@kirana-ui/web 0.2.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 (132) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/llms.txt +1598 -143
  3. package/package.json +48 -3
  4. package/skills/kirana-ui-primitives/SKILL.md +53 -12
  5. package/src/accordion.d.ts +1 -1
  6. package/src/accordion.js +2 -1
  7. package/src/accordion.js.map +1 -1
  8. package/src/alert-dialog.d.ts +2 -2
  9. package/src/alert-dialog.js +9 -4
  10. package/src/alert-dialog.js.map +1 -1
  11. package/src/around.d.ts +28 -4
  12. package/src/around.js +46 -13
  13. package/src/around.js.map +1 -1
  14. package/src/autocomplete.d.ts +7 -4
  15. package/src/autocomplete.js +8 -4
  16. package/src/autocomplete.js.map +1 -1
  17. package/src/avatar.d.ts +11 -5
  18. package/src/avatar.js +41 -12
  19. package/src/avatar.js.map +1 -1
  20. package/src/button.d.ts +2 -1
  21. package/src/button.js +2 -1
  22. package/src/button.js.map +1 -1
  23. package/src/calendar.d.ts +9 -5
  24. package/src/calendar.js +22 -9
  25. package/src/calendar.js.map +1 -1
  26. package/src/carousel.d.ts +1 -1
  27. package/src/carousel.js +4 -2
  28. package/src/carousel.js.map +1 -1
  29. package/src/checkbox-group.d.ts +22 -0
  30. package/src/checkbox-group.js +36 -0
  31. package/src/checkbox-group.js.map +1 -0
  32. package/src/checkbox.d.ts +4 -2
  33. package/src/checkbox.js +10 -4
  34. package/src/checkbox.js.map +1 -1
  35. package/src/color-picker.d.ts +28 -0
  36. package/src/color-picker.js +81 -0
  37. package/src/color-picker.js.map +1 -0
  38. package/src/combobox.d.ts +27 -7
  39. package/src/combobox.js +79 -17
  40. package/src/combobox.js.map +1 -1
  41. package/src/command.d.ts +3 -3
  42. package/src/command.js +6 -5
  43. package/src/command.js.map +1 -1
  44. package/src/context-menu.d.ts +2 -1
  45. package/src/context-menu.js.map +1 -1
  46. package/src/date-field.d.ts +2 -2
  47. package/src/date-field.js +3 -3
  48. package/src/date-field.js.map +1 -1
  49. package/src/date-picker.d.ts +14 -8
  50. package/src/date-picker.js +49 -10
  51. package/src/date-picker.js.map +1 -1
  52. package/src/dates.d.ts +11 -5
  53. package/src/dates.js +58 -20
  54. package/src/dates.js.map +1 -1
  55. package/src/dialog.d.ts +3 -2
  56. package/src/dialog.js +12 -4
  57. package/src/dialog.js.map +1 -1
  58. package/src/drawer.d.ts +2 -1
  59. package/src/drawer.js +7 -3
  60. package/src/drawer.js.map +1 -1
  61. package/src/editable.d.ts +21 -0
  62. package/src/editable.js +56 -0
  63. package/src/editable.js.map +1 -0
  64. package/src/file-upload.d.ts +23 -0
  65. package/src/file-upload.js +98 -0
  66. package/src/file-upload.js.map +1 -0
  67. package/src/hover-card.d.ts +2 -1
  68. package/src/hover-card.js.map +1 -1
  69. package/src/index.d.ts +29 -7
  70. package/src/index.js +11 -0
  71. package/src/menu.d.ts +4 -3
  72. package/src/menu.js +19 -10
  73. package/src/menu.js.map +1 -1
  74. package/src/menubar.d.ts +2 -2
  75. package/src/menubar.js +5 -3
  76. package/src/menubar.js.map +1 -1
  77. package/src/navigation-menu.d.ts +4 -3
  78. package/src/navigation-menu.js +10 -6
  79. package/src/navigation-menu.js.map +1 -1
  80. package/src/number-field.d.ts +5 -2
  81. package/src/number-field.js +23 -3
  82. package/src/number-field.js.map +1 -1
  83. package/src/otp.d.ts +4 -2
  84. package/src/otp.js +24 -4
  85. package/src/otp.js.map +1 -1
  86. package/src/password-input.d.ts +20 -0
  87. package/src/password-input.js +39 -0
  88. package/src/password-input.js.map +1 -0
  89. package/src/popover.d.ts +8 -7
  90. package/src/popover.js +33 -5
  91. package/src/popover.js.map +1 -1
  92. package/src/radio-group.d.ts +2 -1
  93. package/src/radio-group.js +9 -2
  94. package/src/radio-group.js.map +1 -1
  95. package/src/rating.d.ts +18 -0
  96. package/src/rating.js +54 -0
  97. package/src/rating.js.map +1 -0
  98. package/src/runtime.d.ts +9 -4
  99. package/src/runtime.js +8 -5
  100. package/src/runtime.js.map +1 -1
  101. package/src/select.d.ts +12 -4
  102. package/src/select.js +33 -10
  103. package/src/select.js.map +1 -1
  104. package/src/slider.d.ts +2 -2
  105. package/src/slider.js +3 -2
  106. package/src/slider.js.map +1 -1
  107. package/src/steps.d.ts +17 -0
  108. package/src/steps.js +47 -0
  109. package/src/steps.js.map +1 -0
  110. package/src/tags-input.d.ts +35 -0
  111. package/src/tags-input.js +96 -0
  112. package/src/tags-input.js.map +1 -0
  113. package/src/time-field.d.ts +18 -0
  114. package/src/time-field.js +54 -0
  115. package/src/time-field.js.map +1 -0
  116. package/src/toast.d.ts +4 -3
  117. package/src/toast.js +6 -4
  118. package/src/toast.js.map +1 -1
  119. package/src/toggle-group.d.ts +1 -1
  120. package/src/toggle-group.js +2 -1
  121. package/src/toggle-group.js.map +1 -1
  122. package/src/toolbar.d.ts +0 -6
  123. package/src/toolbar.js +14 -3
  124. package/src/toolbar.js.map +1 -1
  125. package/src/tooltip.d.ts +2 -1
  126. package/src/tooltip.js.map +1 -1
  127. package/src/tour.d.ts +27 -0
  128. package/src/tour.js +62 -0
  129. package/src/tour.js.map +1 -0
  130. package/src/tree.d.ts +29 -0
  131. package/src/tree.js +99 -0
  132. package/src/tree.js.map +1 -0
package/src/select.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import { ElementOf, Tag } from "./runtime.js";
2
+ import { Placed } from "./around.js";
2
3
  import { Select, SelectProps } from "@kirana-ui/core/select";
3
- type Props = Omit<SelectProps<string>, "values" | "defaultValues"> & {
4
+ type Props = Omit<SelectProps<string, boolean>, "value" | "defaultValue" | "values" | "defaultValues"> & {
5
+ /** With `multiple`, the chosen values, with commas between. */
6
+ value?: string | readonly string[] | null;
7
+ defaultValue?: string | readonly string[] | null;
4
8
  values?: string | readonly string[];
5
9
  defaultValues?: string | readonly string[];
6
10
  };
@@ -15,8 +19,12 @@ type Props = Omit<SelectProps<string>, "values" | "defaultValues"> & {
15
19
  * it draws the hidden input a form reads. A `value` part that holds something says what the
16
20
  * page wrote there: a `<template kui-each="values">` in it is drawn for each chosen value
17
21
  * (`{value}`, `{label}`), in the items' order. `value`, `default-value`, `open`,
18
- * `default-open`, `disabled`, `required`, `multiple`, `values` and `default-values` (with
19
- * commas between), `name`, `form`; `items` as a property; it tells `value-change`,
22
+ * `default-open`, `disabled`, `read-only`, `required`, `multiple` (with it, `value`
23
+ * and `default-value` hold the chosen values with commas between; `values` and
24
+ * `default-values`, the older names, are still read), `name`, `form`, `presentation` (`sheet` opens the list from the bottom edge,
25
+ * modal, over a `backdrop` part in the portal; `auto` on a narrow touch screen) and
26
+ * `sheet-below`; `items`, `itemToStringLabel` and `itemToStringValue` as
27
+ * properties; it tells `value-change`,
20
28
  * `values-change` and `open-change`.
21
29
  */
22
30
  export declare const tag: Tag<Props, Select<string>>;
@@ -26,7 +34,7 @@ declare global {
26
34
  "value-change": ["onValueChange", "value"];
27
35
  "values-change": ["onValuesChange", "values"];
28
36
  "open-change": ["onOpenChange", "open"];
29
- }>;
37
+ }> & Placed;
30
38
  }
31
39
  }
32
40
  export {};
package/src/select.js CHANGED
@@ -1,4 +1,4 @@
1
- import { MARK, fieldAround, itemOptions, list, once, positioner, valueOf } from "./around.js";
1
+ import { fieldAround, itemOptions, list, once, positioner, valueOf } from "./around.js";
2
2
  import { defineElement, partAround } from "./runtime.js";
3
3
  import { computed } from "@kirana-ui/core";
4
4
  import { createSelect } from "@kirana-ui/core/select";
