mesurer-solid 0.2.0 → 0.2.1-beta.0

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.
@@ -24,7 +24,7 @@ The installer writes a self-contained skill and injection artifact:
24
24
 
25
25
  The base inspector includes Select, X-ray, Rulers, Typography, Guides, Distance, and Settings. Color Picker uses application-local host capture when available and otherwise uses a working browser `EyeDropper`.
26
26
 
27
- First-party plugins add Context, Arrange, Screenshot, and optional Codex delivery. The complete public map, including the low-level inspection methods and plugin host, is in [Capabilities](../../docs/CAPABILITIES.md).
27
+ First-party plugins add Context, Edit, Screenshot, and optional Codex delivery. Edit movement preserves the existing Arrange agent method names for compatibility. The complete public map, including the low-level inspection methods and plugin host, is in [Capabilities](../../docs/CAPABILITIES.md).
28
28
 
29
29
  For normal coding-agent work, use `window.__MESURER__`. Use `window.__MESURER_INSTANCE__` only when the task requires mounted-instance or plugin-host operations.
30
30
 
@@ -43,7 +43,7 @@ if (hasMesurer) {
43
43
  }
44
44
  ```
45
45
 
46
- If it exists, use that instance. A person may already have selected targets, guides, measurements, annotations, Arrange intent, text/style intent, or screenshot review state. That state is part of the request.
46
+ If it exists, use that instance. A person may already have selected targets, guides, measurements, annotations, Edit movement intent, text/style intent, or screenshot review state. That state is part of the request.
47
47
 
48
48
  The injector reuses a connected instance by default. Deliberate replacement requires:
49
49
 
@@ -104,7 +104,7 @@ const textEditIntents = await Promise.all(
104
104
  )
105
105
  ```
106
106
 
107
- Treat annotation notes, Arrange Desired geometry, and text/style Desired state as intent. Treat selection, measurements, distances, geometry, and computed styles as rendered evidence.
107
+ Treat annotation notes, Edit movement Desired geometry, and text/style Desired state as intent. Treat selection, measurements, distances, geometry, and computed styles as rendered evidence.
108
108
 
109
109
  ## Agent API reference
110
110
 
@@ -127,13 +127,13 @@ Use the high-level Context and saved-intent methods for normal UI work. The lowe
127
127
 
128
128
  Context adds `capabilities()`, `context()`, `contextText()`, `select()`, `annotations()`, `review()`, `capturePlan()`, `prepareCapture()`, and `finishCapture()`.
129
129
 
130
- These inspection methods accept general DOM elements, including SVG. `select()` and point inspection can return SVG targets, and Context preserves their selector, tag, and geometry. Arrange and direct text editing remain HTML-only mutation paths.
130
+ These inspection methods accept general DOM elements, including SVG. `select()` and point inspection can return SVG targets, and Context preserves their selector, tag, and geometry. Edit movement and direct text editing remain HTML-only mutation paths.
131
131
 
132
132
  Human Select lifecycle follows the same public contract. Invoking Select clears the current element and Guide selection before toggling the tool, and holding Shift while clicking rendered targets adds or removes them from the human multi-selection. Browser and agent code should not assume a hidden selection survives Select-off or an off-state reload.
133
133
 
134
- Arrange adds `arrangements()`, `arrange()`, `showArrange()`, `arrangeCapturePlan()`, and `reviewArrange()`.
134
+ Edit movement exposes `arrangements()`, `arrange()`, `showArrange()`, `arrangeCapturePlan()`, and `reviewArrange()` under their existing compatibility names.
135
135
 
136
- Use `capabilities().capabilities` before calling optional Context, Arrange, or text-edit paths. The complete public list is in [Capabilities](../../docs/CAPABILITIES.md).
136
+ Use `capabilities().capabilities` before calling optional Context, Edit movement, or text-edit paths. The complete public list is in [Capabilities](../../docs/CAPABILITIES.md).
137
137
 
