@printstack/print-studio 0.1.0 → 0.1.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/README.md +122 -154
- package/assets/render.worker-DkH7TepL.js +109 -0
- package/{cloneDeep-C5UZRjbH.js → cloneDeep-waBDTGc3.js} +10 -4
- package/components/print-s-logo/print-s-logo.vue.d.ts +1 -1
- package/components/s-form/types.d.ts +1 -1
- package/core/coordinate-space.d.ts +16 -0
- package/core/document-model.d.ts +1 -1
- package/core/element-registry.d.ts +3 -8
- package/core/page-extensions.d.ts +1 -1
- package/core/types.d.ts +8 -0
- package/core.js +2 -2
- package/designer/commands/menu-adapter.d.ts +3 -3
- package/designer/commands/menu-types.d.ts +8 -1
- package/designer/commands/types.d.ts +2 -0
- package/designer/components/dialogs/preview-dialog.vue.d.ts +10 -1
- package/designer/components/dialogs/print-preview-dialog.vue.d.ts +14 -0
- package/designer/components/dialogs/print-preview-source.d.ts +22 -0
- package/designer/components/dialogs/use-document-preview.d.ts +5 -1
- package/designer/components/dialogs/use-preview-renderer.d.ts +2 -0
- package/designer/components/dialogs/use-print-preview.d.ts +33 -0
- package/designer/components/fields/use-table-draft.d.ts +0 -4
- package/designer/components/panels/layer-row-types.d.ts +37 -0
- package/designer/components/panels/layer-row.vue.d.ts +17 -0
- package/designer/components/stage/marquee-overlay.vue.d.ts +8 -0
- package/designer/components/stage/node-style.d.ts +3 -0
- package/designer/components/stage/selection-member.vue.d.ts +14 -0
- package/designer/composables/use-theme.d.ts +3 -0
- package/designer/facade/editing.d.ts +2 -2
- package/designer/facade/entities.d.ts +1156 -22
- package/designer/facade/output.d.ts +2 -2
- package/designer/frame/print-designer-frame.vue.d.ts +2 -2
- package/designer/frame/shared.d.ts +2 -0
- package/designer/frame/view.d.ts +9 -0
- package/designer/interactions/marquee.d.ts +1 -1
- package/designer/interactions/move.d.ts +3 -1
- package/designer/mount-print-designer.d.ts +1 -1
- package/designer/mount-print-preview.d.ts +5 -0
- package/designer/plugins/plugin-manager.d.ts +3 -3
- package/designer/plugins/types.d.ts +1 -1
- package/designer/print-designer.vue.d.ts +2 -2
- package/designer/print-preview.vue.d.ts +4 -0
- package/designer/stores/document-store.d.ts +72 -0
- package/designer/stores/editor-store.d.ts +770 -14
- package/designer/stores/page-store.d.ts +25 -1
- package/designer/stores/template-store.d.ts +52 -4
- package/designer/stores/types.d.ts +1 -0
- package/designer/stores/ui-store.d.ts +232 -3
- package/designer/stores/view-store.d.ts +10 -1
- package/designer.d.ts +1 -1
- package/designer.js +3 -3
- package/{document-model-DC9sn2WV.js → document-model-Cc5RoO4j.js} +160 -179
- package/elements/table/table-style.d.ts +3 -10
- package/host-OAp3gFDx.js +123 -0
- package/index.js +5 -5
- package/locales/runtime.d.ts +8 -2
- package/locales/translations/zh-CN/app.json.d.ts +1 -0
- package/locales/translations/zh-CN/designer.json.d.ts +9 -4
- package/{mount-print-designer-BzHLGlv-.js → mount-print-designer-DnHTrBE9.js} +4 -3
- package/mount-print-preview-Bcb08lJ-.js +66 -0
- package/package.json +1 -1
- package/presets-BunYODhE.js +13 -0
- package/{registries-BOU8RLim.js → registries-sg39PGF1.js} +793 -790
- package/runtime/browser-output.d.ts +2 -0
- package/runtime.js +4 -4
- package/{saas-B3fJOgHX.js → saas-D-q51uTz.js} +1 -1
- package/saas.js +1 -1
- package/{studio-C_rqbJ9q.js → studio-B3B6zI06.js} +830 -754
- package/studio-types.d.ts +3 -2
- package/style.css +1 -1
- package/vue.js +1035 -941
- package/assets/render.worker-Cfbk18NW.js +0 -109
- package/presets-Cwp20ef6.js +0 -133
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as e, B as t, I as n, j as r, t as i } from "./cloneDeep-
|
|
1
|
+
import { A as e, B as t, I as n, j as r, t as i } from "./cloneDeep-waBDTGc3.js";
|
|
2
2
|
// node_modules/.pnpm/uuid@14.0.3/node_modules/uuid/dist/stringify.js
|
|
3
3
|
var a = [];
|
|
4
4
|
for (let e = 0; e < 256; ++e) a.push((e + 256).toString(16).slice(1));
|
|
@@ -344,28 +344,28 @@ function Se(e) {
|
|
|
344
344
|
return n;
|
|
345
345
|
}
|
|
346
346
|
// src/core/units.ts
|
|
347
|
-
var
|
|
348
|
-
function
|
|
349
|
-
return e / (
|
|
347
|
+
var y = 96 / 25.4, Ce = 25.4 / 72;
|
|
348
|
+
function we(e, t = 1) {
|
|
349
|
+
return e / (y * t);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
return e *
|
|
351
|
+
function Te(e) {
|
|
352
|
+
return e * Ce;
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function Ee(e, t = 1) {
|
|
355
355
|
return 96 / 72 * e * t;
|
|
356
356
|
}
|
|
357
|
-
function
|
|
357
|
+
function De(e, t, n) {
|
|
358
358
|
return e < t ? t : e > n ? n : e;
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function b(e, t = 2) {
|
|
361
361
|
let n = 10 ** t;
|
|
362
362
|
return Math.round(e * n) / n;
|
|
363
363
|
}
|
|
364
364
|
// src/core/geometry.ts
|
|
365
|
-
function
|
|
365
|
+
function x(e) {
|
|
366
366
|
return (e % 360 + 540) % 360 - 180;
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function Oe(e, t) {
|
|
369
369
|
let n = t * Math.PI / 180, r = Math.abs(Math.cos(n)), i = Math.abs(Math.sin(n)), a = e.x + e.width / 2, o = e.y + e.height / 2, s = e.width / 2 * r + e.height / 2 * i, c = e.width / 2 * i + e.height / 2 * r;
|
|
370
370
|
return {
|
|
371
371
|
height: c * 2,
|
|
@@ -374,7 +374,7 @@ function ke(e, t) {
|
|
|
374
374
|
y: o - c
|
|
375
375
|
};
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function ke(e) {
|
|
378
378
|
if (e.length === 0) return null;
|
|
379
379
|
let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity;
|
|
380
380
|
for (let a of e) t = Math.min(t, a.x), n = Math.min(n, a.y), r = Math.max(r, a.x + a.width), i = Math.max(i, a.y + a.height);
|
|
@@ -385,7 +385,7 @@ function Ae(e) {
|
|
|
385
385
|
y: n
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function Ae(e) {
|
|
389
389
|
if (e.length === 0) return {
|
|
390
390
|
height: 1,
|
|
391
391
|
width: 1,
|
|
@@ -401,31 +401,24 @@ function je(e) {
|
|
|
401
401
|
y: n
|
|
402
402
|
};
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function je(e, t, n) {
|
|
405
405
|
return e.map((e) => ({
|
|
406
|
-
x:
|
|
407
|
-
y:
|
|
406
|
+
x: b(e.x + t),
|
|
407
|
+
y: b(e.y + n)
|
|
408
408
|
}));
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function Me(e, t, n, r) {
|
|
411
411
|
return e.map((e) => ({
|
|
412
|
-
x:
|
|
413
|
-
y:
|
|
412
|
+
x: b(t.x + (e.x - t.x) * n),
|
|
413
|
+
y: b(t.y + (e.y - t.y) * r)
|
|
414
414
|
}));
|
|
415
415
|
}
|
|
416
|
-
function
|
|
417
|
-
let r = n * Math.PI / 180, i = Math.cos(r), a = Math.sin(r), o = e.x - t.x, s = e.y - t.y;
|
|
418
|
-
return {
|
|
419
|
-
x: y(t.x + o * i - s * a),
|
|
420
|
-
y: y(t.y + o * a + s * i)
|
|
421
|
-
};
|
|
422
|
-
}
|
|
423
|
-
function x(e) {
|
|
416
|
+
function S(e) {
|
|
424
417
|
if (e.length < 2) return 0;
|
|
425
418
|
let t = e[0], n = e[e.length - 1];
|
|
426
|
-
return
|
|
419
|
+
return x(Math.atan2(n.y - t.y, n.x - t.x) * 180 / Math.PI);
|
|
427
420
|
}
|
|
428
|
-
function
|
|
421
|
+
function Ne(e) {
|
|
429
422
|
if (e.length < 2) return 0;
|
|
430
423
|
let t = e[0], n = e[e.length - 1];
|
|
431
424
|
return Math.hypot(n.x - t.x, n.y - t.y);
|
|
@@ -435,80 +428,80 @@ function w(e, t, n, r) {
|
|
|
435
428
|
let i = t, a = n(t), o = r && r(t) ? t : null, s = o ? a : Infinity;
|
|
436
429
|
for (let e = -1; e <= 1; e += 1) for (let c = -1; c <= 1; c += 1) {
|
|
437
430
|
let l = {
|
|
438
|
-
x:
|
|
439
|
-
y:
|
|
431
|
+
x: b(t.x + e * C),
|
|
432
|
+
y: b(t.y + c * C)
|
|
440
433
|
}, u = n(l);
|
|
441
434
|
u < a && (i = l, a = u), r && r(l) && u < s && (o = l, s = u);
|
|
442
435
|
}
|
|
443
436
|
return o ?? i;
|
|
444
437
|
}
|
|
445
|
-
function
|
|
446
|
-
let i =
|
|
438
|
+
function Pe(e, t, n, r) {
|
|
439
|
+
let i = x(n);
|
|
447
440
|
return w(e, t, (t) => {
|
|
448
|
-
let n =
|
|
449
|
-
return Math.abs(
|
|
441
|
+
let n = S([e, t]);
|
|
442
|
+
return Math.abs(x(n - i));
|
|
450
443
|
}, r);
|
|
451
444
|
}
|
|
452
|
-
function
|
|
445
|
+
function Fe(e, t, n, r) {
|
|
453
446
|
return w(e, t, (t) => Math.abs(Math.hypot(t.x - e.x, t.y - e.y) - n), r);
|
|
454
447
|
}
|
|
455
|
-
function
|
|
448
|
+
function T(e, t, n) {
|
|
456
449
|
let r = t * Math.PI / 180;
|
|
457
450
|
return {
|
|
458
|
-
x:
|
|
459
|
-
y:
|
|
451
|
+
x: b(e.x + Math.cos(r) * n),
|
|
452
|
+
y: b(e.y + Math.sin(r) * n)
|
|
460
453
|
};
|
|
461
454
|
}
|
|
462
|
-
function
|
|
463
|
-
let r =
|
|
464
|
-
return
|
|
455
|
+
function Ie(e, t, n) {
|
|
456
|
+
let r = b(S([e, t]));
|
|
457
|
+
return Fe(e, T(e, r, n), n, (t) => b(x(S([e, t])), 2) === b(x(r), 2));
|
|
465
458
|
}
|
|
466
|
-
function
|
|
467
|
-
let r =
|
|
468
|
-
return
|
|
459
|
+
function Le(e, t, n) {
|
|
460
|
+
let r = b(Ne([e, t]));
|
|
461
|
+
return Pe(e, T(e, n, r), n, (t) => b(Math.hypot(t.x - e.x, t.y - e.y), 2) === r);
|
|
469
462
|
}
|
|
470
|
-
function
|
|
463
|
+
function Re(e, t, n) {
|
|
471
464
|
let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
|
|
472
465
|
if (a === 0) return Math.hypot(e.x - t.x, e.y - t.y);
|
|
473
|
-
let o =
|
|
466
|
+
let o = De(((e.x - t.x) * r + (e.y - t.y) * i) / a, 0, 1);
|
|
474
467
|
return Math.hypot(e.x - (t.x + o * r), e.y - (t.y + o * i));
|
|
475
468
|
}
|
|
476
|
-
function
|
|
469
|
+
function E(e) {
|
|
477
470
|
return Array.isArray(e.points) && e.points.length > 0;
|
|
478
471
|
}
|
|
479
|
-
function
|
|
480
|
-
let n =
|
|
472
|
+
function D(e, t) {
|
|
473
|
+
let n = Ae(t);
|
|
481
474
|
return {
|
|
482
|
-
height:
|
|
475
|
+
height: b(Math.max(n.height, 0)),
|
|
483
476
|
points: t.map((e) => ({
|
|
484
|
-
x:
|
|
485
|
-
y:
|
|
477
|
+
x: b(e.x),
|
|
478
|
+
y: b(e.y)
|
|
486
479
|
})),
|
|
487
480
|
rotation: 0,
|
|
488
|
-
width:
|
|
489
|
-
x:
|
|
490
|
-
y:
|
|
481
|
+
width: b(Math.max(n.width, 0)),
|
|
482
|
+
x: b(n.x),
|
|
483
|
+
y: b(n.y)
|
|
491
484
|
};
|
|
492
485
|
}
|
|
493
|
-
function
|
|
494
|
-
return
|
|
495
|
-
x:
|
|
496
|
-
y:
|
|
486
|
+
function O(e, t, n) {
|
|
487
|
+
return E(e) ? D(e, je(e.points, t, n)) : {
|
|
488
|
+
x: b(e.x + t),
|
|
489
|
+
y: b(e.y + n)
|
|
497
490
|
};
|
|
498
491
|
}
|
|
499
492
|
// src/core/render/element-warning.ts
|
|
500
|
-
function
|
|
493
|
+
function k(e, n) {
|
|
501
494
|
return t("core.pageExtensions.elementFailed", {
|
|
502
495
|
elementName: e.name || e.id,
|
|
503
496
|
message: n instanceof Error && n.cause ? r(n) + " · " + r(n.cause) : r(n)
|
|
504
497
|
});
|
|
505
498
|
}
|
|
506
|
-
function
|
|
507
|
-
let r =
|
|
499
|
+
function ze(e, t, n) {
|
|
500
|
+
let r = k(e, t);
|
|
508
501
|
n ? n(r) : console.warn(r);
|
|
509
502
|
}
|
|
510
503
|
// src/core/element-registry.ts
|
|
511
|
-
var
|
|
504
|
+
var Be = class {
|
|
512
505
|
definitions = /* @__PURE__ */ new Map();
|
|
513
506
|
listeners = /* @__PURE__ */ new Set();
|
|
514
507
|
get(e) {
|
|
@@ -543,23 +536,23 @@ var He = class {
|
|
|
543
536
|
notify() {
|
|
544
537
|
for (let e of this.listeners) e();
|
|
545
538
|
}
|
|
546
|
-
},
|
|
547
|
-
function
|
|
539
|
+
}, A = new Be();
|
|
540
|
+
function Ve(e) {
|
|
548
541
|
return e;
|
|
549
542
|
}
|
|
550
|
-
function
|
|
551
|
-
return e?.elements ??
|
|
543
|
+
function He(e) {
|
|
544
|
+
return e?.elements ?? A;
|
|
552
545
|
}
|
|
553
|
-
function
|
|
546
|
+
function Ue(e, t) {
|
|
554
547
|
if (!t.node.visible) return null;
|
|
555
548
|
try {
|
|
556
549
|
return e.get(t.node.type)?.paginate?.(t);
|
|
557
550
|
} catch (e) {
|
|
558
|
-
return t.warnings.add(
|
|
551
|
+
return t.warnings.add(k(t.node, e)), null;
|
|
559
552
|
}
|
|
560
553
|
}
|
|
561
554
|
// src/core/element-transform.ts
|
|
562
|
-
function
|
|
555
|
+
function j(e, t = A) {
|
|
563
556
|
let n = t.get(e.type)?.getMinSize?.({
|
|
564
557
|
node: e,
|
|
565
558
|
props: e.props
|
|
@@ -569,50 +562,50 @@ function A(e, t = k) {
|
|
|
569
562
|
width: Math.max(1, n?.width ?? 1)
|
|
570
563
|
};
|
|
571
564
|
}
|
|
572
|
-
function
|
|
565
|
+
function M(e, t, n = A, r = {}) {
|
|
573
566
|
let i = n.get(e.type), a = i?.aspectRatio, o = t;
|
|
574
567
|
if (a && a > 0 && (typeof t.width == "number" ? o = {
|
|
575
568
|
...t,
|
|
576
|
-
height:
|
|
569
|
+
height: b(t.width / a)
|
|
577
570
|
} : typeof t.height == "number" && (o = {
|
|
578
571
|
...t,
|
|
579
|
-
width:
|
|
572
|
+
width: b(t.height * a)
|
|
580
573
|
})), r.enforceMinimum !== !1 && i?.getMinSize && ("width" in t || "height" in t || "props" in t || "type" in t)) {
|
|
581
574
|
let t = {
|
|
582
575
|
...e,
|
|
583
576
|
...o
|
|
584
|
-
}, r =
|
|
577
|
+
}, r = j(t, n);
|
|
585
578
|
t.width < r.width && (o = {
|
|
586
579
|
...o,
|
|
587
580
|
width: r.width
|
|
588
581
|
}, t = {
|
|
589
582
|
...e,
|
|
590
583
|
...o
|
|
591
|
-
}, r =
|
|
584
|
+
}, r = j(t, n)), t.height < r.height && (o = {
|
|
592
585
|
...o,
|
|
593
586
|
height: r.height
|
|
594
587
|
});
|
|
595
588
|
}
|
|
596
589
|
return o;
|
|
597
590
|
}
|
|
598
|
-
function
|
|
599
|
-
if (
|
|
600
|
-
if (t === "width") return
|
|
601
|
-
if (t === "rotation") return
|
|
591
|
+
function We(e, t) {
|
|
592
|
+
if (E(e)) {
|
|
593
|
+
if (t === "width") return b(Ne(e.points));
|
|
594
|
+
if (t === "rotation") return b(S(e.points));
|
|
602
595
|
}
|
|
603
596
|
return e[t];
|
|
604
597
|
}
|
|
605
|
-
function
|
|
598
|
+
function Ge(e, t, n) {
|
|
606
599
|
if (typeof n != "number" || !Number.isFinite(n)) return {};
|
|
607
|
-
if (t === "x") return
|
|
608
|
-
if (t === "y") return
|
|
609
|
-
if (!
|
|
600
|
+
if (t === "x") return O(e, n - e.x, 0);
|
|
601
|
+
if (t === "y") return O(e, 0, n - e.y);
|
|
602
|
+
if (!E(e)) return M(e, { [t]: n });
|
|
610
603
|
let r = e.points, i = r[0], a = r[r.length - 1];
|
|
611
|
-
if (t === "width") return
|
|
612
|
-
if (t === "rotation") return
|
|
604
|
+
if (t === "width") return D(e, [...r.slice(0, -1), Ie(i, a, n)]);
|
|
605
|
+
if (t === "rotation") return D(e, [...r.slice(0, -1), Le(i, a, n)]);
|
|
613
606
|
if (t === "height") {
|
|
614
607
|
let t = e.height > 0 ? n / e.height : 1;
|
|
615
|
-
return
|
|
608
|
+
return D(e, Me(r, {
|
|
616
609
|
x: e.x,
|
|
617
610
|
y: e.y
|
|
618
611
|
}, 1, t));
|
|
@@ -620,10 +613,10 @@ function qe(e, t, n) {
|
|
|
620
613
|
return { [t]: n };
|
|
621
614
|
}
|
|
622
615
|
// src/core/follow-block.ts
|
|
623
|
-
function
|
|
616
|
+
function Ke(e) {
|
|
624
617
|
return `${e.kind}:${e.id}`;
|
|
625
618
|
}
|
|
626
|
-
function
|
|
619
|
+
function qe(e, t, n) {
|
|
627
620
|
if (n.kind === "element") {
|
|
628
621
|
let r = e.pages.find((e) => e.id === t)?.elements.find((e) => e.id === n.id);
|
|
629
622
|
return r ? {
|
|
@@ -637,7 +630,7 @@ function Ye(e, t, n) {
|
|
|
637
630
|
name: r.name
|
|
638
631
|
} : void 0;
|
|
639
632
|
}
|
|
640
|
-
function
|
|
633
|
+
function N(e, t) {
|
|
641
634
|
let n = e.pages.find((e) => e.id === t.pageId), r = (e.followBlocks ?? []).filter((e) => e.id !== t.id), i = e.repeatGroups ?? [];
|
|
642
635
|
if (!n || !t.id || !Number.isFinite(t.gap) || t.elementIds.length === 0 || new Set(t.elementIds).size !== t.elementIds.length || t.elementIds.some((e) => !n.elements.some((t) => t.id === e))) return "invalidMembers";
|
|
643
636
|
if (r.some((e) => e.elementIds.some((e) => t.elementIds.includes(e))) || i.some((e) => e.elementIds.some((e) => t.elementIds.includes(e)))) return "memberConflict";
|
|
@@ -652,15 +645,15 @@ function M(e, t) {
|
|
|
652
645
|
o.add(r.id), s = r;
|
|
653
646
|
}
|
|
654
647
|
}
|
|
655
|
-
function
|
|
648
|
+
function Je(n) {
|
|
656
649
|
let r = /* @__PURE__ */ new Set();
|
|
657
650
|
for (let i of n.followBlocks ?? []) {
|
|
658
|
-
let a = r.has(i.id) ? "invalidMembers" :
|
|
651
|
+
let a = r.has(i.id) ? "invalidMembers" : N(n, i);
|
|
659
652
|
if (a) throw new e(t(`core.followBlock.${a}`), { code: `follow.${a}` });
|
|
660
653
|
r.add(i.id);
|
|
661
654
|
}
|
|
662
655
|
}
|
|
663
|
-
function
|
|
656
|
+
function Ye(e) {
|
|
664
657
|
if (!e.followBlocks) return;
|
|
665
658
|
e.followBlocks = e.followBlocks.map((t) => {
|
|
666
659
|
let n = e.pages.find((e) => e.id === t.pageId);
|
|
@@ -672,12 +665,12 @@ function Ze(e) {
|
|
|
672
665
|
let t = !0;
|
|
673
666
|
for (; t;) {
|
|
674
667
|
let n = e.followBlocks ?? [], r = /* @__PURE__ */ new Set();
|
|
675
|
-
e.followBlocks = n.filter((t) => r.has(t.id) ||
|
|
668
|
+
e.followBlocks = n.filter((t) => r.has(t.id) || N(e, t) ? !1 : (r.add(t.id), !0)), t = (e.followBlocks?.length ?? 0) !== n.length;
|
|
676
669
|
}
|
|
677
670
|
}
|
|
678
671
|
// src/core/page-extensions.ts
|
|
679
|
-
function
|
|
680
|
-
let r = e.templates?.find((e) => e.owner &&
|
|
672
|
+
function P(e, t, n) {
|
|
673
|
+
let r = e.templates?.find((e) => e.owner && K(e).some((e) => e.elements.some((e) => e.id === t.id)));
|
|
681
674
|
if (!r?.owner) return;
|
|
682
675
|
let i = Y(e, r.owner.elementId)?.node, a = i && n.get(i.type)?.pageExtensions, o = i && a?.references(i).find((e) => e.templateId === r.id && e.elementId === t.id && e.purpose === r.owner?.purpose);
|
|
683
676
|
if (i && a && o) return {
|
|
@@ -686,19 +679,19 @@ function N(e, t, n) {
|
|
|
686
679
|
source: i
|
|
687
680
|
};
|
|
688
681
|
}
|
|
689
|
-
function P(e, t, n) {
|
|
690
|
-
let r = N(e, t, n);
|
|
691
|
-
return r?.capability.resolveTarget?.(r.source, t, r.purpose) ?? t;
|
|
692
|
-
}
|
|
693
682
|
function F(e, t, n) {
|
|
694
683
|
let r = P(e, t, n);
|
|
684
|
+
return r?.capability.resolveTarget?.(r.source, t, r.purpose) ?? t;
|
|
685
|
+
}
|
|
686
|
+
function I(e, t, n) {
|
|
687
|
+
let r = F(e, t, n);
|
|
695
688
|
r === t ? n.get(t.type)?.pageExtensions?.reconcile?.(e, t) : (t.bindings = r.bindings, t.props = r.props);
|
|
696
689
|
}
|
|
697
|
-
function
|
|
690
|
+
function Xe(n, r, i) {
|
|
698
691
|
let a = n.templates?.flatMap((e) => e.requiredElements ?? []).find((e) => e.elementId === r.id);
|
|
699
692
|
if (a && (!i || i.id !== void 0 && i.id !== r.id || i.visible === !1 || i.type !== void 0 && i.type !== a.type)) throw new e(t("core.pageExtensions.requiredElement"), { code: "template.required-element" });
|
|
700
693
|
}
|
|
701
|
-
function
|
|
694
|
+
function L(n) {
|
|
702
695
|
let r = [n.page, ...n.evenPage ? [n.evenPage] : []].flatMap((e) => e.elements);
|
|
703
696
|
for (let i of n.requiredElements ?? []) {
|
|
704
697
|
let a = r.find((e) => e.id === i.elementId);
|
|
@@ -708,26 +701,16 @@ function I(n) {
|
|
|
708
701
|
}), { code: "template.invalid-dependency" });
|
|
709
702
|
}
|
|
710
703
|
}
|
|
711
|
-
function
|
|
704
|
+
function Ze(e, t, n, r, a = e) {
|
|
712
705
|
let o = r.get(t.type)?.pageExtensions;
|
|
713
706
|
if (o) for (let s of o.references(t)) {
|
|
714
707
|
let c = a.templates?.find((e) => e.id === s.templateId);
|
|
715
708
|
if (!c) continue;
|
|
716
|
-
if (
|
|
709
|
+
if (K(c).some((e) => e.elements.some((e) => e.id === t.id))) {
|
|
717
710
|
o.rebind(n, s.purpose, "", "");
|
|
718
711
|
continue;
|
|
719
712
|
}
|
|
720
713
|
if (t.id === n.id && c.owner?.elementId === n.id) continue;
|
|
721
|
-
if (t.id === n.id && !c.owner && !e.pages.some((e) => e.templateId === c.id) && !e.templates?.some((e) => e.baseTemplateId === c.id)) {
|
|
722
|
-
c.owner = {
|
|
723
|
-
elementId: n.id,
|
|
724
|
-
purpose: s.purpose
|
|
725
|
-
}, c.requiredElements = [{
|
|
726
|
-
elementId: s.elementId,
|
|
727
|
-
type: t.type
|
|
728
|
-
}];
|
|
729
|
-
continue;
|
|
730
|
-
}
|
|
731
714
|
let l = i(c);
|
|
732
715
|
l.id = U("template"), l.builtin = !1, l.owner = {
|
|
733
716
|
elementId: n.id,
|
|
@@ -762,7 +745,7 @@ function R(e, t) {
|
|
|
762
745
|
}), n = e.templates.length !== r.length;
|
|
763
746
|
} while (n);
|
|
764
747
|
}
|
|
765
|
-
function
|
|
748
|
+
function Qe(n, r, i) {
|
|
766
749
|
for (let a of i.get(r.type)?.pageExtensions?.references(r) ?? []) {
|
|
767
750
|
let i = n.templates?.find((e) => e.id === a.templateId);
|
|
768
751
|
if (i?.owner && (i.owner.elementId !== r.id || i.owner.purpose !== a.purpose || !i.requiredElements?.some((e) => e.elementId === a.elementId))) throw new e(t("core.pageExtensions.internalTemplate"), { code: "template.owner-mismatch" });
|
|
@@ -811,13 +794,13 @@ function V(n) {
|
|
|
811
794
|
}
|
|
812
795
|
// src/core/parser-version.ts
|
|
813
796
|
var H = "1.0.0";
|
|
814
|
-
function
|
|
797
|
+
function $e(e) {
|
|
815
798
|
if (e === void 0) return H;
|
|
816
799
|
if (typeof e != "string" || !e.trim()) throw Error("Invalid parser version");
|
|
817
800
|
return e;
|
|
818
801
|
}
|
|
819
802
|
// src/core/document-model.ts
|
|
820
|
-
var
|
|
803
|
+
var et = "1.0";
|
|
821
804
|
function U(e = "id") {
|
|
822
805
|
return `${e}-${u()}`;
|
|
823
806
|
}
|
|
@@ -834,11 +817,11 @@ function W(e = 210, n = 297, r, i = {}) {
|
|
|
834
817
|
};
|
|
835
818
|
return V(a), a.margins !== void 0 && (a.margins = B(a.margins)), a;
|
|
836
819
|
}
|
|
837
|
-
var
|
|
838
|
-
function
|
|
820
|
+
var tt = "template-blank", nt = "template-none";
|
|
821
|
+
function G() {
|
|
839
822
|
let e = {
|
|
840
823
|
builtin: !0,
|
|
841
|
-
id:
|
|
824
|
+
id: tt,
|
|
842
825
|
name: t("core.documentModel.blankTemplateName"),
|
|
843
826
|
page: W(210, 297)
|
|
844
827
|
};
|
|
@@ -868,7 +851,7 @@ function rt(n, r, i = 0, a = /* @__PURE__ */ new Set()) {
|
|
|
868
851
|
function it(e, t) {
|
|
869
852
|
return t <= 0 || (t % 2 == 0 ? e.evenPages : e.oddPages) !== !1;
|
|
870
853
|
}
|
|
871
|
-
function
|
|
854
|
+
function K(e) {
|
|
872
855
|
return e.facingPages && e.evenPage ? [e.evenPage, e.page] : [e.page];
|
|
873
856
|
}
|
|
874
857
|
function at(e, t) {
|
|
@@ -893,7 +876,7 @@ function st(e, n) {
|
|
|
893
876
|
};
|
|
894
877
|
return r.page.id = r.id, r.page.name = r.name, r;
|
|
895
878
|
}
|
|
896
|
-
function
|
|
879
|
+
function q(e, n = {}, r = A) {
|
|
897
880
|
let i = r.get(e);
|
|
898
881
|
if (!i) throw Error(t("core.documentModel.unregisteredElementType", { elementType: e }));
|
|
899
882
|
let a = {
|
|
@@ -911,11 +894,11 @@ function ct(e, n = {}, r = k) {
|
|
|
911
894
|
y: 0,
|
|
912
895
|
...n
|
|
913
896
|
};
|
|
914
|
-
|
|
897
|
+
lt(a, i), a.props = i.normalizeProps?.(a.props) ?? a.props, ct(a, i);
|
|
915
898
|
let o = n.height !== void 0 && n.width === void 0 ? { height: a.height } : { width: a.width };
|
|
916
|
-
return Object.assign(a,
|
|
899
|
+
return Object.assign(a, M(a, o, r)), a;
|
|
917
900
|
}
|
|
918
|
-
function
|
|
901
|
+
function ct(e, t = A.get(e.type)) {
|
|
919
902
|
let n = t?.measureSize?.({
|
|
920
903
|
mode: "design",
|
|
921
904
|
node: e,
|
|
@@ -923,16 +906,16 @@ function lt(e, t = k.get(e.type)) {
|
|
|
923
906
|
});
|
|
924
907
|
n && (typeof n.height == "number" && (e.height = n.height), typeof n.width == "number" && (e.width = n.width));
|
|
925
908
|
}
|
|
926
|
-
function
|
|
909
|
+
function lt(e, t = A.get(e.type)) {
|
|
927
910
|
if (t?.pointBased && !Array.isArray(e.points)) {
|
|
928
|
-
let n =
|
|
911
|
+
let n = {
|
|
929
912
|
x: e.x,
|
|
930
913
|
y: e.y + e.height / 2
|
|
931
|
-
}, {
|
|
914
|
+
}, r = {
|
|
932
915
|
x: e.x + e.width,
|
|
933
|
-
y:
|
|
934
|
-
}
|
|
935
|
-
Object.assign(e,
|
|
916
|
+
y: n.y
|
|
917
|
+
}, i = t.pointBased.createPoints(n, r);
|
|
918
|
+
Object.assign(e, D(e, i));
|
|
936
919
|
}
|
|
937
920
|
return e;
|
|
938
921
|
}
|
|
@@ -962,26 +945,26 @@ function X(e) {
|
|
|
962
945
|
for (let n of e.templates ?? []) t.push(n.page), n.evenPage && t.push(n.evenPage);
|
|
963
946
|
return t;
|
|
964
947
|
}
|
|
965
|
-
function
|
|
948
|
+
function ut(e, t) {
|
|
966
949
|
return X(e).find((e) => e.id === t);
|
|
967
950
|
}
|
|
968
951
|
function Z(e, t, n = e.pages.findIndex((e) => e.id === t.id) + 1) {
|
|
969
952
|
let r = t.templateId ?? "template-blank", i = e.templates?.find((e) => e.id === r);
|
|
970
953
|
if (r !== "template-none" && i && i.owner === void 0 && it(i, n)) return rt(e, i, n);
|
|
971
954
|
}
|
|
972
|
-
function
|
|
955
|
+
function dt(e, t, n) {
|
|
973
956
|
return z(Z(e, t, n)?.page ?? t);
|
|
974
957
|
}
|
|
975
|
-
function
|
|
958
|
+
function ft(e, t = (e) => e, n = console.warn) {
|
|
976
959
|
if (!e.templates?.length) return e;
|
|
977
960
|
let i = e.pages.map((i, a) => {
|
|
978
961
|
let o;
|
|
979
962
|
try {
|
|
980
|
-
o = Z(e, i, a + 1), o &&
|
|
963
|
+
o = Z(e, i, a + 1), o && L(o);
|
|
981
964
|
} catch (e) {
|
|
982
965
|
return n(r(e)), {
|
|
983
966
|
...i,
|
|
984
|
-
templateId:
|
|
967
|
+
templateId: nt
|
|
985
968
|
};
|
|
986
969
|
}
|
|
987
970
|
let s = o !== void 0 && (o.background !== void 0 || o.page.elements.length > 0 || o.page.margins !== void 0 || i.margins !== void 0 || i.width !== o.page.width || i.height !== o.page.height);
|
|
@@ -1005,19 +988,19 @@ function pt(e, t = (e) => e, n = console.warn) {
|
|
|
1005
988
|
templates: void 0
|
|
1006
989
|
};
|
|
1007
990
|
}
|
|
1008
|
-
function
|
|
991
|
+
function pt() {
|
|
1009
992
|
let e = W(210, 297, t("core.documentModel.initialPageName"));
|
|
1010
993
|
return {
|
|
1011
|
-
dataSources:
|
|
994
|
+
dataSources: mt(),
|
|
1012
995
|
name: t("core.documentModel.defaultDocumentName"),
|
|
1013
996
|
pages: [e],
|
|
1014
997
|
parserVersion: H,
|
|
1015
998
|
repeatGroups: [],
|
|
1016
|
-
templates: [
|
|
999
|
+
templates: [G()],
|
|
1017
1000
|
version: "1.0"
|
|
1018
1001
|
};
|
|
1019
1002
|
}
|
|
1020
|
-
function
|
|
1003
|
+
function mt() {
|
|
1021
1004
|
return [
|
|
1022
1005
|
{
|
|
1023
1006
|
description: t("core.documentModel.orderSourceDescription"),
|
|
@@ -1116,50 +1099,45 @@ function ht() {
|
|
|
1116
1099
|
}
|
|
1117
1100
|
];
|
|
1118
1101
|
}
|
|
1119
|
-
function
|
|
1102
|
+
function ht(n) {
|
|
1120
1103
|
if (!Array.isArray(n.pages) || n.pages.length === 0) throw new e(t("core.documentModel.missingPages"), { code: "document.no-pages" });
|
|
1121
1104
|
}
|
|
1122
|
-
function
|
|
1105
|
+
function gt(r, i = A) {
|
|
1123
1106
|
if (!r || typeof r != "object") throw new e(t("core.documentModel.invalidDocument"), { code: "document.invalid" });
|
|
1124
1107
|
let a = r;
|
|
1125
|
-
|
|
1126
|
-
let o = [], s =
|
|
1108
|
+
ht(a);
|
|
1109
|
+
let o = [], s = vt(a.templates, o, i), c = {
|
|
1127
1110
|
name: "",
|
|
1128
1111
|
pages: a.pages,
|
|
1129
|
-
templates:
|
|
1112
|
+
templates: s,
|
|
1130
1113
|
version: "1.0"
|
|
1131
|
-
},
|
|
1132
|
-
let n = e?.templateId, r = n && n !== "template-none" && !
|
|
1114
|
+
}, l = a.pages.map((e, t) => {
|
|
1115
|
+
let n = e?.templateId, r = n && n !== "template-none" && !s.some((e) => e.id === n) ? {
|
|
1133
1116
|
...e,
|
|
1134
1117
|
templateId: void 0
|
|
1135
|
-
} : e;
|
|
1136
|
-
s && (r?.templateId === void 0 || r.templateId === "template-blank") && (r = {
|
|
1137
|
-
...r,
|
|
1138
|
-
templateId: G
|
|
1139
|
-
});
|
|
1140
|
-
let a = Z(l, r ?? {}, t + 1);
|
|
1118
|
+
} : e, a = Z(c, r ?? {}, t + 1);
|
|
1141
1119
|
return Q(a ? {
|
|
1142
1120
|
...r,
|
|
1143
1121
|
...z(a.page)
|
|
1144
1122
|
} : r, t, o, i);
|
|
1145
|
-
}),
|
|
1123
|
+
}), u = {
|
|
1146
1124
|
dataSources: n(Array.isArray(a.dataSources) ? a.dataSources : []),
|
|
1147
1125
|
elementGroups: Se(a.elementGroups),
|
|
1148
|
-
followBlocks:
|
|
1126
|
+
followBlocks: _t(a.followBlocks),
|
|
1149
1127
|
name: typeof a.name == "string" && a.name ? a.name : t("core.documentModel.defaultDocumentName"),
|
|
1150
|
-
pages:
|
|
1151
|
-
parserVersion:
|
|
1152
|
-
repeatGroups:
|
|
1153
|
-
templates:
|
|
1128
|
+
pages: l,
|
|
1129
|
+
parserVersion: $e(a.parserVersion),
|
|
1130
|
+
repeatGroups: Ct(a.repeatGroups, l),
|
|
1131
|
+
templates: s,
|
|
1154
1132
|
version: "1.0"
|
|
1155
1133
|
};
|
|
1156
|
-
for (let e of [...X(
|
|
1157
|
-
return
|
|
1158
|
-
document:
|
|
1134
|
+
for (let e of [...X(u)]) for (let t of e.elements) I(u, t, i);
|
|
1135
|
+
return Ye(u), R(u, i), oe(u), {
|
|
1136
|
+
document: u,
|
|
1159
1137
|
skippedTypes: o
|
|
1160
1138
|
};
|
|
1161
1139
|
}
|
|
1162
|
-
function
|
|
1140
|
+
function _t(e) {
|
|
1163
1141
|
if (!Array.isArray(e)) return [];
|
|
1164
1142
|
let t = [];
|
|
1165
1143
|
for (let n of e) {
|
|
@@ -1187,21 +1165,24 @@ function Q(e, n, r, i) {
|
|
|
1187
1165
|
let a = {
|
|
1188
1166
|
background: typeof e?.background == "string" ? e.background : "#ffffff",
|
|
1189
1167
|
elements: [],
|
|
1190
|
-
guides:
|
|
1168
|
+
guides: yt(e?.guides),
|
|
1191
1169
|
height: $(e?.height, 297),
|
|
1192
1170
|
id: typeof e?.id == "string" ? e.id : U("page"),
|
|
1193
1171
|
margins: e?.margins === void 0 ? void 0 : B(e.margins),
|
|
1194
1172
|
name: typeof e?.name == "string" ? e.name : t("core.documentModel.numberedPageName", { pageNumber: n + 1 }),
|
|
1195
1173
|
templateId: typeof e?.templateId == "string" ? e.templateId : void 0,
|
|
1196
1174
|
width: $(e?.width, 210)
|
|
1197
|
-
};
|
|
1198
|
-
if (
|
|
1199
|
-
|
|
1175
|
+
}, o = e?.position;
|
|
1176
|
+
if (o && Number.isFinite(o.x) && Number.isFinite(o.y) && (a.position = {
|
|
1177
|
+
x: Math.max(0, b(o.x, 2)),
|
|
1178
|
+
y: Math.max(0, b(o.y, 2))
|
|
1179
|
+
}), V(a), Array.isArray(e?.elements)) for (let t of e.elements) {
|
|
1180
|
+
let e = bt(t, r, i);
|
|
1200
1181
|
e && a.elements.push(e);
|
|
1201
1182
|
}
|
|
1202
1183
|
return a;
|
|
1203
1184
|
}
|
|
1204
|
-
function
|
|
1185
|
+
function vt(e, n, r) {
|
|
1205
1186
|
let i = [];
|
|
1206
1187
|
if (Array.isArray(e)) for (let a of e) {
|
|
1207
1188
|
if (!a || typeof a != "object") continue;
|
|
@@ -1223,9 +1204,9 @@ function yt(e, n, r) {
|
|
|
1223
1204
|
requiredElements: Array.isArray(e.requiredElements) ? e.requiredElements.filter((e) => typeof e?.elementId == "string" && typeof e?.type == "string").map((e) => ({ ...e })) : void 0
|
|
1224
1205
|
});
|
|
1225
1206
|
}
|
|
1226
|
-
return i.some((e) => e.id === "template-blank") || i.unshift(
|
|
1207
|
+
return i.some((e) => e.id === "template-blank") || i.unshift(G()), i;
|
|
1227
1208
|
}
|
|
1228
|
-
function
|
|
1209
|
+
function yt(e) {
|
|
1229
1210
|
if (!Array.isArray(e)) return [];
|
|
1230
1211
|
let t = [];
|
|
1231
1212
|
for (let n of e) n && typeof n == "object" && typeof n.orientation == "string" && t.push({
|
|
@@ -1235,15 +1216,15 @@ function bt(e) {
|
|
|
1235
1216
|
});
|
|
1236
1217
|
return t;
|
|
1237
1218
|
}
|
|
1238
|
-
function
|
|
1219
|
+
function bt(e, t, n) {
|
|
1239
1220
|
if (!e || typeof e != "object" || !("type" in e) || typeof e.type != "string") return;
|
|
1240
1221
|
let r = n.get(e.type);
|
|
1241
1222
|
if (!r) {
|
|
1242
1223
|
t.includes(e.type) || t.push(e.type);
|
|
1243
1224
|
return;
|
|
1244
1225
|
}
|
|
1245
|
-
let i = e, a =
|
|
1246
|
-
bindings:
|
|
1226
|
+
let i = e, a = q(e.type, {}, n), o = {
|
|
1227
|
+
bindings: xt(i.bindings),
|
|
1247
1228
|
height: $(i.height, r.defaultSize.height),
|
|
1248
1229
|
id: typeof i.id == "string" ? i.id : a.id,
|
|
1249
1230
|
locked: i.locked === !0,
|
|
@@ -1263,19 +1244,19 @@ function xt(e, t, n) {
|
|
|
1263
1244
|
x: $(i.x, 0),
|
|
1264
1245
|
y: $(i.y, 0)
|
|
1265
1246
|
};
|
|
1266
|
-
return r.pointBased &&
|
|
1247
|
+
return r.pointBased && (o.points = a.points?.map((e) => ({ ...e })), St(o, i.points)), Object.assign(o, M(o, { width: o.width }, n)), o;
|
|
1267
1248
|
}
|
|
1268
|
-
function
|
|
1249
|
+
function xt(e) {
|
|
1269
1250
|
if (e && typeof e == "object") return Object.fromEntries(Object.entries(e).filter((e) => typeof e[1] == "string"));
|
|
1270
1251
|
}
|
|
1271
|
-
function
|
|
1252
|
+
function St(e, t) {
|
|
1272
1253
|
let n = (Array.isArray(t) ? t : []).filter((e) => e && typeof e == "object").map((e) => ({
|
|
1273
1254
|
x: $(e.x, 0),
|
|
1274
1255
|
y: $(e.y, 0)
|
|
1275
1256
|
}));
|
|
1276
|
-
n.length === 0 ?
|
|
1257
|
+
n.length === 0 ? Object.assign(e, D(e, e.points ?? [])) : Object.assign(e, D(e, n));
|
|
1277
1258
|
}
|
|
1278
|
-
function
|
|
1259
|
+
function Ct(e, n) {
|
|
1279
1260
|
if (!Array.isArray(e)) return [];
|
|
1280
1261
|
let r = [];
|
|
1281
1262
|
for (let i of e) {
|
|
@@ -1299,4 +1280,4 @@ function wt(e, n) {
|
|
|
1299
1280
|
function $(e, t) {
|
|
1300
1281
|
return typeof e == "number" && Number.isFinite(e) ? e : t;
|
|
1301
1282
|
}
|
|
1302
|
-
export {
|
|
1283
|
+
export { ke as $, R as A, j as B, $e as C, Xe as D, Qe as E, Ke as F, A as G, Ge as H, Ye as I, k as J, Ue as K, qe as L, F as M, L as N, Ze as O, N as P, O as Q, Je as R, H as S, z as T, Be as U, We as V, Ve as W, Re as X, ze as Y, Oe as Z, X as _, ht as a, b as at, ft as b, q as c, ce as ct, pt as d, pe as dt, y as et, st as f, ge as ft, K as g, ut as h, me as ht, ct as i, we as it, I as j, P as k, U as l, xe as lt, Y as m, ye as mt, et as n, Te as nt, J as o, le as ot, gt as p, oe as pt, He as q, nt as r, Ee as rt, G as s, be as st, tt as t, De as tt, W as u, de as ut, dt as v, V as w, rt as x, Z as y, M as z };
|