@pygmalionjs/pygmalion 0.7.3 → 0.8.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.
Files changed (133) hide show
  1. package/README.ko.md +17 -2
  2. package/README.md +18 -2
  3. package/dist-lib/CameraLayer-nkNrazn8.js +159 -0
  4. package/dist-lib/pygmalion.js +14562 -16919
  5. package/dist-lib/runtime-DdYnT6k4.js +19705 -0
  6. package/dist-lib/style.css +1 -1
  7. package/dist-lib/testing.js +20 -21
  8. package/dist-lib/types/EditorShell.d.ts +1 -1
  9. package/dist-lib/types/canvas/CameraLayer.d.ts +3 -3
  10. package/dist-lib/types/canvas/Canvas.d.ts +2 -2
  11. package/dist-lib/types/canvas/FrameLabelBanner.d.ts +1 -1
  12. package/dist-lib/types/canvas/FrameView.d.ts +8 -2
  13. package/dist-lib/types/canvas/FrozenRoutePreview.d.ts +1 -1
  14. package/dist-lib/types/canvas/InspectOverlay.d.ts +4 -2
  15. package/dist-lib/types/canvas/LightweightCanvas.d.ts +1 -1
  16. package/dist-lib/types/canvas/SectionBoxes.d.ts +1 -1
  17. package/dist-lib/types/canvas/ShadowRoutePreview.d.ts +2 -2
  18. package/dist-lib/types/canvas/useFlowSession.d.ts +1 -1
  19. package/dist-lib/types/canvas/useFrameLod.d.ts +1 -1
  20. package/dist-lib/types/contract/transport.d.ts +5 -5
  21. package/dist-lib/types/contract/types.d.ts +1 -1
  22. package/dist-lib/types/contract/validate.d.ts +3 -3
  23. package/dist-lib/types/core/context.d.ts +2 -2
  24. package/dist-lib/types/core/debug.d.ts +14 -14
  25. package/dist-lib/types/core/hostBindings.d.ts +2 -2
  26. package/dist-lib/types/core/runtime.d.ts +34 -3
  27. package/dist-lib/types/core/runtimeContext.d.ts +3 -3
  28. package/dist-lib/types/core/schedulers.d.ts +67 -0
  29. package/dist-lib/types/editor/assetEditing.d.ts +2 -2
  30. package/dist-lib/types/editor/automaticMotion.d.ts +0 -11
  31. package/dist-lib/types/editor/automaticPseudoStates.d.ts +8 -2
  32. package/dist-lib/types/editor/captureSupply.d.ts +25 -7
  33. package/dist-lib/types/editor/catalog.d.ts +2 -2
  34. package/dist-lib/types/editor/codegen.d.ts +6 -3
  35. package/dist-lib/types/editor/componentConnections.d.ts +13 -8
  36. package/dist-lib/types/editor/componentInstances.d.ts +2 -2
  37. package/dist-lib/types/editor/declarations.d.ts +107 -0
  38. package/dist-lib/types/editor/designCompiler.d.ts +9 -4
  39. package/dist-lib/types/editor/designImport.d.ts +48 -12
  40. package/dist-lib/types/editor/documentSync.d.ts +28 -25
  41. package/dist-lib/types/editor/domImport.d.ts +2 -2
  42. package/dist-lib/types/editor/fiberMap.d.ts +1 -1
  43. package/dist-lib/types/editor/flowSessionScheduler.d.ts +106 -159
  44. package/dist-lib/types/editor/flowSessions.d.ts +147 -84
  45. package/dist-lib/types/editor/frameInteraction.d.ts +22 -32
  46. package/dist-lib/types/editor/frameLabels.d.ts +11 -5
  47. package/dist-lib/types/editor/frameLanes.d.ts +14 -17
  48. package/dist-lib/types/editor/frameLod.d.ts +17 -0
  49. package/dist-lib/types/editor/frameLodRuntime.d.ts +38 -38
  50. package/dist-lib/types/editor/framePreviewKeys.d.ts +14 -5
  51. package/dist-lib/types/editor/frozenImport.d.ts +13 -14
  52. package/dist-lib/types/editor/heldPseudoStates.d.ts +1 -1
  53. package/dist-lib/types/editor/host.d.ts +10 -55
  54. package/dist-lib/types/editor/implementationSourceMap.d.ts +2 -2
  55. package/dist-lib/types/editor/importFidelity.d.ts +1 -1
  56. package/dist-lib/types/editor/inspect.d.ts +7 -2
  57. package/dist-lib/types/editor/interactiveSessionSurface.d.ts +26 -34
  58. package/dist-lib/types/editor/interactiveStates.d.ts +12 -10
  59. package/dist-lib/types/editor/livePreviewInstances.d.ts +13 -3
  60. package/dist-lib/types/editor/liveScreens.d.ts +25 -16
  61. package/dist-lib/types/editor/mountScheduler.d.ts +8 -11
  62. package/dist-lib/types/editor/nodeSelector.d.ts +1 -1
  63. package/dist-lib/types/editor/pendingSourceChanges.d.ts +19 -0
  64. package/dist-lib/types/editor/previewBootstrap.d.ts +12 -22
  65. package/dist-lib/types/editor/previewCaptureProgress.d.ts +10 -6
  66. package/dist-lib/types/editor/previewEnvironmentControls.d.ts +14 -17
  67. package/dist-lib/types/editor/previewIntent.d.ts +11 -16
  68. package/dist-lib/types/editor/previewSweep.d.ts +7 -3
  69. package/dist-lib/types/editor/previewWarmup.d.ts +19 -7
  70. package/dist-lib/types/editor/projectRuntime.d.ts +2 -2
  71. package/dist-lib/types/editor/registry.d.ts +6 -2
  72. package/dist-lib/types/editor/revisionCatalog.d.ts +19 -19
  73. package/dist-lib/types/editor/revisionCatalogInstall.d.ts +18 -17
  74. package/dist-lib/types/editor/routePreview.d.ts +85 -139
  75. package/dist-lib/types/editor/scenarioCoverage.d.ts +52 -20
  76. package/dist-lib/types/editor/screenCards.d.ts +10 -6
  77. package/dist-lib/types/editor/screenDimensions.d.ts +9 -5
  78. package/dist-lib/types/editor/screenFlows.d.ts +8 -5
  79. package/dist-lib/types/editor/screenInteractions.d.ts +9 -1
  80. package/dist-lib/types/editor/screenLists.d.ts +8 -4
  81. package/dist-lib/types/editor/screenStateGroups.d.ts +1 -1
  82. package/dist-lib/types/editor/sectionHeaders.d.ts +10 -6
  83. package/dist-lib/types/editor/sessionPresets.d.ts +12 -32
  84. package/dist-lib/types/editor/shadowPreview.d.ts +7 -10
  85. package/dist-lib/types/editor/sharedSource.d.ts +4 -2
  86. package/dist-lib/types/editor/sourceChangeSummary.d.ts +1 -1
  87. package/dist-lib/types/editor/sourceJournal.d.ts +2 -2
  88. package/dist-lib/types/editor/stateSwitchMetrics.d.ts +68 -82
  89. package/dist-lib/types/editor/store.d.ts +88 -22
  90. package/dist-lib/types/editor/storyboardAuthored.d.ts +2 -2
  91. package/dist-lib/types/editor/storyboardDiscovery.d.ts +4 -3
  92. package/dist-lib/types/editor/storyboardEnvironment.d.ts +9 -5
  93. package/dist-lib/types/editor/storyboardGraph.d.ts +1 -1
  94. package/dist-lib/types/editor/storyboardGraphRuntime.d.ts +8 -10
  95. package/dist-lib/types/editor/storyboardGraphView.d.ts +1 -1
  96. package/dist-lib/types/editor/storyboardJourney.d.ts +1 -1
  97. package/dist-lib/types/editor/surfaceDemands.d.ts +196 -31
  98. package/dist-lib/types/editor/tokens.d.ts +24 -25
  99. package/dist-lib/types/editor/variantAxes.d.ts +70 -0
  100. package/dist-lib/types/editor/variantPrefetch.d.ts +26 -43
  101. package/dist-lib/types/editor/viewportPresets.d.ts +6 -6
  102. package/dist-lib/types/editor/visualQa.d.ts +2 -2
  103. package/dist-lib/types/lib.d.ts +104 -108
  104. package/dist-lib/types/shell/CatalogAssetPanel.d.ts +1 -1
  105. package/dist-lib/types/shell/CodePanel.d.ts +1 -1
  106. package/dist-lib/types/shell/ComponentStateControls.d.ts +7 -53
  107. package/dist-lib/types/shell/FrameInspector.d.ts +17 -0
  108. package/dist-lib/types/shell/FrameReviewDetails.d.ts +28 -0
  109. package/dist-lib/types/shell/LayerTree.d.ts +1 -1
  110. package/dist-lib/types/shell/StoryboardGraphPanel.d.ts +2 -2
  111. package/dist-lib/types/shell/VariantPanel.d.ts +23 -0
  112. package/dist-lib/types/shell/inspectorControls.d.ts +34 -0
  113. package/dist-lib/types/shell/qaPresentation.d.ts +1 -1
  114. package/dist-lib/types/testing.d.ts +5 -6
  115. package/dist-lib/types/ui/SourceRefControl.d.ts +1 -1
  116. package/docs/coverage-contracts.md +431 -0
  117. package/docs/screen-state-contract.md +14 -16
  118. package/node/component-branches.mjs +7 -13
  119. package/node/design-session.mjs +3 -5
  120. package/node/dev-mirror.mjs +9 -6
  121. package/node/envelope.mjs +43 -0
  122. package/node/impact-frames.mjs +94 -0
  123. package/node/inspect-plugin.mjs +12 -6
  124. package/node/preview-artifact-plugin.mjs +3 -9
  125. package/node/qa-capture-plugin.mjs +3 -6
  126. package/node/source-graph.mjs +1 -0
  127. package/node/storyboard-environment.mjs +33 -6
  128. package/node/vite.mjs +1 -0
  129. package/package.json +7 -2
  130. package/dist-lib/CameraLayer-D2wrEPwG.js +0 -415
  131. package/dist-lib/frameLodRuntime-CU0IYaSu.js +0 -272
  132. package/dist-lib/runtime-DRkTU9eq.js +0 -16195
  133. package/dist-lib/types/core/defaultRuntime.d.ts +0 -3
