@oyerinde/caliper 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 +20 -0
- package/README.md +134 -25
- package/dist/bridge.cjs +50 -0
- package/dist/bridge.d.cts +1649 -0
- package/dist/bridge.d.ts +1649 -0
- package/dist/bridge.js +1 -0
- package/dist/bridge.server.cjs +34 -0
- package/dist/bridge.server.js +31 -0
- package/dist/chunk-3W2YKDGV.cjs +18631 -0
- package/dist/chunk-ACV6FK43.js +18619 -0
- package/dist/chunk-OSQHATBH.cjs +5891 -0
- package/dist/chunk-XYBNY4BT.js +5885 -0
- package/dist/index.cjs +24 -5131
- package/dist/index.d.cts +975 -18
- package/dist/index.d.ts +975 -2
- package/dist/index.global.js +154 -4878
- package/dist/index.global.js.map +1 -0
- package/dist/index.global.min.js +327 -0
- package/dist/index.global.min.js.map +1 -0
- package/dist/index.js +1 -5128
- package/dist/index.server.cjs +19 -8
- package/dist/index.server.js +19 -9
- package/dist/mcp.cjs +2305 -0
- package/dist/mcp.js +2303 -0
- package/dist/preset.cjs +44 -0
- package/dist/preset.d.cts +964 -0
- package/dist/preset.d.ts +964 -0
- package/dist/preset.js +31 -0
- package/dist/preset.server.cjs +43 -0
- package/dist/preset.server.js +39 -0
- package/dist/version.json +2 -2
- package/package.json +46 -8
package/dist/index.d.cts
CHANGED
|
@@ -1,18 +1,975 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export declare interface AgentBridgeConfig {
|
|
4
|
+
/** Enable the agentic bridge for AI integration (default: false) */
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
/** WebSocket port for the MCP relay (default: 9876) */
|
|
7
|
+
wsPort?: number;
|
|
8
|
+
/** Callback for agent state changes */
|
|
9
|
+
onStateChange?: (state: CaliperAgentState) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export declare interface AnimationConfig {
|
|
13
|
+
/** Enable smooth lerp animation for boundary box hover (default: true) */
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
/** Lerp factor for animation smoothness (0-1, lower = smoother, default: 0.25) */
|
|
16
|
+
lerpFactor?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export declare interface CalculatorIntegration {
|
|
20
|
+
getState: () => CalculatorState;
|
|
21
|
+
open: (baseValue: number) => void;
|
|
22
|
+
handleInput: (key: string) => void;
|
|
23
|
+
handleBackspace: () => void;
|
|
24
|
+
handleDelete: () => void;
|
|
25
|
+
handleEnter: () => void;
|
|
26
|
+
close: () => void;
|
|
27
|
+
syncValue: (value: number) => void;
|
|
28
|
+
getResult: () => number | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Calculator state machine
|
|
33
|
+
*/
|
|
34
|
+
declare type CalculatorOperation = "+" | "-" | "*" | "/";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Keyboard shortcuts for measurement sides.
|
|
38
|
+
*/
|
|
39
|
+
export declare interface CalculatorShortcuts {
|
|
40
|
+
top?: string;
|
|
41
|
+
bottom?: string;
|
|
42
|
+
left?: string;
|
|
43
|
+
right?: string;
|
|
44
|
+
distance?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare interface CalculatorState {
|
|
48
|
+
baseValue: number;
|
|
49
|
+
operation: CalculatorOperation | null;
|
|
50
|
+
inputValue: string;
|
|
51
|
+
result: number | null;
|
|
52
|
+
isActive: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare type CaliperAgentState = z.infer<typeof CaliperAgentStateSchema>;
|
|
56
|
+
|
|
57
|
+
declare const CaliperAgentStateSchema: z.ZodObject<{
|
|
58
|
+
viewport: z.ZodObject<{
|
|
59
|
+
width: z.ZodNumber;
|
|
60
|
+
height: z.ZodNumber;
|
|
61
|
+
scrollX: z.ZodNumber;
|
|
62
|
+
scrollY: z.ZodNumber;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
activeSelection: z.ZodNullable<z.ZodObject<{
|
|
65
|
+
rect: z.ZodNullable<z.ZodObject<{
|
|
66
|
+
top: z.ZodNumber;
|
|
67
|
+
right: z.ZodNumber;
|
|
68
|
+
bottom: z.ZodNumber;
|
|
69
|
+
left: z.ZodNumber;
|
|
70
|
+
width: z.ZodNumber;
|
|
71
|
+
height: z.ZodNumber;
|
|
72
|
+
x: z.ZodNumber;
|
|
73
|
+
y: z.ZodNumber;
|
|
74
|
+
}, z.core.$strip>>;
|
|
75
|
+
scrollHierarchy: z.ZodArray<z.ZodObject<{
|
|
76
|
+
initialScrollTop: z.ZodNumber;
|
|
77
|
+
initialScrollLeft: z.ZodNumber;
|
|
78
|
+
containerRect: z.ZodNullable<z.ZodObject<{
|
|
79
|
+
top: z.ZodNumber;
|
|
80
|
+
right: z.ZodNumber;
|
|
81
|
+
bottom: z.ZodNumber;
|
|
82
|
+
left: z.ZodNumber;
|
|
83
|
+
width: z.ZodNumber;
|
|
84
|
+
height: z.ZodNumber;
|
|
85
|
+
x: z.ZodNumber;
|
|
86
|
+
y: z.ZodNumber;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
absoluteDepth: z.ZodNumber;
|
|
89
|
+
hasStickyAncestor: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
}, z.core.$strip>>;
|
|
91
|
+
position: z.ZodEnum<{
|
|
92
|
+
static: "static";
|
|
93
|
+
relative: "relative";
|
|
94
|
+
absolute: "absolute";
|
|
95
|
+
fixed: "fixed";
|
|
96
|
+
sticky: "sticky";
|
|
97
|
+
}>;
|
|
98
|
+
stickyConfig: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
top: z.ZodNullable<z.ZodNumber>;
|
|
100
|
+
bottom: z.ZodNullable<z.ZodNumber>;
|
|
101
|
+
left: z.ZodNullable<z.ZodNumber>;
|
|
102
|
+
right: z.ZodNullable<z.ZodNumber>;
|
|
103
|
+
naturalTop: z.ZodNumber;
|
|
104
|
+
naturalLeft: z.ZodNumber;
|
|
105
|
+
containerWidth: z.ZodNumber;
|
|
106
|
+
containerHeight: z.ZodNumber;
|
|
107
|
+
elementWidth: z.ZodNumber;
|
|
108
|
+
elementHeight: z.ZodNumber;
|
|
109
|
+
anchorAbsoluteDepth: z.ZodNumber;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
initialWindowX: z.ZodNumber;
|
|
112
|
+
initialWindowY: z.ZodNumber;
|
|
113
|
+
depth: z.ZodNumber;
|
|
114
|
+
hasContainingBlock: z.ZodOptional<z.ZodBoolean>;
|
|
115
|
+
}, z.core.$strip>>;
|
|
116
|
+
selectionFingerprint: z.ZodNullable<z.ZodObject<{
|
|
117
|
+
selector: z.ZodString;
|
|
118
|
+
tag: z.ZodString;
|
|
119
|
+
timestamp: z.ZodNumber;
|
|
120
|
+
id: z.ZodOptional<z.ZodString>;
|
|
121
|
+
text: z.ZodOptional<z.ZodString>;
|
|
122
|
+
classes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
123
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
124
|
+
nthChild: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
x: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
y: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
marker: z.ZodOptional<z.ZodString>;
|
|
129
|
+
scrollHierarchy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
130
|
+
initialScrollTop: z.ZodNumber;
|
|
131
|
+
initialScrollLeft: z.ZodNumber;
|
|
132
|
+
containerRect: z.ZodNullable<z.ZodObject<{
|
|
133
|
+
top: z.ZodNumber;
|
|
134
|
+
right: z.ZodNumber;
|
|
135
|
+
bottom: z.ZodNumber;
|
|
136
|
+
left: z.ZodNumber;
|
|
137
|
+
width: z.ZodNumber;
|
|
138
|
+
height: z.ZodNumber;
|
|
139
|
+
x: z.ZodNumber;
|
|
140
|
+
y: z.ZodNumber;
|
|
141
|
+
}, z.core.$strip>>;
|
|
142
|
+
absoluteDepth: z.ZodNumber;
|
|
143
|
+
hasStickyAncestor: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
+
}, z.core.$strip>>>;
|
|
145
|
+
position: z.ZodOptional<z.ZodEnum<{
|
|
146
|
+
static: "static";
|
|
147
|
+
relative: "relative";
|
|
148
|
+
absolute: "absolute";
|
|
149
|
+
fixed: "fixed";
|
|
150
|
+
sticky: "sticky";
|
|
151
|
+
}>>;
|
|
152
|
+
stickyConfig: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
top: z.ZodNullable<z.ZodNumber>;
|
|
154
|
+
bottom: z.ZodNullable<z.ZodNumber>;
|
|
155
|
+
left: z.ZodNullable<z.ZodNumber>;
|
|
156
|
+
right: z.ZodNullable<z.ZodNumber>;
|
|
157
|
+
naturalTop: z.ZodNumber;
|
|
158
|
+
naturalLeft: z.ZodNumber;
|
|
159
|
+
containerWidth: z.ZodNumber;
|
|
160
|
+
containerHeight: z.ZodNumber;
|
|
161
|
+
elementWidth: z.ZodNumber;
|
|
162
|
+
elementHeight: z.ZodNumber;
|
|
163
|
+
anchorAbsoluteDepth: z.ZodNumber;
|
|
164
|
+
}, z.core.$strip>>;
|
|
165
|
+
initialWindowX: z.ZodOptional<z.ZodNumber>;
|
|
166
|
+
initialWindowY: z.ZodOptional<z.ZodNumber>;
|
|
167
|
+
hasContainingBlock: z.ZodOptional<z.ZodBoolean>;
|
|
168
|
+
rect: z.ZodOptional<z.ZodObject<{
|
|
169
|
+
top: z.ZodNumber;
|
|
170
|
+
right: z.ZodNumber;
|
|
171
|
+
bottom: z.ZodNumber;
|
|
172
|
+
left: z.ZodNumber;
|
|
173
|
+
width: z.ZodNumber;
|
|
174
|
+
height: z.ZodNumber;
|
|
175
|
+
x: z.ZodNumber;
|
|
176
|
+
y: z.ZodNumber;
|
|
177
|
+
}, z.core.$strip>>;
|
|
178
|
+
}, z.core.$strip>>;
|
|
179
|
+
lastMeasurement: z.ZodNullable<z.ZodObject<{
|
|
180
|
+
context: z.ZodNullable<z.ZodEnum<{
|
|
181
|
+
parent: "parent";
|
|
182
|
+
child: "child";
|
|
183
|
+
sibling: "sibling";
|
|
184
|
+
}>>;
|
|
185
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
186
|
+
type: z.ZodEnum<{
|
|
187
|
+
top: "top";
|
|
188
|
+
right: "right";
|
|
189
|
+
bottom: "bottom";
|
|
190
|
+
left: "left";
|
|
191
|
+
distance: "distance";
|
|
192
|
+
}>;
|
|
193
|
+
value: z.ZodNumber;
|
|
194
|
+
start: z.ZodObject<{
|
|
195
|
+
x: z.ZodNumber;
|
|
196
|
+
y: z.ZodNumber;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
end: z.ZodObject<{
|
|
199
|
+
x: z.ZodNumber;
|
|
200
|
+
y: z.ZodNumber;
|
|
201
|
+
}, z.core.$strip>;
|
|
202
|
+
startSync: z.ZodOptional<z.ZodEnum<{
|
|
203
|
+
primary: "primary";
|
|
204
|
+
secondary: "secondary";
|
|
205
|
+
}>>;
|
|
206
|
+
endSync: z.ZodOptional<z.ZodEnum<{
|
|
207
|
+
primary: "primary";
|
|
208
|
+
secondary: "secondary";
|
|
209
|
+
}>>;
|
|
210
|
+
}, z.core.$strip>>;
|
|
211
|
+
primary: z.ZodObject<{
|
|
212
|
+
top: z.ZodNumber;
|
|
213
|
+
right: z.ZodNumber;
|
|
214
|
+
bottom: z.ZodNumber;
|
|
215
|
+
left: z.ZodNumber;
|
|
216
|
+
width: z.ZodNumber;
|
|
217
|
+
height: z.ZodNumber;
|
|
218
|
+
x: z.ZodNumber;
|
|
219
|
+
y: z.ZodNumber;
|
|
220
|
+
}, z.core.$strip>;
|
|
221
|
+
secondary: z.ZodNullable<z.ZodObject<{
|
|
222
|
+
top: z.ZodNumber;
|
|
223
|
+
right: z.ZodNumber;
|
|
224
|
+
bottom: z.ZodNumber;
|
|
225
|
+
left: z.ZodNumber;
|
|
226
|
+
width: z.ZodNumber;
|
|
227
|
+
height: z.ZodNumber;
|
|
228
|
+
x: z.ZodNumber;
|
|
229
|
+
y: z.ZodNumber;
|
|
230
|
+
}, z.core.$strip>>;
|
|
231
|
+
timestamp: z.ZodNumber;
|
|
232
|
+
primaryHierarchy: z.ZodArray<z.ZodObject<{
|
|
233
|
+
initialScrollTop: z.ZodNumber;
|
|
234
|
+
initialScrollLeft: z.ZodNumber;
|
|
235
|
+
containerRect: z.ZodNullable<z.ZodObject<{
|
|
236
|
+
top: z.ZodNumber;
|
|
237
|
+
right: z.ZodNumber;
|
|
238
|
+
bottom: z.ZodNumber;
|
|
239
|
+
left: z.ZodNumber;
|
|
240
|
+
width: z.ZodNumber;
|
|
241
|
+
height: z.ZodNumber;
|
|
242
|
+
x: z.ZodNumber;
|
|
243
|
+
y: z.ZodNumber;
|
|
244
|
+
}, z.core.$strip>>;
|
|
245
|
+
absoluteDepth: z.ZodNumber;
|
|
246
|
+
hasStickyAncestor: z.ZodOptional<z.ZodBoolean>;
|
|
247
|
+
}, z.core.$strip>>;
|
|
248
|
+
secondaryHierarchy: z.ZodArray<z.ZodObject<{
|
|
249
|
+
initialScrollTop: z.ZodNumber;
|
|
250
|
+
initialScrollLeft: z.ZodNumber;
|
|
251
|
+
containerRect: z.ZodNullable<z.ZodObject<{
|
|
252
|
+
top: z.ZodNumber;
|
|
253
|
+
right: z.ZodNumber;
|
|
254
|
+
bottom: z.ZodNumber;
|
|
255
|
+
left: z.ZodNumber;
|
|
256
|
+
width: z.ZodNumber;
|
|
257
|
+
height: z.ZodNumber;
|
|
258
|
+
x: z.ZodNumber;
|
|
259
|
+
y: z.ZodNumber;
|
|
260
|
+
}, z.core.$strip>>;
|
|
261
|
+
absoluteDepth: z.ZodNumber;
|
|
262
|
+
hasStickyAncestor: z.ZodOptional<z.ZodBoolean>;
|
|
263
|
+
}, z.core.$strip>>;
|
|
264
|
+
primaryPosition: z.ZodEnum<{
|
|
265
|
+
static: "static";
|
|
266
|
+
relative: "relative";
|
|
267
|
+
absolute: "absolute";
|
|
268
|
+
fixed: "fixed";
|
|
269
|
+
sticky: "sticky";
|
|
270
|
+
}>;
|
|
271
|
+
secondaryPosition: z.ZodEnum<{
|
|
272
|
+
static: "static";
|
|
273
|
+
relative: "relative";
|
|
274
|
+
absolute: "absolute";
|
|
275
|
+
fixed: "fixed";
|
|
276
|
+
sticky: "sticky";
|
|
277
|
+
}>;
|
|
278
|
+
primaryWinX: z.ZodNumber;
|
|
279
|
+
primaryWinY: z.ZodNumber;
|
|
280
|
+
secondaryWinX: z.ZodNumber;
|
|
281
|
+
secondaryWinY: z.ZodNumber;
|
|
282
|
+
primarySticky: z.ZodOptional<z.ZodObject<{
|
|
283
|
+
top: z.ZodNullable<z.ZodNumber>;
|
|
284
|
+
bottom: z.ZodNullable<z.ZodNumber>;
|
|
285
|
+
left: z.ZodNullable<z.ZodNumber>;
|
|
286
|
+
right: z.ZodNullable<z.ZodNumber>;
|
|
287
|
+
naturalTop: z.ZodNumber;
|
|
288
|
+
naturalLeft: z.ZodNumber;
|
|
289
|
+
containerWidth: z.ZodNumber;
|
|
290
|
+
containerHeight: z.ZodNumber;
|
|
291
|
+
elementWidth: z.ZodNumber;
|
|
292
|
+
elementHeight: z.ZodNumber;
|
|
293
|
+
anchorAbsoluteDepth: z.ZodNumber;
|
|
294
|
+
}, z.core.$strip>>;
|
|
295
|
+
secondarySticky: z.ZodOptional<z.ZodObject<{
|
|
296
|
+
top: z.ZodNullable<z.ZodNumber>;
|
|
297
|
+
bottom: z.ZodNullable<z.ZodNumber>;
|
|
298
|
+
left: z.ZodNullable<z.ZodNumber>;
|
|
299
|
+
right: z.ZodNullable<z.ZodNumber>;
|
|
300
|
+
naturalTop: z.ZodNumber;
|
|
301
|
+
naturalLeft: z.ZodNumber;
|
|
302
|
+
containerWidth: z.ZodNumber;
|
|
303
|
+
containerHeight: z.ZodNumber;
|
|
304
|
+
elementWidth: z.ZodNumber;
|
|
305
|
+
elementHeight: z.ZodNumber;
|
|
306
|
+
anchorAbsoluteDepth: z.ZodNumber;
|
|
307
|
+
}, z.core.$strip>>;
|
|
308
|
+
primaryHasContainingBlock: z.ZodOptional<z.ZodBoolean>;
|
|
309
|
+
secondaryHasContainingBlock: z.ZodOptional<z.ZodBoolean>;
|
|
310
|
+
}, z.core.$strip>>;
|
|
311
|
+
measurementFingerprint: z.ZodNullable<z.ZodObject<{
|
|
312
|
+
primary: z.ZodObject<{
|
|
313
|
+
selector: z.ZodString;
|
|
314
|
+
tag: z.ZodString;
|
|
315
|
+
timestamp: z.ZodNumber;
|
|
316
|
+
id: z.ZodOptional<z.ZodString>;
|
|
317
|
+
text: z.ZodOptional<z.ZodString>;
|
|
318
|
+
classes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
319
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
320
|
+
nthChild: z.ZodOptional<z.ZodNumber>;
|
|
321
|
+
x: z.ZodOptional<z.ZodNumber>;
|
|
322
|
+
y: z.ZodOptional<z.ZodNumber>;
|
|
323
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
324
|
+
marker: z.ZodOptional<z.ZodString>;
|
|
325
|
+
scrollHierarchy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
326
|
+
initialScrollTop: z.ZodNumber;
|
|
327
|
+
initialScrollLeft: z.ZodNumber;
|
|
328
|
+
containerRect: z.ZodNullable<z.ZodObject<{
|
|
329
|
+
top: z.ZodNumber;
|
|
330
|
+
right: z.ZodNumber;
|
|
331
|
+
bottom: z.ZodNumber;
|
|
332
|
+
left: z.ZodNumber;
|
|
333
|
+
width: z.ZodNumber;
|
|
334
|
+
height: z.ZodNumber;
|
|
335
|
+
x: z.ZodNumber;
|
|
336
|
+
y: z.ZodNumber;
|
|
337
|
+
}, z.core.$strip>>;
|
|
338
|
+
absoluteDepth: z.ZodNumber;
|
|
339
|
+
hasStickyAncestor: z.ZodOptional<z.ZodBoolean>;
|
|
340
|
+
}, z.core.$strip>>>;
|
|
341
|
+
position: z.ZodOptional<z.ZodEnum<{
|
|
342
|
+
static: "static";
|
|
343
|
+
relative: "relative";
|
|
344
|
+
absolute: "absolute";
|
|
345
|
+
fixed: "fixed";
|
|
346
|
+
sticky: "sticky";
|
|
347
|
+
}>>;
|
|
348
|
+
stickyConfig: z.ZodOptional<z.ZodObject<{
|
|
349
|
+
top: z.ZodNullable<z.ZodNumber>;
|
|
350
|
+
bottom: z.ZodNullable<z.ZodNumber>;
|
|
351
|
+
left: z.ZodNullable<z.ZodNumber>;
|
|
352
|
+
right: z.ZodNullable<z.ZodNumber>;
|
|
353
|
+
naturalTop: z.ZodNumber;
|
|
354
|
+
naturalLeft: z.ZodNumber;
|
|
355
|
+
containerWidth: z.ZodNumber;
|
|
356
|
+
containerHeight: z.ZodNumber;
|
|
357
|
+
elementWidth: z.ZodNumber;
|
|
358
|
+
elementHeight: z.ZodNumber;
|
|
359
|
+
anchorAbsoluteDepth: z.ZodNumber;
|
|
360
|
+
}, z.core.$strip>>;
|
|
361
|
+
initialWindowX: z.ZodOptional<z.ZodNumber>;
|
|
362
|
+
initialWindowY: z.ZodOptional<z.ZodNumber>;
|
|
363
|
+
hasContainingBlock: z.ZodOptional<z.ZodBoolean>;
|
|
364
|
+
rect: z.ZodOptional<z.ZodObject<{
|
|
365
|
+
top: z.ZodNumber;
|
|
366
|
+
right: z.ZodNumber;
|
|
367
|
+
bottom: z.ZodNumber;
|
|
368
|
+
left: z.ZodNumber;
|
|
369
|
+
width: z.ZodNumber;
|
|
370
|
+
height: z.ZodNumber;
|
|
371
|
+
x: z.ZodNumber;
|
|
372
|
+
y: z.ZodNumber;
|
|
373
|
+
}, z.core.$strip>>;
|
|
374
|
+
}, z.core.$strip>;
|
|
375
|
+
secondary: z.ZodObject<{
|
|
376
|
+
selector: z.ZodString;
|
|
377
|
+
tag: z.ZodString;
|
|
378
|
+
timestamp: z.ZodNumber;
|
|
379
|
+
id: z.ZodOptional<z.ZodString>;
|
|
380
|
+
text: z.ZodOptional<z.ZodString>;
|
|
381
|
+
classes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
382
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
383
|
+
nthChild: z.ZodOptional<z.ZodNumber>;
|
|
384
|
+
x: z.ZodOptional<z.ZodNumber>;
|
|
385
|
+
y: z.ZodOptional<z.ZodNumber>;
|
|
386
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
387
|
+
marker: z.ZodOptional<z.ZodString>;
|
|
388
|
+
scrollHierarchy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
389
|
+
initialScrollTop: z.ZodNumber;
|
|
390
|
+
initialScrollLeft: z.ZodNumber;
|
|
391
|
+
containerRect: z.ZodNullable<z.ZodObject<{
|
|
392
|
+
top: z.ZodNumber;
|
|
393
|
+
right: z.ZodNumber;
|
|
394
|
+
bottom: z.ZodNumber;
|
|
395
|
+
left: z.ZodNumber;
|
|
396
|
+
width: z.ZodNumber;
|
|
397
|
+
height: z.ZodNumber;
|
|
398
|
+
x: z.ZodNumber;
|
|
399
|
+
y: z.ZodNumber;
|
|
400
|
+
}, z.core.$strip>>;
|
|
401
|
+
absoluteDepth: z.ZodNumber;
|
|
402
|
+
hasStickyAncestor: z.ZodOptional<z.ZodBoolean>;
|
|
403
|
+
}, z.core.$strip>>>;
|
|
404
|
+
position: z.ZodOptional<z.ZodEnum<{
|
|
405
|
+
static: "static";
|
|
406
|
+
relative: "relative";
|
|
407
|
+
absolute: "absolute";
|
|
408
|
+
fixed: "fixed";
|
|
409
|
+
sticky: "sticky";
|
|
410
|
+
}>>;
|
|
411
|
+
stickyConfig: z.ZodOptional<z.ZodObject<{
|
|
412
|
+
top: z.ZodNullable<z.ZodNumber>;
|
|
413
|
+
bottom: z.ZodNullable<z.ZodNumber>;
|
|
414
|
+
left: z.ZodNullable<z.ZodNumber>;
|
|
415
|
+
right: z.ZodNullable<z.ZodNumber>;
|
|
416
|
+
naturalTop: z.ZodNumber;
|
|
417
|
+
naturalLeft: z.ZodNumber;
|
|
418
|
+
containerWidth: z.ZodNumber;
|
|
419
|
+
containerHeight: z.ZodNumber;
|
|
420
|
+
elementWidth: z.ZodNumber;
|
|
421
|
+
elementHeight: z.ZodNumber;
|
|
422
|
+
anchorAbsoluteDepth: z.ZodNumber;
|
|
423
|
+
}, z.core.$strip>>;
|
|
424
|
+
initialWindowX: z.ZodOptional<z.ZodNumber>;
|
|
425
|
+
initialWindowY: z.ZodOptional<z.ZodNumber>;
|
|
426
|
+
hasContainingBlock: z.ZodOptional<z.ZodBoolean>;
|
|
427
|
+
rect: z.ZodOptional<z.ZodObject<{
|
|
428
|
+
top: z.ZodNumber;
|
|
429
|
+
right: z.ZodNumber;
|
|
430
|
+
bottom: z.ZodNumber;
|
|
431
|
+
left: z.ZodNumber;
|
|
432
|
+
width: z.ZodNumber;
|
|
433
|
+
height: z.ZodNumber;
|
|
434
|
+
x: z.ZodNumber;
|
|
435
|
+
y: z.ZodNumber;
|
|
436
|
+
}, z.core.$strip>>;
|
|
437
|
+
}, z.core.$strip>;
|
|
438
|
+
}, z.core.$strip>>;
|
|
439
|
+
lastUpdated: z.ZodNumber;
|
|
440
|
+
}, z.core.$strip>;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* A plugin allows extending Caliper's functionality by accessing the
|
|
444
|
+
* OverlayInstance and internal systems.
|
|
445
|
+
*/
|
|
446
|
+
export declare interface CaliperPlugin {
|
|
447
|
+
/** Unique identifier for the plugin. Used for deduplication. */
|
|
448
|
+
name: string;
|
|
449
|
+
/** Called when the plugin is installed on an overlay instance. */
|
|
450
|
+
install: (instance: OverlayInstance) => void;
|
|
451
|
+
/** Optional cleanup logic called when the overlay is disposed. */
|
|
452
|
+
dispose?: () => void;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* A helper function for developers to add stable markers to their components.
|
|
457
|
+
* Returns an object with the data-caliper-marker attribute.
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* <div {...caliperProps("main-logo")}>...</div>
|
|
461
|
+
*/
|
|
462
|
+
export declare function caliperProps(marker: string): {
|
|
463
|
+
"data-caliper-marker"?: undefined;
|
|
464
|
+
} | {
|
|
465
|
+
"data-caliper-marker": string;
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
export declare interface CommandsConfig {
|
|
469
|
+
/** Key to activate measuring mode (default: Alt) */
|
|
470
|
+
activate?: string;
|
|
471
|
+
/** Key to freeze current measurement (default: Space) */
|
|
472
|
+
freeze?: string;
|
|
473
|
+
/** Key to select an element - must be held + click (default: Control) */
|
|
474
|
+
select?: string;
|
|
475
|
+
/** Key to clear current selection (default: Escape) */
|
|
476
|
+
clear?: string;
|
|
477
|
+
/** Custom keys to trigger calculator for specific sides (default: t, r, b, l) */
|
|
478
|
+
calculator?: CalculatorShortcuts;
|
|
479
|
+
/** Custom keys to trigger projection for specific directions (default: w, a, s, d) */
|
|
480
|
+
projection?: ProjectionShortcuts;
|
|
481
|
+
/** Key to trigger ruler lines - must be Shift + this key (default: r) */
|
|
482
|
+
ruler?: string;
|
|
483
|
+
/** Duration in ms to hold the select key to trigger selection (default: 250) */
|
|
484
|
+
selectionHoldDuration?: number;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Retrieves the current Caliper configuration from the environment.
|
|
489
|
+
*
|
|
490
|
+
* It resolves configuration in the following priority:
|
|
491
|
+
* 1. Global window object (`window.__CALIPER_CONFIG__`)
|
|
492
|
+
* 2. `data-config` attribute on the script tag (useful for UMD/CDN usage)
|
|
493
|
+
*
|
|
494
|
+
* @returns The resolved OverlayConfig object.
|
|
495
|
+
*/
|
|
496
|
+
export declare function getConfig(): OverlayConfig;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Core factory function to create and mount the Caliper overlay.
|
|
500
|
+
*
|
|
501
|
+
* It manages the lifecycle of the overlay instance, including:
|
|
502
|
+
* - Bootstrapping the Shadow DOM container.
|
|
503
|
+
* - Injecting CSS styles.
|
|
504
|
+
* - Initializing Solid.js rendering for the UI.
|
|
505
|
+
* - Coordinating measurement and selection systems.
|
|
506
|
+
* - Managing plugin lifecycle via the `.use()` method.
|
|
507
|
+
*
|
|
508
|
+
* This function is idempotent and will return the existing active instance if
|
|
509
|
+
* one is already mounted in the window.
|
|
510
|
+
*
|
|
511
|
+
* @example
|
|
512
|
+
* ```ts
|
|
513
|
+
* import { createOverlay } from "@caliper/overlay";
|
|
514
|
+
*
|
|
515
|
+
* const caliper = createOverlay({
|
|
516
|
+
* theme: { primary: "#18a0fb" }
|
|
517
|
+
* });
|
|
518
|
+
*
|
|
519
|
+
* // Plugins can be added using .use()
|
|
520
|
+
* caliper.use(myPlugin);
|
|
521
|
+
* ```
|
|
522
|
+
*
|
|
523
|
+
* @param config - The initial configuration object to merge with global defaults.
|
|
524
|
+
* @returns An OverlayInstance with mount, dispose, and plugin management capabilities.
|
|
525
|
+
*/
|
|
526
|
+
export declare function init(config?: OverlayConfig): OverlayInstance;
|
|
527
|
+
|
|
528
|
+
export declare type MeasurementLine = MeasurementLine_2;
|
|
529
|
+
|
|
530
|
+
declare type MeasurementLine_2 = Prettify_2<z.infer<typeof MeasurementLineSchema>>;
|
|
531
|
+
|
|
532
|
+
declare const MeasurementLineSchema: z.ZodObject<{
|
|
533
|
+
type: z.ZodEnum<{
|
|
534
|
+
top: "top";
|
|
535
|
+
right: "right";
|
|
536
|
+
bottom: "bottom";
|
|
537
|
+
left: "left";
|
|
538
|
+
distance: "distance";
|
|
539
|
+
}>;
|
|
540
|
+
value: z.ZodNumber;
|
|
541
|
+
start: z.ZodObject<{
|
|
542
|
+
x: z.ZodNumber;
|
|
543
|
+
y: z.ZodNumber;
|
|
544
|
+
}, z.core.$strip>;
|
|
545
|
+
end: z.ZodObject<{
|
|
546
|
+
x: z.ZodNumber;
|
|
547
|
+
y: z.ZodNumber;
|
|
548
|
+
}, z.core.$strip>;
|
|
549
|
+
startSync: z.ZodOptional<z.ZodEnum<{
|
|
550
|
+
primary: "primary";
|
|
551
|
+
secondary: "secondary";
|
|
552
|
+
}>>;
|
|
553
|
+
endSync: z.ZodOptional<z.ZodEnum<{
|
|
554
|
+
primary: "primary";
|
|
555
|
+
secondary: "secondary";
|
|
556
|
+
}>>;
|
|
557
|
+
}, z.core.$strip>;
|
|
558
|
+
|
|
559
|
+
export declare type MeasurementResult = Remap<MeasurementResult_2, {
|
|
560
|
+
primary: DOMRect;
|
|
561
|
+
secondary: DOMRect | null;
|
|
562
|
+
primaryHierarchy: ScrollState[];
|
|
563
|
+
secondaryHierarchy: ScrollState[];
|
|
564
|
+
secondaryElement: Element | null;
|
|
565
|
+
}>;
|
|
566
|
+
|
|
567
|
+
declare type MeasurementResult_2 = Prettify_2<z.infer<typeof MeasurementResultSchema>>;
|
|
568
|
+
|
|
569
|
+
declare const MeasurementResultSchema: z.ZodObject<{
|
|
570
|
+
context: z.ZodNullable<z.ZodEnum<{
|
|
571
|
+
parent: "parent";
|
|
572
|
+
child: "child";
|
|
573
|
+
sibling: "sibling";
|
|
574
|
+
}>>;
|
|
575
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
576
|
+
type: z.ZodEnum<{
|
|
577
|
+
top: "top";
|
|
578
|
+
right: "right";
|
|
579
|
+
bottom: "bottom";
|
|
580
|
+
left: "left";
|
|
581
|
+
distance: "distance";
|
|
582
|
+
}>;
|
|
583
|
+
value: z.ZodNumber;
|
|
584
|
+
start: z.ZodObject<{
|
|
585
|
+
x: z.ZodNumber;
|
|
586
|
+
y: z.ZodNumber;
|
|
587
|
+
}, z.core.$strip>;
|
|
588
|
+
end: z.ZodObject<{
|
|
589
|
+
x: z.ZodNumber;
|
|
590
|
+
y: z.ZodNumber;
|
|
591
|
+
}, z.core.$strip>;
|
|
592
|
+
startSync: z.ZodOptional<z.ZodEnum<{
|
|
593
|
+
primary: "primary";
|
|
594
|
+
secondary: "secondary";
|
|
595
|
+
}>>;
|
|
596
|
+
endSync: z.ZodOptional<z.ZodEnum<{
|
|
597
|
+
primary: "primary";
|
|
598
|
+
secondary: "secondary";
|
|
599
|
+
}>>;
|
|
600
|
+
}, z.core.$strip>>;
|
|
601
|
+
primary: z.ZodObject<{
|
|
602
|
+
top: z.ZodNumber;
|
|
603
|
+
right: z.ZodNumber;
|
|
604
|
+
bottom: z.ZodNumber;
|
|
605
|
+
left: z.ZodNumber;
|
|
606
|
+
width: z.ZodNumber;
|
|
607
|
+
height: z.ZodNumber;
|
|
608
|
+
x: z.ZodNumber;
|
|
609
|
+
y: z.ZodNumber;
|
|
610
|
+
}, z.core.$strip>;
|
|
611
|
+
secondary: z.ZodNullable<z.ZodObject<{
|
|
612
|
+
top: z.ZodNumber;
|
|
613
|
+
right: z.ZodNumber;
|
|
614
|
+
bottom: z.ZodNumber;
|
|
615
|
+
left: z.ZodNumber;
|
|
616
|
+
width: z.ZodNumber;
|
|
617
|
+
height: z.ZodNumber;
|
|
618
|
+
x: z.ZodNumber;
|
|
619
|
+
y: z.ZodNumber;
|
|
620
|
+
}, z.core.$strip>>;
|
|
621
|
+
timestamp: z.ZodNumber;
|
|
622
|
+
primaryHierarchy: z.ZodArray<z.ZodObject<{
|
|
623
|
+
initialScrollTop: z.ZodNumber;
|
|
624
|
+
initialScrollLeft: z.ZodNumber;
|
|
625
|
+
containerRect: z.ZodNullable<z.ZodObject<{
|
|
626
|
+
top: z.ZodNumber;
|
|
627
|
+
right: z.ZodNumber;
|
|
628
|
+
bottom: z.ZodNumber;
|
|
629
|
+
left: z.ZodNumber;
|
|
630
|
+
width: z.ZodNumber;
|
|
631
|
+
height: z.ZodNumber;
|
|
632
|
+
x: z.ZodNumber;
|
|
633
|
+
y: z.ZodNumber;
|
|
634
|
+
}, z.core.$strip>>;
|
|
635
|
+
absoluteDepth: z.ZodNumber;
|
|
636
|
+
hasStickyAncestor: z.ZodOptional<z.ZodBoolean>;
|
|
637
|
+
}, z.core.$strip>>;
|
|
638
|
+
secondaryHierarchy: z.ZodArray<z.ZodObject<{
|
|
639
|
+
initialScrollTop: z.ZodNumber;
|
|
640
|
+
initialScrollLeft: z.ZodNumber;
|
|
641
|
+
containerRect: z.ZodNullable<z.ZodObject<{
|
|
642
|
+
top: z.ZodNumber;
|
|
643
|
+
right: z.ZodNumber;
|
|
644
|
+
bottom: z.ZodNumber;
|
|
645
|
+
left: z.ZodNumber;
|
|
646
|
+
width: z.ZodNumber;
|
|
647
|
+
height: z.ZodNumber;
|
|
648
|
+
x: z.ZodNumber;
|
|
649
|
+
y: z.ZodNumber;
|
|
650
|
+
}, z.core.$strip>>;
|
|
651
|
+
absoluteDepth: z.ZodNumber;
|
|
652
|
+
hasStickyAncestor: z.ZodOptional<z.ZodBoolean>;
|
|
653
|
+
}, z.core.$strip>>;
|
|
654
|
+
primaryPosition: z.ZodEnum<{
|
|
655
|
+
static: "static";
|
|
656
|
+
relative: "relative";
|
|
657
|
+
absolute: "absolute";
|
|
658
|
+
fixed: "fixed";
|
|
659
|
+
sticky: "sticky";
|
|
660
|
+
}>;
|
|
661
|
+
secondaryPosition: z.ZodEnum<{
|
|
662
|
+
static: "static";
|
|
663
|
+
relative: "relative";
|
|
664
|
+
absolute: "absolute";
|
|
665
|
+
fixed: "fixed";
|
|
666
|
+
sticky: "sticky";
|
|
667
|
+
}>;
|
|
668
|
+
primaryWinX: z.ZodNumber;
|
|
669
|
+
primaryWinY: z.ZodNumber;
|
|
670
|
+
secondaryWinX: z.ZodNumber;
|
|
671
|
+
secondaryWinY: z.ZodNumber;
|
|
672
|
+
primarySticky: z.ZodOptional<z.ZodObject<{
|
|
673
|
+
top: z.ZodNullable<z.ZodNumber>;
|
|
674
|
+
bottom: z.ZodNullable<z.ZodNumber>;
|
|
675
|
+
left: z.ZodNullable<z.ZodNumber>;
|
|
676
|
+
right: z.ZodNullable<z.ZodNumber>;
|
|
677
|
+
naturalTop: z.ZodNumber;
|
|
678
|
+
naturalLeft: z.ZodNumber;
|
|
679
|
+
containerWidth: z.ZodNumber;
|
|
680
|
+
containerHeight: z.ZodNumber;
|
|
681
|
+
elementWidth: z.ZodNumber;
|
|
682
|
+
elementHeight: z.ZodNumber;
|
|
683
|
+
anchorAbsoluteDepth: z.ZodNumber;
|
|
684
|
+
}, z.core.$strip>>;
|
|
685
|
+
secondarySticky: z.ZodOptional<z.ZodObject<{
|
|
686
|
+
top: z.ZodNullable<z.ZodNumber>;
|
|
687
|
+
bottom: z.ZodNullable<z.ZodNumber>;
|
|
688
|
+
left: z.ZodNullable<z.ZodNumber>;
|
|
689
|
+
right: z.ZodNullable<z.ZodNumber>;
|
|
690
|
+
naturalTop: z.ZodNumber;
|
|
691
|
+
naturalLeft: z.ZodNumber;
|
|
692
|
+
containerWidth: z.ZodNumber;
|
|
693
|
+
containerHeight: z.ZodNumber;
|
|
694
|
+
elementWidth: z.ZodNumber;
|
|
695
|
+
elementHeight: z.ZodNumber;
|
|
696
|
+
anchorAbsoluteDepth: z.ZodNumber;
|
|
697
|
+
}, z.core.$strip>>;
|
|
698
|
+
primaryHasContainingBlock: z.ZodOptional<z.ZodBoolean>;
|
|
699
|
+
secondaryHasContainingBlock: z.ZodOptional<z.ZodBoolean>;
|
|
700
|
+
}, z.core.$strip>;
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Measurement state machine
|
|
704
|
+
* IDLE → ARMED → MEASURING → FROZEN → IDLE
|
|
705
|
+
*/
|
|
706
|
+
export declare type MeasurementState = "IDLE" | "ARMED" | "MEASURING" | "FROZEN";
|
|
707
|
+
|
|
708
|
+
export declare interface MeasurementSystem {
|
|
709
|
+
measure: (selectedElement: Element, cursor: {
|
|
710
|
+
x: number;
|
|
711
|
+
y: number;
|
|
712
|
+
}) => void;
|
|
713
|
+
abort: () => void;
|
|
714
|
+
stop: () => void;
|
|
715
|
+
freeze: () => void;
|
|
716
|
+
unfreeze: (isAltDown: boolean) => void;
|
|
717
|
+
cleanup: () => void;
|
|
718
|
+
getState: () => MeasurementState;
|
|
719
|
+
getCurrentResult: () => MeasurementResult | null;
|
|
720
|
+
getSecondaryElement: () => Element | null;
|
|
721
|
+
getCalculator: () => CalculatorIntegration;
|
|
722
|
+
getProjection: () => ProjectionSystem;
|
|
723
|
+
getRuler: () => RulerSystem;
|
|
724
|
+
onStateChange: (listener: MeasurementSystemListener) => () => void;
|
|
725
|
+
updatePrimaryRect: (rect: DOMRect) => void;
|
|
726
|
+
updateSecondaryRect: (rect: DOMRect) => void;
|
|
727
|
+
applyResult: (result: MeasurementResult) => void;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
export declare type MeasurementSystemListener = () => void;
|
|
731
|
+
|
|
732
|
+
export declare interface OverlayConfig {
|
|
733
|
+
/** Customize the visual appearance of the overlay (colors, shadows). */
|
|
734
|
+
theme?: ThemeConfig;
|
|
735
|
+
/** Customize keyboard shortcuts for all interactions. */
|
|
736
|
+
commands?: CommandsConfig;
|
|
737
|
+
/** Control the boundary box lerp animation behavior. */
|
|
738
|
+
animation?: AnimationConfig;
|
|
739
|
+
/** Configure the Agent Bridge for AI/MCP integration. */
|
|
740
|
+
bridge?: AgentBridgeConfig;
|
|
741
|
+
/** Enable debug logging (default: true). All logs are stripped from production builds. */
|
|
742
|
+
debug?: boolean;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Handle to a running Caliper overlay.
|
|
747
|
+
*/
|
|
748
|
+
export declare interface OverlayInstance {
|
|
749
|
+
/**
|
|
750
|
+
* Mounts the overlay into the DOM.
|
|
751
|
+
* By default, it mounts into document.documentElement (safe for Shadow DOM).
|
|
752
|
+
*/
|
|
753
|
+
mount: (container?: HTMLElement) => void;
|
|
754
|
+
/**
|
|
755
|
+
* Removes the overlay from the DOM and cleans up all event listeners and systems.
|
|
756
|
+
*/
|
|
757
|
+
dispose: () => void;
|
|
758
|
+
/**
|
|
759
|
+
* Synchronously returns the internal systems if they are initialized.
|
|
760
|
+
*/
|
|
761
|
+
getSystems: () => Systems | null;
|
|
762
|
+
/**
|
|
763
|
+
* Asynchronous helper that resolves when the internal systems are ready.
|
|
764
|
+
* Useful for plugins that need to interact with the DOM or state immediately.
|
|
765
|
+
*/
|
|
766
|
+
waitForSystems: () => Promise<Systems>;
|
|
767
|
+
/**
|
|
768
|
+
* Registers a plugin with this instance.
|
|
769
|
+
*/
|
|
770
|
+
use: (plugin: CaliperPlugin) => OverlayInstance;
|
|
771
|
+
/** Whether the overlay is currently mounted in the document. */
|
|
772
|
+
mounted: boolean;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
declare type Prettify<T> = {
|
|
776
|
+
[K in keyof T]: T[K];
|
|
777
|
+
} & {};
|
|
778
|
+
|
|
779
|
+
declare type Prettify_2<T> = {
|
|
780
|
+
[K in keyof T]: T[K];
|
|
781
|
+
} & {};
|
|
782
|
+
|
|
783
|
+
declare type ProjectionDirection = "top" | "right" | "bottom" | "left";
|
|
784
|
+
|
|
785
|
+
declare type ProjectionListener = (state: ProjectionState) => void;
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* Keyboard shortcuts for projection directions.
|
|
789
|
+
*/
|
|
790
|
+
export declare interface ProjectionShortcuts {
|
|
791
|
+
top?: string;
|
|
792
|
+
left?: string;
|
|
793
|
+
bottom?: string;
|
|
794
|
+
right?: string;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
declare interface ProjectionState {
|
|
798
|
+
direction: ProjectionDirection | null;
|
|
799
|
+
value: string;
|
|
800
|
+
element: HTMLElement | null;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
export declare interface ProjectionSystem {
|
|
804
|
+
getState: () => ProjectionState;
|
|
805
|
+
setDirection: (direction: ProjectionDirection | null) => void;
|
|
806
|
+
setElement: (element: HTMLElement | null) => void;
|
|
807
|
+
appendValue: (char: string, max?: number) => void;
|
|
808
|
+
capValue: (max: number) => void;
|
|
809
|
+
backspace: () => void;
|
|
810
|
+
clear: () => void;
|
|
811
|
+
onUpdate: (listener: ProjectionListener) => () => void;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
declare type Remap<T, U> = Prettify<Omit<T, keyof U> & U>;
|
|
815
|
+
|
|
816
|
+
declare interface RulerLine {
|
|
817
|
+
id: string;
|
|
818
|
+
type: "horizontal" | "vertical";
|
|
819
|
+
position: number;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
declare type RulerListener = (state: RulerState) => void;
|
|
823
|
+
|
|
824
|
+
declare interface RulerState {
|
|
825
|
+
lines: RulerLine[];
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
export declare interface RulerSystem {
|
|
829
|
+
getState: () => RulerState;
|
|
830
|
+
addPair: (x: number, y: number) => string | null;
|
|
831
|
+
updateLine: (id: string, position: number) => void;
|
|
832
|
+
removeLine: (id: string) => void;
|
|
833
|
+
clear: () => void;
|
|
834
|
+
onUpdate: (listener: RulerListener) => () => void;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
declare interface ScrollState extends ScrollState_2 {
|
|
838
|
+
element?: HTMLElement;
|
|
839
|
+
containerRect: DOMRect | null;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
declare type ScrollState_2 = Prettify_2<z.infer<typeof ScrollStateSchema>>;
|
|
843
|
+
|
|
844
|
+
declare const ScrollStateSchema: z.ZodObject<{
|
|
845
|
+
initialScrollTop: z.ZodNumber;
|
|
846
|
+
initialScrollLeft: z.ZodNumber;
|
|
847
|
+
containerRect: z.ZodNullable<z.ZodObject<{
|
|
848
|
+
top: z.ZodNumber;
|
|
849
|
+
right: z.ZodNumber;
|
|
850
|
+
bottom: z.ZodNumber;
|
|
851
|
+
left: z.ZodNumber;
|
|
852
|
+
width: z.ZodNumber;
|
|
853
|
+
height: z.ZodNumber;
|
|
854
|
+
x: z.ZodNumber;
|
|
855
|
+
y: z.ZodNumber;
|
|
856
|
+
}, z.core.$strip>>;
|
|
857
|
+
absoluteDepth: z.ZodNumber;
|
|
858
|
+
hasStickyAncestor: z.ZodOptional<z.ZodBoolean>;
|
|
859
|
+
}, z.core.$strip>;
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* Selection system for tracking selected elements
|
|
863
|
+
*/
|
|
864
|
+
export declare type SelectionMetadata = Remap<SelectionMetadata_2, {
|
|
865
|
+
element: Element | null;
|
|
866
|
+
rect: DOMRect | null;
|
|
867
|
+
scrollHierarchy: ScrollState[];
|
|
868
|
+
}>;
|
|
869
|
+
|
|
870
|
+
declare type SelectionMetadata_2 = Prettify_2<z.infer<typeof SelectionMetadataSchema>>;
|
|
871
|
+
|
|
872
|
+
declare const SelectionMetadataSchema: z.ZodObject<{
|
|
873
|
+
rect: z.ZodNullable<z.ZodObject<{
|
|
874
|
+
top: z.ZodNumber;
|
|
875
|
+
right: z.ZodNumber;
|
|
876
|
+
bottom: z.ZodNumber;
|
|
877
|
+
left: z.ZodNumber;
|
|
878
|
+
width: z.ZodNumber;
|
|
879
|
+
height: z.ZodNumber;
|
|
880
|
+
x: z.ZodNumber;
|
|
881
|
+
y: z.ZodNumber;
|
|
882
|
+
}, z.core.$strip>>;
|
|
883
|
+
scrollHierarchy: z.ZodArray<z.ZodObject<{
|
|
884
|
+
initialScrollTop: z.ZodNumber;
|
|
885
|
+
initialScrollLeft: z.ZodNumber;
|
|
886
|
+
containerRect: z.ZodNullable<z.ZodObject<{
|
|
887
|
+
top: z.ZodNumber;
|
|
888
|
+
right: z.ZodNumber;
|
|
889
|
+
bottom: z.ZodNumber;
|
|
890
|
+
left: z.ZodNumber;
|
|
891
|
+
width: z.ZodNumber;
|
|
892
|
+
height: z.ZodNumber;
|
|
893
|
+
x: z.ZodNumber;
|
|
894
|
+
y: z.ZodNumber;
|
|
895
|
+
}, z.core.$strip>>;
|
|
896
|
+
absoluteDepth: z.ZodNumber;
|
|
897
|
+
hasStickyAncestor: z.ZodOptional<z.ZodBoolean>;
|
|
898
|
+
}, z.core.$strip>>;
|
|
899
|
+
position: z.ZodEnum<{
|
|
900
|
+
static: "static";
|
|
901
|
+
relative: "relative";
|
|
902
|
+
absolute: "absolute";
|
|
903
|
+
fixed: "fixed";
|
|
904
|
+
sticky: "sticky";
|
|
905
|
+
}>;
|
|
906
|
+
stickyConfig: z.ZodOptional<z.ZodObject<{
|
|
907
|
+
top: z.ZodNullable<z.ZodNumber>;
|
|
908
|
+
bottom: z.ZodNullable<z.ZodNumber>;
|
|
909
|
+
left: z.ZodNullable<z.ZodNumber>;
|
|
910
|
+
right: z.ZodNullable<z.ZodNumber>;
|
|
911
|
+
naturalTop: z.ZodNumber;
|
|
912
|
+
naturalLeft: z.ZodNumber;
|
|
913
|
+
containerWidth: z.ZodNumber;
|
|
914
|
+
containerHeight: z.ZodNumber;
|
|
915
|
+
elementWidth: z.ZodNumber;
|
|
916
|
+
elementHeight: z.ZodNumber;
|
|
917
|
+
anchorAbsoluteDepth: z.ZodNumber;
|
|
918
|
+
}, z.core.$strip>>;
|
|
919
|
+
initialWindowX: z.ZodNumber;
|
|
920
|
+
initialWindowY: z.ZodNumber;
|
|
921
|
+
depth: z.ZodNumber;
|
|
922
|
+
hasContainingBlock: z.ZodOptional<z.ZodBoolean>;
|
|
923
|
+
}, z.core.$strip>;
|
|
924
|
+
|
|
925
|
+
export declare interface SelectionSystem {
|
|
926
|
+
select: (element: Element | null) => void;
|
|
927
|
+
getSelected: () => Element | null;
|
|
928
|
+
getSelectedRect: () => DOMRect | null;
|
|
929
|
+
getMetadata: () => SelectionMetadata;
|
|
930
|
+
clear: () => void;
|
|
931
|
+
onUpdate: (callback: (metadata: SelectionMetadata) => void) => () => void;
|
|
932
|
+
updateRect: (rect: DOMRect) => void;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* Sets the global Caliper configuration.
|
|
937
|
+
* This is a typed wrapper around window.__CALIPER_CONFIG__.
|
|
938
|
+
*
|
|
939
|
+
* @param config - The configuration object to set
|
|
940
|
+
*
|
|
941
|
+
* @example
|
|
942
|
+
* ```ts
|
|
943
|
+
* import { setConfig } from "@caliper/core";
|
|
944
|
+
*
|
|
945
|
+
* setConfig({
|
|
946
|
+
* theme: { primary: "#ff0000" },
|
|
947
|
+
* commands: { activate: "Alt" }
|
|
948
|
+
* });
|
|
949
|
+
* ```
|
|
950
|
+
*/
|
|
951
|
+
export declare function setConfig(config: OverlayConfig): void;
|
|
952
|
+
|
|
953
|
+
export declare interface Systems {
|
|
954
|
+
measurementSystem: MeasurementSystem;
|
|
955
|
+
selectionSystem: SelectionSystem;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
export declare interface ThemeConfig {
|
|
959
|
+
primary?: string;
|
|
960
|
+
secondary?: string;
|
|
961
|
+
calcBg?: string;
|
|
962
|
+
calcShadow?: string;
|
|
963
|
+
calcOpHighlight?: string;
|
|
964
|
+
calcText?: string;
|
|
965
|
+
text?: string;
|
|
966
|
+
projection?: string;
|
|
967
|
+
ruler?: string;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* The current version of the Caliper package.
|
|
972
|
+
*/
|
|
973
|
+
export declare const VERSION: string;
|
|
974
|
+
|
|
975
|
+
export { }
|