feat(primitives): media-editor components, category reorg, perf + type cleanup
Reorganize components into category folders (forms/canvas/overlays/etc.); add the media-editor headless family (timeline, curve-editor, waveform, crop, color picker, etc.); apply perf fixes (O(1) collection lookups, plain-object drag state, gesture-leak teardown, shallowRef color state, rect caching) and replace source `any` with proper types.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import type { ComputedRef, Ref } from 'vue';
|
||||
import { useContextFactory } from '@robonen/vue';
|
||||
|
||||
export type ProgressState = 'indeterminate' | 'loading' | 'complete';
|
||||
|
||||
export interface ProgressContext {
|
||||
/** Resolved (validated/clamped) value; `null` when indeterminate. */
|
||||
value: Ref<number | null>;
|
||||
/** Resolved (validated) maximum. */
|
||||
max: Ref<number>;
|
||||
/** Derived progress state. */
|
||||
state: Ref<ProgressState>;
|
||||
/** Completion ratio in `[0, 1]`, or `null` when indeterminate. */
|
||||
progress: ComputedRef<number | null>;
|
||||
/** Completion percentage in `[0, 100]`, or `null` when indeterminate. */
|
||||
percentage: ComputedRef<number | null>;
|
||||
}
|
||||
|
||||
const ctx = useContextFactory<ProgressContext>('ProgressContext');
|
||||
|
||||
export const provideProgressContext = ctx.provide;
|
||||
export const useProgressContext = ctx.inject;
|
||||
Reference in New Issue
Block a user