@agent-native/core 0.187.0 → 0.187.1-nightly-20260925003003

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 (158) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +4 -3
  3. package/corpus/templates/analytics/changelog/2026-09-24-analytics-sidebar-footer-aligns-consistently.md +6 -0
  4. package/corpus/templates/analytics/changelog/2026-09-24-dashboard-emails-match-stacked-area-totals.md +6 -0
  5. package/corpus/templates/analytics/server/lib/report-chart-svg.ts +47 -20
  6. package/corpus/templates/calendar/app/components/calendar/AttendeeAutocomplete.tsx +1 -1
  7. package/corpus/templates/calendar/changelog/2026-09-24-guest-inputs-wrap-beneath-existing-guests-so-the-active-inpu.md +6 -0
  8. package/corpus/templates/clips/app/components/editor/stitch-manager.tsx +8 -3
  9. package/corpus/templates/clips/app/lib/recording-link.ts +21 -0
  10. package/corpus/templates/clips/app/routes/record.tsx +27 -8
  11. package/corpus/templates/clips/changelog/2026-09-24-the-camera-bubble-stays-visible-while-you-reposition-it-befo.md +6 -0
  12. package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +7 -0
  13. package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +63 -55
  14. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +251 -74
  15. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +66 -56
  16. package/corpus/templates/design/app/components/design/EditPanel.tsx +19 -0
  17. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +59 -9
  18. package/corpus/templates/design/app/components/design/edit-panel/interaction-state-helpers.ts +4 -0
  19. package/corpus/templates/design/app/components/design/edit-panel/layout-properties.tsx +119 -0
  20. package/corpus/templates/design/app/components/design/edit-panel/stroke-properties.tsx +48 -51
  21. package/corpus/templates/design/app/components/design/edit-panel/style-change-types.ts +1 -0
  22. package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +298 -187
  23. package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +2 -2
  24. package/corpus/templates/design/app/components/design/inspector/index.ts +4 -0
  25. package/corpus/templates/design/app/components/design/multi-screen/types.ts +4 -2
  26. package/corpus/templates/design/app/i18n/en-US.ts +6 -0
  27. package/corpus/templates/design/app/pages/Present.tsx +101 -87
  28. package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +75 -14
  29. package/corpus/templates/design/app/pages/design-editor/commands/README.md +1 -0
  30. package/corpus/templates/design/app/pages/design-editor/commands/commit-relative-style-delta-to-selected-layers.ts +69 -56
  31. package/corpus/templates/design/app/pages/design-editor/commands/mode-change.ts +16 -0
  32. package/corpus/templates/design/app/pages/design-editor/commands/scale-selection.ts +17 -2
  33. package/corpus/templates/design/app/pages/design-editor/commands/styles-change.ts +23 -30
  34. package/corpus/templates/design/app/pages/design-editor/commands/swap-fill-stroke.ts +105 -0
  35. package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +21 -0
  36. package/corpus/templates/design/app/pages/present-review-state.ts +7 -1
  37. package/corpus/templates/design/changelog/2026-09-24-a-vector-s-stroke-row-shows-position-beside-weight-instead-o.md +6 -0
  38. package/corpus/templates/design/changelog/2026-09-24-css-margins-can-be-adjusted-on-the-canvas-and-in-the-layout-.md +6 -0
  39. package/corpus/templates/design/changelog/2026-09-24-design-reviews-show-the-real-canvas-beside-its-conversation.md +6 -0
  40. package/corpus/templates/design/changelog/2026-09-24-double-clicking-text-or-a-vector-on-the-board-starts-editing.md +6 -0
  41. package/corpus/templates/design/changelog/2026-09-24-interact-opens-a-focused-responsive-preview-without-reloadin.md +6 -0
  42. package/corpus/templates/design/changelog/2026-09-24-keep-gradient-values-visible-and-limit-canvas-paints-to-supp.md +6 -0
  43. package/corpus/templates/design/changelog/2026-09-24-open-pen-paths-no-longer-paint-a-filled-triangle-after-shift.md +6 -0
  44. package/corpus/templates/design/changelog/2026-09-24-re-clicking-the-active-responsive-preview-returns-to-the-can.md +6 -0
  45. package/corpus/templates/design/changelog/2026-09-24-resized-vectors-can-be-point-edited-and-the-k-scale-tool-sho.md +6 -0
  46. package/corpus/templates/design/changelog/2026-09-24-while-editing-text-click-to-place-the-caret-and-double-click.md +6 -0
  47. package/corpus/templates/design/e2e/helpers.ts +19 -2
  48. package/corpus/templates/mail/app/components/email/ComposeModal.tsx +1 -1
  49. package/corpus/templates/mail/changelog/2026-09-24-gmail-push-ack.md +6 -0
  50. package/corpus/templates/mail/changelog/2026-09-24-the-composer-keeps-its-taller-layout-in-a-narrower-window.md +6 -0
  51. package/corpus/templates/mail/server/db/schema.ts +26 -1
  52. package/corpus/templates/mail/server/lib/inbox-store.ts +68 -23
  53. package/corpus/templates/mail/server/lib/inbox-sync.ts +43 -17
  54. package/corpus/templates/mail/server/plugins/db.ts +19 -0
  55. package/corpus/templates/mail/server/routes/api/gmail/push.post.ts +4 -15
  56. package/corpus/templates/slides/.agents/skills/create-deck/SKILL.md +45 -30
  57. package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +18 -2
  58. package/corpus/templates/slides/actions/export-html.ts +28 -17
  59. package/corpus/templates/slides/app/hooks/use-deck-design-system.ts +27 -15
  60. package/corpus/templates/slides/app/pages/DeckEditor.tsx +1 -1
  61. package/corpus/templates/slides/changelog/2026-09-23-decks-with-no-design-system-now-follow-a-theme-chosen-for-th.md +6 -0
  62. package/corpus/templates/slides/shared/slide-background.ts +3 -1
  63. package/dist/agent/engine/builder-engine.js +11 -0
  64. package/dist/agent/engine/types.d.ts +1 -0
  65. package/dist/agent/production-agent.d.ts +2 -0
  66. package/dist/agent/production-agent.js +32 -4
  67. package/dist/agent/run-loop-with-resume.js +6 -0
  68. package/dist/cli/index.js +4 -4
  69. package/dist/cli/process.d.ts +10 -1
  70. package/dist/cli/process.js +66 -0
  71. package/dist/cli/workspace-dev.js +2 -0
  72. package/dist/client/agent-chat.js +13 -14
  73. package/dist/client/error-format.js +4 -4
  74. package/dist/client/observability/ObservabilityDashboard.js +95 -65
  75. package/dist/client/observability/OutputPreview.d.ts +2 -1
  76. package/dist/client/observability/OutputPreview.js +64 -7
  77. package/dist/client/observability/useObservability.d.ts +2 -1
  78. package/dist/client/observability/useObservability.js +5 -1
  79. package/dist/client/settings/UsageSection.js +105 -17
  80. package/dist/collab/routes.d.ts +1 -1
  81. package/dist/collab/struct-routes.d.ts +1 -1
  82. package/dist/db/client.d.ts +44 -0
  83. package/dist/db/client.js +62 -3
  84. package/dist/db/create-get-db.js +23 -1
  85. package/dist/db/embedded-runtime.d.ts +21 -0
  86. package/dist/db/embedded-runtime.js +27 -0
  87. package/dist/db/migrations.js +2 -0
  88. package/dist/db/server-runtime.d.ts +22 -0
  89. package/dist/db/server-runtime.js +26 -0
  90. package/dist/deploy/build.d.ts +29 -0
  91. package/dist/deploy/build.js +204 -121
  92. package/dist/feature-flags/index.d.ts +1 -1
  93. package/dist/feature-flags/index.js +1 -1
  94. package/dist/feature-flags/registry.d.ts +1 -0
  95. package/dist/feature-flags/registry.js +5 -0
  96. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  97. package/dist/index.d.ts +1 -1
  98. package/dist/index.js +1 -1
  99. package/dist/integrations/webhook-handler.js +4 -1
  100. package/dist/jobs/background-automation-runner.js +6 -1
  101. package/dist/localization/core-messages/ar-SA.js +9 -1
  102. package/dist/localization/core-messages/de-DE.js +9 -1
  103. package/dist/localization/core-messages/en-US.d.ts +9 -1
  104. package/dist/localization/core-messages/en-US.js +9 -1
  105. package/dist/localization/core-messages/es-ES.js +9 -1
  106. package/dist/localization/core-messages/fr-FR.js +9 -1
  107. package/dist/localization/core-messages/hi-IN.js +9 -1
  108. package/dist/localization/core-messages/ja-JP.js +9 -1
  109. package/dist/localization/core-messages/ko-KR.js +9 -1
  110. package/dist/localization/core-messages/pt-BR.js +9 -1
  111. package/dist/localization/core-messages/supplemental/ar-SA.js +1 -0
  112. package/dist/localization/core-messages/supplemental/de-DE.js +1 -0
  113. package/dist/localization/core-messages/supplemental/en-US.js +1 -0
  114. package/dist/localization/core-messages/supplemental/es-ES.js +1 -0
  115. package/dist/localization/core-messages/supplemental/fr-FR.js +1 -0
  116. package/dist/localization/core-messages/supplemental/hi-IN.js +1 -0
  117. package/dist/localization/core-messages/supplemental/ja-JP.js +1 -0
  118. package/dist/localization/core-messages/supplemental/ko-KR.js +1 -0
  119. package/dist/localization/core-messages/supplemental/pt-BR.js +1 -0
  120. package/dist/localization/core-messages/supplemental/zh-CN.js +1 -0
  121. package/dist/localization/core-messages/supplemental/zh-TW.js +1 -0
  122. package/dist/localization/core-messages/zh-CN.js +9 -1
  123. package/dist/localization/core-messages/zh-TW.js +9 -1
  124. package/dist/localization/core-messages.d.ts +9 -1
  125. package/dist/localization/mcp-settings-messages.d.ts +1 -0
  126. package/dist/mcp/connect-route.js +45 -8
  127. package/dist/mcp/connect-store.d.ts +7 -5
  128. package/dist/mcp/connect-store.js +30 -39
  129. package/dist/notifications/routes.d.ts +3 -3
  130. package/dist/observability/actions/get-observability-review-detail.d.ts +7 -0
  131. package/dist/observability/actions/get-observability-review-detail.js +25 -0
  132. package/dist/observability/reviews.d.ts +9 -1
  133. package/dist/observability/reviews.js +20 -0
  134. package/dist/observability/routes.d.ts +3 -3
  135. package/dist/observability/types.d.ts +8 -0
  136. package/dist/org/handlers.d.ts +1 -1
  137. package/dist/provider-api/actions/custom-provider-registration.d.ts +7 -7
  138. package/dist/provider-api/actions/provider-api.d.ts +9 -9
  139. package/dist/scripts/db/query.js +6 -1
  140. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  141. package/dist/server/agent-engine-ollama-models-route.d.ts +2 -2
  142. package/dist/server/agent-teams.js +4 -1
  143. package/dist/server/auth.js +60 -20
  144. package/dist/server/better-auth-instance.js +7 -1
  145. package/dist/server/core-routes-plugin.d.ts +1 -1
  146. package/dist/server/core-routes-plugin.js +2 -0
  147. package/dist/server/embedded.js +6 -0
  148. package/dist/server/framework-request-handler.js +6 -0
  149. package/dist/server/realtime-token.d.ts +1 -1
  150. package/dist/usage/actions/get-usage-metrics.js +4 -1
  151. package/dist/usage/metrics-store.d.ts +19 -0
  152. package/dist/usage/metrics-store.js +106 -14
  153. package/dist/usage/store.d.ts +7 -2
  154. package/dist/usage/store.js +25 -4
  155. package/dist/vite/action-types-plugin.js +4 -0
  156. package/dist/vite/client.d.ts +6 -1
  157. package/dist/vite/client.js +40 -1
  158. package/package.json +4 -3
