@gridui/case-showcase 0.0.0-stage → 1.0.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 CHANGED
@@ -1,3 +1,100 @@
1
- # Temporary Holding Version
1
+ # Case showcase
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `@gridui/case-showcase` draws an authored customer case inside
4
+ an independent React component. The host supplies the final HTML/SVG composition,
5
+ localized control labels, and a timeline. The package owns three cursors,
6
+ selection outlines, playback, and cleanup.
7
+
8
+ ## Preview
9
+
10
+ Run `make storybook` from the repository root and open **Landing / CaseShowcase**.
11
+ The examples include a complete authored portal and independent instances.
12
+ Stories and browser fixtures are separate from the published runtime.
13
+
14
+ ## Consumption
15
+
16
+ Install `@gridui/case-showcase` with its React peer dependencies. Load
17
+ `@gridui/theme/styles.css`, `@gridui/button/styles.css`, then
18
+ `@gridui/case-showcase/styles.css`. The optional theme reset is host-owned.
19
+
20
+ ```tsx
21
+ import { CaseShowcase } from "@gridui/case-showcase";
22
+ import type { CaseShowcaseLabels, CaseStep } from "@gridui/case-showcase";
23
+
24
+ const labels: CaseShowcaseLabels = {
25
+ play: "Play",
26
+ pause: "Pause",
27
+ resume: "Resume",
28
+ replay: "Replay",
29
+ finish: "Skip to end",
30
+ ready: "Ready",
31
+ playing: "Playing",
32
+ paused: "Paused",
33
+ complete: "Complete",
34
+ reducedMotion: "Reduced motion is on",
35
+ };
36
+
37
+ const steps: readonly CaseStep[] = [
38
+ { target: "title", kind: "text", start: 0, duration: 900, cursor: 0 },
39
+ { target: "summary", kind: "reveal", start: 700, duration: 1200, cursor: 1 },
40
+ ];
41
+
42
+ <CaseShowcase title="Customer workspace" labels={labels} steps={steps}>
43
+ <h3 data-case-target="title">Project overview</h3>
44
+ <p data-case-target="summary">Twelve active projects, together in one place.</p>
45
+ </CaseShowcase>
46
+ ```
47
+
48
+ Keep the timeline reference stable, for example as a module constant. Use a React
49
+ `key` when replacing a case's composition. Changing `steps` resets playback.
50
+ Ordinary parent rerenders preserve the current position. Case content is an
51
+ authored, static presentation during playback.
52
+
53
+ ## Actions and targets
54
+
55
+ Each step has a `target`, `kind`, `start`, `duration`, and `cursor` (0, 1, or 2).
56
+ Times are milliseconds. The first 18% of an action moves its cursor to the start;
57
+ the remaining time draws the target. Different cursors can work concurrently.
58
+
59
+ | Kind | Behavior |
60
+ | --- | --- |
61
+ | `box` | Drag from the top-left to the bottom-right, revealing the fill with selection handles and a size badge |
62
+ | `text` | Reveal measured graphemes without changing the final text or its line wrapping |
63
+ | `line` | Trace an SVG `path` by its actual length; ordinary elements reveal horizontally |
64
+ | `reveal` | Sweep horizontally across a complete element |
65
+ | `copy` | Drag a visual copy from `from` to the target, then display the target's own content |
66
+
67
+ Set `data-case-target` on each target. IDs are local to the instance. A target has
68
+ one action, and actions on the same cursor cannot overlap. Copy sources must
69
+ already be complete. Invalid timelines or missing/duplicate targets throw a
70
+ descriptive authoring error before any content is hidden.
71
+
72
+ Animated targets must be siblings or otherwise non-nested. For a panel followed
73
+ by its contents, use an absolutely positioned background element as the `box`
74
+ target and separate content targets beside it. Target elements need measurable
75
+ boxes. Text targets support text and inline text markup. Use `reveal` for media
76
+ and mixed icon/text compositions. Use unfilled SVG paths for stroke drawing.
77
+ Copy preserves element and descendant computed styles; pseudo-elements and live
78
+ canvas/video contents should be represented with explicit presentation markup.
79
+
80
+ Let the host compose responsive HTML/CSS inside the stage. Measurements use the
81
+ instance's coordinate system and refresh on container resize, font completion,
82
+ and image load. A dedicated compact composition keeps small text readable.
83
+ Avoid independently scrolling or rotating target subtrees during playback.
84
+
85
+ ## Playback and accessibility
86
+
87
+ The server renders the complete case. Playback begins only after a user selects
88
+ Play. Without JavaScript the final composition remains readable. During playback
89
+ and pause the presentation stage is inert; controls remain accessible outside it.
90
+ Decorative cursors and selection outlines are hidden from assistive technology.
91
+
92
+ Pause retains progress. Resume continues it. Replay starts from the beginning.
93
+ Skip and natural completion remove temporary styles and copies and expose the
94
+ complete case. Leaving the viewport or hiding the document pauses playback;
95
+ the viewer explicitly resumes it. Reduced motion shows the complete case and
96
+ disables playback, including when the preference changes during a run.
97
+
98
+ Each instance owns its animation frame, target references, and observers. Unmount
99
+ cancels playback and restores authored styles. All public copy comes from `title`,
100
+ `labels`, and the host's children.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package CaseShowcase
4
+ * @namespace CaseShowcase
5
+ * @description Case Showcase
6
+ */
7
+ import type { CaseShowcaseLabels, CaseStep } from "./types";
8
+ import type { FC, ReactNode } from "react";
9
+ export type CaseShowcaseProps = {
10
+ readonly title: string;
11
+ readonly children: ReactNode;
12
+ readonly steps: readonly CaseStep[];
13
+ readonly labels: CaseShowcaseLabels;
14
+ readonly className?: string;
15
+ };
16
+ export declare const CaseShowcase: FC<CaseShowcaseProps>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package CaseShowcase
4
+ * @namespace CaseShowcase
5
+ * @description Geometry
6
+ */
7
+ export type CaseBox = {
8
+ readonly x: number;
9
+ readonly y: number;
10
+ readonly width: number;
11
+ readonly height: number;
12
+ };
13
+ export declare const measureBox: (element: Element, stage: HTMLElement) => CaseBox;
14
+ export declare const measureText: (element: Element, stage: HTMLElement) => readonly CaseBox[][];
15
+ export declare const textClip: (graphemes: readonly CaseBox[][], count: number, box: CaseBox) => string;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package CaseShowcase
4
+ * @namespace CaseShowcase
5
+ * @description Playback
6
+ */
7
+ import type { CasePlaybackState, CaseStep } from "./types";
8
+ export declare class CasePlayback {
9
+ private readonly stage;
10
+ private readonly overlay;
11
+ private readonly progress;
12
+ private readonly onState;
13
+ private readonly targets;
14
+ private readonly duration;
15
+ private elapsed;
16
+ private startedAt;
17
+ private frame;
18
+ private state;
19
+ constructor(stage: HTMLElement, overlay: HTMLElement, progress: HTMLElement, steps: readonly CaseStep[], onState: (state: CasePlaybackState) => void);
20
+ play(): void;
21
+ pause(): void;
22
+ finish(): void;
23
+ destroy(): void;
24
+ refresh: () => void;
25
+ private setState;
26
+ private measure;
27
+ private tick;
28
+ private clear;
29
+ private anchor;
30
+ private copy;
31
+ private draw;
32
+ private render;
33
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package CaseShowcase
4
+ * @namespace CaseShowcase
5
+ * @description Types
6
+ */
7
+ export type CaseStep = {
8
+ readonly target: string;
9
+ readonly start: number;
10
+ readonly duration: number;
11
+ readonly cursor: 0 | 1 | 2;
12
+ } & ({
13
+ readonly kind: "box" | "text" | "line" | "reveal";
14
+ } | {
15
+ readonly kind: "copy";
16
+ readonly from: string;
17
+ });
18
+ export type CaseShowcaseLabels = {
19
+ readonly play: string;
20
+ readonly pause: string;
21
+ readonly resume: string;
22
+ readonly replay: string;
23
+ readonly finish: string;
24
+ readonly ready: string;
25
+ readonly playing: string;
26
+ readonly paused: string;
27
+ readonly complete: string;
28
+ readonly reducedMotion: string;
29
+ };
30
+ export type CasePlaybackState = "ready" | "playing" | "paused" | "complete";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package CaseShowcase
4
+ * @namespace Root
5
+ * @description Index
6
+ */
7
+ export type { CaseShowcaseProps } from "./case-showcase/case-showcase";
8
+ export { CaseShowcase } from "./case-showcase/case-showcase";
9
+ export type { CasePlaybackState, CaseShowcaseLabels, CaseStep } from "./case-showcase/types";
package/dist/index.js ADDED
@@ -0,0 +1,721 @@
1
+ // src/case-showcase/geometry.ts
2
+ var measureBox = (element, stage) => {
3
+ const origin = stage.getBoundingClientRect();
4
+ const rect = element.getBoundingClientRect();
5
+ const scaleX = origin.width / (stage.offsetWidth || 1);
6
+ const scaleY = origin.height / (stage.offsetHeight || 1);
7
+ return {
8
+ x: (rect.left - origin.left) / scaleX,
9
+ y: (rect.top - origin.top) / scaleY,
10
+ width: rect.width / scaleX,
11
+ height: rect.height / scaleY
12
+ };
13
+ };
14
+ var measureText = (element, stage) => {
15
+ const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
16
+ const nodes = [];
17
+ let text = "";
18
+ let node = walker.nextNode();
19
+ while (node) {
20
+ if (node instanceof Text) {
21
+ nodes.push({
22
+ node,
23
+ start: text.length,
24
+ end: text.length + node.length
25
+ });
26
+ text += node.data;
27
+ }
28
+ node = walker.nextNode();
29
+ }
30
+ const origin = stage.getBoundingClientRect();
31
+ const scaleX = origin.width / (stage.offsetWidth || 1);
32
+ const scaleY = origin.height / (stage.offsetHeight || 1);
33
+ const range = document.createRange();
34
+ const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
35
+ return Array.from(segmenter.segment(text), ({ index, segment }) => {
36
+ const start = nodes.find((item) => {
37
+ return item.end > index;
38
+ });
39
+ const end = nodes.find((item) => {
40
+ return item.end >= index + segment.length;
41
+ });
42
+ if (!start || !end) {
43
+ return [];
44
+ }
45
+ range.setStart(start.node, index - start.start);
46
+ range.setEnd(end.node, index + segment.length - end.start);
47
+ return Array.from(range.getClientRects(), (rect) => {
48
+ return {
49
+ x: (rect.left - origin.left) / scaleX,
50
+ y: (rect.top - origin.top) / scaleY,
51
+ width: rect.width / scaleX,
52
+ height: rect.height / scaleY
53
+ };
54
+ });
55
+ });
56
+ };
57
+ var textClip = (graphemes, count, box) => {
58
+ const lines = [];
59
+ for (const rect of graphemes.slice(0, count).flat()) {
60
+ const previous = lines.at(-1);
61
+ if (previous && Math.abs(previous.y - rect.y) < 2 && Math.abs(previous.height - rect.height) < 2) {
62
+ const x = Math.min(previous.x, rect.x);
63
+ lines[lines.length - 1] = {
64
+ x,
65
+ y: previous.y,
66
+ width: Math.max(previous.x + previous.width, rect.x + rect.width) - x,
67
+ height: Math.max(previous.height, rect.height)
68
+ };
69
+ } else {
70
+ lines.push(rect);
71
+ }
72
+ }
73
+ const path = lines.map((line) => {
74
+ return `M${line.x - box.x - 1},${line.y - box.y - 1}h${line.width + 2}v${line.height + 2}h${-line.width - 2}Z`;
75
+ }).join(" ");
76
+ return `path('${path || "M0,0Z"}')`;
77
+ };
78
+
79
+ // src/case-showcase/playback.ts
80
+ var properties = [
81
+ "clip-path",
82
+ "opacity",
83
+ "stroke-dasharray",
84
+ "stroke-dashoffset"
85
+ ];
86
+ var clamp = (value) => {
87
+ return Math.max(0, Math.min(1, value));
88
+ };
89
+ var restore = (target) => {
90
+ for (const { property, value, priority } of target.original) {
91
+ if (value) {
92
+ target.element.style.setProperty(property, value, priority);
93
+ } else {
94
+ target.element.style.removeProperty(property);
95
+ }
96
+ }
97
+ };
98
+ var CasePlayback = class {
99
+ constructor(stage, overlay, progress, steps, onState) {
100
+ this.stage = stage;
101
+ this.overlay = overlay;
102
+ this.progress = progress;
103
+ this.onState = onState;
104
+ const elements = /* @__PURE__ */ new Map();
105
+ for (const element of stage.querySelectorAll("[data-case-target]")) {
106
+ const id = element.dataset.caseTarget;
107
+ if (elements.has(id)) {
108
+ throw new Error(`Duplicate case target: ${id}`);
109
+ }
110
+ elements.set(id, element);
111
+ }
112
+ const ids = /* @__PURE__ */ new Set();
113
+ const cursorEnd = [
114
+ 0,
115
+ 0,
116
+ 0
117
+ ];
118
+ const ordered = [...steps].sort((left, right) => {
119
+ return left.start - right.start;
120
+ });
121
+ this.targets = ordered.map((step) => {
122
+ const element = elements.get(step.target);
123
+ if (!element || ids.has(step.target)) {
124
+ throw new Error(`Case steps require one existing, unique target: ${step.target}`);
125
+ }
126
+ if (!Number.isFinite(step.start) || !Number.isFinite(step.duration) || step.duration <= 0 || step.start < 0 || step.cursor < 0 || step.cursor > 2 || !Number.isInteger(step.cursor)) {
127
+ throw new Error(`Invalid case timing or cursor: ${step.target}`);
128
+ }
129
+ if (step.start < cursorEnd[step.cursor]) {
130
+ throw new Error(`Overlapping actions for cursor ${step.cursor}: ${step.target}`);
131
+ }
132
+ cursorEnd[step.cursor] = step.start + step.duration;
133
+ ids.add(step.target);
134
+ let source = null;
135
+ if (step.kind === "copy") {
136
+ source = elements.get(step.from) ?? null;
137
+ const sourceStep = ordered.find((item) => {
138
+ return item.target === step.from;
139
+ });
140
+ if (!source || source === element || sourceStep && sourceStep.start + sourceStep.duration > step.start) {
141
+ throw new Error(`Copy source must be complete before its copy: ${step.target}`);
142
+ }
143
+ }
144
+ return {
145
+ step,
146
+ element,
147
+ source,
148
+ ghost: null,
149
+ box: measureBox(element, stage),
150
+ text: [],
151
+ original: properties.map((property) => {
152
+ return {
153
+ property,
154
+ value: element.style.getPropertyValue(property),
155
+ priority: element.style.getPropertyPriority(property)
156
+ };
157
+ })
158
+ };
159
+ });
160
+ for (const target of this.targets) {
161
+ if (this.targets.some((other) => {
162
+ return other !== target && target.element.contains(other.element);
163
+ })) {
164
+ throw new Error(`Animated targets must not contain each other: ${target.step.target}`);
165
+ }
166
+ }
167
+ this.duration = Math.max(0, ...ordered.map((step) => {
168
+ return step.start + step.duration;
169
+ }));
170
+ }
171
+ stage;
172
+ overlay;
173
+ progress;
174
+ onState;
175
+ targets;
176
+ duration;
177
+ elapsed = 0;
178
+ startedAt = 0;
179
+ frame = 0;
180
+ state = "ready";
181
+ play() {
182
+ if (this.state === "playing") {
183
+ return;
184
+ }
185
+ if (this.state !== "paused") {
186
+ this.elapsed = 0;
187
+ }
188
+ this.measure();
189
+ this.startedAt = performance.now() - this.elapsed;
190
+ this.setState("playing");
191
+ this.render();
192
+ this.frame = requestAnimationFrame(this.tick);
193
+ }
194
+ pause() {
195
+ if (this.state !== "playing") {
196
+ return;
197
+ }
198
+ cancelAnimationFrame(this.frame);
199
+ this.elapsed = Math.min(this.duration, performance.now() - this.startedAt);
200
+ this.render();
201
+ this.setState("paused");
202
+ }
203
+ finish() {
204
+ cancelAnimationFrame(this.frame);
205
+ this.elapsed = this.duration;
206
+ this.clear();
207
+ this.progress.style.transform = "scaleX(1)";
208
+ this.setState("complete");
209
+ }
210
+ destroy() {
211
+ cancelAnimationFrame(this.frame);
212
+ this.clear();
213
+ this.progress.style.transform = "scaleX(0)";
214
+ }
215
+ refresh = () => {
216
+ if (this.state === "playing" || this.state === "paused") {
217
+ this.measure();
218
+ this.render();
219
+ }
220
+ };
221
+ setState(state) {
222
+ this.state = state;
223
+ this.onState(state);
224
+ }
225
+ measure() {
226
+ for (const target of this.targets) {
227
+ target.box = measureBox(target.element, this.stage);
228
+ if (target.step.kind === "text") {
229
+ target.text = measureText(target.element, this.stage);
230
+ }
231
+ }
232
+ }
233
+ tick = (now) => {
234
+ this.elapsed = Math.min(this.duration, now - this.startedAt);
235
+ if (this.elapsed >= this.duration) {
236
+ this.finish();
237
+ return;
238
+ }
239
+ this.render();
240
+ this.frame = requestAnimationFrame(this.tick);
241
+ };
242
+ clear() {
243
+ for (const target of this.targets) {
244
+ restore(target);
245
+ target.ghost?.remove();
246
+ target.ghost = null;
247
+ }
248
+ this.overlay.hidden = true;
249
+ }
250
+ anchor(target, progress) {
251
+ const { box, step, element } = target;
252
+ if (step.kind === "copy") {
253
+ const source = measureBox(target.source, this.stage);
254
+ return {
255
+ x: source.x + (box.x - source.x) * progress + 16,
256
+ y: source.y + (box.y - source.y) * progress + 16
257
+ };
258
+ }
259
+ if (step.kind === "text") {
260
+ const count = Math.floor(target.text.length * progress);
261
+ const last = target.text[count - 1]?.at(-1);
262
+ const first = target.text[0]?.[0];
263
+ return {
264
+ x: last ? last.x + last.width : first?.x ?? box.x,
265
+ y: last?.y ?? first?.y ?? box.y
266
+ };
267
+ }
268
+ if (step.kind === "line" && element instanceof SVGPathElement) {
269
+ const point = element.getPointAtLength(element.getTotalLength() * progress);
270
+ const matrix = element.getScreenCTM();
271
+ if (matrix) {
272
+ const screen = new DOMPoint(point.x, point.y).matrixTransform(matrix);
273
+ const origin = this.stage.getBoundingClientRect();
274
+ return {
275
+ x: (screen.x - origin.left) * this.stage.offsetWidth / origin.width,
276
+ y: (screen.y - origin.top) * this.stage.offsetHeight / origin.height
277
+ };
278
+ }
279
+ }
280
+ const y = step.kind === "box" ? box.y + box.height * progress : box.y + box.height / 2;
281
+ return {
282
+ x: box.x + box.width * progress,
283
+ y
284
+ };
285
+ }
286
+ copy(target, progress) {
287
+ const source = target.source;
288
+ const origin = measureBox(source, this.stage);
289
+ if (!target.ghost) {
290
+ const ghost = source.cloneNode(true);
291
+ if (!(ghost instanceof HTMLElement || ghost instanceof SVGElement)) {
292
+ throw new Error("Copy target must be a styled element.");
293
+ }
294
+ const originals = [
295
+ source,
296
+ ...source.querySelectorAll("*")
297
+ ];
298
+ const copies = [
299
+ ghost,
300
+ ...ghost.querySelectorAll("*")
301
+ ];
302
+ for (const [
303
+ index,
304
+ copy
305
+ ] of copies.entries()) {
306
+ if (copy instanceof HTMLElement || copy instanceof SVGElement) {
307
+ const computed = getComputedStyle(originals[index]);
308
+ for (const property of computed) {
309
+ copy.style.setProperty(property, computed.getPropertyValue(property));
310
+ }
311
+ }
312
+ }
313
+ for (const node of [
314
+ ghost,
315
+ ...ghost.querySelectorAll("[id], [data-case-target]")
316
+ ]) {
317
+ node.removeAttribute("id");
318
+ node.removeAttribute("data-case-target");
319
+ }
320
+ ghost.classList.add("gridui-case-copy");
321
+ ghost.setAttribute("aria-hidden", "true");
322
+ this.overlay.prepend(ghost);
323
+ target.ghost = ghost;
324
+ }
325
+ const x = origin.x + (target.box.x - origin.x) * progress;
326
+ const y = origin.y + (target.box.y - origin.y) * progress;
327
+ Object.assign(target.ghost.style, {
328
+ left: `${x}px`,
329
+ top: `${y}px`,
330
+ width: `${origin.width + (target.box.width - origin.width) * progress}px`,
331
+ height: `${origin.height + (target.box.height - origin.height) * progress}px`
332
+ });
333
+ target.element.style.opacity = "0";
334
+ return {
335
+ x: x + 16,
336
+ y: y + 16
337
+ };
338
+ }
339
+ draw(target, progress) {
340
+ const { element, box, step } = target;
341
+ element.style.opacity = "1";
342
+ if (step.kind === "copy") {
343
+ return this.copy(target, progress);
344
+ }
345
+ if (step.kind === "text") {
346
+ const count = Math.floor(target.text.length * progress);
347
+ element.style.clipPath = textClip(target.text, count, box);
348
+ return this.anchor(target, progress);
349
+ }
350
+ if (step.kind === "line" && element instanceof SVGPathElement) {
351
+ const length = element.getTotalLength();
352
+ element.style.strokeDasharray = `${length}`;
353
+ element.style.strokeDashoffset = `${length * (1 - progress)}`;
354
+ } else {
355
+ const bottom = step.kind === "box" ? 100 * (1 - progress) : 0;
356
+ element.style.clipPath = `inset(0 ${100 * (1 - progress)}% ${bottom}% 0)`;
357
+ }
358
+ return this.anchor(target, progress);
359
+ }
360
+ render() {
361
+ this.overlay.hidden = false;
362
+ const actors = this.overlay.querySelectorAll(".gridui-case-actor");
363
+ for (const actor of actors) {
364
+ actor.hidden = true;
365
+ }
366
+ this.progress.style.transform = `scaleX(${this.duration ? this.elapsed / this.duration : 1})`;
367
+ for (const target of this.targets) {
368
+ const { step, element, box } = target;
369
+ const progress = (this.elapsed - step.start) / step.duration;
370
+ if (progress >= 1) {
371
+ restore(target);
372
+ target.ghost?.remove();
373
+ target.ghost = null;
374
+ continue;
375
+ }
376
+ element.style.opacity = "0";
377
+ if (progress < 0) {
378
+ continue;
379
+ }
380
+ const actor = actors[step.cursor];
381
+ actor.hidden = false;
382
+ actor.dataset.kind = step.kind;
383
+ const drawing = clamp((progress - 0.18) / 0.82);
384
+ let position = this.anchor(target, 0);
385
+ if (progress >= 0.18) {
386
+ position = this.draw(target, drawing);
387
+ } else {
388
+ const travel = clamp(progress / 0.18);
389
+ const ease = travel * travel * (3 - 2 * travel);
390
+ const previous = this.targets.filter((item) => {
391
+ return item.step.cursor === step.cursor && item.step.start < step.start;
392
+ }).at(-1);
393
+ const origin = previous ? this.anchor(previous, 1) : {
394
+ x: 24 + step.cursor * 36,
395
+ y: 24
396
+ };
397
+ position = {
398
+ x: origin.x + (position.x - origin.x) * ease,
399
+ y: origin.y + (position.y - origin.y) * ease
400
+ };
401
+ }
402
+ const cursor = actor.querySelector(".gridui-case-cursor");
403
+ cursor.style.transform = `translate(${position.x}px, ${position.y}px)`;
404
+ const outline = actor.querySelector(".gridui-case-outline");
405
+ outline.hidden = step.kind !== "box" || progress < 0.18;
406
+ Object.assign(outline.style, {
407
+ left: `${box.x}px`,
408
+ top: `${box.y}px`,
409
+ width: `${box.width * drawing}px`,
410
+ height: `${box.height * drawing}px`
411
+ });
412
+ outline.querySelector("span").textContent = `${Math.round(box.width * drawing)} \xD7 ${Math.round(box.height * drawing)}`;
413
+ }
414
+ }
415
+ };
416
+
417
+ // src/case-showcase/case-showcase.tsx
418
+ import { Button } from "@gridui/button";
419
+ import { cn } from "@gridui/style-utils";
420
+ import { Pause, Play, RotateCcw, SkipForward } from "lucide-react";
421
+ import { useEffect, useRef, useState } from "react";
422
+ import { jsx, jsxs } from "react/jsx-runtime";
423
+ var CaseShowcase = (props) => {
424
+ const { title, children, steps, labels, className = "" } = props;
425
+ const stage = useRef(null);
426
+ const overlay = useRef(null);
427
+ const progress = useRef(null);
428
+ const playback = useRef(null);
429
+ const [
430
+ state,
431
+ setState
432
+ ] = useState("ready");
433
+ const [
434
+ hydrated,
435
+ setHydrated
436
+ ] = useState(false);
437
+ const [
438
+ reducedMotion,
439
+ setReducedMotion
440
+ ] = useState(false);
441
+ useEffect(() => {
442
+ const content = stage.current;
443
+ const player = new CasePlayback(content, overlay.current, progress.current, steps, setState);
444
+ playback.current = player;
445
+ setState("ready");
446
+ setHydrated(true);
447
+ const preference = window.matchMedia("(prefers-reduced-motion: reduce)");
448
+ const updatePreference = () => {
449
+ setReducedMotion(preference.matches);
450
+ if (preference.matches) {
451
+ player.finish();
452
+ }
453
+ };
454
+ updatePreference();
455
+ preference.addEventListener("change", updatePreference);
456
+ const resize = new ResizeObserver(player.refresh);
457
+ resize.observe(content);
458
+ const intersection = new IntersectionObserver(([entry]) => {
459
+ if (entry && !entry.isIntersecting) {
460
+ player.pause();
461
+ }
462
+ });
463
+ intersection.observe(content);
464
+ const visibility = () => {
465
+ if (document.hidden) {
466
+ player.pause();
467
+ }
468
+ };
469
+ document.addEventListener("visibilitychange", visibility);
470
+ document.fonts.addEventListener("loadingdone", player.refresh);
471
+ content.addEventListener("load", player.refresh, true);
472
+ return () => {
473
+ player.destroy();
474
+ playback.current = null;
475
+ resize.disconnect();
476
+ intersection.disconnect();
477
+ preference.removeEventListener("change", updatePreference);
478
+ document.removeEventListener("visibilitychange", visibility);
479
+ document.fonts.removeEventListener("loadingdone", player.refresh);
480
+ content.removeEventListener("load", player.refresh, true);
481
+ };
482
+ }, [steps]);
483
+ let action = labels.play;
484
+ let ActionIcon = Play;
485
+ if (state === "playing") {
486
+ action = labels.pause;
487
+ ActionIcon = Pause;
488
+ } else if (state === "paused") {
489
+ action = labels.resume;
490
+ } else if (state === "complete") {
491
+ action = labels.replay;
492
+ ActionIcon = RotateCcw;
493
+ }
494
+ const active = state === "playing" || state === "paused";
495
+ const toggle = () => {
496
+ if (state === "playing") {
497
+ playback.current?.pause();
498
+ } else {
499
+ playback.current?.play();
500
+ }
501
+ };
502
+ return /* @__PURE__ */ jsxs(
503
+ "section",
504
+ {
505
+ className: cn("gridui-case-showcase", className),
506
+ "aria-label": title,
507
+ "data-state": state,
508
+ children: [
509
+ /* @__PURE__ */ jsxs(
510
+ "div",
511
+ {
512
+ className: "gridui-case-heading",
513
+ children: [
514
+ /* @__PURE__ */ jsx("span", { children: title }),
515
+ /* @__PURE__ */ jsxs(
516
+ "span",
517
+ {
518
+ className: "gridui-case-status",
519
+ role: "status",
520
+ children: [
521
+ /* @__PURE__ */ jsx(
522
+ "i",
523
+ {
524
+ "aria-hidden": "true"
525
+ }
526
+ ),
527
+ reducedMotion ? labels.reducedMotion : labels[state]
528
+ ]
529
+ }
530
+ )
531
+ ]
532
+ }
533
+ ),
534
+ /* @__PURE__ */ jsxs(
535
+ "div",
536
+ {
537
+ className: "gridui-case-controls",
538
+ children: [
539
+ /* @__PURE__ */ jsxs(
540
+ Button,
541
+ {
542
+ type: "button",
543
+ variant: "secondary",
544
+ size: "small",
545
+ disabled: !hydrated || reducedMotion || steps.length === 0,
546
+ onClick: toggle,
547
+ children: [
548
+ /* @__PURE__ */ jsx(
549
+ ActionIcon,
550
+ {
551
+ "aria-hidden": "true"
552
+ }
553
+ ),
554
+ action
555
+ ]
556
+ }
557
+ ),
558
+ /* @__PURE__ */ jsxs(
559
+ Button,
560
+ {
561
+ type: "button",
562
+ variant: "quiet",
563
+ size: "small",
564
+ disabled: !hydrated || !active,
565
+ onClick: () => {
566
+ return playback.current?.finish();
567
+ },
568
+ children: [
569
+ /* @__PURE__ */ jsx(
570
+ SkipForward,
571
+ {
572
+ "aria-hidden": "true"
573
+ }
574
+ ),
575
+ labels.finish
576
+ ]
577
+ }
578
+ )
579
+ ]
580
+ }
581
+ ),
582
+ /* @__PURE__ */ jsxs(
583
+ "div",
584
+ {
585
+ className: "gridui-case-viewport",
586
+ children: [
587
+ /* @__PURE__ */ jsx(
588
+ "div",
589
+ {
590
+ ref: stage,
591
+ className: "gridui-case-stage",
592
+ inert: active,
593
+ children
594
+ }
595
+ ),
596
+ /* @__PURE__ */ jsx(
597
+ "div",
598
+ {
599
+ ref: overlay,
600
+ className: "gridui-case-overlay",
601
+ "aria-hidden": "true",
602
+ inert: true,
603
+ hidden: true,
604
+ children: [
605
+ 0,
606
+ 1,
607
+ 2
608
+ ].map((cursor) => {
609
+ return /* @__PURE__ */ jsxs(
610
+ "div",
611
+ {
612
+ className: "gridui-case-actor",
613
+ "data-cursor": cursor,
614
+ hidden: true,
615
+ children: [
616
+ /* @__PURE__ */ jsx(
617
+ "div",
618
+ {
619
+ className: "gridui-case-outline",
620
+ hidden: true,
621
+ children: /* @__PURE__ */ jsx("span", {})
622
+ }
623
+ ),
624
+ /* @__PURE__ */ jsxs(
625
+ "div",
626
+ {
627
+ className: "gridui-case-cursor",
628
+ children: [
629
+ /* @__PURE__ */ jsx(
630
+ "svg",
631
+ {
632
+ className: "gridui-case-arrow",
633
+ width: "24",
634
+ height: "30",
635
+ viewBox: "0 0 24 30",
636
+ children: /* @__PURE__ */ jsx(
637
+ "path",
638
+ {
639
+ d: "M1 1 21 15 12 17 8 26Z",
640
+ fill: "currentColor",
641
+ stroke: "white",
642
+ strokeWidth: "1.5",
643
+ strokeLinejoin: "round"
644
+ }
645
+ )
646
+ }
647
+ ),
648
+ /* @__PURE__ */ jsxs(
649
+ "svg",
650
+ {
651
+ className: "gridui-case-cross",
652
+ width: "24",
653
+ height: "24",
654
+ viewBox: "-12 -12 24 24",
655
+ children: [
656
+ /* @__PURE__ */ jsx(
657
+ "path",
658
+ {
659
+ d: "M-10 0H10M0-10V10",
660
+ stroke: "white",
661
+ strokeWidth: "4"
662
+ }
663
+ ),
664
+ /* @__PURE__ */ jsx(
665
+ "path",
666
+ {
667
+ d: "M-10 0H10M0-10V10",
668
+ stroke: "currentColor",
669
+ strokeWidth: "2"
670
+ }
671
+ )
672
+ ]
673
+ }
674
+ ),
675
+ /* @__PURE__ */ jsx(
676
+ "span",
677
+ {
678
+ className: "gridui-case-caret"
679
+ }
680
+ ),
681
+ /* @__PURE__ */ jsx(
682
+ "span",
683
+ {
684
+ className: "gridui-case-cursor-label",
685
+ children: String(cursor + 1).padStart(2, "0")
686
+ }
687
+ )
688
+ ]
689
+ }
690
+ )
691
+ ]
692
+ },
693
+ cursor
694
+ );
695
+ })
696
+ }
697
+ )
698
+ ]
699
+ }
700
+ ),
701
+ /* @__PURE__ */ jsx(
702
+ "div",
703
+ {
704
+ className: "gridui-case-progress",
705
+ "aria-hidden": "true",
706
+ children: /* @__PURE__ */ jsx(
707
+ "div",
708
+ {
709
+ ref: progress
710
+ }
711
+ )
712
+ }
713
+ )
714
+ ]
715
+ }
716
+ );
717
+ };
718
+ export {
719
+ CaseShowcase
720
+ };
721
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/case-showcase/geometry.ts", "../src/case-showcase/playback.ts", "../src/case-showcase/case-showcase.tsx"],
4
+ "sourcesContent": ["/**\n * @author WMXPY\n * @package CaseShowcase\n * @namespace CaseShowcase\n * @description Geometry\n */\n\nexport type CaseBox = {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n};\n\nexport const measureBox = (element: Element, stage: HTMLElement): CaseBox => {\n const origin = stage.getBoundingClientRect();\n const rect = element.getBoundingClientRect();\n const scaleX = origin.width / (stage.offsetWidth || 1);\n const scaleY = origin.height / (stage.offsetHeight || 1);\n return {\n x: (rect.left - origin.left) / scaleX,\n y: (rect.top - origin.top) / scaleY,\n width: rect.width / scaleX,\n height: rect.height / scaleY,\n };\n};\n\n// Measure complete graphemes in the final layout so typing never changes wrapping.\nexport const measureText = (element: Element, stage: HTMLElement): readonly CaseBox[][] => {\n const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);\n const nodes: {\n node: Text;\n start: number;\n end: number;\n }[] = [];\n let text = \"\";\n let node = walker.nextNode();\n while (node) {\n if (node instanceof Text) {\n nodes.push({\n node,\n start: text.length,\n end: text.length + node.length,\n });\n text += node.data;\n }\n node = walker.nextNode();\n }\n const origin = stage.getBoundingClientRect();\n const scaleX = origin.width / (stage.offsetWidth || 1);\n const scaleY = origin.height / (stage.offsetHeight || 1);\n const range = document.createRange();\n const segmenter = new Intl.Segmenter(undefined, { granularity: \"grapheme\" });\n return Array.from(segmenter.segment(text), ({ index, segment }) => {\n const start = nodes.find((item) => {\n return item.end > index;\n });\n const end = nodes.find((item) => {\n return item.end >= index + segment.length;\n });\n if (!start || !end) {\n return [];\n }\n range.setStart(start.node, index - start.start);\n range.setEnd(end.node, index + segment.length - end.start);\n return Array.from(range.getClientRects(), (rect) => {\n return {\n x: (rect.left - origin.left) / scaleX,\n y: (rect.top - origin.top) / scaleY,\n width: rect.width / scaleX,\n height: rect.height / scaleY,\n };\n });\n });\n};\n\nexport const textClip = (graphemes: readonly CaseBox[][], count: number, box: CaseBox): string => {\n // Join neighboring glyph bounds into line rectangles, keeping the path small.\n const lines: CaseBox[] = [];\n for (const rect of graphemes.slice(0, count).flat()) {\n const previous = lines.at(-1);\n if (previous && Math.abs(previous.y - rect.y) < 2 && Math.abs(previous.height - rect.height) < 2) {\n const x = Math.min(previous.x, rect.x);\n lines[lines.length - 1] = {\n x,\n y: previous.y,\n width: Math.max(previous.x + previous.width, rect.x + rect.width) - x,\n height: Math.max(previous.height, rect.height),\n };\n } else {\n lines.push(rect);\n }\n }\n const path = lines.map((line) => {\n // A small inset allowance preserves glyph overhangs and antialiasing.\n return `M${line.x - box.x - 1},${line.y - box.y - 1}h${line.width + 2}v${line.height + 2}h${-line.width - 2}Z`;\n }).join(\" \");\n return `path('${path || \"M0,0Z\"}')`;\n};\n", "/**\n * @author WMXPY\n * @package CaseShowcase\n * @namespace CaseShowcase\n * @description Playback\n */\n\nimport type { CaseBox } from \"./geometry\";\nimport { measureBox, measureText, textClip } from \"./geometry\";\nimport type { CasePlaybackState, CaseStep } from \"./types\";\n\ntype Target = {\n readonly step: CaseStep;\n readonly element: HTMLElement | SVGElement;\n readonly original: readonly {\n property: string;\n value: string;\n priority: string;\n }[];\n box: CaseBox;\n text: readonly CaseBox[][];\n source: HTMLElement | SVGElement | null;\n ghost: HTMLElement | SVGElement | null;\n};\n\nconst properties = [\n \"clip-path\",\n \"opacity\",\n \"stroke-dasharray\",\n \"stroke-dashoffset\",\n];\nconst clamp = (value: number): number => {\n return Math.max(0, Math.min(1, value));\n};\nconst restore = (target: Target): void => {\n for (const { property, value, priority } of target.original) {\n if (value) {\n target.element.style.setProperty(property, value, priority);\n } else {\n target.element.style.removeProperty(property);\n }\n }\n};\n\nexport class CasePlayback {\n private readonly targets: Target[];\n private readonly duration: number;\n private elapsed = 0;\n private startedAt = 0;\n private frame = 0;\n private state: CasePlaybackState = \"ready\";\n\n public constructor(\n private readonly stage: HTMLElement,\n private readonly overlay: HTMLElement,\n private readonly progress: HTMLElement,\n steps: readonly CaseStep[],\n private readonly onState: (state: CasePlaybackState) => void,\n ) {\n const elements = new Map<string, HTMLElement | SVGElement>();\n for (const element of stage.querySelectorAll<HTMLElement | SVGElement>(\"[data-case-target]\")) {\n const id = element.dataset.caseTarget!;\n if (elements.has(id)) {\n throw new Error(`Duplicate case target: ${id}`);\n }\n elements.set(id, element);\n }\n const ids = new Set<string>();\n const cursorEnd = [\n 0,\n 0,\n 0,\n ];\n const ordered = [...steps].sort((left, right) => {\n return left.start - right.start;\n });\n this.targets = ordered.map((step) => {\n const element = elements.get(step.target);\n if (!element || ids.has(step.target)) {\n throw new Error(`Case steps require one existing, unique target: ${step.target}`);\n }\n if (!Number.isFinite(step.start) || !Number.isFinite(step.duration) || step.duration <= 0\n || step.start < 0 || step.cursor < 0 || step.cursor > 2 || !Number.isInteger(step.cursor)) {\n throw new Error(`Invalid case timing or cursor: ${step.target}`);\n }\n if (step.start < cursorEnd[step.cursor]!) {\n throw new Error(`Overlapping actions for cursor ${step.cursor}: ${step.target}`);\n }\n cursorEnd[step.cursor] = step.start + step.duration;\n ids.add(step.target);\n let source = null;\n if (step.kind === \"copy\") {\n source = elements.get(step.from) ?? null;\n const sourceStep = ordered.find((item) => {\n return item.target === step.from;\n });\n if (!source || source === element || (sourceStep && sourceStep.start + sourceStep.duration > step.start)) {\n throw new Error(`Copy source must be complete before its copy: ${step.target}`);\n }\n }\n return {\n step,\n element,\n source,\n ghost: null,\n box: measureBox(element, stage),\n text: [],\n original: properties.map((property) => {\n return {\n property,\n value: element.style.getPropertyValue(property),\n priority: element.style.getPropertyPriority(property),\n };\n }),\n };\n });\n for (const target of this.targets) {\n if (this.targets.some((other) => {\n return other !== target && target.element.contains(other.element);\n })) {\n throw new Error(`Animated targets must not contain each other: ${target.step.target}`);\n }\n }\n this.duration = Math.max(0, ...ordered.map((step) => {\n return step.start + step.duration;\n }));\n }\n\n public play(): void {\n if (this.state === \"playing\") {\n return;\n }\n if (this.state !== \"paused\") {\n this.elapsed = 0;\n }\n this.measure();\n this.startedAt = performance.now() - this.elapsed;\n this.setState(\"playing\");\n this.render();\n this.frame = requestAnimationFrame(this.tick);\n }\n\n public pause(): void {\n if (this.state !== \"playing\") {\n return;\n }\n cancelAnimationFrame(this.frame);\n this.elapsed = Math.min(this.duration, performance.now() - this.startedAt);\n this.render();\n this.setState(\"paused\");\n }\n\n public finish(): void {\n cancelAnimationFrame(this.frame);\n this.elapsed = this.duration;\n this.clear();\n this.progress.style.transform = \"scaleX(1)\";\n this.setState(\"complete\");\n }\n\n public destroy(): void {\n cancelAnimationFrame(this.frame);\n this.clear();\n this.progress.style.transform = \"scaleX(0)\";\n }\n\n public refresh = (): void => {\n if (this.state === \"playing\" || this.state === \"paused\") {\n this.measure();\n this.render();\n }\n };\n\n private setState(state: CasePlaybackState): void {\n this.state = state;\n this.onState(state);\n }\n\n private measure(): void {\n for (const target of this.targets) {\n target.box = measureBox(target.element, this.stage);\n if (target.step.kind === \"text\") {\n target.text = measureText(target.element, this.stage);\n }\n }\n }\n\n private tick = (now: number): void => {\n this.elapsed = Math.min(this.duration, now - this.startedAt);\n if (this.elapsed >= this.duration) {\n this.finish();\n return;\n }\n this.render();\n this.frame = requestAnimationFrame(this.tick);\n };\n\n private clear(): void {\n for (const target of this.targets) {\n restore(target);\n target.ghost?.remove();\n target.ghost = null;\n }\n this.overlay.hidden = true;\n }\n\n private anchor(target: Target, progress: number): {\n x: number;\n y: number;\n } {\n const { box, step, element } = target;\n if (step.kind === \"copy\") {\n const source = measureBox(target.source!, this.stage);\n return {\n x: source.x + (box.x - source.x) * progress + 16,\n y: source.y + (box.y - source.y) * progress + 16,\n };\n }\n if (step.kind === \"text\") {\n const count = Math.floor(target.text.length * progress);\n const last = target.text[count - 1]?.at(-1);\n const first = target.text[0]?.[0];\n return {\n x: last ? last.x + last.width : first?.x ?? box.x,\n y: last?.y ?? first?.y ?? box.y,\n };\n }\n if (step.kind === \"line\" && element instanceof SVGPathElement) {\n const point = element.getPointAtLength(element.getTotalLength() * progress);\n const matrix = element.getScreenCTM();\n if (matrix) {\n const screen = new DOMPoint(point.x, point.y).matrixTransform(matrix);\n const origin = this.stage.getBoundingClientRect();\n return {\n x: (screen.x - origin.left) * this.stage.offsetWidth / origin.width,\n y: (screen.y - origin.top) * this.stage.offsetHeight / origin.height,\n };\n }\n }\n const y = step.kind === \"box\" ? box.y + box.height * progress : box.y + box.height / 2;\n return {\n x: box.x + box.width * progress,\n y,\n };\n }\n\n private copy(target: Target, progress: number): {\n x: number;\n y: number;\n } {\n const source = target.source!;\n const origin = measureBox(source, this.stage);\n if (!target.ghost) {\n const ghost = source.cloneNode(true);\n if (!(ghost instanceof HTMLElement || ghost instanceof SVGElement)) {\n throw new Error(\"Copy target must be a styled element.\");\n }\n // Preserve the source's appearance outside its layout and inheritance context.\n const originals = [\n source,\n ...source.querySelectorAll(\"*\"),\n ];\n const copies = [\n ghost,\n ...ghost.querySelectorAll(\"*\"),\n ];\n for (const [\n index,\n copy,\n ] of copies.entries()) {\n if (copy instanceof HTMLElement || copy instanceof SVGElement) {\n const computed = getComputedStyle(originals[index]!);\n for (const property of computed) {\n copy.style.setProperty(property, computed.getPropertyValue(property));\n }\n }\n }\n for (const node of [\n ghost,\n ...ghost.querySelectorAll(\"[id], [data-case-target]\"),\n ]) {\n node.removeAttribute(\"id\");\n node.removeAttribute(\"data-case-target\");\n }\n ghost.classList.add(\"gridui-case-copy\");\n ghost.setAttribute(\"aria-hidden\", \"true\");\n this.overlay.prepend(ghost);\n target.ghost = ghost;\n }\n const x = origin.x + (target.box.x - origin.x) * progress;\n const y = origin.y + (target.box.y - origin.y) * progress;\n Object.assign(target.ghost.style, {\n left: `${x}px`,\n top: `${y}px`,\n width: `${origin.width + (target.box.width - origin.width) * progress}px`,\n height: `${origin.height + (target.box.height - origin.height) * progress}px`,\n });\n target.element.style.opacity = \"0\";\n return {\n x: x + 16,\n y: y + 16,\n };\n }\n\n private draw(target: Target, progress: number): {\n x: number;\n y: number;\n } {\n const { element, box, step } = target;\n element.style.opacity = \"1\";\n if (step.kind === \"copy\") {\n return this.copy(target, progress);\n }\n if (step.kind === \"text\") {\n const count = Math.floor(target.text.length * progress);\n element.style.clipPath = textClip(target.text, count, box);\n return this.anchor(target, progress);\n }\n if (step.kind === \"line\" && element instanceof SVGPathElement) {\n const length = element.getTotalLength();\n element.style.strokeDasharray = `${length}`;\n element.style.strokeDashoffset = `${length * (1 - progress)}`;\n } else {\n const bottom = step.kind === \"box\" ? 100 * (1 - progress) : 0;\n element.style.clipPath = `inset(0 ${100 * (1 - progress)}% ${bottom}% 0)`;\n }\n return this.anchor(target, progress);\n }\n\n private render(): void {\n this.overlay.hidden = false;\n const actors = this.overlay.querySelectorAll<HTMLElement>(\".gridui-case-actor\");\n for (const actor of actors) {\n actor.hidden = true;\n }\n this.progress.style.transform = `scaleX(${this.duration ? this.elapsed / this.duration : 1})`;\n for (const target of this.targets) {\n const { step, element, box } = target;\n const progress = (this.elapsed - step.start) / step.duration;\n if (progress >= 1) {\n restore(target);\n target.ghost?.remove();\n target.ghost = null;\n continue;\n }\n element.style.opacity = \"0\";\n if (progress < 0) {\n continue;\n }\n const actor = actors[step.cursor]!;\n actor.hidden = false;\n actor.dataset.kind = step.kind;\n const drawing = clamp((progress - 0.18) / 0.82);\n let position = this.anchor(target, 0);\n if (progress >= 0.18) {\n position = this.draw(target, drawing);\n } else {\n const travel = clamp(progress / 0.18);\n const ease = travel * travel * (3 - 2 * travel);\n const previous = this.targets.filter((item) => {\n return item.step.cursor === step.cursor && item.step.start < step.start;\n }).at(-1);\n const origin = previous ? this.anchor(previous, 1) : {\n x: 24 + step.cursor * 36,\n y: 24,\n };\n position = {\n x: origin.x + (position.x - origin.x) * ease,\n y: origin.y + (position.y - origin.y) * ease,\n };\n }\n const cursor = actor.querySelector<HTMLElement>(\".gridui-case-cursor\")!;\n cursor.style.transform = `translate(${position.x}px, ${position.y}px)`;\n const outline = actor.querySelector<HTMLElement>(\".gridui-case-outline\")!;\n outline.hidden = step.kind !== \"box\" || progress < 0.18;\n Object.assign(outline.style, {\n left: `${box.x}px`,\n top: `${box.y}px`,\n width: `${box.width * drawing}px`,\n height: `${box.height * drawing}px`,\n });\n outline.querySelector(\"span\")!.textContent = `${Math.round(box.width * drawing)} \u00D7 ${Math.round(box.height * drawing)}`;\n }\n }\n}\n", "/**\n * @author WMXPY\n * @package CaseShowcase\n * @namespace CaseShowcase\n * @description Case Showcase\n */\n\nimport { CasePlayback } from \"./playback\";\nimport type { CasePlaybackState, CaseShowcaseLabels, CaseStep } from \"./types\";\nimport { Button } from \"@gridui/button\";\nimport { cn } from \"@gridui/style-utils\";\nimport { Pause, Play, RotateCcw, SkipForward } from \"lucide-react\";\nimport type { FC, ReactNode } from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nexport type CaseShowcaseProps = {\n readonly title: string;\n readonly children: ReactNode;\n readonly steps: readonly CaseStep[];\n readonly labels: CaseShowcaseLabels;\n readonly className?: string;\n};\n\nexport const CaseShowcase: FC<CaseShowcaseProps> = (props: CaseShowcaseProps) => {\n const { title, children, steps, labels, className = \"\" } = props;\n const stage = useRef<HTMLDivElement>(null);\n const overlay = useRef<HTMLDivElement>(null);\n const progress = useRef<HTMLDivElement>(null);\n const playback = useRef<CasePlayback | null>(null);\n const [\n state,\n setState,\n ] = useState<CasePlaybackState>(\"ready\");\n const [\n hydrated,\n setHydrated,\n ] = useState(false);\n const [\n reducedMotion,\n setReducedMotion,\n ] = useState(false);\n\n useEffect(() => {\n const content = stage.current!;\n const player = new CasePlayback(content, overlay.current!, progress.current!, steps, setState);\n playback.current = player;\n setState(\"ready\");\n setHydrated(true);\n const preference = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n const updatePreference = (): void => {\n setReducedMotion(preference.matches);\n if (preference.matches) {\n player.finish();\n }\n };\n updatePreference();\n preference.addEventListener(\"change\", updatePreference);\n const resize = new ResizeObserver(player.refresh);\n resize.observe(content);\n const intersection = new IntersectionObserver(([entry]) => {\n if (entry && !entry.isIntersecting) {\n player.pause();\n }\n });\n intersection.observe(content);\n const visibility = (): void => {\n if (document.hidden) {\n player.pause();\n }\n };\n document.addEventListener(\"visibilitychange\", visibility);\n document.fonts.addEventListener(\"loadingdone\", player.refresh);\n content.addEventListener(\"load\", player.refresh, true);\n return () => {\n player.destroy();\n playback.current = null;\n resize.disconnect();\n intersection.disconnect();\n preference.removeEventListener(\"change\", updatePreference);\n document.removeEventListener(\"visibilitychange\", visibility);\n document.fonts.removeEventListener(\"loadingdone\", player.refresh);\n content.removeEventListener(\"load\", player.refresh, true);\n };\n }, [steps]);\n\n let action = labels.play;\n let ActionIcon = Play;\n if (state === \"playing\") {\n action = labels.pause;\n ActionIcon = Pause;\n } else if (state === \"paused\") {\n action = labels.resume;\n } else if (state === \"complete\") {\n action = labels.replay;\n ActionIcon = RotateCcw;\n }\n const active = state === \"playing\" || state === \"paused\";\n const toggle = (): void => {\n if (state === \"playing\") {\n playback.current?.pause();\n } else {\n playback.current?.play();\n }\n };\n\n return (<section\n className={cn(\"gridui-case-showcase\", className)}\n aria-label={title}\n data-state={state}\n >\n <div\n className=\"gridui-case-heading\"\n >\n <span>\n {title}\n </span>\n <span\n className=\"gridui-case-status\"\n role=\"status\"\n >\n <i\n aria-hidden=\"true\"\n />\n {reducedMotion ? labels.reducedMotion : labels[state]}\n </span>\n </div>\n <div\n className=\"gridui-case-controls\"\n >\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"small\"\n disabled={!hydrated || reducedMotion || steps.length === 0}\n onClick={toggle}\n >\n <ActionIcon\n aria-hidden=\"true\"\n />\n {action}\n </Button>\n <Button\n type=\"button\"\n variant=\"quiet\"\n size=\"small\"\n disabled={!hydrated || !active}\n onClick={() => {\n return playback.current?.finish();\n }}\n >\n <SkipForward\n aria-hidden=\"true\"\n />\n {labels.finish}\n </Button>\n </div>\n <div\n className=\"gridui-case-viewport\"\n >\n <div\n ref={stage}\n className=\"gridui-case-stage\"\n inert={active}\n >\n {children}\n </div>\n <div\n ref={overlay}\n className=\"gridui-case-overlay\"\n aria-hidden=\"true\"\n inert\n hidden\n >\n {[\n 0,\n 1,\n 2,\n ].map((cursor) => {\n return (<div\n key={cursor}\n className=\"gridui-case-actor\"\n data-cursor={cursor}\n hidden\n >\n <div\n className=\"gridui-case-outline\"\n hidden\n >\n <span />\n </div>\n <div\n className=\"gridui-case-cursor\"\n >\n <svg\n className=\"gridui-case-arrow\"\n width=\"24\"\n height=\"30\"\n viewBox=\"0 0 24 30\"\n >\n <path\n d=\"M1 1 21 15 12 17 8 26Z\"\n fill=\"currentColor\"\n stroke=\"white\"\n strokeWidth=\"1.5\"\n strokeLinejoin=\"round\"\n />\n </svg>\n <svg\n className=\"gridui-case-cross\"\n width=\"24\"\n height=\"24\"\n viewBox=\"-12 -12 24 24\"\n >\n <path\n d=\"M-10 0H10M0-10V10\"\n stroke=\"white\"\n strokeWidth=\"4\"\n />\n <path\n d=\"M-10 0H10M0-10V10\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n </svg>\n <span\n className=\"gridui-case-caret\"\n />\n <span\n className=\"gridui-case-cursor-label\"\n >\n {String(cursor + 1).padStart(2, \"0\")}\n </span>\n </div>\n </div>);\n })}\n </div>\n </div>\n <div\n className=\"gridui-case-progress\"\n aria-hidden=\"true\"\n >\n <div\n ref={progress}\n />\n </div>\n\n </section>);\n};\n"],
5
+ "mappings": ";AAcO,IAAM,aAAa,CAAC,SAAkB,UAAgC;AACzE,QAAM,SAAS,MAAM,sBAAsB;AAC3C,QAAM,OAAO,QAAQ,sBAAsB;AAC3C,QAAM,SAAS,OAAO,SAAS,MAAM,eAAe;AACpD,QAAM,SAAS,OAAO,UAAU,MAAM,gBAAgB;AACtD,SAAO;AAAA,IACH,IAAI,KAAK,OAAO,OAAO,QAAQ;AAAA,IAC/B,IAAI,KAAK,MAAM,OAAO,OAAO;AAAA,IAC7B,OAAO,KAAK,QAAQ;AAAA,IACpB,QAAQ,KAAK,SAAS;AAAA,EAC1B;AACJ;AAGO,IAAM,cAAc,CAAC,SAAkB,UAA6C;AACvF,QAAM,SAAS,SAAS,iBAAiB,SAAS,WAAW,SAAS;AACtE,QAAM,QAI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AAQ;AAAA,oCAER;AAAA;AAAA,wCAAC;AAAA;AAAA,0CACG,GAAE;AAAA,0CACF,QAAO;AAAA,0CACP,aAAY;AAAA;AAAA,sCAChB;AAAA,sCACA;AAAA,wCAAC;AAAA;AAAA,0CACG,GAAE;AAAA,0CACF,QAAO;AAAA,0CACP,aAAY;AAAA;AAAA,sCAChB;AAAA;AAAA;AAAA,gCACJ;AAAA,gCACA;AAAA,kCAAC;AAAA;AAAA,oCACG,WAAU;AAAA;AAAA,gCACd;AAAA,gCACA;AAAA,kCAAC;AAAA;AAAA,oCACG,WAAU;AAAA,oCAET,iBAAO,SAAS,CAAC,EAAE,SAAS,GAAG,GAAG;AAAA;AAAA,gCACvC;AAAA;AAAA;AAAA,0BACJ;AAAA;AAAA;AAAA,sBArDK;AAAA,oBAsDT;AAAA,kBACJ,CAAC;AAAA;AAAA,cACL;AAAA;AAAA;AAAA,QACJ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACG,WAAU;AAAA,YACV,eAAY;AAAA,YAEZ;AAAA,cAAC;AAAA;AAAA,gBACG,KAAK;AAAA;AAAA,YACT;AAAA;AAAA,QACJ;AAAA;AAAA;AAAA,EAEJ;AACJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,167 @@
1
+ /*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
2
+ @layer theme, base, components, utilities;
3
+ @layer utilities;
4
+ @layer components {
5
+ .gridui-case-showcase {
6
+ --gridui-case-blue: #245fe5;
7
+ --gridui-case-orange: #b65318;
8
+ --gridui-case-violet: #8546d5;
9
+ min-width: 0;
10
+ color: var(--gridui-foreground);
11
+ background: var(--gridui-background);
12
+ border: 1px solid var(--gridui-border);
13
+ isolation: isolate;
14
+ }
15
+ .gridui-case-heading, .gridui-case-controls {
16
+ display: flex;
17
+ align-items: center;
18
+ flex-wrap: wrap;
19
+ gap: 0.75rem;
20
+ padding: 0.875rem 1rem;
21
+ font-size: 0.875rem;
22
+ }
23
+ .gridui-case-heading {
24
+ justify-content: space-between;
25
+ border-bottom: 1px solid var(--gridui-border);
26
+ font-weight: 500;
27
+ }
28
+ .gridui-case-status {
29
+ display: inline-flex;
30
+ align-items: center;
31
+ gap: 0.5rem;
32
+ color: var(--gridui-muted);
33
+ font-size: 0.75rem;
34
+ }
35
+ .gridui-case-status i {
36
+ width: 0.375rem;
37
+ height: 0.375rem;
38
+ border-radius: 50%;
39
+ background: currentcolor;
40
+ }
41
+ .gridui-case-showcase[data-state="playing"] .gridui-case-status {
42
+ color: var(--gridui-link);
43
+ }
44
+ .gridui-case-viewport {
45
+ position: relative;
46
+ overflow: clip;
47
+ }
48
+ .gridui-case-stage {
49
+ position: relative;
50
+ display: flow-root;
51
+ min-width: 0;
52
+ }
53
+ .gridui-case-overlay, .gridui-case-actor {
54
+ position: absolute;
55
+ inset: 0;
56
+ pointer-events: none;
57
+ }
58
+ .gridui-case-overlay {
59
+ z-index: 1;
60
+ }
61
+ .gridui-case-overlay[hidden], .gridui-case-actor[hidden], .gridui-case-outline[hidden] {
62
+ display: none;
63
+ }
64
+ .gridui-case-actor {
65
+ color: var(--gridui-case-blue);
66
+ }
67
+ .gridui-case-actor[data-cursor="1"] {
68
+ color: var(--gridui-case-orange);
69
+ }
70
+ .gridui-case-actor[data-cursor="2"] {
71
+ color: var(--gridui-case-violet);
72
+ }
73
+ .gridui-case-cursor {
74
+ position: absolute;
75
+ top: 0;
76
+ left: 0;
77
+ will-change: transform;
78
+ }
79
+ .gridui-case-cursor svg {
80
+ display: block;
81
+ overflow: visible;
82
+ }
83
+ .gridui-case-cursor-label {
84
+ position: absolute;
85
+ top: 1.4rem;
86
+ left: 0.8rem;
87
+ padding: 0.1rem 0.35rem;
88
+ background: currentcolor;
89
+ font: 500 0.625rem/1.5 var(--gridui-font-mono);
90
+ -webkit-text-fill-color: white;
91
+ }
92
+ .gridui-case-outline {
93
+ position: absolute;
94
+ box-sizing: border-box;
95
+ border: 1px solid currentcolor;
96
+ background: currentcolor;
97
+ @supports (color: color-mix(in lab, red, red)) {
98
+ background: color-mix(in srgb, currentcolor 6%, transparent);
99
+ }
100
+ }
101
+ .gridui-case-outline::before, .gridui-case-outline::after {
102
+ content: "";
103
+ position: absolute;
104
+ width: 0.25rem;
105
+ height: 0.25rem;
106
+ background: white;
107
+ border: 1px solid currentcolor;
108
+ }
109
+ .gridui-case-outline::before {
110
+ left: -0.2rem;
111
+ top: -0.2rem;
112
+ }
113
+ .gridui-case-outline::after {
114
+ right: -0.2rem;
115
+ bottom: -0.2rem;
116
+ }
117
+ .gridui-case-outline > span {
118
+ position: absolute;
119
+ left: 50%;
120
+ bottom: -1.5rem;
121
+ transform: translateX(-50%);
122
+ padding: 0.1rem 0.3rem;
123
+ background: currentcolor;
124
+ white-space: nowrap;
125
+ font: 500 0.625rem/1.5 var(--gridui-font-mono);
126
+ -webkit-text-fill-color: white;
127
+ }
128
+ .gridui-case-cursor .gridui-case-cross, .gridui-case-caret {
129
+ display: none;
130
+ }
131
+ .gridui-case-actor[data-kind="box"] .gridui-case-arrow, .gridui-case-actor[data-kind="text"] .gridui-case-arrow {
132
+ display: none;
133
+ }
134
+ .gridui-case-actor[data-kind="box"] .gridui-case-cross {
135
+ display: block;
136
+ transform: translate(-50%, -50%);
137
+ }
138
+ .gridui-case-actor[data-kind="text"] .gridui-case-caret {
139
+ display: block;
140
+ width: 2px;
141
+ height: 1.1rem;
142
+ background: currentcolor;
143
+ }
144
+ .gridui-case-copy {
145
+ position: absolute !important;
146
+ box-sizing: border-box !important;
147
+ margin: 0 !important;
148
+ pointer-events: none !important;
149
+ outline: 1px solid var(--gridui-case-violet);
150
+ opacity: 0.85;
151
+ }
152
+ .gridui-case-progress {
153
+ height: 2px;
154
+ background: var(--gridui-border);
155
+ }
156
+ .gridui-case-progress > div {
157
+ height: 100%;
158
+ transform: scaleX(0);
159
+ transform-origin: left;
160
+ background: var(--gridui-link);
161
+ }
162
+ @media (prefers-reduced-motion: reduce) {
163
+ .gridui-case-overlay {
164
+ display: none;
165
+ }
166
+ }
167
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "name": "@gridui/case-showcase",
4
+ "version": "1.0.0",
5
+ "category": "landing",
6
+ "description": "GridUI React authored case playback with coordinated cursors",
7
+ "usage": "`@gridui/case-showcase` draws an authored customer case inside an independent React component. The host supplies the final HTML/SVG composition, localized control labels, and a timeline. The package owns three cursors, selection outlines, playback, and cleanup.",
8
+ "documentation": [
9
+ "README.md"
10
+ ],
11
+ "exports": [
12
+ {
13
+ "name": "CasePlaybackState",
14
+ "kind": "type",
15
+ "importPath": "@gridui/case-showcase"
16
+ },
17
+ {
18
+ "name": "CaseShowcase",
19
+ "kind": "component",
20
+ "importPath": "@gridui/case-showcase"
21
+ },
22
+ {
23
+ "name": "CaseShowcaseLabels",
24
+ "kind": "type",
25
+ "importPath": "@gridui/case-showcase"
26
+ },
27
+ {
28
+ "name": "CaseShowcaseProps",
29
+ "kind": "type",
30
+ "importPath": "@gridui/case-showcase"
31
+ },
32
+ {
33
+ "name": "CaseStep",
34
+ "kind": "type",
35
+ "importPath": "@gridui/case-showcase"
36
+ }
37
+ ],
38
+ "styles": [
39
+ "@gridui/theme/styles.css",
40
+ "@gridui/button/styles.css",
41
+ "@gridui/case-showcase/styles.css"
42
+ ],
43
+ "examples": [
44
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-landing/case-showcase/stories/case-showcase.stories.tsx"
45
+ ]
46
+ }
package/package.json CHANGED
@@ -1,6 +1,54 @@
1
1
  {
2
2
  "name": "@gridui/case-showcase",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0",
4
+ "description": "GridUI React authored case playback with coordinated cursors",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "README.md",
10
+ "docs"
11
+ ],
12
+ "sideEffects": [
13
+ "**/*.css"
14
+ ],
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ },
20
+ "./styles.css": "./dist/styles.css"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "peerDependencies": {
26
+ "react": "^19.2.0",
27
+ "react-dom": "^19.2.0"
28
+ },
29
+ "dependencies": {
30
+ "@gridui/button": "^4.0.0",
31
+ "@gridui/style-utils": "^3.0.0",
32
+ "@gridui/theme": "^2.5.3",
33
+ "lucide-react": "1.70.0"
34
+ },
35
+ "devDependencies": {
36
+ "@gridui-internal/configuration": "0.0.0-internal",
37
+ "@jest/globals": "30.5.2",
38
+ "@storybook/react-vite": "10.6.6",
39
+ "@types/jest": "30.0.0",
40
+ "@types/node": "26.6.6",
41
+ "@types/react": "19.3.0",
42
+ "@types/react-dom": "19.3.0",
43
+ "jest": "30.5.2",
44
+ "react": "19.3.1",
45
+ "react-dom": "19.3.1",
46
+ "typescript": "6.0.3"
47
+ },
48
+ "scripts": {
49
+ "build": "node ../../scripts/compilation/package.ts",
50
+ "compile": "tsc --project tsconfig.json",
51
+ "test": "jest",
52
+ "coverage": "jest --coverage"
53
+ }
6
54
  }