nudge-ui 0.2.4 → 0.2.6

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 (642) hide show
  1. package/dist/cli/agentCommand.d.ts +0 -1
  2. package/dist/cli/agentCommand.js +4 -29
  3. package/dist/client.mjs +987 -221
  4. package/dist/compiler/ast.d.ts +0 -6
  5. package/dist/compiler/ast.js +0 -5
  6. package/dist/compiler/componentContractTypes.d.ts +11 -5
  7. package/dist/compiler/componentContracts.js +3 -9
  8. package/dist/compiler/componentInstrumentation.d.ts +2 -13
  9. package/dist/compiler/componentInstrumentation.js +3 -12
  10. package/dist/compiler/componentPolicyResolution.d.ts +3 -22
  11. package/dist/compiler/componentPolicyResolution.js +6 -38
  12. package/dist/compiler/identityAttributes.d.ts +2 -0
  13. package/dist/compiler/identityAttributes.js +2 -0
  14. package/dist/compiler/index.d.ts +0 -1
  15. package/dist/compiler/index.js +0 -1
  16. package/dist/compiler/packageComponentContracts.d.ts +10 -19
  17. package/dist/compiler/packageComponentContracts.js +60 -43
  18. package/dist/compiler/reactComponentProtocols.d.ts +0 -7
  19. package/dist/compiler/reactComponentProtocols.js +0 -7
  20. package/dist/compiler/reactIdentity.d.ts +2 -2
  21. package/dist/compiler/reactIdentity.js +41 -43
  22. package/dist/compiler/sourcePaths.d.ts +4 -8
  23. package/dist/compiler/sourcePaths.js +6 -8
  24. package/dist/css/dialects/index.d.ts +2 -21
  25. package/dist/css/dialects/index.js +2 -9
  26. package/dist/css/dialects/tailwind.d.ts +2 -16
  27. package/dist/css/dialects/tailwind.js +2 -25
  28. package/dist/css/dialects/vanillaExtract.d.ts +1 -9
  29. package/dist/css/dialects/vanillaExtract.js +0 -1
  30. package/dist/css/index.d.ts +0 -8
  31. package/dist/css/index.js +0 -8
  32. package/dist/css/model/index.d.ts +6 -38
  33. package/dist/css/model/index.js +0 -9
  34. package/dist/css/token-inventory/index.d.ts +0 -23
  35. package/dist/css/token-inventory/index.js +0 -23
  36. package/dist/css/token-inventory/inventory.js +4 -16
  37. package/dist/css/token-inventory/parseStylesheet.d.ts +1 -9
  38. package/dist/css/token-inventory/parseStylesheet.js +5 -42
  39. package/dist/css/token-inventory/policy.d.ts +2 -39
  40. package/dist/css/token-inventory/policy.js +2 -39
  41. package/dist/css/token-inventory/types.d.ts +2 -15
  42. package/dist/css/value-semantics/borderSemantics.d.ts +1 -8
  43. package/dist/css/value-semantics/borderSemantics.js +5 -23
  44. package/dist/css/value-semantics/boxSemantics.d.ts +2 -25
  45. package/dist/css/value-semantics/boxSemantics.js +1 -7
  46. package/dist/css/value-semantics/colorSemantics.d.ts +6 -60
  47. package/dist/css/value-semantics/colorSemantics.js +9 -40
  48. package/dist/css/value-semantics/cssSyntax.d.ts +10 -10
  49. package/dist/css/value-semantics/cssSyntax.js +39 -11
  50. package/dist/css/value-semantics/fontSemantics.d.ts +3 -19
  51. package/dist/css/value-semantics/fontSemantics.js +7 -25
  52. package/dist/css/value-semantics/index.d.ts +1 -12
  53. package/dist/css/value-semantics/index.js +1 -12
  54. package/dist/css/value-semantics/propertyPolicy.d.ts +6 -53
  55. package/dist/css/value-semantics/propertyPolicy.js +47 -59
  56. package/dist/css/value-semantics/stringMaps.d.ts +0 -1
  57. package/dist/css/value-semantics/structuredValues.d.ts +3 -37
  58. package/dist/css/value-semantics/structuredValues.js +6 -17
  59. package/dist/css/value-semantics/tokenInterpretation.d.ts +8 -50
  60. package/dist/css/value-semantics/tokenInterpretation.js +7 -21
  61. package/dist/hosts/astro/astroRuntimeConfig.d.ts +0 -1
  62. package/dist/hosts/astro/astroRuntimeConfig.js +0 -1
  63. package/dist/hosts/astro/clientAsset.d.ts +1 -5
  64. package/dist/hosts/astro/clientAsset.js +1 -5
  65. package/dist/hosts/astro/clientTransport.d.ts +0 -1
  66. package/dist/hosts/astro/clientTransport.js +4 -9
  67. package/dist/hosts/astro/integration.d.ts +2 -28
  68. package/dist/hosts/astro/integration.js +7 -36
  69. package/dist/hosts/astro/markdownIdentity.d.ts +0 -3
  70. package/dist/hosts/astro/markdownIdentity.js +0 -3
  71. package/dist/hosts/astro/middleware.d.ts +1 -12
  72. package/dist/hosts/astro/middleware.js +1 -12
  73. package/dist/hosts/astro/projectContext.d.ts +1 -9
  74. package/dist/hosts/astro/projectContext.js +2 -11
  75. package/dist/hosts/astro/responseInstrumentation.d.ts +4 -33
  76. package/dist/hosts/astro/responseInstrumentation.js +5 -34
  77. package/dist/hosts/environment.d.ts +0 -8
  78. package/dist/hosts/environment.js +0 -1
  79. package/dist/hosts/next/index.js +1 -3
  80. package/dist/hosts/next/loader.d.ts +5 -44
  81. package/dist/hosts/next/loader.js +22 -103
  82. package/dist/hosts/next/loaders/identity-loader.cjs +111 -65
  83. package/dist/hosts/next/loaders/loader-plugin.cjs +111 -65
  84. package/dist/hosts/next/manifest.d.ts +2 -16
  85. package/dist/hosts/next/manifest.js +18 -20
  86. package/dist/hosts/next/mount.d.ts +1 -11
  87. package/dist/hosts/next/mount.js +1 -11
  88. package/dist/hosts/next/repositoryScope.d.ts +2 -17
  89. package/dist/hosts/next/repositoryScope.js +2 -17
  90. package/dist/hosts/next/sidecar.d.ts +0 -13
  91. package/dist/hosts/next/sidecar.js +25 -110
  92. package/dist/hosts/next/wrapper.d.ts +0 -31
  93. package/dist/hosts/next/wrapper.js +14 -71
  94. package/dist/hosts/projectBridge.d.ts +0 -2
  95. package/dist/hosts/projectBridge.js +3 -19
  96. package/dist/hosts/reactRendererCapture.d.ts +2 -0
  97. package/dist/hosts/reactRendererCapture.js +12 -0
  98. package/dist/hosts/static/cli.d.ts +0 -4
  99. package/dist/hosts/static/cli.js +0 -3
  100. package/dist/hosts/static/html/bootstrap.d.ts +1 -18
  101. package/dist/hosts/static/html/bootstrap.js +2 -14
  102. package/dist/hosts/static/manifest.d.ts +2 -15
  103. package/dist/hosts/static/manifest.js +5 -18
  104. package/dist/hosts/static/server.d.ts +4 -38
  105. package/dist/hosts/static/server.js +17 -67
  106. package/dist/hosts/vite/index.d.ts +0 -10
  107. package/dist/hosts/vite/index.js +0 -10
  108. package/dist/hosts/vite/react.d.ts +4 -17
  109. package/dist/hosts/vite/react.js +18 -35
  110. package/dist/hosts/vite/tokens/activeStylesheets.d.ts +1 -10
  111. package/dist/hosts/vite/tokens/activeStylesheets.js +3 -8
  112. package/dist/hosts/vite/tokens/fileMap.d.ts +0 -1
  113. package/dist/hosts/vite/tokens/viteStylesheetArtifacts.d.ts +2 -15
  114. package/dist/hosts/vite/tokens/viteStylesheetArtifacts.js +3 -10
  115. package/dist/hosts/vite/vite.d.ts +5 -26
  116. package/dist/hosts/vite/vite.js +44 -80
  117. package/dist/html/dom.d.ts +0 -1
  118. package/dist/html/dom.js +0 -1
  119. package/dist/html/identity.d.ts +1 -15
  120. package/dist/html/identity.js +1 -8
  121. package/dist/html/insertions.d.ts +2 -8
  122. package/dist/html/insertions.js +1 -1
  123. package/dist/inspector/agent/McpConnectionDialog.d.ts +1 -6
  124. package/dist/inspector/agent/McpConnectionDialog.js +8 -9
  125. package/dist/inspector/agent/activity.d.ts +2 -2
  126. package/dist/inspector/agent/activity.js +4 -3
  127. package/dist/inspector/agent/client.d.ts +3 -27
  128. package/dist/inspector/agent/client.js +43 -91
  129. package/dist/inspector/agent/connectionStatus.d.ts +3 -2
  130. package/dist/inspector/agent/connectionStatus.js +25 -1
  131. package/dist/inspector/agent/httpTransport.d.ts +0 -8
  132. package/dist/inspector/agent/httpTransport.js +42 -176
  133. package/dist/inspector/agent/protocol.d.ts +1 -10
  134. package/dist/inspector/agent/protocol.js +1 -9
  135. package/dist/inspector/agent/verification.d.ts +3 -20
  136. package/dist/inspector/agent/verification.js +10 -43
  137. package/dist/inspector/boot.d.ts +5 -0
  138. package/dist/inspector/boot.js +289 -0
  139. package/dist/inspector/canvas/AgentActivityOverlay.d.ts +3 -2
  140. package/dist/inspector/canvas/AgentActivityOverlay.js +7 -4
  141. package/dist/inspector/canvas/CanvasCard.js +26 -24
  142. package/dist/inspector/canvas/CanvasElementOverlay.js +196 -174
  143. package/dist/inspector/canvas/CanvasToolbar.js +2 -1
  144. package/dist/inspector/canvas/CanvasWorkspace.js +87 -124
  145. package/dist/inspector/canvas/LockedWorkspaceNotice.d.ts +3 -2
  146. package/dist/inspector/canvas/LockedWorkspaceNotice.js +10 -6
  147. package/dist/inspector/canvas/PageCard.d.ts +9 -0
  148. package/dist/inspector/canvas/PageCard.js +50 -0
  149. package/dist/inspector/canvas/SketchToolOptions.d.ts +4 -0
  150. package/dist/inspector/canvas/SketchToolOptions.js +80 -0
  151. package/dist/inspector/canvas/StaleChangeIndicator.d.ts +1 -1
  152. package/dist/inspector/canvas/StaleChangeIndicator.js +1 -1
  153. package/dist/inspector/canvas/ToolOptionsDrawer.d.ts +16 -0
  154. package/dist/inspector/canvas/ToolOptionsDrawer.js +71 -0
  155. package/dist/inspector/canvas/activeCanvasDocument.d.ts +3 -4
  156. package/dist/inspector/canvas/activeCanvasDocument.js +0 -2
  157. package/dist/inspector/canvas/agentPresentation.d.ts +2 -13
  158. package/dist/inspector/canvas/agentPresentation.js +3 -14
  159. package/dist/inspector/canvas/assets/eraser.svg +28 -0
  160. package/dist/inspector/canvas/assets/pen.svg +25 -0
  161. package/dist/inspector/canvas/canvasFrame.d.ts +12 -0
  162. package/dist/inspector/canvas/canvasFrame.js +9 -0
  163. package/dist/inspector/canvas/canvasGestures.d.ts +0 -1
  164. package/dist/inspector/canvas/canvasGestures.js +0 -6
  165. package/dist/inspector/canvas/canvasResize.d.ts +1 -6
  166. package/dist/inspector/canvas/canvasResize.js +1 -6
  167. package/dist/inspector/canvas/canvasStore.d.ts +5 -7
  168. package/dist/inspector/canvas/canvasStore.js +42 -21
  169. package/dist/inspector/canvas/frameConnection.d.ts +42 -0
  170. package/dist/inspector/canvas/frameConnection.js +73 -0
  171. package/dist/inspector/canvas/frameContent.d.ts +0 -1
  172. package/dist/inspector/canvas/frameLifecycle.d.ts +12 -0
  173. package/dist/inspector/canvas/frameLifecycle.js +11 -0
  174. package/dist/inspector/canvas/frameProtocol.d.ts +20 -38
  175. package/dist/inspector/canvas/frameProtocol.js +37 -24
  176. package/dist/inspector/canvas/frameScrollbarStyles.d.ts +0 -1
  177. package/dist/inspector/canvas/frameScrollbarStyles.js +0 -1
  178. package/dist/inspector/canvas/layout.d.ts +10 -22
  179. package/dist/inspector/canvas/layout.js +0 -3
  180. package/dist/inspector/canvas/normalizeUrl.js +1 -8
  181. package/dist/inspector/canvas/pageSurface.d.ts +6 -0
  182. package/dist/inspector/canvas/pageSurface.js +29 -0
  183. package/dist/inspector/canvas/projection.d.ts +14 -25
  184. package/dist/inspector/canvas/projection.js +64 -87
  185. package/dist/inspector/canvas/rendererBootstrap.d.ts +8 -1
  186. package/dist/inspector/canvas/rendererBootstrap.js +10 -15
  187. package/dist/inspector/canvas/rendererCidIndex.d.ts +0 -5
  188. package/dist/inspector/canvas/rendererCidIndex.js +0 -5
  189. package/dist/inspector/canvas/rendererElementSelector.js +38 -28
  190. package/dist/inspector/canvas/rendererMessageRouter.d.ts +4 -6
  191. package/dist/inspector/canvas/rendererMessageRouter.js +12 -17
  192. package/dist/inspector/canvas/rendererSelectionProxy.d.ts +3 -1
  193. package/dist/inspector/canvas/rendererSelectionProxy.js +7 -40
  194. package/dist/inspector/canvas/rendererStylesheet.d.ts +0 -1
  195. package/dist/inspector/canvas/rendererStylesheet.js +23 -1
  196. package/dist/inspector/canvas/resizeHandleScale.d.ts +1 -10
  197. package/dist/inspector/canvas/resizeHandleScale.js +1 -10
  198. package/dist/inspector/canvas/sessionStore.d.ts +3 -9
  199. package/dist/inspector/canvas/sessionStore.js +33 -43
  200. package/dist/inspector/canvas/staleChangeDetector.d.ts +1 -1
  201. package/dist/inspector/canvas/staleChangeDetector.js +11 -26
  202. package/dist/inspector/canvas/toolbarScale.d.ts +1 -4
  203. package/dist/inspector/canvas/toolbarScale.js +1 -4
  204. package/dist/inspector/canvas/useCanvasLayoutAnimation.d.ts +0 -1
  205. package/dist/inspector/canvas/useCanvasLayoutAnimation.js +0 -1
  206. package/dist/inspector/canvas/viewStore.js +1 -1
  207. package/dist/inspector/canvas/wheelPan.d.ts +1 -1
  208. package/dist/inspector/canvas/wheelPan.js +1 -1
  209. package/dist/inspector/canvas/workspaceLease.d.ts +1 -5
  210. package/dist/inspector/canvas/workspaceLease.js +1 -7
  211. package/dist/inspector/changes/codecs.d.ts +1 -0
  212. package/dist/inspector/changes/codecs.js +21 -5
  213. package/dist/inspector/changes/draftPreview.d.ts +7 -0
  214. package/dist/inspector/changes/draftPreview.js +118 -0
  215. package/dist/inspector/changes/editModel.d.ts +11 -13
  216. package/dist/inspector/changes/editModel.js +9 -4
  217. package/dist/inspector/changes/managedStyleProjection.js +6 -15
  218. package/dist/inspector/changes/model.d.ts +0 -5
  219. package/dist/inspector/changes/model.js +1 -8
  220. package/dist/inspector/changes/previewDiagnostics.d.ts +2 -12
  221. package/dist/inspector/changes/previewDiagnostics.js +5 -21
  222. package/dist/inspector/changes/previewVerification.d.ts +25 -0
  223. package/dist/inspector/changes/previewVerification.js +34 -0
  224. package/dist/inspector/changes/structuralTypes.d.ts +2 -4
  225. package/dist/inspector/changes/types.d.ts +11 -8
  226. package/dist/inspector/clientManifest.d.ts +17 -6
  227. package/dist/inspector/clientManifest.js +16 -3
  228. package/dist/inspector/comments/CommentsOverlay.js +66 -23
  229. package/dist/inspector/comments/element.d.ts +1 -2
  230. package/dist/inspector/comments/element.js +1 -2
  231. package/dist/inspector/comments/store.d.ts +1 -1
  232. package/dist/inspector/comments/store.js +4 -3
  233. package/dist/inspector/comments/verification.d.ts +8 -2
  234. package/dist/inspector/comments/verification.js +19 -11
  235. package/dist/inspector/componentSemantics/ComponentPropsSection.d.ts +8 -0
  236. package/dist/inspector/componentSemantics/ComponentPropsSection.js +12 -8
  237. package/dist/inspector/componentSemantics/adapterRegistry.d.ts +2 -9
  238. package/dist/inspector/componentSemantics/adapterRegistry.js +2 -9
  239. package/dist/inspector/componentSemantics/changeAction.js +1 -1
  240. package/dist/inspector/componentSemantics/changeModel.js +2 -4
  241. package/dist/inspector/componentSemantics/react/callsites.d.ts +28 -0
  242. package/dist/inspector/componentSemantics/react/callsites.js +261 -0
  243. package/dist/inspector/componentSemantics/react/devtoolsHook.d.ts +23 -0
  244. package/dist/inspector/componentSemantics/react/devtoolsHook.js +71 -0
  245. package/dist/inspector/componentSemantics/react/fibers.d.ts +17 -0
  246. package/dist/inspector/componentSemantics/react/fibers.js +30 -0
  247. package/dist/inspector/componentSemantics/{reactRuntime.d.ts → react/runtime.d.ts} +3 -2
  248. package/dist/inspector/componentSemantics/{reactRuntime.js → react/runtime.js} +70 -53
  249. package/dist/inspector/componentSemantics/runtimeBridge.d.ts +2 -18
  250. package/dist/inspector/componentSemantics/runtimeBridge.js +5 -19
  251. package/dist/inspector/componentSemantics/textBinding.d.ts +2 -11
  252. package/dist/inspector/componentSemantics/textBinding.js +20 -87
  253. package/dist/inspector/componentSemantics/types.d.ts +8 -27
  254. package/dist/inspector/componentSemantics/types.js +0 -1
  255. package/dist/inspector/conformance/borderCases.d.ts +0 -5
  256. package/dist/inspector/conformance/borderCases.js +0 -5
  257. package/dist/inspector/conformance/colorCases.d.ts +0 -6
  258. package/dist/inspector/conformance/colorCases.js +0 -6
  259. package/dist/inspector/conformance/fixture.d.ts +1 -5
  260. package/dist/inspector/conformance/fixture.js +1 -5
  261. package/dist/inspector/conformance/spacingCases.d.ts +0 -4
  262. package/dist/inspector/conformance/spacingCases.js +0 -4
  263. package/dist/inspector/conformance/typographyCases.d.ts +0 -5
  264. package/dist/inspector/conformance/typographyCases.js +0 -5
  265. package/dist/inspector/drafts/draftStore.d.ts +95 -0
  266. package/dist/inspector/drafts/draftStore.js +461 -0
  267. package/dist/inspector/drafts/model.d.ts +14 -14
  268. package/dist/inspector/drafts/model.js +4 -2
  269. package/dist/inspector/drafts/store.d.ts +47 -16
  270. package/dist/inspector/drafts/store.js +137 -170
  271. package/dist/inspector/editScope.d.ts +0 -1
  272. package/dist/inspector/editScope.js +0 -1
  273. package/dist/inspector/index.d.ts +2 -4
  274. package/dist/inspector/index.js +2 -264
  275. package/dist/inspector/inline-text/inlineTextDiagnostics.d.ts +0 -2
  276. package/dist/inspector/inline-text/inlineTextDiagnostics.js +0 -2
  277. package/dist/inspector/inline-text/inlineTextEditor.d.ts +3 -9
  278. package/dist/inspector/inline-text/inlineTextEditor.js +27 -81
  279. package/dist/inspector/inline-text/inlineTextLifecycle.js +1 -6
  280. package/dist/inspector/inline-text/textEditChange.d.ts +1 -2
  281. package/dist/inspector/inspection/bridge.d.ts +3 -7
  282. package/dist/inspector/inspection/bridge.js +6 -13
  283. package/dist/inspector/inspection/browserCssInspection.d.ts +12 -11
  284. package/dist/inspector/inspection/browserCssInspection.js +32 -14
  285. package/dist/inspector/inspection/browserCssInspectionRegistry.d.ts +0 -7
  286. package/dist/inspector/inspection/browserCssInspectionRegistry.js +1 -16
  287. package/dist/inspector/inspection/inspectionSnapshot.d.ts +6 -0
  288. package/dist/inspector/inspection/inspectionSnapshot.js +10 -0
  289. package/dist/inspector/inspection/performanceDiagnostics.d.ts +18 -0
  290. package/dist/inspector/inspection/performanceDiagnostics.js +31 -0
  291. package/dist/inspector/inspection/selectionProperty.d.ts +1 -6
  292. package/dist/inspector/inspection/selectionProperty.js +1 -5
  293. package/dist/inspector/inspection/useBrowserCssInspection.d.ts +1 -5
  294. package/dist/inspector/inspection/useBrowserCssInspection.js +22 -59
  295. package/dist/inspector/iterations/capture.d.ts +2 -2
  296. package/dist/inspector/iterations/capture.js +4 -9
  297. package/dist/inspector/iterations/client.d.ts +2 -2
  298. package/dist/inspector/iterations/client.js +0 -1
  299. package/dist/inspector/iterations/coordinator.d.ts +4 -4
  300. package/dist/inspector/iterations/coordinator.js +5 -4
  301. package/dist/inspector/iterations/prompt.d.ts +0 -1
  302. package/dist/inspector/iterations/prompt.js +9 -9
  303. package/dist/inspector/overlay/DomNavigator.d.ts +3 -1
  304. package/dist/inspector/overlay/DomNavigator.js +39 -15
  305. package/dist/inspector/overlay/DropGuideOverlay.d.ts +0 -1
  306. package/dist/inspector/overlay/DropGuideOverlay.js +0 -1
  307. package/dist/inspector/overlay/MeasurementGuideOverlay.d.ts +1 -8
  308. package/dist/inspector/overlay/MeasurementGuideOverlay.js +1 -5
  309. package/dist/inspector/overlay/clickPolicy.d.ts +3 -14
  310. package/dist/inspector/overlay/clickPolicy.js +3 -14
  311. package/dist/inspector/overlay/dropGuide.d.ts +0 -3
  312. package/dist/inspector/overlay/dropGuide.js +0 -3
  313. package/dist/inspector/overlay/frameThrottle.d.ts +0 -1
  314. package/dist/inspector/overlay/frameThrottle.js +0 -1
  315. package/dist/inspector/overlay/interactionStyles.d.ts +1 -1
  316. package/dist/inspector/overlay/interactionStyles.js +19 -8
  317. package/dist/inspector/overlay/measurementGeometry.js +4 -12
  318. package/dist/inspector/overlay/selectedGeometry.d.ts +1 -6
  319. package/dist/inspector/overlay/selectedGeometry.js +1 -8
  320. package/dist/inspector/overlay/spacingGestures.d.ts +14 -21
  321. package/dist/inspector/overlay/spacingGestures.js +151 -31
  322. package/dist/inspector/overlay/structuralGestures.d.ts +2 -9
  323. package/dist/inspector/overlay/structuralGestures.js +1 -4
  324. package/dist/inspector/pageInspector.d.ts +33 -0
  325. package/dist/inspector/pageInspector.js +335 -0
  326. package/dist/inspector/projection/cssEscapes.d.ts +0 -1
  327. package/dist/inspector/projection/cssEscapes.js +2 -4
  328. package/dist/inspector/projection/draftProjection.d.ts +6 -10
  329. package/dist/inspector/projection/draftProjection.js +8 -7
  330. package/dist/inspector/projection/managedStylesheet.d.ts +1 -7
  331. package/dist/inspector/projection/managedStylesheet.js +28 -26
  332. package/dist/inspector/projection/renderedInstance.d.ts +5 -28
  333. package/dist/inspector/projection/renderedInstance.js +13 -33
  334. package/dist/inspector/projection/structuralProjection.d.ts +7 -48
  335. package/dist/inspector/projection/structuralProjection.js +31 -96
  336. package/dist/inspector/projection/textProjection.d.ts +7 -13
  337. package/dist/inspector/projection/textProjection.js +35 -80
  338. package/dist/inspector/prompt/PromptSettingsDialog.d.ts +0 -1
  339. package/dist/inspector/prompt/PromptSettingsDialog.js +0 -1
  340. package/dist/inspector/prompt/clipboardHandoff.d.ts +1 -0
  341. package/dist/inspector/prompt/clipboardHandoff.js +34 -16
  342. package/dist/inspector/prompt/generatePrompt.d.ts +2 -2
  343. package/dist/inspector/prompt/generatePrompt.js +247 -166
  344. package/dist/inspector/prompt/promptDocument.d.ts +3 -0
  345. package/dist/inspector/prompt/promptDocument.js +8 -0
  346. package/dist/inspector/prompt/promptSettings.d.ts +0 -3
  347. package/dist/inspector/prompt/promptSettings.js +7 -8
  348. package/dist/inspector/runtime/devFlag.d.ts +2 -25
  349. package/dist/inspector/runtime/devFlag.js +4 -31
  350. package/dist/inspector/runtime/documentStylesheetOrder.d.ts +0 -2
  351. package/dist/inspector/runtime/editorShell.d.ts +0 -1
  352. package/dist/inspector/runtime/editorShell.js +0 -1
  353. package/dist/inspector/runtime/inspectorStorage.d.ts +11 -0
  354. package/dist/inspector/runtime/inspectorStorage.js +37 -0
  355. package/dist/inspector/runtime/ownedStylesheets.d.ts +14 -0
  356. package/dist/inspector/runtime/ownedStylesheets.js +66 -0
  357. package/dist/inspector/runtime/runtimeConfig.d.ts +14 -84
  358. package/dist/inspector/runtime/runtimeConfig.js +18 -50
  359. package/dist/inspector/runtime/runtimeIdentityClaims.d.ts +19 -0
  360. package/dist/inspector/runtime/runtimeIdentityClaims.js +178 -0
  361. package/dist/inspector/runtime/staticHtmlRuntimeIdentity.d.ts +6 -23
  362. package/dist/inspector/runtime/staticHtmlRuntimeIdentity.js +103 -52
  363. package/dist/inspector/runtime/useRuntimeConfig.d.ts +1 -8
  364. package/dist/inspector/runtime/useRuntimeConfig.js +1 -8
  365. package/dist/inspector/selection/editScope.d.ts +2 -7
  366. package/dist/inspector/selection/editScope.js +15 -14
  367. package/dist/inspector/selection/editTarget.d.ts +1 -5
  368. package/dist/inspector/selection/hierarchy.d.ts +11 -11
  369. package/dist/inspector/selection/hierarchy.js +42 -24
  370. package/dist/inspector/selection/selectionStore.d.ts +0 -3
  371. package/dist/inspector/selection/selectionStore.js +5 -16
  372. package/dist/inspector/selection/sourceSite.d.ts +1 -5
  373. package/dist/inspector/selection/sourceSite.js +2 -8
  374. package/dist/inspector/selection/styleSelection.d.ts +1 -5
  375. package/dist/inspector/selection/styleSelection.js +1 -5
  376. package/dist/inspector/session/lifecycle.d.ts +1 -9
  377. package/dist/inspector/session/lifecycle.js +0 -1
  378. package/dist/inspector/session/sessionContext.d.ts +0 -4
  379. package/dist/inspector/session/sessionContext.js +0 -4
  380. package/dist/inspector/session/sessionFactory.d.ts +0 -9
  381. package/dist/inspector/session/sessionFactory.js +0 -6
  382. package/dist/inspector/settings/SettingsDialog.d.ts +0 -1
  383. package/dist/inspector/settings/SettingsDialog.js +5 -3
  384. package/dist/inspector/shell/AgentStatusButton.d.ts +3 -2
  385. package/dist/inspector/shell/AgentStatusButton.js +7 -7
  386. package/dist/inspector/shell/AppShell.js +6 -2
  387. package/dist/inspector/shell/ChangesLog.js +29 -12
  388. package/dist/inspector/shell/CopyPromptButton.d.ts +2 -1
  389. package/dist/inspector/shell/CopyPromptButton.js +62 -55
  390. package/dist/inspector/shell/EmptyState.js +3 -3
  391. package/dist/inspector/shell/InspectorEditors.d.ts +16 -0
  392. package/dist/inspector/shell/InspectorEditors.js +14 -0
  393. package/dist/inspector/shell/InspectorPanel.d.ts +12 -0
  394. package/dist/inspector/shell/InspectorPanel.js +8 -0
  395. package/dist/inspector/shell/InspectorSelection.d.ts +24 -0
  396. package/dist/inspector/shell/InspectorSelection.js +20 -0
  397. package/dist/inspector/shell/InspectorShell.d.ts +0 -3
  398. package/dist/inspector/shell/InspectorShell.js +44 -58
  399. package/dist/inspector/shell/NudgeLogoIcon.d.ts +5 -0
  400. package/dist/inspector/shell/NudgeLogoIcon.js +5 -0
  401. package/dist/inspector/shell/PeekOriginalButton.d.ts +0 -5
  402. package/dist/inspector/shell/PeekOriginalButton.js +3 -8
  403. package/dist/inspector/shell/PeekOriginalIcon.d.ts +0 -5
  404. package/dist/inspector/shell/PeekOriginalIcon.js +0 -5
  405. package/dist/inspector/shell/PromptActionButton.d.ts +21 -0
  406. package/dist/inspector/shell/PromptActionButton.js +14 -0
  407. package/dist/inspector/shell/elementName.d.ts +5 -0
  408. package/dist/inspector/shell/elementName.js +29 -0
  409. package/dist/inspector/shell/interactionStatePreview.d.ts +6 -0
  410. package/dist/inspector/shell/interactionStatePreview.js +107 -0
  411. package/dist/inspector/shell/originalPreview.d.ts +1 -5
  412. package/dist/inspector/shell/originalPreview.js +5 -37
  413. package/dist/inspector/shell/stateValue.d.ts +1 -2
  414. package/dist/inspector/shell/stateValue.js +4 -8
  415. package/dist/inspector/shell/styleState.d.ts +1 -2
  416. package/dist/inspector/shell/styleState.js +1 -2
  417. package/dist/inspector/sketch/SketchEditor.js +5 -5
  418. package/dist/inspector/sketch/SketchFrameOverlay.d.ts +2 -1
  419. package/dist/inspector/sketch/SketchFrameOverlay.js +13 -16
  420. package/dist/inspector/sketch/SketchOverlay.d.ts +3 -5
  421. package/dist/inspector/sketch/SketchOverlay.js +138 -263
  422. package/dist/inspector/sketch/SketchPromptPanel.d.ts +1 -2
  423. package/dist/inspector/sketch/SketchPromptPanel.js +8 -2
  424. package/dist/inspector/sketch/SketchThumbnail.d.ts +5 -0
  425. package/dist/inspector/sketch/SketchThumbnail.js +18 -0
  426. package/dist/inspector/sketch/SketchWorkspace.d.ts +1 -2
  427. package/dist/inspector/sketch/SketchWorkspace.js +70 -37
  428. package/dist/inspector/sketch/capture.d.ts +12 -3
  429. package/dist/inspector/sketch/capture.js +31 -14
  430. package/dist/inspector/sketch/copySketch.d.ts +4 -0
  431. package/dist/inspector/sketch/copySketch.js +43 -0
  432. package/dist/inspector/sketch/drawingTools.d.ts +15 -0
  433. package/dist/inspector/sketch/drawingTools.js +46 -0
  434. package/dist/inspector/sketch/frameHeading.d.ts +3 -0
  435. package/dist/inspector/sketch/frameHeading.js +23 -0
  436. package/dist/inspector/sketch/freehand.d.ts +0 -1
  437. package/dist/inspector/sketch/freehand.js +3 -4
  438. package/dist/inspector/sketch/geometry.d.ts +2 -1
  439. package/dist/inspector/sketch/geometry.js +15 -1
  440. package/dist/inspector/sketch/handoff.js +0 -1
  441. package/dist/inspector/sketch/history.d.ts +26 -0
  442. package/dist/inspector/sketch/history.js +55 -0
  443. package/dist/inspector/sketch/interaction.d.ts +3 -5
  444. package/dist/inspector/sketch/interaction.js +8 -11
  445. package/dist/inspector/sketch/model.d.ts +33 -6
  446. package/dist/inspector/sketch/model.js +101 -63
  447. package/dist/inspector/sketch/persistence.d.ts +14 -1
  448. package/dist/inspector/sketch/persistence.js +64 -8
  449. package/dist/inspector/sketch/raster.d.ts +3 -2
  450. package/dist/inspector/sketch/raster.js +40 -20
  451. package/dist/inspector/sketch/store.d.ts +1 -1
  452. package/dist/inspector/sketch/store.js +3 -4
  453. package/dist/inspector/sketch/videoFrames.d.ts +6 -0
  454. package/dist/inspector/sketch/videoFrames.js +80 -0
  455. package/dist/inspector/spacing/projection.d.ts +0 -8
  456. package/dist/inspector/spacing/projection.js +38 -20
  457. package/dist/inspector/styleEditors/BackgroundEditor.js +3 -2
  458. package/dist/inspector/styleEditors/BorderEditor.js +30 -135
  459. package/dist/inspector/styleEditors/BorderRadiusEditor.js +8 -3
  460. package/dist/inspector/styleEditors/ChildPlacement.d.ts +12 -0
  461. package/dist/inspector/styleEditors/ChildPlacement.js +9 -0
  462. package/dist/inspector/styleEditors/FlexControls.d.ts +35 -0
  463. package/dist/inspector/styleEditors/FlexControls.js +158 -0
  464. package/dist/inspector/styleEditors/GapField.d.ts +5 -2
  465. package/dist/inspector/styleEditors/GapField.js +3 -4
  466. package/dist/inspector/styleEditors/GridChildSection.d.ts +0 -5
  467. package/dist/inspector/styleEditors/GridChildSection.js +0 -5
  468. package/dist/inspector/styleEditors/GridPicker.d.ts +1 -1
  469. package/dist/inspector/styleEditors/GridPicker.js +2 -4
  470. package/dist/inspector/styleEditors/GridSection.d.ts +10 -8
  471. package/dist/inspector/styleEditors/GridSection.js +22 -9
  472. package/dist/inspector/styleEditors/GridValueField.d.ts +1 -5
  473. package/dist/inspector/styleEditors/GridValueField.js +2 -8
  474. package/dist/inspector/styleEditors/ImageBackgroundEditor.d.ts +0 -1
  475. package/dist/inspector/styleEditors/ImageBackgroundEditor.js +1 -2
  476. package/dist/inspector/styleEditors/LayoutBlockedIndicator.d.ts +0 -1
  477. package/dist/inspector/styleEditors/LayoutBlockedIndicator.js +0 -1
  478. package/dist/inspector/styleEditors/LayoutComboField.js +0 -5
  479. package/dist/inspector/styleEditors/LayoutModeRow.d.ts +14 -0
  480. package/dist/inspector/styleEditors/LayoutModeRow.js +60 -0
  481. package/dist/inspector/styleEditors/LayoutSection.d.ts +2 -2
  482. package/dist/inspector/styleEditors/LayoutSection.js +30 -356
  483. package/dist/inspector/styleEditors/OpacityEditor.js +7 -5
  484. package/dist/inspector/styleEditors/PositionControls.d.ts +18 -0
  485. package/dist/inspector/styleEditors/PositionControls.js +16 -0
  486. package/dist/inspector/styleEditors/SizeSection.d.ts +18 -0
  487. package/dist/inspector/styleEditors/SizeSection.js +71 -0
  488. package/dist/inspector/styleEditors/{SpacingBox.d.ts → SpacingField.d.ts} +3 -10
  489. package/dist/inspector/styleEditors/{SpacingBox.js → SpacingField.js} +15 -29
  490. package/dist/inspector/styleEditors/Typography.js +2 -4
  491. package/dist/inspector/styleEditors/borderModel.d.ts +36 -0
  492. package/dist/inspector/styleEditors/borderModel.js +105 -0
  493. package/dist/inspector/styleEditors/completeCssValue.d.ts +1 -5
  494. package/dist/inspector/styleEditors/completeCssValue.js +3 -13
  495. package/dist/inspector/styleEditors/fieldValue.d.ts +20 -0
  496. package/dist/inspector/styleEditors/fieldValue.js +26 -0
  497. package/dist/inspector/styleEditors/gradientValue.d.ts +1 -1
  498. package/dist/inspector/styleEditors/gradientValue.js +3 -2
  499. package/dist/inspector/styleEditors/gridChildModel.d.ts +7 -47
  500. package/dist/inspector/styleEditors/gridChildModel.js +6 -37
  501. package/dist/inspector/styleEditors/hiddenSizeOverrides.d.ts +5 -0
  502. package/dist/inspector/styleEditors/hiddenSizeOverrides.js +42 -0
  503. package/dist/inspector/styleEditors/inlineAuthored.d.ts +1 -8
  504. package/dist/inspector/styleEditors/inlineAuthored.js +3 -17
  505. package/dist/inspector/styleEditors/layoutMode.d.ts +15 -0
  506. package/dist/inspector/styleEditors/layoutMode.js +33 -0
  507. package/dist/inspector/styleEditors/layoutPreviewState.d.ts +0 -1
  508. package/dist/inspector/styleEditors/layoutPreviewState.js +0 -1
  509. package/dist/inspector/styleEditors/layoutValue.d.ts +2 -8
  510. package/dist/inspector/styleEditors/layoutValue.js +6 -15
  511. package/dist/inspector/styleEditors/nudgeValue.d.ts +1 -13
  512. package/dist/inspector/styleEditors/nudgeValue.js +1 -13
  513. package/dist/inspector/styleEditors/rowLookup.d.ts +1 -5
  514. package/dist/inspector/styleEditors/rowLookup.js +1 -5
  515. package/dist/inspector/styleEditors/stringRecord.d.ts +1 -2
  516. package/dist/inspector/styleEditors/stylePresence.d.ts +0 -2
  517. package/dist/inspector/styleEditors/stylePresence.js +1 -4
  518. package/dist/inspector/styleEditors/textRelevance.d.ts +1 -1
  519. package/dist/inspector/styleEditors/textRelevance.js +1 -1
  520. package/dist/inspector/styleEditors/useFieldVisibility.js +1 -2
  521. package/dist/inspector/styleEditors/useLayoutContext.d.ts +13 -0
  522. package/dist/inspector/styleEditors/useLayoutContext.js +53 -0
  523. package/dist/inspector/styleEditors/valuePolicy.d.ts +1 -5
  524. package/dist/inspector/styleEditors/valuePolicy.js +0 -1
  525. package/dist/inspector/testing.d.ts +1 -4
  526. package/dist/inspector/testing.js +1 -4
  527. package/dist/inspector/tokens/TokenChip.d.ts +1 -4
  528. package/dist/inspector/tokens/TokenChip.js +1 -4
  529. package/dist/inspector/tokens/TokenField.d.ts +4 -3
  530. package/dist/inspector/tokens/TokenField.js +53 -32
  531. package/dist/inspector/tokens/TokensPanel.js +2 -1
  532. package/dist/inspector/tokens/catalog.d.ts +2 -10
  533. package/dist/inspector/tokens/catalog.js +5 -12
  534. package/dist/inspector/tokens/dragPointerLock.d.ts +0 -1
  535. package/dist/inspector/tokens/dragPointerLock.js +2 -3
  536. package/dist/inspector/tokens/editActions.d.ts +4 -4
  537. package/dist/inspector/tokens/editActions.js +11 -7
  538. package/dist/inspector/tokens/resolution/cascade.d.ts +1 -5
  539. package/dist/inspector/tokens/resolution/cascade.js +1 -5
  540. package/dist/inspector/tokens/resolution/containerQueryEvaluator.d.ts +11 -0
  541. package/dist/inspector/tokens/resolution/containerQueryEvaluator.js +82 -0
  542. package/dist/inspector/tokens/resolution/cssomCollector.d.ts +4 -19
  543. package/dist/inspector/tokens/resolution/cssomCollector.js +186 -122
  544. package/dist/inspector/tokens/resolution/nestedSelectors.d.ts +2 -0
  545. package/dist/inspector/tokens/resolution/nestedSelectors.js +63 -0
  546. package/dist/inspector/tokens/resolution/ruleMatching.d.ts +4 -14
  547. package/dist/inspector/tokens/resolution/ruleMatching.js +136 -63
  548. package/dist/inspector/tokens/resolution/selectorSemantics.d.ts +3 -14
  549. package/dist/inspector/tokens/resolution/selectorSemantics.js +12 -27
  550. package/dist/inspector/tokens/resolution.d.ts +11 -27
  551. package/dist/inspector/tokens/resolution.js +105 -181
  552. package/dist/inspector/tokens/tokenAvailability.d.ts +2 -14
  553. package/dist/inspector/tokens/tokenAvailability.js +6 -38
  554. package/dist/inspector/tokens/tokenEdits.d.ts +1 -1
  555. package/dist/inspector/tokens/tokenEdits.js +1 -1
  556. package/dist/inspector/tokens/valueSemanticsAdapter.d.ts +0 -1
  557. package/dist/inspector/tokens/valueSemanticsAdapter.js +18 -2
  558. package/dist/inspector/ui/AtRuleContext.d.ts +5 -5
  559. package/dist/inspector/ui/AtRuleContext.js +8 -6
  560. package/dist/inspector/ui/ControlSurface.d.ts +0 -4
  561. package/dist/inspector/ui/Disclosure.d.ts +0 -5
  562. package/dist/inspector/ui/Disclosure.js +0 -4
  563. package/dist/inspector/ui/InlineStyleWarning.d.ts +0 -1
  564. package/dist/inspector/ui/InlineStyleWarning.js +2 -2
  565. package/dist/inspector/ui/InspectorPopover.d.ts +1 -5
  566. package/dist/inspector/ui/InspectorPopover.js +1 -5
  567. package/dist/inspector/ui/InspectorStyle.d.ts +8 -0
  568. package/dist/inspector/ui/InspectorStyle.js +26 -0
  569. package/dist/inspector/ui/PopoverListbox.d.ts +2 -1
  570. package/dist/inspector/ui/PopoverListbox.js +3 -3
  571. package/dist/inspector/ui/SegmentedControl.d.ts +4 -4
  572. package/dist/inspector/ui/SegmentedControl.js +6 -4
  573. package/dist/inspector/ui/SideValuesField.d.ts +1 -6
  574. package/dist/inspector/ui/SideValuesField.js +2 -8
  575. package/dist/inspector/ui/Toast.d.ts +10 -0
  576. package/dist/inspector/ui/Toast.js +26 -0
  577. package/dist/inspector/ui/assets/canvasIllustration.d.ts +2 -0
  578. package/dist/inspector/ui/assets/canvasIllustration.js +21 -0
  579. package/dist/inspector/ui/assets/gridIllustration.d.ts +2 -0
  580. package/dist/inspector/ui/assets/{grid.svg → gridIllustration.js} +3 -2
  581. package/dist/inspector/ui/atRuleSegments.d.ts +13 -0
  582. package/dist/inspector/ui/atRuleSegments.js +34 -0
  583. package/dist/inspector/ui/classNames.d.ts +0 -1
  584. package/dist/inspector/ui/classNames.js +0 -1
  585. package/dist/inspector/ui/customCursors.d.ts +11 -0
  586. package/dist/inspector/ui/customCursors.js +29 -7
  587. package/dist/inspector/ui/styles.js +25 -25
  588. package/dist/inspector/workspace/commands.js +1 -2
  589. package/dist/inspector/workspace/controller.js +20 -2
  590. package/dist/inspector/workspace/handoff.d.ts +1 -5
  591. package/dist/inspector/workspace/handoff.js +4 -7
  592. package/dist/inspector/workspace/sentItems.d.ts +3 -6
  593. package/dist/inspector/workspace/sentItems.js +6 -24
  594. package/dist/inspector/workspace/timeline.d.ts +28 -11
  595. package/dist/inspector/workspace/timeline.js +117 -96
  596. package/dist/internal/agent-protocol.d.ts +53 -38
  597. package/dist/internal/agent-protocol.js +151 -42
  598. package/dist/nudge-ui.mjs +155 -92
  599. package/dist/project/artifacts.js +24 -21
  600. package/dist/project/files.d.ts +0 -1
  601. package/dist/project/files.js +2 -9
  602. package/dist/project/identity.d.ts +1 -5
  603. package/dist/project/identity.js +1 -5
  604. package/dist/project/mcpPackage.d.ts +3 -0
  605. package/dist/project/mcpPackage.js +55 -0
  606. package/dist/project/pathPolicy.d.ts +1 -6
  607. package/dist/project/pathPolicy.js +1 -6
  608. package/dist/project/tokens.d.ts +2 -12
  609. package/dist/project/tokens.js +4 -15
  610. package/dist/transport/editor.d.ts +1 -12
  611. package/dist/transport/editor.js +2 -13
  612. package/dist/transport/index.d.ts +0 -5
  613. package/dist/transport/index.js +0 -5
  614. package/dist/transport/routes.d.ts +0 -5
  615. package/dist/transport/routes.js +0 -5
  616. package/package.json +16 -5
  617. package/dist/inspector/canvas/measurementProjection.d.ts +0 -8
  618. package/dist/inspector/canvas/measurementProjection.js +0 -16
  619. package/dist/inspector/changes/changesLog.d.ts +0 -49
  620. package/dist/inspector/changes/changesLog.js +0 -255
  621. package/dist/inspector/changes/draftChanges.d.ts +0 -58
  622. package/dist/inspector/changes/draftChanges.js +0 -304
  623. package/dist/inspector/conformance/projection.d.ts +0 -2
  624. package/dist/inspector/conformance/projection.js +0 -3
  625. package/dist/inspector/inline-text/textChangeBoundary.d.ts +0 -6
  626. package/dist/inspector/inline-text/textChangeBoundary.js +0 -1
  627. package/dist/inspector/overlay/InspectorOverlay.d.ts +0 -5
  628. package/dist/inspector/overlay/InspectorOverlay.js +0 -332
  629. package/dist/inspector/overlay/elementSelector.d.ts +0 -1
  630. package/dist/inspector/overlay/elementSelector.js +0 -111
  631. package/dist/inspector/sketch/SketchChanges.d.ts +0 -2
  632. package/dist/inspector/sketch/SketchChanges.js +0 -72
  633. package/dist/inspector/sketch/SketchEntryButton.d.ts +0 -4
  634. package/dist/inspector/sketch/SketchEntryButton.js +0 -11
  635. package/dist/inspector/sketch/SketchLayersPanel.d.ts +0 -2
  636. package/dist/inspector/sketch/SketchLayersPanel.js +0 -71
  637. package/dist/inspector/styleEditors/InsetSection.d.ts +0 -15
  638. package/dist/inspector/styleEditors/InsetSection.js +0 -15
  639. package/dist/inspector/styleEditors/PositionInsets.d.ts +0 -15
  640. package/dist/inspector/styleEditors/PositionInsets.js +0 -12
  641. package/dist/inspector/tokens/TokenDropdown.d.ts +0 -13
  642. package/dist/inspector/tokens/TokenDropdown.js +0 -59
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 "pnp" in process.versions && 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
 
