@rien7/design-surface 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.
- package/bin/design-surface.mjs +286 -0
- package/dist/cli/init.mjs +411 -0
- package/dist/cli/propose.mjs +172 -0
- package/dist/cli/reviewOps.mjs +127 -0
- package/dist/editor/AgentProposalCard.d.ts +10 -0
- package/dist/editor/AgentProposalCard.d.ts.map +1 -0
- package/dist/editor/AgentProposalCard.js +28 -0
- package/dist/editor/AgentProposalCard.js.map +1 -0
- package/dist/editor/App.d.ts +2 -0
- package/dist/editor/App.d.ts.map +1 -0
- package/dist/editor/App.js +1813 -0
- package/dist/editor/App.js.map +1 -0
- package/dist/editor/CanvasHud.d.ts +12 -0
- package/dist/editor/CanvasHud.d.ts.map +1 -0
- package/dist/editor/CanvasHud.js +13 -0
- package/dist/editor/CanvasHud.js.map +1 -0
- package/dist/editor/CanvasSurface.d.ts +20 -0
- package/dist/editor/CanvasSurface.d.ts.map +1 -0
- package/dist/editor/CanvasSurface.js +252 -0
- package/dist/editor/CanvasSurface.js.map +1 -0
- package/dist/editor/Changes.d.ts +17 -0
- package/dist/editor/Changes.d.ts.map +1 -0
- package/dist/editor/Changes.js +59 -0
- package/dist/editor/Changes.js.map +1 -0
- package/dist/editor/CommentPopover.d.ts +17 -0
- package/dist/editor/CommentPopover.d.ts.map +1 -0
- package/dist/editor/CommentPopover.js +62 -0
- package/dist/editor/CommentPopover.js.map +1 -0
- package/dist/editor/Comments.d.ts +13 -0
- package/dist/editor/Comments.d.ts.map +1 -0
- package/dist/editor/Comments.js +39 -0
- package/dist/editor/Comments.js.map +1 -0
- package/dist/editor/History.d.ts +7 -0
- package/dist/editor/History.d.ts.map +1 -0
- package/dist/editor/History.js +43 -0
- package/dist/editor/History.js.map +1 -0
- package/dist/editor/Inspector.d.ts +22 -0
- package/dist/editor/Inspector.d.ts.map +1 -0
- package/dist/editor/Inspector.js +241 -0
- package/dist/editor/Inspector.js.map +1 -0
- package/dist/editor/LazyMount.d.ts +10 -0
- package/dist/editor/LazyMount.d.ts.map +1 -0
- package/dist/editor/LazyMount.js +29 -0
- package/dist/editor/LazyMount.js.map +1 -0
- package/dist/editor/LocaleSwitch.d.ts +2 -0
- package/dist/editor/LocaleSwitch.d.ts.map +1 -0
- package/dist/editor/LocaleSwitch.js +13 -0
- package/dist/editor/LocaleSwitch.js.map +1 -0
- package/dist/editor/NodeInspector.d.ts +9 -0
- package/dist/editor/NodeInspector.d.ts.map +1 -0
- package/dist/editor/NodeInspector.js +9 -0
- package/dist/editor/NodeInspector.js.map +1 -0
- package/dist/editor/PreviewFrame.d.ts +10 -0
- package/dist/editor/PreviewFrame.d.ts.map +1 -0
- package/dist/editor/PreviewFrame.js +22 -0
- package/dist/editor/PreviewFrame.js.map +1 -0
- package/dist/editor/ProjectIndex.d.ts +12 -0
- package/dist/editor/ProjectIndex.d.ts.map +1 -0
- package/dist/editor/ProjectIndex.js +43 -0
- package/dist/editor/ProjectIndex.js.map +1 -0
- package/dist/editor/StyleEditor.d.ts +37 -0
- package/dist/editor/StyleEditor.d.ts.map +1 -0
- package/dist/editor/StyleEditor.js +275 -0
- package/dist/editor/StyleEditor.js.map +1 -0
- package/dist/editor/TokenWorkbench.d.ts +37 -0
- package/dist/editor/TokenWorkbench.d.ts.map +1 -0
- package/dist/editor/TokenWorkbench.js +146 -0
- package/dist/editor/TokenWorkbench.js.map +1 -0
- package/dist/editor/Tokens.d.ts +21 -0
- package/dist/editor/Tokens.d.ts.map +1 -0
- package/dist/editor/Tokens.js +56 -0
- package/dist/editor/Tokens.js.map +1 -0
- package/dist/editor/VariablesPage.d.ts +28 -0
- package/dist/editor/VariablesPage.d.ts.map +1 -0
- package/dist/editor/VariablesPage.js +14 -0
- package/dist/editor/VariablesPage.js.map +1 -0
- package/dist/editor/api.d.ts +13 -0
- package/dist/editor/api.d.ts.map +1 -0
- package/dist/editor/api.js +70 -0
- package/dist/editor/api.js.map +1 -0
- package/dist/editor/camera.d.ts +18 -0
- package/dist/editor/camera.d.ts.map +1 -0
- package/dist/editor/camera.js +40 -0
- package/dist/editor/camera.js.map +1 -0
- package/dist/editor/canvas.d.ts +26 -0
- package/dist/editor/canvas.d.ts.map +1 -0
- package/dist/editor/canvas.js +51 -0
- package/dist/editor/canvas.js.map +1 -0
- package/dist/editor/chrome/EditorChrome.d.ts +42 -0
- package/dist/editor/chrome/EditorChrome.d.ts.map +1 -0
- package/dist/editor/chrome/EditorChrome.js +21 -0
- package/dist/editor/chrome/EditorChrome.js.map +1 -0
- package/dist/editor/i18n.d.ts +18 -0
- package/dist/editor/i18n.d.ts.map +1 -0
- package/dist/editor/i18n.js +762 -0
- package/dist/editor/i18n.js.map +1 -0
- package/dist/editor/main.d.ts +3 -0
- package/dist/editor/main.d.ts.map +1 -0
- package/dist/editor/main.js +12 -0
- package/dist/editor/main.js.map +1 -0
- package/dist/editor/model.d.ts +17 -0
- package/dist/editor/model.d.ts.map +1 -0
- package/dist/editor/model.js +12 -0
- package/dist/editor/model.js.map +1 -0
- package/dist/editor/reviewLifecycle.d.ts +9 -0
- package/dist/editor/reviewLifecycle.d.ts.map +1 -0
- package/dist/editor/reviewLifecycle.js +30 -0
- package/dist/editor/reviewLifecycle.js.map +1 -0
- package/dist/editor/styles.css +6626 -0
- package/dist/editor/ui/Button.d.ts +3 -0
- package/dist/editor/ui/Button.d.ts.map +1 -0
- package/dist/editor/ui/Button.js +6 -0
- package/dist/editor/ui/Button.js.map +1 -0
- package/dist/editor/ui/CommentBox.d.ts +23 -0
- package/dist/editor/ui/CommentBox.d.ts.map +1 -0
- package/dist/editor/ui/CommentBox.js +41 -0
- package/dist/editor/ui/CommentBox.js.map +1 -0
- package/dist/editor/ui/Icon.d.ts +9 -0
- package/dist/editor/ui/Icon.d.ts.map +1 -0
- package/dist/editor/ui/Icon.js +6 -0
- package/dist/editor/ui/Icon.js.map +1 -0
- package/dist/editor/ui/IconButton.d.ts +11 -0
- package/dist/editor/ui/IconButton.d.ts.map +1 -0
- package/dist/editor/ui/IconButton.js +6 -0
- package/dist/editor/ui/IconButton.js.map +1 -0
- package/dist/editor/ui/NumberInput.d.ts +14 -0
- package/dist/editor/ui/NumberInput.d.ts.map +1 -0
- package/dist/editor/ui/NumberInput.js +6 -0
- package/dist/editor/ui/NumberInput.js.map +1 -0
- package/dist/editor/ui/PageLine.d.ts +14 -0
- package/dist/editor/ui/PageLine.d.ts.map +1 -0
- package/dist/editor/ui/PageLine.js +7 -0
- package/dist/editor/ui/PageLine.js.map +1 -0
- package/dist/editor/ui/Select.d.ts +15 -0
- package/dist/editor/ui/Select.d.ts.map +1 -0
- package/dist/editor/ui/Select.js +11 -0
- package/dist/editor/ui/Select.js.map +1 -0
- package/dist/editor/ui/TokenField.d.ts +14 -0
- package/dist/editor/ui/TokenField.d.ts.map +1 -0
- package/dist/editor/ui/TokenField.js +41 -0
- package/dist/editor/ui/TokenField.js.map +1 -0
- package/dist/editor-ui.d.ts +14 -0
- package/dist/editor-ui.d.ts.map +1 -0
- package/dist/editor-ui.js +13 -0
- package/dist/editor-ui.js.map +1 -0
- package/dist/inspector/runtime.d.ts +18 -0
- package/dist/inspector/runtime.d.ts.map +1 -0
- package/dist/inspector/runtime.js +987 -0
- package/dist/inspector/runtime.js.map +1 -0
- package/dist/preview/main.d.ts +3 -0
- package/dist/preview/main.d.ts.map +1 -0
- package/dist/preview/main.js +72 -0
- package/dist/preview/main.js.map +1 -0
- package/dist/preview/preview.css +39 -0
- package/dist/runtime/flow.d.ts +15 -0
- package/dist/runtime/flow.d.ts.map +1 -0
- package/dist/runtime/flow.js +48 -0
- package/dist/runtime/flow.js.map +1 -0
- package/dist/runtime/free.d.ts +18 -0
- package/dist/runtime/free.d.ts.map +1 -0
- package/dist/runtime/free.js +8 -0
- package/dist/runtime/free.js.map +1 -0
- package/dist/runtime/index.d.ts +11 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +46 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/types.d.ts +57 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +14 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/shared/prompt.d.mts +13 -0
- package/dist/shared/prompt.mjs +97 -0
- package/dist/shared/protocol.d.ts +79 -0
- package/dist/shared/protocol.d.ts.map +1 -0
- package/dist/shared/protocol.js +7 -0
- package/dist/shared/protocol.js.map +1 -0
- package/dist/shared/tokens.d.ts +66 -0
- package/dist/shared/tokens.d.ts.map +1 -0
- package/dist/shared/tokens.js +2 -0
- package/dist/shared/tokens.js.map +1 -0
- package/dist/shared/types.d.ts +301 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +13 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/tokens/adapters/css.mjs +44 -0
- package/dist/tokens/adapters/cssInCode.mjs +277 -0
- package/dist/tokens/adapters/oxcShared.mjs +59 -0
- package/dist/tokens/adapters/preprocessor.mjs +63 -0
- package/dist/tokens/adapters/registry.mjs +53 -0
- package/dist/tokens/adapters/tailwindcss.mjs +360 -0
- package/dist/tokens/adapters/types.mjs +117 -0
- package/dist/tokens/extract.mjs +328 -0
- package/dist/tokens/pipeline.mjs +688 -0
- package/dist/vite/events.d.ts +25 -0
- package/dist/vite/events.d.ts.map +1 -0
- package/dist/vite/events.js +137 -0
- package/dist/vite/events.js.map +1 -0
- package/dist/vite/layout.d.ts +4 -0
- package/dist/vite/layout.d.ts.map +1 -0
- package/dist/vite/layout.js +78 -0
- package/dist/vite/layout.js.map +1 -0
- package/dist/vite/plugin.d.ts +33 -0
- package/dist/vite/plugin.d.ts.map +1 -0
- package/dist/vite/plugin.js +403 -0
- package/dist/vite/plugin.js.map +1 -0
- package/dist/vite/review.d.ts +7 -0
- package/dist/vite/review.d.ts.map +1 -0
- package/dist/vite/review.js +334 -0
- package/dist/vite/review.js.map +1 -0
- package/package.json +86 -4
- package/skills/design-surface/SKILL.md +190 -0
- package/skills/design-surface-authoring/SKILL.md +257 -0
- package/skills/design-surface-tokens/SKILL.md +235 -0
- package/README.md +0 -3
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { SAFE_DESIGN_ID } from "./events.js";
|
|
4
|
+
export function reviewFile(root, design) {
|
|
5
|
+
if (!SAFE_DESIGN_ID.test(design))
|
|
6
|
+
throw new Error(`Invalid design id: ${design}`);
|
|
7
|
+
return path.resolve(root, 'design', design, 'review.json');
|
|
8
|
+
}
|
|
9
|
+
export function emptyReview(design) {
|
|
10
|
+
return {
|
|
11
|
+
version: 1,
|
|
12
|
+
design,
|
|
13
|
+
updatedAt: new Date().toISOString(),
|
|
14
|
+
items: [],
|
|
15
|
+
batches: [],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const nowIso = () => new Date().toISOString();
|
|
19
|
+
const idOf = (prefix, index) => `${prefix}-${index}-${Math.random().toString(36).slice(2, 8)}`;
|
|
20
|
+
const statusOf = (value, resolved = false) => {
|
|
21
|
+
if (resolved)
|
|
22
|
+
return 'resolved';
|
|
23
|
+
return value === 'in_progress' || value === 'resolved' ? value : 'open';
|
|
24
|
+
};
|
|
25
|
+
const legacyPage = (frame) => frame.split('__')[0];
|
|
26
|
+
function legacyStyleItem(style, frame, index) {
|
|
27
|
+
const createdAt = nowIso();
|
|
28
|
+
return {
|
|
29
|
+
id: idOf(`legacy-style-${frame}`, index),
|
|
30
|
+
design: '',
|
|
31
|
+
kind: 'style',
|
|
32
|
+
scope: 'frame',
|
|
33
|
+
page: legacyPage(frame),
|
|
34
|
+
frame,
|
|
35
|
+
target: { type: 'node', node: style.node },
|
|
36
|
+
property: style.property,
|
|
37
|
+
from: style.from,
|
|
38
|
+
to: style.value,
|
|
39
|
+
token: style.token,
|
|
40
|
+
status: statusOf(style.status),
|
|
41
|
+
agentReply: style.agentReply,
|
|
42
|
+
createdAt,
|
|
43
|
+
updatedAt: createdAt,
|
|
44
|
+
resolvedAt: style.resolvedAt,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function legacyCommentItem(comment, frame, index) {
|
|
48
|
+
const createdAt = comment.createdAt ?? nowIso();
|
|
49
|
+
return {
|
|
50
|
+
id: `legacy-comment-${frame}-${comment.id || index}`,
|
|
51
|
+
design: '',
|
|
52
|
+
kind: 'comment',
|
|
53
|
+
scope: 'frame',
|
|
54
|
+
page: legacyPage(frame),
|
|
55
|
+
frame,
|
|
56
|
+
target: { type: 'node', node: comment.node },
|
|
57
|
+
body: comment.body,
|
|
58
|
+
thread: (comment.replies ?? []).map((reply) => ({
|
|
59
|
+
id: reply.id,
|
|
60
|
+
body: reply.body,
|
|
61
|
+
author: reply.author,
|
|
62
|
+
createdAt: reply.createdAt,
|
|
63
|
+
})),
|
|
64
|
+
status: statusOf(comment.status, Boolean(comment.resolved)),
|
|
65
|
+
agentReply: comment.agentReply,
|
|
66
|
+
createdAt,
|
|
67
|
+
updatedAt: comment.editedAt ?? createdAt,
|
|
68
|
+
resolvedAt: comment.resolvedAt,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function legacyArchiveItem(item) {
|
|
72
|
+
const change = item.change;
|
|
73
|
+
const isToken = item.kind === 'token';
|
|
74
|
+
const node = change.node && typeof change.node === 'object' && 'type' in change.node
|
|
75
|
+
? change.node
|
|
76
|
+
: null;
|
|
77
|
+
return {
|
|
78
|
+
id: `legacy-archive-${item.id}`,
|
|
79
|
+
design: item.design,
|
|
80
|
+
kind: item.kind === 'comment' ? 'comment' : item.kind,
|
|
81
|
+
scope: isToken ? 'design' : 'frame',
|
|
82
|
+
frame: isToken ? undefined : item.frame,
|
|
83
|
+
target: isToken
|
|
84
|
+
? { type: 'token', token: change.name ?? item.title }
|
|
85
|
+
: node ?? { type: 'node', node: change.node ?? {} },
|
|
86
|
+
property: change.property,
|
|
87
|
+
from: isToken ? change.from : change.from,
|
|
88
|
+
to: isToken ? change.value : change.value,
|
|
89
|
+
token: change.token,
|
|
90
|
+
agentReply: change.agentReply,
|
|
91
|
+
status: 'archived',
|
|
92
|
+
createdAt: item.resolvedAt,
|
|
93
|
+
updatedAt: item.archivedAt,
|
|
94
|
+
resolvedAt: item.resolvedAt,
|
|
95
|
+
archivedAt: item.archivedAt,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function readLegacySessions(root, design) {
|
|
99
|
+
if (!SAFE_DESIGN_ID.test(design))
|
|
100
|
+
return [];
|
|
101
|
+
const dir = path.resolve(root, 'design', design, '.session');
|
|
102
|
+
if (!fs.existsSync(dir))
|
|
103
|
+
return [];
|
|
104
|
+
const sessions = [];
|
|
105
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
106
|
+
if (!entry.isFile() || !entry.name.endsWith('.json'))
|
|
107
|
+
continue;
|
|
108
|
+
try {
|
|
109
|
+
const parsed = JSON.parse(fs.readFileSync(path.join(dir, entry.name), 'utf8'));
|
|
110
|
+
if (parsed && typeof parsed === 'object' && typeof parsed.frame === 'string') {
|
|
111
|
+
sessions.push(parsed);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// Ignore malformed legacy files.
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return sessions;
|
|
119
|
+
}
|
|
120
|
+
function readLegacyHistory(root, design) {
|
|
121
|
+
if (!SAFE_DESIGN_ID.test(design))
|
|
122
|
+
return [];
|
|
123
|
+
try {
|
|
124
|
+
const parsed = JSON.parse(fs.readFileSync(path.resolve(root, 'design', design, 'history.json'), 'utf8'));
|
|
125
|
+
return Array.isArray(parsed.items) ? parsed.items : [];
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function migrateLegacy(root, design) {
|
|
132
|
+
const items = [];
|
|
133
|
+
const sessions = readLegacySessions(root, design);
|
|
134
|
+
const tokens = new Map();
|
|
135
|
+
sessions.forEach((session) => {
|
|
136
|
+
const frame = session.frame;
|
|
137
|
+
const updatedAt = session.updatedAt ?? nowIso();
|
|
138
|
+
session.tokens.forEach((token, index) => {
|
|
139
|
+
const existing = tokens.get(token.name);
|
|
140
|
+
const status = statusOf(token.status);
|
|
141
|
+
if (!existing) {
|
|
142
|
+
const item = {
|
|
143
|
+
id: `legacy-token-${token.name.replace(/[^a-zA-Z0-9_-]/g, '_')}-${index}`,
|
|
144
|
+
design,
|
|
145
|
+
kind: 'token',
|
|
146
|
+
scope: 'design',
|
|
147
|
+
target: { type: 'token', token: token.name },
|
|
148
|
+
from: token.from,
|
|
149
|
+
to: token.value,
|
|
150
|
+
status,
|
|
151
|
+
agentReply: token.agentReply,
|
|
152
|
+
createdAt: updatedAt,
|
|
153
|
+
updatedAt,
|
|
154
|
+
resolvedAt: token.resolvedAt,
|
|
155
|
+
};
|
|
156
|
+
tokens.set(token.name, item);
|
|
157
|
+
items.push(item);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (status === 'resolved')
|
|
161
|
+
existing.status = 'resolved';
|
|
162
|
+
else if (status === 'in_progress' && existing.status === 'open')
|
|
163
|
+
existing.status = 'in_progress';
|
|
164
|
+
existing.resolvedAt = token.resolvedAt ?? existing.resolvedAt;
|
|
165
|
+
existing.agentReply = token.agentReply ?? existing.agentReply;
|
|
166
|
+
existing.updatedAt = updatedAt;
|
|
167
|
+
});
|
|
168
|
+
(session.styles ?? []).forEach((style, index) => {
|
|
169
|
+
const item = legacyStyleItem(style, frame, index);
|
|
170
|
+
item.design = design;
|
|
171
|
+
items.push(item);
|
|
172
|
+
});
|
|
173
|
+
session.free.forEach((free, index) => {
|
|
174
|
+
const createdAt = updatedAt;
|
|
175
|
+
items.push({
|
|
176
|
+
id: idOf(`legacy-free-${frame}`, index),
|
|
177
|
+
design,
|
|
178
|
+
kind: 'free',
|
|
179
|
+
scope: 'frame',
|
|
180
|
+
page: legacyPage(frame),
|
|
181
|
+
frame,
|
|
182
|
+
target: { type: 'node', node: free.node },
|
|
183
|
+
from: free.from,
|
|
184
|
+
to: free.to,
|
|
185
|
+
status: statusOf(free.status),
|
|
186
|
+
agentReply: free.agentReply,
|
|
187
|
+
createdAt,
|
|
188
|
+
updatedAt: createdAt,
|
|
189
|
+
resolvedAt: free.resolvedAt,
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
session.structure.forEach((structure, index) => {
|
|
193
|
+
items.push({
|
|
194
|
+
id: idOf(`legacy-structure-${frame}`, index),
|
|
195
|
+
design,
|
|
196
|
+
kind: 'structure',
|
|
197
|
+
scope: 'frame',
|
|
198
|
+
page: legacyPage(frame),
|
|
199
|
+
frame,
|
|
200
|
+
target: { type: 'node', node: structure.node },
|
|
201
|
+
from: structure,
|
|
202
|
+
status: statusOf(structure.status),
|
|
203
|
+
agentReply: structure.agentReply,
|
|
204
|
+
createdAt: updatedAt,
|
|
205
|
+
updatedAt,
|
|
206
|
+
resolvedAt: structure.resolvedAt,
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
(session.suggestions ?? []).forEach((suggestion, index) => {
|
|
210
|
+
items.push({
|
|
211
|
+
id: idOf(`legacy-suggestion-${frame}`, index),
|
|
212
|
+
design,
|
|
213
|
+
kind: 'suggestion',
|
|
214
|
+
scope: 'frame',
|
|
215
|
+
page: legacyPage(frame),
|
|
216
|
+
frame,
|
|
217
|
+
target: { type: 'node', node: suggestion.node },
|
|
218
|
+
property: suggestion.property,
|
|
219
|
+
from: suggestion.value,
|
|
220
|
+
to: suggestion.token,
|
|
221
|
+
token: suggestion.token,
|
|
222
|
+
status: statusOf(suggestion.status),
|
|
223
|
+
agentReply: suggestion.agentReply,
|
|
224
|
+
createdAt: suggestion.createdAt ?? updatedAt,
|
|
225
|
+
updatedAt,
|
|
226
|
+
resolvedAt: suggestion.resolvedAt,
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
(session.comments ?? []).forEach((comment, index) => {
|
|
230
|
+
const item = legacyCommentItem(comment, frame, index);
|
|
231
|
+
item.design = design;
|
|
232
|
+
items.push(item);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
const archives = readLegacyHistory(root, design);
|
|
236
|
+
if (!sessions.length && !archives.length)
|
|
237
|
+
return emptyReview(design);
|
|
238
|
+
const archivedTokens = new Set();
|
|
239
|
+
archives.forEach((archive) => {
|
|
240
|
+
if (archive.kind === 'token') {
|
|
241
|
+
const name = archive.change.name ?? archive.title;
|
|
242
|
+
if (archivedTokens.has(name))
|
|
243
|
+
return;
|
|
244
|
+
archivedTokens.add(name);
|
|
245
|
+
}
|
|
246
|
+
const item = legacyArchiveItem(archive);
|
|
247
|
+
item.design = design;
|
|
248
|
+
items.push(item);
|
|
249
|
+
});
|
|
250
|
+
const review = {
|
|
251
|
+
version: 1,
|
|
252
|
+
design,
|
|
253
|
+
updatedAt: nowIso(),
|
|
254
|
+
items,
|
|
255
|
+
batches: [],
|
|
256
|
+
};
|
|
257
|
+
fs.mkdirSync(path.dirname(reviewFile(root, design)), { recursive: true });
|
|
258
|
+
fs.writeFileSync(reviewFile(root, design), `${JSON.stringify(review, null, 2)}\n`);
|
|
259
|
+
fs.rmSync(path.resolve(root, 'design', design, '.session'), { recursive: true, force: true });
|
|
260
|
+
fs.rmSync(path.resolve(root, 'design', design, 'history.json'), { force: true });
|
|
261
|
+
return review;
|
|
262
|
+
}
|
|
263
|
+
export function readReview(root, design) {
|
|
264
|
+
try {
|
|
265
|
+
const parsed = JSON.parse(fs.readFileSync(reviewFile(root, design), 'utf8'));
|
|
266
|
+
return {
|
|
267
|
+
version: 1,
|
|
268
|
+
design,
|
|
269
|
+
updatedAt: typeof parsed.updatedAt === 'string' ? parsed.updatedAt : nowIso(),
|
|
270
|
+
items: Array.isArray(parsed.items) ? parsed.items : [],
|
|
271
|
+
batches: Array.isArray(parsed.batches) ? parsed.batches : [],
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
return migrateLegacy(root, design);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
export function writeReview(root, design, value) {
|
|
279
|
+
const next = {
|
|
280
|
+
version: 1,
|
|
281
|
+
design,
|
|
282
|
+
updatedAt: nowIso(),
|
|
283
|
+
items: value.items,
|
|
284
|
+
batches: value.batches,
|
|
285
|
+
};
|
|
286
|
+
fs.mkdirSync(path.dirname(reviewFile(root, design)), { recursive: true });
|
|
287
|
+
fs.writeFileSync(reviewFile(root, design), `${JSON.stringify(next, null, 2)}\n`);
|
|
288
|
+
return next;
|
|
289
|
+
}
|
|
290
|
+
export function applyReviewOps(root, design, ops) {
|
|
291
|
+
if (!Array.isArray(ops))
|
|
292
|
+
throw new Error('Invalid review ops');
|
|
293
|
+
const current = readReview(root, design);
|
|
294
|
+
const items = new Map(current.items.map((item) => [item.id, item]));
|
|
295
|
+
const batches = new Map(current.batches.map((batch) => [batch.id, batch]));
|
|
296
|
+
for (const raw of ops) {
|
|
297
|
+
if (!raw || typeof raw !== 'object')
|
|
298
|
+
continue;
|
|
299
|
+
if (raw.type === 'upsert' && raw.item?.id) {
|
|
300
|
+
items.set(raw.item.id, { ...raw.item, design });
|
|
301
|
+
}
|
|
302
|
+
else if (raw.type === 'remove' && raw.id) {
|
|
303
|
+
items.delete(raw.id);
|
|
304
|
+
}
|
|
305
|
+
else if (raw.type === 'archive' && Array.isArray(raw.ids)) {
|
|
306
|
+
for (const id of raw.ids) {
|
|
307
|
+
const item = items.get(id);
|
|
308
|
+
if (!item)
|
|
309
|
+
continue;
|
|
310
|
+
items.set(id, {
|
|
311
|
+
...item,
|
|
312
|
+
status: 'archived',
|
|
313
|
+
archivedAt: raw.archivedAt ?? nowIso(),
|
|
314
|
+
updatedAt: nowIso(),
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
else if (raw.type === 'patch' && raw.id) {
|
|
319
|
+
const item = items.get(raw.id);
|
|
320
|
+
if (item) {
|
|
321
|
+
items.set(raw.id, { ...item, ...raw.patch, id: item.id, design });
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
else if (raw.type === 'batch' && raw.batch?.id) {
|
|
325
|
+
batches.set(raw.batch.id, raw.batch);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return writeReview(root, design, {
|
|
329
|
+
...current,
|
|
330
|
+
items: [...items.values()],
|
|
331
|
+
batches: [...batches.values()],
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
//# sourceMappingURL=review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.js","sourceRoot":"","sources":["../../src/vite/review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAe5B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,MAAc;IACrD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,MAAM,EAAE,CAAC,CAAA;IACjF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,CAAA;AAC5D,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO;QACL,OAAO,EAAE,CAAC;QACV,MAAM;QACN,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,EAAE;KACZ,CAAA;AACH,CAAC;AAED,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;AAE7C,MAAM,IAAI,GAAG,CAAC,MAAc,EAAE,KAAa,EAAE,EAAE,CAC7C,GAAG,MAAM,IAAI,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC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"name": "@rien7/design-surface",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "A TSX-native design surface: preview real components, tune tokens, and hand structured changes to a coding agent.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/rien7/design-surface.git",
|
|
10
|
+
"directory": "packages/design"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/rien7/design-surface#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/rien7/design-surface/issues"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=20.19.0"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"bin",
|
|
25
|
+
"skills"
|
|
26
|
+
],
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/runtime/index.d.ts",
|
|
30
|
+
"import": "./dist/runtime/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./runtime": {
|
|
33
|
+
"types": "./dist/runtime/index.d.ts",
|
|
34
|
+
"import": "./dist/runtime/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./vite": {
|
|
37
|
+
"types": "./dist/vite/plugin.d.ts",
|
|
38
|
+
"import": "./dist/vite/plugin.js"
|
|
39
|
+
},
|
|
40
|
+
"./inspector": {
|
|
41
|
+
"types": "./dist/inspector/runtime.d.ts",
|
|
42
|
+
"import": "./dist/inspector/runtime.js"
|
|
43
|
+
},
|
|
44
|
+
"./editor-ui": {
|
|
45
|
+
"types": "./dist/editor-ui.d.ts",
|
|
46
|
+
"import": "./dist/editor-ui.js"
|
|
47
|
+
},
|
|
48
|
+
"./tokens": {
|
|
49
|
+
"import": "./dist/tokens/pipeline.mjs"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"bin": {
|
|
53
|
+
"design-surface": "bin/design-surface.mjs"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "node scripts/build.mjs",
|
|
57
|
+
"prepublishOnly": "node scripts/build.mjs",
|
|
58
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"react": ">=18",
|
|
62
|
+
"react-dom": ">=18",
|
|
63
|
+
"vite": ">=6"
|
|
64
|
+
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"vite": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@types/node": "^22.10.0",
|
|
72
|
+
"@types/react": "^19.2.0",
|
|
73
|
+
"@types/react-dom": "^19.2.0",
|
|
74
|
+
"react": "^19.2.0",
|
|
75
|
+
"react-dom": "^19.2.0",
|
|
76
|
+
"typescript": "^5.9.3",
|
|
77
|
+
"vite": "^8.0.0"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@base-ui/react": "^1.9.0",
|
|
81
|
+
"@hugeicons/core-free-icons": "^4.4.0",
|
|
82
|
+
"@hugeicons/react": "^1.1.10",
|
|
83
|
+
"oxc-parser": "^0.160.0",
|
|
84
|
+
"postcss": "^8.5.33",
|
|
85
|
+
"postcss-value-parser": "^4.2.0",
|
|
86
|
+
"tinyglobby": "^0.2.17"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: design-surface
|
|
3
|
+
description: Use when applying pending Design Surface review items from design/<design>/review.json, including token create/update/merge/alias/deprecate, style, suggestion, free-layout, structure and comment items. For DTCG details use design-surface-tokens; for pages and component pages use design-surface-authoring.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Apply Design Surface review items
|
|
7
|
+
|
|
8
|
+
The browser never writes source. It records intents in one design-level ledger:
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
design/<design>/review.json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Your job is to change the component TSX/CSS or DTCG token source, then update the ledger using the
|
|
15
|
+
`design-surface` CLI (or in place). The surface verifies token changes and archives finished items.
|
|
16
|
+
|
|
17
|
+
## Read the ledger
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx design-surface list
|
|
21
|
+
npx design-surface show <design>
|
|
22
|
+
npx design-surface prompt <design>
|
|
23
|
+
npx design-surface check
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
A frame is a locator, not a storage boundary. A token is one `scope: "design"` item; never create a
|
|
27
|
+
per-frame copy.
|
|
28
|
+
|
|
29
|
+
## Item fields
|
|
30
|
+
|
|
31
|
+
Every item has `id`, `design`, `kind`, `scope`, `target`, `status`, `createdAt`, `updatedAt`.
|
|
32
|
+
|
|
33
|
+
Additional fields by kind:
|
|
34
|
+
|
|
35
|
+
| Kind | Fields |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `token` | `source`, `sourceHash`, `tokenType`, `tokenAction`, `tokenAlias?`, `tokenTier?`, `from`, `to`, `author?`, `rationale?`, `proposalDecision?`, `decisionNote?`, `verifiedAt?` |
|
|
38
|
+
| `style` | `page`, `frame`, `target.node`, `property`, `from`, `to` |
|
|
39
|
+
| `suggestion` | `page`, `frame`, `target.node`, `property`, `token`, `from`, `to`, `source` |
|
|
40
|
+
| `free` | `page`, `frame`, `target.node`, `from` rect, `to` rect |
|
|
41
|
+
| `structure` | `page`, `frame`/`component`, `target`, `body` |
|
|
42
|
+
| `comment` | `page`, `frame`, `target.node`, `body`, `thread` |
|
|
43
|
+
|
|
44
|
+
`target.node` also carries `component`, `components`, `source` (`file:line`), `anchor`, and `path`.
|
|
45
|
+
`scope` is `design`, `page`, `frame`, `component` or `editor`.
|
|
46
|
+
|
|
47
|
+
## Apply by kind
|
|
48
|
+
|
|
49
|
+
### Token
|
|
50
|
+
|
|
51
|
+
`target.token` is the CSS variable name (`--surface-accent`); the DTCG path is the same name without
|
|
52
|
+
`--` and with dots (`surface.accent`). `source` names the DTCG file. Do not edit generated files:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
design/tokens.generated.ts
|
|
56
|
+
design/tokens.manifest.json
|
|
57
|
+
src/tokens.generated.css
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Apply the action:
|
|
61
|
+
|
|
62
|
+
| `tokenAction` | Source change | `to` |
|
|
63
|
+
| --- | --- | --- |
|
|
64
|
+
| `create` | Add the token to the tier/source. | Resolved value. |
|
|
65
|
+
| `update` | Change the token value or alias. | Resolved value. |
|
|
66
|
+
| `alias` | Set `$value` to `{target.path}`. | Target DTCG path. |
|
|
67
|
+
| `merge` | Alias the source to the target; keep the source name as an alias unless the human asked to remove it. | Target DTCG path. |
|
|
68
|
+
| `deprecate` | Remove the token and its usages. | Empty. |
|
|
69
|
+
|
|
70
|
+
For `alias` and `merge`, set `tokenAlias` to the target DTCG path. For `create`, use `tokenTier` to
|
|
71
|
+
choose `primitive.tokens.json`, `semantic.tokens.json` or `component.tokens.json`.
|
|
72
|
+
|
|
73
|
+
If the item is an agent proposal (`author: "agent"`):
|
|
74
|
+
|
|
75
|
+
- **Unreviewed proposals** (`!proposalDecision`) wait for the human in the Variables/Changes UI and are excluded from `design-surface prompt`.
|
|
76
|
+
- **`[approved proposal]`**: add/update the token in the named DTCG source, run `tokens build` and `tokens check`, and mark `resolved`.
|
|
77
|
+
- **`[rejected proposal]`**: do **not** write the token to DTCG source; revert or switch usages to existing tokens per `decisionNote`, and mark `resolved`.
|
|
78
|
+
|
|
79
|
+
To propose a missing semantic token before editing DTCG source:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npx design-surface propose token <design> \
|
|
83
|
+
--name --surface-elevated \
|
|
84
|
+
--value "#ffffff" \
|
|
85
|
+
--tier semantic \
|
|
86
|
+
--alias color.surface \
|
|
87
|
+
--type color \
|
|
88
|
+
--rationale "Shared by secondary cards"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
While a proposal is pending approval, reference it in code with an existing token fallback:
|
|
92
|
+
`var(--surface-elevated, var(--color-surface))`.
|
|
93
|
+
|
|
94
|
+
After editing DTCG source:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npx design-surface tokens build
|
|
98
|
+
npx design-surface tokens check
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The surface verifies:
|
|
102
|
+
|
|
103
|
+
| Action | Verified when |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `create` / `update` | generated value equals `to` |
|
|
106
|
+
| `alias` / `merge` | generated alias equals `to` |
|
|
107
|
+
| `deprecate` | generated value is absent |
|
|
108
|
+
|
|
109
|
+
Do not write `verifiedAt`, `archivedAt` or `sourceHash`. A resolved token item is not archived until
|
|
110
|
+
the surface writes `verifiedAt` and ten minutes pass (rejected proposals archive 10 minutes after
|
|
111
|
+
`resolved` without `verifiedAt`).
|
|
112
|
+
|
|
113
|
+
### Style
|
|
114
|
+
|
|
115
|
+
Apply `property` to the source element identified by `target.node.source`, `component`, `anchor`,
|
|
116
|
+
`path` and `html`. Use the page/frame locator to find the right component in `src/`. Do not add a
|
|
117
|
+
parallel styling system or a JSON scene graph.
|
|
118
|
+
|
|
119
|
+
### Suggestion
|
|
120
|
+
|
|
121
|
+
A suggestion asks to bind a literal to a token:
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"kind": "suggestion",
|
|
126
|
+
"property": "padding",
|
|
127
|
+
"token": "--space-card",
|
|
128
|
+
"from": "0 8px",
|
|
129
|
+
"to": "--space-card"
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Apply the token to source (`var(--space-card)` or token class), not a literal copy of its resolved
|
|
134
|
+
value.
|
|
135
|
+
|
|
136
|
+
### Free
|
|
137
|
+
|
|
138
|
+
Apply the `to` rect to the matching `FreeItem` props (`x`, `y`, `width`, `height`) or free-layout
|
|
139
|
+
source. Keep `from` for comparison.
|
|
140
|
+
|
|
141
|
+
### Structure
|
|
142
|
+
|
|
143
|
+
Apply the requested node/page/component change to source using `target`, `body` and the surrounding
|
|
144
|
+
page/frame context. If the locator is ambiguous, use the anchor, `source`, and HTML; ask the human
|
|
145
|
+
if it still does not resolve.
|
|
146
|
+
|
|
147
|
+
### Comment
|
|
148
|
+
|
|
149
|
+
Reply using the CLI (optionally marking resolved):
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
npx design-surface reply <design> <itemId> "Raised button contrast to match primary token." --resolve
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Do not delete the comment.
|
|
156
|
+
|
|
157
|
+
## Update status, do not clear
|
|
158
|
+
|
|
159
|
+
Use the safe CLI commands to update item status and summaries:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
npx design-surface status <design> <itemId> in_progress
|
|
163
|
+
npx design-surface status <design> <itemId> resolved --reply "Applied to shared Button in src/components/Button.tsx."
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
- Use `in_progress` while working.
|
|
167
|
+
- Use `resolved` only when the source change is complete.
|
|
168
|
+
- Never delete items.
|
|
169
|
+
- Never write `verifiedAt` or `archivedAt`, and never archive manually.
|
|
170
|
+
- Non-token resolved items and rejected proposals archive after ten minutes.
|
|
171
|
+
- Approved/human token resolved items archive after verification plus ten minutes.
|
|
172
|
+
|
|
173
|
+
## Verify
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
npx design-surface tokens check
|
|
177
|
+
npx design-surface check
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Also run the host project's typecheck and build (e.g. `npm run typecheck && npm run build`).
|
|
181
|
+
|
|
182
|
+
## Common mistakes
|
|
183
|
+
|
|
184
|
+
- Editing `design/tokens.ts` or generated CSS instead of DTCG source (`design/tokens/*.tokens.json`).
|
|
185
|
+
- Writing `sourceHash`, `verifiedAt`, or `archivedAt` by hand.
|
|
186
|
+
- Applying a suggestion as a literal instead of `var(--token)`.
|
|
187
|
+
- Creating one token item per frame.
|
|
188
|
+
- Marking a token resolved without running `tokens build` and `tokens check`.
|
|
189
|
+
- Building duplicate production components inside `design/` instead of importing from `src/`.
|
|
190
|
+
- Deleting or archiving items.
|