mesurer 0.1.4 → 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/CHANGELOG.md +23 -0
- package/PRIVACY.md +9 -1
- package/README.md +12 -2
- package/dist/index.cjs +16385 -10944
- package/dist/index.d.cts +119 -7
- package/dist/index.d.ts +119 -7
- package/dist/index.js +16374 -10930
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -37,6 +37,34 @@ type TextAnnotation = {
|
|
|
37
37
|
rotation?: number;
|
|
38
38
|
boxWidth?: number;
|
|
39
39
|
};
|
|
40
|
+
type CommentMessage = {
|
|
41
|
+
id: string;
|
|
42
|
+
role: "user";
|
|
43
|
+
text: string;
|
|
44
|
+
createdAt: number;
|
|
45
|
+
};
|
|
46
|
+
type CommentTarget = {
|
|
47
|
+
selector: string;
|
|
48
|
+
framePath?: string[];
|
|
49
|
+
frameShadowPaths?: string[][];
|
|
50
|
+
shadowPath?: string[];
|
|
51
|
+
tagName: string;
|
|
52
|
+
textSnippet: string;
|
|
53
|
+
htmlPreview: string;
|
|
54
|
+
attributes: Record<string, string>;
|
|
55
|
+
styles: string;
|
|
56
|
+
rect: Rect;
|
|
57
|
+
documentPoint: Point;
|
|
58
|
+
anchor?: Point;
|
|
59
|
+
};
|
|
60
|
+
type CommentThread = {
|
|
61
|
+
id: string;
|
|
62
|
+
target: CommentTarget;
|
|
63
|
+
messages: CommentMessage[];
|
|
64
|
+
status: "open" | "resolved";
|
|
65
|
+
createdAt: number;
|
|
66
|
+
updatedAt: number;
|
|
67
|
+
};
|
|
40
68
|
type Rect = {
|
|
41
69
|
left: number;
|
|
42
70
|
top: number;
|
|
@@ -66,24 +94,41 @@ type Guide = {
|
|
|
66
94
|
};
|
|
67
95
|
type DistanceOverlay = {
|
|
68
96
|
id: string;
|
|
97
|
+
guideIds?: Array<string | null>;
|
|
69
98
|
rectA: Rect;
|
|
70
99
|
rectB: Rect;
|
|
71
100
|
normalizedRectA: NormalizedRect;
|
|
72
101
|
normalizedRectB: NormalizedRect;
|
|
73
102
|
elementRefA?: Element | null;
|
|
74
103
|
elementRefB?: Element | null;
|
|
104
|
+
pinTargetRef?: Element | null;
|
|
105
|
+
pinTargetRect?: Rect | null;
|
|
106
|
+
pinCursor?: Point | null;
|
|
107
|
+
pinCursorOffset?: Point | null;
|
|
75
108
|
horizontal: {
|
|
76
109
|
x1: number;
|
|
77
110
|
x2: number;
|
|
78
111
|
y: number;
|
|
79
112
|
value: number;
|
|
80
113
|
} | null;
|
|
114
|
+
extraHorizontals?: Array<{
|
|
115
|
+
x1: number;
|
|
116
|
+
x2: number;
|
|
117
|
+
y: number;
|
|
118
|
+
value: number;
|
|
119
|
+
}>;
|
|
81
120
|
vertical: {
|
|
82
121
|
y1: number;
|
|
83
122
|
y2: number;
|
|
84
123
|
x: number;
|
|
85
124
|
value: number;
|
|
86
125
|
} | null;
|
|
126
|
+
extraVerticals?: Array<{
|
|
127
|
+
y1: number;
|
|
128
|
+
y2: number;
|
|
129
|
+
x: number;
|
|
130
|
+
value: number;
|
|
131
|
+
}>;
|
|
87
132
|
connectors: Array<{
|
|
88
133
|
x1: number;
|
|
89
134
|
y1: number;
|
|
@@ -91,8 +136,8 @@ type DistanceOverlay = {
|
|
|
91
136
|
y2: number;
|
|
92
137
|
}>;
|
|
93
138
|
};
|
|
94
|
-
type ToolMode = "none" | "select" | "selection" | "guides" | "
|
|
95
|
-
type PersistentToolMode = Exclude<ToolMode, "none" | "
|
|
139
|
+
type ToolMode = "none" | "select" | "selection" | "guides" | "xray" | "rulers" | "arrows" | "pen" | "text" | "comments";
|
|
140
|
+
type PersistentToolMode = Exclude<ToolMode, "none" | "xray" | "rulers">;
|
|
96
141
|
|
|
97
142
|
type TextFont = "handwritten" | "code" | "serif" | "sans-serif";
|
|
98
143
|
type TextStyleSettings = {
|
|
@@ -100,8 +145,25 @@ type TextStyleSettings = {
|
|
|
100
145
|
color: string;
|
|
101
146
|
};
|
|
102
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
|
+
|
|
103
163
|
declare const MESURER_STORAGE_VERSION = 2;
|
|
104
164
|
type GuidePattern = "solid" | "dashed" | "dotted";
|
|
165
|
+
type InfoCardMode = "hover" | "click";
|
|
166
|
+
type ThemeMode = "system" | "light" | "dark";
|
|
105
167
|
type GuideStyle = {
|
|
106
168
|
opacity: number;
|
|
107
169
|
width: number;
|
|
@@ -119,6 +181,10 @@ type ScreenshotSettings = {
|
|
|
119
181
|
};
|
|
120
182
|
type MesurerStoredSettings = {
|
|
121
183
|
lastToolMode?: PersistentToolMode;
|
|
184
|
+
toolbarPosition?: {
|
|
185
|
+
x: number;
|
|
186
|
+
y: number;
|
|
187
|
+
};
|
|
122
188
|
highlightColor?: string;
|
|
123
189
|
guideColor?: string;
|
|
124
190
|
arrowColor?: string;
|
|
@@ -133,19 +199,23 @@ type MesurerStoredSettings = {
|
|
|
133
199
|
arrowClickToPlace?: boolean;
|
|
134
200
|
selectNewGuideEnabled?: boolean;
|
|
135
201
|
multiMeasureEnabled?: boolean;
|
|
202
|
+
infoCardMode?: InfoCardMode;
|
|
136
203
|
persistOnReload?: boolean;
|
|
137
204
|
shortcutsEnabled?: boolean;
|
|
205
|
+
theme?: ThemeMode;
|
|
138
206
|
guideStyle?: Partial<GuideStyle>;
|
|
139
207
|
rulerSettings?: Partial<RulerSettings>;
|
|
140
208
|
screenshotSettings?: Partial<ScreenshotSettings>;
|
|
141
209
|
textStyle?: Partial<TextStyleSettings>;
|
|
142
210
|
};
|
|
143
|
-
type
|
|
211
|
+
type MesurerSessionChrome = {
|
|
144
212
|
enabled: boolean;
|
|
145
213
|
xrayVisible: boolean;
|
|
146
214
|
toolMode: ToolMode;
|
|
147
215
|
rulersVisible: boolean;
|
|
148
216
|
guideOrientation: "vertical" | "horizontal";
|
|
217
|
+
};
|
|
218
|
+
type MesurerPageArtifacts = {
|
|
149
219
|
guides: Guide[];
|
|
150
220
|
selectedGuideIds: string[];
|
|
151
221
|
arrows: Arrow[];
|
|
@@ -157,10 +227,17 @@ type MesurerStoredWorkspace = {
|
|
|
157
227
|
measurements: Measurement[];
|
|
158
228
|
activeMeasurement: Measurement | null;
|
|
159
229
|
heldDistances: DistanceOverlay[];
|
|
230
|
+
comments?: CommentThread[];
|
|
231
|
+
layoutGuides?: LayoutGuide[];
|
|
232
|
+
};
|
|
233
|
+
type MesurerStoredWorkspace = MesurerSessionChrome & MesurerPageArtifacts;
|
|
234
|
+
type PagedWorkspaceStore = MesurerSessionChrome & {
|
|
235
|
+
pages: Record<string, MesurerPageArtifacts | null>;
|
|
160
236
|
};
|
|
237
|
+
declare const isPagedWorkspaceStore: (value: unknown) => value is PagedWorkspaceStore;
|
|
161
238
|
type MesurerPersistenceSnapshot = {
|
|
162
239
|
settings: MesurerStoredSettings;
|
|
163
|
-
workspace: MesurerStoredWorkspace | null;
|
|
240
|
+
workspace: MesurerStoredWorkspace | PagedWorkspaceStore | null;
|
|
164
241
|
};
|
|
165
242
|
type PersistenceChangeSource = {
|
|
166
243
|
settings?: boolean;
|
|
@@ -169,7 +246,7 @@ type PersistenceChangeSource = {
|
|
|
169
246
|
type MesurerPersistence = {
|
|
170
247
|
load: () => MesurerPersistenceSnapshot | null;
|
|
171
248
|
saveSettings: (settings: MesurerStoredSettings) => void;
|
|
172
|
-
saveWorkspace: (workspace: MesurerStoredWorkspace) => void;
|
|
249
|
+
saveWorkspace: (workspace: MesurerStoredWorkspace | PagedWorkspaceStore) => void;
|
|
173
250
|
clearWorkspace: () => void;
|
|
174
251
|
clearSettings: () => void;
|
|
175
252
|
subscribe?: (listener: (snapshot: MesurerPersistenceSnapshot | null, source?: PersistenceChangeSource) => void) => () => void;
|
|
@@ -178,6 +255,13 @@ type MesurerPersistence = {
|
|
|
178
255
|
declare const normalizeStoredSettings: (value: unknown) => MesurerStoredSettings;
|
|
179
256
|
declare const normalizeStoredWorkspace: (value: unknown) => MesurerStoredWorkspace | null;
|
|
180
257
|
declare const createLocalStoragePersistence: (ownerWindow: Window, workspaceKey: string, settingsKey?: string, legacyKey?: string) => MesurerPersistence;
|
|
258
|
+
declare const createPageScopedPersistence: (base: MesurerPersistence, getPageKey: () => string) => MesurerPersistence;
|
|
259
|
+
|
|
260
|
+
type MesurerFeatures = {
|
|
261
|
+
screenshot?: boolean;
|
|
262
|
+
rulers?: boolean;
|
|
263
|
+
settings?: boolean;
|
|
264
|
+
};
|
|
181
265
|
|
|
182
266
|
type MesurerProps = {
|
|
183
267
|
highlightColor?: string;
|
|
@@ -187,7 +271,9 @@ type MesurerProps = {
|
|
|
187
271
|
hoverHighlightEnabled?: boolean;
|
|
188
272
|
layoutDetailsEnabled?: boolean;
|
|
189
273
|
persistOnReload?: boolean;
|
|
274
|
+
persistSession?: boolean;
|
|
190
275
|
shortcutsEnabled?: boolean;
|
|
276
|
+
theme?: ThemeMode;
|
|
191
277
|
portalTarget?: HTMLElement | ShadowRoot;
|
|
192
278
|
persistKey?: string;
|
|
193
279
|
colorPickerFormats?: ColorPickerFormat[];
|
|
@@ -204,9 +290,35 @@ type MesurerProps = {
|
|
|
204
290
|
persistence?: MesurerPersistence;
|
|
205
291
|
onPersistenceError?: (error: unknown) => void;
|
|
206
292
|
captureVisibleTab?: () => Promise<Blob>;
|
|
293
|
+
features?: MesurerFeatures;
|
|
294
|
+
initialState?: {
|
|
295
|
+
enabled?: boolean;
|
|
296
|
+
minimized?: boolean;
|
|
297
|
+
toolMode?: ToolMode;
|
|
298
|
+
toolbarPosition?: {
|
|
299
|
+
x: number;
|
|
300
|
+
y: number;
|
|
301
|
+
};
|
|
302
|
+
xrayVisible?: boolean;
|
|
303
|
+
rulersVisible?: boolean;
|
|
304
|
+
guideOrientation?: "vertical" | "horizontal";
|
|
305
|
+
guides?: MesurerStoredWorkspace["guides"];
|
|
306
|
+
selectedGuideIds?: string[];
|
|
307
|
+
arrows?: MesurerStoredWorkspace["arrows"];
|
|
308
|
+
selectedArrowIds?: string[];
|
|
309
|
+
penStrokes?: MesurerStoredWorkspace["penStrokes"];
|
|
310
|
+
selectedPenStrokeIds?: string[];
|
|
311
|
+
textAnnotations?: MesurerStoredWorkspace["textAnnotations"];
|
|
312
|
+
selectedTextIds?: string[];
|
|
313
|
+
measurements?: MesurerStoredWorkspace["measurements"];
|
|
314
|
+
activeMeasurement?: MesurerStoredWorkspace["activeMeasurement"];
|
|
315
|
+
heldDistances?: MesurerStoredWorkspace["heldDistances"];
|
|
316
|
+
comments?: CommentThread[];
|
|
317
|
+
layoutGuides?: MesurerStoredWorkspace["layoutGuides"];
|
|
318
|
+
};
|
|
207
319
|
};
|
|
208
320
|
|
|
209
|
-
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, }: 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;
|
|
210
322
|
|
|
211
323
|
type TypographyRow = {
|
|
212
324
|
label: string;
|
|
@@ -245,4 +357,4 @@ type TextInspectorOptions = {
|
|
|
245
357
|
declare const createTextInspector: (options?: TextInspectorOptions, legacy?: boolean) => TextInspectorAPI;
|
|
246
358
|
declare const TextInspector: TextInspectorAPI;
|
|
247
359
|
|
|
248
|
-
export { type Arrow, type ColorPickerFormat, type ColorSample, type GuidePattern, type GuideStyle, MESURER_STORAGE_VERSION, Mesurer, 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
|
@@ -37,6 +37,34 @@ type TextAnnotation = {
|
|
|
37
37
|
rotation?: number;
|
|
38
38
|
boxWidth?: number;
|
|
39
39
|
};
|
|
40
|
+
type CommentMessage = {
|
|
41
|
+
id: string;
|
|
42
|
+
role: "user";
|
|
43
|
+
text: string;
|
|
44
|
+
createdAt: number;
|
|
45
|
+
};
|
|
46
|
+
type CommentTarget = {
|
|
47
|
+
selector: string;
|
|
48
|
+
framePath?: string[];
|
|
49
|
+
frameShadowPaths?: string[][];
|
|
50
|
+
shadowPath?: string[];
|
|
51
|
+
tagName: string;
|
|
52
|
+
textSnippet: string;
|
|
53
|
+
htmlPreview: string;
|
|
54
|
+
attributes: Record<string, string>;
|
|
55
|
+
styles: string;
|
|
56
|
+
rect: Rect;
|
|
57
|
+
documentPoint: Point;
|
|
58
|
+
anchor?: Point;
|
|
59
|
+
};
|
|
60
|
+
type CommentThread = {
|
|
61
|
+
id: string;
|
|
62
|
+
target: CommentTarget;
|
|
63
|
+
messages: CommentMessage[];
|
|
64
|
+
status: "open" | "resolved";
|
|
65
|
+
createdAt: number;
|
|
66
|
+
updatedAt: number;
|
|
67
|
+
};
|
|
40
68
|
type Rect = {
|
|
41
69
|
left: number;
|
|
42
70
|
top: number;
|
|
@@ -66,24 +94,41 @@ type Guide = {
|
|
|
66
94
|
};
|
|
67
95
|
type DistanceOverlay = {
|
|
68
96
|
id: string;
|
|
97
|
+
guideIds?: Array<string | null>;
|
|
69
98
|
rectA: Rect;
|
|
70
99
|
rectB: Rect;
|
|
71
100
|
normalizedRectA: NormalizedRect;
|
|
72
101
|
normalizedRectB: NormalizedRect;
|
|
73
102
|
elementRefA?: Element | null;
|
|
74
103
|
elementRefB?: Element | null;
|
|
104
|
+
pinTargetRef?: Element | null;
|
|
105
|
+
pinTargetRect?: Rect | null;
|
|
106
|
+
pinCursor?: Point | null;
|
|
107
|
+
pinCursorOffset?: Point | null;
|
|
75
108
|
horizontal: {
|
|
76
109
|
x1: number;
|
|
77
110
|
x2: number;
|
|
78
111
|
y: number;
|
|
79
112
|
value: number;
|
|
80
113
|
} | null;
|
|
114
|
+
extraHorizontals?: Array<{
|
|
115
|
+
x1: number;
|
|
116
|
+
x2: number;
|
|
117
|
+
y: number;
|
|
118
|
+
value: number;
|
|
119
|
+
}>;
|
|
81
120
|
vertical: {
|
|
82
121
|
y1: number;
|
|
83
122
|
y2: number;
|
|
84
123
|
x: number;
|
|
85
124
|
value: number;
|
|
86
125
|
} | null;
|
|
126
|
+
extraVerticals?: Array<{
|
|
127
|
+
y1: number;
|
|
128
|
+
y2: number;
|
|
129
|
+
x: number;
|
|
130
|
+
value: number;
|
|
131
|
+
}>;
|
|
87
132
|
connectors: Array<{
|
|
88
133
|
x1: number;
|
|
89
134
|
y1: number;
|
|
@@ -91,8 +136,8 @@ type DistanceOverlay = {
|
|
|
91
136
|
y2: number;
|
|
92
137
|
}>;
|
|
93
138
|
};
|
|
94
|
-
type ToolMode = "none" | "select" | "selection" | "guides" | "
|
|
95
|
-
type PersistentToolMode = Exclude<ToolMode, "none" | "
|
|
139
|
+
type ToolMode = "none" | "select" | "selection" | "guides" | "xray" | "rulers" | "arrows" | "pen" | "text" | "comments";
|
|
140
|
+
type PersistentToolMode = Exclude<ToolMode, "none" | "xray" | "rulers">;
|
|
96
141
|
|
|
97
142
|
type TextFont = "handwritten" | "code" | "serif" | "sans-serif";
|
|
98
143
|
type TextStyleSettings = {
|
|
@@ -100,8 +145,25 @@ type TextStyleSettings = {
|
|
|
100
145
|
color: string;
|
|
101
146
|
};
|
|
102
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
|
+
|
|
103
163
|
declare const MESURER_STORAGE_VERSION = 2;
|
|
104
164
|
type GuidePattern = "solid" | "dashed" | "dotted";
|
|
165
|
+
type InfoCardMode = "hover" | "click";
|
|
166
|
+
type ThemeMode = "system" | "light" | "dark";
|
|
105
167
|
type GuideStyle = {
|
|
106
168
|
opacity: number;
|
|
107
169
|
width: number;
|
|
@@ -119,6 +181,10 @@ type ScreenshotSettings = {
|
|
|
119
181
|
};
|
|
120
182
|
type MesurerStoredSettings = {
|
|
121
183
|
lastToolMode?: PersistentToolMode;
|
|
184
|
+
toolbarPosition?: {
|
|
185
|
+
x: number;
|
|
186
|
+
y: number;
|
|
187
|
+
};
|
|
122
188
|
highlightColor?: string;
|
|
123
189
|
guideColor?: string;
|
|
124
190
|
arrowColor?: string;
|
|
@@ -133,19 +199,23 @@ type MesurerStoredSettings = {
|
|
|
133
199
|
arrowClickToPlace?: boolean;
|
|
134
200
|
selectNewGuideEnabled?: boolean;
|
|
135
201
|
multiMeasureEnabled?: boolean;
|
|
202
|
+
infoCardMode?: InfoCardMode;
|
|
136
203
|
persistOnReload?: boolean;
|
|
137
204
|
shortcutsEnabled?: boolean;
|
|
205
|
+
theme?: ThemeMode;
|
|
138
206
|
guideStyle?: Partial<GuideStyle>;
|
|
139
207
|
rulerSettings?: Partial<RulerSettings>;
|
|
140
208
|
screenshotSettings?: Partial<ScreenshotSettings>;
|
|
141
209
|
textStyle?: Partial<TextStyleSettings>;
|
|
142
210
|
};
|
|
143
|
-
type
|
|
211
|
+
type MesurerSessionChrome = {
|
|
144
212
|
enabled: boolean;
|
|
145
213
|
xrayVisible: boolean;
|
|
146
214
|
toolMode: ToolMode;
|
|
147
215
|
rulersVisible: boolean;
|
|
148
216
|
guideOrientation: "vertical" | "horizontal";
|
|
217
|
+
};
|
|
218
|
+
type MesurerPageArtifacts = {
|
|
149
219
|
guides: Guide[];
|
|
150
220
|
selectedGuideIds: string[];
|
|
151
221
|
arrows: Arrow[];
|
|
@@ -157,10 +227,17 @@ type MesurerStoredWorkspace = {
|
|
|
157
227
|
measurements: Measurement[];
|
|
158
228
|
activeMeasurement: Measurement | null;
|
|
159
229
|
heldDistances: DistanceOverlay[];
|
|
230
|
+
comments?: CommentThread[];
|
|
231
|
+
layoutGuides?: LayoutGuide[];
|
|
232
|
+
};
|
|
233
|
+
type MesurerStoredWorkspace = MesurerSessionChrome & MesurerPageArtifacts;
|
|
234
|
+
type PagedWorkspaceStore = MesurerSessionChrome & {
|
|
235
|
+
pages: Record<string, MesurerPageArtifacts | null>;
|
|
160
236
|
};
|
|
237
|
+
declare const isPagedWorkspaceStore: (value: unknown) => value is PagedWorkspaceStore;
|
|
161
238
|
type MesurerPersistenceSnapshot = {
|
|
162
239
|
settings: MesurerStoredSettings;
|
|
163
|
-
workspace: MesurerStoredWorkspace | null;
|
|
240
|
+
workspace: MesurerStoredWorkspace | PagedWorkspaceStore | null;
|
|
164
241
|
};
|
|
165
242
|
type PersistenceChangeSource = {
|
|
166
243
|
settings?: boolean;
|
|
@@ -169,7 +246,7 @@ type PersistenceChangeSource = {
|
|
|
169
246
|
type MesurerPersistence = {
|
|
170
247
|
load: () => MesurerPersistenceSnapshot | null;
|
|
171
248
|
saveSettings: (settings: MesurerStoredSettings) => void;
|
|
172
|
-
saveWorkspace: (workspace: MesurerStoredWorkspace) => void;
|
|
249
|
+
saveWorkspace: (workspace: MesurerStoredWorkspace | PagedWorkspaceStore) => void;
|
|
173
250
|
clearWorkspace: () => void;
|
|
174
251
|
clearSettings: () => void;
|
|
175
252
|
subscribe?: (listener: (snapshot: MesurerPersistenceSnapshot | null, source?: PersistenceChangeSource) => void) => () => void;
|
|
@@ -178,6 +255,13 @@ type MesurerPersistence = {
|
|
|
178
255
|
declare const normalizeStoredSettings: (value: unknown) => MesurerStoredSettings;
|
|
179
256
|
declare const normalizeStoredWorkspace: (value: unknown) => MesurerStoredWorkspace | null;
|
|
180
257
|
declare const createLocalStoragePersistence: (ownerWindow: Window, workspaceKey: string, settingsKey?: string, legacyKey?: string) => MesurerPersistence;
|
|
258
|
+
declare const createPageScopedPersistence: (base: MesurerPersistence, getPageKey: () => string) => MesurerPersistence;
|
|
259
|
+
|
|
260
|
+
type MesurerFeatures = {
|
|
261
|
+
screenshot?: boolean;
|
|
262
|
+
rulers?: boolean;
|
|
263
|
+
settings?: boolean;
|
|
264
|
+
};
|
|
181
265
|
|
|
182
266
|
type MesurerProps = {
|
|
183
267
|
highlightColor?: string;
|
|
@@ -187,7 +271,9 @@ type MesurerProps = {
|
|
|
187
271
|
hoverHighlightEnabled?: boolean;
|
|
188
272
|
layoutDetailsEnabled?: boolean;
|
|
189
273
|
persistOnReload?: boolean;
|
|
274
|
+
persistSession?: boolean;
|
|
190
275
|
shortcutsEnabled?: boolean;
|
|
276
|
+
theme?: ThemeMode;
|
|
191
277
|
portalTarget?: HTMLElement | ShadowRoot;
|
|
192
278
|
persistKey?: string;
|
|
193
279
|
colorPickerFormats?: ColorPickerFormat[];
|
|
@@ -204,9 +290,35 @@ type MesurerProps = {
|
|
|
204
290
|
persistence?: MesurerPersistence;
|
|
205
291
|
onPersistenceError?: (error: unknown) => void;
|
|
206
292
|
captureVisibleTab?: () => Promise<Blob>;
|
|
293
|
+
features?: MesurerFeatures;
|
|
294
|
+
initialState?: {
|
|
295
|
+
enabled?: boolean;
|
|
296
|
+
minimized?: boolean;
|
|
297
|
+
toolMode?: ToolMode;
|
|
298
|
+
toolbarPosition?: {
|
|
299
|
+
x: number;
|
|
300
|
+
y: number;
|
|
301
|
+
};
|
|
302
|
+
xrayVisible?: boolean;
|
|
303
|
+
rulersVisible?: boolean;
|
|
304
|
+
guideOrientation?: "vertical" | "horizontal";
|
|
305
|
+
guides?: MesurerStoredWorkspace["guides"];
|
|
306
|
+
selectedGuideIds?: string[];
|
|
307
|
+
arrows?: MesurerStoredWorkspace["arrows"];
|
|
308
|
+
selectedArrowIds?: string[];
|
|
309
|
+
penStrokes?: MesurerStoredWorkspace["penStrokes"];
|
|
310
|
+
selectedPenStrokeIds?: string[];
|
|
311
|
+
textAnnotations?: MesurerStoredWorkspace["textAnnotations"];
|
|
312
|
+
selectedTextIds?: string[];
|
|
313
|
+
measurements?: MesurerStoredWorkspace["measurements"];
|
|
314
|
+
activeMeasurement?: MesurerStoredWorkspace["activeMeasurement"];
|
|
315
|
+
heldDistances?: MesurerStoredWorkspace["heldDistances"];
|
|
316
|
+
comments?: CommentThread[];
|
|
317
|
+
layoutGuides?: MesurerStoredWorkspace["layoutGuides"];
|
|
318
|
+
};
|
|
207
319
|
};
|
|
208
320
|
|
|
209
|
-
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, }: 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;
|
|
210
322
|
|
|
211
323
|
type TypographyRow = {
|
|
212
324
|
label: string;
|
|
@@ -245,4 +357,4 @@ type TextInspectorOptions = {
|
|
|
245
357
|
declare const createTextInspector: (options?: TextInspectorOptions, legacy?: boolean) => TextInspectorAPI;
|
|
246
358
|
declare const TextInspector: TextInspectorAPI;
|
|
247
359
|
|
|
248
|
-
export { type Arrow, type ColorPickerFormat, type ColorSample, type GuidePattern, type GuideStyle, MESURER_STORAGE_VERSION, Mesurer, 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 };
|