@popmelt.com/core 0.17.0 → 0.18.1

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.
@@ -1,666 +0,0 @@
1
- declare const STICKER_COLOR_NAMES: readonly ["slate", "gray", "zinc", "neutral", "stone", "red", "orange", "amber", "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo", "violet", "purple", "fuchsia", "pink", "rose"];
2
- type StickerColorName = (typeof STICKER_COLOR_NAMES)[number];
3
- declare const STICKER_COLOR_STEPS: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
4
- type StickerColorStep = (typeof STICKER_COLOR_STEPS)[number];
5
-
6
- declare const STICKER_FAMILIES: readonly ["padding", "margin", "border", "radius", "stack", "grid", "text", "color", "transform", "opacity"];
7
- type StickerFamily = (typeof STICKER_FAMILIES)[number];
8
- declare const SPACING_STEPS: readonly [0, 1, 2, 3, 4, 6, 8, 10, 12, 16];
9
- declare const TRANSLATE_STEPS: readonly [-16, -12, -10, -8, -6, -4, -3, -2, -1, 0, 1, 2, 3, 4, 6, 8, 10, 12, 16];
10
- declare const BORDER_STEPS: readonly [0, 1, 2, 4, 8];
11
- declare const DIRECTION_STEPS: readonly ["vertical", "horizontal"];
12
- declare const ALIGN_STEPS: readonly ["stretch", "start", "center", "end", "baseline"];
13
- declare const JUSTIFY_STEPS: readonly ["start", "center", "end", "between", "around", "evenly"];
14
- declare const GRID_COUNT_STEPS: readonly [1, 2, 3, 4, 5, 6];
15
- declare const FONT_SIZE_STEPS: readonly ["xs", "sm", "base", "lg", "xl", "2xl", "3xl", "4xl"];
16
- declare const FONT_WEIGHT_STEPS: readonly [300, 400, 500, 600, 700, 800];
17
- declare const LINE_HEIGHT_STEPS: readonly ["none", "tight", "snug", "normal", "relaxed", "loose"];
18
- declare const LETTER_SPACING_STEPS: readonly ["tighter", "tight", "normal", "wide", "wider", "widest"];
19
- declare const TEXT_ALIGN_STEPS: readonly ["left", "center", "right", "justify"];
20
- declare const SCALE_STEPS: readonly [25, 50, 75, 90, 95, 100, 105, 110, 125, 150];
21
- declare const ROTATE_STEPS: readonly [-180, -90, -45, -25, -12, -6, -3, -2, -1, 0, 1, 2, 3, 6, 12, 25, 45, 90, 180];
22
- declare const OPACITY_STEPS: readonly [0, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 95, 100];
23
- declare const MIX_BLEND_STEPS: readonly ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
24
- type StickerStep = (typeof SPACING_STEPS)[number] | (typeof BORDER_STEPS)[number] | (typeof DIRECTION_STEPS)[number] | (typeof ALIGN_STEPS)[number] | (typeof JUSTIFY_STEPS)[number] | (typeof GRID_COUNT_STEPS)[number] | (typeof FONT_SIZE_STEPS)[number] | (typeof FONT_WEIGHT_STEPS)[number] | (typeof LINE_HEIGHT_STEPS)[number] | (typeof LETTER_SPACING_STEPS)[number] | (typeof TEXT_ALIGN_STEPS)[number] | (typeof TRANSLATE_STEPS)[number] | (typeof SCALE_STEPS)[number] | (typeof ROTATE_STEPS)[number] | (typeof OPACITY_STEPS)[number] | (typeof MIX_BLEND_STEPS)[number] | StickerColorStep;
25
- type StickerSubproperty = 'all' | 'x' | 'y' | 'top' | 'right' | 'bottom' | 'left' | 'top-left' | 'top-right' | 'bottom-right' | 'bottom-left' | 'vertical' | 'horizontal' | 'direction' | 'gap' | 'align' | 'justify' | 'rows' | 'columns' | 'size' | 'weight' | 'line-height' | 'letter-spacing' | 'text-align' | 'color' | 'translate' | 'scale' | 'rotate' | 'opacity' | 'mix-blend' | StickerColorName;
26
-
27
- type AnnotationLifecycleStatus = 'pending' | 'sending' | 'in_flight' | 'resolved' | 'needs_review' | 'dismissed' | 'waiting_input' | 'failed';
28
- type ScopeBreadth = 'instance' | 'pattern';
29
- type ScopeTarget = 'element' | 'component' | 'token';
30
- type Scope = {
31
- breadth: ScopeBreadth;
32
- target: ScopeTarget;
33
- };
34
- declare const TOOL_TYPES: readonly ["inspector", "sticker", "model"];
35
- type ToolType = (typeof TOOL_TYPES)[number];
36
- declare const LEGACY_ANNOTATION_TYPES: readonly ["freehand", "line", "rectangle", "circle"];
37
- type LegacyAnnotationType = (typeof LEGACY_ANNOTATION_TYPES)[number];
38
- type AnnotationType = LegacyAnnotationType | 'text';
39
- type Point = {
40
- x: number;
41
- y: number;
42
- };
43
- type AnnotationRevealStep = {
44
- triggerSelector: string;
45
- targetSelector?: string;
46
- label: string;
47
- };
48
- type AnnotationRevealRecipe = {
49
- steps: AnnotationRevealStep[];
50
- location: string[];
51
- };
52
- type ReactSourceLocation = {
53
- fileName: string;
54
- lineNumber: number;
55
- columnNumber?: number;
56
- };
57
- /** Coordinates refer to the original image, not its responsive DOM rectangle. */
58
- type ImageObjectContext = {
59
- src: string;
60
- alt: string;
61
- width: number;
62
- height: number;
63
- box: {
64
- x: number;
65
- y: number;
66
- width: number;
67
- height: number;
68
- };
69
- normalizedBox: {
70
- x: number;
71
- y: number;
72
- width: number;
73
- height: number;
74
- };
75
- };
76
- /** Coordinates refer to the decoded video frame, not its responsive DOM box. */
77
- type VideoObjectContext = {
78
- src: string;
79
- width: number;
80
- height: number;
81
- duration: number;
82
- currentTime: number;
83
- normalizedBox: {
84
- x: number;
85
- y: number;
86
- width: number;
87
- height: number;
88
- };
89
- box: {
90
- x: number;
91
- y: number;
92
- width: number;
93
- height: number;
94
- };
95
- trackStart: number;
96
- trackEnd: number;
97
- };
98
- type SubjectFeedbackAttachment = {
99
- /** Zero-based index in this annotation's transported images. */
100
- cropImageIndex?: number;
101
- warning?: string;
102
- };
103
- type ElementInfo = {
104
- selector: string;
105
- tagName: string;
106
- /** Adapter-owned semantic name for a non-DOM subject. */
107
- subjectLabel?: string;
108
- id?: string;
109
- className?: string;
110
- textContent?: string;
111
- dataAttributes?: Record<string, string>;
112
- reactComponent?: string;
113
- reactComponentPath?: string[];
114
- reactSource?: ReactSourceLocation;
115
- imageObject?: ImageObjectContext;
116
- videoObject?: VideoObjectContext;
117
- /** The real DOM surface, rather than the subject's hidden projection. */
118
- sourceElement?: ElementInfo;
119
- context?: string;
120
- revealRecipe?: AnnotationRevealRecipe;
121
- };
122
- /** Renderer-owned identity for a target that does not exist as a DOM node. */
123
- type OpaqueTargetReference = {
124
- adapter: string;
125
- key: string;
126
- };
127
- type StyleChange = {
128
- property: string;
129
- original: string;
130
- modified: string;
131
- token?: string;
132
- sticker?: {
133
- family: StickerFamily;
134
- subproperty: StickerSubproperty;
135
- step: StickerStep;
136
- axisSteps?: {
137
- x: StickerStep;
138
- y: StickerStep;
139
- };
140
- };
141
- };
142
- type StyleModification = {
143
- selector: string;
144
- durableSelector?: string;
145
- element: ElementInfo;
146
- changes: StyleChange[];
147
- createdAt?: number;
148
- annotationNumber?: number;
149
- captured?: boolean;
150
- pathname?: string;
151
- };
152
- type TextModification = {
153
- selector: string;
154
- durableSelector?: string;
155
- element: ElementInfo;
156
- textNodePath: number[];
157
- original: string;
158
- modified: string;
159
- createdAt?: number;
160
- annotationNumber?: number;
161
- captured?: boolean;
162
- pathname?: string;
163
- };
164
- type DomInsertionPlacement = 'before' | 'after';
165
- type DomModification = {
166
- id: string;
167
- operation: 'move' | 'copy';
168
- selector: string;
169
- durableSelector?: string;
170
- element: ElementInfo;
171
- sourceSelector?: string;
172
- sourceDurableSelector?: string;
173
- sourceElement?: ElementInfo;
174
- originalParentSelector?: string;
175
- originalParentDurableSelector?: string;
176
- originalIndex?: number;
177
- targetParentSelector: string;
178
- targetParentDurableSelector?: string;
179
- targetIndex: number;
180
- referenceSelector?: string;
181
- referenceDurableSelector?: string;
182
- placement: DomInsertionPlacement;
183
- captured?: boolean;
184
- pathname?: string;
185
- };
186
- type SpacingElementEvidence = {
187
- selector: string;
188
- reactComponent?: string;
189
- className: string;
190
- property: string;
191
- matchedClass?: string;
192
- suggestedClass?: string;
193
- };
194
- type SpacingTokenChange = {
195
- id: string;
196
- tokenPath: string;
197
- tokenName: string;
198
- originalPx: number;
199
- newPx: number;
200
- captured?: boolean;
201
- affectedElements: SpacingElementEvidence[];
202
- };
203
- type AnnotationAttachment = {
204
- id: string;
205
- name: string;
206
- mimeType: string;
207
- size: number;
208
- kind: 'svg' | 'text';
209
- };
210
- type Annotation = {
211
- id: string;
212
- type: AnnotationType;
213
- points: Point[];
214
- color: string;
215
- strokeWidth: number;
216
- text?: string;
217
- fontSize?: number;
218
- timestamp: number;
219
- groupId?: string;
220
- captured?: boolean;
221
- status?: AnnotationLifecycleStatus;
222
- question?: string;
223
- resolutionSummary?: string;
224
- scope?: Scope | null;
225
- replyCount?: number;
226
- replyJobIds?: string[];
227
- threadId?: string;
228
- targetBindingId?: string;
229
- target?: OpaqueTargetReference;
230
- pathname?: string;
231
- elements?: ElementInfo[];
232
- linkedSelector?: string;
233
- linkedAnchor?: 'top-left' | 'bottom-left';
234
- imageCount?: number;
235
- attachments?: AnnotationAttachment[];
236
- };
237
- type BridgeStatus = {
238
- ok: boolean;
239
- activeJob: {
240
- id: string;
241
- status: string;
242
- } | null;
243
- queueDepth: number;
244
- sessionId: string | null;
245
- };
246
- type ClaudeResponse = {
247
- jobId: string;
248
- sessionId?: string;
249
- text: string;
250
- success: boolean;
251
- toolsUsed: string[];
252
- };
253
-
254
- type PopmeltSubjectBounds = {
255
- left: number;
256
- top: number;
257
- width: number;
258
- height: number;
259
- };
260
- type PopmeltSubjectTrackingAnchor = {
261
- /** Horizontal position normalized within the subject bounds. */
262
- x: number;
263
- /** Vertical position normalized within the subject bounds. */
264
- y: number;
265
- };
266
- type PopmeltSubject = {
267
- key: string;
268
- label: string;
269
- bounds: PopmeltSubjectBounds;
270
- /** Viewport bounds of the renderer surface that owns this subject. */
271
- surfaceBounds?: PopmeltSubjectBounds;
272
- context?: string;
273
- data?: Record<string, string>;
274
- /** Live owning surface; never serialized or included in model context. */
275
- sourceElement?: Element;
276
- imageObject?: ImageObjectContext;
277
- videoObject?: VideoObjectContext;
278
- /** Optional provider-neutral foreground anchors used by motion tracking. */
279
- trackingAnchors?: readonly PopmeltSubjectTrackingAnchor[];
280
- };
281
- type PopmeltSurfaceSnapshot = {
282
- element: HTMLCanvasElement;
283
- dataUrl: string;
284
- };
285
- type PopmeltSubjectCreationSession = {
286
- key: string;
287
- update(clientPoint: {
288
- x: number;
289
- y: number;
290
- }): PopmeltSubject | null;
291
- commit(): PopmeltSubject | null;
292
- cancel(): void;
293
- };
294
- /**
295
- * Minimal renderer boundary for non-DOM subjects. The adapter owns hit testing,
296
- * durable keys, and viewport projection; Popmelt owns annotations and threads.
297
- */
298
- type PopmeltSubjectAdapter = {
299
- id: string;
300
- /** Surface ownership; an explicit image adapter replaces Core's default. */
301
- surfaceKind?: 'image' | 'video';
302
- /** Resolve once the adapter's persisted subject index is available. */
303
- whenReady?(): Promise<void>;
304
- hitTest(clientPoint: {
305
- x: number;
306
- y: number;
307
- }): PopmeltSubject | null;
308
- resolve(key: string): PopmeltSubject | null;
309
- /** Recreate a missing durable subject from annotation-captured context. */
310
- restoreSubject?(key: string, elementInfo: ElementInfo): PopmeltSubject | null;
311
- /** Optional clean subject crop, without Popmelt's overlay. */
312
- captureSubject?(key: string): Blob | null | Promise<Blob | null>;
313
- /** Optional bitmap capture for renderer surfaces that DOM cloning cannot read. */
314
- captureSurfaces?(): readonly PopmeltSurfaceSnapshot[] | Promise<readonly PopmeltSurfaceSnapshot[]>;
315
- /** Begin a context-aware subject-creation gesture at a viewport point. */
316
- beginCreate?(clientPoint: {
317
- x: number;
318
- y: number;
319
- }): PopmeltSubjectCreationSession | null;
320
- /** Rename a subject without changing its durable key. */
321
- renameSubject?(key: string, label: string): PopmeltSubject | null;
322
- /** Replace a subject's viewport bounds, projected back into adapter space. */
323
- updateSubjectBounds?(key: string, bounds: PopmeltSubjectBounds): PopmeltSubject | null;
324
- /** Replace optional foreground anchors normalized within subject bounds. */
325
- updateSubjectTrackingAnchors?(key: string, anchors: readonly PopmeltSubjectTrackingAnchor[]): PopmeltSubject | null;
326
- /** Remove a user-created subject or hide an adapter-owned subject. */
327
- removeSubject?(key: string): void;
328
- };
329
-
330
- /** Geometry is normalized against the loaded image, not its rendered size. */
331
- type ImageObjectBox = {
332
- left: number;
333
- top: number;
334
- width: number;
335
- height: number;
336
- };
337
- /** A provider's observation; no inference runtime is required by Core. */
338
- type ImageObjectObservation = {
339
- label: string;
340
- score: number;
341
- box: ImageObjectBox;
342
- };
343
-
344
- type PersistedImageSubject = {
345
- id: string;
346
- label: string;
347
- detectedLabel?: string;
348
- score: number;
349
- box: ImageObjectBox;
350
- detectedBox?: ImageObjectBox;
351
- origin: 'detected' | 'manual';
352
- boundsOverridden?: boolean;
353
- };
354
- type PersistedImageSuppression = {
355
- detectedLabel: string;
356
- detectedBox: ImageObjectBox;
357
- };
358
- type PersistedImageAnalysis = {
359
- schemaVersion: 1;
360
- source: string;
361
- imageHash: string;
362
- inferenceKey: string;
363
- dedupeKey: string;
364
- subjects: readonly PersistedImageSubject[];
365
- /** Inferred objects explicitly removed by the user for this image hash. */
366
- suppressions?: readonly PersistedImageSuppression[];
367
- updatedAt: number;
368
- };
369
- type ImageSubjectStore = {
370
- load(key: string): PersistedImageAnalysis | null | Promise<PersistedImageAnalysis | null>;
371
- save(key: string, analysis: PersistedImageAnalysis): void | Promise<void>;
372
- remove?(key: string): void | Promise<void>;
373
- /** Older content-hash versions retained before the active record changed. */
374
- loadHistory?(key: string): readonly PersistedImageAnalysis[] | Promise<readonly PersistedImageAnalysis[]>;
375
- };
376
- type BrowserImageSubjectStoreOptions = {
377
- /** Prefix used for browser storage entries. */
378
- namespace?: string;
379
- /** Override localStorage, primarily for embedded browsers and tests. */
380
- storage?: Storage;
381
- };
382
- declare function createBrowserImageSubjectStore(options?: BrowserImageSubjectStoreOptions): ImageSubjectStore;
383
- declare function createMemoryImageSubjectStore(): ImageSubjectStore;
384
-
385
- type ImageContentHasher = (image: HTMLImageElement) => string | Promise<string>;
386
- /** Optional perception boundary. Core keeps media authoring usable without it. */
387
- type ImageRecognitionProvider = {
388
- cacheKey: string;
389
- configurationKey: string;
390
- detect(image: HTMLImageElement): Promise<readonly ImageObjectObservation[]>;
391
- reconcile(observations: readonly ImageObjectObservation[], previousSubjects: readonly PersistedImageSubject[], suppressions: readonly PersistedImageSuppression[]): readonly PersistedImageSubject[];
392
- dispose?(): void | Promise<void>;
393
- };
394
- type ImageSubjectAdapterOptions = {
395
- /** Optional perception; omit for manual-only image annotation. */
396
- recognition?: ImageRecognitionProvider;
397
- /** Restore saved subjects without hashing or running recognition. */
398
- hydrateOnly?: boolean;
399
- /** Images to analyze when the adapter starts. Defaults to every image. */
400
- selector?: string;
401
- /** Root to scan and observe. Defaults to document. */
402
- root?: Document | Element;
403
- /** Observe added images and src changes. Defaults to true. */
404
- observe?: boolean;
405
- /** Override the durable Core adapter id. */
406
- id?: string;
407
- /** Persist detections and user overrides. Omit to keep adapter state ephemeral. */
408
- store?: ImageSubjectStore;
409
- /** Override content hashing, primarily for authenticated or virtual images. */
410
- imageHasher?: ImageContentHasher;
411
- onError?: (error: unknown, image: HTMLImageElement) => void;
412
- };
413
- declare class ImageSubjectAdapter implements PopmeltSubjectAdapter {
414
- private readonly options;
415
- readonly surfaceKind: "image";
416
- readonly id: string;
417
- private readonly records;
418
- private readonly imageKeys;
419
- private readonly analyzedSources;
420
- private readonly pending;
421
- private readonly analysisMetadata;
422
- private readonly suppressions;
423
- private readonly writeChains;
424
- private readonly pendingWrites;
425
- private readonly observer;
426
- private refreshQueued;
427
- private destroyed;
428
- private readyPromise;
429
- private manualSequence;
430
- constructor(options?: ImageSubjectAdapterOptions);
431
- whenReady(): Promise<void>;
432
- listSubjects(): readonly PopmeltSubject[];
433
- refresh(): Promise<void>;
434
- hitTest(clientPoint: {
435
- x: number;
436
- y: number;
437
- }): PopmeltSubject | null;
438
- resolve(key: string): PopmeltSubject | null;
439
- restoreSubject(key: string, elementInfo: ElementInfo): PopmeltSubject | null;
440
- private imageObjectContext;
441
- captureSubject(key: string): Promise<Blob | null>;
442
- beginCreate(clientPoint: {
443
- x: number;
444
- y: number;
445
- }): PopmeltSubjectCreationSession | null;
446
- renameSubject(key: string, label: string): PopmeltSubject | null;
447
- updateSubjectBounds(key: string, bounds: PopmeltSubjectBounds): PopmeltSubject | null;
448
- removeSubject(key: string): void;
449
- destroy(): Promise<void>;
450
- private queueRefresh;
451
- private analyze;
452
- private replaceImageRecords;
453
- private imageIdentity;
454
- private matchingImages;
455
- private clampedImagePoint;
456
- private newObjectId;
457
- private persistImage;
458
- private saveImage;
459
- private imageSubjects;
460
- private persistencePayload;
461
- private removeImage;
462
- }
463
- declare function createImageSubjectAdapter(options?: ImageSubjectAdapterOptions): ImageSubjectAdapter;
464
-
465
- type VideoObjectBox = ImageObjectBox;
466
- type VideoTrackingAnchor = PopmeltSubjectTrackingAnchor;
467
- type VideoTrackKeyframe = {
468
- time: number;
469
- box: VideoObjectBox;
470
- score: number;
471
- source: 'manual' | 'tracked';
472
- };
473
- type VideoTrackObservation = {
474
- time: number;
475
- box: VideoObjectBox;
476
- score: number;
477
- };
478
- type VideoTrackingAttempt = {
479
- /** Expand the normal local search crop during reacquisition. */
480
- searchScale?: number;
481
- };
482
- type VideoTrackSegment = {
483
- /** First media time at which this object is confidently observable. */
484
- start: number;
485
- /** Last confidently observable media time. Omitted while the segment is open. */
486
- end?: number;
487
- };
488
- type VideoTrackingSeed = {
489
- video: HTMLVideoElement;
490
- time: number;
491
- box: VideoObjectBox;
492
- anchors?: readonly VideoTrackingAnchor[];
493
- };
494
- type VideoTrackingSession = {
495
- track(video: HTMLVideoElement, time: number, attempt?: VideoTrackingAttempt): Promise<VideoTrackObservation | null>;
496
- reseed?(seed: VideoTrackingSeed): void | Promise<void>;
497
- dispose?(): void | Promise<void>;
498
- };
499
- type VideoTrackSmoother = {
500
- /** Builds one presentation frame from a chronological durable observation. */
501
- smooth(frame: VideoTrackKeyframe): VideoTrackKeyframe;
502
- };
503
- type VideoMotionState = {
504
- visible: boolean;
505
- misses: number;
506
- hits: number;
507
- lostAt?: number;
508
- };
509
- type VideoMotionPresenceDecision = {
510
- state: VideoMotionState;
511
- action: 'accept' | 'hold' | 'close' | 'reopen';
512
- };
513
- type VideoMotionAttempt = {
514
- framesPerSecond: number;
515
- tracking: VideoTrackingAttempt;
516
- };
517
- type VideoBackwardAnalysisOptions = {
518
- source: HTMLVideoElement;
519
- seedTime: number;
520
- keyframes: readonly VideoTrackKeyframe[];
521
- anchors: readonly VideoTrackingAnchor[];
522
- maximumFramesPerSecond: number;
523
- cancelled: () => boolean;
524
- forwardWork: () => Promise<void> | undefined;
525
- };
526
- type VideoBackwardAnalysisResult = {
527
- earliestTime: number;
528
- keyframes: VideoTrackKeyframe[];
529
- };
530
- /**
531
- * Pixel-derived motion policy supplied by a perception extension. Core invokes
532
- * it, then stores and renders the resulting durable and presentation tracks.
533
- */
534
- type VideoMotionPolicy = {
535
- createSmoother(): VideoTrackSmoother;
536
- attempt(options: {
537
- state: VideoMotionState;
538
- time: number;
539
- maximumFramesPerSecond: number;
540
- }): VideoMotionAttempt;
541
- observe(options: {
542
- state: VideoMotionState;
543
- time: number;
544
- observation: VideoTrackObservation | null;
545
- }): VideoMotionPresenceDecision;
546
- analyzeBackward(options: VideoBackwardAnalysisOptions): Promise<VideoBackwardAnalysisResult>;
547
- };
548
- /** Optional local perception boundary. Core owns tracks and authoring. */
549
- type VideoTrackingProvider = {
550
- cacheKey: string;
551
- configurationKey: string;
552
- motion: VideoMotionPolicy;
553
- createSession(seed: VideoTrackingSeed): Promise<VideoTrackingSession>;
554
- dispose?(): void | Promise<void>;
555
- };
556
- type PersistedVideoTrack = {
557
- id: string;
558
- label: string;
559
- origin: 'manual' | 'detected';
560
- keyframes: readonly VideoTrackKeyframe[];
561
- /** See-derived display geometry, persisted so Core can replay it alone. */
562
- presentationKeyframes?: readonly VideoTrackKeyframe[];
563
- anchors?: readonly VideoTrackingAnchor[];
564
- /** Explicit visible spans. Missing on schema-v1 tracks, which migrate open-ended. */
565
- segments?: readonly VideoTrackSegment[];
566
- /** Furthest media time already covered by forward inference. */
567
- analyzedThrough?: number;
568
- createdAt: number;
569
- updatedAt: number;
570
- };
571
- type PersistedVideoAnalysis = {
572
- schemaVersion: 1 | 2 | 3;
573
- source: string;
574
- duration: number;
575
- tracks: readonly PersistedVideoTrack[];
576
- updatedAt: number;
577
- };
578
- type VideoSubjectStore = {
579
- load(key: string): PersistedVideoAnalysis | null | Promise<PersistedVideoAnalysis | null>;
580
- save(key: string, analysis: PersistedVideoAnalysis): void | Promise<void>;
581
- remove?(key: string): void | Promise<void>;
582
- };
583
-
584
- type VideoSubjectAdapterOptions = {
585
- tracking?: VideoTrackingProvider;
586
- selector?: string;
587
- root?: Document | Element;
588
- observe?: boolean;
589
- id?: string;
590
- store?: VideoSubjectStore;
591
- maxTrackingFramesPerSecond?: number;
592
- onError?: (error: unknown, video: HTMLVideoElement) => void;
593
- };
594
- declare class VideoSubjectAdapter implements PopmeltSubjectAdapter {
595
- private readonly options;
596
- readonly surfaceKind: "video";
597
- readonly id: string;
598
- private readonly records;
599
- private readonly videoKeys;
600
- private readonly metadata;
601
- private readonly analyzedSources;
602
- private readonly listeners;
603
- private readonly frameHandles;
604
- private readonly persistTimers;
605
- private readonly writeChains;
606
- private readonly pendingWrites;
607
- private readonly observer;
608
- private refreshQueued;
609
- private destroyed;
610
- private manualSequence;
611
- private activeTrackingKey;
612
- private readyPromise;
613
- constructor(options?: VideoSubjectAdapterOptions);
614
- whenReady(): Promise<void>;
615
- listSubjects(): readonly PopmeltSubject[];
616
- refresh(): Promise<void>;
617
- hitTest(point: {
618
- x: number;
619
- y: number;
620
- }): PopmeltSubject | null;
621
- resolve(key: string): PopmeltSubject | null;
622
- captureSubject(key: string): Promise<Blob | null>;
623
- beginCreate(point: {
624
- x: number;
625
- y: number;
626
- }): PopmeltSubjectCreationSession | null;
627
- renameSubject(key: string, label: string): PopmeltSubject | null;
628
- updateSubjectBounds(key: string, bounds: PopmeltSubjectBounds): PopmeltSubject | null;
629
- updateSubjectTrackingAnchors(key: string, anchors: readonly PopmeltSubjectTrackingAnchor[]): PopmeltSubject | null;
630
- removeSubject(key: string): void;
631
- destroy(): Promise<void>;
632
- private analyze;
633
- private addVideoListeners;
634
- private removeVideoListeners;
635
- private scheduleFrame;
636
- private trackVideo;
637
- private startSession;
638
- private reseed;
639
- private failTracking;
640
- private activeRecordFor;
641
- private activateMostRecentRecord;
642
- private activateTrackingRecord;
643
- private scheduleBackwardAnalysis;
644
- private cancelBackwardAnalysis;
645
- private runBackwardAnalysis;
646
- private acceptObservation;
647
- private openSegment;
648
- private closeSegment;
649
- private insertKeyframe;
650
- private rebuildPresentationTrack;
651
- private clearLiveFrames;
652
- private videoObjectContext;
653
- private replaceVideoRecords;
654
- private persistVideo;
655
- private schedulePersistence;
656
- private flushScheduledPersistence;
657
- private matchingVideos;
658
- private videoIdentity;
659
- private newObjectId;
660
- private removeVideoRecords;
661
- private removeVideo;
662
- private queueRefresh;
663
- }
664
- declare function createVideoSubjectAdapter(options?: VideoSubjectAdapterOptions): VideoSubjectAdapter;
665
-
666
- export { type VideoTrackingAttempt as $, type Annotation as A, type BridgeStatus as B, type ClaudeResponse as C, type DomModification as D, type ElementInfo as E, type PersistedImageSuppression as F, type PersistedVideoAnalysis as G, type PersistedVideoTrack as H, type ImageRecognitionProvider as I, type VideoBackwardAnalysisOptions as J, type VideoBackwardAnalysisResult as K, type VideoMotionAttempt as L, type VideoMotionPolicy as M, type VideoMotionPresenceDecision as N, type OpaqueTargetReference as O, type PopmeltSubjectAdapter as P, type VideoMotionState as Q, type ReactSourceLocation as R, type SubjectFeedbackAttachment as S, type TextModification as T, VideoSubjectAdapter as U, type VideoTrackingProvider as V, type VideoTrackKeyframe as W, type VideoTrackObservation as X, type VideoTrackSegment as Y, type VideoTrackSmoother as Z, type VideoTrackingAnchor as _, type ImageSubjectAdapterOptions as a, type VideoTrackingSeed as a0, type VideoTrackingSession as a1, createBrowserImageSubjectStore as a2, createImageSubjectAdapter as a3, createMemoryImageSubjectStore as a4, createVideoSubjectAdapter as a5, type VideoSubjectAdapterOptions as b, type AnnotationAttachment as c, type StyleModification as d, type SpacingTokenChange as e, type AnnotationType as f, type ImageObjectContext as g, type Point as h, type PopmeltSubject as i, type PopmeltSubjectBounds as j, type PopmeltSubjectCreationSession as k, type PopmeltSubjectTrackingAnchor as l, type PopmeltSurfaceSnapshot as m, type StyleChange as n, type ToolType as o, type VideoObjectContext as p, type ImageObjectBox as q, type VideoSubjectStore as r, type VideoObjectBox as s, type BrowserImageSubjectStoreOptions as t, type ImageContentHasher as u, type ImageObjectObservation as v, ImageSubjectAdapter as w, type ImageSubjectStore as x, type PersistedImageAnalysis as y, type PersistedImageSubject as z };