@kirana-ui/vue 0.1.0 → 0.2.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/llms.txt +3216 -0
- package/package.json +124 -2
- package/skills/kirana-ui-primitives/SKILL.md +142 -0
- package/src/accordion.d.ts +42 -75
- package/src/accordion.js +4 -2
- package/src/accordion.js.map +1 -1
- package/src/agent.d.ts +1 -0
- package/src/agent.js +1 -0
- package/src/alert-dialog.d.ts +3 -2
- package/src/autocomplete.d.ts +4 -0
- package/src/autocomplete.js +1 -0
- package/src/autosize.d.ts +12 -0
- package/src/autosize.js +24 -0
- package/src/autosize.js.map +1 -0
- package/src/avatar.d.ts +10 -13
- package/src/avatar.js.map +1 -1
- package/src/button.d.ts +4 -21
- package/src/button.js.map +1 -1
- package/src/calendar.d.ts +73 -0
- package/src/calendar.js +130 -0
- package/src/calendar.js.map +1 -0
- package/src/carousel.d.ts +39 -0
- package/src/carousel.js +75 -0
- package/src/carousel.js.map +1 -0
- package/src/checkbox.d.ts +28 -48
- package/src/checkbox.js +4 -2
- package/src/checkbox.js.map +1 -1
- package/src/collapsible.d.ts +26 -36
- package/src/collapsible.js.map +1 -1
- package/src/combobox.d.ts +147 -0
- package/src/combobox.js +296 -0
- package/src/combobox.js.map +1 -0
- package/src/command.d.ts +46 -0
- package/src/command.js +129 -0
- package/src/command.js.map +1 -0
- package/src/context-menu.d.ts +4 -0
- package/src/context-menu.js +1 -0
- package/src/date-field.d.ts +40 -0
- package/src/date-field.js +81 -0
- package/src/date-field.js.map +1 -0
- package/src/date-picker.d.ts +89 -0
- package/src/date-picker.js +82 -0
- package/src/date-picker.js.map +1 -0
- package/src/dialog.d.ts +77 -78
- package/src/dialog.js +58 -1
- package/src/dialog.js.map +1 -1
- package/src/direction.d.ts +5 -8
- package/src/direction.js.map +1 -1
- package/src/drawer.d.ts +3 -0
- package/src/drawer.js +1 -0
- package/src/element.d.ts +23 -0
- package/src/element.js +90 -0
- package/src/element.js.map +1 -0
- package/src/field.d.ts +63 -45
- package/src/field.js +3 -2
- package/src/field.js.map +1 -1
- package/src/fieldset.d.ts +12 -13
- package/src/fieldset.js.map +1 -1
- package/src/form.d.ts +5 -15
- package/src/form.js.map +1 -1
- package/src/hover-card.d.ts +29 -35
- package/src/hover-card.js.map +1 -1
- package/src/hover-popup.d.ts +27 -38
- package/src/hover-popup.js +45 -26
- package/src/hover-popup.js.map +1 -1
- package/src/index.d.ts +37 -2
- package/src/index.js +26 -2
- package/src/input.d.ts +17 -0
- package/src/input.js +36 -0
- package/src/input.js.map +1 -0
- package/src/label.d.ts +5 -0
- package/src/label.js +18 -0
- package/src/label.js.map +1 -0
- package/src/listbox.d.ts +37 -0
- package/src/listbox.js +104 -0
- package/src/listbox.js.map +1 -0
- package/src/menu.d.ts +179 -0
- package/src/menu.js +235 -0
- package/src/menu.js.map +1 -0
- package/src/menubar-context.d.ts +5 -0
- package/src/menubar-context.js +6 -0
- package/src/menubar-context.js.map +1 -0
- package/src/menubar.d.ts +8 -0
- package/src/menubar.js +34 -0
- package/src/menubar.js.map +1 -0
- package/src/message-scroller.d.ts +26 -0
- package/src/message-scroller.js +34 -0
- package/src/message-scroller.js.map +1 -0
- package/src/meter.d.ts +10 -31
- package/src/meter.js.map +1 -1
- package/src/navigation-menu.d.ts +80 -0
- package/src/navigation-menu.js +118 -0
- package/src/navigation-menu.js.map +1 -0
- package/src/number-field.d.ts +75 -0
- package/src/number-field.js +81 -0
- package/src/number-field.js.map +1 -0
- package/src/otp.d.ts +37 -0
- package/src/otp.js +86 -0
- package/src/otp.js.map +1 -0
- package/src/pagination.d.ts +34 -0
- package/src/pagination.js +70 -0
- package/src/pagination.js.map +1 -0
- package/src/popover.d.ts +64 -35
- package/src/popover.js +34 -6
- package/src/popover.js.map +1 -1
- package/src/primitive.d.ts +21 -0
- package/src/primitive.js +27 -0
- package/src/primitive.js.map +1 -0
- package/src/progress.d.ts +28 -31
- package/src/progress.js.map +1 -1
- package/src/qr-code.d.ts +15 -0
- package/src/qr-code.js +34 -0
- package/src/qr-code.js.map +1 -0
- package/src/radio-group.d.ts +37 -73
- package/src/radio-group.js +4 -2
- package/src/radio-group.js.map +1 -1
- package/src/resizable.d.ts +29 -0
- package/src/resizable.js +62 -0
- package/src/resizable.js.map +1 -0
- package/src/runtime.d.ts +97 -6
- package/src/runtime.js +43 -25
- package/src/runtime.js.map +1 -1
- package/src/scroll-area.d.ts +37 -0
- package/src/scroll-area.js +63 -0
- package/src/scroll-area.js.map +1 -0
- package/src/select.d.ts +91 -116
- package/src/select.js +99 -10
- package/src/select.js.map +1 -1
- package/src/separator.d.ts +4 -9
- package/src/separator.js.map +1 -1
- package/src/slider.d.ts +61 -76
- package/src/slider.js +12 -10
- package/src/slider.js.map +1 -1
- package/src/switch.d.ts +21 -37
- package/src/switch.js +4 -2
- package/src/switch.js.map +1 -1
- package/src/tabs.d.ts +44 -98
- package/src/tabs.js.map +1 -1
- package/src/testing.d.ts +1 -0
- package/src/testing.js +1 -0
- package/src/toast.d.ts +61 -0
- package/src/toast.js +95 -0
- package/src/toast.js.map +1 -0
- package/src/toggle-group.d.ts +10 -0
- package/src/toggle-group.js +46 -0
- package/src/toggle-group.js.map +1 -0
- package/src/toggle.d.ts +9 -25
- package/src/toggle.js +19 -4
- package/src/toggle.js.map +1 -1
- package/src/toolbar-context.d.ts +8 -0
- package/src/toolbar-context.js +8 -0
- package/src/toolbar-context.js.map +1 -0
- package/src/toolbar.d.ts +34 -0
- package/src/toolbar.js +55 -0
- package/src/toolbar.js.map +1 -0
- package/src/tooltip.d.ts +29 -35
- package/src/tooltip.js.map +1 -1
- package/src/value-bar.d.ts +26 -35
- package/src/value-bar.js +10 -3
- package/src/value-bar.js.map +1 -1
package/src/resizable.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useDirectionAround } from "./direction-context.js";
|
|
2
|
+
import { context, controller, optional, partComponent, toSignal } from "./runtime.js";
|
|
3
|
+
import { defined, within } from "@kirana-ui/core";
|
|
4
|
+
import { defineComponent, h, useId } from "vue";
|
|
5
|
+
import { createResizable } from "@kirana-ui/core/resizable";
|
|
6
|
+
// src/resizable.ts
|
|
7
|
+
const scope = context("Resizable");
|
|
8
|
+
const GroupElement = partComponent("ResizableGroupElement", "div", () => scope.use().group);
|
|
9
|
+
const Resizable = {
|
|
10
|
+
Group: defineComponent({
|
|
11
|
+
name: "ResizableGroup",
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
props: {
|
|
14
|
+
orientation: String,
|
|
15
|
+
keyboardStep: Number,
|
|
16
|
+
disabled: Boolean,
|
|
17
|
+
id: String
|
|
18
|
+
},
|
|
19
|
+
emits: ["sizesChange"],
|
|
20
|
+
setup(props, { attrs, slots, emit }) {
|
|
21
|
+
const generated = useId();
|
|
22
|
+
const direction = useDirectionAround();
|
|
23
|
+
scope.provide(controller(within(createResizable, { direction }), () => ({
|
|
24
|
+
id: props.id ?? generated,
|
|
25
|
+
orientation: props.orientation,
|
|
26
|
+
keyboardStep: props.keyboardStep,
|
|
27
|
+
disabled: props.disabled,
|
|
28
|
+
onSizesChange: (sizes, details) => emit("sizesChange", sizes, details)
|
|
29
|
+
})));
|
|
30
|
+
return () => h(GroupElement, attrs, slots);
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
Panel: defineComponent({
|
|
34
|
+
name: "ResizablePanel",
|
|
35
|
+
inheritAttrs: false,
|
|
36
|
+
props: {
|
|
37
|
+
defaultSize: Number,
|
|
38
|
+
minSize: Number,
|
|
39
|
+
maxSize: Number
|
|
40
|
+
},
|
|
41
|
+
setup(props, { attrs, slots }) {
|
|
42
|
+
const options = toSignal(() => ({ ...props }));
|
|
43
|
+
const part = scope.use().panel(() => defined(options.get()));
|
|
44
|
+
const Element = partComponent("ResizablePanelElement", "div", () => part);
|
|
45
|
+
return () => h(Element, attrs, slots);
|
|
46
|
+
}
|
|
47
|
+
}),
|
|
48
|
+
Handle: defineComponent({
|
|
49
|
+
name: "ResizableHandle",
|
|
50
|
+
inheritAttrs: false,
|
|
51
|
+
props: { disabled: optional(Boolean) },
|
|
52
|
+
setup(props, { attrs, slots }) {
|
|
53
|
+
const options = toSignal(() => ({ disabled: props.disabled }));
|
|
54
|
+
const part = scope.use().handle(() => defined(options.get()));
|
|
55
|
+
const Element = partComponent("ResizableHandleElement", "div", () => part);
|
|
56
|
+
return () => h(Element, attrs, slots);
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
};
|
|
60
|
+
export { Resizable };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=resizable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizable.js","names":[],"sources":["../../../../packages/vue/src/resizable.ts"],"sourcesContent":["import { defined, within } from \"@kirana-ui/core\"\nimport type { ChangeDetails, Orientation } from \"@kirana-ui/core\"\nimport { createResizable } from \"@kirana-ui/core/resizable\"\nimport type {\n Resizable as Controller,\n ResizablePanelOptions,\n ResizableProps,\n} from \"@kirana-ui/core/resizable\"\nimport { defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, optional, partComponent, toSignal } from \"./runtime.ts\"\nimport type { PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"resizable\">\n\nconst scope = context<Controller>(\"Resizable\")\n\nconst GroupElement = partComponent(\"ResizableGroupElement\", \"div\", () => scope.use().group)\n\nexport type GroupProps = Omit<ResizableProps, \"id\" | \"onSizesChange\"> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type GroupEmits = {\n /** The panels were resized: each one's share, in order. */\n sizesChange: (sizes: number[], details: ChangeDetails) => void\n}\n\n/** `@sizes-change=\"(sizes, details) => …\"` as the panels are resized. */\nconst Group = defineComponent({\n name: \"ResizableGroup\",\n inheritAttrs: false,\n props: {\n orientation: String as PropType<Orientation>,\n keyboardStep: Number,\n disabled: Boolean,\n id: String,\n },\n emits: [\"sizesChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createResizable, { direction }), () => ({\n id: props.id ?? generated,\n orientation: props.orientation,\n keyboardStep: props.keyboardStep,\n disabled: props.disabled,\n onSizesChange: (sizes: number[], details: ChangeDetails) =>\n emit(\"sizesChange\", sizes, details),\n }))\n )\n return () => h(GroupElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"group\"], GroupProps, GroupEmits>\n\nexport interface PanelProps extends ResizablePanelOptions, PartComponentProps {}\n\nconst Panel = defineComponent({\n name: \"ResizablePanel\",\n inheritAttrs: false,\n props: { defaultSize: Number, minSize: Number, maxSize: Number },\n setup(props, { attrs, slots }) {\n const options = toSignal(() => ({ ...props }))\n const part = scope.use().panel(() => defined(options.get()))\n const Element = partComponent(\"ResizablePanelElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"panel\"], PanelProps>\n\nexport interface HandleProps extends PartComponentProps {\n disabled?: boolean | undefined\n}\n\nconst Handle = defineComponent({\n name: \"ResizableHandle\",\n inheritAttrs: false,\n props: { disabled: optional(Boolean) },\n setup(props, { attrs, slots }) {\n const options = toSignal(() => ({ disabled: props.disabled }))\n const part = scope.use().handle(() => defined(options.get()))\n const Element = partComponent(\"ResizableHandleElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"handle\"], HandleProps>\n\nexport const Resizable = { Group, Panel, Handle }\n"],"mappings":";;;;;;AAiBA,MAAM,QAAQ,QAAoB,WAAW;AAE7C,MAAM,eAAe,cAAc,yBAAyB,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;AAqE1F,MAAa,YAAY;CAAE,OAzDb,gBAAgB;EAC5B,MAAM;EACN,cAAc;EACd,OAAO;GACL,aAAa;GACb,cAAc;GACd,UAAU;GACV,IAAI;EACN;EACA,OAAO,CAAC,aAAa;EACr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angeDetails, Part, PartDefinition, PartEvent, PartState, ReadonlySignal, StateOf } from "@kirana-ui/core";
|
|
3
|
+
import { DefineSetupFnComponent, HTMLAttributes, IntrinsicElementAttributes, ObjectEmitsOptions, PublicProps, ShallowRef, SlotsType, VNode } from "vue";
|
|
4
|
+
import { Vocabulary } from "@kirana-ui/core/vocabulary";
|
|
3
5
|
/** A core signal as a Vue ref, read-only: tracked by whatever reads `.value`. */
|
|
4
6
|
export declare function fromSignal<T>(source: ReadonlySignal<T>): Readonly<ShallowRef<T>>;
|
|
5
7
|
/** A core signal that follows Vue state: the core hears a changed prop as it changes. */
|
|
@@ -13,17 +15,106 @@ export declare function context<C>(name: string): {
|
|
|
13
15
|
provide(controller: C): C;
|
|
14
16
|
use(): C;
|
|
15
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* The state of each part of a component, by their names in the vocabulary: what a part's
|
|
20
|
+
* `data-*` attributes say, and what its default slot is given as `state`.
|
|
21
|
+
*/
|
|
22
|
+
export type StatesOf<Name extends keyof Vocabulary> = { [Each in keyof Vocabulary[Name]]: Vocabulary[Name][Each] extends (infer Definition extends PartDefinition) ? StateOf<Definition> : never; };
|
|
23
|
+
/** What every part takes besides its own props and its element's attributes. */
|
|
24
|
+
export interface PartComponentProps {
|
|
25
|
+
/** Another tag for the part's element (`as="a"`): its attributes are then that tag's. */
|
|
26
|
+
as?: string | undefined;
|
|
27
|
+
/** Draws the element in the part's slot in place of the part's own: it takes the part's props. */
|
|
28
|
+
asChild?: boolean | undefined;
|
|
29
|
+
}
|
|
30
|
+
type Hearing<Prop> = Prop extends ((event: infer Heard) => infer Answer) ? Heard extends Event ? (event: PartEvent<Heard>) => Answer : Prop : Prop;
|
|
31
|
+
type Heard<Attributes> = { [Name in keyof Attributes]: Hearing<Attributes[Name]>; };
|
|
32
|
+
/**
|
|
33
|
+
* What the element of a tag takes, listeners included (`onClick` is `@click`, its event a
|
|
34
|
+
* `MouseEvent` with `preventKiranaHandler()`, which keeps the part's own listener out of it):
|
|
35
|
+
* Vue's own attributes for the tag, a plain element's for a tag Vue does not know, and any
|
|
36
|
+
* `data-*` attribute.
|
|
37
|
+
*/
|
|
38
|
+
export type ElementAttributes<Tag extends string> = Heard<Tag extends keyof IntrinsicElementAttributes ? IntrinsicElementAttributes[Tag] : HTMLAttributes> & {
|
|
39
|
+
[name: `data${string}`]: unknown;
|
|
40
|
+
};
|
|
41
|
+
/** A component's events as the listeners among its props: `openChange` is `onOpenChange`. */
|
|
42
|
+
export type Listeners<Emits> = { [Name in keyof Emits & string as `on${Capitalize<Name>}`]?: Emits[Name]; };
|
|
43
|
+
/**
|
|
44
|
+
* The two events of a value its caller may hold: `update:open`, which `v-model:open` hears,
|
|
45
|
+
* and `openChange`, which also carries the details and may cancel the change.
|
|
46
|
+
*/
|
|
47
|
+
export type Changes<Name extends string, Value, Details = ChangeDetails> = { [Event in `update:${Name}`]: (value: Value) => void; } & { [Event in `${Name}Change`]: (value: Value, details: Details) => void; };
|
|
48
|
+
/**
|
|
49
|
+
* What a caller may hand a part drawn as `Tag`: the part's own props, a listener for each of
|
|
50
|
+
* its events, and what the element takes. A prop or an event of the part's that an attribute
|
|
51
|
+
* of the element shares a name with (`value`, `disabled`, `onSelect`) is the part's.
|
|
52
|
+
*/
|
|
53
|
+
export type PartGiven<Tag extends string, Props, Emits = {}> = Props & {
|
|
54
|
+
as?: Tag | undefined;
|
|
55
|
+
} & Listeners<Emits> & Omit<ElementAttributes<Tag>, keyof Props | keyof Listeners<Emits>>;
|
|
56
|
+
/** A component's default slot, given `Slot`. */
|
|
57
|
+
export type DefaultSlot<Slot> = SlotsType<{
|
|
58
|
+
default?: (props: Slot) => VNode[];
|
|
59
|
+
}>;
|
|
60
|
+
/** A part's instance, as Vue's own tools read a component: its props, its events, its slot. */
|
|
61
|
+
export type PartInstance<Tag extends string, Props, Emits extends ObjectEmitsOptions, Slot> = InstanceType<DefineSetupFnComponent<PartGiven<Tag, Props, Emits>, Emits, DefaultSlot<Slot>, PartGiven<Tag, Props, Emits>>>;
|
|
62
|
+
/**
|
|
63
|
+
* A part as its callers see it. `Tag` is the element it draws, and `as` another: the part
|
|
64
|
+
* takes the attributes and listeners of whichever it is. `State` is what its default slot is
|
|
65
|
+
* given as `state` (`StateOf` its entry in the vocabulary), with `Given` beside it when the
|
|
66
|
+
* part hands its slot more. `Props` are the part's own, `Emits` its events with their payloads.
|
|
67
|
+
*
|
|
68
|
+
* A part whose value has a type of its caller's (a root with `value`) writes the same
|
|
69
|
+
* signature out with that type as a parameter: `new <Value, As extends string = "div">(props:
|
|
70
|
+
* PartGiven<As, RootProps<Value>, RootEmits<Value>> & PublicProps) => PartInstance<…>`.
|
|
71
|
+
*/
|
|
72
|
+
export type PartComponent<Tag extends string, State = PartState, Props = PartComponentProps, Emits extends ObjectEmitsOptions = {}, Given = unknown> = new <As extends string = Tag>(props: PartGiven<As, Props, Emits> & PublicProps) => PartInstance<As, Props, Emits, {
|
|
73
|
+
state: State;
|
|
74
|
+
} & Given>;
|
|
75
|
+
/**
|
|
76
|
+
* A component that draws no element of its own (a root that only provides, a portal, a list
|
|
77
|
+
* that draws its slot once for each entry): its props, its events, what its slot is given.
|
|
78
|
+
*/
|
|
79
|
+
export type PlainComponent<Props = {}, Emits extends ObjectEmitsOptions = {}, Slot = {}> = DefineSetupFnComponent<Props & Listeners<Emits>, Emits, DefaultSlot<Slot>, Props & Listeners<Emits>>;
|
|
80
|
+
/** The instance of a `PlainComponent`, for one whose value has a type of its caller's. */
|
|
81
|
+
export type PlainInstance<Props, Emits extends ObjectEmitsOptions, Slot> = InstanceType<PlainComponent<Props, Emits, Slot>>;
|
|
82
|
+
/**
|
|
83
|
+
* A component's instance as its element: its root, or with several roots the first element
|
|
84
|
+
* after the fragment's own mark.
|
|
85
|
+
*/
|
|
86
|
+
export declare function elementOf(instance: unknown): Element | null;
|
|
16
87
|
/**
|
|
17
88
|
* A part as a component: its element (`as`, the part's own tag by default), or with `as-child`
|
|
18
|
-
* the caller's own element in its slot, which takes the part's props
|
|
19
|
-
*
|
|
89
|
+
* the caller's own element in its slot, which takes the part's props, and the part's DOM work
|
|
90
|
+
* attached to the element. Three layers of props, lowest first: the attributes on the part,
|
|
91
|
+
* the slotted element's own, the part's. A higher layer wins an attribute; classes join;
|
|
92
|
+
* styles are merged; every listener of an event runs, lowest first, and
|
|
93
|
+
* `event.preventKiranaHandler()` in a caller's stops the part's. The default slot is given the
|
|
94
|
+
* part's state (`{ state }`: `open`, `side` …, read from its `data-*` attributes), typed by
|
|
95
|
+
* `State`. `hold` is for a part that keeps something of its own in its element (a hidden
|
|
96
|
+
* input, the text it writes: `written`): it is given the content and returns what the element
|
|
97
|
+
* holds, whoever drew the element.
|
|
98
|
+
*/
|
|
99
|
+
export declare function partComponent<Tag extends string, State = PartState>(name: string, tag: Tag, resolve: () => Part, hold?: Hold): PartComponent<Tag, State>;
|
|
100
|
+
/** What `PortalProvider` takes. */
|
|
101
|
+
export interface PortalProviderProps {
|
|
102
|
+
/** Where the popups are drawn; `<body>` when left out, or while there is none. */
|
|
103
|
+
container?: HTMLElement | null | undefined;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Says where every popup inside it is drawn, the popups those open included: an element of
|
|
107
|
+
* the page (a shadow root's host, a full-screen element) in place of `<body>`.
|
|
20
108
|
*/
|
|
21
|
-
export declare
|
|
109
|
+
export declare const PortalProvider: PlainComponent<PortalProviderProps>;
|
|
110
|
+
/** A portal takes nothing: where it is drawn is its `PortalProvider`'s to say. */
|
|
111
|
+
export type PortalProps = Record<never, never>;
|
|
22
112
|
/** Its slot in a container at the end of the page, while `mounted`. */
|
|
23
|
-
export declare function portalComponent(name: string, mounted: () => ReadonlySignal<boolean>):
|
|
113
|
+
export declare function portalComponent(name: string, mounted: () => ReadonlySignal<boolean>): PlainComponent<PortalProps>;
|
|
24
114
|
/** A prop that is "not given" when absent, where Vue would make a boolean `false`. */
|
|
25
115
|
export declare const optional: <T>(type: T) => {
|
|
26
116
|
type: T;
|
|
27
117
|
default: undefined;
|
|
28
118
|
};
|
|
119
|
+
export { type Hold, type PartEvent, written };
|
|
29
120
|
//# sourceMappingURL=runtime.d.ts.map
|
package/src/runtime.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { draw, written } from "./element.js";
|
|
2
|
+
import { sameProps, signal, stateOf } from "@kirana-ui/core";
|
|
3
|
+
import { Teleport, defineComponent, h, inject, onBeforeUnmount, onMounted, onScopeDispose, provide, queuePostFlushCb, shallowRef, watchEffect } from "vue";
|
|
3
4
|
// src/runtime.ts
|
|
4
5
|
/** A core signal as a Vue ref, read-only: tracked by whatever reads `.value`. */
|
|
5
6
|
function fromSignal(source) {
|
|
@@ -52,19 +53,28 @@ function toVue(props) {
|
|
|
52
53
|
}
|
|
53
54
|
return out;
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
/**
|
|
57
|
+
* A component's instance as its element: its root, or with several roots the first element
|
|
58
|
+
* after the fragment's own mark.
|
|
59
|
+
*/
|
|
60
|
+
function elementOf(instance) {
|
|
61
|
+
let found = instance?.$el ?? null;
|
|
62
|
+
while (found && found.nodeType !== 1) found = found.nextSibling;
|
|
63
|
+
return found;
|
|
61
64
|
}
|
|
62
65
|
/**
|
|
63
66
|
* A part as a component: its element (`as`, the part's own tag by default), or with `as-child`
|
|
64
|
-
* the caller's own element in its slot, which takes the part's props
|
|
65
|
-
*
|
|
67
|
+
* the caller's own element in its slot, which takes the part's props, and the part's DOM work
|
|
68
|
+
* attached to the element. Three layers of props, lowest first: the attributes on the part,
|
|
69
|
+
* the slotted element's own, the part's. A higher layer wins an attribute; classes join;
|
|
70
|
+
* styles are merged; every listener of an event runs, lowest first, and
|
|
71
|
+
* `event.preventKiranaHandler()` in a caller's stops the part's. The default slot is given the
|
|
72
|
+
* part's state (`{ state }`: `open`, `side` …, read from its `data-*` attributes), typed by
|
|
73
|
+
* `State`. `hold` is for a part that keeps something of its own in its element (a hidden
|
|
74
|
+
* input, the text it writes: `written`): it is given the content and returns what the element
|
|
75
|
+
* holds, whoever drew the element.
|
|
66
76
|
*/
|
|
67
|
-
function partComponent(name, tag, resolve) {
|
|
77
|
+
function partComponent(name, tag, resolve, hold) {
|
|
68
78
|
return defineComponent({
|
|
69
79
|
name,
|
|
70
80
|
inheritAttrs: false,
|
|
@@ -88,35 +98,43 @@ function partComponent(name, tag, resolve) {
|
|
|
88
98
|
detach = wanted ? part.attach(wanted) : void 0;
|
|
89
99
|
};
|
|
90
100
|
const attach = (target) => {
|
|
91
|
-
|
|
101
|
+
const found = target instanceof HTMLElement ? target : elementOf(target);
|
|
102
|
+
wanted = found instanceof HTMLElement ? found : null;
|
|
92
103
|
if (wanted) queuePostFlushCb(sync);
|
|
93
104
|
else sync();
|
|
94
105
|
};
|
|
95
|
-
return () => {
|
|
96
|
-
const merged = {
|
|
97
|
-
...mergeProps(attrs, toVue(own.value)),
|
|
98
|
-
ref: attach
|
|
99
|
-
};
|
|
100
|
-
if (props.asChild) {
|
|
101
|
-
const child = firstElement(slots.default?.());
|
|
102
|
-
return child ? cloneVNode(child, merged, true) : null;
|
|
103
|
-
}
|
|
104
|
-
return h(props.as, merged, slots.default?.());
|
|
105
|
-
};
|
|
106
|
+
return () => draw(props.as, props.asChild, attrs, slots.default?.({ state: stateOf(own.value) }), toVue(own.value), attach, hold);
|
|
106
107
|
}
|
|
107
108
|
});
|
|
108
109
|
}
|
|
110
|
+
const PORTAL_CONTAINER = Symbol("PortalContainer");
|
|
111
|
+
/**
|
|
112
|
+
* Says where every popup inside it is drawn, the popups those open included: an element of
|
|
113
|
+
* the page (a shadow root's host, a full-screen element) in place of `<body>`.
|
|
114
|
+
*/
|
|
115
|
+
const PortalProvider = defineComponent({
|
|
116
|
+
name: "PortalProvider",
|
|
117
|
+
props: { container: {
|
|
118
|
+
type: null,
|
|
119
|
+
default: void 0
|
|
120
|
+
} },
|
|
121
|
+
setup(props, { slots }) {
|
|
122
|
+
provide(PORTAL_CONTAINER, () => props.container);
|
|
123
|
+
return () => slots.default?.();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
109
126
|
/** Its slot in a container at the end of the page, while `mounted`. */
|
|
110
127
|
function portalComponent(name, mounted) {
|
|
111
128
|
return defineComponent({
|
|
112
129
|
name,
|
|
113
130
|
setup(_props, { slots }) {
|
|
114
131
|
const shown = fromSignal(mounted());
|
|
132
|
+
const container = inject(PORTAL_CONTAINER, void 0);
|
|
115
133
|
const ready = shallowRef(false);
|
|
116
134
|
onMounted(() => {
|
|
117
135
|
ready.value = true;
|
|
118
136
|
});
|
|
119
|
-
return () => shown.value && ready.value ? h(Teleport, { to: "body" }, h("div", { "data-kirana-portal": "" }, slots.default?.())) : null;
|
|
137
|
+
return () => shown.value && ready.value ? h(Teleport, { to: container?.() ?? "body" }, h("div", { "data-kirana-portal": "" }, slots.default?.())) : null;
|
|
120
138
|
}
|
|
121
139
|
});
|
|
122
140
|
}
|
|
@@ -125,6 +143,6 @@ const optional = (type) => ({
|
|
|
125
143
|
type,
|
|
126
144
|
default: void 0
|
|
127
145
|
});
|
|
128
|
-
export { context, controller, fromSignal, optional, partComponent, portalComponent, toSignal };
|
|
146
|
+
export { PortalProvider, context, controller, elementOf, fromSignal, optional, partComponent, portalComponent, toSignal, written };
|
|
129
147
|
|
|
130
148
|
//# sourceMappingURL=runtime.js.map
|
package/src/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","names":[],"sources":["../../../../packages/vue/src/runtime.ts"],"sourcesContent":["import { mergeProps, sameProps, signal } from \"@kirana-ui/core\"\nimport type { Part, PartProps, ReadonlySignal } from \"@kirana-ui/core\"\nimport {\n Comment,\n Fragment,\n Teleport,\n cloneVNode,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n onScopeDispose,\n provide,\n queuePostFlushCb,\n shallowRef,\n watchEffect,\n} from \"vue\"\nimport type { Component, InjectionKey, ShallowRef, VNode } from \"vue\"\n\n/** A core signal as a Vue ref, read-only: tracked by whatever reads `.value`. */\nexport function fromSignal<T>(source: ReadonlySignal<T>): Readonly<ShallowRef<T>> {\n const ref = shallowRef(source.peek())\n // On a server nothing changes after the first read, and no scope is disposed to unsubscribe.\n if (typeof window !== \"undefined\") {\n onScopeDispose(\n source.subscribe(() => {\n ref.value = source.peek()\n })\n )\n }\n return ref\n}\n\n/** A core signal that follows Vue state: the core hears a changed prop as it changes. */\nexport function toSignal<T extends Record<string, unknown>>(read: () => T): ReadonlySignal<T> {\n const source = signal(read(), sameProps as (a: T, b: T) => boolean)\n watchEffect(() => source.set(read()), { flush: \"sync\" })\n return source\n}\n\n/** A component's controller, made once, following its props. */\nexport function controller<P extends Record<string, unknown>, C extends { mount(): () => void }>(\n create: (props: ReadonlySignal<P>) => C,\n read: () => P\n): C {\n const made = create(toSignal(read))\n let stop: (() => void) | undefined\n onMounted(() => {\n stop = made.mount()\n })\n onBeforeUnmount(() => stop?.())\n return made\n}\n\n/** A controller its parts find: `provide` in the root, `use` in a part. */\nexport function context<C>(name: string): { provide(controller: C): C; use(): C } {\n const key: InjectionKey<C> = Symbol(name)\n return {\n provide(made) {\n provide(key, made)\n return made\n },\n use() {\n const made = inject(key, undefined)\n if (!made) throw new Error(`A ${name} part must be inside <${name}.Root>`)\n return made\n },\n }\n}\n\nfunction toVue(props: PartProps): PartProps {\n const out: PartProps = {}\n for (const key in props) {\n const value = props[key]\n if (typeof value === \"function\") {\n // Vue names an event from the listener's key, so `onKeyDown` would listen for `key-down`:\n // it is `onKeydown`. Focus and blur are the bubbling ones, as in the core.\n const name = key.slice(2).toLowerCase()\n const event = name === \"focus\" ? \"focusin\" : name === \"blur\" ? \"focusout\" : name\n out[`on${event[0]!.toUpperCase()}${event.slice(1)}`] = value\n } else {\n out[key] = value\n }\n }\n return out\n}\n\nfunction firstElement(nodes: VNode[] | undefined): VNode | undefined {\n for (const node of nodes ?? []) {\n if (node.type === Comment) continue\n if (node.type === Fragment) return firstElement(node.children as VNode[])\n return node\n }\n return undefined\n}\n\n/**\n * A part as a component: its element (`as`, the part's own tag by default), or with `as-child`\n * the caller's own element in its slot, which takes the part's props. Either way the caller's\n * attributes are merged under the part's, and the part's DOM work is attached to the element.\n */\nexport function partComponent(name: string, tag: string, resolve: () => Part): Component {\n return defineComponent({\n name,\n inheritAttrs: false,\n props: { as: { type: String, default: tag }, asChild: Boolean },\n setup(props, { attrs, slots }) {\n const part = resolve()\n const own = fromSignal(part.props)\n let element: HTMLElement | null = null\n let detach: (() => void) | undefined\n\n // Vue calls a function ref as soon as the element exists, before the tree it is in reaches\n // the page: the part's DOM work (focus, measures, the starting style) waits for the flush\n // that follows the render, when it is there. An element that leaves detaches at once.\n let wanted: HTMLElement | null = null\n const sync = () => {\n if (wanted === element) return\n detach?.()\n element = wanted\n detach = wanted ? part.attach(wanted) : undefined\n }\n const attach = (target: unknown) => {\n wanted =\n target instanceof HTMLElement\n ? target\n : (((target as { $el?: unknown } | null)?.$el as HTMLElement | undefined) ?? null)\n if (wanted) queuePostFlushCb(sync)\n else sync()\n }\n\n return () => {\n const merged = { ...mergeProps(attrs, toVue(own.value)), ref: attach }\n if (props.asChild) {\n const child = firstElement(slots.default?.())\n return child ? cloneVNode(child, merged, true) : null\n }\n return h(props.as, merged, slots.default?.())\n }\n },\n })\n}\n\n/** Its slot in a container at the end of the page, while `mounted`. */\nexport function portalComponent(name: string, mounted: () => ReadonlySignal<boolean>): Component {\n return defineComponent({\n name,\n setup(_props, { slots }) {\n const shown = fromSignal(mounted())\n // Only in a browser, once the page is in it: a server draws no portal, so hydration must\n // find none either. One that opens later is drawn at once.\n const ready = shallowRef(false)\n onMounted(() => {\n ready.value = true\n })\n return () =>\n shown.value && ready.value\n ? h(Teleport, { to: \"body\" }, h(\"div\", { \"data-kirana-portal\": \"\" }, slots.default?.()))\n : null\n },\n })\n}\n\n/** A prop that is \"not given\" when absent, where Vue would make a boolean `false`. */\nexport const optional = <T>(type: T) => ({ type, default: undefined })\n"],"mappings":";;;;AAqBA,SAAgB,WAAc,QAAoD;CAChF,MAAM,MAAM,WAAW,OAAO,KAAK,CAAC;CAEpC,IAAI,OAAO,WAAW,aACpB,eACE,OAAO,gBAAgB;EACrB,IAAI,QAAQ,OAAO,KAAK;CAC1B,CAAC,CACH;CAEF,OAAO;AACT;;AAGA,SAAgB,SAA4C,MAAkC;CAC5F,MAAM,SAAS,OAAO,KAAK,GAAG,SAAoC;CAClE,kBAAkB,OAAO,IAAI,KAAK,CAAC,GAAG,EAAE,OAAO,OAAO,CAAC;CACvD,OAAO;AACT;;AAGA,SAAgB,WACd,QACA,MACG;CACH,MAAM,OAAO,OAAO,SAAS,IAAI,CAAC;CAClC,IAAI;CACJ,gBAAgB;EACd,OAAO,KAAK,MAAM;CACpB,CAAC;CACD,sBAAsB,OAAO,CAAC;CAC9B,OAAO;AACT;;AAGA,SAAgB,QAAW,MAAuD;CAChF,MAAM,MAAuB,OAAO,IAAI;CACxC,OAAO;EACL,QAAQ,MAAM;GACZ,QAAQ,KAAK,IAAI;GACjB,OAAO;EACT;EACA,MAAM;GACJ,MAAM,OAAO,OAAO,KAAK,KAAA,CAAS;GAClC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,KAAK,KAAK,wBAAwB,KAAK,OAAO;GACzE,OAAO;EACT;CACF;AACF;AAEA,SAAS,MAAM,OAA6B;CAC1C,MAAM,MAAiB,CAAC;CACxB,KAAK,MAAM,OAAO,OAAO;EACvB,MAAM,QAAQ,MAAM;EACpB,IAAI,OAAO,UAAU,YAAY;GAG/B,MAAM,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,YAAY;GACtC,MAAM,QAAQ,SAAS,UAAU,YAAY,SAAS,SAAS,aAAa;GAC5E,IAAI,KAAK,MAAM,EAAE,CAAE,YAAY,IAAI,MAAM,MAAM,CAAC,OAAO;EACzD,OACE,IAAI,OAAO;CAEf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AM,QAAQ;GAChB,CAAC;GACD,aACE,MAAM,SAAS,MAAM,QACjB,EAAE,UAAU,EAAE,IAAI,OAAO,GAAG,EAAE,OAAO,EAAE,sBAAsB,GAAG,GAAG,MAAM,UAAU,CAAC,CAAC,IACrF;EACR;CACF,CAAC;AACH;;AAGA,MAAa,YAAe,UAAa;CAAE;CAAM,SAAS,KAAA;AAAU"}
|
|
1
|
+
{"version":3,"file":"runtime.js","names":[],"sources":["../../../../packages/vue/src/runtime.ts"],"sourcesContent":["import { sameProps, signal, stateOf } from \"@kirana-ui/core\"\nimport type {\n ChangeDetails,\n Part,\n PartDefinition,\n PartEvent,\n PartProps,\n PartState,\n ReadonlySignal,\n StateOf,\n} from \"@kirana-ui/core\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport {\n Teleport,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n onScopeDispose,\n provide,\n queuePostFlushCb,\n shallowRef,\n watchEffect,\n} from \"vue\"\nimport type {\n DefineSetupFnComponent,\n HTMLAttributes,\n InjectionKey,\n IntrinsicElementAttributes,\n ObjectEmitsOptions,\n PropType,\n PublicProps,\n ShallowRef,\n SlotsType,\n VNode,\n} from \"vue\"\n\nimport { draw } from \"./element.ts\"\nimport type { Hold } from \"./element.ts\"\n\nexport { written } from \"./element.ts\"\nexport type { Hold } from \"./element.ts\"\n\n/** A core signal as a Vue ref, read-only: tracked by whatever reads `.value`. */\nexport function fromSignal<T>(source: ReadonlySignal<T>): Readonly<ShallowRef<T>> {\n const ref = shallowRef(source.peek())\n // On a server nothing changes after the first read, and no scope is disposed to unsubscribe.\n if (typeof window !== \"undefined\") {\n onScopeDispose(\n source.subscribe(() => {\n ref.value = source.peek()\n })\n )\n }\n return ref\n}\n\n/** A core signal that follows Vue state: the core hears a changed prop as it changes. */\nexport function toSignal<T extends Record<string, unknown>>(read: () => T): ReadonlySignal<T> {\n const source = signal(read(), sameProps as (a: T, b: T) => boolean)\n watchEffect(() => source.set(read()), { flush: \"sync\" })\n return source\n}\n\n/** A component's controller, made once, following its props. */\nexport function controller<P extends Record<string, unknown>, C extends { mount(): () => void }>(\n create: (props: ReadonlySignal<P>) => C,\n read: () => P\n): C {\n const made = create(toSignal(read))\n let stop: (() => void) | undefined\n onMounted(() => {\n stop = made.mount()\n })\n onBeforeUnmount(() => stop?.())\n return made\n}\n\n/** A controller its parts find: `provide` in the root, `use` in a part. */\nexport function context<C>(name: string): { provide(controller: C): C; use(): C } {\n const key: InjectionKey<C> = Symbol(name)\n return {\n provide(made) {\n provide(key, made)\n return made\n },\n use() {\n const made = inject(key, undefined)\n if (!made) throw new Error(`A ${name} part must be inside <${name}.Root>`)\n return made\n },\n }\n}\n\nfunction toVue(props: PartProps): PartProps {\n const out: PartProps = {}\n for (const key in props) {\n const value = props[key]\n if (typeof value === \"function\") {\n // Vue names an event from the listener's key, so `onKeyDown` would listen for `key-down`:\n // it is `onKeydown`. Focus and blur are the bubbling ones, as in the core.\n const name = key.slice(2).toLowerCase()\n const event = name === \"focus\" ? \"focusin\" : name === \"blur\" ? \"focusout\" : name\n out[`on${event[0]!.toUpperCase()}${event.slice(1)}`] = value\n } else {\n out[key] = value\n }\n }\n return out\n}\n\n/**\n * The state of each part of a component, by their names in the vocabulary: what a part's\n * `data-*` attributes say, and what its default slot is given as `state`.\n */\nexport type StatesOf<Name extends keyof Vocabulary> = {\n [Each in keyof Vocabulary[Name]]: Vocabulary[Name][Each] extends infer Definition extends\n PartDefinition\n ? StateOf<Definition>\n : never\n}\n\n/** What every part takes besides its own props and its element's attributes. */\nexport interface PartComponentProps {\n /** Another tag for the part's element (`as=\"a\"`): its attributes are then that tag's. */\n as?: string | undefined\n /** Draws the element in the part's slot in place of the part's own: it takes the part's props. */\n asChild?: boolean | undefined\n}\n\nexport type { PartEvent }\n\n// A listener takes the event with its `preventKiranaHandler()`; anything else is as it was.\ntype Hearing<Prop> = Prop extends (event: infer Heard) => infer Answer\n ? Heard extends Event\n ? (event: PartEvent<Heard>) => Answer\n : Prop\n : Prop\n\ntype Heard<Attributes> = { [Name in keyof Attributes]: Hearing<Attributes[Name]> }\n\n/**\n * What the element of a tag takes, listeners included (`onClick` is `@click`, its event a\n * `MouseEvent` with `preventKiranaHandler()`, which keeps the part's own listener out of it):\n * Vue's own attributes for the tag, a plain element's for a tag Vue does not know, and any\n * `data-*` attribute.\n */\nexport type ElementAttributes<Tag extends string> = Heard<\n Tag extends keyof IntrinsicElementAttributes ? IntrinsicElementAttributes[Tag] : HTMLAttributes\n> & { [name: `data${string}`]: unknown }\n\n/** A component's events as the listeners among its props: `openChange` is `onOpenChange`. */\nexport type Listeners<Emits> = {\n [Name in keyof Emits & string as `on${Capitalize<Name>}`]?: Emits[Name]\n}\n\n/**\n * The two events of a value its caller may hold: `update:open`, which `v-model:open` hears,\n * and `openChange`, which also carries the details and may cancel the change.\n */\nexport type Changes<Name extends string, Value, Details = ChangeDetails> = {\n [Event in `update:${Name}`]: (value: Value) => void\n} & { [Event in `${Name}Change`]: (value: Value, details: Details) => void }\n\n/**\n * What a caller may hand a part drawn as `Tag`: the part's own props, a listener for each of\n * its events, and what the element takes. A prop or an event of the part's that an attribute\n * of the element shares a name with (`value`, `disabled`, `onSelect`) is the part's.\n */\nexport type PartGiven<Tag extends string, Props, Emits = {}> = Props & {\n as?: Tag | undefined\n} & Listeners<Emits> &\n Omit<ElementAttributes<Tag>, keyof Props | keyof Listeners<Emits>>\n\n/** A component's default slot, given `Slot`. */\nexport type DefaultSlot<Slot> = SlotsType<{ default?: (props: Slot) => VNode[] }>\n\n/** A part's instance, as Vue's own tools read a component: its props, its events, its slot. */\nexport type PartInstance<\n Tag extends string,\n Props,\n Emits extends ObjectEmitsOptions,\n Slot,\n> = InstanceType<\n // Its listeners are the ones `PartGiven` names, each once.\n DefineSetupFnComponent<\n PartGiven<Tag, Props, Emits>,\n Emits,\n DefaultSlot<Slot>,\n PartGiven<Tag, Props, Emits>\n >\n>\n\n/**\n * A part as its callers see it. `Tag` is the element it draws, and `as` another: the part\n * takes the attributes and listeners of whichever it is. `State` is what its default slot is\n * given as `state` (`StateOf` its entry in the vocabulary), with `Given` beside it when the\n * part hands its slot more. `Props` are the part's own, `Emits` its events with their payloads.\n *\n * A part whose value has a type of its caller's (a root with `value`) writes the same\n * signature out with that type as a parameter: `new <Value, As extends string = \"div\">(props:\n * PartGiven<As, RootProps<Value>, RootEmits<Value>> & PublicProps) => PartInstance<…>`.\n */\nexport type PartComponent<\n Tag extends string,\n State = PartState,\n Props = PartComponentProps,\n Emits extends ObjectEmitsOptions = {},\n Given = unknown,\n> = new <As extends string = Tag>(\n props: PartGiven<As, Props, Emits> & PublicProps\n) => PartInstance<As, Props, Emits, { state: State } & Given>\n\n/**\n * A component that draws no element of its own (a root that only provides, a portal, a list\n * that draws its slot once for each entry): its props, its events, what its slot is given.\n */\nexport type PlainComponent<\n Props = {},\n Emits extends ObjectEmitsOptions = {},\n Slot = {},\n> = DefineSetupFnComponent<\n Props & Listeners<Emits>,\n Emits,\n DefaultSlot<Slot>,\n Props & Listeners<Emits>\n>\n\n/** The instance of a `PlainComponent`, for one whose value has a type of its caller's. */\nexport type PlainInstance<Props, Emits extends ObjectEmitsOptions, Slot> = InstanceType<\n PlainComponent<Props, Emits, Slot>\n>\n\n/**\n * A component's instance as its element: its root, or with several roots the first element\n * after the fragment's own mark.\n */\nexport function elementOf(instance: unknown): Element | null {\n let found = (instance as { $el?: Node | null } | null)?.$el ?? null\n while (found && found.nodeType !== 1) found = found.nextSibling\n return found as Element | null\n}\n\n/**\n * A part as a component: its element (`as`, the part's own tag by default), or with `as-child`\n * the caller's own element in its slot, which takes the part's props, and the part's DOM work\n * attached to the element. Three layers of props, lowest first: the attributes on the part,\n * the slotted element's own, the part's. A higher layer wins an attribute; classes join;\n * styles are merged; every listener of an event runs, lowest first, and\n * `event.preventKiranaHandler()` in a caller's stops the part's. The default slot is given the\n * part's state (`{ state }`: `open`, `side` …, read from its `data-*` attributes), typed by\n * `State`. `hold` is for a part that keeps something of its own in its element (a hidden\n * input, the text it writes: `written`): it is given the content and returns what the element\n * holds, whoever drew the element.\n */\nexport function partComponent<Tag extends string, State = PartState>(\n name: string,\n tag: Tag,\n resolve: () => Part,\n hold?: Hold\n): PartComponent<Tag, State> {\n return defineComponent({\n name,\n inheritAttrs: false,\n props: { as: { type: String, default: tag as string }, asChild: Boolean },\n setup(props, { attrs, slots }) {\n const part = resolve()\n const own = fromSignal(part.props)\n let element: HTMLElement | null = null\n let detach: (() => void) | undefined\n\n // Vue calls a function ref as soon as the element exists, before the tree it is in reaches\n // the page: the part's DOM work (focus, measures, the starting style) waits for the flush\n // that follows the render, when it is there. An element that leaves detaches at once.\n let wanted: HTMLElement | null = null\n const sync = () => {\n if (wanted === element) return\n detach?.()\n element = wanted\n detach = wanted ? part.attach(wanted) : undefined\n }\n const attach = (target: unknown) => {\n // On a component (`as-child` over one), the ref is its instance.\n const found = target instanceof HTMLElement ? target : elementOf(target)\n wanted = found instanceof HTMLElement ? found : null\n if (wanted) queuePostFlushCb(sync)\n else sync()\n }\n\n return () =>\n draw(\n props.as,\n props.asChild,\n attrs,\n slots.default?.({ state: stateOf(own.value) }),\n toVue(own.value),\n attach,\n hold\n )\n },\n }) as unknown as PartComponent<Tag, State>\n}\n\nconst PORTAL_CONTAINER: InjectionKey<() => HTMLElement | null | undefined> =\n Symbol(\"PortalContainer\")\n\n/** What `PortalProvider` takes. */\nexport interface PortalProviderProps {\n /** Where the popups are drawn; `<body>` when left out, or while there is none. */\n container?: HTMLElement | null | undefined\n}\n\n/**\n * Says where every popup inside it is drawn, the popups those open included: an element of\n * the page (a shadow root's host, a full-screen element) in place of `<body>`.\n */\nexport const PortalProvider = defineComponent({\n name: \"PortalProvider\",\n props: {\n container: { type: null as unknown as PropType<HTMLElement | null>, default: undefined },\n },\n setup(props, { slots }) {\n provide(PORTAL_CONTAINER, () => props.container)\n return () => slots.default?.()\n },\n}) as unknown as PlainComponent<PortalProviderProps>\n\n/** A portal takes nothing: where it is drawn is its `PortalProvider`'s to say. */\nexport type PortalProps = Record<never, never>\n\n/** Its slot in a container at the end of the page, while `mounted`. */\nexport function portalComponent(\n name: string,\n mounted: () => ReadonlySignal<boolean>\n): PlainComponent<PortalProps> {\n return defineComponent({\n name,\n setup(_props, { slots }) {\n const shown = fromSignal(mounted())\n const container = inject(PORTAL_CONTAINER, undefined)\n // Only in a browser, once the page is in it: a server draws no portal, so hydration must\n // find none either. One that opens later is drawn at once.\n const ready = shallowRef(false)\n onMounted(() => {\n ready.value = true\n })\n return () =>\n shown.value && ready.value\n ? h(\n Teleport,\n { to: container?.() ?? \"body\" },\n h(\"div\", { \"data-kirana-portal\": \"\" }, slots.default?.())\n )\n : null\n },\n }) as unknown as PlainComponent<PortalProps>\n}\n\n/** A prop that is \"not given\" when absent, where Vue would make a boolean `false`. */\nexport const optional = <T>(type: T) => ({ type, default: undefined })\n"],"mappings":";;;;;AA6CA,SAAgB,WAAc,QAAoD;CAChF,MAAM,MAAM,WAAW,OAAO,KAAK,CAAC;CAEpC,IAAI,OAAO,WAAW,aACpB,eACE,OAAO,gBAAgB;EACrB,IAAI,QAAQ,OAAO,KAAK;CAC1B,CAAC,CACH;CAEF,OAAO;AACT;;AAGA,SAAgB,SAA4C,MAAkC;CAC5F,MAAM,SAAS,OAAO,KAAK,GAAG,SAAoC;CAClE,kBAAkB,OAAO,IAAI,KAAK,CAAC,GAAG,EAAE,OAAO,OAAO,CAAC;CACvD,OAAO;AACT;;AAGA,SAAgB,WACd,QACA,MACG;CACH,MAAM,OAAO,OAAO,SAAS,IAAI,CAAC;CAClC,IAAI;CACJ,gBAAgB;EACd,OAAO,KAAK,MAAM;CACpB,CAAC;CACD,sBAAsB,OAAO,CAAC;CAC9B,OAAO;AACT;;AAGA,SAAgB,QAAW,MAAuD;CAChF,MAAM,MAAuB,OAAO,IAAI;CACxC,OAAO;EACL,QAAQ,MAAM;GACZ,QAAQ,KAAK,IAAI;GACjB,OAAO;EACT;EACA,MAAM;G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GACZ;GAEA,aACE,KACE,MAAM,IACN,MAAM,SACN,OACA,MAAM,UAAU,EAAE,OAAO,QAAQ,IAAI,KAAK,EAAE,CAAC,GAC7C,MAAM,IAAI,KAAK,GACf,QACA,IACF;EACJ;CACF,CAAC;AACH;AAEA,MAAM,mBACJ,OAAO,iBAAiB;;;;;AAY1B,MAAa,iBAAiB,gBAAgB;CAC5C,MAAM;CACN,OAAO,EACL,WAAW;EAAE,MAAM;EAAiD,SAAS,KAAA;CAAU,EACzF;CACA,MAAM,OAAO,EAAE,SAAS;EACtB,QAAQ,wBAAwB,MAAM,SAAS;EAC/C,aAAa,MAAM,UAAU;CAC/B;AACF,CAAC;;AAMD,SAAgB,gBACd,MACA,SAC6B;CAC7B,OAAO,gBAAgB;EACrB;EACA,MAAM,QAAQ,EAAE,SAAS;GACvB,MAAM,QAAQ,WAAW,QAAQ,CAAC;GAClC,MAAM,YAAY,OAAO,kBAAkB,KAAA,CAAS;GAGpD,MAAM,QAAQ,WAAW,KAAK;GAC9B,gBAAgB;IACd,MAAM,QAAQ;GAChB,CAAC;GACD,aACE,MAAM,SAAS,MAAM,QACjB,EACE,UACA,EAAE,IAAI,YAAY,KAAK,OAAO,GAC9B,EAAE,OAAO,EAAE,sBAAsB,GAAG,GAAG,MAAM,UAAU,CAAC,CAC1D,IACA;EACR;CACF,CAAC;AACH;;AAGA,MAAa,YAAe,UAAa;CAAE;CAAM,SAAS,KAAA;AAAU"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { PartComponent, PartComponentProps } from "./runtime.js";
|
|
2
|
+
import { Orientation } from "@kirana-ui/core";
|
|
3
|
+
export type RootProps = PartComponentProps;
|
|
4
|
+
export interface ScrollbarProps extends PartComponentProps {
|
|
5
|
+
/** Which way it scrolls; `vertical` when left out. */
|
|
6
|
+
orientation?: Orientation | undefined;
|
|
7
|
+
/** Keeps the bar in the page while there is nothing to scroll that way. */
|
|
8
|
+
keepMounted?: boolean | undefined;
|
|
9
|
+
}
|
|
10
|
+
export type ThumbProps = PartComponentProps;
|
|
11
|
+
export type CornerProps = PartComponentProps;
|
|
12
|
+
export type ViewportProps = PartComponentProps;
|
|
13
|
+
export type ContentProps = PartComponentProps;
|
|
14
|
+
export declare const ScrollArea: {
|
|
15
|
+
Root: PartComponent<"div", {
|
|
16
|
+
readonly hasOverflowX?: true | undefined;
|
|
17
|
+
readonly hasOverflowY?: true | undefined;
|
|
18
|
+
readonly scrolling?: true | undefined;
|
|
19
|
+
readonly hovering?: true | undefined;
|
|
20
|
+
}, PartComponentProps>;
|
|
21
|
+
Viewport: PartComponent<"div", {
|
|
22
|
+
readonly hasOverflowX?: true | undefined;
|
|
23
|
+
readonly hasOverflowY?: true | undefined;
|
|
24
|
+
readonly scrolling?: true | undefined;
|
|
25
|
+
}, PartComponentProps, {}, unknown>;
|
|
26
|
+
Content: PartComponent<"div", Record<never, never>, PartComponentProps, {}, unknown>;
|
|
27
|
+
Scrollbar: PartComponent<"div", {
|
|
28
|
+
readonly orientation?: "horizontal" | "vertical" | undefined;
|
|
29
|
+
readonly hovering?: true | undefined;
|
|
30
|
+
readonly scrolling?: true | undefined;
|
|
31
|
+
}, ScrollbarProps>;
|
|
32
|
+
Thumb: PartComponent<"div", {
|
|
33
|
+
readonly orientation?: "horizontal" | "vertical" | undefined;
|
|
34
|
+
}, PartComponentProps, {}, unknown>;
|
|
35
|
+
Corner: PartComponent<"div", Record<never, never>, PartComponentProps>;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=scroll-area.d.ts.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useDirectionAround } from "./direction-context.js";
|
|
2
|
+
import { context, controller, fromSignal, partComponent } from "./runtime.js";
|
|
3
|
+
import { within } from "@kirana-ui/core";
|
|
4
|
+
import { defineComponent, h, inject, provide } from "vue";
|
|
5
|
+
import { createScrollArea } from "@kirana-ui/core/scroll-area";
|
|
6
|
+
// src/scroll-area.ts
|
|
7
|
+
const scope = context("ScrollArea");
|
|
8
|
+
const SCROLLBAR = Symbol("ScrollAreaScrollbar");
|
|
9
|
+
const Root = defineComponent({
|
|
10
|
+
name: "ScrollAreaRoot",
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
setup(_props, { attrs, slots }) {
|
|
13
|
+
const direction = useDirectionAround();
|
|
14
|
+
const made = scope.provide(controller(within(createScrollArea, { direction }), () => ({})));
|
|
15
|
+
const Element = partComponent("ScrollAreaRootElement", "div", () => made.root);
|
|
16
|
+
return () => h(Element, attrs, slots);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
/** `orientation` is which way it scrolls (`vertical` by default). */
|
|
20
|
+
const Scrollbar = defineComponent({
|
|
21
|
+
name: "ScrollAreaScrollbar",
|
|
22
|
+
inheritAttrs: false,
|
|
23
|
+
props: {
|
|
24
|
+
orientation: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "vertical"
|
|
27
|
+
},
|
|
28
|
+
keepMounted: Boolean
|
|
29
|
+
},
|
|
30
|
+
setup(props, { attrs, slots }) {
|
|
31
|
+
const bar = scope.use().scrollbar(props.orientation);
|
|
32
|
+
provide(SCROLLBAR, bar);
|
|
33
|
+
const shown = fromSignal(bar.shown);
|
|
34
|
+
const Element = partComponent("ScrollAreaScrollbarElement", "div", () => bar.part);
|
|
35
|
+
return () => shown.value || props.keepMounted ? h(Element, attrs, slots) : null;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const Thumb = partComponent("ScrollAreaThumb", "div", () => {
|
|
39
|
+
const bar = inject(SCROLLBAR, void 0);
|
|
40
|
+
if (!bar) throw new Error("A ScrollArea.Thumb must be inside <ScrollArea.Scrollbar>");
|
|
41
|
+
return bar.thumb;
|
|
42
|
+
});
|
|
43
|
+
const Corner = defineComponent({
|
|
44
|
+
name: "ScrollAreaCorner",
|
|
45
|
+
inheritAttrs: false,
|
|
46
|
+
setup(_props, { attrs, slots }) {
|
|
47
|
+
const { corner } = scope.use();
|
|
48
|
+
const shown = fromSignal(corner.shown);
|
|
49
|
+
const Element = partComponent("ScrollAreaCornerElement", "div", () => corner.part);
|
|
50
|
+
return () => shown.value ? h(Element, attrs, slots) : null;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const ScrollArea = {
|
|
54
|
+
Root,
|
|
55
|
+
Viewport: partComponent("ScrollAreaViewport", "div", () => scope.use().viewport),
|
|
56
|
+
Content: partComponent("ScrollAreaContent", "div", () => scope.use().content),
|
|
57
|
+
Scrollbar,
|
|
58
|
+
Thumb,
|
|
59
|
+
Corner
|
|
60
|
+
};
|
|
61
|
+
export { ScrollArea };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=scroll-area.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-area.js","names":[],"sources":["../../../../packages/vue/src/scroll-area.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { Orientation } from \"@kirana-ui/core\"\nimport { createScrollArea } from \"@kirana-ui/core/scroll-area\"\nimport type { ScrollArea as Controller, ScrollAreaScrollbar } from \"@kirana-ui/core/scroll-area\"\nimport { defineComponent, h, inject, provide } from \"vue\"\nimport type { InjectionKey, PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, fromSignal, partComponent } from \"./runtime.ts\"\nimport type { PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"scrollArea\">\n\nconst scope = context<Controller>(\"ScrollArea\")\nconst SCROLLBAR: InjectionKey<ScrollAreaScrollbar> = Symbol(\"ScrollAreaScrollbar\")\n\nexport type RootProps = PartComponentProps\n\nconst Root = defineComponent({\n name: \"ScrollAreaRoot\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const direction = useDirectionAround()\n const made = scope.provide(controller(within(createScrollArea, { direction }), () => ({})))\n const Element = partComponent(\"ScrollAreaRootElement\", \"div\", () => made.root)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"root\"], RootProps>\n\nexport interface ScrollbarProps extends PartComponentProps {\n /** Which way it scrolls; `vertical` when left out. */\n orientation?: Orientation | undefined\n /** Keeps the bar in the page while there is nothing to scroll that way. */\n keepMounted?: boolean | undefined\n}\n\n/** `orientation` is which way it scrolls (`vertical` by default). */\nconst Scrollbar = defineComponent({\n name: \"ScrollAreaScrollbar\",\n inheritAttrs: false,\n props: {\n orientation: { type: String as PropType<Orientation>, default: \"vertical\" },\n keepMounted: Boolean,\n },\n setup(props, { attrs, slots }) {\n const bar = scope.use().scrollbar(props.orientation)\n provide(SCROLLBAR, bar)\n const shown = fromSignal(bar.shown)\n const Element = partComponent(\"ScrollAreaScrollbarElement\", \"div\", () => bar.part)\n return () => (shown.value || props.keepMounted ? h(Element, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"div\", State[\"scrollbar\"], ScrollbarProps>\n\nexport type ThumbProps = PartComponentProps\nconst Thumb = partComponent<\"div\", State[\"thumb\"]>(\"ScrollAreaThumb\", \"div\", () => {\n const bar = inject(SCROLLBAR, undefined)\n if (!bar) throw new Error(\"A ScrollArea.Thumb must be inside <ScrollArea.Scrollbar>\")\n return bar.thumb\n})\n\nexport type CornerProps = PartComponentProps\n\nconst Corner = defineComponent({\n name: \"ScrollAreaCorner\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const { corner } = scope.use()\n const shown = fromSignal(corner.shown)\n const Element = partComponent(\"ScrollAreaCornerElement\", \"div\", () => corner.part)\n return () => (shown.value ? h(Element, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"div\", State[\"corner\"], CornerProps>\n\nexport type ViewportProps = PartComponentProps\nexport type ContentProps = PartComponentProps\nexport const ScrollArea = {\n Root,\n Viewport: partComponent<\"div\", State[\"viewport\"]>(\n \"ScrollAreaViewport\",\n \"div\",\n () => scope.use().viewport\n ),\n Content: partComponent<\"div\", State[\"content\"]>(\n \"ScrollAreaContent\",\n \"div\",\n () => scope.use().content\n ),\n Scrollbar,\n Thumb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