mesurer 0.1.4 → 0.1.5

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
@@ -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,12 +94,17 @@ 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;
@@ -91,8 +124,8 @@ type DistanceOverlay = {
91
124
  y2: number;
92
125
  }>;
93
126
  };
94
- type ToolMode = "none" | "select" | "selection" | "guides" | "text-inspector" | "xray" | "rulers" | "arrows" | "pen" | "text";
95
- type PersistentToolMode = Exclude<ToolMode, "none" | "text-inspector" | "xray" | "rulers">;
127
+ type ToolMode = "none" | "select" | "selection" | "guides" | "xray" | "rulers" | "arrows" | "pen" | "text" | "comments";
128
+ type PersistentToolMode = Exclude<ToolMode, "none" | "xray" | "rulers">;
96
129
 
97
130
  type TextFont = "handwritten" | "code" | "serif" | "sans-serif";
98
131
  type TextStyleSettings = {
@@ -102,6 +135,7 @@ type TextStyleSettings = {
102
135
 
103
136
  declare const MESURER_STORAGE_VERSION = 2;
104
137
  type GuidePattern = "solid" | "dashed" | "dotted";
138
+ type InfoCardMode = "hover" | "click";
105
139
  type GuideStyle = {
106
140
  opacity: number;
107
141
  width: number;
@@ -133,6 +167,7 @@ type MesurerStoredSettings = {
133
167
  arrowClickToPlace?: boolean;
134
168
  selectNewGuideEnabled?: boolean;
135
169
  multiMeasureEnabled?: boolean;
170
+ infoCardMode?: InfoCardMode;
136
171
  persistOnReload?: boolean;
137
172
  shortcutsEnabled?: boolean;
138
173
  guideStyle?: Partial<GuideStyle>;
@@ -157,6 +192,7 @@ type MesurerStoredWorkspace = {
157
192
  measurements: Measurement[];
158
193
  activeMeasurement: Measurement | null;
159
194
  heldDistances: DistanceOverlay[];
195
+ comments?: CommentThread[];
160
196
  };
161
197
  type MesurerPersistenceSnapshot = {
162
198
  settings: MesurerStoredSettings;
@@ -179,6 +215,12 @@ declare const normalizeStoredSettings: (value: unknown) => MesurerStoredSettings
179
215
  declare const normalizeStoredWorkspace: (value: unknown) => MesurerStoredWorkspace | null;
180
216
  declare const createLocalStoragePersistence: (ownerWindow: Window, workspaceKey: string, settingsKey?: string, legacyKey?: string) => MesurerPersistence;
181
217
 
218
+ type MesurerFeatures = {
219
+ screenshot?: boolean;
220
+ rulers?: boolean;
221
+ settings?: boolean;
222
+ };
223
+
182
224
  type MesurerProps = {
183
225
  highlightColor?: string;
184
226
  guideColor?: string;
@@ -204,9 +246,34 @@ type MesurerProps = {
204
246
  persistence?: MesurerPersistence;
205
247
  onPersistenceError?: (error: unknown) => void;
206
248
  captureVisibleTab?: () => Promise<Blob>;
249
+ features?: MesurerFeatures;
250
+ initialState?: {
251
+ enabled?: boolean;
252
+ minimized?: boolean;
253
+ toolMode?: ToolMode;
254
+ toolbarPosition?: {
255
+ x: number;
256
+ y: number;
257
+ };
258
+ xrayVisible?: boolean;
259
+ rulersVisible?: boolean;
260
+ guideOrientation?: "vertical" | "horizontal";
261
+ guides?: MesurerStoredWorkspace["guides"];
262
+ selectedGuideIds?: string[];
263
+ arrows?: MesurerStoredWorkspace["arrows"];
264
+ selectedArrowIds?: string[];
265
+ penStrokes?: MesurerStoredWorkspace["penStrokes"];
266
+ selectedPenStrokeIds?: string[];
267
+ textAnnotations?: MesurerStoredWorkspace["textAnnotations"];
268
+ selectedTextIds?: string[];
269
+ measurements?: MesurerStoredWorkspace["measurements"];
270
+ activeMeasurement?: MesurerStoredWorkspace["activeMeasurement"];
271
+ heldDistances?: MesurerStoredWorkspace["heldDistances"];
272
+ comments?: CommentThread[];
273
+ };
207
274
  };
208
275
 
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;
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;
210
277
 
211
278
  type TypographyRow = {
212
279
  label: string;
@@ -245,4 +312,4 @@ type TextInspectorOptions = {
245
312
  declare const createTextInspector: (options?: TextInspectorOptions, legacy?: boolean) => TextInspectorAPI;
246
313
  declare const TextInspector: TextInspectorAPI;
247
314
 
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 };
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 };
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,12 +94,17 @@ 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;
@@ -91,8 +124,8 @@ type DistanceOverlay = {
91
124
  y2: number;
92
125
  }>;
93
126
  };
94
- type ToolMode = "none" | "select" | "selection" | "guides" | "text-inspector" | "xray" | "rulers" | "arrows" | "pen" | "text";
95
- type PersistentToolMode = Exclude<ToolMode, "none" | "text-inspector" | "xray" | "rulers">;
127
+ type ToolMode = "none" | "select" | "selection" | "guides" | "xray" | "rulers" | "arrows" | "pen" | "text" | "comments";
128
+ type PersistentToolMode = Exclude<ToolMode, "none" | "xray" | "rulers">;
96
129
 
97
130
  type TextFont = "handwritten" | "code" | "serif" | "sans-serif";
98
131
  type TextStyleSettings = {
@@ -102,6 +135,7 @@ type TextStyleSettings = {
102
135
 
103
136
  declare const MESURER_STORAGE_VERSION = 2;
104
137
  type GuidePattern = "solid" | "dashed" | "dotted";
138
+ type InfoCardMode = "hover" | "click";
105
139
  type GuideStyle = {
106
140
  opacity: number;
107
141
  width: number;
@@ -133,6 +167,7 @@ type MesurerStoredSettings = {
133
167
  arrowClickToPlace?: boolean;
134
168
  selectNewGuideEnabled?: boolean;
135
169
  multiMeasureEnabled?: boolean;
170
+ infoCardMode?: InfoCardMode;
136
171
  persistOnReload?: boolean;
137
172
  shortcutsEnabled?: boolean;
138
173
  guideStyle?: Partial<GuideStyle>;
@@ -157,6 +192,7 @@ type MesurerStoredWorkspace = {
157
192
  measurements: Measurement[];
158
193
  activeMeasurement: Measurement | null;
159
194
  heldDistances: DistanceOverlay[];
195
+ comments?: CommentThread[];
160
196
  };
161
197
  type MesurerPersistenceSnapshot = {
162
198
  settings: MesurerStoredSettings;
@@ -179,6 +215,12 @@ declare const normalizeStoredSettings: (value: unknown) => MesurerStoredSettings
179
215
  declare const normalizeStoredWorkspace: (value: unknown) => MesurerStoredWorkspace | null;
180
216
  declare const createLocalStoragePersistence: (ownerWindow: Window, workspaceKey: string, settingsKey?: string, legacyKey?: string) => MesurerPersistence;
181
217
 
218
+ type MesurerFeatures = {
219
+ screenshot?: boolean;
220
+ rulers?: boolean;
221
+ settings?: boolean;
222
+ };
223
+
182
224
  type MesurerProps = {
183
225
  highlightColor?: string;
184
226
  guideColor?: string;
@@ -204,9 +246,34 @@ type MesurerProps = {
204
246
  persistence?: MesurerPersistence;
205
247
  onPersistenceError?: (error: unknown) => void;
206
248
  captureVisibleTab?: () => Promise<Blob>;
249
+ features?: MesurerFeatures;
250
+ initialState?: {
251
+ enabled?: boolean;
252
+ minimized?: boolean;
253
+ toolMode?: ToolMode;
254
+ toolbarPosition?: {
255
+ x: number;
256
+ y: number;
257
+ };
258
+ xrayVisible?: boolean;
259
+ rulersVisible?: boolean;
260
+ guideOrientation?: "vertical" | "horizontal";
261
+ guides?: MesurerStoredWorkspace["guides"];
262
+ selectedGuideIds?: string[];
263
+ arrows?: MesurerStoredWorkspace["arrows"];
264
+ selectedArrowIds?: string[];
265
+ penStrokes?: MesurerStoredWorkspace["penStrokes"];
266
+ selectedPenStrokeIds?: string[];
267
+ textAnnotations?: MesurerStoredWorkspace["textAnnotations"];
268
+ selectedTextIds?: string[];
269
+ measurements?: MesurerStoredWorkspace["measurements"];
270
+ activeMeasurement?: MesurerStoredWorkspace["activeMeasurement"];
271
+ heldDistances?: MesurerStoredWorkspace["heldDistances"];
272
+ comments?: CommentThread[];
273
+ };
207
274
  };
208
275
 
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;
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;
210
277
 
211
278
  type TypographyRow = {
212
279
  label: string;
@@ -245,4 +312,4 @@ type TextInspectorOptions = {
245
312
  declare const createTextInspector: (options?: TextInspectorOptions, legacy?: boolean) => TextInspectorAPI;
246
313
  declare const TextInspector: TextInspectorAPI;
247
314
 
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 };
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 };