@sobree/core 0.1.16 → 0.1.18

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.
@@ -1,41 +1,42 @@
1
1
  /**
2
- * Unequal multi-column flow.
2
+ * Multi-column section flow — equal AND unequal, across pages.
3
3
  *
4
- * CSS multi-column only produces equal columns, so a Word section with
5
- * explicit per-column widths (`<w:cols w:equalWidth="0">`) can't be laid
6
- * out by CSS. The renderer (`openColumnContainerIfNeeded`) emits a flat
7
- * `.sobree-cols-unequal` wrapper stamped with the column geometry; this
8
- * pass run after layout, when heights are measurable — restructures it
9
- * into explicit-width column tracks and flows the section's blocks across
10
- * them.
4
+ * A Word multi-column section (`<w:cols w:num="2">`, with or without
5
+ * explicit per-column widths) flows its content in newspaper order:
6
+ * fill column 0 to the page bottom, then column 1, then continue on the
7
+ * NEXT page. CSS can express neither unequal column widths nor a flow
8
+ * that fragments across our manually-paginated, fixed-height page boxes,
9
+ * so this pass owns the whole 2-D layout: it restructures a section's
10
+ * blocks into explicit width tracks, chunked one wrapper per page.
11
11
  *
12
- * Fill model: BALANCE, not fill-to-page. Word balances a multi-column
13
- * section that has no explicit column break and fits one page — it
14
- * equalises the column heights rather than packing the first column to
15
- * the page bottom and spilling the remainder. (CSS `column-count` does
16
- * the same for the equal-width path; this is the unequal-width analogue.)
17
- * A naive "fill column 1 to the page height, then spill" instead packs
18
- * the wide column nearly full before the narrow one starts, and — worse —
19
- * the page-height threshold sits far above the actual content, so a few
20
- * pixels of font-metric drift between renders (web fonts loaded vs not)
21
- * flip blocks across the boundary. Balancing both matches Word and is
22
- * stable: the split lands at the block boundary that minimises the
23
- * tallest column, which block granularity pins in place.
12
+ * The renderer (`openColumnContainerIfNeeded`) emits ONE flat
13
+ * `.sobree-cols` wrapper per section, stamped with the geometry and a
14
+ * stable section id (`data-pag-cid`). This pass run after layout, when
15
+ * heights are measurable replaces that wrapper with a sequence of
16
+ * page-sized wrappers (the first reused in place, the rest inserted as
17
+ * siblings). Each is at most one page tall, so the column-agnostic
18
+ * paginator downstream simply places each on its own page; the columns
19
+ * "snake" because page K+1 continues page K's content.
24
20
  *
25
- * Scope: single-page column sections (a section whose content fits one
26
- * page), which matches the equal-column path's current capability that
27
- * wraps a section's content in one monolithic block the paginator places
28
- * on a single page. Blocks are moved whole (a paragraph is not split
29
- * across a column boundary); that's faithful for the templates this
30
- * targets, where columns break at block boundaries. `colHeightPx` is the
31
- * page content height — a hard ceiling no column may exceed (content
32
- * taller than that genuinely overflows the page, out of this scope).
33
- * Idempotent: re-running re-flattens and re-fills, so the iterative
34
- * paginate loop can call it each pass.
21
+ * Fill model:
22
+ * - Interior pages are FILLED: column 0 packed to the page budget,
23
+ * then column 1, etc.
24
+ * - The FINAL page is BALANCED (equalised column heights), matching
25
+ * Word's "balance columns at section end". A section that fits one
26
+ * page is a single, balanced chunk identical to the previous
27
+ * single-page behaviour.
28
+ *
29
+ * Blocks move whole (a paragraph is never split across a column or page
30
+ * boundary); that's faithful for the templates this targets, where
31
+ * columns break at block boundaries.
32
+ *
33
+ * Idempotent: the repaginate loop re-collects every block and re-runs
34
+ * this pass each iteration. On entry we re-consolidate the per-page
35
+ * wrappers of each section (matched by `data-pag-cid`) back into one,
36
+ * then re-chunk — so re-running is a no-op on a settled layout.
35
37
  */
36
38
  /**
37
- * Flow every unequal-column section under `root` into its width tracks.
38
- * `colHeightPx` is the page content-height budget (the height each
39
- * column may fill before spilling to the next).
39
+ * Flow every multi-column section under `root` into per-page column
40
+ * chunks. `pageHeightPx` is the page content-height budget.
40
41
  */
41
- export declare function flowUnequalColumnSections(root: HTMLElement, colHeightPx: number): void;
42
+ export declare function flowColumnSections(root: HTMLElement, pageHeightPx: number): void;
package/dist/sobree.d.ts CHANGED
@@ -68,6 +68,11 @@ export interface SobreeOptions {
68
68
  * after a deploy) — it has no other behaviour.
69
69
  */
70
70
  versionBadge?: boolean;
71
+ /**
72
+ * Show hidden text (`<w:vanish/>`) from the start. Off by default
73
+ * (print-faithful). Toggle later with `editor.setShowHiddenText`.
74
+ */
75
+ showHiddenText?: boolean;
71
76
  }
72
77
  /**
73
78
  * Top-level embeddable product surface. Composes a framework-free `Editor`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sobree/core",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },