@kirana-ui/vue 0.3.0 → 0.4.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.
Files changed (106) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/llms.txt +1495 -119
  3. package/package.json +44 -3
  4. package/skills/kirana-ui-primitives/SKILL.md +24 -4
  5. package/src/accordion.d.ts +4 -0
  6. package/src/accordion.js +6 -0
  7. package/src/accordion.js.map +1 -1
  8. package/src/autocomplete.d.ts +2 -2
  9. package/src/avatar.js +2 -2
  10. package/src/avatar.js.map +1 -1
  11. package/src/button.d.ts +4 -1
  12. package/src/button.js +4 -1
  13. package/src/button.js.map +1 -1
  14. package/src/calendar.d.ts +5 -2
  15. package/src/calendar.js +8 -2
  16. package/src/calendar.js.map +1 -1
  17. package/src/carousel.d.ts +5 -2
  18. package/src/carousel.js +1 -4
  19. package/src/carousel.js.map +1 -1
  20. package/src/checkbox.d.ts +16 -0
  21. package/src/checkbox.js.map +1 -1
  22. package/src/collapsible.d.ts +2 -0
  23. package/src/color-picker.d.ts +118 -0
  24. package/src/color-picker.js +174 -0
  25. package/src/color-picker.js.map +1 -0
  26. package/src/combobox.d.ts +82 -4
  27. package/src/combobox.js +32 -9
  28. package/src/combobox.js.map +1 -1
  29. package/src/command.d.ts +2 -2
  30. package/src/command.js +1 -1
  31. package/src/command.js.map +1 -1
  32. package/src/date-field.d.ts +1 -1
  33. package/src/date-field.js +2 -0
  34. package/src/date-field.js.map +1 -1
  35. package/src/date-picker.d.ts +33 -10
  36. package/src/date-picker.js +103 -61
  37. package/src/date-picker.js.map +1 -1
  38. package/src/dialog.d.ts +22 -8
  39. package/src/dialog.js +40 -7
  40. package/src/dialog.js.map +1 -1
  41. package/src/editable.d.ts +87 -0
  42. package/src/editable.js +83 -0
  43. package/src/editable.js.map +1 -0
  44. package/src/element.js +5 -5
  45. package/src/element.js.map +1 -1
  46. package/src/file-upload.d.ts +76 -0
  47. package/src/file-upload.js +139 -0
  48. package/src/file-upload.js.map +1 -0
  49. package/src/hover-card.d.ts +3 -0
  50. package/src/index.d.ts +27 -9
  51. package/src/index.js +11 -1
  52. package/src/menu.d.ts +10 -0
  53. package/src/menu.js +17 -6
  54. package/src/menu.js.map +1 -1
  55. package/src/menubar.js +10 -1
  56. package/src/menubar.js.map +1 -1
  57. package/src/navigation-menu.d.ts +14 -3
  58. package/src/navigation-menu.js +20 -2
  59. package/src/navigation-menu.js.map +1 -1
  60. package/src/otp.d.ts +25 -3
  61. package/src/otp.js +20 -3
  62. package/src/otp.js.map +1 -1
  63. package/src/password-input.d.ts +37 -0
  64. package/src/password-input.js +44 -0
  65. package/src/password-input.js.map +1 -0
  66. package/src/popover.d.ts +6 -1
  67. package/src/popover.js +1 -1
  68. package/src/radio-group.d.ts +12 -0
  69. package/src/rating.d.ts +34 -0
  70. package/src/rating.js +81 -0
  71. package/src/rating.js.map +1 -0
  72. package/src/runtime.d.ts +2 -1
  73. package/src/runtime.js +5 -2
  74. package/src/runtime.js.map +1 -1
  75. package/src/scroll-area.d.ts +24 -1
  76. package/src/select.d.ts +38 -5
  77. package/src/select.js +28 -9
  78. package/src/select.js.map +1 -1
  79. package/src/slider.d.ts +30 -0
  80. package/src/steps.d.ts +74 -0
  81. package/src/steps.js +84 -0
  82. package/src/steps.js.map +1 -0
  83. package/src/switch.d.ts +12 -0
  84. package/src/tabs.d.ts +2 -0
  85. package/src/tabs.js +5 -0
  86. package/src/tabs.js.map +1 -1
  87. package/src/tags-input.d.ts +69 -0
  88. package/src/tags-input.js +145 -0
  89. package/src/tags-input.js.map +1 -0
  90. package/src/time-field.d.ts +41 -0
  91. package/src/time-field.js +85 -0
  92. package/src/time-field.js.map +1 -0
  93. package/src/toast.d.ts +12 -4
  94. package/src/toggle-group.js +6 -0
  95. package/src/toggle-group.js.map +1 -1
  96. package/src/toolbar-context.d.ts +1 -1
  97. package/src/toolbar.d.ts +4 -1
  98. package/src/toolbar.js +17 -2
  99. package/src/toolbar.js.map +1 -1
  100. package/src/tooltip.d.ts +5 -0
  101. package/src/tour.d.ts +75 -0
  102. package/src/tour.js +95 -0
  103. package/src/tour.js.map +1 -0
  104. package/src/tree.d.ts +69 -0
  105. package/src/tree.js +118 -0
  106. package/src/tree.js.map +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirana-ui/vue",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Kirana UI Primitives for Vue",
5
5
  "license": "MIT",
6
6
  "author": "The Kirana authors",
@@ -139,6 +139,46 @@
139
139
  "types": "./src/pagination.d.ts",
140
140
  "default": "./src/pagination.js"
141
141
  },
142
+ "./rating": {
143
+ "types": "./src/rating.d.ts",
144
+ "default": "./src/rating.js"
145
+ },
146
+ "./steps": {
147
+ "types": "./src/steps.d.ts",
148
+ "default": "./src/steps.js"
149
+ },
150
+ "./editable": {
151
+ "types": "./src/editable.d.ts",
152
+ "default": "./src/editable.js"
153
+ },
154
+ "./password-input": {
155
+ "types": "./src/password-input.d.ts",
156
+ "default": "./src/password-input.js"
157
+ },
158
+ "./tags-input": {
159
+ "types": "./src/tags-input.d.ts",
160
+ "default": "./src/tags-input.js"
161
+ },
162
+ "./file-upload": {
163
+ "types": "./src/file-upload.d.ts",
164
+ "default": "./src/file-upload.js"
165
+ },
166
+ "./time-field": {
167
+ "types": "./src/time-field.d.ts",
168
+ "default": "./src/time-field.js"
169
+ },
170
+ "./tree": {
171
+ "types": "./src/tree.d.ts",
172
+ "default": "./src/tree.js"
173
+ },
174
+ "./color-picker": {
175
+ "types": "./src/color-picker.d.ts",
176
+ "default": "./src/color-picker.js"
177
+ },
178
+ "./tour": {
179
+ "types": "./src/tour.d.ts",
180
+ "default": "./src/tour.js"
181
+ },
142
182
  "./date-picker": {
143
183
  "types": "./src/date-picker.d.ts",
144
184
  "default": "./src/date-picker.js"
@@ -230,7 +270,7 @@
230
270
  "./package.json": "./package.json"
231
271
  },
232
272
  "dependencies": {
233
- "@kirana-ui/core": "0.3.0"
273
+ "@kirana-ui/core": "0.4.0"
234
274
  },
235
275
  "peerDependencies": {
236
276
  "vue": "^3.5.0"
@@ -253,6 +293,7 @@
253
293
  "REFERENCE.md",
254
294
  "llms.txt",
255
295
  "skills",
256
- "LICENSE"
296
+ "LICENSE",
297
+ "CHANGELOG.md"
257
298
  ]
258
299
  }
@@ -52,15 +52,17 @@ from one core. The package for a framework is all a project installs.
52
52
  4. A value is controlled when given (`value` + `onValueChange`) and the component's own
53
53
  otherwise (`defaultValue`). A callback beside a value the component holds is
54
54
  `(value, details)`, and `details.cancel()` keeps the value as it was. A callback that
55
- reports something that happened (`onComplete`, `onClearErrors`, `onMonthChange`) takes only
56
- that.
55
+ reports something that happened (`onClearErrors`, `onMonthChange`) takes only that. The
56
+ names are Base UI's: `loopFocus`, `disablePointerDismissal`, a multiple Select's or
57
+ Combobox's list in `value`, One-Time Code's `validationType` and `onValueComplete`, a
58
+ toast's `timeout`; the older names still work and are marked deprecated.
57
59
  5. A control with a `name` is submitted with its form and follows the form's reset. Wrap it
58
60
  in `Field` for a label, a description and validation. `readOnly` and `keepMounted` are
59
61
  props of the parts `llms.txt` lists them for, and of no others.
60
62
 
61
63
  Per framework: React takes `render` for another element; Vue takes `as` / `as-child`, binds
62
64
  with `v-model:value` and names props in kebab case; Svelte takes a `child` snippet and
63
- `bind:value`; Solid takes `as` and `render`; Angular's parts are directives on your own
65
+ `bind:value`; Solid (2, with `@solidjs/web`) takes `as` and `render`; Angular's parts are directives on your own
64
66
  elements (`<button kpDialogTrigger>`), bound with `[(value)]`, with `[kpId]` for an id, and
65
67
  a part that comes and goes is structural (`*kpDialogPortal`, `*kpTabsPanel`: the list is in
66
68
  `llms.txt`); custom elements name each part with `kui-part` inside `<kui-dialog>`.
@@ -136,7 +138,25 @@ component's ref, kind, label, state and actions), `act({ steps: [{ ref, action,
136
138
  through the component's own handlers: its callback runs with `details.source === "agent"`
137
139
  and may cancel. Give every control an accessible name (a `<label>`, `aria-label`): it is how
138
140
  an agent finds it. Mark a destructive control `data-agent-confirm="what it does"`, private
139
- regions `data-agent-hidden`, secrets `data-agent-secret`. `allow(action)` is the policy,
141
+ regions `data-agent-hidden`, secrets `data-agent-secret` (whatever is inside is listed with its
142
+ name and its actions, never its value, its choices or whether it is checked). A bridge given a
143
+ `root` also reads what was opened from inside it (a dialog, a menu, a select's list), by the
144
+ `aria-controls` of what opened it. A step names its control by ref, by its label, by words of
145
+ the label, by the text of its row or by one of its choices; a name two controls answer to
146
+ fails with both. `subscribe((changed, changes) => …)` says of each change its `key`, `value`,
147
+ `previous`, `source` and `reason`; `record()` keeps a person's changes in `history()` beside
148
+ the agent's, each with its `source` and a sentence (`text`), and `undoSource("agent")` takes
149
+ back only the agent's. `stage({ steps })` shows a suggestion in the controls and gives
150
+ `revert()` and `keep()`. `act` takes a `signal`; `timeout` bounds a wait for `allow` or
151
+ `confirm`. A component of your own is read through `kinds` (`AgentKind`: a selector, `read`,
152
+ `perform`). A slider's `setValue` fails with what the slider holds when
153
+ its range or step does not hold the value asked for, and so does a spin button's (a Date or
154
+ Time Field's part, typed as a person types it). The thumbs of a range named by their group
155
+ are told apart by their place (`"Price, 1 of 2"`). A list of several values (a listbox, a
156
+ select with `multiple`, a tree) says `values` and takes a list in `setValue`; a closed
157
+ select's are known once its list has been read. A tree is one component: its shown nodes
158
+ are its `items` (with `level` below the top and `open` for a branch), and `setValue`,
159
+ `open` and `close` take a node's name. `allow(action)` is the policy,
140
160
  asked for every step; `confirm(action)` is a person's answer, asked for a step on something
141
161
  marked `data-agent-confirm`, and without it such a step fails with "Needs a person" whatever
142
162
  `allow` says. Never write `confirm: () => true`: open a dialog and resolve with what the
@@ -21,14 +21,17 @@ export declare const Accordion: {
21
21
  state: State["root"];
22
22
  }>;
23
23
  Item: PartComponent<"div", {
24
+ readonly index?: true | undefined;
24
25
  readonly open?: true | undefined;
25
26
  readonly disabled?: true | undefined;
26
27
  }, ItemProps>;
27
28
  Header: PartComponent<"h3", {
29
+ readonly index?: true | undefined;
28
30
  readonly open?: true | undefined;
29
31
  readonly disabled?: true | undefined;
30
32
  }, PartComponentProps, {}, unknown>;
31
33
  Trigger: PartComponent<"button", {
34
+ readonly index?: true | undefined;
32
35
  readonly panelOpen?: true | undefined;
33
36
  readonly disabled?: true | undefined;
34
37
  }, PartComponentProps, {}, unknown>;
@@ -39,6 +42,7 @@ export declare const Accordion: {
39
42
  readonly endingStyle?: true | undefined;
40
43
  readonly disabled?: true | undefined;
41
44
  readonly orientation?: "horizontal" | "vertical" | undefined;
45
+ readonly index?: true | undefined;
42
46
  }, PanelProps>;
43
47
  };
44
48
  export {};
package/src/accordion.js CHANGED
@@ -23,6 +23,11 @@ const Root = defineComponent({
23
23
  multiple: Boolean,
24
24
  disabled: Boolean,
25
25
  orientation: String,
26
+ loopFocus: optional(Boolean),
27
+ /**
28
+ * Whether the arrows wrap from the last item to the first.
29
+ * @deprecated Base UI's name is `loopFocus`, which wins when both are given.
30
+ */
26
31
  loop: optional(Boolean),
27
32
  id: String
28
33
  },
@@ -38,6 +43,7 @@ const Root = defineComponent({
38
43
  disabled: props.disabled,
39
44
  orientation: props.orientation,
40
45
  loop: props.loop,
46
+ loopFocus: props.loopFocus,
41
47
  onValueChange(value, details) {
42
48
  emit("valueChange", value, details);
43
49
  if (!details.canceled) emit("update:value", value);
@@ -1 +1 @@
1
- {"version":3,"file":"accordion.js","names":[],"sources":["../../../../packages/vue/src/accordion.ts"],"sourcesContent":["import { defined, within } from \"@kirana-ui/core\"\nimport type { ChangeDetails, Orientation } from \"@kirana-ui/core\"\nimport { createAccordion } from \"@kirana-ui/core/accordion\"\nimport type {\n AccordionItem,\n AccordionItemOptions,\n AccordionProps,\n Accordion as Controller,\n} from \"@kirana-ui/core/accordion\"\nimport { defineComponent, h, inject, onBeforeUnmount, onMounted, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType, PublicProps } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent, toSignal } from \"./runtime.ts\"\nimport type {\n Changes,\n PartComponent,\n PartComponentProps,\n PartGiven,\n PartInstance,\n StatesOf,\n} from \"./runtime.ts\"\n\ntype State = StatesOf<\"accordion\">\n\nconst scope = context<Controller>(\"Accordion\")\nconst ITEM: InjectionKey<AccordionItem> = Symbol(\"AccordionItem\")\nconst ANY = null as unknown as PropType<unknown>\n\nfunction useItem(): AccordionItem {\n const item = inject(ITEM, undefined)\n if (!item) throw new Error(\"An Accordion part must be inside <Accordion.Item>\")\n return item\n}\n\nconst RootElement = partComponent(\"AccordionRootElement\", \"div\", () => scope.use().root)\n\nexport type RootProps<Value = unknown> = Omit<AccordionProps<Value>, \"id\" | \"onValueChange\"> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type RootEmits<Value = unknown> = Changes<\"value\", Value[]>\n\n/** `v-model:value` (a list), or `value` with `@value-change=\"(value, details) => …\"`. */\nconst Root = defineComponent({\n name: \"AccordionRoot\",\n inheritAttrs: false,\n props: {\n value: optional(Array as PropType<readonly unknown[]>),\n defaultValue: Array as PropType<readonly unknown[]>,\n multiple: Boolean,\n disabled: Boolean,\n orientation: String as PropType<Orientation>,\n loop: optional(Boolean),\n id: String,\n },\n emits: [\"update:value\", \"valueChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createAccordion, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n multiple: props.multiple,\n disabled: props.disabled,\n orientation: props.orientation,\n loop: props.loop,\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}) as unknown as new <Value = unknown, As extends string = \"div\">(\n props: PartGiven<As, RootProps<Value>, RootEmits<Value>> & PublicProps\n) => PartInstance<As, RootProps<Value>, RootEmits<Value>, { state: State[\"root\"] }>\n\nexport interface ItemProps extends AccordionItemOptions, PartComponentProps {\n /** What tells this item from the others; an item that is given none makes its own. */\n value?: unknown\n}\n\n/** `value` tells this item from the others; an item that is given none makes its own. */\nconst Item = defineComponent({\n name: \"AccordionItem\",\n inheritAttrs: false,\n props: { value: { type: ANY, default: undefined as unknown }, disabled: optional(Boolean) },\n setup(props, { attrs, slots }) {\n const options = toSignal(() => ({ disabled: props.disabled }))\n const generated = useId()\n // An item is its value for as long as it is in the page.\n const item = scope\n .use()\n .item(props.value === undefined ? generated : props.value, () => defined(options.get()))\n provide(ITEM, item)\n let stop: (() => void) | undefined\n onMounted(() => {\n stop = item.mount()\n })\n onBeforeUnmount(() => stop?.())\n const Element = partComponent(\"AccordionItemElement\", \"div\", () => item.root)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"item\"], ItemProps>\n\nconst PanelElement = partComponent(\"AccordionPanelElement\", \"div\", () => useItem().panel)\n\nexport interface PanelProps extends PartComponentProps {\n /** Keeps the closed panel in the page, `hidden`. */\n keepMounted?: boolean | undefined\n}\n\n/** `keep-mounted` keeps the closed panel in the page, `hidden`. */\nconst Panel = defineComponent({\n name: \"AccordionPanel\",\n inheritAttrs: false,\n props: { keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const mounted = fromSignal(useItem().mounted)\n return () => (mounted.value || props.keepMounted ? h(PanelElement, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"div\", State[\"panel\"], PanelProps>\n\nexport type HeaderProps = PartComponentProps\nexport type TriggerProps = PartComponentProps\nexport const Accordion = {\n Root,\n Item,\n Header: partComponent<\"h3\", State[\"header\"]>(\"AccordionHeader\", \"h3\", () => useItem().header),\n Trigger: partComponent<\"button\", State[\"trigger\"]>(\n \"AccordionTrigger\",\n \"button\",\n () => useItem().trigger\n ),\n Panel,\n}\n"],"mappings":";;;;;;AAyBA,MAAM,QAAQ,QAAoB,WAAW;AAC7C,MAAM,OAAoC,OAAO,eAAe;AAChE,MA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,QAAQ,QAAQ,IAAI,CAAC,CAAC;EACzF,QAAQ,MAAM,IAAI;EAClB,IAAI;EACJ,gBAAgB;GACd,OAAO,KAAK,MAAM;EACpB,CAAC;EACD,sBAAsB,OAAO,CAAC;EAC9B,MAAM,UAAU,cAAc,wBAAwB,aAAa,KAAK,IAAI;EAC5E,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC;AAED,MAAM,eAAe,cAAc,yBAAyB,aAAa,QAAQ,CAAC,CAAC,KAAK;;AAQxF,MAAM,QAAQ,gBAAgB;CAC5B,MAAM;CACN,cAAc;CACd,OAAO,EAAE,aAAa,QAAQ;CAC9B,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,UAAU,WAAW,QAAQ,CAAC,CAAC,OAAO;EAC5C,aAAc,QAAQ,SAAS,MAAM,cAAc,EAAE,cAAc,OAAO,KAAK,IAAI;CACrF;AACF,CAAC;AAID,MAAa,YAAY;CACvB;CACA;CACA,QAAQ,cAAqC,mBAAmB,YAAY,QAAQ,CAAC,CAAC,MAAM;CAC5F,SAAS,cACP,oBACA,gBACM,QAAQ,CAAC,CAAC,OAClB;CACA;AACF"}
1
+ {"version":3,"file":"accordion.js","names":[],"sources":["../../../../packages/vue/src/accordion.ts"],"sourcesContent":["import { defined, within } from \"@kirana-ui/core\"\nimport type { ChangeDetails, Orientation } from \"@kirana-ui/core\"\nimport { createAccordion } from \"@kirana-ui/core/accordion\"\nimport type {\n AccordionItem,\n AccordionItemOptions,\n AccordionProps,\n Accordion as Controller,\n} from \"@kirana-ui/core/accordion\"\nimport { defineComponent, h, inject, onBeforeUnmount, onMounted, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType, PublicProps } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent, toSignal } from \"./runtime.ts\"\nimport type {\n Changes,\n PartComponent,\n PartComponentProps,\n PartGiven,\n PartInstance,\n StatesOf,\n} from \"./runtime.ts\"\n\ntype State = StatesOf<\"accordion\">\n\nconst scope = context<Controller>(\"Accordion\")\nconst ITEM: InjectionKey<AccordionItem> = Symbol(\"AccordionItem\")\nconst ANY = null as unknown as PropType<unknown>\n\nfunction useItem(): AccordionItem {\n const item = inject(ITEM, undefined)\n if (!item) throw new Error(\"An Accordion part must be inside <Accordion.Item>\")\n return item\n}\n\nconst RootElement = partComponent(\"AccordionRootElement\", \"div\", () => scope.use().root)\n\nexport type RootProps<Value = unknown> = Omit<AccordionProps<Value>, \"id\" | \"onValueChange\"> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type RootEmits<Value = unknown> = Changes<\"value\", Value[]>\n\n/** `v-model:value` (a list), or `value` with `@value-change=\"(value, details) => …\"`. */\nconst Root = defineComponent({\n name: \"AccordionRoot\",\n inheritAttrs: false,\n props: {\n value: optional(Array as PropType<readonly unknown[]>),\n defaultValue: Array as PropType<readonly unknown[]>,\n multiple: Boolean,\n disabled: Boolean,\n orientation: String as PropType<Orientation>,\n loopFocus: optional(Boolean),\n /**\n * Whether the arrows wrap from the last item to the first.\n * @deprecated Base UI's name is `loopFocus`, which wins when both are given.\n */\n loop: optional(Boolean),\n id: String,\n },\n emits: [\"update:value\", \"valueChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createAccordion, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n multiple: props.multiple,\n disabled: props.disabled,\n orientation: props.orientation,\n loop: props.loop,\n loopFocus: props.loopFocus,\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}) as unknown as new <Value = unknown, As extends string = \"div\">(\n props: PartGiven<As, RootProps<Value>, RootEmits<Value>> & PublicProps\n) => PartInstance<As, RootProps<Value>, RootEmits<Value>, { state: State[\"root\"] }>\n\nexport interface ItemProps extends AccordionItemOptions, PartComponentProps {\n /** What tells this item from the others; an item that is given none makes its own. */\n value?: unknown\n}\n\n/** `value` tells this item from the others; an item that is given none makes its own. */\nconst Item = defineComponent({\n name: \"AccordionItem\",\n inheritAttrs: false,\n props: { value: { type: ANY, default: undefined as unknown }, disabled: optional(Boolean) },\n setup(props, { attrs, slots }) {\n const options = toSignal(() => ({ disabled: props.disabled }))\n const generated = useId()\n // An item is its value for as long as it is in the page.\n const item = scope\n .use()\n .item(props.value === undefined ? generated : props.value, () => defined(options.get()))\n provide(ITEM, item)\n let stop: (() => void) | undefined\n onMounted(() => {\n stop = item.mount()\n })\n onBeforeUnmount(() => stop?.())\n const Element = partComponent(\"AccordionItemElement\", \"div\", () => item.root)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"item\"], ItemProps>\n\nconst PanelElement = partComponent(\"AccordionPanelElement\", \"div\", () => useItem().panel)\n\nexport interface PanelProps extends PartComponentProps {\n /** Keeps the closed panel in the page, `hidden`. */\n keepMounted?: boolean | undefined\n}\n\n/** `keep-mounted` keeps the closed panel in the page, `hidden`. */\nconst Panel = defineComponent({\n name: \"AccordionPanel\",\n inheritAttrs: false,\n props: { keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const mounted = fromSignal(useItem().mounted)\n return () => (mounted.value || props.keepMounted ? h(PanelElement, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"div\", State[\"panel\"], PanelProps>\n\nexport type HeaderProps = PartComponentProps\nexport type TriggerProps = PartComponentProps\nexport const Accordion = {\n Root,\n Item,\n Header: partComponent<\"h3\", State[\"header\"]>(\"AccordionHeader\", \"h3\", () => useItem().header),\n Trigger: partComponent<\"button\", State[\"trigger\"]>(\n \"AccordionTrigger\",\n \"button\",\n () => useItem().trigger\n ),\n Panel,\n}\n"],"mappings":";;;;;;AAyBA,MAAM,QAAQ,QAAoB,WAAW;AAC7C,MAAM,OAAoC,OAAO,eAAe;AAChE,MAAM,MAAM;AAEZ,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U,KAAA,IAAY,YAAY,MAAM,aAAa,QAAQ,QAAQ,IAAI,CAAC,CAAC;EACzF,QAAQ,MAAM,IAAI;EAClB,IAAI;EACJ,gBAAgB;GACd,OAAO,KAAK,MAAM;EACpB,CAAC;EACD,sBAAsB,OAAO,CAAC;EAC9B,MAAM,UAAU,cAAc,wBAAwB,aAAa,KAAK,IAAI;EAC5E,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC;AAED,MAAM,eAAe,cAAc,yBAAyB,aAAa,QAAQ,CAAC,CAAC,KAAK;;AAQxF,MAAM,QAAQ,gBAAgB;CAC5B,MAAM;CACN,cAAc;CACd,OAAO,EAAE,aAAa,QAAQ;CAC9B,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,UAAU,WAAW,QAAQ,CAAC,CAAC,OAAO;EAC5C,aAAc,QAAQ,SAAS,MAAM,cAAc,EAAE,cAAc,OAAO,KAAK,IAAI;CACrF;AACF,CAAC;AAID,MAAa,YAAY;CACvB;CACA;CACA,QAAQ,cAAqC,mBAAmB,YAAY,QAAQ,CAAC,CAAC,MAAM;CAC5F,SAAS,cACP,oBACA,gBACM,QAAQ,CAAC,CAAC,OAClB;CACA;AACF"}
@@ -1,4 +1,4 @@
1
1
  import { PortalProps } from "./runtime.js";
2
2
  import { PositionerProps } from "./popover.js";
3
- import { Autocomplete, AutocompleteRootEmits, AutocompleteRootProps, ChipProps, ChipRemoveProps, ChipsProps, ClearProps, CollectionProps, Combobox, EmptyProps, GroupLabelProps, GroupProps, InputProps, ItemIndicatorProps, ItemProps, ListProps, PopupProps, SeparatorProps, StatusProps, TriggerProps, ValueProps } from "./combobox.js";
4
- export { Autocomplete, type AutocompleteRootEmits, type AutocompleteRootProps, type ChipProps, type ChipRemoveProps, type ChipsProps, type ClearProps, type CollectionProps, type Combobox, type EmptyProps, type GroupLabelProps, type GroupProps, type InputProps, type ItemIndicatorProps, type ItemProps, type ListProps, type PopupProps, type PortalProps, type PositionerProps, type AutocompleteRootEmits as RootEmits, type AutocompleteRootProps as RootProps, type SeparatorProps, type StatusProps, type TriggerProps, type ValueProps };
3
+ import { Autocomplete, AutocompleteRootEmits, AutocompleteRootProps, BackdropProps, ChipProps, ChipRemoveProps, ChipsProps, ClearProps, CollectionProps, Combobox, EmptyProps, GroupLabelProps, GroupProps, InputProps, ItemIndicatorProps, ItemProps, ListProps, PopupProps, SeparatorProps, StatusProps, TriggerProps, ValueProps } from "./combobox.js";
4
+ export { Autocomplete, type AutocompleteRootEmits, type AutocompleteRootProps, type BackdropProps, type ChipProps, type ChipRemoveProps, type ChipsProps, type ClearProps, type CollectionProps, type Combobox, type EmptyProps, type GroupLabelProps, type GroupProps, type InputProps, type ItemIndicatorProps, type ItemProps, type ListProps, type PopupProps, type PortalProps, type PositionerProps, type AutocompleteRootEmits as RootEmits, type AutocompleteRootProps as RootProps, type SeparatorProps, type StatusProps, type TriggerProps, type ValueProps };
package/src/avatar.js CHANGED
@@ -37,11 +37,11 @@ const Avatar = {
37
37
  const made = scope.use();
38
38
  watchEffect(() => made.source.set(props.src), { flush: "sync" });
39
39
  whileMounted(made.statusReport(() => (status) => emit("loadingStatusChange", status)));
40
- const status = fromSignal(made.status);
40
+ const mounted = fromSignal(made.imageMounted);
41
41
  return () => props.keepMounted ? h(KeptImageElement, {
42
42
  ...attrs,
43
43
  src: props.src
44
- }) : status.value === "loaded" ? h(ImageElement, attrs) : null;
44
+ }) : mounted.value ? h(ImageElement, attrs) : null;
45
45
  }
46
46
  }),
47
47
  Fallback: defineComponent({
package/src/avatar.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.js","names":[],"sources":["../../../../packages/vue/src/avatar.ts"],"sourcesContent":["import { createAvatar } from \"@kirana-ui/core/avatar\"\nimport type { Avatar as Controller, ImageStatus } from \"@kirana-ui/core/avatar\"\nimport { defineComponent, h, onBeforeUnmount, onMounted, watchEffect } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { context, controller, fromSignal, partComponent } from \"./runtime.ts\"\nimport type { PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"avatar\">\n\nconst scope = context<Controller>(\"Avatar\")\nconst RootElement = partComponent(\"AvatarRootElement\", \"span\", () => scope.use().root)\nconst ImageElement = partComponent(\"AvatarImageElement\", \"img\", () => scope.use().image)\nconst KeptImageElement = partComponent(\"AvatarKeptImageElement\", \"img\", () => scope.use().keptImage)\nconst FallbackElement = partComponent(\"AvatarFallbackElement\", \"span\", () => scope.use().fallback)\n\nexport type RootProps = PartComponentProps\n\nconst Root = defineComponent({\n name: \"AvatarRoot\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n scope.provide(controller(createAvatar, () => ({})))\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"span\", State[\"root\"], RootProps>\n\nexport interface ImageProps extends PartComponentProps {\n /** The picture's address: the part is in the page once it has loaded. */\n src?: string | undefined\n /**\n * Keeps the element in the page while the picture loads, as Base UI's: it loads the\n * picture itself (`loading=\"lazy\"` works), and until it has loaded it is `aria-hidden`,\n * with `data-loading` or `data-error` for the design to hide or fade it by. Default:\n * `false`, the element is drawn once the picture has loaded.\n */\n keepMounted?: boolean | undefined\n}\n\nexport type ImageEmits = {\n /**\n * `@loading-status-change`: each time the picture's loading status changes, `loading` once it\n * has an address, then `loaded` or `error`; `idle` again when its address is taken away. The\n * root says the same in `data-image-loading-status`.\n */\n loadingStatusChange: (status: ImageStatus) => void\n}\n\n/** Runs something with a `mount()` for the component's life in the page. */\nfunction whileMounted(made: { mount(): () => void }) {\n let stop: (() => void) | undefined\n onMounted(() => {\n stop = made.mount()\n })\n onBeforeUnmount(() => stop?.())\n}\n\n/**\n * The picture: in the page once `src` has loaded, or all along with `keep-mounted`.\n * `@loading-status-change` hears its loading.\n */\nconst Image = defineComponent({\n name: \"AvatarImage\",\n inheritAttrs: false,\n props: { src: String, keepMounted: Boolean },\n emits: [\"loadingStatusChange\"],\n setup(props, { attrs, emit }) {\n const made = scope.use()\n watchEffect(() => made.source.set(props.src), { flush: \"sync\" })\n whileMounted(made.statusReport(() => (status) => emit(\"loadingStatusChange\", status)))\n const status = fromSignal(made.status)\n return () =>\n props.keepMounted\n ? h(KeptImageElement, { ...attrs, src: props.src })\n : status.value === \"loaded\"\n ? h(ImageElement, attrs)\n : null\n },\n}) as unknown as PartComponent<\"img\", State[\"image\"], ImageProps, ImageEmits>\n\nexport interface FallbackProps extends PartComponentProps {\n /**\n * How long to wait before showing, in milliseconds, so a picture that loads sooner never\n * lets the fallback be seen. Read once. Default: `0`, at once.\n */\n delay?: number | undefined\n}\n\n/** What shows until the picture has loaded, or when it cannot; after `delay`, when given one. */\nconst Fallback = defineComponent({\n name: \"AvatarFallback\",\n inheritAttrs: false,\n props: { delay: { type: Number as PropType<number>, default: undefined as unknown } },\n setup(props, { attrs, slots }) {\n const presence = scope.use().fallbackPresence({ delay: props.delay as number | undefined })\n whileMounted(presence)\n const shown = fromSignal(presence.shown)\n return () => (shown.value ? h(FallbackElement, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"span\", State[\"fallback\"], FallbackProps>\n\nexport const Avatar = { Root, Image, Fallback }\n"],"mappings":";;;;AAUA,MAAM,QAAQ,QAAoB,QAAQ;AAC1C,MAAM,cAAc,cAAc,qBAAqB,cAAc,MAAM,IAAI,CAAC,CAAC,IAAI;AACrF,MAAM,eAAe,cAAc,sBAAsB,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;AACvF,MAAM,mBAAmB,cAAc,0BAA0B,aAAa,MAAM,IAAI,CAAC,CAAC,SAAS;AACnG,MAAM,kBAAkB,cAAc,yBAAyB,cAAc,MAAM,IAAI,CAAC,CAAC,QAAQ;AAIjG,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,MAAM,QAAQ,EAAE,OAAO,SAAS;EAC9B,MAAM,QAAQ,WAAW,qBAAqB,CAAC,EAAE,CAAC;EAClD,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;;AAwBD,SAAS,aAAa,MAA+B;CACnD,IAAI;CACJ,gBAAgB;EACd,OAAO,KAAK,MAAM;CACpB,CAAC;CACD,sBAAsB,OAAO,CAAC;AAChC;AA8CA,MAAa,SAAS;CAAE;CAAM,OAxChB,gBAAgB;EAC5B,MAAM;EACN,cAAc;EACd,OAAO;GAAE,KAAK;GAAQ,aAAa;EAAQ;EAC3C,OAAO,CAAC,qBAAqB;EAC7B,MAAM,OAAO,EAAE,OAAO,QAAQ;GAC5B,MAAM,OAAO,MAAM,IAAI;GACvB,kBAAkB,KAAK,OAAO,IAAI,MAAM,GAAG,GAAG,EAAE,OAAO,OAAO,CAAC;GAC/D,aAAa,KAAK,oBAAoB,WAAW,KAAK,uBAAuB,MAAM,CAAC,CAAC;GACrF,MAAM,SAAS,WAAW,KAAK,MAAM;GACrC,aACE,MAAM,cACF,EAAE,kBAAkB;IAAE,GAAG;IAAO,KAAK,MAAM;GAAI,CAAC,IAChD,OAAO,UAAU,WACf,EAAE,cAAc,KAAK,IACrB;EACV;CACF,CAuB8B;CAAO,UAZpB,gBAAgB;EAC/B,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO;GAAE,MAAM;GAA4B,SAAS,KAAA;EAAqB,EAAE;EACpF,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,WAAW,MAAM,IAAI,CAAC,CAAC,iBAAiB,EAAE,OAAO,MAAM,MAA4B,CAAC;GAC1F,aAAa,QAAQ;GACrB,MAAM,QAAQ,WAAW,SAAS,KAAK;GACvC,aAAc,MAAM,QAAQ,EAAE,iBAAiB,OAAO,KAAK,IAAI;EACjE;CACF,CAEqC;AAAS"}
1
+ {"version":3,"file":"avatar.js","names":[],"sources":["../../../../packages/vue/src/avatar.ts"],"sourcesContent":["import { createAvatar } from \"@kirana-ui/core/avatar\"\nimport type { Avatar as Controller, ImageStatus } from \"@kirana-ui/core/avatar\"\nimport { defineComponent, h, onBeforeUnmount, onMounted, watchEffect } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { context, controller, fromSignal, partComponent } from \"./runtime.ts\"\nimport type { PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"avatar\">\n\nconst scope = context<Controller>(\"Avatar\")\nconst RootElement = partComponent(\"AvatarRootElement\", \"span\", () => scope.use().root)\nconst ImageElement = partComponent(\"AvatarImageElement\", \"img\", () => scope.use().image)\nconst KeptImageElement = partComponent(\"AvatarKeptImageElement\", \"img\", () => scope.use().keptImage)\nconst FallbackElement = partComponent(\"AvatarFallbackElement\", \"span\", () => scope.use().fallback)\n\nexport type RootProps = PartComponentProps\n\nconst Root = defineComponent({\n name: \"AvatarRoot\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n scope.provide(controller(createAvatar, () => ({})))\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"span\", State[\"root\"], RootProps>\n\nexport interface ImageProps extends PartComponentProps {\n /** The picture's address: the part is in the page once it has loaded. */\n src?: string | undefined\n /**\n * Keeps the element in the page while the picture loads, as Base UI's: it loads the\n * picture itself (`loading=\"lazy\"` works), and until it has loaded it is `aria-hidden`,\n * with `data-loading` or `data-error` for the design to hide or fade it by. Default:\n * `false`, the element is drawn once the picture has loaded.\n */\n keepMounted?: boolean | undefined\n}\n\nexport type ImageEmits = {\n /**\n * `@loading-status-change`: each time the picture's loading status changes, `loading` once it\n * has an address, then `loaded` or `error`; `idle` again when its address is taken away. The\n * root says the same in `data-image-loading-status`.\n */\n loadingStatusChange: (status: ImageStatus) => void\n}\n\n/** Runs something with a `mount()` for the component's life in the page. */\nfunction whileMounted(made: { mount(): () => void }) {\n let stop: (() => void) | undefined\n onMounted(() => {\n stop = made.mount()\n })\n onBeforeUnmount(() => stop?.())\n}\n\n/**\n * The picture: in the page once `src` has loaded, or all along with `keep-mounted`.\n * `@loading-status-change` hears its loading.\n */\nconst Image = defineComponent({\n name: \"AvatarImage\",\n inheritAttrs: false,\n props: { src: String, keepMounted: Boolean },\n emits: [\"loadingStatusChange\"],\n setup(props, { attrs, emit }) {\n const made = scope.use()\n watchEffect(() => made.source.set(props.src), { flush: \"sync\" })\n whileMounted(made.statusReport(() => (status) => emit(\"loadingStatusChange\", status)))\n const mounted = fromSignal(made.imageMounted)\n return () =>\n props.keepMounted\n ? h(KeptImageElement, { ...attrs, src: props.src })\n : mounted.value\n ? h(ImageElement, attrs)\n : null\n },\n}) as unknown as PartComponent<\"img\", State[\"image\"], ImageProps, ImageEmits>\n\nexport interface FallbackProps extends PartComponentProps {\n /**\n * How long to wait before showing, in milliseconds, so a picture that loads sooner never\n * lets the fallback be seen. Read once. Default: `0`, at once.\n */\n delay?: number | undefined\n}\n\n/** What shows until the picture has loaded, or when it cannot; after `delay`, when given one. */\nconst Fallback = defineComponent({\n name: \"AvatarFallback\",\n inheritAttrs: false,\n props: { delay: { type: Number as PropType<number>, default: undefined as unknown } },\n setup(props, { attrs, slots }) {\n const presence = scope.use().fallbackPresence({ delay: props.delay as number | undefined })\n whileMounted(presence)\n const shown = fromSignal(presence.shown)\n return () => (shown.value ? h(FallbackElement, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"span\", State[\"fallback\"], FallbackProps>\n\nexport const Avatar = { Root, Image, Fallback }\n"],"mappings":";;;;AAUA,MAAM,QAAQ,QAAoB,QAAQ;AAC1C,MAAM,cAAc,cAAc,qBAAqB,cAAc,MAAM,IAAI,CAAC,CAAC,IAAI;AACrF,MAAM,eAAe,cAAc,sBAAsB,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;AACvF,MAAM,mBAAmB,cAAc,0BAA0B,aAAa,MAAM,IAAI,CAAC,CAAC,SAAS;AACnG,MAAM,kBAAkB,cAAc,yBAAyB,cAAc,MAAM,IAAI,CAAC,CAAC,QAAQ;AAIjG,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,MAAM,QAAQ,EAAE,OAAO,SAAS;EAC9B,MAAM,QAAQ,WAAW,qBAAqB,CAAC,EAAE,CAAC;EAClD,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;;AAwBD,SAAS,aAAa,MAA+B;CACnD,IAAI;CACJ,gBAAgB;EACd,OAAO,KAAK,MAAM;CACpB,CAAC;CACD,sBAAsB,OAAO,CAAC;AAChC;AA8CA,MAAa,SAAS;CAAE;CAAM,OAxChB,gBAAgB;EAC5B,MAAM;EACN,cAAc;EACd,OAAO;GAAE,KAAK;GAAQ,aAAa;EAAQ;EAC3C,OAAO,CAAC,qBAAqB;EAC7B,MAAM,OAAO,EAAE,OAAO,QAAQ;GAC5B,MAAM,OAAO,MAAM,IAAI;GACvB,kBAAkB,KAAK,OAAO,IAAI,MAAM,GAAG,GAAG,EAAE,OAAO,OAAO,CAAC;GAC/D,aAAa,KAAK,oBAAoB,WAAW,KAAK,uBAAuB,MAAM,CAAC,CAAC;GACrF,MAAM,UAAU,WAAW,KAAK,YAAY;GAC5C,aACE,MAAM,cACF,EAAE,kBAAkB;IAAE,GAAG;IAAO,KAAK,MAAM;GAAI,CAAC,IAChD,QAAQ,QACN,EAAE,cAAc,KAAK,IACrB;EACV;CACF,CAuB8B;CAAO,UAZpB,gBAAgB;EAC/B,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO;GAAE,MAAM;GAA4B,SAAS,KAAA;EAAqB,EAAE;EACpF,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,WAAW,MAAM,IAAI,CAAC,CAAC,iBAAiB,EAAE,OAAO,MAAM,MAA4B,CAAC;GAC1F,aAAa,QAAQ;GACrB,MAAM,QAAQ,WAAW,SAAS,KAAK;GACvC,aAAc,MAAM,QAAQ,EAAE,iBAAiB,OAAO,KAAK,IAAI;EACjE;CACF,CAEqC;AAAS"}
package/src/button.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { PartComponent, PartComponentProps, StatesOf } from "./runtime.js";
2
2
  import { ButtonProps as ButtonProps$1 } from "@kirana-ui/core/button";
