@thedatagrid/docs-kit 0.2.1 → 0.3.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/CHANGELOG.md +21 -0
- package/README.md +75 -1
- package/dist/demos/build.d.ts.map +1 -1
- package/dist/demos/build.js +1 -0
- package/dist/demos/build.js.map +1 -1
- package/dist/demos/config.d.ts +7 -0
- package/dist/demos/config.d.ts.map +1 -1
- package/dist/demos/config.js.map +1 -1
- package/dist/demos/pages.d.ts +2 -0
- package/dist/demos/pages.d.ts.map +1 -1
- package/dist/demos/pages.js +6 -2
- package/dist/demos/pages.js.map +1 -1
- package/dist/react/DemoShell.js +21 -5
- package/dist/react/DemoShell.js.map +1 -1
- package/dist/react/styles.css +8 -0
- package/dist/remark/index.d.ts +1 -1
- package/dist/remark/index.d.ts.map +1 -1
- package/dist/remark/index.js +1 -1
- package/dist/remark/index.js.map +1 -1
- package/dist/remark/meta.d.ts +13 -0
- package/dist/remark/meta.d.ts.map +1 -1
- package/dist/remark/meta.js +13 -0
- package/dist/remark/meta.js.map +1 -1
- package/dist/remark/remarkDemoFences.d.ts +10 -2
- package/dist/remark/remarkDemoFences.d.ts.map +1 -1
- package/dist/remark/remarkDemoFences.js +6 -4
- package/dist/remark/remarkDemoFences.js.map +1 -1
- package/dist/showcase/AutomatedDemo.d.ts +46 -0
- package/dist/showcase/AutomatedDemo.d.ts.map +1 -0
- package/dist/showcase/AutomatedDemo.js +169 -0
- package/dist/showcase/AutomatedDemo.js.map +1 -0
- package/dist/showcase/LazyShowcase.d.ts +31 -0
- package/dist/showcase/LazyShowcase.d.ts.map +1 -0
- package/dist/showcase/LazyShowcase.js +51 -0
- package/dist/showcase/LazyShowcase.js.map +1 -0
- package/dist/showcase/hooks.d.ts +19 -0
- package/dist/showcase/hooks.d.ts.map +1 -0
- package/dist/showcase/hooks.js +63 -0
- package/dist/showcase/hooks.js.map +1 -0
- package/dist/showcase/index.d.ts +17 -0
- package/dist/showcase/index.d.ts.map +1 -0
- package/dist/showcase/index.js +15 -0
- package/dist/showcase/index.js.map +1 -0
- package/dist/showcase/scripted.d.ts +100 -0
- package/dist/showcase/scripted.d.ts.map +1 -0
- package/dist/showcase/scripted.js +381 -0
- package/dist/showcase/scripted.js.map +1 -0
- package/dist/showcase/styles.css +174 -0
- package/package.json +7 -2
- package/src/demos/build.ts +1 -0
- package/src/demos/config.ts +7 -0
- package/src/demos/pages.ts +6 -2
- package/src/react/DemoShell.tsx +64 -8
- package/src/react/styles.css +8 -0
- package/src/remark/index.ts +1 -1
- package/src/remark/meta.ts +26 -0
- package/src/remark/remarkDemoFences.ts +15 -4
- package/src/showcase/AutomatedDemo.tsx +266 -0
- package/src/showcase/LazyShowcase.tsx +111 -0
- package/src/showcase/hooks.ts +84 -0
- package/src/showcase/index.ts +23 -0
- package/src/showcase/scripted.ts +533 -0
- package/src/showcase/styles.css +174 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny automation toolkit for a "scripted demo you can take over": a fake SVG
|
|
3
|
+
* cursor tweened over a LIVE component, with real state changes applied at
|
|
4
|
+
* each "click". Everything is cancellable through one AbortSignal, so a single
|
|
5
|
+
* real user interaction stops the show instantly and leaves the component
|
|
6
|
+
* exactly where the script brought it.
|
|
7
|
+
*
|
|
8
|
+
* Product-agnostic on purpose: no imports from any grid or app code.
|
|
9
|
+
*/
|
|
10
|
+
/** Thrown by every helper when the script is aborted; callers swallow it. */
|
|
11
|
+
export declare class ScriptCancelled extends Error {
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
14
|
+
export declare function assertActive(signal: AbortSignal): void;
|
|
15
|
+
export declare function sleep(ms: number, signal: AbortSignal): Promise<void>;
|
|
16
|
+
/** Poll until `get` returns a truthy value; null when it times out. */
|
|
17
|
+
export declare function waitFor<T>(get: () => T | null | undefined | false, signal: AbortSignal, { timeout, interval, }?: {
|
|
18
|
+
timeout?: number;
|
|
19
|
+
interval?: number;
|
|
20
|
+
}): Promise<T | null>;
|
|
21
|
+
export type Point = {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const easeInOutCubic: (t: number) => number;
|
|
26
|
+
/** Run `onFrame(easedT)` on every animation frame for `duration` ms. */
|
|
27
|
+
export declare function tween(onFrame: (t: number) => void, duration: number, signal: AbortSignal, ease?: (t: number) => number): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Inertial "fling": starts at `velocity` (px per ms) and decays exponentially,
|
|
30
|
+
* like a trackpad swipe released at speed. `apply` receives the delta for the
|
|
31
|
+
* frame and returns false to stop early (for example when an edge is hit).
|
|
32
|
+
* Resolves with the total distance travelled.
|
|
33
|
+
*/
|
|
34
|
+
export declare function fling(apply: (delta: number) => boolean | void, { velocity,
|
|
35
|
+
/** Fraction of velocity kept per 16.7ms frame. 0.95 ≈ a long glide. */
|
|
36
|
+
friction, minVelocity, maxDuration, }: {
|
|
37
|
+
velocity: number;
|
|
38
|
+
friction?: number;
|
|
39
|
+
minVelocity?: number;
|
|
40
|
+
maxDuration?: number;
|
|
41
|
+
}, signal: AbortSignal): Promise<number>;
|
|
42
|
+
/**
|
|
43
|
+
* Dispatch a full pointer+mouse sequence so whatever the target listens to
|
|
44
|
+
* (pointerdown, mousedown, click…) fires. Coordinates are real client-space
|
|
45
|
+
* coords, so `elementFromPoint`-style logic in handlers also works.
|
|
46
|
+
*
|
|
47
|
+
* Note: synthetic events have `isTrusted === false`; the takeover logic in
|
|
48
|
+
* AutomatedDemo relies on that to tell the script apart from the user.
|
|
49
|
+
*/
|
|
50
|
+
export declare function dispatchClickSequence(el: HTMLElement, clientX: number, clientY: number): void;
|
|
51
|
+
/** Fire hover events (pointerover/enter, mouseover/enter/move) on `el`. */
|
|
52
|
+
export declare function dispatchHover(el: HTMLElement, clientX: number, clientY: number): void;
|
|
53
|
+
export type ScriptedCursor = ReturnType<typeof createScriptedCursor>;
|
|
54
|
+
/**
|
|
55
|
+
* The fake mouse: a cursor element inside a pointer-events-none overlay that
|
|
56
|
+
* covers the demo. Positions are in overlay-local coordinates; the arrow tip
|
|
57
|
+
* is the hotspot.
|
|
58
|
+
*/
|
|
59
|
+
export declare function createScriptedCursor(overlay: HTMLElement): {
|
|
60
|
+
element: HTMLDivElement;
|
|
61
|
+
show(): void;
|
|
62
|
+
hide(): void;
|
|
63
|
+
/** A small caption next to the cursor ("⇢ swipe", "1M rows"…); null hides it. */
|
|
64
|
+
setLabel(text: string | null): void;
|
|
65
|
+
/** Current hotspot position in client coordinates (for event dispatch). */
|
|
66
|
+
clientPoint(): Point;
|
|
67
|
+
localPoint(): Point;
|
|
68
|
+
moveTo(target: Point, signal: AbortSignal, { speed }?: {
|
|
69
|
+
speed?: number;
|
|
70
|
+
}): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Move to an element's center (plus optional offset from center).
|
|
73
|
+
* Recomputes the rect at call time, so virtualized cells are fine as long
|
|
74
|
+
* as they exist when the move starts.
|
|
75
|
+
*/
|
|
76
|
+
moveToElement(target: HTMLElement, signal: AbortSignal, offset?: Partial<Point>, options?: {
|
|
77
|
+
speed?: number;
|
|
78
|
+
}): Promise<void>;
|
|
79
|
+
/** Move onto `target` and fire hover events on it (opens hover menus). */
|
|
80
|
+
hover(target: HTMLElement, signal: AbortSignal, offset?: Partial<Point>): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Play the click ripple; optionally dispatch a real event sequence on
|
|
83
|
+
* `target` at the current cursor position. Resolves after the press —
|
|
84
|
+
* the ripple keeps expanding while the script moves on.
|
|
85
|
+
*/
|
|
86
|
+
click(signal: AbortSignal, target?: HTMLElement | null): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Press on `source`, drag to `to` (overlay-local) dispatching pointermove
|
|
89
|
+
* along the way, release. Events go to `source` (handlers that track a
|
|
90
|
+
* drag usually listen on the pressed element with pointer capture).
|
|
91
|
+
*/
|
|
92
|
+
drag(source: HTMLElement, to: Point, signal: AbortSignal, { duration, steps, }?: {
|
|
93
|
+
duration?: number;
|
|
94
|
+
steps?: number;
|
|
95
|
+
}): Promise<void>;
|
|
96
|
+
/** Convert an element's center to overlay-local coordinates. */
|
|
97
|
+
centerOf: (target: HTMLElement, offset?: Partial<Point>) => Point;
|
|
98
|
+
destroy(): void;
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=scripted.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scripted.d.ts","sourceRoot":"","sources":["../../src/showcase/scripted.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6EAA6E;AAC7E,qBAAa,eAAgB,SAAQ,KAAK;;CAKzC;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,QAE/C;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAapE;AAED,uEAAuE;AACvE,wBAAsB,OAAO,CAAC,CAAC,EAC7B,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,EACvC,MAAM,EAAE,WAAW,EACnB,EACE,OAAe,EACf,QAAc,GACf,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAC9C,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CASnB;AAED,MAAM,MAAM,KAAK,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7C,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,WACmB,CAAC;AAE5D,wEAAwE;AACxE,wBAAgB,KAAK,CACnB,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,EAC5B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,WAAW,EACnB,IAAI,GAAE,CAAC,CAAC,EAAE,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AIG;iBAEO,WAAW,MACf,KAAK,UACD,WAAW,yBAIhB;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IA+D1C,gEAAgE;uBAlLxD,WAAW,WACX,OAAO,CAAC,KAAK,CAAC,KACrB,KAAK;;EAyLT"}
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny automation toolkit for a "scripted demo you can take over": a fake SVG
|
|
3
|
+
* cursor tweened over a LIVE component, with real state changes applied at
|
|
4
|
+
* each "click". Everything is cancellable through one AbortSignal, so a single
|
|
5
|
+
* real user interaction stops the show instantly and leaves the component
|
|
6
|
+
* exactly where the script brought it.
|
|
7
|
+
*
|
|
8
|
+
* Product-agnostic on purpose: no imports from any grid or app code.
|
|
9
|
+
*/
|
|
10
|
+
/** Thrown by every helper when the script is aborted; callers swallow it. */
|
|
11
|
+
export class ScriptCancelled extends Error {
|
|
12
|
+
constructor() {
|
|
13
|
+
super('script cancelled');
|
|
14
|
+
this.name = 'ScriptCancelled';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function assertActive(signal) {
|
|
18
|
+
if (signal.aborted)
|
|
19
|
+
throw new ScriptCancelled();
|
|
20
|
+
}
|
|
21
|
+
export function sleep(ms, signal) {
|
|
22
|
+
assertActive(signal);
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
const id = window.setTimeout(() => {
|
|
25
|
+
signal.removeEventListener('abort', onAbort);
|
|
26
|
+
resolve();
|
|
27
|
+
}, ms);
|
|
28
|
+
const onAbort = () => {
|
|
29
|
+
window.clearTimeout(id);
|
|
30
|
+
reject(new ScriptCancelled());
|
|
31
|
+
};
|
|
32
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** Poll until `get` returns a truthy value; null when it times out. */
|
|
36
|
+
export async function waitFor(get, signal, { timeout = 12000, interval = 120, } = {}) {
|
|
37
|
+
const deadline = Date.now() + timeout;
|
|
38
|
+
for (;;) {
|
|
39
|
+
assertActive(signal);
|
|
40
|
+
const value = get();
|
|
41
|
+
if (value)
|
|
42
|
+
return value;
|
|
43
|
+
if (Date.now() > deadline)
|
|
44
|
+
return null;
|
|
45
|
+
await sleep(interval, signal);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export const easeInOutCubic = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
|
|
49
|
+
/** Run `onFrame(easedT)` on every animation frame for `duration` ms. */
|
|
50
|
+
export function tween(onFrame, duration, signal, ease = easeInOutCubic) {
|
|
51
|
+
assertActive(signal);
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
const start = performance.now();
|
|
54
|
+
let raf = 0;
|
|
55
|
+
const onAbort = () => {
|
|
56
|
+
cancelAnimationFrame(raf);
|
|
57
|
+
reject(new ScriptCancelled());
|
|
58
|
+
};
|
|
59
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
60
|
+
const frame = (now) => {
|
|
61
|
+
const t = Math.min(1, (now - start) / duration);
|
|
62
|
+
try {
|
|
63
|
+
onFrame(ease(t));
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
signal.removeEventListener('abort', onAbort);
|
|
67
|
+
reject(error);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (t >= 1) {
|
|
71
|
+
signal.removeEventListener('abort', onAbort);
|
|
72
|
+
resolve();
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
raf = requestAnimationFrame(frame);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
raf = requestAnimationFrame(frame);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Inertial "fling": starts at `velocity` (px per ms) and decays exponentially,
|
|
83
|
+
* like a trackpad swipe released at speed. `apply` receives the delta for the
|
|
84
|
+
* frame and returns false to stop early (for example when an edge is hit).
|
|
85
|
+
* Resolves with the total distance travelled.
|
|
86
|
+
*/
|
|
87
|
+
export function fling(apply, { velocity,
|
|
88
|
+
/** Fraction of velocity kept per 16.7ms frame. 0.95 ≈ a long glide. */
|
|
89
|
+
friction = 0.955, minVelocity = 0.02, maxDuration = 4000, }, signal) {
|
|
90
|
+
assertActive(signal);
|
|
91
|
+
return new Promise((resolve, reject) => {
|
|
92
|
+
let v = velocity;
|
|
93
|
+
let last = performance.now();
|
|
94
|
+
const start = last;
|
|
95
|
+
let travelled = 0;
|
|
96
|
+
let raf = 0;
|
|
97
|
+
const onAbort = () => {
|
|
98
|
+
cancelAnimationFrame(raf);
|
|
99
|
+
reject(new ScriptCancelled());
|
|
100
|
+
};
|
|
101
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
102
|
+
const done = () => {
|
|
103
|
+
signal.removeEventListener('abort', onAbort);
|
|
104
|
+
resolve(travelled);
|
|
105
|
+
};
|
|
106
|
+
const frame = (now) => {
|
|
107
|
+
const dt = Math.min(48, now - last);
|
|
108
|
+
last = now;
|
|
109
|
+
const delta = v * dt;
|
|
110
|
+
travelled += delta;
|
|
111
|
+
let keepGoing = true;
|
|
112
|
+
try {
|
|
113
|
+
keepGoing = apply(delta);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
signal.removeEventListener('abort', onAbort);
|
|
117
|
+
reject(error);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
v *= Math.pow(friction, dt / 16.67);
|
|
121
|
+
if (keepGoing === false ||
|
|
122
|
+
Math.abs(v) < minVelocity ||
|
|
123
|
+
now - start > maxDuration) {
|
|
124
|
+
done();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
raf = requestAnimationFrame(frame);
|
|
128
|
+
};
|
|
129
|
+
raf = requestAnimationFrame(frame);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const SYNTHETIC_POINTER_ID = 999;
|
|
133
|
+
function safeDispatch(el, event) {
|
|
134
|
+
try {
|
|
135
|
+
el.dispatchEvent(event);
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// a hostile handler must not kill the script
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function mouseInit(clientX, clientY, extra = {}) {
|
|
142
|
+
return {
|
|
143
|
+
bubbles: true,
|
|
144
|
+
cancelable: true,
|
|
145
|
+
composed: true,
|
|
146
|
+
view: window,
|
|
147
|
+
clientX,
|
|
148
|
+
clientY,
|
|
149
|
+
...extra,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function pointerEvent(type, clientX, clientY, extra = {}) {
|
|
153
|
+
return new PointerEvent(type, {
|
|
154
|
+
...mouseInit(clientX, clientY),
|
|
155
|
+
pointerId: SYNTHETIC_POINTER_ID,
|
|
156
|
+
pointerType: 'mouse',
|
|
157
|
+
isPrimary: true,
|
|
158
|
+
...extra,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Dispatch a full pointer+mouse sequence so whatever the target listens to
|
|
163
|
+
* (pointerdown, mousedown, click…) fires. Coordinates are real client-space
|
|
164
|
+
* coords, so `elementFromPoint`-style logic in handlers also works.
|
|
165
|
+
*
|
|
166
|
+
* Note: synthetic events have `isTrusted === false`; the takeover logic in
|
|
167
|
+
* AutomatedDemo relies on that to tell the script apart from the user.
|
|
168
|
+
*/
|
|
169
|
+
export function dispatchClickSequence(el, clientX, clientY) {
|
|
170
|
+
safeDispatch(el, pointerEvent('pointerover', clientX, clientY));
|
|
171
|
+
safeDispatch(el, pointerEvent('pointerenter', clientX, clientY, { bubbles: false }));
|
|
172
|
+
safeDispatch(el, new MouseEvent('mouseover', mouseInit(clientX, clientY)));
|
|
173
|
+
safeDispatch(el, pointerEvent('pointerdown', clientX, clientY, { button: 0, buttons: 1 }));
|
|
174
|
+
safeDispatch(el, new MouseEvent('mousedown', mouseInit(clientX, clientY, { button: 0, buttons: 1 })));
|
|
175
|
+
safeDispatch(el, pointerEvent('pointerup', clientX, clientY, { button: 0, buttons: 0 }));
|
|
176
|
+
safeDispatch(el, new MouseEvent('mouseup', mouseInit(clientX, clientY, { button: 0 })));
|
|
177
|
+
safeDispatch(el, new MouseEvent('click', mouseInit(clientX, clientY, { button: 0, detail: 1 })));
|
|
178
|
+
}
|
|
179
|
+
/** Fire hover events (pointerover/enter, mouseover/enter/move) on `el`. */
|
|
180
|
+
export function dispatchHover(el, clientX, clientY) {
|
|
181
|
+
safeDispatch(el, pointerEvent('pointerover', clientX, clientY));
|
|
182
|
+
safeDispatch(el, pointerEvent('pointerenter', clientX, clientY, { bubbles: false }));
|
|
183
|
+
safeDispatch(el, new MouseEvent('mouseover', mouseInit(clientX, clientY)));
|
|
184
|
+
safeDispatch(el, new MouseEvent('mouseenter', mouseInit(clientX, clientY, { bubbles: false })));
|
|
185
|
+
safeDispatch(el, pointerEvent('pointermove', clientX, clientY));
|
|
186
|
+
safeDispatch(el, new MouseEvent('mousemove', mouseInit(clientX, clientY)));
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Synthetic pointer ids are unknown to the browser, so `setPointerCapture`
|
|
190
|
+
* throws for them. While a scripted drag runs, shadow it on the element
|
|
191
|
+
* instance (and restore it afterwards).
|
|
192
|
+
*/
|
|
193
|
+
function shimPointerCapture(el) {
|
|
194
|
+
const own = Object.prototype.hasOwnProperty.call(el, 'setPointerCapture');
|
|
195
|
+
const previous = own ? el.setPointerCapture : undefined;
|
|
196
|
+
const previousRelease = Object.prototype.hasOwnProperty.call(el, 'releasePointerCapture')
|
|
197
|
+
? el.releasePointerCapture
|
|
198
|
+
: undefined;
|
|
199
|
+
el.setPointerCapture = () => { };
|
|
200
|
+
el.releasePointerCapture = () => { };
|
|
201
|
+
return () => {
|
|
202
|
+
if (previous)
|
|
203
|
+
el.setPointerCapture = previous;
|
|
204
|
+
else
|
|
205
|
+
delete el.setPointerCapture;
|
|
206
|
+
if (previousRelease)
|
|
207
|
+
el.releasePointerCapture = previousRelease;
|
|
208
|
+
else
|
|
209
|
+
delete el.releasePointerCapture;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/** Distance-based duration: constant perceived speed, clamped to sane bounds. */
|
|
213
|
+
function moveDuration(from, to, speed = 1) {
|
|
214
|
+
const distance = Math.hypot(to.x - from.x, to.y - from.y);
|
|
215
|
+
return Math.min(1100, Math.max(260, distance / 0.9)) / speed;
|
|
216
|
+
}
|
|
217
|
+
const CURSOR_HTML = `
|
|
218
|
+
<span class="showcase-cursor__ring"></span>
|
|
219
|
+
<svg class="showcase-cursor__arrow" width="26" height="30" viewBox="0 0 26 30" aria-hidden="true">
|
|
220
|
+
<path d="M2 1 L2 24 L8.4 18.6 L12.2 27.6 L16.6 25.7 L12.8 16.9 L20.5 16.6 Z"
|
|
221
|
+
fill="#14161c" stroke="#fff" stroke-width="1.6" stroke-linejoin="round" />
|
|
222
|
+
</svg>
|
|
223
|
+
<span class="showcase-cursor__label"></span>
|
|
224
|
+
`;
|
|
225
|
+
/**
|
|
226
|
+
* The fake mouse: a cursor element inside a pointer-events-none overlay that
|
|
227
|
+
* covers the demo. Positions are in overlay-local coordinates; the arrow tip
|
|
228
|
+
* is the hotspot.
|
|
229
|
+
*/
|
|
230
|
+
export function createScriptedCursor(overlay) {
|
|
231
|
+
const el = document.createElement('div');
|
|
232
|
+
el.className = 'showcase-cursor';
|
|
233
|
+
el.innerHTML = CURSOR_HTML;
|
|
234
|
+
overlay.appendChild(el);
|
|
235
|
+
const label = el.querySelector('.showcase-cursor__label');
|
|
236
|
+
let pos = {
|
|
237
|
+
x: overlay.clientWidth * 0.5,
|
|
238
|
+
y: overlay.clientHeight * 0.65,
|
|
239
|
+
};
|
|
240
|
+
const render = () => {
|
|
241
|
+
el.style.transform = `translate3d(${pos.x}px, ${pos.y}px, 0)`;
|
|
242
|
+
};
|
|
243
|
+
render();
|
|
244
|
+
const toLocal = (clientX, clientY) => {
|
|
245
|
+
const rect = overlay.getBoundingClientRect();
|
|
246
|
+
return { x: clientX - rect.left, y: clientY - rect.top };
|
|
247
|
+
};
|
|
248
|
+
const toClient = (p) => {
|
|
249
|
+
const rect = overlay.getBoundingClientRect();
|
|
250
|
+
return { x: p.x + rect.left, y: p.y + rect.top };
|
|
251
|
+
};
|
|
252
|
+
const centerOf = (target, offset = {}) => {
|
|
253
|
+
const rect = target.getBoundingClientRect();
|
|
254
|
+
return toLocal(rect.left + rect.width / 2 + (offset.x ?? 0), rect.top + rect.height / 2 + (offset.y ?? 0));
|
|
255
|
+
};
|
|
256
|
+
const cursor = {
|
|
257
|
+
element: el,
|
|
258
|
+
show() {
|
|
259
|
+
el.classList.add('is-visible');
|
|
260
|
+
},
|
|
261
|
+
hide() {
|
|
262
|
+
el.classList.remove('is-visible', 'is-pressed', 'is-clicking');
|
|
263
|
+
cursor.setLabel(null);
|
|
264
|
+
},
|
|
265
|
+
/** A small caption next to the cursor ("⇢ swipe", "1M rows"…); null hides it. */
|
|
266
|
+
setLabel(text) {
|
|
267
|
+
label.textContent = text ?? '';
|
|
268
|
+
el.classList.toggle('has-label', !!text);
|
|
269
|
+
},
|
|
270
|
+
/** Current hotspot position in client coordinates (for event dispatch). */
|
|
271
|
+
clientPoint() {
|
|
272
|
+
return toClient(pos);
|
|
273
|
+
},
|
|
274
|
+
localPoint() {
|
|
275
|
+
return { ...pos };
|
|
276
|
+
},
|
|
277
|
+
async moveTo(target, signal, { speed = 1 } = {}) {
|
|
278
|
+
el.classList.add('is-visible');
|
|
279
|
+
const from = { ...pos };
|
|
280
|
+
await tween((t) => {
|
|
281
|
+
pos = {
|
|
282
|
+
x: from.x + (target.x - from.x) * t,
|
|
283
|
+
y: from.y + (target.y - from.y) * t,
|
|
284
|
+
};
|
|
285
|
+
render();
|
|
286
|
+
}, moveDuration(from, target, speed), signal);
|
|
287
|
+
},
|
|
288
|
+
/**
|
|
289
|
+
* Move to an element's center (plus optional offset from center).
|
|
290
|
+
* Recomputes the rect at call time, so virtualized cells are fine as long
|
|
291
|
+
* as they exist when the move starts.
|
|
292
|
+
*/
|
|
293
|
+
async moveToElement(target, signal, offset = {}, options) {
|
|
294
|
+
await cursor.moveTo(centerOf(target, offset), signal, options);
|
|
295
|
+
},
|
|
296
|
+
/** Move onto `target` and fire hover events on it (opens hover menus). */
|
|
297
|
+
async hover(target, signal, offset = {}) {
|
|
298
|
+
await cursor.moveToElement(target, signal, offset);
|
|
299
|
+
const client = toClient(pos);
|
|
300
|
+
dispatchHover(target, client.x, client.y);
|
|
301
|
+
},
|
|
302
|
+
/**
|
|
303
|
+
* Play the click ripple; optionally dispatch a real event sequence on
|
|
304
|
+
* `target` at the current cursor position. Resolves after the press —
|
|
305
|
+
* the ripple keeps expanding while the script moves on.
|
|
306
|
+
*/
|
|
307
|
+
async click(signal, target) {
|
|
308
|
+
el.classList.remove('is-clicking');
|
|
309
|
+
// reflow so re-adding the class restarts the ripple animation
|
|
310
|
+
void el.offsetWidth;
|
|
311
|
+
el.classList.add('is-clicking');
|
|
312
|
+
await sleep(130, signal);
|
|
313
|
+
let restore;
|
|
314
|
+
if (target) {
|
|
315
|
+
const client = toClient(pos);
|
|
316
|
+
restore = shimPointerCapture(target);
|
|
317
|
+
dispatchClickSequence(target, client.x, client.y);
|
|
318
|
+
}
|
|
319
|
+
try {
|
|
320
|
+
await sleep(200, signal);
|
|
321
|
+
}
|
|
322
|
+
finally {
|
|
323
|
+
// handlers often finish in a rAF that may still call setPointerCapture
|
|
324
|
+
restore?.();
|
|
325
|
+
el.classList.remove('is-clicking');
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
/**
|
|
329
|
+
* Press on `source`, drag to `to` (overlay-local) dispatching pointermove
|
|
330
|
+
* along the way, release. Events go to `source` (handlers that track a
|
|
331
|
+
* drag usually listen on the pressed element with pointer capture).
|
|
332
|
+
*/
|
|
333
|
+
async drag(source, to, signal, { duration = 900, steps = 36, } = {}) {
|
|
334
|
+
await cursor.moveToElement(source, signal);
|
|
335
|
+
const restore = shimPointerCapture(source);
|
|
336
|
+
try {
|
|
337
|
+
const start = toClient(pos);
|
|
338
|
+
el.classList.add('is-pressed');
|
|
339
|
+
safeDispatch(source, pointerEvent('pointerdown', start.x, start.y, {
|
|
340
|
+
button: 0,
|
|
341
|
+
buttons: 1,
|
|
342
|
+
}));
|
|
343
|
+
safeDispatch(source, new MouseEvent('mousedown', mouseInit(start.x, start.y, { button: 0, buttons: 1 })));
|
|
344
|
+
await sleep(160, signal);
|
|
345
|
+
const from = { ...pos };
|
|
346
|
+
let lastStep = -1;
|
|
347
|
+
await tween((t) => {
|
|
348
|
+
pos = {
|
|
349
|
+
x: from.x + (to.x - from.x) * t,
|
|
350
|
+
y: from.y + (to.y - from.y) * t,
|
|
351
|
+
};
|
|
352
|
+
render();
|
|
353
|
+
const step = Math.floor(t * steps);
|
|
354
|
+
if (step !== lastStep) {
|
|
355
|
+
lastStep = step;
|
|
356
|
+
const client = toClient(pos);
|
|
357
|
+
safeDispatch(source, pointerEvent('pointermove', client.x, client.y, { buttons: 1 }));
|
|
358
|
+
}
|
|
359
|
+
}, duration, signal);
|
|
360
|
+
await sleep(140, signal);
|
|
361
|
+
const end = toClient(pos);
|
|
362
|
+
safeDispatch(source, pointerEvent('pointerup', end.x, end.y, { button: 0, buttons: 0 }));
|
|
363
|
+
safeDispatch(source, new MouseEvent('mouseup', mouseInit(end.x, end.y, { button: 0 })));
|
|
364
|
+
el.classList.remove('is-pressed');
|
|
365
|
+
// handlers commonly finish the drop in a rAF
|
|
366
|
+
await sleep(120, signal);
|
|
367
|
+
}
|
|
368
|
+
finally {
|
|
369
|
+
el.classList.remove('is-pressed');
|
|
370
|
+
restore();
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
/** Convert an element's center to overlay-local coordinates. */
|
|
374
|
+
centerOf,
|
|
375
|
+
destroy() {
|
|
376
|
+
el.remove();
|
|
377
|
+
},
|
|
378
|
+
};
|
|
379
|
+
return cursor;
|
|
380
|
+
}
|
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EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CACnE,CAAC;gBACF,YAAY,CACV,MAAM,EACN,IAAI,UAAU,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAClE,CAAC;gBACF,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;gBAClC,6CAA6C;gBAC7C,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAC3B,CAAC;oBAAS,CAAC;gBACT,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;gBAClC,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC;QAED,gEAAgE;QAChE,QAAQ;QAER,OAAO;YACL,EAAE,CAAC,MAAM,EAAE,CAAC;QACd,CAAC;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Styles for the product-agnostic showcase kit (scripted cursor, automated
|
|
3
|
+
* demo shell, lazy poster). Hosts theme it through these custom properties:
|
|
4
|
+
*
|
|
5
|
+
* --showcase-accent cursor click ripple, pill dot
|
|
6
|
+
* --showcase-pill-bg pill background
|
|
7
|
+
* --showcase-pill-fg pill text
|
|
8
|
+
* --showcase-pill-border pill border
|
|
9
|
+
* --showcase-z base z-index of the overlay layer
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
.showcase-demo {
|
|
13
|
+
position: relative;
|
|
14
|
+
height: 100%;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.showcase-demo__overlay {
|
|
18
|
+
position: absolute;
|
|
19
|
+
inset: 0;
|
|
20
|
+
z-index: calc(var(--showcase-z, 2000));
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* ---- the fake cursor ---------------------------------------------------- */
|
|
26
|
+
|
|
27
|
+
.showcase-cursor {
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: 0;
|
|
30
|
+
top: 0;
|
|
31
|
+
opacity: 0;
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
will-change: transform;
|
|
34
|
+
transition: opacity 350ms ease;
|
|
35
|
+
}
|
|
36
|
+
.showcase-cursor.is-visible {
|
|
37
|
+
opacity: 1;
|
|
38
|
+
}
|
|
39
|
+
.showcase-cursor__arrow {
|
|
40
|
+
display: block;
|
|
41
|
+
filter: drop-shadow(0 2px 5px rgb(0 0 0 / 0.35));
|
|
42
|
+
transform-origin: 4px 3px; /* the arrow tip */
|
|
43
|
+
transition: transform 130ms ease;
|
|
44
|
+
}
|
|
45
|
+
.showcase-cursor.is-clicking .showcase-cursor__arrow,
|
|
46
|
+
.showcase-cursor.is-pressed .showcase-cursor__arrow {
|
|
47
|
+
transform: scale(0.82);
|
|
48
|
+
}
|
|
49
|
+
.showcase-cursor__ring {
|
|
50
|
+
position: absolute;
|
|
51
|
+
left: -15px;
|
|
52
|
+
top: -14px;
|
|
53
|
+
width: 34px;
|
|
54
|
+
height: 34px;
|
|
55
|
+
border-radius: 50%;
|
|
56
|
+
background: var(--showcase-accent, #3b82f6);
|
|
57
|
+
opacity: 0;
|
|
58
|
+
transform: scale(0.3);
|
|
59
|
+
}
|
|
60
|
+
.showcase-cursor.is-clicking .showcase-cursor__ring {
|
|
61
|
+
animation: showcase-ripple 500ms ease-out;
|
|
62
|
+
}
|
|
63
|
+
.showcase-cursor.is-pressed .showcase-cursor__ring {
|
|
64
|
+
opacity: 0.35;
|
|
65
|
+
transform: scale(0.75);
|
|
66
|
+
transition: opacity 120ms ease, transform 120ms ease;
|
|
67
|
+
}
|
|
68
|
+
.showcase-cursor__label {
|
|
69
|
+
position: absolute;
|
|
70
|
+
left: 24px;
|
|
71
|
+
top: 22px;
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
padding: 3px 8px;
|
|
74
|
+
border-radius: 999px;
|
|
75
|
+
font: 500 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
76
|
+
color: var(--showcase-pill-fg, #e5e7eb);
|
|
77
|
+
background: var(--showcase-pill-bg, rgb(17 19 24 / 0.92));
|
|
78
|
+
border: 1px solid var(--showcase-pill-border, rgb(255 255 255 / 0.14));
|
|
79
|
+
opacity: 0;
|
|
80
|
+
transform: translateY(4px);
|
|
81
|
+
transition: opacity 200ms ease, transform 200ms ease;
|
|
82
|
+
}
|
|
83
|
+
.showcase-cursor.has-label .showcase-cursor__label {
|
|
84
|
+
opacity: 1;
|
|
85
|
+
transform: none;
|
|
86
|
+
}
|
|
87
|
+
@keyframes showcase-ripple {
|
|
88
|
+
0% {
|
|
89
|
+
opacity: 0.4;
|
|
90
|
+
transform: scale(0.3);
|
|
91
|
+
}
|
|
92
|
+
100% {
|
|
93
|
+
opacity: 0;
|
|
94
|
+
transform: scale(1.9);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* ---- status pills ------------------------------------------------------- */
|
|
99
|
+
|
|
100
|
+
.showcase-pill {
|
|
101
|
+
position: absolute;
|
|
102
|
+
bottom: 12px;
|
|
103
|
+
left: 50%;
|
|
104
|
+
z-index: calc(var(--showcase-z, 2000) + 1);
|
|
105
|
+
transform: translateX(-50%);
|
|
106
|
+
display: inline-flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
gap: 8px;
|
|
109
|
+
padding: 6px 14px;
|
|
110
|
+
border-radius: 999px;
|
|
111
|
+
font: 500 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
112
|
+
white-space: nowrap;
|
|
113
|
+
color: var(--showcase-pill-fg, #e5e7eb);
|
|
114
|
+
background: var(--showcase-pill-bg, rgb(17 19 24 / 0.9));
|
|
115
|
+
border: 1px solid var(--showcase-pill-border, rgb(255 255 255 / 0.14));
|
|
116
|
+
box-shadow: 0 6px 24px rgb(0 0 0 / 0.35);
|
|
117
|
+
backdrop-filter: blur(8px);
|
|
118
|
+
}
|
|
119
|
+
.showcase-pill--running {
|
|
120
|
+
pointer-events: none;
|
|
121
|
+
}
|
|
122
|
+
.showcase-pill--user {
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
transition: border-color 150ms ease, color 150ms ease;
|
|
125
|
+
}
|
|
126
|
+
.showcase-pill--user:hover {
|
|
127
|
+
border-color: var(--showcase-accent, #3b82f6);
|
|
128
|
+
}
|
|
129
|
+
.showcase-pill__dot {
|
|
130
|
+
width: 6px;
|
|
131
|
+
height: 6px;
|
|
132
|
+
border-radius: 50%;
|
|
133
|
+
background: var(--showcase-accent, #3b82f6);
|
|
134
|
+
animation: showcase-pulse 1.4s ease-in-out infinite;
|
|
135
|
+
}
|
|
136
|
+
@keyframes showcase-pulse {
|
|
137
|
+
50% {
|
|
138
|
+
opacity: 0.35;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* ---- lazy poster → live ------------------------------------------------- */
|
|
143
|
+
|
|
144
|
+
.showcase-lazy {
|
|
145
|
+
position: relative;
|
|
146
|
+
overflow: hidden;
|
|
147
|
+
}
|
|
148
|
+
.showcase-lazy__poster,
|
|
149
|
+
.showcase-lazy__live {
|
|
150
|
+
position: absolute;
|
|
151
|
+
inset: 0;
|
|
152
|
+
}
|
|
153
|
+
.showcase-lazy__poster {
|
|
154
|
+
transition: opacity 500ms ease;
|
|
155
|
+
}
|
|
156
|
+
.showcase-lazy__live {
|
|
157
|
+
opacity: 0;
|
|
158
|
+
transition: opacity 500ms ease;
|
|
159
|
+
}
|
|
160
|
+
.showcase-lazy[data-showcase-ready='true'] .showcase-lazy__live {
|
|
161
|
+
opacity: 1;
|
|
162
|
+
}
|
|
163
|
+
.showcase-lazy[data-showcase-ready='true'] .showcase-lazy__poster {
|
|
164
|
+
opacity: 0;
|
|
165
|
+
pointer-events: none;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@media (prefers-reduced-motion: reduce) {
|
|
169
|
+
.showcase-lazy__poster,
|
|
170
|
+
.showcase-lazy__live,
|
|
171
|
+
.showcase-cursor {
|
|
172
|
+
transition: none;
|
|
173
|
+
}
|
|
174
|
+
}
|