@particle-academy/last-word-ui 0.2.0 → 0.4.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/CHANGELOG.md CHANGED
@@ -10,6 +10,73 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.4.0] - 2026-11-03
14
+
15
+ **What you must do: nothing.** A document with one page setup draws exactly as
16
+ before, with no new element and no new `onLayout` key. Under Tailwind, your build
17
+ needs react-fancy's classes as it already does.
18
+
19
+ ### Added
20
+
21
+ - **A visible notice when a document asks for mixed page layout** (mixed page
22
+ orientation, stage 1). `pageBreak.page`, page keys written straight on a break
23
+ (`pageBreak.orientation`, `.margins`, ...) and a top-level `sections` were silently
24
+ ignored, so a landscape section drew as portrait with nothing said. The document
25
+ still draws, one page setup as before, under a react-fancy `Callout`
26
+ (`data-lw-layout-notice`) in light and dark. `onLayout` gains `notShown`, JSON
27
+ Pointers to what it ignored, present only when there is something to report. New
28
+ exports: `LAYOUT_NOTICE`, `unshownLayout(doc)`. Per-page geometry comes in a later
29
+ release; **consumer action:** none. Those near-miss keys and `sections` do not
30
+ exist: `pageBreak.page` is the form, and `last-word` refuses all of them on write
31
+ until it can honour the first.
32
+
33
+ ## [0.3.0] - 2026-11-01
34
+
35
+ **What you must do: probably nothing, but expect page breaks to move.** Calibri
36
+ and default text now draws in a bundled font with kerning off, so a document
37
+ can break differently from 0.2.0, on every machine, including ones that had
38
+ real Calibri or only Arial. That is the point: the count is now the same
39
+ everywhere and matches last-word's `Agent::layout()`. Under a strict CSP you
40
+ already import `styles.css`; allow its font files in `font-src`. On the
41
+ CommonJS build, import `styles.css` too, or the viewer reports
42
+ `font: "fallback"`.
43
+
44
+ ### Added
45
+
46
+ - **A bundled Carlito** (1.104, from googlefonts/carlito, unmodified, SIL OFL
47
+ 1.1 with a NOTICE in `fonts/`), declared as `"LW Carlito"` in regular, bold,
48
+ italic and bold italic. Metric-compatible with Calibri: every printable
49
+ ASCII and Latin-1 advance is equal in all four styles. The package now
50
+ publishes `fonts/` (about 2.7 MB of TTF; Carlito is not published as woff2
51
+ upstream, and these are the files as published). A browser fetches only the
52
+ faces a document uses.
53
+ - `styles.css` declares the same `@font-face` rules, with URLs relative to the
54
+ stylesheet, for the strict-CSP route.
55
+ - `DocViewerLayout.font`: `"carlito"`, `"fallback"` or `"unused"`, and
56
+ `data-lw-font` on the root, so a caller can tell a deterministic page count
57
+ from one that depends on the machine.
58
+ - `FONT_LOAD_TIMEOUT_MS` (3000) and the `ViewerFont` type.
59
+ - `demo/agreement.html`: the harness that renders documents in the viewer and
60
+ records the page layout last-word's `layout()` is held to. The fixtures it
61
+ produced are in `tests/fixtures/viewer-agreement.json` (the same bytes as in
62
+ last-word; both pin the sha256).
63
+
64
+ ### Changed
65
+
66
+ - **Calibri and unspecified text draws in the bundled Carlito, first in the
67
+ stack**, ahead of `Calibri`, `Carlito`, `Segoe UI` and `Arial`. Pages may
68
+ break differently from 0.2.0 on any machine: where real Calibri was
69
+ installed, because kerning is now off; where it was not, because the text is
70
+ no longer in Segoe UI or Arial. Every other explicit font keeps its stack,
71
+ and its breaks still depend on the machine.
72
+ - **Kerning and ligatures are off** (`font-kerning: none`,
73
+ `font-variant-ligatures: none`), as in Word by default, and
74
+ `text-rendering: geometricPrecision`.
75
+ - **The viewer waits for the font before it measures.** No pages and no
76
+ `onLayout` until the faces the document draws have loaded (or 3 s pass).
77
+ 0.2.0 drew pages in the fallback first and re-laid them out when web fonts
78
+ arrived, so `onLayout` could report a count that changed a moment later.
79
+
13
80
  ## [0.2.0] - 2026-11-01
