@agent-native/core 0.85.5 → 0.85.7
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 +12 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/client/AssistantChat.tsx +1 -1
- package/corpus/core/src/client/use-pinch-zoom.ts +76 -11
- package/corpus/core/src/collab/presence.ts +63 -3
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +245 -77
- package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +190 -13
- package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +16 -4
- package/corpus/templates/design/.agents/skills/export-handoff/SKILL.md +46 -3
- package/corpus/templates/design/AGENTS.md +40 -4
- package/corpus/templates/design/actions/apply-component-prop-edit.ts +20 -73
- package/corpus/templates/design/actions/apply-motion-edit.ts +29 -2
- package/corpus/templates/design/actions/apply-visual-edit.ts +4 -2
- package/corpus/templates/design/actions/connect-localhost.ts +25 -18
- package/corpus/templates/design/actions/edit-design.ts +5 -3
- package/corpus/templates/design/actions/export-pdf.ts +8 -1
- package/corpus/templates/design/actions/export-zip.ts +10 -1
- package/corpus/templates/design/actions/get-motion-timeline.ts +26 -20
- package/corpus/templates/design/actions/grant-localhost-write-consent.ts +10 -0
- package/corpus/templates/design/actions/insert-asset.ts +190 -7
- package/corpus/templates/design/actions/open-visual-edit.ts +27 -5
- package/corpus/templates/design/actions/present-design-variants.ts +12 -8
- package/corpus/templates/design/actions/revoke-localhost-write-consent.ts +18 -14
- package/corpus/templates/design/actions/run-design-audit.ts +7 -4
- package/corpus/templates/design/actions/write-local-file.ts +47 -22
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +221 -66
- package/corpus/templates/design/app/components/design/EditPanel.tsx +650 -237
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +526 -127
- package/corpus/templates/design/app/components/design/MotionDock.tsx +234 -46
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +1520 -410
- package/corpus/templates/design/app/components/design/StatesPanel.tsx +25 -2
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +640 -72
- package/corpus/templates/design/app/components/design/bridge/motion-preview.bridge.ts +605 -0
- package/corpus/templates/design/app/components/design/canvas-primitive-style.ts +50 -26
- package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +16 -4
- package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +90 -103
- package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +111 -5
- package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +13 -2
- package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +42 -2
- package/corpus/templates/design/app/components/design/inspector/scrub-input-utils.ts +11 -2
- package/corpus/templates/design/app/components/design/types.ts +16 -0
- package/corpus/templates/design/app/components/visual-editor/CanvasCommentPins.tsx +24 -6
- package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +15 -1
- package/corpus/templates/design/app/hooks/use-question-flow.ts +2 -2
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +77 -0
- package/corpus/templates/design/app/i18n/zh-TW.ts +1 -0
- package/corpus/templates/design/app/i18n-data.ts +18 -0
- package/corpus/templates/design/app/lib/design-import.ts +95 -0
- package/corpus/templates/design/app/pages/DesignEditor.tsx +4015 -840
- package/corpus/templates/design/changelog/2026-07-02-creating-two-frames-in-a-row-no-longer-freezes-and-reloads-t.md +6 -0
- package/corpus/templates/design/changelog/2026-07-03-canvas-interactions-now-match-figma-rotation-aware-resizing-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-03-design-retries-stalled-screen-edits-with-a-smaller-safer-fol.md +6 -0
- package/corpus/templates/design/changelog/2026-07-03-inspector-fixes-mixed-selections-show-mixed-instead-of-wrong.md +6 -0
- package/corpus/templates/design/changelog/2026-07-03-keyframe-timeline-works-reliably-drag-keyframes-smoothly-pic.md +6 -0
- package/corpus/templates/design/changelog/2026-07-03-layers-panel-matches-figma-top-layer-on-top-drag-with-auto-s.md +6 -0
- package/corpus/templates/design/changelog/2026-07-03-much-faster-editor-smooth-dragging-zooming-and-panel-updates.md +6 -0
- package/corpus/templates/design/changelog/2026-07-03-pen-tool-refinements-click-the-first-point-to-close-with-a-d.md +6 -0
- package/corpus/templates/design/changelog/2026-07-03-text-editing-enter-adds-a-line-break-international-ime-typin.md +6 -0
- package/corpus/templates/design/changelog/2026-07-03-undo-and-redo-are-dependable-across-agent-edits-screen-switc.md +6 -0
- package/corpus/templates/design/server/lib/design-export.ts +43 -1
- package/corpus/templates/design/server/plugins/agent-chat.ts +1 -1
- package/corpus/templates/design/shared/board-file.ts +25 -5
- package/corpus/templates/design/shared/canvas-math.ts +754 -9
- package/corpus/templates/design/shared/code-layer.ts +304 -26
- package/corpus/templates/design/shared/color-utils.ts +84 -0
- package/corpus/templates/design/shared/design-source-capabilities.ts +16 -7
- package/corpus/templates/design/shared/motion-compiler.ts +75 -31
- package/corpus/templates/design/shared/motion-timeline.ts +335 -0
- package/corpus/templates/design/shared/pen-path.ts +200 -23
- package/dist/client/AssistantChat.js +1 -1
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/use-pinch-zoom.d.ts.map +1 -1
- package/dist/client/use-pinch-zoom.js +76 -11
- package/dist/client/use-pinch-zoom.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/presence.d.ts.map +1 -1
- package/dist/collab/presence.js +54 -3
- package/dist/collab/presence.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/observability/routes.d.ts +2 -2
- package/dist/secrets/routes.d.ts +3 -3
- package/package.json +1 -1
|
@@ -17,6 +17,47 @@ function escapeHtml(str: string): string {
|
|
|
17
17
|
.replace(/"/g, """);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// Layers toggled hidden in the editor are only visually suppressed by the
|
|
21
|
+
// live editor bridge (which paints `display:none` on
|
|
22
|
+
// `[data-agent-native-hidden="true"]` inside the canvas iframe). Exports never
|
|
23
|
+
// go through that bridge, so without this rule hidden layers would leak back
|
|
24
|
+
// into every exported artifact. Inject the same rule at export time so
|
|
25
|
+
// hidden-in-editor stays hidden-in-export.
|
|
26
|
+
export const HIDDEN_LAYER_EXPORT_STYLE_MARKER =
|
|
27
|
+
"data-agent-native-export-hidden";
|
|
28
|
+
export const HIDDEN_LAYER_EXPORT_CSS = `[data-agent-native-hidden="true"]{display:none!important}`;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Wraps the hidden-layer suppression rule in a marked <style> tag so callers
|
|
32
|
+
* can idempotently check whether it's already present (e.g. before injecting
|
|
33
|
+
* into HTML that may have already been through this pipeline).
|
|
34
|
+
*/
|
|
35
|
+
export function hiddenLayerExportStyleTag(): string {
|
|
36
|
+
return `<style ${HIDDEN_LAYER_EXPORT_STYLE_MARKER}>${HIDDEN_LAYER_EXPORT_CSS}</style>`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Injects the hidden-layer suppression rule into a standalone HTML document,
|
|
41
|
+
* before `</head>` when present, otherwise prepended to the document. Safe to
|
|
42
|
+
* call more than once — re-injection is skipped if the marked style tag is
|
|
43
|
+
* already present.
|
|
44
|
+
*/
|
|
45
|
+
export function injectHiddenLayerExportStyle(html: string): string {
|
|
46
|
+
if (
|
|
47
|
+
new RegExp(`<style[^>]*${HIDDEN_LAYER_EXPORT_STYLE_MARKER}\\b`, "i").test(
|
|
48
|
+
html,
|
|
49
|
+
)
|
|
50
|
+
) {
|
|
51
|
+
return html;
|
|
52
|
+
}
|
|
53
|
+
const styleTag = hiddenLayerExportStyleTag();
|
|
54
|
+
const closeHead = html.lastIndexOf("</head>");
|
|
55
|
+
if (closeHead !== -1) {
|
|
56
|
+
return `${html.slice(0, closeHead)}${styleTag}\n${html.slice(closeHead)}`;
|
|
57
|
+
}
|
|
58
|
+
return `${styleTag}\n${html}`;
|
|
59
|
+
}
|
|
60
|
+
|
|
20
61
|
function extractRenderableHtml(content: string): string {
|
|
21
62
|
const bodyMatch = content.match(/<body\b[^>]*>([\s\S]*?)<\/body>/i);
|
|
22
63
|
if (bodyMatch) return bodyMatch[1].trim();
|
|
@@ -90,7 +131,7 @@ export function buildStandaloneHtml(args: {
|
|
|
90
131
|
}
|
|
91
132
|
}
|
|
92
133
|
|
|
93
|
-
return html;
|
|
134
|
+
return injectHiddenLayerExportStyle(html);
|
|
94
135
|
}
|
|
95
136
|
|
|
96
137
|
const combinedBody = [...htmlFiles, ...jsxFiles]
|
|
@@ -108,6 +149,7 @@ export function buildStandaloneHtml(args: {
|
|
|
108
149
|
<style>
|
|
109
150
|
${combinedCss}
|
|
110
151
|
</style>
|
|
152
|
+
${hiddenLayerExportStyleTag()}
|
|
111
153
|
</head>
|
|
112
154
|
<body>
|
|
113
155
|
${combinedBody}
|
|
@@ -53,7 +53,7 @@ When the user asks for a new design and the current navigation view is list, set
|
|
|
53
53
|
|
|
54
54
|
When the user asks you to refine an existing design, call view-screen if the open design is unclear, then read the live current file with get-design-snapshot before editing. For small localized changes, call edit-design with exact search/replace edits. For broad copy-only changes such as translating all visible text, call edit-design in replace-file mode with the complete updated file content from the snapshot so the HTML structure, scripts, styles, and tweaks are preserved without dozens of fragile search blocks. Do not claim the design is updated until the mutating action succeeds.
|
|
55
55
|
|
|
56
|
-
When the user picks one direction from a set of presented variants, delete each unchosen variant screen at most once, then call get-design-snapshot exactly once for the kept screen's fileId and call edit-design on that same fileId. Use edit-design replace-file when expanding the placeholder into the
|
|
56
|
+
When the user picks one direction from a set of presented variants, delete each unchosen variant screen at most once, then call get-design-snapshot exactly once for the kept screen's fileId and call edit-design on that same fileId. Use edit-design replace-file when expanding the placeholder into a complete but compact product UI in the chosen direction. Prioritize the primary workflow and render secondary details as visible controls, states, or affordances if the feature list is too large for one reliable edit. Do not call generate-design after a variant pick unless the user explicitly asks to create a separate new screen.
|
|
57
57
|
|
|
58
58
|
When the user asks to visually inspect or edit a running local app, use open-visual-edit. It registers the localhost bridge, creates or reuses the Design project, places URL-backed iframe screens, stores the active visual-edit context, and navigates to overview mode in one authenticated step. For follow-ups like adding a mobile viewport or another route state, reuse the current designId and connectionId and call open-visual-edit or add-localhost-screens with explicit routes/paths and viewport sizes.
|
|
59
59
|
|
|
@@ -104,13 +104,18 @@ export function boardObjectEntryToHtmlFragment(
|
|
|
104
104
|
const nodeId = id;
|
|
105
105
|
const layerName = name ?? kindToLayerName(kind);
|
|
106
106
|
|
|
107
|
+
// Auto-sized text grows to fit its content (matches the creation path in
|
|
108
|
+
// DesignEditor.tsx canvasPrimitiveHtmlDocument, which omits width/height for
|
|
109
|
+
// `kind === "text" && primitive.autoSize`). Persisting a fixed width/height
|
|
110
|
+
// for these would fight the auto-size behavior on reload.
|
|
111
|
+
const isAutoSizeText = kind === "text" && entry.autoSize === true;
|
|
112
|
+
|
|
107
113
|
// Base inline style — negative left/top are kept as-is.
|
|
108
114
|
const baseStyle = [
|
|
109
115
|
"position:absolute",
|
|
110
116
|
`left:${x}px`,
|
|
111
117
|
`top:${y}px`,
|
|
112
|
-
`width:${width}px`,
|
|
113
|
-
`height:${height}px`,
|
|
118
|
+
...(isAutoSizeText ? [] : [`width:${width}px`, `height:${height}px`]),
|
|
114
119
|
...(geometry.rotation ? [`transform:rotate(${geometry.rotation}deg)`] : []),
|
|
115
120
|
...(typeof geometry.z === "number" ? [`z-index:${geometry.z}`] : []),
|
|
116
121
|
].join(";");
|
|
@@ -152,7 +157,19 @@ export function boardObjectEntryToHtmlFragment(
|
|
|
152
157
|
markerEnd = ` marker-end="url(#${escapeAttr(markerId)})"`;
|
|
153
158
|
}
|
|
154
159
|
|
|
155
|
-
|
|
160
|
+
// Pen-authored paths (pathData present) serialize anchors in absolute
|
|
161
|
+
// canvas/geometry space, not relative to the fragment's own 0,0 origin
|
|
162
|
+
// like the synthesized `pts`-based `d` above. Without a matching viewBox,
|
|
163
|
+
// the SVG paints those absolute coordinates directly inside its own
|
|
164
|
+
// top-left-at-0,0 box while the box itself is *also* offset to
|
|
165
|
+
// geometry.x/y via baseStyle's left/top — doubling the displacement.
|
|
166
|
+
// Give the SVG a viewBox anchored at the geometry origin so pathData
|
|
167
|
+
// coordinates land exactly where they were authored.
|
|
168
|
+
const viewBoxAttr = pathData
|
|
169
|
+
? ` viewBox="${x} ${y} ${width} ${height}"`
|
|
170
|
+
: "";
|
|
171
|
+
|
|
172
|
+
return `<svg style="${baseStyle}" xmlns="http://www.w3.org/2000/svg" overflow="visible"${viewBoxAttr} ${dataAttrs}>${markerDefs}<path d="${escapeAttr(d)}" fill="none" stroke="${escapeAttr(strokeColor)}" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"${markerEnd}/></svg>`;
|
|
156
173
|
}
|
|
157
174
|
|
|
158
175
|
// Ellipse kind uses a <div> with border-radius.
|
|
@@ -165,10 +182,13 @@ export function boardObjectEntryToHtmlFragment(
|
|
|
165
182
|
return `<div style="${style}" ${dataAttrs}></div>`;
|
|
166
183
|
}
|
|
167
184
|
|
|
168
|
-
// Text kind uses a <div> with text content.
|
|
185
|
+
// Text kind uses a <div> with text content. font-size/line-height defaults
|
|
186
|
+
// match the creation path (DesignEditor.tsx canvasPrimitiveHtmlDocument:
|
|
187
|
+
// element.style.fontSize = "16px"; element.style.lineHeight = "1.2";) so a
|
|
188
|
+
// freshly persisted board text object looks identical to its draft preview.
|
|
169
189
|
if (kind === "text") {
|
|
170
190
|
const color = fill ?? "inherit";
|
|
171
|
-
const style = `${baseStyle};color:${color};white-space:pre-wrap;`;
|
|
191
|
+
const style = `${baseStyle};color:${color};white-space:pre-wrap;font-size:16px;line-height:1.2;`;
|
|
172
192
|
return `<div style="${style}" ${dataAttrs}>${text ? escapeHtml(text) : ""}</div>`;
|
|
173
193
|
}
|
|
174
194
|
|