@cloudgrid-io/ui 0.64.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.
- package/README.md +1 -1
- package/dist/blocks/add-tile.d.ts +16 -1
- package/dist/blocks/add-tile.d.ts.map +1 -1
- package/dist/blocks/add-tile.js +20 -3
- package/dist/blocks/add-tile.js.map +1 -1
- package/dist/blocks/avatar-picker.d.ts +50 -4
- package/dist/blocks/avatar-picker.d.ts.map +1 -1
- package/dist/blocks/avatar-picker.js +56 -10
- package/dist/blocks/avatar-picker.js.map +1 -1
- package/dist/blocks/bento-card-hint.d.ts +16 -0
- package/dist/blocks/bento-card-hint.d.ts.map +1 -0
- package/dist/blocks/bento-card-hint.js +23 -0
- package/dist/blocks/bento-card-hint.js.map +1 -0
- package/dist/blocks/bento-card.d.ts +59 -0
- package/dist/blocks/bento-card.d.ts.map +1 -0
- package/dist/blocks/bento-card.js +59 -0
- package/dist/blocks/bento-card.js.map +1 -0
- package/dist/blocks/coming-soon-hint.d.ts.map +1 -1
- package/dist/blocks/coming-soon-hint.js +110 -7
- package/dist/blocks/coming-soon-hint.js.map +1 -1
- package/dist/blocks/creation-search.d.ts +147 -0
- package/dist/blocks/creation-search.d.ts.map +1 -0
- package/dist/blocks/creation-search.js +239 -0
- package/dist/blocks/creation-search.js.map +1 -0
- package/dist/blocks/entity-card.d.ts +82 -2
- package/dist/blocks/entity-card.d.ts.map +1 -1
- package/dist/blocks/entity-card.js +176 -17
- package/dist/blocks/entity-card.js.map +1 -1
- package/dist/blocks/from-your-grid.d.ts +66 -0
- package/dist/blocks/from-your-grid.d.ts.map +1 -0
- package/dist/blocks/from-your-grid.js +63 -0
- package/dist/blocks/from-your-grid.js.map +1 -0
- package/dist/blocks/grid-profile.d.ts +25 -4
- package/dist/blocks/grid-profile.d.ts.map +1 -1
- package/dist/blocks/grid-profile.js +69 -7
- package/dist/blocks/grid-profile.js.map +1 -1
- package/dist/blocks/help-menu.d.ts +58 -0
- package/dist/blocks/help-menu.d.ts.map +1 -0
- package/dist/blocks/help-menu.js +64 -0
- package/dist/blocks/help-menu.js.map +1 -0
- package/dist/blocks/home-bento.d.ts +86 -0
- package/dist/blocks/home-bento.d.ts.map +1 -0
- package/dist/blocks/home-bento.js +87 -0
- package/dist/blocks/home-bento.js.map +1 -0
- package/dist/blocks/home-empty-illustrations.d.ts +37 -0
- package/dist/blocks/home-empty-illustrations.d.ts.map +1 -0
- package/dist/blocks/home-empty-illustrations.js +47 -0
- package/dist/blocks/home-empty-illustrations.js.map +1 -0
- package/dist/blocks/home-pinned.d.ts +168 -0
- package/dist/blocks/home-pinned.d.ts.map +1 -0
- package/dist/blocks/home-pinned.js +100 -0
- package/dist/blocks/home-pinned.js.map +1 -0
- package/dist/blocks/icons.d.ts +46 -0
- package/dist/blocks/icons.d.ts.map +1 -1
- package/dist/blocks/icons.js +46 -0
- package/dist/blocks/icons.js.map +1 -1
- package/dist/blocks/image-adjust-dialog.d.ts +68 -11
- package/dist/blocks/image-adjust-dialog.d.ts.map +1 -1
- package/dist/blocks/image-adjust-dialog.js +68 -16
- package/dist/blocks/image-adjust-dialog.js.map +1 -1
- package/dist/blocks/inspiration-cards.d.ts +241 -0
- package/dist/blocks/inspiration-cards.d.ts.map +1 -0
- package/dist/blocks/inspiration-cards.js +234 -0
- package/dist/blocks/inspiration-cards.js.map +1 -0
- package/dist/blocks/invite-popup.d.ts +63 -5
- package/dist/blocks/invite-popup.d.ts.map +1 -1
- package/dist/blocks/invite-popup.js +60 -20
- package/dist/blocks/invite-popup.js.map +1 -1
- package/dist/blocks/liquid-glass.d.ts +106 -0
- package/dist/blocks/liquid-glass.d.ts.map +1 -0
- package/dist/blocks/liquid-glass.js +283 -0
- package/dist/blocks/liquid-glass.js.map +1 -0
- package/dist/blocks/meter.d.ts +5 -2
- package/dist/blocks/meter.d.ts.map +1 -1
- package/dist/blocks/meter.js +4 -0
- package/dist/blocks/meter.js.map +1 -1
- package/dist/blocks/motion.d.ts +48 -0
- package/dist/blocks/motion.d.ts.map +1 -0
- package/dist/blocks/motion.js +148 -0
- package/dist/blocks/motion.js.map +1 -0
- package/dist/blocks/need-help-line.d.ts +21 -0
- package/dist/blocks/need-help-line.d.ts.map +1 -0
- package/dist/blocks/need-help-line.js +24 -0
- package/dist/blocks/need-help-line.js.map +1 -0
- package/dist/blocks/needs-attention.d.ts +89 -0
- package/dist/blocks/needs-attention.d.ts.map +1 -0
- package/dist/blocks/needs-attention.js +32 -0
- package/dist/blocks/needs-attention.js.map +1 -0
- package/dist/blocks/phosphor-marks.d.ts +16 -0
- package/dist/blocks/phosphor-marks.d.ts.map +1 -1
- package/dist/blocks/phosphor-marks.js +24 -0
- package/dist/blocks/phosphor-marks.js.map +1 -1
- package/dist/blocks/picture-menu.d.ts +26 -0
- package/dist/blocks/picture-menu.d.ts.map +1 -0
- package/dist/blocks/picture-menu.js +22 -0
- package/dist/blocks/picture-menu.js.map +1 -0
- package/dist/blocks/ranked-list.d.ts +7 -1
- package/dist/blocks/ranked-list.d.ts.map +1 -1
- package/dist/blocks/ranked-list.js +8 -6
- package/dist/blocks/ranked-list.js.map +1 -1
- package/dist/blocks/recent-plugs.d.ts +74 -0
- package/dist/blocks/recent-plugs.d.ts.map +1 -0
- package/dist/blocks/recent-plugs.js +20 -0
- package/dist/blocks/recent-plugs.js.map +1 -0
- package/dist/blocks/shared-grid-illustration.d.ts +55 -0
- package/dist/blocks/shared-grid-illustration.d.ts.map +1 -0
- package/dist/blocks/shared-grid-illustration.js +81 -0
- package/dist/blocks/shared-grid-illustration.js.map +1 -0
- package/dist/blocks/shelf-strip.d.ts +36 -0
- package/dist/blocks/shelf-strip.d.ts.map +1 -0
- package/dist/blocks/shelf-strip.js +32 -0
- package/dist/blocks/shelf-strip.js.map +1 -0
- package/dist/blocks/stat-tile.d.ts +17 -1
- package/dist/blocks/stat-tile.d.ts.map +1 -1
- package/dist/blocks/stat-tile.js +4 -1
- package/dist/blocks/stat-tile.js.map +1 -1
- package/dist/blocks/top-creations.d.ts +76 -0
- package/dist/blocks/top-creations.d.ts.map +1 -0
- package/dist/blocks/top-creations.js +54 -0
- package/dist/blocks/top-creations.js.map +1 -0
- package/dist/brand/email/headline-1-invitation-left.png +0 -0
- package/dist/brand/email/headline-2-invitations-left.png +0 -0
- package/dist/brand/email/headline-3-invitations-left.png +0 -0
- package/dist/brand/email/headline-4-invitations-left.png +0 -0
- package/dist/brand/email/headline-5-invitations-left.png +0 -0
- package/dist/brand/email/headline-6-invitations-left.png +0 -0
- package/dist/brand/email/headline-7-invitations-left.png +0 -0
- package/dist/brand/email/headline-8-invitations-left.png +0 -0
- package/dist/brand/email/headline-9-invitations-left.png +0 -0
- package/dist/brand/email/headline-you-have-1-invitation.png +0 -0
- package/dist/brand/email/headline-you-have-2-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-3-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-4-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-5-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-6-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-7-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-8-invitations.png +0 -0
- package/dist/brand/email/headline-you-have-9-invitations.png +0 -0
- package/dist/email/assets.d.ts +108 -0
- package/dist/email/assets.d.ts.map +1 -1
- package/dist/email/assets.js +18 -0
- package/dist/email/assets.js.map +1 -1
- package/dist/email/index.d.ts +71 -0
- package/dist/email/index.d.ts.map +1 -1
- package/dist/email/index.js +110 -5
- package/dist/email/index.js.map +1 -1
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/fit.d.ts +39 -0
- package/dist/lib/fit.d.ts.map +1 -0
- package/dist/lib/fit.js +92 -0
- package/dist/lib/fit.js.map +1 -0
- package/dist/lib/motion.d.ts +165 -0
- package/dist/lib/motion.d.ts.map +1 -0
- package/dist/lib/motion.js +196 -0
- package/dist/lib/motion.js.map +1 -0
- package/dist/lib/touch-hover.d.ts +63 -0
- package/dist/lib/touch-hover.d.ts.map +1 -0
- package/dist/lib/touch-hover.js +164 -0
- package/dist/lib/touch-hover.js.map +1 -0
- package/dist/ui/dialog.d.ts +7 -1
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +2 -2
- package/dist/ui/dialog.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fit.js","sourceRoot":"","sources":["../../src/lib/fit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,oKAAoK;AACpK,MAAM,kBAAkB,GAAG,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAA;AAEpG;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,OAAO,CACrB,KAA0C,EAC1C,OAA4C,EAC5C,OAAO,GAAG,IAAI,EACd,KAAK,GAAG,CAAC;IAET,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE7C,kBAAkB,CAAC,GAAG,EAAE;QACtB,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAA;QACvB,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAA;QACzB,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE,CAAC;YAClE,OAAO,CAAC,KAAK,CAAC,CAAA;YACd,OAAM;QACR,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAmB,CAAA;QAC1C,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YAC9C,KAAK,MAAM,KAAK,IAAI,OAAO;gBAAE,OAA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H;QACvH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;QAC1D,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;YACzC,IAAI,CAAC,KAAK;gBAAE,OAAM;YAClB,MAAM,GAAG,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAA;YACpC,2EAA2E;YAC3E,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;QACxE,CAAC,CAAC,CAAA;QACF,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,CAAA;QAC7C,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAA;IACpC,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAA;IAElB,OAAO,IAAI,CAAA;AACb,CAAC;AAED,mGAAmG;AACnG,SAAS,SAAS,CAAC,KAA0B;IAC3C,MAAM,GAAG,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAA;IACpC,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAA;AACvD,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { gsap as GsapInstance } from "gsap";
|
|
3
|
+
/**
|
|
4
|
+
* The library's motion, on gsap (ui#533). The one module that imports gsap:
|
|
5
|
+
* the pieces in `blocks/motion.tsx` and `blocks/shared-grid-illustration.tsx`
|
|
6
|
+
* call the helpers here, and a caller never touches gsap at all.
|
|
7
|
+
*
|
|
8
|
+
* ## Quiet, because this is a console
|
|
9
|
+
*
|
|
10
|
+
* The website moves; the Console mostly sits still. So every motion here is
|
|
11
|
+
* short (at most 0.8s), eases out, and travels a few pixels. A count and the
|
|
12
|
+
* bar beside it share one duration, so a ranked row's number and its fill land
|
|
13
|
+
* together. The one motion that does not end is the empty illustration's float,
|
|
14
|
+
* and it is 3px over 2.4s.
|
|
15
|
+
*
|
|
16
|
+
* ## The final state is the markup
|
|
17
|
+
*
|
|
18
|
+
* Every piece RENDERS its end state: the caller's number, the full bar, every
|
|
19
|
+
* item visible. The motion is applied in a layout effect, before the browser
|
|
20
|
+
* paints, by setting the start state and tweening back to what React rendered.
|
|
21
|
+
* That makes three cases one:
|
|
22
|
+
*
|
|
23
|
+
* - no script (a server render, a crawler): the end state;
|
|
24
|
+
* - reduced motion: the effect returns before it starts anything, so the
|
|
25
|
+
* end state shows at once and gsap is never fetched;
|
|
26
|
+
* - an unmount mid-motion: the gsap context reverts, nothing is left inline.
|
|
27
|
+
*
|
|
28
|
+
* A server-rendered page shows the end state for the moment between its HTML
|
|
29
|
+
* painting and hydration, then runs the motion from the start. The Console's
|
|
30
|
+
* Home renders its data on the client, where the layout effect runs before the
|
|
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.
|
|
48
|
+
*
|
|
49
|
+
* ## The number reader
|
|
50
|
+
*
|
|
51
|
+
* "Number formatting stays the caller's" (ui#533). A count-up takes the text
|
|
52
|
+
* the caller already formatted ("214", "12 min", "1.2K", "1,234") and finds the
|
|
53
|
+
* figure in it; each frame writes a number back in that same shape: the same
|
|
54
|
+
* prefix and suffix, the same decimal places, grouping if the caller grouped.
|
|
55
|
+
* Text with no figure ("—", "Static") is left as it is. Grouping is read and
|
|
56
|
+
* written as en-US commas, which is the only grouping the Console prints.
|
|
57
|
+
*/
|
|
58
|
+
/** The durations, eases and distances every motion here uses. */
|
|
59
|
+
export declare const MOTION: {
|
|
60
|
+
/** A count-up, 0 to the caller's figure. */
|
|
61
|
+
readonly count: {
|
|
62
|
+
readonly duration: 0.8;
|
|
63
|
+
readonly ease: "power2.out";
|
|
64
|
+
};
|
|
65
|
+
/** A meter's fill, 0 to its width; the same time as its count. */
|
|
66
|
+
readonly fill: {
|
|
67
|
+
readonly duration: 0.8;
|
|
68
|
+
readonly ease: "power2.out";
|
|
69
|
+
};
|
|
70
|
+
/** Items appearing one by one: up from 8px below, 0.08s apart. */
|
|
71
|
+
readonly reveal: {
|
|
72
|
+
readonly duration: 0.4;
|
|
73
|
+
readonly ease: "power2.out";
|
|
74
|
+
readonly y: 8;
|
|
75
|
+
readonly stagger: 0.08;
|
|
76
|
+
};
|
|
77
|
+
/** The illustration's build: a part grows in from 92%, sides 0.15s later. */
|
|
78
|
+
readonly build: {
|
|
79
|
+
readonly duration: 0.45;
|
|
80
|
+
readonly ease: "power2.out";
|
|
81
|
+
readonly scale: 0.92;
|
|
82
|
+
readonly x: 16;
|
|
83
|
+
readonly sideDelay: 0.15;
|
|
84
|
+
readonly lineDuration: 0.4;
|
|
85
|
+
};
|
|
86
|
+
/** The illustration's float: 3px up and back, 2.4s each way. */
|
|
87
|
+
readonly float: {
|
|
88
|
+
readonly duration: 2.4;
|
|
89
|
+
readonly ease: "sine.inOut";
|
|
90
|
+
readonly y: 3;
|
|
91
|
+
readonly offset: 0.6;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
/** Whether the reader asked for reduced motion. False where there is no window. */
|
|
95
|
+
export declare function prefersReducedMotion(): boolean;
|
|
96
|
+
/** useLayoutEffect in the browser; useEffect on a server, where nothing paints. */
|
|
97
|
+
export declare const useIsoLayoutEffect: typeof React.useEffect;
|
|
98
|
+
/**
|
|
99
|
+
* Where a piece is in its motion, on its root as `data-motion`:
|
|
100
|
+
* `running`, `done`, or `static` (reduced motion, or nothing to move).
|
|
101
|
+
*/
|
|
102
|
+
export type MotionState = "running" | "done" | "static";
|
|
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;
|
|
125
|
+
/**
|
|
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.
|
|
129
|
+
*/
|
|
130
|
+
export declare function withMotion(scope: Element, build: (gsap: Gsap) => void): () => void;
|
|
131
|
+
/**
|
|
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.
|
|
137
|
+
*/
|
|
138
|
+
export declare const START_NOW: {
|
|
139
|
+
readonly immediateRender: true;
|
|
140
|
+
readonly lazy: false;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Notes `els`' own inline style BEFORE a tween touches them, and returns what
|
|
144
|
+
* hands it back once the tween is over. gsap's revert
|
|
145
|
+
* restores what a tween moved, but leaves the `translate`, `rotate` and
|
|
146
|
+
* `scale` it writes as `none` beside a transform; this puts those back as they
|
|
147
|
+
* were too, and drops a `style` attribute that ends up empty, so a piece at
|
|
148
|
+
* rest carries no inline style of ours.
|
|
149
|
+
*/
|
|
150
|
+
export declare function holdStyle(els: readonly (HTMLElement | SVGElement)[]): (tween: {
|
|
151
|
+
revert(): unknown;
|
|
152
|
+
}) => void;
|
|
153
|
+
/** A caller's formatted figure, split so a count-up can write it back. */
|
|
154
|
+
export type Figure = {
|
|
155
|
+
prefix: string;
|
|
156
|
+
value: number;
|
|
157
|
+
decimals: number;
|
|
158
|
+
grouped: boolean;
|
|
159
|
+
suffix: string;
|
|
160
|
+
};
|
|
161
|
+
/** The first figure in `text`, with what comes before and after it; null for words. */
|
|
162
|
+
export declare function readFigure(text: string): Figure | null;
|
|
163
|
+
/** `n` written in `figure`'s shape. */
|
|
164
|
+
export declare function writeFigure(figure: Figure, n: number): string;
|
|
165
|
+
//# sourceMappingURL=motion.d.ts.map
|
|
@@ -0,0 +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,KAAK,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,MAAM,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,iEAAiE;AACjE,eAAO,MAAM,MAAM;IACjB,4CAA4C;;;;;IAE5C,kEAAkE;;;;;IAElE,kEAAkE;;;;;;;IAElE,6EAA6E;;;;;;;;;IAE7E,gEAAgE;;;;;;;CAExD,CAAA;AAEV,mFAAmF;AACnF,wBAAgB,oBAAoB,IAAI,OAAO,CAM9C;AAED,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,wBAA4E,CAAA;AAE3G;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEvD,wBAAgB,UAAU,CAAC,EAAE,EAAE,WAAW,GAAG,UAAU,EAAE,KAAK,EAAE,WAAW,QAE1E;AAED,sDAAsD;AACtD,MAAM,MAAM,IAAI,GAAG,OAAO,YAAY,CAAA;AAKtC,2FAA2F;AAC3F,wBAAgB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CASxC;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,GAAG,MAAM,IAAI,CAc/E;AAID;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAGpC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI,CAKlF;AAED;;;;;;GAMG;AACH,eAAO,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"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The library's motion, on gsap (ui#533). The one module that imports gsap:
|
|
4
|
+
* the pieces in `blocks/motion.tsx` and `blocks/shared-grid-illustration.tsx`
|
|
5
|
+
* call the helpers here, and a caller never touches gsap at all.
|
|
6
|
+
*
|
|
7
|
+
* ## Quiet, because this is a console
|
|
8
|
+
*
|
|
9
|
+
* The website moves; the Console mostly sits still. So every motion here is
|
|
10
|
+
* short (at most 0.8s), eases out, and travels a few pixels. A count and the
|
|
11
|
+
* bar beside it share one duration, so a ranked row's number and its fill land
|
|
12
|
+
* together. The one motion that does not end is the empty illustration's float,
|
|
13
|
+
* and it is 3px over 2.4s.
|
|
14
|
+
*
|
|
15
|
+
* ## The final state is the markup
|
|
16
|
+
*
|
|
17
|
+
* Every piece RENDERS its end state: the caller's number, the full bar, every
|
|
18
|
+
* item visible. The motion is applied in a layout effect, before the browser
|
|
19
|
+
* paints, by setting the start state and tweening back to what React rendered.
|
|
20
|
+
* That makes three cases one:
|
|
21
|
+
*
|
|
22
|
+
* - no script (a server render, a crawler): the end state;
|
|
23
|
+
* - reduced motion: the effect returns before it starts anything, so the
|
|
24
|
+
* end state shows at once and gsap is never fetched;
|
|
25
|
+
* - an unmount mid-motion: the gsap context reverts, nothing is left inline.
|
|
26
|
+
*
|
|
27
|
+
* A server-rendered page shows the end state for the moment between its HTML
|
|
28
|
+
* painting and hydration, then runs the motion from the start. The Console's
|
|
29
|
+
* Home renders its data on the client, where the layout effect runs before the
|
|
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.
|
|
47
|
+
*
|
|
48
|
+
* ## The number reader
|
|
49
|
+
*
|
|
50
|
+
* "Number formatting stays the caller's" (ui#533). A count-up takes the text
|
|
51
|
+
* the caller already formatted ("214", "12 min", "1.2K", "1,234") and finds the
|
|
52
|
+
* figure in it; each frame writes a number back in that same shape: the same
|
|
53
|
+
* prefix and suffix, the same decimal places, grouping if the caller grouped.
|
|
54
|
+
* Text with no figure ("—", "Static") is left as it is. Grouping is read and
|
|
55
|
+
* written as en-US commas, which is the only grouping the Console prints.
|
|
56
|
+
*/
|
|
57
|
+
/** The durations, eases and distances every motion here uses. */
|
|
58
|
+
export const MOTION = {
|
|
59
|
+
/** A count-up, 0 to the caller's figure. */
|
|
60
|
+
count: { duration: 0.8, ease: "power2.out" },
|
|
61
|
+
/** A meter's fill, 0 to its width; the same time as its count. */
|
|
62
|
+
fill: { duration: 0.8, ease: "power2.out" },
|
|
63
|
+
/** Items appearing one by one: up from 8px below, 0.08s apart. */
|
|
64
|
+
reveal: { duration: 0.4, ease: "power2.out", y: 8, stagger: 0.08 },
|
|
65
|
+
/** The illustration's build: a part grows in from 92%, sides 0.15s later. */
|
|
66
|
+
build: { duration: 0.45, ease: "power2.out", scale: 0.92, x: 16, sideDelay: 0.15, lineDuration: 0.4 },
|
|
67
|
+
/** The illustration's float: 3px up and back, 2.4s each way. */
|
|
68
|
+
float: { duration: 2.4, ease: "sine.inOut", y: 3, offset: 0.6 },
|
|
69
|
+
};
|
|
70
|
+
/** Whether the reader asked for reduced motion. False where there is no window. */
|
|
71
|
+
export function prefersReducedMotion() {
|
|
72
|
+
return (typeof window !== "undefined" &&
|
|
73
|
+
typeof window.matchMedia === "function" &&
|
|
74
|
+
window.matchMedia("(prefers-reduced-motion: reduce)").matches);
|
|
75
|
+
}
|
|
76
|
+
/** useLayoutEffect in the browser; useEffect on a server, where nothing paints. */
|
|
77
|
+
export const useIsoLayoutEffect = typeof document === "undefined" ? React.useEffect : React.useLayoutEffect;
|
|
78
|
+
export function markMotion(el, state) {
|
|
79
|
+
el.setAttribute("data-motion", state);
|
|
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
|
+
}
|
|
126
|
+
/**
|
|
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.
|
|
130
|
+
*/
|
|
131
|
+
export function withMotion(scope, build) {
|
|
132
|
+
return withGsap((gsap) => {
|
|
133
|
+
const ctx = gsap.context(() => build(gsap), scope);
|
|
134
|
+
return () => ctx.revert();
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
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.
|
|
143
|
+
*/
|
|
144
|
+
export const START_NOW = { immediateRender: true, lazy: false };
|
|
145
|
+
const INDEPENDENT = ["translate", "rotate", "scale"];
|
|
146
|
+
/**
|
|
147
|
+
* Notes `els`' own inline style BEFORE a tween touches them, and returns what
|
|
148
|
+
* hands it back once the tween is over. gsap's revert
|
|
149
|
+
* restores what a tween moved, but leaves the `translate`, `rotate` and
|
|
150
|
+
* `scale` it writes as `none` beside a transform; this puts those back as they
|
|
151
|
+
* were too, and drops a `style` attribute that ends up empty, so a piece at
|
|
152
|
+
* rest carries no inline style of ours.
|
|
153
|
+
*/
|
|
154
|
+
export function holdStyle(els) {
|
|
155
|
+
const saved = els.map((el) => INDEPENDENT.map((p) => el.style.getPropertyValue(p)));
|
|
156
|
+
const hadStyle = els.map((el) => el.hasAttribute("style"));
|
|
157
|
+
return (tween) => {
|
|
158
|
+
tween.revert();
|
|
159
|
+
els.forEach((el, i) => {
|
|
160
|
+
INDEPENDENT.forEach((p, j) => {
|
|
161
|
+
const v = saved[i][j];
|
|
162
|
+
if (v)
|
|
163
|
+
el.style.setProperty(p, v);
|
|
164
|
+
else
|
|
165
|
+
el.style.removeProperty(p);
|
|
166
|
+
});
|
|
167
|
+
if (!hadStyle[i] && !el.getAttribute("style"))
|
|
168
|
+
el.removeAttribute("style");
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
const FIGURE = /^(\D*?)(\d{1,3}(?:,\d{3})+|\d+)(?:\.(\d+))?([\s\S]*)$/;
|
|
173
|
+
/** The first figure in `text`, with what comes before and after it; null for words. */
|
|
174
|
+
export function readFigure(text) {
|
|
175
|
+
const m = FIGURE.exec(text);
|
|
176
|
+
if (!m)
|
|
177
|
+
return null;
|
|
178
|
+
const [, prefix = "", whole = "", fraction, suffix = ""] = m;
|
|
179
|
+
const grouped = whole.includes(",");
|
|
180
|
+
const value = Number(`${whole.replace(/,/g, "")}${fraction ? `.${fraction}` : ""}`);
|
|
181
|
+
if (!Number.isFinite(value))
|
|
182
|
+
return null;
|
|
183
|
+
return { prefix, value, decimals: fraction ? fraction.length : 0, grouped, suffix };
|
|
184
|
+
}
|
|
185
|
+
/** `n` written in `figure`'s shape. */
|
|
186
|
+
export function writeFigure(figure, n) {
|
|
187
|
+
const fixed = n.toFixed(figure.decimals);
|
|
188
|
+
const body = figure.grouped
|
|
189
|
+
? Number(fixed).toLocaleString("en-US", {
|
|
190
|
+
minimumFractionDigits: figure.decimals,
|
|
191
|
+
maximumFractionDigits: figure.decimals,
|
|
192
|
+
})
|
|
193
|
+
: fixed;
|
|
194
|
+
return `${figure.prefix}${body}${figure.suffix}`;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=motion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion.js","sourceRoot":"","sources":["../../src/lib/motion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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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,EAAE,GAAG,MAAqD,CAAA;IAChE,OAAO,EAAE,IAAI,OAAO,EAAE,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CA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AAC,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/dist/ui/dialog.d.ts
CHANGED
|
@@ -67,8 +67,14 @@ declare function DialogOverlay({ className, forceRender, ...props }: DialogPrimi
|
|
|
67
67
|
* conflict): `ConfirmDeleteDialog` keeps its 24 padding and 448 width,
|
|
68
68
|
* `PluggedDialog` its own radius and 632 width.
|
|
69
69
|
*/
|
|
70
|
-
declare function DialogContent({ className, children, showCloseButton, scrim, ...props }: DialogPrimitive.Popup.Props & {
|
|
70
|
+
declare function DialogContent({ className, children, showCloseButton, scrim, container, ...props }: DialogPrimitive.Popup.Props & {
|
|
71
71
|
showCloseButton?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Where the scrim and the card portal (ui#531). Absent, the document body,
|
|
74
|
+
* as before. A gallery frame passes a stage with a `transform`, which then
|
|
75
|
+
* holds the fixed scrim and card, the way `InvitePopup` and `Drawer` do.
|
|
76
|
+
*/
|
|
77
|
+
container?: DialogPrimitive.Portal.Props["container"];
|
|
72
78
|
/**
|
|
73
79
|
* The backdrop. `default` is the Style Guide overlay, the purple wash with
|
|
74
80
|
* the page blurred behind it (ui#368), unchanged. `light` is a light dim with
|
package/dist/ui/dialog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/ui/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAkBjE,iBAAS,MAAM,CAAC,EAAE,KAAY,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,qBAMrE;AAED,iBAAS,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,qBAEjE;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,KAAK,qBAE1E;AAED,iBAAS,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,qBAE7D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,WAAkB,EAClB,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,QAAQ,CAAC,KAAK,qBAYhC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,eAAsB,EACtB,KAAiB,EACjB,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,GAAG;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