14
81
 
15
82
  Renders last-word 0.16.0's band variants and field tokens. **Consumer action:
package/README.md CHANGED
@@ -51,7 +51,7 @@ so a deep clone between numbering and render would lose the marks.
51
51
  | `gap` | `number` | `16` | px between pages |
52
52
  | `filename` | `string` | `""` | what a `{filename}` band field shows |
53
53
  | `now` | `Date \| string` | first render | the moment `{date}` / `{time}` show; an ISO string is fine |
54
- | `onLayout` | `(l) => void` | | `{ pages, pageWidth, pageHeight, scale }`, JSON |
54
+ | `onLayout` | `(l) => void` | | `{ pages, pageWidth, pageHeight, scale, font }`, JSON; see *Fonts* |
55
55
  | `injectStyles` | `boolean` | `true` | see *Styles* |
56
56
  | `id`, `className`, `style` | | | on the root |
57
57
 
@@ -75,6 +75,41 @@ rules instead:
75
75
  import "@particle-academy/last-word-ui/styles.css";
76
76
  ```
77
77
 
78
+ `styles.css` also declares the bundled font (below) with URLs relative to
79
+ itself (`../fonts/*.ttf`), so the bundler that imports it emits the font files.
80
+ Allow them in `font-src` (`'self'` covers it when you serve them from your own
81
+ origin).
82
+
83
+ ### Fonts: the same page count on every machine
84
+
85
+ Calibri, and text with no font named, draws in a **bundled Carlito** (family
86
+ `"LW Carlito"`, first in the stack). Carlito is metric-compatible with Calibri:
87
+ every printable ASCII and Latin-1 advance is identical in all four styles, so
88
+ lines break where Calibri's would. Because the font ships with the package, a
89
+ document paginates the same on a machine with Calibri, with Arial, or with
90
+ neither, and the count agrees with last-word's `Agent::layout()` (PHP, 0.17.0),
91
+ which measures with the same font's metrics.
92
+
93
+ - Kerning and ligatures are off, as they are in Word by default, so a line is
94
+ exactly the sum of its advances.
95
+ - The viewer **waits for the font** before it measures: no pages are drawn and
96
+ `onLayout` is not called until the faces the document uses have loaded (only
97
+ those are fetched; a plain memo never downloads the italics). After
98
+ `FONT_LOAD_TIMEOUT_MS` (3 s) it lays out without it.
99
+ - `onLayout` reports `font`: `"carlito"` (deterministic), `"fallback"` (the
100
+ font could not load, so the count depends on this machine) or `"unused"` (no
101
+ Calibri text). The root carries the same value as `data-lw-font`.
102
+ - Only Calibri and default text is deterministic. Any other font in the
103
+ document draws in that font as installed, as before.
104
+ - With `injectStyles` (the default) the `@font-face` rules point at the files
105
+ through `new URL("../fonts/...", import.meta.url)`, which Vite, webpack 5,
106
+ Rollup and Parcel resolve to emitted assets. The CommonJS build has no
107
+ `import.meta`, so there it reports `"fallback"`: import `styles.css` instead.
108
+
109
+ The four TTFs are Carlito 1.104 from
110
+ [googlefonts/carlito](https://github.com/googlefonts/carlito), shipped
111
+ unmodified under the SIL Open Font License 1.1 (`fonts/OFL.txt`, `fonts/NOTICE`).
112
+
78
113
  ## What it renders
79
114
 
80
115
  - **Pages:** letter, legal and a4, portrait or landscape, with margins as the
@@ -150,4 +185,5 @@ npm run demo # vite demo: a multi-page memo, wide and narrow
150
185
 
151
186
  ## License
152
187
 
153
- MIT
188
+ MIT, except the fonts in `fonts/`: Carlito, SIL Open Font License 1.1, see
189
+ `fonts/OFL.txt` and `fonts/NOTICE`.
package/dist/index.cjs CHANGED
@@ -4,6 +4,7 @@ var react = require('react');
4
4
  var reactFancy = require('@particle-academy/react-fancy');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
7
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
7
8
  // src/DocViewer.tsx
8
9
 
9
10
  // src/geometry.ts
@@ -305,11 +306,25 @@ var FALLBACKS = {
305
306
  "courier new": '"Liberation Mono", Cousine, monospace',
306
307
  consolas: '"Liberation Mono", Menlo, monospace'
307
308
  };
309
+ var CARLITO_FAMILY = "LW Carlito";
308
310
  function fontStack(name) {
309
- const clean = typeof name === "string" ? name.replace(/[^A-Za-z0-9 _-]/g, "").trim() : "";
310
- const font = clean === "" ? DEFAULT_FONT : clean;
311
+ const clean2 = typeof name === "string" ? name.replace(/[^A-Za-z0-9 _-]/g, "").trim() : "";
312
+ const font = clean2 === "" ? DEFAULT_FONT : clean2;
311
313
  const fallback = FALLBACKS[font.toLowerCase()] ?? 'Carlito, "Segoe UI", Arial, sans-serif';
312
- return `"${font}", ${fallback}`;
314
+ const first = font.toLowerCase() === "calibri" ? `"${CARLITO_FAMILY}", ` : "";
315
+ return `${first}"${font}", ${fallback}`;
316
+ }
317
+ function typography(defaultFont, size) {
318
+ return {
319
+ fontFamily: fontStack(defaultFont),
320
+ fontSize: pt(size),
321
+ lineHeight: SINGLE_LINE,
322
+ color: "#000000",
323
+ textAlign: "left",
324
+ fontKerning: "none",
325
+ fontVariantLigatures: "none",
326
+ textRendering: "geometricPrecision"
327
+ };
313
328
  }
314
329
  var MONO = fontStack("Consolas");
315
330
  var CSS_STYLE = {
@@ -812,6 +827,40 @@ function numberFootnotes(doc) {
812
827
  return { marks, notes };
813
828
  }
814
829
 
830
+ // src/layout-notice.ts
831
+ var LAYOUT_NOTICE = "Mixed page orientation isn't shown yet. This document asks for different page settings partway through; every page here uses the document's one page setup.";
832
+ var NEAR_MISS_KEYS = ["size", "orientation", "margins", "header", "footer", "firstHeader", "firstFooter", "evenHeader", "evenFooter", "background", "border"];
833
+ var isObject = (v) => typeof v === "object" && v !== null;
834
+ function unshownLayout(doc) {
835
+ const found = [];
836
+ if (!isObject(doc)) return found;
837
+ if (doc.sections !== void 0) found.push("/sections");
838
+ const stack = [{ blocks: doc.blocks, at: "/blocks" }];
839
+ while (stack.length > 0) {
840
+ const { blocks, at } = stack.pop();
841
+ if (!Array.isArray(blocks)) continue;
842
+ blocks.forEach((block, i) => {
843
+ if (!isObject(block)) return;
844
+ const path = `${at}/${i}`;
845
+ if (block.type === "pageBreak") {
846
+ for (const key of ["page", ...NEAR_MISS_KEYS]) {
847
+ if (block[key] !== void 0) found.push(`${path}/${key}`);
848
+ }
849
+ } else if (block.type === "quote") {
850
+ stack.push({ blocks: block.blocks, at: `${path}/blocks` });
851
+ } else if (block.type === "table" && Array.isArray(block.rows)) {
852
+ block.rows.forEach((row, r) => {
853
+ if (!isObject(row) || !Array.isArray(row.cells)) return;
854
+ row.cells.forEach((cell, c) => {
855
+ if (isObject(cell)) stack.push({ blocks: cell.blocks, at: `${path}/rows/${r}/cells/${c}/blocks` });
856
+ });
857
+ });
858
+ }
859
+ });
860
+ }
861
+ return found;
862
+ }
863
+
815
864
  // src/measure.ts
816
865
  var SPLITTABLE = /* @__PURE__ */ new Set(["paragraph", "heading", "list", "quote", "code"]);
