@pyreon/document-primitives 0.13.1 → 0.15.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.
@@ -0,0 +1,388 @@
1
+ import { defineManifest } from '@pyreon/manifest'
2
+
3
+ export default defineManifest({
4
+ name: '@pyreon/document-primitives',
5
+ title: 'Document Primitives',
6
+ tagline:
7
+ '18 rocketstyle document components — render in browser AND export to 14+ formats via the same tree',
8
+ description:
9
+ '18 rocketstyle-based document primitives — `DocDocument`, `DocPage`, `DocSection`, `DocRow`, `DocColumn`, `DocHeading`, `DocText`, `DocLink`, `DocImage`, `DocTable`, `DocList`, `DocListItem`, `DocCode`, `DocDivider`, `DocSpacer`, `DocButton`, `DocQuote`, `DocPageBreak`. The same JSX tree renders in the browser AND exports to 14+ output formats (PDF, DOCX, XLSX, PPTX, HTML, Markdown, email, Slack, Teams, etc.). Primitives carry `_documentType` static markers; `extractDocumentTree` (from `@pyreon/connector-document`) walks the tree to produce a `DocNode` for `@pyreon/document`\\\'s `render()` to consume. `DocDocument` accepts reactive accessors for `title` / `author` / `subject` — function values are stored in `_documentProps` and resolved at extraction time so each export click reads the LIVE value from the underlying signal.',
10
+ category: 'browser',
11
+ features: [
12
+ '18 primitives covering structure, text, lists, tables, code, layout',
13
+ 'Same component tree renders in browser AND exports to 14+ formats',
14
+ 'extractDocNode(templateFn) — one-step extraction (recommended)',
15
+ 'createDocumentExport(templateFn) — two-step form (backward compat)',
16
+ 'DocDocument accepts reactive accessors for title / author / subject',
17
+ 'PR #197 fix: extractDocumentTree now calls rocketstyle components to read post-attrs metadata',
18
+ 'Layout props in .attrs() (direction / gap), CSS in .theme()',
19
+ ],
20
+ longExample: `import {
21
+ DocDocument, DocPage, DocSection, DocRow, DocColumn,
22
+ DocHeading, DocText, DocLink, DocImage, DocTable,
23
+ DocList, DocListItem, DocCode, DocDivider, DocSpacer,
24
+ DocButton, DocQuote, DocPageBreak,
25
+ extractDocNode,
26
+ } from '@pyreon/document-primitives'
27
+ import { download } from '@pyreon/document'
28
+
29
+ interface Resume { name: string; headline: string }
30
+
31
+ function ResumeTemplate(props: { resume: () => Resume }) {
32
+ return (
33
+ // title and author accept reactive accessors — extractDocNode
34
+ // resolves them at extraction time, so each export click reads
35
+ // the LIVE value from the underlying signal
36
+ <DocDocument
37
+ title={() => \`\${props.resume().name} — Resume\`}
38
+ author={() => props.resume().name}
39
+ >
40
+ <DocPage>
41
+ <DocSection>
42
+ <DocHeading level="h1">{() => props.resume().name}</DocHeading>
43
+ <DocText>{() => props.resume().headline}</DocText>
44
+ </DocSection>
45
+ </DocPage>
46
+ </DocDocument>
47
+ )
48
+ }
49
+
50
+ // One-step extraction → render to any of 14+ formats
51
+ const tree = extractDocNode(() => <ResumeTemplate resume={store.resume} />)
52
+ await download(tree, 'resume.pdf')
53
+ await download(tree, 'resume.docx')
54
+ await download(tree, 'resume.html')
55
+ await download(tree, 'resume.md')`,
56
+ api: [
57
+ {
58
+ name: 'extractDocNode',
59
+ kind: 'function',
60
+ signature: 'extractDocNode(templateFn: () => VNode, options?: ExtractOptions): DocNode',
61
+ summary:
62
+ "18 primitives: `DocDocument`, `DocPage`, `DocSection`, `DocRow`, `DocColumn`, `DocHeading`, `DocText`, `DocLink`, `DocImage`, `DocTable`, `DocList`, `DocListItem`, `DocCode`, `DocDivider`, `DocSpacer`, `DocButton`, `DocQuote`, `DocPageBreak`. Same component tree renders in browser AND exports — primitives carry `_documentType` statics that `extractDocumentTree` (from `@pyreon/connector-document`) walks to produce a `DocNode` for `@pyreon/document`\\\'s `render()` to consume. `DocDocument`\\\'s `title` / `author` / `subject` accept either a string OR a `() => string` accessor; function values are stored in `_documentProps` and resolved at extraction time so reactive metadata works without `const initial = get()` workarounds. PR #197 also fixed a latent bug in `extractDocumentTree`: it now CALLS rocketstyle component functions to read post-attrs `_documentProps`, where before it only looked at the JSX vnode\\\'s props directly — every primitive\\\'s metadata was silently dropped during export until that fix landed.",
63
+ example: `import {
64
+ DocDocument, DocPage, DocHeading, DocText,
65
+ extractDocNode,
66
+ } from '@pyreon/document-primitives'
67
+ import { download } from '@pyreon/document'
68
+
69
+ const tree = extractDocNode(() => (
70
+ <DocDocument title="Quarterly Report" author="Aisha">
71
+ <DocPage>
72
+ <DocHeading level="h1">Q4 Results</DocHeading>
73
+ <DocText>Revenue grew 23% YoY.</DocText>
74
+ </DocPage>
75
+ </DocDocument>
76
+ ))
77
+ await download(tree, 'report.pdf')
78
+ await download(tree, 'report.docx')`,
79
+ mistakes: [
80
+ 'Calling `props.title()` at the top of a template body to "fix" reactivity — components run ONCE at mount, so this captures the initial value forever. Pass the accessor through to DocDocument as-is: `<DocDocument title={() => get().name}>`',
81
+ "DocRow direction: layout props (direction, gap) go in `.attrs()` not `.theme()`. Element accepts `'inline'` | `'rows'` | `'reverseInline'` | `'reverseRows'` — `'row'` is NOT valid",
82
+ "For text children reactivity, pass a signal accessor and read inside body: `<DocText>{() => store.field()}</DocText>`",
83
+ "Don't declare runtime-filled fields (`tag`, `_documentProps`) in the rocketstyle `.attrs<P>()` generic — they leak as required JSX props",
84
+ 'Using `createDocumentExport(...).getDocNode()` in new code — prefer `extractDocNode(fn)` which is one call instead of two. `createDocumentExport` is kept for backward compat',
85
+ ],
86
+ seeAlso: ['createDocumentExport'],
87
+ },
88
+ {
89
+ name: 'createDocumentExport',
90
+ kind: 'function',
91
+ signature:
92
+ 'createDocumentExport(templateFn: () => VNode): { getDocNode(): DocNode }',
93
+ summary:
94
+ 'Wrapper around `extractDocNode`. The wrapper-object form is kept for callers that want to pass the helper around (e.g. to wrapper components that take a `DocumentExport` instance). New code should use `extractDocNode(templateFn)` which is one call instead of two.',
95
+ example: `// Two-step form (kept for backward compat). New code should
96
+ // prefer the one-step extractDocNode helper.
97
+ import { createDocumentExport } from '@pyreon/document-primitives'
98
+
99
+ const helper = createDocumentExport(() => <Resume name="Aisha" />)
100
+ const tree = helper.getDocNode()`,
101
+ seeAlso: ['extractDocNode'],
102
+ },
103
+ {
104
+ name: 'DocDocument',
105
+ kind: 'component',
106
+ signature:
107
+ '(props: { title?: string | (() => string); author?: string | (() => string); subject?: string | (() => string); children: VNodeChild }) => VNodeChild',
108
+ summary:
109
+ 'Root container for a document tree — produces a `_documentType: "document"` node. Accepts optional metadata: `title`, `author`, `subject`. Each accepts either a plain string OR a `() => string` accessor; function values are stored in `_documentProps` and resolved at extraction time so each export call reads the LIVE value from any underlying signal.',
110
+ example: `<DocDocument title="Quarterly Report" author="Aisha" subject="Q4 2025">
111
+ <DocPage>...</DocPage>
112
+ </DocDocument>
113
+
114
+ // Reactive metadata via accessor
115
+ <DocDocument title={() => \`\${user().name} — Resume\`}>
116
+ <DocPage>...</DocPage>
117
+ </DocDocument>`,
118
+ seeAlso: ['DocPage', 'extractDocNode'],
119
+ },
120
+ {
121
+ name: 'DocPage',
122
+ kind: 'component',
123
+ signature:
124
+ "(props: { size?: string; orientation?: 'portrait' | 'landscape'; children: VNodeChild }) => VNodeChild",
125
+ summary:
126
+ 'A page boundary inside a `DocDocument`. Paginated outputs (PDF, DOCX) treat each `DocPage` as a separate page; flow outputs (HTML, Markdown) render the contents inline with no page boundary. `size` and `orientation` configure paginated formats — common values: `"A4"`, `"Letter"`, `"Legal"`.',
127
+ example: `<DocDocument>
128
+ <DocPage size="A4" orientation="portrait">
129
+ <DocHeading level="h1">Page 1</DocHeading>
130
+ </DocPage>
131
+ <DocPage size="A4" orientation="landscape">
132
+ <DocHeading level="h1">Page 2 — landscape</DocHeading>
133
+ </DocPage>
134
+ </DocDocument>`,
135
+ seeAlso: ['DocDocument', 'DocPageBreak'],
136
+ },
137
+ {
138
+ name: 'DocSection',
139
+ kind: 'component',
140
+ signature:
141
+ "(props: { direction?: 'column' | 'row'; children: VNodeChild }) => VNodeChild",
142
+ summary:
143
+ 'Semantic grouping inside a page. Default `direction` is `"column"` (children stack vertically); `"row"` arranges them horizontally. Use to group related content for visual rhythm and for export targets that emit semantic section markers (HTML `<section>`, DOCX section breaks).',
144
+ example: `<DocPage>
145
+ <DocSection direction="column">
146
+ <DocHeading level="h2">Introduction</DocHeading>
147
+ <DocText>Background paragraph.</DocText>
148
+ </DocSection>
149
+ </DocPage>`,
150
+ seeAlso: ['DocRow', 'DocColumn'],
151
+ },
152
+ {
153
+ name: 'DocRow',
154
+ kind: 'component',
155
+ signature: '(props: { children: VNodeChild }) => VNodeChild',
156
+ summary:
157
+ 'Horizontal layout container — children flow inline with a fixed 8px gap. Use for side-by-side content (label + value pairs, columns of metadata, button rows). Layout-only — no user-configurable props on this primitive; for columns with custom widths use `DocColumn` inside.',
158
+ example: `<DocRow>
159
+ <DocText>Name:</DocText>
160
+ <DocText>Aisha Patel</DocText>
161
+ </DocRow>`,
162
+ seeAlso: ['DocColumn', 'DocSection'],
163
+ },
164
+ {
165
+ name: 'DocColumn',
166
+ kind: 'component',
167
+ signature:
168
+ '(props: { width?: number | string; children: VNodeChild }) => VNodeChild',
169
+ summary:
170
+ 'A column inside a row layout. Optional `width` controls the column\\\'s share of the row — accepts a number (interpreted as pixels) or a string (`"50%"`, `"1fr"`). When omitted, columns share available width equally. Most common shape is `<DocRow><DocColumn width="30%" /> <DocColumn width="70%" /></DocRow>`.',
171
+ example: `<DocRow>
172
+ <DocColumn width="30%">
173
+ <DocText>Label</DocText>
174
+ </DocColumn>
175
+ <DocColumn width="70%">
176
+ <DocText>Value</DocText>
177
+ </DocColumn>
178
+ </DocRow>`,
179
+ seeAlso: ['DocRow', 'DocSection'],
180
+ },
181
+ {
182
+ name: 'DocHeading',
183
+ kind: 'component',
184
+ signature:
185
+ "(props: { level?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; children: VNodeChild }) => VNodeChild",
186
+ summary:
187
+ 'Heading text — `level` (`"h1"` through `"h6"`) controls both visual size and the semantic level emitted to outputs (HTML `<h1>...<h6>`, DOCX heading styles, Markdown `#`...`######`). Default `level` is `"h1"`. Used for document structure that downstream tooling can build a TOC from.',
188
+ example: `<DocHeading level="h1">Quarterly Report</DocHeading>
189
+ <DocHeading level="h2">Q4 Results</DocHeading>
190
+ <DocHeading level="h3">Revenue Breakdown</DocHeading>`,
191
+ seeAlso: ['DocText', 'DocSection'],
192
+ },
193
+ {
194
+ name: 'DocText',
195
+ kind: 'component',
196
+ signature: '(props: { children: VNodeChild }) => VNodeChild',
197
+ summary:
198
+ 'Paragraph / inline text. The most common primitive — wraps any text content for the document. Children may be string literals OR signal accessors (`{() => store.field()}`) for reactive content. Visual styling (font weight, variant) is controlled via rocketstyle dimension props on the wrapping component definition.',
199
+ example: `<DocText>Static paragraph content.</DocText>
200
+
201
+ // Reactive children
202
+ <DocText>{() => \`Hello, \${user().name}\`}</DocText>`,
203
+ seeAlso: ['DocHeading', 'DocLink'],
204
+ },
205
+ {
206
+ name: 'DocLink',
207
+ kind: 'component',
208
+ signature: '(props: { href?: string; children: VNodeChild }) => VNodeChild',
209
+ summary:
210
+ 'Hyperlink within text. `href` is the URL — defaults to `"#"`. Outputs that support hyperlinks (HTML, PDF, DOCX, email) render this as a clickable link; flat outputs (plain text, certain Slack variants) render the link target inline as `text (href)`.',
211
+ example: `<DocText>
212
+ Read more on
213
+ <DocLink href="https://pyreon.dev">our blog</DocLink>
214
+ for the latest releases.
215
+ </DocText>`,
216
+ seeAlso: ['DocText'],
217
+ },
218
+ {
219
+ name: 'DocImage',
220
+ kind: 'component',
221
+ signature:
222
+ '(props: { src: string; alt?: string; width?: number; height?: number; caption?: string }) => VNodeChild',
223
+ summary:
224
+ 'An image embedded in the document. `src` is the image URL or data URI. `alt` is the accessible description (also used as fallback text in non-visual outputs). `width` / `height` constrain dimensions in pixels. Optional `caption` renders a caption beneath the image.',
225
+ example: `<DocImage
226
+ src="/charts/q4-revenue.png"
227
+ alt="Revenue grew 23% in Q4"
228
+ width={600}
229
+ height={400}
230
+ caption="Figure 1: Quarterly revenue, 2024-2025"
231
+ />`,
232
+ seeAlso: ['DocCode'],
233
+ },
234
+ {
235
+ name: 'DocTable',
236
+ kind: 'component',
237
+ signature:
238
+ '(props: { columns: TableColumn[]; rows: TableRow[]; headerStyle?: object; striped?: boolean; bordered?: boolean; caption?: string }) => VNodeChild',
239
+ summary:
240
+ 'Tabular data. `columns` defines the header cells (label, key, optional alignment). `rows` is an array of data rows keyed by column key. `striped` adds alternating row backgrounds; `bordered` adds cell borders; `caption` renders an accessible table caption. Both `rows` and `columns` are filtered before reaching the DOM via `.attrs(..., { filter: [...] })` because `HTMLTableElement.rows` / `.cells` are read-only DOM properties — assignment would crash.',
241
+ example: `<DocTable
242
+ caption="Q4 results by region"
243
+ bordered
244
+ striped
245
+ columns={[
246
+ { key: 'region', label: 'Region', align: 'left' },
247
+ { key: 'revenue', label: 'Revenue', align: 'right' },
248
+ { key: 'growth', label: 'YoY Growth', align: 'right' },
249
+ ]}
250
+ rows={[
251
+ { region: 'NA', revenue: '$12.4M', growth: '+23%' },
252
+ { region: 'EU', revenue: '$8.7M', growth: '+18%' },
253
+ { region: 'APAC', revenue: '$5.1M', growth: '+41%' },
254
+ ]}
255
+ />`,
256
+ seeAlso: ['DocList', 'DocSection'],
257
+ },
258
+ {
259
+ name: 'DocList',
260
+ kind: 'component',
261
+ signature: '(props: { ordered?: boolean; children: VNodeChild }) => VNodeChild',
262
+ summary:
263
+ 'Bulleted (default) or numbered (`ordered`) list. Children are typically `DocListItem` instances. Outputs map this to the right native list type — HTML `<ul>` / `<ol>`, Markdown `-` / `1.`, DOCX list styles.',
264
+ example: `<DocList>
265
+ <DocListItem>First bullet</DocListItem>
266
+ <DocListItem>Second bullet</DocListItem>
267
+ </DocList>
268
+
269
+ <DocList ordered>
270
+ <DocListItem>First step</DocListItem>
271
+ <DocListItem>Second step</DocListItem>
272
+ </DocList>`,
273
+ seeAlso: ['DocListItem'],
274
+ },
275
+ {
276
+ name: 'DocListItem',
277
+ kind: 'component',
278
+ signature: '(props: { children: VNodeChild }) => VNodeChild',
279
+ summary:
280
+ 'Single item inside a `DocList`. Children may be plain text, `DocText`, nested `DocList` for sublists, or any other inline primitive. Visual marker (bullet vs number) is decided by the parent list\\\'s `ordered` prop, not by the item.',
281
+ example: `<DocList>
282
+ <DocListItem>Top-level item</DocListItem>
283
+ <DocListItem>
284
+ Item with nested list
285
+ <DocList>
286
+ <DocListItem>Nested A</DocListItem>
287
+ <DocListItem>Nested B</DocListItem>
288
+ </DocList>
289
+ </DocListItem>
290
+ </DocList>`,
291
+ seeAlso: ['DocList'],
292
+ },
293
+ {
294
+ name: 'DocCode',
295
+ kind: 'component',
296
+ signature: '(props: { language?: string; children: VNodeChild }) => VNodeChild',
297
+ summary:
298
+ 'Monospace code block. Optional `language` hint enables syntax highlighting in outputs that support it (HTML via Prism / Shiki, Markdown fenced code blocks with language tag). Whitespace is preserved verbatim — pass code as a single string child to keep newlines.',
299
+ example: `<DocCode language="typescript">{
300
+ \`const flow = createFlow({
301
+ nodes: [{ id: '1', position: { x: 0, y: 0 } }],
302
+ edges: [],
303
+ })\`
304
+ }</DocCode>`,
305
+ seeAlso: ['DocText'],
306
+ },
307
+ {
308
+ name: 'DocDivider',
309
+ kind: 'component',
310
+ signature: '(props: { color?: string; thickness?: number }) => VNodeChild',
311
+ summary:
312
+ 'Horizontal rule — visual section separator. `color` controls the line color (any CSS color string); `thickness` controls the line thickness in pixels. Outputs map this to native dividers — HTML `<hr>`, Markdown `---`, DOCX horizontal rule.',
313
+ example: `<DocText>Above the divider.</DocText>
314
+ <DocDivider color="#e5e7eb" thickness={1} />
315
+ <DocText>Below the divider.</DocText>`,
316
+ seeAlso: ['DocSpacer'],
317
+ },
318
+ {
319
+ name: 'DocSpacer',
320
+ kind: 'component',
321
+ signature: '(props: { height?: number }) => VNodeChild',
322
+ summary:
323
+ 'Vertical whitespace — adds a blank vertical gap. `height` is in pixels (default 16). Use to space out content beyond what `DocSection` / `DocPage` margins provide. In flow outputs this becomes a styled blank block; in plain-text outputs, a sequence of newlines.',
324
+ example: `<DocSection>
325
+ <DocHeading level="h2">Section A</DocHeading>
326
+ <DocText>Content...</DocText>
327
+ <DocSpacer height={32} />
328
+ <DocHeading level="h2">Section B</DocHeading>
329
+ <DocText>More content...</DocText>
330
+ </DocSection>`,
331
+ seeAlso: ['DocDivider'],
332
+ },
333
+ {
334
+ name: 'DocButton',
335
+ kind: 'component',
336
+ signature: '(props: { href?: string; children: VNodeChild }) => VNodeChild',
337
+ summary:
338
+ 'Call-to-action button. Renders as a styled clickable element in HTML / email outputs (mail-safe button table layout for email), and as a labeled link in PDF / DOCX. `href` is the action URL — defaults to `"#"`. Visual style (variant) is controlled via rocketstyle dimensions on the component definition.',
339
+ example: `<DocButton href="https://pyreon.dev/signup">
340
+ Get started
341
+ </DocButton>`,
342
+ seeAlso: ['DocLink'],
343
+ },
344
+ {
345
+ name: 'DocQuote',
346
+ kind: 'component',
347
+ signature: '(props: { borderColor?: string; children: VNodeChild }) => VNodeChild',
348
+ summary:
349
+ 'Block quote — sets off a quoted passage with an indented left border. `borderColor` controls the indicator stripe (any CSS color). Outputs map this to native quote styling — HTML `<blockquote>`, Markdown `> ...`, DOCX quote style.',
350
+ example: `<DocQuote borderColor="#3b82f6">
351
+ <DocText>"The best way to predict the future is to build it."</DocText>
352
+ <DocText>— Aisha Patel, Q4 keynote</DocText>
353
+ </DocQuote>`,
354
+ seeAlso: ['DocText'],
355
+ },
356
+ {
357
+ name: 'DocPageBreak',
358
+ kind: 'component',
359
+ signature: '() => VNodeChild',
360
+ summary:
361
+ 'Explicit page boundary inside a `DocPage`. Forces the renderer to start a new page at this point in paginated outputs (PDF, DOCX). In flow outputs (HTML, Markdown), it renders as visible whitespace or is omitted entirely. Use for explicit pagination control beyond what `DocPage` boundaries already provide.',
362
+ example: `<DocPage>
363
+ <DocHeading level="h1">Section 1</DocHeading>
364
+ <DocText>...long content...</DocText>
365
+ <DocPageBreak />
366
+ <DocHeading level="h1">Section 2 — new page</DocHeading>
367
+ </DocPage>`,
368
+ seeAlso: ['DocPage'],
369
+ },
370
+ ],
371
+ gotchas: [
372
+ {
373
+ label: 'Reactive metadata',
374
+ note:
375
+ '`DocDocument` `title` / `author` / `subject` accept either strings or `() => string` accessors. Function values are stored in `_documentProps` and resolved by `extractDocumentTree` at extraction time, so each export click reads the LIVE value from any underlying signal — no `const initial = get()` workaround needed.',
376
+ },
377
+ {
378
+ label: 'PR #197 framework fix',
379
+ note:
380
+ 'Before PR #197, `extractDocumentTree` only looked at the JSX vnode\\\'s direct props for `_documentProps` — but rocketstyle\\\'s attrs HOC stamps that field AFTER the component runs, so every real primitive\\\'s metadata was silently dropped during export. The extractor now CALLS the component function to capture the post-attrs vnode and reads `_documentProps` from there.',
381
+ },
382
+ {
383
+ label: 'DocTable read-only DOM property collision',
384
+ note:
385
+ '`HTMLTableElement.rows` and `.cells` are read-only DOM properties — assigning to them throws. `DocTable` uses `.attrs(callback, { filter: ["rows", "columns", ...] })` to strip these props before they reach the DOM. Watch for similar collisions when adding new primitives that accept prop names matching native HTML element properties.',
386
+ },
387
+ ],
388
+ })
@@ -1 +0,0 @@
1
- {"version":3,"file":"index2.d.ts","names":[],"sources":["../../src/DocumentPreview.ts","../../src/primitives/DocButton.ts","../../src/primitives/DocCode.ts","../../src/primitives/DocColumn.ts","../../src/primitives/DocDivider.ts","../../src/primitives/DocDocument.ts","../../src/primitives/DocHeading.ts","../../src/primitives/DocImage.ts","../../src/primitives/DocLink.ts","../../src/primitives/DocList.ts","../../src/primitives/DocListItem.ts","../../src/primitives/DocPage.ts","../../src/primitives/DocPageBreak.ts","../../src/primitives/DocQuote.ts","../../src/primitives/DocRow.ts","../../src/primitives/DocSection.ts","../../src/primitives/DocSpacer.ts","../../src/primitives/DocTable.ts","../../src/primitives/DocText.ts","../../src/theme.ts","../../src/useDocumentExport.ts"],"mappings":";;;;;;;cAGM,eAAA,uBAAe,oBAAA,CAAA,OAAA;OA0ChB,gBAAA,CAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cC1CC,SAAA,uBA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;;;;;;;;;;;iBAmCJ,cAAA,CACd,UAAA,iBACA,OAAA,GAAS,qBAAA,GACR,SAAA;;;;;;;;;;;;;;;;;;;;;;;;iBA2Ba,oBAAA,CACd,UAAA,iBACA,OAAA,GAAS,qBAAA,GACR,cAAA"}
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["extractDocumentTree"],"sources":["../src/DocumentPreview.ts","../src/primitives/DocButton.ts","../src/primitives/DocCode.ts","../src/primitives/DocColumn.ts","../src/primitives/DocDivider.ts","../src/primitives/DocDocument.ts","../src/primitives/DocHeading.ts","../src/primitives/DocImage.ts","../src/primitives/DocLink.ts","../src/primitives/DocList.ts","../src/primitives/DocListItem.ts","../src/primitives/DocPage.ts","../src/primitives/DocPageBreak.ts","../src/primitives/DocQuote.ts","../src/primitives/DocRow.ts","../src/primitives/DocSection.ts","../src/primitives/DocSpacer.ts","../src/primitives/DocTable.ts","../src/primitives/DocText.ts","../src/theme.ts","../src/useDocumentExport.ts"],"sourcesContent":["import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocumentPreview = rocketstyle({\n dimensions: {\n sizes: 'size',\n },\n useBooleans: true,\n})({ name: 'DocumentPreview', component: Element })\n .theme({\n backgroundColor: '#f5f5f5',\n padding: 40,\n })\n .sizes({\n A4: { width: '210mm', minHeight: '297mm' },\n A3: { width: '297mm', minHeight: '420mm' },\n A5: { width: '148mm', minHeight: '210mm' },\n letter: { width: '8.5in', minHeight: '11in' },\n legal: { width: '8.5in', minHeight: '14in' },\n })\n .styles(\n (css: any) => css`\n display: flex;\n flex-direction: column;\n align-items: center;\n min-height: 100vh;\n\n & > * {\n background: white;\n padding: 25mm;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n margin: 20px 0;\n }\n `,\n )\n .statics({ _documentType: 'document' as const })\n .attrs<{\n size?: string\n showPageBreaks?: boolean\n }>((props) => ({\n tag: 'div',\n _documentProps: {\n ...(props.size ? { size: props.size } : { size: 'A4' }),\n ...(props.showPageBreaks ? { showPageBreaks: props.showPageBreaks } : {}),\n },\n }))\n\nexport default DocumentPreview\n","import { Text } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocButton = rocketstyle({\n dimensions: {\n variants: 'variant',\n },\n useBooleans: true,\n})({ name: 'DocButton', component: Text })\n .theme({\n fontSize: 14,\n fontWeight: 'bold',\n padding: '10px 24px',\n borderRadius: 4,\n textAlign: 'center',\n textDecoration: 'none',\n })\n .variants({\n primary: {\n backgroundColor: '#4f46e5',\n color: '#ffffff',\n },\n secondary: {\n backgroundColor: '#ffffff',\n color: '#4f46e5',\n borderWidth: 1,\n borderColor: '#4f46e5',\n borderStyle: 'solid',\n },\n })\n .statics({ _documentType: 'button' as const })\n .attrs<{ href?: string }>((props) => ({\n tag: 'a',\n _documentProps: { href: props.href ?? '#' },\n }))\n\nexport default DocButton\n","import { Text } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocCode = rocketstyle()({ name: 'DocCode', component: Text })\n .theme({\n fontFamily: 'ui-monospace, monospace',\n fontSize: 13,\n backgroundColor: '#f5f5f5',\n padding: '8px 12px',\n borderRadius: 4,\n })\n .statics({ _documentType: 'code' as const })\n .attrs<{ language?: string }>((props) => ({\n tag: 'pre',\n _documentProps: props.language ? { language: props.language } : {},\n }))\n\nexport default DocCode\n","import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocColumn = rocketstyle()({ name: 'DocColumn', component: Element })\n .statics({ _documentType: 'column' as const })\n .attrs<{ width?: number | string }>((props) => ({\n tag: 'div',\n _documentProps: props.width != null ? { width: props.width } : {},\n }))\n\nexport default DocColumn\n","import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocDivider = rocketstyle()({ name: 'DocDivider', component: Element })\n .theme({\n borderColor: '#dddddd',\n borderWidth: 1,\n })\n .statics({ _documentType: 'divider' as const })\n .attrs<{\n color?: string\n thickness?: number\n }>((props) => ({\n tag: 'hr',\n _documentProps: {\n ...(props.color ? { color: props.color } : {}),\n ...(props.thickness ? { thickness: props.thickness } : {}),\n },\n }))\n\nexport default DocDivider\n","import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\n/**\n * Root document container with metadata for the export pipeline.\n *\n * The `title`, `author`, and `subject` props each accept either a\n * plain `string` or a `() => string` accessor. Accessors are\n * resolved by `extractDocumentTree` at export time, so consumers\n * can pass live signal accessors without capturing values at\n * component mount.\n *\n * **Why accessors are needed**: rocketstyle's `.attrs()` callback\n * runs ONCE at component mount (see\n * `packages/ui-system/rocketstyle/src/hoc/rocketstyleAttrsHoc.ts`\n * line 38: \".attrs() callbacks run once at mount\"). If `title` were\n * `string`-only and a consumer wanted to bind it to a live signal,\n * they'd have to capture the initial value at template setup time\n * — meaning the export metadata would be permanently stale relative\n * to the live UI state.\n *\n * Storing the accessor in `_documentProps` and resolving it at\n * extraction time means every `extractDocumentTree` call (one per\n * export click) reads the live value. Plain string values still\n * work as before — `extractDocumentTree` only calls the value if\n * it's a function.\n *\n * @example Plain string\n * ```tsx\n * <DocDocument title=\"My Report\" author=\"Alice\">\n * ...\n * </DocDocument>\n * ```\n *\n * @example Reactive accessor (recommended for templates that drive\n * a live preview AND export the same tree)\n * ```tsx\n * function MyTemplate({ resume }: { resume: () => Resume }) {\n * return (\n * <DocDocument\n * title={() => `${resume().name} — Resume`}\n * author={() => resume().name}\n * >\n * ...\n * </DocDocument>\n * )\n * }\n * ```\n */\nconst DocDocument = rocketstyle()({ name: 'DocDocument', component: Element })\n .statics({ _documentType: 'document' as const })\n .attrs<{\n title?: string | (() => string)\n author?: string | (() => string)\n subject?: string | (() => string)\n }>((props) => ({\n tag: 'div',\n _documentProps: {\n // Pass accessor functions through unmodified — extractDocumentTree\n // resolves them at export time. Plain strings pass through too.\n // Empty / nullish values are omitted entirely so they don't\n // appear as `title: undefined` in the export metadata.\n ...(props.title != null ? { title: props.title } : {}),\n ...(props.author != null ? { author: props.author } : {}),\n ...(props.subject != null ? { subject: props.subject } : {}),\n },\n }))\n\nexport default DocDocument\n","import { Text } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocHeading = rocketstyle({\n dimensions: {\n levels: 'level',\n },\n useBooleans: true,\n})({ name: 'DocHeading', component: Text })\n .theme({\n fontWeight: 'bold',\n color: '#1a1a2e',\n marginBottom: 12,\n })\n .levels({\n h1: { fontSize: 32, lineHeight: 1.2 },\n h2: { fontSize: 24, lineHeight: 1.3 },\n h3: { fontSize: 20, lineHeight: 1.4 },\n h4: { fontSize: 18, lineHeight: 1.4 },\n h5: { fontSize: 16, lineHeight: 1.5 },\n h6: { fontSize: 14, lineHeight: 1.5 },\n })\n .statics({ _documentType: 'heading' as const })\n .attrs<{ level?: string }>((props) => {\n const lvl = props.level ?? 'h1'\n const num = Number.parseInt(String(lvl).replace('h', ''), 10) || 1\n return {\n tag: lvl,\n _documentProps: { level: num },\n }\n })\n\nexport default DocHeading\n","import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocImage = rocketstyle()({ name: 'DocImage', component: Element })\n .statics({ _documentType: 'image' as const })\n .attrs<{\n src?: string\n alt?: string\n width?: number | string\n height?: number | string\n caption?: string\n }>((props) => ({\n tag: 'img',\n _documentProps: {\n src: props.src ?? '',\n ...(props.alt ? { alt: props.alt } : {}),\n ...(props.width ? { width: props.width } : {}),\n ...(props.height ? { height: props.height } : {}),\n ...(props.caption ? { caption: props.caption } : {}),\n },\n }))\n\nexport default DocImage\n","import { Text } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocLink = rocketstyle()({ name: 'DocLink', component: Text })\n .theme({\n color: '#4f46e5',\n textDecoration: 'underline',\n })\n .statics({ _documentType: 'link' as const })\n .attrs<{ href?: string }>((props) => ({\n tag: 'a',\n _documentProps: { href: props.href ?? '#' },\n }))\n\nexport default DocLink\n","import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocList = rocketstyle()({ name: 'DocList', component: Element })\n .theme({\n marginBottom: 8,\n paddingLeft: 20,\n })\n .statics({ _documentType: 'list' as const })\n .attrs<{ ordered?: boolean }>((props) => ({\n tag: props.ordered ? 'ol' : 'ul',\n _documentProps: props.ordered ? { ordered: props.ordered } : {},\n }))\n\nexport default DocList\n","import { Text } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocListItem = rocketstyle()({ name: 'DocListItem', component: Text })\n .theme({\n fontSize: 14,\n lineHeight: 1.5,\n })\n .statics({ _documentType: 'list-item' as const })\n .attrs(() => ({\n tag: 'li',\n _documentProps: {},\n }))\n\nexport default DocListItem\n","import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocPage = rocketstyle()({ name: 'DocPage', component: Element })\n .theme({\n backgroundColor: '#ffffff',\n padding: '25mm',\n })\n .statics({ _documentType: 'page' as const })\n .attrs<{\n size?: string\n orientation?: string\n }>((props) => ({\n tag: 'div',\n _documentProps: {\n ...(props.size ? { size: props.size } : {}),\n ...(props.orientation ? { orientation: props.orientation } : {}),\n },\n }))\n\nexport default DocPage\n","import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocPageBreak = rocketstyle()({ name: 'DocPageBreak', component: Element })\n .statics({ _documentType: 'page-break' as const })\n .attrs(() => ({\n tag: 'div',\n _documentProps: {},\n }))\n\nexport default DocPageBreak\n","import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocQuote = rocketstyle()({ name: 'DocQuote', component: Element })\n .theme({\n borderColor: '#4f46e5',\n padding: '8px 16px',\n fontStyle: 'italic',\n color: '#666666',\n })\n .statics({ _documentType: 'quote' as const })\n .attrs<{ borderColor?: string }>((props) => ({\n tag: 'blockquote',\n _documentProps: props.borderColor ? { borderColor: props.borderColor } : {},\n }))\n\nexport default DocQuote\n","import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\n/**\n * Horizontal row of inline children. Per project conventions, layout\n * props (`direction`, `gap`) live in `.attrs()`, not `.theme()`. The\n * Element base accepts `direction: 'inline' | 'rows' | 'reverseInline'\n * | 'reverseRows'` — `'row'` is not a valid value.\n */\nconst DocRow = rocketstyle()({ name: 'DocRow', component: Element })\n .statics({ _documentType: 'row' as const })\n .attrs(() => ({\n tag: 'div',\n direction: 'inline' as const,\n gap: 8,\n _documentProps: {},\n }))\n\nexport default DocRow\n","import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocSection = rocketstyle({\n dimensions: {\n directions: 'direction',\n },\n useBooleans: false,\n})({ name: 'DocSection', component: Element })\n .theme({\n padding: 0,\n })\n .directions({\n column: {},\n row: { direction: 'row' },\n })\n .statics({ _documentType: 'section' as const })\n .attrs<{ direction?: string }>((props) => ({\n tag: 'div',\n _documentProps: { direction: props.direction ?? 'column' },\n }))\n\nexport default DocSection\n","import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocSpacer = rocketstyle()({ name: 'DocSpacer', component: Element })\n .statics({ _documentType: 'spacer' as const })\n .attrs<{ height?: number }>((props) => ({\n tag: 'div',\n _documentProps: { height: props.height ?? 16 },\n }))\n\nexport default DocSpacer\n","import { Element } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\n/**\n * Tabular data primitive.\n *\n * The `columns`, `rows`, `headerStyle`, `striped`, `bordered`, and\n * `caption` props are document-export metadata — they belong in\n * `_documentProps` only and must NOT be forwarded to the rendered\n * `<table>` element. The `filter` option on `.attrs()` strips them\n * from the props that flow into the DOM.\n *\n * Why this matters: HTMLTableElement's `rows` property is a\n * read-only `HTMLCollection` of `<tr>` elements. If `rows` were\n * forwarded as a DOM attr, the runtime would call\n * `el.rows = [...]` and crash with\n * `TypeError: Cannot set property rows of [object Object] which has\n * only a getter`. Same family for `columns` (`HTMLTableColElement`'s\n * column collection on parent table). Filtering them at the\n * rocketstyle layer keeps the DOM render path clean.\n */\nconst DocTable = rocketstyle({\n dimensions: {\n variants: 'variant',\n },\n useBooleans: true,\n})({ name: 'DocTable', component: Element })\n .theme({\n fontSize: 14,\n borderColor: '#dddddd',\n })\n .statics({ _documentType: 'table' as const })\n .attrs<{\n columns?: unknown[]\n rows?: unknown[]\n headerStyle?: Record<string, unknown>\n striped?: boolean\n bordered?: boolean\n caption?: string\n }>(\n (props) => ({\n tag: 'table',\n _documentProps: {\n columns: props.columns ?? [],\n rows: props.rows ?? [],\n ...(props.headerStyle ? { headerStyle: props.headerStyle } : {}),\n ...(props.striped ? { striped: props.striped } : {}),\n ...(props.bordered ? { bordered: props.bordered } : {}),\n ...(props.caption ? { caption: props.caption } : {}),\n },\n }),\n {\n filter: ['columns', 'rows', 'headerStyle', 'striped', 'bordered', 'caption'],\n },\n )\n\nexport default DocTable\n","import { Text } from '@pyreon/elements'\nimport rocketstyle from '@pyreon/rocketstyle'\n\nconst DocText = rocketstyle({\n dimensions: {\n variants: 'variant',\n weights: 'weight',\n },\n useBooleans: true,\n})({ name: 'DocText', component: Text })\n .theme({\n color: '#333333',\n lineHeight: 1.5,\n marginBottom: 8,\n })\n .variants({\n body: { fontSize: 14 },\n caption: { fontSize: 12, color: '#666666' },\n label: { fontSize: 11, fontWeight: 'bold' },\n })\n .weights({\n normal: { fontWeight: 'normal' },\n bold: { fontWeight: 'bold' },\n })\n .statics({ _documentType: 'text' as const })\n .attrs(() => ({\n tag: 'p',\n _documentProps: {},\n }))\n\nexport default DocText\n","export const documentTheme = {\n colors: {\n primary: '#4f46e5',\n text: '#333333',\n textSecondary: '#666666',\n background: '#ffffff',\n border: '#dddddd',\n headerBg: '#1a1a2e',\n headerText: '#ffffff',\n stripedRow: '#f9f9f9',\n },\n fonts: {\n heading: 'system-ui, -apple-system, sans-serif',\n body: 'system-ui, -apple-system, sans-serif',\n mono: 'ui-monospace, monospace',\n },\n sizes: {\n h1: 32,\n h2: 24,\n h3: 20,\n h4: 18,\n h5: 16,\n h6: 14,\n body: 14,\n caption: 12,\n label: 11,\n },\n spacing: {\n xs: 4,\n sm: 8,\n md: 16,\n lg: 24,\n xl: 40,\n },\n}\n\nexport type DocumentTheme = typeof documentTheme\n","import type { DocNode, ExtractOptions } from '@pyreon/connector-document'\nimport { extractDocumentTree } from '@pyreon/connector-document'\n\nexport interface DocumentExportOptions extends ExtractOptions {\n /** Theme object to provide during extraction. */\n theme?: Record<string, unknown>\n /** Mode: 'light' or 'dark'. */\n mode?: 'light' | 'dark'\n}\n\nexport interface DocumentExport {\n /** Extract the DocNode tree from the template. */\n getDocNode: () => DocNode\n}\n\n/**\n * One-step helper: extract a DocNode tree from a template function.\n *\n * Equivalent to `createDocumentExport(templateFn).getDocNode()` but\n * without the wrapper-object indirection. Use this when you just\n * need the tree to feed into `@pyreon/document`'s `render()` or\n * `download()` — which is the only thing the wrapper object was\n * ever used for in practice.\n *\n * ```ts\n * import { extractDocNode } from '@pyreon/document-primitives'\n * import { download } from '@pyreon/document'\n *\n * function ResumeTemplate({ resume }: { resume: () => Resume }) {\n * return (\n * <DocDocument title={() => `${resume().name} — Resume`}>\n * <DocPage>...</DocPage>\n * </DocDocument>\n * )\n * }\n *\n * // Export click handler:\n * const tree = extractDocNode(() => <ResumeTemplate resume={store.resume} />)\n * await download(tree, 'resume.pdf')\n * ```\n *\n * The two-step `createDocumentExport` form is still exported for\n * backward compatibility and for callers that want to pass the\n * helper object around (e.g. to wrapper components that take a\n * `DocumentExport` instance). New code should prefer this one-step\n * form unless you specifically need the helper object.\n */\nexport function extractDocNode(\n templateFn: () => unknown,\n options: DocumentExportOptions = {},\n): DocNode {\n return extractDocumentTree(templateFn(), options)\n}\n\n/**\n * Create a document export helper from a template function.\n *\n * The template function should return a VNode tree built with\n * document primitives (DocHeading, DocText, DocTable, etc.).\n *\n * ```ts\n * const doc = createDocumentExport(() =>\n * DocDocument({ title: 'Report', children: [\n * DocHeading({ h1: true, children: 'Sales Report' }),\n * DocText({ children: 'Q4 summary.' }),\n * ]})\n * )\n *\n * const tree = doc.getDocNode()\n * // Pass to @pyreon/document's render() for any format\n * ```\n *\n * **Most consumers should use `extractDocNode(templateFn)` instead**\n * — it's the same operation in one call without the wrapper\n * object. `createDocumentExport` is kept for callers that want to\n * pass the helper object around.\n */\nexport function createDocumentExport(\n templateFn: () => unknown,\n options: DocumentExportOptions = {},\n): DocumentExport {\n const getDocNode = (): DocNode => extractDocNode(templateFn, options)\n return { getDocNode }\n}\n"],"mappings":";;;;;AAGA,MAAM,kBAAkB,YAAY;CAClC,YAAY,EACV,OAAO,QACR;CACD,aAAa;CACd,CAAC,CAAC;CAAE,MAAM;CAAmB,WAAW;CAAS,CAAC,CAChD,MAAM;CACL,iBAAiB;CACjB,SAAS;CACV,CAAC,CACD,MAAM;CACL,IAAI;EAAE,OAAO;EAAS,WAAW;EAAS;CAC1C,IAAI;EAAE,OAAO;EAAS,WAAW;EAAS;CAC1C,IAAI;EAAE,OAAO;EAAS,WAAW;EAAS;CAC1C,QAAQ;EAAE,OAAO;EAAS,WAAW;EAAQ;CAC7C,OAAO;EAAE,OAAO;EAAS,WAAW;EAAQ;CAC7C,CAAC,CACD,QACE,QAAa,GAAG;;;;;;;;;;;;MAalB,CACA,QAAQ,EAAE,eAAe,YAAqB,CAAC,CAC/C,OAGG,WAAW;CACb,KAAK;CACL,gBAAgB;EACd,GAAI,MAAM,OAAO,EAAE,MAAM,MAAM,MAAM,GAAG,EAAE,MAAM,MAAM;EACtD,GAAI,MAAM,iBAAiB,EAAE,gBAAgB,MAAM,gBAAgB,GAAG,EAAE;EACzE;CACF,EAAE;;;;AC1CL,MAAM,YAAY,YAAY;CAC5B,YAAY,EACV,UAAU,WACX;CACD,aAAa;CACd,CAAC,CAAC;CAAE,MAAM;CAAa,WAAW;CAAM,CAAC,CACvC,MAAM;CACL,UAAU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