@ggui-ai/ui-gen 0.28.0 → 0.29.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/dist/{adapter-h4_V69LI.d.ts → adapter-DLQ-5COm.d.ts} +1 -1
- package/dist/adapters/base.js +2 -27
- package/dist/adapters/base.js.map +1 -1
- package/dist/adapters/generation-dispatch.d.ts +14 -6
- package/dist/adapters/generation-dispatch.js +40 -19260
- package/dist/adapters/generation-dispatch.js.map +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js +25 -3561
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/types.js +2 -9
- package/dist/adapters/types.js.map +1 -1
- package/dist/advanced/index.d.ts +13 -12
- package/dist/advanced/index.js +63 -21954
- package/dist/advanced/index.js.map +1 -1
- package/dist/{bank-Ctdp3FUA.d.ts → bank-LWaiAtaA.d.ts} +1 -1
- package/dist/blueprint-validator.js +6 -2301
- package/dist/blueprint-validator.js.map +1 -1
- package/dist/boilerplate.d.ts +3 -2
- package/dist/boilerplate.js +6 -1867
- package/dist/boilerplate.js.map +1 -1
- package/dist/check/index.d.ts +3 -2
- package/dist/check/index.js +6 -1923
- package/dist/check/index.js.map +1 -1
- package/dist/chunk-33B3BAWS.js +24 -0
- package/dist/chunk-33B3BAWS.js.map +1 -0
- package/dist/chunk-3HSGA6NI.js +591 -0
- package/dist/chunk-3HSGA6NI.js.map +1 -0
- package/dist/chunk-3NNNGNTO.js +1707 -0
- package/dist/chunk-3NNNGNTO.js.map +1 -0
- package/dist/chunk-3T2HMTON.js +79 -0
- package/dist/chunk-3T2HMTON.js.map +1 -0
- package/dist/chunk-3ZSSDV3L.js +123 -0
- package/dist/chunk-3ZSSDV3L.js.map +1 -0
- package/dist/chunk-4MBR5GA3.js +99 -0
- package/dist/chunk-4MBR5GA3.js.map +1 -0
- package/dist/chunk-56NJFD55.js +337 -0
- package/dist/chunk-56NJFD55.js.map +1 -0
- package/dist/chunk-5AGTY555.js +26 -0
- package/dist/chunk-5AGTY555.js.map +1 -0
- package/dist/chunk-5EJM7EGY.js +115 -0
- package/dist/chunk-5EJM7EGY.js.map +1 -0
- package/dist/chunk-5KXCQLLR.js +529 -0
- package/dist/chunk-5KXCQLLR.js.map +1 -0
- package/dist/chunk-5VBXHVEH.js +171 -0
- package/dist/chunk-5VBXHVEH.js.map +1 -0
- package/dist/chunk-6KDDEING.js +515 -0
- package/dist/chunk-6KDDEING.js.map +1 -0
- package/dist/chunk-6VDRWAP6.js +123 -0
- package/dist/chunk-6VDRWAP6.js.map +1 -0
- package/dist/chunk-732IBFEJ.js +2400 -0
- package/dist/chunk-732IBFEJ.js.map +1 -0
- package/dist/chunk-73AURS3I.js +46 -0
- package/dist/chunk-73AURS3I.js.map +1 -0
- package/dist/chunk-77H5SKLX.js +8 -0
- package/dist/chunk-77H5SKLX.js.map +1 -0
- package/dist/chunk-7QE3AHLE.js +35 -0
- package/dist/chunk-7QE3AHLE.js.map +1 -0
- package/dist/chunk-A375NNWN.js +11 -0
- package/dist/chunk-A375NNWN.js.map +1 -0
- package/dist/chunk-AOU33EFS.js +140 -0
- package/dist/chunk-AOU33EFS.js.map +1 -0
- package/dist/chunk-BA4QYA6E.js +461 -0
- package/dist/chunk-BA4QYA6E.js.map +1 -0
- package/dist/chunk-DBP764GL.js +3 -0
- package/dist/chunk-DBP764GL.js.map +1 -0
- package/dist/chunk-DUU3ZJDQ.js +41 -0
- package/dist/chunk-DUU3ZJDQ.js.map +1 -0
- package/dist/chunk-DXKRBXNU.js +30 -0
- package/dist/chunk-DXKRBXNU.js.map +1 -0
- package/dist/chunk-FB7OEEAH.js +1467 -0
- package/dist/chunk-FB7OEEAH.js.map +1 -0
- package/dist/chunk-FLRNMZV2.js +18 -0
- package/dist/chunk-FLRNMZV2.js.map +1 -0
- package/dist/chunk-FWJIMKFZ.js +2032 -0
- package/dist/chunk-FWJIMKFZ.js.map +1 -0
- package/dist/chunk-FXRHWYIQ.js +163 -0
- package/dist/chunk-FXRHWYIQ.js.map +1 -0
- package/dist/chunk-G3PMV62Z.js +33 -0
- package/dist/chunk-G3PMV62Z.js.map +1 -0
- package/dist/chunk-GAJI7Y3P.js +13 -0
- package/dist/chunk-GAJI7Y3P.js.map +1 -0
- package/dist/chunk-GYINWMPR.js +2052 -0
- package/dist/chunk-GYINWMPR.js.map +1 -0
- package/dist/chunk-HD6ABIK7.js +484 -0
- package/dist/chunk-HD6ABIK7.js.map +1 -0
- package/dist/chunk-HDQVHYO6.js +100 -0
- package/dist/chunk-HDQVHYO6.js.map +1 -0
- package/dist/chunk-IHUT3SIW.js +7 -0
- package/dist/chunk-IHUT3SIW.js.map +1 -0
- package/dist/chunk-JDH5EGNZ.js +126 -0
- package/dist/chunk-JDH5EGNZ.js.map +1 -0
- package/dist/chunk-JMD4RGSV.js +37 -0
- package/dist/chunk-JMD4RGSV.js.map +1 -0
- package/dist/chunk-KJWGZL5B.js +33 -0
- package/dist/chunk-KJWGZL5B.js.map +1 -0
- package/dist/chunk-MKMDQFZ7.js +86 -0
- package/dist/chunk-MKMDQFZ7.js.map +1 -0
- package/dist/chunk-NF6JUZWF.js +85 -0
- package/dist/chunk-NF6JUZWF.js.map +1 -0
- package/dist/chunk-O2YC6XDC.js +1933 -0
- package/dist/chunk-O2YC6XDC.js.map +1 -0
- package/dist/chunk-OVLH5ICV.js +29 -0
- package/dist/chunk-OVLH5ICV.js.map +1 -0
- package/dist/chunk-PBOYHGSD.js +106 -0
- package/dist/chunk-PBOYHGSD.js.map +1 -0
- package/dist/chunk-PJFH7QWA.js +81 -0
- package/dist/chunk-PJFH7QWA.js.map +1 -0
- package/dist/chunk-PUH4CXGZ.js +284 -0
- package/dist/chunk-PUH4CXGZ.js.map +1 -0
- package/dist/chunk-QLXXPGTV.js +18 -0
- package/dist/chunk-QLXXPGTV.js.map +1 -0
- package/dist/chunk-R5GIGPW2.js +2845 -0
- package/dist/chunk-R5GIGPW2.js.map +1 -0
- package/dist/chunk-RH4IUSTO.js +83 -0
- package/dist/chunk-RH4IUSTO.js.map +1 -0
- package/dist/chunk-S2GVXKKY.js +153 -0
- package/dist/chunk-S2GVXKKY.js.map +1 -0
- package/dist/chunk-TVHGKFJS.js +58 -0
- package/dist/chunk-TVHGKFJS.js.map +1 -0
- package/dist/chunk-U7GALWLG.js +66 -0
- package/dist/chunk-U7GALWLG.js.map +1 -0
- package/dist/chunk-VTC263LT.js +256 -0
- package/dist/chunk-VTC263LT.js.map +1 -0
- package/dist/chunk-WEOXFEVE.js +739 -0
- package/dist/chunk-WEOXFEVE.js.map +1 -0
- package/dist/chunk-WYHP46LT.js +28 -0
- package/dist/chunk-WYHP46LT.js.map +1 -0
- package/dist/chunk-XGLO5LGG.js +274 -0
- package/dist/chunk-XGLO5LGG.js.map +1 -0
- package/dist/chunk-XRBCRKA2.js +29 -0
- package/dist/chunk-XRBCRKA2.js.map +1 -0
- package/dist/chunk-XW7ADFFV.js +340 -0
- package/dist/chunk-XW7ADFFV.js.map +1 -0
- package/dist/chunk-YIQ42IUX.js +34 -0
- package/dist/chunk-YIQ42IUX.js.map +1 -0
- package/dist/chunk-YJZTUY7B.js +101 -0
- package/dist/chunk-YJZTUY7B.js.map +1 -0
- package/dist/chunk-Z3CXME3K.js +107 -0
- package/dist/chunk-Z3CXME3K.js.map +1 -0
- package/dist/classifier/index.js +2 -527
- package/dist/classifier/index.js.map +1 -1
- package/dist/client-JBPCXU7W.js +4 -0
- package/dist/client-JBPCXU7W.js.map +1 -0
- package/dist/compose.js +3 -367
- package/dist/compose.js.map +1 -1
- package/dist/cost-tracker-HHGQ4FTW.js +67 -0
- package/dist/cost-tracker-HHGQ4FTW.js.map +1 -0
- package/dist/{create-ui-generator-BrZHF0cf.d.ts → create-ui-generator-BY-WeaPi.d.ts} +3 -3
- package/dist/{design-mode-DGWN_Gkm.d.ts → design-mode-XyOQmzE0.d.ts} +4 -3
- package/dist/{dispatch-B07TI30d.d.ts → dispatch-8LzTddKw.d.ts} +3 -2
- package/dist/dist-UALN6ZVB.js +543 -0
- package/dist/dist-UALN6ZVB.js.map +1 -0
- package/dist/dupe-break-X6K7QFIS.js +4 -0
- package/dist/dupe-break-X6K7QFIS.js.map +1 -0
- package/dist/evaluation/axis-checks/index.d.ts +5 -4
- package/dist/evaluation/axis-checks/index.js +6 -1914
- package/dist/evaluation/axis-checks/index.js.map +1 -1
- package/dist/evaluation/axis-checks/registry.d.ts +3 -2
- package/dist/evaluation/axis-checks/registry.js +3 -1844
- package/dist/evaluation/axis-checks/registry.js.map +1 -1
- package/dist/evaluation/index.d.ts +49 -132
- package/dist/evaluation/index.js +302 -6466
- package/dist/evaluation/index.js.map +1 -1
- package/dist/evaluation/types.d.ts +3 -2
- package/dist/evaluation/types.js +2 -5
- package/dist/evaluation/types.js.map +1 -1
- package/dist/fragments/index.js +2 -338
- package/dist/fragments/index.js.map +1 -1
- package/dist/{generate-tSO_shQ0.d.ts → generate-DQ4ci90s.d.ts} +1 -1
- package/dist/harness/check/runtime-render/index.d.ts +35 -15
- package/dist/harness/check/runtime-render/index.js +6 -2390
- package/dist/harness/check/runtime-render/index.js.map +1 -1
- package/dist/harness/check/runtime-render/render-check-worker.js +4 -1739
- package/dist/harness/check/runtime-render/render-check-worker.js.map +1 -1
- package/dist/harness/index.d.ts +3 -2
- package/dist/harness/index.js +23 -5126
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/llm-trace-sink.js +2 -24
- package/dist/harness/llm-trace-sink.js.map +1 -1
- package/dist/harness/prompts.d.ts +2 -2
- package/dist/harness/prompts.js +8 -324
- package/dist/harness/prompts.js.map +1 -1
- package/dist/harness/result-types.d.ts +6 -5
- package/dist/harness/result-types.js +2 -0
- package/dist/harness/result-types.js.map +1 -1
- package/dist/harness/runtime.d.ts +22 -5
- package/dist/harness/runtime.js +10 -2313
- package/dist/harness/runtime.js.map +1 -1
- package/dist/harness/types-public.d.ts +3 -2
- package/dist/harness/types-public.js +16 -2954
- package/dist/harness/types-public.js.map +1 -1
- package/dist/harness/validator-trace-sink.d.ts +3 -2
- package/dist/harness/validator-trace-sink.js +2 -26
- package/dist/harness/validator-trace-sink.js.map +1 -1
- package/dist/hash.js +2 -39
- package/dist/hash.js.map +1 -1
- package/dist/hashline-5OKREIRM.js +4 -0
- package/dist/hashline-5OKREIRM.js.map +1 -0
- package/dist/index.d.ts +50 -11
- package/dist/index.js +57 -22015
- package/dist/index.js.map +1 -1
- package/dist/llm-evaluator-PN3WFCS4.js +653 -0
- package/dist/llm-evaluator-PN3WFCS4.js.map +1 -0
- package/dist/magic-string.es-2NZTC4GZ.js +1307 -0
- package/dist/magic-string.es-2NZTC4GZ.js.map +1 -0
- package/dist/patch.d.ts +3 -2
- package/dist/patch.js +2 -56
- package/dist/patch.js.map +1 -1
- package/dist/policy-VCYKGSAC.js +5 -0
- package/dist/policy-VCYKGSAC.js.map +1 -0
- package/dist/policy.js +2 -35
- package/dist/policy.js.map +1 -1
- package/dist/primitive-index-2OF6F4TZ.js +131 -0
- package/dist/primitive-index-2OF6F4TZ.js.map +1 -0
- package/dist/primitive-slice-WTMBLYFJ.js +235 -0
- package/dist/primitive-slice-WTMBLYFJ.js.map +1 -0
- package/dist/{prompts-BhNUuRoZ.d.ts → prompts-CLZGywMP.d.ts} +1 -1
- package/dist/provider-adapter-contract.js +10407 -14204
- package/dist/provider-adapter-contract.js.map +1 -1
- package/dist/provider-adapter.js +2 -44
- package/dist/provider-adapter.js.map +1 -1
- package/dist/providers/index.d.ts +89 -1
- package/dist/providers/index.js +115 -44
- package/dist/providers/index.js.map +1 -1
- package/dist/raw-C6KBH5I3.js +141 -0
- package/dist/raw-C6KBH5I3.js.map +1 -0
- package/dist/raw-FXSBXQTZ.js +7 -0
- package/dist/raw-FXSBXQTZ.js.map +1 -0
- package/dist/raw-MURDUPGK.js +8 -0
- package/dist/raw-MURDUPGK.js.map +1 -0
- package/dist/raw-T3GW3UVX.js +8 -0
- package/dist/raw-T3GW3UVX.js.map +1 -0
- package/dist/render-check-host-ZNIS6BJ5.js +5 -0
- package/dist/render-check-host-ZNIS6BJ5.js.map +1 -0
- package/dist/sdk-4JNSDNSR.js +6 -0
- package/dist/sdk-4JNSDNSR.js.map +1 -0
- package/dist/sdk-DIVJMHCX.js +7 -0
- package/dist/sdk-DIVJMHCX.js.map +1 -0
- package/dist/sdk-QRJOCRTS.js +7 -0
- package/dist/sdk-QRJOCRTS.js.map +1 -0
- package/dist/tag-balance-CTHCTRJ7.js +123 -0
- package/dist/tag-balance-CTHCTRJ7.js.map +1 -0
- package/dist/tools/get-primitives-ts.d.ts +1 -1
- package/dist/tools/get-primitives-ts.js +3 -1
- package/dist/tools/get-primitives-ts.js.map +1 -1
- package/dist/tools/render-check-worker.js +3 -40
- package/dist/tools/render-check-worker.js.map +1 -1
- package/dist/{types-public-h8IMnYuh.d.ts → types-public-hYlrerZh.d.ts} +35 -2
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +3 -498
- package/dist/validation/index.js.map +1 -1
- package/dist/{visual-evaluator-C2strxqD.d.ts → visual-evaluator-KskajxD5.d.ts} +14 -4
- package/dist/visual-evaluator-TGEXYQTP.js +12 -0
- package/dist/visual-evaluator-TGEXYQTP.js.map +1 -0
- package/dist/workflows.d.ts +3 -2
- package/dist/workflows.js +2 -151
- package/dist/workflows.js.map +1 -1
- package/package.json +20 -16
- package/src/adapters/claude/sdk.ts +4 -2
- package/src/adapters/claude/tool-bridge.ts +2 -1
- package/src/adapters/generation-dispatch.ts +9 -0
- package/src/adapters/openai/raw.ts +4 -0
- package/src/adapters/openai/sdk.ts +6 -1
- package/src/adapters/openai/tokens.ts +21 -7
- package/src/adapters/tool-bridge.ts +1 -1
- package/src/adapters/tools.ts +1 -1
- package/src/advanced/feedback.ts +1 -2
- package/src/advanced/generator.ts +4 -3
- package/src/boilerplate/free-design-prompt.ts +7 -0
- package/src/boilerplate/generate.ts +18 -5
- package/src/boilerplate/hard-sections.ts +8 -3
- package/src/boilerplate/react-hooks.ts +56 -0
- package/src/boilerplate/system-prompt.ts +12 -3
- package/src/check/run-tier0.ts +233 -8
- package/src/check/type-checker.ts +128 -16
- package/src/coding-agent/tools.ts +26 -3
- package/src/design-mode.ts +4 -9
- package/src/evaluation/axis-checks/checks/state-merge.ts +2 -4
- package/src/evaluation/axis-checks/checks/state-payload.ts +1 -28
- package/src/evaluation/axis-checks/checks/tint.ts +197 -0
- package/src/evaluation/axis-checks/helpers.ts +121 -0
- package/src/evaluation/axis-checks/registry.ts +2 -0
- package/src/evaluation/criteria/__fixtures__/edge-v2-draw2.json +4629 -0
- package/src/evaluation/criteria/bank.ts +1 -1
- package/src/evaluation/criteria/edge-instruments.ts +14 -0
- package/src/evaluation/criteria/edge-probe-v2.ts +352 -0
- package/src/evaluation/criteria/edge-v2.ts +242 -0
- package/src/evaluation/criteria/resolve.ts +24 -5
- package/src/evaluation/index.ts +3 -5
- package/src/evaluation/mcp-server.ts +0 -50
- package/src/evaluation/types-public.ts +6 -1
- package/src/evaluation/visual-evaluator.ts +161 -30
- package/src/harness/check/runtime-render/index.ts +28 -4
- package/src/harness/check/runtime-render/render-check.ts +20 -21
- package/src/harness/claude-agent-sdk-loader.ts +93 -0
- package/src/harness/claude-code-login-query.ts +1 -1
- package/src/harness/coding/generate-task-runner.ts +1 -0
- package/src/harness/coding/run-coding-turn.ts +3 -0
- package/src/harness/coding/run-eval-round.ts +9 -0
- package/src/harness/llm-router.ts +50 -2
- package/src/harness/runtime.ts +17 -0
- package/src/index.ts +9 -0
- package/src/providers/anthropic-tool-call.ts +263 -0
- package/src/providers/index.ts +13 -0
- package/src/tools/get-primitives-ts.ts +1 -1
- package/src/tools/render-check.ts +4 -4
- package/src/validation/primitives.ts +2 -1
- package/src/evaluation/loop.ts +0 -218
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/design-mode.ts"],"names":[],"mappings":";;;AAsBO,IAAM,YAAA,GAAe,CAAC,aAAA,EAAe,MAAM;AAI3C,IAAM,mBAAA,GAAk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CAAA,+JAAA,CAAA;AAGrD","file":"chunk-3T2HMTON.js","sourcesContent":["// packages/ui-gen/src/design-mode.ts\n//\n// The ONE definition of the `designMode` option and the rendering-canvas\n// vocabulary. Every triad surface (system prompt, boilerplate, tier-0\n// gate, axis checks, evaluator criteria) AND the visual evaluator import\n// these types from here — nothing re-declares the unions.\n//\n// - `constrained` (default) — today's triad: the component composes\n// from the `@ggui-ai/design` primitives, prop enums and spacing\n// scale, and tier-0 enforces the design vocabulary. Byte-identical\n// to the pre-`designMode` behaviour (pinned by\n// `design-mode.pin.test.ts`).\n// - `free` — the design vocabulary is relaxed: raw HTML elements,\n// inline styles and `<style>` blocks are allowed; the design package\n// is importable but optional. Every HARD contract stays: the data\n// contract via the boilerplate-typed wire hooks, the import\n// allowlist + security bans, the host envelope, the budgets, the\n// blueprint-reuse shape, and brand-bearing color via the closed\n// `--ggui-color-*` token manifest (no literals, no fallbacks).\n\nimport type { CanvasClass } from \"@ggui-ai/design/rendering\";\n\nexport const DESIGN_MODES = [\"constrained\", \"free\"] as const;\n\nexport type DesignMode = (typeof DESIGN_MODES)[number];\n\nexport const DEFAULT_DESIGN_MODE: DesignMode = \"constrained\";\n\n// ─── Rendering canvas ───────────────────────────────────────────────────────\n//\n// ONE canvas vocabulary shared by the prompt input (the `free` prompt\n// TELLS the agent its canvas; the `constrained` prompt keeps its\n// shell/screen descriptors byte-for-byte) and the visual evaluator (one\n// screenshot + judge score per class at `CANVAS_VIEWPORTS[class]`).\n//\n// A class is derived from DISPLAY MODE + width, never from width alone:\n// an inline chat card is `xs-chat-card` whatever the host window\n// measures (the bubble, not the window, bounds the component); a\n// fullscreen-class surface follows its width through the three\n// breakpoints. `canvasForViewportWidth` is monotonic in width per\n// display mode (pinned by `design-mode.test.ts`).\n\n// The vocabulary itself lives in `@ggui-ai/design/rendering`, where the runtime reads it too.\nexport { CANVAS_CLASSES, type CanvasClass } from \"@ggui-ai/design/rendering\";\n\nexport interface CanvasViewport {\n readonly width: number;\n readonly height: number;\n}\n\n/** The viewport (CSS px) each class is rendered + judged at. */\nexport const CANVAS_VIEWPORTS: Readonly<Record<CanvasClass, CanvasViewport>> = {\n \"xs-chat-card\": { width: 400, height: 640 },\n \"mobile-fullscreen-small\": { width: 390, height: 844 },\n md: { width: 768, height: 1024 },\n lg: { width: 1024, height: 768 },\n xl: { width: 1440, height: 900 },\n};\n\n/**\n * The two display modes the canvas derivation distinguishes. `inline`\n * is the chat card (MCP Apps `inline` display mode / the `chat` shell);\n * `fullscreen` is every surface the component owns edge to edge or as\n * a panel (`fullscreen`, `pip`, the `spatial` and `partial` shells) —\n * there the width decides the class.\n */\nexport type CanvasDisplayMode = \"inline\" | \"fullscreen\";\n\n/**\n * Map a shell name (`chat` / `fullscreen` / `spatial` / `partial`) or an\n * MCP Apps display mode (`inline` / `fullscreen` / `pip`) onto the\n * canvas display mode. Only `chat` and `inline` are the inline card;\n * everything else is width-governed.\n */\n/**\n * The display mode a JUDGE canvas stands for (ggui#1100): the inline chat\n * card is `xs-chat-card`; every other canvas is a surface the component\n * owns edge to edge, which the served runtime composes with `fit: 'fill'`\n * — so the judge must too, or it scores a picture the user never sees.\n */\nexport function displayModeForCanvas(canvas: CanvasClass): CanvasDisplayMode {\n return canvas === \"xs-chat-card\" ? \"inline\" : \"fullscreen\";\n}\n\nexport function canvasDisplayModeForShell(shell: string | undefined): CanvasDisplayMode {\n return shell === \"chat\" || shell === \"inline\" ? \"inline\" : \"fullscreen\";\n}\n\n/** Fullscreen-class breakpoints (inclusive lower bounds), CSS px. */\nexport const CANVAS_BREAKPOINTS = { md: 600, lg: 1024, xl: 1440 } as const;\n\n/**\n * Derive the canvas class from display mode + container width.\n *\n * inline → `xs-chat-card` at every width\n * fullscreen → width < 600 → `mobile-fullscreen-small`\n * 600 – 1023 → `md`\n * 1024 – 1439 → `lg`\n * ≥ 1440 → `xl`\n */\nexport function canvasForViewportWidth(mode: CanvasDisplayMode, width: number): CanvasClass {\n if (mode === \"inline\") return \"xs-chat-card\";\n if (width < CANVAS_BREAKPOINTS.md) return \"mobile-fullscreen-small\";\n if (width < CANVAS_BREAKPOINTS.lg) return \"md\";\n if (width < CANVAS_BREAKPOINTS.xl) return \"lg\";\n return \"xl\";\n}\n\n/**\n * Map today's shell × screen descriptors onto a canvas class when no\n * width is known. `chat` is always the inline card; `spatial` is a\n * ~600px floating panel (`md`); `fullscreen` follows the screen. Unknown\n * values fall back to `lg` (the widest common fullscreen), matching the\n * skeleton's `fullscreen` / `universal` defaults.\n */\nexport function canvasForRendering(\n shellType: string | undefined,\n screen: string | undefined,\n): CanvasClass {\n const shell = shellType ?? \"fullscreen\";\n if (canvasDisplayModeForShell(shell) === \"inline\") return \"xs-chat-card\";\n if (shell === \"spatial\") return \"md\";\n switch (screen ?? \"universal\") {\n case \"mobile\":\n return \"mobile-fullscreen-small\";\n case \"tablet\":\n return \"md\";\n default:\n return \"lg\";\n }\n}\n\nexport interface CanvasDescriptor {\n /** Short human label. */\n readonly label: string;\n /** Inclusive width range the component must look right across, CSS px. */\n readonly minWidthPx: number;\n readonly maxWidthPx: number;\n /** What the host draws around the component at this canvas. */\n readonly host: string;\n}\n\nexport const CANVAS_DESCRIPTORS: Readonly<Record<CanvasClass, CanvasDescriptor>> = {\n \"xs-chat-card\": {\n label: \"extra-small chat card\",\n minWidthPx: 320,\n maxWidthPx: 480,\n host: \"an inline card inside a chat message bubble — the host draws the card border, shadow and rounded corners; the component fills the bubble width and takes its natural height\",\n },\n \"mobile-fullscreen-small\": {\n label: \"small mobile fullscreen\",\n minWidthPx: 320,\n maxWidthPx: 599,\n host: \"a phone-sized viewport the component owns edge to edge — single column, touch targets at least 44px, the component manages its own scroll\",\n },\n md: {\n label: \"medium panel\",\n minWidthPx: 600,\n maxWidthPx: 1023,\n host: \"a tablet viewport or a floating panel (spatial / picture-in-picture) — one or two columns, medium density\",\n },\n lg: {\n label: \"large fullscreen\",\n minWidthPx: 1024,\n maxWidthPx: 1439,\n host: \"a desktop viewport the component owns edge to edge — multi-column layouts, hover states and pointer interactions are available\",\n },\n xl: {\n label: \"extra-large fullscreen\",\n minWidthPx: 1440,\n maxWidthPx: 1920,\n host: \"a wide desktop viewport the component owns edge to edge — cap content width or use the extra room deliberately; never stretch a single column across the whole width\",\n },\n};\n\n/**\n * The explicit sentence the `free` prompt renders for a canvas — the\n * agent is TOLD the canvas, it never guesses it.\n */\nexport function describeCanvas(canvas: CanvasClass): string {\n const d = CANVAS_DESCRIPTORS[canvas];\n return (\n `This component renders on the \\`${canvas}\\` canvas (${d.label}): ` +\n `${d.minWidthPx}–${d.maxWidthPx}px wide, ${d.host}. ` +\n `Design for the whole range — the host may size the iframe anywhere inside it, and the host owns the height: size to your content, never to the viewport.`\n );\n}\n"]}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { createCapture, captureMarkers, captureSourceCode, captureCompiledCode } from './chunk-YJZTUY7B.js';
|
|
2
|
+
import { GeneratorAdapter, hasCredentials } from './chunk-XRBCRKA2.js';
|
|
3
|
+
import { createAnthropicClient } from './chunk-QLXXPGTV.js';
|
|
4
|
+
import { zodToJsonSchema } from './chunk-7QE3AHLE.js';
|
|
5
|
+
|
|
6
|
+
// src/adapters/claude/raw.ts
|
|
7
|
+
var ClaudeRawAdapter = class extends GeneratorAdapter {
|
|
8
|
+
provider = "claude";
|
|
9
|
+
mode = "raw";
|
|
10
|
+
displayName = "Claude (Raw API)";
|
|
11
|
+
client = null;
|
|
12
|
+
constructor(config = {}) {
|
|
13
|
+
super(config);
|
|
14
|
+
}
|
|
15
|
+
isAvailable() {
|
|
16
|
+
return hasCredentials(this.config, "ANTHROPIC_API_KEY");
|
|
17
|
+
}
|
|
18
|
+
async generate(params) {
|
|
19
|
+
const startTime = Date.now();
|
|
20
|
+
if (!this.client) {
|
|
21
|
+
if (this.config.useBedrock) {
|
|
22
|
+
this.client = createAnthropicClient(void 0);
|
|
23
|
+
} else {
|
|
24
|
+
const rawKey = this.config.apiKey || process.env.ANTHROPIC_API_KEY;
|
|
25
|
+
this.client = createAnthropicClient(rawKey);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const anthropicTools = params.tools.map(toAnthropicTool);
|
|
29
|
+
const capture = createCapture();
|
|
30
|
+
let totalInputTokens = 0;
|
|
31
|
+
let totalOutputTokens = 0;
|
|
32
|
+
let turnsUsed = 0;
|
|
33
|
+
const messages = [
|
|
34
|
+
{ role: "user", content: params.userPrompt }
|
|
35
|
+
];
|
|
36
|
+
for (let turn = 0; turn < params.maxTurns; turn++) {
|
|
37
|
+
turnsUsed = turn + 1;
|
|
38
|
+
const response = await this.client.messages.create({
|
|
39
|
+
model: params.model,
|
|
40
|
+
max_tokens: 16384,
|
|
41
|
+
system: params.systemPrompt,
|
|
42
|
+
messages,
|
|
43
|
+
tools: anthropicTools
|
|
44
|
+
});
|
|
45
|
+
totalInputTokens += response.usage.input_tokens;
|
|
46
|
+
totalOutputTokens += response.usage.output_tokens;
|
|
47
|
+
const toolUseBlocks = response.content.filter(
|
|
48
|
+
(block) => block.type === "tool_use"
|
|
49
|
+
);
|
|
50
|
+
for (const block of response.content) {
|
|
51
|
+
if (block.type === "text") captureMarkers(capture, block.text);
|
|
52
|
+
}
|
|
53
|
+
if (toolUseBlocks.length === 0 || response.stop_reason === "end_turn") {
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
messages.push({
|
|
57
|
+
role: "assistant",
|
|
58
|
+
content: response.content.map((block) => {
|
|
59
|
+
if (block.type === "text") {
|
|
60
|
+
return { type: "text", text: block.text };
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
type: "tool_use",
|
|
64
|
+
id: block.id,
|
|
65
|
+
name: block.name,
|
|
66
|
+
input: block.input
|
|
67
|
+
};
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
const toolResults = [];
|
|
71
|
+
for (const toolBlock of toolUseBlocks) {
|
|
72
|
+
const toolDef = params.tools.find((t) => t.name === toolBlock.name);
|
|
73
|
+
if (!toolDef) {
|
|
74
|
+
toolResults.push({
|
|
75
|
+
type: "tool_result",
|
|
76
|
+
tool_use_id: toolBlock.id,
|
|
77
|
+
content: `Tool '${toolBlock.name}' not found`,
|
|
78
|
+
is_error: true
|
|
79
|
+
});
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const args = toolBlock.input ?? {};
|
|
83
|
+
captureSourceCode(capture, toolBlock.name, args);
|
|
84
|
+
const result = await toolDef.handler(args);
|
|
85
|
+
captureCompiledCode(capture, toolBlock.name, result);
|
|
86
|
+
toolResults.push({
|
|
87
|
+
type: "tool_result",
|
|
88
|
+
tool_use_id: toolBlock.id,
|
|
89
|
+
content: result.content.map((c) => ({ type: "text", text: c.text })),
|
|
90
|
+
is_error: result.isError
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
messages.push({ role: "user", content: toolResults });
|
|
94
|
+
}
|
|
95
|
+
if (!capture.compiledCode) {
|
|
96
|
+
throw new Error("Claude raw adapter: no compiled code produced after all turns");
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
compiledCode: capture.compiledCode,
|
|
100
|
+
sourceCode: capture.sourceCode,
|
|
101
|
+
stream: capture.stream,
|
|
102
|
+
generatorMeta: capture.generatorMeta,
|
|
103
|
+
tokens: {
|
|
104
|
+
input: totalInputTokens,
|
|
105
|
+
output: totalOutputTokens,
|
|
106
|
+
total: totalInputTokens + totalOutputTokens
|
|
107
|
+
},
|
|
108
|
+
generationTimeMs: Date.now() - startTime,
|
|
109
|
+
turnsUsed
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
function toAnthropicTool(def) {
|
|
114
|
+
return {
|
|
115
|
+
name: def.name,
|
|
116
|
+
description: def.description,
|
|
117
|
+
input_schema: zodToJsonSchema(def.inputSchema)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { ClaudeRawAdapter };
|
|
122
|
+
//# sourceMappingURL=chunk-3ZSSDV3L.js.map
|
|
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AO;AAAA,SAClB,CAAA;AAAA,MACH;AAEA,MAAA,QAAA,CAAS,KAAK,EAAE,IAAA,EAAM,MAAA,EAAQ,OAAA,EAAS,aAAa,CAAA;AAAA,IACtD;AAEA,IAAA,IAAI,CAAC,QAAQ,YAAA,EAAc;AACzB,MAAA,MAAM,IAAI,MAAM,+DAA+D,CAAA;AAAA,IACjF;AAEA,IAAA,OAAO;AAAA,MACL,cAAc,OAAA,CAAQ,YAAA;AAAA,MACtB,YAAY,OAAA,CAAQ,UAAA;AAAA,MACpB,QAAQ,OAAA,CAAQ,MAAA;AAAA,MAChB,eAAe,OAAA,CAAQ,aAAA;AAAA,MACvB,MAAA,EAAQ;AAAA,QACN,KAAA,EAAO,gBAAA;AAAA,QACP,MAAA,EAAQ,iBAAA;AAAA,QACR,OAAO,gBAAA,GAAmB;AAAA,OAC5B;AAAA,MACA,gBAAA,EAAkB,IAAA,CAAK,GAAA,EAAI,GAAI,SAAA;AAAA,MAC/B;AAAA,KACF;AAAA,EACF;AACF;AAEA,SAAS,gBAAgB,GAAA,EAAqC;AAC5D,EAAA,OAAO;AAAA,IACL,MAAM,GAAA,CAAI,IAAA;AAAA,IACV,aAAa,GAAA,CAAI,WAAA;AAAA,IACjB,YAAA,EAAc,eAAA,CAAgB,GAAA,CAAI,WAAW;AAAA,GAC/C;AACF","file":"chunk-3ZSSDV3L.js","sourcesContent":["// packages/ui-gen/src/adapters/claude/raw.ts\n//\n// Claude adapter using the raw Anthropic SDK (@anthropic-ai/sdk).\n// Manual tool-use loop: messages.create() -> tool_use -> handler -> repeat.\n//\n// SDK client construction is centralized in `./client.ts`. Do NOT\n// inline `new Anthropic(...)` here.\n\nimport type Anthropic from '@anthropic-ai/sdk';\nimport { GeneratorAdapter, hasCredentials } from '../base';\nimport type { AdapterConfig, GenerateParams } from '../base';\nimport type { AdapterResult, ToolDefinition, ProviderName, AdapterMode } from '../types';\nimport { zodToJsonSchema } from '../tool-bridge';\nimport { createCapture, captureSourceCode, captureCompiledCode, captureMarkers } from '../extract-code';\nimport type { JsonObject } from '@ggui-ai/protocol';\nimport { createAnthropicClient } from './client';\n\nexport class ClaudeRawAdapter extends GeneratorAdapter {\n readonly provider: ProviderName = 'claude';\n readonly mode: AdapterMode = 'raw';\n readonly displayName = 'Claude (Raw API)';\n\n private client: Anthropic | null = null;\n\n constructor(config: AdapterConfig = {}) {\n super(config);\n }\n\n isAvailable(): boolean {\n return hasCredentials(this.config, 'ANTHROPIC_API_KEY');\n }\n\n async generate(params: GenerateParams): Promise<AdapterResult> {\n const startTime = Date.now();\n\n if (!this.client) {\n // Bedrock path: SDK reads AWS creds from the env / role chain;\n // skip the `apiKey` set entirely — `createAnthropicClient(undefined)`\n // gives us a constructed client and the SDK does the rest.\n if (this.config.useBedrock) {\n this.client = createAnthropicClient(undefined);\n } else {\n const rawKey = this.config.apiKey || process.env.ANTHROPIC_API_KEY;\n this.client = createAnthropicClient(rawKey);\n }\n }\n\n const anthropicTools = params.tools.map(toAnthropicTool);\n const capture = createCapture();\n let totalInputTokens = 0;\n let totalOutputTokens = 0;\n let turnsUsed = 0;\n\n const messages: Anthropic.MessageParam[] = [\n { role: 'user', content: params.userPrompt },\n ];\n\n for (let turn = 0; turn < params.maxTurns; turn++) {\n turnsUsed = turn + 1;\n\n const response = await this.client.messages.create({\n model: params.model,\n max_tokens: 16384,\n system: params.systemPrompt,\n messages,\n tools: anthropicTools,\n });\n\n totalInputTokens += response.usage.input_tokens;\n totalOutputTokens += response.usage.output_tokens;\n\n const toolUseBlocks = response.content.filter(\n (block): block is Anthropic.ToolUseBlock => block.type === 'tool_use',\n );\n\n // Scan text blocks for streamSpec/generatorMeta markers\n for (const block of response.content) {\n if (block.type === 'text') captureMarkers(capture, block.text);\n }\n\n if (toolUseBlocks.length === 0 || response.stop_reason === 'end_turn') {\n break;\n }\n\n messages.push({\n role: 'assistant',\n content: response.content.map((block) => {\n if (block.type === 'text') {\n return { type: 'text' as const, text: block.text };\n }\n return {\n type: 'tool_use' as const,\n id: (block as Anthropic.ToolUseBlock).id,\n name: (block as Anthropic.ToolUseBlock).name,\n input: (block as Anthropic.ToolUseBlock).input,\n };\n }),\n });\n\n const toolResults: Anthropic.ToolResultBlockParam[] = [];\n\n for (const toolBlock of toolUseBlocks) {\n const toolDef = params.tools.find((t) => t.name === toolBlock.name);\n if (!toolDef) {\n toolResults.push({\n type: 'tool_result',\n tool_use_id: toolBlock.id,\n content: `Tool '${toolBlock.name}' not found`,\n is_error: true,\n });\n continue;\n }\n\n const args = (toolBlock.input as JsonObject) ?? {};\n captureSourceCode(capture, toolBlock.name, args);\n\n const result = await toolDef.handler(args);\n captureCompiledCode(capture, toolBlock.name, result);\n\n toolResults.push({\n type: 'tool_result',\n tool_use_id: toolBlock.id,\n content: result.content.map((c) => ({ type: 'text' as const, text: c.text })),\n is_error: result.isError,\n });\n }\n\n messages.push({ role: 'user', content: toolResults });\n }\n\n if (!capture.compiledCode) {\n throw new Error('Claude raw adapter: no compiled code produced after all turns');\n }\n\n return {\n compiledCode: capture.compiledCode,\n sourceCode: capture.sourceCode,\n stream: capture.stream,\n generatorMeta: capture.generatorMeta,\n tokens: {\n input: totalInputTokens,\n output: totalOutputTokens,\n total: totalInputTokens + totalOutputTokens,\n },\n generationTimeMs: Date.now() - startTime,\n turnsUsed,\n };\n }\n}\n\nfunction toAnthropicTool(def: ToolDefinition): Anthropic.Tool {\n return {\n name: def.name,\n description: def.description,\n input_schema: zodToJsonSchema(def.inputSchema) as Anthropic.Tool.InputSchema,\n };\n}\n"]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { createHash } from 'crypto';
|
|
2
|
+
|
|
3
|
+
// src/harness/hashline.ts
|
|
4
|
+
function computeLineHash(line) {
|
|
5
|
+
return createHash("sha256").update(line).digest("hex").slice(0, 2);
|
|
6
|
+
}
|
|
7
|
+
function formatWithHashlines(content) {
|
|
8
|
+
const lines = content.split("\n");
|
|
9
|
+
return lines.map((line, i) => `${i + 1}:${computeLineHash(line)}\u2502${line}`).join("\n");
|
|
10
|
+
}
|
|
11
|
+
function parseHashlineRef(ref) {
|
|
12
|
+
if (typeof ref !== "string") return null;
|
|
13
|
+
const m = ref.match(/^(\d+):([0-9a-fA-F]{2})$/);
|
|
14
|
+
if (!m) return null;
|
|
15
|
+
return {
|
|
16
|
+
line: parseInt(m[1], 10),
|
|
17
|
+
expectedHash: m[2].toLowerCase()
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function validateHashlineRefs(sourceBefore, changes) {
|
|
21
|
+
const sourceLines = sourceBefore.split("\n");
|
|
22
|
+
const issues = [];
|
|
23
|
+
for (let i = 0; i < changes.length; i++) {
|
|
24
|
+
const c = changes[i];
|
|
25
|
+
if (c.expectedStartHash !== void 0) {
|
|
26
|
+
const sourceLine = sourceLines[c.startLine - 1];
|
|
27
|
+
if (sourceLine === void 0) {
|
|
28
|
+
issues.push({
|
|
29
|
+
changeIndex: i,
|
|
30
|
+
field: "startLine",
|
|
31
|
+
line: c.startLine,
|
|
32
|
+
expectedHash: c.expectedStartHash,
|
|
33
|
+
actualHash: "??",
|
|
34
|
+
actualContent: `<line ${c.startLine} out of bounds; file has ${sourceLines.length} lines>`
|
|
35
|
+
});
|
|
36
|
+
} else {
|
|
37
|
+
const actual = computeLineHash(sourceLine);
|
|
38
|
+
if (actual !== c.expectedStartHash.toLowerCase()) {
|
|
39
|
+
issues.push({
|
|
40
|
+
changeIndex: i,
|
|
41
|
+
field: "startLine",
|
|
42
|
+
line: c.startLine,
|
|
43
|
+
expectedHash: c.expectedStartHash.toLowerCase(),
|
|
44
|
+
actualHash: actual,
|
|
45
|
+
actualContent: sourceLine
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (c.expectedEndHash !== void 0) {
|
|
51
|
+
const sourceLine = sourceLines[c.endLine - 1];
|
|
52
|
+
if (sourceLine === void 0) {
|
|
53
|
+
issues.push({
|
|
54
|
+
changeIndex: i,
|
|
55
|
+
field: "endLine",
|
|
56
|
+
line: c.endLine,
|
|
57
|
+
expectedHash: c.expectedEndHash,
|
|
58
|
+
actualHash: "??",
|
|
59
|
+
actualContent: `<line ${c.endLine} out of bounds; file has ${sourceLines.length} lines>`
|
|
60
|
+
});
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const actual = computeLineHash(sourceLine);
|
|
64
|
+
if (actual !== c.expectedEndHash.toLowerCase()) {
|
|
65
|
+
issues.push({
|
|
66
|
+
changeIndex: i,
|
|
67
|
+
field: "endLine",
|
|
68
|
+
line: c.endLine,
|
|
69
|
+
expectedHash: c.expectedEndHash.toLowerCase(),
|
|
70
|
+
actualHash: actual,
|
|
71
|
+
actualContent: sourceLine
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return issues;
|
|
77
|
+
}
|
|
78
|
+
function formatHashlineStaleMessage(issues) {
|
|
79
|
+
const lines = [];
|
|
80
|
+
lines.push(
|
|
81
|
+
"HASHLINE_STALE: line hash(es) don't match current file \u2014 your view is stale. Re-read the `## Current File` block and re-emit with current hashes."
|
|
82
|
+
);
|
|
83
|
+
lines.push("");
|
|
84
|
+
for (const issue of issues) {
|
|
85
|
+
lines.push(
|
|
86
|
+
` \u2022 change[${issue.changeIndex}].${issue.field} = ${issue.line}:${issue.expectedHash} \u2014 expected hash ${issue.expectedHash}, actual hash ${issue.actualHash}`
|
|
87
|
+
);
|
|
88
|
+
lines.push(` line ${issue.line} currently: ${issue.actualContent}`);
|
|
89
|
+
}
|
|
90
|
+
lines.push("");
|
|
91
|
+
lines.push(
|
|
92
|
+
"Workspace unchanged. Submit a new apply_changes with line refs like `${N}:${hash}` matching the current file."
|
|
93
|
+
);
|
|
94
|
+
return lines.join("\n");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { computeLineHash, formatHashlineStaleMessage, formatWithHashlines, parseHashlineRef, validateHashlineRefs };
|
|
98
|
+
//# sourceMappingURL=chun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AAA,EAAe,KAAA,CAAM,aAAa,CAAA,CAAE,CAAA;AAAA,EACzE;AACA,EAAA,KAAA,CAAM,KAAK,EAAE,CAAA;AACb,EAAA,KAAA,CAAM,IAAA;AAAA,IACJ;AAAA,GACF;AACA,EAAA,OAAO,KAAA,CAAM,KAAK,IAAI,CAAA;AACxB","file":"chunk-4MBR5GA3.js","sourcesContent":["// Hashline format. The technique injects 2-char content hashes\n// alongside line numbers in the file view and requires the LLM to echo\n// them in apply_changes references.\n//\n// The hash serves as a \"trusted anchor\" — if the file changed since the\n// LLM's last read (due to tool interleaving or the model miscounting),\n// the hash-check rejects the edit before corruption.\n//\n// Display format (in `## Current File` block):\n// 47:a3│ const x = 1;\n// 48:f2│ return x;\n//\n// LLM emits refs as `\"47:a3\"` (string) instead of `47` (number) in the\n// apply_changes.changes[].startLine / endLine fields when the hashline\n// tool is active.\n\nimport { createHash } from \"node:crypto\";\n\n/** Compute a 2-char hex hash of a line's content. Uses SHA-256 trimmed to\n * 2 hex chars (1 byte / 256-space) — enough to disambiguate within a\n * single file (typical 100-400 line components; collision ~5-20%). The\n * hash is computed on the RAW line content (no trim), so whitespace\n * sensitivity is preserved — important for detecting \"file changed by\n * whitespace-only edit.\" */\nexport function computeLineHash(line: string): string {\n return createHash(\"sha256\").update(line).digest(\"hex\").slice(0, 2);\n}\n\n/** Format a file's content with hashlines. Each line becomes `N:hh│content`.\n * `N` is 1-indexed; line numbering matches what apply_changes already\n * expects. The `│` separator is the same character used by the existing\n * workspace.cat() output for visual continuity. */\nexport function formatWithHashlines(content: string): string {\n const lines = content.split(\"\\n\");\n return lines\n .map((line, i) => `${i + 1}:${computeLineHash(line)}│${line}`)\n .join(\"\\n\");\n}\n\nexport interface ParsedHashlineRef {\n readonly line: number;\n readonly expectedHash: string;\n}\n\n/** Parse a hashline ref string like \"47:a3\" into {line, expectedHash}.\n * Returns null if the input doesn't match the pattern — the handler\n * should fall back to treating it as a legacy numeric ref or reject. */\nexport function parseHashlineRef(ref: unknown): ParsedHashlineRef | null {\n if (typeof ref !== \"string\") return null;\n const m = ref.match(/^(\\d+):([0-9a-fA-F]{2})$/);\n if (!m) return null;\n return {\n line: parseInt(m[1]!, 10),\n expectedHash: m[2]!.toLowerCase(),\n };\n}\n\nexport interface HashlineValidationIssue {\n readonly changeIndex: number;\n readonly field: \"startLine\" | \"endLine\";\n readonly line: number;\n readonly expectedHash: string;\n readonly actualHash: string;\n /** The actual current content of the line — helps the LLM re-orient. */\n readonly actualContent: string;\n}\n\n/** Validate that the expected hashes on a list of changes match the current\n * file. Returns issues[] for any mismatches; empty = all good. */\nexport function validateHashlineRefs(\n sourceBefore: string,\n changes: ReadonlyArray<{\n startLine: number;\n endLine: number;\n expectedStartHash?: string;\n expectedEndHash?: string;\n }>,\n): HashlineValidationIssue[] {\n const sourceLines = sourceBefore.split(\"\\n\");\n const issues: HashlineValidationIssue[] = [];\n\n for (let i = 0; i < changes.length; i++) {\n const c = changes[i]!;\n // startLine validation\n if (c.expectedStartHash !== undefined) {\n const sourceLine = sourceLines[c.startLine - 1];\n if (sourceLine === undefined) {\n issues.push({\n changeIndex: i,\n field: \"startLine\",\n line: c.startLine,\n expectedHash: c.expectedStartHash,\n actualHash: \"??\",\n actualContent: `<line ${c.startLine} out of bounds; file has ${sourceLines.length} lines>`,\n });\n } else {\n const actual = computeLineHash(sourceLine);\n if (actual !== c.expectedStartHash.toLowerCase()) {\n issues.push({\n changeIndex: i,\n field: \"startLine\",\n line: c.startLine,\n expectedHash: c.expectedStartHash.toLowerCase(),\n actualHash: actual,\n actualContent: sourceLine,\n });\n }\n }\n }\n // endLine validation\n if (c.expectedEndHash !== undefined) {\n const sourceLine = sourceLines[c.endLine - 1];\n if (sourceLine === undefined) {\n issues.push({\n changeIndex: i,\n field: \"endLine\",\n line: c.endLine,\n expectedHash: c.expectedEndHash,\n actualHash: \"??\",\n actualContent: `<line ${c.endLine} out of bounds; file has ${sourceLines.length} lines>`,\n });\n continue;\n }\n const actual = computeLineHash(sourceLine);\n if (actual !== c.expectedEndHash.toLowerCase()) {\n issues.push({\n changeIndex: i,\n field: \"endLine\",\n line: c.endLine,\n expectedHash: c.expectedEndHash.toLowerCase(),\n actualHash: actual,\n actualContent: sourceLine,\n });\n }\n }\n }\n\n return issues;\n}\n\n/** Format a validation result as an actionable PATCH_INVALID message. */\nexport function formatHashlineStaleMessage(\n issues: ReadonlyArray<HashlineValidationIssue>,\n): string {\n const lines: string[] = [];\n lines.push(\n \"HASHLINE_STALE: line hash(es) don't match current file — your view is stale. Re-read the `## Current File` block and re-emit with current hashes.\",\n );\n lines.push(\"\");\n for (const issue of issues) {\n lines.push(\n ` • change[${issue.changeIndex}].${issue.field} = ${issue.line}:${issue.expectedHash} — expected hash ${issue.expectedHash}, actual hash ${issue.actualHash}`,\n );\n lines.push(` line ${issue.line} currently: ${issue.actualContent}`);\n }\n lines.push(\"\");\n lines.push(\n \"Workspace unchanged. Submit a new apply_changes with line refs like `${N}:${hash}` matching the current file.\",\n );\n return lines.join(\"\\n\");\n}\n"]}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
// src/design-system-docs.ts
|
|
2
|
+
var DEFAULT_DESIGN_SYSTEM_DOCS = `# Design System - Default Light Theme
|
|
3
|
+
|
|
4
|
+
**IMPORTANT:** Always use CSS variables (var(--ggui-*)) for styling to ensure components respect the app theme.
|
|
5
|
+
|
|
6
|
+
## Colors
|
|
7
|
+
|
|
8
|
+
### Primary
|
|
9
|
+
- var(--ggui-color-primary-50) - #f0f9ff
|
|
10
|
+
- var(--ggui-color-primary-100) - #e0f2fe
|
|
11
|
+
- var(--ggui-color-primary-200) - #bae6fd
|
|
12
|
+
- var(--ggui-color-primary-300) - #7dd3fc
|
|
13
|
+
- var(--ggui-color-primary-400) - #38bdf8
|
|
14
|
+
- var(--ggui-color-primary-500) - #0ea5e9
|
|
15
|
+
- var(--ggui-color-primary-600) - #0284c7 (main action FILL \u2014 buttons, borders, icon fills; accent TEXT takes the link role below)
|
|
16
|
+
- var(--ggui-color-primary-700) - #0369a1
|
|
17
|
+
- var(--ggui-color-primary-800) - #075985
|
|
18
|
+
- var(--ggui-color-primary-900) - #0c4a6e
|
|
19
|
+
|
|
20
|
+
### Semantic Surface & Text Colors (REQUIRED for theme compatibility)
|
|
21
|
+
These tokens adapt automatically to any theme (light, dark, branded). **ALWAYS use these for surfaces and text \u2014 never use raw neutral-* scale values.**
|
|
22
|
+
|
|
23
|
+
| Token | CSS Variable | Default | Role |
|
|
24
|
+
|-------|-------------|---------|------|
|
|
25
|
+
| ground | var(--ggui-color-ground) | The page / canvas behind everything |
|
|
26
|
+
| onGround | var(--ggui-color-onGround) | Text on the canvas |
|
|
27
|
+
| container | var(--ggui-color-container) | A card, a bubble, a panel \u2014 the unit of content |
|
|
28
|
+
| onContainer | var(--ggui-color-onContainer) | Body text on a card |
|
|
29
|
+
| elevated | var(--ggui-color-elevated) | Menus, popovers, modals, toasts \u2014 floats above a card |
|
|
30
|
+
| onElevated | var(--ggui-color-onElevated) | Text on an elevated surface |
|
|
31
|
+
| heroGround | var(--ggui-color-heroGround) | A hero / greeting panel's ground \u2014 brand-tinted on a light host, the ink pair on a dark one (Card surface="hero") |
|
|
32
|
+
| onHeroGround | var(--ggui-color-onHeroGround) | Text on the hero ground |
|
|
33
|
+
| sunken | var(--ggui-color-sunken) | Wells, inputs at rest, code blocks \u2014 recessed inside a card |
|
|
34
|
+
| onSunken | var(--ggui-color-onSunken) | Muted / secondary text |
|
|
35
|
+
| link | var(--ggui-color-link) | Accent TEXT \u2014 eyebrows, taglines, links, labels, inline arrows: the brand's readable ink, derived per mode to clear 4.5:1 on the container and the ground |
|
|
36
|
+
| outline | var(--ggui-color-outline) | Borders, dividers |
|
|
37
|
+
| outlineVariant | var(--ggui-color-outlineVariant) | Subtle borders |
|
|
38
|
+
| controlOutline | var(--ggui-color-controlOutline) | A control's edge \u2014 clears 3:1 on its surface; kit controls draw it themselves |
|
|
39
|
+
|
|
40
|
+
**Usage pattern:**
|
|
41
|
+
- Page/section background \u2192 \`var(--ggui-color-ground)\`
|
|
42
|
+
- Body text \u2192 \`var(--ggui-color-onContainer)\`
|
|
43
|
+
- Card/panel background \u2192 \`var(--ggui-color-container)\`; recessed wells / inputs \u2192 \`var(--ggui-color-sunken)\`
|
|
44
|
+
- Secondary/muted text \u2192 \`var(--ggui-color-onSunken)\`
|
|
45
|
+
- Accent / branded text (eyebrow, tagline, link, label, inline arrow) \u2192 \`var(--ggui-color-link)\` or \`<Text tone="emphasized">\` \u2014 never a bare \`primary-<stop>\` as a text color
|
|
46
|
+
- Branded section/header \u2192 \`var(--ggui-color-container)\` bg + \`var(--ggui-color-onContainer)\` text
|
|
47
|
+
- Borders/dividers \u2192 \`var(--ggui-color-outline)\` or \`var(--ggui-color-outlineVariant)\`
|
|
48
|
+
|
|
49
|
+
### State Colors
|
|
50
|
+
Semantic families ship as SCALES; the \`500\` stop is the role color (per-mode brightness), \`50\` the tint, \`800\` the on-tint text:
|
|
51
|
+
- var(--ggui-color-success-500) \u2014 success states (tint bg: success-50, text on tint: success-800)
|
|
52
|
+
- var(--ggui-color-warning-500) \u2014 warning states (warning-50 / warning-800)
|
|
53
|
+
- var(--ggui-color-error-500) \u2014 error states, destructive actions (error-50 / error-800)
|
|
54
|
+
- var(--ggui-color-info-500) \u2014 informational (info-50 / info-800)
|
|
55
|
+
Prefer the primitives' \`tone="success|warning|error|info"\` prop over hand-written vars \u2014 it resolves to the same stops.
|
|
56
|
+
|
|
57
|
+
### IMPORTANT: Color Rules
|
|
58
|
+
- **NEVER** use hardcoded hex colors. ONLY use var(--ggui-color-*) tokens.
|
|
59
|
+
- **NEVER** use rgba(), hsl(), or other CSS color functions with hardcoded values.
|
|
60
|
+
- **NEVER** use raw neutral-* or gray-* scale tokens (neutral-50, neutral-900, etc.) \u2014 these are internal to the theme and break in dark mode.
|
|
61
|
+
- **ALWAYS** use semantic tokens for text and backgrounds:
|
|
62
|
+
- Text: \`var(--ggui-color-onContainer)\` or \`var(--ggui-color-onSunken)\`
|
|
63
|
+
- Backgrounds: \`var(--ggui-color-container)\` or \`var(--ggui-color-sunken)\`
|
|
64
|
+
- Borders: \`var(--ggui-color-outline)\` or \`var(--ggui-color-outlineVariant)\`
|
|
65
|
+
- For branded elements use \`var(--ggui-color-primary-*)\` scale tokens \u2014 these ARE safe because primary adapts per theme.
|
|
66
|
+
- For card backgrounds use \`var(--ggui-color-container)\` or \`var(--ggui-color-primary-50)\`
|
|
67
|
+
|
|
68
|
+
## Spacing
|
|
69
|
+
|
|
70
|
+
Use \`var(--ggui-spacing-N)\` for all padding, gap, and margin values. **Never use raw numbers** like \`padding={16}\` \u2014 always use the token: \`padding="var(--ggui-spacing-4)"\`.
|
|
71
|
+
|
|
72
|
+
| Token | Value | Common use |
|
|
73
|
+
|-------|-------|------------|
|
|
74
|
+
| var(--ggui-spacing-1) | 4px | Icon gaps, tight spacing |
|
|
75
|
+
| var(--ggui-spacing-2) | 8px | Button padding, small gaps |
|
|
76
|
+
| var(--ggui-spacing-3) | 12px | List item spacing, form gaps |
|
|
77
|
+
| var(--ggui-spacing-4) | 16px | Card padding, section gaps |
|
|
78
|
+
| var(--ggui-spacing-5) | 20px | Medium padding |
|
|
79
|
+
| var(--ggui-spacing-6) | 24px | Container padding, large gaps |
|
|
80
|
+
| var(--ggui-spacing-8) | 32px | Section spacing |
|
|
81
|
+
| var(--ggui-spacing-10) | 40px | Page margins |
|
|
82
|
+
| var(--ggui-spacing-12) | 48px | Hero/large section spacing |
|
|
83
|
+
|
|
84
|
+
**Quick lookup (px \u2192 token):** 4\u21921, 8\u21922, 12\u21923, 16\u21924, 20\u21925, 24\u21926, 28\u21927, 32\u21928, 36\u21929, 40\u219210, 48\u219212
|
|
85
|
+
|
|
86
|
+
**Usage on primitives:**
|
|
87
|
+
\`\`\`tsx
|
|
88
|
+
<Container padding="var(--ggui-spacing-6)">
|
|
89
|
+
<Stack gap="var(--ggui-spacing-4)">
|
|
90
|
+
<Card padding="var(--ggui-spacing-4)">
|
|
91
|
+
<Row gap="var(--ggui-spacing-2)">...</Row>
|
|
92
|
+
</Card>
|
|
93
|
+
</Stack>
|
|
94
|
+
</Container>
|
|
95
|
+
\`\`\`
|
|
96
|
+
|
|
97
|
+
## Typography
|
|
98
|
+
|
|
99
|
+
### Font Sizes
|
|
100
|
+
- var(--ggui-font-size-xs) - 12px
|
|
101
|
+
- var(--ggui-font-size-sm) - 14px
|
|
102
|
+
- var(--ggui-font-size-base) - 16px
|
|
103
|
+
- var(--ggui-font-size-lg) - 18px
|
|
104
|
+
- var(--ggui-font-size-xl) - 20px
|
|
105
|
+
- var(--ggui-font-size-2xl) - 24px
|
|
106
|
+
- var(--ggui-font-size-3xl) - 30px
|
|
107
|
+
- var(--ggui-font-size-4xl) - 36px
|
|
108
|
+
|
|
109
|
+
### Font Weights
|
|
110
|
+
- var(--ggui-font-weight-normal) - 400
|
|
111
|
+
- var(--ggui-font-weight-medium) - 500
|
|
112
|
+
- var(--ggui-font-weight-semibold) - 600
|
|
113
|
+
- var(--ggui-font-weight-bold) - 700
|
|
114
|
+
|
|
115
|
+
## Border Radius
|
|
116
|
+
- var(--ggui-shape-radius-sm) - 4px
|
|
117
|
+
- var(--ggui-shape-radius-md) - 8px
|
|
118
|
+
- var(--ggui-shape-radius-lg) - 12px
|
|
119
|
+
- var(--ggui-shape-radius-xl) - 16px
|
|
120
|
+
- var(--ggui-shape-radius-full) - 9999px
|
|
121
|
+
|
|
122
|
+
## Shadows
|
|
123
|
+
- var(--ggui-shape-shadow-sm) - 0 1px 2px rgba(0,0,0,0.05)
|
|
124
|
+
- var(--ggui-shape-shadow-md) - 0 4px 6px -1px rgba(0,0,0,0.1)
|
|
125
|
+
- var(--ggui-shape-shadow-lg) - 0 10px 15px -3px rgba(0,0,0,0.1)
|
|
126
|
+
- var(--ggui-shape-shadow-xl) - 0 20px 25px -5px rgba(0,0,0,0.1)
|
|
127
|
+
|
|
128
|
+
## Usage Examples (always use ggui primitives \u2014 never raw <div>, <button>, <input>)
|
|
129
|
+
|
|
130
|
+
### Branded section header
|
|
131
|
+
\`\`\`tsx
|
|
132
|
+
<Box padding="var(--ggui-spacing-4)" surface="accent">
|
|
133
|
+
<Heading level={2} tone="emphasized">Contact Us</Heading>
|
|
134
|
+
<Text tone="emphasized">We'd love to hear from you</Text>
|
|
135
|
+
</Box>
|
|
136
|
+
\`\`\`
|
|
137
|
+
|
|
138
|
+
### Form input
|
|
139
|
+
\`\`\`tsx
|
|
140
|
+
<Input label="Email" placeholder="you@example.com" />
|
|
141
|
+
\`\`\`
|
|
142
|
+
|
|
143
|
+
### Buttons
|
|
144
|
+
\`\`\`tsx
|
|
145
|
+
<Button variant="primary">Submit</Button>
|
|
146
|
+
<Button variant="outline">Cancel</Button>
|
|
147
|
+
<Button variant="ghost">Skip</Button>
|
|
148
|
+
\`\`\`
|
|
149
|
+
|
|
150
|
+
### Card with spacing tokens
|
|
151
|
+
\`\`\`tsx
|
|
152
|
+
<Card padding="var(--ggui-spacing-4)" shadow="md">
|
|
153
|
+
<Stack gap="var(--ggui-spacing-3)">
|
|
154
|
+
<Heading level={3}>Title</Heading>
|
|
155
|
+
<Text tone="muted">Description</Text>
|
|
156
|
+
</Stack>
|
|
157
|
+
</Card>
|
|
158
|
+
\`\`\`
|
|
159
|
+
|
|
160
|
+
### Color usage guide
|
|
161
|
+
- **Layering roles** (ground, container, elevated, sunken + their on* inks; outline): one kind of AREA each \u2014 use them for every background/text/border decision; they adapt to any theme
|
|
162
|
+
- **primary-50/100**: Section backgrounds, highlight strips, card headers
|
|
163
|
+
- **primary-200/300**: Dividers and section rules \u2014 never a control's border: kit controls draw their own edge (\`controlOutline\` / \`controlAccentOutline\`), so set no inline border on them
|
|
164
|
+
- **primary-500/600**: Filled buttons, CTAs, badges, icon fills, active indicators \u2014 fills and borders, NOT a text color
|
|
165
|
+
- **link**: Accent TEXT \u2014 eyebrows, taglines, links, labels, inline arrows; the brand's readable ink per mode (a bare \`primary-300\u2026600\` as a text color fails tier-0: \`universal.accent_text_ink\`)
|
|
166
|
+
- **primary-700/800/900**: Headings and text on light primary backgrounds
|
|
167
|
+
- **neutral-***: Only when you need a specific shade that semantic tokens don't cover
|
|
168
|
+
|
|
169
|
+
The primary palette is the app's brand \u2014 use it throughout (headers, accents, borders, interactive elements), not just on the submit button.
|
|
170
|
+
|
|
171
|
+
**Note:** Do NOT add fallback values to var() (e.g., var(--ggui-color-container, #fafafa)). Just use var(--ggui-color-container) \u2014 the theme provides all values.
|
|
172
|
+
|
|
173
|
+
## Motion & Animation
|
|
174
|
+
|
|
175
|
+
### Duration Scale
|
|
176
|
+
- \`instant\`: 0ms
|
|
177
|
+
- \`fast\`: 100ms
|
|
178
|
+
- \`normal\`: 200ms
|
|
179
|
+
- \`slow\`: 300ms
|
|
180
|
+
- \`slower\`: 500ms
|
|
181
|
+
|
|
182
|
+
### Easing Curves
|
|
183
|
+
- \`linear\`: linear
|
|
184
|
+
- \`easeIn\`: cubic-bezier(0.4, 0, 1, 1)
|
|
185
|
+
- \`easeOut\`: cubic-bezier(0, 0, 0.2, 1)
|
|
186
|
+
- \`easeInOut\`: cubic-bezier(0.4, 0, 0.2, 1)
|
|
187
|
+
- \`spring\`: cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
188
|
+
|
|
189
|
+
### Transition Presets (import from '@ggui-ai/design/tokens')
|
|
190
|
+
\`\`\`tsx
|
|
191
|
+
import { duration, easing, transition } from '@ggui-ai/design/tokens';
|
|
192
|
+
// transition.fast \u2192 "100ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
193
|
+
// transition.normal \u2192 "200ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
194
|
+
// transition.slow \u2192 "300ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
195
|
+
// transition.colors \u2192 color + background-color + border-color (200ms each)
|
|
196
|
+
// transition.opacity \u2192 opacity 200ms
|
|
197
|
+
// transition.transform \u2192 transform 200ms
|
|
198
|
+
\`\`\`
|
|
199
|
+
|
|
200
|
+
### Animation Keyframes
|
|
201
|
+
Use \`<MotionKeyframes />\` once in your component to inject all keyframes, then reference by name.
|
|
202
|
+
|
|
203
|
+
**Entrance / exit** (GPU-composited, transform + opacity):
|
|
204
|
+
- \`ggui-fadeIn\` / \`ggui-fadeOut\`
|
|
205
|
+
- \`ggui-slideInUp\` / \`ggui-slideInDown\`
|
|
206
|
+
- \`ggui-scaleIn\` / \`ggui-scaleOut\`
|
|
207
|
+
|
|
208
|
+
**State feedback** (color-based, for data-change highlights):
|
|
209
|
+
- \`ggui-flash\` \u2014 background-color highlight that fades out. Set \`--ggui-flash-color\` on the element (default: \`var(--ggui-color-primary-100)\`)
|
|
210
|
+
- \`ggui-pulse\` \u2014 gentle opacity breathing (infinite, for "live" indicators)
|
|
211
|
+
- \`ggui-bounce\` \u2014 subtle scale overshoot (one-shot, for confirmations)
|
|
212
|
+
|
|
213
|
+
\`\`\`tsx
|
|
214
|
+
import { MotionKeyframes, useMotion, useAnimationKey } from '@ggui-ai/design';
|
|
215
|
+
import { animation } from '@ggui-ai/design/tokens';
|
|
216
|
+
|
|
217
|
+
function MyComponent() {
|
|
218
|
+
const { motionEnabled } = useMotion(); // respects prefers-reduced-motion
|
|
219
|
+
return (
|
|
220
|
+
<>
|
|
221
|
+
<MotionKeyframes />
|
|
222
|
+
{/* Entrance animation */}
|
|
223
|
+
<div style={{ animation: motionEnabled ? animation.slideInUp : 'none' }}>
|
|
224
|
+
Content slides in
|
|
225
|
+
</div>
|
|
226
|
+
</>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
\`\`\`
|
|
230
|
+
|
|
231
|
+
### Retriggering Animations on Data Changes
|
|
232
|
+
When data updates (e.g., stock price from a stream), CSS animations don't replay automatically.
|
|
233
|
+
Use \`useAnimationKey(dep)\` \u2014 returns a key that increments when \`dep\` changes, causing React to remount the element and replay the animation.
|
|
234
|
+
|
|
235
|
+
\`\`\`tsx
|
|
236
|
+
import { MotionKeyframes, useAnimationKey } from '@ggui-ai/design';
|
|
237
|
+
import { animation } from '@ggui-ai/design/tokens';
|
|
238
|
+
|
|
239
|
+
// Flash a stock card green/red when the price changes
|
|
240
|
+
const priceKey = useAnimationKey(stock.price);
|
|
241
|
+
<div
|
|
242
|
+
key={priceKey}
|
|
243
|
+
style={{
|
|
244
|
+
animation: animation.flash,
|
|
245
|
+
'--ggui-flash-color': stock.change > 0
|
|
246
|
+
? 'var(--ggui-color-success-100)'
|
|
247
|
+
: 'var(--ggui-color-error-100)',
|
|
248
|
+
} as React.CSSProperties}
|
|
249
|
+
>
|
|
250
|
+
{stock.price}
|
|
251
|
+
</div>
|
|
252
|
+
\`\`\`
|
|
253
|
+
|
|
254
|
+
## Chart / Data Visualization Colors
|
|
255
|
+
Semantic chart tokens for data visualizations:
|
|
256
|
+
- \`var(--ggui-color-primary-600)\` \u2014 primary series
|
|
257
|
+
- \`var(--ggui-color-success-500)\` \u2014 positive / success
|
|
258
|
+
- \`var(--ggui-color-error-500)\` \u2014 negative / error
|
|
259
|
+
- \`var(--ggui-color-warning-500)\` \u2014 warning / caution
|
|
260
|
+
- \`var(--ggui-color-info-500)\` \u2014 informational
|
|
261
|
+
- \`var(--ggui-color-neutral-400)\` \u2014 neutral series
|
|
262
|
+
- \`var(--ggui-color-neutral-200)\` \u2014 light background series
|
|
263
|
+
- \`var(--ggui-color-neutral-600)\` \u2014 dark series
|
|
264
|
+
|
|
265
|
+
## Accessibility Tokens
|
|
266
|
+
|
|
267
|
+
### Focus Ring (for keyboard focus states)
|
|
268
|
+
- Color: \`var(--ggui-color-primary-600)\`
|
|
269
|
+
- Width: 2px
|
|
270
|
+
- Offset: 2px
|
|
271
|
+
- Style: solid
|
|
272
|
+
\`\`\`tsx
|
|
273
|
+
// Apply to focusable elements:
|
|
274
|
+
outline: '2px solid var(--ggui-color-primary-600)',
|
|
275
|
+
outlineOffset: '2px',
|
|
276
|
+
\`\`\`
|
|
277
|
+
|
|
278
|
+
### Reduced Motion
|
|
279
|
+
Use \`useMotion()\` hook to check user preference. If disabled, set animation/transition to \`none\`.
|
|
280
|
+
|
|
281
|
+
## Elevation System
|
|
282
|
+
Semantic depth levels combining shadow + z-index:
|
|
283
|
+
| Level | Shadow | Z-Index | Use For |
|
|
284
|
+
|-------|--------|---------|---------|
|
|
285
|
+
| 0 | none | 0 | Flat content |
|
|
286
|
+
| 1 | sm | auto | Cards, slight lift |
|
|
287
|
+
| 2 | md | 1000 | Dropdowns, popovers |
|
|
288
|
+
| 3 | lg | 1200 | Banners, sticky bars |
|
|
289
|
+
| 4 | xl | 1400 | Modals, dialogs |
|
|
290
|
+
| 5 | 2xl | 1800 | Tooltips, toasts |
|
|
291
|
+
|
|
292
|
+
\`\`\`tsx
|
|
293
|
+
import { elevation } from '@ggui-ai/design/tokens';
|
|
294
|
+
// elevation.level1 \u2192 { shadow: 'var(--ggui-shape-shadow-sm)', zIndex: 'auto' }
|
|
295
|
+
// elevation.level2 \u2192 { shadow: 'var(--ggui-shape-shadow-md)', zIndex: 1000 }
|
|
296
|
+
<div style={{ boxShadow: elevation.level1.shadow, zIndex: elevation.level1.zIndex }}>
|
|
297
|
+
Card content
|
|
298
|
+
</div>
|
|
299
|
+
\`\`\`
|
|
300
|
+
|
|
301
|
+
## Typography Presets
|
|
302
|
+
|
|
303
|
+
### Heading Styles (import { headingStyles } from '@ggui-ai/design/tokens')
|
|
304
|
+
| Level | Size | Weight | Line Height | Letter Spacing |
|
|
305
|
+
|-------|------|--------|-------------|----------------|
|
|
306
|
+
| h1 | 36px | bold (700) | 1.25 | -0.025em |
|
|
307
|
+
| h2 | 30px | bold (700) | 1.25 | -0.025em |
|
|
308
|
+
| h3 | 24px | semibold (600) | 1.375 | 0 |
|
|
309
|
+
| h4 | 20px | semibold (600) | 1.375 | 0 |
|
|
310
|
+
| h5 | 18px | semibold (600) | 1.5 | 0 |
|
|
311
|
+
| h6 | 16px | semibold (600) | 1.5 | 0 |
|
|
312
|
+
|
|
313
|
+
### Text Sizing
|
|
314
|
+
\`<Text>\` composes from \`size\` / \`weight\` / \`tone\` (+ \`caps\` for the
|
|
315
|
+
uppercase eyebrow look) \u2014 there is no preset text-style table. Line
|
|
316
|
+
height derives from \`size\` automatically (1.5 for xs-base, 1.625 at lg,
|
|
317
|
+
tighter on display sizes).
|
|
318
|
+
|
|
319
|
+
### Letter Spacing Scale
|
|
320
|
+
- \`tighter\`: -0.05em
|
|
321
|
+
- \`tight\`: -0.025em
|
|
322
|
+
- \`normal\`: 0
|
|
323
|
+
- \`wide\`: 0.025em
|
|
324
|
+
- \`wider\`: 0.05em
|
|
325
|
+
- \`widest\`: 0.1em
|
|
326
|
+
|
|
327
|
+
### Line Height Scale
|
|
328
|
+
- \`none\`: 1
|
|
329
|
+
- \`tight\`: 1.25
|
|
330
|
+
- \`snug\`: 1.375
|
|
331
|
+
- \`normal\`: 1.5
|
|
332
|
+
- \`relaxed\`: 1.625
|
|
333
|
+
- \`loose\`: 2`;
|
|
334
|
+
|
|
335
|
+
export { DEFAULT_DESIGN_SYSTEM_DOCS };
|
|
336
|
+
//# sourceMappingURL=chunk-56NJFD55.js.map
|
|
337
|
+
//# sourceMappingURL=chunk-56NJFD55.js.map
|