@@ -6233,6 +6262,42 @@ function isReservedNudgeUiRoute(pathname) {
6233
6262
  return pathname === NUDGE_UI_ROUTE_PREFIX.slice(0, -1) || pathname.startsWith(NUDGE_UI_ROUTE_PREFIX);
6234
6263
  }
6235
6264
 
6265
+ // src/inspector/runtime/runtimeConfig.ts
6266
+ function cloneAndFreeze(value, seen = /* @__PURE__ */ new WeakMap()) {
6267
+ if (value === null || typeof value !== "object") return value;
6268
+ const source = value;
6269
+ const existing = seen.get(source);
6270
+ if (existing) return existing;
6271
+ if (Object.isFrozen(value)) {
6272
+ seen.set(source, value);
6273
+ return value;
6274
+ }
6275
+ if (Array.isArray(value)) {
6276
+ const copy2 = [];
6277
+ seen.set(source, copy2);
6278
+ for (const item of value) copy2.push(cloneAndFreeze(item, seen));
6279
+ return Object.freeze(copy2);
6280
+ }
6281
+ const copy = {};
6282
+ seen.set(source, copy);
6283
+ for (const [key, child] of Object.entries(value)) {
6284
+ copy[key] = cloneAndFreeze(child, seen);
6285
+ }
6286
+ return Object.freeze(copy);
6287
+ }
6288
+ var DEFAULT_RUNTIME_CONFIG = cloneAndFreeze({
6289
+ projectId: "/stub/project",
6290
+ host: "vite-react",
6291
+ framework: "React",
6292
+ stylingSystem: "CSS custom properties",
6293
+ capabilities: { canvas: true, componentSemantics: true, domNavigation: false },
6294
+ tokenCatalog: [],
6295
+ tokens: [],
6296
+ tokenDiagnostics: [],
6297
+ tokenGeneration: "",
6298
+ componentContracts: []
6299
+ });
6300
+
6236
6301
  // src/transport/editor.ts
