@cloudgrid-io/ui 0.65.0 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +1 -1
  2. package/dist/blocks/avatar-picker.d.ts +50 -4
  3. package/dist/blocks/avatar-picker.d.ts.map +1 -1
  4. package/dist/blocks/avatar-picker.js +56 -10
  5. package/dist/blocks/avatar-picker.js.map +1 -1
  6. package/dist/blocks/entity-card.d.ts +2 -0
  7. package/dist/blocks/entity-card.d.ts.map +1 -1
  8. package/dist/blocks/entity-card.js +20 -6
  9. package/dist/blocks/entity-card.js.map +1 -1
  10. package/dist/blocks/grid-profile.d.ts +18 -6
  11. package/dist/blocks/grid-profile.d.ts.map +1 -1
  12. package/dist/blocks/grid-profile.js +28 -17
  13. package/dist/blocks/grid-profile.js.map +1 -1
  14. package/dist/blocks/help-menu.d.ts +58 -0
  15. package/dist/blocks/help-menu.d.ts.map +1 -0
  16. package/dist/blocks/help-menu.js +64 -0
  17. package/dist/blocks/help-menu.js.map +1 -0
  18. package/dist/blocks/home-pinned.d.ts +57 -9
  19. package/dist/blocks/home-pinned.d.ts.map +1 -1
  20. package/dist/blocks/home-pinned.js +53 -11
  21. package/dist/blocks/home-pinned.js.map +1 -1
  22. package/dist/blocks/icons.d.ts +13 -0
  23. package/dist/blocks/icons.d.ts.map +1 -1
  24. package/dist/blocks/icons.js +13 -0
  25. package/dist/blocks/icons.js.map +1 -1
  26. package/dist/blocks/image-adjust-dialog.d.ts +68 -11
  27. package/dist/blocks/image-adjust-dialog.d.ts.map +1 -1
  28. package/dist/blocks/image-adjust-dialog.js +68 -16
  29. package/dist/blocks/image-adjust-dialog.js.map +1 -1
  30. package/dist/blocks/invite-popup.d.ts +63 -5
  31. package/dist/blocks/invite-popup.d.ts.map +1 -1
  32. package/dist/blocks/invite-popup.js +60 -20
  33. package/dist/blocks/invite-popup.js.map +1 -1
  34. package/dist/blocks/motion.d.ts +4 -2
  35. package/dist/blocks/motion.d.ts.map +1 -1
  36. package/dist/blocks/motion.js +30 -26
  37. package/dist/blocks/motion.js.map +1 -1
  38. package/dist/blocks/need-help-line.d.ts +21 -0
  39. package/dist/blocks/need-help-line.d.ts.map +1 -0
  40. package/dist/blocks/need-help-line.js +24 -0
  41. package/dist/blocks/need-help-line.js.map +1 -0
  42. package/dist/blocks/needs-attention.d.ts +11 -0
  43. package/dist/blocks/needs-attention.d.ts.map +1 -1
  44. package/dist/blocks/needs-attention.js +4 -1
  45. package/dist/blocks/needs-attention.js.map +1 -1
  46. package/dist/blocks/phosphor-marks.d.ts +4 -0
  47. package/dist/blocks/phosphor-marks.d.ts.map +1 -1
  48. package/dist/blocks/phosphor-marks.js +6 -0
  49. package/dist/blocks/phosphor-marks.js.map +1 -1
  50. package/dist/blocks/picture-menu.d.ts +26 -0
  51. package/dist/blocks/picture-menu.d.ts.map +1 -0
  52. package/dist/blocks/picture-menu.js +22 -0
  53. package/dist/blocks/picture-menu.js.map +1 -0
  54. package/dist/blocks/recent-plugs.d.ts +11 -3
  55. package/dist/blocks/recent-plugs.d.ts.map +1 -1
  56. package/dist/blocks/recent-plugs.js +3 -3
  57. package/dist/blocks/recent-plugs.js.map +1 -1
  58. package/dist/blocks/shared-grid-illustration.js +3 -3
  59. package/dist/blocks/shared-grid-illustration.js.map +1 -1
  60. package/dist/brand/email/headline-1-invitation-left.png +0 -0
  61. package/dist/brand/email/headline-2-invitations-left.png +0 -0
  62. package/dist/brand/email/headline-3-invitations-left.png +0 -0
  63. package/dist/brand/email/headline-4-invitations-left.png +0 -0
  64. package/dist/brand/email/headline-5-invitations-left.png +0 -0
  65. package/dist/brand/email/headline-6-invitations-left.png +0 -0
  66. package/dist/brand/email/headline-7-invitations-left.png +0 -0
  67. package/dist/brand/email/headline-8-invitations-left.png +0 -0
  68. package/dist/brand/email/headline-9-invitations-left.png +0 -0
  69. package/dist/brand/email/headline-you-have-1-invitation.png +0 -0
  70. package/dist/brand/email/headline-you-have-2-invitations.png +0 -0
  71. package/dist/brand/email/headline-you-have-3-invitations.png +0 -0
  72. package/dist/brand/email/headline-you-have-4-invitations.png +0 -0
  73. package/dist/brand/email/headline-you-have-5-invitations.png +0 -0
  74. package/dist/brand/email/headline-you-have-6-invitations.png +0 -0
  75. package/dist/brand/email/headline-you-have-7-invitations.png +0 -0
  76. package/dist/brand/email/headline-you-have-8-invitations.png +0 -0
  77. package/dist/brand/email/headline-you-have-9-invitations.png +0 -0
  78. package/dist/email/assets.d.ts +108 -0
  79. package/dist/email/assets.d.ts.map +1 -1
  80. package/dist/email/assets.js +18 -0
  81. package/dist/email/assets.js.map +1 -1
  82. package/dist/email/index.d.ts +71 -0
  83. package/dist/email/index.d.ts.map +1 -1
  84. package/dist/email/index.js +110 -5
  85. package/dist/email/index.js.map +1 -1
  86. package/dist/index.d.ts +5 -0
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +8 -0
  89. package/dist/index.js.map +1 -1
  90. package/dist/lib/fit.js +1 -1
  91. package/dist/lib/fit.js.map +1 -1
  92. package/dist/lib/motion.d.ts +49 -10
  93. package/dist/lib/motion.d.ts.map +1 -1
  94. package/dist/lib/motion.js +75 -11
  95. package/dist/lib/motion.js.map +1 -1
  96. package/dist/lib/touch-hover.d.ts +63 -0
  97. package/dist/lib/touch-hover.d.ts.map +1 -0
  98. package/dist/lib/touch-hover.js +164 -0
  99. package/dist/lib/touch-hover.js.map +1 -0
  100. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { gsap } from "gsap";
