@alulore/kumiko 0.20.2 → 0.21.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 (82) hide show
  1. package/dist/avatar/avatar.js +1 -1
  2. package/dist/badge/badge.css +41 -3
  3. package/dist/badge/badge.js +11 -4
  4. package/dist/button/button.css +21 -7
  5. package/dist/card/card.css +3 -2
  6. package/dist/card/item-card.d.ts +1 -1
  7. package/dist/card/item-card.js +3 -2
  8. package/dist/chip/chip.css +6 -10
  9. package/dist/chip/chip.js +1 -1
  10. package/dist/form/error-line.js +4 -3
  11. package/dist/input/input.css +99 -114
  12. package/dist/list-row/list-row-motion.js +29 -10
  13. package/dist/media-viewer/gesture-press.d.ts +1 -0
  14. package/dist/media-viewer/gesture-press.js +12 -0
  15. package/dist/media-viewer/media-slide.d.ts +3 -1
  16. package/dist/media-viewer/media-slide.js +3 -2
  17. package/dist/media-viewer/media-viewer.css +5 -1
  18. package/dist/media-viewer/media-viewer.js +41 -23
  19. package/dist/media-viewer/stage-rect.d.ts +16 -0
  20. package/dist/media-viewer/stage-rect.js +56 -0
  21. package/dist/media-viewer/view-gesture.d.ts +1 -2
  22. package/dist/media-viewer/view-gesture.js +39 -44
  23. package/dist/media-viewer/viewer-chrome.d.ts +2 -1
  24. package/dist/media-viewer/viewer-chrome.js +3 -1
  25. package/dist/media-viewer/viewer-motion.d.ts +1 -0
  26. package/dist/media-viewer/viewer-motion.js +20 -7
  27. package/dist/media-viewer/zoom-pan.d.ts +1 -0
  28. package/dist/media-viewer/zoom-pan.js +3 -0
  29. package/dist/media-viewer/zoom-store.d.ts +8 -0
  30. package/dist/media-viewer/zoom-store.js +30 -0
  31. package/dist/menu/menu.js +6 -3
  32. package/dist/menu/point-menu.js +32 -12
  33. package/dist/page/page-actions.js +2 -1
  34. package/dist/page/page-breadcrumbs.js +2 -1
  35. package/dist/page/use-measured-fit.d.ts +5 -0
  36. package/dist/page/use-measured-fit.js +47 -5
  37. package/dist/page/use-stuck.js +12 -2
  38. package/dist/pagination/pagination-fit.d.ts +3 -1
  39. package/dist/pagination/pagination-fit.js +4 -3
  40. package/dist/pagination/pagination-motion.js +18 -11
  41. package/dist/pagination/pagination.css +50 -6
  42. package/dist/pagination/pagination.js +20 -3
  43. package/dist/progress/progress.css +3 -2
  44. package/dist/progress/progress.js +15 -3
  45. package/dist/select/select-labels.d.ts +2 -0
  46. package/dist/select/select-labels.js +5 -1
  47. package/dist/select/select.css +7 -11
  48. package/dist/select/select.d.ts +1 -1
  49. package/dist/select/select.js +12 -6
  50. package/dist/shortcuts/hints.js +10 -4
  51. package/dist/shortcuts/provider.d.ts +4 -2
  52. package/dist/shortcuts/provider.js +14 -17
  53. package/dist/skeleton/skeleton.css +22 -9
  54. package/dist/slider/slider-feel.js +18 -6
  55. package/dist/slider/slider.css +9 -10
  56. package/dist/slider/slider.js +13 -10
  57. package/dist/smooth-caret/caret-controller.js +37 -11
  58. package/dist/smooth-caret/caret-geometry.js +18 -7
  59. package/dist/smooth-caret/caret-glide.js +3 -2
  60. package/dist/smooth-caret/remote-carets.js +20 -3
  61. package/dist/smooth-caret/smooth-caret.css +4 -2
  62. package/dist/smooth-caret/top-layer.d.ts +2 -0
  63. package/dist/smooth-caret/top-layer.js +6 -0
  64. package/dist/switch/switch-gesture.d.ts +4 -4
  65. package/dist/switch/switch-gesture.js +52 -14
  66. package/dist/switch/switch.css +12 -13
  67. package/dist/switch/switch.d.ts +2 -1
  68. package/dist/switch/switch.js +4 -6
  69. package/dist/table/data-table.js +32 -12
  70. package/dist/table/table-cells.d.ts +20 -8
  71. package/dist/table/table-cells.js +18 -20
  72. package/dist/table/table-model.d.ts +0 -2
  73. package/dist/table/table-model.js +15 -9
  74. package/dist/table/table-search.d.ts +12 -0
  75. package/dist/table/table-search.js +34 -0
  76. package/dist/table/table-sections.d.ts +3 -2
  77. package/dist/table/table-sections.js +16 -13
  78. package/dist/table/table.css +2 -14
  79. package/dist/table/use-latest.d.ts +6 -0
  80. package/dist/table/use-latest.js +22 -0
  81. package/dist/table/use-table-view.js +36 -24
  82. package/package.json +1 -1
