@levo-so/site-runtime 0.1.113 → 0.2.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.
Files changed (40) hide show
  1. package/CollectionInput-5QMoXahu.js +147 -0
  2. package/DateTimeWidget-CARoq7bQ.js +254 -0
  3. package/PhoneWidget-vtDO9CFq.js +99 -0
  4. package/Popover-B76-bN-a.js +57 -0
  5. package/RichTextWidget-CafZBEKI.js +912 -0
  6. package/ThemeProvider-Cm2jJC7a.js +381 -0
  7. package/Tooltip-Bx-BfR7T.js +78 -0
  8. package/VerifyButton-D1Mwk04d.js +299 -0
  9. package/index.d.ts +674 -0
  10. package/index.js +5752 -0
  11. package/package.json +63 -31
  12. package/styles.css +2 -0
  13. package/README.md +0 -93
  14. package/dist/LevoSiteProvider.d.ts +0 -25
  15. package/dist/LevoSiteProvider.js +0 -23
  16. package/dist/client.d.ts +0 -26
  17. package/dist/client.js +0 -14
  18. package/dist/data/index.d.ts +0 -101
  19. package/dist/data/index.js +0 -79
  20. package/dist/index.d.ts +0 -26
  21. package/dist/index.js +0 -6
  22. package/dist/inspector/dom.d.ts +0 -56
  23. package/dist/inspector/dom.js +0 -224
  24. package/dist/inspector/editorChannel.d.ts +0 -7
  25. package/dist/inspector/editorChannel.js +0 -19
  26. package/dist/inspector/historyWatcher.d.ts +0 -8
  27. package/dist/inspector/historyWatcher.js +0 -24
  28. package/dist/inspector/index.d.ts +0 -2
  29. package/dist/inspector/index.js +0 -191
  30. package/dist/inspector/messageRouter.d.ts +0 -38
  31. package/dist/inspector/messageRouter.js +0 -134
  32. package/dist/inspector/originalsStash.d.ts +0 -12
  33. package/dist/inspector/originalsStash.js +0 -24
  34. package/dist/inspector/protocol.d.ts +0 -180
  35. package/dist/inspector/stagedOverrides.d.ts +0 -28
  36. package/dist/inspector/stagedOverrides.js +0 -60
  37. package/dist/inspector/textEditController.d.ts +0 -24
  38. package/dist/inspector/textEditController.js +0 -62
  39. package/dist/pageHead.d.ts +0 -75
  40. package/dist/pageHead.js +0 -102
