@auscera/design-labs 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/apps/workspace/.skills/design-labs/SKILL.md +63 -0
  2. package/apps/workspace/.skills/design-labs/references/commands.md +38 -0
  3. package/apps/workspace/AGENTS.md +9 -0
  4. package/apps/workspace/app/(lab)/compare/page.tsx +2 -0
  5. package/apps/workspace/app/(lab)/lab.css +412 -0
  6. package/apps/workspace/app/(lab)/layout.tsx +21 -0
  7. package/apps/workspace/app/(lab)/page.tsx +2 -0
  8. package/apps/workspace/app/api/annotations/route.ts +94 -0
  9. package/apps/workspace/app/api/versions/events/route.ts +63 -0
  10. package/apps/workspace/app/api/versions/route.ts +7 -0
  11. package/apps/workspace/components/animated-icons.tsx +72 -0
  12. package/apps/workspace/components/dotmatrix-loader.css +1228 -0
  13. package/apps/workspace/components/glass-controls.tsx +47 -0
  14. package/apps/workspace/components/lab-providers.tsx +17 -0
  15. package/apps/workspace/components/molecules/brand-lockup.tsx +13 -0
  16. package/apps/workspace/components/molecules/pane-url-popover.css +92 -0
  17. package/apps/workspace/components/molecules/pane-url-popover.tsx +191 -0
  18. package/apps/workspace/components/pane-preferences.tsx +75 -0
  19. package/apps/workspace/components/pane-viewport.css +34 -0
  20. package/apps/workspace/components/pane-viewport.tsx +199 -0
  21. package/apps/workspace/components/preview-pane.css +293 -0
  22. package/apps/workspace/components/preview-pane.tsx +662 -0
  23. package/apps/workspace/components/ui/dotm-triangle-11.tsx +170 -0
  24. package/apps/workspace/components/ui/dotmatrix-core.tsx +1649 -0
  25. package/apps/workspace/components/ui/dotmatrix-hooks.ts +224 -0
  26. package/apps/workspace/components/version-select.tsx +220 -0
  27. package/apps/workspace/components/workspace.tsx +313 -0
  28. package/apps/workspace/eslint.config.mjs +3 -0
  29. package/apps/workspace/lab.config.json +1 -0
  30. package/apps/workspace/lib/annotation-export.ts +28 -0
  31. package/apps/workspace/lib/annotation-types.ts +38 -0
  32. package/apps/workspace/lib/device-presets.ts +103 -0
  33. package/apps/workspace/lib/use-annotation-bridge.ts +130 -0
  34. package/apps/workspace/lib/version-types.ts +12 -0
  35. package/apps/workspace/lib/website-url.ts +78 -0
  36. package/apps/workspace/next-env.d.ts +6 -0
  37. package/apps/workspace/next.config.mjs +1 -0
  38. package/apps/workspace/package.json +35 -0
  39. package/apps/workspace/public/apple-touch-icon.png +0 -0
  40. package/apps/workspace/public/brand/design-labs-script.LICENSE.txt +93 -0
  41. package/apps/workspace/public/brand/design-labs-script.woff2 +0 -0
  42. package/apps/workspace/public/brand/logo.webp +0 -0
  43. package/apps/workspace/public/brand/wordmark.css +42 -0
  44. package/apps/workspace/public/favicon.ico +0 -0
  45. package/apps/workspace/public/icon-192.png +0 -0
  46. package/apps/workspace/public/icon-512.png +0 -0
  47. package/apps/workspace/public/preview-bridge.js +411 -0
  48. package/apps/workspace/public/site.webmanifest +1 -0
  49. package/apps/workspace/scripts/annotation-store.mjs +308 -0
  50. package/apps/workspace/scripts/lab.mjs +414 -0
  51. package/apps/workspace/scripts/migrate.mjs +2 -0
  52. package/apps/workspace/scripts/prepare-preview.mjs +203 -0
  53. package/apps/workspace/tsconfig.json +24 -0
  54. package/package.json +9 -3
  55. package/scripts/install.mjs +67 -0
  56. package/scripts/update.mjs +204 -0
  57. package/README.md +0 -3
