@kirana-ui/web 0.1.1 → 0.3.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 (140) hide show
  1. package/llms.txt +3174 -0
  2. package/package.json +14 -2
  3. package/skills/kirana-ui-primitives/SKILL.md +163 -0
  4. package/src/accordion.d.ts +18 -3
  5. package/src/accordion.js +5 -4
  6. package/src/accordion.js.map +1 -1
  7. package/src/agent.d.ts +1 -0
  8. package/src/agent.js +1 -0
  9. package/src/alert-dialog.d.ts +14 -3
  10. package/src/alert-dialog.js +6 -2
  11. package/src/alert-dialog.js.map +1 -1
  12. package/src/around.d.ts +37 -4
  13. package/src/around.js +72 -8
  14. package/src/around.js.map +1 -1
  15. package/src/autocomplete.d.ts +17 -3
  16. package/src/autocomplete.js +9 -4
  17. package/src/autocomplete.js.map +1 -1
  18. package/src/autosize.d.ts +10 -1
  19. package/src/autosize.js.map +1 -1
  20. package/src/avatar.d.ts +21 -3
  21. package/src/avatar.js +39 -10
  22. package/src/avatar.js.map +1 -1
  23. package/src/button.d.ts +10 -1
  24. package/src/button.js.map +1 -1
  25. package/src/calendar.d.ts +19 -5
  26. package/src/calendar.js +21 -9
  27. package/src/calendar.js.map +1 -1
  28. package/src/carousel.d.ts +10 -1
  29. package/src/carousel.js.map +1 -1
  30. package/src/checkbox-group.d.ts +22 -0
  31. package/src/checkbox-group.js +36 -0
  32. package/src/checkbox-group.js.map +1 -0
  33. package/src/checkbox.d.ts +16 -3
  34. package/src/checkbox.js +10 -4
  35. package/src/checkbox.js.map +1 -1
  36. package/src/collapsible.d.ts +10 -1
  37. package/src/collapsible.js.map +1 -1
  38. package/src/combobox.d.ts +37 -7
  39. package/src/combobox.js +52 -16
  40. package/src/combobox.js.map +1 -1
  41. package/src/command.d.ts +12 -2
  42. package/src/command.js +2 -1
  43. package/src/command.js.map +1 -1
  44. package/src/context-menu.d.ts +13 -1
  45. package/src/context-menu.js.map +1 -1
  46. package/src/date-field.d.ts +10 -1
  47. package/src/date-field.js.map +1 -1
  48. package/src/date-picker.d.ts +19 -4
  49. package/src/date-picker.js +14 -11
  50. package/src/date-picker.js.map +1 -1
  51. package/src/dates.d.ts +5 -2
  52. package/src/dates.js +50 -15
  53. package/src/dates.js.map +1 -1
  54. package/src/dialog.d.ts +14 -3
  55. package/src/dialog.js +6 -2
  56. package/src/dialog.js.map +1 -1
  57. package/src/drawer.d.ts +17 -1
  58. package/src/drawer.js.map +1 -1
  59. package/src/field.d.ts +8 -1
  60. package/src/field.js.map +1 -1
  61. package/src/fieldset.d.ts +10 -1
  62. package/src/fieldset.js.map +1 -1
  63. package/src/form.d.ts +13 -1
  64. package/src/form.js.map +1 -1
  65. package/src/hover-card.d.ts +10 -1
  66. package/src/hover-card.js.map +1 -1
  67. package/src/hover-popup.d.ts +2 -1
  68. package/src/hover-popup.js +2 -8
  69. package/src/hover-popup.js.map +1 -1
  70. package/src/index.d.ts +60 -1
  71. package/src/index.js +1 -0
  72. package/src/input.d.ts +12 -1
  73. package/src/input.js.map +1 -1
  74. package/src/label.d.ts +9 -1
  75. package/src/label.js.map +1 -1
  76. package/src/listbox.d.ts +15 -1
  77. package/src/listbox.js.map +1 -1
  78. package/src/menu.d.ts +15 -4
  79. package/src/menu.js +2 -8
  80. package/src/menu.js.map +1 -1
  81. package/src/menubar.d.ts +10 -1
  82. package/src/menubar.js.map +1 -1
  83. package/src/message-scroller.d.ts +10 -1
  84. package/src/message-scroller.js.map +1 -1
  85. package/src/meter.d.ts +10 -1
  86. package/src/meter.js.map +1 -1
  87. package/src/navigation-menu.d.ts +15 -4
  88. package/src/navigation-menu.js +7 -13
  89. package/src/navigation-menu.js.map +1 -1
  90. package/src/number-field.d.ts +18 -3
  91. package/src/number-field.js +23 -3
  92. package/src/number-field.js.map +1 -1
  93. package/src/otp.d.ts +12 -2
  94. package/src/otp.js +2 -1
  95. package/src/otp.js.map +1 -1
  96. package/src/pagination.d.ts +10 -1
  97. package/src/pagination.js.map +1 -1
  98. package/src/popover.d.ts +16 -3
  99. package/src/popover.js +35 -12
  100. package/src/popover.js.map +1 -1
  101. package/src/progress.d.ts +10 -1
  102. package/src/progress.js.map +1 -1
  103. package/src/qr-code.d.ts +8 -1
  104. package/src/qr-code.js.map +1 -1
  105. package/src/radio-group.d.ts +12 -2
  106. package/src/radio-group.js +9 -2
  107. package/src/radio-group.js.map +1 -1
  108. package/src/resizable.d.ts +10 -1
  109. package/src/resizable.js.map +1 -1
  110. package/src/runtime.d.ts +42 -4
  111. package/src/runtime.js +35 -7
  112. package/src/runtime.js.map +1 -1
  113. package/src/scroll-area.d.ts +13 -2
  114. package/src/scroll-area.js +3 -1
  115. package/src/scroll-area.js.map +1 -1
  116. package/src/select.d.ts +26 -5
  117. package/src/select.js +36 -11
  118. package/src/select.js.map +1 -1
  119. package/src/separator.d.ts +10 -1
  120. package/src/separator.js.map +1 -1
  121. package/src/slider.d.ts +20 -5
  122. package/src/slider.js +9 -8
  123. package/src/slider.js.map +1 -1
  124. package/src/switch.d.ts +12 -1
  125. package/src/switch.js.map +1 -1
  126. package/src/tabs.d.ts +10 -1
  127. package/src/tabs.js.map +1 -1
  128. package/src/testing.d.ts +1 -0
  129. package/src/testing.js +1 -0
  130. package/src/toast.d.ts +20 -7
  131. package/src/toast.js +28 -7
  132. package/src/toast.js.map +1 -1
  133. package/src/toggle-group.d.ts +16 -1
  134. package/src/toggle-group.js.map +1 -1
  135. package/src/toggle.d.ts +12 -1
  136. package/src/toggle.js.map +1 -1
  137. package/src/toolbar.d.ts +10 -1
  138. package/src/toolbar.js.map +1 -1
  139. package/src/tooltip.d.ts +10 -1
  140. package/src/tooltip.js.map +1 -1
package/src/combobox.js CHANGED
@@ -1,4 +1,4 @@
1
- import { MARK, fieldAround, itemOptions, list, once, place, valueOf } from "./around.js";
1
+ import { MARK, fieldAround, itemOptions, list, once, positioner, valueOf } from "./around.js";
2
2
  import { defineElement, entryAround, partAround } from "./runtime.js";
3
3
  import { computed } from "@kirana-ui/core";
4
4
  import { createCombobox } from "@kirana-ui/core/combobox";