2
+ import type { gsap as GsapInstance } from "gsap";
3
3
  /**
4
4
  * The library's motion, on gsap (ui#533). The one module that imports gsap:
5
5
  * the pieces in `blocks/motion.tsx` and `blocks/shared-grid-illustration.tsx`
@@ -22,13 +22,29 @@ import { gsap } from "gsap";
22
22
  *
23
23
  * - no script (a server render, a crawler): the end state;
24
24
  * - reduced motion: the effect returns before it starts anything, so the
25
- * end state shows at once and gsap never runs;
25
+ * end state shows at once and gsap is never fetched;
26
26
  * - an unmount mid-motion: the gsap context reverts, nothing is left inline.
27
27
  *
28
28
  * A server-rendered page shows the end state for the moment between its HTML
29
29
  * painting and hydration, then runs the motion from the start. The Console's
30
30
  * Home renders its data on the client, where the layout effect runs before the
31
- * first paint and there is no such moment.
31
+ * first paint and there is no such moment, once gsap is on the page (below).
32
+ *
33
+ * ## gsap is fetched when a motion runs (ui#554)
34
+ *
35
+ * This module imports gsap's types only. gsap itself is fetched with
36
+ * `import("gsap")` the first time a piece starts a motion, and kept: a
37
+ * bundler splits it into a chunk of its own, so a page that renders a
38
+ * `RankedList` without `animated` (most of the Console) never downloads it.
39
+ * A static import here put its 28 KB gzip on every page that imports
40
+ * anything from `blocks/motion.tsx`, used or not.
41
+ *
42
+ * So the first motion on a page starts when gsap arrives, a moment after its
43
+ * layout effect, and the end state shows until then; every motion after it
44
+ * starts in its layout effect, as before. A piece undone before gsap arrives
45
+ * (unmounted, or its effect re-run) never starts. A page that knows a motion
46
+ * is coming (the Console Home, whose numbers mount after its data loads) calls
47
+ * `preloadMotion()` as it mounts, and its first motion starts at once too.
32
48
  *
33
49
  * ## The number reader
34
50
  *
@@ -85,15 +101,39 @@ export declare const useIsoLayoutEffect: typeof React.useEffect;
85
101
  */
