@kirana-ui/vue 0.0.0 → 0.1.1
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 +1 -1
- package/llms.txt +1838 -0
- package/package.json +230 -6
- package/src/accordion.d.ts +78 -0
- package/src/accordion.js +92 -0
- package/src/accordion.js.map +1 -0
- package/src/alert-dialog.d.ts +2 -0
- package/src/alert-dialog.js +1 -0
- package/src/autocomplete.d.ts +2 -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 +16 -0
- package/src/avatar.js +40 -0
- package/src/avatar.js.map +1 -0
- package/src/button.d.ts +23 -0
- package/src/button.js +22 -0
- package/src/button.js.map +1 -0
- package/src/calendar.d.ts +107 -0
- package/src/calendar.js +125 -0
- package/src/calendar.js.map +1 -0
- package/src/carousel.d.ts +61 -0
- package/src/carousel.js +75 -0
- package/src/carousel.js.map +1 -0
- package/src/checkbox.d.ts +53 -0
- package/src/checkbox.js +64 -0
- package/src/checkbox.js.map +1 -0
- package/src/collapsible.d.ts +39 -0
- package/src/collapsible.js +50 -0
- package/src/collapsible.js.map +1 -0
- package/src/combobox.d.ts +298 -0
- package/src/combobox.js +286 -0
- package/src/combobox.js.map +1 -0
- package/src/command.d.ts +89 -0
- package/src/command.js +129 -0
- package/src/command.js.map +1 -0
- package/src/context-menu.d.ts +2 -0
- package/src/context-menu.js +1 -0
- package/src/date-field.d.ts +70 -0
- package/src/date-field.js +77 -0
- package/src/date-field.js.map +1 -0
- package/src/date-picker.d.ts +145 -0
- package/src/date-picker.js +82 -0
- package/src/date-picker.js.map +1 -0
- package/src/dialog.d.ts +154 -0
- package/src/dialog.js +133 -0
- package/src/dialog.js.map +1 -0
- package/src/direction-context.d.ts +5 -0
- package/src/direction-context.js +9 -0
- package/src/direction-context.js.map +1 -0
- package/src/direction.d.ts +16 -0
- package/src/direction.js +25 -0
- package/src/direction.js.map +1 -0
- package/src/drawer.d.ts +2 -0
- package/src/drawer.js +1 -0
- package/src/field-context.d.ts +6 -0
- package/src/field-context.js +17 -0
- package/src/field-context.js.map +1 -0
- package/src/field.d.ts +49 -0
- package/src/field.js +79 -0
- package/src/field.js.map +1 -0
- package/src/fieldset.d.ts +18 -0
- package/src/fieldset.js +35 -0
- package/src/fieldset.js.map +1 -0
- package/src/form.d.ts +22 -0
- package/src/form.js +29 -0
- package/src/form.js.map +1 -0
- package/src/hover-card.d.ts +46 -0
- package/src/hover-card.js +7 -0
- package/src/hover-card.js.map +1 -0
- package/src/hover-popup.d.ts +49 -0
- package/src/hover-popup.js +62 -0
- package/src/hover-popup.js.map +1 -0
- package/src/index.d.ts +48 -0
- package/src/index.js +47 -0
- package/src/input.d.ts +19 -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 +92 -0
- package/src/listbox.js +104 -0
- package/src/listbox.js.map +1 -0
- package/src/menu.d.ts +542 -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 +26 -0
- package/src/menubar.js +34 -0
- package/src/menubar.js.map +1 -0
- package/src/message-scroller.d.ts +20 -0
- package/src/message-scroller.js +34 -0
- package/src/message-scroller.js.map +1 -0
- package/src/meter.d.ts +34 -0
- package/src/meter.js +7 -0
- package/src/meter.js.map +1 -0
- package/src/navigation-menu.d.ts +91 -0
- package/src/navigation-menu.js +117 -0
- package/src/navigation-menu.js.map +1 -0
- package/src/number-field.d.ts +71 -0
- package/src/number-field.js +81 -0
- package/src/number-field.js.map +1 -0
- package/src/otp.d.ts +58 -0
- package/src/otp.js +86 -0
- package/src/otp.js.map +1 -0
- package/src/pagination.d.ts +61 -0
- package/src/pagination.js +70 -0
- package/src/pagination.js.map +1 -0
- package/src/popover.d.ts +44 -0
- package/src/popover.js +60 -0
- package/src/popover.js.map +1 -0
- package/src/progress.d.ts +34 -0
- package/src/progress.js +7 -0
- package/src/progress.js.map +1 -0
- package/src/qr-code.d.ts +24 -0
- package/src/qr-code.js +34 -0
- package/src/qr-code.js.map +1 -0
- package/src/radio-group.d.ts +78 -0
- package/src/radio-group.js +97 -0
- package/src/radio-group.js.map +1 -0
- package/src/resizable.d.ts +48 -0
- package/src/resizable.js +62 -0
- package/src/resizable.js.map +1 -0
- package/src/runtime.d.ts +48 -0
- package/src/runtime.js +149 -0
- package/src/runtime.js.map +1 -0
- package/src/scroll-area.d.ts +32 -0
- package/src/scroll-area.js +63 -0
- package/src/scroll-area.js.map +1 -0
- package/src/select.d.ts +154 -0
- package/src/select.js +191 -0
- package/src/select.js.map +1 -0
- package/src/separator.d.ts +10 -0
- package/src/separator.js +17 -0
- package/src/separator.js.map +1 -0
- package/src/slider.d.ts +83 -0
- package/src/slider.js +94 -0
- package/src/slider.js.map +1 -0
- package/src/switch.d.ts +42 -0
- package/src/switch.js +51 -0
- package/src/switch.js.map +1 -0
- package/src/tabs.d.ts +101 -0
- package/src/tabs.js +106 -0
- package/src/tabs.js.map +1 -0
- package/src/toast.d.ts +48 -0
- package/src/toast.js +66 -0
- package/src/toast.js.map +1 -0
- package/src/toggle-group.d.ts +41 -0
- package/src/toggle-group.js +46 -0
- package/src/toggle-group.js.map +1 -0
- package/src/toggle.d.ts +39 -0
- package/src/toggle.js +46 -0
- package/src/toggle.js.map +1 -0
- 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 +72 -0
- package/src/toolbar.js +55 -0
- package/src/toolbar.js.map +1 -0
- package/src/tooltip.d.ts +46 -0
- package/src/tooltip.js +7 -0
- package/src/tooltip.js.map +1 -0
- package/src/value-bar.d.ts +38 -0
- package/src/value-bar.js +52 -0
- package/src/value-bar.js.map +1 -0
- package/README.md +0 -7
- package/index.js +0 -5
package/src/popover.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { context, controller, optional, partComponent, portalComponent } from "./runtime.js";
|
|
2
|
+
import { defined } from "@kirana-ui/core";
|
|
3
|
+
import { createPopover } from "@kirana-ui/core/popover";
|
|
4
|
+
import { defineComponent, h, useId, watchEffect } from "vue";
|
|
5
|
+
// src/popover.ts
|
|
6
|
+
const scope = context("Popover");
|
|
7
|
+
const Root = defineComponent({
|
|
8
|
+
name: "PopoverRoot",
|
|
9
|
+
props: {
|
|
10
|
+
open: optional(Boolean),
|
|
11
|
+
defaultOpen: Boolean,
|
|
12
|
+
id: String
|
|
13
|
+
},
|
|
14
|
+
emits: ["update:open", "openChange"],
|
|
15
|
+
setup(props, { slots, emit }) {
|
|
16
|
+
const generated = useId();
|
|
17
|
+
scope.provide(controller(createPopover, () => ({
|
|
18
|
+
id: props.id ?? generated,
|
|
19
|
+
open: props.open,
|
|
20
|
+
defaultOpen: props.defaultOpen,
|
|
21
|
+
onOpenChange(open, details) {
|
|
22
|
+
emit("openChange", open, details);
|
|
23
|
+
if (!details.canceled) emit("update:open", open);
|
|
24
|
+
}
|
|
25
|
+
})));
|
|
26
|
+
return () => slots.default?.();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
/** A positioner: the part's element, with where it goes as props. */
|
|
30
|
+
function positionerComponent(name, use, element) {
|
|
31
|
+
return defineComponent({
|
|
32
|
+
name,
|
|
33
|
+
inheritAttrs: false,
|
|
34
|
+
props: {
|
|
35
|
+
side: String,
|
|
36
|
+
align: String,
|
|
37
|
+
sideOffset: Number,
|
|
38
|
+
alignOffset: Number,
|
|
39
|
+
collisionPadding: Number
|
|
40
|
+
},
|
|
41
|
+
setup(props, { attrs, slots }) {
|
|
42
|
+
const { positioning } = use();
|
|
43
|
+
watchEffect(() => positioning.set(defined({ ...props })), { flush: "sync" });
|
|
44
|
+
return () => h(element, attrs, slots);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const Popover = {
|
|
49
|
+
Root,
|
|
50
|
+
Trigger: partComponent("PopoverTrigger", "button", () => scope.use().trigger),
|
|
51
|
+
Portal: portalComponent("PopoverPortal", () => scope.use().mounted),
|
|
52
|
+
Positioner: positionerComponent("PopoverPositioner", () => scope.use(), partComponent("PopoverPositionerElement", "div", () => scope.use().positioner)),
|
|
53
|
+
Popup: partComponent("PopoverPopup", "div", () => scope.use().popup),
|
|
54
|
+
Title: partComponent("PopoverTitle", "h2", () => scope.use().title),
|
|
55
|
+
Description: partComponent("PopoverDescription", "p", () => scope.use().description),
|
|
56
|
+
Close: partComponent("PopoverClose", "button", () => scope.use().close)
|
|
57
|
+
};
|
|
58
|
+
export { Popover, scope as popoverScope, positionerComponent };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.js","names":[],"sources":["../../../../packages/vue/src/popover.ts"],"sourcesContent":["import { defined } from \"@kirana-ui/core\"\nimport type { ChangeDetails, PositionOptions } from \"@kirana-ui/core\"\nimport { createPopover } from \"@kirana-ui/core/popover\"\nimport type { Popover as Controller } from \"@kirana-ui/core/popover\"\nimport { defineComponent, h, useId, watchEffect } from \"vue\"\nimport type { Component, PropType } from \"vue\"\n\nimport { context, controller, optional, partComponent, portalComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Popover\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as popoverScope }\n\nconst Root = defineComponent({\n name: \"PopoverRoot\",\n props: { open: optional(Boolean), defaultOpen: Boolean, id: String },\n emits: [\"update:open\", \"openChange\"],\n setup(props, { slots, emit }) {\n const generated = useId()\n scope.provide(\n controller(createPopover, () => ({\n id: props.id ?? generated,\n open: props.open,\n defaultOpen: props.defaultOpen,\n onOpenChange(open: boolean, details: ChangeDetails) {\n emit(\"openChange\", open, details)\n if (!details.canceled) emit(\"update:open\", open)\n },\n }))\n )\n return () => slots.default?.()\n },\n})\n\n/** A positioner: the part's element, with where it goes as props. */\nexport function positionerComponent(\n name: string,\n use: () => { positioning: Controller[\"positioning\"] },\n element: Component\n): Component {\n return defineComponent({\n name,\n inheritAttrs: false,\n props: {\n side: String as PropType<PositionOptions[\"side\"]>,\n align: String as PropType<PositionOptions[\"align\"]>,\n sideOffset: Number,\n alignOffset: Number,\n collisionPadding: Number,\n },\n setup(props, { attrs, slots }) {\n const { positioning } = use()\n // As they change, and before the element attaches: the first placement reads these.\n watchEffect(() => positioning.set(defined({ ...props })), { flush: \"sync\" })\n return () => h(element, attrs, slots)\n },\n })\n}\n\nexport const Popover = {\n Root,\n Trigger: partComponent(\"PopoverTrigger\", \"button\", () => scope.use().trigger),\n Portal: portalComponent(\"PopoverPortal\", () => scope.use().mounted),\n Positioner: positionerComponent(\n \"PopoverPositioner\",\n () => scope.use(),\n partComponent(\"PopoverPositionerElement\", \"div\", () => scope.use().positioner)\n ),\n Popup: partComponent(\"PopoverPopup\", \"div\", () => scope.use().popup),\n Title: partComponent(\"PopoverTitle\", \"h2\", () => scope.use().title),\n Description: partComponent(\"PopoverDescription\", \"p\", () => scope.use().description),\n Close: partComponent(\"PopoverClose\", \"button\", () => scope.use().close),\n}\n"],"mappings":";;;;;AASA,MAAM,QAAQ,QAAoB,SAAS;AAI3C,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,OAAO;EAAE,MAAM,SAAS,OAAO;EAAG,aAAa;EAAS,IAAI;CAAO;CACnE,OAAO,CAAC,eAAe,YAAY;CACnC,MAAM,OAAO,EAAE,OAAO,QAAQ;EAC5B,MAAM,YAAY,MAAM;EACxB,MAAM,QACJ,WAAW,sBAAsB;GAC/B,IAAI,MAAM,MAAM;GAChB,MAAM,MAAM;GACZ,aAAa,MAAM;GACnB,aAAa,MAAe,SAAwB;IAClD,KAAK,cAAc,MAAM,OAAO;IAChC,IAAI,CAAC,QAAQ,UAAU,KAAK,eAAe,IAAI;GACjD;EACF,EAAE,CACJ;EACA,aAAa,MAAM,UAAU;CAC/B;AACF,CAAC;;AAGD,SAAgB,oBACd,MACA,KACA,SACW;CACX,OAAO,gBAAgB;EACrB;EACA,cAAc;EACd,OAAO;GACL,MAAM;GACN,OAAO;GACP,YAAY;GACZ,aAAa;GACb,kBAAkB;EACpB;EACA,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,EAAE,gBAAgB,IAAI;GAE5B,kBAAkB,YAAY,IAAI,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,OAAO,CAAC;GAC3E,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAAC;AACH;AAEA,MAAa,UAAU;CACrB;CACA,SAAS,cAAc,kBAAkB,gBAAgB,MAAM,IAAI,CAAC,CAAC,OAAO;CAC5E,QAAQ,gBAAgB,uBAAuB,MAAM,IAAI,CAAC,CAAC,OAAO;CAClE,YAAY,oBACV,2BACM,MAAM,IAAI,GAChB,cAAc,4BAA4B,aAAa,MAAM,IAAI,CAAC,CAAC,UAAU,CAC/E;CACA,OAAO,cAAc,gBAAgB,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;CACnE,OAAO,cAAc,gBAAgB,YAAY,MAAM,IAAI,CAAC,CAAC,KAAK;CAClE,aAAa,cAAc,sBAAsB,WAAW,MAAM,IAAI,CAAC,CAAC,WAAW;CACnF,OAAO,cAAc,gBAAgB,gBAAgB,MAAM,IAAI,CAAC,CAAC,KAAK;AACxE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const Progress: {
|
|
2
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
value: {
|
|
4
|
+
type: import("vue").PropType<number | null>;
|
|
5
|
+
required: true;
|
|
6
|
+
};
|
|
7
|
+
min: NumberConstructor;
|
|
8
|
+
max: NumberConstructor;
|
|
9
|
+
format: import("vue").PropType<Intl.NumberFormatOptions>;
|
|
10
|
+
locale: StringConstructor;
|
|
11
|
+
getAriaValueText: import("vue").PropType<import("@kirana-ui/core/meter").ValueBarProps["getAriaValueText"]>;
|
|
12
|
+
id: StringConstructor;
|
|
13
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
+
value: {
|
|
17
|
+
type: import("vue").PropType<number | null>;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
min: NumberConstructor;
|
|
21
|
+
max: NumberConstructor;
|
|
22
|
+
format: import("vue").PropType<Intl.NumberFormatOptions>;
|
|
23
|
+
locale: StringConstructor;
|
|
24
|
+
getAriaValueText: import("vue").PropType<import("@kirana-ui/core/meter").ValueBarProps["getAriaValueText"]>;
|
|
25
|
+
id: StringConstructor;
|
|
26
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
27
|
+
Track: import("vue").Component;
|
|
28
|
+
Indicator: import("vue").Component;
|
|
29
|
+
Value: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
32
|
+
Label: import("vue").Component;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=progress.d.ts.map
|
package/src/progress.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","names":[],"sources":["../../../../packages/vue/src/progress.ts"],"sourcesContent":["import { createProgress } from \"@kirana-ui/core/progress\"\n\nimport { valueBar } from \"./value-bar.ts\"\n\nexport const Progress = valueBar(\"Progress\", createProgress)\n"],"mappings":";;;AAIA,MAAa,WAAW,SAAS,YAAY,cAAc"}
|
package/src/qr-code.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
import { QrCorrection } from "@kirana-ui/core/qr-code";
|
|
3
|
+
export declare const QrCode: {
|
|
4
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
value: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
correction: PropType<QrCorrection>;
|
|
10
|
+
id: StringConstructor;
|
|
11
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
14
|
+
value: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
correction: PropType<QrCorrection>;
|
|
19
|
+
id: StringConstructor;
|
|
20
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
21
|
+
Frame: import("vue").Component;
|
|
22
|
+
Pattern: import("vue").Component;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=qr-code.d.ts.map
|
package/src/qr-code.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { context, controller, partComponent } from "./runtime.js";
|
|
2
|
+
import { defineComponent, h, useId } from "vue";
|
|
3
|
+
import { createQrCode } from "@kirana-ui/core/qr-code";
|
|
4
|
+
// src/qr-code.ts
|
|
5
|
+
const scope = context("QrCode");
|
|
6
|
+
const RootElement = partComponent("QrCodeRootElement", "div", () => scope.use().root);
|
|
7
|
+
const QrCode = {
|
|
8
|
+
Root: defineComponent({
|
|
9
|
+
name: "QrCodeRoot",
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: {
|
|
12
|
+
value: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
correction: String,
|
|
17
|
+
id: String
|
|
18
|
+
},
|
|
19
|
+
setup(props, { attrs, slots }) {
|
|
20
|
+
const generated = useId();
|
|
21
|
+
scope.provide(controller(createQrCode, () => ({
|
|
22
|
+
id: props.id ?? generated,
|
|
23
|
+
value: props.value,
|
|
24
|
+
correction: props.correction
|
|
25
|
+
})));
|
|
26
|
+
return () => h(RootElement, attrs, slots);
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
Frame: partComponent("QrCodeFrame", "svg", () => scope.use().frame),
|
|
30
|
+
Pattern: partComponent("QrCodePattern", "path", () => scope.use().pattern)
|
|
31
|
+
};
|
|
32
|
+
export { QrCode };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=qr-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-code.js","names":[],"sources":["../../../../packages/vue/src/qr-code.ts"],"sourcesContent":["import { createQrCode } from \"@kirana-ui/core/qr-code\"\nimport type { QrCode as Controller, QrCorrection } from \"@kirana-ui/core/qr-code\"\nimport { defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { context, controller, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"QrCode\")\n\nconst RootElement = partComponent(\"QrCodeRootElement\", \"div\", () => scope.use().root)\n\nconst Root = defineComponent({\n name: \"QrCodeRoot\",\n inheritAttrs: false,\n props: {\n value: { type: String, required: true },\n correction: String as PropType<QrCorrection>,\n id: String,\n },\n setup(props, { attrs, slots }) {\n const generated = useId()\n scope.provide(\n controller(createQrCode, () => ({\n id: props.id ?? generated,\n value: props.value,\n correction: props.correction,\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\nconst Frame = partComponent(\"QrCodeFrame\", \"svg\", () => scope.use().frame)\nconst Pattern = partComponent(\"QrCodePattern\", \"path\", () => scope.use().pattern)\n\nexport const QrCode = { Root, Frame, Pattern }\n"],"mappings":";;;;AAOA,MAAM,QAAQ,QAAoB,QAAQ;AAE1C,MAAM,cAAc,cAAc,qBAAqB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;AA0BpF,MAAa,SAAS;CAAE,MAxBX,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,OAAO;IAAE,MAAM;IAAQ,UAAU;GAAK;GACtC,YAAY;GACZ,IAAI;EACN;EACA,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,YAAY,MAAM;GACxB,MAAM,QACJ,WAAW,qBAAqB;IAC9B,IAAI,MAAM,MAAM;IAChB,OAAO,MAAM;IACb,YAAY,MAAM;GACpB,EAAE,CACJ;GACA,aAAa,EAAE,aAAa,OAAO,KAAK;EAC1C;CACF,CAKwB;CAAM,OAHhB,cAAc,eAAe,aAAa,MAAM,IAAI,CAAC,CAAC,KAGtC;CAAO,SAFrB,cAAc,iBAAiB,cAAc,MAAM,IAAI,CAAC,CAAC,OAEpC;AAAQ"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
export declare const RadioGroup: {
|
|
3
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
value: {
|
|
5
|
+
type: PropType<unknown>;
|
|
6
|
+
default: unknown;
|
|
7
|
+
};
|
|
8
|
+
defaultValue: {
|
|
9
|
+
type: PropType<unknown>;
|
|
10
|
+
default: unknown;
|
|
11
|
+
};
|
|
12
|
+
disabled: BooleanConstructor;
|
|
13
|
+
readOnly: BooleanConstructor;
|
|
14
|
+
required: BooleanConstructor;
|
|
15
|
+
name: StringConstructor;
|
|
16
|
+
form: StringConstructor;
|
|
17
|
+
id: StringConstructor;
|
|
18
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "valueChange")[], "update:value" | "valueChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
value: {
|
|
22
|
+
type: PropType<unknown>;
|
|
23
|
+
default: unknown;
|
|
24
|
+
};
|
|
25
|
+
defaultValue: {
|
|
26
|
+
type: PropType<unknown>;
|
|
27
|
+
default: unknown;
|
|
28
|
+
};
|
|
29
|
+
disabled: BooleanConstructor;
|
|
30
|
+
readOnly: BooleanConstructor;
|
|
31
|
+
required: BooleanConstructor;
|
|
32
|
+
name: StringConstructor;
|
|
33
|
+
form: StringConstructor;
|
|
34
|
+
id: StringConstructor;
|
|
35
|
+
}>> & Readonly<{
|
|
36
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
37
|
+
onValueChange?: ((...args: any[]) => any) | undefined;
|
|
38
|
+
}>, {
|
|
39
|
+
value: unknown;
|
|
40
|
+
defaultValue: unknown;
|
|
41
|
+
disabled: boolean;
|
|
42
|
+
readOnly: boolean;
|
|
43
|
+
required: boolean;
|
|
44
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
45
|
+
Item: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
46
|
+
value: {
|
|
47
|
+
type: PropType<unknown>;
|
|
48
|
+
required: true;
|
|
49
|
+
};
|
|
50
|
+
disabled: {
|
|
51
|
+
type: BooleanConstructor;
|
|
52
|
+
default: undefined;
|
|
53
|
+
};
|
|
54
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
57
|
+
value: {
|
|
58
|
+
type: PropType<unknown>;
|
|
59
|
+
required: true;
|
|
60
|
+
};
|
|
61
|
+
disabled: {
|
|
62
|
+
type: BooleanConstructor;
|
|
63
|
+
default: undefined;
|
|
64
|
+
};
|
|
65
|
+
}>> & Readonly<{}>, {
|
|
66
|
+
disabled: boolean;
|
|
67
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
68
|
+
Indicator: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
69
|
+
keepMounted: BooleanConstructor;
|
|
70
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
71
|
+
[key: string]: any;
|
|
72
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
73
|
+
keepMounted: BooleanConstructor;
|
|
74
|
+
}>> & Readonly<{}>, {
|
|
75
|
+
keepMounted: boolean;
|
|
76
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=radio-group.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { useDirectionAround } from "./direction-context.js";
|
|
2
|
+
import { useFieldAround } from "./field-context.js";
|
|
3
|
+
import { context, controller, fromSignal, optional, partComponent, toSignal } from "./runtime.js";
|
|
4
|
+
import { defined, within } from "@kirana-ui/core";
|
|
5
|
+
import { defineComponent, h, inject, onBeforeUnmount, onMounted, provide, useId } from "vue";
|
|
6
|
+
import { createRadioGroup } from "@kirana-ui/core/radio-group";
|
|
7
|
+
// src/radio-group.ts
|
|
8
|
+
const scope = context("RadioGroup");
|
|
9
|
+
const ITEM = Symbol("RadioGroupItem");
|
|
10
|
+
const RootElement = partComponent("RadioGroupRootElement", "div", () => scope.use().root);
|
|
11
|
+
const RadioGroup = {
|
|
12
|
+
Root: defineComponent({
|
|
13
|
+
name: "RadioGroupRoot",
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
props: {
|
|
16
|
+
value: {
|
|
17
|
+
type: null,
|
|
18
|
+
default: void 0
|
|
19
|
+
},
|
|
20
|
+
defaultValue: {
|
|
21
|
+
type: null,
|
|
22
|
+
default: null
|
|
23
|
+
},
|
|
24
|
+
disabled: Boolean,
|
|
25
|
+
readOnly: Boolean,
|
|
26
|
+
required: Boolean,
|
|
27
|
+
name: String,
|
|
28
|
+
form: String,
|
|
29
|
+
id: String
|
|
30
|
+
},
|
|
31
|
+
emits: ["update:value", "valueChange"],
|
|
32
|
+
setup(props, { attrs, slots, emit }) {
|
|
33
|
+
const generated = useId();
|
|
34
|
+
const field = useFieldAround();
|
|
35
|
+
scope.provide(controller(within(createRadioGroup, {
|
|
36
|
+
field,
|
|
37
|
+
direction: useDirectionAround()
|
|
38
|
+
}), () => ({
|
|
39
|
+
id: props.id ?? generated,
|
|
40
|
+
value: props.value,
|
|
41
|
+
defaultValue: props.defaultValue,
|
|
42
|
+
disabled: props.disabled,
|
|
43
|
+
readOnly: props.readOnly,
|
|
44
|
+
required: props.required,
|
|
45
|
+
name: props.name,
|
|
46
|
+
form: props.form,
|
|
47
|
+
onValueChange(value, details) {
|
|
48
|
+
emit("valueChange", value, details);
|
|
49
|
+
if (!details.canceled) emit("update:value", value);
|
|
50
|
+
}
|
|
51
|
+
})));
|
|
52
|
+
return () => h(RootElement, attrs, slots);
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
Item: defineComponent({
|
|
56
|
+
name: "RadioGroupItem",
|
|
57
|
+
inheritAttrs: false,
|
|
58
|
+
props: {
|
|
59
|
+
value: {
|
|
60
|
+
type: null,
|
|
61
|
+
required: true
|
|
62
|
+
},
|
|
63
|
+
disabled: optional(Boolean)
|
|
64
|
+
},
|
|
65
|
+
setup(props, { attrs, slots }) {
|
|
66
|
+
const value = props.value;
|
|
67
|
+
const options = toSignal(() => ({ disabled: props.disabled }));
|
|
68
|
+
const read = () => defined(options.get());
|
|
69
|
+
const group = scope.use();
|
|
70
|
+
const item = group.item(value, read);
|
|
71
|
+
const input = group.itemInput(value, read);
|
|
72
|
+
provide(ITEM, value);
|
|
73
|
+
const Element = partComponent("RadioGroupItemElement", "span", () => item);
|
|
74
|
+
const Input = partComponent("RadioGroupItemInput", "input", () => input);
|
|
75
|
+
return () => h(Element, attrs, () => [slots.default?.(), h(Input)]);
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
Indicator: defineComponent({
|
|
79
|
+
name: "RadioGroupIndicator",
|
|
80
|
+
inheritAttrs: false,
|
|
81
|
+
props: { keepMounted: Boolean },
|
|
82
|
+
setup(props, { attrs, slots }) {
|
|
83
|
+
const indicator = scope.use().indicator(inject(ITEM));
|
|
84
|
+
let stop;
|
|
85
|
+
onMounted(() => {
|
|
86
|
+
stop = indicator.mount();
|
|
87
|
+
});
|
|
88
|
+
onBeforeUnmount(() => stop?.());
|
|
89
|
+
const mounted = fromSignal(indicator.mounted);
|
|
90
|
+
const Element = partComponent("RadioGroupIndicatorElement", "span", () => indicator.part);
|
|
91
|
+
return () => mounted.value || props.keepMounted ? h(Element, attrs, slots) : null;
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
};
|
|
95
|
+
export { RadioGroup };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=radio-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group.js","names":[],"sources":["../../../../packages/vue/src/radio-group.ts"],"sourcesContent":["import { defined, within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createRadioGroup } from \"@kirana-ui/core/radio-group\"\nimport type { RadioGroup as Controller } from \"@kirana-ui/core/radio-group\"\nimport { defineComponent, h, inject, onBeforeUnmount, onMounted, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { useFieldAround } from \"./field-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent, toSignal } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"RadioGroup\")\nconst ITEM: InjectionKey<unknown> = Symbol(\"RadioGroupItem\")\n\nconst RootElement = partComponent(\"RadioGroupRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:value`, or `value` with `@value-change=\"(value, details) => …\"`. */\nconst Root = defineComponent({\n name: \"RadioGroupRoot\",\n inheritAttrs: false,\n props: {\n value: { type: null as unknown as PropType<unknown>, default: undefined as unknown },\n defaultValue: { type: null as unknown as PropType<unknown>, default: null as unknown },\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const field = useFieldAround()\n scope.provide(\n controller(within(createRadioGroup, { field, direction: useDirectionAround() }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n name: props.name,\n form: props.form,\n onValueChange(value: unknown, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\nconst Item = defineComponent({\n name: \"RadioGroupItem\",\n inheritAttrs: false,\n props: {\n value: { type: null as unknown as PropType<unknown>, required: true },\n disabled: optional(Boolean),\n },\n setup(props, { attrs, slots }) {\n // An item is its value for as long as it is in the page.\n const value = props.value\n const options = toSignal(() => ({ disabled: props.disabled }))\n const read = () => defined(options.get())\n const group = scope.use()\n const item = group.item(value, read)\n const input = group.itemInput(value, read)\n provide(ITEM, value)\n const Element = partComponent(\"RadioGroupItemElement\", \"span\", () => item)\n const Input = partComponent(\"RadioGroupItemInput\", \"input\", () => input)\n return () => h(Element, attrs, () => [slots.default?.(), h(Input)])\n },\n})\n\n/** `keep-mounted` keeps the mark in the page while its item is not the chosen one. */\nconst Indicator = defineComponent({\n name: \"RadioGroupIndicator\",\n inheritAttrs: false,\n props: { keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const indicator = scope.use().indicator(inject(ITEM))\n let stop: (() => void) | undefined\n onMounted(() => {\n stop = indicator.mount()\n })\n onBeforeUnmount(() => stop?.())\n const mounted = fromSignal(indicator.mounted)\n const Element = partComponent(\"RadioGroupIndicatorElement\", \"span\", () => indicator.part)\n return () => (mounted.value || props.keepMounted ? h(Element, attrs, slots) : null)\n },\n})\n\nexport const RadioGroup = { Root, Item, Indicator }\n"],"mappings":";;;;;;;AAWA,MAAM,QAAQ,QAAoB,YAAY;AAC9C,MAAM,OAA8B,OAAO,gBAAgB;AAE3D,MAAM,cAAc,cAAc,yBAAyB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;AAgFxF,MAAa,aAAa;CAAE,MA7Ef,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,OAAO;IAAE,MAAM;IAAsC,SAAS,KAAA;GAAqB;GACnF,cAAc;IAAE,MAAM;IAAsC,SAAS;GAAgB;GACrF,UAAU;GACV,UAAU;GACV,UAAU;GACV,MAAM;GACN,MAAM;GACN,IAAI;EACN;EACA,OAAO,CAAC,gBAAgB,aAAa;EACrC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;GACnC,MAAM,YAAY,MAAM;GACxB,MAAM,QAAQ,eAAe;GAC7B,MAAM,QACJ,WAAW,OAAO,kBAAkB;IAAE;IAAO,WAAW,mBAAmB;GAAE,CAAC,UAAU;IACtF,IAAI,MAAM,MAAM;IAChB,OAAO,MAAM;IACb,cAAc,MAAM;IACpB,UAAU,MAAM;IAChB,UAAU,MAAM;IAChB,UAAU,MAAM;IAChB,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,cAAc,OAAgB,SAAwB;KACpD,KAAK,eAAe,OAAO,OAAO;KAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;IACnD;GACF,EAAE,CACJ;GACA,aAAa,EAAE,aAAa,OAAO,KAAK;EAC1C;CACF,CA0C4B;CAAM,MAxCrB,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,OAAO;IAAE,MAAM;IAAsC,UAAU;GAAK;GACpE,UAAU,SAAS,OAAO;EAC5B;EACA,MAAM,OAAO,EAAE,OAAO,SAAS;GAE7B,MAAM,QAAQ,MAAM;GACpB,MAAM,UAAU,gBAAgB,EAAE,UAAU,MAAM,SAAS,EAAE;GAC7D,MAAM,aAAa,QAAQ,QAAQ,IAAI,CAAC;GACxC,MAAM,QAAQ,MAAM,IAAI;GACxB,MAAM,OAAO,MAAM,KAAK,OAAO,IAAI;GACnC,MAAM,QAAQ,MAAM,UAAU,OAAO,IAAI;GACzC,QAAQ,MAAM,KAAK;GACnB,MAAM,UAAU,cAAc,yBAAyB,cAAc,IAAI;GACzE,MAAM,QAAQ,cAAc,uBAAuB,eAAe,KAAK;GACvE,aAAa,EAAE,SAAS,aAAa,CAAC,MAAM,UAAU,GAAG,EAAE,KAAK,CAAC,CAAC;EACpE;CACF,CAoBkC;CAAM,WAjBtB,gBAAgB;EAChC,MAAM;EACN,cAAc;EACd,OAAO,EAAE,aAAa,QAAQ;EAC9B,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,YAAY,MAAM,IAAI,CAAC,CAAC,UAAU,OAAO,IAAI,CAAC;GACpD,IAAI;GACJ,gBAAgB;IACd,OAAO,UAAU,MAAM;GACzB,CAAC;GACD,sBAAsB,OAAO,CAAC;GAC9B,MAAM,UAAU,WAAW,UAAU,OAAO;GAC5C,MAAM,UAAU,cAAc,8BAA8B,cAAc,UAAU,IAAI;GACxF,aAAc,QAAQ,SAAS,MAAM,cAAc,EAAE,SAAS,OAAO,KAAK,IAAI;EAChF;CACF,CAEwC;AAAU"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Orientation } from "@kirana-ui/core";
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
export declare const Resizable: {
|
|
4
|
+
Group: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
orientation: PropType<Orientation>;
|
|
6
|
+
keyboardStep: NumberConstructor;
|
|
7
|
+
disabled: BooleanConstructor;
|
|
8
|
+
id: StringConstructor;
|
|
9
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "sizesChange"[], "sizesChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
|
+
orientation: PropType<Orientation>;
|
|
13
|
+
keyboardStep: NumberConstructor;
|
|
14
|
+
disabled: BooleanConstructor;
|
|
15
|
+
id: StringConstructor;
|
|
16
|
+
}>> & Readonly<{
|
|
17
|
+
onSizesChange?: ((...args: any[]) => any) | undefined;
|
|
18
|
+
}>, {
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
21
|
+
Panel: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
22
|
+
defaultSize: NumberConstructor;
|
|
23
|
+
minSize: NumberConstructor;
|
|
24
|
+
maxSize: NumberConstructor;
|
|
25
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
|
+
defaultSize: NumberConstructor;
|
|
29
|
+
minSize: NumberConstructor;
|
|
30
|
+
maxSize: NumberConstructor;
|
|
31
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
32
|
+
Handle: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
33
|
+
disabled: {
|
|
34
|
+
type: BooleanConstructor;
|
|
35
|
+
default: undefined;
|
|
36
|
+
};
|
|
37
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
40
|
+
disabled: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
}>> & Readonly<{}>, {
|
|
45
|
+
disabled: boolean;
|
|
46
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=resizable.d.ts.map
|
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 { Resizable as Controller } 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\"\n\nconst scope = context<Controller>(\"Resizable\")\n\nconst GroupElement = partComponent(\"ResizableGroupElement\", \"div\", () => scope.use().group)\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})\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})\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})\n\nexport const Resizable = { Group, Panel, Handle }\n"],"mappings":";;;;;;AAUA,MAAM,QAAQ,QAAoB,WAAW;AAE7C,MAAM,eAAe,cAAc,yBAAyB,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;AAsD1F,MAAa,YAAY;CAAE,OAnDb,gBAAgB;EAC5B,MAAM;EACN,cAAc;EACd,OAAO;GACL,aAAa;GACb,cAAc;GACd,UAAU;GACV,IAAI;EACN;EACA,OAAO,CAAC,aAAa;EACrB,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;GACnC,MAAM,YAAY,MAAM;GACxB,MAAM,YAAY,mBAAmB;GACrC,MAAM,QACJ,WAAW,OAAO,iBAAiB,EAAE,UAAU,CAAC,UAAU;IACxD,IAAI,MAAM,MAAM;IAChB,aAAa,MAAM;IACnB,cAAc,MAAM;IACpB,UAAU,MAAM;IAChB,gBAAgB,OAAiB,YAC/B,KAAK,eAAe,OAAO,OAAO;GACtC,EAAE,CACJ;GACA,aAAa,EAAE,cAAc,OAAO,KAAK;EAC3C;CACF,CA0B2B;CAAO,OAxBpB,gBAAgB;EAC5B,MAAM;EACN,cAAc;EACd,OAAO;GAAE,aAAa;GAAQ,SAAS;GAAQ,SAAS;EAAO;EAC/D,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,UAAU,gBAAgB,EAAE,GAAG,MAAM,EAAE;GAC7C,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,YAAY,QAAQ,QAAQ,IAAI,CAAC,CAAC;GAC3D,MAAM,UAAU,cAAc,yBAAyB,aAAa,IAAI;GACxE,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAckC;CAAO,QAZ1B,gBAAgB;EAC7B,MAAM;EACN,cAAc;EACd,OAAO,EAAE,UAAU,SAAS,OAAO,EAAE;EACrC,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,UAAU,gBAAgB,EAAE,UAAU,MAAM,SAAS,EAAE;GAC7D,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,aAAa,QAAQ,QAAQ,IAAI,CAAC,CAAC;GAC5D,MAAM,UAAU,cAAc,0BAA0B,aAAa,IAAI;GACzE,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAEyC;AAAO"}
|
package/src/runtime.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Part, ReadonlySignal } from "@kirana-ui/core";
|
|
2
|
+
import { Component, PropType, ShallowRef, VNode } from "vue";
|
|
3
|
+
/** A core signal as a Vue ref, read-only: tracked by whatever reads `.value`. */
|
|
4
|
+
export declare function fromSignal<T>(source: ReadonlySignal<T>): Readonly<ShallowRef<T>>;
|
|
5
|
+
/** A core signal that follows Vue state: the core hears a changed prop as it changes. */
|
|
6
|
+
export declare function toSignal<T extends Record<string, unknown>>(read: () => T): ReadonlySignal<T>;
|
|
7
|
+
/** A component's controller, made once, following its props. */
|
|
8
|
+
export declare function controller<P extends Record<string, unknown>, C extends {
|
|
9
|
+
mount(): () => void;
|
|
10
|
+
}>(create: (props: ReadonlySignal<P>) => C, read: () => P): C;
|
|
11
|
+
/** A controller its parts find: `provide` in the root, `use` in a part. */
|
|
12
|
+
export declare function context<C>(name: string): {
|
|
13
|
+
provide(controller: C): C;
|
|
14
|
+
use(): C;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* 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. Either way the caller's
|
|
19
|
+
* attributes are merged under the part's, and the part's DOM work is attached to the element.
|
|
20
|
+
*/
|
|
21
|
+
export declare function partComponent(name: string, tag: string, resolve: () => Part): Component;
|
|
22
|
+
/**
|
|
23
|
+
* Says where every popup inside it is drawn, the popups those open included: an element of
|
|
24
|
+
* the page (a shadow root's host, a full-screen element) in place of `<body>`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const PortalProvider: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
27
|
+
container: {
|
|
28
|
+
type: PropType<HTMLElement | null>;
|
|
29
|
+
default: undefined;
|
|
30
|
+
};
|
|
31
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
|
+
container: {
|
|
35
|
+
type: PropType<HTMLElement | null>;
|
|
36
|
+
default: undefined;
|
|
37
|
+
};
|
|
38
|
+
}>> & Readonly<{}>, {
|
|
39
|
+
container: HTMLElement | null;
|
|
40
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
41
|
+
/** Its slot in a container at the end of the page, while `mounted`. */
|
|
42
|
+
export declare function portalComponent(name: string, mounted: () => ReadonlySignal<boolean>): Component;
|
|
43
|
+
/** A prop that is "not given" when absent, where Vue would make a boolean `false`. */
|
|
44
|
+
export declare const optional: <T>(type: T) => {
|
|
45
|
+
type: T;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=runtime.d.ts.map
|