nudge-ui 0.2.2 → 0.2.4

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 (244) hide show
  1. package/README.md +164 -46
  2. package/dist/client.mjs +260 -61
  3. package/dist/css/value-semantics/colorSemantics.d.ts +4 -0
  4. package/dist/css/value-semantics/colorSemantics.js +17 -0
  5. package/dist/hosts/astro/astroRuntimeConfig.js +1 -0
  6. package/dist/hosts/astro/clientTransport.js +38 -32
  7. package/dist/hosts/astro/integration.js +5 -1
  8. package/dist/hosts/astro/markdownIdentity.d.ts +28 -0
  9. package/dist/hosts/astro/markdownIdentity.js +81 -0
  10. package/dist/hosts/next/manifest.js +1 -1
  11. package/dist/hosts/next/sidecar.js +5 -1
  12. package/dist/hosts/static/manifest.js +1 -1
  13. package/dist/hosts/static/server.js +3 -0
  14. package/dist/hosts/vite/vite.d.ts +3 -0
  15. package/dist/hosts/vite/vite.js +24 -4
  16. package/dist/inspector/agent/McpConnectionDialog.js +13 -19
  17. package/dist/inspector/agent/activity.d.ts +18 -0
  18. package/dist/inspector/agent/activity.js +70 -0
  19. package/dist/inspector/agent/client.d.ts +2 -0
  20. package/dist/inspector/agent/client.js +29 -1
  21. package/dist/inspector/agent/connectionStatus.js +1 -1
  22. package/dist/inspector/agent/httpTransport.js +9 -2
  23. package/dist/inspector/agent/protocol.d.ts +6 -3
  24. package/dist/inspector/agent/protocol.js +1 -1
  25. package/dist/inspector/agent/verification.d.ts +15 -7
  26. package/dist/inspector/agent/verification.js +113 -41
  27. package/dist/inspector/canvas/AgentActivityOverlay.d.ts +13 -0
  28. package/dist/inspector/canvas/AgentActivityOverlay.js +111 -0
  29. package/dist/inspector/canvas/CanvasCard.d.ts +9 -2
  30. package/dist/inspector/canvas/CanvasCard.js +135 -38
  31. package/dist/inspector/canvas/CanvasElementOverlay.js +166 -16
  32. package/dist/inspector/canvas/CanvasToolIcons.d.ts +10 -0
  33. package/dist/inspector/canvas/CanvasToolIcons.js +20 -0
  34. package/dist/inspector/canvas/CanvasToolbar.js +8 -4
  35. package/dist/inspector/canvas/CanvasWorkspace.js +270 -122
  36. package/dist/inspector/canvas/StaleChangeIndicator.js +3 -13
  37. package/dist/inspector/canvas/agentPresentation.d.ts +8 -8
  38. package/dist/inspector/canvas/agentPresentation.js +64 -52
  39. package/dist/inspector/canvas/canvasGestures.d.ts +1 -1
  40. package/dist/inspector/canvas/canvasGestures.js +1 -1
  41. package/dist/inspector/canvas/canvasStore.d.ts +46 -82
  42. package/dist/inspector/canvas/canvasStore.js +251 -284
  43. package/dist/inspector/canvas/frameContent.d.ts +21 -0
  44. package/dist/inspector/canvas/frameContent.js +44 -0
  45. package/dist/inspector/canvas/frameProtocol.d.ts +21 -4
  46. package/dist/inspector/canvas/frameProtocol.js +3 -3
  47. package/dist/inspector/canvas/frameScrollbarStyles.d.ts +3 -0
  48. package/dist/inspector/canvas/frameScrollbarStyles.js +21 -0
  49. package/dist/inspector/canvas/keyboardShortcuts.d.ts +3 -1
  50. package/dist/inspector/canvas/keyboardShortcuts.js +4 -4
  51. package/dist/inspector/canvas/layout.d.ts +52 -0
  52. package/dist/inspector/canvas/layout.js +106 -0
  53. package/dist/inspector/canvas/projection.d.ts +15 -5
  54. package/dist/inspector/canvas/projection.js +69 -13
  55. package/dist/inspector/canvas/rendererBootstrap.js +32 -4
  56. package/dist/inspector/canvas/rendererElementSelector.js +47 -6
  57. package/dist/inspector/canvas/rendererStylesheet.js +2 -2
  58. package/dist/inspector/canvas/resizeHandleScale.js +1 -1
  59. package/dist/inspector/canvas/sessionStore.d.ts +11 -26
  60. package/dist/inspector/canvas/sessionStore.js +43 -183
  61. package/dist/inspector/canvas/staleChangeDetector.js +9 -3
  62. package/dist/inspector/canvas/useCanvasLayoutAnimation.d.ts +5 -0
  63. package/dist/inspector/canvas/useCanvasLayoutAnimation.js +107 -0
  64. package/dist/inspector/canvas/viewStore.d.ts +38 -0
  65. package/dist/inspector/canvas/viewStore.js +104 -0
  66. package/dist/inspector/canvas/wheelPan.d.ts +8 -0
  67. package/dist/inspector/canvas/wheelPan.js +8 -0
  68. package/dist/inspector/changes/changesLog.d.ts +9 -6
  69. package/dist/inspector/changes/changesLog.js +48 -32
  70. package/dist/inspector/changes/codecs.d.ts +1 -0
  71. package/dist/inspector/changes/codecs.js +10 -1
  72. package/dist/inspector/changes/draftChanges.d.ts +58 -0
  73. package/dist/inspector/changes/draftChanges.js +304 -0
  74. package/dist/inspector/changes/editModel.d.ts +10 -0
  75. package/dist/inspector/changes/editModel.js +9 -2
  76. package/dist/inspector/changes/previewDiagnostics.d.ts +4 -2
  77. package/dist/inspector/changes/previewDiagnostics.js +11 -25
  78. package/dist/inspector/changes/types.d.ts +7 -0
  79. package/dist/inspector/clientManifest.d.ts +1 -1
  80. package/dist/inspector/comments/CommentsOverlay.d.ts +2 -0
  81. package/dist/inspector/comments/CommentsOverlay.js +250 -0
  82. package/dist/inspector/comments/element.d.ts +6 -0
  83. package/dist/inspector/comments/element.js +54 -0
  84. package/dist/inspector/comments/store.d.ts +29 -0
  85. package/dist/inspector/comments/store.js +121 -0
  86. package/dist/inspector/comments/verification.d.ts +5 -0
  87. package/dist/inspector/comments/verification.js +52 -0
  88. package/dist/inspector/componentSemantics/adapterRegistry.d.ts +6 -1
  89. package/dist/inspector/componentSemantics/adapterRegistry.js +23 -1
  90. package/dist/inspector/componentSemantics/reactRuntime.d.ts +2 -1
  91. package/dist/inspector/componentSemantics/reactRuntime.js +38 -0
  92. package/dist/inspector/componentSemantics/runtimeBridge.d.ts +4 -2
  93. package/dist/inspector/componentSemantics/runtimeBridge.js +17 -0
  94. package/dist/inspector/componentSemantics/types.d.ts +11 -0
  95. package/dist/inspector/drafts/model.d.ts +35 -0
  96. package/dist/inspector/drafts/model.js +45 -0
  97. package/dist/inspector/drafts/store.d.ts +28 -0
  98. package/dist/inspector/drafts/store.js +231 -0
  99. package/dist/inspector/index.js +20 -27
  100. package/dist/inspector/inline-text/inlineTextEditor.js +7 -0
  101. package/dist/inspector/inspection/useBrowserCssInspection.js +15 -1
  102. package/dist/inspector/iterations/capture.d.ts +2 -0
  103. package/dist/inspector/iterations/capture.js +174 -0
  104. package/dist/inspector/iterations/client.d.ts +7 -0
  105. package/dist/inspector/iterations/client.js +52 -0
  106. package/dist/inspector/iterations/coordinator.d.ts +15 -0
  107. package/dist/inspector/iterations/coordinator.js +130 -0
  108. package/dist/inspector/iterations/prompt.d.ts +3 -0
  109. package/dist/inspector/iterations/prompt.js +26 -0
  110. package/dist/inspector/overlay/DomNavigator.js +21 -15
  111. package/dist/inspector/overlay/interactionStyles.js +3 -1
  112. package/dist/inspector/overlay/spacingGestures.d.ts +13 -1
  113. package/dist/inspector/overlay/spacingGestures.js +82 -5
  114. package/dist/inspector/projection/{workspaceProjection.d.ts → draftProjection.d.ts} +6 -6
  115. package/dist/inspector/projection/{workspaceProjection.js → draftProjection.js} +4 -4
  116. package/dist/inspector/projection/renderedInstance.d.ts +17 -3
  117. package/dist/inspector/projection/renderedInstance.js +62 -11
  118. package/dist/inspector/projection/structuralProjection.d.ts +2 -1
  119. package/dist/inspector/projection/structuralProjection.js +21 -17
  120. package/dist/inspector/projection/textProjection.d.ts +2 -1
  121. package/dist/inspector/projection/textProjection.js +64 -15
  122. package/dist/inspector/prompt/PromptSettingsDialog.js +1 -5
  123. package/dist/inspector/prompt/clipboardHandoff.d.ts +15 -18
  124. package/dist/inspector/prompt/clipboardHandoff.js +97 -143
  125. package/dist/inspector/prompt/generatePrompt.d.ts +4 -1
  126. package/dist/inspector/prompt/generatePrompt.js +22 -17
  127. package/dist/inspector/runtime/runtimeConfig.d.ts +9 -0
  128. package/dist/inspector/runtime/runtimeConfig.js +24 -0
  129. package/dist/inspector/selection/sourceSite.d.ts +12 -0
  130. package/dist/inspector/selection/sourceSite.js +28 -0
  131. package/dist/inspector/settings/SettingsDialog.js +21 -8
  132. package/dist/inspector/shell/AgentStatusButton.d.ts +11 -0
  133. package/dist/inspector/shell/AgentStatusButton.js +36 -0
  134. package/dist/inspector/shell/AppShell.js +4 -2
  135. package/dist/inspector/shell/ChangesLog.js +46 -26
  136. package/dist/inspector/shell/CopyPromptButton.js +184 -93
  137. package/dist/inspector/shell/EmptyState.js +9 -8
  138. package/dist/inspector/shell/InspectorShell.js +13 -21
  139. package/dist/inspector/shell/PeekOriginalButton.js +24 -23
  140. package/dist/inspector/shell/originalPreview.js +5 -5
  141. package/dist/inspector/shell/shortcuts.d.ts +3 -0
  142. package/dist/inspector/shell/shortcuts.js +11 -0
  143. package/dist/inspector/sketch/SketchEditor.js +14 -14
  144. package/dist/inspector/sketch/SketchEntryButton.js +1 -1
  145. package/dist/inspector/sketch/SketchFrameOverlay.d.ts +3 -1
  146. package/dist/inspector/sketch/SketchFrameOverlay.js +11 -8
  147. package/dist/inspector/sketch/SketchLayersPanel.js +13 -5
  148. package/dist/inspector/sketch/SketchOverlay.js +7 -7
  149. package/dist/inspector/sketch/SketchWorkspace.js +18 -12
  150. package/dist/inspector/sketch/interaction.d.ts +1 -0
  151. package/dist/inspector/sketch/interaction.js +8 -4
  152. package/dist/inspector/sketch/model.d.ts +5 -0
  153. package/dist/inspector/sketch/model.js +6 -2
  154. package/dist/inspector/sketch/raster.d.ts +1 -2
  155. package/dist/inspector/sketch/raster.js +68 -4
  156. package/dist/inspector/styleEditors/BackgroundEditor.d.ts +4 -0
  157. package/dist/inspector/styleEditors/BackgroundEditor.js +195 -0
  158. package/dist/inspector/styleEditors/BorderEditor.js +49 -78
  159. package/dist/inspector/styleEditors/BorderRadiusEditor.js +6 -1
  160. package/dist/inspector/styleEditors/BoxShadowEditor.d.ts +1 -2
  161. package/dist/inspector/styleEditors/BoxShadowEditor.js +132 -4
  162. package/dist/inspector/styleEditors/ColorPicker.d.ts +5 -1
  163. package/dist/inspector/styleEditors/ColorPicker.js +10 -4
  164. package/dist/inspector/styleEditors/GapField.js +3 -5
  165. package/dist/inspector/styleEditors/GridChildSection.d.ts +1 -1
  166. package/dist/inspector/styleEditors/GridChildSection.js +18 -9
  167. package/dist/inspector/styleEditors/GridPicker.d.ts +1 -1
  168. package/dist/inspector/styleEditors/GridPicker.js +8 -2
  169. package/dist/inspector/styleEditors/GridSection.js +1 -1
  170. package/dist/inspector/styleEditors/GridValueField.js +19 -14
  171. package/dist/inspector/styleEditors/ImageBackgroundEditor.d.ts +18 -0
  172. package/dist/inspector/styleEditors/ImageBackgroundEditor.js +118 -0
  173. package/dist/inspector/styleEditors/LayoutBlockedIndicator.d.ts +2 -2
  174. package/dist/inspector/styleEditors/LayoutBlockedIndicator.js +3 -3
  175. package/dist/inspector/styleEditors/LayoutComboField.js +6 -4
  176. package/dist/inspector/styleEditors/LayoutDropdown.js +6 -3
  177. package/dist/inspector/styleEditors/LayoutSection.js +32 -11
  178. package/dist/inspector/styleEditors/SpacingBox.js +7 -5
  179. package/dist/inspector/styleEditors/Typography.js +11 -3
  180. package/dist/inspector/styleEditors/backgroundLayers.d.ts +24 -0
  181. package/dist/inspector/styleEditors/backgroundLayers.js +51 -0
  182. package/dist/inspector/styleEditors/gradientValue.d.ts +17 -0
  183. package/dist/inspector/styleEditors/gradientValue.js +114 -0
  184. package/dist/inspector/styleEditors/inlineAuthored.d.ts +10 -0
  185. package/dist/inspector/styleEditors/inlineAuthored.js +114 -0
  186. package/dist/inspector/styleEditors/layoutValue.d.ts +0 -8
  187. package/dist/inspector/styleEditors/layoutValue.js +0 -42
  188. package/dist/inspector/styleEditors/nudgeValue.d.ts +2 -2
  189. package/dist/inspector/styleEditors/nudgeValue.js +36 -8
  190. package/dist/inspector/tokens/TokenField.d.ts +7 -0
  191. package/dist/inspector/tokens/TokenField.js +35 -25
  192. package/dist/inspector/tokens/TokenLabel.js +5 -14
  193. package/dist/inspector/tokens/editActions.d.ts +1 -1
  194. package/dist/inspector/tokens/editActions.js +7 -1
  195. package/dist/inspector/ui/AtRuleContext.js +4 -6
  196. package/dist/inspector/ui/Button.d.ts +6 -2
  197. package/dist/inspector/ui/Button.js +4 -3
  198. package/dist/inspector/ui/ControlSurface.d.ts +2 -2
  199. package/dist/inspector/ui/ControlSurface.js +4 -3
  200. package/dist/inspector/ui/InlineStyleWarning.d.ts +11 -0
  201. package/dist/inspector/ui/InlineStyleWarning.js +13 -0
  202. package/dist/inspector/ui/InspectorPopover.d.ts +2 -1
  203. package/dist/inspector/ui/InspectorPopover.js +4 -5
  204. package/dist/inspector/ui/PopoverListbox.d.ts +2 -1
  205. package/dist/inspector/ui/PopoverListbox.js +8 -7
  206. package/dist/inspector/ui/SegmentedControl.d.ts +2 -1
  207. package/dist/inspector/ui/SegmentedControl.js +2 -2
  208. package/dist/inspector/ui/Select.d.ts +6 -1
  209. package/dist/inspector/ui/Select.js +7 -11
  210. package/dist/inspector/ui/SideValuesField.js +1 -1
  211. package/dist/inspector/ui/Tooltip.d.ts +26 -0
  212. package/dist/inspector/ui/Tooltip.js +32 -0
  213. package/dist/inspector/ui/classNames.d.ts +2 -0
  214. package/dist/inspector/ui/classNames.js +4 -0
  215. package/dist/inspector/ui/customCursors.d.ts +23 -0
  216. package/dist/inspector/ui/customCursors.js +122 -0
  217. package/dist/inspector/ui/dragCursor.d.ts +0 -2
  218. package/dist/inspector/ui/dragCursor.js +2 -10
  219. package/dist/inspector/ui/portalContainer.d.ts +2 -0
  220. package/dist/inspector/ui/portalContainer.js +6 -0
  221. package/dist/inspector/ui/styles.js +29 -21
  222. package/dist/inspector/workspace/commands.d.ts +9 -0
  223. package/dist/inspector/workspace/commands.js +82 -0
  224. package/dist/inspector/workspace/controller.d.ts +4 -0
  225. package/dist/inspector/workspace/controller.js +66 -0
  226. package/dist/inspector/workspace/handoff.d.ts +42 -0
  227. package/dist/inspector/workspace/handoff.js +115 -0
  228. package/dist/inspector/workspace/sentItems.d.ts +19 -0
  229. package/dist/inspector/workspace/sentItems.js +51 -0
  230. package/dist/inspector/workspace/timeline.d.ts +30 -0
  231. package/dist/inspector/workspace/timeline.js +108 -0
  232. package/dist/internal/agent-protocol.d.ts +19 -2
  233. package/dist/internal/agent-protocol.js +13 -0
  234. package/dist/nudge-ui.mjs +558 -311
  235. package/dist/project/artifacts.d.ts +13 -0
  236. package/dist/project/artifacts.js +253 -0
  237. package/dist/transport/artifacts.d.ts +8 -0
  238. package/dist/transport/artifacts.js +9 -0
  239. package/dist/transport/editor.js +3 -1
  240. package/dist/transport/routes.d.ts +2 -0
  241. package/dist/transport/routes.js +2 -0
  242. package/package.json +7 -3
  243. package/dist/inspector/changes/workspaceChanges.d.ts +0 -47
  244. package/dist/inspector/changes/workspaceChanges.js +0 -265