86
102
  export type MotionState = "running" | "done" | "static";
87
103
  export declare function markMotion(el: HTMLElement | SVGElement, state: MotionState): void;
104
+ /** gsap's instance, the one the pieces tween with. */
105
+ export type Gsap = typeof GsapInstance;
106
+ /** gsap, fetched on the first call and kept; a failed fetch is tried again on the next. */
107
+ export declare function loadGsap(): Promise<Gsap>;
108
+ /**
109
+ * Runs `start` with gsap, and returns the undo. With gsap already here it runs
110
+ * at once, in the caller's layout effect; otherwise once gsap arrives. Undone
111
+ * before then, `start` never runs; after, the undo is `start`'s own. If gsap
112
+ * cannot be fetched, nothing runs and the end state, which is the markup,
113
+ * stays.
114
+ */
115
+ export declare function withGsap(start: (gsap: Gsap) => (() => void) | void): () => void;
116
+ /**
117
+ * Starts fetching gsap now, ahead of a page's first motion, so that motion
118
+ * starts in its layout effect instead of showing the end state until gsap
119
+ * arrives. The Console Home calls it as the page mounts, before its data and
120
+ * its numbers. Exported from the package entry; nothing in the library calls
121
+ * it. Does nothing on a server or under reduced motion; a failed fetch is
122
+ * ignored, and the first motion asks again.
123
+ */
124
+ export declare function preloadMotion(): void;
88
125
  /**
89
- * Runs `build` inside a gsap context scoped to `scope`, and returns the undo:
90
- * every tween it made is killed and every inline style it set is removed.
126
+ * Runs `build` inside a gsap context scoped to `scope`, once gsap is here
127
+ * (`withGsap`), and returns the undo: every tween it made is killed and every
128
+ * inline style it set is removed; undone before gsap arrives, nothing starts.
91
129
  */
92
- export declare function withMotion(scope: Element, build: () => void): () => void;
130
+ export declare function withMotion(scope: Element, build: (gsap: Gsap) => void): () => void;
93
131
  /**
94
- * The start state is written at once, in the layout effect, not on gsap's
95
- * next tick (`lazy: false` with the immediate render a from-tween has): the
96
- * browser never paints the end state first and then jumps back to the start.
132
+ * The start state is written at once, when the tween is made, not on gsap's
133
+ * next tick (`lazy: false` with the immediate render a from-tween has): with
134
+ * gsap on the page that is the layout effect, so the browser never paints the
135
+ * end state first and then jumps back to the start. A page's first motion
136
+ * waits for gsap to arrive (ui#554), and shows the end state until it does.
97
137
  */