6237
6302
  function isNudgeUiEditorDocumentRequest(requestHref, method, headers) {
6238
6303
  const normalizedMethod = (method ?? "GET").toUpperCase();
@@ -6256,7 +6321,7 @@ function createNudgeUiEditorDocument() {
6256
6321
  <head>
6257
6322
  <meta charset="utf-8">
6258
6323
  <meta name="viewport" content="width=device-width, initial-scale=1">
6259
- <title>Nudge UI</title>
6324
+ <title></title>
6260
6325
  <style>html,body,#${NUDGE_UI_MOUNT_ID}{width:100%;height:100%;margin:0}body{overflow:hidden}</style>
6261
6326
  </head>
6262
6327
  <body>
@@ -6269,6 +6334,20 @@ function createNudgeUiEditorDocument() {
6269
6334
  // src/transport/index.ts
6270
6335
  var NUDGE_UI_MANIFEST_VERSION = 1;
6271
6336
 
6337
+ // src/inspector/clientManifest.ts
6338
+ var NUDGE_UI_CLIENT_MANIFEST_VERSION = NUDGE_UI_MANIFEST_VERSION;
6339
+ function createNudgeUiClientManifest(input) {
6340
+ return {
6341
+ version: NUDGE_UI_CLIENT_MANIFEST_VERSION,
6342
+ revision: input.revision ?? 0,
6343
+ runtime: input.runtime,
6344
+ ...input.agentBridge ? { agentBridge: input.agentBridge } : {},
6345
+ ...input.document ? { document: input.document } : {},
6346
+ ...input.reload ? { reload: input.reload } : {},
6347
+ ...input.inspectAutomatedBrowsers ? { inspectAutomatedBrowsers: true } : {}
6348
+ };
6349
+ }
6350
+
6272
6351
  // src/hosts/environment.ts
6273
6352
  function readNudgeUiEnvironmentSwitch(env = process.env) {
6274
6353
  const value = env.NUDGE_UI?.trim().toLowerCase();
@@ -6282,17 +6361,14 @@ function automationManifestFields(env = process.env) {
6282
6361
 
6283
6362
  // src/hosts/static/manifest.ts
6284
6363
  function createStandaloneRuntimeManifest(projectId, tokenSnapshot = emptyTokenSnapshot(), revision2 = 0) {
6285
- return {
6286
- version: NUDGE_UI_MANIFEST_VERSION,
6364
+ return createNudgeUiClientManifest({
6287
6365
  revision: revision2,
6288
6366
  runtime: {
6289
6367
  projectId,
6290
6368
  host: "static-html",
6291
6369
  framework: "HTML",
6292
6370
  stylingSystem: "CSS custom properties",
6293
- // Canvas shares the Vite host's controller/renderer runtime (ADR-0012):
6294
- // every served document carries the bootstrap, so card iframes boot as
6295
- // renderers without host-specific code.
6371
+ // Canvas shares the Vite host's controller/renderer runtime (ADR-0012).
6296
6372
  capabilities: { canvas: true, componentSemantics: false, domNavigation: true },
6297
6373
  tokenCatalog: tokenSnapshot.tokenCatalog,
6298
6374
  tokens: tokenSnapshot.tokens,
@@ -6310,7 +6386,7 @@ function createStandaloneRuntimeManifest(projectId, tokenSnapshot = emptyTokenSn
6310
6386
  events: ["ready", "reload"]
6311
6387
  },
6312
6388
  ...automationManifestFields()
6313
- };
6389
+ });
6314
6390
  }
6315
6391
  function emptyTokenSnapshot() {
6316
6392
  return {
@@ -14171,7 +14247,7 @@ var VOID_ELEMENTS = /* @__PURE__ */ new Set([
14171
14247
  ]);
14172
14248
 
14173
14249
  // ../../node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/index.js
14174
- function parse(html, options) {
14250
+ function parse2(html, options) {
14175
14251
  return Parser.parse(html, options);
14176
14252
  }
14177
14253
 
@@ -14181,7 +14257,7 @@ var MOUNT_MARKER = "data-nudge-ui-mount";
14181
14257
  function injectStandaloneBootstrap(html, options = {}) {
14182
14258
  const clientPath = options.clientPath ?? NUDGE_UI_CLIENT_PATH;
14183
14259
  const manifestPath = options.manifestPath ?? NUDGE_UI_MANIFEST_PATH;
14184
- const document2 = parse(html, { sourceCodeLocationInfo: true });
14260
+ const document2 = parse2(html, { sourceCodeLocationInfo: true });
14185
14261
  const sourceFacts = inspectSource(document2, clientPath);
14186
14262
  const nodes = [];
14187
14263
  if (!sourceFacts.hasMount) {
@@ -14291,6 +14367,9 @@ async function directory(root2, id) {
14291
14367
  }
14292
14368
  return join2(actual, id);
14293
14369
  }
14370
+ function isRecord2(value) {
14371
+ return typeof value === "object" && value !== null && !Array.isArray(value);
14372
+ }
14294
14373
  async function body(request) {
14295
14374
  const chunks = [];
14296
14375
  let size = 0;
@@ -14301,7 +14380,9 @@ async function body(request) {
14301
14380
  chunks.push(data);
14302
14381
  }
14303
14382
  const text = Buffer.concat(chunks).toString("utf8");
14304
- return text.length === 0 ? {} : JSON.parse(text);
14383
+ if (text.length === 0) return {};
14384
+ const parsed = JSON.parse(text);
14385
+ return isRecord2(parsed) ? parsed : null;
14305
14386
  }
14306
14387
  function respond(response, status, content, type = "text/plain; charset=utf-8") {
14307
14388
  response.writeHead(status, {
@@ -14338,7 +14419,7 @@ async function handleHtmlArtifactRequest(request, response, root2, transformHtml
14338
14419
  try {
14339
14420
  if (request.method === "POST" && parts.length === 0) {
14340
14421
  const input = await body(request);
14341
- if (!validArtifact(input)) {
14422
+ if (!input || !validArtifact(input)) {
14342
14423
  respond(response, 400, "Invalid artifact");
14343
14424
  return true;
14344
14425
  }
@@ -14394,27 +14475,26 @@ async function handleHtmlArtifactRequest(request, response, root2, transformHtml
14394
14475
  }
14395
14476
  if (request.method === "PUT" && parts[1] === "document" || request.method === "POST" && parts[1] === "commit") {
14396
14477
  const input = await body(request);
14397
- if (!input || typeof input !== "object") {
14478
+ if (!input) {
14398
14479
  respond(response, 400, "Invalid document");
14399
14480
  return true;
14400
14481
  }
14401
- const item = input;
14402
- if (!isHtmlArtifactRevision(item.expected)) {
14482
+ if (!isHtmlArtifactRevision(input.expected)) {
14403
14483
  respond(response, 428, "An expected iteration revision is required");
14404
14484
  return true;
14405
14485
  }
14406
- if (item.html !== void 0 && typeof item.html !== "string" || request.method === "PUT" && typeof item.html !== "string") {
14486
+ if (input.html !== void 0 && typeof input.html !== "string" || request.method === "PUT" && typeof input.html !== "string") {
14407
14487
  respond(response, 400, "Invalid document");
14408
14488
  return true;
14409
14489
  }
14410
- const expected = item.expected;
14490
+ const expected = input.expected;
14411
14491
  if (!sameRevision(await readRevision(target), expected)) {
14412
14492
  respond(response, 409, HTML_ITERATION_CONFLICT);
14413
14493
  return true;
14414
14494
  }
14415
- const html = typeof item.html === "string" ? item.html : await readFile(join2(target, "document.html"), "utf8");
14495
+ const html = typeof input.html === "string" ? input.html : await readFile(join2(target, "document.html"), "utf8");
14416
14496
  const writes = request.method === "POST" ? ["preview.html"] : [];
14417
- if (typeof item.html === "string") writes.push("document.html");
14497
+ if (typeof input.html === "string") writes.push("document.html");
14418
14498
  const previewBefore = await readFile(join2(target, "preview.html"));
14419
14499
  const temporaryFiles = [];
14420
14500
  try {
@@ -14424,8 +14504,8 @@ async function handleHtmlArtifactRequest(request, response, root2, transformHtml
14424
14504
  await writeFile(temporary, html);
14425
14505
  }
14426
14506
  const latest = {
14427
- document: revision(readFileSync(join2(target, "document.html"))),
14428
- preview: revision(readFileSync(join2(target, "preview.html")))
14507
+ document: revision(readFileSync2(join2(target, "document.html"))),
14508
+ preview: revision(readFileSync2(join2(target, "preview.html")))
14429
14509
  };
14430
14510
  if (!sameRevision(latest, expected)) {
14431
14511
  respond(response, 409, HTML_ITERATION_CONFLICT);
@@ -14471,10 +14551,9 @@ async function handleHtmlArtifactRequest(request, response, root2, transformHtml
14471
14551
  return true;
14472
14552
  }
14473
14553
  function validArtifact(value) {
14474
- if (!value || typeof value !== "object") return false;
14475
- const item = value;
14476
- const viewport = item.viewport;
14477
- return typeof item.id === "string" && ID.test(item.id) && typeof item.sourceUrl === "string" && item.sourceUrl.length < 4096 && typeof item.title === "string" && item.title.length < 512 && typeof item.html === "string" && item.html.length > 0 && !!viewport && typeof viewport.width === "number" && typeof viewport.height === "number";
14554
+ if (!isRecord2(value)) return false;
14555
+ const viewport = value.viewport;
14556
+ return typeof value.id === "string" && ID.test(value.id) && typeof value.sourceUrl === "string" && value.sourceUrl.length < 4096 && typeof value.title === "string" && value.title.length < 512 && typeof value.html === "string" && value.html.length > 0 && isRecord2(viewport) && typeof viewport.width === "number" && typeof viewport.height === "number";
14478
14557
  }
14479
14558
 
14480
14559
  // src/hosts/static/server.ts
@@ -14484,12 +14563,12 @@ import {
14484
14563
  } from "node:http";
14485
14564
  import {
14486
14565
  constants,
14487
- existsSync as existsSync3,
14566
+ existsSync as existsSync2,
14488
14567
  realpathSync as realpathSync2,
14489
14568
  statSync as statSync2
14490
14569
  } from "node:fs";
14491
14570
  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";
14571
+ import { dirname as dirname3, extname as extname2, isAbsolute as isAbsolute4, join as join6, relative as relative4, resolve as resolve3 } from "node:path";
14493
14572
  import { createRequire as createRequire3 } from "node:module";
14494
14573
 
14495
14574
  // src/html/dom.ts
@@ -14594,7 +14673,7 @@ function runIdentityPass(source, pass) {
14594
14673
  });
14595
14674
  };
14596
14675
  const parseErrors = [];
14597
- const document2 = parse(source, {
14676
+ const document2 = parse2(source, {
14598
14677
  sourceCodeLocationInfo: true,
14599
14678
  onParseError: (error) => parseErrors.push(error)
14600
14679
  });
@@ -14679,9 +14758,8 @@ function instrumentSourceHtml(source, file) {
14679
14758
  }
14680
14759
 
14681
14760
  // src/hosts/projectBridge.ts
14682
- import { existsSync as existsSync2 } from "node:fs";
14683
14761
  import { createRequire as createRequire2 } from "node:module";
14684
- import { dirname as dirname2, join as join3, parse as parse2 } from "node:path";
14762
+ import { join as join3 } from "node:path";
14685
14763
  import { pathToFileURL } from "node:url";
14686
14764
  var runningBridges = /* @__PURE__ */ new Map();
14687
14765
  async function startOptionalProjectBridge(input) {
@@ -14698,7 +14776,7 @@ async function startOptionalProjectBridge(input) {
14698
14776
  async function launchOptionalProjectBridge(input, key) {
14699
14777
  let modulePath;
14700
14778
  try {
14701
- if (!isPnpRuntime() && !hasProjectInstalledMcp(input.appRoot)) {
14779
+ if (findProjectMcpRoot(input.appRoot) === null) {
14702
14780
  runningBridges.delete(key);
14703
14781
  return null;
14704
14782
  }
@@ -14740,18 +14818,6 @@ async function launchOptionalProjectBridge(input, key) {
14740
14818
  return null;
14741
14819
  }
14742
14820
  }
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
14821
 
14756
14822
  // src/project/tokens.ts
14757
14823
  import { createHash as createHash2 } from "node:crypto";
@@ -15457,7 +15523,7 @@ function comparePosixStrings(a, b) {
15457
15523
  import { watch } from "node:fs";
15458
15524
  import { readdir as readdir2 } from "node:fs/promises";
15459
15525
  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";
15526
+ import { dirname as dirname2, isAbsolute as isAbsolute3, join as join5, relative as relative3, resolve as resolve2, sep as sep3 } from "node:path";
15461
15527
  function createProjectFileWatcher(options) {
15462
15528
  const rootDirectory = realpathSync(resolve2(options.rootDirectory));
15463
15529
  const debounceMs = Math.max(0, options.debounceMs ?? 60);
@@ -15603,7 +15669,7 @@ function canonicalProjectPath(rootDirectory, path) {
15603
15669
  const canonical = realpathSync(path);
15604
15670
  return isWithin(rootDirectory, canonical) && !isSensitiveProjectPath(relative3(rootDirectory, canonical).split(sep3).join("/")) ? canonical : null;
15605
15671
  } catch {
15606
- const parent = dirname3(path);
15672
+ const parent = dirname2(path);
15607
15673
  if (parent === path) return null;
15608
15674
  try {
15609
15675
  const canonicalParent = realpathSync(parent);
@@ -15817,13 +15883,13 @@ function resolveDecodedStaticFile(root2, decodedPath) {
15817
15883
  if (!isWithin2(root2, candidate)) return null;
15818
15884
  const canonicalCandidate = canonicalExistingAncestor(candidate);
15819
15885
  if (!canonicalCandidate || !isWithin2(root2, canonicalCandidate)) return null;
15820
- if (!existsSync3(candidate)) return null;
15886
+ if (!existsSync2(candidate)) return null;
15821
15887
  let filePath = canonicalCandidate;
15822
15888
  const stats = statSync2(filePath);
15823
15889
  if (stats.isDirectory()) {
15824
15890
  const indexCandidate = join6(filePath, "index.html");
15825
15891
  const canonicalIndex = canonicalExistingAncestor(indexCandidate);
15826
- if (!canonicalIndex || !isWithin2(root2, canonicalIndex) || !existsSync3(indexCandidate)) {
15892
+ if (!canonicalIndex || !isWithin2(root2, canonicalIndex) || !existsSync2(indexCandidate)) {
15827
15893
  return null;
15828
15894
  }
15829
15895
  if (!statSync2(canonicalIndex).isFile()) return null;
@@ -15842,10 +15908,7 @@ function createStandaloneProjectId(rootDirectory) {
15842
15908
  }
15843
15909
  function contentTypeForPath(filePath) {
15844
15910
  const extension = extname2(filePath).toLowerCase();
15845
- return MIME_TYPES2[extension] ?? "application/octet-stream";
15846
- }
15847
- function isReservedNudgeUiRoute2(pathname) {
15848
- return pathname === NUDGE_UI_ROUTE_PREFIX.slice(0, -1) || pathname.startsWith(NUDGE_UI_ROUTE_PREFIX);
15911
+ return MIME_TYPES2.get(extension) ?? "application/octet-stream";
15849
15912
  }
15850
15913
  function canonicalDirectory(directory2) {
15851
15914
  const canonical = canonicalDirectoryOrNull(directory2);
@@ -15903,7 +15966,7 @@ function canonicalExistingAncestor(candidate) {
15903
15966
  return realpathSync2(current);
15904
15967
  } catch (error) {
15905
15968
  if (!isMissingPathError(error)) return null;
15906
- const parent = dirname4(current);
15969
+ const parent = dirname3(current);
15907
15970
  if (parent === current) return null;
15908
15971
  current = parent;
15909
15972
  }
@@ -15928,7 +15991,7 @@ async function handleRequest(input) {
15928
15991
  sendText(response, 400, "Bad Request");
15929
15992
  return;
15930
15993
  }
15931
- if (isReservedNudgeUiRoute2(decodedPath)) {
15994
+ if (isReservedNudgeUiRoute(decodedPath)) {
15932
15995
  await handleNudgeUiRoute(input, decodedPath);
15933
15996
  return;
15934
15997
  }
@@ -16084,7 +16147,7 @@ function sendBody(response, status, body2, contentType, headers = {}) {
16084
16147
  if (response.req?.method !== "HEAD") response.end(body2);
16085
16148
  else response.end();
16086
16149
  }
16087
- var MIME_TYPES2 = {
16150
+ var MIME_TYPES2 = new Map(Object.entries({
16088
16151
  ".avif": "image/avif",
16089
16152
  ".css": "text/css; charset=utf-8",
16090
16153
  ".csv": "text/csv; charset=utf-8",
@@ -16110,7 +16173,7 @@ var MIME_TYPES2 = {
16110
16173
  ".woff": "font/woff",
16111
16174
  ".woff2": "font/woff2",
16112
16175
  ".xml": "application/xml; charset=utf-8"
16113
- };
16176
+ }));
16114
16177
 
16115
16178
  // src/hosts/static/cli.ts
16116
16179
  function parseServeArguments(args, currentDirectory = process.cwd()) {
@@ -49,6 +49,10 @@ async function directory(root, id) {
49
49
  }
50
50
  return join(actual, id);
51
51
  }
52
+ function isRecord(value) {
53
+ return typeof value === "object" && value !== null && !Array.isArray(value);
54
+ }
55
+ /** Both artifact endpoints accept JSON objects only. */
52
56
  async function body(request) {
53
57
  const chunks = [];
54
58
  let size = 0;
@@ -60,7 +64,10 @@ async function body(request) {
60
64
  chunks.push(data);
61
65
  }
62
66
  const text = Buffer.concat(chunks).toString("utf8");
63
- return text.length === 0 ? {} : JSON.parse(text);
67
+ if (text.length === 0)
68
+ return {};
69
+ const parsed = JSON.parse(text);
70
+ return isRecord(parsed) ? parsed : null;
64
71
  }
65
72
  function respond(response, status, content, type = "text/plain; charset=utf-8") {
66
73
  response.writeHead(status, {
@@ -100,7 +107,7 @@ export async function handleHtmlArtifactRequest(request, response, root, transfo
100
107
  try {
101
108
  if (request.method === "POST" && parts.length === 0) {
102
109
  const input = await body(request);
103
- if (!validArtifact(input)) {
110
+ if (!input || !validArtifact(input)) {
104
111
  respond(response, 400, "Invalid artifact");
105
112
  return true;
106
113
  }
@@ -159,28 +166,27 @@ export async function handleHtmlArtifactRequest(request, response, root, transfo
159
166
  if ((request.method === "PUT" && parts[1] === "document")
160
167
  || (request.method === "POST" && parts[1] === "commit")) {
161
168
  const input = await body(request);
162
- if (!input || typeof input !== "object") {
169
+ if (!input) {
163
170
  respond(response, 400, "Invalid document");
164
171
  return true;
165
172
  }
166
- const item = input;
167
- if (!isHtmlArtifactRevision(item.expected)) {
173
+ if (!isHtmlArtifactRevision(input.expected)) {
168
174
  respond(response, 428, "An expected iteration revision is required");
169
175
  return true;
170
176
  }
171
- if ((item.html !== undefined && typeof item.html !== "string")
172
- || (request.method === "PUT" && typeof item.html !== "string")) {
177
+ if ((input.html !== undefined && typeof input.html !== "string")
178
+ || (request.method === "PUT" && typeof input.html !== "string")) {
173
179
  respond(response, 400, "Invalid document");
174
180
  return true;
175
181
  }
176
- const expected = item.expected;
182
+ const expected = input.expected;
177
183
  if (!sameRevision(await readRevision(target), expected)) {
178
184
  respond(response, 409, HTML_ITERATION_CONFLICT);
179
185
  return true;
180
186
  }
181
- const html = typeof item.html === "string" ? item.html : await readFile(join(target, "document.html"), "utf8");
187
+ const html = typeof input.html === "string" ? input.html : await readFile(join(target, "document.html"), "utf8");
182
188
  const writes = request.method === "POST" ? ["preview.html"] : [];
183
- if (typeof item.html === "string")
189
+ if (typeof input.html === "string")
184
190
  writes.push("document.html");
185
191
  const previewBefore = await readFile(join(target, "preview.html"));
186
192
  const temporaryFiles = [];
@@ -190,9 +196,7 @@ export async function handleHtmlArtifactRequest(request, response, root, transfo
190
196
  temporaryFiles.push({ temporary, destination: join(target, file) });
191
197
  await writeFile(temporary, html);
192
198
  }
193
- // Keep the final check and replacements in one controller critical section.
194
- // External tools must finish their file writes before handoff; they do
195
- // not participate in this process's request queue.
199
+ // External writers do not join this request queue, so the final check and replacements stay in one critical section.
196
200
  const latest = {
197
201
  document: revision(readFileSync(join(target, "document.html"))),
198
202
  preview: revision(readFileSync(join(target, "preview.html"))),
@@ -241,13 +245,12 @@ export async function handleHtmlArtifactRequest(request, response, root, transfo
241
245
  return true;
242
246
  }
243
247
  function validArtifact(value) {
244
- if (!value || typeof value !== "object")
248
+ if (!isRecord(value))
245
249
  return false;
246
- const item = value;
247
- const viewport = item.viewport;
248
- return typeof item.id === "string" && ID.test(item.id)
249
- && typeof item.sourceUrl === "string" && item.sourceUrl.length < 4096
250
- && typeof item.title === "string" && item.title.length < 512
251
- && typeof item.html === "string" && item.html.length > 0
252
- && !!viewport && typeof viewport.width === "number" && typeof viewport.height === "number";
250
+ const viewport = value.viewport;
251
+ return typeof value.id === "string" && ID.test(value.id)
252
+ && typeof value.sourceUrl === "string" && value.sourceUrl.length < 4096
253
+ && typeof value.title === "string" && value.title.length < 512
254
+ && typeof value.html === "string" && value.html.length > 0
255
+ && isRecord(viewport) && typeof viewport.width === "number" && typeof viewport.height === "number";
253
256
  }
@@ -15,5 +15,4 @@ export interface ProjectFileWatcher {
15
15
  start(): Promise<void>;
16
16
  close(): Promise<void>;
17
17
  }
18
- /** Creates a watcher that starts and stops explicitly with the server. */
19
18
  export declare function createProjectFileWatcher(options: ProjectFileWatcherOptions): ProjectFileWatcher;