@bendyline/squisq-formats 0.1.1 → 1.1.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/dist/__tests__/container.test.d.ts +8 -0
- package/dist/__tests__/container.test.d.ts.map +1 -0
- package/dist/__tests__/container.test.js +147 -0
- package/dist/__tests__/container.test.js.map +1 -0
- package/dist/__tests__/docxExport.test.d.ts +8 -0
- package/dist/__tests__/docxExport.test.d.ts.map +1 -0
- package/dist/__tests__/docxExport.test.js +383 -0
- package/dist/__tests__/docxExport.test.js.map +1 -0
- package/dist/__tests__/docxImport.test.d.ts +8 -0
- package/dist/__tests__/docxImport.test.d.ts.map +1 -0
- package/dist/__tests__/docxImport.test.js +309 -0
- package/dist/__tests__/docxImport.test.js.map +1 -0
- package/dist/__tests__/html.test.d.ts +8 -0
- package/dist/__tests__/html.test.d.ts.map +1 -0
- package/dist/__tests__/html.test.js +243 -0
- package/dist/__tests__/html.test.js.map +1 -0
- package/dist/__tests__/ooxml.test.d.ts +5 -0
- package/dist/__tests__/ooxml.test.d.ts.map +1 -0
- package/dist/__tests__/ooxml.test.js +152 -0
- package/dist/__tests__/ooxml.test.js.map +1 -0
- package/dist/__tests__/pdfExport.test.d.ts +8 -0
- package/dist/__tests__/pdfExport.test.d.ts.map +1 -0
- package/dist/__tests__/pdfExport.test.js +275 -0
- package/dist/__tests__/pdfExport.test.js.map +1 -0
- package/dist/__tests__/pdfImport.test.d.ts +11 -0
- package/dist/__tests__/pdfImport.test.d.ts.map +1 -0
- package/dist/__tests__/pdfImport.test.js +254 -0
- package/dist/__tests__/pdfImport.test.js.map +1 -0
- package/dist/__tests__/roundTrip.test.d.ts +7 -0
- package/dist/__tests__/roundTrip.test.d.ts.map +1 -0
- package/dist/__tests__/roundTrip.test.js +173 -0
- package/dist/__tests__/roundTrip.test.js.map +1 -0
- package/dist/container/index.d.ts +36 -0
- package/dist/container/index.d.ts.map +1 -0
- package/dist/container/index.js +74 -0
- package/dist/container/index.js.map +1 -0
- package/dist/docx/export.d.ts +54 -0
- package/dist/docx/export.d.ts.map +1 -0
- package/dist/docx/export.js +729 -0
- package/dist/docx/export.js.map +1 -0
- package/dist/docx/import.d.ts +52 -0
- package/dist/docx/import.d.ts.map +1 -0
- package/dist/docx/import.js +687 -0
- package/dist/docx/import.js.map +1 -0
- package/dist/docx/index.d.ts +15 -100
- package/dist/docx/index.d.ts.map +1 -0
- package/dist/docx/index.js +22 -13
- package/dist/docx/index.js.map +1 -1
- package/dist/docx/styles.d.ts +68 -0
- package/dist/docx/styles.d.ts.map +1 -0
- package/dist/docx/styles.js +125 -0
- package/dist/docx/styles.js.map +1 -0
- package/dist/html/htmlTemplate.d.ts +64 -0
- package/dist/html/htmlTemplate.d.ts.map +1 -0
- package/dist/html/htmlTemplate.js +235 -0
- package/dist/html/htmlTemplate.js.map +1 -0
- package/dist/html/imageUtils.d.ts +29 -0
- package/dist/html/imageUtils.d.ts.map +1 -0
- package/dist/html/imageUtils.js +63 -0
- package/dist/html/imageUtils.js.map +1 -0
- package/dist/html/index.d.ts +9 -77
- package/dist/html/index.d.ts.map +1 -0
- package/dist/html/index.js +137 -16
- package/dist/html/index.js.map +1 -1
- package/dist/index.d.ts +36 -7
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -53
- package/dist/index.js.map +1 -1
- package/dist/ooxml/index.d.ts +14 -343
- package/dist/ooxml/index.d.ts.map +1 -0
- package/dist/ooxml/index.js +22 -98
- package/dist/ooxml/index.js.map +1 -1
- package/dist/ooxml/namespaces.d.ts +67 -0
- package/dist/ooxml/namespaces.d.ts.map +1 -0
- package/dist/ooxml/namespaces.js +94 -0
- package/dist/ooxml/namespaces.js.map +1 -0
- package/dist/ooxml/reader.d.ts +52 -0
- package/dist/ooxml/reader.d.ts.map +1 -0
- package/dist/ooxml/reader.js +190 -0
- package/dist/ooxml/reader.js.map +1 -0
- package/dist/ooxml/types.d.ts +82 -0
- package/dist/ooxml/types.d.ts.map +1 -0
- package/dist/ooxml/types.js +9 -0
- package/dist/ooxml/types.js.map +1 -0
- package/dist/ooxml/writer.d.ts +71 -0
- package/dist/ooxml/writer.d.ts.map +1 -0
- package/dist/ooxml/writer.js +200 -0
- package/dist/ooxml/writer.js.map +1 -0
- package/dist/ooxml/xmlUtils.d.ts +76 -0
- package/dist/ooxml/xmlUtils.d.ts.map +1 -0
- package/dist/ooxml/xmlUtils.js +108 -0
- package/dist/ooxml/xmlUtils.js.map +1 -0
- package/dist/pdf/export.d.ts +50 -0
- package/dist/pdf/export.d.ts.map +1 -0
- package/dist/pdf/export.js +740 -0
- package/dist/pdf/export.js.map +1 -0
- package/dist/pdf/import.d.ts +78 -0
- package/dist/pdf/import.d.ts.map +1 -0
- package/dist/pdf/import.js +619 -0
- package/dist/pdf/import.js.map +1 -0
- package/dist/pdf/index.d.ts +17 -121
- package/dist/pdf/index.d.ts.map +1 -0
- package/dist/pdf/index.js +25 -14
- package/dist/pdf/index.js.map +1 -1
- package/dist/pdf/styles.d.ts +142 -0
- package/dist/pdf/styles.d.ts.map +1 -0
- package/dist/pdf/styles.js +145 -0
- package/dist/pdf/styles.js.map +1 -0
- package/dist/pptx/index.d.ts +9 -12
- package/dist/pptx/index.d.ts.map +1 -0
- package/dist/pptx/index.js +44 -12
- package/dist/pptx/index.js.map +1 -1
- package/dist/xlsx/index.d.ts +9 -12
- package/dist/xlsx/index.d.ts.map +1 -0
- package/dist/xlsx/index.js +44 -12
- package/dist/xlsx/index.js.map +1 -1
- package/package.json +8 -4
- package/src/__tests__/container.test.ts +189 -0
- package/src/container/index.ts +89 -0
package/dist/pdf/index.d.ts
CHANGED
|
@@ -1,130 +1,26 @@
|
|
|
1
|
-
import { Doc } from '@bendyline/squisq/schemas';
|
|
2
|
-
import { MarkdownDocument } from '@bendyline/squisq/markdown';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
|
-
* PDF
|
|
2
|
+
* @bendyline/squisq-formats PDF Module
|
|
6
3
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* headings, paragraphs, inline formatting, lists, code blocks,
|
|
10
|
-
* blockquotes, tables, thematic breaks, and hyperlinks.
|
|
4
|
+
* Import and export squisq documents (MarkdownDocument / Doc)
|
|
5
|
+
* to/from PDF files.
|
|
11
6
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
7
|
+
* - **Export** uses pdf-lib (zero dependencies, standard fonts, pure JS).
|
|
8
|
+
* - **Import** uses pdfjs-dist (Mozilla pdf.js) with heuristic structure detection.
|
|
14
9
|
*
|
|
15
|
-
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* import { parseMarkdown } from '@bendyline/squisq/markdown';
|
|
18
|
-
* import { markdownDocToPdf } from '@bendyline/squisq-formats/pdf';
|
|
19
|
-
*
|
|
20
|
-
* const md = parseMarkdown('# Hello\n\nWorld **bold** text');
|
|
21
|
-
* const buffer = await markdownDocToPdf(md);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/** Page size presets. */
|
|
26
|
-
type PdfPageSize = 'letter' | 'a4';
|
|
27
|
-
/**
|
|
28
|
-
* Options for PDF export.
|
|
29
|
-
*/
|
|
30
|
-
interface PdfExportOptions {
|
|
31
|
-
/** Document title (PDF metadata). */
|
|
32
|
-
title?: string;
|
|
33
|
-
/** Document author (PDF metadata). */
|
|
34
|
-
author?: string;
|
|
35
|
-
/** Page size preset. Default: "letter". */
|
|
36
|
-
pageSize?: PdfPageSize;
|
|
37
|
-
/** Page margins in points. Default: 72 (1 inch). */
|
|
38
|
-
margin?: number;
|
|
39
|
-
/** Default body font size in points. Default: 11. */
|
|
40
|
-
defaultFontSize?: number;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Convert a MarkdownDocument to a PDF ArrayBuffer.
|
|
44
|
-
*/
|
|
45
|
-
declare function markdownDocToPdf(doc: MarkdownDocument, options?: PdfExportOptions): Promise<ArrayBuffer>;
|
|
46
|
-
/**
|
|
47
|
-
* Convert a squisq Doc to a PDF ArrayBuffer.
|
|
48
|
-
*
|
|
49
|
-
* Convenience wrapper: Doc → MarkdownDocument → PDF.
|
|
50
|
-
*/
|
|
51
|
-
declare function docToPdf(doc: Doc, options?: PdfExportOptions): Promise<ArrayBuffer>;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* PDF Import
|
|
55
|
-
*
|
|
56
|
-
* Parses a PDF file and converts its content into a squisq
|
|
57
|
-
* MarkdownDocument (or Doc) using heuristic detection of headings,
|
|
58
|
-
* lists, code blocks, tables, blockquotes, and hyperlinks.
|
|
59
|
-
*
|
|
60
|
-
* Uses pdfjs-dist (Mozilla pdf.js) for text extraction — a battle-tested,
|
|
61
|
-
* browser-compatible PDF parser. Since PDFs encode positioned glyphs
|
|
62
|
-
* rather than semantic structure, all structure detection is inherently
|
|
63
|
-
* heuristic and works best on simply-formatted documents.
|
|
10
|
+
* All operations run in the browser — no server required.
|
|
64
11
|
*
|
|
65
12
|
* @example
|
|
66
13
|
* ```ts
|
|
67
|
-
* import {
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Options for PDF import.
|
|
77
|
-
*/
|
|
78
|
-
interface PdfImportOptions {
|
|
79
|
-
/**
|
|
80
|
-
* Hint for the body font size used in the PDF (in points).
|
|
81
|
-
* Text items larger than this are considered headings.
|
|
82
|
-
* If not provided, the importer detects the most common font size.
|
|
83
|
-
*/
|
|
84
|
-
bodyFontSize?: number;
|
|
85
|
-
/** Whether to detect tables from column-aligned text. Default: true. */
|
|
86
|
-
detectTables?: boolean;
|
|
87
|
-
/** Whether to detect code blocks from monospace fonts. Default: true. */
|
|
88
|
-
detectCodeBlocks?: boolean;
|
|
89
|
-
/** Whether to detect blockquotes from indentation. Default: true. */
|
|
90
|
-
detectBlockquotes?: boolean;
|
|
91
|
-
/** Whether to detect URLs in text and convert to links. Default: true. */
|
|
92
|
-
detectLinks?: boolean;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Convert a PDF file to a MarkdownDocument.
|
|
96
|
-
*
|
|
97
|
-
* Structure detection is heuristic — results are best-effort.
|
|
98
|
-
*
|
|
99
|
-
* @param data - The raw PDF file as ArrayBuffer, Uint8Array, or Blob
|
|
100
|
-
* @param options - Import options
|
|
101
|
-
* @returns A MarkdownDocument representing the detected content
|
|
102
|
-
*/
|
|
103
|
-
declare function pdfToMarkdownDoc(data: ArrayBuffer | Uint8Array | Blob, options?: PdfImportOptions): Promise<MarkdownDocument>;
|
|
104
|
-
/**
|
|
105
|
-
* Convert a PDF file to a squisq Doc.
|
|
106
|
-
*
|
|
107
|
-
* Convenience wrapper: PDF → MarkdownDocument → Doc.
|
|
108
|
-
*/
|
|
109
|
-
declare function pdfToDoc(data: ArrayBuffer | Uint8Array | Blob, options?: PdfImportOptions): Promise<Doc>;
|
|
110
|
-
/**
|
|
111
|
-
* Configure the pdfjs-dist PDF worker source URL.
|
|
112
|
-
*
|
|
113
|
-
* pdfjs-dist requires a worker for PDF parsing. In the **browser**, bundlers
|
|
114
|
-
* (Vite, webpack) typically handle this automatically, or you can point to a
|
|
115
|
-
* CDN-hosted worker script. In **Node.js / SSR / test** environments, call
|
|
116
|
-
* this with a `file://` URL to the worker module **before** any import call.
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* ```ts
|
|
120
|
-
* // Browser — CDN
|
|
121
|
-
* configurePdfWorker('https://cdn.jsdelivr.net/npm/pdfjs-dist@4/legacy/build/pdf.worker.min.mjs');
|
|
122
|
-
*
|
|
123
|
-
* // Node / vitest — file URL
|
|
124
|
-
* import { pathToFileURL } from 'url';
|
|
125
|
-
* configurePdfWorker(pathToFileURL(require.resolve('pdfjs-dist/legacy/build/pdf.worker.mjs')).href);
|
|
14
|
+
* import {
|
|
15
|
+
* markdownDocToPdf,
|
|
16
|
+
* docToPdf,
|
|
17
|
+
* pdfToMarkdownDoc,
|
|
18
|
+
* pdfToDoc,
|
|
19
|
+
* } from '@bendyline/squisq-formats/pdf';
|
|
126
20
|
* ```
|
|
127
21
|
*/
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
export {
|
|
22
|
+
export { markdownDocToPdf, docToPdf } from './export.js';
|
|
23
|
+
export type { PdfExportOptions } from './export.js';
|
|
24
|
+
export { pdfToMarkdownDoc, pdfToDoc, configurePdfWorker } from './import.js';
|
|
25
|
+
export type { PdfImportOptions } from './import.js';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pdf/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC7E,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/pdf/index.js
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @bendyline/squisq-formats PDF Module
|
|
3
|
+
*
|
|
4
|
+
* Import and export squisq documents (MarkdownDocument / Doc)
|
|
5
|
+
* to/from PDF files.
|
|
6
|
+
*
|
|
7
|
+
* - **Export** uses pdf-lib (zero dependencies, standard fonts, pure JS).
|
|
8
|
+
* - **Import** uses pdfjs-dist (Mozilla pdf.js) with heuristic structure detection.
|
|
9
|
+
*
|
|
10
|
+
* All operations run in the browser — no server required.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import {
|
|
15
|
+
* markdownDocToPdf,
|
|
16
|
+
* docToPdf,
|
|
17
|
+
* pdfToMarkdownDoc,
|
|
18
|
+
* pdfToDoc,
|
|
19
|
+
* } from '@bendyline/squisq-formats/pdf';
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
// Export
|
|
23
|
+
export { markdownDocToPdf, docToPdf } from './export.js';
|
|
24
|
+
// Import
|
|
25
|
+
export { pdfToMarkdownDoc, pdfToDoc, configurePdfWorker } from './import.js';
|
|
15
26
|
//# sourceMappingURL=index.js.map
|
package/dist/pdf/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pdf/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,SAAS;AACT,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGzD,SAAS;AACT,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PDF Style / Layout Constants
|
|
3
|
+
*
|
|
4
|
+
* Shared constants used by both PDF export and import. Defines page
|
|
5
|
+
* dimensions, margins, font sizes, colours, and spacing for rendering
|
|
6
|
+
* MarkdownDocument content as a paginated PDF.
|
|
7
|
+
*/
|
|
8
|
+
/** Standard US Letter page width in points (8.5 in × 72 pt/in). */
|
|
9
|
+
export declare const PAGE_WIDTH_LETTER = 612;
|
|
10
|
+
/** Standard US Letter page height in points (11 in × 72 pt/in). */
|
|
11
|
+
export declare const PAGE_HEIGHT_LETTER = 792;
|
|
12
|
+
/** A4 page width in points (210 mm ≈ 595 pt). */
|
|
13
|
+
export declare const PAGE_WIDTH_A4 = 595.28;
|
|
14
|
+
/** A4 page height in points (297 mm ≈ 842 pt). */
|
|
15
|
+
export declare const PAGE_HEIGHT_A4 = 841.89;
|
|
16
|
+
/** Default page margins in points (1 inch = 72 pt). */
|
|
17
|
+
export declare const DEFAULT_MARGIN = 72;
|
|
18
|
+
export declare const FONT_REGULAR = "Helvetica";
|
|
19
|
+
export declare const FONT_BOLD = "Helvetica-Bold";
|
|
20
|
+
export declare const FONT_ITALIC = "Helvetica-Oblique";
|
|
21
|
+
export declare const FONT_BOLD_ITALIC = "Helvetica-BoldOblique";
|
|
22
|
+
export declare const FONT_MONO = "Courier";
|
|
23
|
+
export declare const FONT_MONO_BOLD = "Courier-Bold";
|
|
24
|
+
/** Default body font size in points. */
|
|
25
|
+
export declare const DEFAULT_FONT_SIZE = 11;
|
|
26
|
+
/** Heading font sizes indexed by depth (1-based). */
|
|
27
|
+
export declare const HEADING_SIZES: Record<number, number>;
|
|
28
|
+
/** Font size used for code blocks and inline code. */
|
|
29
|
+
export declare const CODE_FONT_SIZE = 10;
|
|
30
|
+
/** Line height multiplier (leading). */
|
|
31
|
+
export declare const LINE_HEIGHT_FACTOR = 1.4;
|
|
32
|
+
/** Space above a heading. */
|
|
33
|
+
export declare const HEADING_SPACE_BEFORE = 18;
|
|
34
|
+
/** Space below a heading. */
|
|
35
|
+
export declare const HEADING_SPACE_AFTER = 6;
|
|
36
|
+
/** Space between paragraphs. */
|
|
37
|
+
export declare const PARAGRAPH_SPACING = 8;
|
|
38
|
+
/** Extra indent per list nesting level. */
|
|
39
|
+
export declare const LIST_INDENT = 24;
|
|
40
|
+
/** Bullet character for unordered lists. */
|
|
41
|
+
export declare const BULLET_CHAR = "\u2022";
|
|
42
|
+
/** Indent for blockquotes. */
|
|
43
|
+
export declare const BLOCKQUOTE_INDENT = 24;
|
|
44
|
+
/** Width of the blockquote left bar. */
|
|
45
|
+
export declare const BLOCKQUOTE_BAR_WIDTH = 3;
|
|
46
|
+
export declare const COLOR_TEXT: {
|
|
47
|
+
r: number;
|
|
48
|
+
g: number;
|
|
49
|
+
b: number;
|
|
50
|
+
};
|
|
51
|
+
export declare const COLOR_HEADING: {
|
|
52
|
+
r: number;
|
|
53
|
+
g: number;
|
|
54
|
+
b: number;
|
|
55
|
+
};
|
|
56
|
+
export declare const COLOR_LINK: {
|
|
57
|
+
r: number;
|
|
58
|
+
g: number;
|
|
59
|
+
b: number;
|
|
60
|
+
};
|
|
61
|
+
export declare const COLOR_CODE_BG: {
|
|
62
|
+
r: number;
|
|
63
|
+
g: number;
|
|
64
|
+
b: number;
|
|
65
|
+
};
|
|
66
|
+
export declare const COLOR_CODE_TEXT: {
|
|
67
|
+
r: number;
|
|
68
|
+
g: number;
|
|
69
|
+
b: number;
|
|
70
|
+
};
|
|
71
|
+
export declare const COLOR_BLOCKQUOTE_BAR: {
|
|
72
|
+
r: number;
|
|
73
|
+
g: number;
|
|
74
|
+
b: number;
|
|
75
|
+
};
|
|
76
|
+
export declare const COLOR_BLOCKQUOTE_TEXT: {
|
|
77
|
+
r: number;
|
|
78
|
+
g: number;
|
|
79
|
+
b: number;
|
|
80
|
+
};
|
|
81
|
+
export declare const COLOR_THEMATIC_BREAK: {
|
|
82
|
+
r: number;
|
|
83
|
+
g: number;
|
|
84
|
+
b: number;
|
|
85
|
+
};
|
|
86
|
+
export declare const COLOR_TABLE_BORDER: {
|
|
87
|
+
r: number;
|
|
88
|
+
g: number;
|
|
89
|
+
b: number;
|
|
90
|
+
};
|
|
91
|
+
export declare const COLOR_TABLE_HEADER_BG: {
|
|
92
|
+
r: number;
|
|
93
|
+
g: number;
|
|
94
|
+
b: number;
|
|
95
|
+
};
|
|
96
|
+
/** Table cell horizontal padding in points. */
|
|
97
|
+
export declare const TABLE_CELL_PAD_X = 6;
|
|
98
|
+
/** Table cell vertical padding in points. */
|
|
99
|
+
export declare const TABLE_CELL_PAD_Y = 4;
|
|
100
|
+
/** Table border line width. */
|
|
101
|
+
export declare const TABLE_BORDER_WIDTH = 0.5;
|
|
102
|
+
/**
|
|
103
|
+
* Minimum font size (in PDF points) to consider as a heading.
|
|
104
|
+
* Anything ≥ this and larger than the detected body size is a heading.
|
|
105
|
+
*/
|
|
106
|
+
export declare const IMPORT_HEADING_MIN_SIZE = 13;
|
|
107
|
+
/**
|
|
108
|
+
* Font size ranges mapped to heading depth for import heuristics.
|
|
109
|
+
* Applied when a text item's font size exceeds the body size.
|
|
110
|
+
*/
|
|
111
|
+
export declare const IMPORT_HEADING_SIZE_RANGES: Array<{
|
|
112
|
+
min: number;
|
|
113
|
+
depth: number;
|
|
114
|
+
}>;
|
|
115
|
+
/**
|
|
116
|
+
* Y-distance (in points) between lines that implies a paragraph break
|
|
117
|
+
* rather than a continuation of the same paragraph.
|
|
118
|
+
*/
|
|
119
|
+
export declare const IMPORT_PARAGRAPH_GAP = 4;
|
|
120
|
+
/**
|
|
121
|
+
* Characters that indicate an unordered list bullet at the start of a line.
|
|
122
|
+
*/
|
|
123
|
+
export declare const IMPORT_BULLET_CHARS: Set<string>;
|
|
124
|
+
/**
|
|
125
|
+
* Regex to detect an ordered list prefix (e.g. "1.", "2)", "iv.").
|
|
126
|
+
*/
|
|
127
|
+
export declare const IMPORT_ORDERED_PREFIX: RegExp;
|
|
128
|
+
/**
|
|
129
|
+
* Column alignment tolerance — text items whose x-positions differ by
|
|
130
|
+
* less than this are considered to be in the same column (for table detection).
|
|
131
|
+
*/
|
|
132
|
+
export declare const IMPORT_COLUMN_TOLERANCE = 8;
|
|
133
|
+
/**
|
|
134
|
+
* Minimum number of consecutive rows with the same column count to
|
|
135
|
+
* consider them a table.
|
|
136
|
+
*/
|
|
137
|
+
export declare const IMPORT_TABLE_MIN_ROWS = 2;
|
|
138
|
+
/**
|
|
139
|
+
* URL pattern for detecting links in extracted text.
|
|
140
|
+
*/
|
|
141
|
+
export declare const IMPORT_URL_PATTERN: RegExp;
|
|
142
|
+
//# sourceMappingURL=styles.d.ts.map
|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|
5
|
+
* dimensions, margins, font sizes, colours, and spacing for rendering
|
|
6
|
+
* MarkdownDocument content as a paginated PDF.
|
|
7
|
+
*/
|
|
8
|
+
// ============================================
|
|
9
|
+
// Page Layout
|
|
10
|
+
// ============================================
|
|
11
|
+
/** Standard US Letter page width in points (8.5 in × 72 pt/in). */
|
|
12
|
+
export const PAGE_WIDTH_LETTER = 612;
|
|
13
|
+
/** Standard US Letter page height in points (11 in × 72 pt/in). */
|
|
14
|
+
export const PAGE_HEIGHT_LETTER = 792;
|
|
15
|
+
/** A4 page width in points (210 mm ≈ 595 pt). */
|
|
16
|
+
export const PAGE_WIDTH_A4 = 595.28;
|
|
17
|
+
/** A4 page height in points (297 mm ≈ 842 pt). */
|
|
18
|
+
export const PAGE_HEIGHT_A4 = 841.89;
|
|
19
|
+
/** Default page margins in points (1 inch = 72 pt). */
|
|
20
|
+
export const DEFAULT_MARGIN = 72;
|
|
21
|
+
// ============================================
|
|
22
|
+
// Fonts — pdf-lib standard font names
|
|
23
|
+
// ============================================
|
|
24
|
+
export const FONT_REGULAR = 'Helvetica';
|
|
25
|
+
export const FONT_BOLD = 'Helvetica-Bold';
|
|
26
|
+
export const FONT_ITALIC = 'Helvetica-Oblique';
|
|
27
|
+
export const FONT_BOLD_ITALIC = 'Helvetica-BoldOblique';
|
|
28
|
+
export const FONT_MONO = 'Courier';
|
|
29
|
+
export const FONT_MONO_BOLD = 'Courier-Bold';
|
|
30
|
+
// ============================================
|
|
31
|
+
// Font Sizes
|
|
32
|
+
// ============================================
|
|
33
|
+
/** Default body font size in points. */
|
|
34
|
+
export const DEFAULT_FONT_SIZE = 11;
|
|
35
|
+
/** Heading font sizes indexed by depth (1-based). */
|
|
36
|
+
export const HEADING_SIZES = {
|
|
37
|
+
1: 24,
|
|
38
|
+
2: 20,
|
|
39
|
+
3: 16,
|
|
40
|
+
4: 14,
|
|
41
|
+
5: 13,
|
|
42
|
+
6: 12,
|
|
43
|
+
};
|
|
44
|
+
/** Font size used for code blocks and inline code. */
|
|
45
|
+
export const CODE_FONT_SIZE = 10;
|
|
46
|
+
// ============================================
|
|
47
|
+
// Spacing (in points)
|
|
48
|
+
// ============================================
|
|
49
|
+
/** Line height multiplier (leading). */
|
|
50
|
+
export const LINE_HEIGHT_FACTOR = 1.4;
|
|
51
|
+
/** Space above a heading. */
|
|
52
|
+
export const HEADING_SPACE_BEFORE = 18;
|
|
53
|
+
/** Space below a heading. */
|
|
54
|
+
export const HEADING_SPACE_AFTER = 6;
|
|
55
|
+
/** Space between paragraphs. */
|
|
56
|
+
export const PARAGRAPH_SPACING = 8;
|
|
57
|
+
/** Extra indent per list nesting level. */
|
|
58
|
+
export const LIST_INDENT = 24;
|
|
59
|
+
/** Bullet character for unordered lists. */
|
|
60
|
+
export const BULLET_CHAR = '\u2022'; // •
|
|
61
|
+
/** Indent for blockquotes. */
|
|
62
|
+
export const BLOCKQUOTE_INDENT = 24;
|
|
63
|
+
/** Width of the blockquote left bar. */
|
|
64
|
+
export const BLOCKQUOTE_BAR_WIDTH = 3;
|
|
65
|
+
// ============================================
|
|
66
|
+
// Colours (RGB 0-1)
|
|
67
|
+
// ============================================
|
|
68
|
+
export const COLOR_TEXT = { r: 0.12, g: 0.12, b: 0.14 };
|
|
69
|
+
export const COLOR_HEADING = { r: 0.08, g: 0.08, b: 0.1 };
|
|
70
|
+
export const COLOR_LINK = { r: 0.05, g: 0.27, b: 0.73 };
|
|
71
|
+
export const COLOR_CODE_BG = { r: 0.95, g: 0.95, b: 0.97 };
|
|
72
|
+
export const COLOR_CODE_TEXT = { r: 0.2, g: 0.2, b: 0.22 };
|
|
73
|
+
export const COLOR_BLOCKQUOTE_BAR = { r: 0.75, g: 0.75, b: 0.78 };
|
|
74
|
+
export const COLOR_BLOCKQUOTE_TEXT = { r: 0.35, g: 0.35, b: 0.38 };
|
|
75
|
+
export const COLOR_THEMATIC_BREAK = { r: 0.78, g: 0.78, b: 0.8 };
|
|
76
|
+
export const COLOR_TABLE_BORDER = { r: 0.75, g: 0.75, b: 0.78 };
|
|
77
|
+
export const COLOR_TABLE_HEADER_BG = { r: 0.93, g: 0.93, b: 0.95 };
|
|
78
|
+
// ============================================
|
|
79
|
+
// Table Constants
|
|
80
|
+
// ============================================
|
|
81
|
+
/** Table cell horizontal padding in points. */
|
|
82
|
+
export const TABLE_CELL_PAD_X = 6;
|
|
83
|
+
/** Table cell vertical padding in points. */
|
|
84
|
+
export const TABLE_CELL_PAD_Y = 4;
|
|
85
|
+
/** Table border line width. */
|
|
86
|
+
export const TABLE_BORDER_WIDTH = 0.5;
|
|
87
|
+
// ============================================
|
|
88
|
+
// Import Heuristic Thresholds
|
|
89
|
+
// ============================================
|
|
90
|
+
/**
|
|
91
|
+
* Minimum font size (in PDF points) to consider as a heading.
|
|
92
|
+
* Anything ≥ this and larger than the detected body size is a heading.
|
|
93
|
+
*/
|
|
94
|
+
export const IMPORT_HEADING_MIN_SIZE = 13;
|
|
95
|
+
/**
|
|
96
|
+
* Font size ranges mapped to heading depth for import heuristics.
|
|
97
|
+
* Applied when a text item's font size exceeds the body size.
|
|
98
|
+
*/
|
|
99
|
+
export const IMPORT_HEADING_SIZE_RANGES = [
|
|
100
|
+
{ min: 22, depth: 1 },
|
|
101
|
+
{ min: 18, depth: 2 },
|
|
102
|
+
{ min: 15, depth: 3 },
|
|
103
|
+
{ min: 13.5, depth: 4 },
|
|
104
|
+
{ min: 12.5, depth: 5 },
|
|
105
|
+
{ min: 12, depth: 6 },
|
|
106
|
+
];
|
|
107
|
+
/**
|
|
108
|
+
* Y-distance (in points) between lines that implies a paragraph break
|
|
109
|
+
* rather than a continuation of the same paragraph.
|
|
110
|
+
*/
|
|
111
|
+
export const IMPORT_PARAGRAPH_GAP = 4;
|
|
112
|
+
/**
|
|
113
|
+
* Characters that indicate an unordered list bullet at the start of a line.
|
|
114
|
+
*/
|
|
115
|
+
export const IMPORT_BULLET_CHARS = new Set([
|
|
116
|
+
'\u2022',
|
|
117
|
+
'\u2023',
|
|
118
|
+
'\u25E6',
|
|
119
|
+
'\u2043',
|
|
120
|
+
'-',
|
|
121
|
+
'*',
|
|
122
|
+
'\u2013',
|
|
123
|
+
'\u2014',
|
|
124
|
+
'\u25AA',
|
|
125
|
+
'\u25AB',
|
|
126
|
+
]);
|
|
127
|
+
/**
|
|
128
|
+
* Regex to detect an ordered list prefix (e.g. "1.", "2)", "iv.").
|
|
129
|
+
*/
|
|
130
|
+
export const IMPORT_ORDERED_PREFIX = /^(\d+|[a-z]+|[ivxlcdm]+)[.)]\s/i;
|
|
131
|
+
/**
|
|
132
|
+
* Column alignment tolerance — text items whose x-positions differ by
|
|
133
|
+
* less than this are considered to be in the same column (for table detection).
|
|
134
|
+
*/
|
|
135
|
+
export const IMPORT_COLUMN_TOLERANCE = 8;
|
|
136
|
+
/**
|
|
137
|
+
* Minimum number of consecutive rows with the same column count to
|
|
138
|
+
* consider them a table.
|
|
139
|
+
*/
|
|
140
|
+
export const IMPORT_TABLE_MIN_ROWS = 2;
|
|
141
|
+
/**
|
|
142
|
+
* URL pattern for detecting links in extracted text.
|
|
143
|
+
*/
|
|
144
|
+
export const IMPORT_URL_PATTERN = /https?:\/\/[^\s)>\]]+/g;
|
|
145
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/pdf/styles.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,+CAA+C;AAC/C,cAAc;AACd,+CAA+C;AAE/C,mEAAmE;AACnE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC,mEAAmE;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,iDAAiD;AACjD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AAEpC,kDAAkD;AAClD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AAErC,uDAAuD;AACvD,MAAM,CAAC,MAAM,cAAc,G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,iCAAiC,CAAC;AAEvE;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC"}
|
package/dist/pptx/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { MarkdownDocument } from '@bendyline/squisq/markdown';
|
|
2
|
-
import { Doc } from '@bendyline/squisq/schemas';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* @bendyline/squisq-formats PPTX Module (Stub)
|
|
6
3
|
*
|
|
@@ -13,11 +10,12 @@ import { Doc } from '@bendyline/squisq/schemas';
|
|
|
13
10
|
* import { markdownDocToPptx } from '@bendyline/squisq-formats/pptx';
|
|
14
11
|
* ```
|
|
15
12
|
*/
|
|
16
|
-
|
|
13
|
+
import type { MarkdownDocument } from '@bendyline/squisq/markdown';
|
|
14
|
+
import type { Doc } from '@bendyline/squisq/schemas';
|
|
17
15
|
/**
|
|
18
16
|
* Options for PPTX export (placeholder).
|
|
19
17
|
*/
|
|
20
|
-
interface PptxExportOptions {
|
|
18
|
+
export interface PptxExportOptions {
|
|
21
19
|
/** Presentation title */
|
|
22
20
|
title?: string;
|
|
23
21
|
/** Presentation author */
|
|
@@ -26,7 +24,7 @@ interface PptxExportOptions {
|
|
|
26
24
|
/**
|
|
27
25
|
* Options for PPTX import (placeholder).
|
|
28
26
|
*/
|
|
29
|
-
interface PptxImportOptions {
|
|
27
|
+
export interface PptxImportOptions {
|
|
30
28
|
/** Whether to extract embedded images as data URIs */
|
|
31
29
|
extractImages?: boolean;
|
|
32
30
|
}
|
|
@@ -35,24 +33,23 @@ interface PptxImportOptions {
|
|
|
35
33
|
*
|
|
36
34
|
* @throws Error — PPTX support is not yet implemented
|
|
37
35
|
*/
|
|
38
|
-
declare function markdownDocToPptx(_doc: MarkdownDocument, _options?: PptxExportOptions): Promise<Blob>;
|
|
36
|
+
export declare function markdownDocToPptx(_doc: MarkdownDocument, _options?: PptxExportOptions): Promise<Blob>;
|
|
39
37
|
/**
|
|
40
38
|
* Convert a squisq Doc to a .pptx Blob.
|
|
41
39
|
*
|
|
42
40
|
* @throws Error — PPTX support is not yet implemented
|
|
43
41
|
*/
|
|
44
|
-
declare function docToPptx(_doc: Doc, _options?: PptxExportOptions): Promise<Blob>;
|
|
42
|
+
export declare function docToPptx(_doc: Doc, _options?: PptxExportOptions): Promise<Blob>;
|
|
45
43
|
/**
|
|
46
44
|
* Convert a .pptx file to a MarkdownDocument.
|
|
47
45
|
*
|
|
48
46
|
* @throws Error — PPTX support is not yet implemented
|
|
49
47
|
*/
|
|
50
|
-
declare function pptxToMarkdownDoc(_data: ArrayBuffer | Blob, _options?: PptxImportOptions): Promise<MarkdownDocument>;
|
|
48
|
+
export declare function pptxToMarkdownDoc(_data: ArrayBuffer | Blob, _options?: PptxImportOptions): Promise<MarkdownDocument>;
|
|
51
49
|
/**
|
|
52
50
|
* Convert a .pptx file to a squisq Doc.
|
|
53
51
|
*
|
|
54
52
|
* @throws Error — PPTX support is not yet implemented
|
|
55
53
|
*/
|
|
56
|
-
declare function pptxToDoc(_data: ArrayBuffer | Blob, _options?: PptxImportOptions): Promise<Doc>;
|
|
57
|
-
|
|
58
|
-
export { type PptxExportOptions, type PptxImportOptions, docToPptx, markdownDocToPptx, pptxToDoc, pptxToMarkdownDoc };
|
|
54
|
+
export declare function pptxToDoc(_data: ArrayBuffer | Blob, _options?: PptxImportOptions): Promise<Doc>;
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pptx/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,gBAAgB,EACtB,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEtF;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,WAAW,GAAG,IAAI,EACzB,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,WAAW,GAAG,IAAI,EACzB,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,OAAO,CAAC,GAAG,CAAC,CAEd"}
|
package/dist/pptx/index.js
CHANGED
|
@@ -1,13 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @bendyline/squisq-formats PPTX Module (Stub)
|
|
3
|
+
*
|
|
4
|
+
* Placeholder for PowerPoint .pptx import/export support.
|
|
5
|
+
* Will use PresentationML (`<p:presentation>`, `<p:sld>`) via the
|
|
6
|
+
* shared ooxml/ infrastructure.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { markdownDocToPptx } from '@bendyline/squisq-formats/pptx';
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Convert a MarkdownDocument to a .pptx Blob.
|
|
15
|
+
*
|
|
16
|
+
* @throws Error — PPTX support is not yet implemented
|
|
17
|
+
*/
|
|
18
|
+
export async function markdownDocToPptx(_doc, _options) {
|
|
19
|
+
throw new Error('PPTX export is not yet implemented');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Convert a squisq Doc to a .pptx Blob.
|
|
23
|
+
*
|
|
24
|
+
* @throws Error — PPTX support is not yet implemented
|
|
25
|
+
*/
|
|
26
|
+
export async function docToPptx(_doc, _options) {
|
|
27
|
+
throw new Error('PPTX export is not yet implemented');
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Convert a .pptx file to a MarkdownDocument.
|
|
31
|
+
*
|
|
32
|
+
* @throws Error — PPTX support is not yet implemented
|
|
33
|
+
*/
|
|
34
|
+
export async function pptxToMarkdownDoc(_data, _options) {
|
|
35
|
+
throw new Error('PPTX import is not yet implemented');
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Convert a .pptx file to a squisq Doc.
|
|
39
|
+
*
|
|
40
|
+
* @throws Error — PPTX support is not yet implemented
|
|
41
|
+
*/
|
|
42
|
+
export async function pptxToDoc(_data, _options) {
|
|
43
|
+
throw new Error('PPTX import is not yet implemented');
|
|
44
|
+
}
|
|
13
45
|
//# sourceMappingURL=index.js.map
|
package/dist/pptx/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pptx/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAuBH;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAsB,EACtB,QAA4B;IAE5B,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAS,EAAE,QAA4B;IACrE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAyB,EACzB,QAA4B;IAE5B,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,KAAyB,EACzB,QAA4B;IAE5B,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;AACxD,CAAC"}
|