@bendyline/squisq-formats 2.8.8 → 2.8.9

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 (35) hide show
  1. package/dist/chunk-4LIFEQKX.js +358 -0
  2. package/dist/{chunk-UXEANVBI.js → chunk-5HUHSLGA.js} +1 -84
  3. package/dist/{chunk-6ALSRHD7.js → chunk-6HUQFEP3.js} +61 -4
  4. package/dist/{chunk-BXWNU4T5.js → chunk-DTJQK7U7.js} +43 -0
  5. package/dist/{chunk-QU4EVC62.js → chunk-GFHUJ7L4.js} +1 -1
  6. package/dist/{chunk-TMOXUUTG.js → chunk-NQNIFIDP.js} +6 -4
  7. package/dist/{chunk-LK4KCVN6.js → chunk-SZ3OIY6G.js} +150 -28
  8. package/dist/{chunk-KROH7FNT.js → chunk-VKLJUHC2.js} +6 -4
  9. package/dist/{chunk-GDUZJ75A.js → chunk-WVDAFJFS.js} +59 -21
  10. package/dist/chunk-YRFBWYAD.js +128 -0
  11. package/dist/{chunk-SVYTUYZM.js → chunk-ZJERBWTB.js} +6 -4
  12. package/dist/data/index.d.ts +27 -5
  13. package/dist/data/index.js +6 -2
  14. package/dist/diagrams/index.d.ts +19 -8
  15. package/dist/diagrams/index.js +7 -242
  16. package/dist/docx/index.d.ts +1 -1
  17. package/dist/docx/index.js +3 -3
  18. package/dist/epub/index.d.ts +1 -1
  19. package/dist/epub/index.js +3 -3
  20. package/dist/fontAwesome-C6FRDYTY.js +14 -0
  21. package/dist/html/index.d.ts +85 -1
  22. package/dist/html/index.js +9 -4
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.js +10 -9
  25. package/dist/{materialize-G4WC5UG3.js → materialize-ICXNO4S4.js} +4 -1
  26. package/dist/outside-in/index.d.ts +12 -0
  27. package/dist/outside-in/index.js +2 -2
  28. package/dist/pdf/index.d.ts +1 -1
  29. package/dist/pdf/index.js +3 -3
  30. package/dist/plainHtmlIcons-KBSIJ5EN.js +62 -0
  31. package/dist/pptx/index.js +2 -2
  32. package/dist/readers-3P5A6A2A.js +17 -0
  33. package/dist/registry/index.js +1 -1
  34. package/package.json +2 -2
  35. /package/dist/{chunk-LBXBRFBZ.js → chunk-DDMPZZJF.js} +0 -0
package/dist/index.js CHANGED
@@ -5,11 +5,11 @@ import {
5
5
  htmlToMarkdown,
6
6
  htmlToMarkdownDoc,
7
7
  htmlToMarkdownDocSync
8
- } from "./chunk-LK4KCVN6.js";
8
+ } from "./chunk-SZ3OIY6G.js";
9
9
  import {
10
10
  docToEpub,
11
11
  markdownDocToEpub
12
- } from "./chunk-SVYTUYZM.js";
12
+ } from "./chunk-ZJERBWTB.js";
13
13
  import {
14
14
  BUILTIN_FORMAT_IDS
15
15
  } from "./chunk-2P5HJAQL.js";
@@ -29,7 +29,7 @@ import {
29
29
  renderOutsideInDocument,
30
30
  withOutsideInMarkdownEditing,
31
31
  withOutsideInMetadata
32
- } from "./chunk-6ALSRHD7.js";
32
+ } from "./chunk-6HUQFEP3.js";
33
33
  import {
34
34
  DEFAULT_CONVERSION_LIMITS,
35
35
  convert,
@@ -38,7 +38,7 @@ import {
38
38
  defaultRegistry,
39
39
  prepareConversion,
40
40
  resolveConversionLimits
41
- } from "./chunk-GDUZJ75A.js";
41
+ } from "./chunk-WVDAFJFS.js";
42
42
  import {
43
43
  ConversionError
44
44
  } from "./chunk-KXOZMWBS.js";