3
3
  export interface ButtonProps extends ButtonProps$1, PartComponentProps {}
4
- /** A `<button>`, or with `as` and `:native-button="false"` another element that acts as one. */
4
+ /**
5
+ * A `<button>`, or with `as` and `:native-button="false"` another element that acts as one; a
6
+ * link that navigates (`as="a" href="/x"`, `as-child` on an `<a href>`) stays a link.
7
+ */
5
8
  export declare const Button: PartComponent<"button", StatesOf<"button">["root"], ButtonProps>;
6
9
  //# sourceMappingURL=button.d.ts.map
package/src/button.js CHANGED
@@ -2,7 +2,10 @@ import { controller, optional, partComponent } from "./runtime.js";
2
2
  import { defineComponent, h } from "vue";
3
3
  import { createButton } from "@kirana-ui/core/button";
4
4
  // src/button.ts
5
- /** A `<button>`, or with `as` and `:native-button="false"` another element that acts as one. */
5
+ /**
6
+ * A `<button>`, or with `as` and `:native-button="false"` another element that acts as one; a
7
+ * link that navigates (`as="a" href="/x"`, `as-child` on an `<a href>`) stays a link.
8
+ */
6
9
  const Button = defineComponent({
7
10
  name: "Button",
8
11
  inheritAttrs: false,
package/src/button.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","names":[],"sources":["../../../../packages/vue/src/button.ts"],"sourcesContent":["import { createButton } from \"@kirana-ui/core/button\"\nimport type { ButtonProps as CoreProps } from \"@kirana-ui/core/button\"\nimport { defineComponent, h } from \"vue\"\n\nimport { controller, optional, partComponent } from \"./runtime.ts\"\nimport type { PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\nexport interface ButtonProps extends CoreProps, PartComponentProps {}\n\n/** A `<button>`, or with `as` and `:native-button=\"false\"` another element that acts as one. */\nexport const Button = defineComponent({\n name: \"Button\",\n inheritAttrs: false,\n props: {\n disabled: Boolean,\n focusableWhenDisabled: Boolean,\n nativeButton: optional(Boolean),\n },\n setup(props, { attrs, slots }) {\n const made = controller(createButton, () => ({ ...props }))\n const Element = partComponent(\"ButtonElement\", \"button\", () => made.root)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"button\", StatesOf<\"button\">[\"root\"], ButtonProps>\n"],"mappings":";;;;;AAUA,MAAa,SAAS,gBAAgB;CACpC,MAAM;CACN,cAAc;CACd,OAAO;EACL,UAAU;EACV,uBAAuB;EACvB,cAAc,SAAS,OAAO;CAChC;CACA,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,OAAO,WAAW,qBAAqB,EAAE,GAAG,MAAM,EAAE;EAC1D,MAAM,UAAU,cAAc,iBAAiB,gBAAgB,KAAK,IAAI;EACxE,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC"}
1
+ {"version":3,"file":"button.js","names":[],"sources":["../../../../packages/vue/src/button.ts"],"sourcesContent":["import { createButton } from \"@kirana-ui/core/button\"\nimport type { ButtonProps as CoreProps } from \"@kirana-ui/core/button\"\nimport { defineComponent, h } from \"vue\"\n\nimport { controller, optional, partComponent } from \"./runtime.ts\"\nimport type { PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\nexport interface ButtonProps extends CoreProps, PartComponentProps {}\n\n/**\n * A `<button>`, or with `as` and `:native-button=\"false\"` another element that acts as one; a\n * link that navigates (`as=\"a\" href=\"/x\"`, `as-child` on an `<a href>`) stays a link.\n */\nexport const Button = defineComponent({\n name: \"Button\",\n inheritAttrs: false,\n props: {\n disabled: Boolean,\n focusableWhenDisabled: Boolean,\n nativeButton: optional(Boolean),\n },\n setup(props, { attrs, slots }) {\n const made = controller(createButton, () => ({ ...props }))\n const Element = partComponent(\"ButtonElement\", \"button\", () => made.root)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"button\", StatesOf<\"button\">[\"root\"], ButtonProps>\n"],"mappings":";;;;;;;;AAaA,MAAa,SAAS,gBAAgB;CACpC,MAAM;CACN,cAAc;CACd,OAAO;EACL,UAAU;EACV,uBAAuB;EACvB,cAAc,SAAS,OAAO;CAChC;CACA,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,OAAO,WAAW,qBAAqB,EAAE,GAAG,MAAM,EAAE;EAC1D,MAAM,UAAU,cAAc,iBAAiB,gBAAgB,KAAK,IAAI;EACxE,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC"}
package/src/calendar.d.ts CHANGED
@@ -27,7 +27,10 @@ export interface CellProps extends PartComponentProps {
27
27
  /** The day it is for, as a week of `Calendar.Weeks` gives it. */
28
28
  date: string;
29
29
  }