138
138
  ## Select exact targets
139
139
 
@@ -150,9 +150,9 @@ Each selector must resolve to exactly one target. Missing or ambiguous selectors
150
150
 
151
151
  For multi-selection, inspect every selected target and the relevant pair relationships. Prefer `selection.visualContext.distances`; use `distance(a, b)` when a needed pair has no existing evidence. Box, guide, container, and diagonal semantics are defined in [Measurements and distance geometry](../../docs/MEASUREMENTS.md).
152
152
 
153
- ## Arrange intent
153
+ ## Edit movement intent
154
154
 
155
- Arrange expresses requested geometry, not source implementation.
155
+ Edit movement expresses requested geometry, not source implementation. The agent method names keep `Arrange` for compatibility.
156
156
 
157
157
  ```js
158
158
  const intents = await window.__MESURER__.arrangements()
@@ -169,17 +169,17 @@ await window.__MESURER__.showArrange(arrangeId, "live")
169
169
  const review = await window.__MESURER__.reviewArrange(arrangeId)
170
170
  ```
171
171
 
172
- Live removes the temporary Arrange preview before measuring source output.
172
+ Live removes the temporary Edit movement preview before measuring source output.
173
173
 
174
- Arrange preview ownership is conservative. Mesurer restores an older transform only while the element still carries the exact preview value and priority Mesurer applied. Host-authored transform changes survive review, refresh, and disposal.
174
+ Edit movement preview ownership is conservative. Mesurer restores an older transform only while the element still carries the exact preview value and priority Mesurer applied. Host-authored transform changes survive review, refresh, and disposal.
175
175
 
176
- See [Arrange](../../docs/ARRANGE.md).
176
+ See [Edit](../../docs/EDIT.md).
177
177
 
178
178
  ## Text and Typography intent
179
179
 
180
180
  Direct text editing records copy and typography intent without pretending to edit source. The human-facing tool is **Typography**; the internal compatibility id remains `text-inspector`.
181
181
 
182
- Editing starts by double-click/double-tap while Select or Typography is active. Arrange keeps Select active, so editing works while Arrange remains selected.
182
+ Editing starts by double-click or double-tap while Edit is active. Typography in Select stays inspection-only. Movement and direct text/style editing can therefore share one Edit session.
183
183
 
184
184
  Native editing stays native. Mesurer does not intercept form controls or descendants that inherit `contenteditable`. A nested `contenteditable="false"` boundary ends inherited editability and can become a Mesurer target when the direct-text rules otherwise pass. Mixed inline copy can target the exact direct text run under the pointer while preserving inline children and the host element's native DOM surface.
185
185
 
@@ -198,7 +198,7 @@ const intent = await window.__MESURER__.textEdit(textEditId)
198
198
 
199
199
  Treat `intent.desired` and style deltas as visual/source requirements, not inline CSS instructions. Look for the application's semantic props, classes, design tokens, CSS variables, theme values, or stylesheet rules that produce the requested render.
200
200
 
201
- Verification must use Live source with the Desired preview inactive. Text/style preview ownership follows the same conservative rule as Arrange: while the DOM still equals Mesurer's owned value, undo/redo can move it to the restored Desired value; once the application changes it, Mesurer preserves the host value instead of overwriting it during history or cleanup.
201
+ Verification must use Live source with the Desired preview inactive. Text/style preview ownership follows the same conservative ownership rule as Edit movement: while the DOM still equals Mesurer's owned value, undo/redo can move it to the restored Desired value; once the application changes it, Mesurer preserves the host value instead of overwriting it during history or cleanup.
202
202
 
203
203
  Do not infer Context availability from transient chrome. While a direct editor is active the Add Note button is absent by design, but `annotations()`, annotation-scoped `context()`, and `review()` remain the durable interface.
204
204
 
@@ -267,7 +267,7 @@ await window.__MESURER__.stable()
267
267
 
268
268
  Then compare the same evidence retained before editing:
269
269
 