817
866
  var blockId = (index) => `b${index}`;
@@ -1101,6 +1150,96 @@ function sum(notes) {
1101
1150
  return notes.reduce((a, n) => a + n.height, 0);
1102
1151
  }
1103
1152
 
1153
+ // src/font-urls.ts
1154
+ function carlitoUrls() {
1155
+ try {
1156
+ return {
1157
+ "Carlito-Regular.ttf": new URL("../fonts/Carlito-Regular.ttf", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).href,
1158
+ "Carlito-Bold.ttf": new URL("../fonts/Carlito-Bold.ttf", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).href,
1159
+ "Carlito-Italic.ttf": new URL("../fonts/Carlito-Italic.ttf", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).href,
1160
+ "Carlito-BoldItalic.ttf": new URL("../fonts/Carlito-BoldItalic.ttf", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).href
1161
+ };
1162
+ } catch {
1163
+ return null;
1164
+ }
1165
+ }
1166
+
1167
+ // src/fonts.ts
1168
+ var CARLITO_FACES = [
1169
+ { file: "Carlito-Regular.ttf", weight: 400, style: "normal", sha256: "f6418f708baede9789daef5d458c0f53d2a888af9820e8062934e504fedc6595" },
1170
+ { file: "Carlito-Bold.ttf", weight: 700, style: "normal", sha256: "bb5d20f79b82599ec72983597437373a80f2d2085fa91fc144fd74e876a594db" },
1171
+ { file: "Carlito-Italic.ttf", weight: 400, style: "italic", sha256: "0b019225e58d702bfedcbd35c21696769f8ee115cb6343f84c2f240312450d1c" },
1172
+ { file: "Carlito-BoldItalic.ttf", weight: 700, style: "italic", sha256: "b32928186c119599e03ca6a1ffc680fdcb7fac95772f4b95d989cf6cd3861517" }
1173
+ ];
1174
+ function fontFaceCss(url) {
1175
+ return CARLITO_FACES.map(
1176
+ (f) => `@font-face { font-family: "${CARLITO_FAMILY}"; font-weight: ${f.weight}; font-style: ${f.style}; font-display: swap; src: url("${url(f.file)}") format("truetype"); }`
1177
+ ).join("\n");
1178
+ }
1179
+ var clean = (name) => typeof name === "string" ? name.replace(/[^A-Za-z0-9 _-]/g, "").trim() : "";
1180
+ function usesCarlito(name) {
1181
+ const n = clean(name);
1182
+ return (n === "" ? DEFAULT_FONT : n).toLowerCase() === "calibri";
1183
+ }
1184
+ function carlitoFaces(doc) {
1185
+ const used = /* @__PURE__ */ new Set();
1186
+ const docCarlito = usesCarlito(doc?.defaultFont);
1187
+ const runs = (list, bold, italic) => {
1188
+ if (!Array.isArray(list)) return;
1189
+ for (const r of list) {
1190
+ if (!r || typeof r !== "object") continue;
1191
+ if (r.footnote && typeof r.footnote === "object") blocks(r.footnote.blocks, false, false);
1192
+ const hasFont = typeof r.font === "string" && r.font !== "";
1193
+ if (r.code || !(hasFont ? usesCarlito(r.font) : docCarlito)) continue;
1194
+ used.add(`${bold || r.bold ? 700 : 400}:${italic || r.italic ? "italic" : "normal"}`);
1195
+ }
1196
+ };
1197
+ const blocks = (list, bold, italic) => {
1198
+ if (!Array.isArray(list)) return;
1199
+ for (const b of list) {
1200
+ if (!b || typeof b !== "object") continue;
1201
+ switch (b.type) {
1202
+ case "paragraph":
1203
+ runs(b.runs, bold, italic);
1204
+ break;
1205
+ case "heading":
1206
+ runs(b.runs, true, italic);
1207
+ break;
1208
+ case "list": {
1209
+ const items = (xs) => {
1210
+ if (!Array.isArray(xs)) return;
1211
+ for (const it of xs) {
1212
+ runs(it?.runs, bold, italic);
1213
+ items(it?.children);
1214
+ }
1215
+ };
1216
+ items(b.items);
1217
+ break;
1218
+ }
1219
+ case "quote":
1220
+ blocks(b.blocks, bold, true);
1221
+ break;
1222
+ case "table":
1223
+ for (const row of Array.isArray(b.rows) ? b.rows : []) {
1224
+ for (const cell of Array.isArray(row?.cells) ? row.cells : []) blocks(cell?.blocks, bold || row.header === true, italic);
1225
+ }
1226
+ break;
1227
+ }
1228
+ }
1229
+ };
1230
+ blocks(doc?.blocks, false, false);
1231
+ const page = doc?.page && typeof doc.page === "object" ? doc.page : {};
1232
+ for (const key of ["header", "footer", "firstHeader", "firstFooter", "evenHeader", "evenFooter"]) {
1233
+ const band = page[key];
1234
+ if (!band || typeof band !== "object") continue;
1235
+ if (Array.isArray(band.blocks)) blocks(band.blocks, false, false);
1236
+ else if (docCarlito && [band.left, band.center, band.right].some((s) => typeof s === "string" && s !== "")) used.add("400:normal");
1237
+ }
1238
+ return CARLITO_FACES.filter((f) => used.has(`${f.weight}:${f.style}`)).map(
1239
+ (f) => `${f.weight} ${f.style} 16px "${CARLITO_FAMILY}"`
1240
+ );
1241
+ }
1242
+
1104
1243
  // src/viewer-css.ts
