@kirana-ui/web 0.0.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/LICENSE +1 -1
  2. package/package.json +223 -6
  3. package/src/accordion.d.ts +8 -0
  4. package/src/accordion.js +67 -0
  5. package/src/accordion.js.map +1 -0
  6. package/src/alert-dialog.d.ts +6 -0
  7. package/src/alert-dialog.js +36 -0
  8. package/src/alert-dialog.js.map +1 -0
  9. package/src/around.d.ts +30 -0
  10. package/src/around.js +53 -0
  11. package/src/around.js.map +1 -0
  12. package/src/autocomplete.d.ts +8 -0
  13. package/src/autocomplete.js +42 -0
  14. package/src/autocomplete.js.map +1 -0
  15. package/src/autosize.d.ts +6 -0
  16. package/src/autosize.js +18 -0
  17. package/src/autosize.js.map +1 -0
  18. package/src/avatar.d.ts +7 -0
  19. package/src/avatar.js +38 -0
  20. package/src/avatar.js.map +1 -0
  21. package/src/button.d.ts +6 -0
  22. package/src/button.js +21 -0
  23. package/src/button.js.map +1 -0
  24. package/src/calendar.d.ts +12 -0
  25. package/src/calendar.js +60 -0
  26. package/src/calendar.js.map +1 -0
  27. package/src/carousel.d.ts +7 -0
  28. package/src/carousel.js +34 -0
  29. package/src/carousel.js.map +1 -0
  30. package/src/checkbox.d.ts +8 -0
  31. package/src/checkbox.js +42 -0
  32. package/src/checkbox.js.map +1 -0
  33. package/src/collapsible.d.ts +7 -0
  34. package/src/collapsible.js +32 -0
  35. package/src/collapsible.js.map +1 -0
  36. package/src/combobox.d.ts +27 -0
  37. package/src/combobox.js +125 -0
  38. package/src/combobox.js.map +1 -0
  39. package/src/command.d.ts +10 -0
  40. package/src/command.js +61 -0
  41. package/src/command.js.map +1 -0
  42. package/src/context-menu.d.ts +7 -0
  43. package/src/context-menu.js +11 -0
  44. package/src/context-menu.js.map +1 -0
  45. package/src/date-field.d.ts +9 -0
  46. package/src/date-field.js +41 -0
  47. package/src/date-field.js.map +1 -0
  48. package/src/date-picker.d.ts +11 -0
  49. package/src/date-picker.js +75 -0
  50. package/src/date-picker.js.map +1 -0
  51. package/src/dates.d.ts +19 -0
  52. package/src/dates.js +70 -0
  53. package/src/dates.js.map +1 -0
  54. package/src/dialog.d.ts +8 -0
  55. package/src/dialog.js +40 -0
  56. package/src/dialog.js.map +1 -0
  57. package/src/drawer.d.ts +8 -0
  58. package/src/drawer.js +62 -0
  59. package/src/drawer.js.map +1 -0
  60. package/src/field.d.ts +9 -0
  61. package/src/field.js +47 -0
  62. package/src/field.js.map +1 -0
  63. package/src/fieldset.d.ts +3 -0
  64. package/src/fieldset.js +17 -0
  65. package/src/fieldset.js.map +1 -0
  66. package/src/form.d.ts +7 -0
  67. package/src/form.js +30 -0
  68. package/src/form.js.map +1 -0
  69. package/src/hover-card.d.ts +7 -0
  70. package/src/hover-card.js +12 -0
  71. package/src/hover-card.js.map +1 -0
  72. package/src/hover-popup.d.ts +5 -0
  73. package/src/hover-popup.js +43 -0
  74. package/src/hover-popup.js.map +1 -0
  75. package/src/index.d.ts +5 -0
  76. package/src/index.js +49 -0
  77. package/src/input.d.ts +6 -0
  78. package/src/input.js +22 -0
  79. package/src/input.js.map +1 -0
  80. package/src/label.d.ts +3 -0
  81. package/src/label.js +15 -0
  82. package/src/label.js.map +1 -0
  83. package/src/listbox.d.ts +8 -0
  84. package/src/listbox.js +54 -0
  85. package/src/listbox.js.map +1 -0
  86. package/src/menu.d.ts +16 -0
  87. package/src/menu.js +139 -0
  88. package/src/menu.js.map +1 -0
  89. package/src/menubar.d.ts +7 -0
  90. package/src/menubar.js +22 -0
  91. package/src/menubar.js.map +1 -0
  92. package/src/message-scroller.d.ts +7 -0
  93. package/src/message-scroller.js +30 -0
  94. package/src/message-scroller.js.map +1 -0
  95. package/src/meter.d.ts +7 -0
  96. package/src/meter.js +40 -0
  97. package/src/meter.js.map +1 -0
  98. package/src/navigation-menu.d.ts +10 -0
  99. package/src/navigation-menu.js +77 -0
  100. package/src/navigation-menu.js.map +1 -0
  101. package/src/number-field.d.ts +9 -0
  102. package/src/number-field.js +57 -0
  103. package/src/number-field.js.map +1 -0
  104. package/src/otp.d.ts +9 -0
  105. package/src/otp.js +64 -0
  106. package/src/otp.js.map +1 -0
  107. package/src/pagination.d.ts +9 -0
  108. package/src/pagination.js +45 -0
  109. package/src/pagination.js.map +1 -0
  110. package/src/popover.d.ts +8 -0
  111. package/src/popover.js +39 -0
  112. package/src/popover.js.map +1 -0
  113. package/src/progress.d.ts +7 -0
  114. package/src/progress.js +40 -0
  115. package/src/progress.js.map +1 -0
  116. package/src/qr-code.d.ts +6 -0
  117. package/src/qr-code.js +24 -0
  118. package/src/qr-code.js.map +1 -0
  119. package/src/radio-group.d.ts +8 -0
  120. package/src/radio-group.js +40 -0
  121. package/src/radio-group.js.map +1 -0
  122. package/src/resizable.d.ts +7 -0
  123. package/src/resizable.js +38 -0
  124. package/src/resizable.js.map +1 -0
  125. package/src/runtime.d.ts +124 -0
  126. package/src/runtime.js +452 -0
  127. package/src/runtime.js.map +1 -0
  128. package/src/scroll-area.d.ts +7 -0
  129. package/src/scroll-area.js +35 -0
  130. package/src/scroll-area.js.map +1 -0
  131. package/src/select.d.ts +13 -0
  132. package/src/select.js +83 -0
  133. package/src/select.js.map +1 -0
  134. package/src/separator.d.ts +3 -0
  135. package/src/separator.js +14 -0
  136. package/src/separator.js.map +1 -0
  137. package/src/slider.d.ts +10 -0
  138. package/src/slider.js +71 -0
  139. package/src/slider.js.map +1 -0
  140. package/src/switch.d.ts +7 -0
  141. package/src/switch.js +37 -0
  142. package/src/switch.js.map +1 -0
  143. package/src/tabs.d.ts +7 -0
  144. package/src/tabs.js +31 -0
  145. package/src/tabs.js.map +1 -0
  146. package/src/toast.d.ts +17 -0
  147. package/src/toast.js +72 -0
  148. package/src/toast.js.map +1 -0
  149. package/src/toggle-group.d.ts +7 -0
  150. package/src/toggle-group.js +37 -0
  151. package/src/toggle-group.js.map +1 -0
  152. package/src/toggle.d.ts +7 -0
  153. package/src/toggle.js +32 -0
  154. package/src/toggle.js.map +1 -0
  155. package/src/toolbar.d.ts +8 -0
  156. package/src/toolbar.js +31 -0
  157. package/src/toolbar.js.map +1 -0
  158. package/src/tooltip.d.ts +7 -0
  159. package/src/tooltip.js +12 -0
  160. package/src/tooltip.js.map +1 -0
  161. package/README.md +0 -7
  162. package/index.js +0 -5