@@ -3872,6 +3872,10 @@ export const editorChromeBridgeScript: string = `"use strict";
3872
3872
  "paddingRight",
3873
3873
  "paddingBottom",
3874
3874
  "paddingLeft",
3875
+ "marginTop",
3876
+ "marginRight",
3877
+ "marginBottom",
3878
+ "marginLeft",
3875
3879
  "alignItems",
3876
3880
  "alignContent",
3877
3881
  "justifyItems",
@@ -4023,6 +4027,17 @@ export const editorChromeBridgeScript: string = `"use strict";
4023
4027
  function chromeContrastColorForElement(el) {
4024
4028
  return elementLooksLikeComponent(el) ? "var(--design-editor-component-contrast-color)" : "var(--design-editor-accent-contrast-color)";
4025
4029
  }
4030
+ function marginValueIsAuto(el, side, computedValue) {
4031
+ var typedElement = el;
4032
+ if (typeof typedElement.computedStyleMap === "function") {
4033
+ var typedValue = typedElement.computedStyleMap().get("margin-" + side);
4034
+ if (String(typedValue).trim().toLowerCase() === "auto") return true;
4035
+ }
4036
+ var inlineValue = el.style.getPropertyValue(
4037
+ "margin-" + side
4038
+ );
4039
+ return inlineValue.trim().toLowerCase() === "auto" || computedValue.trim().toLowerCase() === "auto";
4040
+ }
4026
4041
  function collectComputedStyles(cs, paintCs, strokeCs = paintCs) {
4027
4042
  var backgroundClip = cs.backgroundClip;
4028
4043
  var webkitBackgroundClip = cs.getPropertyValue("-webkit-background-clip");
@@ -4323,6 +4338,11 @@ export const editorChromeBridgeScript: string = `"use strict";
4323
4338
  var strokeTarget = vectorStrokeTarget(el);
4324
4339
  var strokeCs = strokeTarget ? window.getComputedStyle(strokeTarget) : paintCs;
4325
4340
  var computed = collectComputedStyles(cs, paintCs, strokeCs);
4341
+ var paintTarget = vectorPaintTarget(el) || (el.tagName.toLowerCase() === "path" && el.hasAttribute("data-an-pen-nodes") ? el : null);
4342
+ var penNodesOwner = paintTarget && paintTarget.hasAttribute("data-an-pen-nodes") ? paintTarget : el;
4343
+ if (paintTarget && paintTarget.getAttribute("fill-opacity") === "0" && (penNodesOwner.getAttribute("data-an-pen-nodes") || "").indexOf("[0") === 0) {
4344
+ computed.fillOpacity = paintTarget.style.getPropertyValue("fill-opacity") || "1";
4345
+ }
4326
4346
  if (el.tagName.toLowerCase() === "svg" && el.getAttribute("data-an-primitive") === "pasted-svg" && !vectorPaintTarget(el) && !el.hasAttribute("fill") && !el.style.getPropertyValue("fill")) {
4327
4347
  computed.fill = "";
4328
4348
  }
@@ -4346,6 +4366,13 @@ export const editorChromeBridgeScript: string = `"use strict";
4346
4366
  computed.resolvedLineHeightPx = resolvedLineHeightPx;
4347
4367
  }
