@kirana-ui/web 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +140 -0
- package/llms.txt +1598 -143
- package/package.json +48 -3
- package/skills/kirana-ui-primitives/SKILL.md +53 -12
- package/src/accordion.d.ts +1 -1
- package/src/accordion.js +2 -1
- package/src/accordion.js.map +1 -1
- package/src/alert-dialog.d.ts +2 -2
- package/src/alert-dialog.js +9 -4
- package/src/alert-dialog.js.map +1 -1
- package/src/around.d.ts +28 -4
- package/src/around.js +46 -13
- package/src/around.js.map +1 -1
- package/src/autocomplete.d.ts +7 -4
- package/src/autocomplete.js +8 -4
- package/src/autocomplete.js.map +1 -1
- package/src/avatar.d.ts +11 -5
- package/src/avatar.js +41 -12
- package/src/avatar.js.map +1 -1
- package/src/button.d.ts +2 -1
- package/src/button.js +2 -1
- package/src/button.js.map +1 -1
- package/src/calendar.d.ts +9 -5
- package/src/calendar.js +22 -9
- package/src/calendar.js.map +1 -1
- package/src/carousel.d.ts +1 -1
- package/src/carousel.js +4 -2
- package/src/carousel.js.map +1 -1
- package/src/checkbox-group.d.ts +22 -0
- package/src/checkbox-group.js +36 -0
- package/src/checkbox-group.js.map +1 -0
- package/src/checkbox.d.ts +4 -2
- package/src/checkbox.js +10 -4
- package/src/checkbox.js.map +1 -1
- package/src/color-picker.d.ts +28 -0
- package/src/color-picker.js +81 -0
- package/src/color-picker.js.map +1 -0
- package/src/combobox.d.ts +27 -7
- package/src/combobox.js +79 -17
- package/src/combobox.js.map +1 -1
- package/src/command.d.ts +3 -3
- package/src/command.js +6 -5
- package/src/command.js.map +1 -1
- package/src/context-menu.d.ts +2 -1
- package/src/context-menu.js.map +1 -1
- package/src/date-field.d.ts +2 -2
- package/src/date-field.js +3 -3
- package/src/date-field.js.map +1 -1
- package/src/date-picker.d.ts +14 -8
- package/src/date-picker.js +49 -10
- package/src/date-picker.js.map +1 -1
- package/src/dates.d.ts +11 -5
- package/src/dates.js +58 -20
- package/src/dates.js.map +1 -1
- package/src/dialog.d.ts +3 -2
- package/src/dialog.js +12 -4
- package/src/dialog.js.map +1 -1
- package/src/drawer.d.ts +2 -1
- package/src/drawer.js +7 -3
- package/src/drawer.js.map +1 -1
- package/src/editable.d.ts +21 -0
- package/src/editable.js +56 -0
- package/src/editable.js.map +1 -0
- package/src/file-upload.d.ts +23 -0
- package/src/file-upload.js +98 -0
- package/src/file-upload.js.map +1 -0
- package/src/hover-card.d.ts +2 -1
- package/src/hover-card.js.map +1 -1
- package/src/index.d.ts +29 -7
- package/src/index.js +11 -0
- package/src/menu.d.ts +4 -3
- package/src/menu.js +19 -10
- package/src/menu.js.map +1 -1
- package/src/menubar.d.ts +2 -2
- package/src/menubar.js +5 -3
- package/src/menubar.js.map +1 -1
- package/src/navigation-menu.d.ts +4 -3
- package/src/navigation-menu.js +10 -6
- package/src/navigation-menu.js.map +1 -1
- package/src/number-field.d.ts +5 -2
- package/src/number-field.js +23 -3
- package/src/number-field.js.map +1 -1
- package/src/otp.d.ts +4 -2
- package/src/otp.js +24 -4
- package/src/otp.js.map +1 -1
- package/src/password-input.d.ts +20 -0
- package/src/password-input.js +39 -0
- package/src/password-input.js.map +1 -0
- package/src/popover.d.ts +8 -7
- package/src/popover.js +33 -5
- package/src/popover.js.map +1 -1
- package/src/radio-group.d.ts +2 -1
- package/src/radio-group.js +9 -2
- package/src/radio-group.js.map +1 -1
- package/src/rating.d.ts +18 -0
- package/src/rating.js +54 -0
- package/src/rating.js.map +1 -0
- package/src/runtime.d.ts +9 -4
- package/src/runtime.js +8 -5
- package/src/runtime.js.map +1 -1
- package/src/select.d.ts +12 -4
- package/src/select.js +33 -10
- package/src/select.js.map +1 -1
- package/src/slider.d.ts +2 -2
- package/src/slider.js +3 -2
- package/src/slider.js.map +1 -1
- package/src/steps.d.ts +17 -0
- package/src/steps.js +47 -0
- package/src/steps.js.map +1 -0
- package/src/tags-input.d.ts +35 -0
- package/src/tags-input.js +96 -0
- package/src/tags-input.js.map +1 -0
- package/src/time-field.d.ts +18 -0
- package/src/time-field.js +54 -0
- package/src/time-field.js.map +1 -0
- package/src/toast.d.ts +4 -3
- package/src/toast.js +6 -4
- package/src/toast.js.map +1 -1
- package/src/toggle-group.d.ts +1 -1
- package/src/toggle-group.js +2 -1
- package/src/toggle-group.js.map +1 -1
- package/src/toolbar.d.ts +0 -6
- package/src/toolbar.js +14 -3
- package/src/toolbar.js.map +1 -1
- package/src/tooltip.d.ts +2 -1
- package/src/tooltip.js.map +1 -1
- package/src/tour.d.ts +27 -0
- package/src/tour.js +62 -0
- package/src/tour.js.map +1 -0
- package/src/tree.d.ts +29 -0
- package/src/tree.js +99 -0
- package/src/tree.js.map +1 -0
package/src/avatar.d.ts
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import { ElementOf, Tag } from "./runtime.js";
|
|
2
|
-
import { Avatar } from "@kirana-ui/core/avatar";
|
|
2
|
+
import { Avatar, AvatarImageProps } from "@kirana-ui/core/avatar";
|
|
3
3
|
/**
|
|
4
4
|
* `<kui-avatar>` around `kui-part="root"`, an `image` (an `<img>`, in the page once the
|
|
5
|
-
* picture has loaded) and a `fallback`, in the page until then
|
|
6
|
-
*
|
|
5
|
+
* picture has loaded) and a `fallback`, in the page until then; `kui-delay="600"` on the
|
|
6
|
+
* fallback waits that many milliseconds first. `src`: the picture's address, on the component,
|
|
7
|
+
* since the image is not in the page to be given one. With `kui-keep-mounted` the image stays
|
|
8
|
+
* in the page, as Base UI's `keepMounted` image: its own `src` is the address, it loads the
|
|
9
|
+
* picture itself, and it is `aria-hidden` until it has (`data-loading`, `data-error`). It
|
|
10
|
+
* tells `loading-status-change` (`detail.status`) as the picture loads.
|
|
7
11
|
*/
|
|
8
12
|
export declare const tag: Tag<{
|
|
9
13
|
id: string;
|
|
10
14
|
src?: string;
|
|
11
|
-
}, Avatar & {
|
|
15
|
+
} & AvatarImageProps, Avatar & {
|
|
12
16
|
mount(): () => void;
|
|
13
17
|
}>;
|
|
14
18
|
declare global {
|
|
15
19
|
interface HTMLElementTagNameMap {
|
|
16
|
-
"kui-avatar": ElementOf<typeof tag
|
|
20
|
+
"kui-avatar": ElementOf<typeof tag, {
|
|
21
|
+
"loading-status-change": ["onLoadingStatusChange", "status"];
|
|
22
|
+
}>;
|
|
17
23
|
}
|
|
18
24
|
}
|
|
19
25
|
//# sourceMappingURL=avatar.d.ts.map
|
package/src/avatar.js
CHANGED
|
@@ -1,36 +1,65 @@
|
|
|
1
1
|
import { defineElement } from "./runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { effect } from "@kirana-ui/core";
|
|
3
3
|
import { createAvatar } from "@kirana-ui/core/avatar";
|
|
4
4
|
// src/avatar.ts
|
|
5
|
+
const fallbacks = /* @__PURE__ */ new WeakMap();
|
|
5
6
|
/**
|
|
6
7
|
* `<kui-avatar>` around `kui-part="root"`, an `image` (an `<img>`, in the page once the
|
|
7
|
-
* picture has loaded) and a `fallback`, in the page until then
|
|
8
|
-
*
|
|
8
|
+
* picture has loaded) and a `fallback`, in the page until then; `kui-delay="600"` on the
|
|
9
|
+
* fallback waits that many milliseconds first. `src`: the picture's address, on the component,
|
|
10
|
+
* since the image is not in the page to be given one. With `kui-keep-mounted` the image stays
|
|
11
|
+
* in the page, as Base UI's `keepMounted` image: its own `src` is the address, it loads the
|
|
12
|
+
* picture itself, and it is `aria-hidden` until it has (`data-loading`, `data-error`). It
|
|
13
|
+
* tells `loading-status-change` (`detail.status`) as the picture loads.
|
|
9
14
|
*/
|
|
10
15
|
const tag = defineElement({
|
|
11
16
|
tag: "kui-avatar",
|
|
12
17
|
props: { src: "string" },
|
|
13
18
|
create(props) {
|
|
14
19
|
const avatar = createAvatar(props);
|
|
20
|
+
const report = avatar.statusReport(() => props.peek().onLoadingStatusChange);
|
|
15
21
|
return {
|
|
16
22
|
...avatar,
|
|
17
23
|
mount() {
|
|
18
|
-
|
|
24
|
+
let given = false;
|
|
25
|
+
const stops = [
|
|
26
|
+
effect(() => {
|
|
27
|
+
const { src } = props.get();
|
|
28
|
+
if (src === void 0 && !given) return;
|
|
29
|
+
given = src !== void 0;
|
|
30
|
+
avatar.source.set(src);
|
|
31
|
+
}),
|
|
32
|
+
avatar.mount(),
|
|
33
|
+
report.mount()
|
|
34
|
+
];
|
|
19
35
|
return () => stops.forEach((stop) => stop());
|
|
20
36
|
}
|
|
21
37
|
};
|
|
22
38
|
},
|
|
23
|
-
changes: {
|
|
39
|
+
changes: { onLoadingStatusChange: {
|
|
40
|
+
event: "loading-status-change",
|
|
41
|
+
prop: "status",
|
|
42
|
+
hold: false
|
|
43
|
+
} },
|
|
24
44
|
parts: {
|
|
25
45
|
root: (controller) => controller.root,
|
|
26
|
-
image: (controller) => ({
|
|
46
|
+
image: (controller, element) => element.hasAttribute("kui-keep-mounted") ? controller.keptImage : {
|
|
27
47
|
part: controller.image,
|
|
28
|
-
mounted:
|
|
29
|
-
}
|
|
30
|
-
fallback
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
48
|
+
mounted: controller.imageMounted
|
|
49
|
+
},
|
|
50
|
+
fallback(controller, element) {
|
|
51
|
+
let presence = fallbacks.get(element);
|
|
52
|
+
if (!presence) {
|
|
53
|
+
const delay = Number(element.getAttribute("kui-delay")) || 0;
|
|
54
|
+
presence = controller.fallbackPresence({ delay });
|
|
55
|
+
fallbacks.set(element, presence);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
part: controller.fallback,
|
|
59
|
+
mounted: presence.shown,
|
|
60
|
+
mount: presence.mount
|
|
61
|
+
};
|
|
62
|
+
}
|
|
34
63
|
}
|
|
35
64
|
});
|
|
36
65
|
export { tag };
|
package/src/avatar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","names":[],"sources":["../../../../packages/web/src/avatar.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"avatar.js","names":[],"sources":["../../../../packages/web/src/avatar.ts"],"sourcesContent":["import { effect } from \"@kirana-ui/core\"\nimport { createAvatar } from \"@kirana-ui/core/avatar\"\nimport type { Avatar, AvatarFallbackPresence, AvatarImageProps } from \"@kirana-ui/core/avatar\"\n\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\n// One presence per fallback element: its delay is counted once.\nconst fallbacks = new WeakMap<HTMLElement, AvatarFallbackPresence>()\n\n/**\n * `<kui-avatar>` around `kui-part=\"root\"`, an `image` (an `<img>`, in the page once the\n * picture has loaded) and a `fallback`, in the page until then; `kui-delay=\"600\"` on the\n * fallback waits that many milliseconds first. `src`: the picture's address, on the component,\n * since the image is not in the page to be given one. With `kui-keep-mounted` the image stays\n * in the page, as Base UI's `keepMounted` image: its own `src` is the address, it loads the\n * picture itself, and it is `aria-hidden` until it has (`data-loading`, `data-error`). It\n * tells `loading-status-change` (`detail.status`) as the picture loads.\n */\nexport const tag = defineElement<\n { id: string; src?: string } & AvatarImageProps,\n Avatar & { mount(): () => void }\n>({\n tag: \"kui-avatar\",\n props: { src: \"string\" },\n create(props) {\n const avatar = createAvatar(props)\n const report = avatar.statusReport(() => props.peek().onLoadingStatusChange)\n return {\n ...avatar,\n mount() {\n // An image kept in the page says its own address: a component given none leaves it.\n let given = false\n const stops = [\n effect(() => {\n const { src } = props.get()\n if (src === undefined && !given) return\n given = src !== undefined\n avatar.source.set(src)\n }),\n avatar.mount(),\n report.mount(),\n ]\n return () => stops.forEach((stop) => stop())\n },\n }\n },\n changes: {\n onLoadingStatusChange: { event: \"loading-status-change\", prop: \"status\", hold: false },\n },\n parts: {\n root: (controller) => controller.root,\n image: (controller, element) =>\n element.hasAttribute(\"kui-keep-mounted\")\n ? controller.keptImage\n : { part: controller.image, mounted: controller.imageMounted },\n fallback(controller, element) {\n let presence = fallbacks.get(element)\n if (!presence) {\n const delay = Number(element.getAttribute(\"kui-delay\")) || 0\n presence = controller.fallbackPresence({ delay })\n fallbacks.set(element, presence)\n }\n return { part: controller.fallback, mounted: presence.shown, mount: presence.mount }\n },\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-avatar\": ElementOf<\n typeof tag,\n { \"loading-status-change\": [\"onLoadingStatusChange\", \"status\"] }\n >\n }\n}\n"],"mappings":";;;;AAQA,MAAM,4BAAY,IAAI,QAA6C;;;;;;;;;;AAWnE,MAAa,MAAM,cAGjB;CACA,KAAK;CACL,OAAO,EAAE,KAAK,SAAS;CACvB,OAAO,OAAO;EACZ,MAAM,SAAS,aAAa,KAAK;EACjC,MAAM,SAAS,OAAO,mBAAmB,MAAM,KAAK,CAAC,CAAC,qBAAqB;EAC3E,OAAO;GACL,GAAG;GACH,QAAQ;IAEN,IAAI,QAAQ;IACZ,MAAM,QAAQ;KACZ,aAAa;MACX,MAAM,EAAE,QAAQ,MAAM,IAAI;MAC1B,IAAI,QAAQ,KAAA,KAAa,CAAC,OAAO;MACjC,QAAQ,QAAQ,KAAA;MAChB,OAAO,OAAO,IAAI,GAAG;KACvB,CAAC;KACD,OAAO,MAAM;KACb,OAAO,MAAM;IACf;IACA,aAAa,MAAM,SAAS,SAAS,KAAK,CAAC;GAC7C;EACF;CACF;CACA,SAAS,EACP,uBAAuB;EAAE,OAAO;EAAyB,MAAM;EAAU,MAAM;CAAM,EACvF;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,YAAY,YAClB,QAAQ,aAAa,kBAAkB,IACnC,WAAW,YACX;GAAE,MAAM,WAAW;GAAO,SAAS,WAAW;EAAa;EACjE,SAAS,YAAY,SAAS;GAC5B,IAAI,WAAW,UAAU,IAAI,OAAO;GACpC,IAAI,CAAC,UAAU;IACb,MAAM,QAAQ,OAAO,QAAQ,aAAa,WAAW,CAAC,KAAK;IAC3D,WAAW,WAAW,iBAAiB,EAAE,MAAM,CAAC;IAChD,UAAU,IAAI,SAAS,QAAQ;GACjC;GACA,OAAO;IAAE,MAAM,WAAW;IAAU,SAAS,SAAS;IAAO,OAAO,SAAS;GAAM;EACrF;CACF;AACF,CAAC"}
|
package/src/button.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { As, ElementOf, Tag } from "./runtime.js";
|
|
|
2
2
|
import { ButtonProps } from "@kirana-ui/core/button";
|
|
3
3
|
/**
|
|
4
4
|
* `<kui-button>` around a `kui-part="root"` button, or with `native-button="false"` another
|
|
5
|
-
* element that acts as one. `disabled`,
|
|
5
|
+
* element that acts as one; on a link that navigates (`<a href>`), it stays a link. `disabled`,
|
|
6
|
+
* `focusable-when-disabled`, `native-button`.
|
|
6
7
|
*/
|
|
7
8
|
export declare const tag: Tag<{
|
|
8
9
|
id: string;
|
package/src/button.js
CHANGED
|
@@ -3,7 +3,8 @@ import { createButton } from "@kirana-ui/core/button";
|
|
|
3
3
|
// src/button.ts
|
|
4
4
|
/**
|
|
5
5
|
* `<kui-button>` around a `kui-part="root"` button, or with `native-button="false"` another
|
|
6
|
-
* element that acts as one. `disabled`,
|
|
6
|
+
* element that acts as one; on a link that navigates (`<a href>`), it stays a link. `disabled`,
|
|
7
|
+
* `focusable-when-disabled`, `native-button`.
|
|
7
8
|
*/
|
|
8
9
|
const tag = defineElement({
|
|
9
10
|
tag: "kui-button",
|
package/src/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":[],"sources":["../../../../packages/web/src/button.ts"],"sourcesContent":["import { createButton } from \"@kirana-ui/core/button\"\nimport type { ButtonProps } from \"@kirana-ui/core/button\"\n\nimport { defineElement } from \"./runtime.ts\"\nimport type { As, ElementOf } from \"./runtime.ts\"\n\n/**\n * `<kui-button>` around a `kui-part=\"root\"` button, or with `native-button=\"false\"` another\n * element that acts as one. `disabled
|
|
1
|
+
{"version":3,"file":"button.js","names":[],"sources":["../../../../packages/web/src/button.ts"],"sourcesContent":["import { createButton } from \"@kirana-ui/core/button\"\nimport type { ButtonProps } from \"@kirana-ui/core/button\"\n\nimport { defineElement } from \"./runtime.ts\"\nimport type { As, ElementOf } from \"./runtime.ts\"\n\n/**\n * `<kui-button>` around a `kui-part=\"root\"` button, or with `native-button=\"false\"` another\n * element that acts as one; on a link that navigates (`<a href>`), it stays a link. `disabled`,\n * `focusable-when-disabled`, `native-button`.\n */\nexport const tag = defineElement({\n tag: \"kui-button\",\n props: { disabled: \"boolean\", \"focusable-when-disabled\": \"boolean\", \"native-button\": \"boolean\" },\n create: (props) => createButton(props as never),\n changes: {},\n parts: { root: (controller) => controller.root },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-button\": ElementOf<As<typeof tag, ButtonProps>>\n }\n}\n"],"mappings":";;;;;;;;AAWA,MAAa,MAAM,cAAc;CAC/B,KAAK;CACL,OAAO;EAAE,UAAU;EAAW,2BAA2B;EAAW,iBAAiB;CAAU;CAC/F,SAAS,UAAU,aAAa,KAAc;CAC9C,SAAS,CAAC;CACV,OAAO,EAAE,OAAO,eAAe,WAAW,KAAK;AACjD,CAAC"}
|
package/src/calendar.d.ts
CHANGED
|
@@ -5,12 +5,16 @@ import { Calendar, CalendarProps } from "@kirana-ui/core/calendar";
|
|
|
5
5
|
* (it says the month) and a `grid` table. The table's head row holds a
|
|
6
6
|
* `<template kui-each="weekdays">` with a `head-cell` (`{short}`, `{narrow}`, `{long}`); its
|
|
7
7
|
* body a `<template kui-each="weeks">` with a row, which holds a `<template kui-each="days">`
|
|
8
|
-
* with a `cell` and its `day` button (`{date}`, `{label}`).
|
|
9
|
-
*
|
|
10
|
-
* `
|
|
11
|
-
* `
|
|
8
|
+
* with a `cell` and its `day` button (`{date}`, `{label}`). With several `months`, a
|
|
9
|
+
* `<template kui-each="months">` (`{index}`, `{month}`, `{title}`) holds each month's
|
|
10
|
+
* `heading` and `grid`. An `<input kui-part="input">` submits the value under `name`.
|
|
11
|
+
* `value` and `default-value` (a day as `2026-03-14`; a range's first and last, or a list's
|
|
12
|
+
* days, with commas between), `mode`, `required`, `min-days`, `max-days`, `months`, `paged-navigation`,
|
|
13
|
+
* `month`, `default-month`, `default-focused-value`, `locale`, `calendar-system`, `min`,
|
|
14
|
+
* `max`, `disabled`, `read-only`, `fixed-weeks`, `name`, `form`; `isDateUnavailable` as a
|
|
15
|
+
* property; it tells `value-change` and `month-change`.
|
|
12
16
|
*/
|
|
13
|
-
export declare const tag: Tag<CalendarProps
|
|
17
|
+
export declare const tag: Tag<CalendarProps<import("@kirana-ui/core/calendar").CalendarMode>, Calendar>;
|
|
14
18
|
declare global {
|
|
15
19
|
interface HTMLElementTagNameMap {
|
|
16
20
|
"kui-calendar": ElementOf<typeof tag, {
|
package/src/calendar.js
CHANGED
|
@@ -9,10 +9,14 @@ const { parts, lists } = calendarParts((controller) => controller);
|
|
|
9
9
|
* (it says the month) and a `grid` table. The table's head row holds a
|
|
10
10
|
* `<template kui-each="weekdays">` with a `head-cell` (`{short}`, `{narrow}`, `{long}`); its
|
|
11
11
|
* body a `<template kui-each="weeks">` with a row, which holds a `<template kui-each="days">`
|
|
12
|
-
* with a `cell` and its `day` button (`{date}`, `{label}`).
|
|
13
|
-
*
|
|
14
|
-
* `
|
|
15
|
-
* `
|
|
12
|
+
* with a `cell` and its `day` button (`{date}`, `{label}`). With several `months`, a
|
|
13
|
+
* `<template kui-each="months">` (`{index}`, `{month}`, `{title}`) holds each month's
|
|
14
|
+
* `heading` and `grid`. An `<input kui-part="input">` submits the value under `name`.
|
|
15
|
+
* `value` and `default-value` (a day as `2026-03-14`; a range's first and last, or a list's
|
|
16
|
+
* days, with commas between), `mode`, `required`, `min-days`, `max-days`, `months`, `paged-navigation`,
|
|
17
|
+
* `month`, `default-month`, `default-focused-value`, `locale`, `calendar-system`, `min`,
|
|
18
|
+
* `max`, `disabled`, `read-only`, `fixed-weeks`, `name`, `form`; `isDateUnavailable` as a
|
|
19
|
+
* property; it tells `value-change` and `month-change`.
|
|
16
20
|
*/
|
|
17
21
|
const tag = defineElement({
|
|
18
22
|
tag: "kui-calendar",
|
|
@@ -20,6 +24,13 @@ const tag = defineElement({
|
|
|
20
24
|
value: "string",
|
|
21
25
|
"default-value": "string",
|
|
22
26
|
mode: "string",
|
|
27
|
+
required: "boolean",
|
|
28
|
+
"min-days": "number",
|
|
29
|
+
"max-days": "number",
|
|
30
|
+
months: "number",
|
|
31
|
+
"paged-navigation": "boolean",
|
|
32
|
+
month: "string",
|
|
33
|
+
"default-month": "string",
|
|
23
34
|
"default-focused-value": "string",
|
|
24
35
|
locale: "string",
|
|
25
36
|
"calendar-system": "string",
|
|
@@ -27,15 +38,17 @@ const tag = defineElement({
|
|
|
27
38
|
max: "string",
|
|
28
39
|
disabled: "boolean",
|
|
29
40
|
"read-only": "boolean",
|
|
30
|
-
"fixed-weeks": "boolean"
|
|
41
|
+
"fixed-weeks": "boolean",
|
|
42
|
+
name: "string",
|
|
43
|
+
form: "string"
|
|
31
44
|
},
|
|
32
45
|
properties: ["isDateUnavailable"],
|
|
33
46
|
create: (props) => createCalendar(computed(() => {
|
|
34
47
|
const own = props.get();
|
|
35
48
|
return {
|
|
36
49
|
...own,
|
|
37
|
-
value: days(own.value),
|
|
38
|
-
defaultValue: days(own.defaultValue)
|
|
50
|
+
value: days(own.value, own.mode),
|
|
51
|
+
defaultValue: days(own.defaultValue, own.mode)
|
|
39
52
|
};
|
|
40
53
|
})),
|
|
41
54
|
changes: {
|
|
@@ -45,13 +58,13 @@ const tag = defineElement({
|
|
|
45
58
|
},
|
|
46
59
|
onMonthChange: {
|
|
47
60
|
event: "month-change",
|
|
48
|
-
prop: "month"
|
|
49
|
-
hold: false
|
|
61
|
+
prop: "month"
|
|
50
62
|
}
|
|
51
63
|
},
|
|
52
64
|
lists,
|
|
53
65
|
parts: {
|
|
54
66
|
root: (controller) => controller.root,
|
|
67
|
+
input: (controller) => controller.input,
|
|
55
68
|
...parts
|
|
56
69
|
}
|
|
57
70
|
});
|
package/src/calendar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","names":[],"sources":["../../../../packages/web/src/calendar.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createCalendar } from \"@kirana-ui/core/calendar\"\nimport type { Calendar, CalendarProps } from \"@kirana-ui/core/calendar\"\n\nimport { calendarParts, days } from \"./dates.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst { parts, lists } = calendarParts<Calendar>((controller) => controller)\n\n/**\n * `<kui-calendar>` around `kui-part=\"root\"`, with `previous` and `next` buttons, a `heading`\n * (it says the month) and a `grid` table. The table's head row holds a\n * `<template kui-each=\"weekdays\">` with a `head-cell` (`{short}`, `{narrow}`, `{long}`); its\n * body a `<template kui-each=\"weeks\">` with a row, which holds a `<template kui-each=\"days\">`\n * with a `cell` and its `day` button (`{date}`, `{label}`). `value` and `default-value` (a
|
|
1
|
+
{"version":3,"file":"calendar.js","names":[],"sources":["../../../../packages/web/src/calendar.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createCalendar } from \"@kirana-ui/core/calendar\"\nimport type { Calendar, CalendarProps } from \"@kirana-ui/core/calendar\"\n\nimport { calendarParts, days } from \"./dates.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst { parts, lists } = calendarParts<Calendar>((controller) => controller)\n\n/**\n * `<kui-calendar>` around `kui-part=\"root\"`, with `previous` and `next` buttons, a `heading`\n * (it says the month) and a `grid` table. The table's head row holds a\n * `<template kui-each=\"weekdays\">` with a `head-cell` (`{short}`, `{narrow}`, `{long}`); its\n * body a `<template kui-each=\"weeks\">` with a row, which holds a `<template kui-each=\"days\">`\n * with a `cell` and its `day` button (`{date}`, `{label}`). With several `months`, a\n * `<template kui-each=\"months\">` (`{index}`, `{month}`, `{title}`) holds each month's\n * `heading` and `grid`. An `<input kui-part=\"input\">` submits the value under `name`.\n * `value` and `default-value` (a day as `2026-03-14`; a range's first and last, or a list's\n * days, with commas between), `mode`, `required`, `min-days`, `max-days`, `months`, `paged-navigation`,\n * `month`, `default-month`, `default-focused-value`, `locale`, `calendar-system`, `min`,\n * `max`, `disabled`, `read-only`, `fixed-weeks`, `name`, `form`; `isDateUnavailable` as a\n * property; it tells `value-change` and `month-change`.\n */\nexport const tag = defineElement<CalendarProps, Calendar>({\n tag: \"kui-calendar\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n mode: \"string\",\n required: \"boolean\",\n \"min-days\": \"number\",\n \"max-days\": \"number\",\n months: \"number\",\n \"paged-navigation\": \"boolean\",\n month: \"string\",\n \"default-month\": \"string\",\n \"default-focused-value\": \"string\",\n locale: \"string\",\n \"calendar-system\": \"string\",\n min: \"string\",\n max: \"string\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n \"fixed-weeks\": \"boolean\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"isDateUnavailable\"],\n create: (props) =>\n createCalendar(\n computed(() => {\n const own = props.get()\n return {\n ...own,\n value: days(own.value, own.mode),\n defaultValue: days(own.defaultValue, own.mode),\n } as CalendarProps\n })\n ),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onMonthChange: { event: \"month-change\", prop: \"month\" },\n },\n lists,\n parts: {\n root: (controller) => controller.root,\n input: (controller) => controller.input,\n ...parts,\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-calendar\": ElementOf<\n typeof tag,\n { \"value-change\": [\"onValueChange\", \"value\"]; \"month-change\": [\"onMonthChange\", \"month\"] }\n >\n }\n}\n"],"mappings":";;;;;AAQA,MAAM,EAAE,OAAO,UAAU,eAAyB,eAAe,UAAU;;;;;;;;;;;;;;;AAgB3E,MAAa,MAAM,cAAuC;CACxD,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,MAAM;EACN,UAAU;EACV,YAAY;EACZ,YAAY;EACZ,QAAQ;EACR,oBAAoB;EACpB,OAAO;EACP,iBAAiB;EACjB,yBAAyB;EACzB,QAAQ;EACR,mBAAmB;EACnB,KAAK;EACL,KAAK;EACL,UAAU;EACV,aAAa;EACb,eAAe;EACf,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,mBAAmB;CAChC,SAAS,UACP,eACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GACL,GAAG;GACH,OAAO,KAAK,IAAI,OAAO,IAAI,IAAI;GAC/B,cAAc,KAAK,IAAI,cAAc,IAAI,IAAI;EAC/C;CACF,CAAC,CACH;CACF,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;CACxD;CACA;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,eAAe,WAAW;EAClC,GAAG;CACL;AACF,CAAC"}
|
package/src/carousel.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ElementOf, Tag } from "./runtime.js";
|
|
|
2
2
|
import { Carousel, CarouselProps } from "@kirana-ui/core/carousel";
|
|
3
3
|
/**
|
|
4
4
|
* `<kui-carousel>` around `kui-part="root"`, a `viewport` with an `item` for each slide
|
|
5
|
-
* (`kui-index`, from 0), `previous` and `next` buttons, and an `indicator` button for a slide
|
|
5
|
+
* (`kui-index`, from 0, or its place in the page when it has none), `previous` and `next` buttons, and an `indicator` button for a slide
|
|
6
6
|
* (`kui-index`). `index`, `default-index`, `orientation`, `loop`; it tells `index-change`.
|
|
7
7
|
*/
|
|
8
8
|
export declare const tag: Tag<CarouselProps, Carousel>;
|
package/src/carousel.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { once } from "./around.js";
|
|
1
2
|
import { defineElement } from "./runtime.js";
|
|
2
3
|
import { createCarousel } from "@kirana-ui/core/carousel";
|
|
3
4
|
// src/carousel.ts
|
|
4
5
|
const indexOf = (element) => Number(element.getAttribute("kui-index") ?? 0);
|
|
6
|
+
const slides = /* @__PURE__ */ new WeakMap();
|
|
5
7
|
/**
|
|
6
8
|
* `<kui-carousel>` around `kui-part="root"`, a `viewport` with an `item` for each slide
|
|
7
|
-
* (`kui-index`, from 0), `previous` and `next` buttons, and an `indicator` button for a slide
|
|
9
|
+
* (`kui-index`, from 0, or its place in the page when it has none), `previous` and `next` buttons, and an `indicator` button for a slide
|
|
8
10
|
* (`kui-index`). `index`, `default-index`, `orientation`, `loop`; it tells `index-change`.
|
|
9
11
|
*/
|
|
10
12
|
const tag = defineElement({
|
|
@@ -23,7 +25,7 @@ const tag = defineElement({
|
|
|
23
25
|
parts: {
|
|
24
26
|
root: (controller) => controller.root,
|
|
25
27
|
viewport: (controller) => controller.viewport,
|
|
26
|
-
item: (controller, element) => controller.item(indexOf(element)),
|
|
28
|
+
item: (controller, element) => once(slides, element, () => controller.item(element.hasAttribute("kui-index") ? indexOf(element) : void 0)),
|
|
27
29
|
previous: (controller) => controller.previous,
|
|
28
30
|
next: (controller) => controller.next,
|
|
29
31
|
indicator: (controller, element) => controller.indicator(indexOf(element))
|
package/src/carousel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","names":[],"sources":["../../../../packages/web/src/carousel.ts"],"sourcesContent":["import { createCarousel } from \"@kirana-ui/core/carousel\"\nimport type { Carousel, CarouselProps } from \"@kirana-ui/core/carousel\"\n\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst indexOf = (element: HTMLElement) => Number(element.getAttribute(\"kui-index\") ?? 0)\n\n/**\n * `<kui-carousel>` around `kui-part=\"root\"`, a `viewport` with an `item` for each slide\n * (`kui-index`, from 0), `previous` and `next` buttons, and an `indicator` button for a slide\n * (`kui-index`). `index`, `default-index`, `orientation`, `loop`; it tells `index-change`.\n */\nexport const tag = defineElement<CarouselProps, Carousel>({\n tag: \"kui-carousel\",\n props: { index: \"number\", \"default-index\": \"number\", orientation: \"string\", loop: \"boolean\" },\n create: (props) => createCarousel(props),\n changes: { onIndexChange: { event: \"index-change\", prop: \"index\" } },\n parts: {\n root: (controller) => controller.root,\n viewport: (controller) => controller.viewport,\n item: (controller, element)
|
|
1
|
+
{"version":3,"file":"carousel.js","names":[],"sources":["../../../../packages/web/src/carousel.ts"],"sourcesContent":["import type { Part } from \"@kirana-ui/core\"\nimport { createCarousel } from \"@kirana-ui/core/carousel\"\nimport type { Carousel, CarouselProps } from \"@kirana-ui/core/carousel\"\n\nimport { once } from \"./around.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst indexOf = (element: HTMLElement) => Number(element.getAttribute(\"kui-index\") ?? 0)\nconst slides = new WeakMap<HTMLElement, Part>()\n\n/**\n * `<kui-carousel>` around `kui-part=\"root\"`, a `viewport` with an `item` for each slide\n * (`kui-index`, from 0, or its place in the page when it has none), `previous` and `next` buttons, and an `indicator` button for a slide\n * (`kui-index`). `index`, `default-index`, `orientation`, `loop`; it tells `index-change`.\n */\nexport const tag = defineElement<CarouselProps, Carousel>({\n tag: \"kui-carousel\",\n props: { index: \"number\", \"default-index\": \"number\", orientation: \"string\", loop: \"boolean\" },\n create: (props) => createCarousel(props),\n changes: { onIndexChange: { event: \"index-change\", prop: \"index\" } },\n parts: {\n root: (controller) => controller.root,\n viewport: (controller) => controller.viewport,\n // A slide with no `kui-index` is counted from the page, and made once for its element.\n item: (controller, element) =>\n once(slides, element, () =>\n controller.item(element.hasAttribute(\"kui-index\") ? indexOf(element) : undefined)\n ),\n previous: (controller) => controller.previous,\n next: (controller) => controller.next,\n indicator: (controller, element) => controller.indicator(indexOf(element)),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-carousel\": ElementOf<typeof tag, { \"index-change\": [\"onIndexChange\", \"index\"] }>\n }\n}\n"],"mappings":";;;;AAQA,MAAM,WAAW,YAAyB,OAAO,QAAQ,aAAa,WAAW,KAAK,CAAC;AACvF,MAAM,yBAAS,IAAI,QAA2B;;;;;;AAO9C,MAAa,MAAM,cAAuC;CACxD,KAAK;CACL,OAAO;EAAE,OAAO;EAAU,iBAAiB;EAAU,aAAa;EAAU,MAAM;CAAU;CAC5F,SAAS,UAAU,eAAe,KAAK;CACvC,SAAS,EAAE,eAAe;EAAE,OAAO;EAAgB,MAAM;CAAQ,EAAE;CACnE,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,WAAW,eAAe,WAAW;EAErC,OAAO,YAAY,YACjB,KAAK,QAAQ,eACX,WAAW,KAAK,QAAQ,aAAa,WAAW,IAAI,QAAQ,OAAO,IAAI,KAAA,CAAS,CAClF;EACF,WAAW,eAAe,WAAW;EACrC,OAAO,eAAe,WAAW;EACjC,YAAY,YAAY,YAAY,WAAW,UAAU,QAAQ,OAAO,CAAC;CAC3E;AACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ElementOf, Tag } from "./runtime.js";
|
|
2
|
+
import { CheckboxGroup, CheckboxGroupProps } from "@kirana-ui/core/checkbox-group";
|
|
3
|
+
type Props = Omit<CheckboxGroupProps, "value" | "defaultValue" | "allValues"> & {
|
|
4
|
+
value?: string | readonly string[];
|
|
5
|
+
defaultValue?: string | readonly string[];
|
|
6
|
+
allValues?: string | readonly string[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* `<kui-checkbox-group>` around `kui-part="root"` and its `<kui-checkbox>`es, each with a
|
|
10
|
+
* `value`; one marked `parent` stands for every value of `all-values`. `value`,
|
|
11
|
+
* `default-value` and `all-values` (with commas between), `disabled`; it tells `value-change`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const tag: Tag<Props, CheckboxGroup>;
|
|
14
|
+
declare global {
|
|
15
|
+
interface HTMLElementTagNameMap {
|
|
16
|
+
"kui-checkbox-group": ElementOf<typeof tag, {
|
|
17
|
+
"value-change": ["onValueChange", "value"];
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=checkbox-group.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { fieldAround, list } from "./around.js";
|
|
2
|
+
import { defineElement } from "./runtime.js";
|
|
3
|
+
import { computed } from "@kirana-ui/core";
|
|
4
|
+
import { createCheckboxGroup } from "@kirana-ui/core/checkbox-group";
|
|
5
|
+
// src/checkbox-group.ts
|
|
6
|
+
/**
|
|
7
|
+
* `<kui-checkbox-group>` around `kui-part="root"` and its `<kui-checkbox>`es, each with a
|
|
8
|
+
* `value`; one marked `parent` stands for every value of `all-values`. `value`,
|
|
9
|
+
* `default-value` and `all-values` (with commas between), `disabled`; it tells `value-change`.
|
|
10
|
+
*/
|
|
11
|
+
const tag = defineElement({
|
|
12
|
+
tag: "kui-checkbox-group",
|
|
13
|
+
props: {
|
|
14
|
+
value: "string",
|
|
15
|
+
"default-value": "string",
|
|
16
|
+
"all-values": "string",
|
|
17
|
+
disabled: "boolean"
|
|
18
|
+
},
|
|
19
|
+
create: (props, host) => createCheckboxGroup(computed(() => {
|
|
20
|
+
const own = props.get();
|
|
21
|
+
return {
|
|
22
|
+
...own,
|
|
23
|
+
value: list(own.value),
|
|
24
|
+
defaultValue: list(own.defaultValue),
|
|
25
|
+
allValues: list(own.allValues)
|
|
26
|
+
};
|
|
27
|
+
}), { field: fieldAround(host) }),
|
|
28
|
+
changes: { onValueChange: {
|
|
29
|
+
event: "value-change",
|
|
30
|
+
prop: "value"
|
|
31
|
+
} },
|
|
32
|
+
parts: { root: (controller) => controller.root }
|
|
33
|
+
});
|
|
34
|
+
export { tag };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=checkbox-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-group.js","names":[],"sources":["../../../../packages/web/src/checkbox-group.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createCheckboxGroup } from \"@kirana-ui/core/checkbox-group\"\nimport type { CheckboxGroup, CheckboxGroupProps } from \"@kirana-ui/core/checkbox-group\"\n\nimport { fieldAround, list } from \"./around.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\ntype Props = Omit<CheckboxGroupProps, \"value\" | \"defaultValue\" | \"allValues\"> & {\n value?: string | readonly string[]\n defaultValue?: string | readonly string[]\n allValues?: string | readonly string[]\n}\n\n/**\n * `<kui-checkbox-group>` around `kui-part=\"root\"` and its `<kui-checkbox>`es, each with a\n * `value`; one marked `parent` stands for every value of `all-values`. `value`,\n * `default-value` and `all-values` (with commas between), `disabled`; it tells `value-change`.\n */\nexport const tag = defineElement<Props, CheckboxGroup>({\n tag: \"kui-checkbox-group\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n \"all-values\": \"string\",\n disabled: \"boolean\",\n },\n create: (props, host) =>\n createCheckboxGroup(\n computed(() => {\n const own = props.get()\n return {\n ...own,\n value: list(own.value),\n defaultValue: list(own.defaultValue),\n allValues: list(own.allValues),\n }\n }),\n { field: fieldAround(host) }\n ),\n changes: { onValueChange: { event: \"value-change\", prop: \"value\" } },\n parts: { root: (controller) => controller.root },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-checkbox-group\": ElementOf<typeof tag, { \"value-change\": [\"onValueChange\", \"value\"] }>\n }\n}\n"],"mappings":";;;;;;;;;;AAmBA,MAAa,MAAM,cAAoC;CACrD,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,cAAc;EACd,UAAU;CACZ;CACA,SAAS,OAAO,SACd,oBACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GACL,GAAG;GACH,OAAO,KAAK,IAAI,KAAK;GACrB,cAAc,KAAK,IAAI,YAAY;GACnC,WAAW,KAAK,IAAI,SAAS;EAC/B;CACF,CAAC,GACD,EAAE,OAAO,YAAY,IAAI,EAAE,CAC7B;CACF,SAAS,EAAE,eAAe;EAAE,OAAO;EAAgB,MAAM;CAAQ,EAAE;CACnE,OAAO,EAAE,OAAO,eAAe,WAAW,KAAK;AACjD,CAAC"}
|
package/src/checkbox.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ import { CheckboxProps } from "@kirana-ui/core/checkbox";
|
|
|
3
3
|
/**
|
|
4
4
|
* `<kui-checkbox>` around a `kui-part="root"` button with an `indicator` inside, which is in
|
|
5
5
|
* the page while the box is checked or indeterminate. The root draws the hidden native input a
|
|
6
|
-
* form and a label reach.
|
|
7
|
-
*
|
|
6
|
+
* form and a label reach. Inside a `<kui-checkbox-group>` it is one of the group's boxes, by
|
|
7
|
+
* its `value`, or with `parent` the one that stands for them all. `checked`, `default-checked`,
|
|
8
|
+
* `indeterminate`, `parent`, `disabled`, `read-only`, `required`, `name`, `form`, `value`; it
|
|
9
|
+
* tells `checked-change`.
|
|
8
10
|
*/
|
|
9
11
|
export declare const tag: Tag<{
|
|
10
12
|
id: string;
|
package/src/checkbox.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { fieldAround } from "./around.js";
|
|
2
|
-
import { defineElement } from "./runtime.js";
|
|
2
|
+
import { controllerAround, defineElement } from "./runtime.js";
|
|
3
3
|
import { createCheckbox } from "@kirana-ui/core/checkbox";
|
|
4
4
|
// src/checkbox.ts
|
|
5
5
|
/**
|
|
6
6
|
* `<kui-checkbox>` around a `kui-part="root"` button with an `indicator` inside, which is in
|
|
7
7
|
* the page while the box is checked or indeterminate. The root draws the hidden native input a
|
|
8
|
-
* form and a label reach.
|
|
9
|
-
*
|
|
8
|
+
* form and a label reach. Inside a `<kui-checkbox-group>` it is one of the group's boxes, by
|
|
9
|
+
* its `value`, or with `parent` the one that stands for them all. `checked`, `default-checked`,
|
|
10
|
+
* `indeterminate`, `parent`, `disabled`, `read-only`, `required`, `name`, `form`, `value`; it
|
|
11
|
+
* tells `checked-change`.
|
|
10
12
|
*/
|
|
11
13
|
const tag = defineElement({
|
|
12
14
|
tag: "kui-checkbox",
|
|
@@ -14,6 +16,7 @@ const tag = defineElement({
|
|
|
14
16
|
checked: "boolean",
|
|
15
17
|
"default-checked": "boolean",
|
|
16
18
|
indeterminate: "boolean",
|
|
19
|
+
parent: "boolean",
|
|
17
20
|
disabled: "boolean",
|
|
18
21
|
"read-only": "boolean",
|
|
19
22
|
required: "boolean",
|
|
@@ -21,7 +24,10 @@ const tag = defineElement({
|
|
|
21
24
|
form: "string",
|
|
22
25
|
value: "string"
|
|
23
26
|
},
|
|
24
|
-
create: (props, host) => createCheckbox(props, {
|
|
27
|
+
create: (props, host) => createCheckbox(props, {
|
|
28
|
+
field: fieldAround(host),
|
|
29
|
+
group: controllerAround(host, "kui-checkbox-group")
|
|
30
|
+
}),
|
|
25
31
|
changes: { onCheckedChange: {
|
|
26
32
|
event: "checked-change",
|
|
27
33
|
prop: "checked"
|
package/src/checkbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../../packages/web/src/checkbox.ts"],"sourcesContent":["import { createCheckbox } from \"@kirana-ui/core/checkbox\"\nimport type { CheckboxProps } from \"@kirana-ui/core/checkbox\"\n\nimport { fieldAround } from \"./around.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { As, ElementOf } from \"./runtime.ts\"\n\n/**\n * `<kui-checkbox>` around a `kui-part=\"root\"` button with an `indicator` inside, which is in\n * the page while the box is checked or indeterminate. The root draws the hidden native input a\n * form and a label reach. `checked`, `default-checked
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../../packages/web/src/checkbox.ts"],"sourcesContent":["import { createCheckbox } from \"@kirana-ui/core/checkbox\"\nimport type { CheckboxGroupLink, CheckboxProps } from \"@kirana-ui/core/checkbox\"\n\nimport { fieldAround } from \"./around.ts\"\nimport { controllerAround, defineElement } from \"./runtime.ts\"\nimport type { As, ElementOf } from \"./runtime.ts\"\n\ntype Group = { readonly link: CheckboxGroupLink }\n\n/**\n * `<kui-checkbox>` around a `kui-part=\"root\"` button with an `indicator` inside, which is in\n * the page while the box is checked or indeterminate. The root draws the hidden native input a\n * form and a label reach. Inside a `<kui-checkbox-group>` it is one of the group's boxes, by\n * its `value`, or with `parent` the one that stands for them all. `checked`, `default-checked`,\n * `indeterminate`, `parent`, `disabled`, `read-only`, `required`, `name`, `form`, `value`; it\n * tells `checked-change`.\n */\nexport const tag = defineElement({\n tag: \"kui-checkbox\",\n props: {\n checked: \"boolean\",\n \"default-checked\": \"boolean\",\n indeterminate: \"boolean\",\n parent: \"boolean\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n name: \"string\",\n form: \"string\",\n value: \"string\",\n },\n create: (props, host) =>\n createCheckbox(props, {\n field: fieldAround(host),\n group: controllerAround<Group>(host, \"kui-checkbox-group\"),\n }),\n changes: { onCheckedChange: { event: \"checked-change\", prop: \"checked\" } },\n parts: {\n root: (controller) => ({ part: controller.root, inner: controller.input }),\n indicator: (controller) => ({\n mounted: controller.indicatorMounted,\n part: controller.indicator,\n }),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-checkbox\": ElementOf<\n As<typeof tag, CheckboxProps>,\n { \"checked-change\": [\"onCheckedChange\", \"checked\"] }\n >\n }\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,MAAM,cAAc;CAC/B,KAAK;CACL,OAAO;EACL,SAAS;EACT,mBAAmB;EACnB,eAAe;EACf,QAAQ;EACR,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;EACN,OAAO;CACT;CACA,SAAS,OAAO,SACd,eAAe,OAAO;EACpB,OAAO,YAAY,IAAI;EACvB,OAAO,iBAAwB,MAAM,oBAAoB;CAC3D,CAAC;CACH,SAAS,EAAE,iBAAiB;EAAE,OAAO;EAAkB,MAAM;CAAU,EAAE;CACzE,OAAO;EACL,OAAO,gBAAgB;GAAE,MAAM,WAAW;GAAM,OAAO,WAAW;EAAM;EACxE,YAAY,gBAAgB;GAC1B,SAAS,WAAW;GACpB,MAAM,WAAW;EACnB;CACF;AACF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ElementOf, Tag } from "./runtime.js";
|
|
2
|
+
import { ColorPicker, ColorPickerProps } from "@kirana-ui/core/color-picker";
|
|
3
|
+
/**
|
|
4
|
+
* `<kui-color-picker>` around `kui-part="root"`, which holds an `area` with its `area-thumb`,
|
|
5
|
+
* a `channel-slider` for each channel it moves (`kui-channel`: `hue` or `alpha`, and
|
|
6
|
+
* `kui-orientation`) holding its `channel-slider-track` and `channel-slider-thumb`, a
|
|
7
|
+
* `channel-input` for each channel typed in (`kui-channel`: `hex`, `red`, `green`, `blue`,
|
|
8
|
+
* `hue`, `saturation`, `lightness`, `alpha`), `swatch`es, `swatch-trigger` buttons for presets
|
|
9
|
+
* (`kui-value`), an `eye-dropper-trigger`, a `value-text` that says the colour and a
|
|
10
|
+
* `format-trigger` that says its format, each unless the page wrote something. The root draws
|
|
11
|
+
* the hidden input a form reads, as its last child. `value`, `default-value`, `format`,
|
|
12
|
+
* `default-format`, `alpha`, `thumb-alignment`, `disabled`, `read-only`, `required`, `name`,
|
|
13
|
+
* `form`; `getAriaValueText` as a property. It tells `value-change`, `value-committed` and
|
|
14
|
+
* `format-change`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const tag: Tag<ColorPickerProps & {
|
|
17
|
+
id: string;
|
|
18
|
+
}, ColorPicker>;
|
|
19
|
+
declare global {
|
|
20
|
+
interface HTMLElementTagNameMap {
|
|
21
|
+
"kui-color-picker": ElementOf<typeof tag, {
|
|
22
|
+
"value-change": ["onValueChange", "value"];
|
|
23
|
+
"value-committed": ["onValueCommitted", "value"];
|
|
24
|
+
"format-change": ["onFormatChange", "format"];
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=color-picker.d.ts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { fieldAround, valueOf } from "./around.js";
|
|
2
|
+
import { defineElement, partAround } from "./runtime.js";
|
|
3
|
+
import { createColorPicker } from "@kirana-ui/core/color-picker";
|
|
4
|
+
// src/color-picker.ts
|
|
5
|
+
/** The channel a slider moves and the way it runs: its own, or the slider's around it. */
|
|
6
|
+
function sliderOf(element) {
|
|
7
|
+
const slider = partAround(element, "channel-slider");
|
|
8
|
+
return [slider?.getAttribute("kui-channel") ?? "hue", slider?.getAttribute("kui-orientation") ?? void 0];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* `<kui-color-picker>` around `kui-part="root"`, which holds an `area` with its `area-thumb`,
|
|
12
|
+
* a `channel-slider` for each channel it moves (`kui-channel`: `hue` or `alpha`, and
|
|
13
|
+
* `kui-orientation`) holding its `channel-slider-track` and `channel-slider-thumb`, a
|
|
14
|
+
* `channel-input` for each channel typed in (`kui-channel`: `hex`, `red`, `green`, `blue`,
|
|
15
|
+
* `hue`, `saturation`, `lightness`, `alpha`), `swatch`es, `swatch-trigger` buttons for presets
|
|
16
|
+
* (`kui-value`), an `eye-dropper-trigger`, a `value-text` that says the colour and a
|
|
17
|
+
* `format-trigger` that says its format, each unless the page wrote something. The root draws
|
|
18
|
+
* the hidden input a form reads, as its last child. `value`, `default-value`, `format`,
|
|
19
|
+
* `default-format`, `alpha`, `thumb-alignment`, `disabled`, `read-only`, `required`, `name`,
|
|
20
|
+
* `form`; `getAriaValueText` as a property. It tells `value-change`, `value-committed` and
|
|
21
|
+
* `format-change`.
|
|
22
|
+
*/
|
|
23
|
+
const tag = defineElement({
|
|
24
|
+
tag: "kui-color-picker",
|
|
25
|
+
props: {
|
|
26
|
+
value: "string",
|
|
27
|
+
"default-value": "string",
|
|
28
|
+
format: "string",
|
|
29
|
+
"default-format": "string",
|
|
30
|
+
alpha: "boolean",
|
|
31
|
+
"thumb-alignment": "string",
|
|
32
|
+
disabled: "boolean",
|
|
33
|
+
"read-only": "boolean",
|
|
34
|
+
required: "boolean",
|
|
35
|
+
name: "string",
|
|
36
|
+
form: "string"
|
|
37
|
+
},
|
|
38
|
+
properties: ["getAriaValueText"],
|
|
39
|
+
create: (props, host) => createColorPicker(props, { field: fieldAround(host) }),
|
|
40
|
+
changes: {
|
|
41
|
+
onValueChange: {
|
|
42
|
+
event: "value-change",
|
|
43
|
+
prop: "value"
|
|
44
|
+
},
|
|
45
|
+
onValueCommitted: {
|
|
46
|
+
event: "value-committed",
|
|
47
|
+
prop: "value",
|
|
48
|
+
hold: false
|
|
49
|
+
},
|
|
50
|
+
onFormatChange: {
|
|
51
|
+
event: "format-change",
|
|
52
|
+
prop: "format"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
parts: {
|
|
56
|
+
root: (controller) => ({
|
|
57
|
+
part: controller.root,
|
|
58
|
+
inner: controller.input
|
|
59
|
+
}),
|
|
60
|
+
area: (controller) => controller.area,
|
|
61
|
+
"area-thumb": (controller) => controller.areaThumb,
|
|
62
|
+
"channel-slider": (controller, element) => controller.channelSlider(...sliderOf(element)),
|
|
63
|
+
"channel-slider-track": (controller, element) => controller.channelSliderTrack(...sliderOf(element)),
|
|
64
|
+
"channel-slider-thumb": (controller, element) => controller.channelSliderThumb(...sliderOf(element)),
|
|
65
|
+
"channel-input": (controller, element) => controller.channelInput(element.getAttribute("kui-channel") ?? "hex"),
|
|
66
|
+
swatch: (controller) => controller.swatch,
|
|
67
|
+
"swatch-trigger": (controller, element) => controller.swatchTrigger(valueOf(element)),
|
|
68
|
+
"eye-dropper-trigger": (controller) => controller.eyeDropperTrigger,
|
|
69
|
+
"value-text": (controller) => ({
|
|
70
|
+
part: controller.valueText,
|
|
71
|
+
text: controller.text
|
|
72
|
+
}),
|
|
73
|
+
"format-trigger": (controller) => ({
|
|
74
|
+
part: controller.formatTrigger,
|
|
75
|
+
text: controller.format
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
export { tag };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=color-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-picker.js","names":[],"sources":["../../../../packages/web/src/color-picker.ts"],"sourcesContent":["import type { Orientation } from \"@kirana-ui/core\"\nimport { createColorPicker } from \"@kirana-ui/core/color-picker\"\nimport type {\n ColorPicker,\n ColorPickerInputChannel,\n ColorPickerProps,\n ColorPickerSliderChannel,\n} from \"@kirana-ui/core/color-picker\"\n\nimport { fieldAround, valueOf } from \"./around.ts\"\nimport { defineElement, partAround } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\n/** The channel a slider moves and the way it runs: its own, or the slider's around it. */\nfunction sliderOf(element: HTMLElement): [ColorPickerSliderChannel, Orientation | undefined] {\n const slider = partAround(element, \"channel-slider\")\n const channel = (slider?.getAttribute(\"kui-channel\") ?? \"hue\") as ColorPickerSliderChannel\n const orientation = slider?.getAttribute(\"kui-orientation\") as Orientation | null | undefined\n return [channel, orientation ?? undefined]\n}\n\n/**\n * `<kui-color-picker>` around `kui-part=\"root\"`, which holds an `area` with its `area-thumb`,\n * a `channel-slider` for each channel it moves (`kui-channel`: `hue` or `alpha`, and\n * `kui-orientation`) holding its `channel-slider-track` and `channel-slider-thumb`, a\n * `channel-input` for each channel typed in (`kui-channel`: `hex`, `red`, `green`, `blue`,\n * `hue`, `saturation`, `lightness`, `alpha`), `swatch`es, `swatch-trigger` buttons for presets\n * (`kui-value`), an `eye-dropper-trigger`, a `value-text` that says the colour and a\n * `format-trigger` that says its format, each unless the page wrote something. The root draws\n * the hidden input a form reads, as its last child. `value`, `default-value`, `format`,\n * `default-format`, `alpha`, `thumb-alignment`, `disabled`, `read-only`, `required`, `name`,\n * `form`; `getAriaValueText` as a property. It tells `value-change`, `value-committed` and\n * `format-change`.\n */\nexport const tag = defineElement<ColorPickerProps & { id: string }, ColorPicker>({\n tag: \"kui-color-picker\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n format: \"string\",\n \"default-format\": \"string\",\n alpha: \"boolean\",\n \"thumb-alignment\": \"string\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"getAriaValueText\"],\n create: (props, host) => createColorPicker(props, { field: fieldAround(host) }),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValueCommitted: { event: \"value-committed\", prop: \"value\", hold: false },\n onFormatChange: { event: \"format-change\", prop: \"format\" },\n },\n parts: {\n root: (controller) => ({ part: controller.root, inner: controller.input }),\n area: (controller) => controller.area,\n \"area-thumb\": (controller) => controller.areaThumb,\n \"channel-slider\": (controller, element) => controller.channelSlider(...sliderOf(element)),\n \"channel-slider-track\": (controller, element) =>\n controller.channelSliderTrack(...sliderOf(element)),\n \"channel-slider-thumb\": (controller, element) =>\n controller.channelSliderThumb(...sliderOf(element)),\n // Its text is the core's, written as the colour changes.\n \"channel-input\": (controller, element) =>\n controller.channelInput(\n (element.getAttribute(\"kui-channel\") ?? \"hex\") as ColorPickerInputChannel\n ),\n swatch: (controller) => controller.swatch,\n \"swatch-trigger\": (controller, element) => controller.swatchTrigger(valueOf(element)),\n \"eye-dropper-trigger\": (controller) => controller.eyeDropperTrigger,\n \"value-text\": (controller) => ({ part: controller.valueText, text: controller.text }),\n \"format-trigger\": (controller) => ({ part: controller.formatTrigger, text: controller.format }),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-color-picker\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"value-committed\": [\"onValueCommitted\", \"value\"]\n \"format-change\": [\"onFormatChange\", \"format\"]\n }\n >\n }\n}\n"],"mappings":";;;;;AAcA,SAAS,SAAS,SAA2E;CAC3F,MAAM,SAAS,WAAW,SAAS,gBAAgB;CAGnD,OAAO,CAFU,QAAQ,aAAa,aAAa,KAAK,OACpC,QAAQ,aAAa,iBAAiB,KAC1B,KAAA,CAAS;AAC3C;;;;;;;;;;;;;;AAeA,MAAa,MAAM,cAA8D;CAC/E,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,kBAAkB;EAClB,OAAO;EACP,mBAAmB;EACnB,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,kBAAkB;CAC/B,SAAS,OAAO,SAAS,kBAAkB,OAAO,EAAE,OAAO,YAAY,IAAI,EAAE,CAAC;CAC9E,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,kBAAkB;GAAE,OAAO;GAAmB,MAAM;GAAS,MAAM;EAAM;EACzE,gBAAgB;GAAE,OAAO;GAAiB,MAAM;EAAS;CAC3D;CACA,OAAO;EACL,OAAO,gBAAgB;GAAE,MAAM,WAAW;GAAM,OAAO,WAAW;EAAM;EACxE,OAAO,eAAe,WAAW;EACjC,eAAe,eAAe,WAAW;EACzC,mBAAmB,YAAY,YAAY,WAAW,cAAc,GAAG,SAAS,OAAO,CAAC;EACxF,yBAAyB,YAAY,YACnC,WAAW,mBAAmB,GAAG,SAAS,OAAO,CAAC;EACpD,yBAAyB,YAAY,YACnC,WAAW,mBAAmB,GAAG,SAAS,OAAO,CAAC;EAEpD,kBAAkB,YAAY,YAC5B,WAAW,aACR,QAAQ,aAAa,aAAa,KAAK,KAC1C;EACF,SAAS,eAAe,WAAW;EACnC,mBAAmB,YAAY,YAAY,WAAW,cAAc,QAAQ,OAAO,CAAC;EACpF,wBAAwB,eAAe,WAAW;EAClD,eAAe,gBAAgB;GAAE,MAAM,WAAW;GAAW,MAAM,WAAW;EAAK;EACnF,mBAAmB,gBAAgB;GAAE,MAAM,WAAW;GAAe,MAAM,WAAW;EAAO;CAC/F;AACF,CAAC"}
|