@@ -0,0 +1,170 @@
1
+ "use client";
2
+
3
+ import type { CSSProperties } from "react";
4
+
5
+ import { cx } from "./dotmatrix-core";
6
+ import { resolveDmxColorTokens } from "./dotmatrix-core";
7
+ import { useDotMatrixPhases } from "./dotmatrix-hooks";
8
+ import { styleOpacity, stylePx } from "./dotmatrix-core";
9
+ import { remapOpacityToTriplet } from "./dotmatrix-core";
10
+ import { dmxBloomRootActive, dmxDotBloomParts } from "./dotmatrix-core";
11
+ import { useCyclePhase } from "./dotmatrix-hooks";
12
+ import { usePrefersReducedMotion } from "./dotmatrix-hooks";
13
+ import type { DotMatrixCommonProps } from "./dotmatrix-core";
14
+
15
+ export type DotmTriangle11Props = DotMatrixCommonProps;
16
+
17
+ const MATRIX_SIZE = 7;
18
+
19
+ const BASE_OPACITY = 0.13;
20
+ const MID_OPACITY = 0.36;
21
+ const HIGH_OPACITY = 0.96;
22
+
23
+ const TRIANGLE_CELLS = new Set([
24
+ "1,3",
25
+ "2,2",
26
+ "2,4",
27
+ "3,1",
28
+ "3,3",
29
+ "3,5",
30
+ "4,0",
31
+ "4,2",
32
+ "4,4",
33
+ "4,6"
34
+ ]);
35
+
36
+ const APEX_ROW = 1;
37
+ const APEX_COL = 3;
38
+
39
+ function isWithinTriangleMask(row: number, col: number): boolean {
40
+ if (row < 0 || row >= MATRIX_SIZE || col < 0 || col >= MATRIX_SIZE) {
41
+ return false;
42
+ }
43
+
44
+ return TRIANGLE_CELLS.has(`${row},${col}`);
45
+ }
46
+
47
+ function manhattanFromApex(row: number, col: number): number {
48
+ return Math.abs(row - APEX_ROW) + Math.abs(col - APEX_COL);
49
+ }
50
+
51
+ function smoothstep01(edge0: number, edge1: number, x: number): number {
52
+ if (edge1 <= edge0) {
53
+ return x >= edge1 ? 1 : 0;
54
+ }
55
+ const t = Math.max(0, Math.min(1, (x - edge0) / (edge1 - edge0)));
56
+ return t * t * (3 - 2 * t);
57
+ }
58
+
59
+ /**
60
+ * Bright bands move down the triangle by tier: phase keys on Manhattan distance from the apex,
61
+ * not the heart cell — reads as stacked horizontal “shelves” lighting in sequence.
62
+ */
63
+ function opacityForCell(row: number, col: number, phase: number): number {
64
+ const tier = manhattanFromApex(row, col);
65
+ const maxTier = 6;
66
+ const t = phase * Math.PI * 2;
67
+ const u = (tier / maxTier) * Math.PI * 2 - t;
68
+ const wave = 0.5 + 0.5 * Math.cos(u);
69
+ const crest = smoothstep01(0.28, 0.98, wave);
70
+ let opacity = BASE_OPACITY + crest * (HIGH_OPACITY - BASE_OPACITY);
71
+
72
+ if (row === 3 && col === 3) {
73
+ opacity = Math.max(opacity, MID_OPACITY + crest * 0.35);
74
+ }
75
+
76
+ return Math.min(HIGH_OPACITY, opacity);
77
+ }
78
+
79
+ export function DotmTriangle11({
80
+ size = 30,
81
+ dotSize = 6.5,
82
+ color = "currentColor",
83
+ colorPreset,
84
+ ariaLabel = "Loading",
85
+ className,
86
+ muted = false,
87
+ bloom = false,
88
+ halo = 0,
89
+ dotClassName,
90
+ dotShape = "circle",
91
+ speed = 1.75,
92
+ animated = true,
93
+ hoverAnimated = false,
94
+ cellPadding,
95
+ opacityBase,
96
+ opacityMid,
97
+ opacityPeak
98
+ }: DotmTriangle11Props) {
99
+ const reducedMotion = usePrefersReducedMotion();
100
+ const { phase: matrixPhase, onMouseEnter, onMouseLeave } = useDotMatrixPhases({
101
+ animated: Boolean(animated && !reducedMotion),
102
+ hoverAnimated: Boolean(hoverAnimated && !reducedMotion),
103
+ speed
104
+ });
105
+ const cycleActive = !reducedMotion && matrixPhase !== "idle";
106
+ const cyclePhase = useCyclePhase({
107
+ active: cycleActive,
108
+ cycleMsBase: 1400,
109
+ speed
110
+ });
111
+
112
+ const gap =
113
+ cellPadding ?? Math.max(1, Math.floor((size - dotSize * MATRIX_SIZE) / (MATRIX_SIZE - 1)));
114
+ const matrixSize = dotSize * MATRIX_SIZE + gap * (MATRIX_SIZE - 1);
115
+ const { resolvedColor, dotFill } = resolveDmxColorTokens(color, colorPreset);
116
+ const rootStyle = {
117
+ width: stylePx(cellPadding == null ? size : matrixSize),
118
+ height: stylePx(cellPadding == null ? size : matrixSize),
119
+ ["--dmx-dot-size" as const]: `${dotSize}px`,
120
+ ["--dmx-halo-level" as const]: halo,
121
+ ["--dmx-dot-fill" as const]: dotFill,
122
+ color: resolvedColor
123
+ } as CSSProperties;
124
+
125
+ return (
126
+ <div
127
+ role="status"
128
+ aria-live="polite"
129
+ aria-label={ariaLabel}
130
+ className={cx("dmx-root", `dmx-dot-shape-${dotShape}`, muted && "dmx-muted", dmxBloomRootActive(bloom, halo) && "dmx-bloom", className)}
131
+ style={rootStyle}
132
+ onMouseEnter={onMouseEnter}
133
+ onMouseLeave={onMouseLeave}
134
+ >
135
+ <div
136
+ className="dmx-grid"
137
+ style={{
138
+ gap,
139
+ gridTemplateColumns: `repeat(${MATRIX_SIZE}, minmax(0, 1fr))`,
140
+ gridTemplateRows: `repeat(${MATRIX_SIZE}, minmax(0, 1fr))`
141
+ }}
142
+ >
143
+ {Array.from({ length: MATRIX_SIZE * MATRIX_SIZE }).map((_, index) => {
144
+ const row = Math.floor(index / MATRIX_SIZE);
145
+ const col = index % MATRIX_SIZE;
146
+ const isActive = isWithinTriangleMask(row, col);
147
+
148
+ const phase = reducedMotion || matrixPhase === "idle" ? 0.18 : cyclePhase;
149
+ const opacity = isActive ? opacityForCell(row, col, phase) : 0;
150
+
151
+ const dmxBloom = dmxDotBloomParts(isActive, opacity, bloom, halo, opacityBase, opacityMid, opacityPeak);
152
+
153
+ return (
154
+ <span
155
+ key={index}
156
+ aria-hidden="true"
157
+ className={cx("dmx-dot", !isActive && "dmx-inactive", dmxBloom.bloomDot && "dmx-bloom-dot", dotClassName)}
158
+ style={{
159
+ width: stylePx(dotSize),
160
+ height: stylePx(dotSize),
161
+ opacity: styleOpacity(remapOpacityToTriplet(opacity, opacityBase, opacityMid, opacityPeak)),
162
+ ["--dmx-bloom-level" as const]: dmxBloom.level
163
+ } as CSSProperties}
164
+ />
165
+ );
166
+ })}
167
+ </div>
168
+ </div>
169
+ );
170
+ }