@pygmalionjs/pygmalion 0.6.35 → 0.7.2
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/LICENSE +190 -0
- package/README.ko.md +309 -28
- package/README.md +37 -16
- package/dist-lib/CameraLayer-D2wrEPwG.js +415 -0
- package/dist-lib/frameLodRuntime-CU0IYaSu.js +272 -0
- package/dist-lib/pygmalion.js +11615 -15973
- package/dist-lib/routePreviewStatus-DTr-UJhV.js +64 -0
- package/dist-lib/{FrozenRoutePreview-BbF5Ov5K.js → runtime-DRkTU9eq.js} +9515 -5306
- package/dist-lib/testing.js +46 -6
- package/dist-lib/types/{App.d.ts → EditorShell.d.ts} +1 -1
- package/dist-lib/types/canvas/CameraLayer.d.ts +2 -1
- package/dist-lib/types/canvas/FrameLabelBanner.d.ts +1 -1
- package/dist-lib/types/canvas/FrameView.d.ts +1 -1
- package/dist-lib/types/canvas/FrozenRoutePreview.d.ts +1 -1
- package/dist-lib/types/canvas/SectionBoxes.d.ts +2 -1
- package/dist-lib/types/canvas/ShadowRoutePreview.d.ts +1 -1
- package/dist-lib/types/contract/errors.d.ts +30 -0
- package/dist-lib/types/contract/index.d.ts +5 -0
- package/dist-lib/types/contract/memoryTransport.d.ts +19 -0
- package/dist-lib/types/contract/paths.d.ts +57 -0
- package/dist-lib/types/contract/transport.d.ts +69 -0
- package/dist-lib/types/contract/types.d.ts +150 -0
- package/dist-lib/types/contract/validate.d.ts +15 -0
- package/dist-lib/types/contract/viteTransport.d.ts +10 -0
- package/dist-lib/types/core/context.d.ts +12 -0
- package/dist-lib/types/core/debug.d.ts +187 -0
- package/dist-lib/types/core/defaultRuntime.d.ts +3 -0
- package/dist-lib/types/core/hostBindings.d.ts +90 -0
- package/dist-lib/types/core/runtime.d.ts +36 -0
- package/dist-lib/types/core/runtimeContext.d.ts +13 -0
- package/dist-lib/types/editor/flowSessionScheduler.d.ts +21 -7
- package/dist-lib/types/editor/framePreviewKeys.d.ts +10 -10
- package/dist-lib/types/editor/host.d.ts +31 -26
- package/dist-lib/types/editor/previewBootstrap.d.ts +5 -15
- package/dist-lib/types/editor/previewCaptureProgress.d.ts +7 -2
- package/dist-lib/types/editor/projectRuntime.d.ts +11 -98
- package/dist-lib/types/editor/revisionCatalog.d.ts +8 -9
- package/dist-lib/types/editor/scenarioCoverage.d.ts +2 -1
- package/dist-lib/types/editor/store.d.ts +17 -2
- package/dist-lib/types/editor/storyboardComposition.d.ts +1 -5
- package/dist-lib/types/editor/storyboardDiscovery.d.ts +6 -16
- package/dist-lib/types/editor/storyboardEnvironment.d.ts +2 -2
- package/dist-lib/types/editor/variantPrefetch.d.ts +3 -2
- package/dist-lib/types/editor/visualQa.d.ts +7 -2
- package/dist-lib/types/lib.d.ts +25 -204
- package/dist-lib/types/shell/ComponentStateControls.d.ts +1 -1
- package/dist-lib/types/testing.d.ts +5 -1
- package/node/component-branches.mjs +3 -3
- package/node/contract.d.mts +63 -0
- package/node/contract.mjs +175 -0
- package/node/design-session.mjs +4 -2
- package/node/dev-mirror.mjs +6 -3
- package/node/inspect-plugin.mjs +3 -2
- package/node/preview-artifact-plugin.mjs +13 -16
- package/node/preview-artifact-store.mjs +4 -2
- package/node/qa-capture-plugin.mjs +3 -2
- package/node/storyboard-canonical.mjs +2 -2
- package/node/storyboard-capture-runtime.mjs +2 -2
- package/node/storyboard-environment.mjs +9 -6
- package/node/vite.mjs +2 -13
- package/package.json +24 -4
- package/storyboard.d.ts +11 -0
|
@@ -0,0 +1,272 @@
|
|
|
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
|
+
};
|