@agent-native/core 0.80.9 → 0.80.11
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/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +13 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/production-agent.ts +108 -15
- package/corpus/core/src/cli/design-connect.ts +28 -2
- package/corpus/core/src/cli/skills.ts +45 -24
- package/corpus/core/src/client/AssistantChat.tsx +123 -26
- package/corpus/core/src/client/sse-event-processor.ts +9 -0
- package/corpus/templates/assets/.agents/skills/image-generation/SKILL.md +9 -2
- package/corpus/templates/assets/AGENTS.md +4 -0
- package/corpus/templates/assets/actions/_tool-activity.ts +46 -0
- package/corpus/templates/assets/actions/generate-image-batch.ts +26 -5
- package/corpus/templates/assets/actions/generate-image.ts +118 -67
- package/corpus/templates/assets/actions/list-draft-assets.ts +50 -0
- package/corpus/templates/assets/actions/rerun-generation-run.ts +52 -31
- package/corpus/templates/assets/app/components/create/RecentDraftsSection.tsx +100 -0
- package/corpus/templates/assets/app/i18n/zh-TW.ts +7 -0
- package/corpus/templates/assets/app/i18n-data.ts +61 -0
- package/corpus/templates/assets/app/routes/_index.tsx +4 -0
- package/corpus/templates/assets/app/routes/library.tsx +145 -38
- package/corpus/templates/assets/changelog/2026-06-29-image-generation-can-now-render-requested-text-and-respect-b.md +6 -0
- package/corpus/templates/assets/changelog/2026-06-30-image-generation-no-longer-looks-stuck-while-the-provider-is-still-working.md +6 -0
- package/corpus/templates/assets/changelog/2026-06-30-tagged-presets-now-control-the-image-aspect-ratio.md +6 -0
- package/corpus/templates/assets/server/lib/generation.ts +135 -11
- package/corpus/templates/assets/shared/api.ts +4 -0
- package/corpus/templates/clips/actions/list-ai-requests.ts +60 -0
- package/corpus/templates/clips/app/hooks/use-auto-title.ts +24 -25
- package/corpus/templates/design/DESIGN-STUDIO-PLAN.md +717 -0
- package/corpus/templates/design/actions/add-breakpoint.ts +143 -0
- package/corpus/templates/design/actions/add-localhost-screens.ts +5 -0
- package/corpus/templates/design/actions/apply-a11y-fix.ts +317 -0
- package/corpus/templates/design/actions/apply-component-prop-edit.ts +441 -0
- package/corpus/templates/design/actions/apply-design-state.ts +213 -0
- package/corpus/templates/design/actions/apply-design-token-edit.ts +202 -0
- package/corpus/templates/design/actions/apply-motion-edit.ts +413 -0
- package/corpus/templates/design/actions/apply-shader-fill.ts +404 -0
- package/corpus/templates/design/actions/apply-visual-edit.ts +191 -5
- package/corpus/templates/design/actions/capture-design-state.ts +224 -0
- package/corpus/templates/design/actions/connect-builder-app.ts +162 -0
- package/corpus/templates/design/actions/create-component.ts +447 -0
- package/corpus/templates/design/actions/create-design-branch.ts +263 -0
- package/corpus/templates/design/actions/create-design-state.ts +162 -0
- package/corpus/templates/design/actions/delete-design-state.ts +55 -0
- package/corpus/templates/design/actions/delete-design.ts +20 -0
- package/corpus/templates/design/actions/deploy-design-preview.ts +275 -0
- package/corpus/templates/design/actions/get-component-details.ts +251 -0
- package/corpus/templates/design/actions/get-design-branch-diff.ts +362 -0
- package/corpus/templates/design/actions/get-design-review.ts +314 -0
- package/corpus/templates/design/actions/get-design-surface-index.ts +582 -0
- package/corpus/templates/design/actions/get-motion-timeline.ts +99 -0
- package/corpus/templates/design/actions/index-components.ts +258 -0
- package/corpus/templates/design/actions/index-design-tokens.ts +277 -0
- package/corpus/templates/design/actions/list-design-extensions.ts +309 -0
- package/corpus/templates/design/actions/list-design-source-capabilities.ts +153 -0
- package/corpus/templates/design/actions/list-design-states.ts +90 -0
- package/corpus/templates/design/actions/migrate-inline-design-to-app.ts +298 -0
- package/corpus/templates/design/actions/open-component-source.ts +242 -0
- package/corpus/templates/design/actions/preview-component-prop-edit.ts +260 -0
- package/corpus/templates/design/actions/preview-design-token-edit.ts +113 -0
- package/corpus/templates/design/actions/preview-shader-fill.ts +187 -0
- package/corpus/templates/design/actions/remove-breakpoint.ts +103 -0
- package/corpus/templates/design/actions/remove-motion-timeline.ts +196 -0
- package/corpus/templates/design/actions/run-design-audit.ts +436 -0
- package/corpus/templates/design/actions/run-design-extension-action.ts +284 -0
- package/corpus/templates/design/actions/set-active-breakpoint.ts +39 -0
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +1550 -82
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +649 -43
- package/corpus/templates/design/app/components/design/DrawOverlay.tsx +1 -1
- package/corpus/templates/design/app/components/design/EditPanel.tsx +1788 -52
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +114 -33
- package/corpus/templates/design/app/components/design/LocalSourceEditBanner.tsx +157 -0
- package/corpus/templates/design/app/components/design/MotionDock.tsx +1071 -0
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +1053 -99
- package/corpus/templates/design/app/components/design/ReviewPanel.tsx +766 -0
- package/corpus/templates/design/app/components/design/StatesPanel.tsx +581 -0
- package/corpus/templates/design/app/components/design/TokensPanel.tsx +578 -0
- package/corpus/templates/design/app/components/design/canvas-primitive-style.ts +241 -0
- package/corpus/templates/design/app/components/design/index.ts +16 -0
- package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +15 -6
- package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +66 -3
- package/corpus/templates/design/app/components/design/inspector/InspectorAiActions.tsx +145 -0
- package/corpus/templates/design/app/components/design/inspector/SHADER_INTEGRATION.md +42 -12
- package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +1 -1
- package/corpus/templates/design/app/hooks/useAgentEditRequest.ts +131 -0
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +3 -1
- package/corpus/templates/design/app/i18n/zh-TW.ts +32 -0
- package/corpus/templates/design/app/i18n-data.ts +280 -0
- package/corpus/templates/design/app/pages/DesignEditor.tsx +3087 -490
- package/corpus/templates/design/changelog/2026-06-29-added-a-review-panel-in-the-design-editor-s-inspector-with-a.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-copying-and-pasting-layers-no-longer-shows-success-notificat.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-device-presets-in-all-screens-view-resize-the-selected-previ.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-layer-and-canvas-drags-keep-the-layer-list-stable-while-chan.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-layer-moves-can-be-undone-and-redone-without-flashing-the-ca.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-previews-use-a-single-blue-hover-border-in-all-screen.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-selected-containers-show-draggable-padding-and-gap-guides-on.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-the-design-editor-adds-a-studio-layer-with-tokens-respon.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-accessibility-findings-now-offer-a-one-click-fix.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-component-instances-now-have-editable-props-in-the-inspe.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-design-token-edits-now-stay-visible-in-previews-and-token-li.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-inspect-code-now-shows-the-elements-opening-tag-at-a-gla.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-shader-fill-presets-can-now-be-applied-to-an-element.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-motion-timeline-can-now-add-a-track-to-any-element-a.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-visual-editor-selection-layer-paint-and-drawing-controls-are-more-reliable.md +6 -0
- package/corpus/templates/design/e2e/global-setup.ts +94 -2
- package/corpus/templates/design/e2e/helpers.ts +10 -4
- package/corpus/templates/design/server/db/schema.ts +123 -0
- package/corpus/templates/design/server/plugins/db.ts +90 -0
- package/corpus/templates/design/shared/builder-app.ts +297 -0
- package/corpus/templates/design/shared/capability-resolver.ts +123 -0
- package/corpus/templates/design/shared/capture-sanitize.ts +70 -0
- package/corpus/templates/design/shared/code-layer.ts +1016 -71
- package/corpus/templates/design/shared/component-model.ts +274 -0
- package/corpus/templates/design/shared/design-review.ts +275 -0
- package/corpus/templates/design/shared/design-source-capabilities.ts +286 -0
- package/corpus/templates/design/shared/design-state.ts +112 -0
- package/corpus/templates/design/shared/design-surface-index.ts +258 -0
- package/corpus/templates/design/shared/motion-compiler.ts +349 -0
- package/corpus/templates/design/shared/motion-timeline.ts +193 -0
- package/corpus/templates/design/shared/resolve-tweaks.ts +32 -9
- package/corpus/templates/design/shared/responsive-classes.ts +452 -0
- package/corpus/templates/design/shared/shader-fill.ts +323 -0
- package/corpus/templates/design/shared/source-mode.ts +245 -0
- package/corpus/templates/plan/app/components/plan/CanvasArea.tsx +6 -2
- package/corpus/templates/plan/changelog/2026-06-29-plan-canvases-open-without-an-initial-pan-and-zoom-flicker.md +6 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +94 -10
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/cli/design-connect.d.ts.map +1 -1
- package/dist/cli/design-connect.js +28 -2
- package/dist/cli/design-connect.js.map +1 -1
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +37 -21
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +14 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +115 -22
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +10 -0
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/observability/routes.d.ts +8 -8
- package/dist/resources/handlers.d.ts +2 -2
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: added
|
|
3
|
+
date: 2026-06-29
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
The Design editor gains a Studio layer — design tokens, multi-breakpoint responsive editing, code-backed components with Create component and Inspect code, accessibility and visual-diff review, and a Builder-powered real-app tier — with each capability gated to what the design's source can safely support.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
|
|
4
|
+
import { createClient } from "@libsql/client";
|
|
4
5
|
import { chromium, type FullConfig } from "@playwright/test";
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -19,6 +20,12 @@ const AUTH_DIR = path.join(import.meta.dirname, ".auth");
|
|
|
19
20
|
const STATE_PATH = path.join(AUTH_DIR, "state.json");
|
|
20
21
|
const SEED_PATH = path.join(AUTH_DIR, "seed.json");
|
|
21
22
|
const BROWSER_CHANNEL = process.env.E2E_BROWSER_CHANNEL;
|
|
23
|
+
const E2E_DATABASE_URL = `file:${path.join(
|
|
24
|
+
import.meta.dirname,
|
|
25
|
+
"..",
|
|
26
|
+
"data",
|
|
27
|
+
"e2e.db",
|
|
28
|
+
)}`;
|
|
22
29
|
|
|
23
30
|
/**
|
|
24
31
|
* Fixture HTML with distinct, text-identifiable elements. Plain inline styles
|
|
@@ -31,6 +38,12 @@ export const FIXTURE_HTML = `<!doctype html>
|
|
|
31
38
|
<meta charset="utf-8" />
|
|
32
39
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
33
40
|
<title>E2E Fixture</title>
|
|
41
|
+
<style>
|
|
42
|
+
:root {
|
|
43
|
+
--e2e-accent-color: #6366f1;
|
|
44
|
+
--e2e-radius: 14px;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
34
47
|
</head>
|
|
35
48
|
<body style="margin:0;font-family:system-ui,sans-serif;background:#0f1115;color:#f4f4f5">
|
|
36
49
|
<main style="max-width:720px;margin:0 auto;padding:48px 32px;display:flex;flex-direction:column;gap:24px">
|
|
@@ -38,8 +51,26 @@ export const FIXTURE_HTML = `<!doctype html>
|
|
|
38
51
|
<p style="font-size:18px;line-height:1.6;margin:0;color:#a1a1aa">First fixture paragraph for selection tests.</p>
|
|
39
52
|
<p style="font-size:18px;line-height:1.6;margin:0;color:#a1a1aa">Second fixture paragraph for selection tests.</p>
|
|
40
53
|
<div style="display:flex;flex-direction:row;gap:16px">
|
|
41
|
-
<button style="padding:14px 28px;border-radius:10px;border:0;background:#6366f1;color:#fff;font-size:16px">Alpha Button</button>
|
|
42
|
-
<button style="padding:14px 28px;border-radius:10px;border:0;background:#22c55e;color:#06240f;font-size:16px">Beta Button</button>
|
|
54
|
+
<button data-agent-native-node-id="e2e-alpha-button" data-agent-native-layer-name="Alpha Button" style="padding:14px 28px;border-radius:10px;border:0;background:#6366f1;color:#fff;font-size:16px">Alpha Button</button>
|
|
55
|
+
<button data-agent-native-node-id="e2e-beta-button" data-agent-native-layer-name="Beta Button" style="padding:14px 28px;border-radius:10px;border:0;background:#22c55e;color:#06240f;font-size:16px">Beta Button</button>
|
|
56
|
+
</div>
|
|
57
|
+
<button
|
|
58
|
+
data-agent-native-node-id="e2e-component-button"
|
|
59
|
+
data-agent-native-layer-name="E2E Component Button"
|
|
60
|
+
data-agent-native-component="E2EButton"
|
|
61
|
+
data-agent-native-prop-variant="primary"
|
|
62
|
+
data-agent-native-prop-size="md"
|
|
63
|
+
style="align-self:flex-start;padding:14px 28px;border-radius:var(--e2e-radius);border:0;background:var(--e2e-accent-color);color:#fff;font-size:16px"
|
|
64
|
+
>Variant CTA</button>
|
|
65
|
+
<div
|
|
66
|
+
data-agent-native-node-id="e2e-token-sample"
|
|
67
|
+
data-agent-native-layer-name="E2E Token Sample"
|
|
68
|
+
style="padding:18px 20px;border-radius:var(--e2e-radius);background:var(--e2e-accent-color);color:#fff;font-weight:700"
|
|
69
|
+
>Token swatch sample</div>
|
|
70
|
+
<div style="display:flex;align-items:center;gap:12px">
|
|
71
|
+
<img data-agent-native-node-id="e2e-audit-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==" style="width:32px;height:32px;border-radius:8px;background:#27272a" />
|
|
72
|
+
<input data-agent-native-node-id="e2e-audit-input" placeholder="Email" style="height:32px;border-radius:8px;border:1px solid #3f3f46;background:#18181b;color:#fff;padding:0 10px" />
|
|
73
|
+
<button data-agent-native-node-id="e2e-audit-focus-button" class="outline-none" style="height:32px;border-radius:8px;border:1px solid #3f3f46;background:#27272a;color:#fff;padding:0 10px">Focus me</button>
|
|
43
74
|
</div>
|
|
44
75
|
<div style="padding:8px;border:1px solid #27272a;border-radius:12px">
|
|
45
76
|
<div style="padding:8px;border:1px solid #3f3f46;border-radius:10px">
|
|
@@ -76,6 +107,63 @@ async function postAction(
|
|
|
76
107
|
return res.json();
|
|
77
108
|
}
|
|
78
109
|
|
|
110
|
+
function componentIndexId(designId: string, name: string): string {
|
|
111
|
+
return `ci_${designId}_${name.toLowerCase().replace(/[^a-z0-9]/g, "_")}`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export async function seedComponentVariantMetadata(
|
|
115
|
+
designId: string,
|
|
116
|
+
): Promise<void> {
|
|
117
|
+
const client = createClient({ url: E2E_DATABASE_URL });
|
|
118
|
+
const name = "E2EButton";
|
|
119
|
+
const now = new Date().toISOString();
|
|
120
|
+
const variants = JSON.stringify({
|
|
121
|
+
variant: ["primary", "secondary", "ghost"],
|
|
122
|
+
size: ["sm", "md", "lg"],
|
|
123
|
+
});
|
|
124
|
+
const props = JSON.stringify([
|
|
125
|
+
{ name: "variant", type: "primary | secondary | ghost" },
|
|
126
|
+
{ name: "size", type: "sm | md | lg" },
|
|
127
|
+
]);
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
const result = await client.execute({
|
|
131
|
+
sql: `
|
|
132
|
+
UPDATE component_index
|
|
133
|
+
SET variants = ?, props = ?, file_path = ?, export_name = ?, updated_at = ?
|
|
134
|
+
WHERE design_id = ? AND name = ?
|
|
135
|
+
`,
|
|
136
|
+
args: [variants, props, "index.html", name, now, designId, name],
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
if (result.rowsAffected > 0) return;
|
|
140
|
+
|
|
141
|
+
await client.execute({
|
|
142
|
+
sql: `
|
|
143
|
+
INSERT INTO component_index (
|
|
144
|
+
id, design_id, name, file_path, export_name, props, variants,
|
|
145
|
+
runtime_selectors, owner_email, created_at, updated_at
|
|
146
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
147
|
+
`,
|
|
148
|
+
args: [
|
|
149
|
+
componentIndexId(designId, name),
|
|
150
|
+
designId,
|
|
151
|
+
name,
|
|
152
|
+
"index.html",
|
|
153
|
+
name,
|
|
154
|
+
props,
|
|
155
|
+
variants,
|
|
156
|
+
JSON.stringify(['[data-agent-native-node-id="e2e-component-button"]']),
|
|
157
|
+
E2E_EMAIL,
|
|
158
|
+
now,
|
|
159
|
+
now,
|
|
160
|
+
],
|
|
161
|
+
});
|
|
162
|
+
} finally {
|
|
163
|
+
client.close();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
79
167
|
export default async function globalSetup(config: FullConfig) {
|
|
80
168
|
const baseURL =
|
|
81
169
|
(config.projects[0]?.use?.baseURL as string | undefined) ??
|
|
@@ -148,6 +236,10 @@ export default async function globalSetup(config: FullConfig) {
|
|
|
148
236
|
content: FIXTURE_HTML,
|
|
149
237
|
fileType: "html",
|
|
150
238
|
});
|
|
239
|
+
await postAction(context.request, baseURL, "index-components", {
|
|
240
|
+
designId,
|
|
241
|
+
});
|
|
242
|
+
await seedComponentVariantMetadata(designId);
|
|
151
243
|
|
|
152
244
|
await writeFile(SEED_PATH, JSON.stringify({ designId }, null, 2));
|
|
153
245
|
// eslint-disable-next-line no-console
|
|
@@ -25,8 +25,10 @@ export async function readSeedDesignId(): Promise<string> {
|
|
|
25
25
|
return designId;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
const DESIGN_PREVIEW_IFRAME_SELECTOR = "iframe[data-design-preview-iframe]";
|
|
29
|
+
|
|
28
30
|
export function designFrame(page: Page): FrameLocator {
|
|
29
|
-
return page.
|
|
31
|
+
return page.locator(DESIGN_PREVIEW_IFRAME_SELECTOR).first().contentFrame();
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
/** Open the editor for a design and wait for the toolbar + iframe to be ready. */
|
|
@@ -40,7 +42,7 @@ export async function gotoEditor(page: Page, designId: string): Promise<void> {
|
|
|
40
42
|
|
|
41
43
|
async function waitForDesignBridgeReady(page: Page): Promise<void> {
|
|
42
44
|
await expect(
|
|
43
|
-
page.locator(
|
|
45
|
+
page.locator(DESIGN_PREVIEW_IFRAME_SELECTOR).first(),
|
|
44
46
|
).toBeVisible();
|
|
45
47
|
await expect(
|
|
46
48
|
designFrame(page).locator('[data-agent-native-edit-overlay="shield"]'),
|
|
@@ -71,8 +73,12 @@ export async function enterDirectMode(page: Page): Promise<void> {
|
|
|
71
73
|
await expect
|
|
72
74
|
.poll(
|
|
73
75
|
async () =>
|
|
74
|
-
(
|
|
75
|
-
|
|
76
|
+
(
|
|
77
|
+
await page
|
|
78
|
+
.locator(DESIGN_PREVIEW_IFRAME_SELECTOR)
|
|
79
|
+
.first()
|
|
80
|
+
.boundingBox()
|
|
81
|
+
)?.width ?? 0,
|
|
76
82
|
{ timeout: 10_000 },
|
|
77
83
|
)
|
|
78
84
|
.toBeGreaterThan(600);
|
|
@@ -81,3 +81,126 @@ export const designLocalhostConnections = table(
|
|
|
81
81
|
updatedAt: text("updated_at").default(now()),
|
|
82
82
|
},
|
|
83
83
|
);
|
|
84
|
+
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
// New tables — additive only; never alter existing tables.
|
|
87
|
+
// All ownable tables are read/written through accessFilter / assertAccess.
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Real-app component metadata indexed from TS prop types, cva/tailwind-variants
|
|
92
|
+
* variants, and Storybook stories. Scoped to one design + source ref.
|
|
93
|
+
*/
|
|
94
|
+
export const componentIndex = table("component_index", {
|
|
95
|
+
id: text("id").primaryKey(),
|
|
96
|
+
designId: text("design_id").notNull(),
|
|
97
|
+
/** Opaque string identifying the source connection (localhost bridge id, fusion project id, etc.) */
|
|
98
|
+
sourceRef: text("source_ref"),
|
|
99
|
+
name: text("name").notNull(),
|
|
100
|
+
filePath: text("file_path"),
|
|
101
|
+
exportName: text("export_name"),
|
|
102
|
+
/** JSON: parsed prop types / cva variant definitions */
|
|
103
|
+
props: text("props"),
|
|
104
|
+
/** JSON: variant groups (size, color, state, …) */
|
|
105
|
+
variants: text("variants"),
|
|
106
|
+
/** JSON: Storybook stories referencing this component */
|
|
107
|
+
stories: text("stories"),
|
|
108
|
+
/** JSON: runtime CSS selectors used to outline instances on the canvas */
|
|
109
|
+
runtimeSelectors: text("runtime_selectors"),
|
|
110
|
+
createdAt: text("created_at").default(now()),
|
|
111
|
+
updatedAt: text("updated_at").default(now()),
|
|
112
|
+
...ownableColumns(),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Motion timeline — scoped to one design + source ref + screen/file.
|
|
117
|
+
* A design may have many timelines (one per screen or animation target).
|
|
118
|
+
* The compiled CSS is the runtime truth; tracks JSON aids editing only.
|
|
119
|
+
*/
|
|
120
|
+
export const motionTimeline = table("motion_timeline", {
|
|
121
|
+
id: text("id").primaryKey(),
|
|
122
|
+
designId: text("design_id").notNull(),
|
|
123
|
+
/** Opaque source connection ref; null for inline designs. */
|
|
124
|
+
sourceRef: text("source_ref"),
|
|
125
|
+
/** File path for real-app CSS modules; null for inline (managed <style> block). */
|
|
126
|
+
filePath: text("file_path"),
|
|
127
|
+
/**
|
|
128
|
+
* JSON array of track objects:
|
|
129
|
+
* [{ target_node_id, property, keyframes: [{ t, value, ease }] }]
|
|
130
|
+
*/
|
|
131
|
+
tracks: text("tracks").notNull().default("[]"),
|
|
132
|
+
/** Total animation duration in milliseconds. */
|
|
133
|
+
durationMs: integer("duration_ms").notNull().default(300),
|
|
134
|
+
/** Default easing function name (e.g. "ease", "ease-in-out", "linear"). */
|
|
135
|
+
defaultEase: text("default_ease").notNull().default("ease"),
|
|
136
|
+
/**
|
|
137
|
+
* Hash of the compiled CSS output; used to detect drift between the tracks
|
|
138
|
+
* JSON and the compiled CSS block. apply-motion-edit updates both atomically.
|
|
139
|
+
*/
|
|
140
|
+
compiledHash: text("compiled_hash"),
|
|
141
|
+
createdAt: text("created_at").default(now()),
|
|
142
|
+
updatedAt: text("updated_at").default(now()),
|
|
143
|
+
...ownableColumns(),
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Design states, fixtures, and live captures.
|
|
148
|
+
* States are alternate x-data / DOM snapshots (e.g. Default, Loading, Empty).
|
|
149
|
+
* Fixtures hold static data payloads for real-app preview.
|
|
150
|
+
* Captures are live snapshots of a running app's route + props + API data.
|
|
151
|
+
*/
|
|
152
|
+
export const designState = table("design_state", {
|
|
153
|
+
id: text("id").primaryKey(),
|
|
154
|
+
designId: text("design_id").notNull(),
|
|
155
|
+
/** Opaque source connection ref. */
|
|
156
|
+
sourceRef: text("source_ref"),
|
|
157
|
+
name: text("name").notNull(),
|
|
158
|
+
/** 'state' | 'fixture' | 'capture' */
|
|
159
|
+
kind: text("kind", { enum: ["state", "fixture", "capture"] })
|
|
160
|
+
.notNull()
|
|
161
|
+
.default("state"),
|
|
162
|
+
/** Active breakpoint when this state was created: 'auto' | 'desktop' | 'tablet' | 'mobile' */
|
|
163
|
+
breakpoint: text("breakpoint", {
|
|
164
|
+
enum: ["auto", "desktop", "tablet", "mobile"],
|
|
165
|
+
})
|
|
166
|
+
.notNull()
|
|
167
|
+
.default("auto"),
|
|
168
|
+
/** Route path captured (real-app captures only). */
|
|
169
|
+
route: text("route"),
|
|
170
|
+
/** JSON: static data fixture payload (fixture kind). */
|
|
171
|
+
fixtureData: text("fixture_data"),
|
|
172
|
+
/** JSON: live-captured route props + API response (capture kind). */
|
|
173
|
+
captureData: text("capture_data"),
|
|
174
|
+
/** Opaque reference to a design_version snapshot or stored preview artifact. */
|
|
175
|
+
previewRef: text("preview_ref"),
|
|
176
|
+
createdAt: text("created_at").default(now()),
|
|
177
|
+
updatedAt: text("updated_at").default(now()),
|
|
178
|
+
...ownableColumns(),
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Cached accessibility audit + visual diff results for a design.
|
|
183
|
+
* Keyed by design + optional base/compare design_versions pair + source ref.
|
|
184
|
+
* status: 'pending' | 'ready' | 'error'
|
|
185
|
+
*/
|
|
186
|
+
export const designReviewSnapshot = table("design_review_snapshot", {
|
|
187
|
+
id: text("id").primaryKey(),
|
|
188
|
+
designId: text("design_id").notNull(),
|
|
189
|
+
/** design_versions.id for the base (older) snapshot in a diff. */
|
|
190
|
+
baseVersionId: text("base_version_id"),
|
|
191
|
+
/** design_versions.id for the compare (newer) snapshot in a diff. */
|
|
192
|
+
compareVersionId: text("compare_version_id"),
|
|
193
|
+
/** Opaque source connection ref. */
|
|
194
|
+
sourceRef: text("source_ref"),
|
|
195
|
+
/** JSON: array of a11y findings (contrast, tap targets, roles, alt, focus). */
|
|
196
|
+
a11yFindings: text("a11y_findings"),
|
|
197
|
+
/** JSON: visual diff surface data (changed regions, before/after refs). */
|
|
198
|
+
visualDiff: text("visual_diff"),
|
|
199
|
+
/** 'pending' | 'ready' | 'error' */
|
|
200
|
+
status: text("status", { enum: ["pending", "ready", "error"] })
|
|
201
|
+
.notNull()
|
|
202
|
+
.default("pending"),
|
|
203
|
+
createdAt: text("created_at").default(now()),
|
|
204
|
+
updatedAt: text("updated_at").default(now()),
|
|
205
|
+
...ownableColumns(),
|
|
206
|
+
});
|
|
@@ -121,6 +121,96 @@ CREATE INDEX IF NOT EXISTS design_systems_owner_org_updated_idx ON design_system
|
|
|
121
121
|
CREATE INDEX IF NOT EXISTS design_shares_resource_principal_idx ON design_shares (resource_id, principal_type, principal_id);
|
|
122
122
|
CREATE INDEX IF NOT EXISTS design_system_shares_resource_principal_idx ON design_system_shares (resource_id, principal_type, principal_id)`,
|
|
123
123
|
},
|
|
124
|
+
// v12: component_index — real-app component metadata (name, file path,
|
|
125
|
+
// export name, parsed prop types, cva/tailwind-variants variants, Storybook
|
|
126
|
+
// stories, runtime selectors). Ownable; access-checked via accessFilter /
|
|
127
|
+
// assertAccess.
|
|
128
|
+
{
|
|
129
|
+
version: 12,
|
|
130
|
+
sql: `CREATE TABLE IF NOT EXISTS component_index (
|
|
131
|
+
id TEXT PRIMARY KEY,
|
|
132
|
+
design_id TEXT NOT NULL,
|
|
133
|
+
source_ref TEXT,
|
|
134
|
+
name TEXT NOT NULL,
|
|
135
|
+
file_path TEXT,
|
|
136
|
+
export_name TEXT,
|
|
137
|
+
props TEXT,
|
|
138
|
+
variants TEXT,
|
|
139
|
+
stories TEXT,
|
|
140
|
+
runtime_selectors TEXT,
|
|
141
|
+
created_at TEXT DEFAULT (datetime('now')),
|
|
142
|
+
updated_at TEXT DEFAULT (datetime('now')),
|
|
143
|
+
owner_email TEXT NOT NULL DEFAULT 'local@localhost',
|
|
144
|
+
org_id TEXT,
|
|
145
|
+
visibility TEXT NOT NULL DEFAULT 'private'
|
|
146
|
+
)`,
|
|
147
|
+
},
|
|
148
|
+
// v13: motion_timeline — CSS-first keyframe animation tracks scoped to one
|
|
149
|
+
// design + source + screen/file. tracks JSON is the editing representation;
|
|
150
|
+
// the compiled CSS block (managed <style data-agent-native-motion>) is the
|
|
151
|
+
// runtime truth. compiled_hash guards drift between the two. Ownable.
|
|
152
|
+
{
|
|
153
|
+
version: 13,
|
|
154
|
+
sql: `CREATE TABLE IF NOT EXISTS motion_timeline (
|
|
155
|
+
id TEXT PRIMARY KEY,
|
|
156
|
+
design_id TEXT NOT NULL,
|
|
157
|
+
source_ref TEXT,
|
|
158
|
+
file_path TEXT,
|
|
159
|
+
tracks TEXT NOT NULL DEFAULT '[]',
|
|
160
|
+
duration_ms INTEGER NOT NULL DEFAULT 300,
|
|
161
|
+
default_ease TEXT NOT NULL DEFAULT 'ease',
|
|
162
|
+
compiled_hash TEXT,
|
|
163
|
+
created_at TEXT DEFAULT (datetime('now')),
|
|
164
|
+
updated_at TEXT DEFAULT (datetime('now')),
|
|
165
|
+
owner_email TEXT NOT NULL DEFAULT 'local@localhost',
|
|
166
|
+
org_id TEXT,
|
|
167
|
+
visibility TEXT NOT NULL DEFAULT 'private'
|
|
168
|
+
)`,
|
|
169
|
+
},
|
|
170
|
+
// v14: design_state — design states (alternate x-data/DOM snapshots for
|
|
171
|
+
// Default / Loading / Empty / Error), static data fixtures, and live
|
|
172
|
+
// captures of running-app route + props + API data. Ownable.
|
|
173
|
+
{
|
|
174
|
+
version: 14,
|
|
175
|
+
sql: `CREATE TABLE IF NOT EXISTS design_state (
|
|
176
|
+
id TEXT PRIMARY KEY,
|
|
177
|
+
design_id TEXT NOT NULL,
|
|
178
|
+
source_ref TEXT,
|
|
179
|
+
name TEXT NOT NULL,
|
|
180
|
+
kind TEXT NOT NULL DEFAULT 'state',
|
|
181
|
+
breakpoint TEXT NOT NULL DEFAULT 'auto',
|
|
182
|
+
route TEXT,
|
|
183
|
+
fixture_data TEXT,
|
|
184
|
+
capture_data TEXT,
|
|
185
|
+
preview_ref TEXT,
|
|
186
|
+
created_at TEXT DEFAULT (datetime('now')),
|
|
187
|
+
updated_at TEXT DEFAULT (datetime('now')),
|
|
188
|
+
owner_email TEXT NOT NULL DEFAULT 'local@localhost',
|
|
189
|
+
org_id TEXT,
|
|
190
|
+
visibility TEXT NOT NULL DEFAULT 'private'
|
|
191
|
+
)`,
|
|
192
|
+
},
|
|
193
|
+
// v15: design_review_snapshot — cached a11y audit results and visual diff
|
|
194
|
+
// data keyed by design + optional base/compare design_versions pair.
|
|
195
|
+
// status: 'pending' | 'ready' | 'error'. Ownable.
|
|
196
|
+
{
|
|
197
|
+
version: 15,
|
|
198
|
+
sql: `CREATE TABLE IF NOT EXISTS design_review_snapshot (
|
|
199
|
+
id TEXT PRIMARY KEY,
|
|
200
|
+
design_id TEXT NOT NULL,
|
|
201
|
+
base_version_id TEXT,
|
|
202
|
+
compare_version_id TEXT,
|
|
203
|
+
source_ref TEXT,
|
|
204
|
+
a11y_findings TEXT,
|
|
205
|
+
visual_diff TEXT,
|
|
206
|
+
status TEXT NOT NULL DEFAULT 'pending',
|
|
207
|
+
created_at TEXT DEFAULT (datetime('now')),
|
|
208
|
+
updated_at TEXT DEFAULT (datetime('now')),
|
|
209
|
+
owner_email TEXT NOT NULL DEFAULT 'local@localhost',
|
|
210
|
+
org_id TEXT,
|
|
211
|
+
visibility TEXT NOT NULL DEFAULT 'private'
|
|
212
|
+
)`,
|
|
213
|
+
},
|
|
124
214
|
],
|
|
125
215
|
{ table: "design_migrations" },
|
|
126
216
|
);
|