@lovince/ui-vue 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +134 -2
- package/dist/components/accordion.d.ts +197 -0
- package/dist/components/avatar.d.ts +90 -0
- package/dist/components/calendar.d.ts +421 -0
- package/dist/components/carousel.d.ts +293 -0
- package/dist/components/combobox.d.ts +431 -0
- package/dist/components/command.d.ts +252 -0
- package/dist/components/dialog.d.ts +242 -0
- package/dist/components/disclosure.d.ts +120 -0
- package/dist/components/emoji-picker.d.ts +359 -0
- package/dist/components/menu.d.ts +493 -0
- package/dist/components/navigation-menu.d.ts +275 -0
- package/dist/components/number-field.d.ts +202 -0
- package/dist/components/pin-input.d.ts +174 -0
- package/dist/components/popover.d.ts +213 -0
- package/dist/components/progress.d.ts +82 -0
- package/dist/components/radio-group.d.ts +167 -0
- package/dist/components/select.d.ts +418 -0
- package/dist/components/slider.d.ts +222 -0
- package/dist/components/sortable.d.ts +140 -0
- package/dist/components/splitter.d.ts +167 -0
- package/dist/components/tabs.d.ts +183 -0
- package/dist/components/toast.d.ts +192 -0
- package/dist/components/toggle-group.d.ts +205 -0
- package/dist/components/toggles.d.ts +232 -0
- package/dist/components/tooltip.d.ts +370 -0
- package/dist/components/tree.d.ts +147 -0
- package/dist/composables/data-table.d.ts +25 -0
- package/dist/composables/observers.d.ts +42 -0
- package/dist/composables/presence.d.ts +7 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +4094 -0
- package/dist/shared/context.d.ts +2 -0
- package/dist/shared/dismiss.d.ts +17 -0
- package/dist/shared/element.d.ts +6 -0
- package/dist/shared/floating-props.d.ts +27 -0
- package/dist/shared/list.d.ts +17 -0
- package/dist/shared/machine.d.ts +37 -0
- package/dist/shared/parts.d.ts +8 -0
- package/dist/shared/portal.d.ts +34 -0
- package/dist/shared/primitive.d.ts +57 -0
- package/package.json +68 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DismissReason, EffectEvent, EventObject } from '@lovince/ui-headless';
|
|
2
|
+
type Listener = (reason: DismissReason, native: Event) => void;
|
|
3
|
+
export type DismissRelay = {
|
|
4
|
+
/** For `useMachine`'s `beforeSend`: lets a consumer cancel a dismissal before the machine sees it. */
|
|
5
|
+
readonly filter: (event: EventObject | EffectEvent) => boolean;
|
|
6
|
+
/** The content part registers how it reports dismissals (its emits). */
|
|
7
|
+
readonly listen: (listener: Listener) => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Consumers hear about a dismissal first — `escapeKeyDown`,
|
|
11
|
+
* `pointerDownOutside`, `focusOutside` — and may cancel it with
|
|
12
|
+
* `preventDefault()`. An Escape that does dismiss is marked handled, so
|
|
13
|
+
* nothing beneath the layer reacts to it too.
|
|
14
|
+
*/
|
|
15
|
+
export declare const createDismissRelay: () => DismissRelay;
|
|
16
|
+
export declare const dismissEmit: (reason: DismissReason) => "escapeKeyDown" | "pointerDownOutside" | "focusOutside";
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentPublicInstance, Ref } from 'vue';
|
|
2
|
+
export type ElementRef = Ref<HTMLElement | ComponentPublicInstance | null | undefined>;
|
|
3
|
+
/** The DOM element behind a template ref, whether it points at an element or a component. */
|
|
4
|
+
export declare const toElement: (target: ElementRef | HTMLElement | null | undefined) => HTMLElement | null;
|
|
5
|
+
/** Calls `onChange` with the element's real id whenever it differs from the expected one. */
|
|
6
|
+
export declare const useIdWatch: (target: ElementRef | (() => HTMLElement | null), expected: () => string, onChange: (id: string) => void) => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { Align, Side } from '@lovince/ui-headless';
|
|
3
|
+
/** Placement props every floating part takes; the content syncs them into its machine. */
|
|
4
|
+
export declare const floatingProps: {
|
|
5
|
+
readonly side: {
|
|
6
|
+
readonly type: PropType<Side>;
|
|
7
|
+
readonly default: "bottom";
|
|
8
|
+
readonly validator: (value: string) => boolean;
|
|
9
|
+
};
|
|
10
|
+
readonly align: {
|
|
11
|
+
readonly type: PropType<Align>;
|
|
12
|
+
readonly default: "center";
|
|
13
|
+
readonly validator: (value: string) => boolean;
|
|
14
|
+
};
|
|
15
|
+
readonly sideOffset: {
|
|
16
|
+
readonly type: NumberConstructor;
|
|
17
|
+
readonly default: 4;
|
|
18
|
+
};
|
|
19
|
+
readonly collisionPadding: {
|
|
20
|
+
readonly type: NumberConstructor;
|
|
21
|
+
readonly default: 8;
|
|
22
|
+
};
|
|
23
|
+
readonly avoidCollisions: {
|
|
24
|
+
readonly type: BooleanConstructor;
|
|
25
|
+
readonly default: true;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ListEnv } from '@lovince/ui-headless';
|
|
2
|
+
import { ElementRef } from './element';
|
|
3
|
+
export type ListBinding = ListEnv & {
|
|
4
|
+
/** Spread onto each item so it is found in DOM order. */
|
|
5
|
+
readonly itemAttrs: Readonly<Record<string, string>>;
|
|
6
|
+
/** Items call this as they mount and unmount, so connect re-reads the list. */
|
|
7
|
+
readonly track: () => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The list environment a connect function needs, read from the DOM. A DOM
|
|
11
|
+
* query is not reactive, so items announce themselves and a version counter
|
|
12
|
+
* makes every reader recompute — the default tab stop appears once items exist.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useListEnv: (container: ElementRef, options?: {
|
|
15
|
+
readonly includeHidden?: boolean;
|
|
16
|
+
readonly label?: "text" | "tree";
|
|
17
|
+
}) => ListBinding;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component, ShallowRef } from 'vue';
|
|
2
|
+
import { DomQuery, EffectEvent, EventObject, Machine, PartProps, Service, Snapshot } from '@lovince/ui-headless';
|
|
3
|
+
export type Controlled<C> = {
|
|
4
|
+
readonly [K in keyof C]?: () => C[K] | undefined;
|
|
5
|
+
};
|
|
6
|
+
export type UseMachineOptions<S extends string, C, E extends EventObject> = {
|
|
7
|
+
/** Controlled context: a getter per field, `undefined` meaning the machine owns it. */
|
|
8
|
+
readonly controlled?: Controlled<C>;
|
|
9
|
+
/** Reacts to accepted changes — typically emitting `update:*`. */
|
|
10
|
+
readonly onChange?: (next: Snapshot<S, C>, previous: Snapshot<S, C>) => void;
|
|
11
|
+
/** Runs before any event reaches the machine, effects' included; return false to drop it (a cancelled dismissal). */
|
|
12
|
+
readonly beforeSend?: (event: E | EffectEvent) => boolean;
|
|
13
|
+
};
|
|
14
|
+
export type MachineBinding<S extends string, C, E extends EventObject> = {
|
|
15
|
+
readonly snapshot: ShallowRef<Snapshot<S, C>>;
|
|
16
|
+
readonly send: (event: E | EffectEvent) => void;
|
|
17
|
+
readonly sync: (partial: Partial<C>) => void;
|
|
18
|
+
/** Call when a part that an effect needs has mounted. */
|
|
19
|
+
readonly refresh: () => void;
|
|
20
|
+
/** The page's facts for `connect` — measured by the DOM layer, never by the adapter. */
|
|
21
|
+
readonly query: DomQuery;
|
|
22
|
+
readonly service: Service<S, C, E>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Runs an engine machine inside a component. The machine decides; this only
|
|
26
|
+
* subscribes, feeds controlled props in, and plugs in the DOM layer's effect
|
|
27
|
+
* handlers. Effects start on mount, so a server render runs none.
|
|
28
|
+
*/
|
|
29
|
+
export declare const useMachine: <S extends string, C, E extends EventObject>(machine: Machine<S, C, E>, context: NoInfer<C>, options?: UseMachineOptions<S, C, E>) => MachineBinding<S, C, E>;
|
|
30
|
+
/**
|
|
31
|
+
* Engine part props in Vue's terms. Handlers are named like DOM events in the
|
|
32
|
+
* engine (`onKeyDown`) and Vue wants them lower-cased after `on`
|
|
33
|
+
* (`onKeydown`), or it listens for `key-down`. `false` is dropped, since Vue
|
|
34
|
+
* would render `disabled="false"` on a non-button, which still disables it.
|
|
35
|
+
* The engine's `type: 'button'` applies only when the part renders a button.
|
|
36
|
+
*/
|
|
37
|
+
export declare const normalizeProps: (props: PartProps, as?: string | Component) => Record<string, unknown>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
import { ariaChecked, openState, CheckedState } from '@lovince/ui-headless';
|
|
3
|
+
/** Injects a compound component's context, failing loudly when a part is used outside its root. */
|
|
4
|
+
export declare const useContext: <T>(key: InjectionKey<T>, part: string, root: string) => T;
|
|
5
|
+
export { Portal } from './portal';
|
|
6
|
+
export { ariaChecked, openState, type CheckedState };
|
|
7
|
+
export declare const checkedState: (checked: CheckedState) => "checked" | "unchecked" | "indeterminate";
|
|
8
|
+
export declare const dataFlag: (on: boolean) => "" | undefined;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Teleports its content, but only once mounted. A server render never emits
|
|
4
|
+
* content for a `body` target, so hydrating a Teleport there finds no anchors
|
|
5
|
+
* and Vue removes the siblings it mistakes for teleported nodes — the whole
|
|
6
|
+
* app root included. Rendering nothing until mounted keeps server and client
|
|
7
|
+
* in agreement; overlays are closed on first render, so nothing is lost.
|
|
8
|
+
*/
|
|
9
|
+
export declare const Portal: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
10
|
+
to: {
|
|
11
|
+
type: PropType<string | HTMLElement>;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
/** Render in place instead of teleporting. */
|
|
15
|
+
disabled: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: boolean;
|
|
18
|
+
};
|
|
19
|
+
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}> | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
22
|
+
to: {
|
|
23
|
+
type: PropType<string | HTMLElement>;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
/** Render in place instead of teleporting. */
|
|
27
|
+
disabled: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
31
|
+
}>> & Readonly<{}>, {
|
|
32
|
+
to: string | HTMLElement;
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Component, PropType, VNode } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Renders its single child with this component's attributes merged in:
|
|
4
|
+
* classes and styles concatenate, handlers chain, and for any other attribute
|
|
5
|
+
* the child's own value wins, because it is what the consumer wrote. This is
|
|
6
|
+
* what `asChild` means — behaviour attaches to your element, not a wrapper.
|
|
7
|
+
*/
|
|
8
|
+
export declare const Slot: import('vue').DefineComponent<{}, () => VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}> | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
11
|
+
export declare const primitiveProps: {
|
|
12
|
+
readonly as: {
|
|
13
|
+
readonly type: PropType<string | Component>;
|
|
14
|
+
readonly default: "div";
|
|
15
|
+
};
|
|
16
|
+
readonly asChild: {
|
|
17
|
+
readonly type: BooleanConstructor;
|
|
18
|
+
readonly default: false;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare const buttonPrimitiveProps: {
|
|
22
|
+
readonly as: {
|
|
23
|
+
readonly default: "button";
|
|
24
|
+
readonly type: PropType<string | Component>;
|
|
25
|
+
};
|
|
26
|
+
readonly asChild: {
|
|
27
|
+
readonly type: BooleanConstructor;
|
|
28
|
+
readonly default: false;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/** A polymorphic element: `as` swaps the tag or component, `asChild` renders the child instead. */
|
|
32
|
+
export declare const Primitive: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
33
|
+
readonly as: {
|
|
34
|
+
readonly type: PropType<string | Component>;
|
|
35
|
+
readonly default: "div";
|
|
36
|
+
};
|
|
37
|
+
readonly asChild: {
|
|
38
|
+
readonly type: BooleanConstructor;
|
|
39
|
+
readonly default: false;
|
|
40
|
+
};
|
|
41
|
+
}>, () => VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
44
|
+
readonly as: {
|
|
45
|
+
readonly type: PropType<string | Component>;
|
|
46
|
+
readonly default: "div";
|
|
47
|
+
};
|
|
48
|
+
readonly asChild: {
|
|
49
|
+
readonly type: BooleanConstructor;
|
|
50
|
+
readonly default: false;
|
|
51
|
+
};
|
|
52
|
+
}>> & Readonly<{}>, {
|
|
53
|
+
readonly as: string | Component;
|
|
54
|
+
readonly asChild: boolean;
|
|
55
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
56
|
+
/** `type="button"` only when the part really renders a button, so a form never submits by accident. */
|
|
57
|
+
export declare const buttonType: (as: string | Component) => "button" | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovince/ui-vue",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Accessible headless Vue 3 components for Lovince UI — Disclosure, Checkbox, Tabs and Dialog, unstyled.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Lovince Tech",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Mac254/Lovince_product_journey.git",
|
|
11
|
+
"directory": "packages/ui-vue"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/Mac254/Lovince_product_journey#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/Mac254/Lovince_product_journey/issues"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"module": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18"
|
|
28
|
+
},
|
|
29
|
+
"browserslist": [
|
|
30
|
+
"last 2 Chrome versions",
|
|
31
|
+
"last 2 Edge versions",
|
|
32
|
+
"last 2 Firefox versions",
|
|
33
|
+
"last 2 Safari versions",
|
|
34
|
+
"iOS >= 15",
|
|
35
|
+
"not dead"
|
|
36
|
+
],
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"vue",
|
|
42
|
+
"vue3",
|
|
43
|
+
"nuxt",
|
|
44
|
+
"headless",
|
|
45
|
+
"headless-ui",
|
|
46
|
+
"components",
|
|
47
|
+
"accessibility",
|
|
48
|
+
"wai-aria",
|
|
49
|
+
"dialog",
|
|
50
|
+
"tabs"
|
|
51
|
+
],
|
|
52
|
+
"exports": {
|
|
53
|
+
".": {
|
|
54
|
+
"types": "./dist/index.d.ts",
|
|
55
|
+
"import": "./dist/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./package.json": "./package.json"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "vite build",
|
|
61
|
+
"typecheck": "vue-tsc --noEmit"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@lovince/ui-headless": "^0.1.0",
|
|
65
|
+
"@lovince/ui-dom": "^0.1.0"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"vue": "^3.5.0"
|
|
69
|
+
}
|
|
70
|
+
}
|