@@ -49,18 +49,19 @@ import {
49
49
  isOutsideInTargetPath,
50
50
  resolveOutsideInLayout
51
51
  } from "./chunk-WJTC5OD6.js";
52
+ import "./chunk-4LIFEQKX.js";
52
53
  import {
53
54
  docToDocx,
54
55
  docxToDoc,
55
56
  docxToMarkdownDoc,
56
57
  markdownDocToDocx
57
- } from "./chunk-KROH7FNT.js";
58
+ } from "./chunk-VKLJUHC2.js";
58
59
  import {
59
60
  docToPptx,
60
61
  markdownDocToPptx,
61
62
  pptxToDoc,
62
63
  pptxToMarkdownDoc
63
- } from "./chunk-QU4EVC62.js";
64
+ } from "./chunk-GFHUJ7L4.js";
64
65
  import "./chunk-6N2J7C2B.js";
65
66
  import "./chunk-WMIDXNGR.js";
66
67
  import "./chunk-DHAK4PII.js";
@@ -96,11 +97,11 @@ import {
96
97
  markdownDocToPdf,
97
98
  pdfToDoc,
98
99
  pdfToMarkdownDoc
99
- } from "./chunk-TMOXUUTG.js";
100
+ } from "./chunk-NQNIFIDP.js";
100
101
  import "./chunk-34KECNZO.js";
101
- import "./chunk-BXWNU4T5.js";
102
+ import "./chunk-DTJQK7U7.js";
102
103
  import "./chunk-IIQYS2YH.js";
103
- import "./chunk-LBXBRFBZ.js";
104
+ import "./chunk-DDMPZZJF.js";
104
105
  import "./chunk-JZR32FON.js";
105
106
  export {
106
107
  BUILTIN_FORMAT_IDS,
@@ -1,11 +1,14 @@
1
1
  import {
2
+ DATA_PREVIEW_ROWS,
2
3
  materializeDataReferences
3
- } from "./chunk-UXEANVBI.js";
4
+ } from "./chunk-YRFBWYAD.js";
5
+ import "./chunk-5HUHSLGA.js";
4
6
  import "./chunk-ATWVNF7D.js";
5
7
  import "./chunk-Q77KNJIN.js";
6
8
  import "./chunk-DXYWKZ52.js";
7
9
  import "./chunk-S5PCVMKU.js";
8
10
  import "./chunk-7AWFHP5U.js";
9
11
  export {
12
+ DATA_PREVIEW_ROWS,
10
13
  materializeDataReferences
11
14
  };
@@ -1,6 +1,7 @@
1
1
  import { MarkdownDocument } from '@bendyline/squisq/markdown';
2
2
  import { ContentContainer } from '@bendyline/squisq/storage';
3
3
  import { c as ConvertOptions, b as ConversionResult } from '../types-CVv9eldp.js';
4
+ import { DiagramRasterizer } from '../diagrams/index.js';
4
5
  import { OutsideInLayout, OutsideInFormatId } from './layout.js';
5
6
  export { OUTSIDE_IN_FORMAT_IDS, OUTSIDE_IN_OUTPUT_TEMPLATE_KEY, chooseOutsideInMarkdownPath, isOutsideInTargetPath, resolveOutsideInLayout } from './layout.js';
6
7
  import '@bendyline/squisq/schemas';
@@ -58,6 +59,17 @@ interface RenderOutsideInOptions extends ConvertOptions {
58
59
  /** URL from the rendered HTML file to its companion media folder. */
59
60
  basePath?: string;
60
61
  };
62
+ /**
63
+ * Draws diagrams as pictures for the targets that cannot draw them: Word
64
+ * and PDF get pictures in place of Mermaid, ASCII diagrams, timelines, file
65
+ * trees, drawings, and layouts (PDF also of SVG islands, which Word embeds
66
+ * as vector art over the picture); PowerPoint, whose own shapes draw the
67
+ * rest, gets pictures of Mermaid and of SVG islands. In a browser, pass
68
+ * `createDiagramPictureRenderer()` from
69
+ * `@bendyline/squisq-react/diagram-pictures`. Without one those diagrams
70
+ * render as their source text. HTML targets draw their own.
71
+ */
72
+ renderDiagram?: DiagramRasterizer;
61
73
  }