4348
4368
  }
4369
+ if (marginValueIsAuto(el, "top", cs.marginTop)) computed.marginTop = "auto";
4370
+ if (marginValueIsAuto(el, "right", cs.marginRight))
4371
+ computed.marginRight = "auto";
4372
+ if (marginValueIsAuto(el, "bottom", cs.marginBottom))
4373
+ computed.marginBottom = "auto";
4374
+ if (marginValueIsAuto(el, "left", cs.marginLeft))
4375
+ computed.marginLeft = "auto";
4349
4376
  return {
4350
4377
  ...computed,
4351
4378
  "--an-vector-stroke-position": el.getAttribute("data-an-vector-stroke-position") || "",
@@ -4693,7 +4720,7 @@ export const editorChromeBridgeScript: string = `"use strict";
4693
4720
  var edge = document.createElement("span");
4694
4721
  edge.setAttribute("data-agent-native-edge-handle", pos);
4695
4722
  var cursor = pos === "n" || pos === "s" ? "ns-resize" : "ew-resize";
4696
- edge.style.cssText = "position:absolute;pointer-events:auto;cursor:" + cursor + ";background:transparent;";
4723
+ edge.style.cssText = "position:absolute;z-index:2;pointer-events:auto;cursor:" + cursor + ";background:transparent;";
4697
4724
  if (pos === "n") {
4698
4725
  edge.style.left = "0";
4699
4726
  edge.style.right = "0";
@@ -6203,10 +6230,10 @@ export const editorChromeBridgeScript: string = `"use strict";
6203
6230
  var scale = chromeLineScale();
6204
6231
  return "repeating-linear-gradient(" + angle + ", " + stripe + " 0 " + 1 * scale + "px, " + tint + " " + 1 * scale + "px " + 4 * scale + "px, transparent " + 4 * scale + "px " + 7 * scale + "px)";
6205
6232
  }
