vobi_document 1.1.1 → 1.1.3

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.
Files changed (39) hide show
  1. package/dist/blocks.cjs +25 -25
  2. package/dist/blocks.d.cts +2 -2
  3. package/dist/blocks.d.ts +2 -2
  4. package/dist/blocks.js +1 -1
  5. package/dist/{chunk-OJZJJEJX.js → chunk-7QF2U74X.js} +10 -5
  6. package/dist/chunk-7QF2U74X.js.map +1 -0
  7. package/dist/{chunk-3FTKM37U.cjs → chunk-CJFNHGYH.cjs} +14 -14
  8. package/dist/{chunk-3FTKM37U.cjs.map → chunk-CJFNHGYH.cjs.map} +1 -1
  9. package/dist/{chunk-RO3Y2MSU.cjs → chunk-GWSTB65K.cjs} +16 -16
  10. package/dist/{chunk-RO3Y2MSU.cjs.map → chunk-GWSTB65K.cjs.map} +1 -1
  11. package/dist/{chunk-26DSIOEY.cjs → chunk-HANC7MNV.cjs} +8 -8
  12. package/dist/{chunk-26DSIOEY.cjs.map → chunk-HANC7MNV.cjs.map} +1 -1
  13. package/dist/{chunk-RZOR3HOA.cjs → chunk-KQDH7LRX.cjs} +10 -5
  14. package/dist/chunk-KQDH7LRX.cjs.map +1 -0
  15. package/dist/{chunk-PLQNNXS2.js → chunk-OUSXJTQ5.js} +21 -4
  16. package/dist/chunk-OUSXJTQ5.js.map +1 -0
  17. package/dist/{chunk-M6FQVH76.js → chunk-QBNPQGAL.js} +3 -3
  18. package/dist/{chunk-M6FQVH76.js.map → chunk-QBNPQGAL.js.map} +1 -1
  19. package/dist/{chunk-ERKU5FDV.cjs → chunk-S3FCX5TC.cjs} +21 -3
  20. package/dist/chunk-S3FCX5TC.cjs.map +1 -0
  21. package/dist/{chunk-JYSA6IM5.js → chunk-XHKS4BTC.js} +3 -3
  22. package/dist/{chunk-JYSA6IM5.js.map → chunk-XHKS4BTC.js.map} +1 -1
  23. package/dist/{chunk-W52ULJCW.js → chunk-Z3SAVLTS.js} +3 -3
  24. package/dist/{chunk-W52ULJCW.js.map → chunk-Z3SAVLTS.js.map} +1 -1
  25. package/dist/editor.cjs +14 -14
  26. package/dist/editor.js +2 -2
  27. package/dist/index.cjs +83 -83
  28. package/dist/index.js +6 -6
  29. package/dist/print.cjs +48 -16
  30. package/dist/print.cjs.map +1 -1
  31. package/dist/print.js +35 -3
  32. package/dist/print.js.map +1 -1
  33. package/dist/render.cjs +18 -18
  34. package/dist/render.js +3 -3
  35. package/package.json +1 -1
  36. package/dist/chunk-ERKU5FDV.cjs.map +0 -1
  37. package/dist/chunk-OJZJJEJX.js.map +0 -1
  38. package/dist/chunk-PLQNNXS2.js.map +0 -1
  39. package/dist/chunk-RZOR3HOA.cjs.map +0 -1
