@popmelt.com/core 0.14.1 → 0.15.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 +32 -29
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/adapter-three.d.mts +66 -0
- package/dist/adapter-three.mjs +1 -0
- package/dist/bridge-entry.mjs +68 -67
- package/dist/{chunk-NPY4CUO4.mjs → chunk-H4AAYYUP.mjs} +1 -1
- package/dist/cli.mjs +85 -84
- package/dist/index.d.mts +73 -30
- package/dist/index.mjs +39 -39
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server-GNK5OVVW.mjs +211 -0
- package/dist/server.d.mts +2 -1
- package/dist/server.mjs +69 -68
- package/package.json +12 -2
- package/dist/server-2EWUDZZ5.mjs +0 -210
package/dist/index.d.mts
CHANGED
|
@@ -1,35 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
|
-
/** Client-side envelope used for persisted and streaming bridge events. */
|
|
5
|
-
type BridgeEvent = {
|
|
6
|
-
type: string;
|
|
7
|
-
data: Record<string, unknown>;
|
|
8
|
-
timestamp: number;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
declare global {
|
|
12
|
-
interface Window {
|
|
13
|
-
__POPMELT_BRIDGE_URL__?: string;
|
|
14
|
-
__POPMELT_PROJECT_ID__?: string;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type PopmeltContextValue = {
|
|
19
|
-
isEnabled: boolean;
|
|
20
|
-
};
|
|
21
|
-
type PopmeltProviderProps = PropsWithChildren<{
|
|
22
|
-
enabled?: boolean;
|
|
23
|
-
bridgeUrl?: string;
|
|
24
|
-
/** Stable project id generated by the framework plugin/bridge startup. */
|
|
25
|
-
projectId?: string | null;
|
|
26
|
-
/** Framework router push — used for multi-page screenshot capture.
|
|
27
|
-
* Pass your SPA router's navigate function (e.g. Next.js `router.push`). */
|
|
28
|
-
navigate?: (url: string) => void | Promise<unknown>;
|
|
29
|
-
}>;
|
|
30
|
-
declare function PopmeltProvider({ children, enabled, bridgeUrl, projectId: projectIdProp, navigate: navigateProp, }: PopmeltProviderProps): react.JSX.Element;
|
|
31
|
-
declare function usePopmelt(): PopmeltContextValue;
|
|
32
|
-
|
|
33
4
|
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"];
|
|
34
5
|
type StickerColorName = (typeof STICKER_COLOR_NAMES)[number];
|
|
35
6
|
declare const STICKER_COLOR_STEPS: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
@@ -56,6 +27,13 @@ declare const MIX_BLEND_STEPS: readonly ["normal", "multiply", "screen", "overla
|
|
|
56
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;
|
|
57
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;
|
|
58
29
|
|
|
30
|
+
/** Client-side envelope used for persisted and streaming bridge events. */
|
|
31
|
+
type BridgeEvent = {
|
|
32
|
+
type: string;
|
|
33
|
+
data: Record<string, unknown>;
|
|
34
|
+
timestamp: number;
|
|
35
|
+
};
|
|
36
|
+
|
|
59
37
|
type AnnotationLifecycleStatus = 'pending' | 'sending' | 'in_flight' | 'resolved' | 'needs_review' | 'dismissed' | 'waiting_input' | 'failed';
|
|
60
38
|
type ScopeBreadth = 'instance' | 'pattern';
|
|
61
39
|
type ScopeTarget = 'element' | 'component' | 'token';
|
|
@@ -84,6 +62,8 @@ type AnnotationRevealRecipe = {
|
|
|
84
62
|
type ElementInfo = {
|
|
85
63
|
selector: string;
|
|
86
64
|
tagName: string;
|
|
65
|
+
/** Adapter-owned semantic name for a non-DOM subject. */
|
|
66
|
+
subjectLabel?: string;
|
|
87
67
|
id?: string;
|
|
88
68
|
className?: string;
|
|
89
69
|
textContent?: string;
|
|
@@ -92,6 +72,11 @@ type ElementInfo = {
|
|
|
92
72
|
context?: string;
|
|
93
73
|
revealRecipe?: AnnotationRevealRecipe;
|
|
94
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
|
+
};
|
|
95
80
|
type StyleChange = {
|
|
96
81
|
property: string;
|
|
97
82
|
original: string;
|
|
@@ -194,6 +179,7 @@ type Annotation = {
|
|
|
194
179
|
replyJobIds?: string[];
|
|
195
180
|
threadId?: string;
|
|
196
181
|
targetBindingId?: string;
|
|
182
|
+
target?: OpaqueTargetReference;
|
|
197
183
|
pathname?: string;
|
|
198
184
|
elements?: ElementInfo[];
|
|
199
185
|
linkedSelector?: string;
|
|
@@ -218,11 +204,68 @@ type ClaudeResponse = {
|
|
|
218
204
|
toolsUsed: string[];
|
|
219
205
|
};
|
|
220
206
|
|
|
207
|
+
type PopmeltSubjectBounds = {
|
|
208
|
+
left: number;
|
|
209
|
+
top: number;
|
|
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
|
+
};
|
|
238
|
+
|
|
239
|
+
declare global {
|
|
240
|
+
interface Window {
|
|
241
|
+
__POPMELT_BRIDGE_URL__?: string;
|
|
242
|
+
__POPMELT_PROJECT_ID__?: string;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
type PopmeltContextValue = {
|
|
247
|
+
isEnabled: boolean;
|
|
248
|
+
};
|
|
249
|
+
type PopmeltProviderProps = PropsWithChildren<{
|
|
250
|
+
enabled?: boolean;
|
|
251
|
+
bridgeUrl?: string;
|
|
252
|
+
/** Stable project id generated by the framework plugin/bridge startup. */
|
|
253
|
+
projectId?: string | null;
|
|
254
|
+
/** Framework router push — used for multi-page screenshot capture.
|
|
255
|
+
* Pass your SPA router's navigate function (e.g. Next.js `router.push`). */
|
|
256
|
+
navigate?: (url: string) => void | Promise<unknown>;
|
|
257
|
+
/** Optional non-DOM renderer adapters, such as Three.js scene subjects. */
|
|
258
|
+
subjectAdapters?: readonly PopmeltSubjectAdapter[];
|
|
259
|
+
}>;
|
|
260
|
+
declare function PopmeltProvider({ children, enabled, bridgeUrl, projectId: projectIdProp, navigate: navigateProp, subjectAdapters, }: PopmeltProviderProps): react.JSX.Element;
|
|
261
|
+
declare function usePopmelt(): PopmeltContextValue;
|
|
262
|
+
|
|
221
263
|
type AnnotationData = {
|
|
222
264
|
id: string;
|
|
223
265
|
type: string;
|
|
224
266
|
instruction?: string;
|
|
225
267
|
linkedSelector?: string;
|
|
268
|
+
target?: Annotation['target'];
|
|
226
269
|
pathname?: string;
|
|
227
270
|
elements: ElementInfo[];
|
|
228
271
|
imageCount?: number;
|
|
@@ -247,4 +290,4 @@ type FeedbackData = {
|
|
|
247
290
|
spacingTokenChanges?: SpacingTokenChange[];
|
|
248
291
|
};
|
|
249
292
|
|
|
250
|
-
export { type Annotation, type AnnotationType, type BridgeEvent, type BridgeStatus, type ClaudeResponse, type ElementInfo, type FeedbackData, type Point, PopmeltProvider, type StyleChange, type StyleModification, type ToolType, usePopmelt };
|
|
293
|
+
export { type Annotation, type AnnotationType, type BridgeEvent, type BridgeStatus, type ClaudeResponse, type ElementInfo, type FeedbackData, type OpaqueTargetReference, type Point, PopmeltProvider, type PopmeltSubject, type PopmeltSubjectAdapter, type PopmeltSubjectBounds, type PopmeltSurfaceSnapshot, type StyleChange, type StyleModification, type ToolType, usePopmelt };
|