claymorph-ui 0.0.0-stage → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +130 -2
  3. package/dist/attach.d.ts +115 -0
  4. package/dist/attach.js +328 -0
  5. package/dist/attach.js.map +1 -0
  6. package/dist/clay.css +1648 -0
  7. package/dist/color.d.ts +5 -0
  8. package/dist/color.js +44 -0
  9. package/dist/color.js.map +1 -0
  10. package/dist/components/action-button.d.ts +31 -0
  11. package/dist/components/action-button.js +158 -0
  12. package/dist/components/action-button.js.map +1 -0
  13. package/dist/components/bars.d.ts +33 -0
  14. package/dist/components/bars.js +135 -0
  15. package/dist/components/bars.js.map +1 -0
  16. package/dist/components/button.d.ts +10 -0
  17. package/dist/components/button.js +36 -0
  18. package/dist/components/button.js.map +1 -0
  19. package/dist/components/card.d.ts +24 -0
  20. package/dist/components/card.js +139 -0
  21. package/dist/components/card.js.map +1 -0
  22. package/dist/components/controls.d.ts +54 -0
  23. package/dist/components/controls.js +310 -0
  24. package/dist/components/controls.js.map +1 -0
  25. package/dist/components/forms.d.ts +41 -0
  26. package/dist/components/forms.js +266 -0
  27. package/dist/components/forms.js.map +1 -0
  28. package/dist/components/group.d.ts +26 -0
  29. package/dist/components/group.js +180 -0
  30. package/dist/components/group.js.map +1 -0
  31. package/dist/components/overlays.d.ts +89 -0
  32. package/dist/components/overlays.js +383 -0
  33. package/dist/components/overlays.js.map +1 -0
  34. package/dist/components/popups.d.ts +55 -0
  35. package/dist/components/popups.js +308 -0
  36. package/dist/components/popups.js.map +1 -0
  37. package/dist/components/slide.d.ts +34 -0
  38. package/dist/components/slide.js +234 -0
  39. package/dist/components/slide.js.map +1 -0
  40. package/dist/components/tabs.d.ts +20 -0
  41. package/dist/components/tabs.js +105 -0
  42. package/dist/components/tabs.js.map +1 -0
  43. package/dist/config.d.ts +48 -0
  44. package/dist/config.js +50 -0
  45. package/dist/config.js.map +1 -0
  46. package/dist/element.d.ts +39 -0
  47. package/dist/element.js +135 -0
  48. package/dist/element.js.map +1 -0
  49. package/dist/engine.d.ts +91 -0
  50. package/dist/engine.js +454 -0
  51. package/dist/engine.js.map +1 -0
  52. package/dist/entries/action-button.d.ts +8 -0
  53. package/dist/entries/action-button.js +8 -0
  54. package/dist/entries/action-button.js.map +1 -0
  55. package/dist/entries/avatar.d.ts +8 -0
  56. package/dist/entries/avatar.js +8 -0
  57. package/dist/entries/avatar.js.map +1 -0
  58. package/dist/entries/badge.d.ts +7 -0
  59. package/dist/entries/badge.js +7 -0
  60. package/dist/entries/badge.js.map +1 -0
  61. package/dist/entries/button-group.d.ts +9 -0
  62. package/dist/entries/button-group.js +9 -0
  63. package/dist/entries/button-group.js.map +1 -0
  64. package/dist/entries/button.d.ts +8 -0
  65. package/dist/entries/button.js +8 -0
  66. package/dist/entries/button.js.map +1 -0
  67. package/dist/entries/card.d.ts +7 -0
  68. package/dist/entries/card.js +7 -0
  69. package/dist/entries/card.js.map +1 -0
  70. package/dist/entries/checkbox.d.ts +9 -0
  71. package/dist/entries/checkbox.js +9 -0
  72. package/dist/entries/checkbox.js.map +1 -0
  73. package/dist/entries/dialog.d.ts +8 -0
  74. package/dist/entries/dialog.js +8 -0
  75. package/dist/entries/dialog.js.map +1 -0
  76. package/dist/entries/input.d.ts +9 -0
  77. package/dist/entries/input.js +9 -0
  78. package/dist/entries/input.js.map +1 -0
  79. package/dist/entries/menu.d.ts +8 -0
  80. package/dist/entries/menu.js +8 -0
  81. package/dist/entries/menu.js.map +1 -0
  82. package/dist/entries/meter.d.ts +8 -0
  83. package/dist/entries/meter.js +8 -0
  84. package/dist/entries/meter.js.map +1 -0
  85. package/dist/entries/popover.d.ts +8 -0
  86. package/dist/entries/popover.js +8 -0
  87. package/dist/entries/popover.js.map +1 -0
  88. package/dist/entries/progress.d.ts +8 -0
  89. package/dist/entries/progress.js +8 -0
  90. package/dist/entries/progress.js.map +1 -0
  91. package/dist/entries/radio.d.ts +9 -0
  92. package/dist/entries/radio.js +9 -0
  93. package/dist/entries/radio.js.map +1 -0
  94. package/dist/entries/segmented.d.ts +8 -0
  95. package/dist/entries/segmented.js +8 -0
  96. package/dist/entries/segmented.js.map +1 -0
  97. package/dist/entries/select.d.ts +8 -0
  98. package/dist/entries/select.js +8 -0
  99. package/dist/entries/select.js.map +1 -0
  100. package/dist/entries/slide-confirm.d.ts +8 -0
  101. package/dist/entries/slide-confirm.js +8 -0
  102. package/dist/entries/slide-confirm.js.map +1 -0
  103. package/dist/entries/slider.d.ts +9 -0
  104. package/dist/entries/slider.js +9 -0
  105. package/dist/entries/slider.js.map +1 -0
  106. package/dist/entries/switch.d.ts +9 -0
  107. package/dist/entries/switch.js +9 -0
  108. package/dist/entries/switch.js.map +1 -0
  109. package/dist/entries/tabs.d.ts +8 -0
  110. package/dist/entries/tabs.js +8 -0
  111. package/dist/entries/tabs.js.map +1 -0
  112. package/dist/entries/toast.d.ts +9 -0
  113. package/dist/entries/toast.js +8 -0
  114. package/dist/entries/toast.js.map +1 -0
  115. package/dist/entries/toggle.d.ts +8 -0
  116. package/dist/entries/toggle.js +8 -0
  117. package/dist/entries/toggle.js.map +1 -0
  118. package/dist/entries/tooltip.d.ts +8 -0
  119. package/dist/entries/tooltip.js +8 -0
  120. package/dist/entries/tooltip.js.map +1 -0
  121. package/dist/highlight.d.ts +26 -0
  122. package/dist/highlight.js +100 -0
  123. package/dist/highlight.js.map +1 -0
  124. package/dist/index.d.ts +29 -0
  125. package/dist/index.js +37 -0
  126. package/dist/shared.d.ts +28 -0
  127. package/dist/shared.js +80 -0
  128. package/dist/shared.js.map +1 -0
  129. package/dist/spring.d.ts +14 -0
  130. package/dist/spring.js +50 -0
  131. package/dist/spring.js.map +1 -0
  132. package/dist/surface.d.ts +88 -0
  133. package/dist/surface.js +240 -0
  134. package/dist/surface.js.map +1 -0
  135. package/package.json +140 -4