270
- - Arrange Desired against Live through `reviewArrange()`;
270
+ - Edit movement Desired against Live through `reviewArrange()`;
271
271
  - text/style Desired against Live with the text preview inactive;
272
272
  - saved annotations through `review()`;
273
273
  - current selections and measurements through fresh `context()`;
@@ -277,6 +277,6 @@ Do not clear human history merely to expose Live state, and do not reinject just
277
277
 
278
278
  ## Completion rule
279
279
 
280
- A meaningful Mesurer call should affect the work. If exact geometry is available, use it instead of estimating pixels from a screenshot. If the user already encoded intent in Arrange, text editing, annotations, or selection, consume it before asking them to repeat it.
280
+ A meaningful Mesurer call should affect the work. If exact geometry is available, use it instead of estimating pixels from a screenshot. If the user already encoded intent in Edit movement, text editing, annotations, or selection, consume it before asking them to repeat it.
281
281
 
282
282
  The repository's packaged [`mesurer-ui` skill](./skills/mesurer-ui/SKILL.md) carries the operational version of this contract for coding agents. [Browser and agent integration](../../docs/BROWSER_HARNESS.md) documents the browser-control boundary.
package/README.md CHANGED
@@ -56,20 +56,20 @@ All public first-party plugin factories are exported from `mesurer-solid/plugins
56
56
 
57
57
  ```ts
58
58
  import { mountMesurer } from "mesurer-solid"
59
- import { arrange, context, layoutGuides, screenshot } from "mesurer-solid/plugins"
59
+ import { context, edit, layoutGuides, screenshot } from "mesurer-solid/plugins"
60
60
 
61
61
  const mesurer = mountMesurer({
62
62
  agent: true,
63
63
  plugins: [
64
64
  context(),
65
- arrange(),
65
+ edit(),
66
66
  layoutGuides(),
67
67
  screenshot(),
68
68
  ],
69
69
  })
