nudge-ui 0.2.4 → 0.2.5

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 (250) hide show
  1. package/dist/cli/agentCommand.js +4 -28
  2. package/dist/client.mjs +863 -213
  3. package/dist/hosts/next/wrapper.js +1 -7
  4. package/dist/hosts/projectBridge.js +3 -17
  5. package/dist/inspector/agent/McpConnectionDialog.js +7 -3
  6. package/dist/inspector/agent/activity.d.ts +1 -1
  7. package/dist/inspector/agent/activity.js +3 -2
  8. package/dist/inspector/agent/client.d.ts +2 -2
  9. package/dist/inspector/agent/client.js +28 -29
  10. package/dist/inspector/agent/connectionStatus.d.ts +3 -1
  11. package/dist/inspector/agent/connectionStatus.js +25 -0
  12. package/dist/inspector/agent/httpTransport.js +31 -147
  13. package/dist/inspector/agent/protocol.d.ts +1 -1
  14. package/dist/inspector/agent/protocol.js +1 -1
  15. package/dist/inspector/agent/verification.d.ts +1 -1
  16. package/dist/inspector/agent/verification.js +7 -4
  17. package/dist/inspector/boot.d.ts +3 -0
  18. package/dist/inspector/boot.js +297 -0
  19. package/dist/inspector/canvas/AgentActivityOverlay.d.ts +2 -1
  20. package/dist/inspector/canvas/AgentActivityOverlay.js +6 -3
  21. package/dist/inspector/canvas/CanvasCard.js +21 -12
  22. package/dist/inspector/canvas/CanvasElementOverlay.js +82 -127
  23. package/dist/inspector/canvas/CanvasToolbar.js +2 -1
  24. package/dist/inspector/canvas/CanvasWorkspace.js +74 -97
  25. package/dist/inspector/canvas/LockedWorkspaceNotice.d.ts +3 -2
  26. package/dist/inspector/canvas/LockedWorkspaceNotice.js +10 -6
  27. package/dist/inspector/canvas/PageCard.d.ts +10 -0
  28. package/dist/inspector/canvas/PageCard.js +51 -0
  29. package/dist/inspector/canvas/SketchToolOptions.d.ts +5 -0
  30. package/dist/inspector/canvas/SketchToolOptions.js +86 -0
  31. package/dist/inspector/canvas/StaleChangeIndicator.d.ts +1 -1
  32. package/dist/inspector/canvas/StaleChangeIndicator.js +1 -1
  33. package/dist/inspector/canvas/ToolOptionsDrawer.d.ts +21 -0
  34. package/dist/inspector/canvas/ToolOptionsDrawer.js +77 -0
  35. package/dist/inspector/canvas/activeCanvasDocument.d.ts +3 -2
  36. package/dist/inspector/canvas/assets/eraser.svg +28 -0
  37. package/dist/inspector/canvas/assets/pen.svg +25 -0
  38. package/dist/inspector/canvas/canvasFrame.d.ts +16 -0
  39. package/dist/inspector/canvas/canvasFrame.js +10 -0
  40. package/dist/inspector/canvas/canvasGestures.d.ts +0 -1
  41. package/dist/inspector/canvas/canvasGestures.js +0 -6
  42. package/dist/inspector/canvas/canvasStore.d.ts +6 -0
  43. package/dist/inspector/canvas/canvasStore.js +36 -1
  44. package/dist/inspector/canvas/frameConnection.d.ts +48 -0
  45. package/dist/inspector/canvas/frameConnection.js +73 -0
  46. package/dist/inspector/canvas/frameProtocol.d.ts +18 -1
  47. package/dist/inspector/canvas/frameProtocol.js +36 -0
  48. package/dist/inspector/canvas/pageSurface.d.ts +11 -0
  49. package/dist/inspector/canvas/pageSurface.js +34 -0
  50. package/dist/inspector/canvas/projection.d.ts +19 -9
  51. package/dist/inspector/canvas/projection.js +58 -31
  52. package/dist/inspector/canvas/rendererBootstrap.js +4 -1
  53. package/dist/inspector/canvas/rendererElementSelector.js +9 -1
  54. package/dist/inspector/canvas/rendererMessageRouter.d.ts +4 -5
  55. package/dist/inspector/canvas/rendererMessageRouter.js +12 -16
  56. package/dist/inspector/canvas/rendererSelectionProxy.d.ts +7 -1
  57. package/dist/inspector/canvas/rendererSelectionProxy.js +8 -36
  58. package/dist/inspector/canvas/rendererStylesheet.js +15 -0
  59. package/dist/inspector/canvas/sessionStore.d.ts +2 -2
  60. package/dist/inspector/canvas/sessionStore.js +12 -9
  61. package/dist/inspector/canvas/staleChangeDetector.d.ts +1 -1
  62. package/dist/inspector/canvas/staleChangeDetector.js +10 -22
  63. package/dist/inspector/changes/codecs.d.ts +1 -0
  64. package/dist/inspector/changes/codecs.js +20 -5
  65. package/dist/inspector/changes/draftPreview.d.ts +12 -0
  66. package/dist/inspector/changes/draftPreview.js +133 -0
  67. package/dist/inspector/changes/editModel.d.ts +8 -0
  68. package/dist/inspector/changes/editModel.js +8 -2
  69. package/dist/inspector/changes/managedStyleProjection.js +2 -1
  70. package/dist/inspector/changes/previewDiagnostics.js +1 -1
  71. package/dist/inspector/changes/types.d.ts +11 -1
  72. package/dist/inspector/comments/CommentsOverlay.js +18 -16
  73. package/dist/inspector/comments/store.js +3 -2
  74. package/dist/inspector/comments/verification.js +1 -1
  75. package/dist/inspector/componentSemantics/ComponentPropsSection.js +2 -1
  76. package/dist/inspector/componentSemantics/changeAction.js +1 -1
  77. package/dist/inspector/componentSemantics/textBinding.d.ts +1 -2
  78. package/dist/inspector/componentSemantics/textBinding.js +4 -45
  79. package/dist/inspector/drafts/draftStore.d.ts +109 -0
  80. package/dist/inspector/drafts/draftStore.js +451 -0
  81. package/dist/inspector/drafts/model.d.ts +9 -1
  82. package/dist/inspector/drafts/model.js +5 -1
  83. package/dist/inspector/drafts/store.d.ts +53 -15
  84. package/dist/inspector/drafts/store.js +143 -169
  85. package/dist/inspector/index.d.ts +2 -4
  86. package/dist/inspector/index.js +2 -264
  87. package/dist/inspector/inline-text/inlineTextEditor.d.ts +1 -1
  88. package/dist/inspector/inline-text/inlineTextEditor.js +1 -2
  89. package/dist/inspector/inline-text/textEditChange.d.ts +1 -1
  90. package/dist/inspector/inspection/bridge.d.ts +1 -1
  91. package/dist/inspector/inspection/bridge.js +2 -1
  92. package/dist/inspector/inspection/browserCssInspection.d.ts +8 -0
  93. package/dist/inspector/inspection/browserCssInspection.js +28 -6
  94. package/dist/inspector/inspection/inspectionSnapshot.d.ts +6 -0
  95. package/dist/inspector/inspection/inspectionSnapshot.js +10 -0
  96. package/dist/inspector/inspection/performanceDiagnostics.d.ts +18 -0
  97. package/dist/inspector/inspection/performanceDiagnostics.js +31 -0
  98. package/dist/inspector/inspection/useBrowserCssInspection.js +17 -38
  99. package/dist/inspector/iterations/capture.d.ts +2 -1
  100. package/dist/inspector/iterations/client.d.ts +2 -1
  101. package/dist/inspector/iterations/coordinator.d.ts +4 -3
  102. package/dist/inspector/iterations/coordinator.js +5 -3
  103. package/dist/inspector/iterations/prompt.js +9 -8
  104. package/dist/inspector/overlay/interactionStyles.js +17 -0
  105. package/dist/inspector/pageInspector.d.ts +42 -0
  106. package/dist/inspector/pageInspector.js +342 -0
  107. package/dist/inspector/projection/draftProjection.d.ts +10 -2
  108. package/dist/inspector/projection/draftProjection.js +9 -1
  109. package/dist/inspector/projection/managedStylesheet.js +24 -4
  110. package/dist/inspector/projection/renderedInstance.js +7 -1
  111. package/dist/inspector/projection/structuralProjection.d.ts +0 -9
  112. package/dist/inspector/projection/structuralProjection.js +14 -44
  113. package/dist/inspector/projection/textProjection.d.ts +8 -2
  114. package/dist/inspector/projection/textProjection.js +21 -13
  115. package/dist/inspector/prompt/clipboardHandoff.d.ts +9 -0
  116. package/dist/inspector/prompt/clipboardHandoff.js +42 -16
  117. package/dist/inspector/prompt/generatePrompt.d.ts +1 -1
  118. package/dist/inspector/prompt/generatePrompt.js +243 -147
  119. package/dist/inspector/prompt/promptDocument.d.ts +3 -0
  120. package/dist/inspector/prompt/promptDocument.js +8 -0
  121. package/dist/inspector/prompt/promptSettings.js +7 -5
  122. package/dist/inspector/runtime/inspectorStorage.d.ts +17 -0
  123. package/dist/inspector/runtime/inspectorStorage.js +42 -0
  124. package/dist/inspector/runtime/ownedStylesheets.d.ts +20 -0
  125. package/dist/inspector/runtime/ownedStylesheets.js +72 -0
  126. package/dist/inspector/runtime/runtimeConfig.d.ts +4 -0
  127. package/dist/inspector/runtime/runtimeConfig.js +10 -1
  128. package/dist/inspector/runtime/runtimeIdentityClaims.d.ts +29 -0
  129. package/dist/inspector/runtime/runtimeIdentityClaims.js +188 -0
  130. package/dist/inspector/runtime/staticHtmlRuntimeIdentity.d.ts +15 -0
  131. package/dist/inspector/runtime/staticHtmlRuntimeIdentity.js +113 -29
  132. package/dist/inspector/selection/editScope.d.ts +1 -0
  133. package/dist/inspector/selection/editScope.js +13 -2
  134. package/dist/inspector/shell/AgentStatusButton.js +2 -2
  135. package/dist/inspector/shell/AppShell.js +6 -2
  136. package/dist/inspector/shell/ChangesLog.js +27 -9
  137. package/dist/inspector/shell/CopyPromptButton.js +60 -54
  138. package/dist/inspector/shell/EmptyState.js +3 -3
  139. package/dist/inspector/shell/InspectorShell.d.ts +0 -3
  140. package/dist/inspector/shell/InspectorShell.js +21 -13
  141. package/dist/inspector/shell/PeekOriginalButton.js +3 -3
  142. package/dist/inspector/shell/interactionStatePreview.d.ts +9 -0
  143. package/dist/inspector/shell/interactionStatePreview.js +112 -0
  144. package/dist/inspector/shell/originalPreview.d.ts +3 -2
  145. package/dist/inspector/shell/originalPreview.js +10 -37
  146. package/dist/inspector/shell/stateValue.js +2 -3
  147. package/dist/inspector/sketch/SketchEditor.js +5 -4
  148. package/dist/inspector/sketch/SketchFrameOverlay.d.ts +2 -1
  149. package/dist/inspector/sketch/SketchFrameOverlay.js +5 -4
  150. package/dist/inspector/sketch/SketchOverlay.d.ts +3 -5
  151. package/dist/inspector/sketch/SketchOverlay.js +139 -263
  152. package/dist/inspector/sketch/SketchPromptPanel.d.ts +1 -1
  153. package/dist/inspector/sketch/SketchPromptPanel.js +8 -1
  154. package/dist/inspector/sketch/SketchThumbnail.d.ts +5 -0
  155. package/dist/inspector/sketch/SketchThumbnail.js +18 -0
  156. package/dist/inspector/sketch/SketchWorkspace.d.ts +1 -2
  157. package/dist/inspector/sketch/SketchWorkspace.js +69 -34
  158. package/dist/inspector/sketch/capture.js +19 -3
  159. package/dist/inspector/sketch/copySketch.d.ts +10 -0
  160. package/dist/inspector/sketch/copySketch.js +52 -0
  161. package/dist/inspector/sketch/drawingTools.d.ts +17 -0
  162. package/dist/inspector/sketch/drawingTools.js +47 -0
  163. package/dist/inspector/sketch/frameHeading.d.ts +9 -0
  164. package/dist/inspector/sketch/frameHeading.js +30 -0
  165. package/dist/inspector/sketch/freehand.js +3 -3
  166. package/dist/inspector/sketch/geometry.d.ts +6 -0
  167. package/dist/inspector/sketch/geometry.js +19 -0
  168. package/dist/inspector/sketch/history.d.ts +30 -0
  169. package/dist/inspector/sketch/history.js +58 -0
  170. package/dist/inspector/sketch/interaction.d.ts +1 -3
  171. package/dist/inspector/sketch/interaction.js +6 -9
  172. package/dist/inspector/sketch/model.d.ts +35 -1
  173. package/dist/inspector/sketch/model.js +116 -61
  174. package/dist/inspector/sketch/persistence.d.ts +14 -0
  175. package/dist/inspector/sketch/persistence.js +63 -7
  176. package/dist/inspector/sketch/raster.d.ts +6 -2
  177. package/dist/inspector/sketch/raster.js +43 -17
  178. package/dist/inspector/sketch/store.d.ts +1 -1
  179. package/dist/inspector/sketch/store.js +1 -1
  180. package/dist/inspector/sketch/videoFrames.d.ts +6 -0
  181. package/dist/inspector/sketch/videoFrames.js +81 -0
  182. package/dist/inspector/styleEditors/BackgroundEditor.js +2 -1
  183. package/dist/inspector/styleEditors/BorderEditor.js +30 -130
  184. package/dist/inspector/styleEditors/BorderRadiusEditor.js +8 -3
  185. package/dist/inspector/styleEditors/ImageBackgroundEditor.js +1 -1
  186. package/dist/inspector/styleEditors/LayoutSection.js +2 -2
  187. package/dist/inspector/styleEditors/borderModel.d.ts +42 -0
  188. package/dist/inspector/styleEditors/borderModel.js +114 -0
  189. package/dist/inspector/styleEditors/layoutValue.js +2 -3
  190. package/dist/inspector/tokens/TokenField.js +34 -3
  191. package/dist/inspector/tokens/TokensPanel.js +2 -1
  192. package/dist/inspector/tokens/editActions.d.ts +3 -3
  193. package/dist/inspector/tokens/editActions.js +9 -3
  194. package/dist/inspector/tokens/resolution/containerQueryEvaluator.d.ts +15 -0
  195. package/dist/inspector/tokens/resolution/containerQueryEvaluator.js +86 -0
  196. package/dist/inspector/tokens/resolution/cssomCollector.js +44 -9
  197. package/dist/inspector/tokens/resolution/nestedSelectors.d.ts +6 -0
  198. package/dist/inspector/tokens/resolution/nestedSelectors.js +67 -0
  199. package/dist/inspector/tokens/resolution/ruleMatching.js +23 -4
  200. package/dist/inspector/tokens/resolution.d.ts +6 -3
  201. package/dist/inspector/tokens/resolution.js +91 -112
  202. package/dist/inspector/tokens/tokenEdits.d.ts +1 -1
  203. package/dist/inspector/tokens/tokenEdits.js +1 -1
  204. package/dist/inspector/ui/InlineStyleWarning.js +2 -2
  205. package/dist/inspector/ui/InspectorStyle.d.ts +8 -0
  206. package/dist/inspector/ui/InspectorStyle.js +26 -0
  207. package/dist/inspector/ui/PopoverListbox.d.ts +2 -1
  208. package/dist/inspector/ui/PopoverListbox.js +3 -3
  209. package/dist/inspector/ui/Toast.d.ts +14 -0
  210. package/dist/inspector/ui/Toast.js +30 -0
  211. package/dist/inspector/ui/assets/canvasIllustration.d.ts +2 -0
  212. package/dist/inspector/ui/assets/canvasIllustration.js +21 -0
  213. package/dist/inspector/ui/assets/gridIllustration.d.ts +2 -0
  214. package/dist/inspector/ui/assets/{grid.svg → gridIllustration.js} +3 -2
  215. package/dist/inspector/ui/customCursors.d.ts +5 -0
  216. package/dist/inspector/ui/customCursors.js +32 -6
  217. package/dist/inspector/ui/styles.js +12 -10
  218. package/dist/inspector/workspace/commands.js +1 -2
  219. package/dist/inspector/workspace/controller.js +1 -2
  220. package/dist/inspector/workspace/handoff.js +3 -2
  221. package/dist/inspector/workspace/sentItems.d.ts +3 -6
  222. package/dist/inspector/workspace/sentItems.js +6 -24
  223. package/dist/inspector/workspace/timeline.d.ts +24 -10
  224. package/dist/inspector/workspace/timeline.js +118 -96
  225. package/dist/internal/agent-protocol.d.ts +50 -13
  226. package/dist/internal/agent-protocol.js +145 -19
  227. package/dist/nudge-ui.mjs +81 -65
  228. package/dist/project/mcpPackage.d.ts +8 -0
  229. package/dist/project/mcpPackage.js +60 -0
  230. package/package.json +12 -2
  231. package/dist/inspector/canvas/measurementProjection.d.ts +0 -8
  232. package/dist/inspector/canvas/measurementProjection.js +0 -16
  233. package/dist/inspector/changes/changesLog.d.ts +0 -49
  234. package/dist/inspector/changes/changesLog.js +0 -255
  235. package/dist/inspector/changes/draftChanges.d.ts +0 -58
  236. package/dist/inspector/changes/draftChanges.js +0 -304
  237. package/dist/inspector/conformance/projection.d.ts +0 -2
  238. package/dist/inspector/conformance/projection.js +0 -3
  239. package/dist/inspector/inline-text/textChangeBoundary.d.ts +0 -6
  240. package/dist/inspector/inline-text/textChangeBoundary.js +0 -1
  241. package/dist/inspector/overlay/InspectorOverlay.d.ts +0 -5
  242. package/dist/inspector/overlay/InspectorOverlay.js +0 -332
  243. package/dist/inspector/overlay/elementSelector.d.ts +0 -1
  244. package/dist/inspector/overlay/elementSelector.js +0 -111
  245. package/dist/inspector/sketch/SketchChanges.d.ts +0 -2
  246. package/dist/inspector/sketch/SketchChanges.js +0 -72
  247. package/dist/inspector/sketch/SketchEntryButton.d.ts +0 -4
  248. package/dist/inspector/sketch/SketchEntryButton.js +0 -11
  249. package/dist/inspector/sketch/SketchLayersPanel.d.ts +0 -2
  250. package/dist/inspector/sketch/SketchLayersPanel.js +0 -71