6206
- function clampSpacingValue(value) {
6233
+ function clampSpacingValue(value, allowNegative) {
6207
6234
  var rounded = Math.round(value);
6208
6235
  if (!Number.isFinite(rounded)) return 0;
6209
- return Math.max(0, Math.min(999, rounded));
6236
+ return Math.max(allowNegative ? -999 : 0, Math.min(999, rounded));
6210
6237
  }
6211
6238
  var PADDING_HANDLE_HIT_TOLERANCE_BASE = 4;
6212
6239
  function hitRectForPaddingHandle(line, region, tolerance) {
@@ -6226,6 +6253,35 @@ export const editorChromeBridgeScript: string = `"use strict";
6226
6253
  height: Math.max(1, hitBottom - hitY)
6227
6254
  };
6228
6255
  }
6256
+ function hitRectForMarginHandle(line, tolerance, side, elementRect) {
6257
+ var hit = {
6258
+ x: line.x - tolerance,
6259
+ y: line.y - tolerance,
6260
+ width: line.width + tolerance * 2,
6261
+ height: line.height + tolerance * 2
6262
+ };
6263
+ var inwardReach = side === "top" || side === "bottom" ? clampHandleInwardReach(Number.POSITIVE_INFINITY, elementRect.height) : clampHandleInwardReach(Number.POSITIVE_INFINITY, elementRect.width);
6264
+ if (side === "top") {
6265
+ var bottom = Math.min(hit.y + hit.height, inwardReach);
6266
+ hit.y = Math.min(hit.y, bottom - 1);
6267
+ hit.height = Math.max(1, bottom - hit.y);
6268
+ } else if (side === "bottom") {
6269
+ var originalBottom = hit.y + hit.height;
6270
+ var top = Math.max(hit.y, elementRect.height - inwardReach);
6271
+ hit.y = top;
6272
+ hit.height = Math.max(1, originalBottom - top);
6273
+ } else if (side === "left") {
6274
+ var right = Math.min(hit.x + hit.width, inwardReach);
6275
+ hit.x = Math.min(hit.x, right - 1);
6276
+ hit.width = Math.max(1, right - hit.x);
6277
+ } else if (side === "right") {
6278
+ var originalRight = hit.x + hit.width;
6279
+ var left = Math.max(hit.x, elementRect.width - inwardReach);
6280
+ hit.x = left;
6281
+ hit.width = Math.max(1, originalRight - left);
6282
+ }
6283
+ return hit;
6284
+ }
6229
6285
  function makeSpacingHandle(config) {
6230
6286
  var region = config.region;
6231
6287
  if (!region || region.width <= 0 || region.height <= 0) return null;
@@ -6239,6 +6295,11 @@ export const editorChromeBridgeScript: string = `"use strict";
6239
6295
  config.line,
6240
6296
  roundedRegion,
6241
6297
  PADDING_HANDLE_HIT_TOLERANCE_BASE * chromeLineScale()
6298
+ ) : config.kind === "margin" ? hitRectForMarginHandle(
6299
+ config.line,
6300
+ PADDING_HANDLE_HIT_TOLERANCE_BASE * chromeLineScale(),
6301
+ config.side || "",
6302
+ config.elementRect || { width: 0, height: 0 }
6242
6303
  ) : roundedRegion;
6243
6304
  return {
6244
6305
  key: config.key,
@@ -6248,7 +6309,8 @@ export const editorChromeBridgeScript: string = `"use strict";
6248
6309
  oppositeProperty: config.oppositeProperty || "",
6249
6310
  side: config.side || "",
6250
6311
  orientation: config.orientation,
6251
- value: clampSpacingValue(config.value),
6312
+ value: clampSpacingValue(config.value, config.kind === "margin"),
6313
+ valueLabel: config.valueLabel || "",
6252
6314
  region: roundedRegion,
6253
6315
  hit,
6254
6316
  line: config.line
@@ -6389,6 +6451,109 @@ export const editorChromeBridgeScript: string = `"use strict";
6389
6451
  }
6390
6452
  return handles.filter(Boolean);
6391
6453
  }