@@ -21,8 +21,12 @@ const arrow = (drawn) => ({
21
21
  * it draws the hidden input a form reads. A `value` part that holds something says what the
22
22
  * page wrote there: a `<template kui-each="values">` in it is drawn for each chosen value
23
23
  * (`{value}`, `{label}`), in the items' order. `value`, `default-value`, `open`,
24
- * `default-open`, `disabled`, `required`, `multiple`, `values` and `default-values` (with
25
- * commas between), `name`, `form`; `items` as a property; it tells `value-change`,
24
+ * `default-open`, `disabled`, `read-only`, `required`, `multiple` (with it, `value`
25
+ * and `default-value` hold the chosen values with commas between; `values` and
26
+ * `default-values`, the older names, are still read), `name`, `form`, `presentation` (`sheet` opens the list from the bottom edge,
27
+ * modal, over a `backdrop` part in the portal; `auto` on a narrow touch screen) and
28
+ * `sheet-below`; `items`, `itemToStringLabel` and `itemToStringValue` as
29
+ * properties; it tells `value-change`,
26
30
  * `values-change` and `open-change`.
27
31
  */
28
32
  const tag = defineElement({
@@ -33,20 +37,34 @@ const tag = defineElement({
33
37
  open: "boolean",
34
38
  "default-open": "boolean",
35
39
  disabled: "boolean",
40
+ "read-only": "boolean",
36
41
  required: "boolean",
37
42
  multiple: "boolean",
38
43
  values: "string",
39
44
  "default-values": "string",
40
45
  name: "string",
41
- form: "string"
46
+ form: "string",
47
+ presentation: "string",
48
+ "sheet-below": "number"
42
49
  },
43
- properties: ["items"],
50
+ properties: [
51
+ "items",
52
+ "itemToStringLabel",
53
+ "itemToStringValue"
54
+ ],
44
55
  create: (props, host) => createSelect(computed(() => {
45
56
  const own = props.get();
57
+ const many = (given) => own.multiple ? list(given) : given;
46
58
  return {
47
59
  ...own,
60
+ value: many(own.value),
61
+ defaultValue: many(own.defaultValue),
48
62
  values: list(own.values),
49
- defaultValues: list(own.defaultValues)
63
+ defaultValues: list(own.defaultValues),
64
+ onValueChange(value, details) {
65
+ own.onValueChange?.(value, details);
66
+ if (own.multiple && Array.isArray(value)) own.onValuesChange?.(value, details);
67
+ }
50
68
  };
51
69
  }), { field: fieldAround(host) }),
52
70
  lists: { values: (controller) => ({
@@ -88,6 +106,7 @@ const tag = defineElement({
88
106
  return positioner(controller, element);
89
107
  },
90
108
  popup: (controller) => controller.popup,
109
+ backdrop: (controller) => controller.backdrop,
91
110
  list: (controller) => controller.list,
92
111
  "scroll-up-arrow": (controller) => arrow(controller.scrollArrow("up")),
93
112
  "scroll-down-arrow": (controller) => arrow(controller.scrollArrow("down")),
@@ -96,10 +115,14 @@ const tag = defineElement({
96
115
  separator: (controller) => controller.separator,
97
116
  item: (controller, element) => controller.item(valueOf(element), itemOptions(element)),
98
117
  "item-text": (controller, element) => controller.itemText(valueOf(partAround(element, "item"))),
99
- "item-indicator": (controller, element) => ({
100
- part: MARK,
101
- mounted: controller.selected(valueOf(partAround(element, "item")))
102
- })
118
+ "item-indicator"(controller, element) {
119
+ const mark = controller.itemIndicator(valueOf(partAround(element, "item")));
120
+ return {
121
+ part: mark,
122
+ mounted: mark.mounted,
123
+ mount: mark.mount
124
+ };
125
+ }
103
126
  }
104
127
  });
105
128
  export { tag };
package/src/select.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","names":[],"sources":["../../../../packages/web/src/select.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createSelect } from \"@kirana-ui/core/select\"\nimport type { Select, SelectGroup, SelectProps, SelectScrollArrow } from \"@kirana-ui/core/select\"\n\nimport { fieldAround, itemOptions, list, MARK, once, positioner, valueOf } from \"./around.ts\"\nimport { defineElement, partAround } from \"./runtime.ts\"\nimport type { Drawn, Each, ElementOf } from \"./runtime.ts\"\n\ntype Props = Omit<SelectProps<string>, \"values\" | \"defaultValues\"> & {\n values?: string | readonly string[]\n defaultValues?: string | readonly string[]\n}\n\nconst groups = new WeakMap<HTMLElement, SelectGroup>()\nlet made = 0\n\nconst arrow = (drawn: SelectScrollArrow): Drawn => ({\n part: drawn.part,\n mounted: drawn.mounted,\n mount: () => drawn.mount(),\n})\n\n/**\n * `<kui-select>` around a `kui-part=\"trigger\"` button holding a `value` (it says the chosen\n * item's text, or its `kui-placeholder`; with `multiple`, the chosen items' texts with commas\n * between), and a `portal` with a `positioner` (its `kui-side`\n * and the like, and `kui-align-item-with-trigger`) around the `popup`. The popup holds an\n * `item` for each `kui-value` (`kui-disabled`, `kui-label`), each with an `item-text` and an\n * `item-indicator`; items may be in a `group` with a `group-label`, with `separator`s\n * between, and in a `list` between a `scroll-up-arrow` and a `scroll-down-arrow`. With a name\n * it draws the hidden input a form reads. A `value` part that holds something says what the\n * page wrote there: a `<template kui-each=\"values\">` in it is drawn for each chosen value\n * (`{value}`, `{label}`), in the items' order. `value`, `default-value`, `open`,\n * `default-open`, `disabled`, `required`, `multiple`, `values` and `default-values` (with\n * commas between), `name`, `form`; `items` as a property; it tells `value-change`,\n * `values-change` and `open-change`.\n */\nexport const tag = defineElement<Props, Select<string>>({\n tag: \"kui-select\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n open: \"boolean\",\n \"default-open\": \"boolean\",\n disabled: \"boolean\",\n required: \"boolean\",\n multiple: \"boolean\",\n values: \"string\",\n \"default-values\": \"string\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"items\"],\n create: (props, host) =>\n createSelect<string>(\n computed(() => {\n const own = props.get()\n return { ...own, values: list(own.values), defaultValues: list(own.defaultValues) }\n }),\n { field: fieldAround(host) }\n ),\n lists: {\n values: (controller): Each<{ value: string; label: string }> => ({\n entries: computed(() => {\n const { values, labels } = controller.shown.get()\n return values.map((value, at) => ({ value, label: labels[at] ?? value }))\n }),\n key: (chosen) => chosen.value,\n }),\n },\n inner: (controller) => ({ part: controller.input, mounted: controller.named }),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValuesChange: { event: \"values-change\", prop: \"values\" },\n onOpenChange: { event: \"open-change\", prop: \"open\" },\n },\n parts: {\n trigger: (controller) => controller.trigger,\n value: (controller, element) => ({\n part: controller.valuePart,\n text: computed(\n () => controller.label.get() ?? element.getAttribute(\"kui-placeholder\") ?? undefined\n ),\n }),\n positioner(controller, element) {\n controller.alignItemWithTrigger.set(element.hasAttribute(\"kui-align-item-with-trigger\"))\n return positioner(controller, element)\n },\n popup: (controller) => controller.popup,\n list: (controller) => controller.list,\n \"scroll-up-arrow\": (controller) => arrow(controller.scrollArrow(\"up\")),\n \"scroll-down-arrow\": (controller) => arrow(controller.scrollArrow(\"down\")),\n group: (controller, element) =>\n once(groups, element, (group) =>\n controller.group(group.getAttribute(\"kui-id\") ?? `kui-select-group-${++made}`)\n )?.root,\n // Outside a group it is plain text, and names nothing.\n \"group-label\": (controller, element) =>\n groups.get(partAround(element, \"group\")!)?.label ?? controller.groupLabel,\n separator: (controller) => controller.separator,\n item: (controller, element) => controller.item(valueOf(element), itemOptions(element)),\n \"item-text\": (controller, element) => controller.itemText(valueOf(partAround(element, \"item\"))),\n \"item-indicator\": (controller, element) => ({\n part: MARK,\n mounted: controller.selected(valueOf(partAround(element, \"item\"))),\n }),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-select\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"values-change\": [\"onValuesChange\", \"values\"]\n \"open-change\": [\"onOpenChange\", \"open\"]\n }\n >\n }\n}\n"],"mappings":";;;;;AAaA,MAAM,yBAAS,IAAI,QAAkC;AACrD,IAAI,OAAO;AAEX,MAAM,SAAS,WAAqC;CAClD,MAAM,MAAM;CACZ,SAAS,MAAM;CACf,aAAa,MAAM,MAAM;AAC3B;;;;;;;;;;;;;;;;AAiBA,MAAa,MAAM,cAAqC;CACtD,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,MAAM;EACN,gBAAgB;EAChB,UAAU;EACV,UAAU;EACV,UAAU;EACV,QAAQ;EACR,kBAAkB;EAClB,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,OAAO;CACpB,SAAS,OAAO,SACd,aACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GAAE,GAAG;GAAK,QAAQ,KAAK,IAAI,MAAM;GAAG,eAAe,KAAK,IAAI,aAAa;EAAE;CACpF,CAAC,GACD,EAAE,OAAO,YAAY,IAAI,EAAE,CAC7B;CACF,OAAO,EACL,SAAS,gBAAwD;EAC/D,SAAS,eAAe;GACtB,MAAM,EAAE,QAAQ,WAAW,WAAW,MAAM,IAAI;GAChD,OAAO,OAAO,KAAK,OAAO,QAAQ;IAAE;IAAO,OAAO,OAAO,OAAO;GAAM,EAAE;EAC1E,CAAC;EACD,MAAM,WAAW,OAAO;CAC1B,GACF;CACA,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAO,SAAS,WAAW;CAAM;CAC5E,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,gBAAgB;GAAE,OAAO;GAAiB,MAAM;EAAS;EACzD,cAAc;GAAE,OAAO;GAAe,MAAM;EAAO;CACrD;CACA,OAAO;EACL,UAAU,eAAe,WAAW;EACpC,QAAQ,YAAY,aAAa;GAC/B,MAAM,WAAW;GACjB,MAAM,eACE,WAAW,MAAM,IAAI,KAAK,QAAQ,aAAa,iBAAiB,KAAK,KAAA,CAC7E;EACF;EACA,WAAW,YAAY,SAAS;GAC9B,WAAW,qBAAqB,IAAI,QAAQ,aAAa,6BAA6B,CAAC;GACvF,OAAO,WAAW,YAAY,OAAO;EACvC;EACA,QAAQ,eAAe,WAAW;EAClC,OAAO,eAAe,WAAW;EACjC,oBAAoB,eAAe,MAAM,WAAW,YAAY,IAAI,CAAC;EACrE,sBAAsB,eAAe,MAAM,WAAW,YAAY,MAAM,CAAC;EACzE,QAAQ,YAAY,YAClB,KAAK,QAAQ,UAAU,UACrB,WAAW,MAAM,MAAM,aAAa,QAAQ,KAAK,oBAAoB,EAAE,MAAM,CAC/E,CAAC,EAAE;EAEL,gBAAgB,YAAY,YAC1B,OAAO,IAAI,WAAW,SAAS,OAAO,CAAE,CAAC,EAAE,SAAS,WAAW;EACjE,YAAY,eAAe,WAAW;EACtC,OAAO,YAAY,YAAY,WAAW,KAAK,QAAQ,OAAO,GAAG,YAAY,OAAO,CAAC;EACrF,cAAc,YAAY,YAAY,WAAW,SAAS,QAAQ,WAAW,SAAS,MAAM,CAAC,CAAC;EAC9F,mBAAmB,YAAY,aAAa;GAC1C,MAAM;GACN,SAAS,WAAW,SAAS,QAAQ,WAAW,SAAS,MAAM,CAAC,CAAC;EACnE;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"select.js","names":[],"sources":["../../../../packages/web/src/select.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createSelect } from \"@kirana-ui/core/select\"\nimport type { Select, SelectGroup, SelectProps, SelectScrollArrow } from \"@kirana-ui/core/select\"\n\nimport { fieldAround, itemOptions, list, once, positioner, valueOf } from \"./around.ts\"\nimport type { Placed } from \"./around.ts\"\nimport { defineElement, partAround } from \"./runtime.ts\"\nimport type { Drawn, Each, ElementOf } from \"./runtime.ts\"\n\ntype Props = Omit<\n SelectProps<string, boolean>,\n \"value\" | \"defaultValue\" | \"values\" | \"defaultValues\"\n> & {\n /** With `multiple`, the chosen values, with commas between. */\n value?: string | readonly string[] | null\n defaultValue?: string | readonly string[] | null\n values?: string | readonly string[]\n defaultValues?: string | readonly string[]\n}\n\nconst groups = new WeakMap<HTMLElement, SelectGroup>()\nlet made = 0\n\nconst arrow = (drawn: SelectScrollArrow): Drawn => ({\n part: drawn.part,\n mounted: drawn.mounted,\n mount: () => drawn.mount(),\n})\n\n/**\n * `<kui-select>` around a `kui-part=\"trigger\"` button holding a `value` (it says the chosen\n * item's text, or its `kui-placeholder`; with `multiple`, the chosen items' texts with commas\n * between), and a `portal` with a `positioner` (its `kui-side`\n * and the like, and `kui-align-item-with-trigger`) around the `popup`. The popup holds an\n * `item` for each `kui-value` (`kui-disabled`, `kui-label`), each with an `item-text` and an\n * `item-indicator`; items may be in a `group` with a `group-label`, with `separator`s\n * between, and in a `list` between a `scroll-up-arrow` and a `scroll-down-arrow`. With a name\n * it draws the hidden input a form reads. A `value` part that holds something says what the\n * page wrote there: a `<template kui-each=\"values\">` in it is drawn for each chosen value\n * (`{value}`, `{label}`), in the items' order. `value`, `default-value`, `open`,\n * `default-open`, `disabled`, `read-only`, `required`, `multiple` (with it, `value`\n * and `default-value` hold the chosen values with commas between; `values` and\n * `default-values`, the older names, are still read), `name`, `form`, `presentation` (`sheet` opens the list from the bottom edge,\n * modal, over a `backdrop` part in the portal; `auto` on a narrow touch screen) and\n * `sheet-below`; `items`, `itemToStringLabel` and `itemToStringValue` as\n * properties; it tells `value-change`,\n * `values-change` and `open-change`.\n */\nexport const tag = defineElement<Props, Select<string>>({\n tag: \"kui-select\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n open: \"boolean\",\n \"default-open\": \"boolean\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n multiple: \"boolean\",\n values: \"string\",\n \"default-values\": \"string\",\n name: \"string\",\n form: \"string\",\n presentation: \"string\",\n \"sheet-below\": \"number\",\n },\n properties: [\"items\", \"itemToStringLabel\", \"itemToStringValue\"],\n create: (props, host) =>\n createSelect<string, boolean>(\n computed(() => {\n const own = props.get()\n // With `multiple`, Base UI's `value` holding the list; the older `values` still read.\n const many = <Given>(given: Given) => (own.multiple ? list(given) : given)\n return {\n ...own,\n value: many(own.value) as string | readonly string[] | null | undefined,\n defaultValue: many(own.defaultValue) as string | readonly string[] | null | undefined,\n values: list(own.values),\n defaultValues: list(own.defaultValues),\n onValueChange(value: string | string[] | null, details: ChangeDetails) {\n own.onValueChange?.(value, details)\n // The older event too: a listener cannot be told from none.\n if (own.multiple && Array.isArray(value)) own.onValuesChange?.(value, details)\n },\n }\n }),\n { field: fieldAround(host) }\n ),\n lists: {\n values: (controller): Each<{ value: string; label: string }> => ({\n entries: computed(() => {\n const { values, labels } = controller.shown.get()\n return values.map((value, at) => ({ value, label: labels[at] ?? value }))\n }),\n key: (chosen) => chosen.value,\n }),\n },\n inner: (controller) => ({ part: controller.input, mounted: controller.named }),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValuesChange: { event: \"values-change\", prop: \"values\" },\n onOpenChange: { event: \"open-change\", prop: \"open\" },\n },\n parts: {\n trigger: (controller) => controller.trigger,\n value: (controller, element) => ({\n part: controller.valuePart,\n text: computed(\n () => controller.label.get() ?? element.getAttribute(\"kui-placeholder\") ?? undefined\n ),\n }),\n positioner(controller, element) {\n controller.alignItemWithTrigger.set(element.hasAttribute(\"kui-align-item-with-trigger\"))\n return positioner(controller, element)\n },\n popup: (controller) => controller.popup,\n backdrop: (controller) => controller.backdrop,\n list: (controller) => controller.list,\n \"scroll-up-arrow\": (controller) => arrow(controller.scrollArrow(\"up\")),\n \"scroll-down-arrow\": (controller) => arrow(controller.scrollArrow(\"down\")),\n group: (controller, element) =>\n once(groups, element, (group) =>\n controller.group(group.getAttribute(\"kui-id\") ?? `kui-select-group-${++made}`)\n )?.root,\n // Outside a group it is plain text, and names nothing.\n \"group-label\": (controller, element) =>\n groups.get(partAround(element, \"group\")!)?.label ?? controller.groupLabel,\n separator: (controller) => controller.separator,\n item: (controller, element) => controller.item(valueOf(element), itemOptions(element)),\n \"item-text\": (controller, element) => controller.itemText(valueOf(partAround(element, \"item\"))),\n \"item-indicator\"(controller, element) {\n // In the page while chosen, and through its exit.\n const mark = controller.itemIndicator(valueOf(partAround(element, \"item\")))\n return { part: mark, mounted: mark.mounted, mount: mark.mount }\n },\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-select\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"values-change\": [\"onValuesChange\", \"values\"]\n \"open-change\": [\"onOpenChange\", \"open\"]\n }\n > &\n Placed\n }\n}\n"],"mappings":";;;;;AAqBA,MAAM,yBAAS,IAAI,QAAkC;AACrD,IAAI,OAAO;AAEX,MAAM,SAAS,WAAqC;CAClD,MAAM,MAAM;CACZ,SAAS,MAAM;CACf,aAAa,MAAM,MAAM;AAC3B;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,MAAM,cAAqC;CACtD,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,MAAM;EACN,gBAAgB;EAChB,UAAU;EACV,aAAa;EACb,UAAU;EACV,UAAU;EACV,QAAQ;EACR,kBAAkB;EAClB,MAAM;EACN,MAAM;EACN,cAAc;EACd,eAAe;CACjB;CACA,YAAY;EAAC;EAAS;EAAqB;CAAmB;CAC9D,SAAS,OAAO,SACd,aACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EAEtB,MAAM,QAAe,UAAkB,IAAI,WAAW,KAAK,KAAK,IAAI;EACpE,OAAO;GACL,GAAG;GACH,OAAO,KAAK,IAAI,KAAK;GACrB,cAAc,KAAK,IAAI,YAAY;GACnC,QAAQ,KAAK,IAAI,MAAM;GACvB,eAAe,KAAK,IAAI,aAAa;GACrC,cAAc,OAAiC,SAAwB;IACrE,IAAI,gBAAgB,OAAO,OAAO;IAElC,IAAI,IAAI,YAAY,MAAM,QAAQ,KAAK,GAAG,IAAI,iBAAiB,OAAO,OAAO;GAC/E;EACF;CACF,CAAC,GACD,EAAE,OAAO,YAAY,IAAI,EAAE,CAC7B;CACF,OAAO,EACL,SAAS,gBAAwD;EAC/D,SAAS,eAAe;GACtB,MAAM,EAAE,QAAQ,WAAW,WAAW,MAAM,IAAI;GAChD,OAAO,OAAO,KAAK,OAAO,QAAQ;IAAE;IAAO,OAAO,OAAO,OAAO;GAAM,EAAE;EAC1E,CAAC;EACD,MAAM,WAAW,OAAO;CAC1B,GACF;CACA,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAO,SAAS,WAAW;CAAM;CAC5E,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,gBAAgB;GAAE,OAAO;GAAiB,MAAM;EAAS;EACzD,cAAc;GAAE,OAAO;GAAe,MAAM;EAAO;CACrD;CACA,OAAO;EACL,UAAU,eAAe,WAAW;EACpC,QAAQ,YAAY,aAAa;GAC/B,MAAM,WAAW;GACjB,MAAM,eACE,WAAW,MAAM,IAAI,KAAK,QAAQ,aAAa,iBAAiB,KAAK,KAAA,CAC7E;EACF;EACA,WAAW,YAAY,SAAS;GAC9B,WAAW,qBAAqB,IAAI,QAAQ,aAAa,6BAA6B,CAAC;GACvF,OAAO,WAAW,YAAY,OAAO;EACvC;EACA,QAAQ,eAAe,WAAW;EAClC,WAAW,eAAe,WAAW;EACrC,OAAO,eAAe,WAAW;EACjC,oBAAoB,eAAe,MAAM,WAAW,YAAY,IAAI,CAAC;EACrE,sBAAsB,eAAe,MAAM,WAAW,YAAY,MAAM,CAAC;EACzE,QAAQ,YAAY,YAClB,KAAK,QAAQ,UAAU,UACrB,WAAW,MAAM,MAAM,aAAa,QAAQ,KAAK,oBAAoB,EAAE,MAAM,CAC/E,CAAC,EAAE;EAEL,gBAAgB,YAAY,YAC1B,OAAO,IAAI,WAAW,SAAS,OAAO,CAAE,CAAC,EAAE,SAAS,WAAW;EACjE,YAAY,eAAe,WAAW;EACtC,OAAO,YAAY,YAAY,WAAW,KAAK,QAAQ,OAAO,GAAG,YAAY,OAAO,CAAC;EACrF,cAAc,YAAY,YAAY,WAAW,SAAS,QAAQ,WAAW,SAAS,MAAM,CAAC,CAAC;EAC9F,iBAAiB,YAAY,SAAS;GAEpC,MAAM,OAAO,WAAW,cAAc,QAAQ,WAAW,SAAS,MAAM,CAAC,CAAC;GAC1E,OAAO;IAAE,MAAM;IAAM,SAAS,KAAK;IAAS,OAAO,KAAK;GAAM;EAChE;CACF;AACF,CAAC"}
package/src/slider.d.ts CHANGED
@@ -9,8 +9,8 @@ type Props = Omit<SliderProps, "value" | "defaultValue"> & {
9
9
  * a `control` with its `track`, `indicator` and a `thumb` for each value, in the values'
10
10
  * order (or each with its `kui-index`). A thumb draws the hidden input a form reads. `value` and
11
11
  * `default-value` (a range with a comma), `min`, `max`, `step`, `large-step`,
12
- * `min-steps-between-values`, `thumb-alignment`, `orientation`, `disabled`, `name`, `form`,
13
- * `locale`; it tells `value-change` and `value-committed`.
12
+ * `min-steps-between-values`, `thumb-alignment`, `orientation`, `disabled`, `read-only`,
13
+ * `name`, `form`, `locale`; it tells `value-change` and `value-committed`.
14
14
  */
15
15
  export declare const tag: Tag<Props, Slider>;
16
16
  declare global {
package/src/slider.js CHANGED
@@ -11,8 +11,8 @@ const at = (element) => element.hasAttribute("kui-index") ? Number(element.getAt
11
11
  * a `control` with its `track`, `indicator` and a `thumb` for each value, in the values'
12
12
  * order (or each with its `kui-index`). A thumb draws the hidden input a form reads. `value` and
13
13
  * `default-value` (a range with a comma), `min`, `max`, `step`, `large-step`,
14
- * `min-steps-between-values`, `thumb-alignment`, `orientation`, `disabled`, `name`, `form`,
15
- * `locale`; it tells `value-change` and `value-committed`.
14
+ * `min-steps-between-values`, `thumb-alignment`, `orientation`, `disabled`, `read-only`,
15
+ * `name`, `form`, `locale`; it tells `value-change` and `value-committed`.
16
16
  */
17
17
  const tag = defineElement({
18
18
  tag: "kui-slider",
@@ -27,6 +27,7 @@ const tag = defineElement({
27
27
  "thumb-alignment": "string",
28
28
  orientation: "string",
29
29
  disabled: "boolean",
30
+ "read-only": "boolean",
30
31
  name: "string",
31
32
  form: "string",
32
33
  locale: "string"
package/src/slider.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","names":[],"sources":["../../../../packages/web/src/slider.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createSlider } from \"@kirana-ui/core/slider\"\nimport type { Slider, SliderProps } from \"@kirana-ui/core/slider\"\n\nimport { fieldAround, ownValue } from \"./around.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\n/** A value as an attribute writes it: `\"40\"`, or for a range `\"20,80\"`. */\nconst read = (given: unknown): number | number[] | undefined =>\n typeof given === \"string\"\n ? given.includes(\",\")\n ? given.split(\",\").map(Number)\n : Number(given)\n : (given as number | number[] | undefined)\n\n// A thumb with no `kui-index` takes its place among the slider's thumbs, in the page's order.\nconst at = (element: HTMLElement) =>\n element.hasAttribute(\"kui-index\") ? Number(element.getAttribute(\"kui-index\")) : ownValue(element)\n\ntype Props = Omit<SliderProps, \"value\" | \"defaultValue\"> & {\n value?: string | number | number[]\n defaultValue?: string | number | number[]\n}\n\n/**\n * `<kui-slider>` around `kui-part=\"root\"`, a `value` (which says the value as it is written),\n * a `control` with its `track`, `indicator` and a `thumb` for each value, in the values'\n * order (or each with its `kui-index`). A thumb draws the hidden input a form reads. `value` and\n * `default-value` (a range with a comma), `min`, `max`, `step`, `large-step`,\n * `min-steps-between-values`, `thumb-alignment`, `orientation`, `disabled`, `name`, `form`,\n * `locale`; it tells `value-change` and `value-committed`.\n */\nexport const tag = defineElement<Props, Slider>({\n tag: \"kui-slider\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n min: \"number\",\n max: \"number\",\n step: \"number\",\n \"large-step\": \"number\",\n \"min-steps-between-values\": \"number\",\n \"thumb-alignment\": \"string\",\n orientation: \"string\",\n disabled: \"boolean\",\n name: \"string\",\n form: \"string\",\n locale: \"string\",\n },\n properties: [\"format\", \"getAriaValueText\"],\n create: (props, host) =>\n createSlider(\n computed(() => {\n const own = props.get()\n return { ...own, value: read(own.value), defaultValue: read(own.defaultValue) }\n }),\n { field: fieldAround(host) }\n ),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValueCommitted: { event: \"value-committed\", prop: \"value\", hold: false },\n },\n parts: {\n root: (controller) => controller.root,\n value: (controller) => ({ part: controller.value, text: controller.text }),\n control: (controller) => controller.control,\n track: (controller) => controller.track,\n indicator: (controller) => controller.indicator,\n thumb: (controller, element) => ({\n part: controller.thumb(at(element)),\n inner: controller.thumbInput(at(element)),\n }),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-slider\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"value-committed\": [\"onValueCommitted\", \"value\"]\n }\n >\n }\n}\n"],"mappings":";;;;;;AASA,MAAM,QAAQ,UACZ,OAAO,UAAU,WACb,MAAM,SAAS,GAAG,IAChB,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,IAC3B,OAAO,KAAK,IACb;AAGP,MAAM,MAAM,YACV,QAAQ,aAAa,WAAW,IAAI,OAAO,QAAQ,aAAa,WAAW,CAAC,IAAI,SAAS,OAAO;;;;;;;;;AAelG,MAAa,MAAM,cAA6B;CAC9C,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,KAAK;EACL,KAAK;EACL,MAAM;EACN,cAAc;EACd,4BAA4B;EAC5B,mBAAmB;EACnB,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;EACN,QAAQ;CACV;CACA,YAAY,CAAC,UAAU,kBAAkB;CACzC,SAAS,OAAO,SACd,aACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GAAE,GAAG;GAAK,OAAO,KAAK,IAAI,KAAK;GAAG,cAAc,KAAK,IAAI,YAAY;EAAE;CAChF,CAAC,GACD,EAAE,OAAO,YAAY,IAAI,EAAE,CAC7B;CACF,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,kBAAkB;GAAE,OAAO;GAAmB,MAAM;GAAS,MAAM;EAAM;CAC3E;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,gBAAgB;GAAE,MAAM,WAAW;GAAO,MAAM,WAAW;EAAK;EACxE,UAAU,eAAe,WAAW;EACpC,QAAQ,eAAe,WAAW;EAClC,YAAY,eAAe,WAAW;EACtC,QAAQ,YAAY,aAAa;GAC/B,MAAM,WAAW,MAAM,GAAG,OAAO,CAAC;GAClC,OAAO,WAAW,WAAW,GAAG,OAAO,CAAC;EAC1C;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"slider.js","names":[],"sources":["../../../../packages/web/src/slider.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createSlider } from \"@kirana-ui/core/slider\"\nimport type { Slider, SliderProps } from \"@kirana-ui/core/slider\"\n\nimport { fieldAround, ownValue } from \"./around.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\n/** A value as an attribute writes it: `\"40\"`, or for a range `\"20,80\"`. */\nconst read = (given: unknown): number | number[] | undefined =>\n typeof given === \"string\"\n ? given.includes(\",\")\n ? given.split(\",\").map(Number)\n : Number(given)\n : (given as number | number[] | undefined)\n\n// A thumb with no `kui-index` takes its place among the slider's thumbs, in the page's order.\nconst at = (element: HTMLElement) =>\n element.hasAttribute(\"kui-index\") ? Number(element.getAttribute(\"kui-index\")) : ownValue(element)\n\ntype Props = Omit<SliderProps, \"value\" | \"defaultValue\"> & {\n value?: string | number | number[]\n defaultValue?: string | number | number[]\n}\n\n/**\n * `<kui-slider>` around `kui-part=\"root\"`, a `value` (which says the value as it is written),\n * a `control` with its `track`, `indicator` and a `thumb` for each value, in the values'\n * order (or each with its `kui-index`). A thumb draws the hidden input a form reads. `value` and\n * `default-value` (a range with a comma), `min`, `max`, `step`, `large-step`,\n * `min-steps-between-values`, `thumb-alignment`, `orientation`, `disabled`, `read-only`,\n * `name`, `form`, `locale`; it tells `value-change` and `value-committed`.\n */\nexport const tag = defineElement<Props, Slider>({\n tag: \"kui-slider\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n min: \"number\",\n max: \"number\",\n step: \"number\",\n \"large-step\": \"number\",\n \"min-steps-between-values\": \"number\",\n \"thumb-alignment\": \"string\",\n orientation: \"string\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n name: \"string\",\n form: \"string\",\n locale: \"string\",\n },\n properties: [\"format\", \"getAriaValueText\"],\n create: (props, host) =>\n createSlider(\n computed(() => {\n const own = props.get()\n return { ...own, value: read(own.value), defaultValue: read(own.defaultValue) }\n }),\n { field: fieldAround(host) }\n ),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValueCommitted: { event: \"value-committed\", prop: \"value\", hold: false },\n },\n parts: {\n root: (controller) => controller.root,\n value: (controller) => ({ part: controller.value, text: controller.text }),\n control: (controller) => controller.control,\n track: (controller) => controller.track,\n indicator: (controller) => controller.indicator,\n thumb: (controller, element) => ({\n part: controller.thumb(at(element)),\n inner: controller.thumbInput(at(element)),\n }),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-slider\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"value-committed\": [\"onValueCommitted\", \"value\"]\n }\n >\n }\n}\n"],"mappings":";;;;;;AASA,MAAM,QAAQ,UACZ,OAAO,UAAU,WACb,MAAM,SAAS,GAAG,IAChB,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,IAC3B,OAAO,KAAK,IACb;AAGP,MAAM,MAAM,YACV,QAAQ,aAAa,WAAW,IAAI,OAAO,QAAQ,aAAa,WAAW,CAAC,IAAI,SAAS,OAAO;;;;;;;;;AAelG,MAAa,MAAM,cAA6B;CAC9C,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,KAAK;EACL,KAAK;EACL,MAAM;EACN,cAAc;EACd,4BAA4B;EAC5B,mBAAmB;EACnB,aAAa;EACb,UAAU;EACV,aAAa;EACb,MAAM;EACN,MAAM;EACN,QAAQ;CACV;CACA,YAAY,CAAC,UAAU,kBAAkB;CACzC,SAAS,OAAO,SACd,aACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GAAE,GAAG;GAAK,OAAO,KAAK,IAAI,KAAK;GAAG,cAAc,KAAK,IAAI,YAAY;EAAE;CAChF,CAAC,GACD,EAAE,OAAO,YAAY,IAAI,EAAE,CAC7B;CACF,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,kBAAkB;GAAE,OAAO;GAAmB,MAAM;GAAS,MAAM;EAAM;CAC3E;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,gBAAgB;GAAE,MAAM,WAAW;GAAO,MAAM,WAAW;EAAK;EACxE,UAAU,eAAe,WAAW;EACpC,QAAQ,eAAe,WAAW;EAClC,YAAY,eAAe,WAAW;EACtC,QAAQ,YAAY,aAAa;GAC/B,MAAM,WAAW,MAAM,GAAG,OAAO,CAAC;GAClC,OAAO,WAAW,WAAW,GAAG,OAAO,CAAC;EAC1C;CACF;AACF,CAAC"}
package/src/steps.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { ElementOf, Tag } from "./runtime.js";
2
+ import { Steps, StepsProps } from "@kirana-ui/core/steps";
3
+ /**
4
+ * `<kui-steps>` around `kui-part="root"`, a `list` with an `item` for each step (`kui-index`,
5
+ * from 0, or its place in the page when it has none) holding its `trigger` (with an `indicator` inside) and a `separator`, a `content`
6
+ * for each step (`kui-index`), a `completed`, and `previous` and `next` buttons. `step`,
7
+ * `default-step`, `count` (the items in the page when it is left out), `linear`, `orientation`; it tells `step-change`.
8
+ */
9
+ export declare const tag: Tag<StepsProps, Steps>;
10
+ declare global {
11
+ interface HTMLElementTagNameMap {
12
+ "kui-steps": ElementOf<typeof tag, {
13
+ "step-change": ["onStepChange", "step"];
14
+ }>;
15
+ }
16
+ }
17
+ //# sourceMappingURL=steps.d.ts.map
package/src/steps.js ADDED
@@ -0,0 +1,47 @@
1
+ import { once } from "./around.js";
2
+ import { defineElement, partAround } from "./runtime.js";
3
+ import { createSteps } from "@kirana-ui/core/steps";
4
+ // src/steps.ts
5
+ const indexOf = (element) => Number(element?.getAttribute("kui-index") ?? 0);
6
+ /** An item's `kui-index`, or nothing: it is then counted from the page. */
7
+ const given = (element) => element.hasAttribute("kui-index") ? indexOf(element) : void 0;
8
+ const items = /* @__PURE__ */ new WeakMap();
9
+ const itemFor = (controller, element) => once(items, element, (item) => controller.item(given(item)));
10
+ /** The step of the item a part is inside: its index, given or counted. */
11
+ const itemOf = (controller, element) => itemFor(controller, partAround(element, "item"))?.index ?? 0;
12
+ /**
13
+ * `<kui-steps>` around `kui-part="root"`, a `list` with an `item` for each step (`kui-index`,
14
+ * from 0, or its place in the page when it has none) holding its `trigger` (with an `indicator` inside) and a `separator`, a `content`
15
+ * for each step (`kui-index`), a `completed`, and `previous` and `next` buttons. `step`,
16
+ * `default-step`, `count` (the items in the page when it is left out), `linear`, `orientation`; it tells `step-change`.
17
+ */
18
+ const tag = defineElement({
19
+ tag: "kui-steps",
20
+ props: {
21
+ step: "number",
22
+ "default-step": "number",
23
+ count: "number",
24
+ linear: "boolean",
25
+ orientation: "string"
26
+ },
27
+ create: (props) => createSteps(props),
28
+ changes: { onStepChange: {
29
+ event: "step-change",
30
+ prop: "step"
31
+ } },
32
+ parts: {
33
+ root: (controller) => controller.root,
34
+ list: (controller) => controller.list,
35
+ item: (controller, element) => itemFor(controller, element),
36
+ trigger: (controller, element) => controller.trigger(itemOf(controller, element)),
37
+ indicator: (controller, element) => controller.indicator(itemOf(controller, element)),
38
+ separator: (controller, element) => controller.separator(itemOf(controller, element)),
39
+ content: (controller, element) => controller.content(indexOf(element)),
40
+ completed: (controller) => controller.completed,
41
+ previous: (controller) => controller.previous,
42
+ next: (controller) => controller.next
43
+ }
44
+ });
45
+ export { tag };
46
+
47
+ //# sourceMappingURL=steps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.js","names":[],"sources":["../../../../packages/web/src/steps.ts"],"sourcesContent":["import { createSteps } from \"@kirana-ui/core/steps\"\nimport type { Steps, StepsItem, StepsProps } from \"@kirana-ui/core/steps\"\n\nimport { once } from \"./around.ts\"\nimport { defineElement, partAround } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst indexOf = (element: HTMLElement | null) => Number(element?.getAttribute(\"kui-index\") ?? 0)\n/** An item's `kui-index`, or nothing: it is then counted from the page. */\nconst given = (element: HTMLElement) =>\n element.hasAttribute(\"kui-index\") ? indexOf(element) : undefined\nconst items = new WeakMap<HTMLElement, StepsItem>()\nconst itemFor = (controller: Steps, element: HTMLElement | null) =>\n once(items, element, (item) => controller.item(given(item)))\n/** The step of the item a part is inside: its index, given or counted. */\nconst itemOf = (controller: Steps, element: HTMLElement) =>\n itemFor(controller, partAround(element, \"item\"))?.index ?? 0\n\n/**\n * `<kui-steps>` around `kui-part=\"root\"`, a `list` with an `item` for each step (`kui-index`,\n * from 0, or its place in the page when it has none) holding its `trigger` (with an `indicator` inside) and a `separator`, a `content`\n * for each step (`kui-index`), a `completed`, and `previous` and `next` buttons. `step`,\n * `default-step`, `count` (the items in the page when it is left out), `linear`, `orientation`; it tells `step-change`.\n */\nexport const tag = defineElement<StepsProps, Steps>({\n tag: \"kui-steps\",\n props: {\n step: \"number\",\n \"default-step\": \"number\",\n count: \"number\",\n linear: \"boolean\",\n orientation: \"string\",\n },\n create: (props) => createSteps(props),\n changes: { onStepChange: { event: \"step-change\", prop: \"step\" } },\n parts: {\n root: (controller) => controller.root,\n list: (controller) => controller.list,\n item: (controller, element) => itemFor(controller, element),\n trigger: (controller, element) => controller.trigger(itemOf(controller, element)),\n indicator: (controller, element) => controller.indicator(itemOf(controller, element)),\n separator: (controller, element) => controller.separator(itemOf(controller, element)),\n content: (controller, element) => controller.content(indexOf(element)),\n completed: (controller) => controller.completed,\n previous: (controller) => controller.previous,\n next: (controller) => controller.next,\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-steps\": ElementOf<typeof tag, { \"step-change\": [\"onStepChange\", \"step\"] }>\n }\n}\n"],"mappings":";;;;AAOA,MAAM,WAAW,YAAgC,OAAO,SAAS,aAAa,WAAW,KAAK,CAAC;;AAE/F,MAAM,SAAS,YACb,QAAQ,aAAa,WAAW,IAAI,QAAQ,OAAO,IAAI,KAAA;AACzD,MAAM,wBAAQ,IAAI,QAAgC;AAClD,MAAM,WAAW,YAAmB,YAClC,KAAK,OAAO,UAAU,SAAS,WAAW,KAAK,MAAM,IAAI,CAAC,CAAC;;AAE7D,MAAM,UAAU,YAAmB,YACjC,QAAQ,YAAY,WAAW,SAAS,MAAM,CAAC,CAAC,EAAE,SAAS;;;;;;;AAQ7D,MAAa,MAAM,cAAiC;CAClD,KAAK;CACL,OAAO;EACL,MAAM;EACN,gBAAgB;EAChB,OAAO;EACP,QAAQ;EACR,aAAa;CACf;CACA,SAAS,UAAU,YAAY,KAAK;CACpC,SAAS,EAAE,cAAc;EAAE,OAAO;EAAe,MAAM;CAAO,EAAE;CAChE,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,OAAO,eAAe,WAAW;EACjC,OAAO,YAAY,YAAY,QAAQ,YAAY,OAAO;EAC1D,UAAU,YAAY,YAAY,WAAW,QAAQ,OAAO,YAAY,OAAO,CAAC;EAChF,YAAY,YAAY,YAAY,WAAW,UAAU,OAAO,YAAY,OAAO,CAAC;EACpF,YAAY,YAAY,YAAY,WAAW,UAAU,OAAO,YAAY,OAAO,CAAC;EACpF,UAAU,YAAY,YAAY,WAAW,QAAQ,QAAQ,OAAO,CAAC;EACrE,YAAY,eAAe,WAAW;EACtC,WAAW,eAAe,WAAW;EACrC,OAAO,eAAe,WAAW;CACnC;AACF,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { ElementOf, Tag } from "./runtime.js";
2
+ import { TagsInput, TagsInputProps } from "@kirana-ui/core/tags-input";
3
+ type Props = Omit<TagsInputProps, "value" | "defaultValue"> & {
4
+ value?: string | readonly string[];
5
+ defaultValue?: string | readonly string[];
6
+ };
7
+ /** Why a text was not made a tag. */
8
+ type Refusal = "duplicate" | "max" | "invalid";
9
+ /**
10
+ * `<kui-tags-input>` around `kui-part="root"`, which holds a `list` with a
11
+ * `<template kui-each="items">` for a tag (`{value}` is its text, `{index}` its place): an
12
+ * `item` holding its `item-text`, which says the tag unless the page wrote something, and
13
+ * optionally an `item-input` to edit it in place and an `item-remove` button. Beside the list,
14
+ * the `input` a new tag is typed in and a `clear` button. The root draws the hidden inputs a
15
+ * form reads, as its last children. `value` and `default-value` (with commas between), `max`,
16
+ * `allow-duplicates`, `delimiter`, `add-on-blur`, `add-on-paste`, `editable`, `disabled`,
17
+ * `read-only`, `required`, `name`, `form`; `validate`, and `delimiter` when it is a pattern, as
18
+ * properties. It tells `value-change`, and `value-invalid` (`detail.text`, `detail.reason`)
19
+ * for a text that was not made a tag.
20
+ */
21
+ export declare const tag: Tag<Props, TagsInput>;
22
+ declare global {
23
+ interface HTMLElementTagNameMap {
24
+ "kui-tags-input": ElementOf<typeof tag, {
25
+ "value-change": ["onValueChange", "value"];
26
+ }, {
27
+ "value-invalid": CustomEvent<{
28
+ readonly text: string;
29
+ readonly reason: Refusal;
30
+ }>;
31
+ }>;
32
+ }
33
+ }
34
+ export {};
35
+ //# sourceMappingURL=tags-input.d.ts.map
@@ -0,0 +1,96 @@
1
+ import { fieldAround, list } from "./around.js";
2
+ import { defineElement, entryAround } from "./runtime.js";
3
+ import { computed } from "@kirana-ui/core";
4
+ import { createTagsInput } from "@kirana-ui/core/tags-input";
5
+ // src/tags-input.ts
6
+ /** The tag a part is in: the entry its item was stamped for. */
7
+ const keyOf = (element) => entryAround(element)?.key;
8
+ /**
9
+ * `<kui-tags-input>` around `kui-part="root"`, which holds a `list` with a
10
+ * `<template kui-each="items">` for a tag (`{value}` is its text, `{index}` its place): an
11
+ * `item` holding its `item-text`, which says the tag unless the page wrote something, and
12
+ * optionally an `item-input` to edit it in place and an `item-remove` button. Beside the list,
13
+ * the `input` a new tag is typed in and a `clear` button. The root draws the hidden inputs a
14
+ * form reads, as its last children. `value` and `default-value` (with commas between), `max`,
15
+ * `allow-duplicates`, `delimiter`, `add-on-blur`, `add-on-paste`, `editable`, `disabled`,
16
+ * `read-only`, `required`, `name`, `form`; `validate`, and `delimiter` when it is a pattern, as
17
+ * properties. It tells `value-change`, and `value-invalid` (`detail.text`, `detail.reason`)
18
+ * for a text that was not made a tag.
19
+ */
20
+ const tag = defineElement({
21
+ tag: "kui-tags-input",
22
+ props: {
23
+ value: "string",
24
+ "default-value": "string",
25
+ max: "number",
26
+ "allow-duplicates": "boolean",
27
+ delimiter: "string",
28
+ "add-on-blur": "boolean",
29
+ "add-on-paste": "boolean",
30
+ editable: "boolean",
31
+ disabled: "boolean",
32
+ "read-only": "boolean",
33
+ required: "boolean",
34
+ name: "string",
35
+ form: "string"
36
+ },
37
+ properties: ["validate"],
38
+ create: (props, host) => createTagsInput(computed(() => {
39
+ const own = props.get();
40
+ return {
41
+ ...own,
42
+ value: list(own.value),
43
+ defaultValue: list(own.defaultValue),
44
+ onValueInvalid(text, reason) {
45
+ host.dispatchEvent(new CustomEvent("value-invalid", {
46
+ detail: {
47
+ text,
48
+ reason
49
+ },
50
+ bubbles: true
51
+ }));
52
+ }
53
+ };
54
+ }), { field: fieldAround(host) }),
55
+ changes: { onValueChange: {
56
+ event: "value-change",
57
+ prop: "value"
58
+ } },
59
+ lists: { items: (controller) => ({
60
+ entries: controller.entries,
61
+ key: (entry) => entry.key
62
+ }) },
63
+ parts: {
64
+ root: (controller) => ({
65
+ part: controller.root,
66
+ inner: controller.hiddenInput
67
+ }),
68
+ list: (controller) => controller.list,
69
+ item(controller, element) {
70
+ const key = keyOf(element);
71
+ return key === void 0 ? void 0 : controller.item(key);
72
+ },
73
+ "item-text"(controller, element) {
74
+ const entry = entryAround(element);
75
+ if (!entry) return void 0;
76
+ const { value } = entry;
77
+ return {
78
+ part: controller.itemText(entry.key),
79
+ text: computed(() => value)
80
+ };
81
+ },
82
+ "item-input"(controller, element) {
83
+ const key = keyOf(element);
84
+ return key === void 0 ? void 0 : controller.itemInput(key);
85
+ },
86
+ "item-remove"(controller, element) {
87
+ const key = keyOf(element);
88
+ return key === void 0 ? void 0 : controller.itemRemove(key);
89
+ },
90
+ input: (controller) => controller.input,
91
+ clear: (controller) => controller.clear
92
+ }
93
+ });
94
+ export { tag };
95
+
96
+ //# sourceMappingURL=tags-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags-input.js","names":[],"sources":["../../../../packages/web/src/tags-input.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createTagsInput } from \"@kirana-ui/core/tags-input\"\nimport type { TagsInput, TagsInputEntry, TagsInputProps } from \"@kirana-ui/core/tags-input\"\n\nimport { fieldAround, list } from \"./around.ts\"\nimport { defineElement, entryAround } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\ntype Props = Omit<TagsInputProps, \"value\" | \"defaultValue\"> & {\n value?: string | readonly string[]\n defaultValue?: string | readonly string[]\n}\n\n/** Why a text was not made a tag. */\ntype Refusal = \"duplicate\" | \"max\" | \"invalid\"\n\n/** The tag a part is in: the entry its item was stamped for. */\nconst keyOf = (element: HTMLElement) => entryAround<TagsInputEntry>(element)?.key\n\n/**\n * `<kui-tags-input>` around `kui-part=\"root\"`, which holds a `list` with a\n * `<template kui-each=\"items\">` for a tag (`{value}` is its text, `{index}` its place): an\n * `item` holding its `item-text`, which says the tag unless the page wrote something, and\n * optionally an `item-input` to edit it in place and an `item-remove` button. Beside the list,\n * the `input` a new tag is typed in and a `clear` button. The root draws the hidden inputs a\n * form reads, as its last children. `value` and `default-value` (with commas between), `max`,\n * `allow-duplicates`, `delimiter`, `add-on-blur`, `add-on-paste`, `editable`, `disabled`,\n * `read-only`, `required`, `name`, `form`; `validate`, and `delimiter` when it is a pattern, as\n * properties. It tells `value-change`, and `value-invalid` (`detail.text`, `detail.reason`)\n * for a text that was not made a tag.\n */\nexport const tag = defineElement<Props, TagsInput>({\n tag: \"kui-tags-input\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n max: \"number\",\n \"allow-duplicates\": \"boolean\",\n delimiter: \"string\",\n \"add-on-blur\": \"boolean\",\n \"add-on-paste\": \"boolean\",\n editable: \"boolean\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"validate\"],\n create: (props, host) =>\n createTagsInput(\n computed(() => {\n const own = props.get()\n return {\n ...own,\n value: list(own.value),\n defaultValue: list(own.defaultValue),\n // Told as an event of its own: its second value is a reason, not a change's details.\n onValueInvalid(text: string, reason: Refusal) {\n host.dispatchEvent(\n new CustomEvent(\"value-invalid\", { detail: { text, reason }, bubbles: true })\n )\n },\n }\n }),\n { field: fieldAround(host) }\n ),\n changes: { onValueChange: { event: \"value-change\", prop: \"value\" } },\n lists: {\n items: (controller) => ({\n entries: controller.entries,\n key: (entry: TagsInputEntry) => entry.key,\n }),\n },\n parts: {\n root: (controller) => ({ part: controller.root, inner: controller.hiddenInput }),\n list: (controller) => controller.list,\n item(controller, element) {\n const key = keyOf(element)\n return key === undefined ? undefined : controller.item(key)\n },\n \"item-text\"(controller, element) {\n const entry = entryAround<TagsInputEntry>(element)\n if (!entry) return undefined\n // A tag's key holds its text: a tag whose text changes is another tag.\n const { value } = entry\n return { part: controller.itemText(entry.key), text: computed(() => value) }\n },\n \"item-input\"(controller, element) {\n const key = keyOf(element)\n return key === undefined ? undefined : controller.itemInput(key)\n },\n \"item-remove\"(controller, element) {\n const key = keyOf(element)\n return key === undefined ? undefined : controller.itemRemove(key)\n },\n input: (controller) => controller.input,\n clear: (controller) => controller.clear,\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-tags-input\": ElementOf<\n typeof tag,\n { \"value-change\": [\"onValueChange\", \"value\"] },\n { \"value-invalid\": CustomEvent<{ readonly text: string; readonly reason: Refusal }> }\n >\n }\n}\n"],"mappings":";;;;;;AAiBA,MAAM,SAAS,YAAyB,YAA4B,OAAO,CAAC,EAAE;;;;;;;;;;;;;AAc9E,MAAa,MAAM,cAAgC;CACjD,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,KAAK;EACL,oBAAoB;EACpB,WAAW;EACX,eAAe;EACf,gBAAgB;EAChB,UAAU;EACV,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,UAAU;CACvB,SAAS,OAAO,SACd,gBACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GACL,GAAG;GACH,OAAO,KAAK,IAAI,KAAK;GACrB,cAAc,KAAK,IAAI,YAAY;GAEnC,eAAe,MAAc,QAAiB;IAC5C,KAAK,cACH,IAAI,YAAY,iBAAiB;KAAE,QAAQ;MAAE;MAAM;KAAO;KAAG,SAAS;IAAK,CAAC,CAC9E;GACF;EACF;CACF,CAAC,GACD,EAAE,OAAO,YAAY,IAAI,EAAE,CAC7B;CACF,SAAS,EAAE,eAAe;EAAE,OAAO;EAAgB,MAAM;CAAQ,EAAE;CACnE,OAAO,EACL,QAAQ,gBAAgB;EACtB,SAAS,WAAW;EACpB,MAAM,UAA0B,MAAM;CACxC,GACF;CACA,OAAO;EACL,OAAO,gBAAgB;GAAE,MAAM,WAAW;GAAM,OAAO,WAAW;EAAY;EAC9E,OAAO,eAAe,WAAW;EACjC,KAAK,YAAY,SAAS;GACxB,MAAM,MAAM,MAAM,OAAO;GACzB,OAAO,QAAQ,KAAA,IAAY,KAAA,IAAY,WAAW,KAAK,GAAG;EAC5D;EACA,YAAY,YAAY,SAAS;GAC/B,MAAM,QAAQ,YAA4B,OAAO;GACjD,IAAI,CAAC,OAAO,OAAO,KAAA;GAEnB,MAAM,EAAE,UAAU;GAClB,OAAO;IAAE,MAAM,WAAW,SAAS,MAAM,GAAG;IAAG,MAAM,eAAe,KAAK;GAAE;EAC7E;EACA,aAAa,YAAY,SAAS;GAChC,MAAM,MAAM,MAAM,OAAO;GACzB,OAAO,QAAQ,KAAA,IAAY,KAAA,IAAY,WAAW,UAAU,GAAG;EACjE;EACA,cAAc,YAAY,SAAS;GACjC,MAAM,MAAM,MAAM,OAAO;GACzB,OAAO,QAAQ,KAAA,IAAY,KAAA,IAAY,WAAW,WAAW,GAAG;EAClE;EACA,QAAQ,eAAe,WAAW;EAClC,QAAQ,eAAe,WAAW;CACpC;AACF,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { ElementOf, Tag } from "./runtime.js";
2
+ import { TimeField, TimeFieldProps } from "@kirana-ui/core/time-field";
3
+ /**
4
+ * `<kui-time-field>` around `kui-part="root"`, which holds a `<template kui-each="segments">`
5
+ * with the `segment` each part of the time is typed in (`{type}` and `{index}` say which),
6
+ * and the hidden `input` a form reads. `value`, `default-value`, `granularity`, `hour-cycle`,
7
+ * `locale`, `min`, `max`, `disabled`, `read-only`, `required`, `name`, `form`; `placeholders`
8
+ * as a property; it tells `value-change`. Inside a `<kui-field>` it is the field's control.
9
+ */
10
+ export declare const tag: Tag<TimeFieldProps, TimeField>;
11
+ declare global {
12
+ interface HTMLElementTagNameMap {
13
+ "kui-time-field": ElementOf<typeof tag, {
14
+ "value-change": ["onValueChange", "value"];
15
+ }>;
16
+ }
17
+ }
18
+ //# sourceMappingURL=time-field.d.ts.map
@@ -0,0 +1,54 @@
1
+ import { fieldAround } from "./around.js";
2
+ import { defineElement, entryAround } from "./runtime.js";
3
+ import { createTimeField } from "@kirana-ui/core/time-field";
4
+ // src/time-field.ts
5
+ /**
6
+ * `<kui-time-field>` around `kui-part="root"`, which holds a `<template kui-each="segments">`
7
+ * with the `segment` each part of the time is typed in (`{type}` and `{index}` say which),
8
+ * and the hidden `input` a form reads. `value`, `default-value`, `granularity`, `hour-cycle`,
9
+ * `locale`, `min`, `max`, `disabled`, `read-only`, `required`, `name`, `form`; `placeholders`
10
+ * as a property; it tells `value-change`. Inside a `<kui-field>` it is the field's control.
11
+ */
12
+ const tag = defineElement({
13
+ tag: "kui-time-field",
14
+ props: {
15
+ value: "string",
16
+ "default-value": "string",
17
+ granularity: "string",
18
+ "hour-cycle": "number",
19
+ locale: "string",
20
+ min: "string",
21
+ max: "string",
22
+ disabled: "boolean",
23
+ "read-only": "boolean",
24
+ required: "boolean",
25
+ name: "string",
26
+ form: "string"
27
+ },
28
+ properties: ["placeholders"],
29
+ create: (props, host) => createTimeField(props, { field: fieldAround(host) }),
30
+ changes: { onValueChange: {
31
+ event: "value-change",
32
+ prop: "value"
33
+ } },
34
+ lists: { segments: (controller) => ({
35
+ entries: controller.segments,
36
+ key: (segment) => `${segment.index}-${segment.type}`
37
+ }) },
38
+ parts: {
39
+ root: (controller) => controller.root,
40
+ segment(controller, element) {
41
+ const segment = entryAround(element);
42
+ if (!segment) return void 0;
43
+ const { part, text } = controller.segment(segment);
44
+ return {
45
+ part,
46
+ text
47
+ };
48
+ },
49
+ input: (controller) => controller.input
50
+ }
51
+ });
52
+ export { tag };
53
+
54
+ //# sourceMappingURL=time-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-field.js","names":[],"sources":["../../../../packages/web/src/time-field.ts"],"sourcesContent":["import { createTimeField } from \"@kirana-ui/core/time-field\"\nimport type { TimeField, TimeFieldProps, TimeFieldSegment } from \"@kirana-ui/core/time-field\"\n\nimport { fieldAround } from \"./around.ts\"\nimport { defineElement, entryAround } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\n/**\n * `<kui-time-field>` around `kui-part=\"root\"`, which holds a `<template kui-each=\"segments\">`\n * with the `segment` each part of the time is typed in (`{type}` and `{index}` say which),\n * and the hidden `input` a form reads. `value`, `default-value`, `granularity`, `hour-cycle`,\n * `locale`, `min`, `max`, `disabled`, `read-only`, `required`, `name`, `form`; `placeholders`\n * as a property; it tells `value-change`. Inside a `<kui-field>` it is the field's control.\n */\nexport const tag = defineElement<TimeFieldProps, TimeField>({\n tag: \"kui-time-field\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n granularity: \"string\",\n \"hour-cycle\": \"number\",\n locale: \"string\",\n min: \"string\",\n max: \"string\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"placeholders\"],\n create: (props, host) => createTimeField(props, { field: fieldAround(host) }),\n changes: { onValueChange: { event: \"value-change\", prop: \"value\" } },\n lists: {\n segments: (controller) => ({\n entries: controller.segments,\n key: (segment: TimeFieldSegment) => `${segment.index}-${segment.type}`,\n }),\n },\n parts: {\n root: (controller) => controller.root,\n segment(controller, element) {\n const segment = entryAround<TimeFieldSegment>(element)\n if (!segment) return undefined\n const { part, text } = controller.segment(segment)\n return { part, text }\n },\n input: (controller) => controller.input,\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-time-field\": ElementOf<typeof tag, { \"value-change\": [\"onValueChange\", \"value\"] }>\n }\n}\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,MAAM,cAAyC;CAC1D,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,aAAa;EACb,cAAc;EACd,QAAQ;EACR,KAAK;EACL,KAAK;EACL,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,cAAc;CAC3B,SAAS,OAAO,SAAS,gBAAgB,OAAO,EAAE,OAAO,YAAY,IAAI,EAAE,CAAC;CAC5E,SAAS,EAAE,eAAe;EAAE,OAAO;EAAgB,MAAM;CAAQ,EAAE;CACnE,OAAO,EACL,WAAW,gBAAgB;EACzB,SAAS,WAAW;EACpB,MAAM,YAA8B,GAAG,QAAQ,MAAM,GAAG,QAAQ;CAClE,GACF;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,YAAY,SAAS;GAC3B,MAAM,UAAU,YAA8B,OAAO;GACrD,IAAI,CAAC,SAAS,OAAO,KAAA;GACrB,MAAM,EAAE,MAAM,SAAS,WAAW,QAAQ,OAAO;GACjD,OAAO;IAAE;IAAM;GAAK;EACtB;EACA,QAAQ,eAAe,WAAW;CACpC;AACF,CAAC"}
package/src/toast.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ElementOf, Tag } from "./runtime.js";
2
2
  import { Toast, ToastActionOptions, ToastOptions, ToastProps, ToastRecord, ToastState, Toaster, ToasterOptions, createToaster } from "@kirana-ui/core/toast";
3
3
  /**
4
- * The toaster a `<kui-toast>` draws: its own (made with the element's `duration` and
5
- * `limit`), unless it was given one as its `toaster` property before it began.
4
+ * The toaster a `<kui-toast>` draws: its own (made with the element's `timeout`,
5
+ * `duration`, its old name, and `limit`), unless it was given one as its `toaster` property before it began.
6
6
  * `toasterOf(element).add({ title: "Saved" })`.
7
7
  */
8
8
  export declare function toasterOf(element: Element): Toaster;
@@ -12,12 +12,13 @@ export declare function toasterOf(element: Element): Toaster;
12
12
  * `description`, and a `close` and an `action` button. A `title`, a `description` and an
13
13
  * `action` written empty say what the toast was added with, and are in the page only for a
14
14
  * toast that has one; one written with something in it (`{title}`) is always there. `label`,
15
- * `hotkey`, `swipe-direction`; `duration` and `limit` for the toaster it makes, or `toaster`
15
+ * `hotkey`, `swipe-direction`; `timeout` (`duration`, its old name) and `limit` for the toaster it makes, or `toaster`
16
16
  * as a property for one of the page's own. A title, a description and an action's label are
17
17
  * strings.
18
18
  */
19
19
  export declare const tag: Tag<Omit<ToastProps<string>, "toaster"> & {
20
20
  toaster?: Toaster;
21
+ timeout?: number;
21
22
  duration?: number;
22
23
  limit?: number;
23
24
  }, Toast<string>>;
package/src/toast.js CHANGED
@@ -4,8 +4,8 @@ import { createToast, createToaster } from "@kirana-ui/core/toast";
4
4
  // src/toast.ts
5
5
  const toasters = /* @__PURE__ */ new WeakMap();
6
6
  /**
7
- * The toaster a `<kui-toast>` draws: its own (made with the element's `duration` and
8
- * `limit`), unless it was given one as its `toaster` property before it began.
7
+ * The toaster a `<kui-toast>` draws: its own (made with the element's `timeout`,
8
+ * `duration`, its old name, and `limit`), unless it was given one as its `toaster` property before it began.
9
9
  * `toasterOf(element).add({ title: "Saved" })`.
10
10
  */
11
11
  function toasterOf(element) {
@@ -13,6 +13,7 @@ function toasterOf(element) {
13
13
  if (!toaster) {
14
14
  const number = (name) => element.hasAttribute(name) ? { [name]: Number(element.getAttribute(name)) } : {};
15
15
  toasters.set(element, toaster = createToaster({
16
+ ...number("timeout"),
16
17
  ...number("duration"),
17
18
  ...number("limit")
18
19
  }));
@@ -47,7 +48,7 @@ const said = (name) => (controller, element) => {
47
48
  * `description`, and a `close` and an `action` button. A `title`, a `description` and an
48
49
  * `action` written empty say what the toast was added with, and are in the page only for a
49
50
  * toast that has one; one written with something in it (`{title}`) is always there. `label`,
50
- * `hotkey`, `swipe-direction`; `duration` and `limit` for the toaster it makes, or `toaster`
51
+ * `hotkey`, `swipe-direction`; `timeout` (`duration`, its old name) and `limit` for the toaster it makes, or `toaster`
51
52
  * as a property for one of the page's own. A title, a description and an action's label are
52
53
  * strings.
53
54
  */
@@ -57,6 +58,7 @@ const tag = defineElement({
57
58
  label: "string",
58
59
  hotkey: "string",
59
60
  "swipe-direction": "string",
61
+ timeout: "number",
60
62
  duration: "number",
61
63
  limit: "number"
62
64
  },
@@ -66,7 +68,7 @@ const tag = defineElement({
66
68
  if (given) toasters.set(host, given);
67
69
  const toaster = toasterOf(host);
68
70
  return createToast(computed(() => {
69
- const { duration: _duration, limit: _limit, ...own } = props.get();
71
+ const { timeout: _timeout, duration: _duration, limit: _limit, ...own } = props.get();
70
72
  return {
71
73
  ...own,
72
74
  toaster