1105
1244
  var VIEWER_CSS = `
1106
1245
  :where([data-lw-viewer]) [data-lw-table] > table { width: 100%; border-collapse: collapse; table-layout: fixed; }
@@ -1109,6 +1248,16 @@ var VIEWER_CSS = `
1109
1248
  :where([data-lw-viewer]) hr[data-react-fancy-separator] { margin: 0; width: 100%; border: 0; border-top: 0.75pt solid #000000; }
1110
1249
  :where([data-lw-viewer]) [data-lw-sheet] p, :where([data-lw-viewer]) [data-lw-measure] p { margin-top: 0; margin-bottom: 0; }
1111
1250
  `.trim();
1251
+ var FONT_LOAD_TIMEOUT_MS = 3e3;
1252
+ var FONT_CSS = (() => {
1253
+ const urls = carlitoUrls();
1254
+ return urls ? fontFaceCss((file) => urls[file]) : null;
1255
+ })();
1256
+ function initialFontState(faces) {
1257
+ if (faces.length === 0) return "unused";
1258
+ const fonts = typeof document !== "undefined" ? document.fonts : void 0;
1259
+ return fonts && typeof fonts.load === "function" ? "pending" : "fallback";
1260
+ }
1112
1261
  function DocViewer({
1113
1262
  doc,
1114
1263
  fit = "width",
@@ -1145,6 +1294,9 @@ function DocViewer({
1145
1294
  const measureRef = react.useRef(null);
1146
1295
  const [layout, setLayout] = react.useState(null);
1147
1296
  const [fontEpoch, setFontEpoch] = react.useState(0);
1297
+ const faces = react.useMemo(() => carlitoFaces(doc), [doc]);
1298
+ const facesKey = faces.join("|");
1299
+ const [font, setFont] = react.useState(() => initialFontState(faces));
1148
1300
  const [width, setWidth] = react.useState(null);
1149
1301
  const ctx = react.useMemo(
1150
1302
  () => ({
@@ -1155,9 +1307,21 @@ function DocViewer({
1155
1307
  }),
1156
1308
  [numbering, doc, geometry]
1157
1309
  );
1310
+ react.useEffect(() => {
1311
+ const state = initialFontState(faces);
1312
+ setFont(state);
1313
+ if (state !== "pending") return;
1314
+ let live = true;
1315
+ const timer = setTimeout(() => live && setFont((f) => f === "pending" ? "fallback" : f), FONT_LOAD_TIMEOUT_MS);
1316
+ Promise.all(faces.map((f) => document.fonts.load(f))).then((loaded) => live && setFont(loaded.every((l) => l.length > 0) ? "carlito" : "fallback")).catch(() => live && setFont("fallback"));
1317
+ return () => {
1318
+ live = false;
1319
+ clearTimeout(timer);
1320
+ };
1321
+ }, [facesKey]);
1158
1322
  react.useLayoutEffect(() => {
1159
1323
  const el = measureRef.current;
1160
- if (!el) return;
1324
+ if (!el || font === "pending") return;
1161
1325
  const m = measure(el, blocks);
1162
1326
  const toPt = (h) => ({
1163
1327
  default: h.default / PX_PER_PT,
@@ -1173,7 +1337,7 @@ function DocViewer({
1173
1337
  });
1174
1338
  const heights = m.items.map((it) => it.type === "block" ? it.height : 0);
1175
1339
  setLayout({ pages, boxes, heights });
1176
- }, [blocks, geometry, numbering, fontEpoch, page, docFields]);
1340
+ }, [blocks, geometry, numbering, fontEpoch, page, docFields, font]);
1177
1341
  react.useEffect(() => {
1178
1342
  const fonts = typeof document !== "undefined" ? document.fonts : void 0;
1179
1343
  let live = true;
@@ -1196,28 +1360,36 @@ function DocViewer({
1196
1360
  }, []);
1197
1361
  const pageWpx = geometry.width * PX_PER_PT;
1198
1362
  const scale = typeof fixedScale === "number" && fixedScale > 0 ? fixedScale : fit === "none" || !width ? 1 : Math.min(maxScale, width / pageWpx);
1363
+ const notShown = react.useMemo(() => unshownLayout(doc), [doc]);
1199
1364
  const pageCount = layout?.pages.length ?? 0;
1200
1365
  react.useEffect(() => {
1201
- if (layout) onLayout?.({ pages: layout.pages.length, pageWidth: geometry.width, pageHeight: geometry.height, scale });
1202
- }, [layout, geometry, scale, onLayout]);
1203
- const typography = {
1204
- fontFamily: fontStack(doc?.defaultFont),
1205
- fontSize: pt(ctx.size),
1206
- lineHeight: SINGLE_LINE,
1207
- color: "#000000",
1208
- textAlign: "left"
1209
- };
1366
+ if (layout && font !== "pending") {
1367
+ onLayout?.({
1368
+ pages: layout.pages.length,
1369
+ pageWidth: geometry.width,
1370
+ pageHeight: geometry.height,
1371
+ scale,
1372
+ font,
1373
+ ...notShown.length > 0 ? { notShown } : {}
1374
+ });
1375
+ }
1376
+ }, [layout, geometry, scale, onLayout, font, notShown]);
1377
+ const typography2 = typography(doc?.defaultFont, ctx.size);
1378
+ const ready = layout !== null && font !== "pending";
1210
1379
  return /* @__PURE__ */ jsxRuntime.jsxs(
1211
1380
  "div",
1212
1381
  {
1213
1382
  ref: rootRef,
1214
1383
  id,
1215
1384
  "data-lw-viewer": "",
1216
- "data-lw-pages": pageCount || void 0,
1385
+ "data-lw-pages": ready && pageCount || void 0,
1386
+ "data-lw-font": ready ? font : void 0,
1217
1387
  className,
1218
1388
  style: { position: "relative", ...style },
1219
1389
  children: [
1220
1390
  injectStyles && /* @__PURE__ */ jsxRuntime.jsx("style", { href: "particle-academy-last-word-ui", precedence: "default", children: VIEWER_CSS }),
1391
+ injectStyles && FONT_CSS && /* @__PURE__ */ jsxRuntime.jsx("style", { href: "particle-academy-last-word-ui-fonts", precedence: "default", children: FONT_CSS }),
1392
+ notShown.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-lw-layout-notice": "", style: { marginBottom: gap }, children: /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Callout, { color: "amber", children: LAYOUT_NOTICE }) }),
1221
1393
  /* @__PURE__ */ jsxRuntime.jsx(
1222
1394
  "div",
1223
1395
  {
@@ -1225,7 +1397,7 @@ function DocViewer({
1225
1397
  "aria-hidden": "true",
1226
1398
  "data-lw-measure": "",
1227
1399
  style: {
1228
- ...typography,
1400
+ ...typography2,
1229
1401
  position: "absolute",
1230
1402
  visibility: "hidden",
1231
1403
  pointerEvents: "none",
@@ -1248,7 +1420,7 @@ function DocViewer({
1248
1420
  ] })
1249
1421
  }
1250
1422
  ),
1251
- layout && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-lw-page-stack": "", style: { display: "flex", flexDirection: "column", alignItems: "center", gap }, children: layout.pages.map((p) => /* @__PURE__ */ jsxRuntime.jsx(
1423
+ ready && layout && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-lw-page-stack": "", style: { display: "flex", flexDirection: "column", alignItems: "center", gap }, children: layout.pages.map((p) => /* @__PURE__ */ jsxRuntime.jsx(
1252
1424
  PageView,
1253
1425
  {
1254
1426
  page: p,
@@ -1256,7 +1428,7 @@ function DocViewer({
1256
1428
  geometry,
1257
1429
  box: layout.boxes[pageClass(p.index)],
1258
1430
  scale,
1259
- typography,
1431
+ typography: typography2,
1260
1432
  ctx,
1261
1433
  docPage: page,
1262
1434
  docFields,
@@ -1270,7 +1442,7 @@ function DocViewer({
1270
1442
  }
1271
1443
  );
1272
1444
  }
1273
- function PageView({ page, pages, geometry, box, scale, typography, ctx, docPage, docFields, numbering, blocks, heights }) {
1445
+ function PageView({ page, pages, geometry, box, scale, typography: typography2, ctx, docPage, docFields, numbering, blocks, heights }) {
1274
1446
  const n = page.index + 1;
1275
1447
  const g = geometry;
1276
1448
  const bandCtx = { ...ctx, fields: { ...docFields, page: n, pages, sectionPages: pages } };
@@ -1290,7 +1462,7 @@ function PageView({ page, pages, geometry, box, scale, typography, ctx, docPage,
1290
1462
  {
1291
1463
  "data-lw-sheet": "",
1292
1464
  style: {
1293
- ...typography,
1465
+ ...typography2,
1294
1466
  position: "relative",
1295
1467
  width: pt(g.width),
1296
1468
  height: pt(g.height),
@@ -1396,14 +1568,20 @@ function docFromReader(output) {
1396
1568
  return value;
1397
1569
  }
1398
1570
 
1571
+ exports.CARLITO_FACES = CARLITO_FACES;
1572
+ exports.CARLITO_FAMILY = CARLITO_FAMILY;
1399
1573
  exports.DocViewer = DocViewer;
1574
+ exports.FONT_LOAD_TIMEOUT_MS = FONT_LOAD_TIMEOUT_MS;
1575
+ exports.LAYOUT_NOTICE = LAYOUT_NOTICE;
1400
1576
  exports.PAGE_BAND_DISTANCE_DEFAULT = PAGE_BAND_DISTANCE_DEFAULT;
1401
1577
  exports.PAGE_MARGIN_DEFAULT = PAGE_MARGIN_DEFAULT;
1402
1578
  exports.PAGE_SIZES_PT = PAGE_SIZES_PT;
1403
1579
  exports.PX_PER_PT = PX_PER_PT;
1404
1580
  exports.bandSlot = bandSlot;
1405
1581
  exports.bodyBox = bodyBox;
1582
+ exports.carlitoFaces = carlitoFaces;
1406
1583
  exports.docFromReader = docFromReader;
1584
+ exports.fontFaceCss = fontFaceCss;
1407
1585
  exports.formatDatePicture = formatDatePicture;
1408
1586
  exports.numberFootnotes = numberFootnotes;
1409
1587
  exports.pageBand = pageBand;
@@ -1415,5 +1593,6 @@ exports.pageMargins = pageMargins;
1415
1593
  exports.paginate = paginate;
1416
1594
  exports.resolveNow = resolveNow;
1417
1595
  exports.substituteFields = substituteFields;
1596
+ exports.unshownLayout = unshownLayout;
1418
1597
  //# sourceMappingURL=index.cjs.map
1419
1598
  //# sourceMappingURL=index.cjs.map