6454
+ function buildMarginSpacingHandles(el, rect, cs) {
6455
+ var line = chromeLineScale();
6456
+ var tickLength = Math.max(6, Math.min(18, Math.min(rect.width, rect.height) * 0.12)) * line;
6457
+ var marginHandleClearance = 6 * Math.max(1, line);
6458
+ var top = clampSpacingValue(readPx(cs.marginTop), true);
6459
+ var right = clampSpacingValue(readPx(cs.marginRight), true);
6460
+ var bottom = clampSpacingValue(readPx(cs.marginBottom), true);
6461
+ var left = clampSpacingValue(readPx(cs.marginLeft), true);
6462
+ return [
6463
+ makeSpacingHandle({
6464
+ key: "margin:top",
6465
+ kind: "margin",
6466
+ property: "marginTop",
6467
+ oppositeProperty: "marginBottom",
6468
+ side: "top",
6469
+ orientation: "horizontal",
6470
+ value: top,
6471
+ valueLabel: marginValueIsAuto(el, "top", cs.marginTop) ? "auto" : "",
6472
+ elementRect: rect,
6473
+ region: {
6474
+ x: 0,
6475
+ y: Math.min(0, -top),
6476
+ width: rect.width,
6477
+ height: Math.max(1, Math.abs(top))
6478
+ },
6479
+ line: {
6480
+ x: rect.width / 2 - tickLength / 2,
6481
+ y: (top >= 0 ? -1 : 1) * Math.max(marginHandleClearance, Math.abs(top) / 2) - line / 2,
6482
+ width: tickLength,
6483
+ height: line
6484
+ }
6485
+ }),
6486
+ makeSpacingHandle({
6487
+ key: "margin:right",
6488
+ kind: "margin",
6489
+ property: "marginRight",
6490
+ oppositeProperty: "marginLeft",
6491
+ side: "right",
6492
+ orientation: "vertical",
6493
+ value: right,
6494
+ valueLabel: marginValueIsAuto(el, "right", cs.marginRight) ? "auto" : "",
6495
+ elementRect: rect,
6496
+ region: {
6497
+ x: rect.width + Math.min(0, right),
6498
+ y: 0,
6499
+ width: Math.max(1, Math.abs(right)),
6500
+ height: rect.height
6501
+ },
6502
+ line: {
6503
+ x: rect.width + (right >= 0 ? 1 : -1) * Math.max(marginHandleClearance, Math.abs(right) / 2) - line / 2,
6504
+ y: rect.height / 2 - tickLength / 2,
6505
+ width: line,
6506
+ height: tickLength
6507
+ }
6508
+ }),
6509
+ makeSpacingHandle({
6510
+ key: "margin:bottom",
6511
+ kind: "margin",
6512
+ property: "marginBottom",
6513
+ oppositeProperty: "marginTop",
6514
+ side: "bottom",
6515
+ orientation: "horizontal",
6516
+ value: bottom,
6517
+ valueLabel: marginValueIsAuto(el, "bottom", cs.marginBottom) ? "auto" : "",
6518
+ elementRect: rect,
6519
+ region: {
6520
+ x: 0,
6521
+ y: rect.height + Math.min(0, bottom),
6522
+ width: rect.width,
6523
+ height: Math.max(1, Math.abs(bottom))
6524
+ },
6525
+ line: {
6526
+ x: rect.width / 2 - tickLength / 2,
6527
+ y: rect.height + (bottom >= 0 ? 1 : -1) * Math.max(marginHandleClearance, Math.abs(bottom) / 2) - line / 2,
6528
+ width: tickLength,
6529
+ height: line
6530
+ }
6531
+ }),
6532
+ makeSpacingHandle({
6533
+ key: "margin:left",
6534
+ kind: "margin",
6535
+ property: "marginLeft",
6536
+ oppositeProperty: "marginRight",
6537
+ side: "left",
6538
+ orientation: "vertical",
6539
+ value: left,
6540
+ valueLabel: marginValueIsAuto(el, "left", cs.marginLeft) ? "auto" : "",
6541
+ elementRect: rect,
6542
+ region: {
6543
+ x: Math.min(0, -left),
6544
+ y: 0,
6545
+ width: Math.max(1, Math.abs(left)),
6546
+ height: rect.height
6547
+ },
6548
+ line: {
6549
+ x: (left >= 0 ? -1 : 1) * Math.max(marginHandleClearance, Math.abs(left) / 2) - line / 2,
6550
+ y: rect.height / 2 - tickLength / 2,
6551
+ width: line,
6552
+ height: tickLength
6553
+ }
6554
+ })
6555
+ ].filter(Boolean);
6556
+ }
6392
6557
  function buildGapSpacingHandles(el, rect, cs) {
6393
6558
  var children = visibleLayoutChildren(el);
6394
6559
  if (children.length < 2) return [];
@@ -6473,14 +6638,10 @@ export const editorChromeBridgeScript: string = `"use strict";
6473
6638
  function buildSpacingHandles(el) {
6474
6639
  if (!el || !document.documentElement.contains(el)) return [];
6475
6640
  if (Math.abs(currentRotation(el)) > 0.01) return [];
6476
- var children = visibleLayoutChildren(el);
6477
- if (children.length === 0) return [];
6478
6641
  var rect = el.getBoundingClientRect();
6479
6642
  if (rect.width <= 0 || rect.height <= 0) return [];
6480
6643
  var cs = window.getComputedStyle(el);
6481
- return buildPaddingSpacingHandles(el, rect, cs).concat(
6482
- buildGapSpacingHandles(el, rect, cs)
6483
- );
6644
+ return buildPaddingSpacingHandles(el, rect, cs).concat(buildMarginSpacingHandles(el, rect, cs)).concat(buildGapSpacingHandles(el, rect, cs));
6484
6645
  }
6485
6646
  function showSpacingBadgeForHandle(handle, value, cursorPoint) {
6486
6647
  if (!selectedEl || !handle) {
@@ -6499,7 +6660,7 @@ export const editorChromeBridgeScript: string = `"use strict";
6499
6660
  x = rect.left + handle.region.x + handle.region.width / 2;
6500
6661
  y = rect.top + handle.region.y + handle.region.height / 2;
6501
6662
  }
6502
- spacingBadge.textContent = String(clampSpacingValue(value)) + "px";
6663
+ spacingBadge.textContent = handle.kind === "margin" && handle.valueLabel === "auto" && value === handle.value ? "auto" : String(clampSpacingValue(value, handle.kind === "margin")) + "px";
6503
6664
  spacingBadge.style.display = "block";
6504
6665
  spacingBadge.style.background = spacingColor(handle.kind);
6505
6666
  spacingBadge.style.fontSize = 10 * line + "px";
@@ -6527,7 +6688,7 @@ export const editorChromeBridgeScript: string = `"use strict";
6527
6688
  lineNode.style.background = spacingColor(handle.kind);
6528
6689
  spacingOverlay.appendChild(lineNode);
6529
6690
  var hatchTile = 6 * chromeLineScale() + "px";
6530
- if (handle.kind === "padding") {
6691
+ if (handle.kind === "padding" || handle.kind === "margin") {
6531
6692
  var hatchNode = document.createElement("span");
6532
6693
  hatchNode.setAttribute("data-agent-native-spacing-hatch", handle.kind);
6533
6694
  hatchNode.style.position = "absolute";
@@ -6551,15 +6712,16 @@ export const editorChromeBridgeScript: string = `"use strict";
6551
6712
  regionNode.style.display = "block";
6552
6713
  regionNode.style.boxSizing = "border-box";
6553
6714
  regionNode.style.pointerEvents = "auto";
6715
+ regionNode.style.zIndex = handle.kind === "padding" ? "3" : handle.kind === "margin" ? "1" : "0";
6554
6716
  regionNode.style.backgroundSize = hatchTile + " " + hatchTile;
6555
6717
  regionNode.style.cursor = handle.orientation === "vertical" ? "ew-resize" : "ns-resize";
6556
- var hitRect = handle.kind === "padding" ? handle.hit : handle.region;
6718
+ var hitRect = handle.kind === "padding" || handle.kind === "margin" ? handle.hit : handle.region;
6557
6719
  regionNode.style.left = hitRect.x + "px";
6558
6720
  regionNode.style.top = hitRect.y + "px";
6559
6721
  regionNode.style.width = hitRect.width + "px";
6560
6722
  regionNode.style.height = hitRect.height + "px";
6561
- regionNode.style.background = handle.kind !== "padding" && active ? spacingFill(handle.kind, handle.orientation) : "transparent";
6562
- regionNode.style.outline = handle.kind !== "padding" && active ? "1px solid " + spacingColor(handle.kind) : "0";
6723
+ regionNode.style.background = handle.kind !== "padding" && handle.kind !== "margin" && active ? spacingFill(handle.kind, handle.orientation) : "transparent";
6724
+ regionNode.style.outline = handle.kind !== "padding" && handle.kind !== "margin" && active ? "1px solid " + spacingColor(handle.kind) : "0";
6563
6725
  regionNode.style.outlineOffset = "-1px";
