claymorph-ui 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +77 -2
- package/dist/attach.d.ts +115 -0
- package/dist/attach.js +328 -0
- package/dist/attach.js.map +1 -0
- package/dist/clay.css +1648 -0
- package/dist/color.d.ts +5 -0
- package/dist/color.js +44 -0
- package/dist/color.js.map +1 -0
- package/dist/components/action-button.d.ts +31 -0
- package/dist/components/action-button.js +158 -0
- package/dist/components/action-button.js.map +1 -0
- package/dist/components/bars.d.ts +33 -0
- package/dist/components/bars.js +135 -0
- package/dist/components/bars.js.map +1 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/button.js +36 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/card.d.ts +24 -0
- package/dist/components/card.js +139 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/controls.d.ts +54 -0
- package/dist/components/controls.js +310 -0
- package/dist/components/controls.js.map +1 -0
- package/dist/components/forms.d.ts +41 -0
- package/dist/components/forms.js +266 -0
- package/dist/components/forms.js.map +1 -0
- package/dist/components/group.d.ts +26 -0
- package/dist/components/group.js +180 -0
- package/dist/components/group.js.map +1 -0
- package/dist/components/overlays.d.ts +89 -0
- package/dist/components/overlays.js +383 -0
- package/dist/components/overlays.js.map +1 -0
- package/dist/components/popups.d.ts +55 -0
- package/dist/components/popups.js +308 -0
- package/dist/components/popups.js.map +1 -0
- package/dist/components/slide.d.ts +34 -0
- package/dist/components/slide.js +234 -0
- package/dist/components/slide.js.map +1 -0
- package/dist/components/tabs.d.ts +20 -0
- package/dist/components/tabs.js +105 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/config.d.ts +48 -0
- package/dist/config.js +50 -0
- package/dist/config.js.map +1 -0
- package/dist/element.d.ts +39 -0
- package/dist/element.js +135 -0
- package/dist/element.js.map +1 -0
- package/dist/engine.d.ts +91 -0
- package/dist/engine.js +454 -0
- package/dist/engine.js.map +1 -0
- package/dist/entries/action-button.d.ts +8 -0
- package/dist/entries/action-button.js +8 -0
- package/dist/entries/action-button.js.map +1 -0
- package/dist/entries/avatar.d.ts +8 -0
- package/dist/entries/avatar.js +8 -0
- package/dist/entries/avatar.js.map +1 -0
- package/dist/entries/badge.d.ts +7 -0
- package/dist/entries/badge.js +7 -0
- package/dist/entries/badge.js.map +1 -0
- package/dist/entries/button-group.d.ts +9 -0
- package/dist/entries/button-group.js +9 -0
- package/dist/entries/button-group.js.map +1 -0
- package/dist/entries/button.d.ts +8 -0
- package/dist/entries/button.js +8 -0
- package/dist/entries/button.js.map +1 -0
- package/dist/entries/card.d.ts +7 -0
- package/dist/entries/card.js +7 -0
- package/dist/entries/card.js.map +1 -0
- package/dist/entries/checkbox.d.ts +9 -0
- package/dist/entries/checkbox.js +9 -0
- package/dist/entries/checkbox.js.map +1 -0
- package/dist/entries/dialog.d.ts +8 -0
- package/dist/entries/dialog.js +8 -0
- package/dist/entries/dialog.js.map +1 -0
- package/dist/entries/input.d.ts +9 -0
- package/dist/entries/input.js +9 -0
- package/dist/entries/input.js.map +1 -0
- package/dist/entries/menu.d.ts +8 -0
- package/dist/entries/menu.js +8 -0
- package/dist/entries/menu.js.map +1 -0
- package/dist/entries/meter.d.ts +8 -0
- package/dist/entries/meter.js +8 -0
- package/dist/entries/meter.js.map +1 -0
- package/dist/entries/popover.d.ts +8 -0
- package/dist/entries/popover.js +8 -0
- package/dist/entries/popover.js.map +1 -0
- package/dist/entries/progress.d.ts +8 -0
- package/dist/entries/progress.js +8 -0
- package/dist/entries/progress.js.map +1 -0
- package/dist/entries/radio.d.ts +9 -0
- package/dist/entries/radio.js +9 -0
- package/dist/entries/radio.js.map +1 -0
- package/dist/entries/segmented.d.ts +8 -0
- package/dist/entries/segmented.js +8 -0
- package/dist/entries/segmented.js.map +1 -0
- package/dist/entries/select.d.ts +8 -0
- package/dist/entries/select.js +8 -0
- package/dist/entries/select.js.map +1 -0
- package/dist/entries/slide-confirm.d.ts +8 -0
- package/dist/entries/slide-confirm.js +8 -0
- package/dist/entries/slide-confirm.js.map +1 -0
- package/dist/entries/slider.d.ts +9 -0
- package/dist/entries/slider.js +9 -0
- package/dist/entries/slider.js.map +1 -0
- package/dist/entries/switch.d.ts +9 -0
- package/dist/entries/switch.js +9 -0
- package/dist/entries/switch.js.map +1 -0
- package/dist/entries/tabs.d.ts +8 -0
- package/dist/entries/tabs.js +8 -0
- package/dist/entries/tabs.js.map +1 -0
- package/dist/entries/toast.d.ts +9 -0
- package/dist/entries/toast.js +8 -0
- package/dist/entries/toast.js.map +1 -0
- package/dist/entries/toggle.d.ts +8 -0
- package/dist/entries/toggle.js +8 -0
- package/dist/entries/toggle.js.map +1 -0
- package/dist/entries/tooltip.d.ts +8 -0
- package/dist/entries/tooltip.js +8 -0
- package/dist/entries/tooltip.js.map +1 -0
- package/dist/highlight.d.ts +26 -0
- package/dist/highlight.js +100 -0
- package/dist/highlight.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +37 -0
- package/dist/shared.d.ts +28 -0
- package/dist/shared.js +80 -0
- package/dist/shared.js.map +1 -0
- package/dist/spring.d.ts +14 -0
- package/dist/spring.js +50 -0
- package/dist/spring.js.map +1 -0
- package/dist/surface.d.ts +88 -0
- package/dist/surface.js +240 -0
- package/dist/surface.js.map +1 -0
- package/package.json +140 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../../src/clay/entries/checkbox.ts"],"sourcesContent":["import \"@ui-sdk/web/checkbox\"\nimport \"@ui-sdk/web/field\"\nimport { ClayCheckbox } from \"../components/controls\"\nimport { define } from \"../element\"\n\ndefine(\"clay-checkbox\", ClayCheckbox)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-checkbox\": ClayCheckbox\n }\n}\n\nexport { ClayCheckbox }\n"],"mappings":";;;;;AAKA,OAAO,iBAAiB,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","names":[],"sources":["../../../../src/clay/entries/dialog.ts"],"sourcesContent":["import \"@ui-sdk/web/dialog\"\nimport { ClayDialog } from \"../components/overlays\"\nimport { define } from \"../element\"\n\ndefine(\"clay-dialog\", ClayDialog)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-dialog\": ClayDialog\n }\n}\n\nexport { ClayDialog }\n"],"mappings":";;;;AAIA,OAAO,eAAe,UAAU"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ClayInput } from "../components/forms.js";
|
|
2
|
+
import { define } from "../element.js";
|
|
3
|
+
import "@ui-sdk/web/field";
|
|
4
|
+
import "@ui-sdk/web/input";
|
|
5
|
+
// src/clay/entries/input.ts
|
|
6
|
+
define("clay-input", ClayInput);
|
|
7
|
+
export { ClayInput };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","names":[],"sources":["../../../../src/clay/entries/input.ts"],"sourcesContent":["import \"@ui-sdk/web/field\"\nimport \"@ui-sdk/web/input\"\nimport { ClayInput } from \"../components/forms\"\nimport { define } from \"../element\"\n\ndefine(\"clay-input\", ClayInput)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-input\": ClayInput\n }\n}\n\nexport { ClayInput }\n"],"mappings":";;;;;AAKA,OAAO,cAAc,SAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.js","names":[],"sources":["../../../../src/clay/entries/menu.ts"],"sourcesContent":["import \"@ui-sdk/web/menu\"\nimport { ClayMenu } from \"../components/overlays\"\nimport { define } from \"../element\"\n\ndefine(\"clay-menu\", ClayMenu)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-menu\": ClayMenu\n }\n}\n\nexport { ClayMenu }\n"],"mappings":";;;;AAIA,OAAO,aAAa,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter.js","names":[],"sources":["../../../../src/clay/entries/meter.ts"],"sourcesContent":["import \"@ui-sdk/web/meter\"\nimport { ClayMeter } from \"../components/bars\"\nimport { define } from \"../element\"\n\ndefine(\"clay-meter\", ClayMeter)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-meter\": ClayMeter\n }\n}\n\nexport { ClayMeter }\n"],"mappings":";;;;AAIA,OAAO,cAAc,SAAS"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClayPopover } from "../components/overlays.js";
|
|
2
|
+
import { define } from "../element.js";
|
|
3
|
+
import "@ui-sdk/web/popover";
|
|
4
|
+
// src/clay/entries/popover.ts
|
|
5
|
+
define("clay-popover", ClayPopover);
|
|
6
|
+
export { ClayPopover };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.js","names":[],"sources":["../../../../src/clay/entries/popover.ts"],"sourcesContent":["import \"@ui-sdk/web/popover\"\nimport { ClayPopover } from \"../components/overlays\"\nimport { define } from \"../element\"\n\ndefine(\"clay-popover\", ClayPopover)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-popover\": ClayPopover\n }\n}\n\nexport { ClayPopover }\n"],"mappings":";;;;AAIA,OAAO,gBAAgB,WAAW"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClayProgress } from "../components/bars.js";
|
|
2
|
+
import { define } from "../element.js";
|
|
3
|
+
import "@ui-sdk/web/progress";
|
|
4
|
+
// src/clay/entries/progress.ts
|
|
5
|
+
define("clay-progress", ClayProgress);
|
|
6
|
+
export { ClayProgress };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","names":[],"sources":["../../../../src/clay/entries/progress.ts"],"sourcesContent":["import \"@ui-sdk/web/progress\"\nimport { ClayProgress } from \"../components/bars\"\nimport { define } from \"../element\"\n\ndefine(\"clay-progress\", ClayProgress)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-progress\": ClayProgress\n }\n}\n\nexport { ClayProgress }\n"],"mappings":";;;;AAIA,OAAO,iBAAiB,YAAY"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ClayRadio } from "../components/forms.js";
|
|
2
|
+
import { define } from "../element.js";
|
|
3
|
+
import "@ui-sdk/web/field";
|
|
4
|
+
import "@ui-sdk/web/radio";
|
|
5
|
+
// src/clay/entries/radio.ts
|
|
6
|
+
define("clay-radio", ClayRadio);
|
|
7
|
+
export { ClayRadio };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=radio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio.js","names":[],"sources":["../../../../src/clay/entries/radio.ts"],"sourcesContent":["import \"@ui-sdk/web/field\"\nimport \"@ui-sdk/web/radio\"\nimport { ClayRadio } from \"../components/forms\"\nimport { define } from \"../element\"\n\ndefine(\"clay-radio\", ClayRadio)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-radio\": ClayRadio\n }\n}\n\nexport { ClayRadio }\n"],"mappings":";;;;;AAKA,OAAO,cAAc,SAAS"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClaySegmented } from "../components/controls.js";
|
|
2
|
+
import { define } from "../element.js";
|
|
3
|
+
import "@ui-sdk/web/segmented-control";
|
|
4
|
+
// src/clay/entries/segmented.ts
|
|
5
|
+
define("clay-segmented", ClaySegmented);
|
|
6
|
+
export { ClaySegmented };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=segmented.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmented.js","names":[],"sources":["../../../../src/clay/entries/segmented.ts"],"sourcesContent":["import \"@ui-sdk/web/segmented-control\"\nimport { ClaySegmented } from \"../components/controls\"\nimport { define } from \"../element\"\n\ndefine(\"clay-segmented\", ClaySegmented)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-segmented\": ClaySegmented\n }\n}\n\nexport { ClaySegmented }\n"],"mappings":";;;;AAIA,OAAO,kBAAkB,aAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","names":[],"sources":["../../../../src/clay/entries/select.ts"],"sourcesContent":["import \"@ui-sdk/web/select\"\nimport { ClaySelect } from \"../components/popups\"\nimport { define } from \"../element\"\n\ndefine(\"clay-select\", ClaySelect)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-select\": ClaySelect\n }\n}\n\nexport { ClaySelect }\n"],"mappings":";;;;AAIA,OAAO,eAAe,UAAU"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClaySlideConfirm } from "../components/slide.js";
|
|
2
|
+
import { define } from "../element.js";
|
|
3
|
+
import "@ui-sdk/web/slider";
|
|
4
|
+
// src/clay/entries/slide-confirm.ts
|
|
5
|
+
define("clay-slide-confirm", ClaySlideConfirm);
|
|
6
|
+
export { ClaySlideConfirm };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=slide-confirm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slide-confirm.js","names":[],"sources":["../../../../src/clay/entries/slide-confirm.ts"],"sourcesContent":["import \"@ui-sdk/web/slider\"\nimport { ClaySlideConfirm, type SlideState } from \"../components/slide\"\nimport { define } from \"../element\"\n\ndefine(\"clay-slide-confirm\", ClaySlideConfirm)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-slide-confirm\": ClaySlideConfirm\n }\n}\n\nexport { ClaySlideConfirm, type SlideState }\n"],"mappings":";;;;AAIA,OAAO,sBAAsB,gBAAgB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ClaySlider } from "../components/controls.js";
|
|
2
|
+
import { define } from "../element.js";
|
|
3
|
+
import "@ui-sdk/web/field";
|
|
4
|
+
import "@ui-sdk/web/slider";
|
|
5
|
+
// src/clay/entries/slider.ts
|
|
6
|
+
define("clay-slider", ClaySlider);
|
|
7
|
+
export { ClaySlider };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider.js","names":[],"sources":["../../../../src/clay/entries/slider.ts"],"sourcesContent":["import \"@ui-sdk/web/field\"\nimport \"@ui-sdk/web/slider\"\nimport { ClaySlider } from \"../components/controls\"\nimport { define } from \"../element\"\n\ndefine(\"clay-slider\", ClaySlider)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-slider\": ClaySlider\n }\n}\n\nexport { ClaySlider }\n"],"mappings":";;;;;AAKA,OAAO,eAAe,UAAU"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ClaySwitch } from "../components/controls.js";
|
|
2
|
+
import { define } from "../element.js";
|
|
3
|
+
import "@ui-sdk/web/field";
|
|
4
|
+
import "@ui-sdk/web/switch";
|
|
5
|
+
// src/clay/entries/switch.ts
|
|
6
|
+
define("clay-switch", ClaySwitch);
|
|
7
|
+
export { ClaySwitch };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.js","names":[],"sources":["../../../../src/clay/entries/switch.ts"],"sourcesContent":["import \"@ui-sdk/web/field\"\nimport \"@ui-sdk/web/switch\"\nimport { ClaySwitch } from \"../components/controls\"\nimport { define } from \"../element\"\n\ndefine(\"clay-switch\", ClaySwitch)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-switch\": ClaySwitch\n }\n}\n\nexport { ClaySwitch }\n"],"mappings":";;;;;AAKA,OAAO,eAAe,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","names":[],"sources":["../../../../src/clay/entries/tabs.ts"],"sourcesContent":["import \"@ui-sdk/web/tabs\"\nimport { ClayTabs } from \"../components/tabs\"\nimport { define } from \"../element\"\n\ndefine(\"clay-tabs\", ClayTabs)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-tabs\": ClayTabs\n }\n}\n\nexport { ClayTabs }\n"],"mappings":";;;;AAIA,OAAO,aAAa,QAAQ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "@ui-sdk/web/toast";
|
|
2
|
+
import { ClayToastRegion } from "../components/overlays.js";
|
|
3
|
+
export { createToaster, toast } from "@ui-sdk/web/toast";
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
"clay-toast-region": ClayToastRegion;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export { ClayToastRegion };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClayToastRegion } from "../components/overlays.js";
|
|
2
|
+
import { define } from "../element.js";
|
|
3
|
+
import { createToaster, toast } from "@ui-sdk/web/toast";
|
|
4
|
+
// src/clay/entries/toast.ts
|
|
5
|
+
define("clay-toast-region", ClayToastRegion);
|
|
6
|
+
export { ClayToastRegion, createToaster, toast };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","names":[],"sources":["../../../../src/clay/entries/toast.ts"],"sourcesContent":["import \"@ui-sdk/web/toast\"\nimport { ClayToastRegion } from \"../components/overlays\"\nimport { define } from \"../element\"\n\nexport { createToaster, toast } from \"@ui-sdk/web/toast\"\n\ndefine(\"clay-toast-region\", ClayToastRegion)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-toast-region\": ClayToastRegion\n }\n}\n\nexport { ClayToastRegion }\n"],"mappings":";;;;AAMA,OAAO,qBAAqB,eAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.js","names":[],"sources":["../../../../src/clay/entries/toggle.ts"],"sourcesContent":["import \"@ui-sdk/web/toggle\"\nimport { ClayToggle } from \"../components/group\"\nimport { define } from \"../element\"\n\ndefine(\"clay-toggle\", ClayToggle)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-toggle\": ClayToggle\n }\n}\n\nexport { ClayToggle }\n"],"mappings":";;;;AAIA,OAAO,eAAe,UAAU"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClayTooltip } from "../components/popups.js";
|
|
2
|
+
import { define } from "../element.js";
|
|
3
|
+
import "@ui-sdk/web/tooltip";
|
|
4
|
+
// src/clay/entries/tooltip.ts
|
|
5
|
+
define("clay-tooltip", ClayTooltip);
|
|
6
|
+
export { ClayTooltip };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.js","names":[],"sources":["../../../../src/clay/entries/tooltip.ts"],"sourcesContent":["import \"@ui-sdk/web/tooltip\"\nimport { ClayTooltip } from \"../components/popups\"\nimport { define } from \"../element\"\n\ndefine(\"clay-tooltip\", ClayTooltip)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"clay-tooltip\": ClayTooltip\n }\n}\n\nexport { ClayTooltip }\n"],"mappings":";;;;AAIA,OAAO,gBAAgB,WAAW"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Attachment } from "./attach.js";
|
|
2
|
+
import type { RGB } from "./color.js";
|
|
3
|
+
import type { ClayShape } from "./engine.js";
|
|
4
|
+
import { type ClaySurface, type SurfaceOptions } from "./surface.js";
|
|
5
|
+
/**
|
|
6
|
+
* A well pressed into a list's clay that slides to the highlighted item, stretching as it travels,
|
|
7
|
+
* like Slide's bead. It replaces the item's own highlight while the clay is drawn.
|
|
8
|
+
*/
|
|
9
|
+
declare class Highlight {
|
|
10
|
+
private readonly x;
|
|
11
|
+
private readonly y;
|
|
12
|
+
private readonly w;
|
|
13
|
+
private readonly h;
|
|
14
|
+
private readonly shown;
|
|
15
|
+
private readonly list;
|
|
16
|
+
private readonly items;
|
|
17
|
+
constructor(list: HTMLElement, items: string);
|
|
18
|
+
/** Calls back whenever the highlighted item changes. Returns a function that stops. */
|
|
19
|
+
watch(changed: () => void): () => void;
|
|
20
|
+
measure(): void;
|
|
21
|
+
step(dt: number, still: boolean): boolean;
|
|
22
|
+
shape(color: RGB, presence?: number): ClayShape | null;
|
|
23
|
+
}
|
|
24
|
+
/** Adds a list's sliding highlight to its popup's clay, once the popup is all the way out. */
|
|
25
|
+
declare function withHighlight(base: SurfaceOptions, highlight: Highlight | null, surface: () => ClaySurface | undefined, attachment: Attachment | null): SurfaceOptions;
|
|
26
|
+
export { Highlight, withHighlight };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { SPRINGS } from "./config.js";
|
|
2
|
+
import { NEUTRAL } from "./element.js";
|
|
3
|
+
import { clamp, deeper, watch } from "./shared.js";
|
|
4
|
+
import { Spring } from "./spring.js";
|
|
5
|
+
import { offsetWithin } from "./surface.js";
|
|
6
|
+
// src/clay/highlight.ts
|
|
7
|
+
/**
|
|
8
|
+
* A well pressed into a list's clay that slides to the highlighted item, stretching as it travels,
|
|
9
|
+
* like Slide's bead. It replaces the item's own highlight while the clay is drawn.
|
|
10
|
+
*/
|
|
11
|
+
var Highlight = class {
|
|
12
|
+
x = new Spring(0);
|
|
13
|
+
y = new Spring(0);
|
|
14
|
+
w = new Spring(0);
|
|
15
|
+
h = new Spring(0);
|
|
16
|
+
shown = new Spring(0);
|
|
17
|
+
list;
|
|
18
|
+
items;
|
|
19
|
+
constructor(list, items) {
|
|
20
|
+
this.list = list;
|
|
21
|
+
this.items = items;
|
|
22
|
+
}
|
|
23
|
+
/** Calls back whenever the highlighted item changes. Returns a function that stops. */
|
|
24
|
+
watch(changed) {
|
|
25
|
+
return watch(this.list, ["data-highlighted"], changed);
|
|
26
|
+
}
|
|
27
|
+
measure() {
|
|
28
|
+
const item = this.list.querySelector(`:is(${this.items})[data-highlighted]`);
|
|
29
|
+
if (!item || !item.getClientRects().length) {
|
|
30
|
+
this.shown.target = 0;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const box = offsetWithin(item, this.list);
|
|
34
|
+
const springs = [
|
|
35
|
+
this.x,
|
|
36
|
+
this.y,
|
|
37
|
+
this.w,
|
|
38
|
+
this.h
|
|
39
|
+
];
|
|
40
|
+
const values = [
|
|
41
|
+
box.x,
|
|
42
|
+
box.y,
|
|
43
|
+
box.w,
|
|
44
|
+
box.h
|
|
45
|
+
];
|
|
46
|
+
const jump = this.shown.x < .05;
|
|
47
|
+
springs.forEach((spring, i) => jump ? spring.set(values[i]) : spring.target = values[i]);
|
|
48
|
+
this.shown.target = 1;
|
|
49
|
+
}
|
|
50
|
+
step(dt, still) {
|
|
51
|
+
return [...[
|
|
52
|
+
this.x,
|
|
53
|
+
this.y,
|
|
54
|
+
this.w,
|
|
55
|
+
this.h
|
|
56
|
+
].map((spring) => spring.step(dt, SPRINGS.travel, still)), this.shown.step(dt, {
|
|
57
|
+
omega: 20,
|
|
58
|
+
zeta: .85
|
|
59
|
+
}, still)].some(Boolean);
|
|
60
|
+
}
|
|
61
|
+
shape(color, presence = 1) {
|
|
62
|
+
const a = clamp(this.shown.x, 0, 1) * presence;
|
|
63
|
+
if (a < .01) return null;
|
|
64
|
+
const stretch = clamp(Math.abs(this.y.v) * 6e-4, 0, .2);
|
|
65
|
+
const h = this.h.x * (1 + stretch);
|
|
66
|
+
const w = this.w.x * (1 - stretch * .25);
|
|
67
|
+
return {
|
|
68
|
+
x: this.x.x + (this.w.x - w) / 2,
|
|
69
|
+
y: this.y.x - (h - this.h.x) / 2,
|
|
70
|
+
w,
|
|
71
|
+
h,
|
|
72
|
+
radius: Math.min(h / 2, 13),
|
|
73
|
+
color: deeper(color, .07),
|
|
74
|
+
height: -.55 * (.6 + .4 * a),
|
|
75
|
+
bevel: 8,
|
|
76
|
+
opacity: a
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
/** Adds a list's sliding highlight to its popup's clay, once the popup is all the way out. */
|
|
81
|
+
function withHighlight(base, highlight, surface, attachment) {
|
|
82
|
+
if (!highlight) return base;
|
|
83
|
+
return {
|
|
84
|
+
...base,
|
|
85
|
+
measure: () => {
|
|
86
|
+
base.measure?.();
|
|
87
|
+
highlight.measure();
|
|
88
|
+
},
|
|
89
|
+
step: (dt, still) => [base.step?.(dt, still) ?? false, highlight.step(dt, still)].some(Boolean),
|
|
90
|
+
shapes: () => {
|
|
91
|
+
const shapes = base.shapes();
|
|
92
|
+
const presence = attachment ? clamp((attachment.emerge.x - .85) / .15, 0, 1) : 1;
|
|
93
|
+
const well = surface() && highlight.shape(surface().color("--clay-popup", NEUTRAL), presence);
|
|
94
|
+
return well ? [...shapes, well] : shapes;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export { Highlight, withHighlight };
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=highlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight.js","names":[],"sources":["../../../src/clay/highlight.ts"],"sourcesContent":["import type { Attachment } from \"./attach\"\nimport type { RGB } from \"./color\"\nimport { SPRINGS } from \"./config\"\nimport type { ClayShape } from \"./engine\"\nimport { NEUTRAL } from \"./element\"\nimport { clamp, deeper, watch } from \"./shared\"\nimport { Spring } from \"./spring\"\nimport { offsetWithin, type ClaySurface, type SurfaceOptions } from \"./surface\"\n\n/**\n * A well pressed into a list's clay that slides to the highlighted item, stretching as it travels,\n * like Slide's bead. It replaces the item's own highlight while the clay is drawn.\n */\nclass Highlight {\n private readonly x = new Spring(0)\n private readonly y = new Spring(0)\n private readonly w = new Spring(0)\n private readonly h = new Spring(0)\n private readonly shown = new Spring(0)\n private readonly list: HTMLElement\n private readonly items: string\n\n constructor(list: HTMLElement, items: string) {\n this.list = list\n this.items = items\n }\n\n /** Calls back whenever the highlighted item changes. Returns a function that stops. */\n watch(changed: () => void) {\n return watch(this.list, [\"data-highlighted\"], changed)\n }\n\n measure() {\n const item = this.list.querySelector<HTMLElement>(`:is(${this.items})[data-highlighted]`)\n if (!item || !item.getClientRects().length) {\n this.shown.target = 0\n return\n }\n const box = offsetWithin(item, this.list)\n const springs = [this.x, this.y, this.w, this.h] as const\n const values = [box.x, box.y, box.w, box.h]\n // Appearing, it starts where the pointer is instead of sliding in from the last item.\n const jump = this.shown.x < 0.05\n springs.forEach((spring, i) => (jump ? spring.set(values[i]!) : (spring.target = values[i]!)))\n this.shown.target = 1\n }\n\n step(dt: number, still: boolean) {\n return [\n ...[this.x, this.y, this.w, this.h].map((spring) => spring.step(dt, SPRINGS.travel, still)),\n this.shown.step(dt, { omega: 20, zeta: 0.85 }, still),\n ].some(Boolean)\n }\n\n shape(color: RGB, presence = 1): ClayShape | null {\n const a = clamp(this.shown.x, 0, 1) * presence\n if (a < 0.01) return null\n const stretch = clamp(Math.abs(this.y.v) * 0.0006, 0, 0.2)\n const h = this.h.x * (1 + stretch)\n const w = this.w.x * (1 - stretch * 0.25)\n // It fades in and out whole and eases in a little deeper: a well that only got shallower would keep\n // its rim to the end and then pop away.\n return {\n x: this.x.x + (this.w.x - w) / 2,\n y: this.y.x - (h - this.h.x) / 2,\n w,\n h,\n radius: Math.min(h / 2, 13),\n color: deeper(color, 0.07),\n height: -0.55 * (0.6 + 0.4 * a),\n bevel: 8,\n opacity: a,\n }\n }\n}\n\n/** Adds a list's sliding highlight to its popup's clay, once the popup is all the way out. */\nfunction withHighlight(\n base: SurfaceOptions,\n highlight: Highlight | null,\n surface: () => ClaySurface | undefined,\n attachment: Attachment | null\n): SurfaceOptions {\n if (!highlight) return base\n return {\n ...base,\n measure: () => {\n base.measure?.()\n highlight.measure()\n },\n step: (dt, still) => [base.step?.(dt, still) ?? false, highlight.step(dt, still)].some(Boolean),\n shapes: () => {\n const shapes = base.shapes()\n const presence = attachment ? clamp((attachment.emerge.x - 0.85) / 0.15, 0, 1) : 1\n const well = surface() && highlight.shape(surface()!.color(\"--clay-popup\", NEUTRAL), presence)\n return well ? [...shapes, well] : shapes\n },\n }\n}\n\nexport { Highlight, withHighlight }\n"],"mappings":";;;;;;;;;;AAaA,IAAM,YAAN,MAAgB;CACd,IAAqB,IAAI,OAAO,CAAC;CACjC,IAAqB,IAAI,OAAO,CAAC;CACjC,IAAqB,IAAI,OAAO,CAAC;CACjC,IAAqB,IAAI,OAAO,CAAC;CACjC,QAAyB,IAAI,OAAO,CAAC;CACrC;CACA;CAEA,YAAY,MAAmB,OAAe;EAC5C,KAAK,OAAO;EACZ,KAAK,QAAQ;CACf;;CAGA,MAAM,SAAqB;EACzB,OAAO,MAAM,KAAK,MAAM,CAAC,kBAAkB,GAAG,OAAO;CACvD;CAEA,UAAU;EACR,MAAM,OAAO,KAAK,KAAK,cAA2B,OAAO,KAAK,MAAM,oBAAoB;EACxF,IAAI,CAAC,QAAQ,CAAC,KAAK,eAAe,CAAC,CAAC,QAAQ;GAC1C,KAAK,MAAM,SAAS;GACpB;EACF;EACA,MAAM,MAAM,aAAa,MAAM,KAAK,IAAI;EACxC,MAAM,UAAU;GAAC,KAAK;GAAG,KAAK;GAAG,KAAK;GAAG,KAAK;EAAC;EAC/C,MAAM,SAAS;GAAC,IAAI;GAAG,IAAI;GAAG,IAAI;GAAG,IAAI;EAAC;EAE1C,MAAM,OAAO,KAAK,MAAM,IAAI;EAC5B,QAAQ,SAAS,QAAQ,MAAO,OAAO,OAAO,IAAI,OAAO,EAAG,IAAK,OAAO,SAAS,OAAO,EAAK;EAC7F,KAAK,MAAM,SAAS;CACtB;CAEA,KAAK,IAAY,OAAgB;EAC/B,OAAO,CACL,GAAG;GAAC,KAAK;GAAG,KAAK;GAAG,KAAK;GAAG,KAAK;EAAC,CAAC,CAAC,KAAK,WAAW,OAAO,KAAK,IAAI,QAAQ,QAAQ,KAAK,CAAC,GAC1F,KAAK,MAAM,KAAK,IAAI;GAAE,OAAO;GAAI,MAAM;EAAK,GAAG,KAAK,CACtD,CAAC,CAAC,KAAK,OAAO;CAChB;CAEA,MAAM,OAAY,WAAW,GAAqB;EAChD,MAAM,IAAI,MAAM,KAAK,MAAM,GAAG,GAAG,CAAC,IAAI;EACtC,IAAI,IAAI,KAAM,OAAO;EACrB,MAAM,UAAU,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC,IAAI,MAAQ,GAAG,EAAG;EACzD,MAAM,IAAI,KAAK,EAAE,KAAK,IAAI;EAC1B,MAAM,IAAI,KAAK,EAAE,KAAK,IAAI,UAAU;EAGpC,OAAO;GACL,GAAG,KAAK,EAAE,KAAK,KAAK,EAAE,IAAI,KAAK;GAC/B,GAAG,KAAK,EAAE,KAAK,IAAI,KAAK,EAAE,KAAK;GAC/B;GACA;GACA,QAAQ,KAAK,IAAI,IAAI,GAAG,EAAE;GAC1B,OAAO,OAAO,OAAO,GAAI;GACzB,QAAQ,QAAS,KAAM,KAAM;GAC7B,OAAO;GACP,SAAS;EACX;CACF;AACF;;AAGA,SAAS,cACP,MACA,WACA,SACA,YACgB;CAChB,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO;EACL,GAAG;EACH,eAAe;GACb,KAAK,UAAU;GACf,UAAU,QAAQ;EACpB;EACA,OAAO,IAAI,UAAU,CAAC,KAAK,OAAO,IAAI,KAAK,KAAK,OAAO,UAAU,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO;EAC9F,cAAc;GACZ,MAAM,SAAS,KAAK,OAAO;GAC3B,MAAM,WAAW,aAAa,OAAO,WAAW,OAAO,IAAI,OAAQ,KAAM,GAAG,CAAC,IAAI;GACjF,MAAM,OAAO,QAAQ,KAAK,UAAU,MAAM,QAAQ,CAAC,CAAE,MAAM,gBAAgB,OAAO,GAAG,QAAQ;GAC7F,OAAO,OAAO,CAAC,GAAG,QAAQ,IAAI,IAAI;EACpC;CACF;AACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every Clay element, registered, with the config and engine. To load only some, import their
|
|
3
|
+
* entries instead, like `./entries/button`. The stylesheet is separate: `./clay.css`.
|
|
4
|
+
*/
|
|
5
|
+
export * from "./entries/action-button.js";
|
|
6
|
+
export * from "./entries/avatar.js";
|
|
7
|
+
export * from "./entries/badge.js";
|
|
8
|
+
export * from "./entries/button.js";
|
|
9
|
+
export * from "./entries/button-group.js";
|
|
10
|
+
export * from "./entries/card.js";
|
|
11
|
+
export * from "./entries/checkbox.js";
|
|
12
|
+
export * from "./entries/dialog.js";
|
|
13
|
+
export * from "./entries/input.js";
|
|
14
|
+
export * from "./entries/menu.js";
|
|
15
|
+
export * from "./entries/meter.js";
|
|
16
|
+
export * from "./entries/popover.js";
|
|
17
|
+
export * from "./entries/progress.js";
|
|
18
|
+
export * from "./entries/radio.js";
|
|
19
|
+
export * from "./entries/segmented.js";
|
|
20
|
+
export * from "./entries/select.js";
|
|
21
|
+
export * from "./entries/slide-confirm.js";
|
|
22
|
+
export * from "./entries/slider.js";
|
|
23
|
+
export * from "./entries/switch.js";
|
|
24
|
+
export * from "./entries/tabs.js";
|
|
25
|
+
export * from "./entries/toast.js";
|
|
26
|
+
export * from "./entries/toggle.js";
|
|
27
|
+
export * from "./entries/tooltip.js";
|
|
28
|
+
export { CLAY, CLAY_DEFAULTS, SPRINGS, type ClayConfig } from "./config.js";
|
|
29
|
+
export { getClayEngine, type ClayShape } from "./engine.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "./entries/action-button.js";
|
|
2
|
+
import "./entries/avatar.js";
|
|
3
|
+
import { ClayActionButton } from "./components/action-button.js";
|
|
4
|
+
import "./entries/badge.js";
|
|
5
|
+
import { ClayAvatar, ClayBadge, ClayCard } from "./components/card.js";
|
|
6
|
+
import "./entries/button.js";
|
|
7
|
+
import "./entries/button-group.js";
|
|
8
|
+
import { ClayButton } from "./components/button.js";
|
|
9
|
+
import "./entries/card.js";
|
|
10
|
+
import { ClayButtonGroup, ClayToggle } from "./components/group.js";
|
|
11
|
+
import "./entries/checkbox.js";
|
|
12
|
+
import "./entries/dialog.js";
|
|
13
|
+
import { ClayCheckbox, ClaySegmented, ClaySlider, ClaySwitch } from "./components/controls.js";
|
|
14
|
+
import "./entries/input.js";
|
|
15
|
+
import { ClayDialog, ClayMenu, ClayPopover, ClayToastRegion } from "./components/overlays.js";
|
|
16
|
+
import "./entries/menu.js";
|
|
17
|
+
import { ClayInput, ClayRadio } from "./components/forms.js";
|
|
18
|
+
import "./entries/meter.js";
|
|
19
|
+
import "./entries/popover.js";
|
|
20
|
+
import { ClayMeter, ClayProgress } from "./components/bars.js";
|
|
21
|
+
import "./entries/progress.js";
|
|
22
|
+
import "./entries/radio.js";
|
|
23
|
+
import "./entries/segmented.js";
|
|
24
|
+
import "./entries/select.js";
|
|
25
|
+
import "./entries/slide-confirm.js";
|
|
26
|
+
import { ClaySelect, ClayTooltip } from "./components/popups.js";
|
|
27
|
+
import "./entries/slider.js";
|
|
28
|
+
import { ClaySlideConfirm } from "./components/slide.js";
|
|
29
|
+
import "./entries/switch.js";
|
|
30
|
+
import "./entries/tabs.js";
|
|
31
|
+
import { createToaster, toast } from "./entries/toast.js";
|
|
32
|
+
import { ClayTabs } from "./components/tabs.js";
|
|
33
|
+
import "./entries/toggle.js";
|
|
34
|
+
import "./entries/tooltip.js";
|
|
35
|
+
import { CLAY, CLAY_DEFAULTS, SPRINGS } from "./config.js";
|
|
36
|
+
import { getClayEngine } from "./engine.js";
|
|
37
|
+
export { CLAY, CLAY_DEFAULTS, ClayActionButton, ClayAvatar, ClayBadge, ClayButton, ClayButtonGroup, ClayCard, ClayCheckbox, ClayDialog, ClayInput, ClayMenu, ClayMeter, ClayPopover, ClayProgress, ClayRadio, ClaySegmented, ClaySelect, ClaySlideConfirm, ClaySlider, ClaySwitch, ClayTabs, ClayToastRegion, ClayToggle, ClayTooltip, SPRINGS, createToaster, getClayEngine, toast };
|