@@ -1,415 +0,0 @@
1
- import { jsx as G } from "react/jsx-runtime";
2
- import { a6 as U, R as A, Y as q, ab as O, ad as J, a7 as Q, af as Z, ac as ee, bB as te } from "./runtime-DRkTU9eq.js";
3
- import { useRef as ne, useLayoutEffect as N } from "react";
4
- import { d as re, e as oe } from "./frameLodRuntime-CU0IYaSu.js";
5
- function Ee({
6
- editMode: e,
7
- tool: t,
8
- hasRoute: r,
9
- liveOriginReady: n,
10
- backgroundOnly: o = !1
11
- }) {
12
- return !e && t === "select" && r && n && !o;
13
- }
14
- function ie(e, t, r) {
15
- return t !== "select" ? !1 : e || r;
16
- }
17
- const Y = Object.freeze({
18
- frameId: null,
19
- phase: "idle",
20
- scroll: null
21
- }), P = /* @__PURE__ */ new Set();
22
- let u = Y, v = null;
23
- function L(e) {
24
- u = e;
25
- for (const t of P) t();
26
- }
27
- function y(e) {
28
- return Number.isFinite(e) ? e : 0;
29
- }
30
- function X(e) {
31
- const t = Math.max(0, y(e.viewportWidth)), r = Math.max(0, y(e.viewportHeight)), n = Math.max(t, y(e.contentWidth)), o = Math.max(r, y(e.contentHeight)), s = Math.max(0, y(e.maxX)), a = Math.max(0, y(e.maxY));
32
- return {
33
- x: Math.min(s, Math.max(0, y(e.x))),
34
- y: Math.min(a, Math.max(0, y(e.y))),
35
- maxX: s,
36
- maxY: a,
37
- viewportWidth: t,
38
- viewportHeight: r,
39
- contentWidth: n,
40
- contentHeight: o
41
- };
42
- }
43
- function se(e, t) {
44
- return e ? e.x === t.x && e.y === t.y && e.maxX === t.maxX && e.maxY === t.maxY && e.viewportWidth === t.viewportWidth && e.viewportHeight === t.viewportHeight && e.contentWidth === t.contentWidth && e.contentHeight === t.contentHeight : !1;
45
- }
46
- function x(e) {
47
- const t = v;
48
- t && (v = null, t.unsubscribe(), e && u.frameId === t.frameId && (u.phase === "preview" || u.phase === "interacting") && L({ frameId: t.frameId, phase: "starting", scroll: null }));
49
- }
50
- function Le(e) {
51
- var t, r;
52
- if (e) {
53
- if (u.frameId === e) {
54
- (r = v == null ? void 0 : (t = v.adapter).focus) == null || r.call(t);
55
- return;
56
- }
57
- x(!1), L({ frameId: e, phase: "starting", scroll: null });
58
- }
59
- }
60
- function F(e) {
61
- return u.frameId == null || e != null && u.frameId !== e ? !1 : (x(!1), L(Y), !0);
62
- }
63
- function xe(e, t) {
64
- return u.frameId == null || t && u.frameId === e ? !1 : F();
65
- }
66
- function ke() {
67
- return u;
68
- }
69
- function Ie(e) {
70
- return P.add(e), () => P.delete(e);
71
- }
72
- function ae(e, t) {
73
- return B(e, t, "interacting");
74
- }
75
- function B(e, t, r) {
76
- var o, s;
77
- if (u.frameId !== e) return () => {
78
- };
79
- x(!1);
80
- const n = () => {
81
- if (u.frameId !== e || (v == null ? void 0 : v.adapter) !== t) return;
82
- const a = X(t.readScroll());
83
- u.phase === r && se(u.scroll, a) || L({ frameId: e, phase: r, scroll: a });
84
- };
85
- return v = {
86
- frameId: e,
87
- adapter: t,
88
- phase: r,
89
- unsubscribe: ((o = t.subscribe) == null ? void 0 : o.call(t, n)) ?? (() => {
90
- })
91
- }, n(), (s = t.focus) == null || s.call(t), () => {
92
- (v == null ? void 0 : v.adapter) === t && x(!0);
93
- };
94
- }
95
- function Pe(e, t, r) {
96
- const n = t.host.ownerDocument.defaultView;
97
- if (!n) return () => {
98
- };
99
- let o = r;
100
- return B(e, {
101
- readScroll: () => j(o),
102
- scrollTo: ({ x: a, y: i }) => {
103
- try {
104
- o.scrollTo({ left: a, top: i, behavior: "auto" });
105
- } catch {
106
- o.scrollLeft = a, o.scrollTop = i;
107
- }
108
- o.scrollLeft !== a && (o.scrollLeft = a), o.scrollTop !== i && (o.scrollTop = i);
109
- },
110
- subscribe: (a) => {
111
- const i = (l) => {
112
- const c = l.target;
113
- c instanceof n.HTMLElement && (c.scrollHeight > c.clientHeight || c.scrollWidth > c.clientWidth) && (o = c), a();
114
- }, f = (l) => {
115
- !(l instanceof n.KeyboardEvent) || l.key !== "Escape" || (l.preventDefault(), l.stopImmediatePropagation(), F(e));
116
- }, w = (l) => {
117
- var S;
118
- const c = l.target;
119
- (S = c == null ? void 0 : c.closest) != null && S.call(c, "a[href]") && l.preventDefault();
120
- }, g = (l) => l.preventDefault();
121
- return t.addEventListener("scroll", i, !0), t.addEventListener("keydown", f, !0), t.addEventListener("click", w, !0), t.addEventListener("submit", g, !0), () => {
122
- t.removeEventListener("scroll", i, !0), t.removeEventListener("keydown", f, !0), t.removeEventListener("click", w, !0), t.removeEventListener("submit", g, !0);
123
- };
124
- }
125
- }, "preview");
126
- }
127
- function Fe(e) {
128
- const t = v;
129
- if (!t || u.phase !== "preview" && u.phase !== "interacting" || !u.scroll)
130
- return !1;
131
- t.adapter.scrollTo({
132
- x: e.x ?? u.scroll.x,
133
- y: e.y ?? u.scroll.y
134
- });
135
- const r = X(t.adapter.readScroll());
136
- return L({
137
- frameId: t.frameId,
138
- phase: t.phase,
139
- scroll: r
140
- }), !0;
141
- }
142
- function j(e) {
143
- return {
144
- x: e.scrollLeft,
145
- y: e.scrollTop,
146
- maxX: Math.max(0, e.scrollWidth - e.clientWidth),
147
- maxY: Math.max(0, e.scrollHeight - e.clientHeight),
148
- viewportWidth: e.clientWidth,
149
- viewportHeight: e.clientHeight,
150
- contentWidth: e.scrollWidth,
151
- contentHeight: e.scrollHeight
152
- };
153
- }
154
- function I(e, t) {
155
- try {
156
- const r = new URL(e), n = new URL(t, r);
157
- return r.origin === n.origin && r.pathname === n.pathname;
158
- } catch {
159
- return !1;
160
- }
161
- }
162
- function ce(e, t) {
163
- const r = e.location.href, n = e.history, o = n.pushState, s = n.replaceState, a = n.back, i = n.forward, f = n.go, w = e.open, g = (d) => d == null || I(
164
- r,
165
- new URL(String(d), e.location.href).href
166
- ), l = (d, p, m) => {
167
- g(m) && o.call(n, d, p, m);
168
- }, c = (d, p, m) => {
169
- g(m) && s.call(n, d, p, m);
170
- }, S = () => {
171
- }, H = () => {
172
- }, W = () => {
173
- }, M = (() => null);
174
- n.pushState = l, n.replaceState = c, n.back = S, n.forward = H, n.go = W, e.open = M;
175
- const R = (d) => {
176
- var D;
177
- const p = d.target, m = (D = p == null ? void 0 : p.closest) == null ? void 0 : D.call(p, "a[href]");
178
- if (!m) return;
179
- (m.target && m.target.toLowerCase() !== "_self" || !I(
180
- r,
181
- m.href
182
- )) && d.preventDefault();
183
- }, T = (d) => d.preventDefault(), b = e.navigation, C = (d) => {
184
- var m;
185
- const p = (m = d.destination) == null ? void 0 : m.url;
186
- p && !I(r, p) && d.cancelable && d.preventDefault();
187
- };
188
- return t.addEventListener("click", R, !0), t.addEventListener("submit", T, !0), b == null || b.addEventListener("navigate", C), () => {
189
- t.removeEventListener("click", R, !0), t.removeEventListener("submit", T, !0), b == null || b.removeEventListener("navigate", C), n.pushState === l && (n.pushState = o), n.replaceState === c && (n.replaceState = s), n.back === S && (n.back = a), n.forward === H && (n.forward = i), n.go === W && (n.go = f), e.open === M && (e.open = w);
190
- };
191
- }
192
- function He(e, t) {
193
- const r = t.contentWindow, n = t.contentDocument, o = n == null ? void 0 : n.scrollingElement;
194
- if (!r || !n || !o)
195
- return () => {
196
- };
197
- let s = o;
198
- return ae(e, {
199
- readScroll: () => j(s),
200
- scrollTo: ({ x: i, y: f }) => s.scrollTo({ left: i, top: f }),
201
- focus: () => {
202
- t.focus(), r.focus();
203
- },
204
- subscribe: (i) => {
205
- const f = ce(
206
- r,
207
- n
208
- ), w = (l) => {
209
- const c = l.target;
210
- c != null && c.nodeType === 1 && (c.scrollHeight > c.clientHeight || c.scrollWidth > c.clientWidth) && (s = c), i();
211
- }, g = (l) => {
212
- l.key === "Escape" && (l.preventDefault(), l.stopImmediatePropagation(), F(e));
213
- };
214
- return n.addEventListener("scroll", w, !0), r.addEventListener("resize", i), r.addEventListener("keydown", g, !0), () => {
215
- f(), n.removeEventListener("scroll", w, !0), r.removeEventListener("resize", i), r.removeEventListener("keydown", g, !0);
216
- };
217
- }
218
- });
219
- }
220
- const le = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map();
221
- let h = [];
222
- const ue = 2;
223
- function K(e, t) {
224
- for (const n of [...le]) n();
225
- const r = /* @__PURE__ */ new Set();
226
- for (const n of e) t.includes(n) || r.add(n);
227
- for (const n of t) e.includes(n) || r.add(n);
228
- for (const n of r) {
229
- const o = E.get(n);
230
- if (o)
231
- for (const s of [...o]) s();
232
- }
233
- }
234
- function We(e, t = ue) {
235
- if (!e) return !1;
236
- const r = Math.max(1, t);
237
- if (h[0] === e && h.length <= r) return !1;
238
- const n = [e, ...h.filter((s) => s !== e)].slice(0, r);
239
- if (n.length === h.length && n.every((s, a) => s === h[a]))
240
- return !1;
241
- const o = h;
242
- return h = n, K(o, n), !0;
243
- }
244
- function Me(e) {
245
- if (!h.includes(e)) return;
246
- const t = h;
247
- h = h.filter((r) => r !== e), K(t, h);
248
- }
249
- function fe(e) {
250
- return h.includes(e);
251
- }
252
- function Re() {
253
- return h;
254
- }
255
- function Te(e, t) {
256
- let r = E.get(e);
257
- return r || (r = /* @__PURE__ */ new Set(), E.set(e, r)), r.add(t), () => {
258
- r.delete(t), r.size === 0 && E.get(e) === r && E.delete(e);
259
- };
260
- }
261
- function _(e) {
262
- return `translate(${e.panX}px, ${e.panY}px) scale(${e.zoom})`;
263
- }
264
- function $(e, t, r) {
265
- return ie(e, t, r) ? void 0 : "none";
266
- }
267
- function z(e, t) {
268
- return $(
269
- e.editMode,
270
- e.tool,
271
- t != null
272
- );
273
- }
274
- const k = /* @__PURE__ */ new WeakMap();
275
- function de(e, t, r) {
276
- if (e.route == null) return 0;
277
- const n = Q(e) ?? e.route, o = e.width ?? 390, s = e.height ?? 600, a = te();
278
- let i = k.get(e);
279
- (!i || i.revision !== t || i.epoch !== a || i.route !== n || i.width !== o || i.height !== s) && (i = {
280
- revision: t,
281
- epoch: a,
282
- route: n,
283
- width: o,
284
- height: s,
285
- key: O(e, t, r)
286
- }, k.set(e, i));
287
- const f = Z(i.key);
288
- if (f != null) return f.length * 2;
289
- const w = ee(i.key);
290
- return w ? w.bodyHtml.length * 2 : 0;
291
- }
292
- function he(e, t, r) {
293
- var i;
294
- if (e.route == null) return null;
295
- const n = k.get(e), o = (n == null ? void 0 : n.key) ?? O(e, t, r), s = (i = J(o)) == null ? void 0 : i.screenshot;
296
- if (!s) return null;
297
- const a = e.width ?? 390;
298
- return a > 0 ? s.width / a : null;
299
- }
300
- function me(e) {
301
- return V(e).map((r) => {
302
- var o;
303
- const n = e.store.pages.find((s) => s.id === r.id);
304
- return {
305
- ...r,
306
- memoKey: n ? (o = k.get(n)) == null ? void 0 : o.key : void 0
307
- };
308
- });
309
- }
310
- function V(e) {
311
- const t = e.store, r = e.host.previewRevision, n = t.selectedCanvasObject;
312
- return t.pages.filter(
313
- (o) => (o.canvas ?? "default") === t.activeCanvas && t.isScreenStateShown(o)
314
- ).map((o) => ({
315
- id: o.id,
316
- rect: {
317
- x: o.x ?? 0,
318
- y: o.y ?? 0,
319
- width: o.width ?? 390,
320
- height: q(o)
321
- },
322
- pinned: o.id === t.activePageId || (n == null ? void 0 : n.kind) === "frame" && n.id === o.id || // Catalog sheets need a full first render to replace their 1x1 seed.
323
- // Their live DOM remains mounted afterwards; offscreen paint may be skipped.
324
- oe(o) || fe(o.id),
325
- weightBytes: de(o, r, o.id === t.activePageId),
326
- screenshotDensity: he(
327
- o,
328
- r,
329
- o.id === t.activePageId
330
- )
331
- }));
332
- }
333
- let ve = 0;
334
- function pe({
335
- children: e,
336
- interactionFrameId: t = null
337
- }) {
338
- const r = U(), n = r.store, o = ne(null);
339
- return N(() => {
340
- const s = o.current;
341
- if (!s) return;
342
- const a = new A(`CameraLayer#${++ve}`, () => {
343
- a.isDisposed || i();
344
- }), i = () => {
345
- a.track(() => {
346
- s.style.transform = _(n), s.style.pointerEvents = z(n, t) ?? "";
347
- });
348
- };
349
- return i(), () => a.dispose();
350
- }, [n, t]), N(() => {
351
- const s = re({
352
- readCamera: () => ({
353
- panX: n.panX,
354
- panY: n.panY,
355
- zoom: n.zoom,
356
- canvas: n.activeCanvas
357
- }),
358
- readFrames: () => V(r),
359
- readViewport: () => {
360
- var i;
361
- const a = (i = o.current) == null ? void 0 : i.parentElement;
362
- if (a) {
363
- const f = a.getBoundingClientRect();
364
- if (f.width > 0 && f.height > 0)
365
- return { width: f.width, height: f.height };
366
- }
367
- return { width: window.innerWidth, height: window.innerHeight };
368
- }
369
- });
370
- return s.start(), () => s.stop();
371
- }, [n, r]), /* @__PURE__ */ G(
372
- "div",
373
- {
374
- ref: o,
375
- "data-canvas-camera": !0,
376
- style: {
377
- position: "absolute",
378
- left: 0,
379
- top: 0,
380
- transform: _(n),
381
- transformOrigin: "0 0",
382
- transition: "none",
383
- willChange: "transform",
384
- pointerEvents: z(n, t)
385
- },
386
- children: e
387
- }
388
- );
389
- }
390
- const Ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
391
- __proto__: null,
392
- CameraLayer: pe,
393
- __debugReadEditorFrames: me,
394
- resolveCameraPointerEvents: $
395
- }, Symbol.toStringTag, { value: "Module" }));
396
- export {
397
- pe as C,
398
- ue as P,
399
- He as a,
400
- Ie as b,
401
- Pe as c,
402
- xe as d,
403
- F as e,
404
- I as f,
405
- ke as g,
406
- fe as h,
407
- Ee as i,
408
- Le as j,
409
- Re as k,
410
- Fe as l,
411
- Ce as m,
412
- We as n,
413
- Me as r,
414
- Te as s
415
- };
@@ -1,272 +0,0 @@
1
- import { R as P, bz as N } from "./runtime-DRkTU9eq.js";
2
- const L = {
3
- fullEnter: 0.75,
4
- fullExit: 1.25,
5
- detachEnter: 3,
6
- detachExit: 2,
7
- dwellMs: 4e3,
8
- overviewFitSlack: 1.15,
9
- overviewVisibleCount: 12
10
- };
11
- function se(e) {
12
- return e.frameSizeMode === "content" && ((e.width ?? 1) <= 1 || (e.height ?? 1) <= 1);
13
- }
14
- function z(e, t) {
15
- const i = e.x * t.zoom + t.panX, n = e.y * t.zoom + t.panY;
16
- return {
17
- left: i,
18
- top: n,
19
- right: i + e.width * t.zoom,
20
- bottom: n + e.height * t.zoom
21
- };
22
- }
23
- function k(e, t, i) {
24
- const n = Math.hypot(i.width, i.height);
25
- if (!(n > 0)) return 0;
26
- const o = z(e, t), c = Math.max(0, o.left - i.width, -o.right), a = Math.max(0, o.top - i.height, -o.bottom);
27
- return Math.hypot(c, a) / n;
28
- }
29
- function O(e, t, i, n = L) {
30
- if (e.length === 0) return !1;
31
- let o = 1 / 0, c = 1 / 0, a = -1 / 0, s = -1 / 0, u = 0;
32
- for (const d of e) {
33
- const r = z(d, t);
34
- o = Math.min(o, r.left), c = Math.min(c, r.top), a = Math.max(a, r.right), s = Math.max(s, r.bottom), r.left < i.width && r.right > 0 && r.top < i.height && r.bottom > 0 && (u += 1);
35
- }
36
- return u >= n.overviewVisibleCount ? !0 : a - o <= i.width * n.overviewFitSlack && s - c <= i.height * n.overviewFitSlack;
37
- }
38
- function U(e, t, i, n) {
39
- return !n && e === "full" && i != null && i > 0 && Number.isFinite(t) && t > i;
40
- }
41
- function Y(e, t) {
42
- return Number.isFinite(t) ? e ? t > 0.95 : t > 1.05 : e;
43
- }
44
- const G = 24 * 1024 * 1024, I = 48 * 1024 * 1024, V = 768 * 1024 * 1024, j = 512 * 1024;
45
- function q({
46
- deviceMemoryGb: e,
47
- frameCount: t
48
- }) {
49
- const i = typeof e == "number" && Number.isFinite(e) && e > 0 ? Math.min(64, e) : 4, n = Math.max(
50
- I,
51
- Math.min(V, i * G)
52
- ), o = Math.max(
53
- I,
54
- t * j
55
- );
56
- return Math.max(o, n);
57
- }
58
- function X(e, t, i, n) {
59
- const o = (e == null ? void 0 : e.tier) ?? "contained";
60
- return o === "full" ? t > n.fullExit ? "contained" : "full" : o === "detached" ? t < n.fullEnter ? "full" : t <= n.detachExit ? "contained" : "detached" : t < n.fullEnter ? "full" : t >= n.detachEnter && e != null && i - e.since >= n.dwellMs ? "detached" : "contained";
61
- }
62
- function W({
63
- frames: e,
64
- camera: t,
65
- viewport: i,
66
- previous: n,
67
- now: o,
68
- config: c = L,
69
- budget: a
70
- }) {
71
- const s = /* @__PURE__ */ new Map();
72
- if (O(
73
- e.map((r) => r.rect),
74
- t,
75
- i,
76
- c
77
- )) {
78
- for (const r of e) s.set(r.id, "full");
79
- return s;
80
- }
81
- const u = /* @__PURE__ */ new Map();
82
- let d = 0;
83
- for (const r of e) {
84
- const l = k(r.rect, t, i);
85
- u.set(r.id, l);
86
- const m = r.pinned ? "full" : X(n.get(r.id), l, o, c);
87
- s.set(r.id, m), m !== "detached" && (d += r.weightBytes);
88
- }
89
- if (d > a) {
90
- const r = e.filter(
91
- (l) => !l.pinned && l.weightBytes > 0 && s.get(l.id) !== "detached"
92
- ).sort(
93
- (l, m) => (u.get(m.id) ?? 0) - (u.get(l.id) ?? 0)
94
- );
95
- for (const l of r) {
96
- if (d <= a) break;
97
- s.set(l.id, "detached"), d -= l.weightBytes;
98
- }
99
- }
100
- return s;
101
- }
102
- const h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), w = "full";
103
- function $(e) {
104
- return h.get(e) ?? w;
105
- }
106
- function H(e) {
107
- return g.get(e) ?? !1;
108
- }
109
- let b = !1;
110
- const v = /* @__PURE__ */ new Set();
111
- function J() {
112
- return b;
113
- }
114
- function K(e) {
115
- return v.add(e), () => {
116
- v.delete(e);
117
- };
118
- }
119
- function A(e) {
120
- if (e !== b) {
121
- b = e;
122
- for (const t of [...v]) t();
123
- }
124
- }
125
- function Q() {
126
- return {
127
- tiers: [...h.entries()],
128
- magnified: [...g.entries()],
129
- lastRecompute: { ...E }
130
- };
131
- }
132
- const E = {};
133
- function Z(e, t) {
134
- let i = M.get(e);
135
- return i || (i = /* @__PURE__ */ new Set(), M.set(e, i)), i.add(t), () => {
136
- i.delete(t), i.size === 0 && M.delete(e);
137
- };
138
- }
139
- function ee() {
140
- let e = 0;
141
- for (const t of M.values()) e += t.size;
142
- return e;
143
- }
144
- function C(e, t = /* @__PURE__ */ new Map()) {
145
- const i = /* @__PURE__ */ new Set();
146
- for (const [n, o] of h)
147
- (e.get(n) ?? w) !== o && i.add(n);
148
- for (const [n, o] of e)
149
- !h.has(n) && o !== w && i.add(n);
150
- for (const [n, o] of g)
151
- (t.get(n) ?? !1) !== o && i.add(n);
152
- for (const [n, o] of t)
153
- o && !g.get(n) && i.add(n);
154
- h.clear();
155
- for (const [n, o] of e) h.set(n, o);
156
- g.clear();
157
- for (const [n, o] of t)
158
- o && g.set(n, o);
159
- for (const n of i) {
160
- const o = M.get(n);
161
- if (o)
162
- for (const c of [...o]) c();
163
- }
164
- }
165
- function te(e) {
166
- if (typeof requestAnimationFrame != "function") {
167
- const i = setTimeout(e, 16);
168
- return () => clearTimeout(i);
169
- }
170
- const t = requestAnimationFrame(() => e());
171
- return () => cancelAnimationFrame(t);
172
- }
173
- function ne(e) {
174
- const t = typeof navigator > "u" ? void 0 : navigator.deviceMemory;
175
- return q({ deviceMemoryGb: t, frameCount: e.length });
176
- }
177
- function ie() {
178
- if (typeof window > "u") return 1;
179
- const e = window.devicePixelRatio;
180
- return Number.isFinite(e) && e > 0 ? e : 1;
181
- }
182
- let oe = 0;
183
- function re(e) {
184
- const t = e.config ?? L, i = e.now ?? (() => Date.now()), n = e.schedule ?? te, o = e.resolveBudget ?? ne, c = e.readDevicePixelRatio ?? ie;
185
- let a = null, s = null, u = /* @__PURE__ */ new Map();
186
- const d = () => {
187
- s = null;
188
- const m = i(), { camera: B, frames: F, viewport: T } = N(() => ({
189
- camera: e.readCamera(),
190
- frames: e.readFrames(),
191
- viewport: e.readViewport()
192
- })), p = W({
193
- frames: F,
194
- camera: B,
195
- viewport: T,
196
- previous: u,
197
- now: m,
198
- config: t,
199
- budget: o(F)
200
- }), S = /* @__PURE__ */ new Map();
201
- for (const [f, x] of p) {
202
- const _ = u.get(f);
203
- S.set(
204
- f,
205
- (_ == null ? void 0 : _.tier) === x ? _ : { tier: x, since: m }
206
- );
207
- }
208
- u = S;
209
- const R = B.zoom * c(), D = O(
210
- F.map((f) => f.rect),
211
- B,
212
- T,
213
- t
214
- ), y = /* @__PURE__ */ new Map();
215
- for (const f of F)
216
- y.set(
217
- f.id,
218
- U(
219
- p.get(f.id) ?? w,
220
- R,
221
- f.screenshotDensity,
222
- D
223
- )
224
- );
225
- E.displayDensity = R, E.overview = D, E.frames = F.map((f) => ({
226
- id: f.id,
227
- screenshotDensity: f.screenshotDensity,
228
- tier: p.get(f.id) ?? w
229
- })), A(
230
- Y(b, R)
231
- ), C(p, y);
232
- }, r = () => {
233
- s == null && (s = n(d));
234
- }, l = () => {
235
- a == null || a.track(() => {
236
- e.readCamera();
237
- });
238
- };
239
- return {
240
- start() {
241
- a == null && (a = new P(`FrameLodController#${++oe}`, () => {
242
- l(), r();
243
- }), l(), d());
244
- },
245
- stop() {
246
- s != null && (s(), s = null), a == null || a.dispose(), a = null, u = /* @__PURE__ */ new Map(), C(/* @__PURE__ */ new Map()), A(!1);
247
- },
248
- recompute: d
249
- };
250
- }
251
- const le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
252
- __proto__: null,
253
- DEFAULT_FRAME_LOD_TIER: w,
254
- __debugFrameLodState: Q,
255
- countFrameLodListeners: ee,
256
- createFrameLodController: re,
257
- getFrameBitmapFull: J,
258
- getFrameMagnification: H,
259
- getFrameTier: $,
260
- subscribeFrameBitmapScale: K,
261
- subscribeFrameLod: Z
262
- }, Symbol.toStringTag, { value: "Module" }));
263
- export {
264
- H as a,
265
- K as b,
266
- J as c,
267
- re as d,
268
- se as e,
269
- le as f,
270
- $ as g,
271
- Z as s
272
- };