6564
6726
  regionNode.addEventListener(
6565
6727
  "pointerdown",
@@ -6586,7 +6748,7 @@ export const editorChromeBridgeScript: string = `"use strict";
6586
6748
  var hovered = Boolean(hoverGroupKeys[handle.groupKey]);
6587
6749
  var regionNode = spacingHandleNodesByKey[handle.key];
6588
6750
  if (regionNode) {
6589
- var gapHighlighted = handle.kind !== "padding" && active;
6751
+ var gapHighlighted = handle.kind !== "padding" && handle.kind !== "margin" && active;
6590
6752
  regionNode.style.background = gapHighlighted ? spacingFill(handle.kind, handle.orientation) : "transparent";
6591
6753
  regionNode.style.outline = gapHighlighted ? "1px solid " + spacingColor(handle.kind) : "0";
6592
6754
  }
@@ -6600,7 +6762,7 @@ export const editorChromeBridgeScript: string = `"use strict";
6600
6762
  var activeGroupKeys = {};
6601
6763
  if (!activeHandle) return activeGroupKeys;
6602
6764
  activeGroupKeys[activeHandle.groupKey] = true;
6603
- if (spacingDrag && spacingDrag.mirrorOpposite && activeHandle.kind === "padding" && activeHandle.oppositeProperty) {
6765
+ if (spacingDrag && spacingDrag.mirrorOpposite && (activeHandle.kind === "padding" || activeHandle.kind === "margin") && activeHandle.oppositeProperty) {
6604
6766
  handles.forEach(function(handle) {
6605
6767
  if (!handle) return;
6606
6768
  if (handle.property === activeHandle.oppositeProperty) {
@@ -8326,25 +8488,27 @@ export const editorChromeBridgeScript: string = `"use strict";
8326
8488
  active.blur();
8327
8489
  }
8328
8490
  }
8491
+ function syncShieldPointerEvents() {
8492
+ shieldOverlay.style.pointerEvents = interactionMode || textEditPointerState ? "none" : "auto";
8493
+ }
8329
8494
  function setTextEditingPointerPassthrough(enabled) {
8330
8495
  if (enabled) {
8331
8496
  if (!textEditPointerState) {
8332
8497
  textEditPointerState = {
8333
- shield: shieldOverlay.style.pointerEvents,
8334
8498
  selection: selectionOverlay.style.pointerEvents,
8335
8499
  highlight: highlightOverlay.style.pointerEvents
8336
8500
  };
8337
8501
  }
8338
- shieldOverlay.style.pointerEvents = "none";
8502
+ syncShieldPointerEvents();
8339
8503
  selectionOverlay.style.pointerEvents = "none";
8340
8504
  highlightOverlay.style.pointerEvents = "none";
8341
8505
  return;
8342
8506
  }
8343
8507
  if (!textEditPointerState) return;
8344
- shieldOverlay.style.pointerEvents = textEditPointerState.shield;
8345
8508
  selectionOverlay.style.pointerEvents = textEditPointerState.selection;
8346
8509
  highlightOverlay.style.pointerEvents = textEditPointerState.highlight;
8347
8510
  textEditPointerState = null;
8511
+ syncShieldPointerEvents();
8348
8512
  }
8349
8513
  function hasTextContent(el) {
8350
8514
  return !!(el && el.textContent && el.textContent.trim().length > 0);
@@ -9770,10 +9934,10 @@ export const editorChromeBridgeScript: string = `"use strict";
9770
9934
  }
9771
9935
  function spacingValueFromPointer(handle, originValue, startX, startY, clientX, clientY) {
9772
9936
  var delta = handle.orientation === "vertical" ? clientX - startX : clientY - startY;
9773
- if (handle.kind === "padding" && (handle.side === "right" || handle.side === "bottom")) {
9937
+ if (handle.kind === "padding" && (handle.side === "right" || handle.side === "bottom") || handle.kind === "margin" && (handle.side === "left" || handle.side === "top")) {
9774
9938
  delta = -delta;
9775
9939
  }
9776
- return clampSpacingValue(originValue + delta);
9940
+ return clampSpacingValue(originValue + delta, handle.kind === "margin");
9777
9941
  }
9778
9942
  var paddingProperties = [
9779
9943
  "paddingTop",
@@ -9781,16 +9945,28 @@ export const editorChromeBridgeScript: string = `"use strict";
9781
9945
  "paddingBottom",
9782
9946
  "paddingLeft"
9783
9947
  ];
9784
- function applySpacingDragValue(target, handle, value, mirrorOpposite, syncAllPadding) {
9948
+ var marginProperties = [
9949
+ "marginTop",
9950
+ "marginRight",
9951
+ "marginBottom",
9952
+ "marginLeft"
9953
+ ];
9954
+ function propertiesForSpacingHandle(handle) {
9955
+ if (handle.kind === "margin") return marginProperties;
9956
+ if (handle.kind === "padding") return paddingProperties;
9957
+ return [handle.property];
9958
+ }
9959
+ function applySpacingDragValue(target, handle, value, mirrorOpposite, syncAllSides) {
9785
9960
  if (!target || !handle) return;
9786
- if (handle.kind === "padding" && syncAllPadding) {
9787
- for (var i = 0; i < 4; i += 1) {
9788
- target.style[paddingProperties[i]] = value + "px";
9961
+ var properties = propertiesForSpacingHandle(handle);
9962
+ if (syncAllSides) {
9963
+ for (var i = 0; i < properties.length; i += 1) {
9964
+ target.style[properties[i]] = value + "px";
9789
9965
  }
9790
9966
  return;
9791
9967
  }
9792
9968
  target.style[handle.property] = value + "px";
9793
- if (handle.kind === "padding" && mirrorOpposite && handle.oppositeProperty) {
9969
+ if ((handle.kind === "padding" || handle.kind === "margin") && mirrorOpposite && handle.oppositeProperty) {
9794
9970
  target.style[handle.oppositeProperty] = value + "px";
9795
9971
  }
9796
9972
  }
@@ -9809,12 +9985,13 @@ export const editorChromeBridgeScript: string = `"use strict";
9809
9985
  var events = dragEventNames(e);
9810
9986
  var dragEl = selectedEl;
9811
9987
  var originValue = handle.value;
9812
- var originInlinePaddingValues = {};
9813
- for (var paddingIndex = 0; paddingIndex < 4; paddingIndex += 1) {
9814
- var paddingProperty = paddingProperties[paddingIndex];
9815
- originInlinePaddingValues[paddingProperty] = dragEl.style[paddingProperty];
9988
+ var spacingProperties = propertiesForSpacingHandle(handle);
9989
+ var originInlineSpacingValues = {};
9990
+ for (var propertyIndex = 0; propertyIndex < spacingProperties.length; propertyIndex += 1) {
9991
+ var spacingProperty = spacingProperties[propertyIndex];
9992
+ originInlineSpacingValues[spacingProperty] = dragEl.style[spacingProperty];
9816
9993
  }
9817
- var syncAllPadding = !!e.shiftKey;
9994
+ var syncAllSides = !!e.shiftKey;
9818
9995
  var startX = e.clientX;
9819
9996
  var startY = e.clientY;
9820
9997
  lastSpacingPointerPoint = { x: startX, y: startY };
@@ -9823,39 +10000,34 @@ export const editorChromeBridgeScript: string = `"use strict";
9823
10000
  handle,
9824
10001
  currentValue: originValue,
9825
10002
  mirrorOpposite: !!e.altKey,
9826
- syncAllPadding,
9827
- touchedAllPadding: syncAllPadding
10003
+ syncAllSides
9828
10004
  };
9829
- applySpacingDragValue(
9830
- dragEl,
9831
- handle,
9832
- originValue,
9833
- !!e.altKey,
9834
- syncAllPadding
9835
- );
10005
+ if (syncAllSides) {
10006
+ applySpacingDragValue(dragEl, handle, originValue, !!e.altKey, true);
10007
+ }
9836
10008
  updateSpacingOverlay(selectedEl);
9837
10009
  showSpacingBadgeForHandle(handle, originValue);
9838
- function updateSpacingDragState(mirrorOpposite, syncAllPadding2) {
10010
+ function updateSpacingDragState(mirrorOpposite, syncAllSides2) {
9839
10011
  if (!spacingDrag) return;
9840
- if (spacingDrag.mirrorOpposite === mirrorOpposite && spacingDrag.syncAllPadding === syncAllPadding2) {
10012
+ if (spacingDrag.mirrorOpposite === mirrorOpposite && spacingDrag.syncAllSides === syncAllSides2) {
9841
10013
  return;
9842
10014
  }
9843
- var touchedAllPadding = spacingDrag.touchedAllPadding || syncAllPadding2;
9844
- if (syncAllPadding2) {
9845
- applySpacingDragValue(
9846
- dragEl,
9847
- handle,
9848
- spacingDrag.currentValue,
9849
- mirrorOpposite,
9850
- true
9851
- );
10015
+ for (var propertyIndex2 = 0; propertyIndex2 < spacingProperties.length; propertyIndex2 += 1) {
10016
+ var spacingProperty2 = spacingProperties[propertyIndex2];
10017
+ dragEl.style[spacingProperty2] = originInlineSpacingValues[spacingProperty2];
9852
10018
  }
10019
+ applySpacingDragValue(
10020
+ dragEl,
10021
+ handle,
10022
+ spacingDrag.currentValue,
10023
+ mirrorOpposite,
10024
+ syncAllSides2
10025
+ );
9853
10026
  spacingDrag = {
9854
10027
  handle,
9855
10028
  currentValue: spacingDrag.currentValue,
9856
10029
  mirrorOpposite,
9857
- syncAllPadding: syncAllPadding2,
9858
- touchedAllPadding
10030
+ syncAllSides: syncAllSides2
9859
10031
  };
9860
10032
  positionOverlay(selectionOverlay, dragEl);
9861
10033
  showSpacingBadgeForHandle(handle, spacingDrag.currentValue);
@@ -9869,9 +10041,9 @@ export const editorChromeBridgeScript: string = `"use strict";
9869
10041
  }
9870
10042
  function restoreSpacingDragValue() {
9871
10043
  if (dragEl && document.documentElement.contains(dragEl)) {
9872
- for (var paddingIndex2 = 0; paddingIndex2 < 4; paddingIndex2 += 1) {
9873
- var paddingProperty2 = paddingProperties[paddingIndex2];
9874
- dragEl.style[paddingProperty2] = originInlinePaddingValues[paddingProperty2];
10044
+ for (var propertyIndex2 = 0; propertyIndex2 < spacingProperties.length; propertyIndex2 += 1) {
10045
+ var spacingProperty2 = spacingProperties[propertyIndex2];
10046
+ dragEl.style[spacingProperty2] = originInlineSpacingValues[spacingProperty2];
9875
10047
  }
9876
10048
  selectedEl = dragEl;
9877
10049
  positionOverlay(selectionOverlay, dragEl);
@@ -9903,14 +10075,12 @@ export const editorChromeBridgeScript: string = `"use strict";
9903
10075
  ev.clientX,
9904
10076
  ev.clientY
9905
10077
  );
9906
- var syncAllPadding2 = !!ev.shiftKey;
9907
- var touchedAllPadding = spacingDrag && spacingDrag.touchedAllPadding || syncAllPadding2;
10078
+ var syncAllSides2 = !!ev.shiftKey;
9908
10079
  spacingDrag = {
9909
10080
  handle,
9910
10081
  currentValue: nextValue,
9911
10082
  mirrorOpposite: !!ev.altKey,
9912
- syncAllPadding: syncAllPadding2,
9913
- touchedAllPadding
10083
+ syncAllSides: syncAllSides2
9914
10084
  };
9915
10085
  lastSpacingPointerPoint = { x: ev.clientX, y: ev.clientY };
9916
10086
  applySpacingDragValue(
@@ -9918,7 +10088,7 @@ export const editorChromeBridgeScript: string = `"use strict";
9918
10088
  handle,
9919
10089
  nextValue,
9920
10090
  !!ev.altKey,
9921
- syncAllPadding2
10091
+ syncAllSides2
9922
10092
  );
9923
10093
  positionOverlay(selectionOverlay, dragEl);
9924
10094
  showSpacingBadgeForHandle(handle, nextValue);
@@ -9932,26 +10102,29 @@ export const editorChromeBridgeScript: string = `"use strict";
9932
10102
  }
9933
10103
  var finalValue = spacingDrag ? spacingDrag.currentValue : originValue;
9934
10104
  var mirrorOpposite = spacingDrag ? spacingDrag.mirrorOpposite : !!ev.altKey;
9935
- var syncAllPadding2 = spacingDrag ? spacingDrag.syncAllPadding : !!ev.shiftKey;
9936
- var touchedAllPadding = spacingDrag ? spacingDrag.touchedAllPadding : syncAllPadding2;
9937
- var commitAllPadding = handle.kind === "padding" && (syncAllPadding2 || touchedAllPadding);
10105
+ var syncAllSides2 = spacingDrag ? spacingDrag.syncAllSides : !!ev.shiftKey;
10106
+ var commitAllSides = (handle.kind === "padding" || handle.kind === "margin") && syncAllSides2;
10107
+ if (finalValue === originValue && !commitAllSides) {
10108
+ restoreSpacingDragValue();
10109
+ return;
10110
+ }
9938
10111
  applySpacingDragValue(
9939
10112
  dragEl,
9940
10113
  handle,
9941
10114
  finalValue,
9942
10115
  mirrorOpposite,
9943
- commitAllPadding
10116
+ commitAllSides
9944
10117
  );
9945
10118
  selectedEl = dragEl;
9946
10119
  spacingDrag = null;
9947
10120
  var styles = {};
9948
- if (commitAllPadding) {
9949
- for (var paddingIndex2 = 0; paddingIndex2 < 4; paddingIndex2 += 1) {
9950
- styles[paddingProperties[paddingIndex2]] = finalValue + "px";
10121
+ if (commitAllSides) {
10122
+ for (var propertyIndex2 = 0; propertyIndex2 < spacingProperties.length; propertyIndex2 += 1) {
10123
+ styles[spacingProperties[propertyIndex2]] = finalValue + "px";
9951
10124
  }
9952
10125
  } else {
9953
10126
  styles[handle.property] = finalValue + "px";
9954
- if (handle.kind === "padding" && mirrorOpposite && handle.oppositeProperty) {
10127
+ if ((handle.kind === "padding" || handle.kind === "margin") && mirrorOpposite && handle.oppositeProperty) {
9955
10128
  styles[handle.oppositeProperty] = finalValue + "px";
9956
10129
  }
9957
10130
  }
@@ -17624,6 +17797,10 @@ export const editorChromeBridgeScript: string = `"use strict";
17624
17797
  if (!target || target.nodeType !== 1) {
17625
17798
  if (!programmaticFlag) {
17626
17799
  var descendHit = elementFromEditorPoint(e.clientX, e.clientY);
17800
+ if (descendHit && selectedEl && selectedEl.hasAttribute("data-an-pen-nodes") && selectedEl.contains(descendHit)) {
17801
+ postDesignHotkey({ key: "Enter", code: "Enter" });
17802
+ return;
17803
+ }
17627
17804
  if (descendHit && descendHit !== document.body && descendHit !== document.documentElement && !isLayerInteractionBlocked(descendHit)) {
17628
17805
  var previousSelectedElForDescend = selectedEl;
17629
17806
  if (previousSelectedElForDescend && document.documentElement.contains(previousSelectedElForDescend) && previousSelectedElForDescend.contains(descendHit)) {
@@ -18370,7 +18547,7 @@ export const editorChromeBridgeScript: string = `"use strict";
18370
18547
  cancelActiveBridgeDrag();
18371
18548
  setSelectionOverlayResizeChromeVisible(false);
18372
18549
  }
18373
- shieldOverlay.style.pointerEvents = interactionMode ? "none" : "auto";
18550
+ syncShieldPointerEvents();
18374
18551
  setSelectionOverlayResizeChromeVisible(!readOnly && !interactionMode);
18375
18552
  if (interactionMode) hideSelectionOverlay();
18376
18553
  else if (selectedEl?.isConnected)
@@ -18398,11 +18575,11 @@ export const editorChromeBridgeScript: string = `"use strict";
18398
18575
  hideSelectionOverlay();
18399
18576
  highlightOverlay.style.display = "none";
18400
18577
  marqueeSelectionOverlay.style.display = "none";
18401
- shieldOverlay.style.pointerEvents = "none";
18578
+ syncShieldPointerEvents();
18402
18579
  } else {
18403
18580
  textEditingEnabled = !readOnly && textEditingEnabledFlag;
18404
18581
  setSelectionOverlayResizeChromeVisible(!readOnly);
18405
- shieldOverlay.style.pointerEvents = "auto";
18582
+ syncShieldPointerEvents();
18406
18583
  if (selectedEl?.isConnected)
18407
18584
  positionOverlay(selectionOverlay, selectedEl);
18408
18585
  scheduleRuntimeLayerSnapshot();
@@ -19642,10 +19819,10 @@ export const editorChromeBridgeScript: string = `"use strict";
19642
19819
  hideSelectionOverlay();
19643
19820
  highlightOverlay.style.display = "none";
19644
19821
  marqueeSelectionOverlay.style.display = "none";
19645
- shieldOverlay.style.pointerEvents = "none";
19822
+ syncShieldPointerEvents();
19646
19823
  } else {
19647
19824
  setSelectionOverlayResizeChromeVisible(!readOnly);
19648
- shieldOverlay.style.pointerEvents = "auto";
19825
+ syncShieldPointerEvents();
19649
19826
  if (selectedEl?.isConnected)
19650
19827
  positionOverlay(selectionOverlay, selectedEl);
19651
19828
  }