vobi_document 1.1.1 → 1.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/dist/{chunk-ERKU5FDV.cjs → chunk-2VZW2MGO.cjs} +20 -2
- package/dist/chunk-2VZW2MGO.cjs.map +1 -0
- package/dist/{chunk-RO3Y2MSU.cjs → chunk-A427FKMP.cjs} +16 -16
- package/dist/{chunk-RO3Y2MSU.cjs.map → chunk-A427FKMP.cjs.map} +1 -1
- package/dist/{chunk-M6FQVH76.js → chunk-BEG6KN5X.js} +3 -3
- package/dist/{chunk-M6FQVH76.js.map → chunk-BEG6KN5X.js.map} +1 -1
- package/dist/{chunk-3FTKM37U.cjs → chunk-KALUNX3C.cjs} +14 -14
- package/dist/{chunk-3FTKM37U.cjs.map → chunk-KALUNX3C.cjs.map} +1 -1
- package/dist/{chunk-PLQNNXS2.js → chunk-QEWDIL2H.js} +20 -3
- package/dist/chunk-QEWDIL2H.js.map +1 -0
- package/dist/{chunk-JYSA6IM5.js → chunk-QRVQXVZC.js} +3 -3
- package/dist/{chunk-JYSA6IM5.js.map → chunk-QRVQXVZC.js.map} +1 -1
- package/dist/{chunk-W52ULJCW.js → chunk-QU6XF6OQ.js} +3 -3
- package/dist/{chunk-W52ULJCW.js.map → chunk-QU6XF6OQ.js.map} +1 -1
- package/dist/{chunk-26DSIOEY.cjs → chunk-SFKH6QYD.cjs} +8 -8
- package/dist/{chunk-26DSIOEY.cjs.map → chunk-SFKH6QYD.cjs.map} +1 -1
- package/dist/editor.cjs +14 -14
- package/dist/editor.js +2 -2
- package/dist/index.cjs +58 -58
- package/dist/index.js +5 -5
- package/dist/print.cjs +48 -16
- package/dist/print.cjs.map +1 -1
- package/dist/print.js +35 -3
- package/dist/print.js.map +1 -1
- package/dist/render.cjs +18 -18
- package/dist/render.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-ERKU5FDV.cjs.map +0 -1
- package/dist/chunk-PLQNNXS2.js.map +0 -1
package/dist/print.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkLNBAFOVK_cjs = require('./chunk-LNBAFOVK.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkA427FKMP_cjs = require('./chunk-A427FKMP.cjs');
|
|
5
|
+
var chunk2VZW2MGO_cjs = require('./chunk-2VZW2MGO.cjs');
|
|
6
6
|
require('./chunk-QJ5W5EED.cjs');
|
|
7
7
|
require('./chunk-SP5LCPDG.cjs');
|
|
8
8
|
var react = require('react');
|
|
@@ -29,7 +29,7 @@ function footerHeightPx(theme = {}) {
|
|
|
29
29
|
var DEFAULT_NO_CUT_BLOCKS = ["Image", "Button", "Divider", "IconText", "ImageGrid", "ImageText"];
|
|
30
30
|
function buildPageCss(theme = {}, opts = {}) {
|
|
31
31
|
const noCutBlocks = opts.noCutBlockKeys ?? DEFAULT_NO_CUT_BLOCKS;
|
|
32
|
-
const margins = { ...
|
|
32
|
+
const margins = { ...chunk2VZW2MGO_cjs.DEFAULT_PAGE_MARGINS, ...theme.page?.margins };
|
|
33
33
|
const format = theme.page?.format ?? "A4";
|
|
34
34
|
const size = theme.page?.orientation === "landscape" ? `${format} landscape` : format;
|
|
35
35
|
const hasHeader = Boolean(theme.header?.enabled);
|
|
@@ -39,7 +39,7 @@ function buildPageCss(theme = {}, opts = {}) {
|
|
|
39
39
|
const hasCover = Boolean(opts.hasCover);
|
|
40
40
|
const headerH = headerHeightPx(theme);
|
|
41
41
|
const footerH = footerHeightPx(theme);
|
|
42
|
-
const pageBg = theme.colors?.background ??
|
|
42
|
+
const pageBg = theme.colors?.background ?? chunk2VZW2MGO_cjs.DEFAULT_DOCUMENT_COLORS.background;
|
|
43
43
|
const top = hasHeader ? headerH + CONTENT_GAP_PX : margins.top;
|
|
44
44
|
const numberBase = hasFooter ? footerH : margins.bottom;
|
|
45
45
|
const bottom = hasFooterBox ? numberBase + NUMBER_STRIP_PX : margins.bottom;
|
|
@@ -98,7 +98,7 @@ function buildPageCss(theme = {}, opts = {}) {
|
|
|
98
98
|
font-size: 12px;
|
|
99
99
|
font-weight: 500;
|
|
100
100
|
line-height: 18px;
|
|
101
|
-
color: ${theme.colors?.text ??
|
|
101
|
+
color: ${theme.colors?.text ?? chunk2VZW2MGO_cjs.DEFAULT_DOCUMENT_COLORS.text};
|
|
102
102
|
}`);
|
|
103
103
|
}
|
|
104
104
|
if (hasFooter) {
|
|
@@ -117,6 +117,8 @@ function buildPageCss(theme = {}, opts = {}) {
|
|
|
117
117
|
padding: 0;
|
|
118
118
|
}`);
|
|
119
119
|
parts.push(`${noCutBlocks.map((key) => `[data-docgen-block="${key}"]`).join(",\n")} { break-inside: avoid; }`);
|
|
120
|
+
const pageH = theme.page?.orientation === "landscape" ? chunk2VZW2MGO_cjs.pageWidthPx(format) : chunk2VZW2MGO_cjs.pageHeightPx(format);
|
|
121
|
+
parts.push(`:where([data-docgen-block]) img { max-height: ${pageH - top - bottom}px; object-fit: contain; }`);
|
|
120
122
|
parts.push(`[data-docgen-block="PageBreak"] { break-after: page; }
|
|
121
123
|
[data-docgen-block] { orphans: 2; widows: 2; }
|
|
122
124
|
.dg-no-break { break-inside: avoid; }
|
|
@@ -199,12 +201,41 @@ var REPEAT_TABLE_HEADERS = `(function () {
|
|
|
199
201
|
window.Paged.registerHandlers(RepeatingTableHeaders);
|
|
200
202
|
})();`;
|
|
201
203
|
|
|
204
|
+
// src/render/undisplayedFix.ts
|
|
205
|
+
var UNDISPLAYED_FIX = `(function () {
|
|
206
|
+
var handlers = window.Paged && window.Paged.registeredHandlers;
|
|
207
|
+
if (!handlers) return;
|
|
208
|
+
|
|
209
|
+
handlers.forEach(function (Handler) {
|
|
210
|
+
var proto = Handler && Handler.prototype;
|
|
211
|
+
if (!proto || typeof proto.filter !== 'function' || typeof proto.sortDisplayedSelectors !== 'function') return;
|
|
212
|
+
|
|
213
|
+
proto.filter = function (content) {
|
|
214
|
+
var sorted = this.sortDisplayedSelectors(content, this.displayRules);
|
|
215
|
+
var matches = sorted.matches;
|
|
216
|
+
var selectors = sorted.selectors;
|
|
217
|
+
|
|
218
|
+
for (var i = 0; i < matches.length; i++) {
|
|
219
|
+
var selector = selectors[i];
|
|
220
|
+
if (this.removable(matches[i]) && selector[selector.length - 1].value === 'none') {
|
|
221
|
+
matches[i].dataset.undisplayed = 'undisplayed';
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
var styled = content.querySelectorAll('[style]');
|
|
226
|
+
for (var j = 0; j < styled.length; j++) {
|
|
227
|
+
if (styled[j].style.display === 'none') styled[j].dataset.undisplayed = 'undisplayed';
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
});
|
|
231
|
+
})();`;
|
|
232
|
+
|
|
202
233
|
// src/render/previewBootstrap.ts
|
|
203
234
|
var ASSET_TIMEOUT_MS = 5e3;
|
|
204
235
|
var PREVIEW_BOOTSTRAP = `(function () {
|
|
205
236
|
function send(type, detail) {
|
|
206
237
|
if (window.parent && window.parent !== window) {
|
|
207
|
-
window.parent.postMessage({ source: '${
|
|
238
|
+
window.parent.postMessage({ source: '${chunkA427FKMP_cjs.DG_MESSAGE_SOURCE}', type: type, detail: detail || null }, '*');
|
|
208
239
|
}
|
|
209
240
|
}
|
|
210
241
|
function waitAssets() {
|
|
@@ -219,8 +250,8 @@ var PREVIEW_BOOTSTRAP = `(function () {
|
|
|
219
250
|
function run() {
|
|
220
251
|
waitAssets()
|
|
221
252
|
.then(function () { return window.PagedPolyfill.preview(); })
|
|
222
|
-
.then(function () { send('${
|
|
223
|
-
['catch'](function (err) { send('${
|
|
253
|
+
.then(function () { send('${chunkA427FKMP_cjs.DG_READY}'); })
|
|
254
|
+
['catch'](function (err) { send('${chunkA427FKMP_cjs.DG_ERROR}', String((err && err.message) || err)); });
|
|
224
255
|
}
|
|
225
256
|
if (document.readyState === 'loading') {
|
|
226
257
|
document.addEventListener('DOMContentLoaded', run);
|
|
@@ -255,7 +286,7 @@ var collectFontHrefs = (data, theme) => {
|
|
|
255
286
|
const fontFamily = item?.props?.appearance?.fontFamily;
|
|
256
287
|
if (fontFamily) ids.add(fontFamily);
|
|
257
288
|
});
|
|
258
|
-
return [...ids].map((id) =>
|
|
289
|
+
return [...ids].map((id) => chunk2VZW2MGO_cjs.gfontHref(id)).filter((href) => Boolean(href));
|
|
259
290
|
};
|
|
260
291
|
var renderBody = (opts) => {
|
|
261
292
|
const sheet = new styledComponents.ServerStyleSheet();
|
|
@@ -263,7 +294,7 @@ var renderBody = (opts) => {
|
|
|
263
294
|
const [first, ...rest] = opts.data.content ?? [];
|
|
264
295
|
const coverBlock = first?.type === (opts.coverBlockKey ?? DEFAULT_COVER_BLOCK_KEY) ? first : null;
|
|
265
296
|
const contentData = coverBlock ? { ...opts.data, content: rest } : opts.data;
|
|
266
|
-
const documentRenderer = react.createElement(
|
|
297
|
+
const documentRenderer = react.createElement(chunkA427FKMP_cjs.DocumentRenderer, {
|
|
267
298
|
registry: opts.registry,
|
|
268
299
|
data: contentData,
|
|
269
300
|
theme: opts.theme,
|
|
@@ -278,7 +309,7 @@ var renderBody = (opts) => {
|
|
|
278
309
|
react.createElement(
|
|
279
310
|
react.Fragment,
|
|
280
311
|
null,
|
|
281
|
-
coverBlock ? react.createElement(
|
|
312
|
+
coverBlock ? react.createElement(chunkA427FKMP_cjs.CoverPage, {
|
|
282
313
|
templateId: coverProps?.templateId,
|
|
283
314
|
accent: coverProps?.accent,
|
|
284
315
|
fields: coverProps?.fields,
|
|
@@ -286,13 +317,13 @@ var renderBody = (opts) => {
|
|
|
286
317
|
textColor: coverProps?.textColor,
|
|
287
318
|
bgColor: coverProps?.bgColor
|
|
288
319
|
}) : null,
|
|
289
|
-
react.createElement(
|
|
320
|
+
react.createElement(chunkA427FKMP_cjs.HeaderBar, {
|
|
290
321
|
config: opts.theme?.header,
|
|
291
322
|
companyInfo: opts.companyInfo,
|
|
292
323
|
logoUrl: opts.theme?.logo?.url,
|
|
293
324
|
documentFont: opts.theme?.documentFont
|
|
294
325
|
}),
|
|
295
|
-
react.createElement(
|
|
326
|
+
react.createElement(chunkA427FKMP_cjs.FooterBar, {
|
|
296
327
|
config: opts.theme?.footer,
|
|
297
328
|
companyInfo: opts.companyInfo,
|
|
298
329
|
documentFont: opts.theme?.documentFont
|
|
@@ -324,6 +355,7 @@ function buildDocumentHtml(opts) {
|
|
|
324
355
|
"<style>body { margin: 0; background: #E8E9EB; } .pagedjs_page { box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18); margin: 16px auto; }</style>",
|
|
325
356
|
"<script>window.PagedConfig = { auto: false };</script>",
|
|
326
357
|
`<script>${PAGEDJS_SOURCE}</script>`,
|
|
358
|
+
`<script>${UNDISPLAYED_FIX}</script>`,
|
|
327
359
|
`<script>${REPEAT_TABLE_HEADERS}</script>`,
|
|
328
360
|
`<script>${PREVIEW_BOOTSTRAP}</script>`,
|
|
329
361
|
"</head>",
|
|
@@ -334,15 +366,15 @@ function buildDocumentHtml(opts) {
|
|
|
334
366
|
|
|
335
367
|
Object.defineProperty(exports, "DG_ERROR", {
|
|
336
368
|
enumerable: true,
|
|
337
|
-
get: function () { return
|
|
369
|
+
get: function () { return chunkA427FKMP_cjs.DG_ERROR; }
|
|
338
370
|
});
|
|
339
371
|
Object.defineProperty(exports, "DG_MESSAGE_SOURCE", {
|
|
340
372
|
enumerable: true,
|
|
341
|
-
get: function () { return
|
|
373
|
+
get: function () { return chunkA427FKMP_cjs.DG_MESSAGE_SOURCE; }
|
|
342
374
|
});
|
|
343
375
|
Object.defineProperty(exports, "DG_READY", {
|
|
344
376
|
enumerable: true,
|
|
345
|
-
get: function () { return
|
|
377
|
+
get: function () { return chunkA427FKMP_cjs.DG_READY; }
|
|
346
378
|
});
|
|
347
379
|
exports.DEFAULT_COVER_BLOCK_KEY = DEFAULT_COVER_BLOCK_KEY;
|
|
348
380
|
exports.DEFAULT_NO_CUT_BLOCKS = DEFAULT_NO_CUT_BLOCKS;
|