@kirana-ui/web 0.2.0 → 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 (72) hide show
  1. package/llms.txt +248 -74
  2. package/package.json +6 -2
  3. package/skills/kirana-ui-primitives/SKILL.md +29 -8
  4. package/src/alert-dialog.d.ts +2 -2
  5. package/src/alert-dialog.js +6 -2
  6. package/src/alert-dialog.js.map +1 -1
  7. package/src/around.d.ts +21 -4
  8. package/src/around.js +34 -12
  9. package/src/around.js.map +1 -1
  10. package/src/autocomplete.d.ts +6 -3
  11. package/src/autocomplete.js +8 -4
  12. package/src/autocomplete.js.map +1 -1
  13. package/src/avatar.d.ts +11 -5
  14. package/src/avatar.js +39 -10
  15. package/src/avatar.js.map +1 -1
  16. package/src/calendar.d.ts +9 -5
  17. package/src/calendar.js +21 -9
  18. package/src/calendar.js.map +1 -1
  19. package/src/checkbox-group.d.ts +22 -0
  20. package/src/checkbox-group.js +36 -0
  21. package/src/checkbox-group.js.map +1 -0
  22. package/src/checkbox.d.ts +4 -2
  23. package/src/checkbox.js +10 -4
  24. package/src/checkbox.js.map +1 -1
  25. package/src/combobox.d.ts +17 -4
  26. package/src/combobox.js +43 -6
  27. package/src/combobox.js.map +1 -1
  28. package/src/command.d.ts +1 -1
  29. package/src/command.js +2 -1
  30. package/src/command.js.map +1 -1
  31. package/src/context-menu.d.ts +2 -1
  32. package/src/context-menu.js.map +1 -1
  33. package/src/date-picker.d.ts +7 -4
  34. package/src/date-picker.js +12 -3
  35. package/src/date-picker.js.map +1 -1
  36. package/src/dates.d.ts +5 -2
  37. package/src/dates.js +50 -15
  38. package/src/dates.js.map +1 -1
  39. package/src/dialog.d.ts +2 -2
  40. package/src/dialog.js +6 -2
  41. package/src/dialog.js.map +1 -1
  42. package/src/hover-card.d.ts +2 -1
  43. package/src/hover-card.js.map +1 -1
  44. package/src/index.d.ts +7 -3
  45. package/src/index.js +1 -0
  46. package/src/menu.d.ts +2 -1
  47. package/src/menu.js.map +1 -1
  48. package/src/navigation-menu.d.ts +2 -1
  49. package/src/navigation-menu.js.map +1 -1
  50. package/src/number-field.d.ts +5 -2
  51. package/src/number-field.js +23 -3
  52. package/src/number-field.js.map +1 -1
  53. package/src/otp.d.ts +1 -1
  54. package/src/otp.js +2 -1
  55. package/src/otp.js.map +1 -1
  56. package/src/popover.d.ts +8 -7
  57. package/src/popover.js +33 -5
  58. package/src/popover.js.map +1 -1
  59. package/src/radio-group.d.ts +2 -1
  60. package/src/radio-group.js +9 -2
  61. package/src/radio-group.js.map +1 -1
  62. package/src/runtime.d.ts +7 -2
  63. package/src/runtime.js +7 -4
  64. package/src/runtime.js.map +1 -1
  65. package/src/select.d.ts +3 -2
  66. package/src/select.js +2 -1
  67. package/src/select.js.map +1 -1
  68. package/src/slider.d.ts +2 -2
  69. package/src/slider.js +3 -2
  70. package/src/slider.js.map +1 -1
  71. package/src/tooltip.d.ts +2 -1
  72. package/src/tooltip.js.map +1 -1
@@ -3,11 +3,18 @@ import { defineElement, partAround } from "./runtime.js";
3
3
  import { createRadioGroup } from "@kirana-ui/core/radio-group";
4
4
  // src/radio-group.ts
5
5
  const valueOf = (element) => partAround(element, "item")?.getAttribute("kui-value") ?? "";
6
- const options = (element) => () => partAround(element, "item")?.hasAttribute("kui-disabled") ? { disabled: true } : {};
6
+ const options = (element) => () => {
7
+ const item = partAround(element, "item");
8
+ return {
9
+ disabled: item?.hasAttribute("kui-disabled") || void 0,
10
+ id: item?.getAttribute("kui-id") ?? void 0
11
+ };
12
+ };
7
13
  /**
8
14
  * `<kui-radio-group>` around `kui-part="root"` and an `item` button for each `value`, with an
9
15
  * `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`,
16
+ * hidden native radio a form and a label reach; an item's `kui-id` is that radio's id, which a
17
+ * `<label for>` names. `value`, `default-value`, `disabled`,
11
18
  * `read-only`, `required`, `name`, `form`; it tells `value-change`.
12
19
  */