70
70
  ```
71
71
 
72
- The base inspector includes Select, X-ray, Rulers, Typography, Guides, Distance, Settings, plugin hosting, direct text editing, and the low-level inspection API. Color Picker uses application-local capture when `window.__MESURER_HOST__.captureScreenshot` is available; other supported browser hosts use an operational `EyeDropper`. A successful sample is copied to the clipboard using `colorPickerClickFormat`.
72
+ The base inspector includes Select, X-ray, Rulers, Typography, Guides, Distance, Settings, plugin hosting, direct text editing, and the low-level inspection API. The toolbar groups those controls into Select and Edit. Typography stays read-only in Select; Edit owns movement and direct text/style changes. Color Picker uses application-local capture when `window.__MESURER_HOST__.captureScreenshot` is available; other supported browser hosts use an operational `EyeDropper`. A successful sample is copied to the clipboard using `colorPickerClickFormat`.
73
73
 
74
74
  `mesurer-solid/plugins` also exports the built-in factories for lower-level composition. Normal mounts already include the built-ins. Use `excludeBuiltins` with names such as `"xray"`, `"typography"`, and `"colorPicker"` when a mount should omit one.
75
75
 
@@ -95,8 +95,8 @@ Programmatic injection reuses an existing connected instance by default. Lifecyc
95
95
  - Measure distance and pairwise multi-selection spacing.
96
96
  - Use X-ray, guides, rulers, and persisted settings.
97
97
  - Add page-scoped columns, rows, or pixel grids with the optional `layoutGuides()` plugin. Guide edits participate in plugin undo/redo, and Context includes the current page's saved guides with their visibility state.
98
- - Inspect Typography and preview reversible direct copy/style changes.
99
- - Arrange selected UI into a Desired position without changing source.
98
+ - Inspect rendered typography in Select. Edit previews reversible direct copy and style changes.
99
+ - Use Edit to move selected UI and change direct text, typography, and text color without changing source.
100
100
  - Capture page regions through the optional Screenshot plugin. It selects native host capture, the Chromium extension adapter, or browser display capture internally.
101
101
  - Read selection, measurements, guides, annotations, layout, styles, and saved human intent through Context and agent APIs.
102
102
  - Keep saved annotations across same-tab reloads and conservatively rebind them to their original DOM targets; markers, cards, and ownership evidence stay attached through scrolling, repeated-note markers stay local, Add Note remains available while a note is open, and cards/composers occlude Select hover and selection chrome.
@@ -104,11 +104,11 @@ Programmatic injection reuses an existing connected instance by default. Lifecyc
104
104
  - Compact the toolbar to active controls without changing tool state or order.
105
105
  - Choose System, Light, or Dark appearance while keeping the same theme across isolated and document-backed Mesurer UI.
106
106
 
107
- Arrange is not a toolbar mode. It can be activated before a selection exists and enables Select automatically. Turning Arrange off leaves Select active; turning Select off exits Arrange. Escape clears the current Select or Arrange selection first. A second Escape with nothing selected exits Select, or exits both Arrange and Select. Each moved Arrange target has a Reset position control, and the Arrange menu can reset all positions on the current page.
107
+ Use `1` for Select and `2` for Edit. Select contains inspection tools. Edit owns movement and direct text/style changes. Context and Codex remain visible in both modes. The grouped toolbar changes modes in 150 ms. `Shift+A` still enters Edit for compatibility with existing Arrange workflows.
108
108
 
109
109
  Toolbar dragging starts after the pointer crosses the drag threshold. Dragging from Settings, Guide, or plugin triggers closes the open menu or panel. Pointer activity inside menus, dialogs, form controls, editable regions, and sliders does not drag the toolbar.
110
110
 
111
- Select and agent point inspection use the same rendered hit-test path. They can target SVG and visible `pointer-events:none` descendants instead of collapsing those descendants to an interactive ancestor. Open shadow roots are traversed; closed shadow roots remain browser-owned boundaries. Context and annotations accept the same SVG targets. Arrange and direct text editing only mutate HTML elements.
111
+ Select and agent point inspection use the same rendered hit-test path. They can target SVG and visible `pointer-events:none` descendants instead of collapsing those descendants to an interactive ancestor. Open shadow roots are traversed; closed shadow roots remain browser-owned boundaries. Context and annotations accept the same SVG targets. Edit movement and direct text editing only mutate HTML elements.
112
112
 
113
113
  Persisted workspace evidence is page-scoped by route, including sorted query parameters. In-tab navigation swaps the current page workspace without carrying page-owned guides or selection state to another route. Toolbar placement remains tab-session UI and survives those route changes and reloads.
114
114
 
@@ -116,7 +116,7 @@ Direct text editing respects native editing boundaries. Descendants of an editab
116
116
 
117
117
  While direct text editing is active, Mesurer keeps one visible edit ring, keeps the selected dimensions pill and Typography separated by the same `2px` rendered gap when the card is below the source, and keeps Typography stationary during ordinary pointer movement. The selection-adjacent Add Note button is suppressed only for the active edit and returns when the editor closes; saved annotation markers and panels remain available.
118
118
 
119
- Mesurer previews text, styles, and Arrange transforms only while it still owns the value it applied. Host-authored changes take ownership and are preserved through undo/redo, Live review, cleanup, and disposal.
119
+ Mesurer previews text, styles, and Edit movement only while it still owns the value it applied. Host-authored changes take ownership and are preserved through undo/redo, Live review, cleanup, and disposal.
120
120
 
121
121
  ## Appearance
122
122
 
@@ -135,6 +135,8 @@ Global shortcuts are enabled by default. Turn them off from **Settings > General
135
135
  | Shortcut | Action |
136
136
  | --- | --- |
137
137
  | `M` | Toggle Mesurer |
138
+ | `1` | Select mode |
139
+ | `2` | Edit mode |
138
140
  | `S` | Select |
139
141
  | `X` | X-ray |
140
142
  | `P` | Color Picker when supported |
@@ -145,7 +147,7 @@ Global shortcuts are enabled by default. Turn them off from **Settings > General
145
147
  | `H` / `V` | Horizontal / vertical guide orientation |
146
148
  | `Alt` / `Option` | Distance overlay |
147
149
  | `Cmd/Ctrl + ,` | Settings |
148
- | `Shift + A` | Arrange |
150
+ | `Shift + A` | Edit compatibility shortcut |
149
151
  | `Shift + S` | Screenshot |
150
152
  | `C` | Copy Context |
151
153
  | `Shift + C` | Copy Selection |
@@ -155,7 +157,7 @@ Plugin shortcuts are active only when their plugin is mounted and enabled.
155
157
 
156
158
  ## Agent integration
157
159
 
158
- Enable `agent: true` to expose the full browser agent object through `mesurer.agent` and `window.__MESURER__`. The mounted instance also mirrors the high-level Context, Arrange, and text-intent methods.
160
+ Enable `agent: true` to expose the full browser agent object through `mesurer.agent` and `window.__MESURER__`. The mounted instance also mirrors high-level Context, Edit movement, and text-intent methods. The movement method names retain `Arrange` for compatibility.
159
161
 
160
162
  ```ts
