@proto-labs-inc/wire 0.1.1 → 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/dist/index.d.ts +15 -10
- package/dist/index.js +10 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const PROTOCOL_VERSION =
|
|
1
|
+
export declare const PROTOCOL_VERSION = 3;
|
|
2
2
|
export type ResolvedPreviewTheme = "light" | "dark";
|
|
3
3
|
export interface StateDef {
|
|
4
4
|
id: string;
|
|
@@ -88,6 +88,8 @@ export interface VariantSetDef {
|
|
|
88
88
|
}
|
|
89
89
|
export interface Manifest {
|
|
90
90
|
schemaVersion: 2;
|
|
91
|
+
/** Trusted Frame app origin, configured by the workspace owner. */
|
|
92
|
+
frameOrigin?: string;
|
|
91
93
|
/** the slug */
|
|
92
94
|
name: string;
|
|
93
95
|
port: number;
|
|
@@ -132,10 +134,10 @@ export type FrameToRig = {
|
|
|
132
134
|
variant: string;
|
|
133
135
|
} | {
|
|
134
136
|
type: "focus-target";
|
|
135
|
-
|
|
137
|
+
selector: string | null;
|
|
136
138
|
} | {
|
|
137
139
|
type: "measure-target";
|
|
138
|
-
|
|
140
|
+
selector: string;
|
|
139
141
|
} | {
|
|
140
142
|
type: "set-comment-mode";
|
|
141
143
|
on: boolean;
|
|
@@ -164,6 +166,9 @@ export interface CommentAnchor {
|
|
|
164
166
|
height: number;
|
|
165
167
|
}
|
|
166
168
|
export type RigToFrame = {
|
|
169
|
+
type: "frame-tools-status";
|
|
170
|
+
status: "loading" | "ready" | "unavailable";
|
|
171
|
+
} | {
|
|
167
172
|
type: "hello";
|
|
168
173
|
protocolVersion: number;
|
|
169
174
|
rigVersion: string;
|
|
@@ -175,14 +180,14 @@ export type RigToFrame = {
|
|
|
175
180
|
search: string;
|
|
176
181
|
} | {
|
|
177
182
|
type: "comment-target-picked";
|
|
178
|
-
/**
|
|
179
|
-
|
|
183
|
+
/** CSS selector for the exact selected element. */
|
|
184
|
+
selector: string;
|
|
180
185
|
/** Used by the Frame to place the composer beside the selection. */
|
|
181
186
|
anchor: CommentAnchor;
|
|
182
187
|
} | {
|
|
183
188
|
type: "comment-capture";
|
|
184
|
-
/**
|
|
185
|
-
|
|
189
|
+
/** CSS selector for the exact selected element. */
|
|
190
|
+
selector: string;
|
|
186
191
|
/** PNG data URL with the highlight composited in; null if capture failed
|
|
187
192
|
(e.g. modern-screenshot not installed) — the comment still works */
|
|
188
193
|
image: string | null;
|
|
@@ -204,12 +209,12 @@ export type RigToFrame = {
|
|
|
204
209
|
type: "target-focus-dismissed";
|
|
205
210
|
} | {
|
|
206
211
|
type: "target-measured";
|
|
207
|
-
|
|
208
|
-
/** Null when no matching
|
|
212
|
+
selector: string;
|
|
213
|
+
/** Null when no matching element exists in the current state. */
|
|
209
214
|
anchor: CommentAnchor | null;
|
|
210
215
|
} | {
|
|
211
216
|
type: "variant-set-target-picked";
|
|
212
|
-
|
|
217
|
+
selector: string;
|
|
213
218
|
/** Used by the Frame to place the variant-set brief beside the selection. */
|
|
214
219
|
anchor: CommentAnchor;
|
|
215
220
|
} | {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const PROTOCOL_VERSION =
|
|
1
|
+
export const PROTOCOL_VERSION = 3;
|
|
2
2
|
// ─── URL param conventions ─────────────────────────────────────────
|
|
3
3
|
export const STATE_PARAM = "state";
|
|
4
4
|
export const variantParam = (component) => `v.${component}`;
|
|
@@ -67,8 +67,8 @@ export function isFrameToRig(d) {
|
|
|
67
67
|
(t === "set-theme" &&
|
|
68
68
|
(message.theme === "light" || message.theme === "dark")) ||
|
|
69
69
|
t === "set-variant" ||
|
|
70
|
-
t === "focus-target" ||
|
|
71
|
-
t === "measure-target" ||
|
|
70
|
+
(t === "focus-target" && (message.selector === null || typeof message.selector === "string")) ||
|
|
71
|
+
(t === "measure-target" && typeof message.selector === "string") ||
|
|
72
72
|
t === "set-comment-mode" ||
|
|
73
73
|
t === "capture-comment" ||
|
|
74
74
|
t === "set-variant-set-picker" ||
|
|
@@ -77,16 +77,17 @@ export function isFrameToRig(d) {
|
|
|
77
77
|
export function isRigToFrame(d) {
|
|
78
78
|
if (typeof d !== "object" || d === null)
|
|
79
79
|
return false;
|
|
80
|
-
const
|
|
81
|
-
|
|
80
|
+
const message = d;
|
|
81
|
+
const t = message.type;
|
|
82
|
+
if (["comment-target-picked", "comment-capture", "variant-set-target-picked", "target-measured"].includes(t)) {
|
|
83
|
+
return typeof message.selector === "string";
|
|
84
|
+
}
|
|
85
|
+
return ((t === "frame-tools-status" && ["loading", "ready", "unavailable"].includes(message.status)) ||
|
|
86
|
+
t === "hello" ||
|
|
82
87
|
t === "state-changed" ||
|
|
83
|
-
t === "comment-target-picked" ||
|
|
84
|
-
t === "comment-capture" ||
|
|
85
88
|
t === "thumbnail-capture" ||
|
|
86
89
|
t === "comment-mode-exited" ||
|
|
87
90
|
t === "target-focus-dismissed" ||
|
|
88
|
-
t === "target-measured" ||
|
|
89
|
-
t === "variant-set-target-picked" ||
|
|
90
91
|
t === "variant-set-picker-exited" ||
|
|
91
92
|
t === "element-preview-bounds" ||
|
|
92
93
|
t === "element-target-picked" ||
|
package/package.json
CHANGED