@@ -0,0 +1,28 @@
1
+ import { type RGB } from "./color.js";
2
+ import type { ClayShape } from "./engine.js";
3
+ import type { ClaySurface } from "./surface.js";
4
+ interface Box {
5
+ x: number;
6
+ y: number;
7
+ w: number;
8
+ h: number;
9
+ }
10
+ declare const SHADE: RGB;
11
+ declare const deeper: (color: RGB, amount?: number) => RGB;
12
+ declare const clamp: (value: number, min: number, max: number) => number;
13
+ /** Calls back whenever one of the attributes changes anywhere under a root. */
14
+ declare function watch(root: Element, attributes: string[], callback: () => void): () => void;
15
+ /** A flat-topped slab filling the surface: cards, popups, toasts. */
16
+ declare function slab(surface: ClaySurface, color: string, radius: number, bevel: number, lift: number): ClayShape;
17
+ /** A button body that swells under the pointer and squashes when pressed. */
18
+ declare function pressable(surface: ClaySurface, radius?: number, color?: string): ClayShape;
19
+ /** A groove: a raised rim with a well pressed into it, `inset` px inside. */
20
+ declare function groove(surface: ClaySurface, box: {
21
+ x: number;
22
+ y: number;
23
+ w: number;
24
+ h: number;
25
+ }, inset: number, radius?: number): ClayShape[];
26
+ declare const lerp: (a: number, b: number, t: number) => number;
27
+ declare const lerpBox: (a: Box, b: Box, t: number) => Box;
28
+ export { clamp, deeper, groove, lerp, lerpBox, pressable, SHADE, slab, watch, type Box };
package/dist/shared.js ADDED
@@ -0,0 +1,80 @@
1
+ import { mix } from "./color.js";
2
+ import { NEUTRAL } from "./element.js";
3
+ // src/clay/shared.ts
4
+ var SHADE = [
5
+ .1,
6
+ .14,
7
+ .2
8
+ ];
9
+ var deeper = (color, amount = .1) => mix(color, SHADE, amount);
10
+ var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
11
+ /** Calls back whenever one of the attributes changes anywhere under a root. */
12
+ function watch(root, attributes, callback) {
13
+ const observer = new MutationObserver(callback);
14
+ observer.observe(root, {
15
+ attributes: true,
16
+ attributeFilter: attributes,
17
+ subtree: true
18
+ });
19
+ return () => observer.disconnect();
20
+ }
21
+ /** A flat-topped slab filling the surface: cards, popups, toasts. */
22
+ function slab(surface, color, radius, bevel, lift) {
23
+ return {
24
+ x: 0,
25
+ y: 0,
26
+ w: surface.width,
27
+ h: surface.height,
28
+ radius,
29
+ color: surface.color(color, NEUTRAL),
30
+ height: .85,
31
+ bevel,
32
+ lift
33
+ };
34
+ }
35
+ /** A button body that swells under the pointer and squashes when pressed. */
36
+ function pressable(surface, radius = surface.height / 2, color = "--clay-color") {
37
+ const press = surface.press.x;
38
+ return {
39
+ x: 0,
40
+ y: 0,
41
+ w: surface.width,
42
+ h: surface.height,
43
+ radius,
44
+ color: surface.color(color, NEUTRAL),
45
+ height: 1 - press * .4,
46
+ lift: 1 + surface.hover.x * .3 - press * .55
47
+ };
48
+ }
49
+ /** A groove: a raised rim with a well pressed into it, `inset` px inside. */
50
+ function groove(surface, box, inset, radius = (box.h + inset * 2) / 2) {
51
+ const body = surface.color("--clay-surface", NEUTRAL);
52
+ return [{
53
+ x: box.x - inset,
54
+ y: box.y - inset,
55
+ w: box.w + inset * 2,
56
+ h: box.h + inset * 2,
57
+ radius,
58
+ color: body,
59
+ height: .8,
60
+ lift: .5
61
+ }, {
62
+ x: box.x,
63
+ y: box.y,
64
+ w: box.w,
65
+ h: box.h,
66
+ radius: Math.max(radius - inset, 2),
67
+ color: deeper(body, .09),
68
+ height: -.9
69
+ }];
70
+ }
71
+ var lerp = (a, b, t) => a + (b - a) * t;
72
+ var lerpBox = (a, b, t) => ({
73
+ x: lerp(a.x, b.x, t),
74
+ y: lerp(a.y, b.y, t),
75
+ w: lerp(a.w, b.w, t),
76
+ h: lerp(a.h, b.h, t)
77
+ });
78
+ export { SHADE, clamp, deeper, groove, lerp, lerpBox, pressable, slab, watch };
79
+
80
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","names":[],"sources":["../../../src/clay/shared.ts"],"sourcesContent":["import { mix, type RGB } from \"./color\"\nimport type { ClayShape } from \"./engine\"\nimport { NEUTRAL } from \"./element\"\nimport type { ClaySurface } from \"./surface\"\n\ninterface Box {\n x: number\n y: number\n w: number\n h: number\n}\n\nconst SHADE: RGB = [0.1, 0.14, 0.2]\n\nconst deeper = (color: RGB, amount = 0.1) => mix(color, SHADE, amount)\n\nconst clamp = (value: number, min: number, max: number) => Math.min(max, Math.max(min, value))\n\n/** Calls back whenever one of the attributes changes anywhere under a root. */\nfunction watch(root: Element, attributes: string[], callback: () => void) {\n const observer = new MutationObserver(callback)\n observer.observe(root, { attributes: true, attributeFilter: attributes, subtree: true })\n return () => observer.disconnect()\n}\n\n/** A flat-topped slab filling the surface: cards, popups, toasts. */\nfunction slab(surface: ClaySurface, color: string, radius: number, bevel: number, lift: number): ClayShape {\n return {\n x: 0,\n y: 0,\n w: surface.width,\n h: surface.height,\n radius,\n color: surface.color(color, NEUTRAL),\n height: 0.85,\n bevel,\n lift,\n }\n}\n\n/** A button body that swells under the pointer and squashes when pressed. */\nfunction pressable(surface: ClaySurface, radius = surface.height / 2, color = \"--clay-color\"): ClayShape {\n const press = surface.press.x\n return {\n x: 0,\n y: 0,\n w: surface.width,\n h: surface.height,\n radius,\n color: surface.color(color, NEUTRAL),\n height: 1 - press * 0.4,\n lift: 1 + surface.hover.x * 0.3 - press * 0.55,\n }\n}\n\n/** A groove: a raised rim with a well pressed into it, `inset` px inside. */\nfunction groove(\n surface: ClaySurface,\n box: { x: number; y: number; w: number; h: number },\n inset: number,\n radius = (box.h + inset * 2) / 2\n): ClayShape[] {\n const body = surface.color(\"--clay-surface\", NEUTRAL)\n return [\n {\n x: box.x - inset,\n y: box.y - inset,\n w: box.w + inset * 2,\n h: box.h + inset * 2,\n radius,\n color: body,\n height: 0.8,\n lift: 0.5,\n },\n { x: box.x, y: box.y, w: box.w, h: box.h, radius: Math.max(radius - inset, 2), color: deeper(body, 0.09), height: -0.9 },\n ]\n}\n\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t\n\nconst lerpBox = (a: Box, b: Box, t: number): Box => ({\n x: lerp(a.x, b.x, t),\n y: lerp(a.y, b.y, t),\n w: lerp(a.w, b.w, t),\n h: lerp(a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AAM;CACR,GACA;EAAE,GAAG,IAAI;EAAG,GAAG,IAAI;EAAG,GAAG,IAAI;EAAG,GAAG,IAAI;EAAG,QAAQ,KAAK,IAAI,SAAS,OAAO,CAAC;EAAG,OAAO,OAAO,MAAM,GAAI;EAAG,QAAQ;CAAK,CACzH;AACF;AAEA,IAAM,QAAQ,GAAW,GAAW,MAAc,KAAK,IAAI,KAAK;AAEhE,IAAM,WAAW,GAAQ,GAAQ,OAAoB;CACnD,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC;CACnB,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC;CACnB,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC;CACnB,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC;AACrB"}
@@ -0,0 +1,14 @@
1
+ interface SpringConfig {
2
+ omega: number;
3
+ zeta: number;
4
+ }
5
+ declare class Spring {
6
+ x: number;
7
+ v: number;
8
+ target: number;
9
+ constructor(value?: number);
10
+ set(value: number): void;
11
+ get moving(): boolean;
12
+ step(dt: number, { omega, zeta }: SpringConfig, still?: boolean): boolean;
13
+ }
14
+ export { Spring, type SpringConfig };
package/dist/spring.js ADDED
@@ -0,0 +1,50 @@
1
+ // src/clay/spring.ts
2
+ var Spring = class {
3
+ x;
4
+ v = 0;
5
+ target;
6
+ constructor(value = 0) {
7
+ this.x = value;
8
+ this.target = value;
9
+ }
10
+ set(value) {
11
+ this.x = value;
12
+ this.target = value;
13
+ this.v = 0;
14
+ }
15
+ get moving() {
16
+ return this.x !== this.target || this.v !== 0;
17
+ }
18
+ step(dt, { omega, zeta }, still = false) {
19
+ if (still) {
20
+ this.set(this.target);
21
+ return false;
22
+ }
23
+ const x0 = this.x - this.target;
24
+ const v0 = this.v;
25
+ if (zeta < 1) {
26
+ const a = zeta * omega;
27
+ const wd = omega * Math.sqrt(1 - zeta * zeta);
28
+ const e = Math.exp(-a * dt);
29
+ const c = Math.cos(wd * dt);
30
+ const s = Math.sin(wd * dt);
31
+ const b = (v0 + a * x0) / wd;
32
+ this.x = this.target + e * (x0 * c + b * s);
33
+ this.v = e * (v0 * c - (x0 * wd + a * b) * s);
34
+ } else {
35
+ const e = Math.exp(-omega * dt);
36
+ const b = v0 + omega * x0;
37
+ this.x = this.target + (x0 + b * dt) * e;
38
+ this.v = (v0 - omega * b * dt) * e;
39
+ }
40
+ const scale = Math.max(Math.abs(this.target), 1) * 1e-4;
41
+ if (Math.abs(this.x - this.target) < scale && Math.abs(this.v) < scale * 20) {
42
+ this.set(this.target);
43
+ return false;
44
+ }
45
+ return true;
46
+ }
47
+ };
48
+ export { Spring };
49
+
50
+ //# sourceMappingURL=spring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spring.js","names":[],"sources":["../../../src/clay/spring.ts"],"sourcesContent":["interface SpringConfig {\n omega: number\n zeta: number\n}\n\nclass Spring {\n x: number\n v = 0\n target: number\n\n constructor(value = 0) {\n this.x = value\n this.target = value\n }\n\n set(value: number) {\n this.x = value\n this.target = value\n this.v = 0\n }\n\n get moving() {\n return this.x !== this.target || this.v !== 0\n }\n\n step(dt: number, { omega, zeta }: SpringConfig, still = false) {\n if (still) {\n this.set(this.target)\n return false\n }\n const x0 = this.x - this.target\n const v0 = this.v\n if (zeta < 1) {\n const a = zeta * omega\n const wd = omega * Math.sqrt(1 - zeta * zeta)\n const e = Math.exp(-a * dt)\n const c = Math.cos(wd * dt)\n const s = Math.sin(wd * dt)\n const b = (v0 + a * x0) / wd\n this.x = this.target + e * (x0 * c + b * s)\n this.v = e * (v0 * c - (x0 * wd + a * b) * s)\n } else {\n const e = Math.exp(-omega * dt)\n const b = v0 + omega * x0\n this.x = this.target + (x0 + b * dt) * e\n this.v = (v0 - omega * b * dt) * e\n }\n const scale = Math.max(Math.abs(this.target), 1) * 1e-4\n if (Math.abs(this.x - this.target) < scale && Math.abs(this.v) < scale * 20) {\n this.set(this.target)\n return false\n }\n return true\n }\n}\n\nexport { Spring, type SpringConfig }\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M;GACpB,OAAO;EACT;EACA,OAAO;CACT;AACF"}
@@ -0,0 +1,88 @@
1
+ import { type RGB } from "./color.js";
2
+ import { type ClayFrame, type ClayShape, type ClayView } from "./engine.js";
3
+ import { Spring } from "./spring.js";
4
+ interface SurfaceOptions {
5
+ /** Room around the host for shadows, in CSS px. A function is asked again whenever the surface is dirty. */
6
+ pad?: number | (() => number);
7
+ /** Hover swell and press squash on the host itself. */
8
+ swell?: boolean;
9
+ /** Starts calm: no swell, squash or light leaning toward the pointer. */
10
+ calm?: boolean;
11
+ /** Where hover and presses are read; defaults to the host. */
12
+ pressTarget?: HTMLElement;
13
+ /** The clay element whose `--clay-color` this surface wears; defaults to the host. */
14
+ owner?: HTMLElement;
15
+ /** Re-reads geometry the shapes depend on. Runs whenever the surface is dirty. */
16
+ measure?: () => void;
17
+ /** Advances the component's own springs. Returns true while anything moves. */
18
+ step?: (dt: number, still: boolean) => boolean;
19
+ shapes: () => ClayShape[];
20
+ }
21
+ declare class ClaySurface implements ClayView {
22
+ readonly host: HTMLElement;
23
+ readonly canvas: HTMLCanvasElement;
24
+ readonly ctx: CanvasRenderingContext2D;
25
+ pad: number;
26
+ readonly hover: Spring;
27
+ readonly press: Spring;
28
+ width: number;
29
+ height: number;
30
+ visible: boolean;
31
+ dirty: boolean;
32
+ /**
33
+ * Measure again on the next frame, without waking the engine. For a surface that follows another
34
+ * element's box while that element moves: `dirty` is spent by the frame's draw before the next measure.
35
+ */
36
+ stale: boolean;
37
+ key: string;
38
+ pointer: {
39
+ x: number;
40
+ y: number;
41
+ } | null;
42
+ private options;
43
+ private colors;
44
+ private cleanup;
45
+ private ready;
46
+ private lastSx;
47
+ private lastSy;
48
+ private placed;
49
+ private calmed;
50
+ constructor(host: HTMLElement, options: SurfaceOptions);
51
+ static attach(host: HTMLElement, options: SurfaceOptions): ClaySurface | null;
52
+ private connect;
53
+ destroy(): void;
54
+ private setHover;
55
+ private setPress;
56
+ /**
57
+ * Holds the surface still: no swell, squash or light leaning toward the pointer. A trigger stays calm
58
+ * while its popup is melted onto it, so the joint between them doesn't shift as the pointer moves.
59
+ */
60
+ calm(on: boolean): void;
61
+ /** A little squash and spring back, as when something tucks back into it. */
62
+ bounce(strength?: number): void;
63
+ invalidate(): void;
64
+ wake(): void;
65
+ /**
66
+ * The resolved colour of a CSS custom property, cached until the surface is dirty. `--clay-color`
67
+ * comes from the owner, so a clay card around a part can't recolour it; the rest from the host.
68
+ */
69
+ color(property: string, fallback?: RGB): RGB;
70
+ /**
71
+ * The canvas needs a positioned host. Decided on the first frame, once ui-sdk has styled its parts:
72
+ * a popup or dialog in the top layer would turn `relative` into `absolute` and leave the viewport.
73
+ */
74
+ private place;
75
+ tick(dt: number, still: boolean): boolean;
76
+ private applySquash;
77
+ frame(): ClayFrame;
78
+ drawn(): void;
79
+ lost(): void;
80
+ }
81
+ /** The offset of an element inside a host, in untransformed layout px. */
82
+ declare function offsetWithin(el: HTMLElement, host: HTMLElement): {
83
+ x: number;
84
+ y: number;
85
+ w: number;
86
+ h: number;
87
+ };
88
+ export { ClaySurface, offsetWithin, type SurfaceOptions };
@@ -0,0 +1,240 @@
1
+ import { resolveColor } from "./color.js";
2
+ import { CLAY, SPRINGS } from "./config.js";
3
+ import { getClayEngine } from "./engine.js";
4
+ import { Spring } from "./spring.js";
5
+ // src/clay/surface.ts
6
+ var isDisabled = (el) => el.matches("[data-disabled], [aria-disabled='true']") || !!el.querySelector(":disabled, [aria-disabled='true'], [data-disabled]");
7
+ var ClaySurface = class ClaySurface {
8
+ host;
9
+ canvas = document.createElement("canvas");
10
+ ctx;
11
+ pad;
12
+ hover = new Spring(0);
13
+ press = new Spring(0);
14
+ width = 0;
15
+ height = 0;
16
+ visible = true;
17
+ dirty = true;
18
+ /**
19
+ * Measure again on the next frame, without waking the engine. For a surface that follows another
20
+ * element's box while that element moves: `dirty` is spent by the frame's draw before the next measure.
21
+ */
22
+ stale = false;
23
+ key = "";
24
+ pointer = null;
25
+ options;
26
+ colors = /* @__PURE__ */ new Map();
27
+ cleanup = [];
28
+ ready = false;
29
+ lastSx = "";
30
+ lastSy = "";
31
+ placed = false;
32
+ calmed = false;
33
+ constructor(host, options) {
34
+ this.host = host;
35
+ this.options = options;
36
+ this.pad = typeof options.pad === "number" ? options.pad : 28;
37
+ this.calmed = options.calm ?? false;
38
+ this.ctx = this.canvas.getContext("2d");
39
+ this.canvas.className = "clay-canvas";
40
+ this.canvas.setAttribute("aria-hidden", "true");
41
+ this.canvas.dataset.clayCanvas = "";
42
+ }
43
+ static attach(host, options) {
44
+ const engine = getClayEngine();
45
+ if (!engine) return null;
46
+ const surface = new ClaySurface(host, options);
47
+ surface.connect();
48
+ engine.add(surface);
49
+ return surface;
50
+ }
51
+ connect() {
52
+ const { host } = this;
53
+ host.setAttribute("data-clay-host", "");
54
+ host.prepend(this.canvas);
55
+ const resize = new ResizeObserver(() => this.invalidate());
56
+ resize.observe(host);
57
+ const visibility = new IntersectionObserver(([entry]) => {
58
+ this.visible = entry.isIntersecting;
59
+ if (this.visible) this.invalidate();
60
+ }, { rootMargin: "120px" });
61
+ visibility.observe(host);
62
+ this.cleanup.push(() => resize.disconnect(), () => visibility.disconnect());
63
+ const target = this.options.pressTarget ?? host;
64
+ const on = (type, handler) => {
65
+ target.addEventListener(type, handler);
66
+ this.cleanup.push(() => target.removeEventListener(type, handler));
67
+ };
68
+ on("pointerenter", () => this.setHover(true));
69
+ on("pointerleave", () => {
70
+ this.setHover(false);
71
+ this.setPress(false);
72
+ });
73
+ on("pointermove", (event) => {
74
+ const box = host.getBoundingClientRect();
75
+ const sx = box.width / (host.offsetWidth || 1);
76
+ const sy = box.height / (host.offsetHeight || 1);
77
+ this.pointer = {
78
+ x: (event.clientX - box.left) / sx,
79
+ y: (event.clientY - box.top) / sy
80
+ };
81
+ this.wake();
82
+ });
83
+ on("pointerdown", (event) => {
84
+ if (event.button === 0) this.setPress(true);
85
+ });
86
+ on("pointerup", () => this.setPress(false));
87
+ on("pointercancel", () => this.setPress(false));
88
+ on("keydown", (event) => {
89
+ if (!event.repeat && (event.key === " " || event.key === "Enter")) this.setPress(true);
90
+ });
91
+ on("keyup", () => this.setPress(false));
92
+ on("focusout", () => this.setPress(false));
93
+ }
94
+ destroy() {
95
+ getClayEngine()?.remove(this);
96
+ for (const fn of this.cleanup) fn();
97
+ this.canvas.remove();
98
+ this.host.removeAttribute("data-clay-ready");
99
+ this.host.removeAttribute("data-clay-host");
100
+ }
101
+ setHover(on) {
102
+ this.hover.target = on && !this.calmed && !isDisabled(this.host) ? 1 : 0;
103
+ this.wake();
104
+ }
105
+ setPress(on) {
106
+ this.press.target = on && !this.calmed && !isDisabled(this.host) ? 1 : 0;
107
+ this.wake();
108
+ }
109
+ /**
110
+ * Holds the surface still: no swell, squash or light leaning toward the pointer. A trigger stays calm
111
+ * while its popup is melted onto it, so the joint between them doesn't shift as the pointer moves.
112
+ */
113
+ calm(on) {
114
+ if (on === this.calmed) return;
115
+ this.calmed = on;
116
+ if (on) {
117
+ this.hover.target = 0;
118
+ this.press.target = 0;
119
+ }
120
+ this.wake();
121
+ }
122
+ /** A little squash and spring back, as when something tucks back into it. */
123
+ bounce(strength = 1) {
124
+ this.press.v += 7 * strength;
125
+ this.wake();
126
+ }
127
+ invalidate() {
128
+ this.dirty = true;
129
+ this.wake();
130
+ }
131
+ wake() {
132
+ getClayEngine()?.wake();
133
+ }
134
+ /**
135
+ * The resolved colour of a CSS custom property, cached until the surface is dirty. `--clay-color`
136
+ * comes from the owner, so a clay card around a part can't recolour it; the rest from the host.
137
+ */
138
+ color(property, fallback) {
139
+ let value = this.colors.get(property);
140
+ if (!value) {
141
+ const source = property === "--clay-color" ? this.options.owner ?? this.host : this.host;
142
+ value = resolveColor(getComputedStyle(source).getPropertyValue(property), fallback);
143
+ this.colors.set(property, value);
144
+ }
145
+ return value;
146
+ }
147
+ /**
148
+ * The canvas needs a positioned host. Decided on the first frame, once ui-sdk has styled its parts:
149
+ * a popup or dialog in the top layer would turn `relative` into `absolute` and leave the viewport.
150
+ */
151
+ place() {
152
+ this.placed = true;
153
+ const { host } = this;
154
+ if (host.matches("[popover], [data-slot$='-content'], [data-slot='toast'], [data-slot='toast-region']")) return;
155
+ if (getComputedStyle(host).position !== "static") return;
156
+ host.style.position = "relative";
157
+ this.cleanup.push(() => host.style.removeProperty("position"));
158
+ }
159
+ tick(dt, still) {
160
+ if (!this.placed) this.place();
161
+ if (!this.ready && (!this.host.offsetWidth || !this.host.offsetHeight)) this.drawn();
162
+ if (this.dirty || this.stale) {
163
+ this.stale = false;
164
+ this.width = this.host.offsetWidth;
165
+ this.height = this.host.offsetHeight;
166
+ this.colors.clear();
167
+ this.options.measure?.();
168
+ const pad = typeof this.options.pad === "function" ? this.options.pad() : this.pad;
169
+ this.pad = pad;
170
+ const style = this.canvas.style;
171
+ style.left = style.top = `${-pad}px`;
172
+ style.width = `${this.width + pad * 2}px`;
173
+ style.height = `${this.height + pad * 2}px`;
174
+ }
175
+ let moving = this.hover.step(dt, SPRINGS.hover, still);
176
+ moving = this.press.step(dt, SPRINGS.press, still) || moving;
177
+ moving = (this.options.step?.(dt, still) ?? false) || moving;
178
+ if (this.options.swell !== false) this.applySquash();
179
+ return moving;
180
+ }
181
+ applySquash() {
182
+ const swell = 1 + this.hover.x * CLAY.hoverSwell;
183
+ const squash = this.press.x * CLAY.pressSquash;
184
+ const sx = (swell * (1 + squash * .8)).toFixed(4);
185
+ const sy = (swell * (1 - squash)).toFixed(4);
186
+ if (sx !== this.lastSx) this.host.style.setProperty("--clay-sx", this.lastSx = sx);
187
+ if (sy !== this.lastSy) this.host.style.setProperty("--clay-sy", this.lastSy = sy);
188
+ }
189
+ frame() {
190
+ const lean = this.pointer && !this.calmed ? CLAY.pointerLean * this.hover.x : 0;
191
+ let lx = CLAY.lightX;
192
+ let ly = CLAY.lightY;
193
+ if (this.pointer && lean > 0) {
194
+ const dx = this.pointer.x / Math.max(this.width, 1) - .5;
195
+ const dy = this.pointer.y / Math.max(this.height, 1) - .5;
196
+ lx += Math.round(dx * 2 * lean * 100) / 100;
197
+ ly += Math.round(dy * 2 * lean * 100) / 100;
198
+ }
199
+ return {
200
+ shapes: this.options.shapes(),
201
+ pointer: this.pointer && this.hover.x > .01 ? {
202
+ ...this.pointer,
203
+ strength: this.hover.x
204
+ } : null,
205
+ glow: this.calmed ? 0 : this.press.x * CLAY.glow,
206
+ light: [
207
+ lx,
208
+ ly,
209
+ CLAY.lightZ
210
+ ]
211
+ };
212
+ }
213
+ drawn() {
214
+ if (this.ready) return;
215
+ this.ready = true;
216
+ this.host.setAttribute("data-clay-ready", "");
217
+ }
218
+ lost() {
219
+ this.ready = false;
220
+ this.host.removeAttribute("data-clay-ready");
221
+ this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
222
+ this.dirty = true;
223
+ }
224
+ };
225
+ /** The offset of an element inside a host, in untransformed layout px. */
226
+ function offsetWithin(el, host) {
227
+ const a = el.getBoundingClientRect();
228
+ const b = host.getBoundingClientRect();
229
+ const sx = b.width / (host.offsetWidth || 1) || 1;
230
+ const sy = b.height / (host.offsetHeight || 1) || 1;
231
+ return {
232
+ x: (a.left - b.left) / sx,
233
+ y: (a.top - b.top) / sy,
234
+ w: a.width / sx,
235
+ h: a.height / sy
236
+ };
237
+ }
238
+ export { ClaySurface, offsetWithin };
239
+
240
+ //# sourceMappingURL=surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface.js","names":[],"sources":["../../../src/clay/surface.ts"],"sourcesContent":["import { resolveColor, type RGB } from \"./color\"\nimport { CLAY, SPRINGS } from \"./config\"\nimport { getClayEngine, type ClayFrame, type ClayShape, type ClayView } from \"./engine\"\nimport { Spring } from \"./spring\"\n\ninterface SurfaceOptions {\n /** Room around the host for shadows, in CSS px. A function is asked again whenever the surface is dirty. */\n pad?: number | (() => number)\n /** Hover swell and press squash on the host itself. */\n swell?: boolean\n /** Starts calm: no swell, squash or light leaning toward the pointer. */\n calm?: boolean\n /** Where hover and presses are read; defaults to the host. */\n pressTarget?: HTMLElement\n /** The clay element whose `--clay-color` this surface wears; defaults to the host. */\n owner?: HTMLElement\n /** Re-reads geometry the shapes depend on. Runs whenever the surface is dirty. */\n measure?: () => void\n /** Advances the component's own springs. Returns true while anything moves. */\n step?: (dt: number, still: boolean) => boolean\n shapes: () => ClayShape[]\n}\n\nconst isDisabled = (el: HTMLElement) =>\n el.matches(\"[data-disabled], [aria-disabled='true']\") ||\n !!el.querySelector(\":disabled, [aria-disabled='true'], [data-disabled]\")\n\nclass ClaySurface implements ClayView {\n readonly host: HTMLElement\n readonly canvas = document.createElement(\"canvas\")\n readonly ctx: CanvasRenderingContext2D\n pad: number\n readonly hover = new Spring(0)\n readonly press = new Spring(0)\n width = 0\n height = 0\n visible = true\n dirty = true\n /**\n * Measure again on the next frame, without waking the engine. For a surface that follows another\n * element's box while that element moves: `dirty` is spent by the frame's draw before the next measure.\n */\n stale = false\n key = \"\"\n pointer: { x: number; y: number } | null = null\n private options: SurfaceOptions\n private colors = new Map<string, RGB>()\n private cleanup: Array<() => void> = []\n private ready = false\n private lastSx = \"\"\n private lastSy = \"\"\n private placed = false\n private calmed = false\n\n constructor(host: HTMLElement, options: SurfaceOptions) {\n this.host = host\n this.options = options\n this.pad = typeof options.pad === \"number\" ? options.pad : 28\n this.calmed = options.calm ?? false\n this.ctx = this.canvas.getContext(\"2d\")!\n this.canvas.className = \"clay-canvas\"\n this.canvas.setAttribute(\"aria-hidden\", \"true\")\n this.canvas.dataset.clayCanvas = \"\"\n }\n\n static attach(host: HTMLElement, options: SurfaceOptions) {\n const engine = getClayEngine()\n if (!engine) return null\n const surface = new ClaySurface(host, options)\n surface.connect()\n engine.add(surface)\n return surface\n }\n\n private connect() {\n const { host } = this\n host.setAttribute(\"data-clay-host\", \"\")\n host.prepend(this.canvas)\n\n const resize = new ResizeObserver(() => this.invalidate())\n resize.observe(host)\n const visibility = new IntersectionObserver(\n ([entry]) => {\n this.visible = entry!.isIntersecting\n if (this.visible) this.invalidate()\n },\n { rootMargin: \"120px\" }\n )\n visibility.observe(host)\n this.cleanup.push(() => resize.disconnect(), () => visibility.disconnect())\n\n const target = this.options.pressTarget ?? host\n const on = <K extends keyof HTMLElementEventMap>(\n type: K,\n handler: (event: HTMLElementEventMap[K]) => void\n ) => {\n target.addEventListener(type, handler)\n this.cleanup.push(() => target.removeEventListener(type, handler))\n }\n on(\"pointerenter\", () => this.setHover(true))\n // The pointer stays where it left, so the light leaning toward it eases back with the hover.\n on(\"pointerleave\", () => {\n this.setHover(false)\n this.setPress(false)\n })\n on(\"pointermove\", (event) => {\n const box = host.getBoundingClientRect()\n const sx = box.width / (host.offsetWidth || 1)\n const sy = box.height / (host.offsetHeight || 1)\n this.pointer = { x: (event.clientX - box.left) / sx, y: (event.clientY - box.top) / sy }\n this.wake()\n })\n on(\"pointerdown\", (event) => {\n if (event.button === 0) this.setPress(true)\n })\n on(\"pointerup\", () => this.setPress(false))\n on(\"pointercancel\", () => this.setPress(false))\n on(\"keydown\", (event) => {\n if (!event.repeat && (event.key === \" \" || event.key === \"Enter\")) this.setPress(true)\n })\n on(\"keyup\", () => this.setPress(false))\n on(\"focusout\", () => this.setPress(false))\n }\n\n destroy() {\n getClayEngine()?.remove(this)\n for (const fn of this.cleanup) fn()\n this.canvas.remove()\n this.host.removeAttribute(\"data-clay-ready\")\n this.host.removeAttribute(\"data-clay-host\")\n }\n\n private setHover(on: boolean) {\n this.hover.target = on && !this.calmed && !isDisabled(this.host) ? 1 : 0\n this.wake()\n }\n\n private setPress(on: boolean) {\n this.press.target = on && !this.calmed && !isDisabled(this.host) ? 1 : 0\n this.wake()\n }\n\n /**\n * Holds the surface still: no swell, squash or light leaning toward the pointer. A trigger stays calm\n * while its popup is melted onto it, so the joint between them doesn't shift as the pointer moves.\n */\n calm(on: boolean) {\n if (on === this.calmed) return\n this.calmed = on\n if (on) {\n this.hover.target = 0\n this.press.target = 0\n }\n this.wake()\n }\n\n /** A little squash and spring back, as when something tucks back into it. */\n bounce(strength = 1) {\n this.press.v += 7 * strength\n this.wake()\n }\n\n invalidate() {\n this.dirty = true\n this.wake()\n }\n\n wake() {\n getClayEngine()?.wake()\n }\n\n /**\n * The resolved colour of a CSS custom property, cached until the surface is dirty. `--clay-color`\n * comes from the owner, so a clay card around a part can't recolour it; the rest from the host.\n */\n color(property: string, fallback?: RGB): RGB {\n let value = this.colors.get(property)\n if (!value) {\n const source = property === \"--clay-color\" ? (this.options.owner ?? this.host) : this.host\n value = resolveColor(getComputedStyle(source).getPropertyValue(property), fallback)\n this.colors.set(property, value)\n }\n return value\n }\n\n /**\n * The canvas needs a positioned host. Decided on the first frame, once ui-sdk has styled its parts:\n * a popup or dialog in the top layer would turn `relative` into `absolute` and leave the viewport.\n */\n private place() {\n this.placed = true\n const { host } = this\n if (host.matches(\"[popover], [data-slot$='-content'], [data-slot='toast'], [data-slot='toast-region']\")) return\n if (getComputedStyle(host).position !== \"static\") return\n host.style.position = \"relative\"\n this.cleanup.push(() => host.style.removeProperty(\"position\"))\n }\n\n tick(dt: number, still: boolean) {\n if (!this.placed) this.place()\n // A closed popup or an empty toast stack: WebGL2 is running and draws it on its first visible frame,\n // so its CSS clay must not flash up for the frame it shows on.\n if (!this.ready && (!this.host.offsetWidth || !this.host.offsetHeight)) this.drawn()\n if (this.dirty || this.stale) {\n this.stale = false\n this.width = this.host.offsetWidth\n this.height = this.host.offsetHeight\n this.colors.clear()\n this.options.measure?.()\n const pad = typeof this.options.pad === \"function\" ? this.options.pad() : this.pad\n this.pad = pad\n const style = this.canvas.style\n style.left = style.top = `${-pad}px`\n style.width = `${this.width + pad * 2}px`\n style.height = `${this.height + pad * 2}px`\n }\n let moving = this.hover.step(dt, SPRINGS.hover, still)\n moving = this.press.step(dt, SPRINGS.press, still) || moving\n moving = (this.options.step?.(dt, still) ?? false) || moving\n if (this.options.swell !== false) this.applySquash()\n return moving\n }\n\n private applySquash() {\n const swell = 1 + this.hover.x * CLAY.hoverSwell\n const squash = this.press.x * CLAY.pressSquash\n const sx = (swell * (1 + squash * 0.8)).toFixed(4)\n const sy = (swell * (1 - squash)).toFixed(4)\n if (sx !== this.lastSx) this.host.style.setProperty(\"--clay-sx\", (this.lastSx = sx))\n if (sy !== this.lastSy) this.host.style.setProperty(\"--clay-sy\", (this.lastSy = sy))\n }\n\n frame(): ClayFrame {\n // Calm, it's lit like the popup melted onto it, so the two sides of the joint match.\n const lean = this.pointer && !this.calmed ? CLAY.pointerLean * this.hover.x : 0\n let lx = CLAY.lightX\n let ly = CLAY.lightY\n if (this.pointer && lean > 0) {\n const dx = this.pointer.x / Math.max(this.width, 1) - 0.5\n const dy = this.pointer.y / Math.max(this.height, 1) - 0.5\n lx += Math.round(dx * 2 * lean * 100) / 100\n ly += Math.round(dy * 2 * lean * 100) / 100\n }\n return {\n shapes: this.options.shapes(),\n pointer: this.pointer && this.hover.x > 0.01 ? { ...this.pointer, strength: this.hover.x } : null,\n glow: this.calmed ? 0 : this.press.x * CLAY.glow,\n light: [lx, ly, CLAY.lightZ],\n }\n }\n\n drawn() {\n if (this.ready) return\n this.ready = true\n this.host.setAttribute(\"data-clay-ready\", \"\")\n }\n\n lost() {\n this.ready = false\n this.host.removeAttribute(\"data-clay-ready\")\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)\n this.dirty = true\n }\n}\n\n/** The offset of an element inside a host, in untransformed layout px. */\nfunction offsetWithin(el: HTMLElement, host: HTMLElement) {\n const a = el.getBoundingClientRect()\n const b = host.getBoundingClientRect()\n const sx = b.width / (host.offsetWidth || 1) || 1\n const sy = b.height / (host.offsetHeight || 1) || 1\n return { x: (a.left - b.left) / sx, y: (a.top - b.top) / sy, w: a.width / sx, h: a.height / sy }\n}\n\nexport { ClaySurface, offsetWithin, type SurfaceOptions }\n"],"mappings":";;;;;AAuBA,IAAM,cAAc,OAClB,GAAG,QAAQ,yCAAyC,KACpD,CAAC,CAAC,GAAG,cAAc,oDAAoD;AAEzE,IAAM,cAAN,MAAM,YAAgC;CACpC;CACA,SAAkB,SA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