@@ -1,10 +1,12 @@
1
1
  import { PROTOCOL_VERSION, clearRendererIdentity, getRendererIdentity, isRendererMessageFor, sendToParent, setRendererIdentity, } from "./frameProtocol.js";
2
+ import { wheelPanDelta } from "./wheelPan.js";
2
3
  import { handleReplaceStyles, startRendererProjectionDiagnostics } from "./rendererStylesheet.js";
3
4
  import { findClosestAnchor, isEligibleNavigation, hasDifferentRoute } from "./linkEligibility.js";
4
5
  import { installRendererElementSelector } from "./rendererElementSelector.js";
5
6
  import { createFrameThrottle } from "../overlay/frameThrottle.js";
6
7
  import { isNudgeUiDev } from "../runtime/devFlag.js";
7
8
  import { getNudgeUiRuntimeConfig, subscribeNudgeUiRuntime } from "../runtime/runtimeConfig.js";
9
+ import { APP_INTERACTION_KEY } from "./keyboardShortcuts.js";
8
10
  let activeRendererBootstrap = null;
9
11
  function ownsRendererBootstrap(owner) {
10
12
  return owner.active && activeRendererBootstrap?.owner === owner;
@@ -252,6 +254,8 @@ function installRendererPanProxy(owner) {
252
254
  let spaceHeld = false;
253
255
  let panning = false;
254
256
  let boardGesturesEnabled = false;
257
+ let boardScrollPans = false;
258
+ let nativeAppInteraction = false;
255
259
  const panMoveUpdate = createFrameThrottle((point) => {
256
260
  if (!ownsRendererBootstrap(owner))
257
261
  return;
@@ -298,7 +302,9 @@ function installRendererPanProxy(owner) {
298
302
  }
299
303
  if (event.data.type === "board-gesture-state") {
300
304
  boardGesturesEnabled = event.data.enabled;
301
- if (!boardGesturesEnabled) {
305
+ boardScrollPans = event.data.panScroll === true;
306
+ nativeAppInteraction = event.data.panScroll === false;
307
+ if (!boardGesturesEnabled || nativeAppInteraction) {
302
308
  spaceHeld = false;
303
309
  endPan();
304
310
  }
@@ -306,10 +312,18 @@ function installRendererPanProxy(owner) {
306
312
  };
307
313
  window.addEventListener("message", onMessage);
308
314
  owner.listenerRemovers.push(() => window.removeEventListener("message", onMessage));
315
+ function sendAppInteractionModifier(held) {
316
+ const identity = getRendererIdentity();
317
+ if (!identity)
318
+ return;
319
+ sendToParent({ type: "app-interaction-modifier", protocolVersion: PROTOCOL_VERSION, held, ...identity });
320
+ }
309
321
  const onKeyDown = (event) => {
310
322
  if (!ownsRendererBootstrap(owner))
311
323
  return;
312
- if (boardGesturesEnabled && event.code === "Space" && !event.repeat && !isEditableTarget(event.target)) {
324
+ if (event.code === APP_INTERACTION_KEY && !event.repeat && !isEditableTarget(event.target))
325
+ sendAppInteractionModifier(true);
326
+ if (boardGesturesEnabled && !nativeAppInteraction && event.code === "Space" && !event.repeat && !isEditableTarget(event.target)) {
313
327
  spaceHeld = true;
314
328
  if (getRendererIdentity())
315
329
  event.preventDefault();
@@ -321,6 +335,8 @@ function installRendererPanProxy(owner) {
321
335
  const onKeyUp = (event) => {
322
336
  if (!ownsRendererBootstrap(owner))
323
337
  return;
338
+ if (event.code === APP_INTERACTION_KEY)
339
+ sendAppInteractionModifier(false);
324
340
  if (event.code === "Space") {
325
341
  spaceHeld = false;
326
342
  sendSpaceState();
@@ -355,7 +371,7 @@ function installRendererPanProxy(owner) {
355
371
  const onPointerDown = (event) => {
356
372
  if (!ownsRendererBootstrap(owner))
357
373
  return;
358
- if (!boardGesturesEnabled || !spaceHeld || event.button !== 0 || isEditableTarget(event.target))
374
+ if (!boardGesturesEnabled || nativeAppInteraction || !spaceHeld || event.button !== 0 || isEditableTarget(event.target))
359
375
  return;
360
376
  const identity = getRendererIdentity();
361
377
  if (!identity)
@@ -392,6 +408,8 @@ function installRendererPanProxy(owner) {
392
408
  const onBlur = () => {
393
409
  if (!ownsRendererBootstrap(owner))
394
410
  return;
411
+ if (!window.parent.document.hasFocus())
412
+ sendAppInteractionModifier(false);
395
413
  spaceHeld = false;
396
414
  sendSpaceState();
397
415
  endPan();
@@ -401,13 +419,23 @@ function installRendererPanProxy(owner) {
401
419
  const onWheel = (event) => {
402
420
  if (!ownsRendererBootstrap(owner))
403
421
  return;
404
- if (!boardGesturesEnabled || (!event.ctrlKey && !event.metaKey))
422
+ const zoom = event.ctrlKey || event.metaKey;
423
+ if (!boardGesturesEnabled || (!zoom && !boardScrollPans))
405
424
  return;
406
425
  const identity = getRendererIdentity();
407
426
  if (!identity)
408
427
  return;
409
428
  event.preventDefault();
410
429
  event.stopPropagation();
430
+ if (!zoom) {
431
+ const delta = wheelPanDelta(event, { width: window.innerWidth, height: window.innerHeight });
432
+ const message = {
433
+ type: "wheel-pan", protocolVersion: PROTOCOL_VERSION,
434
+ deltaX: delta.x, deltaY: delta.y, ...identity,
435
+ };
436
+ sendToParent(message);
437
+ return;
438
+ }
411
439
  const message = {
412
440
  type: "zoom",
413
441
  protocolVersion: PROTOCOL_VERSION,
@@ -9,7 +9,8 @@ import { resolveSelectionTarget, selectionTargetMode } from "../selection/select
9
9
  import { escapeCssString } from "../projection/cssEscapes.js";
10
10
  import { APPLICATION_GESTURE_EVENTS, blockApplicationClick, blockApplicationGesture, isInlineEditorTarget, isUserClick, } from "../overlay/clickPolicy.js";
11
11
  import { EMPTY_TEXT_PROJECTION_ATTR } from "../projection/textProjection.js";
12
- import { getSpacingAffordanceAtPoint, toSpacingDescriptor, } from "../overlay/spacingGestures.js";
12
+ import { getSpacingAffordanceAtPoint, getSpacingHoverAtPoint, toSpacingDescriptor, } from "../overlay/spacingGestures.js";
13
+ import { COMMENT_CURSOR, INTERACTION_CURSOR_PROPERTY, rendererCursorValue } from "../ui/customCursors.js";
13
14
  const REACT_FIBER_KEY = /^__reactFiber\$/;
14
15
  const REACT_INTERNAL_KEY = /^__reactInternalInstance\$/;
15
16
  const HOVER_SCROLL_SETTLE_DELAY = 150;
@@ -100,8 +101,29 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
100
101
  const cidIndex = createCidIndex(document);
101
102
  const initialCursor = document.documentElement.style.getPropertyValue("cursor");
102
103
  const initialCursorPriority = document.documentElement.style.getPropertyPriority("cursor");
104
+ const initialInteractionCursor = document.documentElement.style.getPropertyValue(INTERACTION_CURSOR_PROPERTY);
105
+ const initialInteractionCursorPriority = document.documentElement.style.getPropertyPriority(INTERACTION_CURSOR_PROPERTY);
106
+ let commentMode = false;
107
+ let interactionCursor = "design";
108
+ let commentCursor = COMMENT_CURSOR;
109
+ let appliedInteractionCursor = rendererCursorValue("design");
103
110
  let appliedRootCursor = null;
104
111
  let spacingCursor = null;
112
+ function setInteractionCursor(cursor) {
113
+ appliedInteractionCursor = rendererCursorValue(cursor, commentCursor);
114
+ document.documentElement.style.setProperty(INTERACTION_CURSOR_PROPERTY, appliedInteractionCursor);
115
+ }
116
+ function restoreInteractionCursor() {
117
+ if (document.documentElement.style.getPropertyValue(INTERACTION_CURSOR_PROPERTY) !== appliedInteractionCursor)
118
+ return;
119
+ if (initialInteractionCursor) {
120
+ document.documentElement.style.setProperty(INTERACTION_CURSOR_PROPERTY, initialInteractionCursor, initialInteractionCursorPriority);
121
+ }
122
+ else {
123
+ document.documentElement.style.removeProperty(INTERACTION_CURSOR_PROPERTY);
124
+ }
125
+ }
126
+ setInteractionCursor("design");
105
127
  function clearSpacingCursor() {
106
128
  const active = spacingCursor;
107
129
  spacingCursor = null;
@@ -140,7 +162,7 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
140
162
  spacingCursor.appliedValue = cursor;
141
163
  }
142
164
  element.style.setProperty("cursor", cursor, "important");
143
- document.documentElement.style.setProperty("cursor", cursor);
165
+ document.documentElement.style.setProperty("cursor", cursor, "important");
144
166
  appliedRootCursor = cursor;
145
167
  }
146
168
  function reportHover(pending) {
@@ -152,10 +174,16 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
152
174
  const selector = buildSelector(element);
153
175
  const src = element.getAttribute("data-src") ?? "";
154
176
  const rect = clear ? null : element.getBoundingClientRect();
155
- const rawSpacing = !clear && pending.point
177
+ // The handle hit is the only target that starts a drag, so it is the only
178
+ // one that changes the cursor. The area-wide match is purely visual.
179
+ const rawSpacing = !commentMode && !clear && pending.point
156
180
  ? getSpacingAffordanceAtPoint(document, pending.point.x, pending.point.y)
157
181
  : null;
158
182
  const spacing = rawSpacing && rawSpacing.element === element ? rawSpacing : null;
183
+ const rawHoverSpacing = !commentMode && !clear && pending.point
184
+ ? getSpacingHoverAtPoint(document, pending.point.x, pending.point.y)
185
+ : null;
186
+ const hoverSpacing = rawHoverSpacing && rawHoverSpacing.element === element ? rawHoverSpacing : null;
159
187
  if (spacing) {
160
188
  setSpacingCursor(spacing.element, spacing.cursor);
161
189
  }
@@ -182,6 +210,7 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
182
210
  borders: rect ? readBorderWidths(element) : null,
183
211
  point: pending.point,
184
212
  spacing: spacing ? toSpacingDescriptor(spacing) : null,
213
+ hoverSpacing: hoverSpacing ? toSpacingDescriptor(hoverSpacing) : null,
185
214
  ...identity,
186
215
  };
187
216
  sendToParent(msg);
@@ -292,8 +321,19 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
292
321
  updateMeasureState(message.altKey, measurePointerOverPage);
293
322
  return;
294
323
  }
324
+ if (message.type === "pan-modifier" && typeof message.spaceHeld === "boolean") {
325
+ setInteractionCursor(message.spaceHeld ? "drag" : interactionCursor);
326
+ return;
327
+ }
295
328
  if (message.type !== "inspector-interaction-state" || typeof message.open !== "boolean")
296
329
  return;
330
+ if (typeof message.commentCursor === "string")
331
+ commentCursor = message.commentCursor;
332
+ interactionCursor = message.cursor === "comment" ? "comment" : message.cursor === "drag" ? "drag" : "design";
333
+ commentMode = interactionCursor === "comment";
334
+ cancelActiveDrag();
335
+ clearSpacingCursor();
336
+ setInteractionCursor(interactionCursor);
297
337
  const interactionsEnabled = message.interactionsEnabled === undefined
298
338
  ? message.open
299
339
  : message.interactionsEnabled === true;
@@ -360,7 +400,7 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
360
400
  trackListener(document, "mousedown", (event) => {
361
401
  if (interactionsSuspended)
362
402
  return;
363
- if (event.button !== 0)
403
+ if (event.button !== 0 || commentMode)
364
404
  return;
365
405
  const element = resolveSelectionTarget(event.target, selectionTargetMode(event));
366
406
  if (!element)
@@ -559,7 +599,7 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
559
599
  sendToParent(msg);
560
600
  return;
561
601
  }
562
- if (!lastSelected)
602
+ if (!lastSelected || commentMode)
563
603
  return;
564
604
  const identity = getRendererIdentity();
565
605
  if (!identity)
@@ -619,7 +659,7 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
619
659
  hoverUpdate.schedule({ element: el, clear: true, point: null });
620
660
  }, true);
621
661
  trackListener(document, "dblclick", (event) => {
622
- if (interactionsSuspended)
662
+ if (interactionsSuspended || commentMode)
623
663
  return;
624
664
  const element = resolveSelectionTarget(event.target, selectionTargetMode(event));
625
665
  const identity = getRendererIdentity();
@@ -701,5 +741,6 @@ export function installRendererElementSelector(acceptsClick = isUserClick) {
701
741
  measureAltKey = false;
702
742
  document.documentElement.removeAttribute("data-nudge-ui-panel");
703
743
  clearSpacingCursor();
744
+ restoreInteractionCursor();
704
745
  };
705
746
  }
@@ -8,7 +8,7 @@ import { applyRenderedInstanceProjection, getRenderedInstanceProjectionReports,
8
8
  import { applyStructuralProjection, getStructuralProjectionReports, isStructuralChange, subscribeStructuralDiagnostics, } from "../projection/structuralProjection.js";
9
9
  import { applyTextContentProjection, getTextProjectionReports, subscribeTextProjectionDiagnostics, } from "../projection/textProjection.js";
10
10
  import { isTextContentChangeListValue } from "../changes/types.js";
11
- import { applyWorkspaceProjection, } from "../projection/workspaceProjection.js";
11
+ import { applyDraftProjection, } from "../projection/draftProjection.js";
12
12
  const SHEET_ID = "nudge-ui-styles";
13
13
  function replaceRendererCss(css) {
14
14
  let sheet = document.getElementById(SHEET_ID);
@@ -208,7 +208,7 @@ export function handleReplaceStyles(msg, projectId, workspaceId, cardId) {
208
208
  return false;
209
209
  if (msg.revision <= lastAppliedRevision)
210
210
  return false;
211
- applyWorkspaceProjection(rendererDocumentProjectionAdapter, projectionFromReplaceStylesMessage(msg));
211
+ applyDraftProjection(rendererDocumentProjectionAdapter, projectionFromReplaceStylesMessage(msg));
212
212
  lastStructuralReportRevision = msg.revision;
213
213
  lastRenderedInstanceReportRevision = msg.revision;
214
214
  lastTextProjectionReportRevision = msg.revision;
@@ -1,4 +1,4 @@
1
- import { MAX_CAMERA_ZOOM } from "./canvasStore.js";
1
+ import { MAX_CAMERA_ZOOM } from "./viewStore.js";
2
2
  import { CANVAS_TOOLBAR_MAX_SCALE } from "./toolbarScale.js";
3
3
  /**
4
4
  * Keep the resize handle usable while the board is zoomed without allowing
@@ -1,46 +1,33 @@
1
- import { type SerializableChange } from "../changes/codecs.js";
2
- import { type CanvasMode } from "./canvasStore.js";
3
- import { type StructuralChange } from "../projection/structuralProjection.js";
1
+ import { type FrameContent } from "./frameContent.js";
2
+ import { type FrameGroup } from "./canvasStore.js";
3
+ import { type CanvasPresentation, type CanvasMode } from "./viewStore.js";
4
4
  import { type ClipboardHandoffSnapshot } from "../prompt/clipboardHandoff.js";
5
- declare const SCHEMA_VERSION = 12;
5
+ declare const SCHEMA_VERSION = 17;
6
6
  declare function storageKey(projectId: string): string;
7
7
  export interface SerializableCard {
8
8
  id: string;
9
- url: string;
9
+ content: FrameContent;
10
10
  title: string | null;
11
+ groupId?: string;
11
12
  x: number;
12
13
  y: number;
13
14
  width: number;
14
15
  height: number;
15
- comparisonGroupId?: string;
16
- }
17
- export interface SerializableComparisonGroup {
18
- id: string;
19
- label: string;
20
- owner: "agent";
21
- agentId: string;
22
- cardIds: string[];
23
- routes: Array<{
24
- url: string;
25
- title?: string | null;
26
- label?: string;
27
- }>;
28
16
  }
29
17
  export interface DurableSession {
30
18
  schemaVersion: typeof SCHEMA_VERSION;
31
19
  projectId: string;
32
20
  mode: CanvasMode;
21
+ presentation: CanvasPresentation;
22
+ groups: readonly FrameGroup[];
33
23
  inspectUrl: string;
34
24
  cards: SerializableCard[];
35
- comparisonGroups: SerializableComparisonGroup[];
36
25
  camera: {
37
26
  x: number;
38
27
  y: number;
39
28
  zoom: number;
40
29
  };
41
30
  focusedCardId?: string | null;
42
- changes: SerializableChange[];
43
- structuralChanges: StructuralChange[];
44
31
  clipboardHandoff: ClipboardHandoffSnapshot | null;
45
32
  }
46
33
  export type { SerializableChange, SerializableComponentChange, SerializableElementChange, SerializableTextContentChange, SerializableTokenChange, SerializableTokenRef, } from "../changes/codecs.js";
@@ -51,6 +38,8 @@ export interface HydrationResult {
51
38
  export declare function serializeSession(): DurableSession;
52
39
  export declare function persistSession(): boolean;
53
40
  export declare function hydrateSession(): HydrationResult;
41
+ /** Clears the active frame's edit draft while preserving canvas geometry and other drafts. */
42
+ export declare function clearSelectedFrameChanges(): void;
54
43
  export declare function clearSession(): void;
55
44
  export declare function enableAutoSave(): void;
56
45
  /**
@@ -59,12 +48,8 @@ export declare function enableAutoSave(): void;
59
48
  * refresh or close inside the debounce window still flushes on `beforeunload`.
60
49
  */
61
50
  export declare function scheduleAutoSave(): void;
62
- /**
63
- * Canvas mode/card/camera changes persist immediately (synchronous) so a
64
- * refresh always restores the workspace, even inside the edit-autosave
65
- * debounce window. Edit autosave stays coalesced behind the trailing timer.
66
- */
67
51
  export declare function scheduleCanvasSave(): void;
52
+ export declare function flushAutoSave(): void;
68
53
  export declare function getRestoreCount(): number;
69
54
  export declare function setRestoreCount(count: number): void;
70
55
  export declare function clearRestoreCount(): void;