package/dist/nudge-ui.mjs CHANGED
@@ -3750,8 +3750,8 @@ var require_source_map = __commonJS({
3750
3750
  var require_previous_map = __commonJS({
3751
3751
  "../../node_modules/.pnpm/postcss@8.5.26/node_modules/postcss/lib/previous-map.js"(exports, module) {
3752
3752
  "use strict";
3753
- var { existsSync: existsSync4, readFileSync: readFileSync2, realpathSync: realpathSync3 } = __require("fs");
3754
- var { dirname: dirname5, isAbsolute: isAbsolute5, join: join7, relative: relative5, sep: sep4 } = __require("path");
3753
+ var { existsSync: existsSync3, readFileSync: readFileSync3, realpathSync: realpathSync3 } = __require("fs");
3754
+ var { dirname: dirname4, isAbsolute: isAbsolute5, join: join7, relative: relative5, sep: sep4 } = __require("path");
3755
3755
  var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
3756
3756
  function realPath(path) {
3757
3757
  try {
@@ -3778,7 +3778,7 @@ var require_previous_map = __commonJS({
3778
3778
  if (!this.mapFile && opts.from) {
3779
3779
  this.mapFile = opts.from;
3780
3780
  }
3781
- if (this.mapFile) this.root = dirname5(this.mapFile);
3781
+ if (this.mapFile) this.root = dirname4(this.mapFile);
3782
3782
  if (text) this.text = text;
3783
3783
  }
3784
3784
  consumer() {
@@ -3824,15 +3824,15 @@ var require_previous_map = __commonJS({
3824
3824
  if (!trusted && !this.unsafeMap) {
3825
3825
  if (!/\.map$/i.test(path)) return void 0;
3826
3826
  if (!cssFile) return void 0;
3827
- let rel = relative5(realPath(dirname5(cssFile)), realPath(path));
3827
+ let rel = relative5(realPath(dirname4(cssFile)), realPath(path));
3828
3828
  if (rel === ".." || rel.startsWith(".." + sep4) || isAbsolute5(rel)) {
3829
3829
  return void 0;
3830
3830
  }
3831
3831
  }
3832
- this.root = dirname5(path);
3833
- if (existsSync4(path)) {
3832
+ this.root = dirname4(path);
3833
+ if (existsSync3(path)) {
3834
3834
  this.mapFile = path;
3835
- return readFileSync2(path, "utf-8").toString().trim();
3835
+ return readFileSync3(path, "utf-8").toString().trim();
3836
3836
  }
3837
3837
  }
3838
3838
  loadMap(file, prev) {
@@ -3866,7 +3866,7 @@ var require_previous_map = __commonJS({
3866
3866
  return this.decodeInline(this.annotation);
3867
3867
  } else if (this.annotation) {
3868
3868
  let map = this.annotation;
3869
- if (file) map = join7(dirname5(file), map);
3869
+ if (file) map = join7(dirname4(file), map);
3870
3870
  let unknown = this.loadFile(map, file, false);
3871
3871
  if (unknown) {
3872
3872
  try {
@@ -4369,12 +4369,12 @@ var require_fromJSON = __commonJS({
4369
4369
  var require_map_generator = __commonJS({
4370
4370
  "../../node_modules/.pnpm/postcss@8.5.26/node_modules/postcss/lib/map-generator.js"(exports, module) {
4371
4371
  "use strict";
4372
- var { dirname: dirname5, relative: relative5, resolve: resolve5, sep: sep4 } = __require("path");
4372
+ var { dirname: dirname4, relative: relative5, resolve: resolve5, sep: sep4 } = __require("path");
4373
4373
  var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
4374
4374
  var { pathToFileURL: pathToFileURL2 } = __require("url");
4375
4375
  var Input2 = require_input();
4376
4376
  var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
4377
- var pathAvailable = Boolean(dirname5 && resolve5 && relative5 && sep4);
4377
+ var pathAvailable = Boolean(dirname4 && resolve5 && relative5 && sep4);
4378
4378
  var MapGenerator = class {
4379
4379
  constructor(stringify2, root2, opts, cssString) {
4380
4380
  this.stringify = stringify2;
@@ -4406,7 +4406,7 @@ var require_map_generator = __commonJS({
4406
4406
  applyPrevMaps() {
4407
4407
  for (let prev of this.previous()) {
4408
4408
  let from = this.toUrl(this.path(prev.file));
4409
- let root2 = prev.root || dirname5(prev.file);
4409
+ let root2 = prev.root || dirname4(prev.file);
4410
4410
  let map;
4411
4411
  if (this.mapOpts.sourcesContent === false) {
4412
4412
  map = new SourceMapConsumer(prev.text);
@@ -4601,9 +4601,9 @@ var require_map_generator = __commonJS({
4601
4601
  if (/^\w+:\/\//.test(file)) return file;
4602
4602
  let cached = this.memoizedPaths.get(file);
4603
4603
  if (cached) return cached;
4604
- let from = this.opts.to ? dirname5(this.opts.to) : ".";
4604
+ let from = this.opts.to ? dirname4(this.opts.to) : ".";
4605
4605
  if (typeof this.mapOpts.annotation === "string") {
4606
- from = dirname5(resolve5(from, this.mapOpts.annotation));
4606
+ from = dirname4(resolve5(from, this.mapOpts.annotation));
4607
4607
  }
4608
4608
  let path = relative5(from, file);
4609
4609
  this.memoizedPaths.set(file, path);
@@ -6152,11 +6152,58 @@ import { resolve as resolve4 } from "node:path";
6152
6152
 
6153
6153
  // src/cli/agentCommand.ts
6154
6154
  import { spawnSync } from "node:child_process";
6155
- import { existsSync } from "node:fs";
6155
+
6156
+ // src/project/mcpPackage.ts
6157
+ import { existsSync, readFileSync } from "node:fs";
6156
6158
  import { createRequire } from "node:module";
6157
- import { dirname, join } from "node:path";
6159
+ import { dirname, join, parse } from "node:path";
6160
+ var MCP_PACKAGE = "@nudge-ui/mcp";
6161
+ var MCP_BIN = "nudge-mcp";
6162
+ function findProjectMcpRoot(appRoot) {
6163
+ let directory2 = appRoot;
6164
+ const { root: root2 } = parse(directory2);
6165
+ for (; ; ) {
6166
+ const candidate = join(directory2, "node_modules", "@nudge-ui", "mcp");
6167
+ if (existsSync(join(candidate, "package.json"))) return candidate;
6168
+ if (directory2 === root2) break;
6169
+ directory2 = dirname(directory2);
6170
+ }
6171
+ if (!isPnpRuntime()) return null;
6172
+ try {
6173
+ return packageRootOf(createRequire(join(appRoot, "package.json")).resolve(MCP_PACKAGE));
6174
+ } catch {
6175
+ return null;
6176
+ }
6177
+ }
6178
+ function projectMcpCliEntry(mcpRoot) {
6179
+ const bin = readManifest(join(mcpRoot, "package.json"))?.bin;
6180
+ const entry = typeof bin === "string" ? bin : isRecord(bin) ? bin[MCP_BIN] : void 0;
6181
+ return typeof entry === "string" ? join(mcpRoot, entry) : null;
6182
+ }
6183
+ function packageRootOf(entry) {
6184
+ for (let directory2 = dirname(entry); ; directory2 = dirname(directory2)) {
6185
+ const manifest = join(directory2, "package.json");
6186
+ if (existsSync(manifest) && readManifest(manifest)?.name === MCP_PACKAGE) return directory2;
6187
+ if (dirname(directory2) === directory2) return null;
6188
+ }
6189
+ }
6190
+ function readManifest(path) {
6191
+ try {
6192
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
6193
+ return isRecord(parsed) ? parsed : null;
6194
+ } catch {
6195
+ return null;
6196
+ }
6197
+ }
6198
+ function isRecord(value) {
6199
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6200
+ }
6201
+ function isPnpRuntime() {
6202
+ return typeof process.versions.pnp === "string";
6203
+ }
6204
+
6205
+ // src/cli/agentCommand.ts
6158
6206
  function planAgentCommand(args, projectRoot, packageVersion) {
6159
- const projectRequire = createRequire(join(projectRoot, "package.json"));
6160
6207
  if (args[0] === "setup") {
6161
6208
  if (!packageVersion || !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(packageVersion)) {
6162
6209
  throw new Error("Run agent setup through the installed nudge-ui executable.");
@@ -6167,13 +6214,9 @@ function planAgentCommand(args, projectRoot, packageVersion) {
6167
6214
  };
6168
6215
  }
6169
6216
  if (args[0] === "doctor") {
6170
- let entry;
6171
- try {
6172
- const packageEntry = projectRequire.resolve(findLocalMcp(projectRoot, projectRequire));
6173
- entry = join(dirname(packageEntry), "cli.mjs");
6174
- } catch {
6175
- throw new Error("Nudge agent integration is not installed. Run nudge-ui agent setup.");
6176
- }
6217
+ const mcpRoot = findProjectMcpRoot(projectRoot);
6218
+ const entry = mcpRoot === null ? null : projectMcpCliEntry(mcpRoot);
6219
+ if (entry === null) throw new Error("Nudge agent integration is not installed. Run nudge-ui agent setup.");
6177
6220
  return {
6178
6221
  executable: process.execPath,
6179
6222
  args: [entry, "doctor", "--workspace-root", projectRoot, ...args.slice(1)]
@@ -6181,20 +6224,6 @@ function planAgentCommand(args, projectRoot, packageVersion) {
6181
6224
  }
6182
6225
  throw new Error("Usage: nudge-ui agent <setup|doctor> [options]");
6183
6226
  }
6184
- function findLocalMcp(projectRoot, projectRequire) {
6185
- let directory2 = projectRoot;
6186
- while (true) {
6187
- const candidate = join(directory2, "node_modules", "@nudge-ui", "mcp");
6188
- if (existsSync(join(candidate, "package.json"))) return candidate;
6189
- const parent = dirname(directory2);
6190
- if (parent === directory2) break;
6191
- directory2 = parent;
6192
- }
6193
- if (process.versions.pnp) {
6194
- return projectRequire.resolve("@nudge-ui/mcp");
6195
- }
6196
- throw new Error("MCP is not installed in this project.");
6197
- }
6198
6227
  function runAgentCommand(args, packageVersion) {
6199
6228
  const command = planAgentCommand(args, process.cwd(), packageVersion);
6200
6229
  const result = spawnSync(command.executable, command.args, { cwd: process.cwd(), stdio: "inherit" });
@@ -6215,7 +6244,7 @@ function isHtmlArtifactRevision(value) {
6215
6244
 
6216
6245
  // src/project/artifacts.ts
6217
6246
  import { createHash } from "node:crypto";
6218
- import { readFileSync, renameSync, writeFileSync } from "node:fs";
6247
+ import { readFileSync as readFileSync2, renameSync, writeFileSync } from "node:fs";
6219
6248
  import { mkdir, readFile, realpath, rename, rm, writeFile } from "node:fs/promises";
6220
6249
  import { isAbsolute, join as join2, relative, sep } from "node:path";
6221
6250
 
@@ -14171,7 +14200,7 @@ var VOID_ELEMENTS = /* @__PURE__ */ new Set([
14171
14200
  ]);
14172
14201
 
14173
14202
  // ../../node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/index.js
14174
- function parse(html, options) {
14203
+ function parse2(html, options) {
14175
14204
  return Parser.parse(html, options);
14176
14205
  }
14177
14206
 
@@ -14181,7 +14210,7 @@ var MOUNT_MARKER = "data-nudge-ui-mount";
14181
14210
  function injectStandaloneBootstrap(html, options = {}) {
14182
14211
  const clientPath = options.clientPath ?? NUDGE_UI_CLIENT_PATH;
14183
14212
  const manifestPath = options.manifestPath ?? NUDGE_UI_MANIFEST_PATH;
14184
- const document2 = parse(html, { sourceCodeLocationInfo: true });
14213
+ const document2 = parse2(html, { sourceCodeLocationInfo: true });
14185
14214
  const sourceFacts = inspectSource(document2, clientPath);
14186
14215
  const nodes = [];
14187
14216
  if (!sourceFacts.hasMount) {
@@ -14424,8 +14453,8 @@ async function handleHtmlArtifactRequest(request, response, root2, transformHtml
14424
14453
  await writeFile(temporary, html);
14425
14454
  }
14426
14455
  const latest = {
14427
- document: revision(readFileSync(join2(target, "document.html"))),
14428
- preview: revision(readFileSync(join2(target, "preview.html")))
14456
+ document: revision(readFileSync2(join2(target, "document.html"))),
14457
+ preview: revision(readFileSync2(join2(target, "preview.html")))
14429
14458
  };
14430
14459
  if (!sameRevision(latest, expected)) {
14431
14460
  respond(response, 409, HTML_ITERATION_CONFLICT);
@@ -14484,12 +14513,12 @@ import {
14484
14513
  } from "node:http";
14485
14514
  import {
14486
14515
  constants,
14487
- existsSync as existsSync3,
14516
+ existsSync as existsSync2,
14488
14517
  realpathSync as realpathSync2,
14489
14518
  statSync as statSync2
14490
14519
  } from "node:fs";
14491
14520
  import { open, stat as stat2 } from "node:fs/promises";
14492
- import { dirname as dirname4, extname as extname2, isAbsolute as isAbsolute4, join as join6, relative as relative4, resolve as resolve3 } from "node:path";
14521
+ import { dirname as dirname3, extname as extname2, isAbsolute as isAbsolute4, join as join6, relative as relative4, resolve as resolve3 } from "node:path";
14493
14522
  import { createRequire as createRequire3 } from "node:module";
14494
14523
 
14495
14524
  // src/html/dom.ts
@@ -14594,7 +14623,7 @@ function runIdentityPass(source, pass) {
14594
14623
  });
14595
14624
  };
14596
14625
  const parseErrors = [];
14597
- const document2 = parse(source, {
14626
+ const document2 = parse2(source, {
14598
14627
  sourceCodeLocationInfo: true,
14599
14628
  onParseError: (error) => parseErrors.push(error)
14600
14629
  });
@@ -14679,9 +14708,8 @@ function instrumentSourceHtml(source, file) {
14679
14708
  }
14680
14709
 
14681
14710
  // src/hosts/projectBridge.ts
14682
- import { existsSync as existsSync2 } from "node:fs";
14683
14711
  import { createRequire as createRequire2 } from "node:module";
14684
- import { dirname as dirname2, join as join3, parse as parse2 } from "node:path";
14712
+ import { join as join3 } from "node:path";
14685
14713
  import { pathToFileURL } from "node:url";
14686
14714
  var runningBridges = /* @__PURE__ */ new Map();
14687
14715
  async function startOptionalProjectBridge(input) {
@@ -14698,7 +14726,7 @@ async function startOptionalProjectBridge(input) {
14698
14726
  async function launchOptionalProjectBridge(input, key) {
14699
14727
  let modulePath;
14700
14728
  try {
14701
- if (!isPnpRuntime() && !hasProjectInstalledMcp(input.appRoot)) {
14729
+ if (findProjectMcpRoot(input.appRoot) === null) {
14702
14730
  runningBridges.delete(key);
14703
14731
  return null;
14704
14732
  }
@@ -14740,18 +14768,6 @@ async function launchOptionalProjectBridge(input, key) {
14740
14768
  return null;
14741
14769
  }
14742
14770
  }
14743
- function isPnpRuntime() {
14744
- return typeof process.versions.pnp === "string";
14745
- }
14746
- function hasProjectInstalledMcp(appRoot) {
14747
- let directory2 = appRoot;
14748
- const root2 = parse2(directory2).root;
14749
- for (; ; ) {
14750
- if (existsSync2(join3(directory2, "node_modules", "@nudge-ui", "mcp", "package.json"))) return true;
14751
- if (directory2 === root2) return false;
14752
- directory2 = dirname2(directory2);
14753
- }
14754
- }
14755
14771
 
14756
14772
  // src/project/tokens.ts
14757
14773
  import { createHash as createHash2 } from "node:crypto";
@@ -15457,7 +15473,7 @@ function comparePosixStrings(a, b) {
15457
15473
  import { watch } from "node:fs";
15458
15474
  import { readdir as readdir2 } from "node:fs/promises";
15459
15475
  import { realpathSync, statSync } from "node:fs";
15460
- import { dirname as dirname3, isAbsolute as isAbsolute3, join as join5, relative as relative3, resolve as resolve2, sep as sep3 } from "node:path";
15476
+ import { dirname as dirname2, isAbsolute as isAbsolute3, join as join5, relative as relative3, resolve as resolve2, sep as sep3 } from "node:path";
15461
15477
  function createProjectFileWatcher(options) {
15462
15478
  const rootDirectory = realpathSync(resolve2(options.rootDirectory));
15463
15479
  const debounceMs = Math.max(0, options.debounceMs ?? 60);
@@ -15603,7 +15619,7 @@ function canonicalProjectPath(rootDirectory, path) {
15603
15619
  const canonical = realpathSync(path);
15604
15620
  return isWithin(rootDirectory, canonical) && !isSensitiveProjectPath(relative3(rootDirectory, canonical).split(sep3).join("/")) ? canonical : null;
15605
15621
  } catch {
15606
- const parent = dirname3(path);
15622
+ const parent = dirname2(path);
15607
15623
  if (parent === path) return null;
15608
15624
  try {
15609
15625
  const canonicalParent = realpathSync(parent);
@@ -15817,13 +15833,13 @@ function resolveDecodedStaticFile(root2, decodedPath) {
15817
15833
  if (!isWithin2(root2, candidate)) return null;
15818
15834
  const canonicalCandidate = canonicalExistingAncestor(candidate);
15819
15835
  if (!canonicalCandidate || !isWithin2(root2, canonicalCandidate)) return null;
15820
- if (!existsSync3(candidate)) return null;
15836
+ if (!existsSync2(candidate)) return null;
15821
15837
  let filePath = canonicalCandidate;
15822
15838
  const stats = statSync2(filePath);
15823
15839
  if (stats.isDirectory()) {
15824
15840
  const indexCandidate = join6(filePath, "index.html");
15825
15841
  const canonicalIndex = canonicalExistingAncestor(indexCandidate);
15826
- if (!canonicalIndex || !isWithin2(root2, canonicalIndex) || !existsSync3(indexCandidate)) {
15842
+ if (!canonicalIndex || !isWithin2(root2, canonicalIndex) || !existsSync2(indexCandidate)) {
15827
15843
  return null;
15828
15844
  }
15829
15845
  if (!statSync2(canonicalIndex).isFile()) return null;
@@ -15903,7 +15919,7 @@ function canonicalExistingAncestor(candidate) {
15903
15919
  return realpathSync2(current);
15904
15920
  } catch (error) {
15905
15921
  if (!isMissingPathError(error)) return null;
15906
- const parent = dirname4(current);
15922
+ const parent = dirname3(current);
15907
15923
  if (parent === current) return null;
15908
15924
  current = parent;
15909
15925
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Locates the optional MCP package installed for an application. Only the
3
+ * application's own dependency tree counts; a global or unrelated copy never
4
+ * starts a bridge or answers diagnostics for this project.
5
+ */
6
+ export declare function findProjectMcpRoot(appRoot: string): string | null;
7
+ /** Absolute path of the installed package's `nudge-mcp` executable entry. */
8
+ export declare function projectMcpCliEntry(mcpRoot: string): string | null;
@@ -0,0 +1,60 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { dirname, join, parse } from "node:path";
4
+ const MCP_PACKAGE = "@nudge-ui/mcp";
5
+ const MCP_BIN = "nudge-mcp";
6
+ /**
7
+ * Locates the optional MCP package installed for an application. Only the
8
+ * application's own dependency tree counts; a global or unrelated copy never
9
+ * starts a bridge or answers diagnostics for this project.
10
+ */
11
+ export function findProjectMcpRoot(appRoot) {
12
+ let directory = appRoot;
13
+ const { root } = parse(directory);
14
+ for (;;) {
15
+ const candidate = join(directory, "node_modules", "@nudge-ui", "mcp");
16
+ if (existsSync(join(candidate, "package.json")))
17
+ return candidate;
18
+ if (directory === root)
19
+ break;
20
+ directory = dirname(directory);
21
+ }
22
+ if (!isPnpRuntime())
23
+ return null;
24
+ try {
25
+ return packageRootOf(createRequire(join(appRoot, "package.json")).resolve(MCP_PACKAGE));
26
+ }
27
+ catch {
28
+ return null;
29
+ }
30
+ }
31
+ /** Absolute path of the installed package's `nudge-mcp` executable entry. */
32
+ export function projectMcpCliEntry(mcpRoot) {
33
+ const bin = readManifest(join(mcpRoot, "package.json"))?.bin;
34
+ const entry = typeof bin === "string" ? bin : isRecord(bin) ? bin[MCP_BIN] : undefined;
35
+ return typeof entry === "string" ? join(mcpRoot, entry) : null;
36
+ }
37
+ function packageRootOf(entry) {
38
+ for (let directory = dirname(entry);; directory = dirname(directory)) {
39
+ const manifest = join(directory, "package.json");
40
+ if (existsSync(manifest) && readManifest(manifest)?.name === MCP_PACKAGE)
41
+ return directory;
42
+ if (dirname(directory) === directory)
43
+ return null;
44
+ }
45
+ }
46
+ function readManifest(path) {
47
+ try {
48
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
49
+ return isRecord(parsed) ? parsed : null;
50
+ }
51
+ catch {
52
+ return null;
53
+ }
54
+ }
55
+ function isRecord(value) {
56
+ return typeof value === "object" && value !== null && !Array.isArray(value);
57
+ }
58
+ function isPnpRuntime() {
59
+ return typeof process.versions.pnp === "string";
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nudge-ui",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "A design panel for your codebase. Development only.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -68,6 +68,16 @@
68
68
  "import": "./dist/inspector/componentSemantics/runtimeBridge.js",
69
69
  "default": "./dist/inspector/componentSemantics/runtimeBridge.js"
70
70
  },
71
+ "./internal/page-inspector": {
72
+ "types": "./dist/inspector/pageInspector.d.ts",
73
+ "import": "./dist/inspector/pageInspector.js",
74
+ "default": "./dist/inspector/pageInspector.js"
75
+ },
76
+ "./internal/cursor-images": {
77
+ "types": "./dist/inspector/ui/customCursors.d.ts",
78
+ "import": "./dist/inspector/ui/customCursors.js",
79
+ "default": "./dist/inspector/ui/customCursors.js"
80
+ },
71
81
  "./internal/next/mount": {
72
82
  "types": "./dist/hosts/next/mount.d.ts",
73
83
  "import": "./dist/hosts/next/mount.js",
@@ -137,7 +147,7 @@
137
147
  "typecheck": "tsc --noEmit -p tsconfig.json",
138
148
  "test:unit": "vitest run --config vitest.unit.config.ts",
139
149
  "test:unit:watch": "vitest --config vitest.unit.config.ts",
140
- "test:ui-integration": "vitest run src/inspector/styleEditors/LayoutSection.test.tsx src/inspector/styleEditors/LayoutComboField.test.tsx src/inspector/tokens/TokenDropdown.test.tsx src/inspector/ui/ui.test.tsx src/inspector/styleEditors/LayoutDropdown.test.tsx src/inspector/tokens/TokenField.test.tsx src/inspector/styleEditors/Typography.test.tsx src/inspector/styleEditors/BorderEditor.test.tsx src/inspector/styleEditors/AspectRatioField.test.tsx",
150
+ "test:ui-integration": "vitest run --config vitest.ui.config.ts",
141
151
  "test:unit:full": "vitest run"
142
152
  }
143
153
  }
@@ -1,8 +0,0 @@
1
- import type { MeasurementSegment } from "../overlay/measurementGeometry.js";
2
- import type { Rect } from "../overlay/overlayGeometry.js";
3
- /**
4
- * Maps iframe-local measurement geometry into the Canvas board's screen
5
- * coordinate system. Distances deliberately remain in local CSS pixels so
6
- * their labels stay meaningful regardless of the board zoom.
7
- */
8
- export declare function projectMeasurementSegments(iframeRect: Rect, segments: MeasurementSegment[], zoom: number): MeasurementSegment[];
@@ -1,16 +0,0 @@
1
- /**
2
- * Maps iframe-local measurement geometry into the Canvas board's screen
3
- * coordinate system. Distances deliberately remain in local CSS pixels so
4
- * their labels stay meaningful regardless of the board zoom.
5
- */
6
- export function projectMeasurementSegments(iframeRect, segments, zoom) {
7
- const projectPoint = (point) => ({
8
- x: iframeRect.left + point.x * zoom,
9
- y: iframeRect.top + point.y * zoom,
10
- });
11
- return segments.map((segment) => ({
12
- ...segment,
13
- from: projectPoint(segment.from),
14
- to: projectPoint(segment.to),
15
- }));
16
- }
@@ -1,49 +0,0 @@
1
- import type { StyleRule } from "../projection/managedStylesheet.js";
2
- import type { ChangeRecord } from "./types.js";
3
- import { type CommitResult } from "./draftChanges.js";
4
- import type { StructuralChange } from "./structuralTypes.js";
5
- export { isComponentChange, isElementChange, isTextContentChange, isTextContentChangeValue, isPreviewableChange, isTokenChange, } from "./types.js";
6
- export type { ChangeRecord, ComponentChangeRecord, ElementChangeRecord, PreviewableChangeRecord, TextContentChangeRecord, TokenChangeRecord, RuntimeElementEvidence, SourceElementEvidence, } from "./types.js";
7
- export interface AppendChangesOptions {
8
- /** The rendered target captured for each change key at commit time. */
9
- verificationTargets?: ReadonlyMap<string, HTMLElement | null>;
10
- }
11
- declare function subscribe(cb: () => void): () => void;
12
- declare function getChangesSnapshot(): ChangeRecord[];
13
- export declare function getPendingRules(): StyleRule[];
14
- /** Append records and report whether canonical workspace state changed. */
15
- export declare function appendChanges(incoming: ChangeRecord[], options?: AppendChangesOptions): CommitResult;
16
- export declare function appendChange(change: ChangeRecord): CommitResult;
17
- export declare function revertChange(change: ChangeRecord): void;
18
- /**
19
- * Removes source-verified records without allowing older undo snapshots to
20
- * resurrect their managed previews.
21
- *
22
- * Agent handoff revisions identify records by the same stable key used by the
23
- * canonical change model. Verification can therefore reconcile a subset while
24
- * preserving newer, unsent edits and their remaining undo history.
25
- */
26
- export declare function reconcileVerifiedChanges(verifiedKeys: ReadonlySet<string>): number;
27
- /** Atomically reconciles ordinary and structural intent from one agent handoff. */
28
- export declare function reconcileVerifiedDraftChanges(verifiedKeys: ReadonlySet<string>, verifiedStructuralIds: ReadonlySet<string>): number;
29
- /** Replaces ordinary and structural intent as one undoable edit. */
30
- export declare function commitDraftContents(changes: readonly ChangeRecord[], structuralChanges: readonly StructuralChange[]): boolean;
31
- export declare function discardChangesForSelector(selector: string): void;
32
- /** Relink removes every CSS declaration owned by one durable rendered target. */
33
- export declare function discardChangesForInstanceOverride(overrideId: string): void;
34
- export declare function undo(): boolean;
35
- export declare function redo(): boolean;
36
- /**
37
- * Replaces ordinary records while preserving structural intent. Restoring any
38
- * dimension is terminal for the unified workspace timeline, so undo and redo
39
- * history are reset for both dimensions.
40
- */
41
- export declare function restoreChangeRecords(incoming: ChangeRecord[]): void;
42
- /** Restores every canonical workspace intent as one subscriber-visible snapshot. */
43
- export declare function loadActiveDraftChanges(incoming: readonly ChangeRecord[], structuralChanges: readonly StructuralChange[], preserveHistory?: boolean): void;
44
- /** Clears the active draft and its edit steps, preserving other session history. */
45
- export declare function clearActiveDraft(): void;
46
- export declare function getChangesList(): ChangeRecord[];
47
- export { subscribe as subscribeChanges, getChangesSnapshot as getChanges };
48
- export declare function useChanges(): ChangeRecord[];
49
- export declare function refreshDraftPreview(): void;