@@ -41,5 +41,5 @@ export function AvatarGroup({ max, size = "md", moreLabel = (hidden) => `${hidde
41
41
  * screen readers.
42
42
  */
43
43
  export function AvatarLabel({ name, detail, src, size = "md", shape, status, avatar, ...props }) {
44
- return (_jsxs("div", { "data-slot": "avatar-label", "data-size": size, ...props, children: [_jsx("span", { "data-slot": "avatar-label-picture", "aria-hidden": true, children: avatar ?? (_jsx(Avatar, { src: src, name: name, size: size, shape: shape, status: status })) }), _jsxs("span", { "data-slot": "avatar-label-text", children: [_jsx("span", { "data-slot": "avatar-label-name", children: name }), detail ? _jsx("span", { "data-slot": "avatar-label-detail", children: detail }) : null] })] }));
44
+ return (_jsxs("div", { "data-slot": "avatar-label", "data-size": size, ...props, children: [avatar ? (_jsx("span", { "data-slot": "avatar-label-picture", "aria-hidden": true, children: avatar })) : (_jsx(Avatar, { src: src, name: name, size: size, shape: shape, status: status, "aria-hidden": true })), _jsxs("span", { "data-slot": "avatar-label-text", children: [_jsx("span", { "data-slot": "avatar-label-name", children: name }), detail ? _jsx("span", { "data-slot": "avatar-label-detail", children: detail }) : null] })] }));
45
45
  }
@@ -131,14 +131,47 @@
131
131
  [data-kumiko-badge~="dot-pulse"] *
132
132
  )
133
133
  ):not([data-kumiko-motion="still"] *) {
134
- animation: kumiko-badge-pulse var(--kumiko-badge-pulse-duration) ease-in-out infinite;
134
+ position: relative;
135
+ background: transparent;
136
+ box-shadow: none;
137
+
138
+ /* The dot and its glow are drawn by two sibling layers: one scales, one fades and scales. A pulse on the dot itself, or on the dot and a layer inside it, is restyled on every frame; siblings run on the compositor. */
139
+ &::before,
140
+ &::after {
141
+ position: absolute;
142
+ inset: 0;
143
+ border-radius: inherit;
144
+ content: "";
145
+ pointer-events: none;
146
+ }
147
+
148
+ &::before {
149
+ background: var(--_dot-fill, var(--_tone));
150
+ box-shadow: 0 0 var(--_glow) calc(var(--_glow) * 0.25)
151
+ color-mix(in oklab, var(--_tone) var(--kumiko-badge-glow-mix), transparent);
152
+ animation: kumiko-badge-pulse var(--kumiko-badge-pulse-duration) ease-in-out
153
+ infinite;
154
+ }
155
+
156
+ &::after {
157
+ box-shadow: 0 0 calc(var(--_glow) * 2) var(--_glow)
158
+ color-mix(in oklab, var(--_tone) var(--kumiko-badge-glow-mix), transparent);
159
+ opacity: 0;
160
+ animation: kumiko-badge-pulse-glow var(--kumiko-badge-pulse-duration) ease-in-out
161
+ infinite;
162
+ }
135
163
  }
136
164
  }
137
165
 
138
166
  @keyframes kumiko-badge-pulse {
139
167
  50% {
140
- box-shadow: 0 0 calc(var(--_glow) * 2) var(--_glow)
141
- color-mix(in oklab, var(--_tone) var(--kumiko-badge-glow-mix), transparent);
168
+ scale: var(--kumiko-badge-pulse-scale);
169
+ }
170
+ }
171
+
172
+ @keyframes kumiko-badge-pulse-glow {
173
+ 50% {
174
+ opacity: 1;
142
175
  scale: var(--kumiko-badge-pulse-scale);
143
176
  }
144
177
  }
@@ -270,12 +303,17 @@
270
303
  }
271
304
 
272
305
  [data-slot="badge"][data-variant="dot"] {
306
+ --_glow: 0px;
307
+ --_dot-fill: CanvasText;
308
+
273
309
  border: 0;
274
310
  background: CanvasText;
275
311
  box-shadow: none;
276
312
  }
277
313
 
278
314
  [data-slot="badge"][data-variant="dot"][data-tone="accent"] {
315
+ --_dot-fill: Highlight;
316
+
279
317
  background: Highlight;
280
318
  }
281
319
 
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
2
+ import { useLayoutEffect, useRef, useState } from "react";
3
3
  /** Remembers the last value, which way a number moved and how many times it changed, and lets the old value go. */
4
4
  function useChange(value) {
5
5
  const [change, setChange] = useState({
@@ -8,8 +8,9 @@ function useChange(value) {
8
8
  direction: "up",
9
9
  tick: 0
10
10
  });
11
+ const settle = () => setChange((latest) => latest.previous === undefined ? latest : { ...latest, previous: undefined });
11
12
  if (change.shown === value) {
12
- return [change, () => setChange({ ...change, previous: undefined })];
13
+ return [change, settle];
13
14
  }
14
15
  const lower = typeof value === "number" && typeof change.shown === "number" && value < change.shown;
15
16
  const next = {
@@ -19,13 +20,19 @@ function useChange(value) {
19
20
  tick: change.tick + 1
20
21
  };
21
22
  setChange(next);
22
- return [next, () => setChange({ ...next, previous: undefined })];
23
+ return [next, settle];
23
24
  }
24
25
  /** A number or text that moves each time it changes, but not when it first appears. The old value is hidden from screen readers. */
25
26
  function Count({ value }) {
26
27
  const [change, settle] = useChange(value);
27
28
  const old = change.previous;
28
- return (_jsx("span", { "data-slot": "badge-clip", children: _jsxs("span", { "data-slot": "badge-value", "data-change": old === undefined ? undefined : change.direction, onAnimationEnd: (event) => {
29
+ const element = useRef(null);
30
+ useLayoutEffect(() => {
31
+ if (old !== undefined && element.current?.getAnimations().length === 0) {
32
+ settle();
33
+ }
34
+ }, [change.tick]);
35
+ return (_jsx("span", { "data-slot": "badge-clip", children: _jsxs("span", { ref: element, "data-slot": "badge-value", "data-change": old === undefined ? undefined : change.direction, onAnimationEnd: (event) => {
29
36
  if (event.target === event.currentTarget) {
30
37
  settle();
31
38
  }
@@ -107,7 +107,8 @@
107
107
  var(--kumiko-button-shimmer-color) 50%,
108
108
  transparent 65%
109
109
  );
110
- --_shimmer-size: 250% 100%;
110
+ --_shimmer-span: 2.5;
111
+ --_shimmer-overflow: clip;
111
112
  --_orbit-animation: kumiko-button-orbit var(--kumiko-button-orbit-duration)
112
113
  var(--kumiko-button-sweep-ease) infinite;
113
114
  --_breathe-animation: kumiko-button-breathe var(--kumiko-button-breathe-duration)
@@ -364,12 +365,23 @@
364
365
  opacity: var(--kumiko-button-loading-dim);
365
366
  }
366
367
 
368
+ /* The band is a strip wider than the face that slides across it, so the sweep runs on the compositor. The face clips it at its outer edge. */
369
+ [data-slot="button"][data-status="loading"][data-loading-style="shimmer"] {
370
+ overflow: var(--_shimmer-overflow);
371
+ overflow-clip-margin: border-box;
372
+ }
373
+
367
374
  [data-slot="button"][data-status="loading"][data-loading-style="shimmer"]::after {
368
375
  content: "";
369
376
  position: absolute;
370
- inset: calc(var(--kumiko-button-border-width) * -1);
377
+ inset-block: calc(var(--kumiko-button-border-width) * -1);
378
+ left: calc(var(--kumiko-button-border-width) * -1);
379
+ right: calc(
380
+ var(--kumiko-button-border-width) * -1 -
381
+ (100% + var(--kumiko-button-border-width) * 2) * (var(--_shimmer-span) - 1)
382
+ );
371
383
  border-radius: inherit;
372
- background: var(--_shimmer-image) 100% 0 / var(--_shimmer-size) no-repeat;
384
+ background: var(--_shimmer-image) 100% 0 / 100% 100% no-repeat;
373
385
  pointer-events: none;
374
386
  animation: var(--_shimmer-animation);
375
387
  }
@@ -452,11 +464,11 @@
452
464
 
453
465
  @keyframes kumiko-button-shimmer {
454
466
  from {
455
- background-position: 100% 0;
467
+ translate: calc((1 / var(--_shimmer-span) - 1) * 100%) 0;
456
468
  }
457
469
 
458
470
  to {
459
- background-position: 0 0;
471
+ translate: 0 0;
460
472
  }
461
473
  }
462
474
 
@@ -524,7 +536,8 @@
524
536
  var(--kumiko-button-shimmer-color),
525
537
  var(--kumiko-button-shimmer-color)
526
538
  );
527
- --_shimmer-size: 100% 100%;
539
+ --_shimmer-span: 1;
540
+ --_shimmer-overflow: visible;
528
541
  --_orbit-animation: kumiko-button-fade var(--kumiko-button-reduced-duration)
529
542
  var(--kumiko-button-pulse-ease) infinite alternate;
530
543
  --_breathe-animation: kumiko-button-breathe var(--kumiko-button-reduced-duration)
@@ -546,7 +559,8 @@
546
559
  var(--kumiko-button-shimmer-color),
547
560
  var(--kumiko-button-shimmer-color)
548
561
  );
549
- --_shimmer-size: 100% 100%;
562
+ --_shimmer-span: 1;
563
+ --_shimmer-overflow: visible;
550
564
  --_orbit-animation: kumiko-button-fade var(--kumiko-button-reduced-duration)
551
565
  var(--kumiko-button-pulse-ease) infinite alternate;
552
566
  --_breathe-animation: kumiko-button-breathe var(--kumiko-button-reduced-duration)
@@ -588,12 +588,13 @@
588
588
  line-height: 1.2;
589
589
  }
590
590
 
591
- [data-slot="item-card-eyebrow"] > i {
591
+ [data-slot="item-card-eyebrow"]::before {
592
+ content: "";
592
593
  flex: none;
593
594
  inline-size: 0.5rem;
594
595
  block-size: 0.5rem;
595
596
  border-radius: 3px;
596
- background: var(--kumiko-item-card-dot);
597
+ background: var(--_eyebrow-dot, var(--kumiko-item-card-dot));
597
598
  rotate: 45deg;
598
599
  }
599
600
 
@@ -63,7 +63,7 @@ export type ItemCardEyebrowProps = React.ComponentPropsWithoutRef<"span"> & {
63
63
  dot?: string;
64
64
  };
65
65
  /** A small line above the title, led by a coloured diamond. */
66
- export declare function ItemCardEyebrow({ dot, children, ...props }: ItemCardEyebrowProps): React.JSX.Element;
66
+ export declare function ItemCardEyebrow({ dot, style, ...props }: ItemCardEyebrowProps): React.JSX.Element;
67
67
  /** The title. A done card shows it quiet, and struck through or drawn through, by its look. */
68
68
  export declare function ItemCardTitle({ children, ...props }: React.ComponentPropsWithoutRef<"span">): React.JSX.Element;
69
69
  export type ItemCardTextProps = React.ComponentPropsWithoutRef<"span"> & {
@@ -53,8 +53,9 @@ export function ItemCard({ asChild = false, pressable: pressableProp, onClick, c
53
53
  });
54
54
  }
55
55
  /** A small line above the title, led by a coloured diamond. */
56
- export function ItemCardEyebrow({ dot, children, ...props }) {
57
- return (_jsxs("span", { "data-slot": "item-card-eyebrow", ...props, children: [_jsx("i", { "aria-hidden": "true", style: dot ? { background: dot } : undefined }), children] }));
56
+ export function ItemCardEyebrow({ dot, style, ...props }) {
57
+ const own = dot ? { "--_eyebrow-dot": dot } : undefined;
58
+ return (_jsx("span", { "data-slot": "item-card-eyebrow", style: own ? { ...style, ...own } : style, ...props }));
58
59
  }
59
60
  /** The title. A done card shows it quiet, and struck through or drawn through, by its look. */
60
61
  export function ItemCardTitle({ children, ...props }) {
@@ -87,10 +87,7 @@
87
87
  /* The tick takes no room until the tint look asks for it. */
88
88
  [data-slot="chip-tick"] {
89
89
  display: none;
90
- }
91
-
92
- [data-slot="chip-tick"] > svg {
93
- display: block;
90
+ flex: none;
94
91
  inline-size: 1em;
95
92
  block-size: 1em;
96
93
  }
@@ -196,15 +193,14 @@
196
193
  )
197
194
  )
198
195
  [data-slot="chip-tick"] {
199
- display: inline-grid;
200
- inline-size: 0;
201
- margin-inline-end: calc(var(--kumiko-chip-gap) * -1);
202
- overflow: hidden;
196
+ display: block;
197
+ margin-inline-end: calc(-1em - var(--kumiko-chip-gap));
198
+ clip-path: inset(0 calc(50% + 50% * var(--_dir)) 0 calc(50% - 50% * var(--_dir)));
203
199
  opacity: 0;
204
200
  translate: calc(-0.5em * var(--_dir)) 0;
205
201
  transition:
206
- inline-size var(--kumiko-move-duration) var(--kumiko-move-ease),
207
202
  margin-inline-end var(--kumiko-move-duration) var(--kumiko-move-ease),
203
+ clip-path var(--kumiko-move-duration) var(--kumiko-move-ease),
208
204
  opacity var(--kumiko-fade-duration) var(--kumiko-fade-ease),
209
205
  translate var(--kumiko-move-duration) var(--kumiko-move-ease);
210
206
  }
@@ -217,8 +213,8 @@
217
213
  )
218
214
  )
219
215
  [data-slot="chip-tick"] {
220
- inline-size: 1em;
221
216
  margin-inline-end: 0;
217
+ clip-path: inset(0);
222
218
  opacity: 1;
223
219
  translate: 0 0;
224
220
  }
package/dist/chip/chip.js CHANGED
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Toggle } from "@ui-sdk/react/toggle";
3
3
  /** The tick of the tint look. It takes no room in the other looks. */
4
4
  function Tick() {
5
- return (_jsx("span", { "data-slot": "chip-tick", "aria-hidden": "true", children: _jsx("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: _jsx("path", { d: "M3 8.5 6.5 12 13 4.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }));
5
+ return (_jsx("svg", { "data-slot": "chip-tick", "aria-hidden": "true", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: _jsx("path", { d: "M3 8.5 6.5 12 13 4.5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
6
6
  }
7
7
  function Icon({ icon }) {
8
8
  return icon ? (_jsx("span", { "data-slot": "chip-icon", "aria-hidden": "true", children: icon })) : null;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef, useState } from "react";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
3
  import { FieldError } from "../input";
4
4
  function noFade(element) {
5
5
  return getComputedStyle(element)
@@ -14,7 +14,8 @@ function useLeaving(message) {
14
14
  setPrevious(message);
15
15
  setLeaving(message === undefined ? previous : undefined);
16
16
  }
17
- return [leaving, () => setLeaving(undefined)];
17
+ const left = useCallback(() => setLeaving(undefined), []);
18
+ return [leaving, left];
18
19
  }
19
20
  /**
20
21
  * The field's error line. It always keeps one line of room, so an error that comes and goes moves nothing; a
@@ -42,6 +43,6 @@ export function ErrorLine({ message }) {
42
43
  if (fading.current && noFade(fading.current)) {
43
44
  left();
44
45
  }
45
- });
46
+ }, [leaving, left]);
46
47
  return (_jsx("div", { ref: line, "data-kumiko-form-error-line": "", children: _jsxs("div", { ref: content, children: [message === undefined ? null : _jsx(FieldError, { match: true, children: message }), leaving === undefined ? null : (_jsx("p", { ref: fading, "aria-hidden": "true", "data-kumiko-form-error-leaving": "", onTransitionEnd: left, onTransitionCancel: left, children: leaving }))] }) }));
47
48
  }
@@ -99,122 +99,107 @@
99
99
  --kumiko-input-cozy-height: 2.625rem;
100
100
  }
101
101
 
102
- /* The look: the chosen look's tokens become the working values. Cozy is the default; a container word or the field's own `data-look` picks another. */
102
+ /* The look: the chosen look's tokens become the working values. Cozy is the default; the nearest container word or the field's own `data-look` picks another. A word switches its look on and the others off for everything inside it, so the nearest word wins while the field still reads the tokens where it sits. */
103
103
  :where(:is([data-slot="input"], [data-slot="textarea"], [data-slot="input-group"])) {
104
- --_radius: var(--kumiko-input-cozy-radius);
105
- --_bg-rest: var(--kumiko-input-cozy-bg);
106
- --_bg-hover: var(--kumiko-input-cozy-bg-hover);
107
- --_bd-rest: var(--kumiko-input-cozy-border);
108
- --_bd-hover: var(--kumiko-input-cozy-border-hover);
109
- --_bd-focus: var(--kumiko-input-cozy-border-focus, var(--kumiko-input-cozy-border-hover));
110
- --_in-rest: var(--kumiko-input-cozy-inset);
111
- --_in-focus: var(--kumiko-input-cozy-inset-focus, var(--kumiko-input-cozy-inset));
112
- --_sh-rest: var(--kumiko-input-cozy-shadow);
113
- --_sh-hover: var(--kumiko-input-cozy-shadow-hover);
114
- --_sh-focus: var(--kumiko-input-cozy-shadow-focus);
115
- --_ring-w: var(--kumiko-input-cozy-ring-width);
116
- --_ring-c: var(--kumiko-input-cozy-ring);
117
- --_ph: var(--kumiko-input-cozy-placeholder);
118
- --_px: var(--kumiko-input-cozy-padding-inline);
119
- --_py: var(--kumiko-input-cozy-padding-block);
120
- --_fs: var(--kumiko-input-cozy-font-size);
121
- --_h: var(--kumiko-input-cozy-height);
122
- }
123
-
124
- :where(
125
- [data-kumiko-field~="look-cozy"]
126
- :is([data-slot="input"], [data-slot="textarea"], [data-slot="input-group"]),
127
- :is(
128
- [data-slot="input"],
129
- [data-slot="textarea"],
130
- [data-slot="input-group"]
131
- )[data-kumiko-field~="look-cozy"]
132
- ) {
133
- --_radius: var(--kumiko-input-cozy-radius);
134
- --_bg-rest: var(--kumiko-input-cozy-bg);
135
- --_bg-hover: var(--kumiko-input-cozy-bg-hover);
136
- --_bd-rest: var(--kumiko-input-cozy-border);
137
- --_bd-hover: var(--kumiko-input-cozy-border-hover);
138
- --_bd-focus: var(--kumiko-input-cozy-border-focus, var(--kumiko-input-cozy-border-hover));
139
- --_in-rest: var(--kumiko-input-cozy-inset);
140
- --_in-focus: var(--kumiko-input-cozy-inset-focus, var(--kumiko-input-cozy-inset));
141
- --_sh-rest: var(--kumiko-input-cozy-shadow);
142
- --_sh-hover: var(--kumiko-input-cozy-shadow-hover);
143
- --_sh-focus: var(--kumiko-input-cozy-shadow-focus);
144
- --_ring-w: var(--kumiko-input-cozy-ring-width);
145
- --_ring-c: var(--kumiko-input-cozy-ring);
146
- --_ph: var(--kumiko-input-cozy-placeholder);
147
- --_px: var(--kumiko-input-cozy-padding-inline);
148
- --_py: var(--kumiko-input-cozy-padding-block);
149
- --_fs: var(--kumiko-input-cozy-font-size);
150
- --_h: var(--kumiko-input-cozy-height);
151
- }
152
-
153
- :where(
154
- [data-kumiko-field~="look-calm"]
155
- :is([data-slot="input"], [data-slot="textarea"], [data-slot="input-group"]),
156
- :is(
157
- [data-slot="input"],
158
- [data-slot="textarea"],
159
- [data-slot="input-group"]
160
- )[data-kumiko-field~="look-calm"]
161
- ) {
162
- --_radius: var(--kumiko-input-calm-radius);
163
- --_bg-rest: var(--kumiko-input-calm-bg);
164
- --_bg-hover: var(--kumiko-input-calm-bg-hover);
165
- --_bd-rest: var(--kumiko-input-calm-border);
166
- --_bd-hover: var(--kumiko-input-calm-border-hover);
167
- --_bd-focus: var(--kumiko-input-calm-border-focus, var(--kumiko-input-accent));
168
- --_in-rest: var(--kumiko-input-calm-inset);
169
- --_in-focus: var(--kumiko-input-calm-inset-focus, var(--kumiko-input-calm-inset));
170
- --_sh-rest: var(--kumiko-input-calm-shadow);
171
- --_sh-hover: var(--kumiko-input-calm-shadow-hover);
172
- --_sh-focus: var(--kumiko-input-calm-shadow-focus);
173
- --_ring-w: var(--kumiko-input-calm-ring-width);
174
- --_ring-c: var(
175
- --kumiko-input-calm-ring,
176
- color-mix(in oklab, var(--kumiko-input-accent) 28%, transparent)
177
- );
178
- --_ph: var(--kumiko-input-calm-placeholder);
179
- --_px: var(--kumiko-input-calm-padding-inline);
180
- --_py: var(--kumiko-input-calm-padding-block);
181
- --_fs: var(--kumiko-input-calm-font-size);
182
- --_h: var(--kumiko-input-calm-height);
183
- }
184
-
185
- :where(
186
- [data-kumiko-field~="look-raised"]
187
- :is([data-slot="input"], [data-slot="textarea"], [data-slot="input-group"]),
188
- :is(
189
- [data-slot="input"],
190
- [data-slot="textarea"],
191
- [data-slot="input-group"]
192
- )[data-kumiko-field~="look-raised"]
193
- ) {
194
- --_radius: var(--kumiko-input-raised-radius);
195
- --_bg-rest: var(--kumiko-input-raised-bg);
196
- --_bg-hover: var(--kumiko-input-raised-bg-hover);
197
- --_bd-rest: var(--kumiko-input-raised-border);
198
- --_bd-hover: var(--kumiko-input-raised-border-hover);
104
+ --_radius: var(--_on-cozy, var(--kumiko-input-cozy-radius))
105
+ var(--_on-calm, var(--kumiko-input-calm-radius))
106
+ var(--_on-raised, var(--kumiko-input-raised-radius));
107
+ --_bg-rest: var(--_on-cozy, var(--kumiko-input-cozy-bg))
108
+ var(--_on-calm, var(--kumiko-input-calm-bg))
109
+ var(--_on-raised, var(--kumiko-input-raised-bg));
110
+ --_bg-hover: var(--_on-cozy, var(--kumiko-input-cozy-bg-hover))
111
+ var(--_on-calm, var(--kumiko-input-calm-bg-hover))
112
+ var(--_on-raised, var(--kumiko-input-raised-bg-hover));
113
+ --_bd-rest: var(--_on-cozy, var(--kumiko-input-cozy-border))
114
+ var(--_on-calm, var(--kumiko-input-calm-border))
115
+ var(--_on-raised, var(--kumiko-input-raised-border));
116
+ --_bd-hover: var(--_on-cozy, var(--kumiko-input-cozy-border-hover))
117
+ var(--_on-calm, var(--kumiko-input-calm-border-hover))
118
+ var(--_on-raised, var(--kumiko-input-raised-border-hover));
199
119
  --_bd-focus: var(
200
- --kumiko-input-raised-border-focus,
201
- color-mix(in oklab, var(--kumiko-input-accent) 45%, transparent)
202
- );
203
- --_in-rest: var(--kumiko-input-raised-inset);
204
- --_in-focus: var(--kumiko-input-raised-inset-focus, var(--kumiko-input-raised-inset));
205
- --_sh-rest: var(--kumiko-input-raised-shadow);
206
- --_sh-hover: var(--kumiko-input-raised-shadow-hover);
207
- --_sh-focus: var(--kumiko-input-raised-shadow-focus);
208
- --_ring-w: var(--kumiko-input-raised-ring-width);
209
- --_ring-c: var(
210
- --kumiko-input-raised-ring,
211
- color-mix(in oklab, var(--kumiko-input-accent) 50%, transparent)
212
- );
213
- --_ph: var(--kumiko-input-raised-placeholder);
214
- --_px: var(--kumiko-input-raised-padding-inline);
215
- --_py: var(--kumiko-input-raised-padding-block);
216
- --_fs: var(--kumiko-input-raised-font-size);
217
- --_h: var(--kumiko-input-raised-height);
120
+ --_on-cozy,
121
+ var(--kumiko-input-cozy-border-focus, var(--kumiko-input-cozy-border-hover))
122
+ )
123
+ var(--_on-calm, var(--kumiko-input-calm-border-focus, var(--kumiko-input-accent)))
124
+ var(
125
+ --_on-raised,
126
+ var(
127
+ --kumiko-input-raised-border-focus,
128
+ color-mix(in oklab, var(--kumiko-input-accent) 45%, transparent)
129
+ )
130
+ );
131
+ --_in-rest: var(--_on-cozy, var(--kumiko-input-cozy-inset))
132
+ var(--_on-calm, var(--kumiko-input-calm-inset))
133
+ var(--_on-raised, var(--kumiko-input-raised-inset));
134
+ --_in-focus: var(
135
+ --_on-cozy,
136
+ var(--kumiko-input-cozy-inset-focus, var(--kumiko-input-cozy-inset))
137
+ )
138
+ var(--_on-calm, var(--kumiko-input-calm-inset-focus, var(--kumiko-input-calm-inset)))
139
+ var(
140
+ --_on-raised,
141
+ var(--kumiko-input-raised-inset-focus, var(--kumiko-input-raised-inset))
142
+ );
143
+ --_sh-rest: var(--_on-cozy, var(--kumiko-input-cozy-shadow))
144
+ var(--_on-calm, var(--kumiko-input-calm-shadow))
145
+ var(--_on-raised, var(--kumiko-input-raised-shadow));
146
+ --_sh-hover: var(--_on-cozy, var(--kumiko-input-cozy-shadow-hover))
147
+ var(--_on-calm, var(--kumiko-input-calm-shadow-hover))
148
+ var(--_on-raised, var(--kumiko-input-raised-shadow-hover));
149
+ --_sh-focus: var(--_on-cozy, var(--kumiko-input-cozy-shadow-focus))
150
+ var(--_on-calm, var(--kumiko-input-calm-shadow-focus))
151
+ var(--_on-raised, var(--kumiko-input-raised-shadow-focus));
152
+ --_ring-w: var(--_on-cozy, var(--kumiko-input-cozy-ring-width))
153
+ var(--_on-calm, var(--kumiko-input-calm-ring-width))
154
+ var(--_on-raised, var(--kumiko-input-raised-ring-width));
155
+ --_ring-c: var(--_on-cozy, var(--kumiko-input-cozy-ring))
156
+ var(
157
+ --_on-calm,
158
+ var(
159
+ --kumiko-input-calm-ring,
160
+ color-mix(in oklab, var(--kumiko-input-accent) 28%, transparent)
161
+ )
162
+ )
163
+ var(
164
+ --_on-raised,
165
+ var(
166
+ --kumiko-input-raised-ring,
167
+ color-mix(in oklab, var(--kumiko-input-accent) 50%, transparent)
168
+ )
169
+ );
170
+ --_ph: var(--_on-cozy, var(--kumiko-input-cozy-placeholder))
171
+ var(--_on-calm, var(--kumiko-input-calm-placeholder))
172
+ var(--_on-raised, var(--kumiko-input-raised-placeholder));
173
+ --_px: var(--_on-cozy, var(--kumiko-input-cozy-padding-inline))
174
+ var(--_on-calm, var(--kumiko-input-calm-padding-inline))
175
+ var(--_on-raised, var(--kumiko-input-raised-padding-inline));
176
+ --_py: var(--_on-cozy, var(--kumiko-input-cozy-padding-block))
177
+ var(--_on-calm, var(--kumiko-input-calm-padding-block))
178
+ var(--_on-raised, var(--kumiko-input-raised-padding-block));
179
+ --_fs: var(--_on-cozy, var(--kumiko-input-cozy-font-size))
180
+ var(--_on-calm, var(--kumiko-input-calm-font-size))
181
+ var(--_on-raised, var(--kumiko-input-raised-font-size));
182
+ --_h: var(--_on-cozy, var(--kumiko-input-cozy-height))
183
+ var(--_on-calm, var(--kumiko-input-calm-height))
184
+ var(--_on-raised, var(--kumiko-input-raised-height));
185
+ }
186
+
187
+ :where(:root, [data-kumiko-field~="look-cozy"]) {
188
+ --_on-cozy: initial;
189
+ --_on-calm: ;
190
+ --_on-raised: ;
191
+ }
192
+
193
+ :where([data-kumiko-field~="look-calm"]) {
194
+ --_on-cozy: ;
195
+ --_on-calm: initial;
196
+ --_on-raised: ;
197
+ }
198
+
199
+ :where([data-kumiko-field~="look-raised"]) {
200
+ --_on-cozy: ;
201
+ --_on-calm: ;
202
+ --_on-raised: initial;
218
203
  }
219
204
 
220
205
  :where(
@@ -1,4 +1,4 @@
1
- import { useLayoutEffect } from "react";
1
+ import { useLayoutEffect, useRef } from "react";
2
2
  /* The rows a person can reach: not static, not disabled. */
3
3
  export const ROW = '[data-slot="list-row"]:not([data-static]):not(:disabled)';
4
4
  const OWNER = '[data-kumiko-list-row~="roving"], [data-kumiko-list-row~="no-roving"]';
@@ -7,6 +7,10 @@ export function isRoving(list) {
7
7
  const owner = list.closest(OWNER);
8
8
  return owner === null || !owner.dataset.kumikoListRow?.split(" ").includes("no-roving");
9
9
  }
10
+ /* A glider only shows, and so only needs placing, under a container that glides. */
11
+ function isGliding(glider) {
12
+ return glider !== null && glider.matches('[data-kumiko-list-row~="glide"] *');
13
+ }
10
14
  /* Puts a glider over a row and copies the row's look onto it. */
11
15
  function place(glider, row) {
12
16
  const style = glider.style;
@@ -74,6 +78,12 @@ export function targetRow(list, row, key) {
74
78
  ]).get(key);
75
79
  return to === undefined ? null : (rows[to] ?? null);
76
80
  }
81
+ /* Moves the hover wash to a row, but only when it glides: otherwise it never shows, so placing it is wasted layout. */
82
+ function hoverAt(glider, row) {
83
+ if (isGliding(glider)) {
84
+ show(glider, row);
85
+ }
86
+ }
77
87
  /* The list's own handlers: the hover wash follows the mouse, focus moves the Tab stop and the arrows move focus. Each also calls the app's handler first. */
78
88
  export function useListHandlers(app, list, hoverGlide, stop) {
79
89
  const rowOf = (target) => {
@@ -84,7 +94,7 @@ export function useListHandlers(app, list, hoverGlide, stop) {
84
94
  onPointerOver: (event) => {
85
95
  app.onPointerOver?.(event);
86
96
  if (event.pointerType === "mouse") {
87
- show(hoverGlide.current, rowOf(event.target));
97
+ hoverAt(hoverGlide.current, rowOf(event.target));
88
98
  }
89
99
  },
90
100
  onPointerLeave: (event) => {
@@ -115,28 +125,37 @@ export function useListHandlers(app, list, hoverGlide, stop) {
115
125
  }
116
126
  /* After every render and every change of the rows: place the current glider and set the Tab stop. */
117
127
  export function useListSync(list, glider, stop) {
128
+ const sync = () => {
129
+ const element = list.current;
130
+ if (!element) {
131
+ return;
132
+ }
133
+ show(glider.current, element.querySelector("[data-current]"));
134
+ syncRoving(element, stop.current);
135
+ };
136
+ const latest = useRef(sync);
137
+ useLayoutEffect(() => {
138
+ latest.current = sync;
139
+ sync();
140
+ });
118
141
  useLayoutEffect(() => {
119
142
  const element = list.current;
120
143
  if (!element) {
121
144
  return undefined;
122
145
  }
123
- const sync = () => {
124
- show(glider.current, element.querySelector("[data-current]"));
125
- syncRoving(element, stop.current);
126
- };
127
- sync();
128
- const mutations = new MutationObserver(sync);
146
+ const run = () => latest.current();
147
+ const mutations = new MutationObserver(run);
129
148
  mutations.observe(element, {
130
149
  subtree: true,
131
150
  childList: true,
132
151
  attributes: true,
133
152
  attributeFilter: ["data-current", "disabled"]
134
153
  });
135
- const sizes = new ResizeObserver(sync);
154
+ const sizes = new ResizeObserver(run);
136
155
  sizes.observe(element);
137
156
  return () => {
138
157
  mutations.disconnect();
139
158
  sizes.disconnect();
140
159
  };
141
- });
160
+ }, [list]);
142
161
  }
@@ -0,0 +1 @@
1
+ export declare function pressIsForSomethingElse(event: PointerEvent): boolean;
@@ -0,0 +1,12 @@
1
+ /* Whether a press belongs to something else: a control, a link, a field, the browser's own video bar, or a button other than the main one. */
2
+ export function pressIsForSomethingElse(event) {
3
+ const target = event.target;
4
+ if (target instanceof Element && target.closest("button, a, input, [data-mv-control]")) {
5
+ return true;
6
+ }
7
+ if (target instanceof HTMLVideoElement && target.controls) {
8
+ /* The browser's own bar sits along the bottom of the video, and keeps its touches. */
9
+ return event.clientY > target.getBoundingClientRect().bottom - 56;
10
+ }
11
+ return event.pointerType === "mouse" && event.button !== 0;
12
+ }
@@ -11,4 +11,6 @@ export interface MediaSlideProps {
11
11
  /** Receives the slide's gesture while it is active, so buttons and keys can zoom it. */
12
12
  gestureRef: React.RefObject<ViewGesture | null>;
13
13
  }
14
- export declare function MediaSlide(props: MediaSlideProps): React.JSX.Element;
14
+ declare function Slide(props: MediaSlideProps): React.JSX.Element;
15
+ export declare const MediaSlide: import("react").MemoExoticComponent<typeof Slide>;
16
+ export {};