mesurer 0.0.10 → 0.1.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
@@ -77,9 +77,14 @@ type RulerSettings = {
77
77
  opacity: number;
78
78
  edgeReveal: boolean;
79
79
  };
80
+ type ScreenshotSettings = {
81
+ copy: boolean;
82
+ download: boolean;
83
+ };
80
84
  type MesurerStoredSettings = {
81
85
  highlightColor?: string;
82
86
  guideColor?: string;
87
+ guideHighlightEnabled?: boolean;
83
88
  hoverHighlightEnabled?: boolean;
84
89
  colorPickerFormats?: ColorPickerFormat[];
85
90
  colorPickerClickFormat?: ColorPickerFormat;
@@ -90,6 +95,7 @@ type MesurerStoredSettings = {
90
95
  persistOnReload?: boolean;
91
96
  guideStyle?: Partial<GuideStyle>;
92
97
  rulerSettings?: Partial<RulerSettings>;
98
+ screenshotSettings?: Partial<ScreenshotSettings>;
93
99
  };
94
100
  type MesurerStoredWorkspace = {
95
101
  enabled: boolean;
@@ -107,22 +113,27 @@ type MesurerPersistenceSnapshot = {
107
113
  settings: MesurerStoredSettings;
108
114
  workspace: MesurerStoredWorkspace | null;
109
115
  };
116
+ type PersistenceChangeSource = {
117
+ settings?: boolean;
118
+ workspace?: boolean;
119
+ };
110
120
  type MesurerPersistence = {
111
121
  load: () => MesurerPersistenceSnapshot | null;
112
122
  saveSettings: (settings: MesurerStoredSettings) => void;
113
123
  saveWorkspace: (workspace: MesurerStoredWorkspace) => void;
114
124
  clearWorkspace: () => void;
115
125
  clearSettings: () => void;
116
- subscribe?: (listener: (snapshot: MesurerPersistenceSnapshot | null) => void) => () => void;
126
+ subscribe?: (listener: (snapshot: MesurerPersistenceSnapshot | null, source?: PersistenceChangeSource) => void) => () => void;
117
127
  setErrorHandler?: (handler: ((error: unknown) => void) | undefined) => void;
118
128
  };
119
129
  declare const normalizeStoredSettings: (value: unknown) => MesurerStoredSettings;
120
130
  declare const normalizeStoredWorkspace: (value: unknown) => MesurerStoredWorkspace | null;
121
131
  declare const createLocalStoragePersistence: (ownerWindow: Window, workspaceKey: string, settingsKey?: string, legacyKey?: string) => MesurerPersistence;
122
132
 
123
- type MeasurerProps = {
133
+ type MesurerProps = {
124
134
  highlightColor?: string;
125
135
  guideColor?: string;
136
+ guideHighlightEnabled?: boolean;
126
137
  hoverHighlightEnabled?: boolean;
127
138
  persistOnReload?: boolean;
128
139
  portalTarget?: HTMLElement | ShadowRoot;
@@ -137,8 +148,9 @@ type MeasurerProps = {
137
148
  rulerSettings?: Partial<RulerSettings>;
138
149
  persistence?: MesurerPersistence;
139
150
  onPersistenceError?: (error: unknown) => void;
151
+ captureVisibleTab?: () => Promise<Blob>;
140
152
  };
141
- declare function Measurer({ highlightColor, guideColor, hoverHighlightEnabled, persistOnReload, portalTarget, persistKey, colorPickerFormats, colorPickerClickFormat, snapEnabled, snapGuidesEnabled, selectNewGuideEnabled, multiMeasureEnabled, guideStyle, rulerSettings, persistence, onPersistenceError, }: MeasurerProps): react_jsx_runtime.JSX.Element | null;
153
+ declare function Mesurer({ highlightColor, guideColor, guideHighlightEnabled, hoverHighlightEnabled, persistOnReload, portalTarget, persistKey, colorPickerFormats, colorPickerClickFormat, snapEnabled, snapGuidesEnabled, selectNewGuideEnabled, multiMeasureEnabled, guideStyle, rulerSettings, persistence, onPersistenceError, captureVisibleTab, }: MesurerProps): react_jsx_runtime.JSX.Element | null;
142
154
 
143
155
  type TypographyRow = {
144
156
  label: string;
@@ -176,4 +188,4 @@ type TextInspectorOptions = {
176
188
  declare const createTextInspector: (options?: TextInspectorOptions, legacy?: boolean) => TextInspectorAPI;
177
189
  declare const TextInspector: TextInspectorAPI;
178
190
 
179
- export { type ColorPickerFormat, type ColorSample, type GuidePattern, type GuideStyle, MESURER_STORAGE_VERSION, Measurer, type MeasurerProps, type MesurerPersistence, type MesurerPersistenceSnapshot, type MesurerStoredSettings, type MesurerStoredWorkspace, type RulerSettings, TextInspector, type TextInspectorAPI, type TextInspectorOptions, type TypographyInfo, type TypographyRow, createLocalStoragePersistence, createTextInspector, normalizeStoredSettings, normalizeStoredWorkspace };
191
+ export { type ColorPickerFormat, type ColorSample, type GuidePattern, type GuideStyle, MESURER_STORAGE_VERSION, Mesurer, type MesurerPersistence, type MesurerPersistenceSnapshot, type MesurerProps, type MesurerStoredSettings, type MesurerStoredWorkspace, type RulerSettings, type ScreenshotSettings, TextInspector, type TextInspectorAPI, type TextInspectorOptions, type TypographyInfo, type TypographyRow, createLocalStoragePersistence, createTextInspector, normalizeStoredSettings, normalizeStoredWorkspace };
package/dist/index.d.ts CHANGED
@@ -77,9 +77,14 @@ type RulerSettings = {
77
77
  opacity: number;
78
78
  edgeReveal: boolean;
79
79
  };
80
+ type ScreenshotSettings = {
81
+ copy: boolean;
82
+ download: boolean;
83
+ };
80
84
  type MesurerStoredSettings = {
81
85
  highlightColor?: string;
82
86
  guideColor?: string;
87
+ guideHighlightEnabled?: boolean;
83
88
  hoverHighlightEnabled?: boolean;
84
89
  colorPickerFormats?: ColorPickerFormat[];
85
90
  colorPickerClickFormat?: ColorPickerFormat;
@@ -90,6 +95,7 @@ type MesurerStoredSettings = {
90
95
  persistOnReload?: boolean;
91
96
  guideStyle?: Partial<GuideStyle>;
92
97
  rulerSettings?: Partial<RulerSettings>;
98
+ screenshotSettings?: Partial<ScreenshotSettings>;
93
99
  };
94
100
  type MesurerStoredWorkspace = {
95
101
  enabled: boolean;
@@ -107,22 +113,27 @@ type MesurerPersistenceSnapshot = {
107
113
  settings: MesurerStoredSettings;
108
114
  workspace: MesurerStoredWorkspace | null;
109
115
  };
116
+ type PersistenceChangeSource = {
117
+ settings?: boolean;
118
+ workspace?: boolean;
119
+ };
110
120
  type MesurerPersistence = {
111
121
  load: () => MesurerPersistenceSnapshot | null;
112
122
  saveSettings: (settings: MesurerStoredSettings) => void;
113
123
  saveWorkspace: (workspace: MesurerStoredWorkspace) => void;
114
124
  clearWorkspace: () => void;
115
125
  clearSettings: () => void;
116
- subscribe?: (listener: (snapshot: MesurerPersistenceSnapshot | null) => void) => () => void;
126
+ subscribe?: (listener: (snapshot: MesurerPersistenceSnapshot | null, source?: PersistenceChangeSource) => void) => () => void;
117
127
  setErrorHandler?: (handler: ((error: unknown) => void) | undefined) => void;
118
128
  };
119
129
  declare const normalizeStoredSettings: (value: unknown) => MesurerStoredSettings;
120
130
  declare const normalizeStoredWorkspace: (value: unknown) => MesurerStoredWorkspace | null;
121
131
  declare const createLocalStoragePersistence: (ownerWindow: Window, workspaceKey: string, settingsKey?: string, legacyKey?: string) => MesurerPersistence;
122
132
 
123
- type MeasurerProps = {
133
+ type MesurerProps = {
124
134
  highlightColor?: string;
125
135
  guideColor?: string;
136
+ guideHighlightEnabled?: boolean;
126
137
  hoverHighlightEnabled?: boolean;
127
138
  persistOnReload?: boolean;
128
139
  portalTarget?: HTMLElement | ShadowRoot;
@@ -137,8 +148,9 @@ type MeasurerProps = {
137
148
  rulerSettings?: Partial<RulerSettings>;
138
149
  persistence?: MesurerPersistence;
139
150
  onPersistenceError?: (error: unknown) => void;
151
+ captureVisibleTab?: () => Promise<Blob>;
140
152
  };
141
- declare function Measurer({ highlightColor, guideColor, hoverHighlightEnabled, persistOnReload, portalTarget, persistKey, colorPickerFormats, colorPickerClickFormat, snapEnabled, snapGuidesEnabled, selectNewGuideEnabled, multiMeasureEnabled, guideStyle, rulerSettings, persistence, onPersistenceError, }: MeasurerProps): react_jsx_runtime.JSX.Element | null;
153
+ declare function Mesurer({ highlightColor, guideColor, guideHighlightEnabled, hoverHighlightEnabled, persistOnReload, portalTarget, persistKey, colorPickerFormats, colorPickerClickFormat, snapEnabled, snapGuidesEnabled, selectNewGuideEnabled, multiMeasureEnabled, guideStyle, rulerSettings, persistence, onPersistenceError, captureVisibleTab, }: MesurerProps): react_jsx_runtime.JSX.Element | null;
142
154
 
143
155
  type TypographyRow = {
144
156
  label: string;
@@ -176,4 +188,4 @@ type TextInspectorOptions = {
176
188
  declare const createTextInspector: (options?: TextInspectorOptions, legacy?: boolean) => TextInspectorAPI;
177
189
  declare const TextInspector: TextInspectorAPI;
178
190
 
179
- export { type ColorPickerFormat, type ColorSample, type GuidePattern, type GuideStyle, MESURER_STORAGE_VERSION, Measurer, type MeasurerProps, type MesurerPersistence, type MesurerPersistenceSnapshot, type MesurerStoredSettings, type MesurerStoredWorkspace, type RulerSettings, TextInspector, type TextInspectorAPI, type TextInspectorOptions, type TypographyInfo, type TypographyRow, createLocalStoragePersistence, createTextInspector, normalizeStoredSettings, normalizeStoredWorkspace };
191
+ export { type ColorPickerFormat, type ColorSample, type GuidePattern, type GuideStyle, MESURER_STORAGE_VERSION, Mesurer, type MesurerPersistence, type MesurerPersistenceSnapshot, type MesurerProps, type MesurerStoredSettings, type MesurerStoredWorkspace, type RulerSettings, type ScreenshotSettings, TextInspector, type TextInspectorAPI, type TextInspectorOptions, type TypographyInfo, type TypographyRow, createLocalStoragePersistence, createTextInspector, normalizeStoredSettings, normalizeStoredWorkspace };