@@ -1,191 +0,0 @@
1
- import { createOverlayNodes as e, externalLinkHref as t, isTextLeaf as n, positionBox as r, selectedPayload as ee, sourceOf as te } from "./dom.js";
2
- import { createEditorChannel as ne } from "./editorChannel.js";
3
- import { createHistoryWatcher as re } from "./historyWatcher.js";
4
- import { createMessageRouter as ie } from "./messageRouter.js";
5
- import { createOriginalsStash as i } from "./originalsStash.js";
6
- import { createStagedOverrides as a } from "./stagedOverrides.js";
7
- import { createTextEditController as ae } from "./textEditController.js";
8
- import { useEffect as o } from "react";
9
- //#region src/inspector/index.tsx
10
- function s() {
11
- return o(() => c(), []), null;
12
- }
13
- function c() {
14
- let o = !1, s = null, c = null, l = !1, u = null, d = i(), f = ne(), { overlay: p, label: m, ring: h, ringLabel: g } = e();
15
- document.body.append(p, m, h, g);
16
- let _ = [
17
- p,
18
- m,
19
- h,
20
- g
21
- ], v = null, y = (e) => {
22
- e && !v ? (v = document.createElement("style"), v.id = "studio-pick-cursor", v.textContent = "*,*::before,*::after{cursor:crosshair !important}", document.head.appendChild(v)) : !e && v && (v.remove(), v = null);
23
- }, b = (e) => !e || _.includes(e) || e === document.body || e === document.documentElement, x = (e) => {
24
- if (!e || b(e)) return null;
25
- let t = te(e) ? e : e.closest("[data-tsd-source]");
26
- return !t || b(t) || !n(t) ? null : t;
27
- }, S = (e) => r(p, m, e), C = () => {
28
- if (c) {
29
- if (!c.isConnected) {
30
- M();
31
- return;
32
- }
33
- r(h, g, c);
34
- }
35
- }, w = 0, T = () => {
36
- w || !c || l || (w = requestAnimationFrame(() => {
37
- w = 0, C();
38
- }));
39
- }, E = new ResizeObserver(T), D = new MutationObserver((e) => {
40
- for (let t of e) {
41
- let e = t.target;
42
- if (!_.some((t) => t === e) && !(t.type === "attributes" && t.attributeName === "data-staged-key")) {
43
- T(), I.scheduleReapply();
44
- return;
45
- }
46
- }
47
- }), O = !1, k = () => {
48
- O ||= (D.observe(document.documentElement, {
49
- attributes: !0,
50
- childList: !0,
51
- characterData: !0,
52
- subtree: !0
53
- }), !0);
54
- }, A = () => {
55
- O &&= (D.disconnect(), !1);
56
- }, j = () => {
57
- E.disconnect(), c?.isConnected && (E.observe(c), k());
58
- }, M = () => {
59
- c = null, E.disconnect(), L(), w &&= (cancelAnimationFrame(w), 0), h.style.display = "none", g.style.display = "none";
60
- }, N = (e) => S(e), P = () => {
61
- p.style.display = "none", m.style.display = "none";
62
- }, F = ae({
63
- channel: f,
64
- originals: d,
65
- clearTextHover: () => {
66
- u = null, P();
67
- }
68
- }), I = a({
69
- originals: d,
70
- editingNode: F.editingNode
71
- }), L = () => {
72
- c?.isConnected || I.count() ? k() : A();
73
- }, R = (e) => {
74
- e && l && z(!1), o = !!e, y(o), o || (s = null, p.style.display = "none", m.style.display = "none"), f.send({
75
- type: "inspect-state",
76
- enabled: o
77
- });
78
- }, z = (e) => {
79
- l = !!e, l ? (o && R(!1), h.style.display = "none", g.style.display = "none") : (F.commitIfEditing(), P(), document.documentElement.style.cursor = "", c && C()), f.send({
80
- type: "text-edit-state",
81
- enabled: l
82
- });
83
- }, B = 0, V = 0, H = 0, oe = () => {
84
- B = 0;
85
- let e = document.elementFromPoint(V, H);
86
- if (!b(e)) {
87
- if (l) {
88
- let t = x(e);
89
- if (t && t === F.editingNode()) {
90
- u = null, P(), document.documentElement.style.cursor = "";
91
- return;
92
- }
93
- u = t, document.documentElement.style.cursor = t ? "text" : "", t ? N(t) : P();
94
- return;
95
- }
96
- o && (s = e, e && S(e));
97
- }
98
- }, U = (e) => {
99
- !o && !l || (V = e.clientX, H = e.clientY, B ||= requestAnimationFrame(oe));
100
- }, W = 0, se = () => {
101
- W = 0, o && s && S(s), l && !F.editingNode() && u?.isConnected && N(u), c && !l && C();
102
- }, G = () => {
103
- W ||= requestAnimationFrame(se);
104
- }, K = (e) => {
105
- let n = t(e.target);
106
- return n ? (e.preventDefault(), e.stopPropagation(), window.open(n, "_blank", "noopener,noreferrer"), !0) : !1;
107
- }, q = (e) => {
108
- if (l) {
109
- let t = x(document.elementFromPoint(e.clientX, e.clientY) || e.target);
110
- if (!t || t === F.editingNode()) {
111
- K(e);
112
- return;
113
- }
114
- e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), F.startEdit(t);
115
- return;
116
- }
117
- if (!o) {
118
- K(e);
119
- return;
120
- }
121
- e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation();
122
- let t = s || e.target;
123
- if (b(t)) return;
124
- let n = t.closest("[data-tsd-source]") || t;
125
- c = n, C(), j(), f.send({
126
- type: "element-selected",
127
- element: ee(n)
128
- });
129
- }, J = ie({
130
- channel: f,
131
- originals: d,
132
- staged: I,
133
- setInspect: R,
134
- setTextEdit: z,
135
- isInspecting: () => o,
136
- isTextEditing: () => l,
137
- editingNode: F.editingNode,
138
- setSelected: (e) => {
139
- c = e, j();
140
- },
141
- positionSelected: C,
142
- clearSelection: M,
143
- syncDomObserver: L,
144
- positionHover: S,
145
- hideTextHover: P,
146
- startEditAtEnd: (e) => F.startEdit(e, !0),
147
- editableTarget: x,
148
- ownNodes: _
149
- }), Y = [
150
- "mousedown",
151
- "mouseup",
152
- "dblclick",
153
- "auxclick",
154
- "pointerdown",
155
- "pointerup",
156
- "mouseover",
157
- "mouseout",
158
- "mouseenter",
159
- "mouseleave",
160
- "pointerover",
161
- "pointerout",
162
- "pointerenter",
163
- "pointerleave",
164
- "touchstart",
165
- "touchend",
166
- "submit"
167
- ], X = (e) => {
168
- o && (e.cancelable && e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation());
169
- }, Z = () => {
170
- c && !l && C();
171
- }, Q = () => {
172
- let e = location.pathname.replace(/\/$/, "") || "/";
173
- f.send({
174
- type: "route",
175
- route: e
176
- });
177
- }, ce = re({ onPathChange: () => {
178
- M(), Q();
179
- } }), $ = (e) => {
180
- e.key !== "Escape" || F.editingNode() || (l ? z(!1) : o && R(!1));
181
- };
182
- window.addEventListener("mousemove", U, !0), window.addEventListener("scroll", G, !0), window.addEventListener("resize", Z), window.addEventListener("click", q, !0), window.addEventListener("keydown", $, !0), window.addEventListener("message", J.onMessage);
183
- for (let e of Y) window.addEventListener(e, X, !0);
184
- return Q(), f.send({ type: "ready" }), () => {
185
- window.removeEventListener("mousemove", U, !0), window.removeEventListener("keydown", $, !0), window.removeEventListener("scroll", G, !0), window.removeEventListener("resize", Z), window.removeEventListener("click", q, !0), window.removeEventListener("message", J.onMessage);
186
- for (let e of Y) window.removeEventListener(e, X, !0);
187
- E.disconnect(), D.disconnect(), w && cancelAnimationFrame(w), B && cancelAnimationFrame(B), W && cancelAnimationFrame(W), I.teardown(), ce.teardown(), F.teardown(), document.documentElement.style.cursor = "", v?.remove(), p.remove(), m.remove(), h.remove(), g.remove();
188
- };
189
- }
190
- //#endregion
191
- export { s as Inspector };
@@ -1,38 +0,0 @@
1
- import { IEditorChannel } from './editorChannel';
2
- import { IOriginalsStash } from './originalsStash';
3
- import { IStagedOverrides } from './stagedOverrides';
4
- export interface IMessageRouterContext {
5
- channel: IEditorChannel;
6
- originals: IOriginalsStash;
7
- staged: IStagedOverrides;
8
- /** Enter/exit select mode (mutual exclusion + state echo live in the setter). */
9
- setInspect: (on: boolean) => void;
10
- /** Enter/exit text mode (mutual exclusion + state echo live in the setter). */
11
- setTextEdit: (on: boolean) => void;
12
- isInspecting: () => boolean;
13
- isTextEditing: () => boolean;
14
- /** The node currently in contenteditable, or null. */
15
- editingNode: () => Element | null;
16
- /** Adopt `node` as the persistent selection (ring bookkeeping + observers re-arm). */
17
- setSelected: (node: Element) => void;
18
- /** Redraw the selection ring (internally drops a disconnected selection). */
19
- positionSelected: () => void;
20
- /** Drop the persistent selection + its ring. */
21
- clearSelection: () => void;
22
- /** Re-arbitrate the document-wide MutationObserver (selection OR staged need it). */
23
- syncDomObserver: () => void;
24
- /** Draw the transient hover outline + label on `el`. */
25
- positionHover: (el: Element) => void;
26
- /** Hide the transient hover outline + label. */
27
- hideTextHover: () => void;
28
- /** Begin an in-place text edit on `el`, caret at the end (programmatic start). */
29
- startEditAtEnd: (el: Element) => void;
30
- /** The nearest editable text-leaf for `el`, or null (mirrors the click-path test). */
31
- editableTarget: (el: Element | null) => Element | null;
32
- /** The runtime's own overlay artifacts, skipped by the layers snapshot. */
33
- ownNodes: readonly Element[];
34
- }
35
- export declare const createMessageRouter: (ctx: IMessageRouterContext) => {
36
- onMessage: (e: MessageEvent) => void;
37
- };
38
- //# sourceMappingURL=messageRouter.d.ts.map
@@ -1,134 +0,0 @@
1
- import { buildLayersTree as e, enumerateSources as t, nodeForSource as n, selectedPayload as r } from "./dom.js";
2
- //#region src/inspector/messageRouter.ts
3
- var i = (i) => {
4
- let { channel: a, originals: o, staged: s } = i, c = a.send, l = null;
5
- return { onMessage: (u) => {
6
- let d = u.data;
7
- if (!(!d || d.source !== "web-chat") && a.acceptOrigin(u)) {
8
- if (d.type === "set-inspect") i.setInspect(d.enabled);
9
- else if (d.type === "set-text-edit") i.setTextEdit(d.enabled);
10
- else if (d.type === "revert-text") {
11
- let e = String(d.element?.source || ""), t = Number.isInteger(d.element?.index) ? d.element.index : 0, r = o.restore(`${e}#${t}`), i = r == null ? null : n(e, t);
12
- i && r != null && (i.textContent = r);
13
- } else if (d.type === "stage-style") {
14
- let e = String(d.stageId || ""), t = String(d.element?.source || ""), n = Number.isInteger(d.element?.index) ? d.element.index : 0, r = d.styles && typeof d.styles == "object" ? d.styles : null;
15
- if (!e || /\s/.test(e) || !t || !r) return;
16
- let a = {
17
- kind: "style",
18
- source: t,
19
- index: n,
20
- styles: r,
21
- media: typeof d.media == "string" && d.media.trim() ? d.media : void 0
22
- };
23
- s.upsert(e, a), i.syncDomObserver(), c({
24
- type: "staged-ack",
25
- stageId: e
26
- });
27
- } else if (d.type === "stage-text") {
28
- let e = String(d.stageId || ""), t = String(d.element?.source || ""), n = Number.isInteger(d.element?.index) ? d.element.index : 0;
29
- if (!e || /\s/.test(e) || !t || typeof d.value != "string") return;
30
- let r = {
31
- kind: "text",
32
- source: t,
33
- index: n,
34
- value: d.value
35
- };
36
- s.upsert(e, r), i.syncDomObserver(), c({
37
- type: "staged-ack",
38
- stageId: e
39
- });
40
- } else if (d.type === "clear-staged") {
41
- if (d.stageId == null) {
42
- let e = s.ids();
43
- s.clearAll();
44
- for (let t of e) c({
45
- type: "staged-ack",
46
- stageId: t
47
- });
48
- } else {
49
- let e = String(d.stageId);
50
- s.clearOne(e), c({
51
- type: "staged-ack",
52
- stageId: e
53
- });
54
- }
55
- i.syncDomObserver();
56
- } else if (d.type === "select-element") {
57
- let e = String(d.element?.source || ""), t = Number.isInteger(d.element?.index) ? d.element.index : 0, a = e ? n(e, t) : null;
58
- if (!a) {
59
- c({
60
- type: "select-miss",
61
- element: {
62
- source: e,
63
- index: t
64
- }
65
- });
66
- return;
67
- }
68
- l = null, i.hideTextHover(), i.setSelected(a), i.isTextEditing() || i.positionSelected(), a.scrollIntoView({
69
- block: "center",
70
- behavior: "smooth"
71
- }), c({
72
- type: "element-selected",
73
- element: r(a)
74
- });
75
- } else if (d.type === "edit-element") {
76
- let e = String(d.element?.source || ""), t = Number.isInteger(d.element?.index) ? d.element.index : 0, a = e ? n(e, t) : null;
77
- if (!a) {
78
- c({
79
- type: "select-miss",
80
- element: {
81
- source: e,
82
- index: t
83
- }
84
- });
85
- return;
86
- }
87
- l = null, i.hideTextHover(), i.setSelected(a), a.scrollIntoView({
88
- block: "center",
89
- behavior: "smooth"
90
- }), c({
91
- type: "element-selected",
92
- element: r(a)
93
- }), i.isTextEditing() || i.setTextEdit(!0);
94
- let o = i.editableTarget(a);
95
- o && i.startEditAtEnd(o);
96
- } else if (d.type === "highlight-element") {
97
- let e = String(d.element?.source || ""), t = Number.isInteger(d.element?.index) ? d.element.index : 0, r = e ? n(e, t) : null;
98
- if (!r) l = null, i.hideTextHover(), c({
99
- type: "highlight-miss",
100
- element: {
101
- source: e,
102
- index: t
103
- }
104
- });
105
- else {
106
- l = r, i.positionHover(r);
107
- let e = r.getBoundingClientRect(), t = window.innerHeight || document.documentElement.clientHeight, n = window.innerWidth || document.documentElement.clientWidth;
108
- (e.bottom < 0 || e.top > t || e.right < 0 || e.left > n) && r.scrollIntoView({
109
- block: "center",
110
- behavior: "smooth"
111
- });
112
- }
113
- } else if (d.type === "clear-highlight") l && (l = null, !i.isInspecting() && !i.editingNode() && i.hideTextHover());
114
- else if (d.type === "request-layers") {
115
- let { tree: t, truncated: n } = e(i.ownNodes);
116
- c({
117
- type: "layers-tree",
118
- tree: t,
119
- truncated: n
120
- });
121
- } else if (d.type === "request-sources") c({
122
- type: "sources-list",
123
- sources: t()
124
- });
125
- else if (d.type === "clear-selection") i.clearSelection();
126
- else if (d.type === "navigate") {
127
- let e = String(d.route || "/");
128
- /^\/(?!\/)[A-Za-z0-9\-._~/?#[\]@!$&'()*+,;=%]*$/.test(e) && location.assign(e);
129
- }
130
- }
131
- } };
132
- };
133
- //#endregion
134
- export { i as createMessageRouter };
@@ -1,12 +0,0 @@
1
- export type IOriginalsStash = ReturnType<typeof createOriginalsStash>;
2
- export declare const createOriginalsStash: () => {
3
- /** Stash unconditionally (edit start) — a fresh edit re-captures the current text. */
4
- capture: (key: string, text: string) => void;
5
- /** Stash only if absent (staged re-apply) — never overwrite the true original. */
6
- captureOnce: (key: string, text: string) => void;
7
- /** Peek without consuming — commit keeps the stash for a possible later revert. */
8
- get: (key: string) => string | undefined;
9
- /** Consume: return the original AND drop it (cancel / clear-staged / revert-text). */
10
- restore: (key: string) => string | undefined;
11
- };
12
- //# sourceMappingURL=originalsStash.d.ts.map
@@ -1,24 +0,0 @@
1
- //#region src/inspector/originalsStash.ts
2
- var e = () => {
3
- let e = /* @__PURE__ */ new Map(), t = () => {
4
- if (e.size > 50) {
5
- let t = e.keys().next().value;
6
- t !== void 0 && e.delete(t);
7
- }
8
- };
9
- return {
10
- capture: (n, r) => {
11
- e.set(n, r), t();
12
- },
13
- captureOnce: (n, r) => {
14
- e.has(n) || (e.set(n, r), t());
15
- },
16
- get: (t) => e.get(t),
17
- restore: (t) => {
18
- let n = e.get(t);
19
- return e.delete(t), n;
20
- }
21
- };
22
- };
23
- //#endregion
24
- export { e as createOriginalsStash };
@@ -1,180 +0,0 @@
1
- export interface IStagedStyleEntry {
2
- kind: "style";
3
- source: string;
4
- index: number;
5
- styles: Record<string, string>;
6
- media?: string;
7
- }
8
- export interface IStagedTextEntry {
9
- kind: "text";
10
- source: string;
11
- index: number;
12
- value: string;
13
- }
14
- export type IStagedEntry = IStagedStyleEntry | IStagedTextEntry;
15
- export interface ILayersNode {
16
- tag: string;
17
- source?: string;
18
- index?: number;
19
- text?: string;
20
- /** The element carries the `hidden` utility (display:none) — a reachability hint the
21
- * Layers panel surfaces. Live + class-based, so it covers component internals too
22
- * (the dashboard no longer parses JSX for this). Present only when true. */
23
- hidden?: boolean;
24
- childCount: number;
25
- children: ILayersNode[];
26
- }
27
- export type IHistoryFn = History["pushState"];
28
- export interface IPatchedHistoryFn {
29
- (this: History, ...args: Parameters<IHistoryFn>): ReturnType<IHistoryFn>;
30
- __inspectorPatched?: boolean;
31
- __orig?: IHistoryFn;
32
- }
33
- /** A nested element locator — `file:line:col` + occurrence index. Never top-level. */
34
- export interface IElementLocator {
35
- source: string;
36
- index?: number;
37
- }
38
- /** The element-selected payload — see `selectedPayload`. */
39
- export interface ISelectedElement {
40
- tag: string;
41
- classes: string;
42
- text: string;
43
- label: string;
44
- path: string;
45
- /** null when the element carries no `data-tsd-source` stamp. */
46
- source: string | null;
47
- index: number;
48
- occurrences: number;
49
- ancestors: {
50
- tag: string;
51
- text: string;
52
- source?: string;
53
- }[];
54
- /** Whole normalized textContent — present ONLY for text-mode-editable nodes. */
55
- fullText?: string;
56
- /**
57
- * The nearest `data-levo-source` binding container above the selection (inclusive) — a
58
- * platform-data-bound region (`useLevoSource`/`useLevoRecord`). Present only when the
59
- * selection sits inside one. `config` is the parsed binding ({mode, module, identifier,
60
- * query,…}), omitted when the attribute is malformed JSON. `element` is the binding
61
- * CONTAINER's own locator, so a data edit targets the hook call site — not the clicked
62
- * child. Lets the editor's "Integrate" dialog open pre-filled without parsing JSX.
63
- */
64
- sourceBinding?: {
65
- raw: string;
66
- config?: unknown;
67
- element: IElementLocator;
68
- };
69
- }
70
- /** The element-text-changed payload — see `commit`. */
71
- export interface ITextChangedElement {
72
- source: string | null;
73
- index: number;
74
- tag: string;
75
- value: string;
76
- previous?: string;
77
- occurrences: number;
78
- }
79
- /** Editor → preview (received by `onMessage`; dashboard's `IOutboundMessage`). */
80
- export type IEditorToPreview = {
81
- type: "set-inspect";
82
- enabled: boolean;
83
- } | {
84
- type: "set-text-edit";
85
- enabled: boolean;
86
- } | {
87
- type: "clear-selection";
88
- } | {
89
- type: "select-element";
90
- element: IElementLocator;
91
- } | {
92
- type: "edit-element";
93
- element: IElementLocator;
94
- } | {
95
- type: "highlight-element";
96
- element: IElementLocator;
97
- } | {
98
- type: "clear-highlight";
99
- } | {
100
- type: "request-layers";
101
- } | {
102
- type: "request-sources";
103
- } | {
104
- type: "revert-text";
105
- element: IElementLocator;
106
- } | {
107
- type: "navigate";
108
- route: string;
109
- } | {
110
- type: "stage-style";
111
- stageId: string;
112
- element: IElementLocator;
113
- styles: Record<string, string>;
114
- media?: string;
115
- } | {
116
- type: "stage-text";
117
- stageId: string;
118
- element: IElementLocator;
119
- value: string;
120
- } | {
121
- type: "clear-staged";
122
- stageId?: string;
123
- };
124
- /** Preview → editor (emitted by `send`; dashboard's `IInboundMessage`). */
125
- export type IPreviewToEditor = {
126
- type: "ready";
127
- } | {
128
- type: "inspect-state";
129
- enabled: boolean;
130
- } | {
131
- type: "text-edit-state";
132
- enabled: boolean;
133
- } | {
134
- type: "element-selected";
135
- element: ISelectedElement;
136
- } | {
137
- type: "element-text-changed";
138
- element: ITextChangedElement;
139
- }
140
- /**
141
- * `route` is the pathname (always present). `file` is the route's repo-relative source
142
- * file (e.g. `src/routes/pricing.tsx`, no leading slash, no `:line:col`) — reserved:
143
- * the runtime doesn't emit it yet; the dashboard falls back to url → file mapping.
144
- */
145
- | {
146
- type: "route";
147
- route: string;
148
- file?: string;
149
- } | {
150
- type: "staged-ack";
151
- stageId: string;
152
- } | {
153
- type: "layers-tree";
154
- tree: ILayersNode;
155
- truncated: boolean;
156
- } | {
157
- type: "sources-list";
158
- sources: IPageSource[];
159
- } | {
160
- type: "select-miss";
161
- element: IElementLocator;
162
- } | {
163
- type: "highlight-miss";
164
- element: IElementLocator;
165
- };
166
- /**
167
- * One platform-data binding found on the page — a `data-levo-source` container. Emitted in
168
- * `sources-list` (reply to `request-sources`) so the editor's page-level Data manager can list
169
- * every binding without a selection. `element` is the container's own `data-tsd-source` locator
170
- * (a data edit targets the hook call site); `config` is the parsed binding, omitted when the
171
- * attribute is malformed JSON.
172
- */
173
- export interface IPageSource {
174
- raw: string;
175
- config?: unknown;
176
- element: IElementLocator;
177
- tag: string;
178
- label: string;
179
- }
180
- //# sourceMappingURL=protocol.d.ts.map
@@ -1,28 +0,0 @@
1
- import { IStagedEntry } from './protocol';
2
- import { IOriginalsStash } from './originalsStash';
3
- export type IStagedOverrides = ReturnType<typeof createStagedOverrides>;
4
- export declare const createStagedOverrides: (deps: {
5
- originals: IOriginalsStash;
6
- /**
7
- * The node currently in contenteditable (or null). A text override is never re-asserted
8
- * onto the node being edited — see applyStagedEntry.
9
- */
10
- editingNode: () => Element | null;
11
- }) => {
12
- upsert: (stageId: string, entry: IStagedEntry) => void;
13
- clearOne: (stageId: string) => void;
14
- clearAll: () => void;
15
- scheduleReapply: () => void;
16
- /** Registered override count — the DOM-observer arbitration reads this. */
17
- count: () => number;
18
- /** All registered stageIds — the clear-ALL ack loop reads these before clearing. */
19
- ids: () => string[];
20
- /**
21
- * Unmount teardown: cancel the reapply rAF and hard-remove the injected sheet + every
22
- * stamp. The registry can't survive a remount, and stale stamps/rules must not outlive
23
- * it — the dashboard re-sends the full staged set on the next `ready`, so an
24
- * HMR/StrictMode remount self-heals.
25
- */
26
- teardown: () => void;
27
- };
28
- //# sourceMappingURL=stagedOverrides.d.ts.map
@@ -1,60 +0,0 @@
1
- import { addStagedKey as e, cssRuleFor as t, nodeForSource as n, removeStagedKey as r } from "./dom.js";
2
- //#region src/inspector/stagedOverrides.ts
3
- var i = (i) => {
4
- let { originals: a, editingNode: o } = i, s = /* @__PURE__ */ new Map(), c = () => {
5
- let e = document.getElementById("studio-staged");
6
- return e || (e = document.createElement("style"), e.id = "studio-staged", document.head.appendChild(e)), e;
7
- }, l = () => {
8
- let e = [];
9
- for (let [n, r] of s) if (r.kind === "style") {
10
- let i = t(n, r);
11
- i && e.push(i);
12
- }
13
- let n = e.join("\n");
14
- if (!n && !document.getElementById("studio-staged")) return;
15
- let r = c();
16
- r.textContent !== n && (r.textContent = n);
17
- }, u = (t, r) => {
18
- let i = n(r.source, r.index);
19
- if (i) if (r.kind === "style") e(i, t);
20
- else {
21
- if (i === o()) return;
22
- let e = `${r.source}#${r.index}`;
23
- a.captureOnce(e, i.textContent ?? ""), i.textContent !== r.value && (i.textContent = r.value);
24
- }
25
- }, d = (e, t) => {
26
- s.set(e, t), u(e, t), t.kind === "style" && l();
27
- }, f = (e) => {
28
- let t = s.get(e);
29
- if (!t) return;
30
- s.delete(e);
31
- let i = n(t.source, t.index);
32
- if (t.kind === "style") i && r(i, e), l();
33
- else {
34
- let e = a.restore(`${t.source}#${t.index}`);
35
- i && e != null && (i.textContent = e);
36
- }
37
- }, p = () => {
38
- for (let e of [...s.keys()]) f(e);
39
- for (let e of Array.from(document.querySelectorAll("[data-staged-key]"))) e.removeAttribute("data-staged-key");
40
- }, m = 0;
41
- return {
42
- upsert: d,
43
- clearOne: f,
44
- clearAll: p,
45
- scheduleReapply: () => {
46
- m || !s.size || (m = requestAnimationFrame(() => {
47
- m = 0;
48
- for (let [e, t] of s) u(e, t);
49
- }));
50
- },
51
- count: () => s.size,
52
- ids: () => [...s.keys()],
53
- teardown: () => {
54
- m && cancelAnimationFrame(m), document.getElementById("studio-staged")?.remove();
55
- for (let e of Array.from(document.querySelectorAll("[data-staged-key]"))) e.removeAttribute("data-staged-key");
56
- }
57
- };
58
- };
59
- //#endregion
60
- export { i as createStagedOverrides };