30
- export type DayProps = CellProps;
30
+ export interface DayProps extends PartComponentProps {
31
+ /** The day it is the button of. Left out, the `Calendar.Cell`'s it is inside. */
32
+ date?: string | undefined;
33
+ }
31
34
  export type PreviousProps = PartComponentProps;
32
35
  export type NextProps = PartComponentProps;
33
36
  export type GridProps = PartComponentProps;
@@ -71,7 +74,7 @@ export declare const Calendar: {
71
74
  readonly unavailable?: true | undefined;
72
75
  readonly rangeStart?: true | undefined;
73
76
  readonly rangeEnd?: true | undefined;
74
- }, CellProps>;
77
+ }, DayProps>;
75
78
  /** The hidden input the value is submitted by, when the root has a `name`. */
76
79
  Input: PartComponent<"input", Record<never, never>, PartComponentProps, {}, unknown>;
77
80
  };
package/src/calendar.js CHANGED
@@ -34,6 +34,7 @@ const Root = defineComponent({
34
34
  Array
35
35
  ],
36
36
  mode: String,
37
+ required: Boolean,
37
38
  minDays: Number,
38
39
  maxDays: Number,
39
40
  months: Number,
@@ -67,6 +68,7 @@ const Root = defineComponent({
67
68
  value: props.value,
68
69
  defaultValue: props.defaultValue,
69
70
  mode: props.mode,
71
+ required: props.required,
70
72
  minDays: props.minDays,
71
73
  maxDays: props.maxDays,
72
74
  months: props.months,
@@ -162,15 +164,19 @@ const HeadCell = defineComponent({
162
164
  return () => h(Element, attrs, slots);
163
165
  }
164
166
  });
167
+ const CELL = Symbol("CalendarCell");
165
168
  const dated = (name, tag, member) => defineComponent({
166
169
  name,
167
170
  inheritAttrs: false,
168
171
  props: { date: {
169
172
  type: String,
170
- required: true
173
+ required: member === "cell"
171
174
  } },
172
175
  setup(props, { attrs, slots }) {
173
- const part = scope.use()[member](props.date, inject(MONTH, void 0));
176
+ const date = props.date ?? inject(CELL, void 0);
177
+ if (date === void 0) throw new Error(`<${name}> needs a date or a Calendar.Cell around it`);
178
+ if (member === "cell") provide(CELL, date);
179
+ const part = scope.use()[member](date, inject(MONTH, void 0));
174
180
  const Element = partComponent(`${name}Element`, tag, () => part);
175
181
  return () => h(Element, attrs, slots);
176
182
  }
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.js","names":[],"sources":["../../../../packages/vue/src/calendar.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCalendar } from \"@kirana-ui/core/calendar\"\nimport type {\n Calendar as Controller,\n CalendarDay,\n CalendarMode,\n CalendarMonth,\n CalendarProps,\n CalendarValue,\n CalendarValueOf,\n CalendarWeekday,\n} from \"@kirana-ui/core/calendar\"\nimport { Fragment, defineComponent, h, inject, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType, PublicProps } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { written } from \"./element.ts\"\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\nimport type {\n Changes,\n PartComponent,\n PartComponentProps,\n PartGiven,\n PartInstance,\n PlainComponent,\n StatesOf,\n} from \"./runtime.ts\"\n\ntype State = StatesOf<\"calendar\">\n\n/**\n * The calendar its parts are inside. Exported for a component that is made of one (a date picker\n * provides its own to the calendar's parts).\n */\nconst scope = context<Controller>(\"Calendar\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as calendarScope }\n\nconst RootElement = partComponent(\"CalendarRootElement\", \"div\", () => scope.use().root)\n\n/** The place of the month its parts are drawn in, inside `Calendar.Months`. */\nconst MONTH: InjectionKey<number> = Symbol(\"CalendarMonth\")\n/** The month a part is drawn in: the one `Calendar.Months` gave, or the first. */\nconst useMonth = () => scope.use().monthAt(inject(MONTH, 0))\n\n/** `value` and its events are typed by `mode`: a day, a range, or a list of days. */\nexport type RootProps<Mode extends CalendarMode = \"single\"> = Omit<\n CalendarProps<Mode>,\n \"id\" | \"onValueChange\" | \"onMonthChange\"\n> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type RootEmits<Mode extends CalendarMode = \"single\"> = Changes<\n \"value\",\n CalendarValueOf<Mode>\n> &\n Changes<\"month\", string>\n\n/**\n * `v-model:value`, `@value-change=\"(value, details) => …\"`; `v-model:month` (the first day of\n * the month shown), `@month-change=\"(month, details) => …\"`.\n */\nconst Root = defineComponent({\n name: \"CalendarRoot\",\n inheritAttrs: false,\n props: {\n value: optional([String, Object, Array] as PropType<CalendarValue>),\n defaultValue: [String, Object, Array] as PropType<CalendarValue>,\n mode: String as PropType<CalendarMode>,\n minDays: Number,\n maxDays: Number,\n months: Number,\n pagedNavigation: Boolean,\n month: optional(String),\n defaultMonth: String,\n defaultFocusedValue: String,\n locale: String,\n calendarSystem: Object as PropType<CalendarProps[\"calendarSystem\"]>,\n min: String,\n max: String,\n isDateUnavailable: Function as PropType<(date: string) => boolean>,\n disabled: Boolean,\n readOnly: Boolean,\n fixedWeeks: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\", \"update:month\", \"monthChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createCalendar, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n mode: props.mode,\n minDays: props.minDays,\n maxDays: props.maxDays,\n months: props.months,\n pagedNavigation: props.pagedNavigation,\n month: props.month,\n defaultMonth: props.defaultMonth,\n defaultFocusedValue: props.defaultFocusedValue,\n locale: props.locale,\n calendarSystem: props.calendarSystem,\n min: props.min,\n max: props.max,\n isDateUnavailable: props.isDateUnavailable,\n disabled: props.disabled,\n readOnly: props.readOnly,\n fixedWeeks: props.fixedWeeks,\n name: props.name,\n form: props.form,\n onValueChange(value: CalendarValue, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onMonthChange(month: string, details: ChangeDetails) {\n emit(\"monthChange\", month, details)\n if (!details.canceled) emit(\"update:month\", month)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as new <Mode extends CalendarMode = \"single\", As extends string = \"div\">(\n props: PartGiven<As, RootProps<Mode>, RootEmits<Mode>> & PublicProps\n) => PartInstance<As, RootProps<Mode>, RootEmits<Mode>, { state: State[\"root\"] }>\n\nexport type HeadingProps = PartComponentProps\n\n/** Names the month shown, unless it is given something else to say. */\nconst Heading = defineComponent({\n name: \"CalendarHeading\",\n inheritAttrs: false,\n setup(_, { attrs, slots }) {\n const month = useMonth()\n const title = fromSignal(month.title)\n // With `as-child` the caller's element holds the text, unless it writes its own.\n const HeadingElement = partComponent(\n \"CalendarHeadingElement\",\n \"div\",\n () => month.heading,\n written(() => title.value)\n )\n return () => h(HeadingElement, attrs, slots.default ?? (() => title.value))\n },\n}) as unknown as PartComponent<\"div\", State[\"heading\"], HeadingProps>\n\nexport type WeekdaysProps = Record<never, never>\n\n/** Its slot once for each day of the week, in the locale's order: `v-slot=\"{ weekday }\"`. */\nconst Weekdays = defineComponent({\n name: \"CalendarWeekdays\",\n setup(_, { slots }) {\n const weekdays = fromSignal(scope.use().weekdays)\n return () =>\n weekdays.value.map((weekday) =>\n h(Fragment, { key: weekday.index }, slots.default?.({ weekday }))\n )\n },\n}) as unknown as PlainComponent<WeekdaysProps, {}, { weekday: CalendarWeekday }>\n\nexport type MonthsProps = Record<never, never>\n\n/** Holds the parts of one month: they are that month's. */\nconst MonthScope = defineComponent({\n name: \"CalendarMonthScope\",\n props: { index: { type: Number, required: true } },\n setup(props, { slots }) {\n // Keyed by its place: a scope is one month's for as long as it is drawn.\n provide(MONTH, props.index)\n return () => slots.default?.()\n },\n})\n\n/**\n * Its slot once for each month shown (`months` on the root), side by side: `v-slot=\"{ month }\"`.\n * The parts inside each are that month's. Left out for one month.\n */\nconst Months = defineComponent({\n name: \"CalendarMonths\",\n setup(_, { slots }) {\n const months = fromSignal(scope.use().months)\n return () =>\n months.value.map((month) =>\n h(MonthScope, { key: month.index, index: month.index }, () => slots.default?.({ month }))\n )\n },\n}) as unknown as PlainComponent<MonthsProps, {}, { month: CalendarMonth }>\n\nexport type WeeksProps = Record<never, never>\n\n/** Its slot once for each week of the month shown: `v-slot=\"{ week }\"`. */\nconst Weeks = defineComponent({\n name: \"CalendarWeeks\",\n setup(_, { slots }) {\n const weeks = fromSignal(useMonth().weeks)\n return () =>\n weeks.value.map((week) => h(Fragment, { key: week[0]!.date }, slots.default?.({ week })))\n },\n}) as unknown as PlainComponent<WeeksProps, {}, { week: readonly CalendarDay[] }>\n\nexport interface HeadCellProps extends PartComponentProps {\n /** The day of the week it names, as `Calendar.Weekdays` gives it. */\n weekday: CalendarWeekday\n}\n\nconst HeadCell = defineComponent({\n name: \"CalendarHeadCell\",\n inheritAttrs: false,\n props: { weekday: { type: Object as PropType<CalendarWeekday>, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().headCell(props.weekday)\n const Element = partComponent(\"CalendarHeadCellElement\", \"th\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"th\", State[\"headCell\"], HeadCellProps>\n\nexport interface CellProps extends PartComponentProps {\n /** The day it is for, as a week of `Calendar.Weeks` gives it. */\n date: string\n}\nexport type DayProps = CellProps\nexport type PreviousProps = PartComponentProps\nexport type NextProps = PartComponentProps\nexport type GridProps = PartComponentProps\nexport type InputProps = PartComponentProps\n\nconst dated = <Tag extends string, Member extends \"cell\" | \"day\">(\n name: string,\n tag: Tag,\n member: Member\n) =>\n defineComponent({\n name,\n inheritAttrs: false,\n props: { date: { type: String, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use()[member](props.date, inject(MONTH, undefined))\n const Element = partComponent<string>(`${name}Element`, tag, () => part)\n return () => h(Element, attrs, slots)\n },\n }) as unknown as PartComponent<Tag, State[Member], CellProps>\n\nexport const Calendar = {\n Root,\n Heading,\n Previous: partComponent<\"button\", State[\"previous\"]>(\n \"CalendarPrevious\",\n \"button\",\n () => scope.use().previous\n ),\n Next: partComponent<\"button\", State[\"next\"]>(\"CalendarNext\", \"button\", () => scope.use().next),\n Months,\n Grid: partComponent<\"table\", State[\"grid\"]>(\"CalendarGrid\", \"table\", () => useMonth().grid),\n Weekdays,\n HeadCell,\n Weeks,\n Cell: dated(\"CalendarCell\", \"td\", \"cell\"),\n Day: dated(\"CalendarDay\", \"button\", \"day\"),\n /** The hidden input the value is submitted by, when the root has a `name`. */\n Input: partComponent<\"input\", State[\"input\"]>(\"CalendarInput\", \"input\", () => scope.use().input),\n}\n"],"mappings":";;;;;;;;;;;AAmCA,MAAM,QAAQ,QAAoB,UAAU;AAI5C,MAAM,cAAc,cAAc,uBAAuB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAGtF,MAAM,QAA8B,OAAO,eAAe;;AAE1D,MAAM,iBAAiB,MAAM,IAAI,CAAC,CAAC,QAAQ,OAAO,OAAO,CAAC,CAAC;;;;;AAoB3D,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,OAAO,SAAS;GAAC;GAAQ;GAAQ;EAAK,CAA4B;EAClE,cAAc;GAAC;GAAQ;GAAQ;EAAK;EACpC,MAAM;EACN,SAAS;EACT,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,OAAO,SAAS,MAAM;EACtB,cAAc;EACd,qBAAqB;EACrB,QAAQ;EACR,gBAAgB;EAChB,KAAK;EACL,KAAK;EACL,mBAAmB;EACnB,UAAU;EACV,UAAU;EACV,YAAY;EACZ,MAAM;EACN,MAAM;EACN,IAAI;CACN;CACA,OAAO;EAAC;EAAgB;EAAe;EAAgB;CAAa;CACpE,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,YAAY,mBAAmB;EACrC,MAAM,QACJ,WAAW,OAAO,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E;CAChD,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,MAAM,OAAO,OAAO,KAAA,CAAS,CAAC;EACrE,MAAM,UAAU,cAAsB,GAAG,KAAK,UAAU,WAAW,IAAI;EACvE,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC;AAEH,MAAa,WAAW;CACtB;CACA;CACA,UAAU,cACR,oBACA,gBACM,MAAM,IAAI,CAAC,CAAC,QACpB;CACA,MAAM,cAAuC,gBAAgB,gBAAgB,MAAM,IAAI,CAAC,CAAC,IAAI;CAC7F;CACA,MAAM,cAAsC,gBAAgB,eAAe,SAAS,CAAC,CAAC,IAAI;CAC1F;CACA;CACA;CACA,MAAM,MAAM,gBAAgB,MAAM,MAAM;CACxC,KAAK,MAAM,eAAe,UAAU,KAAK;;CAEzC,OAAO,cAAuC,iBAAiB,eAAe,MAAM,IAAI,CAAC,CAAC,KAAK;AACjG"}
1
+ {"version":3,"file":"calendar.js","names":[],"sources":["../../../../packages/vue/src/calendar.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCalendar } from \"@kirana-ui/core/calendar\"\nimport type {\n Calendar as Controller,\n CalendarDay,\n CalendarMode,\n CalendarMonth,\n CalendarProps,\n CalendarValue,\n CalendarValueOf,\n CalendarWeekday,\n} from \"@kirana-ui/core/calendar\"\nimport { Fragment, defineComponent, h, inject, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType, PublicProps } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { written } from \"./element.ts\"\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\nimport type {\n Changes,\n PartComponent,\n PartComponentProps,\n PartGiven,\n PartInstance,\n PlainComponent,\n StatesOf,\n} from \"./runtime.ts\"\n\ntype State = StatesOf<\"calendar\">\n\n/**\n * The calendar its parts are inside. Exported for a component that is made of one (a date picker\n * provides its own to the calendar's parts).\n */\nconst scope = context<Controller>(\"Calendar\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as calendarScope }\n\nconst RootElement = partComponent(\"CalendarRootElement\", \"div\", () => scope.use().root)\n\n/** The place of the month its parts are drawn in, inside `Calendar.Months`. */\nconst MONTH: InjectionKey<number> = Symbol(\"CalendarMonth\")\n/** The month a part is drawn in: the one `Calendar.Months` gave, or the first. */\nconst useMonth = () => scope.use().monthAt(inject(MONTH, 0))\n\n/** `value` and its events are typed by `mode`: a day, a range, or a list of days. */\nexport type RootProps<Mode extends CalendarMode = \"single\"> = Omit<\n CalendarProps<Mode>,\n \"id\" | \"onValueChange\" | \"onMonthChange\"\n> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type RootEmits<Mode extends CalendarMode = \"single\"> = Changes<\n \"value\",\n CalendarValueOf<Mode>\n> &\n Changes<\"month\", string>\n\n/**\n * `v-model:value`, `@value-change=\"(value, details) => …\"`; `v-model:month` (the first day of\n * the month shown), `@month-change=\"(month, details) => …\"`.\n */\nconst Root = defineComponent({\n name: \"CalendarRoot\",\n inheritAttrs: false,\n props: {\n value: optional([String, Object, Array] as PropType<CalendarValue>),\n defaultValue: [String, Object, Array] as PropType<CalendarValue>,\n mode: String as PropType<CalendarMode>,\n required: Boolean,\n minDays: Number,\n maxDays: Number,\n months: Number,\n pagedNavigation: Boolean,\n month: optional(String),\n defaultMonth: String,\n defaultFocusedValue: String,\n locale: String,\n calendarSystem: Object as PropType<CalendarProps[\"calendarSystem\"]>,\n min: String,\n max: String,\n isDateUnavailable: Function as PropType<(date: string) => boolean>,\n disabled: Boolean,\n readOnly: Boolean,\n fixedWeeks: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\", \"update:month\", \"monthChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createCalendar, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n mode: props.mode,\n required: props.required,\n minDays: props.minDays,\n maxDays: props.maxDays,\n months: props.months,\n pagedNavigation: props.pagedNavigation,\n month: props.month,\n defaultMonth: props.defaultMonth,\n defaultFocusedValue: props.defaultFocusedValue,\n locale: props.locale,\n calendarSystem: props.calendarSystem,\n min: props.min,\n max: props.max,\n isDateUnavailable: props.isDateUnavailable,\n disabled: props.disabled,\n readOnly: props.readOnly,\n fixedWeeks: props.fixedWeeks,\n name: props.name,\n form: props.form,\n onValueChange(value: CalendarValue, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onMonthChange(month: string, details: ChangeDetails) {\n emit(\"monthChange\", month, details)\n if (!details.canceled) emit(\"update:month\", month)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as new <Mode extends CalendarMode = \"single\", As extends string = \"div\">(\n props: PartGiven<As, RootProps<Mode>, RootEmits<Mode>> & PublicProps\n) => PartInstance<As, RootProps<Mode>, RootEmits<Mode>, { state: State[\"root\"] }>\n\nexport type HeadingProps = PartComponentProps\n\n/** Names the month shown, unless it is given something else to say. */\nconst Heading = defineComponent({\n name: \"CalendarHeading\",\n inheritAttrs: false,\n setup(_, { attrs, slots }) {\n const month = useMonth()\n const title = fromSignal(month.title)\n // With `as-child` the caller's element holds the text, unless it writes its own.\n const HeadingElement = partComponent(\n \"CalendarHeadingElement\",\n \"div\",\n () => month.heading,\n written(() => title.value)\n )\n return () => h(HeadingElement, attrs, slots.default ?? (() => title.value))\n },\n}) as unknown as PartComponent<\"div\", State[\"heading\"], HeadingProps>\n\nexport type WeekdaysProps = Record<never, never>\n\n/** Its slot once for each day of the week, in the locale's order: `v-slot=\"{ weekday }\"`. */\nconst Weekdays = defineComponent({\n name: \"CalendarWeekdays\",\n setup(_, { slots }) {\n const weekdays = fromSignal(scope.use().weekdays)\n return () =>\n weekdays.value.map((weekday) =>\n h(Fragment, { key: weekday.index }, slots.default?.({ weekday }))\n )\n },\n}) as unknown as PlainComponent<WeekdaysProps, {}, { weekday: CalendarWeekday }>\n\nexport type MonthsProps = Record<never, never>\n\n/** Holds the parts of one month: they are that month's. */\nconst MonthScope = defineComponent({\n name: \"CalendarMonthScope\",\n props: { index: { type: Number, required: true } },\n setup(props, { slots }) {\n // Keyed by its place: a scope is one month's for as long as it is drawn.\n provide(MONTH, props.index)\n return () => slots.default?.()\n },\n})\n\n/**\n * Its slot once for each month shown (`months` on the root), side by side: `v-slot=\"{ month }\"`.\n * The parts inside each are that month's. Left out for one month.\n */\nconst Months = defineComponent({\n name: \"CalendarMonths\",\n setup(_, { slots }) {\n const months = fromSignal(scope.use().months)\n return () =>\n months.value.map((month) =>\n h(MonthScope, { key: month.index, index: month.index }, () => slots.default?.({ month }))\n )\n },\n}) as unknown as PlainComponent<MonthsProps, {}, { month: CalendarMonth }>\n\nexport type WeeksProps = Record<never, never>\n\n/** Its slot once for each week of the month shown: `v-slot=\"{ week }\"`. */\nconst Weeks = defineComponent({\n name: \"CalendarWeeks\",\n setup(_, { slots }) {\n const weeks = fromSignal(useMonth().weeks)\n return () =>\n weeks.value.map((week) => h(Fragment, { key: week[0]!.date }, slots.default?.({ week })))\n },\n}) as unknown as PlainComponent<WeeksProps, {}, { week: readonly CalendarDay[] }>\n\nexport interface HeadCellProps extends PartComponentProps {\n /** The day of the week it names, as `Calendar.Weekdays` gives it. */\n weekday: CalendarWeekday\n}\n\nconst HeadCell = defineComponent({\n name: \"CalendarHeadCell\",\n inheritAttrs: false,\n props: { weekday: { type: Object as PropType<CalendarWeekday>, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().headCell(props.weekday)\n const Element = partComponent(\"CalendarHeadCellElement\", \"th\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"th\", State[\"headCell\"], HeadCellProps>\n\nexport interface CellProps extends PartComponentProps {\n /** The day it is for, as a week of `Calendar.Weeks` gives it. */\n date: string\n}\nexport interface DayProps extends PartComponentProps {\n /** The day it is the button of. Left out, the `Calendar.Cell`'s it is inside. */\n date?: string | undefined\n}\nexport type PreviousProps = PartComponentProps\nexport type NextProps = PartComponentProps\nexport type GridProps = PartComponentProps\nexport type InputProps = PartComponentProps\n\n// The day a cell holds, for the day button inside it.\nconst CELL: InjectionKey<string> = Symbol(\"CalendarCell\")\n\nconst dated = <Tag extends string, Member extends \"cell\" | \"day\", Props>(\n name: string,\n tag: Tag,\n member: Member\n) =>\n defineComponent({\n name,\n inheritAttrs: false,\n props: { date: { type: String, required: member === \"cell\" } },\n setup(props, { attrs, slots }) {\n const date = props.date ?? inject(CELL, undefined)\n if (date === undefined) throw new Error(`<${name}> needs a date or a Calendar.Cell around it`)\n if (member === \"cell\") provide(CELL, date)\n const part = scope.use()[member](date, inject(MONTH, undefined))\n const Element = partComponent<string>(`${name}Element`, tag, () => part)\n return () => h(Element, attrs, slots)\n },\n }) as unknown as PartComponent<Tag, State[Member], Props>\n\nexport const Calendar = {\n Root,\n Heading,\n Previous: partComponent<\"button\", State[\"previous\"]>(\n \"CalendarPrevious\",\n \"button\",\n () => scope.use().previous\n ),\n Next: partComponent<\"button\", State[\"next\"]>(\"CalendarNext\", \"button\", () => scope.use().next),\n Months,\n Grid: partComponent<\"table\", State[\"grid\"]>(\"CalendarGrid\", \"table\", () => useMonth().grid),\n Weekdays,\n HeadCell,\n Weeks,\n Cell: dated<\"td\", \"cell\", CellProps>(\"CalendarCell\", \"td\", \"cell\"),\n Day: dated<\"button\", \"day\", DayProps>(\"CalendarDay\", \"button\", \"day\"),\n /** The hidden input the value is submitted by, when the root has a `name`. */\n Input: partComponent<\"input\", State[\"input\"]>(\"CalendarInput\", \"input\", () => scope.use().input),\n}\n"],"mappings":";;;;;;;;;;;AAmCA,MAAM,QAAQ,QAAoB,UAAU;AAI5C,MAAM,cAAc,cAAc,uBAAuB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAGtF,MAAM,QAA8B,OA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AAuC,gBAAgB,gBAAgB,MAAM,IAAI,CAAC,CAAC,IAAI;CAC7F;CACA,MAAM,cAAsC,gBAAgB,eAAe,SAAS,CAAC,CAAC,IAAI;CAC1F;CACA;CACA;CACA,MAAM,MAA+B,gBAAgB,MAAM,MAAM;CACjE,KAAK,MAAiC,eAAe,UAAU,KAAK;;CAEpE,OAAO,cAAuC,iBAAiB,eAAe,MAAM,IAAI,CAAC,CAAC,KAAK;AACjG"}
package/src/carousel.d.ts CHANGED
@@ -8,8 +8,11 @@ export type ViewportProps = PartComponentProps;
8
8
  export type PreviousProps = PartComponentProps;
9
9
  export type NextProps = PartComponentProps;
10
10
  export interface ItemProps extends PartComponentProps {
11
- /** Its place among the slides, from 0. */
12
- index: number;
11
+ /**
12
+ * Its place among the slides, from 0. Left out, its place in the page, once it is there:
13
+ * give it on a page a server draws, which cannot count them.
14
+ */
15
+ index?: number | undefined;
13
16
  }
14
17
  export interface IndicatorProps extends PartComponentProps {
15
18
  /** The slide it goes to, from 0. */
package/src/carousel.js CHANGED
@@ -44,10 +44,7 @@ const Carousel = {
44
44
  Item: defineComponent({
45
45
  name: "CarouselItem",
46
46
  inheritAttrs: false,
47
- props: { index: {
48
- type: Number,
49
- required: true
50
- } },
47
+ props: { index: Number },
51
48
  setup(props, { attrs, slots }) {
52
49
  const part = scope.use().item(props.index);
53
50
  const Element = partComponent("CarouselItemElement", "div", () => part);
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.js","names":[],"sources":["../../../../packages/vue/src/carousel.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails, Orientation } from \"@kirana-ui/core\"\nimport { createCarousel } from \"@kirana-ui/core/carousel\"\nimport type { CarouselProps, Carousel as Controller } from \"@kirana-ui/core/carousel\"\nimport { defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, optional, partComponent } from \"./runtime.ts\"\nimport type { Changes, PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"carousel\">\n\nconst scope = context<Controller>(\"Carousel\")\n\nconst RootElement = partComponent(\"CarouselRootElement\", \"div\", () => scope.use().root)\n\nexport type RootProps = Omit<CarouselProps, \"id\" | \"onIndexChange\"> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type RootEmits = Changes<\"index\", number>\n\n/** `v-model:index`, and `@index-change=\"(index, details) => …\"`. */\nconst Root = defineComponent({\n name: \"CarouselRoot\",\n inheritAttrs: false,\n props: {\n index: optional(Number),\n defaultIndex: Number,\n orientation: String as PropType<Orientation>,\n loop: Boolean,\n id: String,\n },\n emits: [\"update:index\", \"indexChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createCarousel, { direction }), () => ({\n id: props.id ?? generated,\n index: props.index,\n defaultIndex: props.defaultIndex,\n orientation: props.orientation,\n loop: props.loop,\n onIndexChange: (index: number, details: ChangeDetails) => {\n emit(\"indexChange\", index, details)\n if (!details.canceled) emit(\"update:index\", index)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"root\"], RootProps, RootEmits>\n\nexport type ViewportProps = PartComponentProps\nexport type PreviousProps = PartComponentProps\nexport type NextProps = PartComponentProps\nconst Viewport = partComponent<\"div\", State[\"viewport\"]>(\n \"CarouselViewport\",\n \"div\",\n () => scope.use().viewport\n)\nconst Previous = partComponent<\"button\", State[\"previous\"]>(\n \"CarouselPrevious\",\n \"button\",\n () => scope.use().previous\n)\nconst Next = partComponent<\"button\", State[\"next\"]>(\n \"CarouselNext\",\n \"button\",\n () => scope.use().next\n)\n\nexport interface ItemProps extends PartComponentProps {\n /** Its place among the slides, from 0. */\n index: number\n}\n\nconst Item = defineComponent({\n name: \"CarouselItem\",\n inheritAttrs: false,\n props: { index: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().item(props.index)\n const Element = partComponent(\"CarouselItemElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"item\"], ItemProps>\n\nexport interface IndicatorProps extends PartComponentProps {\n /** The slide it goes to, from 0. */\n index: number\n}\n\nconst Indicator = defineComponent({\n name: \"CarouselIndicator\",\n inheritAttrs: false,\n props: { index: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().indicator(props.index)\n const Element = partComponent(\"CarouselIndicatorElement\", \"button\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"button\", State[\"indicator\"], IndicatorProps>\n\nexport const Carousel = { Root, Viewport, Item, Previous, Next, Indicator }\n"],"mappings":";;;;;;AAaA,MAAM,QAAQ,QAAoB,UAAU;AAE5C,MAAM,cAAc,cAAc,uBAAuB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAStF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,OAAO,SAAS,MAAM;EACtB,cAAc;EACd,aAAa;EACb,MAAM;EACN,IAAI;CACN;CACA,OAAO,CAAC,gBAAgB,aAAa;CACrC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,YAAY,mBAAmB;EACrC,MAAM,QACJ,WAAW,OAAO,gBAAgB,EAAE,UAAU,CAAC,UAAU;GACvD,IAAI,MAAM,MAAM;GAChB,OAAO,MAAM;GACb,cAAc,MAAM;GACpB,aAAa,MAAM;GACnB,MAAM,MAAM;GACZ,gBAAgB,OAAe,YAA2B;IACxD,KAAK,eAAe,OAAO,OAAO;IAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;GACnD;EACF,EAAE,CACJ;EACA,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;AAKD,MAAM,WAAW,cACf,oBACA,aACM,MAAM,IAAI,CAAC,CAAC,QACpB;AACA,MAAM,WAAW,cACf,oBACA,gBACM,MAAM,IAAI,CAAC,CAAC,QACpB;AACA,MAAM,OAAO,cACX,gBACA,gBACM,MAAM,IAAI,CAAC,CAAC,IACpB;AAkCA,MAAa,WAAW;CAAE;CAAM;CAAU,MA3B7B,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO;GAAE,MAAM;GAAQ,UAAU;EAAK,EAAE;EACjD,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;GACzC,MAAM,UAAU,cAAc,uBAAuB,aAAa,IAAI;GACtE,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAkB0C;CAAM;CAAU;CAAM,WAX9C,gBAAgB;EAChC,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO;GAAE,MAAM;GAAQ,UAAU;EAAK,EAAE;EACjD,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,UAAU,MAAM,KAAK;GAC9C,MAAM,UAAU,cAAc,4BAA4B,gBAAgB,IAAI;GAC9E,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAEgE;AAAU"}
1
+ {"version":3,"file":"carousel.js","names":[],"sources":["../../../../packages/vue/src/carousel.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails, Orientation } from \"@kirana-ui/core\"\nimport { createCarousel } from \"@kirana-ui/core/carousel\"\nimport type { CarouselProps, Carousel as Controller } from \"@kirana-ui/core/carousel\"\nimport { defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, optional, partComponent } from \"./runtime.ts\"\nimport type { Changes, PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"carousel\">\n\nconst scope = context<Controller>(\"Carousel\")\n\nconst RootElement = partComponent(\"CarouselRootElement\", \"div\", () => scope.use().root)\n\nexport type RootProps = Omit<CarouselProps, \"id\" | \"onIndexChange\"> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type RootEmits = Changes<\"index\", number>\n\n/** `v-model:index`, and `@index-change=\"(index, details) => …\"`. */\nconst Root = defineComponent({\n name: \"CarouselRoot\",\n inheritAttrs: false,\n props: {\n index: optional(Number),\n defaultIndex: Number,\n orientation: String as PropType<Orientation>,\n loop: Boolean,\n id: String,\n },\n emits: [\"update:index\", \"indexChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createCarousel, { direction }), () => ({\n id: props.id ?? generated,\n index: props.index,\n defaultIndex: props.defaultIndex,\n orientation: props.orientation,\n loop: props.loop,\n onIndexChange: (index: number, details: ChangeDetails) => {\n emit(\"indexChange\", index, details)\n if (!details.canceled) emit(\"update:index\", index)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"root\"], RootProps, RootEmits>\n\nexport type ViewportProps = PartComponentProps\nexport type PreviousProps = PartComponentProps\nexport type NextProps = PartComponentProps\nconst Viewport = partComponent<\"div\", State[\"viewport\"]>(\n \"CarouselViewport\",\n \"div\",\n () => scope.use().viewport\n)\nconst Previous = partComponent<\"button\", State[\"previous\"]>(\n \"CarouselPrevious\",\n \"button\",\n () => scope.use().previous\n)\nconst Next = partComponent<\"button\", State[\"next\"]>(\n \"CarouselNext\",\n \"button\",\n () => scope.use().next\n)\n\nexport interface ItemProps extends PartComponentProps {\n /**\n * Its place among the slides, from 0. Left out, its place in the page, once it is there:\n * give it on a page a server draws, which cannot count them.\n */\n index?: number | undefined\n}\n\nconst Item = defineComponent({\n name: \"CarouselItem\",\n inheritAttrs: false,\n props: { index: Number },\n setup(props, { attrs, slots }) {\n const part = scope.use().item(props.index)\n const Element = partComponent(\"CarouselItemElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"item\"], ItemProps>\n\nexport interface IndicatorProps extends PartComponentProps {\n /** The slide it goes to, from 0. */\n index: number\n}\n\nconst Indicator = defineComponent({\n name: \"CarouselIndicator\",\n inheritAttrs: false,\n props: { index: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().indicator(props.index)\n const Element = partComponent(\"CarouselIndicatorElement\", \"button\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"button\", State[\"indicator\"], IndicatorProps>\n\nexport const Carousel = { Root, Viewport, Item, Previous, Next, Indicator }\n"],"mappings":";;;;;;AAaA,MAAM,QAAQ,QAAoB,UAAU;AAE5C,MAAM,cAAc,cAAc,uBAAuB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAStF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,OAAO,SAAS,MAAM;EACtB,cAAc;EACd,aAAa;EACb,MAAM;EACN,IAAI;CACN;CACA,OAAO,CAAC,gBAAgB,aAAa;CACrC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,YAAY,mBAAmB;EACrC,MAAM,QACJ,WAAW,OAAO,gBAAgB,EAAE,UAAU,CAAC,UAAU;GACvD,IAAI,MAAM,MAAM;GAChB,OAAO,MAAM;GACb,cAAc,MAAM;GACpB,aAAa,MAAM;GACnB,MAAM,MAAM;GACZ,gBAAgB,OAAe,YAA2B;IACxD,KAAK,eAAe,OAAO,OAAO;IAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;GACnD;EACF,EAAE,CACJ;EACA,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;AAKD,MAAM,WAAW,cACf,oBACA,aACM,MAAM,IAAI,CAAC,CAAC,QACpB;AACA,MAAM,WAAW,cACf,oBACA,gBACM,MAAM,IAAI,CAAC,CAAC,QACpB;AACA,MAAM,OAAO,cACX,gBACA,gBACM,MAAM,IAAI,CAAC,CAAC,IACpB;AAqCA,MAAa,WAAW;CAAE;CAAM;CAAU,MA3B7B,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO,OAAO;EACvB,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;GACzC,MAAM,UAAU,cAAc,uBAAuB,aAAa,IAAI;GACtE,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAkB0C;CAAM;CAAU;CAAM,WAX9C,gBAAgB;EAChC,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO;GAAE,MAAM;GAAQ,UAAU;EAAK,EAAE;EACjD,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,UAAU,MAAM,KAAK;GAC9C,MAAM,UAAU,cAAc,4BAA4B,gBAAgB,IAAI;GAC9E,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAEgE;AAAU"}
package/src/checkbox.d.ts CHANGED
@@ -4,6 +4,10 @@ export type RootProps = Omit<CheckboxProps, "id" | "onCheckedChange"> & {
4
4
  id?: string | undefined;
5
5
  } & PartComponentProps;
6
6
  export type RootEmits = Changes<"checked", boolean>;
7
+ /**
8
+ * A dash while mixed and a tick while checked, from the slot's state: `<Checkbox.Indicator
9
+ * v-slot="{ state }">{{ state.indeterminate ? "–" : "✓" }}</Checkbox.Indicator>`.
10
+ */
7
11
  export interface IndicatorProps extends PartComponentProps {
8
12
  /** Keeps the mark in the page while the box is unchecked. */
9
13
  keepMounted?: boolean | undefined;
@@ -15,6 +19,12 @@ export declare const Checkbox: {
15
19
  readonly disabled?: true | undefined;
16
20
  readonly readonly?: true | undefined;
17
21
  readonly required?: true | undefined;
22
+ readonly touched?: true | undefined;
23
+ readonly dirty?: true | undefined;
24
+ readonly filled?: true | undefined;
25
+ readonly focused?: true | undefined;
26
+ readonly valid?: true | undefined;
27
+ readonly invalid?: true | undefined;
18
28
  readonly indeterminate?: true | undefined;
19
29
  readonly parent?: true | undefined;
20
30
  }, RootProps, RootEmits>;
@@ -24,6 +34,12 @@ export declare const Checkbox: {
24
34
  readonly disabled?: true | undefined;
25
35
  readonly readonly?: true | undefined;
26
36
  readonly required?: true | undefined;
37
+ readonly touched?: true | undefined;
38
+ readonly dirty?: true | undefined;
39
+ readonly filled?: true | undefined;
40
+ readonly focused?: true | undefined;
41
+ readonly valid?: true | undefined;
42
+ readonly invalid?: true | undefined;
27
43
  readonly indeterminate?: true | undefined;
28
44
  readonly startingStyle?: true | undefined;
29
45
  readonly endingStyle?: true | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","names":[],"sources":["../../../../packages/vue/src/checkbox.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCheckbox } from \"@kirana-ui/core/checkbox\"\nimport type { CheckboxProps, Checkbox as Controller } from \"@kirana-ui/core/checkbox\"\nimport { defineComponent, h, inject, useId } from \"vue\"\n\nimport { CHECKBOX_GROUP } from \"./checkbox-group-context.ts\"\nimport { useFieldAround } from \"./field-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\nimport type { Changes, PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"checkbox\">\n\nconst scope = context<Controller>(\"Checkbox\")\n\nconst Input = partComponent(\"CheckboxInput\", \"input\", () => scope.use().input)\n// Its native input is the element's last child, whatever element the caller asked for.\nconst RootElement = partComponent(\n \"CheckboxRootElement\",\n \"span\",\n () => scope.use().root,\n (content) => [content, h(Input)]\n)\n\nexport type RootProps = Omit<CheckboxProps, \"id\" | \"onCheckedChange\"> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type RootEmits = Changes<\"checked\", boolean>\n\n/** `v-model:checked`, or `checked` with `@checked-change=\"(checked, details) => …\"`. */\nconst Root = defineComponent({\n name: \"CheckboxRoot\",\n inheritAttrs: false,\n props: {\n checked: optional(Boolean),\n defaultChecked: Boolean,\n indeterminate: Boolean,\n parent: Boolean,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n value: String,\n id: String,\n },\n emits: [\"update:checked\", \"checkedChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const field = useFieldAround()\n const group = inject(CHECKBOX_GROUP, null) ?? undefined\n scope.provide(\n controller(within(createCheckbox, { field, group }), () => ({\n id: props.id ?? generated,\n checked: props.checked,\n defaultChecked: props.defaultChecked,\n indeterminate: props.indeterminate,\n parent: props.parent,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n name: props.name,\n form: props.form,\n value: props.value,\n onCheckedChange(checked: boolean, details: ChangeDetails) {\n emit(\"checkedChange\", checked, details)\n if (!details.canceled) emit(\"update:checked\", checked)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"span\", State[\"root\"], RootProps, RootEmits>\n\nconst IndicatorElement = partComponent(\n \"CheckboxIndicatorElement\",\n \"span\",\n () => scope.use().indicator\n)\n\nexport interface IndicatorProps extends PartComponentProps {\n /** Keeps the mark in the page while the box is unchecked. */\n keepMounted?: boolean | undefined\n}\n\n/** `keep-mounted` keeps the mark in the page while the box is unchecked. */\nconst Indicator = defineComponent({\n name: \"CheckboxIndicator\",\n inheritAttrs: false,\n props: { keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const mounted = fromSignal(scope.use().indicatorMounted)\n return () => (mounted.value || props.keepMounted ? h(IndicatorElement, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"span\", State[\"indicator\"], IndicatorProps>\n\nexport const Checkbox = { Root, Indicator }\n"],"mappings":";;;;;;;AAaA,MAAM,QAAQ,QAAoB,UAAU;AAE5C,MAAM,QAAQ,cAAc,iBAAiB,eAAe,MAAM,IAAI,CAAC,CA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c,QAAQ,SAAS,MAAM,cAAc,EAAE,kBAAkB,OAAO,KAAK,IAAI;EACzF;CACF,CAEgC;AAAU"}
1
+ {"version":3,"file":"checkbox.js","names":[],"sources":["../../../../packages/vue/src/checkbox.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCheckbox } from \"@kirana-ui/core/checkbox\"\nimport type { CheckboxProps, Checkbox as Controller } from \"@kirana-ui/core/checkbox\"\nimport { defineComponent, h, inject, useId } from \"vue\"\n\nimport { CHECKBOX_GROUP } from \"./checkbox-group-context.ts\"\nimport { useFieldAround } from \"./field-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\nimport type { Changes, PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"checkbox\">\n\nconst scope = context<Controller>(\"Checkbox\")\n\nconst Input = partComponent(\"CheckboxInput\", \"input\", () => scope.use().input)\n// Its native input is the element's last child, whatever element the caller asked for.\nconst RootElement = partComponent(\n \"CheckboxRootElement\",\n \"span\",\n () => scope.use().root,\n (content) => [content, h(Input)]\n)\n\nexport type RootProps = Omit<CheckboxProps, \"id\" | \"onCheckedChange\"> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type RootEmits = Changes<\"checked\", boolean>\n\n/** `v-model:checked`, or `checked` with `@checked-change=\"(checked, details) => …\"`. */\nconst Root = defineComponent({\n name: \"CheckboxRoot\",\n inheritAttrs: false,\n props: {\n checked: optional(Boolean),\n defaultChecked: Boolean,\n indeterminate: Boolean,\n parent: Boolean,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n value: String,\n id: String,\n },\n emits: [\"update:checked\", \"checkedChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const field = useFieldAround()\n const group = inject(CHECKBOX_GROUP, null) ?? undefined\n scope.provide(\n controller(within(createCheckbox, { field, group }), () => ({\n id: props.id ?? generated,\n checked: props.checked,\n defaultChecked: props.defaultChecked,\n indeterminate: props.indeterminate,\n parent: props.parent,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n name: props.name,\n form: props.form,\n value: props.value,\n onCheckedChange(checked: boolean, details: ChangeDetails) {\n emit(\"checkedChange\", checked, details)\n if (!details.canceled) emit(\"update:checked\", checked)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"span\", State[\"root\"], RootProps, RootEmits>\n\nconst IndicatorElement = partComponent(\n \"CheckboxIndicatorElement\",\n \"span\",\n () => scope.use().indicator\n)\n\n/**\n * A dash while mixed and a tick while checked, from the slot's state: `<Checkbox.Indicator\n * v-slot=\"{ state }\">{{ state.indeterminate ? \"–\" : \"✓\" }}</Checkbox.Indicator>`.\n */\nexport interface IndicatorProps extends PartComponentProps {\n /** Keeps the mark in the page while the box is unchecked. */\n keepMounted?: boolean | undefined\n}\n\n/** `keep-mounted` keeps the mark in the page while the box is unchecked. */\nconst Indicator = defineComponent({\n name: \"CheckboxIndicator\",\n inheritAttrs: false,\n props: { keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const mounted = fromSignal(scope.use().indicatorMounted)\n return () => (mounted.value || props.keepMounted ? h(IndicatorElement, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"span\", State[\"indicator\"], IndicatorProps>\n\nexport const Checkbox = { Root, Indicator }\n"],"mappings":";;;;;;;AAaA,MAAM,QAAQ,QAAoB,UAAU;AAE5C,MAAM,QAAQ,cAAc,iBAAiB,eAAe,MAAM,IAAI,CAAC,CAAC,KAAK;AAE7E,MAAM,cAAc,cAClB,uBACA,cACM,MAAM,IAAI,CAAC,CAAC,OACjB,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CACjC;;AASA,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,SAAS,SAAS,OAAO;EACzB,gBAAgB;EAChB,eAAe;EACf,QAAQ;EACR,UAAU;EACV,UAAU;EACV,UAAU;EACV,MAAM;EACN,MAAM;EACN,OAAO;EACP,IAAI;CACN;CACA,OAAO,CAAC,kBAAkB,eAAe;CACzC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,QAAQ,eAAe;EAC7B,MAAM,QAAQ,OAAO,gBAAgB,IAAI,KAAK,KAAA;EAC9C,MAAM,QACJ,WAAW,OAAO,gBAAgB;GAAE;GAAO;EAAM,CAAC,UAAU;GAC1D,IAAI,MAAM,MAAM;GAChB,SAAS,MAAM;GACf,gBAAgB,MAAM;GACtB,eAAe,MAAM;GACrB,QAAQ,MAAM;GACd,UAAU,MAAM;GAChB,UAAU,MAAM;GAChB,UAAU,MAAM;GAChB,MAAM,MAAM;GACZ,MAAM,MAAM;GACZ,OAAO,MAAM;GACb,gBAAgB,SAAkB,SAAwB;IACxD,KAAK,iBAAiB,SAAS,OAAO;IACtC,IAAI,CAAC,QAAQ,UAAU,KAAK,kBAAkB,OAAO;GACvD;EACF,EAAE,CACJ;EACA,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;AAED,MAAM,mBAAmB,cACvB,4BACA,cACM,MAAM,IAAI,CAAC,CAAC,SACpB;AAsBA,MAAa,WAAW;CAAE;CAAM,WAVd,gBAAgB;EAChC,MAAM;EACN,cAAc;EACd,OAAO,EAAE,aAAa,QAAQ;EAC9B,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,UAAU,WAAW,MAAM,IAAI,CAAC,CAAC,gBAAgB;GACvD,aAAc,QAAQ,SAAS,MAAM,cAAc,EAAE,kBAAkB,OAAO,KAAK,IAAI;EACzF;CACF,CAEgC;AAAU"}
@@ -14,6 +14,8 @@ export declare const Collapsible: {
14
14
  readonly open?: true | undefined;
15
15
  readonly closed?: true | undefined;
16
16
  readonly disabled?: true | undefined;
17
+ readonly startingStyle?: true | undefined;
18
+ readonly endingStyle?: true | undefined;
17
19
  }, RootProps, RootEmits>;
18
20
  Trigger: PartComponent<"button", {
19
21
  readonly panelOpen?: true | undefined;