package/src/otp.js ADDED
@@ -0,0 +1,64 @@
1
+ import { defineElement, partAround } from "./runtime.js";
2
+ import { effect } from "@kirana-ui/core";
3
+ import { createOtp } from "@kirana-ui/core/otp";
4
+ // src/otp.ts
5
+ const indexOf = (element) => Number(element?.getAttribute("kui-index") ?? 0);
6
+ /**
7
+ * `<kui-otp>` around `kui-part="root"`, the one `input` that is typed in, and a `slot` for
8
+ * each character (`kui-index`, from 0), which says its character and may hold a `caret`, in
9
+ * the page while the next character goes there. Slots may be in `group`s with a `separator`
10
+ * between. `length`, `value`, `default-value`, `mode`, `disabled`, `name`, `form`; it tells
11
+ * `value-change` and `complete`.
12
+ */
13
+ const tag = defineElement({
14
+ tag: "kui-otp",
15
+ props: {
16
+ length: "number",
17
+ value: "string",
18
+ "default-value": "string",
19
+ mode: "string",
20
+ disabled: "boolean",
21
+ name: "string",
22
+ form: "string"
23
+ },
24
+ create: (props) => createOtp(props),
25
+ changes: {
26
+ onValueChange: {
27
+ event: "value-change",
28
+ prop: "value"
29
+ },
30
+ onComplete: {
31
+ event: "complete",
32
+ prop: "value",
33
+ hold: false
34
+ }
35
+ },
36
+ parts: {
37
+ root: (controller) => controller.root,
38
+ input: (controller) => controller.input,
39
+ group: (controller) => controller.group,
40
+ separator: (controller) => controller.separator,
41
+ slot(controller, element) {
42
+ const slot = controller.slot(indexOf(element));
43
+ return {
44
+ part: slot.part,
45
+ mount() {
46
+ const text = element.ownerDocument.createTextNode("");
47
+ element.prepend(text);
48
+ const stop = effect(() => void (text.data = slot.char.get()));
49
+ return () => {
50
+ stop();
51
+ text.remove();
52
+ };
53
+ }
54
+ };
55
+ },
56
+ caret: (controller, element) => ({
57
+ part: controller.caretPart,
58
+ mounted: controller.slot(indexOf(partAround(element, "slot"))).caret
59
+ })
60
+ }
61
+ });
62
+ export { tag };
63
+
64
+ //# sourceMappingURL=otp.js.map
package/src/otp.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otp.js","names":[],"sources":["../../../../packages/web/src/otp.ts"],"sourcesContent":["import { effect } from \"@kirana-ui/core\"\nimport { createOtp } from \"@kirana-ui/core/otp\"\nimport type { Otp, OtpProps } from \"@kirana-ui/core/otp\"\n\nimport { defineElement, partAround } from \"./runtime.ts\"\n\nconst indexOf = (element: HTMLElement | null) => Number(element?.getAttribute(\"kui-index\") ?? 0)\n\n/**\n * `<kui-otp>` around `kui-part=\"root\"`, the one `input` that is typed in, and a `slot` for\n * each character (`kui-index`, from 0), which says its character and may hold a `caret`, in\n * the page while the next character goes there. Slots may be in `group`s with a `separator`\n * between. `length`, `value`, `default-value`, `mode`, `disabled`, `name`, `form`; it tells\n * `value-change` and `complete`.\n */\nexport const tag = defineElement<OtpProps, Otp>({\n tag: \"kui-otp\",\n props: {\n length: \"number\",\n value: \"string\",\n \"default-value\": \"string\",\n mode: \"string\",\n disabled: \"boolean\",\n name: \"string\",\n form: \"string\",\n },\n create: (props) => createOtp(props),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onComplete: { event: \"complete\", prop: \"value\", hold: false },\n },\n parts: {\n root: (controller) => controller.root,\n input: (controller) => controller.input,\n group: (controller) => controller.group,\n separator: (controller) => controller.separator,\n slot(controller, element) {\n const slot = controller.slot(indexOf(element))\n return {\n part: slot.part,\n // Its character comes before what the page wrote in it: a caret.\n mount() {\n const text = element.ownerDocument.createTextNode(\"\")\n element.prepend(text)\n const stop = effect(() => void (text.data = slot.char.get()))\n return () => {\n stop()\n text.remove()\n }\n },\n }\n },\n caret: (controller, element) => ({\n part: controller.caretPart,\n mounted: controller.slot(indexOf(partAround(element, \"slot\"))).caret,\n }),\n },\n})\n"],"mappings":";;;;AAMA,MAAM,WAAW,YAAgC,OAAO,SAAS,aAAa,WAAW,KAAK,CAAC;;;;;;;;AAS/F,MAAa,MAAM,cAA6B;CAC9C,KAAK;CACL,OAAO;EACL,QAAQ;EACR,OAAO;EACP,iBAAiB;EACjB,MAAM;EACN,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,SAAS,UAAU,UAAU,KAAK;CAClC,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,YAAY;GAAE,OAAO;GAAY,MAAM;GAAS,MAAM;EAAM;CAC9D;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,eAAe,WAAW;EAClC,QAAQ,eAAe,WAAW;EAClC,YAAY,eAAe,WAAW;EACtC,KAAK,YAAY,SAAS;GACxB,MAAM,OAAO,WAAW,KAAK,QAAQ,OAAO,CAAC;GAC7C,OAAO;IACL,MAAM,KAAK;IAEX,QAAQ;KACN,MAAM,OAAO,QAAQ,cAAc,eAAe,EAAE;KACpD,QAAQ,QAAQ,IAAI;KACpB,MAAM,OAAO,aAAa,MAAM,KAAK,OAAO,KAAK,KAAK,IAAI,EAAE;KAC5D,aAAa;MACX,KAAK;MACL,KAAK,OAAO;KACd;IACF;GACF;EACF;EACA,QAAQ,YAAY,aAAa;GAC/B,MAAM,WAAW;GACjB,SAAS,WAAW,KAAK,QAAQ,WAAW,SAAS,MAAM,CAAC,CAAC,CAAC,CAAC;EACjE;CACF;AACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `<kui-pagination>` around a `kui-part="root"` nav with `previous` and `next` buttons and,
3
+ * between them, a `<template kui-each="items">` holding an `item` button for a page
4
+ * (`kui-when="page"`; `{page}` is its number) and an `ellipsis` for a gap
5
+ * (`kui-when="ellipsis"`; `{key}` is `start` or `end`). `page`, `default-page`, `count`,
6
+ * `page-size`, `sibling-count`, `boundary-count`, `disabled`; it tells `page-change`.
7
+ */
8
+ export declare const tag: string;
9
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1,45 @@
1
+ import { defineElement, entryAround } from "./runtime.js";
2
+ import { createPagination } from "@kirana-ui/core/pagination";
3
+ // src/pagination.ts
4
+ /**
5
+ * `<kui-pagination>` around a `kui-part="root"` nav with `previous` and `next` buttons and,
6
+ * between them, a `<template kui-each="items">` holding an `item` button for a page
7
+ * (`kui-when="page"`; `{page}` is its number) and an `ellipsis` for a gap
8
+ * (`kui-when="ellipsis"`; `{key}` is `start` or `end`). `page`, `default-page`, `count`,
9
+ * `page-size`, `sibling-count`, `boundary-count`, `disabled`; it tells `page-change`.
10
+ */
11
+ const tag = defineElement({
12
+ tag: "kui-pagination",
13
+ props: {
14
+ page: "number",
15
+ "default-page": "number",
16
+ count: "number",
17
+ "page-size": "number",
18
+ "sibling-count": "number",
19
+ "boundary-count": "number",
20
+ disabled: "boolean"
21
+ },
22
+ create: (props) => createPagination(props),
23
+ changes: { onPageChange: {
24
+ event: "page-change",
25
+ prop: "page"
26
+ } },
27
+ lists: { items: (controller) => ({
28
+ entries: controller.entries,
29
+ key: (entry) => entry.key,
30
+ type: (entry) => entry.type
31
+ }) },
32
+ parts: {
33
+ root: (controller) => controller.root,
34
+ previous: (controller) => controller.previous,
35
+ next: (controller) => controller.next,
36
+ ellipsis: (controller) => controller.ellipsis,
37
+ item(controller, element) {
38
+ const entry = entryAround(element);
39
+ return entry?.type === "page" ? controller.item(entry.page) : void 0;
40
+ }
41
+ }
42
+ });
43
+ export { tag };
44
+
45
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","names":[],"sources":["../../../../packages/web/src/pagination.ts"],"sourcesContent":["import { createPagination } from \"@kirana-ui/core/pagination\"\nimport type { Pagination, PaginationEntry, PaginationProps } from \"@kirana-ui/core/pagination\"\n\nimport { defineElement, entryAround } from \"./runtime.ts\"\n\n/**\n * `<kui-pagination>` around a `kui-part=\"root\"` nav with `previous` and `next` buttons and,\n * between them, a `<template kui-each=\"items\">` holding an `item` button for a page\n * (`kui-when=\"page\"`; `{page}` is its number) and an `ellipsis` for a gap\n * (`kui-when=\"ellipsis\"`; `{key}` is `start` or `end`). `page`, `default-page`, `count`,\n * `page-size`, `sibling-count`, `boundary-count`, `disabled`; it tells `page-change`.\n */\nexport const tag = defineElement<PaginationProps, Pagination>({\n tag: \"kui-pagination\",\n props: {\n page: \"number\",\n \"default-page\": \"number\",\n count: \"number\",\n \"page-size\": \"number\",\n \"sibling-count\": \"number\",\n \"boundary-count\": \"number\",\n disabled: \"boolean\",\n },\n create: (props) => createPagination(props),\n changes: { onPageChange: { event: \"page-change\", prop: \"page\" } },\n lists: {\n items: (controller) => ({\n entries: controller.entries,\n key: (entry: PaginationEntry) => entry.key,\n type: (entry: PaginationEntry) => entry.type,\n }),\n },\n parts: {\n root: (controller) => controller.root,\n previous: (controller) => controller.previous,\n next: (controller) => controller.next,\n ellipsis: (controller) => controller.ellipsis,\n item(controller, element) {\n const entry = entryAround<PaginationEntry>(element)\n return entry?.type === \"page\" ? controller.item(entry.page) : undefined\n },\n },\n})\n"],"mappings":";;;;;;;;;;AAYA,MAAa,MAAM,cAA2C;CAC5D,KAAK;CACL,OAAO;EACL,MAAM;EACN,gBAAgB;EAChB,OAAO;EACP,aAAa;EACb,iBAAiB;EACjB,kBAAkB;EAClB,UAAU;CACZ;CACA,SAAS,UAAU,iBAAiB,KAAK;CACzC,SAAS,EAAE,cAAc;EAAE,OAAO;EAAe,MAAM;CAAO,EAAE;CAChE,OAAO,EACL,QAAQ,gBAAgB;EACtB,SAAS,WAAW;EACpB,MAAM,UAA2B,MAAM;EACvC,OAAO,UAA2B,MAAM;CAC1C,GACF;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,WAAW,eAAe,WAAW;EACrC,OAAO,eAAe,WAAW;EACjC,WAAW,eAAe,WAAW;EACrC,KAAK,YAAY,SAAS;GACxB,MAAM,QAAQ,YAA6B,OAAO;GAClD,OAAO,OAAO,SAAS,SAAS,WAAW,KAAK,MAAM,IAAI,IAAI,KAAA;EAChE;CACF;AACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * `<kui-popover>` around a `kui-part="trigger"` button and a `portal`, drawn at the end of the
3
+ * page while it is open, with a `positioner` (`kui-side`, `kui-align`, `kui-side-offset`,
4
+ * `kui-align-offset`, `kui-collision-padding`) around the `popup`, which may hold a `title`,
5
+ * a `description` and a `close` button. `open`, `default-open`; it tells `open-change`.
6
+ */
7
+ export declare const tag: string;
8
+ //# sourceMappingURL=popover.d.ts.map
package/src/popover.js ADDED
@@ -0,0 +1,39 @@
1
+ import { place } from "./around.js";
2
+ import { defineElement } from "./runtime.js";
3
+ import { createPopover } from "@kirana-ui/core/popover";
4
+ // src/popover.ts
5
+ /**
6
+ * `<kui-popover>` around a `kui-part="trigger"` button and a `portal`, drawn at the end of the
7
+ * page while it is open, with a `positioner` (`kui-side`, `kui-align`, `kui-side-offset`,
8
+ * `kui-align-offset`, `kui-collision-padding`) around the `popup`, which may hold a `title`,
9
+ * a `description` and a `close` button. `open`, `default-open`; it tells `open-change`.
10
+ */
11
+ const tag = defineElement({
12
+ tag: "kui-popover",
13
+ props: {
14
+ open: "boolean",
15
+ "default-open": "boolean"
16
+ },
17
+ create: (props) => createPopover(props),
18
+ changes: { onOpenChange: {
19
+ event: "open-change",
20
+ prop: "open"
21
+ } },
22
+ parts: {
23
+ trigger: (controller) => controller.trigger,
24
+ positioner(controller, element) {
25
+ place(controller.positioning, element);
26
+ return {
27
+ mounted: controller.mounted,
28
+ part: controller.positioner
29
+ };
30
+ },
31
+ popup: (controller) => controller.popup,
32
+ title: (controller) => controller.title,
33
+ description: (controller) => controller.description,
34
+ close: (controller) => controller.close
35
+ }
36
+ });
37
+ export { tag };
38
+
39
+ //# sourceMappingURL=popover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover.js","names":[],"sources":["../../../../packages/web/src/popover.ts"],"sourcesContent":["import { createPopover } from \"@kirana-ui/core/popover\"\n\nimport { place } from \"./around.ts\"\nimport { defineElement } from \"./runtime.ts\"\n\n/**\n * `<kui-popover>` around a `kui-part=\"trigger\"` button and a `portal`, drawn at the end of the\n * page while it is open, with a `positioner` (`kui-side`, `kui-align`, `kui-side-offset`,\n * `kui-align-offset`, `kui-collision-padding`) around the `popup`, which may hold a `title`,\n * a `description` and a `close` button. `open`, `default-open`; it tells `open-change`.\n */\nexport const tag = defineElement({\n tag: \"kui-popover\",\n props: { open: \"boolean\", \"default-open\": \"boolean\" },\n create: (props) => createPopover(props),\n changes: { onOpenChange: { event: \"open-change\", prop: \"open\" } },\n parts: {\n trigger: (controller) => controller.trigger,\n positioner(controller, element) {\n place(controller.positioning, element)\n return { mounted: controller.mounted, part: controller.positioner }\n },\n popup: (controller) => controller.popup,\n title: (controller) => controller.title,\n description: (controller) => controller.description,\n close: (controller) => controller.close,\n },\n})\n"],"mappings":";;;;;;;;;;AAWA,MAAa,MAAM,cAAc;CAC/B,KAAK;CACL,OAAO;EAAE,MAAM;EAAW,gBAAgB;CAAU;CACpD,SAAS,UAAU,cAAc,KAAK;CACtC,SAAS,EAAE,cAAc;EAAE,OAAO;EAAe,MAAM;CAAO,EAAE;CAChE,OAAO;EACL,UAAU,eAAe,WAAW;EACpC,WAAW,YAAY,SAAS;GAC9B,MAAM,WAAW,aAAa,OAAO;GACrC,OAAO;IAAE,SAAS,WAAW;IAAS,MAAM,WAAW;GAAW;EACpE;EACA,QAAQ,eAAe,WAAW;EAClC,QAAQ,eAAe,WAAW;EAClC,cAAc,eAAe,WAAW;EACxC,QAAQ,eAAe,WAAW;CACpC;AACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `<kui-progress>` around `kui-part="root"`, a `label`, a `track` with its `indicator`, and a
3
+ * `value`, which says the value as it is written unless the page gave it something to say.
4
+ * `value` (left out: not known yet), `min`, `max`, `locale`; `format` and `getAriaValueText` as properties.
5
+ */
6
+ export declare const tag: string;
7
+ //# sourceMappingURL=progress.d.ts.map
@@ -0,0 +1,40 @@
1
+ import { defineElement } from "./runtime.js";
2
+ import { computed } from "@kirana-ui/core";
3
+ import { createProgress } from "@kirana-ui/core/progress";
4
+ // src/progress.ts
5
+ /**
6
+ * `<kui-progress>` around `kui-part="root"`, a `label`, a `track` with its `indicator`, and a
7
+ * `value`, which says the value as it is written unless the page gave it something to say.
8
+ * `value` (left out: not known yet), `min`, `max`, `locale`; `format` and `getAriaValueText` as properties.
9
+ */
10
+ const tag = defineElement({
11
+ tag: "kui-progress",
12
+ props: {
13
+ value: "number",
14
+ min: "number",
15
+ max: "number",
16
+ locale: "string"
17
+ },
18
+ properties: ["format", "getAriaValueText"],
19
+ create: (props) => createProgress(computed(() => {
20
+ const own = props.get();
21
+ return {
22
+ ...own,
23
+ value: own.value ?? null
24
+ };
25
+ })),
26
+ changes: {},
27
+ parts: {
28
+ root: (controller) => controller.root,
29
+ label: (controller) => controller.label,
30
+ track: (controller) => controller.track,
31
+ indicator: (controller) => controller.indicator,
32
+ value: (controller) => ({
33
+ part: controller.value,
34
+ text: controller.text
35
+ })
36
+ }
37
+ });
38
+ export { tag };
39
+
40
+ //# sourceMappingURL=progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress.js","names":[],"sources":["../../../../packages/web/src/progress.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createProgress } from \"@kirana-ui/core/progress\"\n\nimport { defineElement } from \"./runtime.ts\"\n\n/**\n * `<kui-progress>` around `kui-part=\"root\"`, a `label`, a `track` with its `indicator`, and a\n * `value`, which says the value as it is written unless the page gave it something to say.\n * `value` (left out: not known yet), `min`, `max`, `locale`; `format` and `getAriaValueText` as properties.\n */\nexport const tag = defineElement({\n tag: \"kui-progress\",\n props: { value: \"number\", min: \"number\", max: \"number\", locale: \"string\" },\n properties: [\"format\", \"getAriaValueText\"],\n create: (props) =>\n createProgress(\n computed(() => {\n const own = props.get() as { id: string; value?: number | null }\n return { ...own, value: own.value ?? null }\n }) as never\n ),\n changes: {},\n parts: {\n root: (controller) => controller.root,\n label: (controller) => controller.label,\n track: (controller) => controller.track,\n indicator: (controller) => controller.indicator,\n value: (controller) => ({ part: controller.value, text: controller.text }),\n },\n})\n"],"mappings":";;;;;;;;;AAUA,MAAa,MAAM,cAAc;CAC/B,KAAK;CACL,OAAO;EAAE,OAAO;EAAU,KAAK;EAAU,KAAK;EAAU,QAAQ;CAAS;CACzE,YAAY,CAAC,UAAU,kBAAkB;CACzC,SAAS,UACP,eACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GAAE,GAAG;GAAK,OAAO,IAAI,SAAS;EAAK;CAC5C,CAAC,CACH;CACF,SAAS,CAAC;CACV,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,eAAe,WAAW;EAClC,QAAQ,eAAe,WAAW;EAClC,YAAY,eAAe,WAAW;EACtC,QAAQ,gBAAgB;GAAE,MAAM,WAAW;GAAO,MAAM,WAAW;EAAK;CAC1E;AACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `<kui-qr-code>` around `kui-part="root"`, a `frame` (an `<svg>`) and its `pattern` (a
3
+ * `<path>`). `value`, `correction`.
4
+ */
5
+ export declare const tag: string;
6
+ //# sourceMappingURL=qr-code.d.ts.map
package/src/qr-code.js ADDED
@@ -0,0 +1,24 @@
1
+ import { defineElement } from "./runtime.js";
2
+ import { createQrCode } from "@kirana-ui/core/qr-code";
3
+ // src/qr-code.ts
4
+ /**
5
+ * `<kui-qr-code>` around `kui-part="root"`, a `frame` (an `<svg>`) and its `pattern` (a
6
+ * `<path>`). `value`, `correction`.
7
+ */
8
+ const tag = defineElement({
9
+ tag: "kui-qr-code",
10
+ props: {
11
+ value: "string",
12
+ correction: "string"
13
+ },
14
+ create: (props) => createQrCode(props),
15
+ changes: {},
16
+ parts: {
17
+ root: (controller) => controller.root,
18
+ frame: (controller) => controller.frame,
19
+ pattern: (controller) => controller.pattern
20
+ }
21
+ });
22
+ export { tag };
23
+
24
+ //# sourceMappingURL=qr-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qr-code.js","names":[],"sources":["../../../../packages/web/src/qr-code.ts"],"sourcesContent":["import { createQrCode } from \"@kirana-ui/core/qr-code\"\nimport type { QrCode, QrCodeProps } from \"@kirana-ui/core/qr-code\"\n\nimport { defineElement } from \"./runtime.ts\"\n\n/**\n * `<kui-qr-code>` around `kui-part=\"root\"`, a `frame` (an `<svg>`) and its `pattern` (a\n * `<path>`). `value`, `correction`.\n */\nexport const tag = defineElement<QrCodeProps, QrCode>({\n tag: \"kui-qr-code\",\n props: { value: \"string\", correction: \"string\" },\n create: (props) => createQrCode(props),\n changes: {},\n parts: {\n root: (controller) => controller.root,\n frame: (controller) => controller.frame,\n pattern: (controller) => controller.pattern,\n },\n})\n"],"mappings":";;;;;;;AASA,MAAa,MAAM,cAAmC;CACpD,KAAK;CACL,OAAO;EAAE,OAAO;EAAU,YAAY;CAAS;CAC/C,SAAS,UAAU,aAAa,KAAK;CACrC,SAAS,CAAC;CACV,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,eAAe,WAAW;EAClC,UAAU,eAAe,WAAW;CACtC;AACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * `<kui-radio-group>` around `kui-part="root"` and an `item` button for each `value`, with an
3
+ * `indicator` inside that is in the page while its item is the chosen one. An item draws the
4
+ * hidden native radio a form and a label reach. `value`, `default-value`, `disabled`,
5
+ * `read-only`, `required`, `name`, `form`; it tells `value-change`.
6
+ */
7
+ export declare const tag: string;
8
+ //# sourceMappingURL=radio-group.d.ts.map
@@ -0,0 +1,40 @@
1
+ import { fieldAround } from "./around.js";
2
+ import { defineElement, partAround } from "./runtime.js";
3
+ import { createRadioGroup } from "@kirana-ui/core/radio-group";
4
+ // src/radio-group.ts
5
+ const valueOf = (element) => partAround(element, "item")?.getAttribute("kui-value") ?? "";
6
+ const options = (element) => () => partAround(element, "item")?.hasAttribute("kui-disabled") ? { disabled: true } : {};
7
+ /**
8
+ * `<kui-radio-group>` around `kui-part="root"` and an `item` button for each `value`, with an
9
+ * `indicator` inside that is in the page while its item is the chosen one. An item draws the
10
+ * hidden native radio a form and a label reach. `value`, `default-value`, `disabled`,
11
+ * `read-only`, `required`, `name`, `form`; it tells `value-change`.
12
+ */
13
+ const tag = defineElement({
14
+ tag: "kui-radio-group",
15
+ props: {
16
+ value: "string",
17
+ "default-value": "string",
18
+ disabled: "boolean",
19
+ "read-only": "boolean",
20
+ required: "boolean",
21
+ name: "string",
22
+ form: "string"
23
+ },
24
+ create: (props, host) => createRadioGroup(props, { field: fieldAround(host) }),
25
+ changes: { onValueChange: {
26
+ event: "value-change",
27
+ prop: "value"
28
+ } },
29
+ parts: {
30
+ root: (controller) => controller.root,
31
+ item: (controller, element) => ({
32
+ part: controller.item(valueOf(element), options(element)),
33
+ inner: controller.itemInput(valueOf(element), options(element))
34
+ }),
35
+ indicator: (controller, element) => controller.indicator(valueOf(element))
36
+ }
37
+ });
38
+ export { tag };
39
+
40
+ //# sourceMappingURL=radio-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.js","names":[],"sources":["../../../../packages/web/src/radio-group.ts"],"sourcesContent":["import { createRadioGroup } from \"@kirana-ui/core/radio-group\"\nimport type { RadioGroupProps } from \"@kirana-ui/core/radio-group\"\n\nimport { fieldAround } from \"./around.ts\"\nimport { defineElement, partAround } from \"./runtime.ts\"\n\nconst valueOf = (element: HTMLElement) =>\n partAround(element, \"item\")?.getAttribute(\"kui-value\") ?? \"\"\nconst options = (element: HTMLElement) => () =>\n partAround(element, \"item\")?.hasAttribute(\"kui-disabled\") ? { disabled: true } : {}\n\n/**\n * `<kui-radio-group>` around `kui-part=\"root\"` and an `item` button for each `value`, with an\n * `indicator` inside that is in the page while its item is the chosen one. An item draws the\n * hidden native radio a form and a label reach. `value`, `default-value`, `disabled`,\n * `read-only`, `required`, `name`, `form`; it tells `value-change`.\n */\nexport const tag = defineElement<\n RadioGroupProps<string>,\n ReturnType<typeof createRadioGroup<string>>\n>({\n tag: \"kui-radio-group\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n name: \"string\",\n form: \"string\",\n },\n create: (props, host) => createRadioGroup<string>(props, { field: fieldAround(host) }),\n changes: { onValueChange: { event: \"value-change\", prop: \"value\" } },\n parts: {\n root: (controller) => controller.root,\n item: (controller, element) => ({\n part: controller.item(valueOf(element), options(element)),\n inner: controller.itemInput(valueOf(element), options(element)),\n }),\n indicator: (controller, element) => controller.indicator(valueOf(element)),\n },\n})\n"],"mappings":";;;;AAMA,MAAM,WAAW,YACf,WAAW,SAAS,MAAM,CAAC,EAAE,aAAa,WAAW,KAAK;AAC5D,MAAM,WAAW,kBACf,WAAW,SAAS,MAAM,CAAC,EAAE,aAAa,cAAc,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;;;;;;;AAQpF,MAAa,MAAM,cAGjB;CACA,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,SAAS,OAAO,SAAS,iBAAyB,OAAO,EAAE,OAAO,YAAY,IAAI,EAAE,CAAC;CACrF,SAAS,EAAE,eAAe;EAAE,OAAO;EAAgB,MAAM;CAAQ,EAAE;CACnE,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,OAAO,YAAY,aAAa;GAC9B,MAAM,WAAW,KAAK,QAAQ,OAAO,GAAG,QAAQ,OAAO,CAAC;GACxD,OAAO,WAAW,UAAU,QAAQ,OAAO,GAAG,QAAQ,OAAO,CAAC;EAChE;EACA,YAAY,YAAY,YAAY,WAAW,UAAU,QAAQ,OAAO,CAAC;CAC3E;AACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `<kui-resizable>` around `kui-part="group"`, its `panel`s (`kui-default-size`,
3
+ * `kui-min-size`, `kui-max-size`, in shares of a hundred) and a `handle` between two
4
+ * (`kui-disabled`). `orientation`, `keyboard-step`, `disabled`; it tells `sizes-change`.
5
+ */
6
+ export declare const tag: string;
7
+ //# sourceMappingURL=resizable.d.ts.map
@@ -0,0 +1,38 @@
1
+ import { defineElement } from "./runtime.js";
2
+ import { createResizable } from "@kirana-ui/core/resizable";
3
+ // src/resizable.ts
4
+ const number = (element, name) => {
5
+ const text = element.getAttribute(name);
6
+ return text === null ? {} : { [name.slice(4).replace(/-./g, (at) => at[1].toUpperCase())]: +text };
7
+ };
8
+ /**
9
+ * `<kui-resizable>` around `kui-part="group"`, its `panel`s (`kui-default-size`,
10
+ * `kui-min-size`, `kui-max-size`, in shares of a hundred) and a `handle` between two
11
+ * (`kui-disabled`). `orientation`, `keyboard-step`, `disabled`; it tells `sizes-change`.
12
+ */
13
+ const tag = defineElement({
14
+ tag: "kui-resizable",
15
+ props: {
16
+ orientation: "string",
17
+ "keyboard-step": "number",
18
+ disabled: "boolean"
19
+ },
20
+ create: (props) => createResizable(props),
21
+ changes: { onSizesChange: {
22
+ event: "sizes-change",
23
+ prop: "sizes",
24
+ hold: false
25
+ } },
26
+ parts: {
27
+ group: (controller) => controller.group,
28
+ panel: (controller, element) => controller.panel(() => ({
29
+ ...number(element, "kui-default-size"),
30
+ ...number(element, "kui-min-size"),
31
+ ...number(element, "kui-max-size")
32
+ })),
33
+ handle: (controller, element) => controller.handle(() => element.hasAttribute("kui-disabled") ? { disabled: true } : {})
34
+ }
35
+ });
36
+ export { tag };
37
+
38
+ //# sourceMappingURL=resizable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizable.js","names":[],"sources":["../../../../packages/web/src/resizable.ts"],"sourcesContent":["import { createResizable } from \"@kirana-ui/core/resizable\"\nimport type { Resizable, ResizableProps } from \"@kirana-ui/core/resizable\"\n\nimport { defineElement } from \"./runtime.ts\"\n\nconst number = (element: HTMLElement, name: string) => {\n const text = element.getAttribute(name)\n return text === null\n ? {}\n : { [name.slice(4).replace(/-./g, (at) => at[1]!.toUpperCase())]: +text }\n}\n\n/**\n * `<kui-resizable>` around `kui-part=\"group\"`, its `panel`s (`kui-default-size`,\n * `kui-min-size`, `kui-max-size`, in shares of a hundred) and a `handle` between two\n * (`kui-disabled`). `orientation`, `keyboard-step`, `disabled`; it tells `sizes-change`.\n */\nexport const tag = defineElement<ResizableProps, Resizable>({\n tag: \"kui-resizable\",\n props: { orientation: \"string\", \"keyboard-step\": \"number\", disabled: \"boolean\" },\n create: (props) => createResizable(props),\n changes: { onSizesChange: { event: \"sizes-change\", prop: \"sizes\", hold: false } },\n parts: {\n group: (controller) => controller.group,\n panel: (controller, element) =>\n controller.panel(() => ({\n ...number(element, \"kui-default-size\"),\n ...number(element, \"kui-min-size\"),\n ...number(element, \"kui-max-size\"),\n })),\n handle: (controller, element) =>\n controller.handle(() => (element.hasAttribute(\"kui-disabled\") ? { disabled: true } : {})),\n },\n})\n"],"mappings":";;;AAKA,MAAM,UAAU,SAAsB,SAAiB;CACrD,MAAM,OAAO,QAAQ,aAAa,IAAI;CACtC,OAAO,SAAS,OACZ,CAAC,IACD,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,QAAQ,OAAO,GAAG,EAAE,CAAE,YAAY,CAAC,IAAI,CAAC,KAAK;AAC5E;;;;;;AAOA,MAAa,MAAM,cAAyC;CAC1D,KAAK;CACL,OAAO;EAAE,aAAa;EAAU,iBAAiB;EAAU,UAAU;CAAU;CAC/E,SAAS,UAAU,gBAAgB,KAAK;CACxC,SAAS,EAAE,eAAe;EAAE,OAAO;EAAgB,MAAM;EAAS,MAAM;CAAM,EAAE;CAChF,OAAO;EACL,QAAQ,eAAe,WAAW;EAClC,QAAQ,YAAY,YAClB,WAAW,aAAa;GACtB,GAAG,OAAO,SAAS,kBAAkB;GACrC,GAAG,OAAO,SAAS,cAAc;GACjC,GAAG,OAAO,SAAS,cAAc;EACnC,EAAE;EACJ,SAAS,YAAY,YACnB,WAAW,aAAc,QAAQ,aAAa,cAAc,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC,CAAE;CAC5F;AACF,CAAC"}
@@ -0,0 +1,124 @@
1
+ import { Part, ReadonlySignal } from "@kirana-ui/core";
2
+ /**
3
+ * A component as a custom element, for a page with no framework.
4
+ *
5
+ * The custom element (`<kui-dialog>`) holds the component and draws nothing: it takes no room
6
+ * (`display: contents`) and no attribute of the component's. Its parts are the page's own
7
+ * elements, named by `kui-part` (`<button kui-part="trigger">`), the root among them. So a
8
+ * trigger is a real button and a switch a real button, and the page is the page the other
9
+ * adapters draw: nothing is wrapped, and there is no shadow root for a design to reach into.
10
+ *
11
+ * A part that is in the page only some of the time (a closed panel, a popup) is taken out of
12
+ * the page while it is not, and put back where it was; `kui-keep-mounted` keeps it.
13
+ */
14
+ /** What a part's name gives: the part, and what comes with it. */
15
+ export interface Drawn {
16
+ readonly part: Part;
17
+ /** In the page only while this holds. */
18
+ readonly mounted?: ReadonlySignal<boolean> | undefined;
19
+ /** Runs while the part is the component's. Returns the stop. */
20
+ mount?(): () => void;
21
+ /** A hidden native input the part draws itself, as its last child. */
22
+ readonly inner?: Part | undefined;
23
+ /**
24
+ * Where the part is drawn while it is mounted, when that is not where it was written: a
25
+ * navigation menu's content, in the menu's one viewport. Out of the page while there is none.
26
+ */
27
+ readonly into?: ReadonlySignal<HTMLElement | undefined> | undefined;
28
+ /** What the part's element says, when the page gave it nothing to say. */
29
+ readonly text?: ReadonlySignal<string | undefined> | undefined;
30
+ }
31
+ type Kind = "boolean" | "string" | "number";
32
+ /** A list a component draws from a `<template kui-each>`. */
33
+ export interface Each<Entry = any> {
34
+ readonly entries: ReadonlySignal<readonly Entry[]> | readonly Entry[];
35
+ /** What an entry is known by from one drawing to the next. */
36
+ key(entry: Entry): string | number;
37
+ /**
38
+ * Which of the template's elements an entry is drawn with, when they differ: the ones
39
+ * whose `kui-when` says so (a page, an ellipsis). Elements without `kui-when` are for all.
40
+ */
41
+ type?(entry: Entry): string;
42
+ /**
43
+ * What `{name}` stands for in the template's text and attributes
44
+ * (`data-testid="row-{id}"`). Left out: the entry's own fields.
45
+ */
46
+ values?(entry: Entry): Record<string, unknown>;
47
+ }
48
+ /** The entry an element was stamped for, or the nearest around it: a part reads its own. */
49
+ export declare function entryAround<Entry>(element: Node): Entry | undefined;
50
+ export interface ElementSpec<Props extends {
51
+ id: string;
52
+ }, Controller> {
53
+ /** The custom element's name: `kui-dialog`. */
54
+ tag: string;
55
+ /** Its props by attribute name, each with how an attribute's text is read. */
56
+ props: Record<string, Kind>;
57
+ /** Props that are only properties: a function, an object. By their names as properties. */
58
+ properties?: readonly string[] | undefined;
59
+ /**
60
+ * What the component draws a list of, by name: a calendar's weeks, a toast for each
61
+ * message. The page writes one of an entry as a `<template kui-each="name">` where the
62
+ * list goes, and the element stamps it for each entry, keyed, so an entry that stays keeps
63
+ * its elements. `around` is the entry of the list this one is written in (a week, for its
64
+ * days).
65
+ */
66
+ lists?: Record<string, (controller: Controller, around: unknown) => Each | undefined>;
67
+ /**
68
+ * The hidden native input a form reads, for a component with no part to hold it: drawn as
69
+ * the element's last child, while `mounted` (a select with a name).
70
+ */
71
+ inner?(controller: Controller): {
72
+ part: Part;
73
+ mounted?: ReadonlySignal<boolean> | undefined;
74
+ };
75
+ /** `host` is the custom element: what is around it (a field, a group) is found from it. */
76
+ create(props: ReadonlySignal<Props>, host: HTMLElement): Controller;
77
+ /**
78
+ * Its change callbacks: the event each is told as, and the prop the element then holds
79
+ * (`open`). The event is cancelable: `preventDefault()` keeps the value as it was.
80
+ */
81
+ changes: Record<string, {
82
+ event: string;
83
+ prop: string;
84
+ hold?: boolean;
85
+ }>;
86
+ /** Each part by its `kui-part` name. */
87
+ parts: Record<string, (controller: Controller, element: HTMLElement) => Part | Drawn | undefined>;
88
+ }
89
+ /**
90
+ * The controller of the component around a custom element: the field a control is in, the
91
+ * group a toggle is one of. Through a portal too: what was moved to the page's end is still
92
+ * inside what it was written in.
93
+ */
94
+ export declare function controllerAround<Controller>(host: Element, tag: string): Controller | undefined;
95
+ /** The nearest component around a custom element that is one of `tags`: which, and its controller. */
96
+ export declare function hostAround(host: Element, tags: readonly string[]): {
97
+ tag: string;
98
+ controller: unknown;
99
+ } | undefined;
100
+ /** The nearest element around `element` (or itself) that is the part called `name`. */
101
+ export declare function partAround(element: Element, name: string): HTMLElement | null;
102
+ /**
103
+ * The props of something inside a component that has props of its own (a menu's checkbox
104
+ * item, its radio group), read from its element's `kui-` attributes: `kui-checked`,
105
+ * `kui-default-value`. What it tells is told from that element, and may be refused; a value
106
+ * its element was given is held there, and one the page writes later is followed.
107
+ */
108
+ export declare function partProps<Props>(element: HTMLElement, kinds: Record<string, Kind>, changes: Record<string, {
109
+ event: string;
110
+ prop: string;
111
+ }>): {
112
+ props: ReadonlySignal<Props>;
113
+ mount(): () => void;
114
+ };
115
+ /**
116
+ * Defines a component's custom element, and gives its name (for
117
+ * `customElements.whenDefined`). Where there are no custom elements (a server) it defines
118
+ * nothing.
119
+ */
120
+ export declare function defineElement<Props extends {
121
+ id: string;
122
+ }, Controller extends object>(spec: ElementSpec<Props, Controller>): string;
123
+ export {};
124
+ //# sourceMappingURL=runtime.d.ts.map