@paprize/core 0.0.6 → 0.0.8
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/dist/paprize-core.d.ts +23 -3
- package/dist/paprize-core.js +261 -214
- package/dist/paprize-core.js.map +1 -1
- package/dist/paprize-core.umd.cjs +5 -5
- package/dist/paprize-core.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/paprize-core.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
},
|
|
6
|
-
function
|
|
1
|
+
const fe = "paprize", _e = "pz-temp-container", ot = "pz-current-element", rt = "pz-current-text", st = "pz-ignored-element", at = "pz-ignored-text", K = "paprize-global-style", U = "pz-page", ve = "pz-section", T = "pz-preview", C = "data-pz-";
|
|
2
|
+
let re = !1;
|
|
3
|
+
const lt = () => {
|
|
4
|
+
re = !0;
|
|
5
|
+
}, V = () => re;
|
|
6
|
+
function se(i) {
|
|
7
7
|
return i.nodeType === Node.ELEMENT_NODE;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function be(i) {
|
|
10
10
|
return i.nodeType === Node.TEXT_NODE;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function z(i) {
|
|
13
13
|
const e = i.getBoundingClientRect(), t = getComputedStyle(i), n = parseFloat(t.marginTop) || 0, o = parseFloat(t.marginBottom) || 0;
|
|
14
14
|
return e.height + n + o;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function ye(i) {
|
|
17
17
|
i.style.visibility = "hidden", i.style.position = "absolute", i.style.left = "-9999px", i.style.top = "-9999px";
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const ae = {
|
|
20
20
|
hyphen: "-",
|
|
21
21
|
keepOnSamePage: !1,
|
|
22
22
|
hyphenationDisabled: !1
|
|
23
|
-
},
|
|
23
|
+
}, le = {
|
|
24
24
|
hyphen: {
|
|
25
25
|
key: `${C}hyphen`,
|
|
26
26
|
reader: (i) => String(i)
|
|
@@ -34,52 +34,52 @@ const re = {
|
|
|
34
34
|
reader: (i) => i === "true"
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
function
|
|
37
|
+
function ct(i) {
|
|
38
38
|
const e = {};
|
|
39
39
|
for (const [t, n] of Object.entries(i)) {
|
|
40
|
-
const o =
|
|
40
|
+
const o = le[t];
|
|
41
41
|
o !== void 0 && n !== void 0 && (e[o.key] = String(n));
|
|
42
42
|
}
|
|
43
43
|
return e;
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
function
|
|
45
|
+
const Y = /* @__PURE__ */ new WeakMap();
|
|
46
|
+
function we(i, e, t, n) {
|
|
47
47
|
if (t == null)
|
|
48
48
|
return;
|
|
49
49
|
const o = e(t);
|
|
50
50
|
o !== void 0 && (n[i] = o);
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function ce(i) {
|
|
53
53
|
if (!i)
|
|
54
54
|
return {};
|
|
55
55
|
if (!(i instanceof Element))
|
|
56
|
-
return
|
|
56
|
+
return ce(i?.parentNode);
|
|
57
57
|
const e = {};
|
|
58
|
-
for (const o of Object.keys(
|
|
59
|
-
const r = o, s =
|
|
60
|
-
|
|
58
|
+
for (const o of Object.keys(ae)) {
|
|
59
|
+
const r = o, s = le[r], d = i.getAttribute(s.key);
|
|
60
|
+
we(r, s.reader, d, e);
|
|
61
61
|
}
|
|
62
|
-
const n = { ...i.parentNode ?
|
|
63
|
-
return
|
|
62
|
+
const n = { ...i.parentNode ? Y.get(i.parentNode) : void 0, ...e };
|
|
63
|
+
return Y.set(i, n), n;
|
|
64
64
|
}
|
|
65
|
-
const
|
|
65
|
+
const de = {
|
|
66
66
|
id: "default",
|
|
67
67
|
plugins: [],
|
|
68
|
-
...
|
|
68
|
+
...ae
|
|
69
69
|
};
|
|
70
|
-
function
|
|
71
|
-
const t =
|
|
72
|
-
return { ...
|
|
70
|
+
function Se(i, e) {
|
|
71
|
+
const t = ce(i);
|
|
72
|
+
return { ...de, ...e, ...t };
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function Ce(i) {
|
|
75
75
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
76
76
|
}
|
|
77
|
-
var
|
|
78
|
-
function
|
|
79
|
-
return
|
|
77
|
+
var $ = { exports: {} }, Ne = $.exports, Q;
|
|
78
|
+
function xe() {
|
|
79
|
+
return Q || (Q = 1, (function(i) {
|
|
80
80
|
(function(e, t) {
|
|
81
81
|
i.exports ? i.exports = t() : e.log = t();
|
|
82
|
-
})(
|
|
82
|
+
})(Ne, function() {
|
|
83
83
|
var e = function() {
|
|
84
84
|
}, t = "undefined", n = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), o = [
|
|
85
85
|
"trace",
|
|
@@ -119,13 +119,13 @@ function Ce() {
|
|
|
119
119
|
typeof console !== t && (f.call(this), this[l].apply(this, arguments));
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function j(l, p, a) {
|
|
123
123
|
return b(l) || _.apply(this, arguments);
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
var a = this,
|
|
125
|
+
function J(l, p) {
|
|
126
|
+
var a = this, H, W, y, m = "loglevel";
|
|
127
127
|
typeof l == "string" ? m += ":" + l : typeof l == "symbol" && (m = void 0);
|
|
128
|
-
function
|
|
128
|
+
function ue(c) {
|
|
129
129
|
var u = (o[c] || "silent").toUpperCase();
|
|
130
130
|
if (!(typeof window === t || !m)) {
|
|
131
131
|
try {
|
|
@@ -148,16 +148,16 @@ function Ce() {
|
|
|
148
148
|
}
|
|
149
149
|
if (typeof c === t)
|
|
150
150
|
try {
|
|
151
|
-
var u = window.document.cookie,
|
|
152
|
-
|
|
153
|
-
u.slice(
|
|
151
|
+
var u = window.document.cookie, O = encodeURIComponent(m), X = u.indexOf(O + "=");
|
|
152
|
+
X !== -1 && (c = /^([^;]+)/.exec(
|
|
153
|
+
u.slice(X + O.length + 1)
|
|
154
154
|
)[1]);
|
|
155
155
|
} catch {
|
|
156
156
|
}
|
|
157
157
|
return a.levels[c] === void 0 && (c = void 0), c;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function he() {
|
|
161
161
|
if (!(typeof window === t || !m)) {
|
|
162
162
|
try {
|
|
163
163
|
window.localStorage.removeItem(m);
|
|
@@ -182,68 +182,68 @@ function Ce() {
|
|
|
182
182
|
WARN: 3,
|
|
183
183
|
ERROR: 4,
|
|
184
184
|
SILENT: 5
|
|
185
|
-
}, a.methodFactory = p ||
|
|
186
|
-
return y ??
|
|
185
|
+
}, a.methodFactory = p || j, a.getLevel = function() {
|
|
186
|
+
return y ?? W ?? H;
|
|
187
187
|
}, a.setLevel = function(c, u) {
|
|
188
|
-
return y = E(c), u !== !1 &&
|
|
188
|
+
return y = E(c), u !== !1 && ue(y), f.call(a);
|
|
189
189
|
}, a.setDefaultLevel = function(c) {
|
|
190
|
-
|
|
190
|
+
W = E(c), G() || a.setLevel(c, !1);
|
|
191
191
|
}, a.resetLevel = function() {
|
|
192
|
-
y = null,
|
|
192
|
+
y = null, he(), f.call(a);
|
|
193
193
|
}, a.enableAll = function(c) {
|
|
194
194
|
a.setLevel(a.levels.TRACE, c);
|
|
195
195
|
}, a.disableAll = function(c) {
|
|
196
196
|
a.setLevel(a.levels.SILENT, c);
|
|
197
197
|
}, a.rebuild = function() {
|
|
198
|
-
if (s !== a && (
|
|
198
|
+
if (s !== a && (H = E(s.getLevel())), f.call(a), s === a)
|
|
199
199
|
for (var c in r)
|
|
200
200
|
r[c].rebuild();
|
|
201
|
-
},
|
|
201
|
+
}, H = E(
|
|
202
202
|
s ? s.getLevel() : "WARN"
|
|
203
203
|
);
|
|
204
204
|
var Z = G();
|
|
205
205
|
Z != null && (y = E(Z)), f.call(a);
|
|
206
206
|
}
|
|
207
|
-
s = new
|
|
207
|
+
s = new J(), s.getLogger = function(p) {
|
|
208
208
|
if (typeof p != "symbol" && typeof p != "string" || p === "")
|
|
209
209
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
210
210
|
var a = r[p];
|
|
211
|
-
return a || (a = r[p] = new
|
|
211
|
+
return a || (a = r[p] = new J(
|
|
212
212
|
p,
|
|
213
213
|
s.methodFactory
|
|
214
214
|
)), a;
|
|
215
215
|
};
|
|
216
|
-
var
|
|
216
|
+
var pe = typeof window !== t ? window.log : void 0;
|
|
217
217
|
return s.noConflict = function() {
|
|
218
|
-
return typeof window !== t && window.log === s && (window.log =
|
|
218
|
+
return typeof window !== t && window.log === s && (window.log = pe), s;
|
|
219
219
|
}, s.getLoggers = function() {
|
|
220
220
|
return r;
|
|
221
221
|
}, s.default = s, s;
|
|
222
222
|
});
|
|
223
|
-
})(
|
|
223
|
+
})($)), $.exports;
|
|
224
224
|
}
|
|
225
|
-
var
|
|
226
|
-
const S = /* @__PURE__ */
|
|
225
|
+
var Pe = xe();
|
|
226
|
+
const S = /* @__PURE__ */ Ce(Pe), g = S.getLogger(fe);
|
|
227
227
|
g.setDefaultLevel("info");
|
|
228
|
-
const
|
|
228
|
+
const M = "\x1B[46mPLUGIN\x1B[0m";
|
|
229
229
|
function N(i, e, ...t) {
|
|
230
230
|
i.sort((n, o) => n.order - o.order).forEach((n) => {
|
|
231
231
|
const o = n[e];
|
|
232
232
|
if (o) {
|
|
233
233
|
g.debug(
|
|
234
|
-
|
|
234
|
+
M,
|
|
235
235
|
`executing plugin ${n.name}:${String(e)} ()`,
|
|
236
236
|
t
|
|
237
237
|
);
|
|
238
238
|
try {
|
|
239
239
|
o(...t), g.debug(
|
|
240
|
-
|
|
240
|
+
M,
|
|
241
241
|
`plugin ${n.name}:${String(e)} executed`,
|
|
242
242
|
t
|
|
243
243
|
);
|
|
244
244
|
} catch (r) {
|
|
245
245
|
g.debug(
|
|
246
|
-
|
|
246
|
+
M,
|
|
247
247
|
`plugin ${n.name}:${String(e)} failed`,
|
|
248
248
|
r
|
|
249
249
|
);
|
|
@@ -292,7 +292,7 @@ class F {
|
|
|
292
292
|
), n;
|
|
293
293
|
}
|
|
294
294
|
getHeight() {
|
|
295
|
-
return
|
|
295
|
+
return z(this._node);
|
|
296
296
|
}
|
|
297
297
|
remove() {
|
|
298
298
|
this.transaction.addCommitCallback(() => {
|
|
@@ -309,7 +309,7 @@ class F {
|
|
|
309
309
|
return this._node;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
class
|
|
312
|
+
class Ee {
|
|
313
313
|
_node;
|
|
314
314
|
type = x.Text;
|
|
315
315
|
transaction;
|
|
@@ -332,15 +332,15 @@ class xe {
|
|
|
332
332
|
return this._node;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
if (
|
|
337
|
-
return new
|
|
338
|
-
if (
|
|
335
|
+
function B(i, e, t) {
|
|
336
|
+
if (be(i))
|
|
337
|
+
return new Ee(i, e, t);
|
|
338
|
+
if (se(i))
|
|
339
339
|
return new F(i, e, t);
|
|
340
340
|
throw new Error("Unsupported node type");
|
|
341
341
|
}
|
|
342
342
|
const k = "\x1B[106mDOM\x1B[0m";
|
|
343
|
-
class
|
|
343
|
+
class Te {
|
|
344
344
|
_transaction;
|
|
345
345
|
_treeWalker;
|
|
346
346
|
_config;
|
|
@@ -382,17 +382,17 @@ class Pe {
|
|
|
382
382
|
return this._treeWalker.firstChild() ? (g.debug(k, "moving to first child node"), this.setState(), { parentsTraversed: 1 }) : (this.goToNextNode(), { parentsTraversed: 0 });
|
|
383
383
|
}
|
|
384
384
|
setState() {
|
|
385
|
-
this._previousNode = this._currentNode, this._currentNode =
|
|
385
|
+
this._previousNode = this._currentNode, this._currentNode = B(
|
|
386
386
|
this._treeWalker.currentNode,
|
|
387
387
|
this._transaction,
|
|
388
|
-
|
|
388
|
+
Se(this._treeWalker.currentNode, this._config)
|
|
389
389
|
), g.debug(k, "moved to node", {
|
|
390
390
|
currentNode: this._currentNode,
|
|
391
391
|
previousNode: this._previousNode
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
class
|
|
395
|
+
class ke {
|
|
396
396
|
_onRollback;
|
|
397
397
|
_onCommit;
|
|
398
398
|
isActive;
|
|
@@ -421,7 +421,7 @@ class Ee {
|
|
|
421
421
|
this.isActive && (this.isActive = !1, this._onCommit.forEach((e) => e()));
|
|
422
422
|
};
|
|
423
423
|
}
|
|
424
|
-
const
|
|
424
|
+
const ee = "\x1B[102mPAGE\x1B[0m";
|
|
425
425
|
class I {
|
|
426
426
|
currentPage;
|
|
427
427
|
activeElement;
|
|
@@ -454,14 +454,14 @@ class I {
|
|
|
454
454
|
this.pageHeight
|
|
455
455
|
);
|
|
456
456
|
}
|
|
457
|
-
class
|
|
457
|
+
class q {
|
|
458
458
|
_pageState;
|
|
459
459
|
_transaction;
|
|
460
460
|
_tempContainer;
|
|
461
461
|
_config;
|
|
462
462
|
constructor(e, t, n, o) {
|
|
463
463
|
this._tempContainer = e, this._config = o, this._transaction = n;
|
|
464
|
-
const r =
|
|
464
|
+
const r = q.createPageHtmlElement(
|
|
465
465
|
t.width
|
|
466
466
|
), s = this.createNewPage(r);
|
|
467
467
|
this._pageState = I.create(s, [], 0, t.height), N(this._config.plugins, "onNewPage", o.id, this);
|
|
@@ -501,7 +501,7 @@ class V {
|
|
|
501
501
|
if (!this._pageState.activeElement || this._pageState.activeElement.type !== x.Element)
|
|
502
502
|
throw new Error("Invalid state: activeElement is not an Element");
|
|
503
503
|
g.debug(
|
|
504
|
-
|
|
504
|
+
ee,
|
|
505
505
|
"entering an element",
|
|
506
506
|
this._pageState.activeElement
|
|
507
507
|
), this._pageState.currentElement = this._pageState.activeElement, this._pageState.parentStack.push(this._pageState.activeElement);
|
|
@@ -509,7 +509,7 @@ class V {
|
|
|
509
509
|
leaveElement() {
|
|
510
510
|
this._pageState.activeElement = null;
|
|
511
511
|
const e = this._pageState.parentStack.pop();
|
|
512
|
-
g.debug(
|
|
512
|
+
g.debug(ee, "leaving a parent element", e);
|
|
513
513
|
const t = this._pageState.parentStack.at(-1);
|
|
514
514
|
this._pageState.currentElement = t ?? this._pageState.currentPage;
|
|
515
515
|
}
|
|
@@ -520,7 +520,7 @@ class V {
|
|
|
520
520
|
createNewPage(e) {
|
|
521
521
|
return this._tempContainer.appendChild(e), this._transaction.isActive && this._transaction.addRollbackCallback(() => {
|
|
522
522
|
this._tempContainer.removeChild(e);
|
|
523
|
-
}),
|
|
523
|
+
}), B(e, this._transaction, this._config);
|
|
524
524
|
}
|
|
525
525
|
startTransaction() {
|
|
526
526
|
this._transaction.start();
|
|
@@ -545,7 +545,7 @@ class V {
|
|
|
545
545
|
addTextNode(e) {
|
|
546
546
|
if (this._pageState.activeElement?.type === x.Text)
|
|
547
547
|
return this._pageState.activeElement;
|
|
548
|
-
const t = document.createTextNode(e), n =
|
|
548
|
+
const t = document.createTextNode(e), n = B(
|
|
549
549
|
t,
|
|
550
550
|
this._transaction,
|
|
551
551
|
this._config
|
|
@@ -564,16 +564,16 @@ const h = {
|
|
|
564
564
|
SplitChildren: 2
|
|
565
565
|
// The node is too large for the page, and its children must be paginated individually.
|
|
566
566
|
};
|
|
567
|
-
function
|
|
568
|
-
const t =
|
|
567
|
+
function Ae(i, e) {
|
|
568
|
+
const t = te(i, e);
|
|
569
569
|
if (t !== h.None)
|
|
570
570
|
return t;
|
|
571
571
|
const { rollback: n, commit: o } = e.startTransaction();
|
|
572
572
|
e.nextPage();
|
|
573
|
-
const r =
|
|
573
|
+
const r = te(i, e);
|
|
574
574
|
return r !== h.None ? (o(), r) : (n(), g.debug("Element is too big to fit on a page", i), h.None);
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function te(i, e) {
|
|
577
577
|
if (e.hasEmptySpace(i.getHeight())) {
|
|
578
578
|
const n = e.appendChild(i, !0);
|
|
579
579
|
if (e.isOverFlow())
|
|
@@ -586,17 +586,17 @@ function ee(i, e) {
|
|
|
586
586
|
const t = e.appendChild(i, !1);
|
|
587
587
|
return e.isOverFlow() ? (t.remove(), h.None) : h.SplitChildren;
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function Le(i, e) {
|
|
590
590
|
let t = h.FullNodePlaced;
|
|
591
591
|
const n = i.textContent.split(/(\s+)/).filter((s) => s !== "");
|
|
592
592
|
let o, r = 0;
|
|
593
593
|
for (; o || r < n.length; ) {
|
|
594
|
-
const s = o ?? n[r], d =
|
|
594
|
+
const s = o ?? n[r], d = Fe(s, e, i.config);
|
|
595
595
|
d.completed || (t = h.None), d.pendingToken ? o = d.pendingToken : (o = void 0, r++);
|
|
596
596
|
}
|
|
597
597
|
return t;
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function Fe(i, e, t) {
|
|
600
600
|
e.hasEmptySpace() || e.nextPage();
|
|
601
601
|
const n = e.addTextNode(""), o = n.textContent;
|
|
602
602
|
if (n.textContent += i, !e.isOverFlow())
|
|
@@ -604,13 +604,13 @@ function Ae(i, e, t) {
|
|
|
604
604
|
completed: !0
|
|
605
605
|
};
|
|
606
606
|
n.textContent = o;
|
|
607
|
-
const r =
|
|
607
|
+
const r = Ie(i, e, t);
|
|
608
608
|
return {
|
|
609
609
|
pendingToken: r.leftovers,
|
|
610
610
|
completed: r.completed
|
|
611
611
|
};
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function Ie(i, e, t) {
|
|
614
614
|
const { rollback: n, commit: o } = e.startTransaction();
|
|
615
615
|
if (e.nextPage(), e.addTextNode(i), !e.isOverFlow())
|
|
616
616
|
return o(), {
|
|
@@ -620,13 +620,13 @@ function Le(i, e, t) {
|
|
|
620
620
|
return g.warn("Hyphenation disabled, skipping oversized token:", i), {
|
|
621
621
|
completed: !1
|
|
622
622
|
};
|
|
623
|
-
const r =
|
|
623
|
+
const r = Re(i, t.hyphen, e);
|
|
624
624
|
return {
|
|
625
625
|
completed: !0,
|
|
626
626
|
leftovers: r && r.length > 0 ? r : void 0
|
|
627
627
|
};
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function Re(i, e, t) {
|
|
630
630
|
const n = t.addTextNode("");
|
|
631
631
|
let o = "";
|
|
632
632
|
for (let r = 0; r < i.length; r++) {
|
|
@@ -638,14 +638,14 @@ function Fe(i, e, t) {
|
|
|
638
638
|
return null;
|
|
639
639
|
}
|
|
640
640
|
const A = "\x1B[103mPAGINATOR\x1B[0m";
|
|
641
|
-
class
|
|
641
|
+
class D {
|
|
642
642
|
_domState;
|
|
643
643
|
_pageManager;
|
|
644
644
|
_transaction;
|
|
645
645
|
_tempContainer;
|
|
646
646
|
_config;
|
|
647
647
|
constructor(e, t, n) {
|
|
648
|
-
this._config = { ...
|
|
648
|
+
this._config = { ...de, ...n }, this._tempContainer = D.createTempContainer(this._config.id), this._transaction = new ke(), this._domState = new Te(e, this._transaction, this._config), this._pageManager = new q(
|
|
649
649
|
this._tempContainer,
|
|
650
650
|
t,
|
|
651
651
|
this._transaction,
|
|
@@ -654,11 +654,13 @@ class B {
|
|
|
654
654
|
}
|
|
655
655
|
static createTempContainer(e) {
|
|
656
656
|
const t = document.createElement("div");
|
|
657
|
-
return t.style.display = "flex", t.style.flexDirection = "column", t.style.gap = "20px", t.setAttribute(`${C}-section-id`, e), t.classList.add(
|
|
657
|
+
return t.style.display = "flex", t.style.flexDirection = "column", t.style.gap = "20px", t.setAttribute(`${C}-section-id`, e), t.classList.add(_e), V() || ye(t), document.body.appendChild(t), t;
|
|
658
658
|
}
|
|
659
659
|
static paginate(e, t, n) {
|
|
660
|
-
const o = new
|
|
661
|
-
|
|
660
|
+
const o = new D(e, t, n);
|
|
661
|
+
o.processAllNodes();
|
|
662
|
+
const r = Array.from(o._tempContainer.childNodes).filter((s) => se(s)).map((s) => s.innerHTML);
|
|
663
|
+
return V() || o._tempContainer.remove(), r;
|
|
662
664
|
}
|
|
663
665
|
processAllNodes() {
|
|
664
666
|
this._domState.goToNextNode();
|
|
@@ -717,7 +719,7 @@ class B {
|
|
|
717
719
|
this._domState,
|
|
718
720
|
this._pageManager,
|
|
719
721
|
e
|
|
720
|
-
), e.result !== void 0 ? e.result :
|
|
722
|
+
), e.result !== void 0 ? e.result : Ae(
|
|
721
723
|
this._domState.currentNode,
|
|
722
724
|
this._pageManager
|
|
723
725
|
);
|
|
@@ -730,14 +732,14 @@ class B {
|
|
|
730
732
|
this._domState,
|
|
731
733
|
this._pageManager,
|
|
732
734
|
e
|
|
733
|
-
), e.result !== void 0 ? e.result :
|
|
735
|
+
), e.result !== void 0 ? e.result : Le(
|
|
734
736
|
this._domState.currentNode,
|
|
735
737
|
this._pageManager
|
|
736
738
|
);
|
|
737
739
|
}
|
|
738
740
|
}
|
|
739
741
|
}
|
|
740
|
-
class
|
|
742
|
+
class ge {
|
|
741
743
|
registry = /* @__PURE__ */ new Map();
|
|
742
744
|
addEventListener(e, t) {
|
|
743
745
|
const { registry: n } = this, o = new Set(n.get(e));
|
|
@@ -747,14 +749,14 @@ class ce {
|
|
|
747
749
|
const { registry: n } = this, o = new Set(n.get(e));
|
|
748
750
|
o.delete(t), n.set(e, o);
|
|
749
751
|
}
|
|
750
|
-
dispatch(e, ...t) {
|
|
752
|
+
async dispatch(e, ...t) {
|
|
751
753
|
const { registry: n } = this, o = n.get(e);
|
|
752
754
|
if (o)
|
|
753
755
|
for (const r of o)
|
|
754
|
-
r(...t);
|
|
756
|
+
await r(...t);
|
|
755
757
|
}
|
|
756
758
|
}
|
|
757
|
-
const
|
|
759
|
+
const dt = {
|
|
758
760
|
/** 841mm x 594mm */
|
|
759
761
|
A1: { height: "841mm", width: "594mm" },
|
|
760
762
|
/** 594mm x 420mm */
|
|
@@ -779,7 +781,7 @@ const at = {
|
|
|
779
781
|
Legal: { height: "11in", width: "8.5in" },
|
|
780
782
|
/** 11in x 17in */
|
|
781
783
|
Tabloid: { height: "11in", width: "17in" }
|
|
782
|
-
},
|
|
784
|
+
}, He = {
|
|
783
785
|
/** Top, Right, Bottom, Left: 1in */
|
|
784
786
|
Normal: {
|
|
785
787
|
top: "1in",
|
|
@@ -808,19 +810,19 @@ const at = {
|
|
|
808
810
|
bottom: "0in",
|
|
809
811
|
left: "0in"
|
|
810
812
|
}
|
|
811
|
-
};
|
|
812
|
-
function
|
|
813
|
+
}, Oe = "__PAPRIZE_IS_INITIALIZED", ne = "__PAPRIZE_IS_READY", ie = "__PAPRIZE_READ_JSON_DATA_FILE";
|
|
814
|
+
function $e(i) {
|
|
813
815
|
const e = i.getBoundingClientRect(), t = getComputedStyle(i), n = parseFloat(t.marginLeft) || 0, o = parseFloat(t.marginRight) || 0;
|
|
814
816
|
return {
|
|
815
|
-
height:
|
|
817
|
+
height: z(i),
|
|
816
818
|
width: e.width + n + o
|
|
817
819
|
};
|
|
818
820
|
}
|
|
819
|
-
function
|
|
820
|
-
const { height: n, width: o } =
|
|
821
|
+
function ze(i, e, t) {
|
|
822
|
+
const { height: n, width: o } = $e(i), r = e ? z(e) : 0, s = t ? z(t) : 0;
|
|
821
823
|
return { height: n, width: o, sectionHeaderHeight: r, sectionFooterHeight: s };
|
|
822
824
|
}
|
|
823
|
-
function
|
|
825
|
+
function Be(i, e, t) {
|
|
824
826
|
return {
|
|
825
827
|
name: "sectionPageHeight",
|
|
826
828
|
order: 1,
|
|
@@ -833,10 +835,20 @@ function Oe(i, e, t) {
|
|
|
833
835
|
}
|
|
834
836
|
};
|
|
835
837
|
}
|
|
836
|
-
function
|
|
838
|
+
function De(i) {
|
|
837
839
|
return i ? `${i.top} ${i.right} ${i.bottom} ${i.left}` : "0";
|
|
838
840
|
}
|
|
839
|
-
|
|
841
|
+
function je(i) {
|
|
842
|
+
let e = null;
|
|
843
|
+
return () => (e || (e = i()), e);
|
|
844
|
+
}
|
|
845
|
+
async function We() {
|
|
846
|
+
if (!(ie in window))
|
|
847
|
+
return null;
|
|
848
|
+
const i = await window[ie]?.();
|
|
849
|
+
return i ? JSON.parse(i) : null;
|
|
850
|
+
}
|
|
851
|
+
const Me = `
|
|
840
852
|
html {
|
|
841
853
|
box-sizing: border-box;
|
|
842
854
|
}
|
|
@@ -876,7 +888,7 @@ const ze = `
|
|
|
876
888
|
background-color: var(--paprize-page-background-color);
|
|
877
889
|
}
|
|
878
890
|
|
|
879
|
-
.${
|
|
891
|
+
.${ve} {
|
|
880
892
|
margin-bottom: var(--paprize-section-margin-bottom);
|
|
881
893
|
}
|
|
882
894
|
}
|
|
@@ -886,37 +898,37 @@ const ze = `
|
|
|
886
898
|
display: none !important;
|
|
887
899
|
}
|
|
888
900
|
}
|
|
889
|
-
`,
|
|
901
|
+
`, Ue = {
|
|
890
902
|
display: "flex",
|
|
891
903
|
flexDirection: "column"
|
|
892
|
-
},
|
|
904
|
+
}, Ve = {
|
|
893
905
|
position: "absolute",
|
|
894
906
|
left: "-9999px",
|
|
895
907
|
top: "-9999px",
|
|
896
908
|
visibility: "hidden"
|
|
897
|
-
},
|
|
909
|
+
}, qe = (i, e) => ({
|
|
898
910
|
display: "flex",
|
|
899
911
|
flexDirection: "column",
|
|
900
912
|
width: i.width,
|
|
901
913
|
height: i.height,
|
|
902
914
|
maxHeight: i.height,
|
|
903
915
|
position: "relative",
|
|
904
|
-
padding:
|
|
916
|
+
padding: De(e),
|
|
905
917
|
zIndex: "1"
|
|
906
|
-
}),
|
|
918
|
+
}), Je = {
|
|
907
919
|
overflow: "hidden",
|
|
908
920
|
width: "100%",
|
|
909
921
|
height: "100%"
|
|
910
|
-
},
|
|
922
|
+
}, Ge = {
|
|
911
923
|
position: "absolute",
|
|
912
924
|
width: "100%",
|
|
913
925
|
height: "100%",
|
|
914
926
|
left: 0,
|
|
915
927
|
top: 0
|
|
916
|
-
},
|
|
928
|
+
}, Ze = (i) => ({
|
|
917
929
|
page: `section-${i}`
|
|
918
930
|
});
|
|
919
|
-
function
|
|
931
|
+
function Xe(i, e) {
|
|
920
932
|
return `@page section-${i} {
|
|
921
933
|
margin: none;
|
|
922
934
|
size:${e.width} ${e.height};
|
|
@@ -925,19 +937,19 @@ function Ve(i, e) {
|
|
|
925
937
|
}`;
|
|
926
938
|
}
|
|
927
939
|
const v = {
|
|
928
|
-
globalStyle:
|
|
929
|
-
component:
|
|
930
|
-
outOfScreen:
|
|
931
|
-
page:
|
|
932
|
-
overlay:
|
|
933
|
-
pageContent:
|
|
934
|
-
sectionPageMedia:
|
|
935
|
-
section:
|
|
940
|
+
globalStyle: Me,
|
|
941
|
+
component: Ue,
|
|
942
|
+
outOfScreen: Ve,
|
|
943
|
+
page: qe,
|
|
944
|
+
overlay: Ge,
|
|
945
|
+
pageContent: Je,
|
|
946
|
+
sectionPageMedia: Xe,
|
|
947
|
+
section: Ze
|
|
936
948
|
};
|
|
937
949
|
function L(i) {
|
|
938
950
|
return i?.cloneNode(!0) ?? null;
|
|
939
951
|
}
|
|
940
|
-
function
|
|
952
|
+
function Ke(i) {
|
|
941
953
|
return {
|
|
942
954
|
sectionHeader: L(i.sectionHeader),
|
|
943
955
|
sectionFooter: L(i.sectionFooter),
|
|
@@ -946,15 +958,15 @@ function qe(i) {
|
|
|
946
958
|
pageContent: L(i.pageContent)
|
|
947
959
|
};
|
|
948
960
|
}
|
|
949
|
-
const
|
|
950
|
-
class
|
|
961
|
+
const Ye = "data-pz-page-break";
|
|
962
|
+
class Qe {
|
|
951
963
|
name = "pageBreak";
|
|
952
964
|
order = 1;
|
|
953
965
|
onVisitElement = (e, t, n, o) => {
|
|
954
|
-
t.currentNode.getNode().getAttribute(
|
|
966
|
+
t.currentNode.getNode().getAttribute(Ye) === "true" && (n.markPageAsFull(), o.result = h.FullNodePlaced);
|
|
955
967
|
};
|
|
956
968
|
}
|
|
957
|
-
class
|
|
969
|
+
class et {
|
|
958
970
|
_options = {};
|
|
959
971
|
name = "table";
|
|
960
972
|
order = 1;
|
|
@@ -976,7 +988,7 @@ class Je {
|
|
|
976
988
|
if (!this._isTableBodyEmpty(b))
|
|
977
989
|
return;
|
|
978
990
|
if (r.remove(), o.getNode().tHead === null) {
|
|
979
|
-
const _ =
|
|
991
|
+
const _ = B(
|
|
980
992
|
d.cloneNode(!0),
|
|
981
993
|
o.transaction,
|
|
982
994
|
o.config
|
|
@@ -1021,10 +1033,10 @@ class Je {
|
|
|
1021
1033
|
return n.cells.length !== 1 ? !1 : n.cells[0].textContent.trim() === "";
|
|
1022
1034
|
}
|
|
1023
1035
|
}
|
|
1024
|
-
const
|
|
1025
|
-
new
|
|
1026
|
-
new
|
|
1027
|
-
],
|
|
1036
|
+
const tt = [
|
|
1037
|
+
new Qe(),
|
|
1038
|
+
new et()
|
|
1039
|
+
], gt = {
|
|
1028
1040
|
name: "debug",
|
|
1029
1041
|
order: Number.MAX_SAFE_INTEGER,
|
|
1030
1042
|
onNewPage: (i, e) => {
|
|
@@ -1034,9 +1046,9 @@ const Xe = [
|
|
|
1034
1046
|
e.getPageState().pageHeight.toString()
|
|
1035
1047
|
);
|
|
1036
1048
|
}
|
|
1037
|
-
},
|
|
1038
|
-
class
|
|
1039
|
-
name =
|
|
1049
|
+
}, nt = "sectionToc";
|
|
1050
|
+
class pt {
|
|
1051
|
+
name = nt;
|
|
1040
1052
|
order = 1;
|
|
1041
1053
|
_state = /* @__PURE__ */ new Map();
|
|
1042
1054
|
getContentList = () => Array.from(this._state.values()).flat();
|
|
@@ -1058,21 +1070,29 @@ class ct {
|
|
|
1058
1070
|
return /^H[1-6]$/.test(t) ? parseInt(t.charAt(1), 10) : null;
|
|
1059
1071
|
}
|
|
1060
1072
|
}
|
|
1061
|
-
|
|
1062
|
-
class D {
|
|
1073
|
+
class R {
|
|
1063
1074
|
_promises;
|
|
1064
1075
|
monitor;
|
|
1065
|
-
|
|
1076
|
+
constructor() {
|
|
1077
|
+
this._promises = [], this.monitor = new ge();
|
|
1078
|
+
}
|
|
1079
|
+
toPromise() {
|
|
1066
1080
|
return this._promises.length > 0 ? Promise.allSettled(this._promises.map((e) => e.promise)).then(
|
|
1067
|
-
() => {
|
|
1081
|
+
(e) => {
|
|
1082
|
+
const t = e.find(
|
|
1083
|
+
(n) => n.status === "rejected"
|
|
1084
|
+
);
|
|
1085
|
+
return t ? Promise.reject(t.reason) : Promise.resolve();
|
|
1068
1086
|
}
|
|
1069
1087
|
) : Promise.resolve();
|
|
1070
1088
|
}
|
|
1071
|
-
|
|
1072
|
-
this._promises
|
|
1089
|
+
then(e) {
|
|
1090
|
+
this._promises.push(
|
|
1091
|
+
R.toTracked(this.toPromise().then(e))
|
|
1092
|
+
);
|
|
1073
1093
|
}
|
|
1074
1094
|
async add(e = []) {
|
|
1075
|
-
if (this._promises.push(...e.map(
|
|
1095
|
+
if (this._promises.push(...e.map(R.toTracked)), await new Promise((t) => setTimeout(t, 0)), this.getPending().length === 0) {
|
|
1076
1096
|
this.monitor.dispatch("onChange", 0);
|
|
1077
1097
|
return;
|
|
1078
1098
|
}
|
|
@@ -1083,8 +1103,10 @@ class D {
|
|
|
1083
1103
|
promise: e,
|
|
1084
1104
|
status: "pending"
|
|
1085
1105
|
};
|
|
1086
|
-
return t.promise.
|
|
1106
|
+
return t.promise.then(() => {
|
|
1087
1107
|
t.status = "resolved";
|
|
1108
|
+
}).catch(() => {
|
|
1109
|
+
t.status = "rejected";
|
|
1088
1110
|
}), t;
|
|
1089
1111
|
}
|
|
1090
1112
|
async injectEvents(e) {
|
|
@@ -1099,21 +1121,21 @@ class D {
|
|
|
1099
1121
|
);
|
|
1100
1122
|
}
|
|
1101
1123
|
}
|
|
1102
|
-
function
|
|
1124
|
+
function ut(i, e) {
|
|
1103
1125
|
return `${i}-${e + 1}`;
|
|
1104
1126
|
}
|
|
1105
|
-
function
|
|
1127
|
+
function it(i, e) {
|
|
1106
1128
|
return e === "landscape" ? { height: i.width, width: i.height } : i;
|
|
1107
1129
|
}
|
|
1108
1130
|
const w = "\x1B[43mREPORT\x1B[0m";
|
|
1109
|
-
class
|
|
1131
|
+
class ht {
|
|
1110
1132
|
_sections;
|
|
1111
1133
|
_monitor;
|
|
1112
1134
|
_paginationInProgress;
|
|
1113
1135
|
_pendingPaginateResolvers;
|
|
1114
1136
|
_currentAbortController;
|
|
1115
1137
|
constructor() {
|
|
1116
|
-
this._sections = /* @__PURE__ */ new Map(), this._monitor = new
|
|
1138
|
+
this._sections = /* @__PURE__ */ new Map(), this._monitor = new ge(), this._paginationInProgress = !1, this._pendingPaginateResolvers = [], this._currentAbortController = null, window[Oe] = !0, this._injectStyle(v.globalStyle);
|
|
1117
1139
|
}
|
|
1118
1140
|
/**
|
|
1119
1141
|
* Monitor instance used to subscribe to pagination events.
|
|
@@ -1136,7 +1158,7 @@ class pt {
|
|
|
1136
1158
|
* @param onPaginationCompleted - Callback invoked when pagination for the section is completed.
|
|
1137
1159
|
* @returns `true` if the section was added to the report’s section list, or `false` if it already exists.
|
|
1138
1160
|
*/
|
|
1139
|
-
tryAddSection(e, t, n) {
|
|
1161
|
+
async tryAddSection(e, t, n) {
|
|
1140
1162
|
if (this._sections.has(e.id))
|
|
1141
1163
|
return !1;
|
|
1142
1164
|
const o = {
|
|
@@ -1150,7 +1172,7 @@ class pt {
|
|
|
1150
1172
|
context: o,
|
|
1151
1173
|
options: {
|
|
1152
1174
|
...e,
|
|
1153
|
-
size:
|
|
1175
|
+
size: it(
|
|
1154
1176
|
e.size,
|
|
1155
1177
|
e.orientation ?? "portrait"
|
|
1156
1178
|
)
|
|
@@ -1159,7 +1181,7 @@ class pt {
|
|
|
1159
1181
|
onPaginationCompleted: n
|
|
1160
1182
|
}), this._injectStyle(
|
|
1161
1183
|
v.sectionPageMedia(e.id, e.size)
|
|
1162
|
-
), this._monitor.dispatch("sectionCreated", o), !0;
|
|
1184
|
+
), await this._monitor.dispatch("sectionCreated", o), !0;
|
|
1163
1185
|
}
|
|
1164
1186
|
/**
|
|
1165
1187
|
* Schedules a pagination operation.
|
|
@@ -1177,7 +1199,7 @@ class pt {
|
|
|
1177
1199
|
* `suspension` property of the returned result object.
|
|
1178
1200
|
*/
|
|
1179
1201
|
async schedulePagination() {
|
|
1180
|
-
return this._sections.size === 0 ? (window[
|
|
1202
|
+
return this._sections.size === 0 ? (window[ne] = !0, {
|
|
1181
1203
|
sections: [],
|
|
1182
1204
|
suspension: Promise.resolve()
|
|
1183
1205
|
}) : (this._paginationInProgress && this._currentAbortController && (g.debug(
|
|
@@ -1189,6 +1211,24 @@ class pt {
|
|
|
1189
1211
|
this._pendingPaginateResolvers.push({ resolve: e, reject: t });
|
|
1190
1212
|
}) : this._executePagination());
|
|
1191
1213
|
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Retrieves JSON data injected by **@paprize/puppeteer** during server-side rendering (SSR).
|
|
1216
|
+
*
|
|
1217
|
+
* If no injected data is available, the function returns the provided `defaultData`, or `null` if none is given.
|
|
1218
|
+
*
|
|
1219
|
+
* ⚠️ **Important Notes:**
|
|
1220
|
+
* - This function is **not type-safe** — it performs **no runtime type validation** on the returned data.
|
|
1221
|
+
* - It is available **only during server-side rendering** when using **@paprize/puppeteer**.
|
|
1222
|
+
* - When used in **client-side rendering** or **development** mode, you should provide a `defaultData` value for testing purposes.
|
|
1223
|
+
*
|
|
1224
|
+
* @template T - The expected type of the injected JSON data.
|
|
1225
|
+
* @param defaultData - Optional fallback value to return if no injected data is found.
|
|
1226
|
+
* @returns A promise resolving to the injected JSON data if available, otherwise the provided default value or `null`.
|
|
1227
|
+
*/
|
|
1228
|
+
async getJsonData(e) {
|
|
1229
|
+
return await this._lazyJsonDataReader().catch(() => e) ?? e ?? null;
|
|
1230
|
+
}
|
|
1231
|
+
_lazyJsonDataReader = je(We);
|
|
1192
1232
|
async _executePagination() {
|
|
1193
1233
|
this._paginationInProgress = !0, this._currentAbortController = new AbortController();
|
|
1194
1234
|
const e = this._currentAbortController.signal;
|
|
@@ -1200,32 +1240,32 @@ class pt {
|
|
|
1200
1240
|
const t = [];
|
|
1201
1241
|
for (const o of this._sections.values()) {
|
|
1202
1242
|
o.context.isPaginated = !1;
|
|
1203
|
-
const r = new
|
|
1243
|
+
const r = new R();
|
|
1204
1244
|
await r.add(o.options.suspense), r.monitor.addEventListener("onChange", (s) => {
|
|
1205
1245
|
g.debug(
|
|
1206
1246
|
w,
|
|
1207
1247
|
`${s} pending promises in section '${o.options.id}'.`
|
|
1208
1248
|
);
|
|
1209
|
-
}), r.
|
|
1249
|
+
}), r.then(async () => {
|
|
1210
1250
|
e.aborted || (g.debug(
|
|
1211
1251
|
w,
|
|
1212
1252
|
`Start paginating section '${o.options.id}'.`
|
|
1213
|
-
), o.context.isSuspended = !1, this._paginateSection(o));
|
|
1253
|
+
), o.context.isSuspended = !1, await this._paginateSection(o));
|
|
1214
1254
|
}), t.push(r);
|
|
1215
1255
|
}
|
|
1216
|
-
const n = new
|
|
1217
|
-
return n.monitor.addEventListener("onChange", () => {
|
|
1218
|
-
g.debug(w, "Report pagination completed."), this._monitor.dispatch("paginationCycleCompleted", {
|
|
1256
|
+
const n = new R();
|
|
1257
|
+
return n.monitor.addEventListener("onChange", async () => {
|
|
1258
|
+
g.debug(w, "Report pagination completed."), await this._monitor.dispatch("paginationCycleCompleted", {
|
|
1219
1259
|
sections: [...this._sections.values()].map(
|
|
1220
1260
|
(o) => o.context
|
|
1221
1261
|
)
|
|
1222
1262
|
});
|
|
1223
1263
|
}), e.aborted ? new Promise((o, r) => {
|
|
1224
1264
|
this._pendingPaginateResolvers.push({ resolve: o, reject: r });
|
|
1225
|
-
}) : (await n.add(t.map((o) => o.
|
|
1265
|
+
}) : (await n.add(t.map((o) => o.toPromise())), {
|
|
1226
1266
|
sections: [...this._sections.values()].map((o) => o.context),
|
|
1227
|
-
suspension: n.
|
|
1228
|
-
window[
|
|
1267
|
+
suspension: n.toPromise().then(() => {
|
|
1268
|
+
window[ne] = !0;
|
|
1229
1269
|
})
|
|
1230
1270
|
});
|
|
1231
1271
|
} finally {
|
|
@@ -1247,9 +1287,9 @@ class pt {
|
|
|
1247
1287
|
}
|
|
1248
1288
|
_injectStyle(e) {
|
|
1249
1289
|
let t = document.getElementById(
|
|
1250
|
-
|
|
1290
|
+
K
|
|
1251
1291
|
);
|
|
1252
|
-
t || (t = document.createElement("style"), t.id =
|
|
1292
|
+
t || (t = document.createElement("style"), t.id = K, t.textContent = "", document.head.appendChild(t)), t.textContent = (t.textContent + e).replace(/\s+/g, " ").replace(/\s*([:;{}])\s*/g, "$1").trim();
|
|
1253
1293
|
}
|
|
1254
1294
|
async _paginateSection(e) {
|
|
1255
1295
|
const t = document.createElement("div");
|
|
@@ -1257,10 +1297,10 @@ class pt {
|
|
|
1257
1297
|
t.style,
|
|
1258
1298
|
v.page(
|
|
1259
1299
|
e.options.size,
|
|
1260
|
-
e.options.margin ??
|
|
1300
|
+
e.options.margin ?? He.None
|
|
1261
1301
|
)
|
|
1262
|
-
),
|
|
1263
|
-
const n =
|
|
1302
|
+
), V() || Object.assign(t.style, v.outOfScreen);
|
|
1303
|
+
const n = Ke(e.components);
|
|
1264
1304
|
n.sectionHeader && (Object.assign(
|
|
1265
1305
|
n.sectionHeader.style,
|
|
1266
1306
|
v.component
|
|
@@ -1268,18 +1308,25 @@ class pt {
|
|
|
1268
1308
|
n.sectionFooter.style,
|
|
1269
1309
|
v.component
|
|
1270
1310
|
), t.appendChild(n.sectionFooter)), document.body.appendChild(t);
|
|
1271
|
-
const { height: o, width: r, sectionHeaderHeight: s, sectionFooterHeight: d } =
|
|
1311
|
+
const { height: o, width: r, sectionHeaderHeight: s, sectionFooterHeight: d } = ze(
|
|
1272
1312
|
n.pageContent,
|
|
1273
1313
|
n.sectionHeader,
|
|
1274
1314
|
n.sectionFooter
|
|
1275
|
-
)
|
|
1315
|
+
);
|
|
1316
|
+
if (o === 0)
|
|
1317
|
+
throw g.error(
|
|
1318
|
+
`Pagination failed for section '${e.options.id}': insufficient space for page content or content is empty. Ensure that the section has content and that the header and footer do not occupy all available space.`
|
|
1319
|
+
), t.remove(), new Error(
|
|
1320
|
+
`Pagination failed: no available space for content in section '${e.options.id}'.`
|
|
1321
|
+
);
|
|
1322
|
+
const P = D.paginate(
|
|
1276
1323
|
n.pageContent,
|
|
1277
1324
|
{ height: o, width: r },
|
|
1278
1325
|
{
|
|
1279
1326
|
id: e.options.id,
|
|
1280
1327
|
plugins: [
|
|
1281
|
-
...e.options.plugins ??
|
|
1282
|
-
|
|
1328
|
+
...e.options.plugins ?? tt,
|
|
1329
|
+
Be(
|
|
1283
1330
|
o,
|
|
1284
1331
|
s,
|
|
1285
1332
|
d
|
|
@@ -1288,15 +1335,15 @@ class pt {
|
|
|
1288
1335
|
}
|
|
1289
1336
|
);
|
|
1290
1337
|
t.remove();
|
|
1291
|
-
const b = P.map((_,
|
|
1292
|
-
pageIndex:
|
|
1338
|
+
const b = P.map((_, j) => ({
|
|
1339
|
+
pageIndex: j,
|
|
1293
1340
|
totalPages: P.length,
|
|
1294
1341
|
sectionId: e.options.id,
|
|
1295
1342
|
pageContentHtml: _
|
|
1296
1343
|
}));
|
|
1297
|
-
e.onPaginationCompleted(b);
|
|
1344
|
+
await e.onPaginationCompleted(b);
|
|
1298
1345
|
for (const _ of b)
|
|
1299
|
-
this._monitor.dispatch("pageCompleted", _);
|
|
1346
|
+
await this._monitor.dispatch("pageCompleted", _);
|
|
1300
1347
|
const f = {
|
|
1301
1348
|
...e.context,
|
|
1302
1349
|
isPaginated: !0,
|
|
@@ -1306,10 +1353,10 @@ class pt {
|
|
|
1306
1353
|
this._sections.set(e.options.id, {
|
|
1307
1354
|
...e,
|
|
1308
1355
|
context: f
|
|
1309
|
-
}), this._monitor.dispatch("sectionCompleted", f);
|
|
1356
|
+
}), await this._monitor.dispatch("sectionCompleted", f);
|
|
1310
1357
|
}
|
|
1311
1358
|
}
|
|
1312
|
-
const
|
|
1359
|
+
const oe = [
|
|
1313
1360
|
"ad",
|
|
1314
1361
|
"adipisicing",
|
|
1315
1362
|
"aliqua",
|
|
@@ -1373,59 +1420,59 @@ const ne = [
|
|
|
1373
1420
|
"veniam",
|
|
1374
1421
|
"voluptate"
|
|
1375
1422
|
];
|
|
1376
|
-
function
|
|
1423
|
+
function mt(i, e) {
|
|
1377
1424
|
if (i <= 0)
|
|
1378
1425
|
return "";
|
|
1379
1426
|
const t = [], n = Math.floor(e * 982451653);
|
|
1380
1427
|
for (let o = 0; o < i; o++) {
|
|
1381
1428
|
const r = (n + o * 2654435761) % Math.pow(2, 32), s = Math.floor(
|
|
1382
|
-
r / Math.pow(2, 32) *
|
|
1429
|
+
r / Math.pow(2, 32) * oe.length
|
|
1383
1430
|
);
|
|
1384
|
-
t.push(
|
|
1431
|
+
t.push(oe[s]);
|
|
1385
1432
|
}
|
|
1386
1433
|
return t.length > 0 && (t[0] = t[0].charAt(0).toUpperCase() + t[0].slice(1)), t.join(" ") + ".";
|
|
1387
1434
|
}
|
|
1388
1435
|
export {
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1436
|
+
ge as EventDispatcher,
|
|
1437
|
+
Qe as PageBreakPlugin,
|
|
1438
|
+
D as Paginator,
|
|
1439
|
+
ht as ReportBuilder,
|
|
1440
|
+
pt as SectionTocPlugin,
|
|
1394
1441
|
h as SplitResult,
|
|
1395
|
-
|
|
1396
|
-
|
|
1442
|
+
et as TablePlugin,
|
|
1443
|
+
it as adjustPageSize,
|
|
1397
1444
|
C as attributePrefix,
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1445
|
+
ut as buildPageId,
|
|
1446
|
+
Ke as cloneComponents,
|
|
1447
|
+
mt as createLoremIpsumParagraph,
|
|
1448
|
+
ot as currentElementClassName,
|
|
1449
|
+
rt as currentTextClassName,
|
|
1450
|
+
gt as debugPlugin,
|
|
1451
|
+
tt as defaultPlugins,
|
|
1452
|
+
lt as enableDebugMode,
|
|
1453
|
+
z as getVisibleHeight,
|
|
1454
|
+
Me as globalStyle,
|
|
1455
|
+
K as globalStyleId,
|
|
1456
|
+
st as ignoredElementClassName,
|
|
1457
|
+
at as ignoredTextClassName,
|
|
1458
|
+
V as isDebugMode,
|
|
1459
|
+
se as isElement,
|
|
1460
|
+
be as isTextNode,
|
|
1461
|
+
ct as layoutOptionsToAttributes,
|
|
1415
1462
|
g as logger,
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1463
|
+
fe as loggerName,
|
|
1464
|
+
ye as moveOffscreen,
|
|
1465
|
+
Ye as pageBreakAttributeName,
|
|
1419
1466
|
U as pageClassName,
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1467
|
+
He as pageMargin,
|
|
1468
|
+
dt as pageSize,
|
|
1469
|
+
Oe as paprize_isInitialized,
|
|
1470
|
+
ne as paprize_isReady,
|
|
1471
|
+
ie as paprize_readJsonDataFile,
|
|
1425
1472
|
T as previewClassName,
|
|
1426
1473
|
v as reportStyles,
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1474
|
+
ve as sectionClassName,
|
|
1475
|
+
nt as sectionTocName,
|
|
1476
|
+
_e as tempContainerClassName
|
|
1430
1477
|
};
|
|
1431
1478
|
//# sourceMappingURL=paprize-core.js.map
|