@@ -10,18 +10,18 @@ const groupOf = (controller, element) => once(groups, element, (group) => contro
10
10
  const PARTS = {
11
11
  input: (controller) => controller.input,
12
12
  trigger: (controller) => controller.trigger,
13
+ value: (controller, element) => ({
14
+ part: PLAIN,
15
+ text: computed(() => controller.shown.get().label ?? element.getAttribute("kui-placeholder") ?? void 0)
16
+ }),
17
+ status: (controller) => controller.status,
13
18
  clear: (controller) => ({
14
19
  part: controller.clear,
15
20
  mounted: controller.clearable
16
21
  }),
17
- positioner(controller, element) {
18
- place(controller.positioning, element);
19
- return {
20
- mounted: controller.mounted,
21
- part: controller.positioner
22
- };
23
- },
22
+ positioner,
24
23
  popup: (controller) => controller.popup,
24
+ list: (controller) => controller.list,
25
25
  empty: (controller) => ({
26
26
  part: controller.emptyPart,
27
27
  mounted: controller.empty
@@ -31,8 +31,13 @@ const PARTS = {
31
31
  separator: (controller) => controller.separator,
32
32
  item(controller, element) {
33
33
  const id = element.getAttribute("kui-id") ?? `kui-combobox-item-${++made}`;
34
+ const off = () => {
35
+ const entry = entryAround(element);
36
+ return entry?.type === "item" && entry.disabled ? { disabled: true } : {};
37
+ };
34
38
  return controller.item(valueOf(element), () => ({
35
39
  ...itemOptions(element)(),
40
+ ...off(),
36
41
  id
37
42
  }), groupOf(controller, element.parentElement && partAround(element.parentElement, "group")));
38
43
  },
@@ -50,21 +55,50 @@ const PARTS = {
50
55
  mounted: controller.selected(valueOf(partAround(element, "item")))
51
56
  })
52
57
  };
53
- /** With `multiple`: a chip for each chosen value, from a `<template kui-each="chips">`. */
54
- const LISTS = { chips: (controller) => ({
55
- entries: computed(() => controller.values.get().map((value) => ({ value }))),
56
- key: (chip) => chip.value
57
- }) };
58
+ /** A part that draws no element of its own in a framework: here, the page's element as it is. */
59
+ const PLAIN = {
60
+ props: computed(() => ({})),
61
+ attach: () => () => {}
62
+ };
63
+ /**
64
+ * With `multiple`: a chip for each chosen value, from a `<template kui-each="chips">`. With
65
+ * `items` as data: what is left of them, from a `<template kui-each="collection">`; one
66
+ * written in a group's copy is that group's items left.
67
+ */
68
+ const LISTS = {
69
+ chips: (controller) => ({
70
+ entries: computed(() => controller.values.get().map((value) => ({ value }))),
71
+ key: (chip) => chip.value
72
+ }),
73
+ collection: (controller, around) => {
74
+ const group = around;
75
+ return {
76
+ entries: controller.entries(group?.type === "group" ? group : void 0),
77
+ key: (entry) => entry.key,
78
+ type: (entry) => entry.type
79
+ };
80
+ }
81
+ };
58
82
  /**
59
83
  * `<kui-combobox>` around an `input`, with a `trigger` and a `clear` button if it has them,
60
- * and a `portal` with a `positioner` around the `popup`, which holds an `item` for each
84
+ * and a `portal` with a `positioner` (`kui-side` … and `kui-anchor`, an element's id) around
85
+ * the `popup`, which holds an `item` for each
61
86
  * `kui-value` (`kui-disabled`, `kui-label`, `kui-id`) with an `item-indicator`, in `group`s
62
87
  * with a `group-label` and `separator`s if it has them, and an `empty` part drawn while
63
- * nothing matches. With `multiple`, the input is in a `chips` part with a
88
+ * nothing matches. The `input` may be inside the `popup`, the items then in a `list` part: the
89
+ * popup is placed against the `trigger`, and the input has focus while it is open. With `multiple`, the input is in a `chips` part with a
64
90
  * `<template kui-each="chips">` holding a `chip` (`{value}`) and its `chip-remove` button.
91
+ * With the input in the popup, the `trigger` may hold a `value` part: it says the chosen
92
+ * value's label, or its `kui-placeholder`. A `status` part says how the list stands to
93
+ * software that reads the page, as the page changes its text. With `items` given as data, the
94
+ * list is a `<template kui-each="collection">` holding an `item` (`kui-value="{value}"`,
95
+ * `{label}`; `kui-when="item"` where groups are given too) or a `group`
96
+ * (`kui-when="group"`, `{value}` its name) with a `<template kui-each="collection">` of its
97
+ * own for its items: the element filters, and draws what is left.
65
98
  * With a name it draws the hidden input a form reads. `value`,
66
99
  * `default-value`, `input-value`, `default-input-value`, `open`, `default-open`, `disabled`,
67
- * `required`, `inline`, `multiple`, `values` and `default-values` (with commas between),
100
+ * `read-only`, `required`, `inline`, `auto-highlight`, `multiple`, `values` and `default-values` (with
101
+ * commas between),
68
102
  * `name`, `form`; `items` and `filter` as properties; it tells `value-change`,
69
103
  * `values-change`, `input-value-change` and `open-change`.
70
104
  */
@@ -78,8 +112,10 @@ const tag = defineElement({
78
112
  open: "boolean",
79
113
  "default-open": "boolean",
80
114
  disabled: "boolean",
115
+ "read-only": "boolean",
81
116
  required: "boolean",
82
117
  inline: "boolean",
118
+ "auto-highlight": "boolean",
83
119
  multiple: "boolean",
84
120
  values: "string",
85
121
  "default-values": "string",
@@ -1 +1 @@
1
- {"version":3,"file":"combobox.js","names":[],"sources":["../../../../packages/web/src/combobox.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport type { Combobox, ComboboxGroup, ComboboxProps } from \"@kirana-ui/core/combobox\"\nimport { createCombobox } from \"@kirana-ui/core/combobox\"\n\nimport { fieldAround, itemOptions, list, MARK, once, place, valueOf } from \"./around.ts\"\nimport { defineElement, entryAround, partAround } from \"./runtime.ts\"\nimport type { Drawn, Each } from \"./runtime.ts\"\n\ntype Props = Omit<ComboboxProps<string>, \"values\" | \"defaultValues\"> & {\n values?: string | readonly string[]\n defaultValues?: string | readonly string[]\n}\n\nconst groups = new WeakMap<HTMLElement, ComboboxGroup>()\nlet made = 0\n\nconst groupOf = (controller: Combobox<string>, element: HTMLElement | null) =>\n once(groups, element, (group) =>\n controller.group(group.getAttribute(\"kui-id\") ?? `kui-combobox-group-${++made}`)\n )\n\ntype Parts = Record<\n string,\n (controller: Combobox<string>, element: HTMLElement) => Drawn[\"part\"] | Drawn | undefined\n>\n\n/** A combobox's parts: an autocomplete has them too. */\nexport const PARTS: Parts = {\n input: (controller) => controller.input,\n trigger: (controller) => controller.trigger,\n clear: (controller) => ({ part: controller.clear, mounted: controller.clearable }),\n positioner(controller, element) {\n place(controller.positioning, element)\n return { mounted: controller.mounted, part: controller.positioner }\n },\n popup: (controller) => controller.popup,\n empty: (controller) => ({ part: controller.emptyPart, mounted: controller.empty }),\n group: (controller, element) => groupOf(controller, element)?.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) {\n const id = element.getAttribute(\"kui-id\") ?? `kui-combobox-item-${++made}`\n return controller.item(\n valueOf(element),\n () => ({ ...itemOptions(element)(), id }),\n groupOf(controller, element.parentElement && partAround(element.parentElement, \"group\"))\n )\n },\n chips: (controller) => controller.chips,\n chip(controller, element) {\n const value = entryAround<{ value: string }>(element)?.value\n return value === undefined ? undefined : controller.chip(value)\n },\n \"chip-remove\"(controller, element) {\n const value = entryAround<{ value: string }>(element)?.value\n return value === undefined ? undefined : controller.chipRemove(value)\n },\n \"item-indicator\": (controller, element) => ({\n part: MARK,\n mounted: controller.selected(valueOf(partAround(element, \"item\"))),\n }),\n}\n\n/** With `multiple`: a chip for each chosen value, from a `<template kui-each=\"chips\">`. */\nexport const LISTS = {\n chips: (controller: Combobox<string>): Each<{ value: string }> => ({\n entries: computed(() => controller.values.get().map((value) => ({ value }))),\n key: (chip) => chip.value,\n }),\n}\n\n/**\n * `<kui-combobox>` around an `input`, with a `trigger` and a `clear` button if it has them,\n * and a `portal` with a `positioner` around the `popup`, which holds an `item` for each\n * `kui-value` (`kui-disabled`, `kui-label`, `kui-id`) with an `item-indicator`, in `group`s\n * with a `group-label` and `separator`s if it has them, and an `empty` part drawn while\n * nothing matches. With `multiple`, the input is in a `chips` part with a\n * `<template kui-each=\"chips\">` holding a `chip` (`{value}`) and its `chip-remove` button.\n * With a name it draws the hidden input a form reads. `value`,\n * `default-value`, `input-value`, `default-input-value`, `open`, `default-open`, `disabled`,\n * `required`, `inline`, `multiple`, `values` and `default-values` (with commas between),\n * `name`, `form`; `items` and `filter` as properties; it tells `value-change`,\n * `values-change`, `input-value-change` and `open-change`.\n */\nexport const tag = defineElement<Props, Combobox<string>>({\n tag: \"kui-combobox\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n \"input-value\": \"string\",\n \"default-input-value\": \"string\",\n open: \"boolean\",\n \"default-open\": \"boolean\",\n disabled: \"boolean\",\n required: \"boolean\",\n inline: \"boolean\",\n multiple: \"boolean\",\n values: \"string\",\n \"default-values\": \"string\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"items\", \"filter\"],\n create: (props, host) =>\n createCombobox<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: LISTS,\n inner: (controller) => ({ part: controller.hidden, mounted: controller.named }),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValuesChange: { event: \"values-change\", prop: \"values\" },\n onInputValueChange: { event: \"input-value-change\", prop: \"inputValue\" },\n onOpenChange: { event: \"open-change\", prop: \"open\" },\n },\n parts: PARTS,\n})\n"],"mappings":";;;;;AAaA,MAAM,yBAAS,IAAI,QAAoC;AACvD,IAAI,OAAO;AAEX,MAAM,WAAW,YAA8B,YAC7C,KAAK,QAAQ,UAAU,UACrB,WAAW,MAAM,MAAM,aAAa,QAAQ,KAAK,sBAAsB,EAAE,MAAM,CACjF;;AAQF,MAAa,QAAe;CAC1B,QAAQ,eAAe,WAAW;CAClC,UAAU,eAAe,WAAW;CACpC,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAO,SAAS,WAAW;CAAU;CAChF,WAAW,YAAY,SAAS;EAC9B,MAAM,WAAW,aAAa,OAAO;EACrC,OAAO;GAAE,SAAS,WAAW;GAAS,MAAM,WAAW;EAAW;CACpE;CACA,QAAQ,eAAe,WAAW;CAClC,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAW,SAAS,WAAW;CAAM;CAChF,QAAQ,YAAY,YAAY,QAAQ,YAAY,OAAO,CAAC,EAAE;CAE9D,gBAAgB,YAAY,YAC1B,OAAO,IAAI,WAAW,SAAS,OAAO,CAAE,CAAC,EAAE,SAAS,WAAW;CACjE,YAAY,eAAe,WAAW;C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AE;CACpF,CAAC,GACD,EAAE,OAAO,YAAY,IAAI,EAAE,CAC7B;CACF,OAAO;CACP,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAQ,SAAS,WAAW;CAAM;CAC7E,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,gBAAgB;GAAE,OAAO;GAAiB,MAAM;EAAS;EACzD,oBAAoB;GAAE,OAAO;GAAsB,MAAM;EAAa;EACtE,cAAc;GAAE,OAAO;GAAe,MAAM;EAAO;CACrD;CACA,OAAO;AACT,CAAC"}
1
+ {"version":3,"file":"combobox.js","names":[],"sources":["../../../../packages/web/src/combobox.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport type {\n Combobox,\n ComboboxEntry,\n ComboboxGroup,\n ComboboxProps,\n} from \"@kirana-ui/core/combobox\"\nimport { createCombobox } from \"@kirana-ui/core/combobox\"\n\nimport { fieldAround, itemOptions, list, MARK, once, positioner, valueOf } from \"./around.ts\"\nimport type { Placed } from \"./around.ts\"\nimport { defineElement, entryAround, partAround } from \"./runtime.ts\"\nimport type { Drawn, Each, ElementOf } from \"./runtime.ts\"\n\ntype Props = Omit<ComboboxProps<string>, \"values\" | \"defaultValues\"> & {\n values?: string | readonly string[]\n defaultValues?: string | readonly string[]\n}\n\nconst groups = new WeakMap<HTMLElement, ComboboxGroup>()\nlet made = 0\n\nconst groupOf = (controller: Combobox<string>, element: HTMLElement | null) =>\n once(groups, element, (group) =>\n controller.group(group.getAttribute(\"kui-id\") ?? `kui-combobox-group-${++made}`)\n )\n\ntype Parts = Record<\n string,\n (controller: Combobox<string>, element: HTMLElement) => Drawn[\"part\"] | Drawn | undefined\n>\n\n/** A combobox's parts: an autocomplete has them too. */\nexport const PARTS: Parts = {\n input: (controller) => controller.input,\n trigger: (controller) => controller.trigger,\n // It says the chosen value's label, or its `kui-placeholder`, unless the page wrote there.\n value: (controller, element) => ({\n part: PLAIN,\n text: computed(\n () => controller.shown.get().label ?? element.getAttribute(\"kui-placeholder\") ?? undefined\n ),\n }),\n status: (controller) => controller.status,\n clear: (controller) => ({ part: controller.clear, mounted: controller.clearable }),\n positioner,\n popup: (controller) => controller.popup,\n list: (controller) => controller.list,\n empty: (controller) => ({ part: controller.emptyPart, mounted: controller.empty }),\n group: (controller, element) => groupOf(controller, element)?.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) {\n const id = element.getAttribute(\"kui-id\") ?? `kui-combobox-item-${++made}`\n // Drawn from data, its entry says whether it can be chosen.\n const off = () => {\n const entry = entryAround<ComboboxEntry<string>>(element)\n return entry?.type === \"item\" && entry.disabled ? { disabled: true } : {}\n }\n return controller.item(\n valueOf(element),\n () => ({ ...itemOptions(element)(), ...off(), id }),\n groupOf(controller, element.parentElement && partAround(element.parentElement, \"group\"))\n )\n },\n chips: (controller) => controller.chips,\n chip(controller, element) {\n const value = entryAround<{ value: string }>(element)?.value\n return value === undefined ? undefined : controller.chip(value)\n },\n \"chip-remove\"(controller, element) {\n const value = entryAround<{ value: string }>(element)?.value\n return value === undefined ? undefined : controller.chipRemove(value)\n },\n \"item-indicator\": (controller, element) => ({\n part: MARK,\n mounted: controller.selected(valueOf(partAround(element, \"item\"))),\n }),\n}\n\n/** A part that draws no element of its own in a framework: here, the page's element as it is. */\nconst PLAIN = { props: computed(() => ({})), attach: () => () => {} }\n\n/**\n * With `multiple`: a chip for each chosen value, from a `<template kui-each=\"chips\">`. With\n * `items` as data: what is left of them, from a `<template kui-each=\"collection\">`; one\n * written in a group's copy is that group's items left.\n */\nexport const LISTS = {\n chips: (controller: Combobox<string>): Each<{ value: string }> => ({\n entries: computed(() => controller.values.get().map((value) => ({ value }))),\n key: (chip) => chip.value,\n }),\n collection: (controller: Combobox<string>, around: unknown): Each<ComboboxEntry<string>> => {\n const group = around as ComboboxEntry<string> | undefined\n return {\n entries: controller.entries(group?.type === \"group\" ? group : undefined),\n key: (entry) => entry.key,\n type: (entry) => entry.type,\n }\n },\n}\n\n/**\n * `<kui-combobox>` around an `input`, with a `trigger` and a `clear` button if it has them,\n * and a `portal` with a `positioner` (`kui-side` … and `kui-anchor`, an element's id) around\n * the `popup`, which holds an `item` for each\n * `kui-value` (`kui-disabled`, `kui-label`, `kui-id`) with an `item-indicator`, in `group`s\n * with a `group-label` and `separator`s if it has them, and an `empty` part drawn while\n * nothing matches. The `input` may be inside the `popup`, the items then in a `list` part: the\n * popup is placed against the `trigger`, and the input has focus while it is open. With `multiple`, the input is in a `chips` part with a\n * `<template kui-each=\"chips\">` holding a `chip` (`{value}`) and its `chip-remove` button.\n * With the input in the popup, the `trigger` may hold a `value` part: it says the chosen\n * value's label, or its `kui-placeholder`. A `status` part says how the list stands to\n * software that reads the page, as the page changes its text. With `items` given as data, the\n * list is a `<template kui-each=\"collection\">` holding an `item` (`kui-value=\"{value}\"`,\n * `{label}`; `kui-when=\"item\"` where groups are given too) or a `group`\n * (`kui-when=\"group\"`, `{value}` its name) with a `<template kui-each=\"collection\">` of its\n * own for its items: the element filters, and draws what is left.\n * With a name it draws the hidden input a form reads. `value`,\n * `default-value`, `input-value`, `default-input-value`, `open`, `default-open`, `disabled`,\n * `read-only`, `required`, `inline`, `auto-highlight`, `multiple`, `values` and `default-values` (with\n * commas between),\n * `name`, `form`; `items` and `filter` as properties; it tells `value-change`,\n * `values-change`, `input-value-change` and `open-change`.\n */\nexport const tag = defineElement<Props, Combobox<string>>({\n tag: \"kui-combobox\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n \"input-value\": \"string\",\n \"default-input-value\": \"string\",\n open: \"boolean\",\n \"default-open\": \"boolean\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n inline: \"boolean\",\n \"auto-highlight\": \"boolean\",\n multiple: \"boolean\",\n values: \"string\",\n \"default-values\": \"string\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"items\", \"filter\"],\n create: (props, host) =>\n createCombobox<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: LISTS,\n inner: (controller) => ({ part: controller.hidden, mounted: controller.named }),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValuesChange: { event: \"values-change\", prop: \"values\" },\n onInputValueChange: { event: \"input-value-change\", prop: \"inputValue\" },\n onOpenChange: { event: \"open-change\", prop: \"open\" },\n },\n parts: PARTS,\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-combobox\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"values-change\": [\"onValuesChange\", \"values\"]\n \"input-value-change\": [\"onInputValueChange\", \"inputValue\"]\n \"open-change\": [\"onOpenChange\", \"open\"]\n }\n > &\n Placed\n }\n}\n"],"mappings":";;;;;AAmBA,MAAM,yBAAS,IAAI,QAAoC;AACvD,IAAI,OAAO;AAEX,MAAM,WAAW,YAA8B,YAC7C,KAAK,QAAQ,UAAU,UACrB,WAAW,MAAM,MAAM,aAAa,QAAQ,KAAK,sBAAsB,EAAE,MAAM,CACjF;;AAQF,MAAa,QAAe;CAC1B,QAAQ,eAAe,WAAW;CAClC,UAAU,eAAe,WAAW;CAEpC,QAAQ,YAAY,aAAa;EAC/B,MAAM;EACN,MAAM,eACE,WAAW,MAAM,IAAI,CAAC,CAAC,SAAS,QAAQ,aAAa,iBAAiB,KAAK,KAAA,CACnF;CACF;CACA,SAAS,eAAe,WAAW;CACnC,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAO,SAAS,WAAW;CAAU;CAChF;CACA,QAAQ,eAAe,WAAW;CAClC,OAAO,eAAe,WAAW;CACjC,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAW,SAAS,WAAW;CAAM;CAChF,QAAQ,YAAY,YAAY,QAAQ,YAAY,OAAO,CAAC,EAAE;CAE9D,gBAAgB,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,UAAU,QAAQ,KAAA,CAAS;GACvE,MAAM,UAAU,MAAM;GACtB,OAAO,UAAU,MAAM;EACzB;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,MAAM,cAAuC;CACxD,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,eAAe;EACf,uBAAuB;EACvB,MAAM;EACN,gBAAgB;EAChB,UAAU;EACV,aAAa;EACb,UAAU;EACV,QAAQ;EACR,kBAAkB;EAClB,UAAU;EACV,QAAQ;EACR,kBAAkB;EAClB,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,SAAS,QAAQ;CAC9B,SAAS,OAAO,SACd,eACE,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;CACP,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAQ,SAAS,WAAW;CAAM;CAC7E,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,gBAAgB;GAAE,OAAO;GAAiB,MAAM;EAAS;EACzD,oBAAoB;GAAE,OAAO;GAAsB,MAAM;EAAa;EACtE,cAAc;GAAE,OAAO;GAAe,MAAM;EAAO;CACrD;CACA,OAAO;AACT,CAAC"}
package/src/command.d.ts CHANGED
@@ -1,10 +1,20 @@
1
+ import { ElementOf, Tag } from "./runtime.js";
2
+ import { Command, CommandProps } from "@kirana-ui/core/command";
1
3
  /**
2
4
  * `<kui-command>` around `kui-part="root"`, an `input` and a `list` of `item`s (`kui-value`,
3
5
  * `kui-disabled`, `kui-label`, `kui-keywords` with commas between, `kui-id`), in `group`s
4
6
  * with a `group-heading` and `separator`s (`kui-always-render`) if it has them, and an
5
7
  * `empty` part drawn while nothing matches. What is typed filters the list; Enter or a press
6
- * runs an item. `input-value`, `default-input-value`, `loop`, `disabled`; `filter` as a
8
+ * runs an item. `input-value`, `default-input-value`, `loop`, `auto-highlight` (on unless `="false"`), `disabled`; `filter` as a
7
9
  * property; it tells `input-value-change` and `select`.
8
10
  */
9
- export declare const tag: string;
11
+ export declare const tag: Tag<CommandProps, Command>;
12
+ declare global {
13
+ interface HTMLElementTagNameMap {
14
+ "kui-command": ElementOf<typeof tag, {
15
+ "input-value-change": ["onInputValueChange", "inputValue"];
16
+ select: ["onSelect", "value"];
17
+ }>;
18
+ }
19
+ }
10
20
  //# sourceMappingURL=command.d.ts.map
package/src/command.js CHANGED
@@ -10,7 +10,7 @@ const groupOf = (controller, element) => once(groups, element, (group) => contro
10
10
  * `kui-disabled`, `kui-label`, `kui-keywords` with commas between, `kui-id`), in `group`s
11
11
  * with a `group-heading` and `separator`s (`kui-always-render`) if it has them, and an
12
12
  * `empty` part drawn while nothing matches. What is typed filters the list; Enter or a press
13
- * runs an item. `input-value`, `default-input-value`, `loop`, `disabled`; `filter` as a
13
+ * runs an item. `input-value`, `default-input-value`, `loop`, `auto-highlight` (on unless `="false"`), `disabled`; `filter` as a
14
14
  * property; it tells `input-value-change` and `select`.
15
15
  */
16
16
  const tag = defineElement({
@@ -19,6 +19,7 @@ const tag = defineElement({
19
19
  "input-value": "string",
20
20
  "default-input-value": "string",
21
21
  loop: "boolean",
22
+ "auto-highlight": "boolean",
22
23
  disabled: "boolean"
23
24
  },
24
25
  properties: ["filter"],
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","names":[],"sources":["../../../../packages/web/src/command.ts"],"sourcesContent":["import { createCommand } from \"@kirana-ui/core/command\"\nimport type { Command, CommandGroup, CommandProps } from \"@kirana-ui/core/command\"\n\nimport { list, once, valueOf } from \"./around.ts\"\nimport { defineElement, partAround } from \"./runtime.ts\"\n\nconst groups = new WeakMap<HTMLElement, CommandGroup>()\nlet made = 0\nconst groupOf = (controller: Command, element: HTMLElement | null) =>\n once(groups, element, (group) =>\n controller.group(group.getAttribute(\"kui-id\") ?? `kui-command-group-${++made}`)\n )\n\n/**\n * `<kui-command>` around `kui-part=\"root\"`, an `input` and a `list` of `item`s (`kui-value`,\n * `kui-disabled`, `kui-label`, `kui-keywords` with commas between, `kui-id`), in `group`s\n * with a `group-heading` and `separator`s (`kui-always-render`) if it has them, and an\n * `empty` part drawn while nothing matches. What is typed filters the list; Enter or a press\n * runs an item. `input-value`, `default-input-value`, `loop`, `disabled`; `filter` as a\n * property; it tells `input-value-change` and `select`.\n */\nexport const tag = defineElement<CommandProps, Command>({\n tag: \"kui-command\",\n props: {\n \"input-value\": \"string\",\n \"default-input-value\": \"string\",\n loop: \"boolean\",\n disabled: \"boolean\",\n },\n properties: [\"filter\"],\n create: (props) => createCommand(props),\n changes: {\n onInputValueChange: { event: \"input-value-change\", prop: \"inputValue\" },\n onSelect: { event: \"select\", prop: \"value\", hold: false },\n },\n parts: {\n root: (controller) => controller.root,\n input: (controller) => controller.input,\n list: (controller) => controller.list,\n empty: (controller) => ({ part: controller.emptyPart, mounted: controller.empty }),\n group: (controller, element) => groupOf(controller, element)?.part,\n \"group-heading\": (controller, element) =>\n groups.get(partAround(element, \"group\")!)?.heading ?? controller.heading,\n item(controller, element) {\n const id = element.getAttribute(\"kui-id\") ?? `kui-command-item-${++made}`\n return controller.item(\n valueOf(element),\n () => ({\n id,\n ...(element.hasAttribute(\"kui-disabled\") ? { disabled: true } : {}),\n ...(element.hasAttribute(\"kui-label\")\n ? { label: element.getAttribute(\"kui-label\")! }\n : {}),\n ...(element.hasAttribute(\"kui-keywords\")\n ? { keywords: list(element.getAttribute(\"kui-keywords\"))! }\n : {}),\n }),\n groupOf(controller, element.parentElement && partAround(element.parentElement, \"group\"))\n )\n },\n separator: (controller, element) =>\n controller.separator(() => element.hasAttribute(\"kui-always-render\")),\n },\n})\n"],"mappings":";;;;AAMA,MAAM,yBAAS,IAAI,QAAmC;AACtD,IAAI,OAAO;AACX,MAAM,WAAW,YAAqB,YACpC,KAAK,Q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ources":["../../../../packages/web/src/command.ts"],"sourcesContent":["import { createCommand } from \"@kirana-ui/core/command\"\nimport type { Command, CommandGroup, CommandProps } from \"@kirana-ui/core/command\"\n\nimport { list, once, valueOf } from \"./around.ts\"\nimport { defineElement, partAround } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst groups = new WeakMap<HTMLElement, CommandGroup>()\nlet made = 0\nconst groupOf = (controller: Command, element: HTMLElement | null) =>\n once(groups, element, (group) =>\n controller.group(group.getAttribute(\"kui-id\") ?? `kui-command-group-${++made}`)\n )\n\n/**\n * `<kui-command>` around `kui-part=\"root\"`, an `input` and a `list` of `item`s (`kui-value`,\n * `kui-disabled`, `kui-label`, `kui-keywords` with commas between, `kui-id`), in `group`s\n * with a `group-heading` and `separator`s (`kui-always-render`) if it has them, and an\n * `empty` part drawn while nothing matches. What is typed filters the list; Enter or a press\n * runs an item. `input-value`, `default-input-value`, `loop`, `auto-highlight` (on unless `=\"false\"`), `disabled`; `filter` as a\n * property; it tells `input-value-change` and `select`.\n */\nexport const tag = defineElement<CommandProps, Command>({\n tag: \"kui-command\",\n props: {\n \"input-value\": \"string\",\n \"default-input-value\": \"string\",\n loop: \"boolean\",\n \"auto-highlight\": \"boolean\",\n disabled: \"boolean\",\n },\n properties: [\"filter\"],\n create: (props) => createCommand(props),\n changes: {\n onInputValueChange: { event: \"input-value-change\", prop: \"inputValue\" },\n onSelect: { event: \"select\", prop: \"value\", hold: false },\n },\n parts: {\n root: (controller) => controller.root,\n input: (controller) => controller.input,\n list: (controller) => controller.list,\n empty: (controller) => ({ part: controller.emptyPart, mounted: controller.empty }),\n group: (controller, element) => groupOf(controller, element)?.part,\n \"group-heading\": (controller, element) =>\n groups.get(partAround(element, \"group\")!)?.heading ?? controller.heading,\n item(controller, element) {\n const id = element.getAttribute(\"kui-id\") ?? `kui-command-item-${++made}`\n return controller.item(\n valueOf(element),\n () => ({\n id,\n ...(element.hasAttribute(\"kui-disabled\") ? { disabled: true } : {}),\n ...(element.hasAttribute(\"kui-label\")\n ? { label: element.getAttribute(\"kui-label\")! }\n : {}),\n ...(element.hasAttribute(\"kui-keywords\")\n ? { keywords: list(element.getAttribute(\"kui-keywords\"))! }\n : {}),\n }),\n groupOf(controller, element.parentElement && partAround(element.parentElement, \"group\"))\n )\n },\n separator: (controller, element) =>\n controller.separator(() => element.hasAttribute(\"kui-always-render\")),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-command\": ElementOf<\n typeof tag,\n { \"input-value-change\": [\"onInputValueChange\", \"inputValue\"]; select: [\"onSelect\", \"value\"] }\n >\n }\n}\n"],"mappings":";;;;AAOA,MAAM,yBAAS,IAAI,QAAmC;AACtD,IAAI,OAAO;AACX,MAAM,WAAW,YAAqB,YACpC,KAAK,QAAQ,UAAU,UACrB,WAAW,MAAM,MAAM,aAAa,QAAQ,KAAK,qBAAqB,EAAE,MAAM,CAChF;;;;;;;;;AAUF,MAAa,MAAM,cAAqC;CACtD,KAAK;CACL,OAAO;EACL,eAAe;EACf,uBAAuB;EACvB,MAAM;EACN,kBAAkB;EAClB,UAAU;CACZ;CACA,YAAY,CAAC,QAAQ;CACrB,SAAS,UAAU,cAAc,KAAK;CACtC,SAAS;EACP,oBAAoB;GAAE,OAAO;GAAsB,MAAM;EAAa;EACtE,UAAU;GAAE,OAAO;GAAU,MAAM;GAAS,MAAM;EAAM;CAC1D;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,eAAe,WAAW;EAClC,OAAO,eAAe,WAAW;EACjC,QAAQ,gBAAgB;GAAE,MAAM,WAAW;GAAW,SAAS,WAAW;EAAM;EAChF,QAAQ,YAAY,YAAY,QAAQ,YAAY,OAAO,CAAC,EAAE;EAC9D,kBAAkB,YAAY,YAC5B,OAAO,IAAI,WAAW,SAAS,OAAO,CAAE,CAAC,EAAE,WAAW,WAAW;EACnE,KAAK,YAAY,SAAS;GACxB,MAAM,KAAK,QAAQ,aAAa,QAAQ,KAAK,oBAAoB,EAAE;GACnE,OAAO,WAAW,KAChB,QAAQ,OAAO,UACR;IACL;IACA,GAAI,QAAQ,aAAa,cAAc,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACjE,GAAI,QAAQ,aAAa,WAAW,IAChC,EAAE,OAAO,QAAQ,aAAa,WAAW,EAAG,IAC5C,CAAC;IACL,GAAI,QAAQ,aAAa,cAAc,IACnC,EAAE,UAAU,KAAK,QAAQ,aAAa,cAAc,CAAC,EAAG,IACxD,CAAC;GACP,IACA,QAAQ,YAAY,QAAQ,iBAAiB,WAAW,QAAQ,eAAe,OAAO,CAAC,CACzF;EACF;EACA,YAAY,YAAY,YACtB,WAAW,gBAAgB,QAAQ,aAAa,mBAAmB,CAAC;CACxE;AACF,CAAC"}
@@ -1,7 +1,19 @@
1
+ import { ElementOf, Tag, Told } from "./runtime.js";
2
+ import { Placed } from "./around.js";
1
3
  /**
2
4
  * `<kui-context-menu>`: a menu for an area of the page, opened at the pointer by a secondary
3
5
  * press, or a long one on a touch screen. Its `kui-part="trigger"` is the area; the rest are a
4
6
  * menu's parts.
5
7
  */
6
- export declare const tag: string;
8
+ export declare const tag: Tag<import("@kirana-ui/core/menu").MenuProps, import("@kirana-ui/core/menu").Menu>;
9
+ declare global {
10
+ interface HTMLElementTagNameMap {
11
+ "kui-context-menu": ElementOf<typeof tag, {
12
+ "open-change": ["onOpenChange", "open"];
13
+ }, {
14
+ "checked-change": Told<"checked", boolean>;
15
+ "value-change": Told<"value", string>;
16
+ }> & Placed;
17
+ }
18
+ }
7
19
  //# sourceMappingURL=context-menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-menu.js","names":["defineMenu"],"sources":["../../../../packages/web/src/context-menu.ts"],"sourcesContent":["import { defineMenu } from \"./menu.ts\"\n\n/**\n * `<kui-context-menu>`: a menu for an area of the page, opened at the pointer by a secondary\n * press, or a long one on a touch screen. Its `kui-part=\"trigger\"` is the area; the rest are a\n * menu's parts.\n */\nexport const tag = defineMenu(\n \"kui-context-menu\",\n () => ({ context: true }),\n (controller) => controller.area\n)\n"],"mappings":";;;;;;;AAOA,MAAa,MAAMA,KACjB,2BACO,EAAE,SAAS,KAAK,KACtB,eAAe,WAAW,IAC7B"}
1
+ {"version":3,"file":"context-menu.js","names":["defineMenu"],"sources":["../../../../packages/web/src/context-menu.ts"],"sourcesContent":["import { defineMenu } from \"./menu.ts\"\nimport type { Placed } from \"./around.ts\"\nimport type { ElementOf, Told } from \"./runtime.ts\"\n\n/**\n * `<kui-context-menu>`: a menu for an area of the page, opened at the pointer by a secondary\n * press, or a long one on a touch screen. Its `kui-part=\"trigger\"` is the area; the rest are a\n * menu's parts.\n */\nexport const tag = defineMenu(\n \"kui-context-menu\",\n () => ({ context: true }),\n (controller) => controller.area\n)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-context-menu\": ElementOf<\n typeof tag,\n { \"open-change\": [\"onOpenChange\", \"open\"] },\n { \"checked-change\": Told<\"checked\", boolean>; \"value-change\": Told<\"value\", string> }\n > &\n Placed\n }\n}\n"],"mappings":";;;;;;;AASA,MAAa,MAAMA,KACjB,2BACO,EAAE,SAAS,KAAK,KACtB,eAAe,WAAW,IAC7B"}
@@ -1,3 +1,5 @@
1
+ import { ElementOf, Tag } from "./runtime.js";
2
+ import { DateField, DateFieldProps } from "@kirana-ui/core/date-field";
1
3
  /**
2
4
  * `<kui-date-field>` around `kui-part="root"`, which holds a `<template kui-each="segments">`
3
5
  * with the `segment` each part of the date is typed in (`{type}` and `{index}` say which),
@@ -5,5 +7,12 @@
5
7
  * `disabled`, `read-only`, `required`, `name`, `form`; `placeholders` as a property; it
6
8
  * tells `value-change`.
7
9
  */
8
- export declare const tag: string;
10
+ export declare const tag: Tag<DateFieldProps, DateField>;
11
+ declare global {
12
+ interface HTMLElementTagNameMap {
13
+ "kui-date-field": ElementOf<typeof tag, {
14
+ "value-change": ["onValueChange", "value"];
15
+ }>;
16
+ }
17
+ }
9
18
  //# sourceMappingURL=date-field.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-field.js","names":[],"sources":["../../../../packages/web/src/date-field.ts"],"sourcesContent":["import { createDateField } from \"@kirana-ui/core/date-field\"\nimport type { DateField, DateFieldProps } from \"@kirana-ui/core/date-field\"\n\nimport { fieldParts } from \"./dates.ts\"\nimport { defineElement } from \"./runtime.ts\"\n\nconst { parts, lists } = fieldParts<DateField>((controller) => controller)\n\n/**\n * `<kui-date-field>` around `kui-part=\"root\"`, which holds a `<template kui-each=\"segments\">`\n * with the `segment` each part of the date is typed in (`{type}` and `{index}` say which),\n * and the hidden `input` a form reads. `value`, `default-value`, `locale`, `min`, `max`,\n * `disabled`, `read-only`, `required`, `name`, `form`; `placeholders` as a property; it\n * tells `value-change`.\n */\nexport const tag = defineElement<DateFieldProps, DateField>({\n tag: \"kui-date-field\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\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) => createDateField(props),\n changes: { onValueChange: { event: \"value-change\", prop: \"value\" } },\n lists,\n parts: { root: (controller) => controller.root, ...parts },\n})\n"],"mappings":";;;;AAMA,MAAM,EAAE,OAAO,UAAU,YAAuB,eAAe,UAAU;;;;;;;;AASzE,MAAa,MAAM,cAAyC;CAC1D,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,KAAK;EACL,KAAK;EACL,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,cAAc;CAC3B,SAAS,UAAU,gBAAgB,KAAK;CACxC,SAAS,EAAE,eAAe;EAAE,OAAO;EAAgB,MAAM;CAAQ,EAAE;CACnE;CACA,OAAO;EAAE,OAAO,eAAe,WAAW;EAAM,GAAG;CAAM;AAC3D,CAAC"}
1
+ {"version":3,"file":"date-field.js","names":[],"sources":["../../../../packages/web/src/date-field.ts"],"sourcesContent":["import { createDateField } from \"@kirana-ui/core/date-field\"\nimport type { DateField, DateFieldProps } from \"@kirana-ui/core/date-field\"\n\nimport { fieldParts } from \"./dates.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst { parts, lists } = fieldParts<DateField>((controller) => controller)\n\n/**\n * `<kui-date-field>` around `kui-part=\"root\"`, which holds a `<template kui-each=\"segments\">`\n * with the `segment` each part of the date is typed in (`{type}` and `{index}` say which),\n * and the hidden `input` a form reads. `value`, `default-value`, `locale`, `min`, `max`,\n * `disabled`, `read-only`, `required`, `name`, `form`; `placeholders` as a property; it\n * tells `value-change`.\n */\nexport const tag = defineElement<DateFieldProps, DateField>({\n tag: \"kui-date-field\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\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) => createDateField(props),\n changes: { onValueChange: { event: \"value-change\", prop: \"value\" } },\n lists,\n parts: { root: (controller) => controller.root, ...parts },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-date-field\": ElementOf<typeof tag, { \"value-change\": [\"onValueChange\", \"value\"] }>\n }\n}\n"],"mappings":";;;;AAOA,MAAM,EAAE,OAAO,UAAU,YAAuB,eAAe,UAAU;;;;;;;;AASzE,MAAa,MAAM,cAAyC;CAC1D,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,KAAK;EACL,KAAK;EACL,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,cAAc;CAC3B,SAAS,UAAU,gBAAgB,KAAK;CACxC,SAAS,EAAE,eAAe;EAAE,OAAO;EAAgB,MAAM;CAAQ,EAAE;CACnE;CACA,OAAO;EAAE,OAAO,eAAe,WAAW;EAAM,GAAG;CAAM;AAC3D,CAAC"}
@@ -1,11 +1,26 @@
1
+ import { ElementOf, Tag } from "./runtime.js";
2
+ import { Placed } from "./around.js";
3
+ import { DatePicker, DatePickerProps } from "@kirana-ui/core/date-picker";
1
4
  /**
2
5
  * `<kui-date-picker>`: a date field and a calendar in a popover that are one value. A
3
6
  * `kui-part="field"` with a date field's `segments` template and `input`; a `trigger`
4
7
  * button; and a `portal` with a `positioner` around the `popup`, which holds the `calendar`
5
8
  * with a calendar's parts and templates. `value`, `default-value`, `open`, `default-open`,
6
- * `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `disabled`, `read-only`,
7
- * `required`, `name`, `form`; `isDateUnavailable` and `placeholders` as properties; it tells
8
- * `value-change` and `open-change`.
9
+ * `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `months` (each drawn in a
10
+ * `<template kui-each="months">`), `paged-navigation`, `month`, `default-month`, `disabled`,
11
+ * `read-only`, `required`, `name`, `form`; `isDateUnavailable` and `placeholders` as
12
+ * properties; it tells `value-change`, `open-change` and `month-change`.
9
13
  */
10
- export declare const tag: string;
14
+ export declare const tag: Tag<DatePickerProps, DatePicker & {
15
+ mounted: unknown;
16
+ }>;
17
+ declare global {
18
+ interface HTMLElementTagNameMap {
19
+ "kui-date-picker": ElementOf<typeof tag, {
20
+ "value-change": ["onValueChange", "value"];
21
+ "open-change": ["onOpenChange", "open"];
22
+ "month-change": ["onMonthChange", "month"];
23
+ }> & Placed;
24
+ }
25
+ }
11
26
  //# sourceMappingURL=date-picker.d.ts.map
@@ -1,4 +1,4 @@
1
- import { place } from "./around.js";
1
+ import { positioner } from "./around.js";
2
2
  import { calendarParts, fieldParts } from "./dates.js";
3
3
  import { defineElement } from "./runtime.js";
4
4
  import { createDatePicker } from "@kirana-ui/core/date-picker";
@@ -10,9 +10,10 @@ const calendar = calendarParts((controller) => controller.calendar);
10
10
  * `kui-part="field"` with a date field's `segments` template and `input`; a `trigger`
11
11
  * button; and a `portal` with a `positioner` around the `popup`, which holds the `calendar`
12
12
  * with a calendar's parts and templates. `value`, `default-value`, `open`, `default-open`,
13
- * `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `disabled`, `read-only`,
14
- * `required`, `name`, `form`; `isDateUnavailable` and `placeholders` as properties; it tells
15
- * `value-change` and `open-change`.
13
+ * `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `months` (each drawn in a
14
+ * `<template kui-each="months">`), `paged-navigation`, `month`, `default-month`, `disabled`,
15
+ * `read-only`, `required`, `name`, `form`; `isDateUnavailable` and `placeholders` as
16
+ * properties; it tells `value-change`, `open-change` and `month-change`.
16
17
  */
17
18
  const tag = defineElement({
18
19
  tag: "kui-date-picker",
@@ -26,6 +27,10 @@ const tag = defineElement({
26
27
  max: "string",
27
28
  "calendar-system": "string",
28
29
  "fixed-weeks": "boolean",
30
+ months: "number",
31
+ "paged-navigation": "boolean",
32
+ month: "string",
33
+ "default-month": "string",
29
34
  disabled: "boolean",
30
35
  "read-only": "boolean",
31
36
  required: "boolean",
@@ -48,6 +53,10 @@ const tag = defineElement({
48
53
  onOpenChange: {
49
54
  event: "open-change",
50
55
  prop: "open"
56
+ },
57
+ onMonthChange: {
58
+ event: "month-change",
59
+ prop: "month"
51
60
  }
52
61
  },
53
62
  lists: {
@@ -58,13 +67,7 @@ const tag = defineElement({
58
67
  field: (controller) => controller.field.root,
59
68
  ...field.parts,
60
69
  trigger: (controller) => controller.popover.trigger,
61
- positioner(controller, element) {
62
- place(controller.popover.positioning, element);
63
- return {
64
- mounted: controller.popover.mounted,
65
- part: controller.popover.positioner
66
- };
67
- },
70
+ positioner: (controller, element) => positioner(controller.popover, element),
68
71
  popup: (controller) => controller.popover.popup,
69
72
  calendar: (controller) => controller.calendar.root,
70
73
  ...calendar.parts
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","names":[],"sources":["../../../../packages/web/src/date-picker.ts"],"sourcesContent":["import { createDatePicker } from \"@kirana-ui/core/date-picker\"\nimport type { DatePicker, DatePickerProps } from \"@kirana-ui/core/date-picker\"\n\nimport { place } from \"./around.ts\"\nimport { calendarParts, fieldParts } from \"./dates.ts\"\nimport { defineElement } from \"./runtime.ts\"\n\nconst field = fieldParts<DatePicker>((controller) => controller.field)\nconst calendar = calendarParts<DatePicker>((controller) => controller.calendar)\n\n/**\n * `<kui-date-picker>`: a date field and a calendar in a popover that are one value. A\n * `kui-part=\"field\"` with a date field's `segments` template and `input`; a `trigger`\n * button; and a `portal` with a `positioner` around the `popup`, which holds the `calendar`\n * with a calendar's parts and templates. `value`, `default-value`, `open`, `default-open`,\n * `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `disabled`, `read-only`,\n * `required`, `name`, `form`; `isDateUnavailable` and `placeholders` as properties; it tells\n * `value-change` and `open-change`.\n */\nexport const tag = defineElement<DatePickerProps, DatePicker & { mounted: unknown }>({\n tag: \"kui-date-picker\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n open: \"boolean\",\n \"default-open\": \"boolean\",\n locale: \"string\",\n min: \"string\",\n max: \"string\",\n \"calendar-system\": \"string\",\n \"fixed-weeks\": \"boolean\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"isDateUnavailable\", \"placeholders\"],\n create(props) {\n const picker = createDatePicker(props)\n // What a portal waits for: the popover's.\n return { ...picker, mounted: picker.popover.mounted }\n },\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onOpenChange: { event: \"open-change\", prop: \"open\" },\n },\n lists: { ...field.lists, ...calendar.lists },\n parts: {\n field: (controller) => controller.field.root,\n ...field.parts,\n trigger: (controller) => controller.popover.trigger,\n positioner(controller, element) {\n place(controller.popover.positioning, element)\n return { mounted: controller.popover.mounted, part: controller.popover.positioner }\n },\n popup: (controller) => controller.popover.popup,\n calendar: (controller) => controller.calendar.root,\n ...calendar.parts,\n },\n})\n"],"mappings":";;;;;AAOA,MAAM,QAAQ,YAAwB,eAAe,WAAW,KAAK;AACrE,MAAM,WAAW,eAA2B,eAAe,WAAW,QAAQ;;;;;;;;;;AAW9E,MAAa,MAAM,cAAkE;CACnF,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,KAAK;EACL,KAAK;EACL,mBAAmB;EACnB,eAAe;EACf,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,qBAAqB,cAAc;CAChD,OAAO,OAAO;EACZ,MAAM,SAAS,iBAAiB,KAAK;EAErC,OAAO;GAAE,GAAG;GAAQ,SAAS,OAAO,QAAQ;EAAQ;CACtD;CACA,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,cAAc;GAAE,OAAO;GAAe,MAAM;EAAO;CACrD;CACA,OAAO;EAAE,GAAG,MAAM;EAAO,GAAG,SAAS;CAAM;CAC3C,OAAO;EACL,QAAQ,eAAe,WAAW,MAAM;EACxC,GAAG,MAAM;EACT,UAAU,eAAe,WAAW,QAAQ;EAC5C,WAAW,YAAY,SAAS;GAC9B,MAAM,WAAW,QAAQ,aAAa,OAAO;GAC7C,OAAO;IAAE,SAAS,WAAW,QAAQ;IAAS,MAAM,WAAW,QAAQ;GAAW;EACpF;EACA,QAAQ,eAAe,WAAW,QAAQ;EAC1C,WAAW,eAAe,WAAW,SAAS;EAC9C,GAAG,SAAS;CACd;AACF,CAAC"}
1
+ {"version":3,"file":"date-picker.js","names":[],"sources":["../../../../packages/web/src/date-picker.ts"],"sourcesContent":["import { createDatePicker } from \"@kirana-ui/core/date-picker\"\nimport type { DatePicker, DatePickerProps } from \"@kirana-ui/core/date-picker\"\n\nimport { positioner } from \"./around.ts\"\nimport type { Placed } from \"./around.ts\"\nimport { calendarParts, fieldParts } from \"./dates.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst field = fieldParts<DatePicker>((controller) => controller.field)\nconst calendar = calendarParts<DatePicker>((controller) => controller.calendar)\n\n/**\n * `<kui-date-picker>`: a date field and a calendar in a popover that are one value. A\n * `kui-part=\"field\"` with a date field's `segments` template and `input`; a `trigger`\n * button; and a `portal` with a `positioner` around the `popup`, which holds the `calendar`\n * with a calendar's parts and templates. `value`, `default-value`, `open`, `default-open`,\n * `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `months` (each drawn in a\n * `<template kui-each=\"months\">`), `paged-navigation`, `month`, `default-month`, `disabled`,\n * `read-only`, `required`, `name`, `form`; `isDateUnavailable` and `placeholders` as\n * properties; it tells `value-change`, `open-change` and `month-change`.\n */\nexport const tag = defineElement<DatePickerProps, DatePicker & { mounted: unknown }>({\n tag: \"kui-date-picker\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n open: \"boolean\",\n \"default-open\": \"boolean\",\n locale: \"string\",\n min: \"string\",\n max: \"string\",\n \"calendar-system\": \"string\",\n \"fixed-weeks\": \"boolean\",\n months: \"number\",\n \"paged-navigation\": \"boolean\",\n month: \"string\",\n \"default-month\": \"string\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"isDateUnavailable\", \"placeholders\"],\n create(props) {\n const picker = createDatePicker(props)\n // What a portal waits for: the popover's.\n return { ...picker, mounted: picker.popover.mounted }\n },\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onOpenChange: { event: \"open-change\", prop: \"open\" },\n onMonthChange: { event: \"month-change\", prop: \"month\" },\n },\n lists: { ...field.lists, ...calendar.lists },\n parts: {\n field: (controller) => controller.field.root,\n ...field.parts,\n trigger: (controller) => controller.popover.trigger,\n positioner: (controller, element) => positioner(controller.popover, element),\n popup: (controller) => controller.popover.popup,\n calendar: (controller) => controller.calendar.root,\n ...calendar.parts,\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-date-picker\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"open-change\": [\"onOpenChange\", \"open\"]\n \"month-change\": [\"onMonthChange\", \"month\"]\n }\n > &\n Placed\n }\n}\n"],"mappings":";;;;;AASA,MAAM,QAAQ,YAAwB,eAAe,WAAW,KAAK;AACrE,MAAM,WAAW,eAA2B,eAAe,WAAW,QAAQ;;;;;;;;;;;AAY9E,MAAa,MAAM,cAAkE;CACnF,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,KAAK;EACL,KAAK;EACL,mBAAmB;EACnB,eAAe;EACf,QAAQ;EACR,oBAAoB;EACpB,OAAO;EACP,iBAAiB;EACjB,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,qBAAqB,cAAc;CAChD,OAAO,OAAO;EACZ,MAAM,SAAS,iBAAiB,KAAK;EAErC,OAAO;GAAE,GAAG;GAAQ,SAAS,OAAO,QAAQ;EAAQ;CACtD;CACA,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,cAAc;GAAE,OAAO;GAAe,MAAM;EAAO;EACnD,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;CACxD;CACA,OAAO;EAAE,GAAG,MAAM;EAAO,GAAG,SAAS;CAAM;CAC3C,OAAO;EACL,QAAQ,eAAe,WAAW,MAAM;EACxC,GAAG,MAAM;EACT,UAAU,eAAe,WAAW,QAAQ;EAC5C,aAAa,YAAY,YAAY,WAAW,WAAW,SAAS,OAAO;EAC3E,QAAQ,eAAe,WAAW,QAAQ;EAC1C,WAAW,eAAe,WAAW,SAAS;EAC9C,GAAG,SAAS;CACd;AACF,CAAC"}
package/src/dates.d.ts CHANGED
@@ -13,7 +13,10 @@ export declare function calendarParts<Controller>(of: (controller: Controller) =
13
13
  parts: Parts<Controller>;
14
14
  lists: Lists<Controller>;
15
15
  };
16
- /** A calendar's value as an attribute writes it: a day, or several with commas between. */
17
- export declare const days: (given: unknown) => unknown;
16
+ /**
17
+ * A calendar's value as an attribute writes it: a day, or several with commas between (a
18
+ * range's first and last, or a list's days).
19
+ */
20
+ export declare function days(given: unknown, mode?: unknown): unknown;
18
21
  export {};
19
22
  //# sourceMappingURL=dates.d.ts.map
package/src/dates.js CHANGED
@@ -21,29 +21,36 @@ function fieldParts(of) {
21
21
  }) }
22
22
  };
23
23
  }
24
+ const isMonth = (entry) => typeof entry === "object" && entry !== null && "weeks" in entry && "title" in entry;
25
+ /** The month a part is written in, in a `months` template: its place among those shown. */
26
+ const monthAround = (element) => entryAround(element, isMonth)?.index;
24
27
  /** A calendar's parts and its lists, for a component that is one or holds one. */
25
28
  function calendarParts(of) {
26
29
  const date = (element) => entryAround(element)?.date;
30
+ const month = (controller, element) => of(controller).monthAt(monthAround(element) ?? 0);
27
31
  return {
28
32
  parts: {
29
- heading: (controller) => ({
30
- part: of(controller).heading,
31
- text: of(controller).title
32
- }),
33
+ heading(controller, element) {
34
+ const shown = month(controller, element);
35
+ return {
36
+ part: shown.heading,
37
+ text: shown.title
38
+ };
39
+ },
33
40
  previous: (controller) => of(controller).previous,
34
41
  next: (controller) => of(controller).next,
35
- grid: (controller) => of(controller).grid,
42
+ grid: (controller, element) => month(controller, element).grid,
36
43
  "head-cell"(controller, element) {
37
44
  const weekday = entryAround(element);
38
45
  return weekday && of(controller).headCell(weekday);
39
46
  },
40
47
  cell(controller, element) {
41
48
  const day = date(element);
42
- return day === void 0 ? void 0 : of(controller).cell(day);
49
+ return day === void 0 ? void 0 : of(controller).cell(day, monthAround(element));
43
50
  },
44
51
  day(controller, element) {
45
52
  const day = date(element);
46
- return day === void 0 ? void 0 : of(controller).day(day);
53
+ return day === void 0 ? void 0 : of(controller).day(day, monthAround(element));
47
54
  }
48
55
  },
49
56
  lists: {
@@ -51,20 +58,48 @@ function calendarParts(of) {
51
58
  entries: of(controller).weekdays,
52
59
  key: (weekday) => weekday.index
53
60
  }),
54
- weeks: (controller) => ({
55
- entries: of(controller).weeks,
61
+ months: (controller) => ({
62
+ entries: of(controller).months,
63
+ key: (shown) => shown.index,
64
+ values: (shown) => ({
65
+ index: shown.index,
66
+ month: shown.month,
67
+ title: shown.title
68
+ })
69
+ }),
70
+ weeks: (controller, around) => ({
71
+ entries: isMonth(around) ? of(controller).monthAt(around.index).weeks : of(controller).weeks,
56
72
  key: (week) => week[0].date,
57
73
  values: () => ({})
58
74
  }),
59
- days: (_controller, week) => ({
60
- entries: week ?? [],
61
- key: (day) => day.date
62
- })
75
+ days(controller, week) {
76
+ const row = week ?? [];
77
+ const shown = of(controller).months.peek().find((each) => each.weeks.includes(row));
78
+ return {
79
+ entries: row,
80
+ key: (day) => day.date,
81
+ values: (day) => ({
82
+ ...day,
83
+ monthIndex: shown?.index ?? 0
84
+ })
85
+ };
86
+ }
63
87
  }
64
88
  };
65
89
  }
66
- /** A calendar's value as an attribute writes it: a day, or several with commas between. */
67
- const days = (given) => typeof given === "string" && given.includes(",") ? given.split(",") : given;
90
+ /**
91
+ * A calendar's value as an attribute writes it: a day, or several with commas between (a
92
+ * range's first and last, or a list's days).
93
+ */
94
+ function days(given, mode) {
95
+ const list = typeof given === "string" && given.includes(",") ? given.split(",") : given;
96
+ if (mode === "range" && Array.isArray(list)) return {
97
+ start: list[0],
98
+ end: list[1] ?? list[0]
99
+ };
100
+ if (mode === "multiple" && typeof list === "string") return list === "" ? [] : [list];
101
+ return list;
102
+ }
68
103
  export { calendarParts, days, fieldParts };
69
104
 
70
105
  //# sourceMappingURL=dates.js.map
package/src/dates.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"dates.js","names":[],"sources":["../../../../packages/web/src/dates.ts"],"sourcesContent":["import type { Calendar, CalendarDay, CalendarWeekday } from \"@kirana-ui/core/calendar\"\nimport type { DateField, DateFieldSegment } from \"@kirana-ui/core/date-field\"\n\nimport { entryAround } from \"./runtime.ts\"\nimport type { Drawn, Each } from \"./runtime.ts\"\n\ntype Parts<Controller> = Record<\n string,\n (controller: Controller, element: HTMLElement) => Drawn[\"part\"] | Drawn | undefined\n>\ntype Lists<Controller> = Record<string, (controller: Controller, around: unknown) => Each>\n\n/** A date field's parts and its list, for a component that is one or holds one. */\nexport function fieldParts<Controller>(of: (controller: Controller) => DateField) {\n const parts: Parts<Controller> = {\n segment(controller, element) {\n const segment = entryAround<DateFieldSegment>(element)\n if (!segment) return undefined\n const { part, text } = of(controller).segment(segment)\n return { part, text }\n },\n input: (controller) => of(controller).input,\n }\n const lists: Lists<Controller> = {\n segments: (controller) => ({\n entries: of(controller).segments,\n key: (segment: DateFieldSegment) => `${segment.index}-${segment.type}`,\n }),\n }\n return { parts, lists }\n}\n\n/** A calendar's parts and its lists, for a component that is one or holds one. */\nexport function calendarParts<Controller>(of: (controller: Controller) => Calendar) {\n const date = (element: HTMLElement) => entryAround<CalendarDay>(element)?.date\n const parts: Parts<Controller> = {\n heading: (controller) => ({ part: of(controller).heading, text: of(controller).title }),\n previous: (controller) => of(controller).previous,\n next: (controller) => of(controller).next,\n grid: (controller) => of(controller).grid,\n \"head-cell\"(controller, element) {\n const weekday = entryAround<CalendarWeekday>(element)\n return weekday && of(controller).headCell(weekday)\n },\n cell(controller, element) {\n const day = date(element)\n return day === undefined ? undefined : of(controller).cell(day)\n },\n day(controller, element) {\n const day = date(element)\n return day === undefined ? undefined : of(controller).day(day)\n },\n }\n const lists: Lists<Controller> = {\n weekdays: (controller) => ({\n entries: of(controller).weekdays,\n key: (weekday: CalendarWeekday) => weekday.index,\n }),\n weeks: (controller) => ({\n entries: of(controller).weeks,\n key: (week: readonly CalendarDay[]) => week[0]!.date,\n values: () => ({}),\n }),\n // Written in a week's row: that week's days.\n days: (_controller, week) => ({\n entries: (week as readonly CalendarDay[] | undefined) ?? [],\n key: (day: CalendarDay) => day.date,\n }),\n }\n return { parts, lists }\n}\n\n/** A calendar's value as an attribute writes it: a day, or several with commas between. */\nexport const days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GAAG;GAC/D;EAkBW;EAAG,OAAA;GAfd,WAAW,gBAAgB;IACzB,SAAS,GAAG,UAAU,CAAC,CAAC;IACxB,MAAM,YAA6B,QAAQ;GAC7C;GACA,QAAQ,gBAAgB;IACtB,SAAS,GAAG,UAAU,CAAC,CAAC;IACxB,MAAM,SAAiC,KAAK,EAAE,CAAE;IAChD,eAAe,CAAC;GAClB;GAEA,OAAO,aAAa,UAAU;IAC5B,SAAU,QAA+C,CAAC;IAC1D,MAAM,QAAqB,IAAI;GACjC;EAEkB;CAAE;AACxB;;AAGA,MAAa,QAAQ,UACnB,OAAO,UAAU,YAAY,MAAM,SAAS,GAAG,IAAI,MAAM,MAAM,GAAG,IAAI"}
1
+ {"version":3,"file":"dates.js","names":[],"sources":["../../../../packages/web/src/dates.ts"],"sourcesContent":["import type {\n Calendar,\n CalendarDay,\n CalendarMonth,\n CalendarWeekday,\n} from \"@kirana-ui/core/calendar\"\nimport type { DateField, DateFieldSegment } from \"@kirana-ui/core/date-field\"\n\nimport { entryAround } from \"./runtime.ts\"\nimport type { Drawn, Each } from \"./runtime.ts\"\n\ntype Parts<Controller> = Record<\n string,\n (controller: Controller, element: HTMLElement) => Drawn[\"part\"] | Drawn | undefined\n>\ntype Lists<Controller> = Record<string, (controller: Controller, around: unknown) => Each>\n\n/** A date field's parts and its list, for a component that is one or holds one. */\nexport function fieldParts<Controller>(of: (controller: Controller) => DateField) {\n const parts: Parts<Controller> = {\n segment(controller, element) {\n const segment = entryAround<DateFieldSegment>(element)\n if (!segment) return undefined\n const { part, text } = of(controller).segment(segment)\n return { part, text }\n },\n input: (controller) => of(controller).input,\n }\n const lists: Lists<Controller> = {\n segments: (controller) => ({\n entries: of(controller).segments,\n key: (segment: DateFieldSegment) => `${segment.index}-${segment.type}`,\n }),\n }\n return { parts, lists }\n}\n\nconst isMonth = (entry: unknown) =>\n typeof entry === \"object\" && entry !== null && \"weeks\" in entry && \"title\" in entry\n\n/** The month a part is written in, in a `months` template: its place among those shown. */\nconst monthAround = (element: Node) => entryAround<CalendarMonth>(element, isMonth)?.index\n\n/** A calendar's parts and its lists, for a component that is one or holds one. */\nexport function calendarParts<Controller>(of: (controller: Controller) => Calendar) {\n const date = (element: HTMLElement) => entryAround<CalendarDay>(element)?.date\n const month = (controller: Controller, element: HTMLElement) =>\n of(controller).monthAt(monthAround(element) ?? 0)\n const parts: Parts<Controller> = {\n heading(controller, element) {\n const shown = month(controller, element)\n return { part: shown.heading, text: shown.title }\n },\n previous: (controller) => of(controller).previous,\n next: (controller) => of(controller).next,\n grid: (controller, element) => month(controller, element).grid,\n \"head-cell\"(controller, element) {\n const weekday = entryAround<CalendarWeekday>(element)\n return weekday && of(controller).headCell(weekday)\n },\n cell(controller, element) {\n const day = date(element)\n return day === undefined ? undefined : of(controller).cell(day, monthAround(element))\n },\n day(controller, element) {\n const day = date(element)\n return day === undefined ? undefined : of(controller).day(day, monthAround(element))\n },\n }\n const lists: Lists<Controller> = {\n weekdays: (controller) => ({\n entries: of(controller).weekdays,\n key: (weekday: CalendarWeekday) => weekday.index,\n }),\n months: (controller) => ({\n entries: of(controller).months,\n key: (shown: CalendarMonth) => shown.index,\n values: (shown: CalendarMonth) => ({\n index: shown.index,\n month: shown.month,\n title: shown.title,\n }),\n }),\n // Written in a month's copy: that month's weeks; else the first month's.\n weeks: (controller, around) => ({\n entries: isMonth(around)\n ? of(controller).monthAt((around as CalendarMonth).index).weeks\n : of(controller).weeks,\n key: (week: readonly CalendarDay[]) => week[0]!.date,\n values: () => ({}),\n }),\n // Written in a week's row: that week's days, each with the place of its month\n // (`{monthIndex}`), for a page that names a day where it is drawn twice.\n days(controller, week) {\n const row = (week as readonly CalendarDay[] | undefined) ?? []\n const shown = of(controller)\n .months.peek()\n .find((each) => each.weeks.includes(row))\n return {\n entries: row,\n key: (day: CalendarDay) => day.date,\n values: (day: CalendarDay) => ({ ...day, monthIndex: shown?.index ?? 0 }),\n }\n },\n }\n return { parts, lists }\n}\n\n/**\n * A calendar's value as an attribute writes it: a day, or several with commas between (a\n * range's first and last, or a list's days).\n */\nexport function days(given: unknown, mode?: unknown): unknown {\n const list = typeof given === \"string\" && given.includes(\",\") ? given.split(\",\") : given\n if (mode === \"range\" && Array.isArray(list)) return { start: list[0], end: list[1] ?? list[0] }\n if (mode === \"multiple\" && typeof list === \"string\") return list === \"\" ? [] : [list]\n return list\n}\n"],"mappings":";;;AAkBA,SAAgB,WAAuB,IAA2C;CAgBhF,OAAO;EAAE,OAAA;GAdP,QAAQ,YAAY,SAAS;IAC3B,MAAM,UAAU,YAA8B,OAAO;IACrD,IAAI,CAAC,SAAS,OAAO,KAAA;IACrB,MAAM,EAAE,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,QAAQ,OAAO;IACrD,OAAO;KAAE;KAAM;IAAK;GACtB;GACA,QAAQ,eAAe,GAAG,UAAU,CAAC,CAAC;EAQ3B;EAAG,OAAA,EALd,WAAW,gBAAgB;GACzB,SAAS,GAAG,UAAU,CAAC,CAAC;GACxB,MAAM,YAA8B,GAAG,QAAQ,MAAM,GAAG,QAAQ;EAClE,GAEkB;CAAE;AACxB;AAEA,MAAM,WAAW,UACf,OAAO,UAAU,YAAY,UAAU,QAAQ,WAAW,SAAS,WAAW;;AAGhF,MAAM,eAAe,YAAkB,YAA2B,SAAS,OAAO,CAAC,EAAE;;AAGrF,SAAgB,cAA0B,IAA0C;CAClF,MAAM,QAAQ,YAAyB,YAAyB,OAAO,CAAC,EAAE;CAC1E,MAAM,SAAS,YAAwB,YACrC,GAAG,UAAU,CAAC,CAAC,QAAQ,YAAY,OAAO,KAAK,CAAC;CA0DlD,OAAO;EAAE,OAAA;GAxDP,QAAQ,YAAY,SAAS;IAC3B,MAAM,QAAQ,MAAM,YAAY,OAAO;IACvC,OAAO;KAAE,MAAM,MAAM;KAAS,MAAM,MAAM;IAAM;GAClD;GACA,WAAW,eAAe,GAAG,UAAU,CAAC,CAAC;GACzC,OAAO,eAAe,GAAG,UAAU,CAAC,CAAC;GACrC,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ACzE;GACF;EAEkB;CAAE;AACxB;;;;;AAMA,SAAgB,KAAK,OAAgB,MAAyB;CAC5D,MAAM,OAAO,OAAO,UAAU,YAAY,MAAM,SAAS,GAAG,IAAI,MAAM,MAAM,GAAG,IAAI;CACnF,IAAI,SAAS,WAAW,MAAM,QAAQ,IAAI,GAAG,OAAO;EAAE,OAAO,KAAK;EAAI,KAAK,KAAK,MAAM,KAAK;CAAG;CAC9F,IAAI,SAAS,cAAc,OAAO,SAAS,UAAU,OAAO,SAAS,KAAK,CAAC,IAAI,CAAC,IAAI;CACpF,OAAO;AACT"}
package/src/dialog.d.ts CHANGED
@@ -1,8 +1,19 @@
1
+ import { As, ElementOf, Tag } from "./runtime.js";
2
+ import { DialogProps } from "@kirana-ui/core/dialog";
1
3
  /**
2
4
  * `<kui-dialog>` around a `kui-part="trigger"` button and a `portal`, which is drawn at the
3
5
  * end of the page while the dialog is open and holds its `backdrop` and its `popup`, with a
4
- * `title`, a `description` and a `close` button. `open`, `default-open`, `modal`,
5
- * `dismissible`; it tells `open-change`.
6
+ * `title`, a `description` and a `close` button. A long dialog's popup is in a `viewport`,
7
+ * which scrolls. `open`, `default-open`, `modal`, `dismissible`; it tells `open-change`.
6
8
  */
7
- export declare const tag: string;
9
+ export declare const tag: Tag<{
10
+ id: string;
11
+ }, import("@kirana-ui/core/dialog").Dialog>;
12
+ declare global {
13
+ interface HTMLElementTagNameMap {
14
+ "kui-dialog": ElementOf<As<typeof tag, DialogProps>, {
15
+ "open-change": ["onOpenChange", "open"];
16
+ }>;
17
+ }
18
+ }
8
19
  //# sourceMappingURL=dialog.d.ts.map
package/src/dialog.js CHANGED
@@ -4,8 +4,8 @@ import { createDialog } from "@kirana-ui/core/dialog";
4
4
  /**
5
5
  * `<kui-dialog>` around a `kui-part="trigger"` button and a `portal`, which is drawn at the
6
6
  * end of the page while the dialog is open and holds its `backdrop` and its `popup`, with a
7
- * `title`, a `description` and a `close` button. `open`, `default-open`, `modal`,
8
- * `dismissible`; it tells `open-change`.
7
+ * `title`, a `description` and a `close` button. A long dialog's popup is in a `viewport`,
8
+ * which scrolls. `open`, `default-open`, `modal`, `dismissible`; it tells `open-change`.
9
9
  */
10
10
  const tag = defineElement({
11
11
  tag: "kui-dialog",
@@ -26,6 +26,10 @@ const tag = defineElement({
26
26
  mounted: controller.mounted,
27
27
  part: controller.backdrop
28
28
  }),
29
+ viewport: (controller) => ({
30
+ mounted: controller.mounted,
31
+ part: controller.viewport
32
+ }),
29
33
  popup: (controller) => ({
30
34
  mounted: controller.mounted,
31
35
  part: controller.popup
package/src/dialog.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","names":[],"sources":["../../../../packages/web/src/dialog.ts"],"sourcesContent":["import { createDialog } from \"@kirana-ui/core/dialog\"\n\nimport { defineElement } from \"./runtime.ts\"\n\n/**\n * `<kui-dialog>` around a `kui-part=\"trigger\"` button and a `portal`, which is drawn at the\n * end of the page while the dialog is open and holds its `backdrop` and its `popup`, with a\n * `title`, a `description` and a `close` button. `open`, `default-open`, `modal`,\n * `dismissible`; it tells `open-change`.\n */\nexport const tag = defineElement({\n tag: \"kui-dialog\",\n props: {\n open: \"boolean\",\n \"default-open\": \"boolean\",\n modal: \"boolean\",\n dismissible: \"boolean\",\n },\n create: (props) => createDialog(props),\n changes: { onOpenChange: { event: \"open-change\", prop: \"open\" } },\n parts: {\n trigger: (controller) => controller.trigger,\n backdrop: (controller) => ({ mounted: controller.mounted, part: controller.backdrop }),\n popup: (controller) => ({ mounted: controller.mounted, part: controller.popup }),\n title: (controller) => controller.title,\n description: (controller) => controller.description,\n close: (controller) => controller.close,\n },\n})\n"],"mappings":";;;;;;;;;AAUA,MAAa,MAAM,cAAc;CAC/B,KAAK;CACL,OAAO;EACL,MAAM;EACN,gBAAgB;EAChB,OAAO;EACP,aAAa;CACf;CACA,SAAS,UAAU,aAAa,KAAK;CACrC,SAAS,EAAE,cAAc;EAAE,OAAO;EAAe,MAAM;CAAO,EAAE;CAChE,OAAO;EACL,UAAU,eAAe,WAAW;EACpC,WAAW,gBAAgB;GAAE,SAAS,WAAW;GAAS,MAAM,WAAW;EAAS;EACpF,QAAQ,gBAAgB;GAAE,SAAS,WAAW;GAAS,MAAM,WAAW;EAAM;EAC9E,QAAQ,eAAe,WAAW;EAClC,cAAc,eAAe,WAAW;EACxC,QAAQ,eAAe,WAAW;CACpC;AACF,CAAC"}
1
+ {"version":3,"file":"dialog.js","names":[],"sources":["../../../../packages/web/src/dialog.ts"],"sourcesContent":["import { createDialog } from \"@kirana-ui/core/dialog\"\nimport type { DialogProps } from \"@kirana-ui/core/dialog\"\n\nimport { defineElement } from \"./runtime.ts\"\nimport type { As, ElementOf } from \"./runtime.ts\"\n\n/**\n * `<kui-dialog>` around a `kui-part=\"trigger\"` button and a `portal`, which is drawn at the\n * end of the page while the dialog is open and holds its `backdrop` and its `popup`, with a\n * `title`, a `description` and a `close` button. A long dialog's popup is in a `viewport`,\n * which scrolls. `open`, `default-open`, `modal`, `dismissible`; it tells `open-change`.\n */\nexport const tag = defineElement({\n tag: \"kui-dialog\",\n props: {\n open: \"boolean\",\n \"default-open\": \"boolean\",\n modal: \"boolean\",\n dismissible: \"boolean\",\n },\n create: (props) => createDialog(props),\n changes: { onOpenChange: { event: \"open-change\", prop: \"open\" } },\n parts: {\n trigger: (controller) => controller.trigger,\n backdrop: (controller) => ({ mounted: controller.mounted, part: controller.backdrop }),\n viewport: (controller) => ({ mounted: controller.mounted, part: controller.viewport }),\n popup: (controller) => ({ mounted: controller.mounted, part: controller.popup }),\n title: (controller) => controller.title,\n description: (controller) => controller.description,\n close: (controller) => controller.close,\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-dialog\": ElementOf<\n As<typeof tag, DialogProps>,\n { \"open-change\": [\"onOpenChange\", \"open\"] }\n >\n }\n}\n"],"mappings":";;;;;;;;;AAYA,MAAa,MAAM,cAAc;CAC/B,KAAK;CACL,OAAO;EACL,MAAM;EACN,gBAAgB;EAChB,OAAO;EACP,aAAa;CACf;CACA,SAAS,UAAU,aAAa,KAAK;CACrC,SAAS,EAAE,cAAc;EAAE,OAAO;EAAe,MAAM;CAAO,EAAE;CAChE,OAAO;EACL,UAAU,eAAe,WAAW;EACpC,WAAW,gBAAgB;GAAE,SAAS,WAAW;GAAS,MAAM,WAAW;EAAS;EACpF,WAAW,gBAAgB;GAAE,SAAS,WAAW;GAAS,MAAM,WAAW;EAAS;EACpF,QAAQ,gBAAgB;GAAE,SAAS,WAAW;GAAS,MAAM,WAAW;EAAM;EAC9E,QAAQ,eAAe,WAAW;EAClC,cAAc,eAAe,WAAW;EACxC,QAAQ,eAAe,WAAW;CACpC;AACF,CAAC"}