package/dist/print.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { devWarn } from './chunk-ZOJBDFKU.js';
2
- import { DG_MESSAGE_SOURCE, DG_READY, DG_ERROR, DocumentRenderer, CoverPage, HeaderBar, FooterBar } from './chunk-M6FQVH76.js';
3
- export { DG_ERROR, DG_MESSAGE_SOURCE, DG_READY } from './chunk-M6FQVH76.js';
4
- import { DEFAULT_PAGE_MARGINS, DEFAULT_DOCUMENT_COLORS, gfontHref } from './chunk-PLQNNXS2.js';
2
+ import { DG_MESSAGE_SOURCE, DG_READY, DG_ERROR, DocumentRenderer, CoverPage, HeaderBar, FooterBar } from './chunk-QBNPQGAL.js';
3
+ export { DG_ERROR, DG_MESSAGE_SOURCE, DG_READY } from './chunk-QBNPQGAL.js';
4
+ import { DEFAULT_PAGE_MARGINS, DEFAULT_DOCUMENT_COLORS, pageWidthPx, pageHeightPx, gfontHref } from './chunk-OUSXJTQ5.js';
5
5
  import './chunk-CZB7F2LA.js';
6
6
  import './chunk-SOIYSSU3.js';
7
7
  import { createElement, Fragment } from 'react';
@@ -116,6 +116,8 @@ function buildPageCss(theme = {}, opts = {}) {
116
116
  padding: 0;
117
117
  }`);
118
118
  parts.push(`${noCutBlocks.map((key) => `[data-docgen-block="${key}"]`).join(",\n")} { break-inside: avoid; }`);
119
+ const pageH = theme.page?.orientation === "landscape" ? pageWidthPx(format) : pageHeightPx(format);
120
+ parts.push(`:where([data-docgen-block]) img { max-height: ${pageH - top - bottom}px; object-fit: contain; }`);
119
121
  parts.push(`[data-docgen-block="PageBreak"] { break-after: page; }
120
122
  [data-docgen-block] { orphans: 2; widows: 2; }
121
123
  .dg-no-break { break-inside: avoid; }
@@ -198,6 +200,35 @@ var REPEAT_TABLE_HEADERS = `(function () {
198
200
  window.Paged.registerHandlers(RepeatingTableHeaders);
199
201
  })();`;
200
202
 
203
+ // src/render/undisplayedFix.ts
204
+ var UNDISPLAYED_FIX = `(function () {
205
+ var handlers = window.Paged && window.Paged.registeredHandlers;
206
+ if (!handlers) return;
207
+
208
+ handlers.forEach(function (Handler) {
209
+ var proto = Handler && Handler.prototype;
210
+ if (!proto || typeof proto.filter !== 'function' || typeof proto.sortDisplayedSelectors !== 'function') return;
211
+
212
+ proto.filter = function (content) {
213
+ var sorted = this.sortDisplayedSelectors(content, this.displayRules);
214
+ var matches = sorted.matches;
215
+ var selectors = sorted.selectors;
216
+
217
+ for (var i = 0; i < matches.length; i++) {
218
+ var selector = selectors[i];
219
+ if (this.removable(matches[i]) && selector[selector.length - 1].value === 'none') {
220
+ matches[i].dataset.undisplayed = 'undisplayed';
221
+ }
222
+ }
223
+
224
+ var styled = content.querySelectorAll('[style]');
225
+ for (var j = 0; j < styled.length; j++) {
226
+ if (styled[j].style.display === 'none') styled[j].dataset.undisplayed = 'undisplayed';
227
+ }
228
+ };
229
+ });
230
+ })();`;
231
+
201
232
  // src/render/previewBootstrap.ts
202
233
  var ASSET_TIMEOUT_MS = 5e3;
203
234
  var PREVIEW_BOOTSTRAP = `(function () {
@@ -323,6 +354,7 @@ function buildDocumentHtml(opts) {
323
354
  "<style>body { margin: 0; background: #E8E9EB; } .pagedjs_page { box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18); margin: 16px auto; }</style>",
324
355
  "<script>window.PagedConfig = { auto: false };</script>",
325
356
  `<script>${PAGEDJS_SOURCE}</script>`,
357
+ `<script>${UNDISPLAYED_FIX}</script>`,
326
358
  `<script>${REPEAT_TABLE_HEADERS}</script>`,
327
359
  `<script>${PREVIEW_BOOTSTRAP}</script>`,
328
360
  "</head>",