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,43 @@
|
||||
import type { ComputedRef, Ref } from 'vue';
|
||||
import { useContextFactory } from '@robonen/vue';
|
||||
|
||||
export type StepperOrientation = 'horizontal' | 'vertical';
|
||||
export type StepperDirection = 'ltr' | 'rtl';
|
||||
export type StepperState = 'completed' | 'active' | 'inactive';
|
||||
|
||||
export interface StepperRootContext {
|
||||
/** Currently active step (1-based). */
|
||||
value: Ref<number>;
|
||||
/** Total registered items, tracked through the Collection. */
|
||||
total: ComputedRef<number>;
|
||||
/** Orientation of the stepper — drives arrow-key axis. */
|
||||
orientation: Ref<StepperOrientation>;
|
||||
/** Writing direction. */
|
||||
direction: Ref<StepperDirection>;
|
||||
/** When `true`, steps must be completed in order. */
|
||||
linear: Ref<boolean>;
|
||||
/** Whether the whole stepper is disabled. */
|
||||
disabled: Ref<boolean>;
|
||||
|
||||
goToStep: (step: number) => void;
|
||||
onTriggerKeyDown: (event: KeyboardEvent, el: HTMLElement) => void;
|
||||
}
|
||||
|
||||
export interface StepperItemContext {
|
||||
step: Ref<number>;
|
||||
state: Ref<StepperState>;
|
||||
disabled: Ref<boolean>;
|
||||
focusable: Ref<boolean>;
|
||||
titleId: string;
|
||||
descriptionId: string;
|
||||
}
|
||||
|
||||
export const {
|
||||
inject: useStepperRootContext,
|
||||
provide: provideStepperRootContext,
|
||||
} = useContextFactory<StepperRootContext>('stepper');
|
||||
|
||||
export const {
|
||||
inject: useStepperItemContext,
|
||||
provide: provideStepperItemContext,
|
||||
} = useContextFactory<StepperItemContext>('stepper-item');
|
||||
Reference in New Issue
Block a user