98
138
  export declare const START_NOW: {
99
139
  readonly immediateRender: true;
@@ -110,7 +150,6 @@ export declare const START_NOW: {
110
150
  export declare function holdStyle(els: readonly (HTMLElement | SVGElement)[]): (tween: {
111
151
  revert(): unknown;
112
152
  }) => void;
113
- export { gsap };
114
153
  /** A caller's formatted figure, split so a count-up can write it back. */
115
154
  export type Figure = {
116
155
  prefix: string;
@@ -1 +1 @@
1
- {"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../../src/lib/motion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B;;;;;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AAO,MAAM,SAAS;;;CAAkD,CAAA;AAIxE;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,UAAU,CAAC,EAAE,GAAG,CAAC,KAAK,EAAE;IAAE,MAAM,IAAI,OAAO,CAAA;CAAE,KAAK,IAAI,CAc5G;AAED,0EAA0E;AAC1E,MAAM,MAAM,MAAM,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAID,uFAAuF;AACvF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQtD;AAED,uCAAuC;AACvC,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAS7D"}
@@ -1,5 +1,4 @@
1
1
  import * as React from "react";
2
- import { gsap } from "gsap";
3
2
  /**
4
3
  * The library's motion, on gsap (ui#533). The one module that imports gsap:
5
4
  * the pieces in `blocks/motion.tsx` and `blocks/shared-grid-illustration.tsx`
@@ -22,13 +21,29 @@ import { gsap } from "gsap";
22
21
  *
23
22
  * - no script (a server render, a crawler): the end state;
24
23
  * - reduced motion: the effect returns before it starts anything, so the
25
- * end state shows at once and gsap never runs;
24
+ * end state shows at once and gsap is never fetched;
26
25
  * - an unmount mid-motion: the gsap context reverts, nothing is left inline.
27
26
  *
28
27
  * A server-rendered page shows the end state for the moment between its HTML
29
28
  * painting and hydration, then runs the motion from the start. The Console's
30
29
  * Home renders its data on the client, where the layout effect runs before the
31
- * first paint and there is no such moment.
30
+ * first paint and there is no such moment, once gsap is on the page (below).
31
+ *
32
+ * ## gsap is fetched when a motion runs (ui#554)
33
+ *
34
+ * This module imports gsap's types only. gsap itself is fetched with
35
+ * `import("gsap")` the first time a piece starts a motion, and kept: a
36
+ * bundler splits it into a chunk of its own, so a page that renders a
37
+ * `RankedList` without `animated` (most of the Console) never downloads it.
38
+ * A static import here put its 28 KB gzip on every page that imports
39
+ * anything from `blocks/motion.tsx`, used or not.
40
+ *
41
+ * So the first motion on a page starts when gsap arrives, a moment after its
42
+ * layout effect, and the end state shows until then; every motion after it
43
+ * starts in its layout effect, as before. A piece undone before gsap arrives
44
+ * (unmounted, or its effect re-run) never starts. A page that knows a motion
45
+ * is coming (the Console Home, whose numbers mount after its data loads) calls
46
+ * `preloadMotion()` as it mounts, and its first motion starts at once too.
32
47
  *
33
48
  * ## The number reader
34
49
  *
@@ -63,18 +78,68 @@ export const useIsoLayoutEffect = typeof document === "undefined" ? React.useEff
63
78
  export function markMotion(el, state) {
64
79
  el.setAttribute("data-motion", state);
65
80
  }
81
+ let gsapHere;
82
+ let gsapOnItsWay;
83
+ /** gsap, fetched on the first call and kept; a failed fetch is tried again on the next. */
84
+ export function loadGsap() {
85
+ gsapOnItsWay ??= import("gsap").then((m) => (gsapHere = m.gsap), (error) => {
86
+ gsapOnItsWay = undefined;
87
+ throw error;
88
+ });
89
+ return gsapOnItsWay;
90
+ }
91
+ /**
92
+ * Runs `start` with gsap, and returns the undo. With gsap already here it runs
93
+ * at once, in the caller's layout effect; otherwise once gsap arrives. Undone
94
+ * before then, `start` never runs; after, the undo is `start`'s own. If gsap
95
+ * cannot be fetched, nothing runs and the end state, which is the markup,
96
+ * stays.
97
+ */
98
+ export function withGsap(start) {
99
+ if (gsapHere)
100
+ return start(gsapHere) ?? noop;
101
+ let undone = false;
102
+ let undo;
103
+ loadGsap().then((gsap) => {
104
+ if (!undone)
105
+ undo = start(gsap);
106
+ }, noop);
107
+ return () => {
108
+ undone = true;
109
+ undo?.();
110
+ };
111
+ }
112
+ function noop() { }
113
+ /**
114
+ * Starts fetching gsap now, ahead of a page's first motion, so that motion
115
+ * starts in its layout effect instead of showing the end state until gsap
116
+ * arrives. The Console Home calls it as the page mounts, before its data and
117
+ * its numbers. Exported from the package entry; nothing in the library calls
118
+ * it. Does nothing on a server or under reduced motion; a failed fetch is
119
+ * ignored, and the first motion asks again.
120
+ */
121
+ export function preloadMotion() {
122
+ if (typeof window === "undefined" || prefersReducedMotion())
123
+ return;
124
+ loadGsap().catch(noop);
125
+ }
66
126
  /**
67
- * Runs `build` inside a gsap context scoped to `scope`, and returns the undo:
68
- * every tween it made is killed and every inline style it set is removed.
127
+ * Runs `build` inside a gsap context scoped to `scope`, once gsap is here
128
+ * (`withGsap`), and returns the undo: every tween it made is killed and every
129
+ * inline style it set is removed; undone before gsap arrives, nothing starts.
69
130
  */
70
131
  export function withMotion(scope, build) {
71
- const ctx = gsap.context(build, scope);
72
- return () => ctx.revert();
132
+ return withGsap((gsap) => {
133
+ const ctx = gsap.context(() => build(gsap), scope);
134
+ return () => ctx.revert();
135
+ });
73
136
  }
74
137
  /**
75
- * The start state is written at once, in the layout effect, not on gsap's
76
- * next tick (`lazy: false` with the immediate render a from-tween has): the
77
- * browser never paints the end state first and then jumps back to the start.
138
+ * The start state is written at once, when the tween is made, not on gsap's
139
+ * next tick (`lazy: false` with the immediate render a from-tween has): with
140
+ * gsap on the page that is the layout effect, so the browser never paints the
141
+ * end state first and then jumps back to the start. A page's first motion
142
+ * waits for gsap to arrive (ui#554), and shows the end state until it does.
78
143
  */
79
144
  export const START_NOW = { immediateRender: true, lazy: false };
80
145
  const INDEPENDENT = ["translate", "rotate", "scale"];
@@ -104,7 +169,6 @@ export function holdStyle(els) {
104
169
  });
105
170
  };
106
171
  }
