@supernovaio/prototyping-tooling 0.9.5-alpha.3 → 0.9.5
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/client/annotation/AnnotationOverlay.d.ts +0 -2
- package/dist/client/annotation/AnnotationOverlay.d.ts.map +1 -1
- package/dist/client/general/ForgeClient.d.ts.map +1 -1
- package/dist/client.js +41 -52
- package/dist/host/ForgeHost.d.ts +0 -2
- package/dist/host/ForgeHost.d.ts.map +1 -1
- package/dist/host.js +11 -14
- package/dist/shared/events.d.ts +0 -3
- package/dist/shared/events.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -31,8 +31,6 @@ export declare class AnnotationOverlay {
|
|
|
31
31
|
deactivate(): void;
|
|
32
32
|
/** Selects a dot by ID — highlights its elements and applies selected style. Called from the parent. */
|
|
33
33
|
selectDot(annotationId: string): void;
|
|
34
|
-
/** Clears any selected annotation highlight and restores hover behavior. */
|
|
35
|
-
clearSelectedAnnotation(): void;
|
|
36
34
|
/** Enters accumulation mode — subsequent clicks toggle elements in/out of the annotation. */
|
|
37
35
|
enterAccumulation(annotationId: string, existingElements: AnnotationElementInfo[]): void;
|
|
38
36
|
/** Exits accumulation mode and returns final annotation data (or null if empty). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnnotationOverlay.d.ts","sourceRoot":"","sources":["../../../src/client/annotation/AnnotationOverlay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEhE,OAAO,KAAK,EAAkB,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AA6B1G;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,cAAc,CAA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C,YAAY;IAWpB,OAAO,CAAC,eAAe;CAWxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForgeClient.d.ts","sourceRoot":"","sources":["../../../src/client/general/ForgeClient.ts"],"names":[],"mappings":"AACA,OAAO,EAA+C,KAAK,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAOhH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD;;;;;;GAMG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAClD,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,iBAAiB,CAAmB;IAC5C,OAAO,CAAC,iBAAiB,CAAiC;IAC1D,OAAO,CAAC,gBAAgB,CAAsB;IAC9C,OAAO,CAAC,gBAAgB,CAAsB;IAC9C,OAAO,CAAC,OAAO,CAAC,CAAwB;IAExC,OAAO;IA4BP,4EAA4E;IAC5E,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,WAAW;IAO7D,6FAA6F;IAC7F,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAI5C,2FAA2F;IAC3F,kBAAkB,CAAC,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAI;IAS9D,OAAO,CAAC,oBAAoB;
|
|
1
|
+
{"version":3,"file":"ForgeClient.d.ts","sourceRoot":"","sources":["../../../src/client/general/ForgeClient.ts"],"names":[],"mappings":"AACA,OAAO,EAA+C,KAAK,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAOhH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD;;;;;;GAMG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAClD,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,iBAAiB,CAAmB;IAC5C,OAAO,CAAC,iBAAiB,CAAiC;IAC1D,OAAO,CAAC,gBAAgB,CAAsB;IAC9C,OAAO,CAAC,gBAAgB,CAAsB;IAC9C,OAAO,CAAC,OAAO,CAAC,CAAwB;IAExC,OAAO;IA4BP,4EAA4E;IAC5E,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,WAAW;IAO7D,6FAA6F;IAC7F,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAI5C,2FAA2F;IAC3F,kBAAkB,CAAC,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAI;IAS9D,OAAO,CAAC,oBAAoB;IA2E5B,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,yBAAyB;CAkBlC"}
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as $, c as X, R as Y, d as U, Z as
|
|
1
|
+
import { b as $, c as X, R as Y, d as U, Z as C, C as v, M as O, B as M, e as B, P as G, i as W, a as V, T as j } from "./constants-BXKWBfHg.js";
|
|
2
2
|
import { d as c } from "./debug-CLzmqn3R.js";
|
|
3
3
|
class z {
|
|
4
4
|
registry = /* @__PURE__ */ new Map();
|
|
@@ -38,42 +38,42 @@ function H(r) {
|
|
|
38
38
|
}
|
|
39
39
|
return e;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function b(r) {
|
|
42
42
|
return r.length === 1 && r[0].startsWith("*[@id=") ? `//${r[0]}` : "/" + r.join("/");
|
|
43
43
|
}
|
|
44
44
|
const u = { FunctionComponent: 0, ClassComponent: 1, IndeterminateComponent: 2, HostRoot: 3, HostPortal: 4, HostComponent: 5, HostText: 6, Fragment: 7, Mode: 8, ContextConsumer: 9, ContextProvider: 10, ForwardRef: 11, Profiler: 12, SuspenseComponent: 13, MemoComponent: 14, SimpleMemoComponent: 15, LazyComponent: 16, IncompleteClassComponent: 17, DehydratedFragment: 18, SuspenseListComponent: 19, ScopeComponent: 21, OffscreenComponent: 22, LegacyHiddenComponent: 23, CacheComponent: 24, TracingMarkerComponent: 25, HostHoistable: 26, HostSingleton: 27, IncompleteFunctionComponent: 28, Throw: 29, ViewTransitionComponent: 30, ActivityComponent: 31 }, K = /* @__PURE__ */ new Set(["Component", "PureComponent", "Fragment", "Suspense", "Profiler", "StrictMode", "Routes", "Route", "Outlet", "Root", "ErrorBoundaryHandler", "HotReload", "Hot"]), J = [/Boundary$/, /BoundaryHandler$/, /Provider$/, /Consumer$/, /^(Inner|Outer)/, /Router$/, /^Client(Page|Segment|Root)/, /^Server(Root|Component|Render)/, /^RSC/, /Context$/, /^Hot(Reload)?$/, /^(Dev|React)(Overlay|Tools|Root)/, /Overlay$/, /Handler$/, /^With[A-Z]/, /Wrapper$/, /^Root$/];
|
|
45
|
-
let
|
|
46
|
-
function
|
|
45
|
+
let T = null;
|
|
46
|
+
function N(r) {
|
|
47
47
|
const e = (t) => t.some((n) => n.startsWith("__reactFiber$") || n.startsWith("__reactInternalInstance$") || n.startsWith("__reactProps$"));
|
|
48
48
|
return e(Object.keys(r)) || e(Object.getOwnPropertyNames(r));
|
|
49
49
|
}
|
|
50
50
|
function q() {
|
|
51
|
-
if (
|
|
51
|
+
if (T !== null) return T;
|
|
52
52
|
if (typeof document > "u") return !1;
|
|
53
|
-
if (document.body &&
|
|
54
|
-
return c("client", "Detected React on document.body"),
|
|
53
|
+
if (document.body && N(document.body))
|
|
54
|
+
return c("client", "Detected React on document.body"), T = !0, !0;
|
|
55
55
|
for (const e of Y) {
|
|
56
56
|
const t = document.querySelector(e);
|
|
57
57
|
if (t) {
|
|
58
|
-
if (
|
|
59
|
-
return c("client", "Detected React on", e),
|
|
58
|
+
if (N(t))
|
|
59
|
+
return c("client", "Detected React on", e), T = !0, !0;
|
|
60
60
|
for (const n of t.children)
|
|
61
|
-
if (
|
|
62
|
-
return c("client", "Detected React on child of", e),
|
|
61
|
+
if (N(n))
|
|
62
|
+
return c("client", "Detected React on child of", e), T = !0, !0;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
if (document.body) {
|
|
66
66
|
for (const e of document.body.children)
|
|
67
|
-
if (
|
|
68
|
-
return c("client", "Detected React on body child:", e.tagName),
|
|
67
|
+
if (N(e))
|
|
68
|
+
return c("client", "Detected React on body child:", e.tagName), T = !0, !0;
|
|
69
69
|
}
|
|
70
70
|
const r = document.querySelectorAll("*");
|
|
71
71
|
for (const e of r) {
|
|
72
|
-
if (
|
|
73
|
-
return c("client", "Detected React on deep scan:", e.tagName),
|
|
72
|
+
if (N(e))
|
|
73
|
+
return c("client", "Detected React on deep scan:", e.tagName), T = !0, !0;
|
|
74
74
|
if (r.length > U) break;
|
|
75
75
|
}
|
|
76
|
-
return c("client", "React NOT detected on page"),
|
|
76
|
+
return c("client", "React NOT detected on page"), T = !1, !1;
|
|
77
77
|
}
|
|
78
78
|
function Z(r) {
|
|
79
79
|
const e = Object.keys(r);
|
|
@@ -149,20 +149,20 @@ function ne(r, e = $, t = X) {
|
|
|
149
149
|
return n.length === 0 ? { path: null, components: [] } : { path: n.slice().reverse().map((i) => `<${i}>`).join(" "), components: n };
|
|
150
150
|
}
|
|
151
151
|
let S = null, E = null;
|
|
152
|
-
function
|
|
152
|
+
function x(r, e, t, n = "solid") {
|
|
153
153
|
const o = document.createElement("div");
|
|
154
|
-
return Object.assign(o.style, { position: "fixed", left: `${r.left}px`, top: `${r.top}px`, width: `${r.width}px`, height: `${r.height}px`, border: `1px ${n} ${e}`, backgroundColor: t, pointerEvents: "none", zIndex:
|
|
154
|
+
return Object.assign(o.style, { position: "fixed", left: `${r.left}px`, top: `${r.top}px`, width: `${r.width}px`, height: `${r.height}px`, border: `1px ${n} ${e}`, backgroundColor: t, pointerEvents: "none", zIndex: C.HOVER_OVERLAY, borderRadius: "2px" }), o;
|
|
155
155
|
}
|
|
156
156
|
function oe(r) {
|
|
157
157
|
L();
|
|
158
158
|
const e = r.getBoundingClientRect();
|
|
159
|
-
S =
|
|
159
|
+
S = x(e, v.SELECT_OVERLAY_BORDER, v.SELECT_OVERLAY_BG), S.className = "forge-overlay", document.body.appendChild(S);
|
|
160
160
|
}
|
|
161
161
|
function L() {
|
|
162
162
|
S && (S.remove(), S = null);
|
|
163
163
|
}
|
|
164
164
|
function ie() {
|
|
165
|
-
return E || (E = document.createElement("div"), Object.assign(E.style, { position: "fixed", top: "0", left: "0", width: "100%", height: "100%", backgroundColor: "transparent", pointerEvents: "auto", zIndex:
|
|
165
|
+
return E || (E = document.createElement("div"), Object.assign(E.style, { position: "fixed", top: "0", left: "0", width: "100%", height: "100%", backgroundColor: "transparent", pointerEvents: "auto", zIndex: C.HIT_TEST_OVERLAY, cursor: "crosshair" }), E.className = "forge-hit-test-overlay", document.body.appendChild(E), E);
|
|
166
166
|
}
|
|
167
167
|
function se() {
|
|
168
168
|
E && (E.remove(), E = null);
|
|
@@ -204,18 +204,11 @@ class D {
|
|
|
204
204
|
const t = this.dots.get(e);
|
|
205
205
|
t && (this.removeHoverOverlay(), this.hoverSuppressed = !0, this.highlightAnnotationElements(t));
|
|
206
206
|
}
|
|
207
|
-
clearSelectedAnnotation() {
|
|
208
|
-
if (this.accumulationId) {
|
|
209
|
-
this.removeHoverOverlay(), this.hoverSuppressed = !1;
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
this.removeHoverOverlay(), this.clearAnnotationHighlights(), this.hoverSuppressed = !1;
|
|
213
|
-
}
|
|
214
207
|
enterAccumulation(e, t) {
|
|
215
208
|
if (this.accumulationId !== e) {
|
|
216
209
|
this.accumulationId = e, this.accumulationElements = [], this.clearAnnotationHighlights();
|
|
217
210
|
for (const n of t) {
|
|
218
|
-
const o = { xpath:
|
|
211
|
+
const o = { xpath: b(n.xpath), forgeId: n.forgeId, forgeIdIndex: n.forgeIdIndex }, i = this.resolveLocator(o);
|
|
219
212
|
i && this.accumulationElements.push(i);
|
|
220
213
|
}
|
|
221
214
|
this.refreshAccumulationHighlights(), this.hoverSuppressed = !1, c("annotation", `Entered accumulation mode for ${e} with ${this.accumulationElements.length} elements`);
|
|
@@ -243,7 +236,7 @@ class D {
|
|
|
243
236
|
const o = document.querySelectorAll(`[data-forge-id="${t}"]`);
|
|
244
237
|
o.length > 1 && (n = Array.from(o).indexOf(e));
|
|
245
238
|
}
|
|
246
|
-
return { xpath:
|
|
239
|
+
return { xpath: b(H(e)), forgeId: t, forgeIdIndex: n };
|
|
247
240
|
}
|
|
248
241
|
elementToInfo(e) {
|
|
249
242
|
return { elementTag: e.tagName.toLowerCase(), xpath: H(e), componentName: e.getAttribute("data-component") || void 0, componentPath: this.getComponentPath(e) || void 0, forgeId: e.getAttribute("data-forge-id") || void 0, forgeIdIndex: this.resolveForgeIdIndex(e), sourcePos: e.getAttribute("data-source-pos") || void 0 };
|
|
@@ -262,7 +255,7 @@ class D {
|
|
|
262
255
|
return;
|
|
263
256
|
}
|
|
264
257
|
const n = e[e.length - 1].getBoundingClientRect(), o = n.left + n.width / 2, i = n.bottom, s = e.map((g) => this.elementToInfo(g)), a = e.map((g) => this.elementToLocator(g)), l = this.getAnchorRect(a), h = o - 2, d = i - M - 2, m = l && l.width > 0 && l.height > 0 ? { x: (h - l.left) / l.width, y: (d - l.top) / l.height } : { x: 0, y: 0 }, p = s[0];
|
|
265
|
-
this.messenger.send({ type: "ACCUMULATION_UPDATED", annotation: { id: this.accumulationId, dotX: o, dotY: i, anchorOffset: m, mode: e.length > 1 ? "multi" : "single", elements: s, xpaths: s.map((g) =>
|
|
258
|
+
this.messenger.send({ type: "ACCUMULATION_UPDATED", annotation: { id: this.accumulationId, dotX: o, dotY: i, anchorOffset: m, mode: e.length > 1 ? "multi" : "single", elements: s, xpaths: s.map((g) => b(g.xpath)), elementTag: p.elementTag, componentName: p.componentName, componentPath: p.componentPath, forgeId: p.forgeId, sourcePos: p.sourcePos }, origin: O });
|
|
266
259
|
}
|
|
267
260
|
removeDot(e) {
|
|
268
261
|
const t = this.dots.get(e);
|
|
@@ -274,7 +267,7 @@ class D {
|
|
|
274
267
|
restoreDots(e) {
|
|
275
268
|
this.removeAllDots();
|
|
276
269
|
for (const t of e) {
|
|
277
|
-
const n = t.elements.map((i) => ({ xpath:
|
|
270
|
+
const n = t.elements.map((i) => ({ xpath: b(i.xpath), forgeId: i.forgeId, forgeIdIndex: i.forgeIdIndex })), o = this.getAnchorRect(n);
|
|
278
271
|
if (o && t.anchorOffset && o.width > 0 && o.height > 0) {
|
|
279
272
|
const i = { rx: t.anchorOffset.x, ry: t.anchorOffset.y }, s = o.left + i.rx * o.width, a = o.top + i.ry * o.height;
|
|
280
273
|
this.createDotAtPosition(s, a, t.mode, t.id, t.order, n, i);
|
|
@@ -308,7 +301,7 @@ class D {
|
|
|
308
301
|
this.repositionHoverOverlay();
|
|
309
302
|
};
|
|
310
303
|
createHitTestOverlay() {
|
|
311
|
-
this.hitTestOverlay || (this.hitTestOverlay = document.createElement("div"), Object.assign(this.hitTestOverlay.style, { position: "fixed", top: "0", left: "0", width: "100%", height: "100%", backgroundColor: "transparent", pointerEvents: "auto", zIndex:
|
|
304
|
+
this.hitTestOverlay || (this.hitTestOverlay = document.createElement("div"), Object.assign(this.hitTestOverlay.style, { position: "fixed", top: "0", left: "0", width: "100%", height: "100%", backgroundColor: "transparent", pointerEvents: "auto", zIndex: C.HIT_TEST_OVERLAY, cursor: "crosshair" }), this.hitTestOverlay.className = "forge-annotation-hit-test", document.body.appendChild(this.hitTestOverlay));
|
|
312
305
|
}
|
|
313
306
|
removeHitTestOverlay() {
|
|
314
307
|
this.hitTestOverlay && (this.hitTestOverlay.remove(), this.hitTestOverlay = null);
|
|
@@ -316,7 +309,7 @@ class D {
|
|
|
316
309
|
showHoverOverlay(e, t, n) {
|
|
317
310
|
this.hoverOverlay && (this.hoverOverlay.remove(), this.hoverOverlay = null), this.lastHoveredElement = e;
|
|
318
311
|
const o = e.getBoundingClientRect(), i = t === v.ANNOTATION_MULTI ? v.ANNOTATION_MULTI_BG : v.ANNOTATION_SINGLE_BG;
|
|
319
|
-
this.hoverOverlay =
|
|
312
|
+
this.hoverOverlay = x(o, t, i, "solid"), this.hoverOverlay.style.transition = "all 0.05s ease", this.hoverOverlay.className = "forge-annotation-hover", document.body.appendChild(this.hoverOverlay), this.showComponentTooltip(n || e, o);
|
|
320
313
|
}
|
|
321
314
|
removeHoverOverlay() {
|
|
322
315
|
this.hoverOverlay && (this.hoverOverlay.remove(), this.hoverOverlay = null), this.lastHoveredElement = null, this.removeComponentTooltip();
|
|
@@ -361,12 +354,12 @@ class D {
|
|
|
361
354
|
if (i) {
|
|
362
355
|
const s = i.getBoundingClientRect();
|
|
363
356
|
n.push(s);
|
|
364
|
-
const a =
|
|
357
|
+
const a = x(s, v.ANNOTATION_SINGLE, v.ANNOTATION_SINGLE_BG, "solid");
|
|
365
358
|
a.className = "forge-annotation-highlight", document.body.appendChild(a), this.annotationHighlights.push(a);
|
|
366
359
|
}
|
|
367
360
|
}
|
|
368
361
|
if (t && n.length > 1) {
|
|
369
|
-
const o = Math.min(...n.map((d) => d.left)), i = Math.min(...n.map((d) => d.top)), s = Math.max(...n.map((d) => d.right)), a = Math.max(...n.map((d) => d.bottom)), l = new DOMRect(o, i, s - o, a - i), h =
|
|
362
|
+
const o = Math.min(...n.map((d) => d.left)), i = Math.min(...n.map((d) => d.top)), s = Math.max(...n.map((d) => d.right)), a = Math.max(...n.map((d) => d.bottom)), l = new DOMRect(o, i, s - o, a - i), h = x(l, v.ANNOTATION_SINGLE, "transparent", "dashed");
|
|
370
363
|
h.className = "forge-annotation-bounding-rect", document.body.appendChild(h), this.annotationHighlights.push(h);
|
|
371
364
|
}
|
|
372
365
|
}
|
|
@@ -411,7 +404,7 @@ class D {
|
|
|
411
404
|
const n = this.getComponentPath(e);
|
|
412
405
|
if (!n) return;
|
|
413
406
|
const o = document.createElement("div");
|
|
414
|
-
Object.assign(o.style, { position: "fixed", zIndex:
|
|
407
|
+
Object.assign(o.style, { position: "fixed", zIndex: C.TOOLTIP, backgroundColor: "rgba(30, 30, 30, 0.92)", color: "#e4e4e7", padding: "4px 10px", borderRadius: "6px", fontSize: "11px", fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif", fontWeight: "500", letterSpacing: "0.3px", whiteSpace: "nowrap", pointerEvents: "none", backdropFilter: "blur(8px)", boxShadow: "0 2px 8px rgba(0,0,0,0.3)", transition: "opacity 0.1s ease" }), o.textContent = n.map((l) => `<${l}>`).join(" "), o.className = "forge-annotation-component-tooltip", document.body.appendChild(o);
|
|
415
408
|
const i = o.getBoundingClientRect();
|
|
416
409
|
let s = t.left + t.width / 2 - i.width / 2, a = t.top - i.height - 6;
|
|
417
410
|
s < 4 && (s = 4), s + i.width > window.innerWidth - 4 && (s = window.innerWidth - i.width - 4), a < 4 && (a = t.bottom + 6), o.style.left = `${s}px`, o.style.top = `${a}px`, this.componentTooltip = o;
|
|
@@ -420,7 +413,7 @@ class D {
|
|
|
420
413
|
this.componentTooltip && (this.componentTooltip.remove(), this.componentTooltip = null);
|
|
421
414
|
}
|
|
422
415
|
showDragRect(e, t, n, o) {
|
|
423
|
-
this.dragRect || (this.dragRect = document.createElement("div"), Object.assign(this.dragRect.style, { position: "fixed", border: `1px dashed ${v.ANNOTATION_MULTI}`, backgroundColor: v.DRAG_RECT_BG, pointerEvents: "none", zIndex:
|
|
416
|
+
this.dragRect || (this.dragRect = document.createElement("div"), Object.assign(this.dragRect.style, { position: "fixed", border: `1px dashed ${v.ANNOTATION_MULTI}`, backgroundColor: v.DRAG_RECT_BG, pointerEvents: "none", zIndex: C.HOVER_OVERLAY, borderRadius: "4px" }), this.dragRect.className = "forge-annotation-drag-rect", document.body.appendChild(this.dragRect)), Object.assign(this.dragRect.style, { left: `${Math.min(e, n)}px`, top: `${Math.min(t, o)}px`, width: `${Math.abs(n - e)}px`, height: `${Math.abs(o - t)}px` });
|
|
424
417
|
}
|
|
425
418
|
removeDragRect() {
|
|
426
419
|
this.dragRect && (this.dragRect.remove(), this.dragRect = null), this.clearDragHighlights();
|
|
@@ -428,7 +421,7 @@ class D {
|
|
|
428
421
|
showDragHighlights(e) {
|
|
429
422
|
this.clearDragHighlights();
|
|
430
423
|
for (const t of e) {
|
|
431
|
-
const n = t.getBoundingClientRect(), o =
|
|
424
|
+
const n = t.getBoundingClientRect(), o = x(n, v.ANNOTATION_MULTI, v.ANNOTATION_MULTI_BG, "solid");
|
|
432
425
|
o.className = "forge-annotation-drag-highlight", document.body.appendChild(o), this.dragHighlights.push(o);
|
|
433
426
|
}
|
|
434
427
|
}
|
|
@@ -442,7 +435,7 @@ class D {
|
|
|
442
435
|
}
|
|
443
436
|
createDotAtPosition(e, t, n, o, i, s, a) {
|
|
444
437
|
const l = document.createElement("div");
|
|
445
|
-
Object.assign(l.style, { position: "fixed", left: `${e}px`, top: `${t}px`, minWidth: `${B}px`, height: `${M}px`, borderRadius: "50% 50% 50% 0", backgroundColor: "#FFFFFF", border: "1px solid #1A58D0", cursor: "pointer", zIndex:
|
|
438
|
+
Object.assign(l.style, { position: "fixed", left: `${e}px`, top: `${t}px`, minWidth: `${B}px`, height: `${M}px`, borderRadius: "50% 50% 50% 0", backgroundColor: "#FFFFFF", border: "1px solid #1A58D0", cursor: "pointer", zIndex: C.ANNOTATION_DOT, transition: "transform 0.15s ease", display: this.markersVisible ? "flex" : "none", alignItems: "center", justifyContent: "center", padding: "0 4px", fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif", fontSize: "11px", fontWeight: "700", color: "#1A58D0", lineHeight: "1", userSelect: "none" }), l.textContent = String(i), l.className = "forge-annotation-dot", l.dataset.annotationId = o, l.addEventListener("mouseenter", () => {
|
|
446
439
|
l.style.transform = "scale(1.05)", this.removeHoverOverlay();
|
|
447
440
|
}), l.addEventListener("mouseleave", () => {
|
|
448
441
|
l.style.transform = "scale(1)";
|
|
@@ -594,15 +587,14 @@ class D {
|
|
|
594
587
|
n && (this.createDot(n.dotX, n.dotY, n.mode, e, t, n.locators), this.pendingAnnotations.delete(e)), this.clearAnnotationHighlights(), this.hoverSuppressed = !1;
|
|
595
588
|
}
|
|
596
589
|
cancelPending(e) {
|
|
597
|
-
|
|
598
|
-
n && (this.accumulationId = null, this.accumulationElements = []), (t || n || o) && this.clearAnnotationHighlights(), this.hoverSuppressed = !1;
|
|
590
|
+
this.pendingAnnotations.delete(e), this.accumulationId === e && (this.accumulationId = null, this.accumulationElements = []), this.clearAnnotationHighlights(), this.hoverSuppressed = !1;
|
|
599
591
|
}
|
|
600
592
|
createAnnotationFromElements(e, t, n, o, i) {
|
|
601
593
|
const s = i || ae();
|
|
602
594
|
this.hoverSuppressed = !0, this.removeHoverOverlay();
|
|
603
|
-
const a = e.map((f) => this.elementToInfo(f)), l = a.map((f) => ({ xpath:
|
|
595
|
+
const a = e.map((f) => this.elementToInfo(f)), l = a.map((f) => ({ xpath: b(f.xpath), forgeId: f.forgeId, forgeIdIndex: f.forgeIdIndex })), h = this.getAnchorRect(l), d = n - 2, m = o - M - 2, p = h && h.width > 0 && h.height > 0 ? { x: (d - h.left) / h.width, y: (m - h.top) / h.height } : { x: 0, y: 0 };
|
|
604
596
|
this.pendingAnnotations.set(s, { dotX: n, dotY: o, mode: t, locators: l }), this.clearDragHighlights(), this.highlightLocators(l, t === "multi");
|
|
605
|
-
const g = a[0], y = { id: s, dotX: n, dotY: o, anchorOffset: p, mode: t, elements: a, xpaths: a.map((f) =>
|
|
597
|
+
const g = a[0], y = { id: s, dotX: n, dotY: o, anchorOffset: p, mode: t, elements: a, xpaths: a.map((f) => b(f.xpath)), elementTag: g.elementTag, componentName: g.componentName, componentPath: g.componentPath, forgeId: g.forgeId, sourcePos: g.sourcePos };
|
|
606
598
|
c("annotation", "Annotation created (pending):", y), this.messenger.send({ type: "ANNOTATION_CREATED", annotation: y, origin: O });
|
|
607
599
|
}
|
|
608
600
|
handleDocumentLeave = () => {
|
|
@@ -644,7 +636,7 @@ class le {
|
|
|
644
636
|
return o;
|
|
645
637
|
}
|
|
646
638
|
handleSelectModeClick(e) {
|
|
647
|
-
const t =
|
|
639
|
+
const t = b(H(e));
|
|
648
640
|
c("client", "Element clicked, XPath:", t), this.messenger.send({ type: "XPATH_REPORT", xpath: t, origin: O }), this.messenger.send({ type: "SELECT_MODE_DISABLED", origin: O });
|
|
649
641
|
}
|
|
650
642
|
handleMouseOver = (e) => {
|
|
@@ -758,7 +750,7 @@ class ge {
|
|
|
758
750
|
}
|
|
759
751
|
const n = this.selectController.findTopmostElementWithSameId(e), o = n.getAttribute("data-component"), i = n.getAttribute("data-source-pos"), s = o || n.tagName.toLowerCase();
|
|
760
752
|
this.clearSelection(), this.selectedElement = n, this.applyHighlight(n);
|
|
761
|
-
const a = n.textContent?.trim() || "", l = n.tagName.toLowerCase(), h =
|
|
753
|
+
const a = n.textContent?.trim() || "", l = n.tagName.toLowerCase(), h = b(H(n)), d = this.componentRegistry.getEditableProps(s), m = this.extractPropValues(n, d);
|
|
762
754
|
c("client", "Element selected in design mode:", { forgeId: t, sourcePos: i, text: a, type: l, componentName: s, editableProps: d, propValues: m }), this.messenger.send({ type: "ELEMENT_SELECTED", forgeId: t, sourcePos: i || void 0, text: a, elementType: l, xpath: h, componentName: s, editableProps: d, propValues: m, origin: O });
|
|
763
755
|
}
|
|
764
756
|
updateText(e, t) {
|
|
@@ -816,7 +808,7 @@ class ge {
|
|
|
816
808
|
return t ? e[t] : null;
|
|
817
809
|
}
|
|
818
810
|
}
|
|
819
|
-
class
|
|
811
|
+
class I {
|
|
820
812
|
static instance = null;
|
|
821
813
|
messenger;
|
|
822
814
|
selectMode = !1;
|
|
@@ -831,7 +823,7 @@ class C {
|
|
|
831
823
|
this.onError = e?.onError, c("client", "ForgeClient initialized"), this.messenger = new G(), this.componentRegistry = new z(), this.selectController = new le(this.messenger, { getSelectMode: () => this.selectMode, getDesignMode: () => this.designMode, getHoverDisabled: () => this.hoverDisabled, getSelectedDesignElement: () => this.designController.getSelectedElement(), onSelectClick: (t) => this.handleSelectClick(t), onDesignClick: (t) => this.handleDesignClick(t) }), this.designController = new ge(this.messenger, this.componentRegistry, this.selectController), this.setupMessageListener(), this.sendReady(), this.setupForgeIdPropagation(), window.__forgeClient = this;
|
|
832
824
|
}
|
|
833
825
|
static getInstance(e) {
|
|
834
|
-
return
|
|
826
|
+
return I.instance || (I.instance = new I(e)), I.instance;
|
|
835
827
|
}
|
|
836
828
|
enableAnnotationMode(e) {
|
|
837
829
|
this.setAnnotationMode(e);
|
|
@@ -871,9 +863,6 @@ class C {
|
|
|
871
863
|
case "SELECT_ANNOTATION":
|
|
872
864
|
this.annotationOverlay?.selectDot(t.annotationId);
|
|
873
865
|
break;
|
|
874
|
-
case "UNSELECT_ANNOTATION":
|
|
875
|
-
this.annotationOverlay?.clearSelectedAnnotation();
|
|
876
|
-
break;
|
|
877
866
|
case "ENTER_ACCUMULATION":
|
|
878
867
|
this.annotationOverlay && this.annotationOverlay.enterAccumulation(t.annotationId, t.elements);
|
|
879
868
|
break;
|
|
@@ -949,8 +938,8 @@ class C {
|
|
|
949
938
|
}
|
|
950
939
|
}
|
|
951
940
|
}
|
|
952
|
-
|
|
941
|
+
I.getInstance();
|
|
953
942
|
export {
|
|
954
|
-
|
|
943
|
+
I as ForgeClient,
|
|
955
944
|
G as ParentMessenger
|
|
956
945
|
};
|
package/dist/host/ForgeHost.d.ts
CHANGED
|
@@ -32,8 +32,6 @@ export declare class ForgeHost {
|
|
|
32
32
|
deleteAnnotation(annotationId: string): void;
|
|
33
33
|
/** Selects an annotation dot in the child — highlights its elements and applies selected style. */
|
|
34
34
|
selectAnnotation(annotationId: string): void;
|
|
35
|
-
/** Clears the selected annotation highlight in the child. */
|
|
36
|
-
unselectAnnotation(): void;
|
|
37
35
|
/** Enters accumulation mode — the child will toggle elements on click for this annotation. */
|
|
38
36
|
enterAccumulation(annotationId: string, elements: AnnotationElementInfo[]): void;
|
|
39
37
|
/** Exits accumulation mode — the child will finalize and send the annotation. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForgeHost.d.ts","sourceRoot":"","sources":["../../src/host/ForgeHost.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC5G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAI9D;;;;;GAKG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,MAAM,CAAmC;IACjD,OAAO,CAAC,aAAa,CAA6C;IAClE,OAAO,CAAC,cAAc,CAA4B;IAClD,OAAO,CAAC,iBAAiB,CAA4B;IACrD,OAAO,CAAC,iBAAiB,CAAyC;gBAEtD,MAAM,EAAE,iBAAiB;IAMrC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA6C9B,OAAO,CAAC,gBAAgB;IA+ExB,+DAA+D;IAC/D,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAQxC,iEAAiE;IACjE,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAQxC,mDAAmD;IACnD,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAQ5C,iDAAiD;IACjD,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAK5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AAI;IAK5C,8DAA8D;IAC9D,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAKzD,6DAA6D;IAC7D,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAK5D,gEAAgE;IAChE,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAOtD,mEAAmE;IACnE,aAAa,IAAI,IAAI;IAKrB,2EAA2E;IAC3E,kBAAkB,CAAC,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAI;IAK9D,6DAA6D;IAC7D,eAAe,IAAI,IAAI;IAOvB,+DAA+D;IAC/D,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,IAAI;IAOzE,0DAA0D;IAC1D,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAOnE,mEAAmE;IACnE,EAAE,CAAC,CAAC,SAAS,MAAM,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAU5E,OAAO,CAAC,IAAI;IASZ,6CAA6C;IAC7C,SAAS,IAAI,gBAAgB;IAI7B,iEAAiE;IACjE,UAAU,IAAI,IAAI;CAanB"}
|
package/dist/host.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { T as c, W as h, a as i, i as d, M as E } from "./constants-BXKWBfHg.js";
|
|
2
2
|
import { d as n } from "./debug-CLzmqn3R.js";
|
|
3
|
-
class
|
|
3
|
+
class p {
|
|
4
4
|
iframe;
|
|
5
5
|
messenger = null;
|
|
6
6
|
status = "disconnected";
|
|
@@ -16,14 +16,14 @@ class u {
|
|
|
16
16
|
this.status = "connecting";
|
|
17
17
|
const t = () => {
|
|
18
18
|
this.readyCheckCleanup && (this.readyCheckCleanup(), this.readyCheckCleanup = null);
|
|
19
|
-
},
|
|
19
|
+
}, a = (o) => {
|
|
20
20
|
if (!d(o.data) && (n("host", "Received message:", o.data, "from origin:", o.origin), o.data && typeof o.data == "object" && "type" in o.data)) {
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const r = o.data;
|
|
22
|
+
r.origin === E && r.type === "CHILD_READY" && (n("host", "CHILD_READY received from sandbox, finishing connection"), t(), this.finishConnection(), e());
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
n("host", "Setting up message listener for CHILD_READY"), window.addEventListener("message",
|
|
26
|
-
window.removeEventListener("message",
|
|
25
|
+
n("host", "Setting up message listener for CHILD_READY"), window.addEventListener("message", a), this.readyCheckCleanup = () => {
|
|
26
|
+
window.removeEventListener("message", a);
|
|
27
27
|
}, setTimeout(() => {
|
|
28
28
|
this.status === "connecting" && (n("host", "Connection timeout - child did not respond"), t(), this.status = "disconnected", s(new Error("Connection timeout - child app did not respond")));
|
|
29
29
|
}, c.CONNECTION_TIMEOUT);
|
|
@@ -50,8 +50,8 @@ class u {
|
|
|
50
50
|
break;
|
|
51
51
|
case "ELEMENT_SELECTED": {
|
|
52
52
|
n("host", "ELEMENT_SELECTED received:", t);
|
|
53
|
-
const
|
|
54
|
-
this.emit("element-selected", { forgeId: t.forgeId, sourcePos: t.sourcePos, text: t.text, type: t.elementType, xpath: t.xpath, componentName: t.componentName, editableProps:
|
|
53
|
+
const a = t.editableProps.map((o) => ({ name: o.name, type: o.type, options: o.options, default: o.default, editable: o.editable, label: o.label }));
|
|
54
|
+
this.emit("element-selected", { forgeId: t.forgeId, sourcePos: t.sourcePos, text: t.text, type: t.elementType, xpath: t.xpath, componentName: t.componentName, editableProps: a, propValues: t.propValues });
|
|
55
55
|
break;
|
|
56
56
|
}
|
|
57
57
|
case "REGISTER_COMPONENTS":
|
|
@@ -93,9 +93,6 @@ class u {
|
|
|
93
93
|
selectAnnotation(e) {
|
|
94
94
|
!this.messenger || this.status !== "connected" || this.messenger.send({ type: "SELECT_ANNOTATION", annotationId: e, origin: i });
|
|
95
95
|
}
|
|
96
|
-
unselectAnnotation() {
|
|
97
|
-
!this.messenger || this.status !== "connected" || this.messenger.send({ type: "UNSELECT_ANNOTATION", origin: i });
|
|
98
|
-
}
|
|
99
96
|
enterAccumulation(e, s) {
|
|
100
97
|
!this.messenger || this.status !== "connected" || this.messenger.send({ type: "ENTER_ACCUMULATION", annotationId: e, elements: s, origin: i });
|
|
101
98
|
}
|
|
@@ -141,8 +138,8 @@ class u {
|
|
|
141
138
|
}
|
|
142
139
|
emit(e, ...s) {
|
|
143
140
|
const t = this.eventHandlers.get(e);
|
|
144
|
-
t && t.forEach((
|
|
145
|
-
|
|
141
|
+
t && t.forEach((a) => {
|
|
142
|
+
a(...s);
|
|
146
143
|
});
|
|
147
144
|
}
|
|
148
145
|
getStatus() {
|
|
@@ -153,5 +150,5 @@ class u {
|
|
|
153
150
|
}
|
|
154
151
|
}
|
|
155
152
|
export {
|
|
156
|
-
|
|
153
|
+
p as ForgeHost
|
|
157
154
|
};
|
package/dist/shared/events.d.ts
CHANGED
|
@@ -26,9 +26,6 @@ export type HostToClientMessage = {
|
|
|
26
26
|
type: "SELECT_ANNOTATION";
|
|
27
27
|
annotationId: string;
|
|
28
28
|
origin: typeof MESSAGE_ORIGIN_HOST;
|
|
29
|
-
} | {
|
|
30
|
-
type: "UNSELECT_ANNOTATION";
|
|
31
|
-
origin: typeof MESSAGE_ORIGIN_HOST;
|
|
32
29
|
} | {
|
|
33
30
|
type: "ANNOTATION_UPDATE_ORDERS";
|
|
34
31
|
orders: Record<string, number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/shared/events.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,mBAAmB,EAAG,MAAe,CAAA;AAClD,eAAO,MAAM,sBAAsB,EAAG,SAAkB,CAAA;AAExD,M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