@popmelt.com/core 0.15.0 → 0.17.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/README.md +73 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/adapter-three.d.mts +119 -0
- package/dist/bridge-entry.mjs +2 -2
- package/dist/{chunk-H4AAYYUP.mjs → chunk-D5CD4PIZ.mjs} +1 -1
- package/dist/chunk-RS3XXK26.mjs +2 -0
- package/dist/cli.mjs +32 -32
- package/dist/index.d.mts +29 -225
- package/dist/index.mjs +64 -39
- package/dist/media.d.mts +31 -0
- package/dist/media.mjs +2 -0
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-vite.mjs +1 -1
- package/dist/{server-GNK5OVVW.mjs → server-XGSUCWFZ.mjs} +38 -38
- package/dist/server.mjs +57 -57
- package/dist/video-adapter-cDwq4uNP.d.mts +666 -0
- package/package.json +5 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,31 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type StickerColorName = (typeof STICKER_COLOR_NAMES)[number];
|
|
6
|
-
declare const STICKER_COLOR_STEPS: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
7
|
-
type StickerColorStep = (typeof STICKER_COLOR_STEPS)[number];
|
|
8
|
-
|
|
9
|
-
declare const STICKER_FAMILIES: readonly ["padding", "margin", "border", "radius", "stack", "grid", "text", "color", "transform", "opacity"];
|
|
10
|
-
type StickerFamily = (typeof STICKER_FAMILIES)[number];
|
|
11
|
-
declare const SPACING_STEPS: readonly [0, 1, 2, 3, 4, 6, 8, 10, 12, 16];
|
|
12
|
-
declare const TRANSLATE_STEPS: readonly [-16, -12, -10, -8, -6, -4, -3, -2, -1, 0, 1, 2, 3, 4, 6, 8, 10, 12, 16];
|
|
13
|
-
declare const BORDER_STEPS: readonly [0, 1, 2, 4, 8];
|
|
14
|
-
declare const DIRECTION_STEPS: readonly ["vertical", "horizontal"];
|
|
15
|
-
declare const ALIGN_STEPS: readonly ["stretch", "start", "center", "end", "baseline"];
|
|
16
|
-
declare const JUSTIFY_STEPS: readonly ["start", "center", "end", "between", "around", "evenly"];
|
|
17
|
-
declare const GRID_COUNT_STEPS: readonly [1, 2, 3, 4, 5, 6];
|
|
18
|
-
declare const FONT_SIZE_STEPS: readonly ["xs", "sm", "base", "lg", "xl", "2xl", "3xl", "4xl"];
|
|
19
|
-
declare const FONT_WEIGHT_STEPS: readonly [300, 400, 500, 600, 700, 800];
|
|
20
|
-
declare const LINE_HEIGHT_STEPS: readonly ["none", "tight", "snug", "normal", "relaxed", "loose"];
|
|
21
|
-
declare const LETTER_SPACING_STEPS: readonly ["tighter", "tight", "normal", "wide", "wider", "widest"];
|
|
22
|
-
declare const TEXT_ALIGN_STEPS: readonly ["left", "center", "right", "justify"];
|
|
23
|
-
declare const SCALE_STEPS: readonly [25, 50, 75, 90, 95, 100, 105, 110, 125, 150];
|
|
24
|
-
declare const ROTATE_STEPS: readonly [-180, -90, -45, -25, -12, -6, -3, -2, -1, 0, 1, 2, 3, 6, 12, 25, 45, 90, 180];
|
|
25
|
-
declare const OPACITY_STEPS: readonly [0, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 95, 100];
|
|
26
|
-
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"];
|
|
27
|
-
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;
|
|
28
|
-
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;
|
|
3
|
+
import { I as ImageRecognitionProvider, V as VideoTrackingProvider, P as PopmeltSubjectAdapter, a as ImageSubjectAdapterOptions, b as VideoSubjectAdapterOptions, A as Annotation, E as ElementInfo, c as AnnotationAttachment, S as SubjectFeedbackAttachment, d as StyleModification, T as TextModification, D as DomModification, e as SpacingTokenChange } from './video-adapter-cDwq4uNP.mjs';
|
|
4
|
+
export { f as AnnotationType, B as BridgeStatus, C as ClaudeResponse, g as ImageObjectContext, O as OpaqueTargetReference, h as Point, i as PopmeltSubject, j as PopmeltSubjectBounds, k as PopmeltSubjectCreationSession, l as PopmeltSubjectTrackingAnchor, m as PopmeltSurfaceSnapshot, R as ReactSourceLocation, n as StyleChange, o as ToolType, p as VideoObjectContext } from './video-adapter-cDwq4uNP.mjs';
|
|
29
5
|
|
|
30
6
|
/** Client-side envelope used for persisted and streaming bridge events. */
|
|
31
7
|
type BridgeEvent = {
|
|
@@ -34,207 +10,28 @@ type BridgeEvent = {
|
|
|
34
10
|
timestamp: number;
|
|
35
11
|
};
|
|
36
12
|
|
|
37
|
-
type
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
declare const LEGACY_ANNOTATION_TYPES: readonly ["freehand", "line", "rectangle", "circle"];
|
|
47
|
-
type LegacyAnnotationType = (typeof LEGACY_ANNOTATION_TYPES)[number];
|
|
48
|
-
type AnnotationType = LegacyAnnotationType | 'text';
|
|
49
|
-
type Point = {
|
|
50
|
-
x: number;
|
|
51
|
-
y: number;
|
|
52
|
-
};
|
|
53
|
-
type AnnotationRevealStep = {
|
|
54
|
-
triggerSelector: string;
|
|
55
|
-
targetSelector?: string;
|
|
56
|
-
label: string;
|
|
57
|
-
};
|
|
58
|
-
type AnnotationRevealRecipe = {
|
|
59
|
-
steps: AnnotationRevealStep[];
|
|
60
|
-
location: string[];
|
|
61
|
-
};
|
|
62
|
-
type ElementInfo = {
|
|
63
|
-
selector: string;
|
|
64
|
-
tagName: string;
|
|
65
|
-
/** Adapter-owned semantic name for a non-DOM subject. */
|
|
66
|
-
subjectLabel?: string;
|
|
67
|
-
id?: string;
|
|
68
|
-
className?: string;
|
|
69
|
-
textContent?: string;
|
|
70
|
-
dataAttributes?: Record<string, string>;
|
|
71
|
-
reactComponent?: string;
|
|
72
|
-
context?: string;
|
|
73
|
-
revealRecipe?: AnnotationRevealRecipe;
|
|
74
|
-
};
|
|
75
|
-
/** Renderer-owned identity for a target that does not exist as a DOM node. */
|
|
76
|
-
type OpaqueTargetReference = {
|
|
77
|
-
adapter: string;
|
|
78
|
-
key: string;
|
|
79
|
-
};
|
|
80
|
-
type StyleChange = {
|
|
81
|
-
property: string;
|
|
82
|
-
original: string;
|
|
83
|
-
modified: string;
|
|
84
|
-
token?: string;
|
|
85
|
-
sticker?: {
|
|
86
|
-
family: StickerFamily;
|
|
87
|
-
subproperty: StickerSubproperty;
|
|
88
|
-
step: StickerStep;
|
|
89
|
-
axisSteps?: {
|
|
90
|
-
x: StickerStep;
|
|
91
|
-
y: StickerStep;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
type StyleModification = {
|
|
96
|
-
selector: string;
|
|
97
|
-
durableSelector?: string;
|
|
98
|
-
element: ElementInfo;
|
|
99
|
-
changes: StyleChange[];
|
|
100
|
-
createdAt?: number;
|
|
101
|
-
annotationNumber?: number;
|
|
102
|
-
captured?: boolean;
|
|
103
|
-
pathname?: string;
|
|
104
|
-
};
|
|
105
|
-
type TextModification = {
|
|
106
|
-
selector: string;
|
|
107
|
-
durableSelector?: string;
|
|
108
|
-
element: ElementInfo;
|
|
109
|
-
textNodePath: number[];
|
|
110
|
-
original: string;
|
|
111
|
-
modified: string;
|
|
112
|
-
createdAt?: number;
|
|
113
|
-
annotationNumber?: number;
|
|
114
|
-
captured?: boolean;
|
|
115
|
-
pathname?: string;
|
|
116
|
-
};
|
|
117
|
-
type DomInsertionPlacement = 'before' | 'after';
|
|
118
|
-
type DomModification = {
|
|
119
|
-
id: string;
|
|
120
|
-
operation: 'move' | 'copy';
|
|
121
|
-
selector: string;
|
|
122
|
-
durableSelector?: string;
|
|
123
|
-
element: ElementInfo;
|
|
124
|
-
sourceSelector?: string;
|
|
125
|
-
sourceDurableSelector?: string;
|
|
126
|
-
sourceElement?: ElementInfo;
|
|
127
|
-
originalParentSelector?: string;
|
|
128
|
-
originalParentDurableSelector?: string;
|
|
129
|
-
originalIndex?: number;
|
|
130
|
-
targetParentSelector: string;
|
|
131
|
-
targetParentDurableSelector?: string;
|
|
132
|
-
targetIndex: number;
|
|
133
|
-
referenceSelector?: string;
|
|
134
|
-
referenceDurableSelector?: string;
|
|
135
|
-
placement: DomInsertionPlacement;
|
|
136
|
-
captured?: boolean;
|
|
137
|
-
pathname?: string;
|
|
138
|
-
};
|
|
139
|
-
type SpacingElementEvidence = {
|
|
140
|
-
selector: string;
|
|
141
|
-
reactComponent?: string;
|
|
142
|
-
className: string;
|
|
143
|
-
property: string;
|
|
144
|
-
matchedClass?: string;
|
|
145
|
-
suggestedClass?: string;
|
|
146
|
-
};
|
|
147
|
-
type SpacingTokenChange = {
|
|
148
|
-
id: string;
|
|
149
|
-
tokenPath: string;
|
|
150
|
-
tokenName: string;
|
|
151
|
-
originalPx: number;
|
|
152
|
-
newPx: number;
|
|
153
|
-
captured?: boolean;
|
|
154
|
-
affectedElements: SpacingElementEvidence[];
|
|
155
|
-
};
|
|
156
|
-
type AnnotationAttachment = {
|
|
157
|
-
id: string;
|
|
158
|
-
name: string;
|
|
159
|
-
mimeType: string;
|
|
160
|
-
size: number;
|
|
161
|
-
kind: 'svg' | 'text';
|
|
13
|
+
type PopmeltExtensionRuntime = {
|
|
14
|
+
/** Optional perception contribution for Core's built-in image adapter. */
|
|
15
|
+
imageRecognition?: ImageRecognitionProvider;
|
|
16
|
+
/** Optional perception contribution for Core's built-in video adapter. */
|
|
17
|
+
videoTracking?: VideoTrackingProvider;
|
|
18
|
+
/** Optional non-DOM subject adapters contributed by the extension. */
|
|
19
|
+
subjectAdapters?: readonly PopmeltSubjectAdapter[];
|
|
20
|
+
/** Release extension-owned resources. */
|
|
21
|
+
dispose?(): void | Promise<void>;
|
|
162
22
|
};
|
|
163
|
-
type
|
|
23
|
+
type PopmeltExtension = {
|
|
24
|
+
/** Stable package-level identity used to reconcile extension configuration. */
|
|
164
25
|
id: string;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
text?: string;
|
|
170
|
-
fontSize?: number;
|
|
171
|
-
timestamp: number;
|
|
172
|
-
groupId?: string;
|
|
173
|
-
captured?: boolean;
|
|
174
|
-
status?: AnnotationLifecycleStatus;
|
|
175
|
-
question?: string;
|
|
176
|
-
resolutionSummary?: string;
|
|
177
|
-
scope?: Scope | null;
|
|
178
|
-
replyCount?: number;
|
|
179
|
-
replyJobIds?: string[];
|
|
180
|
-
threadId?: string;
|
|
181
|
-
targetBindingId?: string;
|
|
182
|
-
target?: OpaqueTargetReference;
|
|
183
|
-
pathname?: string;
|
|
184
|
-
elements?: ElementInfo[];
|
|
185
|
-
linkedSelector?: string;
|
|
186
|
-
linkedAnchor?: 'top-left' | 'bottom-left';
|
|
187
|
-
imageCount?: number;
|
|
188
|
-
attachments?: AnnotationAttachment[];
|
|
189
|
-
};
|
|
190
|
-
type BridgeStatus = {
|
|
191
|
-
ok: boolean;
|
|
192
|
-
activeJob: {
|
|
193
|
-
id: string;
|
|
194
|
-
status: string;
|
|
195
|
-
} | null;
|
|
196
|
-
queueDepth: number;
|
|
197
|
-
sessionId: string | null;
|
|
198
|
-
};
|
|
199
|
-
type ClaudeResponse = {
|
|
200
|
-
jobId: string;
|
|
201
|
-
sessionId?: string;
|
|
202
|
-
text: string;
|
|
203
|
-
success: boolean;
|
|
204
|
-
toolsUsed: string[];
|
|
26
|
+
/** Stable signature for configuration changes that require reactivation. */
|
|
27
|
+
configurationKey: string;
|
|
28
|
+
/** Activate lazily after the Core provider mounts in the browser. */
|
|
29
|
+
activate(): PopmeltExtensionRuntime;
|
|
205
30
|
};
|
|
206
31
|
|
|
207
|
-
type
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
width: number;
|
|
211
|
-
height: number;
|
|
212
|
-
};
|
|
213
|
-
type PopmeltSubject = {
|
|
214
|
-
key: string;
|
|
215
|
-
label: string;
|
|
216
|
-
bounds: PopmeltSubjectBounds;
|
|
217
|
-
context?: string;
|
|
218
|
-
data?: Record<string, string>;
|
|
219
|
-
};
|
|
220
|
-
type PopmeltSurfaceSnapshot = {
|
|
221
|
-
element: HTMLCanvasElement;
|
|
222
|
-
dataUrl: string;
|
|
223
|
-
};
|
|
224
|
-
/**
|
|
225
|
-
* Minimal renderer boundary for non-DOM subjects. The adapter owns hit testing,
|
|
226
|
-
* durable keys, and viewport projection; Popmelt owns annotations and threads.
|
|
227
|
-
*/
|
|
228
|
-
type PopmeltSubjectAdapter = {
|
|
229
|
-
id: string;
|
|
230
|
-
hitTest(clientPoint: {
|
|
231
|
-
x: number;
|
|
232
|
-
y: number;
|
|
233
|
-
}): PopmeltSubject | null;
|
|
234
|
-
resolve(key: string): PopmeltSubject | null;
|
|
235
|
-
/** Optional bitmap capture for renderer surfaces that DOM cloning cannot read. */
|
|
236
|
-
captureSurfaces?(): readonly PopmeltSurfaceSnapshot[] | Promise<readonly PopmeltSurfaceSnapshot[]>;
|
|
237
|
-
};
|
|
32
|
+
type ImageAnnotationOptions = Omit<ImageSubjectAdapterOptions, 'id'>;
|
|
33
|
+
|
|
34
|
+
type VideoAnnotationOptions = Omit<VideoSubjectAdapterOptions, 'id'>;
|
|
238
35
|
|
|
239
36
|
declare global {
|
|
240
37
|
interface Window {
|
|
@@ -256,8 +53,14 @@ type PopmeltProviderProps = PropsWithChildren<{
|
|
|
256
53
|
navigate?: (url: string) => void | Promise<unknown>;
|
|
257
54
|
/** Optional non-DOM renderer adapters, such as Three.js scene subjects. */
|
|
258
55
|
subjectAdapters?: readonly PopmeltSubjectAdapter[];
|
|
56
|
+
/** Optional packages that contribute perception or additional subject surfaces. */
|
|
57
|
+
extensions?: readonly PopmeltExtension[];
|
|
58
|
+
/** Manual image annotation is enabled by default; false disables the built-in adapter. */
|
|
59
|
+
imageAnnotation?: boolean | ImageAnnotationOptions;
|
|
60
|
+
/** Manual video annotation is on by default; See may contribute tracking. */
|
|
61
|
+
videoAnnotation?: boolean | VideoAnnotationOptions;
|
|
259
62
|
}>;
|
|
260
|
-
declare function PopmeltProvider({ children, enabled, bridgeUrl, projectId: projectIdProp, navigate: navigateProp, subjectAdapters, }: PopmeltProviderProps): react.JSX.Element;
|
|
63
|
+
declare function PopmeltProvider({ children, enabled, bridgeUrl, projectId: projectIdProp, navigate: navigateProp, subjectAdapters, extensions, imageAnnotation, videoAnnotation, }: PopmeltProviderProps): react.JSX.Element;
|
|
261
64
|
declare function usePopmelt(): PopmeltContextValue;
|
|
262
65
|
|
|
263
66
|
type AnnotationData = {
|
|
@@ -270,6 +73,7 @@ type AnnotationData = {
|
|
|
270
73
|
elements: ElementInfo[];
|
|
271
74
|
imageCount?: number;
|
|
272
75
|
attachments?: AnnotationAttachment[];
|
|
76
|
+
subjectFeedback?: SubjectFeedbackAttachment;
|
|
273
77
|
};
|
|
274
78
|
type FeedbackData = {
|
|
275
79
|
timestamp: string;
|
|
@@ -290,4 +94,4 @@ type FeedbackData = {
|
|
|
290
94
|
spacingTokenChanges?: SpacingTokenChange[];
|
|
291
95
|
};
|
|
292
96
|
|
|
293
|
-
export {
|
|
97
|
+
export { Annotation, type BridgeEvent, ElementInfo, type FeedbackData, type ImageAnnotationOptions, type PopmeltExtension, type PopmeltExtensionRuntime, PopmeltProvider, type PopmeltProviderProps, PopmeltSubjectAdapter, StyleModification, type VideoAnnotationOptions, usePopmelt };
|