@formepdf/core 0.13.0 → 0.14.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/index.d.ts CHANGED
@@ -34,7 +34,11 @@ export type ElementPosition = 'Relative' | 'Absolute';
34
34
  * runtime actually emits, not what the JSX author wrote:
35
35
  *
36
36
  * - Six discrete heading tags (`H1`–`H6`) — NO generic `'Heading'`
37
- * - `TableRow` / `TableCell` — NO `Table` wrapper (unwrapped by layout)
37
+ * - `Table` wrapper containing `TableRow` / `TableCell` — one wrapper per
38
+ * page fragment when the table breaks across pages (clone semantics,
39
+ * like `View`). Before engine 0.14 layout unwrapped tables to sibling
40
+ * rows; the wrapper was added so table-level border/background paint
41
+ * and structural consumers get a real table node.
38
42
  * - `List` + `ListItem` + `Lbl` — from `<OrderedList>` / `<UnorderedList>`
39
43
  * - `FixedHeader` / `FixedFooter` — NO single `Fixed` (split by position)
40
44
  * - `Bookmark` — zero-height marker from `bookmark` on a container, emitted
@@ -52,7 +56,7 @@ export type ElementPosition = 'Relative' | 'Absolute';
52
56
  * never rendered"), on the exact drift risk this whole file exists
53
57
  * to prevent.
54
58
  */
55
- export type ElementNodeType = 'View' | 'Text' | 'TextLine' | 'H1' | 'H2' | 'H3' | 'H4' | 'H5' | 'H6' | 'TableRow' | 'TableCell' | 'List' | 'ListItem' | 'Lbl' | 'FixedHeader' | 'FixedFooter' | 'Bookmark' | 'Image' | 'Svg' | 'QrCode' | 'Barcode' | 'Canvas' | 'Watermark' | 'BarChart' | 'LineChart' | 'PieChart' | 'AreaChart' | 'DotPlot' | 'TextField' | 'Checkbox' | 'Dropdown' | 'RadioButton';
59
+ export type ElementNodeType = 'View' | 'Text' | 'TextLine' | 'H1' | 'H2' | 'H3' | 'H4' | 'H5' | 'H6' | 'Table' | 'TableRow' | 'TableCell' | 'List' | 'ListItem' | 'Lbl' | 'FixedHeader' | 'FixedFooter' | 'Bookmark' | 'Image' | 'Svg' | 'QrCode' | 'Barcode' | 'Canvas' | 'Watermark' | 'BarChart' | 'LineChart' | 'PieChart' | 'AreaChart' | 'DotPlot' | 'TextField' | 'Checkbox' | 'Dropdown' | 'RadioButton';
56
60
  /**
57
61
  * Drawing kind for the node. Governs the PDF operator the serializer
58
62
  * emits; NOT the same as `nodeType`, which describes semantic role.
package/dist/layout.d.ts CHANGED
@@ -82,13 +82,13 @@ export declare function getNodeText(node: ElementInfo): string;
82
82
  */
83
83
  export declare function getHeadingLevel(node: ElementInfo): 1 | 2 | 3 | 4 | 5 | 6 | null;
84
84
  /**
85
- * Every `TableRow` that is a direct child of `parent`.
85
+ * Every `TableRow` under `parent`, looking through `Table` wrapper nodes.
86
86
  *
87
- * Encapsulates the invariant that `<Table>` unwraps at layout time —
88
- * its `<Row>` children become sibling `TableRow` nodes on the
89
- * containing page/View, and there is no `Table` wrapper node to hang
90
- * rows off of. Pass the containing `page` (or the parent `View` that
91
- * held the `<Table>` in JSX) as `parent`.
87
+ * Since engine 0.14, `<Table>` emits a `Table` container element per page
88
+ * fragment with the rows nested inside it. Pass the containing `page`
89
+ * (or the parent `View` that held the `<Table>` in JSX) as `parent` —
90
+ * or a `Table` element directly. Loose sibling rows (the pre-0.14 shape)
91
+ * are still returned for compatibility with stored layouts.
92
92
  *
93
93
  * Returns rows in source order.
94
94
  */
package/dist/layout.js CHANGED
@@ -160,19 +160,27 @@ export function getHeadingLevel(node) {
160
160
  return null;
161
161
  }
162
162
  /**
163
- * Every `TableRow` that is a direct child of `parent`.
163
+ * Every `TableRow` under `parent`, looking through `Table` wrapper nodes.
164
164
  *
165
- * Encapsulates the invariant that `<Table>` unwraps at layout time —
166
- * its `<Row>` children become sibling `TableRow` nodes on the
167
- * containing page/View, and there is no `Table` wrapper node to hang
168
- * rows off of. Pass the containing `page` (or the parent `View` that
169
- * held the `<Table>` in JSX) as `parent`.
165
+ * Since engine 0.14, `<Table>` emits a `Table` container element per page
166
+ * fragment with the rows nested inside it. Pass the containing `page`
167
+ * (or the parent `View` that held the `<Table>` in JSX) as `parent` —
168
+ * or a `Table` element directly. Loose sibling rows (the pre-0.14 shape)
169
+ * are still returned for compatibility with stored layouts.
170
170
  *
171
171
  * Returns rows in source order.
172
172
  */
173
173
  export function getTableRows(parent) {
174
174
  const kids = 'elements' in parent ? parent.elements : parent.children;
175
- return kids.filter((k) => k.nodeType === 'TableRow');
175
+ const rows = [];
176
+ for (const k of kids) {
177
+ if (k.nodeType === 'TableRow')
178
+ rows.push(k);
179
+ else if (k.nodeType === 'Table') {
180
+ rows.push(...k.children.filter((c) => c.nodeType === 'TableRow'));
181
+ }
182
+ }
183
+ return rows;
176
184
  }
177
185
  /**
178
186
  * The `FixedHeader` and `FixedFooter` nodes on `page`. Encapsulates the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formepdf/core",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "WASM-powered PDF rendering engine for Forme",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -64,14 +64,14 @@
64
64
  "prepublishOnly": "npm run build && ./scripts/assert-tarball.sh"
65
65
  },
66
66
  "dependencies": {
67
- "@formepdf/react": "0.13.0"
67
+ "@formepdf/react": "0.14.0"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "react": "^18 || ^19"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@cloudflare/vitest-pool-workers": "^0.12.21",
74
- "@formepdf/templates": "0.13.0",
74
+ "@formepdf/templates": "0.14.0",
75
75
  "@pdf-testkit/vitest": "^0.1.1",
76
76
  "@types/node": "^22.0.0",
77
77
  "@types/react": "^19.0.0",
package/pkg/forme_bg.wasm CHANGED
Binary file
package/pkg/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "forme-pdf",
3
3
  "type": "module",
4
4
  "description": "A page-native PDF rendering engine. Layout INTO pages, not onto an infinite canvas.",
5
- "version": "0.13.0",
5
+ "version": "0.14.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
Binary file
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "forme-pdf",
3
3
  "description": "A page-native PDF rendering engine. Layout INTO pages, not onto an infinite canvas.",
4
- "version": "0.13.0",
4
+ "version": "0.14.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
Binary file
@@ -2,7 +2,7 @@
2
2
  "name": "forme-pdf",
3
3
  "type": "module",
4
4
  "description": "A page-native PDF rendering engine. Layout INTO pages, not onto an infinite canvas.",
5
- "version": "0.13.0",
5
+ "version": "0.14.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",