@nova-lab/core 1.2.2-dev.259 → 1.2.2-dev.272
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/README.md +55 -0
- package/dist/2d/effects.js +165 -404
- package/dist/2d/lighting.d.ts +2 -0
- package/dist/2d/lighting.js +483 -227
- package/dist/2d/lottie.js +1 -1
- package/dist/2d/meshes.js +2 -2
- package/dist/2d/render-textures.js +3 -537
- package/dist/2d.js +3 -3
- package/dist/{NovaNode-CBZ-Ol-W.js → NovaNode-CshmSV9Y.js} +21 -21
- package/dist/{NovaRenderCommandWriter-CWQRa42y.js → NovaRenderCommandWriter-DeHyKjke.js} +272 -251
- package/dist/NovaRenderTexture-Desjl5-m.js +539 -0
- package/dist/{NovaTextSelectionService-7JqMcRrP.js → NovaTextSelectionService-CWJKn7TW.js} +3948 -3517
- package/dist/{NovaWebGLProgram-BO250QNF.js → NovaWebGLProgram-ytnblA5d.js} +28 -25
- package/dist/core.js +3 -3
- package/dist/model/lighting/LightingFields2D.d.ts +35 -0
- package/dist/model/lighting/LightingRenderer2D.d.ts +11 -18
- package/dist/model/lighting/LightingScene2D.d.ts +43 -0
- package/dist/model/lighting/NovaLighting2D.d.ts +18 -33
- package/dist/model/lighting/NovaLightingEffect2D.d.ts +46 -0
- package/dist/model/lighting/lighting-effect.d.ts +24 -0
- package/dist/model/lighting/lighting-shaders.d.ts +2 -2
- package/dist/model/lighting/lighting.types.d.ts +5 -1
- package/dist/model/render/backends/webgl/NovaWebGLCompositionPass.d.ts +2 -1
- package/dist/model/render/backends/webgl/NovaWebGLFrameRenderer.d.ts +26 -2
- package/dist/model/render/backends/webgl/NovaWebGLPathClipPass.d.ts +3 -2
- package/dist/model/render/backends/webgl/NovaWebGLProgram.d.ts +1 -1
- package/dist/model/render/graph/nova-render-dirty-items.d.ts +12 -0
- package/dist/model/runtime/cursor/NovaCursorManager.d.ts +7 -0
- package/dist/shader-effect-CHXZBHrO.js +247 -0
- package/package.json +2 -2
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { p as v, m as
|
|
2
|
-
import { g as
|
|
1
|
+
import { p as v, m as ne, o as ge, q as _e, h as ye } from "./nova-color-parser-BCN_rFRN.js";
|
|
2
|
+
import { g as we, e as Ie, x as se, y as ve, z as be } from "./NovaNode-CshmSV9Y.js";
|
|
3
3
|
import { mat3 as b } from "gl-matrix";
|
|
4
|
-
import { r as
|
|
5
|
-
import { isPath as
|
|
6
|
-
import { g as
|
|
7
|
-
var
|
|
8
|
-
let
|
|
9
|
-
function
|
|
4
|
+
import { r as Se } from "./nova-text-paint-CcntsRjI.js";
|
|
5
|
+
import { isPath as Re } from "@typedworks/geometry";
|
|
6
|
+
import { g as Ne } from "./nova-mesh-registry-B7Xz5mhU.js";
|
|
7
|
+
var D = /* @__PURE__ */ ((r) => (r.Web2D = "2d", r.WebGL = "webgl", r))(D || {});
|
|
8
|
+
let A, G;
|
|
9
|
+
function ie(r) {
|
|
10
10
|
const e = typeof Intl > "u" ? void 0 : Intl.Segmenter;
|
|
11
11
|
if (typeof e != "function") {
|
|
12
|
-
|
|
12
|
+
A = void 0, G = void 0;
|
|
13
13
|
let t = 0;
|
|
14
14
|
const n = [];
|
|
15
15
|
for (const s of r) {
|
|
@@ -22,13 +22,13 @@ function se(r) {
|
|
|
22
22
|
}
|
|
23
23
|
return n;
|
|
24
24
|
}
|
|
25
|
-
return (
|
|
25
|
+
return (G !== e || !A) && (A = new e(void 0, { granularity: "grapheme" }), G = e), Array.from(A.segment(r), (t) => ({
|
|
26
26
|
value: t.segment,
|
|
27
27
|
index: t.index,
|
|
28
28
|
end: t.index + t.segment.length
|
|
29
29
|
}));
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function Be(r, e, t, n) {
|
|
32
32
|
if (Number.isNaN(t) || t < 0)
|
|
33
33
|
return "";
|
|
34
34
|
if ((n ?? r(e)) <= t)
|
|
@@ -36,7 +36,7 @@ function Ne(r, e, t, n) {
|
|
|
36
36
|
const s = "...";
|
|
37
37
|
if (r(s) > t)
|
|
38
38
|
return "";
|
|
39
|
-
const i =
|
|
39
|
+
const i = ie(e);
|
|
40
40
|
let o = 0, a = Math.max(0, i.length - 1);
|
|
41
41
|
for (; o < a; ) {
|
|
42
42
|
const c = Math.ceil((o + a) / 2), h = i[c - 1].end;
|
|
@@ -44,7 +44,7 @@ function Ne(r, e, t, n) {
|
|
|
44
44
|
}
|
|
45
45
|
return `${e.slice(0, o === 0 ? 0 : i[o - 1].end)}${s}`;
|
|
46
46
|
}
|
|
47
|
-
let
|
|
47
|
+
let xe = 0;
|
|
48
48
|
class C {
|
|
49
49
|
constructor(e, t) {
|
|
50
50
|
this.revision = t, this._segments = Object.freeze(e.slice());
|
|
@@ -123,7 +123,7 @@ class C {
|
|
|
123
123
|
return this._segments;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
class
|
|
126
|
+
class oe {
|
|
127
127
|
constructor(e, t) {
|
|
128
128
|
this.revision = t, this._sequences = Object.freeze(e.slice());
|
|
129
129
|
let n = 0;
|
|
@@ -202,13 +202,13 @@ class ie {
|
|
|
202
202
|
return this._sequences;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function Te(r) {
|
|
206
206
|
if (r instanceof C)
|
|
207
207
|
return r.segmentSlices();
|
|
208
|
-
if (r instanceof
|
|
208
|
+
if (r instanceof oe) {
|
|
209
209
|
const e = [];
|
|
210
210
|
for (const t of r.componentSequences()) {
|
|
211
|
-
const n =
|
|
211
|
+
const n = Te(t);
|
|
212
212
|
if (!n)
|
|
213
213
|
return;
|
|
214
214
|
e.push(...n);
|
|
@@ -216,7 +216,7 @@ function xe(r) {
|
|
|
216
216
|
return Object.freeze(e);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function V(r = [], e = 0, t = {}) {
|
|
220
220
|
const n = Object.freeze(Array.from(r));
|
|
221
221
|
return new C([Object.freeze({
|
|
222
222
|
id: t.id ?? `sequence:${e}`,
|
|
@@ -225,10 +225,10 @@ function D(r = [], e = 0, t = {}) {
|
|
|
225
225
|
values: n
|
|
226
226
|
})], e);
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
return new
|
|
228
|
+
function mt(r, e) {
|
|
229
|
+
return new oe(r, e);
|
|
230
230
|
}
|
|
231
|
-
class
|
|
231
|
+
class ke {
|
|
232
232
|
_namespace;
|
|
233
233
|
_commandId = 0;
|
|
234
234
|
_itemId = 0;
|
|
@@ -238,7 +238,7 @@ class Te {
|
|
|
238
238
|
_orderRevision = 0;
|
|
239
239
|
_instructionVersions = /* @__PURE__ */ new Map();
|
|
240
240
|
constructor(e) {
|
|
241
|
-
this._namespace = (++
|
|
241
|
+
this._namespace = (++xe).toString(36);
|
|
242
242
|
}
|
|
243
243
|
nextCommandId() {
|
|
244
244
|
return `cmd:${this._namespace}:${(++this._commandId).toString(36)}`;
|
|
@@ -263,10 +263,10 @@ class Te {
|
|
|
263
263
|
return this._instructionVersions.set(e, t), t;
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
let
|
|
267
|
-
function
|
|
266
|
+
let Ce = 0, Oe = 0;
|
|
267
|
+
function Pe(r, e = 0, t = V(), n = V(), s = !1) {
|
|
268
268
|
return Object.freeze({
|
|
269
|
-
id: `instructions:${(++
|
|
269
|
+
id: `instructions:${(++Oe).toString(36)}:${r}`,
|
|
270
270
|
groupId: r,
|
|
271
271
|
version: e,
|
|
272
272
|
commands: t,
|
|
@@ -274,23 +274,23 @@ function Oe(r, e = 0, t = D(), n = D(), s = !1) {
|
|
|
274
274
|
reused: s
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function Ae(r) {
|
|
278
278
|
return {
|
|
279
279
|
id: r.id,
|
|
280
|
-
ownerGeneration: ++
|
|
280
|
+
ownerGeneration: ++Ce,
|
|
281
281
|
ownerNodeId: r.ownerNodeId,
|
|
282
282
|
parentGroupId: r.parentGroupId,
|
|
283
283
|
layerId: r.layerId,
|
|
284
284
|
opacity: 1,
|
|
285
285
|
dirtyFlags: Ie(),
|
|
286
|
-
versions:
|
|
286
|
+
versions: we(),
|
|
287
287
|
childGroupIds: [],
|
|
288
288
|
visible: !0,
|
|
289
289
|
lastCompiledVersion: 0,
|
|
290
290
|
lastRenderedVersion: 0
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function Ee(r, e = r.childGroupIds) {
|
|
294
294
|
return Object.freeze({
|
|
295
295
|
...r,
|
|
296
296
|
transform: r.transform ? b.clone(r.transform) : void 0,
|
|
@@ -318,7 +318,7 @@ function k(r) {
|
|
|
318
318
|
bounds: r.bounds
|
|
319
319
|
};
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function W(r) {
|
|
322
322
|
switch (r.type) {
|
|
323
323
|
case "rect":
|
|
324
324
|
case "border":
|
|
@@ -336,96 +336,96 @@ function V(r) {
|
|
|
336
336
|
return "custom";
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function Y(r) {
|
|
340
340
|
if (r.type === "rect") {
|
|
341
341
|
const e = typeof r.styles?.background == "string" ? r.styles.background : "texture", t = r.styles?.border ? "border" : "none", n = r.styles?.radius ?? r.styles?.border?.radius ?? 0;
|
|
342
342
|
return `rect:${e}:${t}:${n}:${r.styles?.opacity ?? 1}`;
|
|
343
343
|
}
|
|
344
344
|
return r.type === "border" ? `border:${r.styles?.color ?? "none"}:${r.styles?.width ?? 0}:${r.styles?.opacity ?? 1}` : r.type === "text" ? `text:${r.styles?.font?.family ?? "sans"}:${r.styles?.font?.size ?? 12}:${r.styles?.font?.weight ?? "normal"}` : r.type === "icon" ? `icon:${typeof r.icon == "string" ? r.icon : "source"}` : r.type === "nine-slice-image" ? `nine-slice-image:${typeof r.image == "string" ? r.image : r.image.id}:${r.styles?.opacity ?? 1}` : r.type === "pattern-rect" ? `pattern-rect:${r.pattern.type}:${r.pattern.shape ?? "square"}:${r.pattern.color}:${r.styles?.opacity ?? 1}` : r.type;
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function J(r) {
|
|
347
347
|
if (r.type === "rect") {
|
|
348
348
|
const e = r.styles?.border, t = r.styles?.radius ?? e?.radius ?? 0, n = e?.width ?? 0, s = r.styles?.background;
|
|
349
349
|
return s && typeof s != "string" ? "texture-quad" : t > 0 || n > 0 ? "rounded-rect" : "plain-rect";
|
|
350
350
|
}
|
|
351
351
|
return r.type === "border" ? "border" : r.type === "line" ? "line" : r.type === "circle" ? "circle" : r.type === "arc" ? "arc" : r.type === "path" ? "path" : r.type === "polygon" ? "polygon" : r.type === "text" ? "text-run" : r.type === "icon" ? "icon" : r.type === "nine-slice-image" ? "nine-slice-image" : r.type === "pattern-rect" ? "pattern-rect" : "cached-group";
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function Me(r, e = 0) {
|
|
354
354
|
return {
|
|
355
355
|
id: r,
|
|
356
356
|
zIndex: e,
|
|
357
|
-
rootGroup:
|
|
357
|
+
rootGroup: Ae({
|
|
358
358
|
id: `${r}:root`,
|
|
359
359
|
layerId: r
|
|
360
360
|
})
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
|
-
const
|
|
364
|
-
function
|
|
365
|
-
return
|
|
363
|
+
const ae = /* @__PURE__ */ new WeakMap(), ce = /* @__PURE__ */ new WeakSet();
|
|
364
|
+
function gt(r) {
|
|
365
|
+
return ce.has(r);
|
|
366
366
|
}
|
|
367
|
-
function
|
|
368
|
-
return r !== e && r && typeof r == "object" && (Object.getPrototypeOf(r) === Object.prototype || Object.getPrototypeOf(r) === null) && Object.isFrozen(r) && Array.isArray(r.points) &&
|
|
367
|
+
function X(r, e) {
|
|
368
|
+
return r !== e && r && typeof r == "object" && (Object.getPrototypeOf(r) === Object.prototype || Object.getPrototypeOf(r) === null) && Object.isFrozen(r) && Array.isArray(r.points) && ce.add(r), r;
|
|
369
369
|
}
|
|
370
|
-
const
|
|
370
|
+
const F = /* @__PURE__ */ new WeakSet(), q = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), _t = Object.freeze({
|
|
371
371
|
commit: () => {
|
|
372
372
|
},
|
|
373
373
|
abort: () => {
|
|
374
374
|
}
|
|
375
375
|
});
|
|
376
|
-
function
|
|
377
|
-
return
|
|
376
|
+
function P(r, e) {
|
|
377
|
+
return ae.set(r, e), r;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
return
|
|
379
|
+
function $e(r) {
|
|
380
|
+
return ae.get(r) ?? r;
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function Q(r, e, t = {}) {
|
|
383
383
|
const n = R(
|
|
384
384
|
r,
|
|
385
385
|
/* @__PURE__ */ new WeakMap(),
|
|
386
386
|
t.freeze !== !1
|
|
387
387
|
);
|
|
388
|
-
return e && typeof n == "object" && n !== null &&
|
|
388
|
+
return e && typeof n == "object" && n !== null && P(n, e), t.freeze === !1 ? n : X(n, r);
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function M(r, e) {
|
|
391
391
|
const t = r.count, n = Object.getPrototypeOf(r);
|
|
392
|
-
if (!Number.isSafeInteger(t) || t <= 0 || n !== Object.prototype && n !== null ||
|
|
393
|
-
return
|
|
392
|
+
if (!Number.isSafeInteger(t) || t <= 0 || n !== Object.prototype && n !== null || de(r))
|
|
393
|
+
return Q(r, r);
|
|
394
394
|
const s = /* @__PURE__ */ new WeakMap(), i = {};
|
|
395
395
|
s.set(r, i);
|
|
396
396
|
for (const o of Reflect.ownKeys(r)) {
|
|
397
397
|
const a = r[o], c = typeof o == "string" && Object.hasOwn(e, o) ? e[o] : void 0;
|
|
398
|
-
i[o] = c === void 0 ? R(a, s, !0) :
|
|
398
|
+
i[o] = c === void 0 ? R(a, s, !0) : Ge(a, t * c, s);
|
|
399
399
|
}
|
|
400
|
-
return
|
|
400
|
+
return P(Object.freeze(i), r);
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function yt(r, e) {
|
|
403
403
|
if (e) {
|
|
404
|
-
|
|
404
|
+
F.add(r);
|
|
405
405
|
return;
|
|
406
406
|
}
|
|
407
|
-
|
|
407
|
+
F.delete(r), q.delete(r);
|
|
408
408
|
}
|
|
409
|
-
function
|
|
410
|
-
if (!
|
|
411
|
-
return
|
|
412
|
-
const t =
|
|
409
|
+
function E(r, e) {
|
|
410
|
+
if (!F.has(r) || typeof r.revision != "number" || typeof r.staticRevision != "number")
|
|
411
|
+
return M(r, e);
|
|
412
|
+
const t = q.get(r);
|
|
413
413
|
if (t && t.count === r.count && t.revision === r.revision && t.staticRevision === r.staticRevision)
|
|
414
414
|
return t;
|
|
415
|
-
const n =
|
|
416
|
-
return
|
|
415
|
+
const n = M(r, e);
|
|
416
|
+
return q.set(r, n), n;
|
|
417
417
|
}
|
|
418
|
-
function
|
|
418
|
+
function ze(r, e = {}) {
|
|
419
419
|
const t = e.snapshotVersion, n = e.sourceIdentity === r && typeof t == "number" && Number.isFinite(t) && e.dirtyIndices === void 0;
|
|
420
|
-
if (!n && e.sourceIdentity === r &&
|
|
421
|
-
const c =
|
|
420
|
+
if (!n && e.sourceIdentity === r && j.delete(r), n) {
|
|
421
|
+
const c = j.get(r);
|
|
422
422
|
if (c && c.snapshotVersion === t && c.contentVersion === e.contentVersion && c.semanticScope === e.semanticScope && c.length === r.length)
|
|
423
423
|
return c.snapshot;
|
|
424
424
|
}
|
|
425
|
-
const s = /* @__PURE__ */ new WeakMap(), i = r.map((c) =>
|
|
425
|
+
const s = /* @__PURE__ */ new WeakMap(), i = r.map((c) => X(R(c, s, !0), c));
|
|
426
426
|
i.semanticScope = e.semanticScope, i.contentVersion = e.contentVersion, i.snapshotVersion = e.snapshotVersion, i.dirtyIndices = e.dirtyIndices === void 0 ? void 0 : R(e.dirtyIndices, s, !0);
|
|
427
|
-
const o = Object.freeze(i), a =
|
|
428
|
-
return n &&
|
|
427
|
+
const o = Object.freeze(i), a = P(o, e.sourceIdentity ?? r);
|
|
428
|
+
return n && j.set(r, {
|
|
429
429
|
snapshotVersion: t,
|
|
430
430
|
contentVersion: e.contentVersion,
|
|
431
431
|
semanticScope: e.semanticScope,
|
|
@@ -433,13 +433,13 @@ function $e(r, e = {}) {
|
|
|
433
433
|
snapshot: a
|
|
434
434
|
}), a;
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function wt(r, e, t) {
|
|
437
437
|
const n = /* @__PURE__ */ new WeakMap(), s = r.slice();
|
|
438
438
|
for (const o of t.dirtyIndices)
|
|
439
|
-
s[o] =
|
|
439
|
+
s[o] = X(R(e[o], n, !0), e[o]);
|
|
440
440
|
s.semanticScope = t.semanticScope, s.contentVersion = t.contentVersion, s.dirtyIndices = R(t.dirtyIndices, n, !0);
|
|
441
441
|
const i = Object.freeze(s);
|
|
442
|
-
return
|
|
442
|
+
return P(i, t.sourceIdentity ?? e);
|
|
443
443
|
}
|
|
444
444
|
function R(r, e, t) {
|
|
445
445
|
if (r === null || typeof r != "object")
|
|
@@ -447,7 +447,7 @@ function R(r, e, t) {
|
|
|
447
447
|
const n = r, s = e.get(n);
|
|
448
448
|
if (s !== void 0)
|
|
449
449
|
return s;
|
|
450
|
-
if (
|
|
450
|
+
if (de(r) || Re(r))
|
|
451
451
|
return r;
|
|
452
452
|
if (ArrayBuffer.isView(r))
|
|
453
453
|
return r instanceof DataView ? new DataView(
|
|
@@ -473,7 +473,7 @@ function R(r, e, t) {
|
|
|
473
473
|
);
|
|
474
474
|
return t ? Object.freeze(o) : o;
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function Ge(r, e, t) {
|
|
477
477
|
if (ArrayBuffer.isView(r) && !(r instanceof DataView))
|
|
478
478
|
return r.slice(0, e);
|
|
479
479
|
if (Array.isArray(r)) {
|
|
@@ -484,10 +484,10 @@ function ze(r, e, t) {
|
|
|
484
484
|
}
|
|
485
485
|
return R(r, t, !0);
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function de(r) {
|
|
488
488
|
return typeof r == "object" && r !== null && "__novaAssetRef" in r && r.__novaAssetRef === !0;
|
|
489
489
|
}
|
|
490
|
-
const
|
|
490
|
+
const he = /* @__PURE__ */ new WeakMap(), ue = /* @__PURE__ */ new WeakMap(), $ = {
|
|
491
491
|
x: "x",
|
|
492
492
|
y: "y",
|
|
493
493
|
width: "width",
|
|
@@ -496,7 +496,7 @@ const de = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), M
|
|
|
496
496
|
radius: "radii",
|
|
497
497
|
state: "states"
|
|
498
498
|
};
|
|
499
|
-
class
|
|
499
|
+
class je {
|
|
500
500
|
active = !0;
|
|
501
501
|
count;
|
|
502
502
|
_columns;
|
|
@@ -522,7 +522,7 @@ class Ge {
|
|
|
522
522
|
for (let t = 0; t < this.count; t++)
|
|
523
523
|
this._columns.colors[t * 4 + 3] = 1;
|
|
524
524
|
if (e.defaults) {
|
|
525
|
-
const t =
|
|
525
|
+
const t = Z(e.defaults);
|
|
526
526
|
for (const [n, s] of t)
|
|
527
527
|
if (typeof s == "number")
|
|
528
528
|
this._columns[n].fill(s);
|
|
@@ -530,11 +530,11 @@ class Ge {
|
|
|
530
530
|
for (let i = 0; i < this.count; i++)
|
|
531
531
|
this._columns[n].set(s, i * 4);
|
|
532
532
|
}
|
|
533
|
-
e.columns && this.updateRange(0, e.columns), this._onChange = e.onChange,
|
|
533
|
+
e.columns && this.updateRange(0, e.columns), this._onChange = e.onChange, he.set(this, () => this._capture());
|
|
534
534
|
}
|
|
535
535
|
set(e, t) {
|
|
536
536
|
this._checkRange(e, 1);
|
|
537
|
-
const n = this._apply(e,
|
|
537
|
+
const n = this._apply(e, Z(t));
|
|
538
538
|
return n && this._onChange?.(), n;
|
|
539
539
|
}
|
|
540
540
|
updateRange(e, t) {
|
|
@@ -545,11 +545,11 @@ class Ge {
|
|
|
545
545
|
this._checkRange(e, s);
|
|
546
546
|
const i = [];
|
|
547
547
|
for (const [a, c] of n) {
|
|
548
|
-
if (!Object.hasOwn(
|
|
548
|
+
if (!Object.hasOwn($, a) || c.length !== s)
|
|
549
549
|
throw new TypeError("[Nova] Batch columns must be known fields with equal lengths");
|
|
550
|
-
const h =
|
|
550
|
+
const h = $[a], f = h === "colors" ? 4 : 1, d = new Float32Array(s * f);
|
|
551
551
|
for (let p = 0; p < s; p++) {
|
|
552
|
-
const u =
|
|
552
|
+
const u = le(a, c[p]);
|
|
553
553
|
typeof u == "number" ? d[p] = u : d.set(u, p * f);
|
|
554
554
|
}
|
|
555
555
|
i.push([h, d]);
|
|
@@ -559,8 +559,8 @@ class Ge {
|
|
|
559
559
|
const h = a === "colors" ? 4 : 1, f = this._columns[a], d = a === "x" || a === "y" || a === "width" || a === "height", p = d ? this._geometry : this._paint;
|
|
560
560
|
let u = !1;
|
|
561
561
|
for (let y = 0; y < s; y++)
|
|
562
|
-
for (let
|
|
563
|
-
const x = (e + y) * h +
|
|
562
|
+
for (let I = 0; I < h; I++) {
|
|
563
|
+
const x = (e + y) * h + I, l = c[y * h + I];
|
|
564
564
|
f[x] !== l && (f[x] = l, p.add(e + y), u = !0);
|
|
565
565
|
}
|
|
566
566
|
u && (this._changedColumns.add(a), this._revision += Number(d), this._staticRevision += +!d, o = !0);
|
|
@@ -590,38 +590,38 @@ class Ge {
|
|
|
590
590
|
for (const s of Object.keys(this._columns))
|
|
591
591
|
t[s] = e && !this._changedColumns.has(s) ? e[s] : this._columns[s].slice();
|
|
592
592
|
const n = Object.freeze({ count: this.count, ...t, revision: this._revision, staticRevision: this._staticRevision });
|
|
593
|
-
return
|
|
593
|
+
return P(n, this), ue.set(n, {
|
|
594
594
|
geometryFrom: e?.revision,
|
|
595
595
|
paintFrom: e?.staticRevision,
|
|
596
|
-
geometry:
|
|
597
|
-
paint:
|
|
596
|
+
geometry: ee(this._geometry),
|
|
597
|
+
paint: ee(this._paint)
|
|
598
598
|
}), this._snapshot = n, this._changedColumns.clear(), this._geometry.clear(), this._paint.clear(), n;
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
601
|
function It(r) {
|
|
602
|
-
return new
|
|
603
|
-
}
|
|
604
|
-
function je(r) {
|
|
605
|
-
return de.get(r)?.();
|
|
602
|
+
return new je(r);
|
|
606
603
|
}
|
|
607
604
|
function He(r) {
|
|
608
|
-
return he.get(r);
|
|
605
|
+
return he.get(r)?.();
|
|
609
606
|
}
|
|
610
|
-
function
|
|
607
|
+
function De(r) {
|
|
608
|
+
return ue.get(r);
|
|
609
|
+
}
|
|
610
|
+
function Z(r) {
|
|
611
611
|
const e = Object.entries(r);
|
|
612
612
|
let t = 0;
|
|
613
613
|
for (const n of e) {
|
|
614
614
|
const [s, i] = n;
|
|
615
|
-
if (!Object.hasOwn(
|
|
615
|
+
if (!Object.hasOwn($, s))
|
|
616
616
|
throw new TypeError(`[Nova] Unknown batch field: ${s}`);
|
|
617
617
|
if (i === void 0)
|
|
618
618
|
continue;
|
|
619
|
-
const o =
|
|
620
|
-
n[0] =
|
|
619
|
+
const o = le(s, i);
|
|
620
|
+
n[0] = $[s], n[1] = o, e[t++] = n;
|
|
621
621
|
}
|
|
622
622
|
return e.length = t, e;
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function le(r, e) {
|
|
625
625
|
if (r === "color") {
|
|
626
626
|
const t = typeof e == "string" ? v(e, 255) : void 0, n = t ? [t.r, t.g, t.b, t.a] : e;
|
|
627
627
|
if (!Array.isArray(n) || n.length !== 4 || !n.every((s) => typeof s == "number" && Number.isFinite(s) && s >= 0 && s <= 1))
|
|
@@ -632,7 +632,7 @@ function ue(r, e) {
|
|
|
632
632
|
throw new RangeError(`[Nova] Invalid batch ${r}`);
|
|
633
633
|
return Math.fround(e);
|
|
634
634
|
}
|
|
635
|
-
function
|
|
635
|
+
function ee(r) {
|
|
636
636
|
const e = [];
|
|
637
637
|
for (const t of [...r].sort((n, s) => n - s)) {
|
|
638
638
|
const n = e[e.length - 1];
|
|
@@ -640,19 +640,19 @@ function Z(r) {
|
|
|
640
640
|
}
|
|
641
641
|
return e;
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function Ve(r, e, t, n = 1) {
|
|
644
644
|
const s = r.styles?.font, i = (s?.size ?? 12) * n, o = s?.family ?? t.family, a = s?.style ?? "normal", c = s?.weight ?? "normal", h = (r.styles?.lineHeight ?? t.lineHeight) * n, f = r.text.split(/\r\n|\r|\n/), d = [];
|
|
645
645
|
let p = 0;
|
|
646
646
|
for (let u = 0; u < f.length; u += 1) {
|
|
647
|
-
const y = f[u].split(/(\*\*[^*]+\*\*|_[^_]+_)/g),
|
|
647
|
+
const y = f[u].split(/(\*\*[^*]+\*\*|_[^_]+_)/g), I = [];
|
|
648
648
|
for (const l of y) {
|
|
649
649
|
if (!l)
|
|
650
650
|
continue;
|
|
651
|
-
const _ = /^\*\*.+\*\*$/.test(l),
|
|
652
|
-
N?.font === g ? N.text += m :
|
|
651
|
+
const _ = /^\*\*.+\*\*$/.test(l), w = !_ && /^_.+_$/.test(l), m = _ ? l.slice(2, -2) : w ? l.slice(1, -1) : l, g = `${w ? "italic" : a} ${_ ? "bold" : c} ${i}px ${o}`, N = I[I.length - 1];
|
|
652
|
+
N?.font === g ? N.text += m : I.push({ text: m, font: g });
|
|
653
653
|
}
|
|
654
654
|
let x = 0;
|
|
655
|
-
for (const l of
|
|
655
|
+
for (const l of I) {
|
|
656
656
|
const _ = e(l.text, l.font);
|
|
657
657
|
d.push({ ...l, x, y: u * h, width: _ }), x += _;
|
|
658
658
|
}
|
|
@@ -660,7 +660,7 @@ function De(r, e, t, n = 1) {
|
|
|
660
660
|
}
|
|
661
661
|
return { runs: d, width: p, height: f.length * h, lineHeight: h };
|
|
662
662
|
}
|
|
663
|
-
function
|
|
663
|
+
function vt(r) {
|
|
664
664
|
const e = typeof r.styles?.background == "string" ? r.styles.background : void 0;
|
|
665
665
|
return {
|
|
666
666
|
fill: v(e, 0),
|
|
@@ -671,7 +671,7 @@ function wt(r) {
|
|
|
671
671
|
dashPattern: r.styles?.border?.dashPattern
|
|
672
672
|
};
|
|
673
673
|
}
|
|
674
|
-
function
|
|
674
|
+
function bt(r) {
|
|
675
675
|
return {
|
|
676
676
|
fill: v(void 0, 0),
|
|
677
677
|
opacity: r.styles?.opacity ?? 1,
|
|
@@ -681,7 +681,7 @@ function vt(r) {
|
|
|
681
681
|
dashPattern: r.styles?.dashPattern
|
|
682
682
|
};
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function St(r) {
|
|
685
685
|
const e = typeof r.styles?.background == "string" ? r.styles.background : void 0;
|
|
686
686
|
return {
|
|
687
687
|
fill: v(e, 0),
|
|
@@ -692,7 +692,7 @@ function bt(r) {
|
|
|
692
692
|
dashPattern: r.styles?.border?.dashPattern
|
|
693
693
|
};
|
|
694
694
|
}
|
|
695
|
-
function
|
|
695
|
+
function Rt(r) {
|
|
696
696
|
return {
|
|
697
697
|
color: v(r.styles?.color, 255),
|
|
698
698
|
width: r.styles?.width ?? 1,
|
|
@@ -700,7 +700,7 @@ function St(r) {
|
|
|
700
700
|
lineCap: r.styles?.lineCap ?? "butt"
|
|
701
701
|
};
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function Nt(r) {
|
|
704
704
|
return {
|
|
705
705
|
color: v(r.styles?.color, 255),
|
|
706
706
|
width: r.styles?.width ?? 1,
|
|
@@ -708,7 +708,7 @@ function Rt(r) {
|
|
|
708
708
|
dashPattern: r.styles?.dashPattern
|
|
709
709
|
};
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function Bt(r) {
|
|
712
712
|
return {
|
|
713
713
|
fill: v(r.styles?.background, 0),
|
|
714
714
|
stroke: v(r.styles?.stroke, 0),
|
|
@@ -716,15 +716,15 @@ function Nt(r) {
|
|
|
716
716
|
opacity: r.styles?.opacity ?? 1
|
|
717
717
|
};
|
|
718
718
|
}
|
|
719
|
-
function
|
|
720
|
-
const e = r.styles?.font, t = e?.size ?? 12, n = e?.style ?? "normal", s = e?.weight ?? "normal", i = e?.family ?? "sans-serif", o =
|
|
719
|
+
function xt(r) {
|
|
720
|
+
const e = r.styles?.font, t = e?.size ?? 12, n = e?.style ?? "normal", s = e?.weight ?? "normal", i = e?.family ?? "sans-serif", o = Se(r);
|
|
721
721
|
return {
|
|
722
722
|
color: v(r.styles?.color, 255),
|
|
723
723
|
opacity: r.styles?.opacity ?? 1,
|
|
724
724
|
font: `${n} ${s} ${t}px ${i}`,
|
|
725
725
|
fontSize: t,
|
|
726
726
|
lineHeight: r.styles?.lineHeight ?? t,
|
|
727
|
-
padding:
|
|
727
|
+
padding: fe(r.styles?.padding),
|
|
728
728
|
horizontalAlign: r.styles?.align?.horizontal ?? "left",
|
|
729
729
|
verticalAlign: r.styles?.align?.vertical ?? "top",
|
|
730
730
|
overflowAlign: r.styles?.align?.overflow ?? "start",
|
|
@@ -733,7 +733,7 @@ function Bt(r) {
|
|
|
733
733
|
...o ? { paint: o } : {}
|
|
734
734
|
};
|
|
735
735
|
}
|
|
736
|
-
function
|
|
736
|
+
function fe(r) {
|
|
737
737
|
if (!r)
|
|
738
738
|
return { left: 0, right: 0, top: 0, bottom: 0 };
|
|
739
739
|
if ("all" in r) {
|
|
@@ -755,16 +755,16 @@ function le(r) {
|
|
|
755
755
|
bottom: e.bottom ?? 0
|
|
756
756
|
};
|
|
757
757
|
}
|
|
758
|
-
function
|
|
758
|
+
function We(r) {
|
|
759
759
|
return r.styles?.wrap !== void 0 && r.styles.wrap !== "none";
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function Fe(r, e, t = 1) {
|
|
762
762
|
const n = r.styles;
|
|
763
763
|
if (r.parser === "markdown")
|
|
764
764
|
throw new TypeError("Text wrapping currently requires the string parser");
|
|
765
765
|
if (n?.wrap !== "word" && n?.wrap !== "grapheme")
|
|
766
766
|
throw new TypeError("Unknown text wrapping mode");
|
|
767
|
-
const s = n.font?.size ?? 12, i = n.lineHeight ?? s * 1.2, o = n.maxLines ?? 1 / 0, a =
|
|
767
|
+
const s = n.font?.size ?? 12, i = n.lineHeight ?? s * 1.2, o = n.maxLines ?? 1 / 0, a = fe(n.padding);
|
|
768
768
|
if (![r.width, r.height, ...Object.values(a)].every((l) => Number.isFinite(l) && l >= 0) || ![s, i, t].every((l) => Number.isFinite(l) && l > 0) || n.maxLines !== void 0 && (!Number.isSafeInteger(o) || o <= 0))
|
|
769
769
|
throw new RangeError("Invalid wrapped text dimensions, font, padding or line limit");
|
|
770
770
|
const c = `${n.font?.style ?? "normal"} ${n.font?.weight ?? "normal"} ${s * t}px ${n.font?.family ?? "sans-serif"}`, h = Math.max(0, r.width - a.left - a.right) * t, f = Math.max(0, r.height - a.top - a.bottom) * t, d = [];
|
|
@@ -772,7 +772,7 @@ function We(r, e, t = 1) {
|
|
|
772
772
|
if (h > 0) {
|
|
773
773
|
const l = r.text.split(/\r\n|\r|\n/);
|
|
774
774
|
for (let _ = 0; _ < l.length; _ += 1) {
|
|
775
|
-
const
|
|
775
|
+
const w = l[_], m = ie(w);
|
|
776
776
|
let g = 0;
|
|
777
777
|
do {
|
|
778
778
|
if (d.length === o) {
|
|
@@ -780,9 +780,9 @@ function We(r, e, t = 1) {
|
|
|
780
780
|
break;
|
|
781
781
|
}
|
|
782
782
|
let N = g, S = Math.min(m.length, g + 1);
|
|
783
|
-
const
|
|
783
|
+
const z = m[g]?.index ?? 0;
|
|
784
784
|
for (; S > N; ) {
|
|
785
|
-
if (e(
|
|
785
|
+
if (e(w.slice(z, m[S - 1].end), c) > h) {
|
|
786
786
|
S -= 1;
|
|
787
787
|
break;
|
|
788
788
|
}
|
|
@@ -792,19 +792,19 @@ function We(r, e, t = 1) {
|
|
|
792
792
|
}
|
|
793
793
|
for (; N < S; ) {
|
|
794
794
|
const B = Math.ceil((N + S) / 2);
|
|
795
|
-
e(
|
|
795
|
+
e(w.slice(z, m[B - 1].end), c) <= h ? N = B : S = B - 1;
|
|
796
796
|
}
|
|
797
797
|
let T = Math.min(m.length, Math.max(g + 1, N));
|
|
798
|
-
if (n.wrap === "word" && T < m.length && !
|
|
798
|
+
if (n.wrap === "word" && T < m.length && !H(m[T].value)) {
|
|
799
799
|
for (let B = T - 1; B > g; B -= 1)
|
|
800
|
-
if (
|
|
800
|
+
if (H(m[B].value)) {
|
|
801
801
|
T = B;
|
|
802
802
|
break;
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
const
|
|
806
|
-
if (d.push(
|
|
807
|
-
for (; g < m.length &&
|
|
805
|
+
const me = m[T - 1]?.end ?? 0;
|
|
806
|
+
if (d.push(w.slice(z, me)), g = T, n.wrap === "word")
|
|
807
|
+
for (; g < m.length && H(m[g].value); )
|
|
808
808
|
g += 1;
|
|
809
809
|
} while (g < m.length);
|
|
810
810
|
if (p)
|
|
@@ -813,28 +813,46 @@ function We(r, e, t = 1) {
|
|
|
813
813
|
}
|
|
814
814
|
if (p && n.ellipsis && d.length > 0) {
|
|
815
815
|
const l = d.length - 1, _ = d[l];
|
|
816
|
-
d[l] = e(`${_}...`, c) <= h ? `${_}...` :
|
|
816
|
+
d[l] = e(`${_}...`, c) <= h ? `${_}...` : Be((w) => e(w, c), _, h, 1 / 0);
|
|
817
817
|
}
|
|
818
818
|
const u = d.length * i * t, y = a.top * t + (n.align?.vertical === "middle" ? (f - u) / 2 : n.align?.vertical === "bottom" ? f - u : 0);
|
|
819
|
-
let
|
|
819
|
+
let I = 0;
|
|
820
820
|
return {
|
|
821
821
|
runs: d.map((l, _) => {
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
const m =
|
|
825
|
-
return { text: l, font: c, x: a.left * t + g, y: y + _ * i * t, width:
|
|
822
|
+
const w = e(l, c);
|
|
823
|
+
I = Math.max(I, w);
|
|
824
|
+
const m = w > h && n.align?.overflow !== "preserve" ? "left" : n.align?.horizontal, g = m === "center" ? (h - w) / 2 : m === "right" ? h - w : 0;
|
|
825
|
+
return { text: l, font: c, x: a.left * t + g, y: y + _ * i * t, width: w };
|
|
826
826
|
}),
|
|
827
|
-
width:
|
|
827
|
+
width: I + (a.left + a.right) * t,
|
|
828
828
|
height: u + (a.top + a.bottom) * t,
|
|
829
829
|
lineHeight: i * t,
|
|
830
830
|
truncated: p
|
|
831
831
|
};
|
|
832
832
|
}
|
|
833
|
-
function
|
|
833
|
+
function H(r) {
|
|
834
834
|
return /^[\t\v\f ]+$/.test(r);
|
|
835
835
|
}
|
|
836
|
-
const
|
|
837
|
-
|
|
836
|
+
const U = Symbol("nova-render-dirty-items"), L = Symbol("nova-retained-paint-dirty"), O = Symbol("nova-prepared-backend-lease");
|
|
837
|
+
function Tt(r, e) {
|
|
838
|
+
const t = r;
|
|
839
|
+
if (t[O])
|
|
840
|
+
throw new Error("Nova render frame already has a prepared backend lease.");
|
|
841
|
+
Object.defineProperty(t, O, {
|
|
842
|
+
value: e,
|
|
843
|
+
configurable: !0,
|
|
844
|
+
enumerable: !1
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
function kt(r) {
|
|
848
|
+
const e = r[O];
|
|
849
|
+
return e?.frame === r ? e : void 0;
|
|
850
|
+
}
|
|
851
|
+
function Ct(r, e) {
|
|
852
|
+
const t = r;
|
|
853
|
+
t[O] === e && delete t[O];
|
|
854
|
+
}
|
|
855
|
+
class qe {
|
|
838
856
|
itemIds = [];
|
|
839
857
|
_seenEpochByItemId = /* @__PURE__ */ new Map();
|
|
840
858
|
_epoch = 1;
|
|
@@ -874,7 +892,7 @@ class Fe {
|
|
|
874
892
|
this._epoch += 1;
|
|
875
893
|
}
|
|
876
894
|
}
|
|
877
|
-
class
|
|
895
|
+
class Ue {
|
|
878
896
|
nodeIds = [];
|
|
879
897
|
_seenEpochByNodeId = /* @__PURE__ */ new Map();
|
|
880
898
|
_epoch = 1;
|
|
@@ -889,48 +907,48 @@ class qe {
|
|
|
889
907
|
this._epoch += 1;
|
|
890
908
|
}
|
|
891
909
|
}
|
|
892
|
-
function
|
|
910
|
+
function Le(r) {
|
|
893
911
|
const e = r;
|
|
894
|
-
return e[
|
|
912
|
+
return e[U] ??= new qe(), e[U];
|
|
895
913
|
}
|
|
896
|
-
function
|
|
897
|
-
return r[
|
|
914
|
+
function Ot(r) {
|
|
915
|
+
return r[U];
|
|
898
916
|
}
|
|
899
917
|
function Ke(r) {
|
|
900
918
|
const e = r;
|
|
901
|
-
return e[
|
|
919
|
+
return e[L] ??= new Ue(), e[L];
|
|
902
920
|
}
|
|
903
|
-
function
|
|
904
|
-
return r[
|
|
921
|
+
function Pt(r) {
|
|
922
|
+
return r[L];
|
|
905
923
|
}
|
|
906
|
-
const
|
|
907
|
-
function
|
|
908
|
-
K.set(r, e?.size ? Object.freeze([...e]) :
|
|
924
|
+
const Xe = Object.freeze([]), K = /* @__PURE__ */ new WeakMap();
|
|
925
|
+
function pe(r, e) {
|
|
926
|
+
K.set(r, e?.size ? Object.freeze([...e]) : Xe);
|
|
909
927
|
}
|
|
910
|
-
function
|
|
928
|
+
function At(r) {
|
|
911
929
|
const e = K.get(r);
|
|
912
930
|
if (e)
|
|
913
931
|
return e;
|
|
914
932
|
const t = /* @__PURE__ */ new Set();
|
|
915
933
|
for (const n of r) {
|
|
916
934
|
if (n.type === "beginComposition")
|
|
917
|
-
for (const s of
|
|
935
|
+
for (const s of ne(n.id))
|
|
918
936
|
t.add(s);
|
|
919
937
|
if (n.type === "clipPath")
|
|
920
|
-
for (const s of
|
|
938
|
+
for (const s of se(n.id))
|
|
921
939
|
t.add(s);
|
|
922
940
|
if (n.type === "beginRenderTarget" || n.type === "drawRenderTarget") {
|
|
923
941
|
const s = n.targetId ?? n.target?.id;
|
|
924
942
|
s !== void 0 && t.add(s);
|
|
925
943
|
}
|
|
926
944
|
}
|
|
927
|
-
return
|
|
928
|
-
}
|
|
929
|
-
let ee = 0;
|
|
930
|
-
function Xe() {
|
|
931
|
-
return ee += 1, ee;
|
|
945
|
+
return pe(r, t), K.get(r);
|
|
932
946
|
}
|
|
947
|
+
let te = 0;
|
|
933
948
|
function Qe() {
|
|
949
|
+
return te += 1, te;
|
|
950
|
+
}
|
|
951
|
+
function Ye() {
|
|
934
952
|
return {
|
|
935
953
|
compilerMs: 0,
|
|
936
954
|
backendMs: 0,
|
|
@@ -964,9 +982,9 @@ function Qe() {
|
|
|
964
982
|
reusedGroups: 0
|
|
965
983
|
};
|
|
966
984
|
}
|
|
967
|
-
class
|
|
968
|
-
constructor(e, t, n =
|
|
969
|
-
this._surfaceId = e, this._viewport = t, this._rendererType = n, this._owner = s.owner ?? new
|
|
985
|
+
class Et {
|
|
986
|
+
constructor(e, t, n = D.WebGL, s = {}) {
|
|
987
|
+
this._surfaceId = e, this._viewport = t, this._rendererType = n, this._owner = s.owner ?? new ke(e), this._storageGeneration = this._owner.nextStorageGeneration(), this._orderRevision = this._owner.nextOrderRevision(), this._mainLayer = s.mainLayer ?? Me("main"), this._layers.push(this._mainLayer), this.addGroup(this._mainLayer.rootGroup), this._currentSegment = this._createSegment(this._mainLayer.rootGroup);
|
|
970
988
|
}
|
|
971
989
|
_groups = [];
|
|
972
990
|
_groupsById = /* @__PURE__ */ new Map();
|
|
@@ -1012,10 +1030,10 @@ class Ct {
|
|
|
1012
1030
|
order: e.order ?? this.nextOrder()
|
|
1013
1031
|
};
|
|
1014
1032
|
if (t.type === "beginComposition")
|
|
1015
|
-
for (const n of
|
|
1033
|
+
for (const n of ne(t.id))
|
|
1016
1034
|
(this._targetReferences ??= /* @__PURE__ */ new Set()).add(n);
|
|
1017
1035
|
if (t.type === "clipPath")
|
|
1018
|
-
for (const n of
|
|
1036
|
+
for (const n of se(t.id))
|
|
1019
1037
|
(this._targetReferences ??= /* @__PURE__ */ new Set()).add(n);
|
|
1020
1038
|
if (t.type === "beginRenderTarget" || t.type === "drawRenderTarget") {
|
|
1021
1039
|
const n = t.targetId ?? t.target?.id;
|
|
@@ -1051,22 +1069,22 @@ class Ct {
|
|
|
1051
1069
|
let y = o.get(u.parentGroupId);
|
|
1052
1070
|
y || (y = [], o.set(u.parentGroupId, y)), y.includes(u.id) || y.push(u.id);
|
|
1053
1071
|
}
|
|
1054
|
-
const a = this._groups.map((u) =>
|
|
1072
|
+
const a = this._groups.map((u) => Ee(
|
|
1055
1073
|
u,
|
|
1056
1074
|
o.get(u.id) ?? []
|
|
1057
1075
|
)), c = new Map(a.map((u) => [u.id, u])), h = this._layers.map((u) => Object.freeze({
|
|
1058
1076
|
...u,
|
|
1059
1077
|
rootGroup: c.get(u.rootGroup.id)
|
|
1060
1078
|
})), f = this._targets.map((u) => Object.freeze({ ...u })), d = {
|
|
1061
|
-
...
|
|
1079
|
+
...Ye(),
|
|
1062
1080
|
...e,
|
|
1063
1081
|
commands: s.length,
|
|
1064
1082
|
items: n.length,
|
|
1065
1083
|
groups: this._groups.length
|
|
1066
1084
|
};
|
|
1067
|
-
|
|
1085
|
+
pe(s, this._targetReferences);
|
|
1068
1086
|
const p = {
|
|
1069
|
-
id:
|
|
1087
|
+
id: Qe(),
|
|
1070
1088
|
storageGeneration: this._storageGeneration,
|
|
1071
1089
|
orderRevision: this._orderRevision,
|
|
1072
1090
|
patchRevision: 0,
|
|
@@ -1088,7 +1106,7 @@ class Ct {
|
|
|
1088
1106
|
},
|
|
1089
1107
|
metrics: d
|
|
1090
1108
|
};
|
|
1091
|
-
return this._rendererType ===
|
|
1109
|
+
return this._rendererType === D.WebGL && (Le(p), Ke(p)), p;
|
|
1092
1110
|
}
|
|
1093
1111
|
_createSegment(e) {
|
|
1094
1112
|
const t = {
|
|
@@ -1130,7 +1148,7 @@ class Ct {
|
|
|
1130
1148
|
const i = [];
|
|
1131
1149
|
for (const o of this._groups) {
|
|
1132
1150
|
const a = this._owner.nextInstructionVersion(o.id);
|
|
1133
|
-
i.push(
|
|
1151
|
+
i.push(Pe(
|
|
1134
1152
|
o.id,
|
|
1135
1153
|
a,
|
|
1136
1154
|
new C(
|
|
@@ -1143,7 +1161,7 @@ class Ct {
|
|
|
1143
1161
|
)
|
|
1144
1162
|
));
|
|
1145
1163
|
}
|
|
1146
|
-
return
|
|
1164
|
+
return V(i, this._orderRevision, {
|
|
1147
1165
|
id: `${this._surfaceId}:instruction-buffers:${this._storageGeneration}`,
|
|
1148
1166
|
groupId: this.rootGroup.id
|
|
1149
1167
|
});
|
|
@@ -1153,9 +1171,9 @@ class Ct {
|
|
|
1153
1171
|
throw new Error("NovaRenderFrameBuilder cannot mutate a built frame.");
|
|
1154
1172
|
}
|
|
1155
1173
|
}
|
|
1156
|
-
const
|
|
1157
|
-
let
|
|
1158
|
-
class
|
|
1174
|
+
const Je = 64;
|
|
1175
|
+
let re;
|
|
1176
|
+
class Mt {
|
|
1159
1177
|
constructor(e, t, n, s = {}) {
|
|
1160
1178
|
this.novaCanvas = e, this._schemaRegistry = t, this._writer = n, this._options = s;
|
|
1161
1179
|
}
|
|
@@ -1301,12 +1319,12 @@ class Ot {
|
|
|
1301
1319
|
t && n !== void 0 && (t.save(), t.direction = n);
|
|
1302
1320
|
try {
|
|
1303
1321
|
const s = e.styles?.font, i = s?.size ?? 12, o = s?.family ?? "sans-serif", a = s?.style ?? "normal", c = s?.weight ?? "normal";
|
|
1304
|
-
if (t && (t.font = `${a} ${c} ${i}px ${o}`),
|
|
1305
|
-
const f =
|
|
1322
|
+
if (t && (t.font = `${a} ${c} ${i}px ${o}`), We(e)) {
|
|
1323
|
+
const f = Fe(e, (d, p) => (t && (t.font = p), t?.measureText(d).width ?? d.length * i * 0.6));
|
|
1306
1324
|
return { width: f.width, height: f.height };
|
|
1307
1325
|
}
|
|
1308
1326
|
if (e.parser === "markdown") {
|
|
1309
|
-
const f =
|
|
1327
|
+
const f = Ve(e, (d, p) => (t && (t.font = p), t?.measureText(d).width ?? d.length * i * 0.6), { family: o, lineHeight: i });
|
|
1310
1328
|
return { width: f.width, height: f.height };
|
|
1311
1329
|
}
|
|
1312
1330
|
return {
|
|
@@ -1321,7 +1339,7 @@ class Ot {
|
|
|
1321
1339
|
if (typeof navigator < "u" && navigator.userAgent.toLowerCase().includes("jsdom"))
|
|
1322
1340
|
return null;
|
|
1323
1341
|
try {
|
|
1324
|
-
return
|
|
1342
|
+
return re ??= document.createElement("canvas"), re.getContext("2d");
|
|
1325
1343
|
} catch {
|
|
1326
1344
|
return null;
|
|
1327
1345
|
}
|
|
@@ -1380,7 +1398,7 @@ class Ot {
|
|
|
1380
1398
|
}
|
|
1381
1399
|
_schemaBatch(e, t) {
|
|
1382
1400
|
const n = Array.isArray(e) ? e : [e], s = n.some((o) => o.active === !1) ? n.filter((o) => o.active !== !1) : n, i = Array.isArray(e) && Number.isFinite(e.contentVersion) && s.length > 0 && s.every((o) => o.type === "line" || o.type === "polygon");
|
|
1383
|
-
return s.length <
|
|
1401
|
+
return s.length < Je && !i || s.some((o) => W(o) === "custom") ? !1 : (this._writer.drawSchemaBatch(
|
|
1384
1402
|
s,
|
|
1385
1403
|
t,
|
|
1386
1404
|
Array.isArray(e) ? e.semanticScope : void 0,
|
|
@@ -1389,7 +1407,7 @@ class Ot {
|
|
|
1389
1407
|
), !0);
|
|
1390
1408
|
}
|
|
1391
1409
|
}
|
|
1392
|
-
class
|
|
1410
|
+
class $t {
|
|
1393
1411
|
constructor(e, t = e.rootGroup, n) {
|
|
1394
1412
|
this._frameBuilder = e, this._graph = n, this._group = t, t !== e.currentGroup && e.beginSegment(t);
|
|
1395
1413
|
}
|
|
@@ -1457,15 +1475,15 @@ class Pt {
|
|
|
1457
1475
|
}
|
|
1458
1476
|
beginComposition(e) {
|
|
1459
1477
|
this._renderTargetDepth += 1;
|
|
1460
|
-
const t = e.effects?.some((n) => !!
|
|
1461
|
-
return this.command({ type: "beginComposition", composition: Object.freeze({ ...t, bounds: Object.freeze({ ...t.bounds }), effects: t.effects ?
|
|
1478
|
+
const t = e.effects?.some((n) => !!ge(n).outset) ? e : _e(e);
|
|
1479
|
+
return this.command({ type: "beginComposition", composition: Object.freeze({ ...t, bounds: Object.freeze({ ...t.bounds }), effects: t.effects ? ye(t.effects) : void 0, mask: t.mask ? Object.freeze({ ...t.mask, transform: b.clone(t.mask.transform) }) : void 0 }) });
|
|
1462
1480
|
}
|
|
1463
1481
|
endComposition() {
|
|
1464
1482
|
return this._renderTargetDepth = Math.max(0, this._renderTargetDepth - 1), this.command({ type: "endComposition" });
|
|
1465
1483
|
}
|
|
1466
1484
|
clipPath(e) {
|
|
1467
|
-
const t =
|
|
1468
|
-
return this._clipStack.push(
|
|
1485
|
+
const t = ve(e);
|
|
1486
|
+
return this._clipStack.push(be(t)), this.command({ type: "clipPath", pathClip: t });
|
|
1469
1487
|
}
|
|
1470
1488
|
clearClip() {
|
|
1471
1489
|
const e = this._activeStateMark?.clipDepth ?? 0;
|
|
@@ -1517,14 +1535,14 @@ class Pt {
|
|
|
1517
1535
|
}
|
|
1518
1536
|
drawSchemaItem(e, t = this._currentNodeId) {
|
|
1519
1537
|
this._graph?.markRetainedPaintUnbound(t);
|
|
1520
|
-
const n =
|
|
1538
|
+
const n = Q(e, e, { freeze: !1 }), s = this._frameBuilder.nextOrder(), i = k({
|
|
1521
1539
|
id: this._frameBuilder.nextItemId(),
|
|
1522
1540
|
nodeId: t,
|
|
1523
1541
|
groupId: this._group.id,
|
|
1524
1542
|
layerId: this._group.layerId,
|
|
1525
|
-
kind:
|
|
1543
|
+
kind: W(n),
|
|
1526
1544
|
order: s,
|
|
1527
|
-
batchKey:
|
|
1545
|
+
batchKey: Y(n),
|
|
1528
1546
|
schemaItem: n,
|
|
1529
1547
|
transform: b.clone(this._currentTransform),
|
|
1530
1548
|
clip: this.currentClip
|
|
@@ -1536,7 +1554,7 @@ class Pt {
|
|
|
1536
1554
|
}), i;
|
|
1537
1555
|
}
|
|
1538
1556
|
drawSchemaBatch(e, t = "batched", n, s, i) {
|
|
1539
|
-
const o =
|
|
1557
|
+
const o = ze(e, {
|
|
1540
1558
|
semanticScope: n,
|
|
1541
1559
|
contentVersion: s,
|
|
1542
1560
|
snapshotVersion: i?.snapshotVersion,
|
|
@@ -1549,9 +1567,9 @@ class Pt {
|
|
|
1549
1567
|
nodeId: this._currentNodeId,
|
|
1550
1568
|
groupId: this._group.id,
|
|
1551
1569
|
layerId: this._group.layerId,
|
|
1552
|
-
kind:
|
|
1570
|
+
kind: W(h),
|
|
1553
1571
|
order: this._frameBuilder.peekOrder() + c + 1,
|
|
1554
|
-
batchKey:
|
|
1572
|
+
batchKey: Y(h),
|
|
1555
1573
|
schemaItem: h,
|
|
1556
1574
|
transform: b.clone(this._currentTransform),
|
|
1557
1575
|
clip: this.currentClip
|
|
@@ -1568,11 +1586,11 @@ class Pt {
|
|
|
1568
1586
|
return this._graph && (!i || !this._graph.bindRetainedPaintSource(this._currentNodeId, i, a)) && this._graph.markRetainedPaintUnbound(this._currentNodeId), a;
|
|
1569
1587
|
}
|
|
1570
1588
|
drawMeshBatch(e, t = this._currentNodeId) {
|
|
1571
|
-
return
|
|
1589
|
+
return Ne(e), this._graph?.markRetainedPaintUnbound(t), this.command({ type: "drawMeshBatch", meshBatch: e, nodeId: t });
|
|
1572
1590
|
}
|
|
1573
1591
|
drawParticles(e, t = this._currentNodeId) {
|
|
1574
1592
|
this._graph?.markRetainedPaintUnbound(t);
|
|
1575
|
-
const n =
|
|
1593
|
+
const n = at(e), s = this._frameBuilder.nextOrder(), i = n.kind === "sprite" ? "particle-sprite" : "particle-circle", o = k({
|
|
1576
1594
|
id: this._frameBuilder.nextItemId(),
|
|
1577
1595
|
nodeId: t,
|
|
1578
1596
|
groupId: this._group.id,
|
|
@@ -1591,9 +1609,9 @@ class Pt {
|
|
|
1591
1609
|
});
|
|
1592
1610
|
}
|
|
1593
1611
|
drawRectBatch(e, t = this._currentNodeId) {
|
|
1594
|
-
const n =
|
|
1612
|
+
const n = He(e);
|
|
1595
1613
|
n || this._graph?.markRetainedPaintUnbound(t);
|
|
1596
|
-
const s = n ??
|
|
1614
|
+
const s = n ?? it(e), i = this._frameBuilder.nextOrder(), o = k({
|
|
1597
1615
|
id: this._frameBuilder.nextItemId(),
|
|
1598
1616
|
nodeId: t,
|
|
1599
1617
|
groupId: this._group.id,
|
|
@@ -1610,7 +1628,7 @@ class Pt {
|
|
|
1610
1628
|
itemId: o.id,
|
|
1611
1629
|
rectBatch: s,
|
|
1612
1630
|
order: i
|
|
1613
|
-
}), c = n ? e :
|
|
1631
|
+
}), c = n ? e : De(e) ? $e(e) : void 0;
|
|
1614
1632
|
return c && this._graph?.bindRetainedOwnedRectSource(t, c, a, o, this.hasNeutralRenderState && n !== void 0), a;
|
|
1615
1633
|
}
|
|
1616
1634
|
drawBorderBatch(e, t = this._currentNodeId) {
|
|
@@ -1618,7 +1636,7 @@ class Pt {
|
|
|
1618
1636
|
}
|
|
1619
1637
|
drawTimeRangeSegmentBatch(e, t = this._currentNodeId) {
|
|
1620
1638
|
this._graph?.markRetainedPaintUnbound(t);
|
|
1621
|
-
const n =
|
|
1639
|
+
const n = ot(e), s = this._frameBuilder.nextOrder(), i = k({
|
|
1622
1640
|
id: this._frameBuilder.nextItemId(),
|
|
1623
1641
|
nodeId: t,
|
|
1624
1642
|
groupId: this._group.id,
|
|
@@ -1678,8 +1696,8 @@ class Pt {
|
|
|
1678
1696
|
itemId: e.id,
|
|
1679
1697
|
groupId: e.groupId,
|
|
1680
1698
|
layerId: e.layerId,
|
|
1681
|
-
streamId: `${e.groupId}:${
|
|
1682
|
-
streamKind:
|
|
1699
|
+
streamId: `${e.groupId}:${J(t)}`,
|
|
1700
|
+
streamKind: J(t),
|
|
1683
1701
|
offset: n,
|
|
1684
1702
|
count: s,
|
|
1685
1703
|
batchKey: e.batchKey,
|
|
@@ -1779,7 +1797,7 @@ class Pt {
|
|
|
1779
1797
|
}
|
|
1780
1798
|
_drawGenericBatch(e, t, n, s, i) {
|
|
1781
1799
|
this._graph?.markRetainedPaintUnbound(i);
|
|
1782
|
-
const o =
|
|
1800
|
+
const o = ct(e, s), a = this._frameBuilder.nextOrder(), c = k({
|
|
1783
1801
|
id: this._frameBuilder.nextItemId(),
|
|
1784
1802
|
nodeId: i,
|
|
1785
1803
|
groupId: this._group.id,
|
|
@@ -1828,7 +1846,7 @@ class Pt {
|
|
|
1828
1846
|
this._graph.addHandle(i);
|
|
1829
1847
|
}
|
|
1830
1848
|
}
|
|
1831
|
-
const
|
|
1849
|
+
const Ze = {
|
|
1832
1850
|
x: 1,
|
|
1833
1851
|
y: 1,
|
|
1834
1852
|
width: 1,
|
|
@@ -1837,14 +1855,14 @@ const Je = {
|
|
|
1837
1855
|
radii: 1,
|
|
1838
1856
|
states: 1,
|
|
1839
1857
|
minWidths: 1
|
|
1840
|
-
},
|
|
1858
|
+
}, et = {
|
|
1841
1859
|
startTime: 1,
|
|
1842
1860
|
endTime: 1,
|
|
1843
1861
|
y: 1,
|
|
1844
1862
|
height: 1,
|
|
1845
1863
|
colors: 4,
|
|
1846
1864
|
styles: 4
|
|
1847
|
-
},
|
|
1865
|
+
}, tt = {
|
|
1848
1866
|
x: 1,
|
|
1849
1867
|
y: 1,
|
|
1850
1868
|
width: 1,
|
|
@@ -1852,19 +1870,19 @@ const Je = {
|
|
|
1852
1870
|
borderWidths: 1,
|
|
1853
1871
|
colorIndices: 1,
|
|
1854
1872
|
opacities: 1
|
|
1855
|
-
},
|
|
1873
|
+
}, rt = {
|
|
1856
1874
|
x: 1,
|
|
1857
1875
|
y: 1,
|
|
1858
1876
|
width: 1,
|
|
1859
1877
|
height: 1,
|
|
1860
1878
|
fills: 1
|
|
1861
|
-
},
|
|
1879
|
+
}, nt = {
|
|
1862
1880
|
x: 1,
|
|
1863
1881
|
y: 1,
|
|
1864
1882
|
width: 1,
|
|
1865
1883
|
height: 1,
|
|
1866
1884
|
icons: 1
|
|
1867
|
-
},
|
|
1885
|
+
}, st = {
|
|
1868
1886
|
text: 1,
|
|
1869
1887
|
x: 1,
|
|
1870
1888
|
y: 1,
|
|
@@ -1878,72 +1896,75 @@ const Je = {
|
|
|
1878
1896
|
font: 1,
|
|
1879
1897
|
align: 1
|
|
1880
1898
|
};
|
|
1881
|
-
function st(r) {
|
|
1882
|
-
return A(r, Je);
|
|
1883
|
-
}
|
|
1884
1899
|
function it(r) {
|
|
1885
1900
|
return E(r, Ze);
|
|
1886
1901
|
}
|
|
1887
1902
|
function ot(r) {
|
|
1888
|
-
return
|
|
1903
|
+
return M(r, et);
|
|
1889
1904
|
}
|
|
1890
|
-
function at(r
|
|
1905
|
+
function at(r) {
|
|
1906
|
+
return Q(r, r);
|
|
1907
|
+
}
|
|
1908
|
+
function ct(r, e) {
|
|
1891
1909
|
switch (r) {
|
|
1892
1910
|
case "drawBorderBatch":
|
|
1893
|
-
return
|
|
1911
|
+
return E(e, tt);
|
|
1894
1912
|
case "drawStripeBatch":
|
|
1895
|
-
return
|
|
1913
|
+
return E(e, rt);
|
|
1896
1914
|
case "drawIconBatch":
|
|
1897
|
-
return A(e, rt);
|
|
1898
|
-
case "drawTextBatch":
|
|
1899
1915
|
return E(e, nt);
|
|
1916
|
+
case "drawTextBatch":
|
|
1917
|
+
return M(e, st);
|
|
1900
1918
|
}
|
|
1901
1919
|
}
|
|
1902
1920
|
export {
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1921
|
+
Fe as A,
|
|
1922
|
+
Ve as B,
|
|
1923
|
+
gt as C,
|
|
1924
|
+
Be as D,
|
|
1925
|
+
Te as E,
|
|
1926
|
+
Ot as F,
|
|
1927
|
+
$e as G,
|
|
1928
|
+
kt as H,
|
|
1929
|
+
De as I,
|
|
1930
|
+
Pt as J,
|
|
1931
|
+
At as K,
|
|
1932
|
+
mt as L,
|
|
1933
|
+
V as M,
|
|
1934
|
+
je as N,
|
|
1935
|
+
Qe as O,
|
|
1936
|
+
Le as P,
|
|
1937
|
+
Ke as Q,
|
|
1938
|
+
D as R,
|
|
1939
|
+
C as S,
|
|
1940
|
+
pe as T,
|
|
1941
|
+
Tt as U,
|
|
1942
|
+
Ct as V,
|
|
1943
|
+
ke as W,
|
|
1944
|
+
bt as a,
|
|
1945
|
+
St as b,
|
|
1946
|
+
Rt as c,
|
|
1947
|
+
Nt as d,
|
|
1948
|
+
fe as e,
|
|
1949
|
+
Bt as f,
|
|
1950
|
+
vt as g,
|
|
1951
|
+
xt as h,
|
|
1952
|
+
Pe as i,
|
|
1953
|
+
Ae as j,
|
|
1954
|
+
Ee as k,
|
|
1934
1955
|
k as l,
|
|
1935
|
-
|
|
1936
|
-
|
|
1956
|
+
Y as m,
|
|
1957
|
+
Me as n,
|
|
1937
1958
|
It as o,
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1959
|
+
J as p,
|
|
1960
|
+
ie as q,
|
|
1961
|
+
W as r,
|
|
1962
|
+
yt as s,
|
|
1963
|
+
Et as t,
|
|
1964
|
+
$t as u,
|
|
1965
|
+
Mt as v,
|
|
1966
|
+
_t as w,
|
|
1967
|
+
wt as x,
|
|
1968
|
+
He as y,
|
|
1969
|
+
We as z
|
|
1949
1970
|
};
|