nudge-ui 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/README.md +164 -46
  2. package/dist/client.mjs +260 -61
  3. package/dist/css/value-semantics/colorSemantics.d.ts +4 -0
  4. package/dist/css/value-semantics/colorSemantics.js +17 -0
  5. package/dist/hosts/astro/astroRuntimeConfig.js +1 -0
  6. package/dist/hosts/astro/clientTransport.js +38 -32
  7. package/dist/hosts/astro/integration.js +5 -1
  8. package/dist/hosts/astro/markdownIdentity.d.ts +28 -0
  9. package/dist/hosts/astro/markdownIdentity.js +81 -0
  10. package/dist/hosts/next/manifest.js +1 -1
  11. package/dist/hosts/next/sidecar.js +5 -1
  12. package/dist/hosts/static/manifest.js +1 -1
  13. package/dist/hosts/static/server.js +3 -0
  14. package/dist/hosts/vite/vite.d.ts +3 -0
  15. package/dist/hosts/vite/vite.js +24 -4
  16. package/dist/inspector/agent/McpConnectionDialog.js +13 -19
  17. package/dist/inspector/agent/activity.d.ts +18 -0
  18. package/dist/inspector/agent/activity.js +70 -0
  19. package/dist/inspector/agent/client.d.ts +2 -0
  20. package/dist/inspector/agent/client.js +29 -1
  21. package/dist/inspector/agent/connectionStatus.js +1 -1
  22. package/dist/inspector/agent/httpTransport.js +9 -2
  23. package/dist/inspector/agent/protocol.d.ts +6 -3
  24. package/dist/inspector/agent/protocol.js +1 -1
  25. package/dist/inspector/agent/verification.d.ts +15 -7
  26. package/dist/inspector/agent/verification.js +113 -41
  27. package/dist/inspector/canvas/AgentActivityOverlay.d.ts +13 -0
  28. package/dist/inspector/canvas/AgentActivityOverlay.js +111 -0
  29. package/dist/inspector/canvas/CanvasCard.d.ts +9 -2
  30. package/dist/inspector/canvas/CanvasCard.js +135 -38
  31. package/dist/inspector/canvas/CanvasElementOverlay.js +166 -16
  32. package/dist/inspector/canvas/CanvasToolIcons.d.ts +10 -0
  33. package/dist/inspector/canvas/CanvasToolIcons.js +20 -0
  34. package/dist/inspector/canvas/CanvasToolbar.js +8 -4
  35. package/dist/inspector/canvas/CanvasWorkspace.js +270 -122
  36. package/dist/inspector/canvas/StaleChangeIndicator.js +3 -13
  37. package/dist/inspector/canvas/agentPresentation.d.ts +8 -8
  38. package/dist/inspector/canvas/agentPresentation.js +64 -52
  39. package/dist/inspector/canvas/canvasGestures.d.ts +1 -1
  40. package/dist/inspector/canvas/canvasGestures.js +1 -1
  41. package/dist/inspector/canvas/canvasStore.d.ts +46 -82
  42. package/dist/inspector/canvas/canvasStore.js +251 -284
  43. package/dist/inspector/canvas/frameContent.d.ts +21 -0
  44. package/dist/inspector/canvas/frameContent.js +44 -0
  45. package/dist/inspector/canvas/frameProtocol.d.ts +21 -4
  46. package/dist/inspector/canvas/frameProtocol.js +3 -3
  47. package/dist/inspector/canvas/frameScrollbarStyles.d.ts +3 -0
  48. package/dist/inspector/canvas/frameScrollbarStyles.js +21 -0
  49. package/dist/inspector/canvas/keyboardShortcuts.d.ts +3 -1
  50. package/dist/inspector/canvas/keyboardShortcuts.js +4 -4
  51. package/dist/inspector/canvas/layout.d.ts +52 -0
  52. package/dist/inspector/canvas/layout.js +106 -0
  53. package/dist/inspector/canvas/projection.d.ts +15 -5
  54. package/dist/inspector/canvas/projection.js +69 -13
  55. package/dist/inspector/canvas/rendererBootstrap.js +32 -4
  56. package/dist/inspector/canvas/rendererElementSelector.js +47 -6
  57. package/dist/inspector/canvas/rendererStylesheet.js +2 -2
  58. package/dist/inspector/canvas/resizeHandleScale.js +1 -1
  59. package/dist/inspector/canvas/sessionStore.d.ts +11 -26
  60. package/dist/inspector/canvas/sessionStore.js +43 -183
  61. package/dist/inspector/canvas/staleChangeDetector.js +9 -3
  62. package/dist/inspector/canvas/useCanvasLayoutAnimation.d.ts +5 -0
  63. package/dist/inspector/canvas/useCanvasLayoutAnimation.js +107 -0
  64. package/dist/inspector/canvas/viewStore.d.ts +38 -0
  65. package/dist/inspector/canvas/viewStore.js +104 -0
  66. package/dist/inspector/canvas/wheelPan.d.ts +8 -0
  67. package/dist/inspector/canvas/wheelPan.js +8 -0
  68. package/dist/inspector/changes/changesLog.d.ts +9 -6
  69. package/dist/inspector/changes/changesLog.js +48 -32
  70. package/dist/inspector/changes/codecs.d.ts +1 -0
  71. package/dist/inspector/changes/codecs.js +10 -1
  72. package/dist/inspector/changes/draftChanges.d.ts +58 -0
  73. package/dist/inspector/changes/draftChanges.js +304 -0
  74. package/dist/inspector/changes/editModel.d.ts +10 -0
  75. package/dist/inspector/changes/editModel.js +9 -2
  76. package/dist/inspector/changes/previewDiagnostics.d.ts +4 -2
  77. package/dist/inspector/changes/previewDiagnostics.js +11 -25
  78. package/dist/inspector/changes/types.d.ts +7 -0
  79. package/dist/inspector/clientManifest.d.ts +1 -1
  80. package/dist/inspector/comments/CommentsOverlay.d.ts +2 -0
  81. package/dist/inspector/comments/CommentsOverlay.js +250 -0
  82. package/dist/inspector/comments/element.d.ts +6 -0
  83. package/dist/inspector/comments/element.js +54 -0
  84. package/dist/inspector/comments/store.d.ts +29 -0
  85. package/dist/inspector/comments/store.js +121 -0
  86. package/dist/inspector/comments/verification.d.ts +5 -0
  87. package/dist/inspector/comments/verification.js +52 -0
  88. package/dist/inspector/componentSemantics/adapterRegistry.d.ts +6 -1
  89. package/dist/inspector/componentSemantics/adapterRegistry.js +23 -1
  90. package/dist/inspector/componentSemantics/reactRuntime.d.ts +2 -1
  91. package/dist/inspector/componentSemantics/reactRuntime.js +38 -0
  92. package/dist/inspector/componentSemantics/runtimeBridge.d.ts +4 -2
  93. package/dist/inspector/componentSemantics/runtimeBridge.js +17 -0
  94. package/dist/inspector/componentSemantics/types.d.ts +11 -0
  95. package/dist/inspector/drafts/model.d.ts +35 -0
  96. package/dist/inspector/drafts/model.js +45 -0
  97. package/dist/inspector/drafts/store.d.ts +28 -0
  98. package/dist/inspector/drafts/store.js +231 -0
  99. package/dist/inspector/index.js +20 -27
  100. package/dist/inspector/inline-text/inlineTextEditor.js +7 -0
  101. package/dist/inspector/inspection/useBrowserCssInspection.js +15 -1
  102. package/dist/inspector/iterations/capture.d.ts +2 -0
  103. package/dist/inspector/iterations/capture.js +174 -0
  104. package/dist/inspector/iterations/client.d.ts +7 -0
  105. package/dist/inspector/iterations/client.js +52 -0
  106. package/dist/inspector/iterations/coordinator.d.ts +15 -0
  107. package/dist/inspector/iterations/coordinator.js +130 -0
  108. package/dist/inspector/iterations/prompt.d.ts +3 -0
  109. package/dist/inspector/iterations/prompt.js +26 -0
  110. package/dist/inspector/overlay/DomNavigator.js +21 -15
  111. package/dist/inspector/overlay/interactionStyles.js +3 -1
  112. package/dist/inspector/overlay/spacingGestures.d.ts +13 -1
  113. package/dist/inspector/overlay/spacingGestures.js +82 -5
  114. package/dist/inspector/projection/{workspaceProjection.d.ts → draftProjection.d.ts} +6 -6
  115. package/dist/inspector/projection/{workspaceProjection.js → draftProjection.js} +4 -4
  116. package/dist/inspector/projection/renderedInstance.d.ts +17 -3
  117. package/dist/inspector/projection/renderedInstance.js +62 -11
  118. package/dist/inspector/projection/structuralProjection.d.ts +2 -1
  119. package/dist/inspector/projection/structuralProjection.js +21 -17
  120. package/dist/inspector/projection/textProjection.d.ts +2 -1
  121. package/dist/inspector/projection/textProjection.js +64 -15
  122. package/dist/inspector/prompt/PromptSettingsDialog.js +1 -5
  123. package/dist/inspector/prompt/clipboardHandoff.d.ts +15 -18
  124. package/dist/inspector/prompt/clipboardHandoff.js +97 -143
  125. package/dist/inspector/prompt/generatePrompt.d.ts +4 -1
  126. package/dist/inspector/prompt/generatePrompt.js +22 -17
  127. package/dist/inspector/runtime/runtimeConfig.d.ts +9 -0
  128. package/dist/inspector/runtime/runtimeConfig.js +24 -0
  129. package/dist/inspector/selection/sourceSite.d.ts +12 -0
  130. package/dist/inspector/selection/sourceSite.js +28 -0
  131. package/dist/inspector/settings/SettingsDialog.js +21 -8
  132. package/dist/inspector/shell/AgentStatusButton.d.ts +11 -0
  133. package/dist/inspector/shell/AgentStatusButton.js +36 -0
  134. package/dist/inspector/shell/AppShell.js +4 -2
  135. package/dist/inspector/shell/ChangesLog.js +46 -26
  136. package/dist/inspector/shell/CopyPromptButton.js +184 -93
  137. package/dist/inspector/shell/EmptyState.js +9 -8
  138. package/dist/inspector/shell/InspectorShell.js +13 -21
  139. package/dist/inspector/shell/PeekOriginalButton.js +24 -23
  140. package/dist/inspector/shell/originalPreview.js +5 -5
  141. package/dist/inspector/shell/shortcuts.d.ts +3 -0
  142. package/dist/inspector/shell/shortcuts.js +11 -0
  143. package/dist/inspector/sketch/SketchEditor.js +14 -14
  144. package/dist/inspector/sketch/SketchEntryButton.js +1 -1
  145. package/dist/inspector/sketch/SketchFrameOverlay.d.ts +3 -1
  146. package/dist/inspector/sketch/SketchFrameOverlay.js +11 -8
  147. package/dist/inspector/sketch/SketchLayersPanel.js +13 -5
  148. package/dist/inspector/sketch/SketchOverlay.js +7 -7
  149. package/dist/inspector/sketch/SketchWorkspace.js +18 -12
  150. package/dist/inspector/sketch/interaction.d.ts +1 -0
  151. package/dist/inspector/sketch/interaction.js +8 -4
  152. package/dist/inspector/sketch/model.d.ts +5 -0
  153. package/dist/inspector/sketch/model.js +6 -2
  154. package/dist/inspector/sketch/raster.d.ts +1 -2
  155. package/dist/inspector/sketch/raster.js +68 -4
  156. package/dist/inspector/styleEditors/BackgroundEditor.d.ts +4 -0
  157. package/dist/inspector/styleEditors/BackgroundEditor.js +195 -0
  158. package/dist/inspector/styleEditors/BorderEditor.js +49 -78
  159. package/dist/inspector/styleEditors/BorderRadiusEditor.js +6 -1
  160. package/dist/inspector/styleEditors/BoxShadowEditor.d.ts +1 -2
  161. package/dist/inspector/styleEditors/BoxShadowEditor.js +132 -4
  162. package/dist/inspector/styleEditors/ColorPicker.d.ts +5 -1
  163. package/dist/inspector/styleEditors/ColorPicker.js +10 -4
  164. package/dist/inspector/styleEditors/GapField.js +3 -5
  165. package/dist/inspector/styleEditors/GridChildSection.d.ts +1 -1
  166. package/dist/inspector/styleEditors/GridChildSection.js +18 -9
  167. package/dist/inspector/styleEditors/GridPicker.d.ts +1 -1
  168. package/dist/inspector/styleEditors/GridPicker.js +8 -2
  169. package/dist/inspector/styleEditors/GridSection.js +1 -1
  170. package/dist/inspector/styleEditors/GridValueField.js +19 -14
  171. package/dist/inspector/styleEditors/ImageBackgroundEditor.d.ts +18 -0
  172. package/dist/inspector/styleEditors/ImageBackgroundEditor.js +118 -0
  173. package/dist/inspector/styleEditors/LayoutBlockedIndicator.d.ts +2 -2
  174. package/dist/inspector/styleEditors/LayoutBlockedIndicator.js +3 -3
  175. package/dist/inspector/styleEditors/LayoutComboField.js +6 -4
  176. package/dist/inspector/styleEditors/LayoutDropdown.js +6 -3
  177. package/dist/inspector/styleEditors/LayoutSection.js +32 -11
  178. package/dist/inspector/styleEditors/SpacingBox.js +7 -5
  179. package/dist/inspector/styleEditors/Typography.js +11 -3
  180. package/dist/inspector/styleEditors/backgroundLayers.d.ts +24 -0
  181. package/dist/inspector/styleEditors/backgroundLayers.js +51 -0
  182. package/dist/inspector/styleEditors/gradientValue.d.ts +17 -0
  183. package/dist/inspector/styleEditors/gradientValue.js +114 -0
  184. package/dist/inspector/styleEditors/inlineAuthored.d.ts +10 -0
  185. package/dist/inspector/styleEditors/inlineAuthored.js +114 -0
  186. package/dist/inspector/styleEditors/layoutValue.d.ts +0 -8
  187. package/dist/inspector/styleEditors/layoutValue.js +0 -42
  188. package/dist/inspector/styleEditors/nudgeValue.d.ts +2 -2
  189. package/dist/inspector/styleEditors/nudgeValue.js +36 -8
  190. package/dist/inspector/tokens/TokenField.d.ts +7 -0
  191. package/dist/inspector/tokens/TokenField.js +35 -25
  192. package/dist/inspector/tokens/TokenLabel.js +5 -14
  193. package/dist/inspector/tokens/editActions.d.ts +1 -1
  194. package/dist/inspector/tokens/editActions.js +7 -1
  195. package/dist/inspector/ui/AtRuleContext.js +4 -6
  196. package/dist/inspector/ui/Button.d.ts +6 -2
  197. package/dist/inspector/ui/Button.js +4 -3
  198. package/dist/inspector/ui/ControlSurface.d.ts +2 -2
  199. package/dist/inspector/ui/ControlSurface.js +4 -3
  200. package/dist/inspector/ui/InlineStyleWarning.d.ts +11 -0
  201. package/dist/inspector/ui/InlineStyleWarning.js +13 -0
  202. package/dist/inspector/ui/InspectorPopover.d.ts +2 -1
  203. package/dist/inspector/ui/InspectorPopover.js +4 -5
  204. package/dist/inspector/ui/PopoverListbox.d.ts +2 -1
  205. package/dist/inspector/ui/PopoverListbox.js +8 -7
  206. package/dist/inspector/ui/SegmentedControl.d.ts +2 -1
  207. package/dist/inspector/ui/SegmentedControl.js +2 -2
  208. package/dist/inspector/ui/Select.d.ts +6 -1
  209. package/dist/inspector/ui/Select.js +7 -11
  210. package/dist/inspector/ui/SideValuesField.js +1 -1
  211. package/dist/inspector/ui/Tooltip.d.ts +26 -0
  212. package/dist/inspector/ui/Tooltip.js +32 -0
  213. package/dist/inspector/ui/classNames.d.ts +2 -0
  214. package/dist/inspector/ui/classNames.js +4 -0
  215. package/dist/inspector/ui/customCursors.d.ts +23 -0
  216. package/dist/inspector/ui/customCursors.js +122 -0
  217. package/dist/inspector/ui/dragCursor.d.ts +0 -2
  218. package/dist/inspector/ui/dragCursor.js +2 -10
  219. package/dist/inspector/ui/portalContainer.d.ts +2 -0
  220. package/dist/inspector/ui/portalContainer.js +6 -0
  221. package/dist/inspector/ui/styles.js +29 -21
  222. package/dist/inspector/workspace/commands.d.ts +9 -0
  223. package/dist/inspector/workspace/commands.js +82 -0
  224. package/dist/inspector/workspace/controller.d.ts +4 -0
  225. package/dist/inspector/workspace/controller.js +66 -0
  226. package/dist/inspector/workspace/handoff.d.ts +42 -0
  227. package/dist/inspector/workspace/handoff.js +115 -0
  228. package/dist/inspector/workspace/sentItems.d.ts +19 -0
  229. package/dist/inspector/workspace/sentItems.js +51 -0
  230. package/dist/inspector/workspace/timeline.d.ts +30 -0
  231. package/dist/inspector/workspace/timeline.js +108 -0
  232. package/dist/internal/agent-protocol.d.ts +19 -2
  233. package/dist/internal/agent-protocol.js +13 -0
  234. package/dist/nudge-ui.mjs +558 -311
  235. package/dist/project/artifacts.d.ts +13 -0
  236. package/dist/project/artifacts.js +253 -0
  237. package/dist/transport/artifacts.d.ts +8 -0
  238. package/dist/transport/artifacts.js +9 -0
  239. package/dist/transport/editor.js +3 -1
  240. package/dist/transport/routes.d.ts +2 -0
  241. package/dist/transport/routes.js +2 -0
  242. package/package.json +7 -3
  243. package/dist/inspector/changes/workspaceChanges.d.ts +0 -47
  244. package/dist/inspector/changes/workspaceChanges.js +0 -265