13
20
  const tag = defineElement({
@@ -1 +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\"\nimport type { ElementOf } 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\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-radio-group\": ElementOf<typeof tag, { \"value-change\": [\"onValueChange\", \"value\"] }>\n }\n}\n"],"mappings":";;;;AAOA,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"}
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\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst valueOf = (element: HTMLElement) =>\n partAround(element, \"item\")?.getAttribute(\"kui-value\") ?? \"\"\nconst options = (element: HTMLElement) => () => {\n const item = partAround(element, \"item\")\n return {\n disabled: item?.hasAttribute(\"kui-disabled\") || undefined,\n // The id of the item's native radio: a `<label for>` names it.\n id: item?.getAttribute(\"kui-id\") ?? undefined,\n }\n}\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; an item's `kui-id` is that radio's id, which a\n * `<label for>` names. `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\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-radio-group\": ElementOf<typeof tag, { \"value-change\": [\"onValueChange\", \"value\"] }>\n }\n}\n"],"mappings":";;;;AAOA,MAAM,WAAW,YACf,WAAW,SAAS,MAAM,CAAC,EAAE,aAAa,WAAW,KAAK;AAC5D,MAAM,WAAW,kBAA+B;CAC9C,MAAM,OAAO,WAAW,SAAS,MAAM;CACvC,OAAO;EACL,UAAU,MAAM,aAAa,cAAc,KAAK,KAAA;EAEhD,IAAI,MAAM,aAAa,QAAQ,KAAK,KAAA;CACtC;AACF;;;;;;;;AASA,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"}
package/src/runtime.d.ts CHANGED
@@ -45,8 +45,11 @@ export interface Each<Entry = any> {
45
45
  */
46
46
  values?(entry: Entry): Record<string, unknown>;
47
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;
48
+ /**
49
+ * The entry an element was stamped for, or the nearest around it: a part reads its own. With
50
+ * `which`, the nearest that is of that list (a day's month, around its week).
51
+ */
52
+ export declare function entryAround<Entry>(element: Node, which?: (entry: unknown) => boolean): Entry | undefined;
50
53
  export interface ElementSpec<Props extends {
51
54
  id: string;
52
55
  }, Controller> {
@@ -119,6 +122,8 @@ interface Listens<Events> {
119
122
  export type ElementOf<Defined, Changes = {}, More = {}> = Defined extends Tag<infer Props, infer Controller> ? Listens<{ readonly [Event in keyof Changes]: Changes[Event] extends readonly [infer Name, infer Prop extends string] ? Told<Prop, Parameters<Callback<Props, Name>>[0]> : never; } & More> & { -readonly [Name in keyof Props as Name extends "id" | `on${Capitalize<string>}` ? never : Name]?: Props[Name]; } & {
120
123
  controller?: Controller;
121
124
  } & HTMLElement : never;
125
+ /** The component a part belongs to: the nearest around it, or the one that moved it to the page's end. */
126
+ export declare function ownerOf(element: Element): HTMLElement | null;
122
127
  /**
123
128
  * The controller of the component around a custom element: the field a control is in, the
124
129
  * group a toggle is one of. Through a portal too: what was moved to the page's end is still
package/src/runtime.js CHANGED
@@ -1,9 +1,12 @@
1
1
  import { bind, effect, sameProps, signal } from "@kirana-ui/core";
2
2
  // src/runtime.ts
3
3
  const ENTRY = /* @__PURE__ */ new WeakMap();
4
- /** The entry an element was stamped for, or the nearest around it: a part reads its own. */
5
- function entryAround(element) {
6
- for (let each = element; each; each = each.parentNode) if (ENTRY.has(each)) return ENTRY.get(each);
4
+ /**
5
+ * The entry an element was stamped for, or the nearest around it: a part reads its own. With
6
+ * `which`, the nearest that is of that list (a day's month, around its week).
7
+ */
8
+ function entryAround(element, which) {
9
+ for (let each = element; each; each = each.parentNode) if (ENTRY.has(each) && (!which || which(ENTRY.get(each)))) return ENTRY.get(each);
7
10
  }
8
11
  /** `{name}` in a text, for each name there is a value for; another brace is the page's own. */
9
12
  const fill = (text, values) => text.replace(/\{([A-Za-z_][\w-]*)\}/g, (whole, name) => name in values ? String(values[name] ?? "") : whole);
@@ -472,6 +475,6 @@ function defineElement(spec) {
472
475
  customElements.define(spec.tag, KuiElement);
473
476
  return spec.tag;
474
477
  }
475
- export { controllerAround, defineElement, entryAround, hostAround, partAround, partProps };
478
+ export { controllerAround, defineElement, entryAround, hostAround, ownerOf, partAround, partProps };
476
479
 
477
480
  //# sourceMappingURL=runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","names":[],"sources":["../../../../packages/web/src/runtime.ts"],"sourcesContent":["import { bind, effect, sameProps, signal } from \"@kirana-ui/core\"\nimport type { ChangeDetails, Part, ReadonlySignal, Signal } from \"@kirana-ui/core\"\n\n/**\n * A component as a custom element, for a page with no framework.\n *\n * The custom element (`<kui-dialog>`) holds the component and draws nothing: it takes no room\n * (`display: contents`) and no attribute of the component's. Its parts are the page's own\n * elements, named by `kui-part` (`<button kui-part=\"trigger\">`), the root among them. So a\n * trigger is a real button and a switch a real button, and the page is the page the other\n * adapters draw: nothing is wrapped, and there is no shadow root for a design to reach into.\n *\n * A part that is in the page only some of the time (a closed panel, a popup) is taken out of\n * the page while it is not, and put back where it was; `kui-keep-mounted` keeps it.\n */\n\n/** What a part's name gives: the part, and what comes with it. */\nexport interface Drawn {\n readonly part: Part\n /** In the page only while this holds. */\n readonly mounted?: ReadonlySignal<boolean> | undefined\n /** Runs while the part is the component's. Returns the stop. */\n mount?(): () => void\n /** A hidden native input the part draws itself, as its last child. */\n readonly inner?: Part | undefined\n /**\n * Where the part is drawn while it is mounted, when that is not where it was written: a\n * navigation menu's content, in the menu's one viewport. Out of the page while there is none.\n */\n readonly into?: ReadonlySignal<HTMLElement | undefined> | undefined\n /** What the part's element says, when the page gave it nothing to say. */\n readonly text?: ReadonlySignal<string | undefined> | undefined\n}\n\ntype Kind = \"boolean\" | \"string\" | \"number\"\n\n/** A list a component draws from a `<template kui-each>`. */\nexport interface Each<Entry = any> {\n readonly entries: ReadonlySignal<readonly Entry[]> | readonly Entry[]\n /** What an entry is known by from one drawing to the next. */\n key(entry: Entry): string | number\n /**\n * Which of the template's elements an entry is drawn with, when they differ: the ones\n * whose `kui-when` says so (a page, an ellipsis). Elements without `kui-when` are for all.\n */\n type?(entry: Entry): string\n /**\n * What `{name}` stands for in the template's text and attributes\n * (`data-testid=\"row-{id}\"`). Left out: the entry's own fields.\n */\n values?(entry: Entry): Record<string, unknown>\n}\n\nconst ENTRY = new WeakMap<Node, unknown>()\n\n/** The entry an element was stamped for, or the nearest around it: a part reads its own. */\nexport function entryAround<Entry>(element: Node): Entry | undefined {\n for (let each: Node | null = element; each; each = each.parentNode) {\n if (ENTRY.has(each)) return ENTRY.get(each) as Entry\n }\n return undefined\n}\n\n/** `{name}` in a text, for each name there is a value for; another brace is the page's own. */\nconst fill = (text: string, values: Record<string, unknown>) =>\n text.replace(/\\{([A-Za-z_][\\w-]*)\\}/g, (whole, name: string) =>\n name in values ? String(values[name] ?? \"\") : whole\n )\n\ninterface Row {\n entry: unknown\n nodes: ChildNode[]\n /** Where a `{name}` was written: read again when the entry changes. */\n written: (readonly [Attr | Text, string])[]\n}\n\nexport interface ElementSpec<Props extends { id: string }, Controller> {\n /** The custom element's name: `kui-dialog`. */\n tag: string\n /** Its props by attribute name, each with how an attribute's text is read. */\n props: Record<string, Kind>\n /** Props that are only properties: a function, an object. By their names as properties. */\n properties?: readonly string[] | undefined\n /**\n * What the component draws a list of, by name: a calendar's weeks, a toast for each\n * message. The page writes one of an entry as a `<template kui-each=\"name\">` where the\n * list goes, and the element stamps it for each entry, keyed, so an entry that stays keeps\n * its elements. `around` is the entry of the list this one is written in (a week, for its\n * days).\n */\n lists?: Record<string, (controller: Controller, around: unknown) => Each | undefined>\n /**\n * The hidden native input a form reads, for a component with no part to hold it: drawn as\n * the element's last child, while `mounted` (a select with a name).\n */\n inner?(controller: Controller): { part: Part; mounted?: ReadonlySignal<boolean> | undefined }\n /** `host` is the custom element: what is around it (a field, a group) is found from it. */\n create(props: ReadonlySignal<Props>, host: HTMLElement): Controller\n /**\n * Its change callbacks: the event each is told as, and the prop the element then holds\n * (`open`). The event is cancelable: `preventDefault()` keeps the value as it was.\n */\n changes: Record<string, { event: string; prop: string; hold?: boolean }>\n /** Each part by its `kui-part` name. */\n parts: Record<string, (controller: Controller, element: HTMLElement) => Part | Drawn | undefined>\n}\n\ndeclare const DEFINED: unique symbol\n\n/**\n * A custom element's name as `defineElement` gives it. For TypeScript it also says what the\n * element was defined from, which `ElementOf` reads back; in the page it is the name alone.\n */\nexport type Tag<Props = unknown, Controller = unknown> = string & {\n readonly [DEFINED]?: readonly [Props, Controller]\n}\n\n/**\n * What a component tells: an event whose `detail` holds the value under its prop's name\n * (`detail.open`, `detail.values`) and why it changed (`detail.details.reason`).\n * `preventDefault()` keeps the value as it was.\n */\nexport type Told<Prop extends string, Value> = CustomEvent<\n { readonly [Name in Prop]: Value } & { readonly details: ChangeDetails }\n>\n\n/** A tag with its props said, where `defineElement` was left to work them out. */\nexport type As<Defined, Props> =\n Defined extends Tag<unknown, infer Controller> ? Tag<Props, Controller> : never\n\ntype Callback<Props, Name> = Name extends keyof Props\n ? Extract<Props[Name], (...given: never[]) => unknown>\n : never\n\ninterface Listens<Events> {\n addEventListener<Type extends keyof Events>(\n type: Type,\n listener: (this: HTMLElement, event: Events[Type]) => void,\n options?: boolean | AddEventListenerOptions\n ): void\n removeEventListener<Type extends keyof Events>(\n type: Type,\n listener: (this: HTMLElement, event: Events[Type]) => void,\n options?: boolean | EventListenerOptions\n ): void\n}\n\n/**\n * A component's custom element as TypeScript knows it, from its `tag`: its props as properties\n * (`element.open = true`), its controller once it has begun, and its events with their\n * `detail`. `Changes` names each event with the callback it tells and the prop it holds\n * (`{ \"open-change\": [\"onOpenChange\", \"open\"] }`), as the element's `changes` do; `More` is\n * for events its parts tell from their own elements, which reach it too.\n */\nexport type ElementOf<Defined, Changes = {}, More = {}> =\n Defined extends Tag<infer Props, infer Controller>\n ? Listens<\n {\n readonly [Event in keyof Changes]: Changes[Event] extends readonly [\n infer Name,\n infer Prop extends string,\n ]\n ? Told<Prop, Parameters<Callback<Props, Name>>[0]>\n : never\n } & More\n > & {\n -readonly [\n Name in keyof Props as Name extends \"id\" | `on${Capitalize<string>}` ? never : Name\n ]?: Props[Name]\n } & { controller?: Controller } & HTMLElement\n : never\n\nconst camel = (name: string) =>\n name.replace(/-([a-z])/g, (_all, letter: string) => letter.toUpperCase())\nconst hosts = new Set<string>()\nconst OWNER = Symbol(\"kui-owner\")\nlet made = 0\n\ntype Owned = HTMLElement & { [OWNER]?: HTMLElement }\n\n/**\n * Whether an element is a component's: one that was defined, or a `kui-` one that is yet to\n * be (its entry is imported later). What is inside it is its own from the start, and not a\n * part of the component around it that happens to have a part of the same name.\n */\nconst ours = (element: Element) =>\n hosts.has(element.localName) || element.localName.startsWith(\"kui-\")\n\n/** The component a part belongs to: the nearest around it, or the one that moved it to the page's end. */\nfunction ownerOf(element: Element): HTMLElement | null {\n for (let each: Element | null = element.parentElement; each; each = each.parentElement) {\n if (ours(each)) return each as HTMLElement\n const moved = (each as Owned)[OWNER]\n if (moved) return moved\n }\n return null\n}\n\n/**\n * The controller of the component around a custom element: the field a control is in, the\n * group a toggle is one of. Through a portal too: what was moved to the page's end is still\n * inside what it was written in.\n */\nexport function controllerAround<Controller>(host: Element, tag: string): Controller | undefined {\n return hostAround(host, [tag])?.controller as Controller | undefined\n}\n\n/** The nearest component around a custom element that is one of `tags`: which, and its controller. */\nexport function hostAround(\n host: Element,\n tags: readonly string[]\n): { tag: string; controller: unknown } | undefined {\n for (let each: Element | null = ownerOf(host); each; each = ownerOf(each)) {\n if (tags.includes(each.localName))\n return { tag: each.localName, controller: (each as { controller?: unknown }).controller }\n }\n return undefined\n}\n\n/** The nearest element around `element` (or itself) that is the part called `name`. */\nexport function partAround(element: Element, name: string): HTMLElement | null {\n return element.closest<HTMLElement>(`[kui-part=\"${name}\"]`)\n}\n\n// Elements the page had drawn before their part gave them a style of its own.\nlet settling: HTMLElement[] | undefined\n\n/**\n * A page's markup is drawn before its components begin, so a part's style (a slider thumb's\n * place) reaches an element the browser has already styled, and a design's `transition` on it\n * would run as the page begins: each thumb gliding to where it was all along. A framework's\n * element has its style before it is first drawn; here what the first style started is ended\n * before the page is drawn again, once for all the parts of a pass.\n */\nfunction settle(element: HTMLElement): void {\n if (typeof element.getAnimations !== \"function\") return\n if (!settling) {\n const written: HTMLElement[] = (settling = [])\n queueMicrotask(() => {\n settling = undefined\n for (const each of written) {\n for (const animation of each.getAnimations()) {\n if (animation instanceof CSSTransition) animation.cancel()\n }\n }\n })\n }\n settling.push(element)\n}\n\n/**\n * Puts a part on an element, and takes it off whole: what the part wrote is gone with it. A\n * framework draws a new element each time a part comes back; here the same element is the\n * part again, and must not still say what it said before (`data-closed`, `aria-controls`).\n */\nfunction put(element: HTMLElement, part: Part, drawn = false): () => void {\n const before = new Map(Array.from(element.attributes, (each) => [each.name, each.value]))\n const unbind = bind(element, part)\n if (drawn && part.props.peek().style) settle(element)\n return () => {\n unbind()\n for (const { name } of Array.from(element.attributes)) {\n // Its classes are the page's own, whatever was added to them since.\n if (!before.has(name) && name !== \"class\") element.removeAttribute(name)\n }\n for (const [name, value] of before) {\n if (name !== \"class\" && element.getAttribute(name) !== value)\n element.setAttribute(name, value)\n }\n }\n}\n\n/**\n * The props of something inside a component that has props of its own (a menu's checkbox\n * item, its radio group), read from its element's `kui-` attributes: `kui-checked`,\n * `kui-default-value`. What it tells is told from that element, and may be refused; a value\n * its element was given is held there, and one the page writes later is followed.\n */\nexport function partProps<Props>(\n element: HTMLElement,\n kinds: Record<string, Kind>,\n changes: Record<string, { event: string; prop: string }>\n): { props: ReadonlySignal<Props>; mount(): () => void } {\n const attribute = (name: string) => `kui-${name}`\n const told: Record<string, unknown> = {}\n const all = () => {\n const next: Record<string, unknown> = { ...told }\n for (const [name, kind] of Object.entries(kinds)) {\n const text = element.getAttribute(attribute(name))\n if (text !== null) next[camel(name)] = read(kind, text)\n }\n return next as Props\n }\n const source = signal<Props>({} as Props, sameProps as (a: Props, b: Props) => boolean)\n for (const [callback, { event, prop }] of Object.entries(changes)) {\n told[callback] = (value: unknown, details?: ChangeDetails) => {\n const heard = new CustomEvent(event, {\n detail: { [prop]: value, details },\n bubbles: true,\n cancelable: true,\n })\n if (!element.dispatchEvent(heard)) return details?.cancel()\n const held = attribute(prop.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`))\n if (element.hasAttribute(held)) element.setAttribute(held, String(value))\n source.set(all())\n }\n }\n source.set(all())\n return {\n props: source,\n mount() {\n const observer = new MutationObserver(() => source.set(all()))\n observer.observe(element, {\n attributes: true,\n attributeFilter: Object.keys(kinds).map(attribute),\n })\n return () => observer.disconnect()\n },\n }\n}\n\nfunction read(kind: Kind, text: string | null): unknown {\n if (kind === \"boolean\") return text !== null && text !== \"false\"\n if (text === null) return undefined\n return kind === \"number\" ? Number(text) : text\n}\n\n// Components written inside one that has not begun: its element is not defined yet (its\n// entry is imported later), or it waits itself. They begin when it has.\nconst waiting = new Set<{ begin(): void }>()\n\n/** Whether a component around `element` has yet to begin: what is inside it reads it. */\nfunction early(element: Element): boolean {\n for (let each: Element | null = element.parentElement; each; each = each.parentElement) {\n // Moved to the page's end by a component that had begun: on from that one.\n const moved = (each as Owned)[OWNER]\n if (moved) return early(moved)\n if (ours(each) && !(each as { controller?: unknown }).controller) return true\n }\n return false\n}\n\n/** What can be a part: an element of the page, one of a drawing (`<svg>`, `<path>`) too. */\nconst drawable = (node: Node): node is HTMLElement => node instanceof Element\n\ninterface Held {\n stop(): void\n /** Taken out of the page by the component itself: still its part. */\n parked: boolean\n}\n\n/**\n * Defines a component's custom element, and gives its name (for\n * `customElements.whenDefined`). Where there are no custom elements (a server) it defines\n * nothing.\n */\nexport function defineElement<Props extends { id: string }, Controller extends object>(\n spec: ElementSpec<Props, Controller>\n): Tag<Props, Controller> {\n if (typeof customElements === \"undefined\" || customElements.get(spec.tag)) return spec.tag\n hosts.add(spec.tag)\n const names = Object.keys(spec.props)\n\n class KuiElement extends HTMLElement {\n static observedAttributes = names\n controller?: Controller\n #props?: Signal<Props> | undefined\n // Set as properties before the element was upgraded, or before it joined the page.\n #given: Record<string, unknown> = {}\n #held = new Map<HTMLElement, Held>()\n #stops: (() => void)[] = []\n #leaving = false\n // While the parts the page wrote are first taken: they were drawn before they were parts.\n #first = false\n #watch: (element: HTMLElement) => void = () => {}\n\n connectedCallback() {\n this.#leaving = false\n this.begin()\n }\n\n /** Begins, unless a component around it has not: then it waits for that one. */\n begin() {\n if (this.controller || !this.isConnected) return\n if (early(this)) return void waiting.add(this)\n waiting.delete(this)\n // It holds its parts and draws nothing: no box of its own between them and the page.\n if (!this.style.display) this.style.display = \"contents\"\n const initial: Record<string, unknown> = {\n id: this.getAttribute(\"kui-id\") || `kui-${++made}`,\n }\n for (const name of names) {\n const text = this.getAttribute(name)\n // An attribute that is not there says nothing: the component's own default holds.\n if (text !== null) initial[camel(name)] = read(spec.props[name]!, text)\n }\n Object.assign(initial, this.#given)\n for (const [callback, { event, prop, hold }] of Object.entries(spec.changes)) {\n initial[callback] = (value: unknown, details?: ChangeDetails) => {\n const told = new CustomEvent(event, {\n detail: { [prop]: value, details },\n bubbles: true,\n cancelable: true,\n })\n if (!this.dispatchEvent(told)) return details?.cancel()\n // A value that was given is held by the element from then on, as `<details open>`\n // holds its own: it follows what happens to it.\n if (hold !== false && this.given(prop) !== undefined) this.give(prop, value)\n }\n }\n this.#props = signal(initial as Props, sameProps as (a: Props, b: Props) => boolean)\n this.controller = spec.create(this.#props, this)\n const unmount = (this.controller as { mount?(): () => void }).mount?.()\n if (unmount) this.#stops.push(unmount)\n // Parts that come and go: a page that draws its rows later, a list that changes.\n const observer = new MutationObserver((records) => {\n for (const record of records) {\n for (const node of record.removedNodes) {\n if (drawable(node)) this.#release(node)\n }\n for (const node of record.addedNodes) if (drawable(node)) this.#scan(node)\n }\n })\n observer.observe(this, { childList: true, subtree: true })\n this.#watch = (element) => observer.observe(element, { childList: true, subtree: true })\n this.#stops.push(() => observer.disconnect())\n // A copy: a part that is not in the page yet is taken out as it is met.\n this.#first = true\n for (const each of Array.from(this.children)) if (drawable(each)) this.#scan(each)\n this.#first = false\n const inner = spec.inner?.(this.controller)\n if (inner) {\n const input = this.ownerDocument.createElement(\"input\")\n let unbind: (() => void) | undefined\n const drawn = effect(() => {\n const wanted = inner.mounted?.get() ?? true\n if (wanted && !unbind) {\n this.append(input)\n unbind = bind(input, inner.part)\n } else if (!wanted && unbind) {\n unbind()\n unbind = undefined\n input.remove()\n }\n })\n this.#stops.push(() => {\n drawn()\n unbind?.()\n input.remove()\n })\n }\n for (const each of Array.from(waiting)) each.begin()\n }\n\n disconnectedCallback() {\n // Moved, it comes straight back: only an element that has left is taken apart.\n this.#leaving = true\n queueMicrotask(() => {\n if (!this.#leaving || this.isConnected) return\n waiting.delete(this)\n for (const held of this.#held.values()) held.stop()\n this.#held.clear()\n for (const stop of this.#stops.splice(0).reverse()) stop()\n delete this.controller\n this.#props = undefined\n })\n }\n\n attributeChangedCallback(name: string, _before: string | null, text: string | null) {\n this.give(camel(name), read(spec.props[name]!, text))\n }\n\n /** A prop as it was last given: by an attribute, or as a property. */\n given(prop: string): unknown {\n return this.#props ? (this.#props.peek() as Record<string, unknown>)[prop] : this.#given[prop]\n }\n\n give(prop: string, value: unknown) {\n if (!this.#props) return void (this.#given[prop] = value)\n if (!Object.is((this.#props.peek() as Record<string, unknown>)[prop], value))\n this.#props.set({ ...this.#props.peek(), [prop]: value })\n }\n\n /** Takes the parts in a subtree, in the page's order: one that leaves takes its own with it. */\n #scan(element: HTMLElement) {\n if (!element.isConnected) return\n if (element instanceof HTMLTemplateElement) {\n if (element.hasAttribute(\"kui-each\") && ownerOf(element) === this) this.#each(element)\n return\n }\n if (element.hasAttribute(\"kui-part\")) this.#adopt(element)\n for (const each of Array.from(element.children)) if (drawable(each)) this.#scan(each)\n }\n\n /** Draws a list from its template: a copy for each entry, where the template was. */\n #each(template: HTMLTemplateElement) {\n const list = spec.lists?.[template.getAttribute(\"kui-each\")!]?.(\n this.controller!,\n entryAround(template)\n )\n if (!list) return\n // The template leaves the page for a mark: what is drawn is the page a framework draws.\n const mark = this.ownerDocument.createComment(\"\")\n if (ENTRY.has(template)) ENTRY.set(mark, ENTRY.get(template))\n template.replaceWith(mark)\n const rows = new Map<string | number, Row>()\n const stamp = (entry: unknown): Row => {\n const type = list.type?.(entry)\n const copy = template.content.cloneNode(true) as DocumentFragment\n for (const node of Array.from(copy.childNodes)) {\n const blank = node.nodeType === Node.TEXT_NODE && !node.textContent!.trim()\n const other =\n node instanceof Element &&\n node.hasAttribute(\"kui-when\") &&\n node.getAttribute(\"kui-when\") !== type\n if (blank || other || node.nodeType === Node.COMMENT_NODE) node.remove()\n }\n const written: (readonly [Attr | Text, string])[] = []\n const walker = this.ownerDocument.createTreeWalker(\n copy,\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT\n )\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n // A list written in this one is filled when it is drawn, for its own entries.\n if (node instanceof Text) {\n if (node.data.includes(\"{\")) written.push([node, node.data])\n } else if (!(node instanceof HTMLTemplateElement)) {\n for (const attribute of Array.from((node as Element).attributes))\n if (attribute.value.includes(\"{\")) written.push([attribute, attribute.value])\n }\n }\n const nodes = Array.from(copy.childNodes)\n for (const node of nodes) ENTRY.set(node, entry)\n return { entry, nodes, written }\n }\n const write = (row: Row) => {\n const values =\n list.values?.(row.entry) ?? (row.entry as Record<string, unknown> | undefined) ?? {}\n for (const [node, text] of row.written) {\n const next = fill(text, values)\n if (node instanceof Text) {\n if (node.data !== next) node.data = next\n } else if (node.value !== next) node.value = next\n }\n }\n const draw = () => {\n const { entries } = list\n const next = \"get\" in entries ? entries.get() : entries\n const parent = mark.parentNode\n if (!parent) return\n const kept = new Set<string | number>()\n const fresh: Row[] = []\n const ordered = next.map((entry) => {\n const key = list.key(entry)\n kept.add(key)\n let row = rows.get(key)\n if (!row) {\n rows.set(key, (row = stamp(entry)))\n fresh.push(row)\n write(row)\n } else if (row.entry !== entry) {\n row.entry = entry\n for (const node of row.nodes) ENTRY.set(node, entry)\n write(row)\n }\n return row\n })\n for (const [key, row] of rows) {\n if (kept.has(key)) continue\n rows.delete(key)\n for (const node of row.nodes) node.remove()\n }\n // From the end: a copy that is where it belongs is not moved, and keeps focus.\n let before: ChildNode = mark\n for (const row of ordered.reverse()) {\n for (const node of row.nodes.toReversed()) {\n if (node.nextSibling !== before || node.parentNode !== parent)\n parent.insertBefore(node, before)\n before = node\n }\n }\n for (const row of fresh) for (const node of row.nodes) if (drawable(node)) this.#scan(node)\n }\n const stop = effect(draw)\n this.#stops.push(() => {\n stop()\n for (const row of rows.values()) for (const node of row.nodes) node.remove()\n rows.clear()\n mark.replaceWith(template)\n })\n }\n\n #adopt(element: HTMLElement) {\n if (this.#held.has(element) || ownerOf(element) !== this || !this.controller) return\n const name = element.getAttribute(\"kui-part\")!\n if (name === \"portal\") return this.#portal(element)\n const given = spec.parts[name]?.(this.controller, element)\n if (!given) return\n const drawn: Drawn = \"attach\" in given ? { part: given } : given\n const stops: (() => void)[] = []\n const held: Held = {\n parked: false,\n stop: () => {\n for (const stop of stops.splice(0).reverse()) stop()\n },\n }\n this.#held.set(element, held)\n const unmount = drawn.mount?.()\n if (unmount) stops.push(unmount)\n if (drawn.inner) {\n // One a server wrote there is taken over.\n const last = element.lastElementChild\n const taken = last instanceof HTMLInputElement && last.type === \"hidden\" ? last : undefined\n const input = taken ?? this.ownerDocument.createElement(\"input\")\n if (!taken) element.append(input)\n stops.push(bind(input, drawn.inner), () => {\n if (!taken) input.remove()\n })\n }\n if (drawn.text && element.childNodes.length === 0) {\n const { text } = drawn\n // Taken off, the element says nothing again: put back on (a popup opened a second\n // time), the text is the part's to write still, and not taken for the page's.\n stops.push(\n effect(() => void (element.textContent = text.get() ?? \"\")),\n () => void (element.textContent = \"\")\n )\n }\n const mounted = element.hasAttribute(\"kui-keep-mounted\") ? undefined : drawn.mounted\n const first = this.#first\n if (!mounted) return void stops.push(put(element, drawn.part, first))\n // In the page only while it is mounted: out of it otherwise, its place kept by a mark.\n const home = this.ownerDocument.createComment(\"\")\n let unbind: (() => void) | undefined\n stops.push(\n effect(() => {\n const elsewhere = drawn.into?.get()\n // Still where the page drew it: not moved, and never yet taken out.\n const own = first && !elsewhere && !held.parked && !unbind\n if (mounted.get() && (!drawn.into || elsewhere)) {\n if (elsewhere) {\n // Its place where it was written is kept by the mark all the while.\n if (!held.parked && element.parentNode) element.replaceWith(home)\n held.parked = true\n if (element.parentNode !== elsewhere) elsewhere.append(element)\n } else if (held.parked) {\n held.parked = false\n home.replaceWith(element)\n }\n unbind ??= put(element, drawn.part, own)\n } else {\n unbind?.()\n unbind = undefined\n if (!held.parked && element.parentNode) {\n held.parked = true\n element.replaceWith(home)\n } else if (drawn.into) element.remove()\n }\n }),\n () => {\n unbind?.()\n if (held.parked) home.replaceWith(element)\n }\n )\n }\n\n /** What is inside is drawn at the end of the page while the component is mounted. */\n #portal(element: HTMLElement) {\n const mounted = (this.controller as { mounted?: ReadonlySignal<boolean> }).mounted\n if (!mounted) return\n ;(element as Owned)[OWNER] = this\n const home = this.ownerDocument.createComment(\"\")\n const held: Held = { parked: false, stop: () => {} }\n this.#held.set(element, held)\n this.#watch(element)\n const body = this.ownerDocument.body\n const stop = effect(() => {\n if (mounted.get()) {\n if (element.parentNode === body) return\n // Its place in the page is kept by a mark, for when the component leaves.\n if (!home.parentNode && element.parentNode) element.replaceWith(home)\n held.parked = false\n element.setAttribute(\"data-kirana-portal\", \"\")\n body.append(element)\n this.#scan(element)\n } else if (!held.parked) {\n held.parked = true\n if (!home.parentNode && element.parentNode) element.replaceWith(home)\n else element.remove()\n }\n })\n held.stop = () => {\n stop()\n element.removeAttribute(\"data-kirana-portal\")\n if (home.parentNode) home.replaceWith(element)\n else element.remove()\n }\n }\n\n #release(element: HTMLElement) {\n // Moved to the page's end by its own portal, or put back: still this component's.\n if (element.isConnected) return\n for (const [each, held] of this.#held) {\n if (each !== element && !element.contains(each)) continue\n // Taken out by the component itself: it is still the component's, to be put back.\n if (each === element && held.parked) continue\n held.stop()\n this.#held.delete(each)\n }\n }\n }\n\n // Each prop as a property too: `element.open = true`, and what the element holds read back.\n for (const name of [...names, ...(spec.properties ?? [])]) {\n const prop = camel(name)\n Object.defineProperty(KuiElement.prototype, prop, {\n configurable: true,\n get(this: KuiElement) {\n const state = (this.controller as Record<string, unknown> | undefined)?.[prop] as\n | ReadonlySignal<unknown>\n | undefined\n return typeof state?.peek === \"function\" ? state.peek() : this.given(prop)\n },\n set(this: KuiElement, value: unknown) {\n this.give(prop, value)\n },\n })\n }\n customElements.define(spec.tag, KuiElement)\n return spec.tag\n}\n"],"mappings":";;AAqDA,MAAM,wBAAQ,IAAI,QAAuB;;AAGzC,SAAgB,YAAmB,SAAkC;CACnE,KAAK,IAAI,OAAoB,SAAS,MAAM,OAAO,KAAK,YACtD,IAAI,MAAM,IAAI,IAAI,GAAG,OAAO,MAAM,IAAI,IAAI;AAG9C;;AAGA,MAAM,QAAQ,MAAc,WAC1B,KAAK,QAAQ,2BAA2B,OAAO,SAC7C,QAAQ,SAAS,OAAO,OAAO,SAAS,EAAE,IAAI,KAChD;AAyGF,MAAM,SAAS,SACb,KAAK,QAAQ,cAAc,MAAM,WAAmB,OAAO,YAAY,CAAC;AAC1E,MAAM,wBAAQ,IAAI,IAAY;AAC9B,MAAM,QAAQ,OAAO,WAAW;AAChC,IAAI,OAAO;;;;;;AASX,MAAM,QAAQ,YACZ,MAAM,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;IAChB,KAAK;IACL,QAAQ,gBAAgB,oBAAoB;IAC5C,IAAI,KAAK,YAAY,KAAK,YAAY,OAAO;SACxC,QAAQ,OAAO;GACtB;EACF;EAEA,SAAS,SAAsB;GAE7B,IAAI,QAAQ,aAAa;GACzB,KAAK,MAAM,CAAC,MAAM,SAAS,KAAK,OAAO;IACrC,IAAI,SAAS,WAAW,CAAC,QAAQ,SAAS,IAAI,GAAG;IAEjD,IAAI,SAAS,WAAW,KAAK,QAAQ;IACrC,KAAK,KAAK;IACV,KAAK,MAAM,OAAO,IAAI;GACxB;EACF;CACF;CAGA,KAAK,MAAM,QAAQ,CAAC,GAAG,OAAO,GAAI,KAAK,cAAc,CAAC,CAAE,GAAG;EACzD,MAAM,OAAO,MAAM,IAAI;EACvB,OAAO,eAAe,WAAW,WAAW,MAAM;GAChD,cAAc;GACd,MAAsB;IACpB,MAAM,QAAS,KAAK,aAAqD;IAGzE,OAAO,OAAO,OAAO,SAAS,aAAa,MAAM,KAAK,IAAI,KAAK,MAAM,IAAI;GAC3E;GACA,IAAsB,OAAgB;IACpC,KAAK,KAAK,MAAM,KAAK;GACvB;EACF,CAAC;CACH;CACA,eAAe,OAAO,KAAK,KAAK,UAAU;CAC1C,OAAO,KAAK;AACd"}
1
+ {"version":3,"file":"runtime.js","names":[],"sources":["../../../../packages/web/src/runtime.ts"],"sourcesContent":["import { bind, effect, sameProps, signal } from \"@kirana-ui/core\"\nimport type { ChangeDetails, Part, ReadonlySignal, Signal } from \"@kirana-ui/core\"\n\n/**\n * A component as a custom element, for a page with no framework.\n *\n * The custom element (`<kui-dialog>`) holds the component and draws nothing: it takes no room\n * (`display: contents`) and no attribute of the component's. Its parts are the page's own\n * elements, named by `kui-part` (`<button kui-part=\"trigger\">`), the root among them. So a\n * trigger is a real button and a switch a real button, and the page is the page the other\n * adapters draw: nothing is wrapped, and there is no shadow root for a design to reach into.\n *\n * A part that is in the page only some of the time (a closed panel, a popup) is taken out of\n * the page while it is not, and put back where it was; `kui-keep-mounted` keeps it.\n */\n\n/** What a part's name gives: the part, and what comes with it. */\nexport interface Drawn {\n readonly part: Part\n /** In the page only while this holds. */\n readonly mounted?: ReadonlySignal<boolean> | undefined\n /** Runs while the part is the component's. Returns the stop. */\n mount?(): () => void\n /** A hidden native input the part draws itself, as its last child. */\n readonly inner?: Part | undefined\n /**\n * Where the part is drawn while it is mounted, when that is not where it was written: a\n * navigation menu's content, in the menu's one viewport. Out of the page while there is none.\n */\n readonly into?: ReadonlySignal<HTMLElement | undefined> | undefined\n /** What the part's element says, when the page gave it nothing to say. */\n readonly text?: ReadonlySignal<string | undefined> | undefined\n}\n\ntype Kind = \"boolean\" | \"string\" | \"number\"\n\n/** A list a component draws from a `<template kui-each>`. */\nexport interface Each<Entry = any> {\n readonly entries: ReadonlySignal<readonly Entry[]> | readonly Entry[]\n /** What an entry is known by from one drawing to the next. */\n key(entry: Entry): string | number\n /**\n * Which of the template's elements an entry is drawn with, when they differ: the ones\n * whose `kui-when` says so (a page, an ellipsis). Elements without `kui-when` are for all.\n */\n type?(entry: Entry): string\n /**\n * What `{name}` stands for in the template's text and attributes\n * (`data-testid=\"row-{id}\"`). Left out: the entry's own fields.\n */\n values?(entry: Entry): Record<string, unknown>\n}\n\nconst ENTRY = new WeakMap<Node, unknown>()\n\n/**\n * The entry an element was stamped for, or the nearest around it: a part reads its own. With\n * `which`, the nearest that is of that list (a day's month, around its week).\n */\nexport function entryAround<Entry>(\n element: Node,\n which?: (entry: unknown) => boolean\n): Entry | undefined {\n for (let each: Node | null = element; each; each = each.parentNode) {\n if (ENTRY.has(each) && (!which || which(ENTRY.get(each)))) return ENTRY.get(each) as Entry\n }\n return undefined\n}\n\n/** `{name}` in a text, for each name there is a value for; another brace is the page's own. */\nconst fill = (text: string, values: Record<string, unknown>) =>\n text.replace(/\\{([A-Za-z_][\\w-]*)\\}/g, (whole, name: string) =>\n name in values ? String(values[name] ?? \"\") : whole\n )\n\ninterface Row {\n entry: unknown\n nodes: ChildNode[]\n /** Where a `{name}` was written: read again when the entry changes. */\n written: (readonly [Attr | Text, string])[]\n}\n\nexport interface ElementSpec<Props extends { id: string }, Controller> {\n /** The custom element's name: `kui-dialog`. */\n tag: string\n /** Its props by attribute name, each with how an attribute's text is read. */\n props: Record<string, Kind>\n /** Props that are only properties: a function, an object. By their names as properties. */\n properties?: readonly string[] | undefined\n /**\n * What the component draws a list of, by name: a calendar's weeks, a toast for each\n * message. The page writes one of an entry as a `<template kui-each=\"name\">` where the\n * list goes, and the element stamps it for each entry, keyed, so an entry that stays keeps\n * its elements. `around` is the entry of the list this one is written in (a week, for its\n * days).\n */\n lists?: Record<string, (controller: Controller, around: unknown) => Each | undefined>\n /**\n * The hidden native input a form reads, for a component with no part to hold it: drawn as\n * the element's last child, while `mounted` (a select with a name).\n */\n inner?(controller: Controller): { part: Part; mounted?: ReadonlySignal<boolean> | undefined }\n /** `host` is the custom element: what is around it (a field, a group) is found from it. */\n create(props: ReadonlySignal<Props>, host: HTMLElement): Controller\n /**\n * Its change callbacks: the event each is told as, and the prop the element then holds\n * (`open`). The event is cancelable: `preventDefault()` keeps the value as it was.\n */\n changes: Record<string, { event: string; prop: string; hold?: boolean }>\n /** Each part by its `kui-part` name. */\n parts: Record<string, (controller: Controller, element: HTMLElement) => Part | Drawn | undefined>\n}\n\ndeclare const DEFINED: unique symbol\n\n/**\n * A custom element's name as `defineElement` gives it. For TypeScript it also says what the\n * element was defined from, which `ElementOf` reads back; in the page it is the name alone.\n */\nexport type Tag<Props = unknown, Controller = unknown> = string & {\n readonly [DEFINED]?: readonly [Props, Controller]\n}\n\n/**\n * What a component tells: an event whose `detail` holds the value under its prop's name\n * (`detail.open`, `detail.values`) and why it changed (`detail.details.reason`).\n * `preventDefault()` keeps the value as it was.\n */\nexport type Told<Prop extends string, Value> = CustomEvent<\n { readonly [Name in Prop]: Value } & { readonly details: ChangeDetails }\n>\n\n/** A tag with its props said, where `defineElement` was left to work them out. */\nexport type As<Defined, Props> =\n Defined extends Tag<unknown, infer Controller> ? Tag<Props, Controller> : never\n\ntype Callback<Props, Name> = Name extends keyof Props\n ? Extract<Props[Name], (...given: never[]) => unknown>\n : never\n\ninterface Listens<Events> {\n addEventListener<Type extends keyof Events>(\n type: Type,\n listener: (this: HTMLElement, event: Events[Type]) => void,\n options?: boolean | AddEventListenerOptions\n ): void\n removeEventListener<Type extends keyof Events>(\n type: Type,\n listener: (this: HTMLElement, event: Events[Type]) => void,\n options?: boolean | EventListenerOptions\n ): void\n}\n\n/**\n * A component's custom element as TypeScript knows it, from its `tag`: its props as properties\n * (`element.open = true`), its controller once it has begun, and its events with their\n * `detail`. `Changes` names each event with the callback it tells and the prop it holds\n * (`{ \"open-change\": [\"onOpenChange\", \"open\"] }`), as the element's `changes` do; `More` is\n * for events its parts tell from their own elements, which reach it too.\n */\nexport type ElementOf<Defined, Changes = {}, More = {}> =\n Defined extends Tag<infer Props, infer Controller>\n ? Listens<\n {\n readonly [Event in keyof Changes]: Changes[Event] extends readonly [\n infer Name,\n infer Prop extends string,\n ]\n ? Told<Prop, Parameters<Callback<Props, Name>>[0]>\n : never\n } & More\n > & {\n -readonly [\n Name in keyof Props as Name extends \"id\" | `on${Capitalize<string>}` ? never : Name\n ]?: Props[Name]\n } & { controller?: Controller } & HTMLElement\n : never\n\nconst camel = (name: string) =>\n name.replace(/-([a-z])/g, (_all, letter: string) => letter.toUpperCase())\nconst hosts = new Set<string>()\nconst OWNER = Symbol(\"kui-owner\")\nlet made = 0\n\ntype Owned = HTMLElement & { [OWNER]?: HTMLElement }\n\n/**\n * Whether an element is a component's: one that was defined, or a `kui-` one that is yet to\n * be (its entry is imported later). What is inside it is its own from the start, and not a\n * part of the component around it that happens to have a part of the same name.\n */\nconst ours = (element: Element) =>\n hosts.has(element.localName) || element.localName.startsWith(\"kui-\")\n\n/** The component a part belongs to: the nearest around it, or the one that moved it to the page's end. */\nexport function ownerOf(element: Element): HTMLElement | null {\n for (let each: Element | null = element.parentElement; each; each = each.parentElement) {\n if (ours(each)) return each as HTMLElement\n const moved = (each as Owned)[OWNER]\n if (moved) return moved\n }\n return null\n}\n\n/**\n * The controller of the component around a custom element: the field a control is in, the\n * group a toggle is one of. Through a portal too: what was moved to the page's end is still\n * inside what it was written in.\n */\nexport function controllerAround<Controller>(host: Element, tag: string): Controller | undefined {\n return hostAround(host, [tag])?.controller as Controller | undefined\n}\n\n/** The nearest component around a custom element that is one of `tags`: which, and its controller. */\nexport function hostAround(\n host: Element,\n tags: readonly string[]\n): { tag: string; controller: unknown } | undefined {\n for (let each: Element | null = ownerOf(host); each; each = ownerOf(each)) {\n if (tags.includes(each.localName))\n return { tag: each.localName, controller: (each as { controller?: unknown }).controller }\n }\n return undefined\n}\n\n/** The nearest element around `element` (or itself) that is the part called `name`. */\nexport function partAround(element: Element, name: string): HTMLElement | null {\n return element.closest<HTMLElement>(`[kui-part=\"${name}\"]`)\n}\n\n// Elements the page had drawn before their part gave them a style of its own.\nlet settling: HTMLElement[] | undefined\n\n/**\n * A page's markup is drawn before its components begin, so a part's style (a slider thumb's\n * place) reaches an element the browser has already styled, and a design's `transition` on it\n * would run as the page begins: each thumb gliding to where it was all along. A framework's\n * element has its style before it is first drawn; here what the first style started is ended\n * before the page is drawn again, once for all the parts of a pass.\n */\nfunction settle(element: HTMLElement): void {\n if (typeof element.getAnimations !== \"function\") return\n if (!settling) {\n const written: HTMLElement[] = (settling = [])\n queueMicrotask(() => {\n settling = undefined\n for (const each of written) {\n for (const animation of each.getAnimations()) {\n if (animation instanceof CSSTransition) animation.cancel()\n }\n }\n })\n }\n settling.push(element)\n}\n\n/**\n * Puts a part on an element, and takes it off whole: what the part wrote is gone with it. A\n * framework draws a new element each time a part comes back; here the same element is the\n * part again, and must not still say what it said before (`data-closed`, `aria-controls`).\n */\nfunction put(element: HTMLElement, part: Part, drawn = false): () => void {\n const before = new Map(Array.from(element.attributes, (each) => [each.name, each.value]))\n const unbind = bind(element, part)\n if (drawn && part.props.peek().style) settle(element)\n return () => {\n unbind()\n for (const { name } of Array.from(element.attributes)) {\n // Its classes are the page's own, whatever was added to them since.\n if (!before.has(name) && name !== \"class\") element.removeAttribute(name)\n }\n for (const [name, value] of before) {\n if (name !== \"class\" && element.getAttribute(name) !== value)\n element.setAttribute(name, value)\n }\n }\n}\n\n/**\n * The props of something inside a component that has props of its own (a menu's checkbox\n * item, its radio group), read from its element's `kui-` attributes: `kui-checked`,\n * `kui-default-value`. What it tells is told from that element, and may be refused; a value\n * its element was given is held there, and one the page writes later is followed.\n */\nexport function partProps<Props>(\n element: HTMLElement,\n kinds: Record<string, Kind>,\n changes: Record<string, { event: string; prop: string }>\n): { props: ReadonlySignal<Props>; mount(): () => void } {\n const attribute = (name: string) => `kui-${name}`\n const told: Record<string, unknown> = {}\n const all = () => {\n const next: Record<string, unknown> = { ...told }\n for (const [name, kind] of Object.entries(kinds)) {\n const text = element.getAttribute(attribute(name))\n if (text !== null) next[camel(name)] = read(kind, text)\n }\n return next as Props\n }\n const source = signal<Props>({} as Props, sameProps as (a: Props, b: Props) => boolean)\n for (const [callback, { event, prop }] of Object.entries(changes)) {\n told[callback] = (value: unknown, details?: ChangeDetails) => {\n const heard = new CustomEvent(event, {\n detail: { [prop]: value, details },\n bubbles: true,\n cancelable: true,\n })\n if (!element.dispatchEvent(heard)) return details?.cancel()\n const held = attribute(prop.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`))\n if (element.hasAttribute(held)) element.setAttribute(held, String(value))\n source.set(all())\n }\n }\n source.set(all())\n return {\n props: source,\n mount() {\n const observer = new MutationObserver(() => source.set(all()))\n observer.observe(element, {\n attributes: true,\n attributeFilter: Object.keys(kinds).map(attribute),\n })\n return () => observer.disconnect()\n },\n }\n}\n\nfunction read(kind: Kind, text: string | null): unknown {\n if (kind === \"boolean\") return text !== null && text !== \"false\"\n if (text === null) return undefined\n return kind === \"number\" ? Number(text) : text\n}\n\n// Components written inside one that has not begun: its element is not defined yet (its\n// entry is imported later), or it waits itself. They begin when it has.\nconst waiting = new Set<{ begin(): void }>()\n\n/** Whether a component around `element` has yet to begin: what is inside it reads it. */\nfunction early(element: Element): boolean {\n for (let each: Element | null = element.parentElement; each; each = each.parentElement) {\n // Moved to the page's end by a component that had begun: on from that one.\n const moved = (each as Owned)[OWNER]\n if (moved) return early(moved)\n if (ours(each) && !(each as { controller?: unknown }).controller) return true\n }\n return false\n}\n\n/** What can be a part: an element of the page, one of a drawing (`<svg>`, `<path>`) too. */\nconst drawable = (node: Node): node is HTMLElement => node instanceof Element\n\ninterface Held {\n stop(): void\n /** Taken out of the page by the component itself: still its part. */\n parked: boolean\n}\n\n/**\n * Defines a component's custom element, and gives its name (for\n * `customElements.whenDefined`). Where there are no custom elements (a server) it defines\n * nothing.\n */\nexport function defineElement<Props extends { id: string }, Controller extends object>(\n spec: ElementSpec<Props, Controller>\n): Tag<Props, Controller> {\n if (typeof customElements === \"undefined\" || customElements.get(spec.tag)) return spec.tag\n hosts.add(spec.tag)\n const names = Object.keys(spec.props)\n\n class KuiElement extends HTMLElement {\n static observedAttributes = names\n controller?: Controller\n #props?: Signal<Props> | undefined\n // Set as properties before the element was upgraded, or before it joined the page.\n #given: Record<string, unknown> = {}\n #held = new Map<HTMLElement, Held>()\n #stops: (() => void)[] = []\n #leaving = false\n // While the parts the page wrote are first taken: they were drawn before they were parts.\n #first = false\n #watch: (element: HTMLElement) => void = () => {}\n\n connectedCallback() {\n this.#leaving = false\n this.begin()\n }\n\n /** Begins, unless a component around it has not: then it waits for that one. */\n begin() {\n if (this.controller || !this.isConnected) return\n if (early(this)) return void waiting.add(this)\n waiting.delete(this)\n // It holds its parts and draws nothing: no box of its own between them and the page.\n if (!this.style.display) this.style.display = \"contents\"\n const initial: Record<string, unknown> = {\n id: this.getAttribute(\"kui-id\") || `kui-${++made}`,\n }\n for (const name of names) {\n const text = this.getAttribute(name)\n // An attribute that is not there says nothing: the component's own default holds.\n if (text !== null) initial[camel(name)] = read(spec.props[name]!, text)\n }\n Object.assign(initial, this.#given)\n for (const [callback, { event, prop, hold }] of Object.entries(spec.changes)) {\n initial[callback] = (value: unknown, details?: ChangeDetails) => {\n const told = new CustomEvent(event, {\n detail: { [prop]: value, details },\n bubbles: true,\n cancelable: true,\n })\n if (!this.dispatchEvent(told)) return details?.cancel()\n // A value that was given is held by the element from then on, as `<details open>`\n // holds its own: it follows what happens to it.\n if (hold !== false && this.given(prop) !== undefined) this.give(prop, value)\n }\n }\n this.#props = signal(initial as Props, sameProps as (a: Props, b: Props) => boolean)\n this.controller = spec.create(this.#props, this)\n const unmount = (this.controller as { mount?(): () => void }).mount?.()\n if (unmount) this.#stops.push(unmount)\n // Parts that come and go: a page that draws its rows later, a list that changes.\n const observer = new MutationObserver((records) => {\n for (const record of records) {\n for (const node of record.removedNodes) {\n if (drawable(node)) this.#release(node)\n }\n for (const node of record.addedNodes) if (drawable(node)) this.#scan(node)\n }\n })\n observer.observe(this, { childList: true, subtree: true })\n this.#watch = (element) => observer.observe(element, { childList: true, subtree: true })\n this.#stops.push(() => observer.disconnect())\n // A copy: a part that is not in the page yet is taken out as it is met.\n this.#first = true\n for (const each of Array.from(this.children)) if (drawable(each)) this.#scan(each)\n this.#first = false\n const inner = spec.inner?.(this.controller)\n if (inner) {\n const input = this.ownerDocument.createElement(\"input\")\n let unbind: (() => void) | undefined\n const drawn = effect(() => {\n const wanted = inner.mounted?.get() ?? true\n if (wanted && !unbind) {\n this.append(input)\n unbind = bind(input, inner.part)\n } else if (!wanted && unbind) {\n unbind()\n unbind = undefined\n input.remove()\n }\n })\n this.#stops.push(() => {\n drawn()\n unbind?.()\n input.remove()\n })\n }\n for (const each of Array.from(waiting)) each.begin()\n }\n\n disconnectedCallback() {\n // Moved, it comes straight back: only an element that has left is taken apart.\n this.#leaving = true\n queueMicrotask(() => {\n if (!this.#leaving || this.isConnected) return\n waiting.delete(this)\n for (const held of this.#held.values()) held.stop()\n this.#held.clear()\n for (const stop of this.#stops.splice(0).reverse()) stop()\n delete this.controller\n this.#props = undefined\n })\n }\n\n attributeChangedCallback(name: string, _before: string | null, text: string | null) {\n this.give(camel(name), read(spec.props[name]!, text))\n }\n\n /** A prop as it was last given: by an attribute, or as a property. */\n given(prop: string): unknown {\n return this.#props ? (this.#props.peek() as Record<string, unknown>)[prop] : this.#given[prop]\n }\n\n give(prop: string, value: unknown) {\n if (!this.#props) return void (this.#given[prop] = value)\n if (!Object.is((this.#props.peek() as Record<string, unknown>)[prop], value))\n this.#props.set({ ...this.#props.peek(), [prop]: value })\n }\n\n /** Takes the parts in a subtree, in the page's order: one that leaves takes its own with it. */\n #scan(element: HTMLElement) {\n if (!element.isConnected) return\n if (element instanceof HTMLTemplateElement) {\n if (element.hasAttribute(\"kui-each\") && ownerOf(element) === this) this.#each(element)\n return\n }\n if (element.hasAttribute(\"kui-part\")) this.#adopt(element)\n for (const each of Array.from(element.children)) if (drawable(each)) this.#scan(each)\n }\n\n /** Draws a list from its template: a copy for each entry, where the template was. */\n #each(template: HTMLTemplateElement) {\n const list = spec.lists?.[template.getAttribute(\"kui-each\")!]?.(\n this.controller!,\n entryAround(template)\n )\n if (!list) return\n // The template leaves the page for a mark: what is drawn is the page a framework draws.\n const mark = this.ownerDocument.createComment(\"\")\n if (ENTRY.has(template)) ENTRY.set(mark, ENTRY.get(template))\n template.replaceWith(mark)\n const rows = new Map<string | number, Row>()\n const stamp = (entry: unknown): Row => {\n const type = list.type?.(entry)\n const copy = template.content.cloneNode(true) as DocumentFragment\n for (const node of Array.from(copy.childNodes)) {\n const blank = node.nodeType === Node.TEXT_NODE && !node.textContent!.trim()\n const other =\n node instanceof Element &&\n node.hasAttribute(\"kui-when\") &&\n node.getAttribute(\"kui-when\") !== type\n if (blank || other || node.nodeType === Node.COMMENT_NODE) node.remove()\n }\n const written: (readonly [Attr | Text, string])[] = []\n const walker = this.ownerDocument.createTreeWalker(\n copy,\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT\n )\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n // A list written in this one is filled when it is drawn, for its own entries.\n if (node instanceof Text) {\n if (node.data.includes(\"{\")) written.push([node, node.data])\n } else if (!(node instanceof HTMLTemplateElement)) {\n for (const attribute of Array.from((node as Element).attributes))\n if (attribute.value.includes(\"{\")) written.push([attribute, attribute.value])\n }\n }\n const nodes = Array.from(copy.childNodes)\n for (const node of nodes) ENTRY.set(node, entry)\n return { entry, nodes, written }\n }\n const write = (row: Row) => {\n const values =\n list.values?.(row.entry) ?? (row.entry as Record<string, unknown> | undefined) ?? {}\n for (const [node, text] of row.written) {\n const next = fill(text, values)\n if (node instanceof Text) {\n if (node.data !== next) node.data = next\n } else if (node.value !== next) node.value = next\n }\n }\n const draw = () => {\n const { entries } = list\n const next = \"get\" in entries ? entries.get() : entries\n const parent = mark.parentNode\n if (!parent) return\n const kept = new Set<string | number>()\n const fresh: Row[] = []\n const ordered = next.map((entry) => {\n const key = list.key(entry)\n kept.add(key)\n let row = rows.get(key)\n if (!row) {\n rows.set(key, (row = stamp(entry)))\n fresh.push(row)\n write(row)\n } else if (row.entry !== entry) {\n row.entry = entry\n for (const node of row.nodes) ENTRY.set(node, entry)\n write(row)\n }\n return row\n })\n for (const [key, row] of rows) {\n if (kept.has(key)) continue\n rows.delete(key)\n for (const node of row.nodes) node.remove()\n }\n // From the end: a copy that is where it belongs is not moved, and keeps focus.\n let before: ChildNode = mark\n for (const row of ordered.reverse()) {\n for (const node of row.nodes.toReversed()) {\n if (node.nextSibling !== before || node.parentNode !== parent)\n parent.insertBefore(node, before)\n before = node\n }\n }\n for (const row of fresh) for (const node of row.nodes) if (drawable(node)) this.#scan(node)\n }\n const stop = effect(draw)\n this.#stops.push(() => {\n stop()\n for (const row of rows.values()) for (const node of row.nodes) node.remove()\n rows.clear()\n mark.replaceWith(template)\n })\n }\n\n #adopt(element: HTMLElement) {\n if (this.#held.has(element) || ownerOf(element) !== this || !this.controller) return\n const name = element.getAttribute(\"kui-part\")!\n if (name === \"portal\") return this.#portal(element)\n const given = spec.parts[name]?.(this.controller, element)\n if (!given) return\n const drawn: Drawn = \"attach\" in given ? { part: given } : given\n const stops: (() => void)[] = []\n const held: Held = {\n parked: false,\n stop: () => {\n for (const stop of stops.splice(0).reverse()) stop()\n },\n }\n this.#held.set(element, held)\n const unmount = drawn.mount?.()\n if (unmount) stops.push(unmount)\n if (drawn.inner) {\n // One a server wrote there is taken over.\n const last = element.lastElementChild\n const taken = last instanceof HTMLInputElement && last.type === \"hidden\" ? last : undefined\n const input = taken ?? this.ownerDocument.createElement(\"input\")\n if (!taken) element.append(input)\n stops.push(bind(input, drawn.inner), () => {\n if (!taken) input.remove()\n })\n }\n if (drawn.text && element.childNodes.length === 0) {\n const { text } = drawn\n // Taken off, the element says nothing again: put back on (a popup opened a second\n // time), the text is the part's to write still, and not taken for the page's.\n stops.push(\n effect(() => void (element.textContent = text.get() ?? \"\")),\n () => void (element.textContent = \"\")\n )\n }\n const mounted = element.hasAttribute(\"kui-keep-mounted\") ? undefined : drawn.mounted\n const first = this.#first\n if (!mounted) return void stops.push(put(element, drawn.part, first))\n // In the page only while it is mounted: out of it otherwise, its place kept by a mark.\n const home = this.ownerDocument.createComment(\"\")\n let unbind: (() => void) | undefined\n stops.push(\n effect(() => {\n const elsewhere = drawn.into?.get()\n // Still where the page drew it: not moved, and never yet taken out.\n const own = first && !elsewhere && !held.parked && !unbind\n if (mounted.get() && (!drawn.into || elsewhere)) {\n if (elsewhere) {\n // Its place where it was written is kept by the mark all the while.\n if (!held.parked && element.parentNode) element.replaceWith(home)\n held.parked = true\n if (element.parentNode !== elsewhere) elsewhere.append(element)\n } else if (held.parked) {\n held.parked = false\n home.replaceWith(element)\n }\n unbind ??= put(element, drawn.part, own)\n } else {\n unbind?.()\n unbind = undefined\n if (!held.parked && element.parentNode) {\n held.parked = true\n element.replaceWith(home)\n } else if (drawn.into) element.remove()\n }\n }),\n () => {\n unbind?.()\n if (held.parked) home.replaceWith(element)\n }\n )\n }\n\n /** What is inside is drawn at the end of the page while the component is mounted. */\n #portal(element: HTMLElement) {\n const mounted = (this.controller as { mounted?: ReadonlySignal<boolean> }).mounted\n if (!mounted) return\n ;(element as Owned)[OWNER] = this\n const home = this.ownerDocument.createComment(\"\")\n const held: Held = { parked: false, stop: () => {} }\n this.#held.set(element, held)\n this.#watch(element)\n const body = this.ownerDocument.body\n const stop = effect(() => {\n if (mounted.get()) {\n if (element.parentNode === body) return\n // Its place in the page is kept by a mark, for when the component leaves.\n if (!home.parentNode && element.parentNode) element.replaceWith(home)\n held.parked = false\n element.setAttribute(\"data-kirana-portal\", \"\")\n body.append(element)\n this.#scan(element)\n } else if (!held.parked) {\n held.parked = true\n if (!home.parentNode && element.parentNode) element.replaceWith(home)\n else element.remove()\n }\n })\n held.stop = () => {\n stop()\n element.removeAttribute(\"data-kirana-portal\")\n if (home.parentNode) home.replaceWith(element)\n else element.remove()\n }\n }\n\n #release(element: HTMLElement) {\n // Moved to the page's end by its own portal, or put back: still this component's.\n if (element.isConnected) return\n for (const [each, held] of this.#held) {\n if (each !== element && !element.contains(each)) continue\n // Taken out by the component itself: it is still the component's, to be put back.\n if (each === element && held.parked) continue\n held.stop()\n this.#held.delete(each)\n }\n }\n }\n\n // Each prop as a property too: `element.open = true`, and what the element holds read back.\n for (const name of [...names, ...(spec.properties ?? [])]) {\n const prop = camel(name)\n Object.defineProperty(KuiElement.prototype, prop, {\n configurable: true,\n get(this: KuiElement) {\n const state = (this.controller as Record<string, unknown> | undefined)?.[prop] as\n | ReadonlySignal<unknown>\n | undefined\n return typeof state?.peek === \"function\" ? state.peek() : this.given(prop)\n },\n set(this: KuiElement, value: unknown) {\n this.give(prop, value)\n },\n })\n }\n customElements.define(spec.tag, KuiElement)\n return spec.tag\n}\n"],"mappings":";;AAqDA,MAAM,wBAAQ,IAAI,QAAuB;;;;;AAMzC,SAAgB,YACd,SACA,OACmB;CACnB,KAAK,IAAI,OAAoB,SAAS,MAAM,OAAO,KAAK,YACtD,IAAI,MAAM,IAAI,IAAI,MAAM,CAAC,SAA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js";
2
+ import { Placed } from "./around.js";
2
3
  import { Select, SelectProps } from "@kirana-ui/core/select";
3
4
  type Props = Omit<SelectProps<string>, "values" | "defaultValues"> & {
4
5
  values?: string | readonly string[];
@@ -15,7 +16,7 @@ type Props = Omit<SelectProps<string>, "values" | "defaultValues"> & {
15
16
  * it draws the hidden input a form reads. A `value` part that holds something says what the
16
17
  * page wrote there: a `<template kui-each="values">` in it is drawn for each chosen value
17
18
  * (`{value}`, `{label}`), in the items' order. `value`, `default-value`, `open`,
18
- * `default-open`, `disabled`, `required`, `multiple`, `values` and `default-values` (with
19
+ * `default-open`, `disabled`, `read-only`, `required`, `multiple`, `values` and `default-values` (with
19
20
  * commas between), `name`, `form`; `items` as a property; it tells `value-change`,
20
21
  * `values-change` and `open-change`.
21
22
  */
@@ -26,7 +27,7 @@ declare global {
26
27
  "value-change": ["onValueChange", "value"];
27
28
  "values-change": ["onValuesChange", "values"];
28
29
  "open-change": ["onOpenChange", "open"];
29
- }>;
30
+ }> & Placed;
30
31
  }
31
32
  }
32
33
  export {};
package/src/select.js CHANGED
@@ -21,7 +21,7 @@ const arrow = (drawn) => ({
21
21
  * it draws the hidden input a form reads. A `value` part that holds something says what the
22
22
  * page wrote there: a `<template kui-each="values">` in it is drawn for each chosen value
23
23
  * (`{value}`, `{label}`), in the items' order. `value`, `default-value`, `open`,
24
- * `default-open`, `disabled`, `required`, `multiple`, `values` and `default-values` (with
24
+ * `default-open`, `disabled`, `read-only`, `required`, `multiple`, `values` and `default-values` (with
25
25
  * commas between), `name`, `form`; `items` as a property; it tells `value-change`,
26
26
  * `values-change` and `open-change`.
27
27
  */
@@ -33,6 +33,7 @@ const tag = defineElement({
33
33
  open: "boolean",
34
34
  "default-open": "boolean",
35
35
  disabled: "boolean",
36
+ "read-only": "boolean",
36
37
  required: "boolean",
37
38
  multiple: "boolean",
38
39
  values: "string",
package/src/select.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","names":[],"sources":["../../../../packages/web/src/select.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createSelect } from \"@kirana-ui/core/select\"\nimport type { Select, SelectGroup, SelectProps, SelectScrollArrow } from \"@kirana-ui/core/select\"\n\nimport { fieldAround, itemOptions, list, MARK, once, positioner, valueOf } from \"./around.ts\"\nimport { defineElement, partAround } from \"./runtime.ts\"\nimport type { Drawn, Each, ElementOf } from \"./runtime.ts\"\n\ntype Props = Omit<SelectProps<string>, \"values\" | \"defaultValues\"> & {\n values?: string | readonly string[]\n defaultValues?: string | readonly string[]\n}\n\nconst groups = new WeakMap<HTMLElement, SelectGroup>()\nlet made = 0\n\nconst arrow = (drawn: SelectScrollArrow): Drawn => ({\n part: drawn.part,\n mounted: drawn.mounted,\n mount: () => drawn.mount(),\n})\n\n/**\n * `<kui-select>` around a `kui-part=\"trigger\"` button holding a `value` (it says the chosen\n * item's text, or its `kui-placeholder`; with `multiple`, the chosen items' texts with commas\n * between), and a `portal` with a `positioner` (its `kui-side`\n * and the like, and `kui-align-item-with-trigger`) around the `popup`. The popup holds an\n * `item` for each `kui-value` (`kui-disabled`, `kui-label`), each with an `item-text` and an\n * `item-indicator`; items may be in a `group` with a `group-label`, with `separator`s\n * between, and in a `list` between a `scroll-up-arrow` and a `scroll-down-arrow`. With a name\n * it draws the hidden input a form reads. A `value` part that holds something says what the\n * page wrote there: a `<template kui-each=\"values\">` in it is drawn for each chosen value\n * (`{value}`, `{label}`), in the items' order. `value`, `default-value`, `open`,\n * `default-open`, `disabled`, `required`, `multiple`, `values` and `default-values` (with\n * commas between), `name`, `form`; `items` as a property; it tells `value-change`,\n * `values-change` and `open-change`.\n */\nexport const tag = defineElement<Props, Select<string>>({\n tag: \"kui-select\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n open: \"boolean\",\n \"default-open\": \"boolean\",\n disabled: \"boolean\",\n required: \"boolean\",\n multiple: \"boolean\",\n values: \"string\",\n \"default-values\": \"string\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"items\"],\n create: (props, host) =>\n createSelect<string>(\n computed(() => {\n const own = props.get()\n return { ...own, values: list(own.values), defaultValues: list(own.defaultValues) }\n }),\n { field: fieldAround(host) }\n ),\n lists: {\n values: (controller): Each<{ value: string; label: string }> => ({\n entries: computed(() => {\n const { values, labels } = controller.shown.get()\n return values.map((value, at) => ({ value, label: labels[at] ?? value }))\n }),\n key: (chosen) => chosen.value,\n }),\n },\n inner: (controller) => ({ part: controller.input, mounted: controller.named }),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValuesChange: { event: \"values-change\", prop: \"values\" },\n onOpenChange: { event: \"open-change\", prop: \"open\" },\n },\n parts: {\n trigger: (controller) => controller.trigger,\n value: (controller, element) => ({\n part: controller.valuePart,\n text: computed(\n () => controller.label.get() ?? element.getAttribute(\"kui-placeholder\") ?? undefined\n ),\n }),\n positioner(controller, element) {\n controller.alignItemWithTrigger.set(element.hasAttribute(\"kui-align-item-with-trigger\"))\n return positioner(controller, element)\n },\n popup: (controller) => controller.popup,\n list: (controller) => controller.list,\n \"scroll-up-arrow\": (controller) => arrow(controller.scrollArrow(\"up\")),\n \"scroll-down-arrow\": (controller) => arrow(controller.scrollArrow(\"down\")),\n group: (controller, element) =>\n once(groups, element, (group) =>\n controller.group(group.getAttribute(\"kui-id\") ?? `kui-select-group-${++made}`)\n )?.root,\n // Outside a group it is plain text, and names nothing.\n \"group-label\": (controller, element) =>\n groups.get(partAround(element, \"group\")!)?.label ?? controller.groupLabel,\n separator: (controller) => controller.separator,\n item: (controller, element) => controller.item(valueOf(element), itemOptions(element)),\n \"item-text\": (controller, element) => controller.itemText(valueOf(partAround(element, \"item\"))),\n \"item-indicator\": (controller, element) => ({\n part: MARK,\n mounted: controller.selected(valueOf(partAround(element, \"item\"))),\n }),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-select\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"values-change\": [\"onValuesChange\", \"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AA,CAC7E;EACF;EACA,WAAW,YAAY,SAAS;GAC9B,WAAW,qBAAqB,IAAI,QAAQ,aAAa,6BAA6B,CAAC;GACvF,OAAO,WAAW,YAAY,OAAO;EACvC;EACA,QAAQ,eAAe,WAAW;EAClC,OAAO,eAAe,WAAW;EACjC,oBAAoB,eAAe,MAAM,WAAW,YAAY,IAAI,CAAC;EACrE,sBAAsB,eAAe,MAAM,WAAW,YAAY,MAAM,CAAC;EACzE,QAAQ,YAAY,YAClB,KAAK,QAAQ,UAAU,UACrB,WAAW,MAAM,MAAM,aAAa,QAAQ,KAAK,oBAAoB,EAAE,MAAM,CAC/E,CAAC,EAAE;EAEL,gBAAgB,YAAY,YAC1B,OAAO,IAAI,WAAW,SAAS,OAAO,CAAE,CAAC,EAAE,SAAS,WAAW;EACjE,YAAY,eAAe,WAAW;EACtC,OAAO,YAAY,YAAY,WAAW,KAAK,QAAQ,OAAO,GAAG,YAAY,OAAO,CAAC;EACrF,cAAc,YAAY,YAAY,WAAW,SAAS,QAAQ,WAAW,SAAS,MAAM,CAAC,CAAC;EAC9F,mBAAmB,YAAY,aAAa;GAC1C,MAAM;GACN,SAAS,WAAW,SAAS,QAAQ,WAAW,SAAS,MAAM,CAAC,CAAC;EACnE;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"select.js","names":[],"sources":["../../../../packages/web/src/select.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createSelect } from \"@kirana-ui/core/select\"\nimport type { Select, SelectGroup, SelectProps, SelectScrollArrow } from \"@kirana-ui/core/select\"\n\nimport { fieldAround, itemOptions, list, MARK, once, positioner, valueOf } from \"./around.ts\"\nimport type { Placed } from \"./around.ts\"\nimport { defineElement, partAround } from \"./runtime.ts\"\nimport type { Drawn, Each, ElementOf } from \"./runtime.ts\"\n\ntype Props = Omit<SelectProps<string>, \"values\" | \"defaultValues\"> & {\n values?: string | readonly string[]\n defaultValues?: string | readonly string[]\n}\n\nconst groups = new WeakMap<HTMLElement, SelectGroup>()\nlet made = 0\n\nconst arrow = (drawn: SelectScrollArrow): Drawn => ({\n part: drawn.part,\n mounted: drawn.mounted,\n mount: () => drawn.mount(),\n})\n\n/**\n * `<kui-select>` around a `kui-part=\"trigger\"` button holding a `value` (it says the chosen\n * item's text, or its `kui-placeholder`; with `multiple`, the chosen items' texts with commas\n * between), and a `portal` with a `positioner` (its `kui-side`\n * and the like, and `kui-align-item-with-trigger`) around the `popup`. The popup holds an\n * `item` for each `kui-value` (`kui-disabled`, `kui-label`), each with an `item-text` and an\n * `item-indicator`; items may be in a `group` with a `group-label`, with `separator`s\n * between, and in a `list` between a `scroll-up-arrow` and a `scroll-down-arrow`. With a name\n * it draws the hidden input a form reads. A `value` part that holds something says what the\n * page wrote there: a `<template kui-each=\"values\">` in it is drawn for each chosen value\n * (`{value}`, `{label}`), in the items' order. `value`, `default-value`, `open`,\n * `default-open`, `disabled`, `read-only`, `required`, `multiple`, `values` and `default-values` (with\n * commas between), `name`, `form`; `items` as a property; it tells `value-change`,\n * `values-change` and `open-change`.\n */\nexport const tag = defineElement<Props, Select<string>>({\n tag: \"kui-select\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n open: \"boolean\",\n \"default-open\": \"boolean\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n multiple: \"boolean\",\n values: \"string\",\n \"default-values\": \"string\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"items\"],\n create: (props, host) =>\n createSelect<string>(\n computed(() => {\n const own = props.get()\n return { ...own, values: list(own.values), defaultValues: list(own.defaultValues) }\n }),\n { field: fieldAround(host) }\n ),\n lists: {\n values: (controller): Each<{ value: string; label: string }> => ({\n entries: computed(() => {\n const { values, labels } = controller.shown.get()\n return values.map((value, at) => ({ value, label: labels[at] ?? value }))\n }),\n key: (chosen) => chosen.value,\n }),\n },\n inner: (controller) => ({ part: controller.input, mounted: controller.named }),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValuesChange: { event: \"values-change\", prop: \"values\" },\n onOpenChange: { event: \"open-change\", prop: \"open\" },\n },\n parts: {\n trigger: (controller) => controller.trigger,\n value: (controller, element) => ({\n part: controller.valuePart,\n text: computed(\n () => controller.label.get() ?? element.getAttribute(\"kui-placeholder\") ?? undefined\n ),\n }),\n positioner(controller, element) {\n controller.alignItemWithTrigger.set(element.hasAttribute(\"kui-align-item-with-trigger\"))\n return positioner(controller, element)\n },\n popup: (controller) => controller.popup,\n list: (controller) => controller.list,\n \"scroll-up-arrow\": (controller) => arrow(controller.scrollArrow(\"up\")),\n \"scroll-down-arrow\": (controller) => arrow(controller.scrollArrow(\"down\")),\n group: (controller, element) =>\n once(groups, element, (group) =>\n controller.group(group.getAttribute(\"kui-id\") ?? `kui-select-group-${++made}`)\n )?.root,\n // Outside a group it is plain text, and names nothing.\n \"group-label\": (controller, element) =>\n groups.get(partAround(element, \"group\")!)?.label ?? controller.groupLabel,\n separator: (controller) => controller.separator,\n item: (controller, element) => controller.item(valueOf(element), itemOptions(element)),\n \"item-text\": (controller, element) => controller.itemText(valueOf(partAround(element, \"item\"))),\n \"item-indicator\": (controller, element) => ({\n part: MARK,\n mounted: controller.selected(valueOf(partAround(element, \"item\"))),\n }),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-select\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"values-change\": [\"onValuesChange\", \"values\"]\n \"open-change\": [\"onOpenChange\", \"open\"]\n }\n > &\n Placed\n }\n}\n"],"mappings":";;;;;AAcA,MAAM,yBAAS,IAAI,QAAkC;AACrD,IAAI,OAAO;AAEX,MAAM,SAAS,WAAqC;CAClD,MAAM,MAAM;CACZ,SAAS,MAAM;CACf,aAAa,MAAM,MAAM;AAC3B;;;;;;;;;;;;;;;;AAiBA,MAAa,MAAM,cAAqC;CACtD,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,MAAM;EACN,gBAAgB;EAChB,UAAU;E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,WAAW,MAAM,MAAM,aAAa,QAAQ,KAAK,oBAAoB,EAAE,MAAM,CAC/E,CAAC,EAAE;EAEL,gBAAgB,YAAY,YAC1B,OAAO,IAAI,WAAW,SAAS,OAAO,CAAE,CAAC,EAAE,SAAS,WAAW;EACjE,YAAY,eAAe,WAAW;EACtC,OAAO,YAAY,YAAY,WAAW,KAAK,QAAQ,OAAO,GAAG,YAAY,OAAO,CAAC;EACrF,cAAc,YAAY,YAAY,WAAW,SAAS,QAAQ,WAAW,SAAS,MAAM,CAAC,CAAC;EAC9F,mBAAmB,YAAY,aAAa;GAC1C,MAAM;GACN,SAAS,WAAW,SAAS,QAAQ,WAAW,SAAS,MAAM,CAAC,CAAC;EACnE;CACF;AACF,CAAC"}
package/src/slider.d.ts CHANGED
@@ -9,8 +9,8 @@ type Props = Omit<SliderProps, "value" | "defaultValue"> & {
9
9
  * a `control` with its `track`, `indicator` and a `thumb` for each value, in the values'
10
10
  * order (or each with its `kui-index`). A thumb draws the hidden input a form reads. `value` and
11
11
  * `default-value` (a range with a comma), `min`, `max`, `step`, `large-step`,
12
- * `min-steps-between-values`, `thumb-alignment`, `orientation`, `disabled`, `name`, `form`,
13
- * `locale`; it tells `value-change` and `value-committed`.
12
+ * `min-steps-between-values`, `thumb-alignment`, `orientation`, `disabled`, `read-only`,
13
+ * `name`, `form`, `locale`; it tells `value-change` and `value-committed`.
14
14
  */
15
15
  export declare const tag: Tag<Props, Slider>;
16
16
  declare global {
package/src/slider.js CHANGED
@@ -11,8 +11,8 @@ const at = (element) => element.hasAttribute("kui-index") ? Number(element.getAt
11
11
  * a `control` with its `track`, `indicator` and a `thumb` for each value, in the values'
12
12
  * order (or each with its `kui-index`). A thumb draws the hidden input a form reads. `value` and
13
13
  * `default-value` (a range with a comma), `min`, `max`, `step`, `large-step`,
14
- * `min-steps-between-values`, `thumb-alignment`, `orientation`, `disabled`, `name`, `form`,
15
- * `locale`; it tells `value-change` and `value-committed`.
14
+ * `min-steps-between-values`, `thumb-alignment`, `orientation`, `disabled`, `read-only`,
15
+ * `name`, `form`, `locale`; it tells `value-change` and `value-committed`.
16
16
  */
17
17
  const tag = defineElement({
18
18
  tag: "kui-slider",
@@ -27,6 +27,7 @@ const tag = defineElement({
27
27
  "thumb-alignment": "string",
28
28
  orientation: "string",
29
29
  disabled: "boolean",
30
+ "read-only": "boolean",
30
31
  name: "string",
31
32
  form: "string",
32
33
  locale: "string"
package/src/slider.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","names":[],"sources":["../../../../packages/web/src/slider.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createSlider } from \"@kirana-ui/core/slider\"\nimport type { Slider, SliderProps } from \"@kirana-ui/core/slider\"\n\nimport { fieldAround, ownValue } from \"./around.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\n/** A value as an attribute writes it: `\"40\"`, or for a range `\"20,80\"`. */\nconst read = (given: unknown): number | number[] | undefined =>\n typeof given === \"string\"\n ? given.includes(\",\")\n ? given.split(\",\").map(Number)\n : Number(given)\n : (given as number | number[] | undefined)\n\n// A thumb with no `kui-index` takes its place among the slider's thumbs, in the page's order.\nconst at = (element: HTMLElement) =>\n element.hasAttribute(\"kui-index\") ? Number(element.getAttribute(\"kui-index\")) : ownValue(element)\n\ntype Props = Omit<SliderProps, \"value\" | \"defaultValue\"> & {\n value?: string | number | number[]\n defaultValue?: string | number | number[]\n}\n\n/**\n * `<kui-slider>` around `kui-part=\"root\"`, a `value` (which says the value as it is written),\n * a `control` with its `track`, `indicator` and a `thumb` for each value, in the values'\n * order (or each with its `kui-index`). A thumb draws the hidden input a form reads. `value` and\n * `default-value` (a range with a comma), `min`, `max`, `step`, `large-step`,\n * `min-steps-between-values`, `thumb-alignment`, `orientation`, `disabled`, `name`, `form`,\n * `locale`; it tells `value-change` and `value-committed`.\n */\nexport const tag = defineElement<Props, Slider>({\n tag: \"kui-slider\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n min: \"number\",\n max: \"number\",\n step: \"number\",\n \"large-step\": \"number\",\n \"min-steps-between-values\": \"number\",\n \"thumb-alignment\": \"string\",\n orientation: \"string\",\n disabled: \"boolean\",\n name: \"string\",\n form: \"string\",\n locale: \"string\",\n },\n properties: [\"format\", \"getAriaValueText\"],\n create: (props, host) =>\n createSlider(\n computed(() => {\n const own = props.get()\n return { ...own, value: read(own.value), defaultValue: read(own.defaultValue) }\n }),\n { field: fieldAround(host) }\n ),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValueCommitted: { event: \"value-committed\", prop: \"value\", hold: false },\n },\n parts: {\n root: (controller) => controller.root,\n value: (controller) => ({ part: controller.value, text: controller.text }),\n control: (controller) => controller.control,\n track: (controller) => controller.track,\n indicator: (controller) => controller.indicator,\n thumb: (controller, element) => ({\n part: controller.thumb(at(element)),\n inner: controller.thumbInput(at(element)),\n }),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-slider\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"value-committed\": [\"onValueCommitted\", \"value\"]\n }\n >\n }\n}\n"],"mappings":";;;;;;AASA,MAAM,QAAQ,UACZ,OAAO,UAAU,WACb,MAAM,SAAS,GAAG,IAChB,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,IAC3B,OAAO,KAAK,IACb;AAGP,MAAM,MAAM,YACV,QAAQ,aAAa,WAAW,IAAI,OAAO,QAAQ,aAAa,WAAW,CAAC,IAAI,SAAS,OAAO;;;;;;;;;AAelG,MAAa,MAAM,cAA6B;CAC9C,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,KAAK;EACL,KAAK;EACL,MAAM;EACN,cAAc;EACd,4BAA4B;EAC5B,mBAAmB;EACnB,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;EACN,QAAQ;CACV;CACA,YAAY,CAAC,UAAU,kBAAkB;CACzC,SAAS,OAAO,SACd,aACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GAAE,GAAG;GAAK,OAAO,KAAK,IAAI,KAAK;GAAG,cAAc,KAAK,IAAI,YAAY;EAAE;CAChF,CAAC,GACD,EAAE,OAAO,YAAY,IAAI,EAAE,CAC7B;CACF,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,kBAAkB;GAAE,OAAO;GAAmB,MAAM;GAAS,MAAM;EAAM;CAC3E;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,gBAAgB;GAAE,MAAM,WAAW;GAAO,MAAM,WAAW;EAAK;EACxE,UAAU,eAAe,WAAW;EACpC,QAAQ,eAAe,WAAW;EAClC,YAAY,eAAe,WAAW;EACtC,QAAQ,YAAY,aAAa;GAC/B,MAAM,WAAW,MAAM,GAAG,OAAO,CAAC;GAClC,OAAO,WAAW,WAAW,GAAG,OAAO,CAAC;EAC1C;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"slider.js","names":[],"sources":["../../../../packages/web/src/slider.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createSlider } from \"@kirana-ui/core/slider\"\nimport type { Slider, SliderProps } from \"@kirana-ui/core/slider\"\n\nimport { fieldAround, ownValue } from \"./around.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\n/** A value as an attribute writes it: `\"40\"`, or for a range `\"20,80\"`. */\nconst read = (given: unknown): number | number[] | undefined =>\n typeof given === \"string\"\n ? given.includes(\",\")\n ? given.split(\",\").map(Number)\n : Number(given)\n : (given as number | number[] | undefined)\n\n// A thumb with no `kui-index` takes its place among the slider's thumbs, in the page's order.\nconst at = (element: HTMLElement) =>\n element.hasAttribute(\"kui-index\") ? Number(element.getAttribute(\"kui-index\")) : ownValue(element)\n\ntype Props = Omit<SliderProps, \"value\" | \"defaultValue\"> & {\n value?: string | number | number[]\n defaultValue?: string | number | number[]\n}\n\n/**\n * `<kui-slider>` around `kui-part=\"root\"`, a `value` (which says the value as it is written),\n * a `control` with its `track`, `indicator` and a `thumb` for each value, in the values'\n * order (or each with its `kui-index`). A thumb draws the hidden input a form reads. `value` and\n * `default-value` (a range with a comma), `min`, `max`, `step`, `large-step`,\n * `min-steps-between-values`, `thumb-alignment`, `orientation`, `disabled`, `read-only`,\n * `name`, `form`, `locale`; it tells `value-change` and `value-committed`.\n */\nexport const tag = defineElement<Props, Slider>({\n tag: \"kui-slider\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n min: \"number\",\n max: \"number\",\n step: \"number\",\n \"large-step\": \"number\",\n \"min-steps-between-values\": \"number\",\n \"thumb-alignment\": \"string\",\n orientation: \"string\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n name: \"string\",\n form: \"string\",\n locale: \"string\",\n },\n properties: [\"format\", \"getAriaValueText\"],\n create: (props, host) =>\n createSlider(\n computed(() => {\n const own = props.get()\n return { ...own, value: read(own.value), defaultValue: read(own.defaultValue) }\n }),\n { field: fieldAround(host) }\n ),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValueCommitted: { event: \"value-committed\", prop: \"value\", hold: false },\n },\n parts: {\n root: (controller) => controller.root,\n value: (controller) => ({ part: controller.value, text: controller.text }),\n control: (controller) => controller.control,\n track: (controller) => controller.track,\n indicator: (controller) => controller.indicator,\n thumb: (controller, element) => ({\n part: controller.thumb(at(element)),\n inner: controller.thumbInput(at(element)),\n }),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-slider\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"value-committed\": [\"onValueCommitted\", \"value\"]\n }\n >\n }\n}\n"],"mappings":";;;;;;AASA,MAAM,QAAQ,UACZ,OAAO,UAAU,WACb,MAAM,SAAS,GAAG,IAChB,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,IAC3B,OAAO,KAAK,IACb;AAGP,MAAM,MAAM,YACV,QAAQ,aAAa,WAAW,IAAI,OAAO,QAAQ,aAAa,WAAW,CAAC,IAAI,SAAS,OAAO;;;;;;;;;AAelG,MAAa,MAAM,cAA6B;CAC9C,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,KAAK;EACL,KAAK;EACL,MAAM;EACN,cAAc;EACd,4BAA4B;EAC5B,mBAAmB;EACnB,aAAa;EACb,UAAU;EACV,aAAa;EACb,MAAM;EACN,MAAM;EACN,QAAQ;CACV;CACA,YAAY,CAAC,UAAU,kBAAkB;CACzC,SAAS,OAAO,SACd,aACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GAAE,GAAG;GAAK,OAAO,KAAK,IAAI,KAAK;GAAG,cAAc,KAAK,IAAI,YAAY;EAAE;CAChF,CAAC,GACD,EAAE,OAAO,YAAY,IAAI,EAAE,CAC7B;CACF,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,kBAAkB;GAAE,OAAO;GAAmB,MAAM;GAAS,MAAM;EAAM;CAC3E;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,gBAAgB;GAAE,MAAM,WAAW;GAAO,MAAM,WAAW;EAAK;EACxE,UAAU,eAAe,WAAW;EACpC,QAAQ,eAAe,WAAW;EAClC,YAAY,eAAe,WAAW;EACtC,QAAQ,YAAY,aAAa;GAC/B,MAAM,WAAW,MAAM,GAAG,OAAO,CAAC;GAClC,OAAO,WAAW,WAAW,GAAG,OAAO,CAAC;EAC1C;CACF;AACF,CAAC"}
package/src/tooltip.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ElementOf, Tag } from "./runtime.js";
2
+ import { Placed } from "./around.js";
2
3
  /**
3
4
  * `<kui-tooltip>` around a `kui-part="trigger"` and a `portal` with a `positioner` (its
4
5
  * `kui-side` and the like) around the `popup`, which may hold an `arrow`. `open`,
@@ -9,7 +10,7 @@ declare global {
9
10
  interface HTMLElementTagNameMap {
10
11
  "kui-tooltip": ElementOf<typeof tag, {
11
12
  "open-change": ["onOpenChange", "open"];
12
- }>;
13
+ }> & Placed;
13
14
  }
14
15
  }
15
16
  //# sourceMappingURL=tooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","names":[],"sources":["../../../../packages/web/src/tooltip.ts"],"sourcesContent":["import { createTooltip } from \"@kirana-ui/core/tooltip\"\n\nimport { hoverPopup } from \"./hover-popup.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\n/**\n * `<kui-tooltip>` around a `kui-part=\"trigger\"` and a `portal` with a `positioner` (its\n * `kui-side` and the like) around the `popup`, which may hold an `arrow`. `open`,\n * `default-open`, `delay`, `close-delay`, `disabled`; it tells `open-change`.\n */\nexport const tag = hoverPopup(\"kui-tooltip\", createTooltip)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-tooltip\": ElementOf<typeof tag, { \"open-change\": [\"onOpenChange\", \"open\"] }>\n }\n}\n"],"mappings":";;;;;;;;AAUA,MAAa,MAAM,WAAW,eAAe,aAAa"}
1
+ {"version":3,"file":"tooltip.js","names":[],"sources":["../../../../packages/web/src/tooltip.ts"],"sourcesContent":["import { createTooltip } from \"@kirana-ui/core/tooltip\"\n\nimport { hoverPopup } from \"./hover-popup.ts\"\nimport type { Placed } from \"./around.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\n/**\n * `<kui-tooltip>` around a `kui-part=\"trigger\"` and a `portal` with a `positioner` (its\n * `kui-side` and the like) around the `popup`, which may hold an `arrow`. `open`,\n * `default-open`, `delay`, `close-delay`, `disabled`; it tells `open-change`.\n */\nexport const tag = hoverPopup(\"kui-tooltip\", createTooltip)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-tooltip\": ElementOf<typeof tag, { \"open-change\": [\"onOpenChange\", \"open\"] }> & Placed\n }\n}\n"],"mappings":";;;;;;;;AAWA,MAAa,MAAM,WAAW,eAAe,aAAa"}