@uniweb/press 0.4.5 → 0.4.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/press",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "Press your React components into downloadable files — Word, Excel, PDF. Registration-based pattern with lazy-loaded format adapters.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -52,7 +52,7 @@
52
52
  "devDependencies": {
53
53
  "@testing-library/react": "^16.0.0",
54
54
  "jsdom": "^25.0.0",
55
- "vitest": "^2.0.0"
55
+ "vitest": "^4.1.7"
56
56
  },
57
57
  "scripts": {
58
58
  "test": "vitest run",
@@ -3,7 +3,7 @@
3
3
  * that builders should consult when foundations don't pass explicit
4
4
  * literal values.
5
5
  *
6
- * Stage 5 of kb/framework/plans/press-professional-docx.md.
6
+ * Stage 5 of the print/docx work.
7
7
  *
8
8
  * The shape is intentionally small and forgiving: a foundation passes
9
9
  * whatever subset of keys it cares about, and builders fall back to
@@ -444,8 +444,11 @@ function irToParagraph(node) {
444
444
  options.spacing = {}
445
445
  const before = toInt(node.spacing.before)
446
446
  const after = toInt(node.spacing.after)
447
+ const line = toInt(node.spacing.line)
447
448
  if (before != null) options.spacing.before = before
448
449
  if (after != null) options.spacing.after = after
450
+ if (line != null) options.spacing.line = line
451
+ if (node.spacing.lineRule) options.spacing.lineRule = node.spacing.lineRule
449
452
  }
450
453
  if (node.bullet) {
451
454
  options.bullet = { level: toInt(node.bullet.level) ?? 0 }
@@ -531,8 +534,8 @@ function irToInlineChildren(node) {
531
534
  // v1 fallback: emit the LaTeX source as plain text. Better
532
535
  // than the MathML soup that was leaking before this case
533
536
  // existed (`<mo>…</mo>` operator names appearing as letters
534
- // in the document). A faithful OMML emitter is tracked in
535
- // kb/framework/plans/math-print-adapters.md §"Future work".
537
+ // in the document). A faithful OMML emitter is tracked as
538
+ // future work.
536
539
  return [new TextRun({ text: node.latex || '' })]
537
540
  }
538
541
  default:
@@ -2,7 +2,7 @@
2
2
  * BrandLogo — a brand image suitable for page headers, cover blocks,
3
3
  * and watermarks.
4
4
  *
5
- * Stage 6.4 of kb/framework/plans/press-professional-docx.md.
5
+ * Stage 6.4 of the print/docx work.
6
6
  *
7
7
  * Emits a bare `<img data-type="image">` (no Paragraph wrapper) so
8
8
  * the IR walker keeps the image at section level — Press's docx
package/src/docx/Math.jsx CHANGED
@@ -3,7 +3,7 @@
3
3
  * walker turns into a `math` IR node. The docx adapter's v1 fallback
4
4
  * emits the LaTeX source as plain text (better than the mathml soup
5
5
  * it was leaking before this builder existed); a faithful OMML emitter
6
- * is tracked in kb/framework/plans/math-print-adapters.md §"Future work".
6
+ * is tracked as future work.
7
7
  *
8
8
  * Inline and block math share the same builder, distinguished by the
9
9
  * `display` flag. The optional `id` flows through for parity with the
@@ -2,7 +2,7 @@
2
2
  * Page-chrome builders — page header, page footer, and page-number
3
3
  * field codes.
4
4
  *
5
- * Stage 4 of kb/framework/plans/press-professional-docx.md.
5
+ * Stage 4 of the print/docx work.
6
6
  *
7
7
  * The underlying registration plumbing already exists in Press:
8
8
  * `useDocumentOutput(block, 'docx', body, { role: 'header' })` lifts
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @uniweb/press/format — locale-aware text formatters.
3
3
  *
4
- * Stage 6.1 of kb/framework/plans/press-professional-docx.md.
4
+ * Stage 6.1 of the print/docx work.
5
5
  *
6
6
  * The same JSX feeds the React preview and the docx fragment, so
7
7
  * these are React components that emit <span data-type="text"> and
@@ -76,6 +76,8 @@ export const attributeMap = {
76
76
 
77
77
  'data-spacing-before': { path: ['spacing', 'before'] },
78
78
  'data-spacing-after': { path: ['spacing', 'after'] },
79
+ 'data-spacing-line': { path: ['spacing', 'line'] },
80
+ 'data-spacing-line-rule': { path: ['spacing', 'lineRule'] },
79
81
 
80
82
  'data-transformation-width': { path: ['transformation', 'width'] },
81
83
  'data-transformation-height': { path: ['transformation', 'height'] },
@@ -159,6 +161,14 @@ export const attributeMap = {
159
161
  // emits `<w:rStyle>`.
160
162
  'data-paragraph-style': { path: ['paragraphStyle'] },
161
163
 
164
+ // Paragraph bookmark target: when set, the docx adapter wraps the
165
+ // paragraph's inline children in a Word Bookmark with this id, so
166
+ // <Link href="..."> (InternalHyperlink) elsewhere in the document
167
+ // can jump here. The adapter already handles `node.bookmark` (see
168
+ // src/adapters/docx.js, irToParagraph); this entry is the missing
169
+ // IR attribute mapping that wires React-side props through to it.
170
+ 'data-bookmark': { path: ['bookmark'] },
171
+
162
172
  'data-tab-stops': {
163
173
  path: ['tabStops'],
164
174
  transform: (v) => {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Synthesize OOXML style definitions from a Press theme.
3
3
  *
4
- * Stage 6.0 of kb/framework/plans/press-professional-docx.md.
4
+ * Stage 6.0 of the print/docx work.
5
5
  *
6
6
  * The theme.typography registry is the foundation-facing API:
7
7
  *