@pyreon/connector-document 0.29.0 → 0.32.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/README.md +1 -1
- package/lib/index.d.ts +44 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +17 -2
- package/lib/index.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -108,7 +108,7 @@ import type { DocNode, DocChild, NodeType, ResolvedStyles } from '@pyreon/connec
|
|
|
108
108
|
|
|
109
109
|
## Documentation
|
|
110
110
|
|
|
111
|
-
Full docs: [docs.pyreon.dev/docs/connector-document](https://docs.pyreon.dev/docs/connector-document) (or `docs/docs/connector-document.md` in this repo).
|
|
111
|
+
Full docs: [docs.pyreon.dev/docs/connector-document](https://docs.pyreon.dev/docs/connector-document) (or `docs/src/content/docs/connector-document.md` in this repo).
|
|
112
112
|
|
|
113
113
|
## License
|
|
114
114
|
|
package/lib/index.d.ts
CHANGED
|
@@ -31,6 +31,31 @@ declare function parseFontWeight(value: string | number | undefined): 'normal' |
|
|
|
31
31
|
*/
|
|
32
32
|
declare function parseLineHeight(value: string | number | undefined, rootSize?: number): number | undefined;
|
|
33
33
|
//#endregion
|
|
34
|
+
//#region src/resolveStyles.d.ts
|
|
35
|
+
/**
|
|
36
|
+
* A value resolver — maps a style value to a render-target-evaluable one.
|
|
37
|
+
* Under the CSS-variables theming mode, `$rocketstyle` values can be
|
|
38
|
+
* `var(--…)` reference strings PDF/DOCX/email can't evaluate; supply a
|
|
39
|
+
* resolver (compose `resolveModeVar` from `@pyreon/rocketstyle` with
|
|
40
|
+
* `resolveCssVarReferences` from `@pyreon/unistyle`) to inline them to raw
|
|
41
|
+
* values at extraction time. Non-strings / non-var values pass through
|
|
42
|
+
* unchanged.
|
|
43
|
+
*/
|
|
44
|
+
type VarResolver = (value: unknown) => unknown;
|
|
45
|
+
/**
|
|
46
|
+
* Convert a rocketstyle `$rocketstyle` theme object into a `ResolvedStyles`
|
|
47
|
+
* object compatible with `@pyreon/document`.
|
|
48
|
+
*
|
|
49
|
+
* Only extracts properties that `ResolvedStyles` supports — everything else
|
|
50
|
+
* (transitions, cursor, display, etc.) is silently ignored.
|
|
51
|
+
*
|
|
52
|
+
* `resolveVar` (optional): when the app runs under `init({ cssVariables: true })`,
|
|
53
|
+
* `$rocketstyle` values may be `var(--…)` strings; the resolver inlines them
|
|
54
|
+
* to raw values up front (PDF/DOCX can't evaluate custom properties). Omit it
|
|
55
|
+
* for the classic path — values are already raw.
|
|
56
|
+
*/
|
|
57
|
+
declare function resolveStyles(source: Record<string, unknown>, rootSize?: number, resolveVar?: VarResolver): ResolvedStyles;
|
|
58
|
+
//#endregion
|
|
34
59
|
//#region src/extractDocumentTree.d.ts
|
|
35
60
|
/** Marker interface: components with _documentType are extractable. */
|
|
36
61
|
interface DocumentMarker {
|
|
@@ -41,6 +66,24 @@ interface ExtractOptions {
|
|
|
41
66
|
rootSize?: number;
|
|
42
67
|
/** Include resolved styles from $rocketstyle. Default: true. */
|
|
43
68
|
includeStyles?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Inline `var(--…)` style values to raw values during extraction — needed
|
|
71
|
+
* when the app runs under `init({ cssVariables: true })`, since PDF/DOCX/
|
|
72
|
+
* email render targets can't evaluate CSS custom properties. Compose
|
|
73
|
+
* `resolveModeVar` (`@pyreon/rocketstyle`, resolves `mode(a,b)` pairs) with
|
|
74
|
+
* `resolveCssVarReferences` (`@pyreon/unistyle`, resolves theme-leaf vars
|
|
75
|
+
* via a `themeToCssVars(theme).registry`), e.g.:
|
|
76
|
+
*
|
|
77
|
+
* ```ts
|
|
78
|
+
* const { registry } = themeToCssVars(theme)
|
|
79
|
+
* extractDocNode(tpl, {
|
|
80
|
+
* resolveVar: (v) => resolveCssVarReferences(resolveModeVar(v, mode), registry),
|
|
81
|
+
* })
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* Omit for the classic (non-cssVariables) path — values are already raw.
|
|
85
|
+
*/
|
|
86
|
+
resolveVar?: VarResolver;
|
|
44
87
|
}
|
|
45
88
|
/**
|
|
46
89
|
* Walk a Pyreon VNode tree and extract a `DocNode` tree for `@pyreon/document`.
|
|
@@ -56,15 +99,5 @@ interface ExtractOptions {
|
|
|
56
99
|
*/
|
|
57
100
|
declare function extractDocumentTree(vnode: unknown, options?: ExtractOptions): DocNode;
|
|
58
101
|
//#endregion
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Convert a rocketstyle `$rocketstyle` theme object into a `ResolvedStyles`
|
|
62
|
-
* object compatible with `@pyreon/document`.
|
|
63
|
-
*
|
|
64
|
-
* Only extracts properties that `ResolvedStyles` supports — everything else
|
|
65
|
-
* (transitions, cursor, display, etc.) is silently ignored.
|
|
66
|
-
*/
|
|
67
|
-
declare function resolveStyles(rocketstyle: Record<string, unknown>, rootSize?: number): ResolvedStyles;
|
|
68
|
-
//#endregion
|
|
69
|
-
export { type DocChild, type DocNode, type DocumentMarker, type ExtractOptions, type NodeType, type ResolvedStyles, extractDocumentTree, parseBoxModel, parseCssDimension, parseFontWeight, parseLineHeight, resolveStyles };
|
|
102
|
+
export { type DocChild, type DocNode, type DocumentMarker, type ExtractOptions, type NodeType, type ResolvedStyles, type VarResolver, extractDocumentTree, parseBoxModel, parseCssDimension, parseFontWeight, parseLineHeight, resolveStyles };
|
|
70
103
|
//# sourceMappingURL=index2.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index2.d.ts","names":[],"sources":["../../src/cssValueParser.ts","../../src/
|
|
1
|
+
{"version":3,"file":"index2.d.ts","names":[],"sources":["../../src/cssValueParser.ts","../../src/resolveStyles.ts","../../src/extractDocumentTree.ts"],"mappings":";;;;;;AAiBA;;;;AAE8B;AAuB7B;iBAzBe,iBAAA,CACd,KAAA,sCACA,QAA4B;AAAA,KAyBzB,cAAA;;AAAc;AAWnB;;;;;;;iBAAgB,aAAA,CACd,KAAA,+BACA,QAAA,YACC,cAAc;AAAA;AAyBjB;;AAzBiB,iBAyBD,eAAA,CACd,KAAkC;;AAAA;AAapC;iBAAgB,eAAA,CACd,KAAA,+BACA,QAA4B;;;;;AAlF9B;;;;AAE8B;AAuB7B;;KCpBW,WAAA,IAAe,KAAc;;ADsBtB;AAWnB;;;;;;;;AAGiB;AAyBjB;iBClCgB,aAAA,CACd,MAAA,EAAQ,MAAA,mBACR,QAAA,WACA,UAAA,GAAa,WAAA,GACZ,cAAA;;;;UCjDc,cAAA;EACf,aAAA,EAAe,QAAQ;AAAA;AAAA,UAGR,cAAA;EFWa;EET5B,QAAA;EFkCiB;EEhCjB,aAAA;EFgCiB;AAAA;AAWnB;;;;;;;;AAGiB;AAyBjB;;;;AACoC;AAapC;EEnEE,UAAA,GAAa,WAAW;AAAA;;AFqEI;;;;AC7E9B;;;;AAAyC;AA2BzC;;iBCsOgB,mBAAA,CAAoB,KAAA,WAAgB,OAAA,GAAS,cAAA,GAAsB,OAAO"}
|
package/lib/index.js
CHANGED
|
@@ -99,15 +99,30 @@ const BORDER_STYLE_VALUES = new Set([
|
|
|
99
99
|
"dashed",
|
|
100
100
|
"dotted"
|
|
101
101
|
]);
|
|
102
|
+
/** Shallow copy with every own STRING value mapped through `resolveVar`. */
|
|
103
|
+
function remapStringValues(source, resolveVar) {
|
|
104
|
+
const out = {};
|
|
105
|
+
for (const key in source) {
|
|
106
|
+
const v = source[key];
|
|
107
|
+
out[key] = typeof v === "string" ? resolveVar(v) : v;
|
|
108
|
+
}
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
102
111
|
/**
|
|
103
112
|
* Convert a rocketstyle `$rocketstyle` theme object into a `ResolvedStyles`
|
|
104
113
|
* object compatible with `@pyreon/document`.
|
|
105
114
|
*
|
|
106
115
|
* Only extracts properties that `ResolvedStyles` supports — everything else
|
|
107
116
|
* (transitions, cursor, display, etc.) is silently ignored.
|
|
117
|
+
*
|
|
118
|
+
* `resolveVar` (optional): when the app runs under `init({ cssVariables: true })`,
|
|
119
|
+
* `$rocketstyle` values may be `var(--…)` strings; the resolver inlines them
|
|
120
|
+
* to raw values up front (PDF/DOCX can't evaluate custom properties). Omit it
|
|
121
|
+
* for the classic path — values are already raw.
|
|
108
122
|
*/
|
|
109
|
-
function resolveStyles(
|
|
123
|
+
function resolveStyles(source, rootSize = 16, resolveVar) {
|
|
110
124
|
const styles = {};
|
|
125
|
+
const rocketstyle = resolveVar ? remapStringValues(source, resolveVar) : source;
|
|
111
126
|
const fontSize = parseCssDimension(rocketstyle.fontSize, rootSize);
|
|
112
127
|
if (fontSize != null) styles.fontSize = fontSize;
|
|
113
128
|
if (typeof rocketstyle.fontFamily === "string") styles.fontFamily = rocketstyle.fontFamily;
|
|
@@ -211,7 +226,7 @@ function extractNode(vnode, options) {
|
|
|
211
226
|
const docProps = {};
|
|
212
227
|
if (rawDocProps) for (const [key, value] of Object.entries(rawDocProps)) docProps[key] = typeof value === "function" ? value() : value;
|
|
213
228
|
const stylesSource = props.$rocketstyle ?? extractedFromCall?.props?.$rocketstyle;
|
|
214
|
-
const styles = includeStyles && stylesSource ? resolveStyles(stylesSource, rootSize) : void 0;
|
|
229
|
+
const styles = includeStyles && stylesSource ? resolveStyles(stylesSource, rootSize, options.resolveVar) : void 0;
|
|
215
230
|
const node = {
|
|
216
231
|
type: docType,
|
|
217
232
|
props: docProps,
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/cssValueParser.ts","../src/resolveStyles.ts","../src/extractDocumentTree.ts"],"sourcesContent":["const PX_RE = /^(-?\\d+(?:\\.\\d+)?)px$/\nconst REM_RE = /^(-?\\d+(?:\\.\\d+)?)rem$/\nconst EM_RE = /^(-?\\d+(?:\\.\\d+)?)em$/\nconst PT_RE = /^(-?\\d+(?:\\.\\d+)?)pt$/\nconst NUMBER_RE = /^-?\\d+(?:\\.\\d+)?$/\n\nconst DEFAULT_ROOT_SIZE = 16\n\n/**\n * Parse a CSS dimension value to a number.\n *\n * - `14` → `14`\n * - `'14px'` → `14`\n * - `'1.5rem'` → `24` (with rootSize=16)\n * - `'12pt'` → `16` (pt × 1.333)\n * - `'auto'` → `undefined`\n */\nexport function parseCssDimension(\n value: string | number | null | undefined,\n rootSize = DEFAULT_ROOT_SIZE,\n): number | undefined {\n if (value == null) return undefined\n if (typeof value === 'number') return value\n if (typeof value !== 'string') return undefined\n\n const trimmed = value.trim()\n\n const pxMatch = PX_RE.exec(trimmed)\n if (pxMatch?.[1]) return Number.parseFloat(pxMatch[1])\n\n const remMatch = REM_RE.exec(trimmed)\n if (remMatch?.[1]) return Number.parseFloat(remMatch[1]) * rootSize\n\n const emMatch = EM_RE.exec(trimmed)\n if (emMatch?.[1]) return Number.parseFloat(emMatch[1]) * rootSize\n\n const ptMatch = PT_RE.exec(trimmed)\n if (ptMatch?.[1]) return Number.parseFloat(ptMatch[1]) * (4 / 3)\n\n if (NUMBER_RE.test(trimmed)) return Number.parseFloat(trimmed)\n\n return undefined\n}\n\ntype BoxModelResult = number | [number, number] | [number, number, number, number] | undefined\n\n/**\n * Parse a CSS padding/margin shorthand to document tuple format.\n *\n * - `8` → `8`\n * - `'8px'` → `8`\n * - `'8px 16px'` → `[8, 16]`\n * - `'8px 16px 8px 16px'` → `[8, 16, 8, 16]`\n * - `'8px 16px 12px'` → `[8, 16, 12, 16]` (CSS 3-value shorthand)\n */\nexport function parseBoxModel(\n value: string | number | undefined,\n rootSize = DEFAULT_ROOT_SIZE,\n): BoxModelResult {\n if (value == null) return undefined\n if (typeof value === 'number') return value\n\n const parts = value\n .trim()\n .split(/\\s+/)\n .map((p) => parseCssDimension(p, rootSize))\n\n const nums = parts.filter((p): p is number => p != null)\n if (nums.length !== parts.length) return undefined\n\n if (nums.length === 1) return nums[0]\n if (nums.length === 2) return [nums[0], nums[1]] as [number, number]\n if (nums.length === 3)\n return [nums[0], nums[1], nums[2], nums[1]] as [number, number, number, number]\n if (nums.length === 4)\n return [nums[0], nums[1], nums[2], nums[3]] as [number, number, number, number]\n\n return undefined\n}\n\n/**\n * Parse a CSS font-weight value.\n */\nexport function parseFontWeight(\n value: string | number | undefined,\n): 'normal' | 'bold' | number | undefined {\n if (value == null) return undefined\n if (typeof value === 'number') return value\n if (value === 'normal' || value === 'bold') return value\n const num = Number.parseInt(value, 10)\n if (!Number.isNaN(num)) return num\n return undefined\n}\n\n/**\n * Parse a CSS line-height value to a unitless number.\n */\nexport function parseLineHeight(\n value: string | number | undefined,\n rootSize = DEFAULT_ROOT_SIZE,\n): number | undefined {\n if (value == null) return undefined\n if (typeof value === 'number') return value\n if (value === 'normal') return undefined\n\n const dim = parseCssDimension(value, rootSize)\n if (dim != null) return dim\n\n return undefined\n}\n","import {\n parseBoxModel,\n parseCssDimension,\n parseFontWeight,\n parseLineHeight,\n} from './cssValueParser'\nimport type { ResolvedStyles } from './types'\n\nconst TEXT_ALIGN_VALUES = new Set(['left', 'center', 'right', 'justify'])\nconst FONT_STYLE_VALUES = new Set(['normal', 'italic'])\nconst TEXT_DECORATION_VALUES = new Set(['none', 'underline', 'line-through'])\nconst BORDER_STYLE_VALUES = new Set(['solid', 'dashed', 'dotted'])\n\n/**\n * Convert a rocketstyle `$rocketstyle` theme object into a `ResolvedStyles`\n * object compatible with `@pyreon/document`.\n *\n * Only extracts properties that `ResolvedStyles` supports — everything else\n * (transitions, cursor, display, etc.) is silently ignored.\n */\nexport function resolveStyles(rocketstyle: Record<string, unknown>, rootSize = 16): ResolvedStyles {\n const styles: ResolvedStyles = {}\n\n // Typography\n const fontSize = parseCssDimension(rocketstyle.fontSize as string | number, rootSize)\n if (fontSize != null) styles.fontSize = fontSize\n\n if (typeof rocketstyle.fontFamily === 'string') styles.fontFamily = rocketstyle.fontFamily\n\n const fontWeight = parseFontWeight(rocketstyle.fontWeight as string | number | undefined)\n if (fontWeight != null) styles.fontWeight = fontWeight\n\n if (typeof rocketstyle.fontStyle === 'string' && FONT_STYLE_VALUES.has(rocketstyle.fontStyle))\n styles.fontStyle = rocketstyle.fontStyle as 'normal' | 'italic'\n\n if (\n typeof rocketstyle.textDecoration === 'string' &&\n TEXT_DECORATION_VALUES.has(rocketstyle.textDecoration)\n )\n styles.textDecoration = rocketstyle.textDecoration as 'none' | 'underline' | 'line-through'\n\n if (typeof rocketstyle.color === 'string') styles.color = rocketstyle.color\n\n if (typeof rocketstyle.backgroundColor === 'string')\n styles.backgroundColor = rocketstyle.backgroundColor\n\n if (typeof rocketstyle.textAlign === 'string' && TEXT_ALIGN_VALUES.has(rocketstyle.textAlign))\n styles.textAlign = rocketstyle.textAlign as 'left' | 'center' | 'right' | 'justify'\n\n const lineHeight = parseLineHeight(\n rocketstyle.lineHeight as string | number | undefined,\n rootSize,\n )\n if (lineHeight != null) styles.lineHeight = lineHeight\n\n const letterSpacing = parseCssDimension(rocketstyle.letterSpacing as string | number, rootSize)\n if (letterSpacing != null) styles.letterSpacing = letterSpacing\n\n // Box model\n const padding = parseBoxModel(rocketstyle.padding as string | number | undefined, rootSize)\n if (padding != null) styles.padding = padding\n\n const margin = parseBoxModel(rocketstyle.margin as string | number | undefined, rootSize)\n if (margin != null) styles.margin = margin\n\n // Border\n const borderRadius = parseCssDimension(rocketstyle.borderRadius as string | number, rootSize)\n if (borderRadius != null) styles.borderRadius = borderRadius\n\n const borderWidth = parseCssDimension(rocketstyle.borderWidth as string | number, rootSize)\n if (borderWidth != null) styles.borderWidth = borderWidth\n\n if (typeof rocketstyle.borderColor === 'string') styles.borderColor = rocketstyle.borderColor\n\n if (\n typeof rocketstyle.borderStyle === 'string' &&\n BORDER_STYLE_VALUES.has(rocketstyle.borderStyle)\n )\n styles.borderStyle = rocketstyle.borderStyle as 'solid' | 'dashed' | 'dotted'\n\n // Sizing\n if (rocketstyle.width != null) {\n const w = parseCssDimension(rocketstyle.width as string | number, rootSize)\n styles.width = w ?? (rocketstyle.width as string)\n }\n\n if (rocketstyle.height != null) {\n const h = parseCssDimension(rocketstyle.height as string | number, rootSize)\n styles.height = h ?? (rocketstyle.height as string)\n }\n\n if (rocketstyle.maxWidth != null) {\n const mw = parseCssDimension(rocketstyle.maxWidth as string | number, rootSize)\n styles.maxWidth = mw ?? (rocketstyle.maxWidth as string)\n }\n\n // Opacity\n if (typeof rocketstyle.opacity === 'number') styles.opacity = rocketstyle.opacity\n\n return styles\n}\n","import { resolveStyles } from './resolveStyles'\nimport type { DocChild, DocNode, NodeType } from './types'\n\n/** Marker interface: components with _documentType are extractable. */\nexport interface DocumentMarker {\n _documentType: NodeType\n}\n\nexport interface ExtractOptions {\n /** Root font size for rem→px conversion. Default: 16. */\n rootSize?: number\n /** Include resolved styles from $rocketstyle. Default: true. */\n includeStyles?: boolean\n}\n\ntype VNodeLike = {\n type: string | ((...args: any[]) => any)\n props: Record<string, any>\n children: unknown[]\n}\n\nfunction isVNode(value: unknown): value is VNodeLike {\n return value != null && typeof value === 'object' && 'type' in value && 'props' in value\n}\n\nfunction getDocumentType(fn: unknown): NodeType | undefined {\n if (typeof fn !== 'function') return undefined\n const meta = (fn as any).meta\n if (meta?._documentType) return meta._documentType as NodeType\n // Fallback: check directly on function (non-rocketstyle components)\n if ('_documentType' in fn) return (fn as any)._documentType as NodeType\n return undefined\n}\n\nfunction flattenChildren(children: unknown[]): unknown[] {\n const result: unknown[] = []\n for (const child of children) {\n if (Array.isArray(child)) {\n result.push(...flattenChildren(child))\n } else if (typeof child === 'function') {\n // Reactive getter — call to resolve\n const resolved = child()\n if (Array.isArray(resolved)) {\n result.push(...flattenChildren(resolved))\n } else {\n result.push(resolved)\n }\n } else {\n result.push(child)\n }\n }\n return result\n}\n\nfunction extractChildren(children: unknown[], options: ExtractOptions): DocChild[] {\n const flat = flattenChildren(children)\n const result: DocChild[] = []\n\n for (const child of flat) {\n if (child == null || child === false || child === true) continue\n\n if (typeof child === 'string') {\n result.push(child)\n continue\n }\n\n if (typeof child === 'number') {\n result.push(String(child))\n continue\n }\n\n if (isVNode(child)) {\n const extracted = extractNode(child, options)\n if (Array.isArray(extracted)) {\n result.push(...extracted)\n } else if (extracted != null) {\n result.push(extracted)\n }\n }\n }\n\n return result\n}\n\nfunction extractNode(vnode: VNodeLike, options: ExtractOptions): DocNode | DocChild[] | null {\n const { type, props, children } = vnode\n const includeStyles = options.includeStyles !== false\n const rootSize = options.rootSize ?? 16\n\n // Component function with _documentType marker (via .statics() or direct)\n const docType = getDocumentType(type)\n if (docType) {\n // ── _documentProps resolution ────────────────────────────────────\n //\n // Three paths to find `_documentProps` on a documentType vnode,\n // tried in order:\n //\n // (A) **Pre-resolved on the JSX vnode itself** — used by test\n // fixtures that hand-construct vnodes with `_documentProps`\n // baked in. Cheapest path; tried first.\n //\n // (C) **Hoisted-attrs fast path (T3.1)** — when the\n // component is a real rocketstyle primitive, it exposes\n // `__rs_attrs` (the accumulated `.attrs()` callback chain)\n // as a typed static. We run the chain DIRECTLY with the\n // JSX vnode's props — `chain.reduce(Object.assign, {})` —\n // and read `_documentProps` from the result. No styled\n // wrapper invocation, no JSX tree creation, no dimension\n // resolution. This is the production path for every real\n // Pyreon doc-primitive (DocDocument, DocHeading, etc.).\n //\n // (B) **Full component invocation (legacy fallback)** — only\n // fires when neither A nor C applies. Used by hand-rolled\n // test fixtures that mark a function with `_documentType`\n // but don't go through rocketstyle (so `__rs_attrs` is\n // absent). Calls the component with the JSX props and\n // reads `_documentProps` from the post-call vnode.\n //\n // Why three paths instead of one: (A) is for test fixtures that\n // hardcode `_documentProps` directly on the JSX vnode — a pattern\n // that pre-dates the attrs HOC. (C) is the real-world path. (B)\n // is what (C) replaced — kept so non-rocketstyle fixtures still\n // work.\n //\n // **Function values in _documentProps are resolved at this\n // point** — primitives like DocDocument can store accessor\n // thunks (`() => string`) for reactive metadata, and the\n // export pipeline reads the LIVE value on each extraction.\n\n let rawDocProps: Record<string, unknown> | undefined\n let extractedFromCall: VNodeLike | null = null\n\n // Path A: pre-resolved on the JSX vnode (test fixtures)\n if (props._documentProps && typeof props._documentProps === 'object') {\n rawDocProps = props._documentProps as Record<string, unknown>\n } else if (typeof type === 'function') {\n // ── Path C (T3.1 fast path) ─────────────────────────────────────\n //\n // Rocketstyle exposes the accumulated `.attrs()` callback chain\n // as `__rs_attrs` on the component function. Run the chain\n // directly with the JSX vnode's props to get the post-attrs\n // result — no full component invocation, no styling work, no\n // wrapped JSX tree creation. Just the user-supplied attrs\n // callback(s) folded into a single props object.\n //\n // This eliminates the per-export cost of Path B for every real\n // rocketstyle primitive (DocDocument, DocHeading, etc.). The\n // idempotence assumption is now structural rather than implicit:\n // we never call the component, so it cannot have side effects\n // that affect the second extraction.\n const rsAttrs = (type as { __rs_attrs?: Array<(p: Record<string, unknown>) => Record<string, unknown>> }).__rs_attrs\n if (rsAttrs && rsAttrs.length > 0) {\n const mergedProps = { ...props }\n if (children && children.length > 0) {\n mergedProps.children = children.length === 1 ? children[0] : children\n }\n const attrsResult = rsAttrs.reduce<Record<string, unknown>>(\n (acc, fn) => Object.assign(acc, fn(mergedProps)),\n {},\n )\n if (attrsResult._documentProps && typeof attrsResult._documentProps === 'object') {\n rawDocProps = attrsResult._documentProps as Record<string, unknown>\n }\n } else {\n // Path B (fallback for non-rocketstyle docComponents):\n // invoke the component to get the post-attrs vnode. Used by\n // hand-rolled test fixtures that don't go through rocketstyle.\n const mergedProps = { ...props }\n if (children && children.length > 0) {\n mergedProps.children = children.length === 1 ? children[0] : children\n }\n const result = (type as (p: Record<string, unknown>) => unknown)(mergedProps)\n if (isVNode(result)) {\n extractedFromCall = result\n const innerProps = (result as { props?: Record<string, unknown> }).props\n if (innerProps?._documentProps && typeof innerProps._documentProps === 'object') {\n rawDocProps = innerProps._documentProps as Record<string, unknown>\n }\n }\n }\n }\n\n // Resolve function values (accessors) at extraction time\n const docProps: Record<string, unknown> = {}\n if (rawDocProps) {\n for (const [key, value] of Object.entries(rawDocProps)) {\n docProps[key] = typeof value === 'function' ? (value as () => unknown)() : value\n }\n }\n\n // Resolve styles from $rocketstyle. Look on the JSX vnode props\n // first; if the call result has its own $rocketstyle (because the\n // post-attrs vnode carries it down), use that as a fallback.\n const stylesSource =\n props.$rocketstyle ??\n (extractedFromCall as { props?: Record<string, unknown> } | null)?.props?.$rocketstyle\n const styles =\n includeStyles && stylesSource\n ? resolveStyles(stylesSource as Record<string, unknown>, rootSize)\n : undefined\n\n // Children: prefer the JSX vnode's children (the user-supplied\n // tree). The post-attrs call might wrap children in additional\n // styled elements that aren't part of the document tree.\n const docChildren = extractChildren(children ?? [], options)\n\n const node: DocNode = {\n type: docType,\n props: docProps,\n children: docChildren,\n }\n\n if (styles && Object.keys(styles).length > 0) {\n node.styles = styles\n }\n\n return node\n }\n\n // Component function WITHOUT _documentType — call it to get its VNode output\n if (typeof type === 'function') {\n const mergedProps = { ...props }\n if (children && children.length > 0) {\n mergedProps.children = children.length === 1 ? children[0] : children\n }\n\n const result = type(mergedProps)\n\n if (isVNode(result)) {\n return extractNode(result, options)\n }\n\n // The component returned a primitive or null\n if (typeof result === 'string') return [result]\n if (typeof result === 'number') return [String(result)]\n return null\n }\n\n // DOM element (string type like 'div', 'span') — transparent, extract children\n if (typeof type === 'string') {\n const docChildren = extractChildren(children ?? [], options)\n // If there's text content in the DOM element, collect it\n if (docChildren.length > 0) return docChildren\n return null\n }\n\n return null\n}\n\n/**\n * Walk a Pyreon VNode tree and extract a `DocNode` tree for `@pyreon/document`.\n *\n * For each VNode whose component has a `_documentType` marker:\n * 1. Read `_documentType` → `DocNode.type`\n * 2. Read `_documentProps` → `DocNode.props`\n * 3. Read `$rocketstyle` → `resolveStyles()` → `DocNode.styles`\n * 4. Recurse into children\n *\n * VNodes without `_documentType` are transparent — their children\n * are flattened into the parent's children list.\n */\nexport function extractDocumentTree(vnode: unknown, options: ExtractOptions = {}): DocNode {\n if (isVNode(vnode)) {\n const result = extractNode(vnode, options)\n if (result && !Array.isArray(result)) return result\n\n // Wrap loose children in a document node\n const children = Array.isArray(result) ? result : []\n return { type: 'document', props: {}, children }\n }\n\n // If passed a component function directly, call it\n if (typeof vnode === 'function') {\n const result = (vnode as () => unknown)()\n return extractDocumentTree(result, options)\n }\n\n return { type: 'document', props: {}, children: [] }\n}\n"],"mappings":";AAAA,MAAM,QAAQ;AACd,MAAM,SAAS;AACf,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,YAAY;AAElB,MAAM,oBAAoB;;;;;;;;;;AAW1B,SAAgB,kBACd,OACA,WAAW,mBACS;CACpB,IAAI,SAAS,MAAM,OAAO;CAC1B,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,OAAO,UAAU,UAAU,OAAO;CAEtC,MAAM,UAAU,MAAM,KAAK;CAE3B,MAAM,UAAU,MAAM,KAAK,OAAO;CAClC,IAAI,UAAU,IAAI,OAAO,OAAO,WAAW,QAAQ,EAAE;CAErD,MAAM,WAAW,OAAO,KAAK,OAAO;CACpC,IAAI,WAAW,IAAI,OAAO,OAAO,WAAW,SAAS,EAAE,IAAI;CAE3D,MAAM,UAAU,MAAM,KAAK,OAAO;CAClC,IAAI,UAAU,IAAI,OAAO,OAAO,WAAW,QAAQ,EAAE,IAAI;CAEzD,MAAM,UAAU,MAAM,KAAK,OAAO;CAClC,IAAI,UAAU,IAAI,OAAO,OAAO,WAAW,QAAQ,EAAE,KAAK,IAAI;CAE9D,IAAI,UAAU,KAAK,OAAO,GAAG,OAAO,OAAO,WAAW,OAAO;AAG/D;;;;;;;;;;AAaA,SAAgB,cACd,OACA,WAAW,mBACK;CAChB,IAAI,SAAS,MAAM,OAAO;CAC1B,IAAI,OAAO,UAAU,UAAU,OAAO;CAEtC,MAAM,QAAQ,MACX,KAAK,EACL,MAAM,KAAK,EACX,KAAK,MAAM,kBAAkB,GAAG,QAAQ,CAAC;CAE5C,MAAM,OAAO,MAAM,QAAQ,MAAmB,KAAK,IAAI;CACvD,IAAI,KAAK,WAAW,MAAM,QAAQ,OAAO;CAEzC,IAAI,KAAK,WAAW,GAAG,OAAO,KAAK;CACnC,IAAI,KAAK,WAAW,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ts","../src/extractDocumentTree.ts"],"sourcesContent":["const PX_RE = /^(-?\\d+(?:\\.\\d+)?)px$/\nconst REM_RE = /^(-?\\d+(?:\\.\\d+)?)rem$/\nconst EM_RE = /^(-?\\d+(?:\\.\\d+)?)em$/\nconst PT_RE = /^(-?\\d+(?:\\.\\d+)?)pt$/\nconst NUMBER_RE = /^-?\\d+(?:\\.\\d+)?$/\n\nconst DEFAULT_ROOT_SIZE = 16\n\n/**\n * Parse a CSS dimension value to a number.\n *\n * - `14` → `14`\n * - `'14px'` → `14`\n * - `'1.5rem'` → `24` (with rootSize=16)\n * - `'12pt'` → `16` (pt × 1.333)\n * - `'auto'` → `undefined`\n */\nexport function parseCssDimension(\n value: string | number | null | undefined,\n rootSize = DEFAULT_ROOT_SIZE,\n): number | undefined {\n if (value == null) return undefined\n if (typeof value === 'number') return value\n if (typeof value !== 'string') return undefined\n\n const trimmed = value.trim()\n\n const pxMatch = PX_RE.exec(trimmed)\n if (pxMatch?.[1]) return Number.parseFloat(pxMatch[1])\n\n const remMatch = REM_RE.exec(trimmed)\n if (remMatch?.[1]) return Number.parseFloat(remMatch[1]) * rootSize\n\n const emMatch = EM_RE.exec(trimmed)\n if (emMatch?.[1]) return Number.parseFloat(emMatch[1]) * rootSize\n\n const ptMatch = PT_RE.exec(trimmed)\n if (ptMatch?.[1]) return Number.parseFloat(ptMatch[1]) * (4 / 3)\n\n if (NUMBER_RE.test(trimmed)) return Number.parseFloat(trimmed)\n\n return undefined\n}\n\ntype BoxModelResult = number | [number, number] | [number, number, number, number] | undefined\n\n/**\n * Parse a CSS padding/margin shorthand to document tuple format.\n *\n * - `8` → `8`\n * - `'8px'` → `8`\n * - `'8px 16px'` → `[8, 16]`\n * - `'8px 16px 8px 16px'` → `[8, 16, 8, 16]`\n * - `'8px 16px 12px'` → `[8, 16, 12, 16]` (CSS 3-value shorthand)\n */\nexport function parseBoxModel(\n value: string | number | undefined,\n rootSize = DEFAULT_ROOT_SIZE,\n): BoxModelResult {\n if (value == null) return undefined\n if (typeof value === 'number') return value\n\n const parts = value\n .trim()\n .split(/\\s+/)\n .map((p) => parseCssDimension(p, rootSize))\n\n const nums = parts.filter((p): p is number => p != null)\n if (nums.length !== parts.length) return undefined\n\n if (nums.length === 1) return nums[0]\n if (nums.length === 2) return [nums[0], nums[1]] as [number, number]\n if (nums.length === 3)\n return [nums[0], nums[1], nums[2], nums[1]] as [number, number, number, number]\n if (nums.length === 4)\n return [nums[0], nums[1], nums[2], nums[3]] as [number, number, number, number]\n\n return undefined\n}\n\n/**\n * Parse a CSS font-weight value.\n */\nexport function parseFontWeight(\n value: string | number | undefined,\n): 'normal' | 'bold' | number | undefined {\n if (value == null) return undefined\n if (typeof value === 'number') return value\n if (value === 'normal' || value === 'bold') return value\n const num = Number.parseInt(value, 10)\n if (!Number.isNaN(num)) return num\n return undefined\n}\n\n/**\n * Parse a CSS line-height value to a unitless number.\n */\nexport function parseLineHeight(\n value: string | number | undefined,\n rootSize = DEFAULT_ROOT_SIZE,\n): number | undefined {\n if (value == null) return undefined\n if (typeof value === 'number') return value\n if (value === 'normal') return undefined\n\n const dim = parseCssDimension(value, rootSize)\n if (dim != null) return dim\n\n return undefined\n}\n","import {\n parseBoxModel,\n parseCssDimension,\n parseFontWeight,\n parseLineHeight,\n} from './cssValueParser'\nimport type { ResolvedStyles } from './types'\n\nconst TEXT_ALIGN_VALUES = new Set(['left', 'center', 'right', 'justify'])\nconst FONT_STYLE_VALUES = new Set(['normal', 'italic'])\nconst TEXT_DECORATION_VALUES = new Set(['none', 'underline', 'line-through'])\nconst BORDER_STYLE_VALUES = new Set(['solid', 'dashed', 'dotted'])\n\n/**\n * A value resolver — maps a style value to a render-target-evaluable one.\n * Under the CSS-variables theming mode, `$rocketstyle` values can be\n * `var(--…)` reference strings PDF/DOCX/email can't evaluate; supply a\n * resolver (compose `resolveModeVar` from `@pyreon/rocketstyle` with\n * `resolveCssVarReferences` from `@pyreon/unistyle`) to inline them to raw\n * values at extraction time. Non-strings / non-var values pass through\n * unchanged.\n */\nexport type VarResolver = (value: unknown) => unknown\n\n/** Shallow copy with every own STRING value mapped through `resolveVar`. */\nfunction remapStringValues(\n source: Record<string, unknown>,\n resolveVar: VarResolver,\n): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const key in source) {\n const v = source[key]\n out[key] = typeof v === 'string' ? resolveVar(v) : v\n }\n return out\n}\n\n/**\n * Convert a rocketstyle `$rocketstyle` theme object into a `ResolvedStyles`\n * object compatible with `@pyreon/document`.\n *\n * Only extracts properties that `ResolvedStyles` supports — everything else\n * (transitions, cursor, display, etc.) is silently ignored.\n *\n * `resolveVar` (optional): when the app runs under `init({ cssVariables: true })`,\n * `$rocketstyle` values may be `var(--…)` strings; the resolver inlines them\n * to raw values up front (PDF/DOCX can't evaluate custom properties). Omit it\n * for the classic path — values are already raw.\n */\nexport function resolveStyles(\n source: Record<string, unknown>,\n rootSize = 16,\n resolveVar?: VarResolver,\n): ResolvedStyles {\n const styles: ResolvedStyles = {}\n\n // Inline any var() references ONCE up front so every downstream read sees a\n // raw value. Shallow copy — only own string values are remapped.\n const rocketstyle: Record<string, unknown> = resolveVar\n ? remapStringValues(source, resolveVar)\n : source\n\n // Typography\n const fontSize = parseCssDimension(rocketstyle.fontSize as string | number, rootSize)\n if (fontSize != null) styles.fontSize = fontSize\n\n if (typeof rocketstyle.fontFamily === 'string') styles.fontFamily = rocketstyle.fontFamily\n\n const fontWeight = parseFontWeight(rocketstyle.fontWeight as string | number | undefined)\n if (fontWeight != null) styles.fontWeight = fontWeight\n\n if (typeof rocketstyle.fontStyle === 'string' && FONT_STYLE_VALUES.has(rocketstyle.fontStyle))\n styles.fontStyle = rocketstyle.fontStyle as 'normal' | 'italic'\n\n if (\n typeof rocketstyle.textDecoration === 'string' &&\n TEXT_DECORATION_VALUES.has(rocketstyle.textDecoration)\n )\n styles.textDecoration = rocketstyle.textDecoration as 'none' | 'underline' | 'line-through'\n\n if (typeof rocketstyle.color === 'string') styles.color = rocketstyle.color\n\n if (typeof rocketstyle.backgroundColor === 'string')\n styles.backgroundColor = rocketstyle.backgroundColor\n\n if (typeof rocketstyle.textAlign === 'string' && TEXT_ALIGN_VALUES.has(rocketstyle.textAlign))\n styles.textAlign = rocketstyle.textAlign as 'left' | 'center' | 'right' | 'justify'\n\n const lineHeight = parseLineHeight(\n rocketstyle.lineHeight as string | number | undefined,\n rootSize,\n )\n if (lineHeight != null) styles.lineHeight = lineHeight\n\n const letterSpacing = parseCssDimension(rocketstyle.letterSpacing as string | number, rootSize)\n if (letterSpacing != null) styles.letterSpacing = letterSpacing\n\n // Box model\n const padding = parseBoxModel(rocketstyle.padding as string | number | undefined, rootSize)\n if (padding != null) styles.padding = padding\n\n const margin = parseBoxModel(rocketstyle.margin as string | number | undefined, rootSize)\n if (margin != null) styles.margin = margin\n\n // Border\n const borderRadius = parseCssDimension(rocketstyle.borderRadius as string | number, rootSize)\n if (borderRadius != null) styles.borderRadius = borderRadius\n\n const borderWidth = parseCssDimension(rocketstyle.borderWidth as string | number, rootSize)\n if (borderWidth != null) styles.borderWidth = borderWidth\n\n if (typeof rocketstyle.borderColor === 'string') styles.borderColor = rocketstyle.borderColor\n\n if (\n typeof rocketstyle.borderStyle === 'string' &&\n BORDER_STYLE_VALUES.has(rocketstyle.borderStyle)\n )\n styles.borderStyle = rocketstyle.borderStyle as 'solid' | 'dashed' | 'dotted'\n\n // Sizing\n if (rocketstyle.width != null) {\n const w = parseCssDimension(rocketstyle.width as string | number, rootSize)\n styles.width = w ?? (rocketstyle.width as string)\n }\n\n if (rocketstyle.height != null) {\n const h = parseCssDimension(rocketstyle.height as string | number, rootSize)\n styles.height = h ?? (rocketstyle.height as string)\n }\n\n if (rocketstyle.maxWidth != null) {\n const mw = parseCssDimension(rocketstyle.maxWidth as string | number, rootSize)\n styles.maxWidth = mw ?? (rocketstyle.maxWidth as string)\n }\n\n // Opacity\n if (typeof rocketstyle.opacity === 'number') styles.opacity = rocketstyle.opacity\n\n return styles\n}\n","import { resolveStyles, type VarResolver } from './resolveStyles'\nimport type { DocChild, DocNode, NodeType } from './types'\n\n/** Marker interface: components with _documentType are extractable. */\nexport interface DocumentMarker {\n _documentType: NodeType\n}\n\nexport interface ExtractOptions {\n /** Root font size for rem→px conversion. Default: 16. */\n rootSize?: number\n /** Include resolved styles from $rocketstyle. Default: true. */\n includeStyles?: boolean\n /**\n * Inline `var(--…)` style values to raw values during extraction — needed\n * when the app runs under `init({ cssVariables: true })`, since PDF/DOCX/\n * email render targets can't evaluate CSS custom properties. Compose\n * `resolveModeVar` (`@pyreon/rocketstyle`, resolves `mode(a,b)` pairs) with\n * `resolveCssVarReferences` (`@pyreon/unistyle`, resolves theme-leaf vars\n * via a `themeToCssVars(theme).registry`), e.g.:\n *\n * ```ts\n * const { registry } = themeToCssVars(theme)\n * extractDocNode(tpl, {\n * resolveVar: (v) => resolveCssVarReferences(resolveModeVar(v, mode), registry),\n * })\n * ```\n *\n * Omit for the classic (non-cssVariables) path — values are already raw.\n */\n resolveVar?: VarResolver\n}\n\ntype VNodeLike = {\n type: string | ((...args: any[]) => any)\n props: Record<string, any>\n children: unknown[]\n}\n\nfunction isVNode(value: unknown): value is VNodeLike {\n return value != null && typeof value === 'object' && 'type' in value && 'props' in value\n}\n\nfunction getDocumentType(fn: unknown): NodeType | undefined {\n if (typeof fn !== 'function') return undefined\n const meta = (fn as any).meta\n if (meta?._documentType) return meta._documentType as NodeType\n // Fallback: check directly on function (non-rocketstyle components)\n if ('_documentType' in fn) return (fn as any)._documentType as NodeType\n return undefined\n}\n\nfunction flattenChildren(children: unknown[]): unknown[] {\n const result: unknown[] = []\n for (const child of children) {\n if (Array.isArray(child)) {\n result.push(...flattenChildren(child))\n } else if (typeof child === 'function') {\n // Reactive getter — call to resolve\n const resolved = child()\n if (Array.isArray(resolved)) {\n result.push(...flattenChildren(resolved))\n } else {\n result.push(resolved)\n }\n } else {\n result.push(child)\n }\n }\n return result\n}\n\nfunction extractChildren(children: unknown[], options: ExtractOptions): DocChild[] {\n const flat = flattenChildren(children)\n const result: DocChild[] = []\n\n for (const child of flat) {\n if (child == null || child === false || child === true) continue\n\n if (typeof child === 'string') {\n result.push(child)\n continue\n }\n\n if (typeof child === 'number') {\n result.push(String(child))\n continue\n }\n\n if (isVNode(child)) {\n const extracted = extractNode(child, options)\n if (Array.isArray(extracted)) {\n result.push(...extracted)\n } else if (extracted != null) {\n result.push(extracted)\n }\n }\n }\n\n return result\n}\n\nfunction extractNode(vnode: VNodeLike, options: ExtractOptions): DocNode | DocChild[] | null {\n const { type, props, children } = vnode\n const includeStyles = options.includeStyles !== false\n const rootSize = options.rootSize ?? 16\n\n // Component function with _documentType marker (via .statics() or direct)\n const docType = getDocumentType(type)\n if (docType) {\n // ── _documentProps resolution ────────────────────────────────────\n //\n // Three paths to find `_documentProps` on a documentType vnode,\n // tried in order:\n //\n // (A) **Pre-resolved on the JSX vnode itself** — used by test\n // fixtures that hand-construct vnodes with `_documentProps`\n // baked in. Cheapest path; tried first.\n //\n // (C) **Hoisted-attrs fast path (T3.1)** — when the\n // component is a real rocketstyle primitive, it exposes\n // `__rs_attrs` (the accumulated `.attrs()` callback chain)\n // as a typed static. We run the chain DIRECTLY with the\n // JSX vnode's props — `chain.reduce(Object.assign, {})` —\n // and read `_documentProps` from the result. No styled\n // wrapper invocation, no JSX tree creation, no dimension\n // resolution. This is the production path for every real\n // Pyreon doc-primitive (DocDocument, DocHeading, etc.).\n //\n // (B) **Full component invocation (legacy fallback)** — only\n // fires when neither A nor C applies. Used by hand-rolled\n // test fixtures that mark a function with `_documentType`\n // but don't go through rocketstyle (so `__rs_attrs` is\n // absent). Calls the component with the JSX props and\n // reads `_documentProps` from the post-call vnode.\n //\n // Why three paths instead of one: (A) is for test fixtures that\n // hardcode `_documentProps` directly on the JSX vnode — a pattern\n // that pre-dates the attrs HOC. (C) is the real-world path. (B)\n // is what (C) replaced — kept so non-rocketstyle fixtures still\n // work.\n //\n // **Function values in _documentProps are resolved at this\n // point** — primitives like DocDocument can store accessor\n // thunks (`() => string`) for reactive metadata, and the\n // export pipeline reads the LIVE value on each extraction.\n\n let rawDocProps: Record<string, unknown> | undefined\n let extractedFromCall: VNodeLike | null = null\n\n // Path A: pre-resolved on the JSX vnode (test fixtures)\n if (props._documentProps && typeof props._documentProps === 'object') {\n rawDocProps = props._documentProps as Record<string, unknown>\n } else if (typeof type === 'function') {\n // ── Path C (T3.1 fast path) ─────────────────────────────────────\n //\n // Rocketstyle exposes the accumulated `.attrs()` callback chain\n // as `__rs_attrs` on the component function. Run the chain\n // directly with the JSX vnode's props to get the post-attrs\n // result — no full component invocation, no styling work, no\n // wrapped JSX tree creation. Just the user-supplied attrs\n // callback(s) folded into a single props object.\n //\n // This eliminates the per-export cost of Path B for every real\n // rocketstyle primitive (DocDocument, DocHeading, etc.). The\n // idempotence assumption is now structural rather than implicit:\n // we never call the component, so it cannot have side effects\n // that affect the second extraction.\n const rsAttrs = (type as { __rs_attrs?: Array<(p: Record<string, unknown>) => Record<string, unknown>> }).__rs_attrs\n if (rsAttrs && rsAttrs.length > 0) {\n const mergedProps = { ...props }\n if (children && children.length > 0) {\n mergedProps.children = children.length === 1 ? children[0] : children\n }\n const attrsResult = rsAttrs.reduce<Record<string, unknown>>(\n (acc, fn) => Object.assign(acc, fn(mergedProps)),\n {},\n )\n if (attrsResult._documentProps && typeof attrsResult._documentProps === 'object') {\n rawDocProps = attrsResult._documentProps as Record<string, unknown>\n }\n } else {\n // Path B (fallback for non-rocketstyle docComponents):\n // invoke the component to get the post-attrs vnode. Used by\n // hand-rolled test fixtures that don't go through rocketstyle.\n const mergedProps = { ...props }\n if (children && children.length > 0) {\n mergedProps.children = children.length === 1 ? children[0] : children\n }\n const result = (type as (p: Record<string, unknown>) => unknown)(mergedProps)\n if (isVNode(result)) {\n extractedFromCall = result\n const innerProps = (result as { props?: Record<string, unknown> }).props\n if (innerProps?._documentProps && typeof innerProps._documentProps === 'object') {\n rawDocProps = innerProps._documentProps as Record<string, unknown>\n }\n }\n }\n }\n\n // Resolve function values (accessors) at extraction time\n const docProps: Record<string, unknown> = {}\n if (rawDocProps) {\n for (const [key, value] of Object.entries(rawDocProps)) {\n docProps[key] = typeof value === 'function' ? (value as () => unknown)() : value\n }\n }\n\n // Resolve styles from $rocketstyle. Look on the JSX vnode props\n // first; if the call result has its own $rocketstyle (because the\n // post-attrs vnode carries it down), use that as a fallback.\n const stylesSource =\n props.$rocketstyle ??\n (extractedFromCall as { props?: Record<string, unknown> } | null)?.props?.$rocketstyle\n const styles =\n includeStyles && stylesSource\n ? resolveStyles(stylesSource as Record<string, unknown>, rootSize, options.resolveVar)\n : undefined\n\n // Children: prefer the JSX vnode's children (the user-supplied\n // tree). The post-attrs call might wrap children in additional\n // styled elements that aren't part of the document tree.\n const docChildren = extractChildren(children ?? [], options)\n\n const node: DocNode = {\n type: docType,\n props: docProps,\n children: docChildren,\n }\n\n if (styles && Object.keys(styles).length > 0) {\n node.styles = styles\n }\n\n return node\n }\n\n // Component function WITHOUT _documentType — call it to get its VNode output\n if (typeof type === 'function') {\n const mergedProps = { ...props }\n if (children && children.length > 0) {\n mergedProps.children = children.length === 1 ? children[0] : children\n }\n\n const result = type(mergedProps)\n\n if (isVNode(result)) {\n return extractNode(result, options)\n }\n\n // The component returned a primitive or null\n if (typeof result === 'string') return [result]\n if (typeof result === 'number') return [String(result)]\n return null\n }\n\n // DOM element (string type like 'div', 'span') — transparent, extract children\n if (typeof type === 'string') {\n const docChildren = extractChildren(children ?? [], options)\n // If there's text content in the DOM element, collect it\n if (docChildren.length > 0) return docChildren\n return null\n }\n\n return null\n}\n\n/**\n * Walk a Pyreon VNode tree and extract a `DocNode` tree for `@pyreon/document`.\n *\n * For each VNode whose component has a `_documentType` marker:\n * 1. Read `_documentType` → `DocNode.type`\n * 2. Read `_documentProps` → `DocNode.props`\n * 3. Read `$rocketstyle` → `resolveStyles()` → `DocNode.styles`\n * 4. Recurse into children\n *\n * VNodes without `_documentType` are transparent — their children\n * are flattened into the parent's children list.\n */\nexport function extractDocumentTree(vnode: unknown, options: ExtractOptions = {}): DocNode {\n if (isVNode(vnode)) {\n const result = extractNode(vnode, options)\n if (result && !Array.isArray(result)) return result\n\n // Wrap loose children in a document node\n const children = Array.isArray(result) ? result : []\n return { type: 'document', props: {}, children }\n }\n\n // If passed a component function directly, call it\n if (typeof vnode === 'function') {\n const result = (vnode as () => unknown)()\n return extractDocumentTree(result, options)\n }\n\n return { type: 'document', props: {}, children: [] }\n}\n"],"mappings":";AAAA,MAAM,QAAQ;AACd,MAAM,SAAS;AACf,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,YAAY;AAElB,MAAM,oBAAoB;;;;;;;;;;AAW1B,SAAgB,kBACd,OACA,WAAW,mBACS;CACpB,IAAI,SAAS,MAAM,OAAO;CAC1B,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,OAAO,UAAU,UAAU,OAAO;CAEtC,MAAM,UAAU,MAAM,KAAK;CAE3B,MAAM,UAAU,MAAM,KAAK,OAAO;CAClC,IAAI,UAAU,IAAI,OAAO,OAAO,WAAW,QAAQ,EAAE;CAErD,MAAM,WAAW,OAAO,KAAK,OAAO;CACpC,IAAI,WAAW,IAAI,OAAO,OAAO,WAAW,SAAS,EAAE,IAAI;CAE3D,MAAM,UAAU,MAAM,KAAK,OAAO;CAClC,IAAI,UAAU,IAAI,OAAO,OAAO,WAAW,QAAQ,EAAE,IAAI;CAEzD,MAAM,UAAU,MAAM,KAAK,OAAO;CAClC,IAAI,UAAU,IAAI,OAAO,OAAO,WAAW,QAAQ,EAAE,KAAK,IAAI;CAE9D,IAAI,UAAU,KAAK,OAAO,GAAG,OAAO,OAAO,WAAW,OAAO;AAG/D;;;;;;;;;;AAaA,SAAgB,cACd,OACA,WAAW,mBACK;CAChB,IAAI,SAAS,MAAM,OAAO;CAC1B,IAAI,OAAO,UAAU,UAAU,OAAO;CAEtC,MAAM,QAAQ,MACX,KAAK,EACL,MAAM,KAAK,EACX,KAA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AAgB,UAA0B,CAAC,GAAY;CACzF,IAAI,QAAQ,KAAK,GAAG;EAClB,MAAM,SAAS,YAAY,OAAO,OAAO;EACzC,IAAI,UAAU,CAAC,MAAM,QAAQ,MAAM,GAAG,OAAO;EAI7C,OAAO;GAAE,MAAM;GAAY,OAAO,CAAC;GAAG,UADrB,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC;EACJ;CACjD;CAGA,IAAI,OAAO,UAAU,YAEnB,OAAO,oBADS,MACgB,GAAG,OAAO;CAG5C,OAAO;EAAE,MAAM;EAAY,OAAO,CAAC;EAAG,UAAU,CAAC;CAAE;AACrD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/connector-document",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Bridge between @pyreon/pyreon styled components and @pyreon/document rendering",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/pyreon/pyreon/tree/main/packages/ui-system/connector-document#readme",
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"typecheck": "tsc --noEmit"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@pyreon/core": "^0.
|
|
43
|
+
"@pyreon/core": "^0.32.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@pyreon/document": "^0.
|
|
46
|
+
"@pyreon/document": "^0.32.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@pyreon/reactivity": "^0.
|
|
50
|
-
"@pyreon/test-utils": "^0.13.
|
|
51
|
-
"@pyreon/typescript": "^0.
|
|
52
|
-
"@pyreon/vitest-config": "0.13.
|
|
49
|
+
"@pyreon/reactivity": "^0.32.0",
|
|
50
|
+
"@pyreon/test-utils": "^0.13.20",
|
|
51
|
+
"@pyreon/typescript": "^0.32.0",
|
|
52
|
+
"@pyreon/vitest-config": "0.13.3",
|
|
53
53
|
"@vitest/browser-playwright": "^4.1.8",
|
|
54
54
|
"@vitus-labs/tools-rolldown": "^2.5.0"
|
|
55
55
|
},
|