package/README.md CHANGED
@@ -1,66 +1,184 @@
1
- # nudge-ui
1
+ # Nudge UI
2
2
 
3
- The Nudge UI distribution. One package, one subpath per host.
3
+ Edit the look of your running app in the browser, then hand the changes to your
4
+ coding agent. Nudge UI is a development-only visual inspector for Next.js,
5
+ Astro, Vite with React, and static HTML.
6
+
7
+ Select an element, adjust its design, and see the result immediately. Copy a
8
+ structured prompt or send it to a connected agent to apply the changes to your
9
+ source code. Nudge previews app edits; your coding agent implements them.
10
+
11
+ ![Nudge UI visual inspector](https://github.com/user-attachments/assets/2f8abf6d-71cc-4823-8042-25a6e6407d74)
12
+
13
+ ## Get started
14
+
15
+ Run this from your application's root directory:
4
16
 
5
17
  ```sh
6
- pnpm add -D nudge-ui
18
+ npm create nudge-ui@latest
7
19
  ```
8
20
 
9
- ## Hosts
21
+ The initializer installs `nudge-ui`, configures your framework, and offers to
22
+ connect a coding agent. Start your app with its usual development command and
23
+ open the local URL to use the editor.
24
+
25
+ Requires Node.js 20 or later. Your framework or build tool may require a newer
26
+ version. Supported host versions are Vite 5+, Next.js 15.3–16.x, and Astro 5+;
27
+ React integrations support React 18 and 19. Framework peer dependencies are
28
+ optional, so you only need the tools your app uses.
29
+
30
+ ## What you can do
10
31
 
11
- | Subpath | Host | Entry point |
32
+ - **Inspect and edit:** Preview layout, spacing, typography, colors, backgrounds,
33
+ borders, shadows, text, design tokens, and supported component props.
34
+ - **Compare pages:** Open routes in Canvas frames, resize them, and create linked
35
+ duplicates to compare the same design at different viewport sizes.
36
+ - **Explore alternatives:** Create independent HTML iterations from a frame,
37
+ refine them, and ask an agent to implement your chosen design in the live app.
38
+ - **Explain changes:** Add comments and sketches alongside visual edits.
39
+ - **Hand off to an agent:** Copy a prompt with source context, or send it through
40
+ the optional MCP integration and see the agent's status in the editor.
41
+
42
+ ## Use the editor
43
+
44
+ | Tool | Shortcut | Action |
12
45
  | --- | --- | --- |
13
- | `nudge-ui/vite` | Vite with React | `withNudgeUi(defineConfig(...))` |
14
- | `nudge-ui/next` | Next.js 15.3 – 16.x | `withNudgeUi(nextConfig)` |
15
- | `nudge-ui/astro` | Astro | `nudgeUiAstro()` |
16
- | `nudge-ui/static` | Static HTML | the `nudge-ui serve` command |
46
+ | Select | `V` | Select elements to inspect and edit. |
47
+ | Comment | `C` | Attach a note to an element. |
48
+ | Pencil | `P` | Draw on the page and add sketch notes. |
49
+ | Use app normally | Hold `A` in Canvas | Interact with the app. You can also select this tool in the toolbar. |
50
+
51
+ Hold `Space` to pan the canvas. Use undo and redo to revisit edits and frame
52
+ changes. Comments and pending edits are saved locally.
53
+
54
+ Use **Duplicate** for a linked live frame or **Iteration** for an independent
55
+ HTML design. Iterations save HTML and CSS under `.nudge/artifacts/` in your
56
+ project. They capture the rendered design without the app's scripts. Iteration
57
+ prompts ask the agent to edit that HTML; **Copy prompt for live app** asks it to
58
+ implement the design in application source.
59
+
60
+ After handoff, comments clear when Nudge detects that the target's content or
61
+ appearance changed at the same viewport size, with previews removed. This
62
+ detects a change; it does not verify that the note was satisfied. Missing or
63
+ ambiguous targets keep their comments.
64
+
65
+ ## Connect a coding agent
66
+
67
+ To add or repair agent integration in an installed project, run:
68
+
69
+ ```sh
70
+ npx nudge-ui agent setup
71
+ ```
72
+
73
+ Setup installs [`@nudge-ui/mcp`](https://www.npmjs.com/package/@nudge-ui/mcp)
74
+ and configures your selected agent. Fully restart the agent host, ask it to
75
+ **listen to Nudge in this workspace**, and keep it listening while you send
76
+ changes. You can use copied prompts without MCP.
77
+
78
+ The MCP integration is early alpha. For diagnostics, run
79
+ `npx nudge-ui agent doctor` from the app directory. See the
80
+ [coding-agent guide](https://github.com/charlessmart/nudge-ui/blob/main/docs/agent-integration.md)
81
+ for host limitations and session selection.
82
+
83
+ ## Manual installation
84
+
85
+ Install the package as a development dependency:
86
+
87
+ ```sh
88
+ npm install --save-dev nudge-ui
89
+ ```
90
+
91
+ Choose the integration for your host. There is no root `nudge-ui` import.
92
+
93
+ ### Vite with React
94
+
95
+ Wrap your existing `vite.config.ts` configuration:
96
+
97
+ ```ts
98
+ import { defineConfig } from "vite";
99
+ import react from "@vitejs/plugin-react";
100
+ import { withNudgeUi } from "nudge-ui/vite";
101
+
102
+ export default withNudgeUi(defineConfig({
103
+ plugins: [react()],
104
+ }));
105
+ ```
106
+
107
+ For authored workspace packages outside the app root, pass their directories
108
+ with `sourceRoots`, for example `withNudgeUi(config, { sourceRoots: ["../../packages/ui"] })`.
109
+ Dependency and generated-output directories remain excluded. Vite and Astro
110
+ also accept `debug: true` for experimental DOM parent and child navigation.
111
+
112
+ ### Next.js
113
+
114
+ Wrap your `next.config.ts` configuration:
115
+
116
+ ```ts
117
+ import { withNudgeUi } from "nudge-ui/next";
17
118
 
18
- Peer dependencies on Vite, Next.js, Astro, React, and React DOM are all
19
- optional. Installing this package never asks for a toolchain the project does
20
- not use.
119
+ const nextConfig = {};
21
120
 
22
- ## Layout
121
+ export default withNudgeUi(nextConfig);
122
+ ```
123
+
124
+ The integration supports Webpack and Turbopack. Use `sourceRoots` for authored
125
+ workspace directories outside the application root.
126
+
127
+ ### Astro
23
128
 
129
+ Add the integration to `astro.config.ts`:
130
+
131
+ ```ts
132
+ import { defineConfig } from "astro/config";
133
+ import { nudgeUiAstro } from "nudge-ui/astro";
134
+
135
+ export default defineConfig({
136
+ integrations: [nudgeUiAstro()],
137
+ });
24
138
  ```
25
- src/
26
- hosts/vite Vite lifecycle, CSS observation, transport, bootstrap
27
- hosts/next Webpack and Turbopack loaders, sidecar, mount
28
- hosts/astro Response-level identity over the Vite integration
29
- hosts/static Instrumenting file server and CLI
30
- inspector/ The browser UI, its client bundle, and the runtime bridge
31
- compiler/ JSX identity injection and component contract extraction
32
- css/ Token model, value semantics, dialects, token inventory
33
- transport/ Reserved routes, mount ID, manifest version
34
- project/ File discovery, path policy, watching, token snapshots
35
- html/ parse5 identity instrumentation
139
+
140
+ `withNudgeUi(defineConfig(...))` from `nudge-ui/astro` is also supported and is
141
+ the form used by the initializer.
142
+
143
+ ### Static HTML
144
+
145
+ Serve a directory of HTML, CSS, and assets:
146
+
147
+ ```sh
148
+ npx nudge-ui serve ./prototype
36
149
  ```
37
150
 
38
- A host must not import a sibling host. `scripts/check-package-boundaries.mjs`
39
- enforces this; Astro's dependency on Vite is the one documented exception,
40
- because Astro is a Vite host.
151
+ The server binds to loopback, instruments HTML in memory, and reloads after file
152
+ changes. Dot-prefixed files and directories, including `.env`, are not served.
153
+
154
+ ## Development and automated tests
41
155
 
42
- `transport/` must stay free of Node imports, because the inspector's mount
43
- components import the route constants directly. Anything needing the filesystem
44
- belongs under `project/`. A test in the package enforces this.
156
+ Nudge is enabled by default in development. Standard production builds exclude
157
+ the inspector bootstrap, identity attributes, and token data.
45
158
 
46
- `css/index.ts`, `css/model`, and `css/value-semantics` are browser-safe and
47
- must not import Node, React, PostCSS, or anything under `hosts/` or
48
- `inspector/`. `src/css/importGraph.test.ts` enforces that.
159
+ - **Disable for one tab:** Add `?nudge-ui=off`. The setting persists as you
160
+ navigate in that tab. Add `?nudge-ui=on` to enable it again.
161
+ - **Disable for one server run:** Start the server with `NUDGE_UI=0`, for example
162
+ `NUDGE_UI=0 npm run dev`.
163
+ - **Disable in framework configuration:** Pass `enabled: false`, for example
164
+ `withNudgeUi(config, { enabled: false })` or `nudgeUiAstro({ enabled: false })`.
49
165
 
50
- ## Supported public surface
166
+ Automated browsers with `navigator.webdriver` enabled get the plain app by
167
+ default. To test the editor, add `?nudge-ui=on` to the first URL or start the
168
+ development server with `NUDGE_UI=1`.
51
169
 
52
- The host subpaths above and the following utility subpaths follow semantic
53
- versioning:
170
+ ## Package entry points
54
171
 
55
- | Subpath | Purpose |
56
- | --- | --- |
57
- | `nudge-ui/testing` | Conformance fixtures for consumer tests. |
58
- | `nudge-ui/virtual-design-tokens` | Ambient types for the transport module. |
172
+ Use `nudge-ui/vite`, `nudge-ui/next`, `nudge-ui/astro`, or `nudge-ui/static` for
173
+ host integration. `nudge-ui/testing` provides consumer test fixtures, and
174
+ `nudge-ui/virtual-design-tokens` provides ambient types for the token transport
175
+ module. Imports under `nudge-ui/internal/*` are implementation details and may
176
+ change without notice.
59
177
 
60
- Exports under `nudge-ui/internal/*` are package-owned implementation details.
61
- The host adapters inject or resolve these imports; application code must not
62
- import them directly. They may change without notice.
178
+ ## Links
63
179
 
64
- Everything else is private. See
65
- [ADR-0023](../../docs/adr/0023-one-package-with-host-subpaths.md) and
66
- [ADR-0025](../../docs/adr/0025-supported-and-internal-export-subpaths.md).
180
+ [Initializer](https://www.npmjs.com/package/create-nudge-ui) ·
181
+ [MCP integration](https://www.npmjs.com/package/@nudge-ui/mcp) ·
182
+ [Repository](https://github.com/charlessmart/nudge-ui) ·
183
+ [Issues](https://github.com/charlessmart/nudge-ui/issues) ·
184
+ [MIT license](https://github.com/charlessmart/nudge-ui/blob/main/LICENSE)