@auscera/design-labs 0.0.0-stage → 0.1.1

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 +13 -3
  55. package/scripts/install.mjs +71 -0
  56. package/scripts/update.mjs +155 -0
  57. package/README.md +0 -3
@@ -0,0 +1,63 @@
1
+ import { watch } from "node:fs";
2
+ import { GET as readVersions } from "../route";
3
+ export const dynamic = "force-dynamic";
4
+ export const runtime = "nodejs";
5
+ export async function GET(request: Request) {
6
+ let dispose = () => {};
7
+ const stream = new ReadableStream({
8
+ start(controller) {
9
+ let closed = false;
10
+ let timer: ReturnType<typeof setTimeout>;
11
+ const send = async () => {
12
+ try {
13
+ const data = await (await readVersions()).json();
14
+ if (!closed)
15
+ controller.enqueue(
16
+ new TextEncoder().encode(`data: ${JSON.stringify(data)}\n\n`),
17
+ );
18
+ } catch {
19
+ if (!closed)
20
+ controller.enqueue(
21
+ new TextEncoder().encode("event: retry\ndata: {}\n\n"),
22
+ );
23
+ }
24
+ };
25
+ const watcher = watch(process.cwd(), (_event, name) => {
26
+ if (name === "lab.config.json") {
27
+ clearTimeout(timer);
28
+ timer = setTimeout(send, 150);
29
+ }
30
+ });
31
+ const heartbeat = setInterval(() => {
32
+ if (!closed)
33
+ controller.enqueue(new TextEncoder().encode(": heartbeat\n\n"));
34
+ }, 25000);
35
+ dispose = () => {
36
+ if (closed) return;
37
+ closed = true;
38
+ clearTimeout(timer);
39
+ clearInterval(heartbeat);
40
+ watcher.close();
41
+ request.signal.removeEventListener("abort", dispose);
42
+ try {
43
+ controller.close();
44
+ } catch {
45
+ /* Stream may already be closed by the client. */
46
+ }
47
+ };
48
+ request.signal.addEventListener("abort", dispose);
49
+ void send();
50
+ },
51
+ cancel() {
52
+ dispose();
53
+ },
54
+ });
55
+ return new Response(stream, {
56
+ headers: {
57
+ "Content-Type": "text/event-stream",
58
+ "Cache-Control": "no-cache, no-transform",
59
+ Connection: "keep-alive",
60
+ "X-Accel-Buffering": "no",
61
+ },
62
+ });
63
+ }
@@ -0,0 +1,7 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ export const dynamic = "force-dynamic";
4
+ export async function GET() {
5
+ const config = JSON.parse(await fs.readFile(path.join(process.cwd(), "lab.config.json"), "utf8"));
6
+ return Response.json(config.versions.map((v: Record<string, unknown>) => ({key:v.key,project:v.project,category:v.category,slug:v.slug,label:v.label,summary:v.summary,status:v.status,path:v.path || (v.runtime && v.status === "runnable" ? `http://127.0.0.1:${(v.runtime as {port:number}).port}` : undefined),production:v.production,updatedAt:v.updatedAt,changeTimeKind:v.changeTimeKind})), {headers:{"Cache-Control":"no-store"}});
7
+ }
@@ -0,0 +1,72 @@
1
+ "use client";
2
+ import { useEffect, useRef, type ComponentType, type RefAttributes } from "react";
3
+ import { useReducedMotion } from "framer-motion";
4
+ import { Columns2Icon as OriginalColumns2 } from "@animateicons/react/lucide/columns-2-icon";
5
+ import { Rows2Icon as OriginalRows2 } from "@animateicons/react/lucide/rows-2-icon";
6
+ import { Maximize2Icon as OriginalMaximize2 } from "@animateicons/react/lucide/maximize-2-icon";
7
+ import { Minimize2Icon as OriginalMinimize2 } from "@animateicons/react/lucide/minimize-2-icon";
8
+ import { ExternalLinkIcon as OriginalExternalLink } from "@animateicons/react/lucide/external-link-icon";
9
+ import { SmartphoneIcon as OriginalSmartphone } from "@animateicons/react/lucide/smartphone-icon";
10
+ import { MousePointerIcon as OriginalMousePointer } from "@animateicons/react/lucide/mouse-pointer-icon";
11
+ import { ListIcon as OriginalList } from "@animateicons/react/lucide/list-icon";
12
+ import { DownloadIcon as OriginalDownload } from "@animateicons/react/lucide/download-icon";
13
+ import { CopyIcon as OriginalCopy } from "@animateicons/react/lucide/copy-icon";
14
+ import { Trash2Icon as OriginalTrash2 } from "@animateicons/react/lucide/trash-2-icon";
15
+ import { CheckIcon as OriginalCheck } from "@animateicons/react/lucide/check-icon";
16
+ import { ChevronDownIcon as OriginalChevronDown } from "@animateicons/react/lucide/chevron-down-icon";
17
+ import { LinkIcon as OriginalLink } from "@animateicons/react/lucide/link-icon";
18
+ import { PencilIcon as OriginalPencil } from "@animateicons/react/lucide/pencil-icon";
19
+ import { ArrowUpRightIcon as OriginalArrowUpRight } from "@animateicons/react/lucide/arrow-up-right-icon";
20
+ import { XIcon as OriginalX } from "@animateicons/react/lucide/x-icon";
21
+ import { RotateCwIcon as OriginalRotateCw } from "@animateicons/react/lucide/rotate-cw-icon";
22
+ import { ArrowLeftRightIcon as OriginalArrowLeftRight } from "@animateicons/react/lucide/arrow-left-right-icon";
23
+
24
+ type Handle = { startAnimation: () => void; stopAnimation: () => void };
25
+ type Props = { size?: number; "aria-hidden"?: boolean; className?: string };
26
+ type Icon = ComponentType<Props & { isAnimated?: boolean; style?: React.CSSProperties } & RefAttributes<Handle>>;
27
+ function wrap(Original: Icon) {
28
+ function AnimatedIcon(props: Props) {
29
+ const icon = useRef<Handle>(null);
30
+ const host = useRef<HTMLSpanElement>(null);
31
+ const reduced = useReducedMotion();
32
+ useEffect(() => {
33
+ const control = host.current?.closest("button, a, [role=option]");
34
+ if (!control || reduced) return;
35
+ const start = () => icon.current?.startAnimation();
36
+ const stop = () => icon.current?.stopAnimation();
37
+ control.addEventListener("mouseenter", start);
38
+ control.addEventListener("mouseleave", stop);
39
+ control.addEventListener("focus", start);
40
+ control.addEventListener("blur", stop);
41
+ control.addEventListener("click", start);
42
+ return () => {
43
+ control.removeEventListener("mouseenter", start);
44
+ control.removeEventListener("mouseleave", stop);
45
+ control.removeEventListener("focus", start);
46
+ control.removeEventListener("blur", stop);
47
+ control.removeEventListener("click", start);
48
+ };
49
+ }, [reduced]);
50
+ return <span ref={host} className="animated-icon" aria-hidden="true" style={{display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"none",lineHeight:0}}><Original ref={icon} {...props} isAnimated={false} style={{display:"inline-flex",alignItems:"center",justifyContent:"center"}} /></span>;
51
+ }
52
+ return AnimatedIcon;
53
+ }
54
+ export const Columns2 = wrap(OriginalColumns2);
55
+ export const Rows2 = wrap(OriginalRows2);
56
+ export const Maximize2 = wrap(OriginalMaximize2);
57
+ export const Minimize2 = wrap(OriginalMinimize2);
58
+ export const ExternalLink = wrap(OriginalExternalLink);
59
+ export const Smartphone = wrap(OriginalSmartphone);
60
+ export const MousePointer = wrap(OriginalMousePointer);
61
+ export const List = wrap(OriginalList);
62
+ export const Download = wrap(OriginalDownload);
63
+ export const Copy = wrap(OriginalCopy);
64
+ export const Trash2 = wrap(OriginalTrash2);
65
+ export const Check = wrap(OriginalCheck);
66
+ export const ChevronDown = wrap(OriginalChevronDown);
67
+ export const Link = wrap(OriginalLink);
68
+ export const Pencil = wrap(OriginalPencil);
69
+ export const ArrowUpRight = wrap(OriginalArrowUpRight);
70
+ export const X = wrap(OriginalX);
71
+ export const RotateCw = wrap(OriginalRotateCw);
72
+ export const ArrowLeftRight = wrap(OriginalArrowLeftRight);