@agent-native/core 0.85.6 → 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.
Files changed (80) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +6 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/client/use-pinch-zoom.ts +76 -11
  5. package/corpus/core/src/collab/presence.ts +63 -3
  6. package/corpus/templates/clips/desktop/src/lib/recorder.ts +245 -77
  7. package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +190 -13
  8. package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +16 -4
  9. package/corpus/templates/design/.agents/skills/export-handoff/SKILL.md +46 -3
  10. package/corpus/templates/design/AGENTS.md +33 -1
  11. package/corpus/templates/design/actions/apply-component-prop-edit.ts +20 -73
  12. package/corpus/templates/design/actions/apply-motion-edit.ts +29 -2
  13. package/corpus/templates/design/actions/apply-visual-edit.ts +4 -2
  14. package/corpus/templates/design/actions/connect-localhost.ts +25 -18
  15. package/corpus/templates/design/actions/export-pdf.ts +8 -1
  16. package/corpus/templates/design/actions/export-zip.ts +10 -1
  17. package/corpus/templates/design/actions/get-motion-timeline.ts +26 -20
  18. package/corpus/templates/design/actions/grant-localhost-write-consent.ts +10 -0
  19. package/corpus/templates/design/actions/insert-asset.ts +190 -7
  20. package/corpus/templates/design/actions/open-visual-edit.ts +27 -5
  21. package/corpus/templates/design/actions/present-design-variants.ts +2 -2
  22. package/corpus/templates/design/actions/revoke-localhost-write-consent.ts +18 -14
  23. package/corpus/templates/design/actions/run-design-audit.ts +7 -4
  24. package/corpus/templates/design/actions/write-local-file.ts +47 -22
  25. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +221 -66
  26. package/corpus/templates/design/app/components/design/EditPanel.tsx +650 -237
  27. package/corpus/templates/design/app/components/design/LayersPanel.tsx +526 -127
  28. package/corpus/templates/design/app/components/design/MotionDock.tsx +234 -46
  29. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +1497 -408
  30. package/corpus/templates/design/app/components/design/StatesPanel.tsx +25 -2
  31. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +640 -72
  32. package/corpus/templates/design/app/components/design/bridge/motion-preview.bridge.ts +605 -0
  33. package/corpus/templates/design/app/components/design/canvas-primitive-style.ts +50 -26
  34. package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +16 -4
  35. package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +90 -103
  36. package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +111 -5
  37. package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +13 -2
  38. package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +42 -2
  39. package/corpus/templates/design/app/components/design/inspector/scrub-input-utils.ts +11 -2
  40. package/corpus/templates/design/app/components/design/types.ts +16 -0
  41. package/corpus/templates/design/app/components/visual-editor/CanvasCommentPins.tsx +24 -6
  42. package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +15 -1
  43. package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +77 -0
  44. package/corpus/templates/design/app/i18n/zh-TW.ts +1 -0
  45. package/corpus/templates/design/app/i18n-data.ts +18 -0
  46. package/corpus/templates/design/app/lib/design-import.ts +95 -0
  47. package/corpus/templates/design/app/pages/DesignEditor.tsx +4013 -838
  48. package/corpus/templates/design/changelog/2026-07-03-canvas-interactions-now-match-figma-rotation-aware-resizing-.md +6 -0
  49. package/corpus/templates/design/changelog/2026-07-03-inspector-fixes-mixed-selections-show-mixed-instead-of-wrong.md +6 -0
  50. package/corpus/templates/design/changelog/2026-07-03-keyframe-timeline-works-reliably-drag-keyframes-smoothly-pic.md +6 -0
  51. package/corpus/templates/design/changelog/2026-07-03-layers-panel-matches-figma-top-layer-on-top-drag-with-auto-s.md +6 -0
  52. package/corpus/templates/design/changelog/2026-07-03-much-faster-editor-smooth-dragging-zooming-and-panel-updates.md +6 -0
  53. package/corpus/templates/design/changelog/2026-07-03-pen-tool-refinements-click-the-first-point-to-close-with-a-d.md +6 -0
  54. package/corpus/templates/design/changelog/2026-07-03-text-editing-enter-adds-a-line-break-international-ime-typin.md +6 -0
  55. package/corpus/templates/design/changelog/2026-07-03-undo-and-redo-are-dependable-across-agent-edits-screen-switc.md +6 -0
  56. package/corpus/templates/design/server/lib/design-export.ts +43 -1
  57. package/corpus/templates/design/shared/board-file.ts +25 -5
  58. package/corpus/templates/design/shared/canvas-math.ts +754 -9
  59. package/corpus/templates/design/shared/code-layer.ts +304 -26
  60. package/corpus/templates/design/shared/color-utils.ts +84 -0
  61. package/corpus/templates/design/shared/design-source-capabilities.ts +16 -7
  62. package/corpus/templates/design/shared/motion-compiler.ts +75 -31
  63. package/corpus/templates/design/shared/motion-timeline.ts +335 -0
  64. package/corpus/templates/design/shared/pen-path.ts +200 -23
  65. package/dist/client/use-pinch-zoom.d.ts.map +1 -1
  66. package/dist/client/use-pinch-zoom.js +76 -11
  67. package/dist/client/use-pinch-zoom.js.map +1 -1
  68. package/dist/collab/awareness.d.ts +2 -2
  69. package/dist/collab/awareness.d.ts.map +1 -1
  70. package/dist/collab/presence.d.ts.map +1 -1
  71. package/dist/collab/presence.js +54 -3
  72. package/dist/collab/presence.js.map +1 -1
  73. package/dist/collab/routes.d.ts +2 -2
  74. package/dist/collab/struct-routes.d.ts +1 -1
  75. package/dist/observability/routes.d.ts +3 -3
  76. package/dist/progress/routes.d.ts +1 -1
  77. package/dist/resources/handlers.d.ts +2 -2
  78. package/dist/secrets/routes.d.ts +3 -3
  79. package/dist/server/transcribe-voice.d.ts +1 -1
  80. package/package.json +1 -1
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-03
4
+ ---
5
+
6
+ Canvas interactions now match Figma: rotation-aware resizing, shift constraints, smarter snapping with equal-gap guides, group rotation, and reliable alt-drag duplicating
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: fixed
3
+ date: 2026-07-03
4
+ ---
5
+
6
+ Inspector fixes: mixed selections show Mixed instead of wrong values, gradients edit safely, and hidden fills restore their original colors
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: fixed
3
+ date: 2026-07-03
4
+ ---
5
+
6
+ Keyframe timeline works reliably: drag keyframes smoothly, pick easing per keyframe, and motion edits save safely without reverting
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-03
4
+ ---
5
+
6
+ Layers panel matches Figma: top layer on top, drag with auto-scroll and spring-open folders, and hidden layers stay out of exports
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-03
4
+ ---
5
+
6
+ Much faster editor: smooth dragging, zooming, and panel updates in large multi-screen files
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-03
4
+ ---
5
+
6
+ Pen tool refinements: click the first point to close with a drag-to-curve, double-click to finish, alt to break handles, and anchors stay visible at any zoom
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: fixed
3
+ date: 2026-07-03
4
+ ---
5
+
6
+ Text editing: Enter adds a line break, international (IME) typing works, and text keeps its content during live collaboration
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: fixed
3
+ date: 2026-07-03
4
+ ---
5
+
6
+ Undo and redo are dependable across agent edits, screen switches, and copy/paste between tabs
@@ -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}
@@ -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
- return `<svg style="${baseStyle}" xmlns="http://www.w3.org/2000/svg" overflow="visible" ${dataAttrs}>${markerDefs}<path d="${escapeAttr(d)}" fill="none" stroke="${escapeAttr(strokeColor)}" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"${markerEnd}/></svg>`;
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