161
163
  const workspace = await mesurer.context()
@@ -168,7 +170,7 @@ Install the portable Agent Skill with:
168
170
  npx --yes --package=mesurer-solid mesurer-skill install
169
171
  ```
170
172
 
171
- The skill preserves existing human state, reads Arrange/text/annotation intent before source changes, and verifies the real Live result after implementation.
173
+ The skill preserves existing human state, reads Edit movement, text, and annotation intent before source changes, and verifies the real Live result after implementation.
172
174
 
173
175
  See [Agent integration](https://github.com/jhomra21/mesurer-solid/blob/main/packages/mesurer/AGENT_INTEGRATION.md).
174
176
 
@@ -189,7 +191,7 @@ See [Queue Context feedback to Codex](https://github.com/jhomra21/mesurer-solid/
189
191
  - [Capabilities](https://github.com/jhomra21/mesurer-solid/blob/main/docs/CAPABILITIES.md)
190
192
  - [Getting started](https://github.com/jhomra21/mesurer-solid/blob/main/docs/GETTING_STARTED.md)
191
193
  - [Direct text editing and Typography](https://github.com/jhomra21/mesurer-solid/blob/main/docs/TEXT_EDITING.md)
192
- - [Arrange](https://github.com/jhomra21/mesurer-solid/blob/main/docs/ARRANGE.md) and [Layout Guides](https://github.com/jhomra21/mesurer-solid/blob/main/docs/LAYOUT_GUIDES.md)
194
+ - [Edit](https://github.com/jhomra21/mesurer-solid/blob/main/docs/EDIT.md) and [Layout Guides](https://github.com/jhomra21/mesurer-solid/blob/main/docs/LAYOUT_GUIDES.md)
193
195
  - [Measurements and distance geometry](https://github.com/jhomra21/mesurer-solid/blob/main/docs/MEASUREMENTS.md)
194
196
  - [Screenshots](https://github.com/jhomra21/mesurer-solid/blob/main/docs/SCREENSHOTS.md)
195
197
  - [Electron renderer example](https://github.com/jhomra21/mesurer-solid/blob/main/examples/electron-renderer/README.md)
package/dist/arrange.d.ts CHANGED
@@ -90,3 +90,26 @@ export type MesurerArrangeService = {
90
90
  clear(): Promise<void>;
91
91
  };
92
92
  export declare const arrange: () => MesurerPlugin;
93
+ /**
94
+ * Canonical public name for Mesurer's page-editing plugin.
95
+ *
96
+ * The underlying Arrange ids remain stable so persisted layouts, agent data,
97
+ * and existing integrations continue to work across the rename.
98
+ */
99
+ export declare const edit: () => MesurerPlugin;
100
+ export declare const MESURER_EDIT_ACTIVE_STATE_ID: string;
101
+ export declare const MESURER_EDIT_PLUGIN_ID: string;
102
+ export declare const MESURER_EDIT_SERVICE_ID: string;
103
+ export declare const MESURER_EDIT_SETTINGS_STATE_ID: string;
104
+ export declare const MESURER_EDIT_STATE_ID: string;
105
+ export type EditRect = ArrangeRect;
106
+ export type EditOffset = ArrangeOffset;
107
+ export type EditElementFingerprint = ArrangeElementFingerprint;
108
+ export type EditTarget = ArrangeTarget;
109
+ export type EditIntent = ArrangeIntent;
110
+ export type EditPresentation = ArrangePresentation;
111
+ export type EditReviewTarget = ArrangeReviewTarget;
112
+ export type EditReview = ArrangeReview;
113
+ export type EditCapturePlan = ArrangeCapturePlan;
114
+ export type MesurerEditSettings = MesurerArrangeSettings;
115
+ export type MesurerEditService = MesurerArrangeService;
package/dist/core.d.ts CHANGED
@@ -22,6 +22,7 @@ export type ToolMenuContribution = {
22
22
  label?: string;
23
23
  items: ToolMenuItemContribution[];
24
24
  };
25
+ export type ToolbarMode = "select" | "edit" | "always";
25
26
  export type ToolContribution = {
26
27
  id: string;
27
28
  label: string;
@@ -29,6 +30,8 @@ export type ToolContribution = {
29
30
  command: string;
30
31
  order?: number;
31
32
  builtin?: string;
33
+ toolbarMode?: ToolbarMode;
34
+ modeSwitch?: boolean;
32
35
  icon?: {
33
36
  viewBox?: string;
34
37
  paths: string[];
@@ -138,6 +141,8 @@ export type MesurerPluginDescription = {
138
141
  command: string;
139
142
  order?: number;
140
143
  builtin?: string;
144
+ toolbarMode?: ToolbarMode;
145
+ modeSwitch?: boolean;
141
146
  }>;
142
147
  settings: SettingsDescription[];
143
148
  overlays: OverlayContribution[];
package/dist/index.d.ts CHANGED
@@ -254,5 +254,5 @@ export type { ArrangeCapturePlan, ArrangeIntent, ArrangeOffset, ArrangePresentat
254
254
  export { captureMesurerContext, copyTextToClipboard, createMesurerCapturePlan, formatMesurerContext, reviewMesurerAnnotation, } from "./context";
255
255
  export type { MesurerAnnotation, MesurerAnnotationBaseline, MesurerAnnotationTarget, MesurerCapturePlanV1, MesurerContextDistance, MesurerContextEdges, MesurerContextGuide, MesurerContextLayoutGuide, MesurerContextMeasurement, MesurerContextRect, MesurerContextRequest, MesurerContextTarget, MesurerContextV1, MesurerElementFingerprint, MesurerElementInspection, MesurerReviewChange, MesurerReviewMetricChange, MesurerReviewPresenceChange, MesurerReviewV1, } from "./context";
256
256
  export { createMesurerPluginHost, createMesurerRuntime, defineMesurerPlugin } from "./core";
257
- export type { CommandHandler as MesurerCommandHandler, MesurerPlugin, MesurerPluginContext, MesurerPluginDescription, MesurerPluginHost, OverlayContribution, Registration as MesurerRegistration, SettingsContribution, StateSliceDefinition, ToolContribution, } from "./core";
257
+ export type { CommandHandler as MesurerCommandHandler, MesurerPlugin, MesurerPluginContext, MesurerPluginDescription, MesurerPluginHost, OverlayContribution, Registration as MesurerRegistration, SettingsContribution, StateSliceDefinition, ToolContribution, ToolbarMode, } from "./core";
258
258
  export type { MesurerHostLayerMode } from "./host-layer";