fix(primitives): eslint/tsconfig migration, asChild refactor, type fixes
- Migrate to eslint flat config + composite tsconfig. - Complete the asChild→as="template" refactor (remove asChild prop + :as-child bindings across components, matching Primitive's slot model). - Fix test type errors and source type-safety (useGraceArea hull/point math, FocusScope/util ref typing). Note: ~53 vue-tsc errors remain (HTML attr/event passthrough typing on transparent wrapper components + a couple of duplicate-export naming collisions) — not gated by CI (build/lint/test green); pending a component-attribute-typing design decision.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import type { ComputedRef, Ref } from 'vue';
|
||||
import type { RovingDirection, RovingOrientation } from '../utils/roving-focus';
|
||||
import { useContextFactory } from '@robonen/vue';
|
||||
|
||||
export type ToggleGroupType = 'single' | 'multiple';
|
||||
|
||||
export interface ToggleGroupContext {
|
||||
type: Ref<ToggleGroupType>;
|
||||
value: Ref<string[]>;
|
||||
toggle: (v: string) => void;
|
||||
isPressed: (v: string) => boolean;
|
||||
orientation: Ref<RovingOrientation>;
|
||||
direction: Ref<RovingDirection>;
|
||||
loop: Ref<boolean>;
|
||||
disabled: Ref<boolean>;
|
||||
rovingFocus: Ref<boolean>;
|
||||
/** DOM-ordered items, sourced from the internal Collection. */
|
||||
items: ComputedRef<HTMLElement[]>;
|
||||
onItemKeyDown: (event: KeyboardEvent, el: HTMLElement) => void;
|
||||
}
|
||||
|
||||
const ctx = useContextFactory<ToggleGroupContext>('ToggleGroupContext');
|
||||
|
||||
export const provideToggleGroupContext = ctx.provide;
|
||||
export const useToggleGroupContext = ctx.inject;
|
||||
Reference in New Issue
Block a user