@paprize/core 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/paprize-core.js +227 -167
- package/dist/paprize-core.js.map +1 -1
- package/dist/paprize-core.umd.cjs +6 -6
- package/dist/paprize-core.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/paprize-core.js
CHANGED
|
@@ -159,96 +159,108 @@ var E = {
|
|
|
159
159
|
hyphen: "-",
|
|
160
160
|
keepOnSamePage: !1,
|
|
161
161
|
hyphenationDisabled: !1
|
|
162
|
-
},
|
|
162
|
+
}, re = `${y}hyphen`, D = `${y}keep-on-same-page`, O = `${y}hyphenation-disabled`, ie = {
|
|
163
163
|
hyphen: {
|
|
164
|
-
key:
|
|
164
|
+
key: re,
|
|
165
165
|
reader: (e) => String(e)
|
|
166
166
|
},
|
|
167
167
|
keepOnSamePage: {
|
|
168
|
-
key:
|
|
169
|
-
reader: (e) =>
|
|
168
|
+
key: D,
|
|
169
|
+
reader: (e) => {
|
|
170
|
+
switch (e) {
|
|
171
|
+
case "true": return !0;
|
|
172
|
+
case "false": return !1;
|
|
173
|
+
case "prefer": return "prefer";
|
|
174
|
+
default: return E.keepOnSamePage;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
170
177
|
},
|
|
171
178
|
hyphenationDisabled: {
|
|
172
|
-
key:
|
|
179
|
+
key: O,
|
|
173
180
|
reader: (e) => e === "true"
|
|
174
181
|
}
|
|
175
182
|
};
|
|
176
|
-
function
|
|
183
|
+
function ae(e) {
|
|
177
184
|
let t = {};
|
|
178
185
|
for (let [n, r] of Object.entries(e)) {
|
|
179
|
-
let e =
|
|
186
|
+
let e = ie[n];
|
|
180
187
|
e !== void 0 && r !== void 0 && (t[e.key] = String(r));
|
|
181
188
|
}
|
|
182
189
|
return t;
|
|
183
190
|
}
|
|
184
|
-
var
|
|
185
|
-
function
|
|
191
|
+
var k = /* @__PURE__ */ new WeakMap();
|
|
192
|
+
function oe(e, t, n, r) {
|
|
186
193
|
n != null && (r[e] = t(n));
|
|
187
194
|
}
|
|
188
|
-
function
|
|
195
|
+
function A(e) {
|
|
189
196
|
if (!e) return {};
|
|
190
|
-
if (!(e instanceof Element)) return
|
|
197
|
+
if (!(e instanceof Element)) return A(e?.parentNode);
|
|
191
198
|
let t = {};
|
|
192
199
|
for (let n of Object.keys(E)) {
|
|
193
|
-
let r = n, i =
|
|
194
|
-
|
|
200
|
+
let r = n, i = ie[r], a = e.getAttribute(i.key);
|
|
201
|
+
oe(r, i.reader, a, t);
|
|
195
202
|
}
|
|
196
203
|
let n = {
|
|
197
|
-
...e.parentNode ?
|
|
204
|
+
...e.parentNode ? k.get(e.parentNode) : void 0,
|
|
198
205
|
...t
|
|
199
206
|
};
|
|
200
|
-
return
|
|
207
|
+
return k.set(e, n), n;
|
|
201
208
|
}
|
|
202
209
|
//#endregion
|
|
203
210
|
//#region src/paginate/PaginationOptions.ts
|
|
204
|
-
var
|
|
211
|
+
var j = {
|
|
205
212
|
id: "default",
|
|
206
213
|
plugins: [],
|
|
207
214
|
...E
|
|
208
215
|
};
|
|
209
|
-
function
|
|
210
|
-
let n =
|
|
216
|
+
function se(e, t) {
|
|
217
|
+
let n = A(e);
|
|
211
218
|
return {
|
|
212
|
-
...
|
|
219
|
+
...j,
|
|
213
220
|
...t,
|
|
214
221
|
...n
|
|
215
222
|
};
|
|
216
223
|
}
|
|
217
224
|
//#endregion
|
|
218
225
|
//#region src/paginate/PaginationPlugin.ts
|
|
219
|
-
var
|
|
220
|
-
function
|
|
226
|
+
var M = "\x1B[46mPLUGIN\x1B[0m";
|
|
227
|
+
function N(e, t, ...n) {
|
|
221
228
|
e.sort((e, t) => e.order - t.order).forEach((e) => {
|
|
222
229
|
let r = e[t];
|
|
223
230
|
if (r) {
|
|
224
|
-
x.debug(
|
|
231
|
+
x.debug(M, `executing plugin ${e.name}:${String(t)} ()`, n);
|
|
225
232
|
try {
|
|
226
|
-
r(...n), x.debug(
|
|
233
|
+
r(...n), x.debug(M, `plugin ${e.name}:${String(t)} executed`, n);
|
|
227
234
|
} catch (n) {
|
|
228
|
-
x.debug(
|
|
235
|
+
x.debug(M, `plugin ${e.name}:${String(t)} failed`, n);
|
|
229
236
|
}
|
|
230
237
|
}
|
|
231
238
|
});
|
|
232
239
|
}
|
|
233
240
|
//#endregion
|
|
234
241
|
//#region src/paginate/PageNodes.ts
|
|
235
|
-
var
|
|
242
|
+
var P = {
|
|
236
243
|
Element: "element",
|
|
237
244
|
Text: "text"
|
|
238
|
-
},
|
|
245
|
+
}, F = class e {
|
|
239
246
|
_node;
|
|
240
247
|
config;
|
|
241
|
-
type =
|
|
248
|
+
type = P.Element;
|
|
242
249
|
transaction;
|
|
243
|
-
|
|
244
|
-
cloneCount;
|
|
250
|
+
clonedData;
|
|
245
251
|
constructor(e, t, n, r) {
|
|
246
|
-
this._node = e, this.transaction = t, this.config = n, this.
|
|
252
|
+
this._node = e, this.transaction = t, this.config = n, this.clonedData = r ? {
|
|
253
|
+
clonedFrom: r,
|
|
254
|
+
cloneCount: r.clonedData.cloneCount + 1
|
|
255
|
+
} : {
|
|
256
|
+
clonedFrom: void 0,
|
|
257
|
+
cloneCount: 0
|
|
258
|
+
};
|
|
247
259
|
}
|
|
248
260
|
getOriginalNode() {
|
|
249
|
-
let e = this.clonedFrom;
|
|
250
|
-
for (; e?.clonedFrom;) e = e.clonedFrom;
|
|
251
|
-
return e?._node;
|
|
261
|
+
let e = this.clonedData.clonedFrom;
|
|
262
|
+
for (; e?.clonedData.clonedFrom;) e = e.clonedData.clonedFrom;
|
|
263
|
+
return e?._node ?? this._node;
|
|
252
264
|
}
|
|
253
265
|
appendChild(e) {
|
|
254
266
|
this.transaction.isActive && this.transaction.addRollbackCallback(() => {
|
|
@@ -257,7 +269,7 @@ var F = {
|
|
|
257
269
|
}
|
|
258
270
|
clone(t) {
|
|
259
271
|
let n = new e(this._node.cloneNode(t), this.transaction, this.config, this);
|
|
260
|
-
return
|
|
272
|
+
return N(this.config.plugins, "onClone", this.config.id, this._node, n), n;
|
|
261
273
|
}
|
|
262
274
|
getHeight() {
|
|
263
275
|
return T(this._node);
|
|
@@ -276,9 +288,9 @@ var F = {
|
|
|
276
288
|
getNode() {
|
|
277
289
|
return this._node;
|
|
278
290
|
}
|
|
279
|
-
},
|
|
291
|
+
}, ce = class {
|
|
280
292
|
_node;
|
|
281
|
-
type =
|
|
293
|
+
type = P.Text;
|
|
282
294
|
transaction;
|
|
283
295
|
config;
|
|
284
296
|
constructor(e, t, n) {
|
|
@@ -299,25 +311,25 @@ var F = {
|
|
|
299
311
|
return this._node;
|
|
300
312
|
}
|
|
301
313
|
};
|
|
302
|
-
function
|
|
303
|
-
if (te(e)) return new
|
|
304
|
-
if (w(e)) return new
|
|
314
|
+
function I(e, t, n) {
|
|
315
|
+
if (te(e)) return new ce(e, t, n);
|
|
316
|
+
if (w(e)) return new F(e, t, n);
|
|
305
317
|
throw Error("Unsupported node type");
|
|
306
318
|
}
|
|
307
319
|
//#endregion
|
|
308
320
|
//#region src/debugUtilities/pageNodeMarker.ts
|
|
309
|
-
function ce(e) {
|
|
310
|
-
C() && (e && e.type == F.Element ? e.getNode().classList.add(p) : e && e.type == F.Text && e.getNode().parentElement?.classList.add(m));
|
|
311
|
-
}
|
|
312
321
|
function le(e) {
|
|
313
|
-
C() && (e && e.type ==
|
|
322
|
+
C() && (e && e.type == P.Element ? e.getNode().classList.add(p) : e && e.type == P.Text && e.getNode().parentElement?.classList.add(m));
|
|
314
323
|
}
|
|
315
|
-
function
|
|
316
|
-
C() && (e && e.type ==
|
|
324
|
+
function ue(e) {
|
|
325
|
+
C() && (e && e.type == P.Element ? e.getNode().classList.add(d) : e && e.type == P.Text && e.getNode().parentElement?.classList.add(f));
|
|
326
|
+
}
|
|
327
|
+
function L(e) {
|
|
328
|
+
C() && (e && e.type == P.Element ? e.getNode().classList.remove(d) : e && e.type == P.Text && e.getNode().parentElement?.classList.remove(f));
|
|
317
329
|
}
|
|
318
330
|
//#endregion
|
|
319
331
|
//#region src/paginate/DomState.ts
|
|
320
|
-
var
|
|
332
|
+
var R = "\x1B[106mDOM\x1B[0m", de = class {
|
|
321
333
|
_transaction;
|
|
322
334
|
_treeWalker;
|
|
323
335
|
_config;
|
|
@@ -337,27 +349,27 @@ var z = "\x1B[106mDOM\x1B[0m", ue = class {
|
|
|
337
349
|
return this._previousNode;
|
|
338
350
|
}
|
|
339
351
|
goToNextNode() {
|
|
340
|
-
this._treeWalker.nextNode() || (this._completed = !0), x.debug(
|
|
352
|
+
this._treeWalker.nextNode() || (this._completed = !0), x.debug(R, "moving to next node"), this.setState();
|
|
341
353
|
}
|
|
342
354
|
goToNextSiblingOrParentSibling() {
|
|
343
355
|
let e = 0;
|
|
344
|
-
if (this._treeWalker.nextSibling()) return x.debug(
|
|
345
|
-
for (; this._treeWalker.parentNode();) if (e++, this._treeWalker.nextSibling()) return x.debug(
|
|
356
|
+
if (this._treeWalker.nextSibling()) return x.debug(R, "moving to next sibling node"), this.setState(), { parentsTraversed: e };
|
|
357
|
+
for (; this._treeWalker.parentNode();) if (e++, this._treeWalker.nextSibling()) return x.debug(R, "moving to parent sibling node, traversed:", e), this.setState(), { parentsTraversed: e };
|
|
346
358
|
return this._completed = !0, { parentsTraversed: e };
|
|
347
359
|
}
|
|
348
360
|
goToFirstChildOrNextNode() {
|
|
349
|
-
return this._treeWalker.firstChild() ? (x.debug(
|
|
361
|
+
return this._treeWalker.firstChild() ? (x.debug(R, "moving to first child node"), this.setState(), { parentsTraversed: 1 }) : (this.goToNextNode(), { parentsTraversed: 0 });
|
|
350
362
|
}
|
|
351
363
|
setState() {
|
|
352
|
-
this._previousNode = this._currentNode, this._currentNode =
|
|
353
|
-
DEV:
|
|
354
|
-
DEV:
|
|
355
|
-
x.debug(
|
|
364
|
+
this._previousNode = this._currentNode, this._currentNode = I(this._treeWalker.currentNode, this._transaction, se(this._treeWalker.currentNode, this._config));
|
|
365
|
+
DEV: ue(this._currentNode);
|
|
366
|
+
DEV: L(this._previousNode);
|
|
367
|
+
x.debug(R, "moved to node", {
|
|
356
368
|
currentNode: this._currentNode,
|
|
357
369
|
previousNode: this._previousNode
|
|
358
370
|
});
|
|
359
371
|
}
|
|
360
|
-
},
|
|
372
|
+
}, fe = class {
|
|
361
373
|
_onRollback;
|
|
362
374
|
_onCommit;
|
|
363
375
|
isActive;
|
|
@@ -384,7 +396,7 @@ var z = "\x1B[106mDOM\x1B[0m", ue = class {
|
|
|
384
396
|
commit = () => {
|
|
385
397
|
this.isActive && (this.isActive = !1, this._onCommit.forEach((e) => e()));
|
|
386
398
|
};
|
|
387
|
-
},
|
|
399
|
+
}, z = "\x1B[102mPAGE\x1B[0m", B = class e {
|
|
388
400
|
currentPage;
|
|
389
401
|
activeElement;
|
|
390
402
|
currentElement;
|
|
@@ -399,7 +411,7 @@ var z = "\x1B[106mDOM\x1B[0m", ue = class {
|
|
|
399
411
|
return new e(t, null, t, n, !1, r, i);
|
|
400
412
|
}
|
|
401
413
|
clone = () => new e(this.currentPage, this.activeElement, this.currentElement, [...this.parentStack], this.pageIsFull, this.pageIndex, this.pageHeight);
|
|
402
|
-
},
|
|
414
|
+
}, pe = class e {
|
|
403
415
|
_pageState;
|
|
404
416
|
_transaction;
|
|
405
417
|
_tempContainer;
|
|
@@ -407,11 +419,11 @@ var z = "\x1B[106mDOM\x1B[0m", ue = class {
|
|
|
407
419
|
constructor(t, n, r, i) {
|
|
408
420
|
this._tempContainer = t, this._config = i, this._transaction = r;
|
|
409
421
|
let a = e.createPageHtmlElement(n.width), o = this.createNewPage(a);
|
|
410
|
-
this._pageState =
|
|
422
|
+
this._pageState = B.create(o, [], 0, n.height), N(this._config.plugins, "onNewPage", i.id, this);
|
|
411
423
|
}
|
|
412
424
|
nextPage() {
|
|
413
|
-
let e = this.createNewPage(this._pageState.currentPage.getNode().cloneNode(!1)), t =
|
|
414
|
-
this.cloneParentStackToNewPage(t), this.cleanupEmptyParent(), this._pageState = t,
|
|
425
|
+
let e = this.createNewPage(this._pageState.currentPage.getNode().cloneNode(!1)), t = B.create(e, [], this._pageState.pageIndex + 1, this._pageState.pageHeight);
|
|
426
|
+
this.cloneParentStackToNewPage(t), this.cleanupEmptyParent(), this._pageState = t, N(this._config.plugins, "onNewPage", this._config.id, this);
|
|
415
427
|
}
|
|
416
428
|
cloneParentStackToNewPage(e) {
|
|
417
429
|
for (let t of this._pageState.parentStack) {
|
|
@@ -429,13 +441,13 @@ var z = "\x1B[106mDOM\x1B[0m", ue = class {
|
|
|
429
441
|
});
|
|
430
442
|
}
|
|
431
443
|
enterElement() {
|
|
432
|
-
if (!this._pageState.activeElement || this._pageState.activeElement.type !==
|
|
433
|
-
x.debug(
|
|
444
|
+
if (!this._pageState.activeElement || this._pageState.activeElement.type !== P.Element) throw Error("Invalid state: activeElement is not an Element");
|
|
445
|
+
x.debug(z, "entering an element", this._pageState.activeElement), this._pageState.currentElement = this._pageState.activeElement, this._pageState.parentStack.push(this._pageState.activeElement);
|
|
434
446
|
}
|
|
435
447
|
leaveElement() {
|
|
436
448
|
this._pageState.activeElement = null;
|
|
437
449
|
let e = this._pageState.parentStack.pop();
|
|
438
|
-
x.debug(
|
|
450
|
+
x.debug(z, "leaving a parent element", e);
|
|
439
451
|
let t = this._pageState.parentStack.at(-1);
|
|
440
452
|
this._pageState.currentElement = t ?? this._pageState.currentPage;
|
|
441
453
|
}
|
|
@@ -444,9 +456,9 @@ var z = "\x1B[106mDOM\x1B[0m", ue = class {
|
|
|
444
456
|
return t.style.width = `${e}px`, t.style.maxWidth = `${e}px`, t.className = g, t;
|
|
445
457
|
}
|
|
446
458
|
createNewPage(e) {
|
|
447
|
-
return x.debug(
|
|
459
|
+
return x.debug(z, "creating new page"), this._tempContainer.appendChild(e), this._transaction.isActive && this._transaction.addRollbackCallback(() => {
|
|
448
460
|
this._tempContainer.removeChild(e);
|
|
449
|
-
}),
|
|
461
|
+
}), I(e, this._transaction, this._config);
|
|
450
462
|
}
|
|
451
463
|
startTransaction() {
|
|
452
464
|
this._transaction.start();
|
|
@@ -462,78 +474,81 @@ var z = "\x1B[106mDOM\x1B[0m", ue = class {
|
|
|
462
474
|
return this._pageState.pageIsFull || this._pageState.currentPage.getHeight() > this._pageState.pageHeight;
|
|
463
475
|
}
|
|
464
476
|
markPageAsFull() {
|
|
465
|
-
x.debug(
|
|
477
|
+
x.debug(z, "marking page as full", this._pageState.activeElement), this._pageState.pageIsFull = !0;
|
|
466
478
|
}
|
|
467
479
|
appendChild(e, t) {
|
|
468
480
|
let n = e.clone(t);
|
|
469
|
-
DEV:
|
|
481
|
+
DEV: L(n);
|
|
470
482
|
return this._pageState.currentElement.appendChild(n), this._pageState.activeElement = n, n;
|
|
471
483
|
}
|
|
472
484
|
addTextNode(e) {
|
|
473
|
-
if (this._pageState.activeElement?.type ===
|
|
474
|
-
let t =
|
|
485
|
+
if (this._pageState.activeElement?.type === P.Text) return this._pageState.activeElement;
|
|
486
|
+
let t = I(document.createTextNode(e), this._transaction, this._config);
|
|
475
487
|
return this._pageState.currentElement.appendChild(t), this._pageState.activeElement = t, t;
|
|
476
488
|
}
|
|
477
489
|
getPageState() {
|
|
478
490
|
return this._pageState;
|
|
479
491
|
}
|
|
480
|
-
},
|
|
492
|
+
}, V = {
|
|
481
493
|
None: 0,
|
|
482
494
|
FullNodePlaced: 1,
|
|
483
495
|
SplitChildren: 2
|
|
484
496
|
};
|
|
485
497
|
//#endregion
|
|
486
498
|
//#region src/paginate/paginateElement.ts
|
|
487
|
-
function
|
|
488
|
-
let n =
|
|
489
|
-
if (n !==
|
|
499
|
+
function me(e, t) {
|
|
500
|
+
let n = H(e, t);
|
|
501
|
+
if (n !== V.None) return n;
|
|
490
502
|
let { rollback: r, commit: i } = t.startTransaction();
|
|
491
503
|
t.nextPage();
|
|
492
|
-
let a =
|
|
493
|
-
return a ===
|
|
504
|
+
let a = H(e, t);
|
|
505
|
+
return a === V.None ? (r(), e.config.keepOnSamePage === "prefer" ? U(e, t) : (x.error("Element is too big to fit on a page", e), V.None)) : (i(), a);
|
|
494
506
|
}
|
|
495
|
-
function
|
|
507
|
+
function H(e, t) {
|
|
496
508
|
if (t.hasEmptySpace(e.getHeight())) {
|
|
497
509
|
let n = t.appendChild(e, !0);
|
|
498
510
|
if (t.isOverFlow()) n.remove();
|
|
499
|
-
else return
|
|
511
|
+
else return V.FullNodePlaced;
|
|
500
512
|
}
|
|
501
|
-
|
|
513
|
+
return e.config.keepOnSamePage === !1 ? U(e, t) : V.None;
|
|
514
|
+
}
|
|
515
|
+
function U(e, t) {
|
|
516
|
+
if (e.getChildrenCount() === 0) return V.None;
|
|
502
517
|
let n = t.appendChild(e, !1);
|
|
503
|
-
return t.isOverFlow() ? (n.remove(),
|
|
518
|
+
return t.isOverFlow() ? (n.remove(), V.None) : V.SplitChildren;
|
|
504
519
|
}
|
|
505
520
|
//#endregion
|
|
506
521
|
//#region src/paginate/paginateText.ts
|
|
507
|
-
function
|
|
508
|
-
let n =
|
|
522
|
+
function he(e, t) {
|
|
523
|
+
let n = V.FullNodePlaced, r = e.textContent.split(/(\s+)/).filter((e) => e !== ""), i, a = 0;
|
|
509
524
|
for (; i || a < r.length;) {
|
|
510
|
-
let o =
|
|
511
|
-
o.completed || (n =
|
|
525
|
+
let o = ge(i ?? r[a], t, e.config);
|
|
526
|
+
o.completed || (n = V.None), o.pendingToken ? i = o.pendingToken : (i = void 0, a++);
|
|
512
527
|
}
|
|
513
528
|
return n;
|
|
514
529
|
}
|
|
515
|
-
function
|
|
530
|
+
function ge(e, t, n) {
|
|
516
531
|
let r = t.addTextNode(""), i = r.textContent;
|
|
517
532
|
if (r.textContent += e, !t.isOverFlow()) return { completed: !0 };
|
|
518
533
|
r.textContent = i;
|
|
519
|
-
let a =
|
|
534
|
+
let a = _e(e, t, n);
|
|
520
535
|
return {
|
|
521
536
|
pendingToken: a.leftovers,
|
|
522
537
|
completed: a.completed
|
|
523
538
|
};
|
|
524
539
|
}
|
|
525
|
-
function
|
|
540
|
+
function _e(e, t, n) {
|
|
526
541
|
let { rollback: r, commit: i } = t.startTransaction();
|
|
527
542
|
if (t.nextPage(), t.addTextNode(e), !t.isOverFlow()) return i(), { completed: !0 };
|
|
528
543
|
if (r(), n.hyphenationDisabled) return x.warn("Hyphenation disabled, skipping oversized token:", e), { completed: !1 };
|
|
529
544
|
t.hasEmptySpace() || t.nextPage();
|
|
530
|
-
let a =
|
|
545
|
+
let a = ve(e, n.hyphen, t);
|
|
531
546
|
return {
|
|
532
547
|
completed: !0,
|
|
533
548
|
leftovers: a && a.length > 0 ? a : void 0
|
|
534
549
|
};
|
|
535
550
|
}
|
|
536
|
-
function
|
|
551
|
+
function ve(e, t, n) {
|
|
537
552
|
let r = n.addTextNode(""), i = "";
|
|
538
553
|
for (let a = 0; a < e.length; a++) {
|
|
539
554
|
let o = e[a], s = i + o;
|
|
@@ -552,9 +567,9 @@ var W = "\x1B[103mPAGINATOR\x1B[0m", G = class e {
|
|
|
552
567
|
_config;
|
|
553
568
|
constructor(t, n, r) {
|
|
554
569
|
this._config = {
|
|
555
|
-
...
|
|
570
|
+
...j,
|
|
556
571
|
...r
|
|
557
|
-
}, this._tempContainer = e.createTempContainer(this._config.id), this._transaction = new
|
|
572
|
+
}, this._tempContainer = e.createTempContainer(this._config.id), this._transaction = new fe(), this._domState = new de(t, this._transaction, this._config), this._pageManager = new pe(this._tempContainer, n, this._transaction, this._config);
|
|
558
573
|
}
|
|
559
574
|
static createTempContainer(e) {
|
|
560
575
|
let t = document.createElement("div");
|
|
@@ -570,27 +585,27 @@ var W = "\x1B[103mPAGINATOR\x1B[0m", G = class e {
|
|
|
570
585
|
}) : i._tempContainer.remove(), a;
|
|
571
586
|
}
|
|
572
587
|
processAllNodes() {
|
|
573
|
-
|
|
588
|
+
N(this._config.plugins, "beforePagination", this._config.id, this._domState, this._pageManager), this._domState.goToNextNode();
|
|
574
589
|
do {
|
|
575
590
|
b.default.debug(W, "paginating node", this._domState.currentNode);
|
|
576
591
|
let e = this.processCurrentNode();
|
|
577
|
-
switch (
|
|
578
|
-
case
|
|
592
|
+
switch (N(this._config.plugins, "afterVisitNode", this._config.id, e, this._domState, this._pageManager), e) {
|
|
593
|
+
case V.None:
|
|
579
594
|
this.handleNodeSkipped();
|
|
580
595
|
break;
|
|
581
|
-
case
|
|
596
|
+
case V.FullNodePlaced:
|
|
582
597
|
this.handleFullNodePlaced();
|
|
583
598
|
break;
|
|
584
|
-
case
|
|
599
|
+
case V.SplitChildren:
|
|
585
600
|
this.handleChildrenSplit();
|
|
586
601
|
break;
|
|
587
602
|
}
|
|
588
603
|
} while (this._domState.completed === !1);
|
|
589
|
-
|
|
604
|
+
N(this._config.plugins, "afterPagination", this._config.id, this._domState, this._pageManager), b.default.debug(W, "pagination completed");
|
|
590
605
|
}
|
|
591
606
|
handleNodeSkipped() {
|
|
592
607
|
b.default.debug(W, "node skipped - couldn't paginate");
|
|
593
|
-
DEV:
|
|
608
|
+
DEV: le(this._domState.currentNode);
|
|
594
609
|
this._domState.goToNextSiblingOrParentSibling();
|
|
595
610
|
}
|
|
596
611
|
handleFullNodePlaced() {
|
|
@@ -599,16 +614,16 @@ var W = "\x1B[103mPAGINATOR\x1B[0m", G = class e {
|
|
|
599
614
|
for (let t = 0; t < e; t++) this._pageManager.leaveElement();
|
|
600
615
|
}
|
|
601
616
|
handleChildrenSplit() {
|
|
602
|
-
b.default.debug(W, "node partially paginated - splitting children"), this._domState.goToFirstChildOrNextNode().parentsTraversed === 1 && this._domState.previousNode?.type ===
|
|
617
|
+
b.default.debug(W, "node partially paginated - splitting children"), this._domState.goToFirstChildOrNextNode().parentsTraversed === 1 && this._domState.previousNode?.type === P.Element && this._pageManager.enterElement();
|
|
603
618
|
}
|
|
604
619
|
processCurrentNode() {
|
|
605
|
-
if (!this._domState.currentNode) return
|
|
606
|
-
if (this._domState.currentNode.type ===
|
|
620
|
+
if (!this._domState.currentNode) return V.None;
|
|
621
|
+
if (this._domState.currentNode.type === P.Element) {
|
|
607
622
|
let e = {};
|
|
608
|
-
return
|
|
623
|
+
return N(this._config.plugins, "onVisitElement", this._config.id, this._domState, this._pageManager, e), e.result === void 0 ? me(this._domState.currentNode, this._pageManager) : e.result;
|
|
609
624
|
} else {
|
|
610
625
|
let e = {};
|
|
611
|
-
return
|
|
626
|
+
return N(this._config.plugins, "onVisitText", this._config.id, this._domState, this._pageManager, e), e.result === void 0 ? he(this._domState.currentNode, this._pageManager) : e.result;
|
|
612
627
|
}
|
|
613
628
|
}
|
|
614
629
|
}, K = class {
|
|
@@ -625,7 +640,7 @@ var W = "\x1B[103mPAGINATOR\x1B[0m", G = class e {
|
|
|
625
640
|
let { registry: n } = this, r = n.get(e);
|
|
626
641
|
if (r) for (let e of r) await e(...t);
|
|
627
642
|
}
|
|
628
|
-
},
|
|
643
|
+
}, ye = {
|
|
629
644
|
A1: {
|
|
630
645
|
height: "841mm",
|
|
631
646
|
width: "594mm"
|
|
@@ -699,18 +714,18 @@ var W = "\x1B[103mPAGINATOR\x1B[0m", G = class e {
|
|
|
699
714
|
bottom: "0in",
|
|
700
715
|
left: "0in"
|
|
701
716
|
}
|
|
702
|
-
}, J = "__PAPRIZE_IS_INITIALIZED", Y = "__PAPRIZE_IS_READY",
|
|
717
|
+
}, J = "__PAPRIZE_IS_INITIALIZED", Y = "__PAPRIZE_IS_READY", be = "__PAPRIZE_READ_JSON_DATA_FILE";
|
|
703
718
|
//#endregion
|
|
704
719
|
//#region src/report/utils.ts
|
|
705
|
-
function
|
|
720
|
+
function xe(e) {
|
|
706
721
|
let t = e.getBoundingClientRect(), n = getComputedStyle(e), r = parseFloat(n.marginLeft) || 0, i = parseFloat(n.marginRight) || 0;
|
|
707
722
|
return {
|
|
708
723
|
height: T(e),
|
|
709
724
|
width: t.width + r + i
|
|
710
725
|
};
|
|
711
726
|
}
|
|
712
|
-
function
|
|
713
|
-
let { height: r, width: i } =
|
|
727
|
+
function Se(e, t, n) {
|
|
728
|
+
let { height: r, width: i } = xe(e);
|
|
714
729
|
return {
|
|
715
730
|
height: r,
|
|
716
731
|
width: i,
|
|
@@ -718,7 +733,7 @@ function xe(e, t, n) {
|
|
|
718
733
|
sectionFooterHeight: n ? T(n) : 0
|
|
719
734
|
};
|
|
720
735
|
}
|
|
721
|
-
function
|
|
736
|
+
function Ce(e, t, n) {
|
|
722
737
|
return {
|
|
723
738
|
name: "sectionPageHeight",
|
|
724
739
|
order: 1,
|
|
@@ -731,21 +746,21 @@ function Se(e, t, n) {
|
|
|
731
746
|
}
|
|
732
747
|
};
|
|
733
748
|
}
|
|
734
|
-
function
|
|
749
|
+
function we(e) {
|
|
735
750
|
return e ? `${e.top} ${e.right} ${e.bottom} ${e.left}` : "0";
|
|
736
751
|
}
|
|
737
|
-
function
|
|
752
|
+
function Te(e) {
|
|
738
753
|
let t = null;
|
|
739
754
|
return () => (t ||= e(), t);
|
|
740
755
|
}
|
|
741
|
-
async function
|
|
756
|
+
async function Ee() {
|
|
742
757
|
if (!("__PAPRIZE_READ_JSON_DATA_FILE" in window)) return null;
|
|
743
|
-
let e = await window[
|
|
758
|
+
let e = await window[be]?.();
|
|
744
759
|
return e ? JSON.parse(e) : null;
|
|
745
760
|
}
|
|
746
761
|
//#endregion
|
|
747
762
|
//#region src/report/reportStyles.ts
|
|
748
|
-
var
|
|
763
|
+
var De = `
|
|
749
764
|
html {
|
|
750
765
|
box-sizing: border-box;
|
|
751
766
|
}
|
|
@@ -793,35 +808,35 @@ var Ee = `
|
|
|
793
808
|
display: none !important;
|
|
794
809
|
}
|
|
795
810
|
}
|
|
796
|
-
`,
|
|
811
|
+
`, Oe = {
|
|
797
812
|
display: "flex",
|
|
798
813
|
flexDirection: "column"
|
|
799
|
-
},
|
|
814
|
+
}, ke = {
|
|
800
815
|
position: "absolute",
|
|
801
816
|
left: "-9999px",
|
|
802
817
|
top: "-9999px",
|
|
803
818
|
visibility: "hidden"
|
|
804
|
-
},
|
|
819
|
+
}, Ae = (e, t) => ({
|
|
805
820
|
display: "flex",
|
|
806
821
|
flexDirection: "column",
|
|
807
822
|
width: e.width,
|
|
808
823
|
height: e.height,
|
|
809
824
|
maxHeight: e.height,
|
|
810
825
|
position: "relative",
|
|
811
|
-
padding:
|
|
826
|
+
padding: we(t),
|
|
812
827
|
zIndex: "1"
|
|
813
|
-
}),
|
|
828
|
+
}), je = {
|
|
814
829
|
overflow: "hidden",
|
|
815
830
|
width: "100%",
|
|
816
831
|
height: "100%"
|
|
817
|
-
},
|
|
832
|
+
}, Me = {
|
|
818
833
|
position: "absolute",
|
|
819
834
|
width: "100%",
|
|
820
835
|
height: "100%",
|
|
821
836
|
left: 0,
|
|
822
837
|
top: 0
|
|
823
|
-
},
|
|
824
|
-
function
|
|
838
|
+
}, Ne = (e) => ({ page: `section-${e}` });
|
|
839
|
+
function Pe(e, t) {
|
|
825
840
|
return `@page section-${e} {
|
|
826
841
|
margin: none;
|
|
827
842
|
size:${t.width} ${t.height};
|
|
@@ -830,21 +845,21 @@ function Ne(e, t) {
|
|
|
830
845
|
}`;
|
|
831
846
|
}
|
|
832
847
|
var X = {
|
|
833
|
-
globalStyle:
|
|
834
|
-
component:
|
|
835
|
-
outOfScreen:
|
|
836
|
-
page:
|
|
837
|
-
overlay:
|
|
838
|
-
pageContent:
|
|
839
|
-
sectionPageMedia:
|
|
840
|
-
section:
|
|
848
|
+
globalStyle: De,
|
|
849
|
+
component: Oe,
|
|
850
|
+
outOfScreen: ke,
|
|
851
|
+
page: Ae,
|
|
852
|
+
overlay: Me,
|
|
853
|
+
pageContent: je,
|
|
854
|
+
sectionPageMedia: Pe,
|
|
855
|
+
section: Ne
|
|
841
856
|
};
|
|
842
857
|
//#endregion
|
|
843
858
|
//#region src/report/sectionComponents.ts
|
|
844
859
|
function Z(e) {
|
|
845
860
|
return e?.cloneNode(!0) ?? null;
|
|
846
861
|
}
|
|
847
|
-
function
|
|
862
|
+
function Fe(e) {
|
|
848
863
|
return {
|
|
849
864
|
sectionHeader: Z(e.sectionHeader),
|
|
850
865
|
sectionFooter: Z(e.sectionFooter),
|
|
@@ -854,15 +869,56 @@ function Pe(e) {
|
|
|
854
869
|
};
|
|
855
870
|
}
|
|
856
871
|
//#endregion
|
|
857
|
-
//#region src/plugins/
|
|
858
|
-
var
|
|
872
|
+
//#region src/plugins/OrderedListPlugin.ts
|
|
873
|
+
var Ie = class {
|
|
874
|
+
_originalItemCount = /* @__PURE__ */ new Map();
|
|
875
|
+
name = "orderedList";
|
|
876
|
+
order = 1;
|
|
877
|
+
onClone = (e, t, n) => {
|
|
878
|
+
if (!this._isListItem(t) || !(n.clonedData.cloneCount > 1)) return;
|
|
879
|
+
let r = n.getNode();
|
|
880
|
+
r.style.listStyleType = "none";
|
|
881
|
+
let i = n.clonedData.clonedFrom?.getNode().parentElement, a = n.getOriginalNode().parentElement;
|
|
882
|
+
if (!i || !a || !this._isOrderedList(i) || !this._isOrderedList(a)) return;
|
|
883
|
+
let o = this._readRenderedItemCount(a, (e) => e === i);
|
|
884
|
+
this._setListItemCount(a, i, o - 1);
|
|
885
|
+
};
|
|
886
|
+
afterVisitNode = (e, t, n, r) => {
|
|
887
|
+
let i = r.getPageState().currentElement, a = i.getNode();
|
|
888
|
+
if (!this._isOrderedList(a)) return;
|
|
889
|
+
let o = i.getOriginalNode(), s = this._readRenderedItemCount(o, (e) => e !== a);
|
|
890
|
+
a.start = o.start + s;
|
|
891
|
+
let c = this._getListItemCount(a);
|
|
892
|
+
this._setListItemCount(o, a, c);
|
|
893
|
+
};
|
|
894
|
+
beforePagination = () => {
|
|
895
|
+
this._originalItemCount.clear();
|
|
896
|
+
};
|
|
897
|
+
_isListItem(e) {
|
|
898
|
+
return e.tagName === "LI";
|
|
899
|
+
}
|
|
900
|
+
_isOrderedList(e) {
|
|
901
|
+
return e.tagName === "OL";
|
|
902
|
+
}
|
|
903
|
+
_setListItemCount(e, t, n) {
|
|
904
|
+
let r = this._originalItemCount.get(e) ?? /* @__PURE__ */ new Map();
|
|
905
|
+
r.set(t, n), this._originalItemCount.set(e, r);
|
|
906
|
+
}
|
|
907
|
+
_readRenderedItemCount(e, t) {
|
|
908
|
+
let n = this._originalItemCount.get(e);
|
|
909
|
+
return n ? [...n.entries()].filter((e) => t(e[0])).reduce((e, t) => e + t[1], 0) : 0;
|
|
910
|
+
}
|
|
911
|
+
_getListItemCount(e) {
|
|
912
|
+
return [...e.children].filter((e) => this._isListItem(e)).length;
|
|
913
|
+
}
|
|
914
|
+
}, Le = `${y}page-break`, Re = class {
|
|
859
915
|
name = "pageBreak";
|
|
860
916
|
order = 1;
|
|
861
917
|
onVisitElement = (e, t, n, r) => {
|
|
862
|
-
let i = t.currentNode.getNode().getAttribute(
|
|
863
|
-
(i === "true" || i === "") && (n.markPageAsFull(), r.result =
|
|
918
|
+
let i = t.currentNode.getNode().getAttribute(Le);
|
|
919
|
+
(i === "true" || i === "") && (n.markPageAsFull(), r.result = V.FullNodePlaced);
|
|
864
920
|
};
|
|
865
|
-
},
|
|
921
|
+
}, ze = class {
|
|
866
922
|
_options = {};
|
|
867
923
|
name = "table";
|
|
868
924
|
order = 1;
|
|
@@ -872,31 +928,31 @@ var Fe = `${y}page-break`, Ie = class {
|
|
|
872
928
|
onNewPage = (e, t) => {
|
|
873
929
|
if (this._options.includeHeaderOnlyTables) return;
|
|
874
930
|
let n = t.getPageState().parentStack.find((e) => this._isTable(e.getNode()));
|
|
875
|
-
if (!n || !n.clonedFrom) return;
|
|
876
|
-
let r = n.clonedFrom, i = r.getNode(), a = i.tHead;
|
|
931
|
+
if (!n || !n.clonedData.clonedFrom) return;
|
|
932
|
+
let r = n.clonedData.clonedFrom, i = r.getNode(), a = i.tHead;
|
|
877
933
|
if (a === null) return;
|
|
878
934
|
let o = i.tBodies;
|
|
879
935
|
if (this._isTableBodyEmpty(o) && (r.remove(), n.getNode().tHead === null)) {
|
|
880
|
-
let e =
|
|
936
|
+
let e = I(a.cloneNode(!0), n.transaction, n.config);
|
|
881
937
|
n.appendChild(e);
|
|
882
938
|
}
|
|
883
939
|
};
|
|
884
940
|
onVisitElement = (e, t, n, r) => {
|
|
885
941
|
let i = t.currentNode.getNode();
|
|
886
|
-
i.tagName === "TR" ? t.currentNode.config.keepOnSamePage =
|
|
942
|
+
i.tagName === "TR" ? t.currentNode.config.keepOnSamePage = "prefer" : (i.tagName === "TFOOT" && this._options.cloneFooter || i.tagName === "THEAD" && this._options.cloneHeader) && (r.result = V.FullNodePlaced);
|
|
887
943
|
};
|
|
888
944
|
onClone = (e, t, n) => {
|
|
889
|
-
if (!this._isTable(t) || !n.clonedFrom) return;
|
|
945
|
+
if (!this._isTable(t) || !n.clonedData.clonedFrom) return;
|
|
890
946
|
let r = n.getNode();
|
|
891
947
|
if (r.tHead || r.tFoot) return;
|
|
892
948
|
let i = n.getOriginalNode(), a = i.tHead;
|
|
893
949
|
if (a && this._options.cloneHeader === !0) {
|
|
894
|
-
let e = new
|
|
950
|
+
let e = new F(a.cloneNode(!0), n.transaction, n.config);
|
|
895
951
|
n.appendChild(e);
|
|
896
952
|
}
|
|
897
953
|
let o = i.tFoot;
|
|
898
954
|
if (o && this._options.cloneFooter === !0) {
|
|
899
|
-
let e = new
|
|
955
|
+
let e = new F(o.cloneNode(!0), n.transaction, n.config);
|
|
900
956
|
n.appendChild(e);
|
|
901
957
|
}
|
|
902
958
|
};
|
|
@@ -911,15 +967,19 @@ var Fe = `${y}page-break`, Ie = class {
|
|
|
911
967
|
let n = t.rows[0];
|
|
912
968
|
return n.cells.length === 0 ? !0 : n.cells.length > 1 ? !1 : n.cells[0].textContent?.trim().length === 0;
|
|
913
969
|
}
|
|
914
|
-
},
|
|
970
|
+
}, Be = [
|
|
971
|
+
new Re(),
|
|
972
|
+
new ze(),
|
|
973
|
+
new Ie()
|
|
974
|
+
], Ve = {
|
|
915
975
|
name: "debug",
|
|
916
976
|
order: 2 ** 53 - 1,
|
|
917
977
|
onNewPage: (e, t) => {
|
|
918
978
|
let n = t.getPageState().currentPage.getNode();
|
|
919
979
|
n.classList.contains("pz-page") || n.classList.add(g), n.setAttribute(`${y}-element`, "page"), n.setAttribute(`${y}-height`, t.getPageState().pageHeight.toString());
|
|
920
980
|
}
|
|
921
|
-
},
|
|
922
|
-
name =
|
|
981
|
+
}, He = "sectionToc", Ue = class {
|
|
982
|
+
name = He;
|
|
923
983
|
order = 1;
|
|
924
984
|
_state = /* @__PURE__ */ new Map();
|
|
925
985
|
getContentList = () => Array.from(this._state.values()).flat();
|
|
@@ -943,7 +1003,7 @@ var Fe = `${y}page-break`, Ie = class {
|
|
|
943
1003
|
let t = e.tagName;
|
|
944
1004
|
return /^H[1-6]$/.test(t) ? parseInt(t.charAt(1), 10) : null;
|
|
945
1005
|
}
|
|
946
|
-
},
|
|
1006
|
+
}, Q = class e {
|
|
947
1007
|
_promises;
|
|
948
1008
|
monitor;
|
|
949
1009
|
constructor() {
|
|
@@ -988,10 +1048,10 @@ var Fe = `${y}page-break`, Ie = class {
|
|
|
988
1048
|
};
|
|
989
1049
|
//#endregion
|
|
990
1050
|
//#region src/utils.ts
|
|
991
|
-
function
|
|
1051
|
+
function We(e, t) {
|
|
992
1052
|
return `${e}-${t + 1}`;
|
|
993
1053
|
}
|
|
994
|
-
function
|
|
1054
|
+
function Ge(e, t) {
|
|
995
1055
|
return t === "landscape" ? {
|
|
996
1056
|
height: e.width,
|
|
997
1057
|
width: e.height
|
|
@@ -999,7 +1059,7 @@ function We(e, t) {
|
|
|
999
1059
|
}
|
|
1000
1060
|
//#endregion
|
|
1001
1061
|
//#region src/report/ReportBuilder.ts
|
|
1002
|
-
var
|
|
1062
|
+
var $ = "\x1B[43mREPORT\x1B[0m", Ke = class {
|
|
1003
1063
|
_sections;
|
|
1004
1064
|
_monitor;
|
|
1005
1065
|
_paginationInProgress;
|
|
@@ -1024,7 +1084,7 @@ var Q = "\x1B[43mREPORT\x1B[0m", Ge = class {
|
|
|
1024
1084
|
pages: [],
|
|
1025
1085
|
options: {
|
|
1026
1086
|
...e,
|
|
1027
|
-
size:
|
|
1087
|
+
size: Ge(e.size, e.orientation ?? "portrait")
|
|
1028
1088
|
},
|
|
1029
1089
|
components: t
|
|
1030
1090
|
};
|
|
@@ -1037,7 +1097,7 @@ var Q = "\x1B[43mREPORT\x1B[0m", Ge = class {
|
|
|
1037
1097
|
return this._sections.size === 0 ? (window[Y] = !0, {
|
|
1038
1098
|
sections: [],
|
|
1039
1099
|
suspension: Promise.resolve()
|
|
1040
|
-
}) : (this._paginationInProgress && this._currentAbortController && (x.debug(
|
|
1100
|
+
}) : (this._paginationInProgress && this._currentAbortController && (x.debug($, "Cancelling previous pagination operation."), this._currentAbortController.abort("Cancelled by new paginate call")), this._paginationInProgress ? new Promise((e, t) => {
|
|
1041
1101
|
this._pendingPaginateResolvers.push({
|
|
1042
1102
|
resolve: e,
|
|
1043
1103
|
reject: t
|
|
@@ -1047,12 +1107,12 @@ var Q = "\x1B[43mREPORT\x1B[0m", Ge = class {
|
|
|
1047
1107
|
async getJsonData(e) {
|
|
1048
1108
|
return await this._lazyJsonDataReader().catch(() => e) ?? e ?? null;
|
|
1049
1109
|
}
|
|
1050
|
-
_lazyJsonDataReader =
|
|
1110
|
+
_lazyJsonDataReader = Te(Ee);
|
|
1051
1111
|
async _executePagination() {
|
|
1052
1112
|
this._paginationInProgress = !0, this._currentAbortController = new AbortController();
|
|
1053
1113
|
let e = this._currentAbortController.signal;
|
|
1054
1114
|
try {
|
|
1055
|
-
if (x.debug(
|
|
1115
|
+
if (x.debug($, "Schedule paginate."), await document.fonts.ready, e.aborted) return new Promise((e, t) => {
|
|
1056
1116
|
this._pendingPaginateResolvers.push({
|
|
1057
1117
|
resolve: e,
|
|
1058
1118
|
reject: t
|
|
@@ -1061,16 +1121,16 @@ var Q = "\x1B[43mREPORT\x1B[0m", Ge = class {
|
|
|
1061
1121
|
let t = [];
|
|
1062
1122
|
for (let n of this._sections.values()) {
|
|
1063
1123
|
n.context.isPaginated = !1;
|
|
1064
|
-
let r = new
|
|
1124
|
+
let r = new Q();
|
|
1065
1125
|
await r.add(n.context.options.suspense), r.monitor.addEventListener("onChange", (e) => {
|
|
1066
|
-
x.debug(
|
|
1126
|
+
x.debug($, `${e} pending promises in section '${n.context.sectionId}'.`);
|
|
1067
1127
|
}), r.then(async () => {
|
|
1068
|
-
e.aborted || (x.debug(
|
|
1128
|
+
e.aborted || (x.debug($, `Start paginating section '${n.context.sectionId}'.`), n.context.isSuspended = !1, await this._paginateSection(n));
|
|
1069
1129
|
}), t.push(r);
|
|
1070
1130
|
}
|
|
1071
|
-
let n = new
|
|
1131
|
+
let n = new Q();
|
|
1072
1132
|
return n.monitor.addEventListener("onChange", async () => {
|
|
1073
|
-
x.debug(
|
|
1133
|
+
x.debug($, "Report pagination completed."), await this._monitor.dispatch("paginationCycleCompleted", { sections: [...this._sections.values()].map((e) => e.context) });
|
|
1074
1134
|
}), e.aborted ? new Promise((e, t) => {
|
|
1075
1135
|
this._pendingPaginateResolvers.push({
|
|
1076
1136
|
resolve: e,
|
|
@@ -1088,7 +1148,7 @@ var Q = "\x1B[43mREPORT\x1B[0m", Ge = class {
|
|
|
1088
1148
|
}
|
|
1089
1149
|
async _processPendingPagination() {
|
|
1090
1150
|
if (this._pendingPaginateResolvers.length === 0) return;
|
|
1091
|
-
x.debug(
|
|
1151
|
+
x.debug($, `Processing ${this._pendingPaginateResolvers.length} pending paginate calls.`);
|
|
1092
1152
|
let e = [...this._pendingPaginateResolvers];
|
|
1093
1153
|
this._pendingPaginateResolvers = [];
|
|
1094
1154
|
let t = await this._executePagination();
|
|
@@ -1102,16 +1162,16 @@ var Q = "\x1B[43mREPORT\x1B[0m", Ge = class {
|
|
|
1102
1162
|
let t = document.createElement("div");
|
|
1103
1163
|
/* v8 ignore if -- @preserve */
|
|
1104
1164
|
Object.assign(t.style, X.page(e.context.options.size, e.context.options.margin ?? q.None)), C() || Object.assign(t.style, X.outOfScreen);
|
|
1105
|
-
let n =
|
|
1165
|
+
let n = Fe(e.context.components);
|
|
1106
1166
|
n.sectionHeader && (Object.assign(n.sectionHeader.style, X.component), t.appendChild(n.sectionHeader)), n.pageHeader && (Object.assign(n.pageHeader.style, X.component), t.appendChild(n.pageHeader)), Object.assign(n.pageContent.style, X.pageContent), t.appendChild(n.pageContent), n.pageFooter && (Object.assign(n.pageFooter.style, X.component), t.appendChild(n.pageFooter)), n.sectionFooter && (Object.assign(n.sectionFooter.style, X.component), t.appendChild(n.sectionFooter)), document.body.appendChild(t);
|
|
1107
|
-
let { height: r, width: i, sectionHeaderHeight: a, sectionFooterHeight: o } =
|
|
1167
|
+
let { height: r, width: i, sectionHeaderHeight: a, sectionFooterHeight: o } = Se(n.pageContent, n.sectionHeader, n.sectionFooter);
|
|
1108
1168
|
if (r === 0) throw x.error(`Pagination failed for section '${e.context.sectionId}': 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.`), t.remove(), Error(`Pagination failed: no available space for content in section '${e.context.sectionId}'.`);
|
|
1109
1169
|
let s = G.paginate(n.pageContent, {
|
|
1110
1170
|
height: r,
|
|
1111
1171
|
width: i
|
|
1112
1172
|
}, {
|
|
1113
1173
|
id: e.context.sectionId,
|
|
1114
|
-
plugins: [...e.context.options.plugins ??
|
|
1174
|
+
plugins: [...e.context.options.plugins ?? Be, Ce(r, a, o)]
|
|
1115
1175
|
});
|
|
1116
1176
|
t.remove();
|
|
1117
1177
|
let c = s.map((t, n) => ({
|
|
@@ -1132,17 +1192,17 @@ var Q = "\x1B[43mREPORT\x1B[0m", Ge = class {
|
|
|
1132
1192
|
for (let e of c) await this._monitor.dispatch("pageCompleted", e);
|
|
1133
1193
|
await this._monitor.dispatch("sectionCompleted", l);
|
|
1134
1194
|
}
|
|
1135
|
-
},
|
|
1136
|
-
function
|
|
1195
|
+
}, qe = /* @__PURE__ */ "ad.adipisicing.aliqua.aliquip.amet.anim.aute.cillum.commodo.consectetur.consequat.culpa.cupidatat.deserunt.do.dolor.dolore.duis.ea.eiusmod.elit.enim.esse.est.et.eu.ex.excepteur.exercitation.fugiat.id.in.incididunt.ipsum.irure.labore.laboris.laborum.Lorem.magna.minim.mollit.nisi.non.nostrud.nulla.occaecat.officia.pariatur.proident.qui.quis.reprehenderit.sint.sit.sunt.tempor.ullamco.ut.velit.veniam.voluptate".split(".");
|
|
1196
|
+
function Je(e, t) {
|
|
1137
1197
|
if (e <= 0) return "";
|
|
1138
1198
|
let n = [], r = Math.floor(t * 982451653);
|
|
1139
1199
|
for (let t = 0; t < e; t++) {
|
|
1140
|
-
let e = (r + t * 2654435761) % 2 ** 32, i = Math.floor(e / 2 ** 32 *
|
|
1141
|
-
n.push(
|
|
1200
|
+
let e = (r + t * 2654435761) % 2 ** 32, i = Math.floor(e / 2 ** 32 * qe.length);
|
|
1201
|
+
n.push(qe[i]);
|
|
1142
1202
|
}
|
|
1143
1203
|
return n.length > 0 && (n[0] = n[0].charAt(0).toUpperCase() + n[0].slice(1)), n.join(" ") + ".";
|
|
1144
1204
|
}
|
|
1145
1205
|
//#endregion
|
|
1146
|
-
export { K as EventDispatcher, Ie as PageBreakPlugin, G as Paginator,
|
|
1206
|
+
export { K as EventDispatcher, Ie as OrderedListPlugin, Re as PageBreakPlugin, G as Paginator, Ke as ReportBuilder, Ue as SectionTocPlugin, V as SplitResult, ze as TablePlugin, Ge as adjustPageSize, y as attributePrefix, We as buildPageId, Fe as cloneComponents, Je as createLoremIpsumParagraph, d as currentElementClassName, f as currentTextClassName, Ve as debugPlugin, Be as defaultPlugins, ee as enableDebugMode, A as getNodeLayoutOptionsFromAttribute, T as getVisibleHeight, De as globalStyle, h as globalStyleId, p as ignoredElementClassName, m as ignoredTextClassName, C as isDebugMode, w as isElement, te as isTextNode, re as layoutOptionHyphenAttribute, O as layoutOptionHyphenationDisabledAttribute, D as layoutOptionKeepOnSamePageAttribute, ae as layoutOptionsToAttributes, x as logger, l as loggerName, ne as moveOffscreen, Le as pageBreakAttributeName, g as pageClassName, q as pageMargin, ye as pageSize, J as paprize_isInitialized, Y as paprize_isReady, be as paprize_readJsonDataFile, v as previewClassName, X as reportStyles, _ as sectionClassName, He as sectionTocName, u as tempContainerClassName };
|
|
1147
1207
|
|
|
1148
1208
|
//# sourceMappingURL=paprize-core.js.map
|