mesurer 0.1.5 → 0.2.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.
package/dist/index.d.cts CHANGED
@@ -111,12 +111,24 @@ type DistanceOverlay = {
111
111
  y: number;
112
112
  value: number;
113
113
  } | null;
114
+ extraHorizontals?: Array<{
115
+ x1: number;
116
+ x2: number;
117
+ y: number;
118
+ value: number;
119
+ }>;
114
120
  vertical: {
115
121
  y1: number;
116
122
  y2: number;
117
123
  x: number;
118
124
  value: number;
119
125
  } | null;
126
+ extraVerticals?: Array<{
127
+ y1: number;
128
+ y2: number;
129
+ x: number;
130
+ value: number;
131
+ }>;
120
132
  connectors: Array<{
121
133
  x1: number;
122
134
  y1: number;
@@ -133,9 +145,25 @@ type TextStyleSettings = {
133
145
  color: string;
134
146
  };
135
147
 
148
+ type LayoutGuideKind = "columns" | "rows" | "grid";
149
+ type LayoutGuideAlign = "stretch" | "min" | "center" | "max";
150
+ type LayoutGuide = {
151
+ id: string;
152
+ kind: LayoutGuideKind;
153
+ visible: boolean;
154
+ color: string;
155
+ opacity: number;
156
+ count: number;
157
+ size: number;
158
+ gutter: number;
159
+ offset: number;
160
+ align: LayoutGuideAlign;
161
+ };
162
+
136
163
  declare const MESURER_STORAGE_VERSION = 2;
137
164
  type GuidePattern = "solid" | "dashed" | "dotted";
138
165
  type InfoCardMode = "hover" | "click";
166
+ type ThemeMode = "system" | "light" | "dark";
139
167
  type GuideStyle = {
140
168
  opacity: number;
141
169
  width: number;
@@ -153,6 +181,10 @@ type ScreenshotSettings = {
153
181
  };
154
182
  type MesurerStoredSettings = {
155
183
  lastToolMode?: PersistentToolMode;
184
+ toolbarPosition?: {
185
+ x: number;
186
+ y: number;
187
+ };
156
188
  highlightColor?: string;
157
189
  guideColor?: string;
158
190
  arrowColor?: string;
@@ -170,17 +202,20 @@ type MesurerStoredSettings = {
170
202
  infoCardMode?: InfoCardMode;
171
203
  persistOnReload?: boolean;
172
204
  shortcutsEnabled?: boolean;
205
+ theme?: ThemeMode;
173
206
  guideStyle?: Partial<GuideStyle>;
174
207
  rulerSettings?: Partial<RulerSettings>;
175
208
  screenshotSettings?: Partial<ScreenshotSettings>;
176
209
  textStyle?: Partial<TextStyleSettings>;
177
210
  };
178
- type MesurerStoredWorkspace = {
211
+ type MesurerSessionChrome = {
179
212
  enabled: boolean;
180
213
  xrayVisible: boolean;
181
214
  toolMode: ToolMode;
182
215
  rulersVisible: boolean;
183
216
  guideOrientation: "vertical" | "horizontal";
217
+ };
218
+ type MesurerPageArtifacts = {
184
219
  guides: Guide[];
185
220
  selectedGuideIds: string[];
186
221
  arrows: Arrow[];
@@ -193,10 +228,16 @@ type MesurerStoredWorkspace = {
193
228
  activeMeasurement: Measurement | null;
194
229
  heldDistances: DistanceOverlay[];
195
230
  comments?: CommentThread[];
231
+ layoutGuides?: LayoutGuide[];
232
+ };
233
+ type MesurerStoredWorkspace = MesurerSessionChrome & MesurerPageArtifacts;
234
+ type PagedWorkspaceStore = MesurerSessionChrome & {
235
+ pages: Record<string, MesurerPageArtifacts | null>;
196
236
  };
237
+ declare const isPagedWorkspaceStore: (value: unknown) => value is PagedWorkspaceStore;
197
238
  type MesurerPersistenceSnapshot = {
198
239
  settings: MesurerStoredSettings;
199
- workspace: MesurerStoredWorkspace | null;
240
+ workspace: MesurerStoredWorkspace | PagedWorkspaceStore | null;
200
241
  };
201
242
  type PersistenceChangeSource = {
202
243
  settings?: boolean;
@@ -205,7 +246,7 @@ type PersistenceChangeSource = {
205
246
  type MesurerPersistence = {
206
247
  load: () => MesurerPersistenceSnapshot | null;
207
248
  saveSettings: (settings: MesurerStoredSettings) => void;
208
- saveWorkspace: (workspace: MesurerStoredWorkspace) => void;
249
+ saveWorkspace: (workspace: MesurerStoredWorkspace | PagedWorkspaceStore) => void;
209
250
  clearWorkspace: () => void;
210
251
  clearSettings: () => void;
211
252
  subscribe?: (listener: (snapshot: MesurerPersistenceSnapshot | null, source?: PersistenceChangeSource) => void) => () => void;
@@ -214,6 +255,7 @@ type MesurerPersistence = {
214
255
  declare const normalizeStoredSettings: (value: unknown) => MesurerStoredSettings;
215
256
  declare const normalizeStoredWorkspace: (value: unknown) => MesurerStoredWorkspace | null;
216
257
  declare const createLocalStoragePersistence: (ownerWindow: Window, workspaceKey: string, settingsKey?: string, legacyKey?: string) => MesurerPersistence;
258
+ declare const createPageScopedPersistence: (base: MesurerPersistence, getPageKey: () => string) => MesurerPersistence;
217
259
 
218
260
  type MesurerFeatures = {
219
261
  screenshot?: boolean;
@@ -229,7 +271,9 @@ type MesurerProps = {
229
271
  hoverHighlightEnabled?: boolean;
230
272
  layoutDetailsEnabled?: boolean;
231
273
  persistOnReload?: boolean;
274
+ persistSession?: boolean;
232
275
  shortcutsEnabled?: boolean;
276
+ theme?: ThemeMode;
233
277
  portalTarget?: HTMLElement | ShadowRoot;
234
278
  persistKey?: string;
235
279
  colorPickerFormats?: ColorPickerFormat[];
@@ -270,10 +314,11 @@ type MesurerProps = {
270
314
  activeMeasurement?: MesurerStoredWorkspace["activeMeasurement"];
271
315
  heldDistances?: MesurerStoredWorkspace["heldDistances"];
272
316
  comments?: CommentThread[];
317
+ layoutGuides?: MesurerStoredWorkspace["layoutGuides"];
273
318
  };
274
319
  };
275
320
 
276
- declare function Mesurer({ highlightColor, guideColor, arrowColor, guideHighlightEnabled, hoverHighlightEnabled, layoutDetailsEnabled, persistOnReload, shortcutsEnabled, portalTarget, persistKey, colorPickerFormats, colorPickerClickFormat, snapEnabled, snapGuidesEnabled, snapArrowsEnabled, arrowClickToPlace, selectNewGuideEnabled, multiMeasureEnabled, guideStyle, rulerSettings, textStyle, persistence, onPersistenceError, captureVisibleTab, features, initialState, }: MesurerProps): react_jsx_runtime.JSX.Element | null;
321
+ declare function Mesurer({ highlightColor, guideColor, arrowColor, guideHighlightEnabled, hoverHighlightEnabled, layoutDetailsEnabled, persistOnReload, persistSession, shortcutsEnabled, theme, portalTarget, persistKey, colorPickerFormats, colorPickerClickFormat, snapEnabled, snapGuidesEnabled, snapArrowsEnabled, arrowClickToPlace, selectNewGuideEnabled, multiMeasureEnabled, guideStyle, rulerSettings, textStyle, persistence, onPersistenceError, captureVisibleTab, features, initialState, }: MesurerProps): react_jsx_runtime.JSX.Element | null;
277
322
 
278
323
  type TypographyRow = {
279
324
  label: string;
@@ -312,4 +357,4 @@ type TextInspectorOptions = {
312
357
  declare const createTextInspector: (options?: TextInspectorOptions, legacy?: boolean) => TextInspectorAPI;
313
358
  declare const TextInspector: TextInspectorAPI;
314
359
 
315
- export { type Arrow, type ColorPickerFormat, type ColorSample, type GuidePattern, type GuideStyle, MESURER_STORAGE_VERSION, Mesurer, type MesurerFeatures, type MesurerPersistence, type MesurerPersistenceSnapshot, type MesurerProps, type MesurerStoredSettings, type MesurerStoredWorkspace, type PenStroke, type Point, type RulerSettings, type ScreenshotSettings, type TextAnnotation, type TextFont, TextInspector, type TextInspectorAPI, type TextInspectorOptions, type TextStyleSettings, type TypographyInfo, type TypographyRow, createLocalStoragePersistence, createTextInspector, normalizeStoredSettings, normalizeStoredWorkspace };
360
+ export { type Arrow, type ColorPickerFormat, type ColorSample, type GuidePattern, type GuideStyle, MESURER_STORAGE_VERSION, Mesurer, type MesurerFeatures, type MesurerPageArtifacts, type MesurerPersistence, type MesurerPersistenceSnapshot, type MesurerProps, type MesurerSessionChrome, type MesurerStoredSettings, type MesurerStoredWorkspace, type PagedWorkspaceStore, type PenStroke, type Point, type RulerSettings, type ScreenshotSettings, type TextAnnotation, type TextFont, TextInspector, type TextInspectorAPI, type TextInspectorOptions, type TextStyleSettings, type TypographyInfo, type TypographyRow, createLocalStoragePersistence, createPageScopedPersistence, createTextInspector, isPagedWorkspaceStore, normalizeStoredSettings, normalizeStoredWorkspace };
package/dist/index.d.ts CHANGED
@@ -111,12 +111,24 @@ type DistanceOverlay = {
111
111
  y: number;
112
112
  value: number;
113
113
  } | null;
114
+ extraHorizontals?: Array<{
115
+ x1: number;
116
+ x2: number;
117
+ y: number;
118
+ value: number;
119
+ }>;
114
120
  vertical: {
115
121
  y1: number;
116
122
  y2: number;
117
123
  x: number;
118
124
  value: number;
119
125
  } | null;
126
+ extraVerticals?: Array<{
127
+ y1: number;
128
+ y2: number;
129
+ x: number;
130
+ value: number;
131
+ }>;
120
132
  connectors: Array<{
121
133
  x1: number;
122
134
  y1: number;
@@ -133,9 +145,25 @@ type TextStyleSettings = {
133
145
  color: string;
134
146
  };
135
147
 
148
+ type LayoutGuideKind = "columns" | "rows" | "grid";
149
+ type LayoutGuideAlign = "stretch" | "min" | "center" | "max";
150
+ type LayoutGuide = {
151
+ id: string;
152
+ kind: LayoutGuideKind;
153
+ visible: boolean;
154
+ color: string;
155
+ opacity: number;
156
+ count: number;
157
+ size: number;
158
+ gutter: number;
159
+ offset: number;
160
+ align: LayoutGuideAlign;
161
+ };
162
+
136
163
  declare const MESURER_STORAGE_VERSION = 2;
137
164
  type GuidePattern = "solid" | "dashed" | "dotted";
138
165
  type InfoCardMode = "hover" | "click";
166
+ type ThemeMode = "system" | "light" | "dark";
139
167
  type GuideStyle = {
140
168
  opacity: number;
141
169
  width: number;
@@ -153,6 +181,10 @@ type ScreenshotSettings = {
153
181
  };
154
182
  type MesurerStoredSettings = {
155
183
  lastToolMode?: PersistentToolMode;
184
+ toolbarPosition?: {
185
+ x: number;
186
+ y: number;
187
+ };
156
188
  highlightColor?: string;
157
189
  guideColor?: string;
158
190
  arrowColor?: string;
@@ -170,17 +202,20 @@ type MesurerStoredSettings = {
170
202
  infoCardMode?: InfoCardMode;
171
203
  persistOnReload?: boolean;
172
204
  shortcutsEnabled?: boolean;
205
+ theme?: ThemeMode;
173
206
  guideStyle?: Partial<GuideStyle>;
174
207
  rulerSettings?: Partial<RulerSettings>;
175
208
  screenshotSettings?: Partial<ScreenshotSettings>;
176
209
  textStyle?: Partial<TextStyleSettings>;
177
210
  };
178
- type MesurerStoredWorkspace = {
211
+ type MesurerSessionChrome = {
179
212
  enabled: boolean;
180
213
  xrayVisible: boolean;
181
214
  toolMode: ToolMode;
182
215
  rulersVisible: boolean;
183
216
  guideOrientation: "vertical" | "horizontal";
217
+ };
218
+ type MesurerPageArtifacts = {
184
219
  guides: Guide[];
185
220
  selectedGuideIds: string[];
186
221
  arrows: Arrow[];
@@ -193,10 +228,16 @@ type MesurerStoredWorkspace = {
193
228
  activeMeasurement: Measurement | null;
194
229
  heldDistances: DistanceOverlay[];
195
230
  comments?: CommentThread[];
231
+ layoutGuides?: LayoutGuide[];
232
+ };
233
+ type MesurerStoredWorkspace = MesurerSessionChrome & MesurerPageArtifacts;
234
+ type PagedWorkspaceStore = MesurerSessionChrome & {
235
+ pages: Record<string, MesurerPageArtifacts | null>;
196
236
  };
237
+ declare const isPagedWorkspaceStore: (value: unknown) => value is PagedWorkspaceStore;
197
238
  type MesurerPersistenceSnapshot = {
198
239
  settings: MesurerStoredSettings;
199
- workspace: MesurerStoredWorkspace | null;
240
+ workspace: MesurerStoredWorkspace | PagedWorkspaceStore | null;
200
241
  };
201
242
  type PersistenceChangeSource = {
202
243
  settings?: boolean;
@@ -205,7 +246,7 @@ type PersistenceChangeSource = {
205
246
  type MesurerPersistence = {
206
247
  load: () => MesurerPersistenceSnapshot | null;
207
248
  saveSettings: (settings: MesurerStoredSettings) => void;
208
- saveWorkspace: (workspace: MesurerStoredWorkspace) => void;
249
+ saveWorkspace: (workspace: MesurerStoredWorkspace | PagedWorkspaceStore) => void;
209
250
  clearWorkspace: () => void;
210
251
  clearSettings: () => void;
211
252
  subscribe?: (listener: (snapshot: MesurerPersistenceSnapshot | null, source?: PersistenceChangeSource) => void) => () => void;
@@ -214,6 +255,7 @@ type MesurerPersistence = {
214
255
  declare const normalizeStoredSettings: (value: unknown) => MesurerStoredSettings;
215
256
  declare const normalizeStoredWorkspace: (value: unknown) => MesurerStoredWorkspace | null;
216
257
  declare const createLocalStoragePersistence: (ownerWindow: Window, workspaceKey: string, settingsKey?: string, legacyKey?: string) => MesurerPersistence;
258
+ declare const createPageScopedPersistence: (base: MesurerPersistence, getPageKey: () => string) => MesurerPersistence;
217
259
 
218
260
  type MesurerFeatures = {
219
261
  screenshot?: boolean;
@@ -229,7 +271,9 @@ type MesurerProps = {
229
271
  hoverHighlightEnabled?: boolean;
230
272
  layoutDetailsEnabled?: boolean;
231
273
  persistOnReload?: boolean;
274
+ persistSession?: boolean;
232
275
  shortcutsEnabled?: boolean;
276
+ theme?: ThemeMode;
233
277
  portalTarget?: HTMLElement | ShadowRoot;
234
278
  persistKey?: string;
235
279
  colorPickerFormats?: ColorPickerFormat[];
@@ -270,10 +314,11 @@ type MesurerProps = {
270
314
  activeMeasurement?: MesurerStoredWorkspace["activeMeasurement"];
271
315
  heldDistances?: MesurerStoredWorkspace["heldDistances"];
272
316
  comments?: CommentThread[];
317
+ layoutGuides?: MesurerStoredWorkspace["layoutGuides"];
273
318
  };
274
319
  };
275
320
 
276
- declare function Mesurer({ highlightColor, guideColor, arrowColor, guideHighlightEnabled, hoverHighlightEnabled, layoutDetailsEnabled, persistOnReload, shortcutsEnabled, portalTarget, persistKey, colorPickerFormats, colorPickerClickFormat, snapEnabled, snapGuidesEnabled, snapArrowsEnabled, arrowClickToPlace, selectNewGuideEnabled, multiMeasureEnabled, guideStyle, rulerSettings, textStyle, persistence, onPersistenceError, captureVisibleTab, features, initialState, }: MesurerProps): react_jsx_runtime.JSX.Element | null;
321
+ declare function Mesurer({ highlightColor, guideColor, arrowColor, guideHighlightEnabled, hoverHighlightEnabled, layoutDetailsEnabled, persistOnReload, persistSession, shortcutsEnabled, theme, portalTarget, persistKey, colorPickerFormats, colorPickerClickFormat, snapEnabled, snapGuidesEnabled, snapArrowsEnabled, arrowClickToPlace, selectNewGuideEnabled, multiMeasureEnabled, guideStyle, rulerSettings, textStyle, persistence, onPersistenceError, captureVisibleTab, features, initialState, }: MesurerProps): react_jsx_runtime.JSX.Element | null;
277
322
 
278
323
  type TypographyRow = {
279
324
  label: string;
@@ -312,4 +357,4 @@ type TextInspectorOptions = {
312
357
  declare const createTextInspector: (options?: TextInspectorOptions, legacy?: boolean) => TextInspectorAPI;
313
358
  declare const TextInspector: TextInspectorAPI;
314
359
 
315
- export { type Arrow, type ColorPickerFormat, type ColorSample, type GuidePattern, type GuideStyle, MESURER_STORAGE_VERSION, Mesurer, type MesurerFeatures, type MesurerPersistence, type MesurerPersistenceSnapshot, type MesurerProps, type MesurerStoredSettings, type MesurerStoredWorkspace, type PenStroke, type Point, type RulerSettings, type ScreenshotSettings, type TextAnnotation, type TextFont, TextInspector, type TextInspectorAPI, type TextInspectorOptions, type TextStyleSettings, type TypographyInfo, type TypographyRow, createLocalStoragePersistence, createTextInspector, normalizeStoredSettings, normalizeStoredWorkspace };
360
+ export { type Arrow, type ColorPickerFormat, type ColorSample, type GuidePattern, type GuideStyle, MESURER_STORAGE_VERSION, Mesurer, type MesurerFeatures, type MesurerPageArtifacts, type MesurerPersistence, type MesurerPersistenceSnapshot, type MesurerProps, type MesurerSessionChrome, type MesurerStoredSettings, type MesurerStoredWorkspace, type PagedWorkspaceStore, type PenStroke, type Point, type RulerSettings, type ScreenshotSettings, type TextAnnotation, type TextFont, TextInspector, type TextInspectorAPI, type TextInspectorOptions, type TextStyleSettings, type TypographyInfo, type TypographyRow, createLocalStoragePersistence, createPageScopedPersistence, createTextInspector, isPagedWorkspaceStore, normalizeStoredSettings, normalizeStoredWorkspace };