107
- export { gsap };
108
172
  const FIGURE = /^(\D*?)(\d{1,3}(?:,\d{3})+|\d+)(?:\.(\d+))?([\s\S]*)$/;
109
173
  /** The first figure in `text`, with what comes before and after it; null for words. */
110
174
  export function readFigure(text) {
@@ -1 +1 @@
1
- {"version":3,"file":"motion.js","sourceRoot":"","sources":["../../src/lib/motion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA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nF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACxC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AACrF,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,CAAS;IACnD,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACxC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO;QACzB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE;YACpC,qBAAqB,EAAE,MAAM,CAAC,QAAQ;YACtC,qBAAqB,EAAE,MAAM,CAAC,QAAQ;SACvC,CAAC;QACJ,CAAC,CAAC,KAAK,CAAA;IACT,OAAO,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAA;AAClD,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * ON A TOUCH SCREEN, ONE TAP DOES WHAT HOVER DOES (ui#559, Asaf, 2026-11-22).
3
+ *
4
+ * A phone has no hover, so a piece that shows its actions on hover hides them
5
+ * from a touch reader. For the pieces that ask (a scope: the Home card, a
6
+ * pinned item), this makes the first tap show the hover state and a second tap
7
+ * open, as one tap did before:
8
+ *
9
+ * 1 the first tap on a scope writes `data-touch-hover` on it and goes no
10
+ * further: the link under it does not follow, no handler hears it
11
+ * 2 a tap on a scope that already has it is the tap's own: the door opens,
12
+ * a button presses
13
+ * 3 so a button works on its first tap once it shows, and never on the tap
14
+ * that showed it (it was inert while hidden, and that tap is swallowed
15
+ * wherever in the scope it landed)
16
+ * 4 one at a time: a press anywhere outside the scope clears it (a press on
17
+ * another scope, then, moves it), and so does a scroll, of a rail or of
18
+ * the page. A press or a scroll inside an open menu is not outside: the
19
+ * menu is the scope's, portalled away from it
20
+ * 5 touch is the press's `pointerType`, per tap: never the screen's width or
21
+ * `(hover: none)`. A mouse or a pen (which hovers) and the keyboard (a
22
+ * click with no press before it, `detail` 0) behave exactly as before
23
+ * 6 only a real finger reveals: a touch press with a contact size (`width`
24
+ * and `height` above 0), at the scope its click lands on. A screen
25
+ * reader's double-tap (VoiceOver, TalkBack) can arrive as a synthesized
26
+ * touch press of size 0, or as a click with no press before it; either
27
+ * activates at once, as before, so its first activation is never
28
+ * swallowed (Nataly's review on PR #562). Not yet checked on a device
29
+ *
30
+ * It moves no focus and adds no element, role or name: a screen reader hears
31
+ * what it heard. The look is the scope's own CSS: every `group-hover/<g>:`
32
+ * class has a `group-data-[touch-hover]/<g>:` twin beside it, so the tapped
33
+ * look is the hover look, eased by the same transition and stilled by the same
34
+ * reduced-motion rule.
35
+ *
36
+ * One listener set per document, in the capture phase (so a handler that
37
+ * stops propagation cannot hide a tap, and a swallowed tap reaches nothing),
38
+ * shared by every scope and counted, as `trackInputModality` is. The attribute
39
+ * is written on the element, not through React state: nothing re-renders, and
40
+ * the pieces that ask stay server components (`<TouchHover />` renders
41
+ * nothing).
42
+ */
43
+ export declare const TOUCH_HOVER_ATTRIBUTE = "data-touch-hover";
44
+ type TouchHoverDocument = Pick<Document, "addEventListener" | "removeEventListener">;
45
+ /**
46
+ * Make the first touch tap on any element matching `scope` show its hover
47
+ * state (`data-touch-hover`), and the second open. Returns a function that
48
+ * stops this start. `<TouchHover scope=… />` is this in an effect.
49
+ *
50
+ * Counted per document and per scope: the first start attaches the listeners,
51
+ * the last stop removes them and clears the state; a stop released twice
52
+ * counts once.
53
+ */
54
+ export declare function trackTouchHover(scope: string, doc?: TouchHoverDocument): () => void;
55
+ /**
56
+ * Turns the touch rule on for `scope` while it is mounted. Renders nothing, so
57
+ * a server component can carry it: the Home card and Pinned do.
58
+ */
59
+ export declare function TouchHover({ scope }: {
60
+ scope: string;
61
+ }): null;
62
+ export {};
63
+ //# sourceMappingURL=touch-hover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"touch-hover.d.ts","sourceRoot":"","sources":["../../src/lib/touch-hover.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,qBAAqB,qBAAqB,CAAA;AAOvD,KAAK,kBAAkB,GAAG,IAAI,CAAC,QAAQ,EAAE,kBAAkB,GAAG,qBAAqB,CAAC,CAAA;AA2EpF;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,GAAE,kBAA6B,GAAG,MAAM,IAAI,CA0B7F;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAG7D"}
@@ -0,0 +1,164 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ /**
4
+ * ON A TOUCH SCREEN, ONE TAP DOES WHAT HOVER DOES (ui#559, Asaf, 2026-11-22).
5
+ *
6
+ * A phone has no hover, so a piece that shows its actions on hover hides them
7
+ * from a touch reader. For the pieces that ask (a scope: the Home card, a
8
+ * pinned item), this makes the first tap show the hover state and a second tap
9
+ * open, as one tap did before:
10
+ *
11
+ * 1 the first tap on a scope writes `data-touch-hover` on it and goes no
12
+ * further: the link under it does not follow, no handler hears it
13
+ * 2 a tap on a scope that already has it is the tap's own: the door opens,
14
+ * a button presses
15
+ * 3 so a button works on its first tap once it shows, and never on the tap
16
+ * that showed it (it was inert while hidden, and that tap is swallowed
17
+ * wherever in the scope it landed)
18
+ * 4 one at a time: a press anywhere outside the scope clears it (a press on
19
+ * another scope, then, moves it), and so does a scroll, of a rail or of
20
+ * the page. A press or a scroll inside an open menu is not outside: the
21
+ * menu is the scope's, portalled away from it
22
+ * 5 touch is the press's `pointerType`, per tap: never the screen's width or
23
+ * `(hover: none)`. A mouse or a pen (which hovers) and the keyboard (a
24
+ * click with no press before it, `detail` 0) behave exactly as before
25
+ * 6 only a real finger reveals: a touch press with a contact size (`width`
26
+ * and `height` above 0), at the scope its click lands on. A screen
27
+ * reader's double-tap (VoiceOver, TalkBack) can arrive as a synthesized
28
+ * touch press of size 0, or as a click with no press before it; either
29
+ * activates at once, as before, so its first activation is never
30
+ * swallowed (Nataly's review on PR #562). Not yet checked on a device
31
+ *
32
+ * It moves no focus and adds no element, role or name: a screen reader hears
33
+ * what it heard. The look is the scope's own CSS: every `group-hover/<g>:`
34
+ * class has a `group-data-[touch-hover]/<g>:` twin beside it, so the tapped
35
+ * look is the hover look, eased by the same transition and stilled by the same
36
+ * reduced-motion rule.
37
+ *
38
+ * One listener set per document, in the capture phase (so a handler that
39
+ * stops propagation cannot hide a tap, and a swallowed tap reaches nothing),
40
+ * shared by every scope and counted, as `trackInputModality` is. The attribute
41
+ * is written on the element, not through React state: nothing re-renders, and
42
+ * the pieces that ask stay server components (`<TouchHover />` renders
43
+ * nothing).
44
+ */
45
+ export const TOUCH_HOVER_ATTRIBUTE = "data-touch-hover";
46
+ /** Inside an open menu is not outside the scope that opened it. */
47
+ const MENU = '[role="menu"]';
48
+ const trackers = new WeakMap();
49
+ /** The nearest ancestor (or self) matching `selector`, if the target is an element at all. */
50
+ function closest(target, selector) {
51
+ const el = target;
52
+ return el && typeof el.closest === "function" ? el.closest(selector) : null;
53
+ }
54
+ function attach(doc, tracker) {
55
+ // The last press, if it was a finger's, and where it landed, until its click
56
+ // reads it. Cleared by every click and by a cancelled press, so a later
57
+ // keyboard or synthesized click never inherits it.
58
+ let finger = null;
59
+ const clear = () => {
60
+ tracker.current?.removeAttribute(TOUCH_HOVER_ATTRIBUTE);
61
+ tracker.current = null;
62
+ };
63
+ const selector = () => [...tracker.scopes.keys()].join(",");
64
+ const outside = (target) => tracker.current !== null && !tracker.current.contains(target) && closest(target, MENU) === null;
65
+ const onPointerDown = (event) => {
66
+ const e = event;
67
+ // A finger has a contact size. A screen reader's double-tap (VoiceOver,
68
+ // TalkBack) can arrive as a synthesized touch press of size 0: that is not
69
+ // a tap to reveal on, so it activates as it always did.
70
+ finger = e.pointerType === "touch" && e.width > 0 && e.height > 0 ? event.target : null;
71
+ if (outside(event.target))
72
+ clear();
73
+ };
74
+ const onPointerCancel = () => {
75
+ finger = null;
76
+ };
77
+ const onClick = (event) => {
78
+ const pressed = finger;
79
+ finger = null;
80
+ if (pressed === null || event.detail === 0)
81
+ return;
82
+ const scope = closest(event.target, selector());
83
+ if (!scope)
84
+ return;
85
+ // The finger's press must be at this scope: a click with no press of its
86
+ // own there (synthesized, or after a press elsewhere) activates at once.
87
+ if (!scope.contains(pressed))
88
+ return;
89
+ if (tracker.current === scope)
90
+ return;
91
+ clear();
92
+ scope.setAttribute(TOUCH_HOVER_ATTRIBUTE, "");
93
+ tracker.current = scope;
94
+ event.preventDefault();
95
+ event.stopPropagation();
96
+ };
97
+ const onScroll = (event) => {
98
+ if (closest(event.target, MENU) === null)
99
+ clear();
100
+ };
101
+ // An options object rather than `true`: Node's EventTarget does not match a
102
+ // boolean capture flag on removal, and the tests run there. Scroll does not
103
+ // bubble, so the capture phase is also the only way to hear a rail's.
104
+ const capture = { capture: true };
105
+ const passive = { capture: true, passive: true };
106
+ doc.addEventListener("pointerdown", onPointerDown, passive);
107
+ doc.addEventListener("pointercancel", onPointerCancel, passive);
108
+ doc.addEventListener("click", onClick, capture);
109
+ doc.addEventListener("scroll", onScroll, passive);
110
+ return () => {
111
+ doc.removeEventListener("pointerdown", onPointerDown, passive);
112
+ doc.removeEventListener("pointercancel", onPointerCancel, passive);
113
+ doc.removeEventListener("click", onClick, capture);
114
+ doc.removeEventListener("scroll", onScroll, passive);
115
+ clear();
116
+ };
117
+ }
118
+ /**
119
+ * Make the first touch tap on any element matching `scope` show its hover
120
+ * state (`data-touch-hover`), and the second open. Returns a function that
121
+ * stops this start. `<TouchHover scope=… />` is this in an effect.
122
+ *
123
+ * Counted per document and per scope: the first start attaches the listeners,
124
+ * the last stop removes them and clears the state; a stop released twice
125
+ * counts once.
126
+ */
127
+ export function trackTouchHover(scope, doc = document) {
128
+ let tracker = trackers.get(doc);
129
+ if (!tracker) {
130
+ const t = { scopes: new Map(), current: null, detach: () => { } };
131
+ t.detach = attach(doc, t);
132
+ trackers.set(doc, t);
133
+ tracker = t;
134
+ }
135
+ tracker.scopes.set(scope, (tracker.scopes.get(scope) ?? 0) + 1);
136
+ let released = false;
137
+ return () => {
138
+ if (released)
139
+ return;
140
+ released = true;
141
+ const t = trackers.get(doc);
142
+ if (!t)
143
+ return;
144
+ const n = (t.scopes.get(scope) ?? 1) - 1;
145
+ if (n > 0) {
146
+ t.scopes.set(scope, n);
147
+ return;
148
+ }
149
+ t.scopes.delete(scope);
150
+ if (t.scopes.size > 0)
151
+ return;
152
+ trackers.delete(doc);
153
+ t.detach();
154
+ };
155
+ }
156
+ /**
157
+ * Turns the touch rule on for `scope` while it is mounted. Renders nothing, so
158
+ * a server component can carry it: the Home card and Pinned do.
159
+ */
160
+ export function TouchHover({ scope }) {
161
+ React.useEffect(() => trackTouchHover(scope), [scope]);
162
+ return null;
163
+ }
164
+ //# sourceMappingURL=touch-hover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"touch-hover.js","sourceRoot":"","sources":["../../src/lib/touch-hover.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAA;AAEvD,mEAAmE;AACnE,MAAM,IAAI,GAAG,eAAe,CAAA;AAQ5B,MAAM,QAAQ,GAAG,IAAI,OAAO,EAA+B,CAAA;AAE3D,8FAA8F;AAC9F,SAAS,OAAO,CAAC,MAA0B,EAAE,QAAgB;IAC3D,MAAM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AA;IACpB,OAAO,GAAG,EAAE;QACV,IAAI,QAAQ;YAAE,OAAM;QACpB,QAAQ,GAAG,IAAI,CAAA;QACf,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC3B,IAAI,CAAC,CAAC;YAAE,OAAM;QACd,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;QACxC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACV,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;YACtB,OAAM;QACR,CAAC;QACD,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACtB,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC;YAAE,OAAM;QAC7B,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACpB,CAAC,CAAC,MAAM,EAAE,CAAA;IACZ,CAAC,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,EAAqB;IACrD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IACtD,OAAO,IAAI,CAAA;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudgrid-io/ui",
3
- "version": "0.65.0",
3
+ "version": "0.66.0",
4
4
  "description": "CloudGrid design system: React components, brand design tokens, Tailwind theme, self-hosted fonts.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",