62
74
  /** Read outside-in metadata without interpreting the output path as authority. */
63
75
  declare function readOutsideInMetadata(source: string): OutsideInMetadata | null;
@@ -7,8 +7,8 @@ import {
7
7
  renderOutsideInDocument,
8
8
  withOutsideInMarkdownEditing,
9
9
  withOutsideInMetadata
10
- } from "../chunk-6ALSRHD7.js";
11
- import "../chunk-GDUZJ75A.js";
10
+ } from "../chunk-6HUQFEP3.js";
11
+ import "../chunk-WVDAFJFS.js";
12
12
  import "../chunk-KXOZMWBS.js";
13
13
  import {
14
14
  OUTSIDE_IN_FORMAT_IDS,
@@ -116,7 +116,7 @@ interface PdfExportOptions {
116
116
  /**
117
117
  * Convert a MarkdownDocument to a PDF ArrayBuffer.
118
118
  */
119
- declare function markdownDocToPdf(doc: MarkdownDocument, options?: PdfExportOptions): Promise<ArrayBuffer>;
119
+ declare function markdownDocToPdf(source: MarkdownDocument, options?: PdfExportOptions): Promise<ArrayBuffer>;
120
120
  /**
121
121
  * Convert a squisq Doc to a PDF ArrayBuffer.
122
122
  *
package/dist/pdf/index.js CHANGED
@@ -5,11 +5,11 @@ import {
5
5
  pdfToContainer,
6
6
  pdfToDoc,
7
7
  pdfToMarkdownDoc
8
- } from "../chunk-TMOXUUTG.js";
8
+ } from "../chunk-NQNIFIDP.js";
9
9
  import "../chunk-34KECNZO.js";
10
- import "../chunk-BXWNU4T5.js";
10
+ import "../chunk-DTJQK7U7.js";
11
11
  import "../chunk-IIQYS2YH.js";
12
- import "../chunk-LBXBRFBZ.js";
12
+ import "../chunk-DDMPZZJF.js";
13
13
  import "../chunk-JZR32FON.js";
14
14
  export {
15
15
  configurePdfWorker,
@@ -0,0 +1,62 @@
1
+ // src/html/plainHtmlIcons.ts
2
+ var fonts = /* @__PURE__ */ new Map();
3
+ function loadFont(family) {
4
+ let font = fonts.get(family);
5
+ if (!font) {
6
+ font = Promise.all([import("@pdf-lib/fontkit"), import("./fontAwesome-C6FRDYTY.js")]).then(
7
+ ([fontkit, { fontAwesomeFace }]) => fontkit.default.create(fontAwesomeFace(family).data)
8
+ );
9
+ font.catch(() => fonts.delete(family));
10
+ fonts.set(family, font);
11
+ }
12
+ return font;
13
+ }
14
+ function usedIcons(doc) {
15
+ const used = /* @__PURE__ */ new Map();
16
+ const visit = (node) => {
17
+ if (!node || typeof node !== "object") return;
18
+ const n = node;
19
+ if (n.type === "inlineIcon" && n.family && n.name) {
20
+ used.set(`${n.family}:${n.name}`, [n.family, n.name]);
21
+ }
22
+ if (Array.isArray(n.children)) n.children.forEach(visit);
23
+ };
24
+ visit(doc);
25
+ return used;
26
+ }
27
+ var round = (n) => Math.round(n * 100) / 100;
28
+ function glyphPath(font, glyph) {
29
+ const y = (value) => round(font.ascent - value);
30
+ const parts = [];
31
+ const sink = {
32
+ moveTo: (x, py) => parts.push(`M${round(x)} ${y(py)}`),
33
+ lineTo: (x, py) => parts.push(`L${round(x)} ${y(py)}`),
34
+ quadraticCurveTo: (cx, cy, x, py) => parts.push(`Q${round(cx)} ${y(cy)} ${round(x)} ${y(py)}`),
35
+ bezierCurveTo: (c1x, c1y, c2x, c2y, x, py) => parts.push(`C${round(c1x)} ${y(c1y)} ${round(c2x)} ${y(c2y)} ${round(x)} ${y(py)}`),
36
+ closePath: () => parts.push("Z")
37
+ };
38
+ glyph.path.toFunction()(sink);
39
+ return parts.join("");
40
+ }
41
+ async function plainHtmlIcons(doc) {
42
+ const icons = /* @__PURE__ */ new Map();
43
+ const used = usedIcons(doc);
44
+ if (used.size === 0) return icons;
45
+ const { fontAwesomeGlyph } = await import("./fontAwesome-C6FRDYTY.js");
46
+ for (const [key, [family, name]] of used) {
47
+ const glyph = fontAwesomeGlyph(family, name);
48
+ if (!glyph) continue;
49
+ const font = await loadFont(family);
50
+ const outline = font.glyphForCodePoint(glyph.codePointAt(0));
51
+ if (!outline || outline.advanceWidth <= 0) continue;
52
+ icons.set(key, {
53
+ width: outline.advanceWidth,
54
+ height: font.unitsPerEm,
55
+ path: glyphPath(font, outline)
56
+ });
57
+ }
58
+ return icons;
59
+ }
60
+ export {
61
+ plainHtmlIcons
62
+ };
@@ -4,7 +4,7 @@ import {
4
4
  pptxToContainer,
5
5
  pptxToDoc,
6
6
  pptxToMarkdownDoc
7
- } from "../chunk-QU4EVC62.js";
7
+ } from "../chunk-GFHUJ7L4.js";
8
8
  import {
9
9
  analyzePptxLayouts,
10
10
  inspectPptxLayouts
@@ -18,7 +18,7 @@ import "../chunk-JU2RHXUB.js";
18
18
  import "../chunk-S5PCVMKU.js";
19
19
  import "../chunk-7AWFHP5U.js";
20
20
  import "../chunk-IIQYS2YH.js";
21
- import "../chunk-LBXBRFBZ.js";
21
+ import "../chunk-DDMPZZJF.js";
22
22
  import "../chunk-JZR32FON.js";
23
23
  export {
24
24
  analyzePptxLayouts,
@@ -0,0 +1,17 @@
1
+ import {
2
+ csvDataReader,
3
+ defaultDataReaders,
4
+ parquetDataReader,
5
+ xlsxDataReader
6
+ } from "./chunk-5HUHSLGA.js";
7
+ import "./chunk-ATWVNF7D.js";
8
+ import "./chunk-Q77KNJIN.js";
9
+ import "./chunk-DXYWKZ52.js";
10
+ import "./chunk-S5PCVMKU.js";
11
+ import "./chunk-7AWFHP5U.js";
12
+ export {
13
+ csvDataReader,
14
+ defaultDataReaders,
15
+ parquetDataReader,
16
+ xlsxDataReader
17
+ };
@@ -9,7 +9,7 @@ import {
9
9
  defaultRegistry,
10
10
  prepareConversion,
11
11
  resolveConversionLimits
12
- } from "../chunk-GDUZJ75A.js";
12
+ } from "../chunk-WVDAFJFS.js";
13
13
  import {
14
14
  ConversionError
15
15
  } from "../chunk-KXOZMWBS.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/squisq-formats",
3
- "version": "2.8.8",
3
+ "version": "2.8.9",
4
4
  "description": "Document format converters — DOCX, PDF, OOXML import/export",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -125,7 +125,7 @@
125
125
  "typecheck": "tsc --noEmit"
126
126
  },
127
127
  "dependencies": {
128
- "@bendyline/squisq": "2.13.7",
128
+ "@bendyline/squisq": "2.13.8",
129
129
  "@pdf-lib/fontkit": "1.1.1",
130
130
  "@pdf-lib/upng": "1.0.1",
131
131
  "@xmldom/xmldom": "0.9.12",
File without changes