@format.dev/react 0.0.0 → 0.1.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.js ADDED
@@ -0,0 +1,451 @@
1
+ import { renderToStaticMarkup } from "react-dom/server";
2
+ import { jsx } from "react/jsx-runtime";
3
+
4
+ //#region src/utils.ts
5
+ const IMAGE_PRELOAD_LINK = /<link\b(?=[^>]*\brel="preload")(?=[^>]*\bas="image")[^>]*>/g;
6
+ /**
7
+ * Removes the `<link rel="preload" as="image">` tags that React's server
8
+ * renderer emits ahead of every eager `<img>`. The engine allows a `<link>`
9
+ * only when its `rel` is `stylesheet`, and fails the render with an
10
+ * `INVALID_HTML_LINK_ELEMENT` 400 otherwise.
11
+ */
12
+ function stripImagePreloads(html) {
13
+ return html.replace(IMAGE_PRELOAD_LINK, "");
14
+ }
15
+ /**
16
+ * Tagged template for authoring CSS, typically inside a `<style>` element.
17
+ * Returns the string from the raw segments, so CSS escapes (`\2014`,
18
+ * icon-font codepoints, escaped selectors) survive intact. Interpolated
19
+ * `null`, `undefined`, and `false` collapse to an empty string for clean
20
+ * conditional rules. The `css` name also lets editors and the Format docs
21
+ * highlighter treat the contents as CSS.
22
+ */
23
+ function css(parts, ...vals) {
24
+ let out = parts.raw[0] ?? "";
25
+ for (let i = 0; i < vals.length; i++) {
26
+ const v = vals[i];
27
+ out += (v == null || v === false ? "" : String(v)) + parts.raw[i + 1];
28
+ }
29
+ return out;
30
+ }
31
+
32
+ //#endregion
33
+ //#region src/Template.tsx
34
+ function Template({ children, ...props }) {
35
+ const html = stripImagePreloads(renderToStaticMarkup(children));
36
+ return /* @__PURE__ */ jsx("template", {
37
+ ...props,
38
+ dangerouslySetInnerHTML: { __html: html }
39
+ });
40
+ }
41
+
42
+ //#endregion
43
+ //#region src/engine-target.ts
44
+ const engineTarget = "0.1.0";
45
+
46
+ //#endregion
47
+ //#region src/sdk-version.ts
48
+ const sdkVersion = "0.1.0";
49
+
50
+ //#endregion
51
+ //#region src/Document.tsx
52
+ function Document({ title, subject, author, keywords, fonts, children }) {
53
+ const keywordsString = keywords?.join(", ");
54
+ return /* @__PURE__ */ jsx(Template, {
55
+ "data-sdk": sdkVersion,
56
+ "data-engine": engineTarget,
57
+ "data-type": "document",
58
+ "data-title": title,
59
+ "data-subject": subject,
60
+ "data-author": author,
61
+ "data-keywords": keywordsString,
62
+ "data-fonts": fonts,
63
+ children
64
+ });
65
+ }
66
+
67
+ //#endregion
68
+ //#region src/Layout.tsx
69
+ function Layout({ id, width, height, paginationStrategy, splitGranularity, children }) {
70
+ return /* @__PURE__ */ jsx(Template, {
71
+ "data-type": "layout",
72
+ "data-id": id,
73
+ "data-width": `${width}px`,
74
+ "data-height": `${height}px`,
75
+ "data-pagination-strategy": paginationStrategy,
76
+ "data-split-granularity": splitGranularity,
77
+ children
78
+ });
79
+ }
80
+
81
+ //#endregion
82
+ //#region src/Flow.tsx
83
+ /**
84
+ * A Flow is a region whose content paginates across pages. Everything inside the
85
+ * Flow that isn't its Stream is scaffolding that repeats on every page the
86
+ * content spans; the stream's items appear once and flow.
87
+ *
88
+ * Author the stream two ways:
89
+ *
90
+ * - **bare** — `<Flow>{items}</Flow>`: the Flow's own children are the stream,
91
+ * injected with no wrapper element.
92
+ * - **scaffolded** — wrap the stream in a `<Stream>` inside surrounding markup,
93
+ * e.g. `<Flow><table><thead/><Stream>{rows}</Stream><tfoot/></table></Flow>`:
94
+ * the table, thead, and tfoot repeat per page; the rows flow.
95
+ *
96
+ * Flows nest: a Flow placed inside another Flow's stream paginates against the
97
+ * nearest enclosing sealing region (a Frame, else the page), re-cloning its own
98
+ * scaffolding on each page its content reaches.
99
+ */
100
+ function Flow({ splitGranularity, paginationStrategy, scope, children }) {
101
+ return /* @__PURE__ */ jsx(Template, {
102
+ "data-type": "flow",
103
+ "data-split-granularity": splitGranularity,
104
+ "data-pagination-strategy": paginationStrategy,
105
+ "data-scope": scope,
106
+ children
107
+ });
108
+ }
109
+
110
+ //#endregion
111
+ //#region src/Stream.tsx
112
+ /**
113
+ * A Stream marks where a scaffolded Flow's items land. Use it when a Flow wraps
114
+ * its content in repeating scaffolding (a table's header and footer, a titled
115
+ * panel) and you need to say where in that scaffolding the stream flows in:
116
+ *
117
+ * ```tsx
118
+ * <Flow>
119
+ * <table>
120
+ * <thead>…</thead>
121
+ * <Stream>{rows}</Stream>
122
+ * <tfoot>…</tfoot>
123
+ * </table>
124
+ * </Flow>
125
+ * ```
126
+ *
127
+ * Omit it for a bare Flow, where the Flow's own children are the stream.
128
+ */
129
+ function Stream({ children }) {
130
+ return /* @__PURE__ */ jsx(Template, {
131
+ "data-type": "stream",
132
+ children
133
+ });
134
+ }
135
+
136
+ //#endregion
137
+ //#region src/PageBreak.tsx
138
+ function PageBreak() {
139
+ return /* @__PURE__ */ jsx("template", { "data-type": "page-break" });
140
+ }
141
+
142
+ //#endregion
143
+ //#region src/PageCounter.tsx
144
+ function PageCounter({ type, as: Tag = "span", counterStyle, style, ...rest }) {
145
+ const mergedStyle = counterStyle ? {
146
+ ...style,
147
+ "--page-counter-style": counterStyle
148
+ } : style;
149
+ return /* @__PURE__ */ jsx(Tag, {
150
+ "data-type": type,
151
+ style: mergedStyle,
152
+ ...rest
153
+ });
154
+ }
155
+
156
+ //#endregion
157
+ //#region src/PageNumber.tsx
158
+ function PageNumber(props) {
159
+ return /* @__PURE__ */ jsx(PageCounter, {
160
+ ...props,
161
+ type: "page-number"
162
+ });
163
+ }
164
+
165
+ //#endregion
166
+ //#region src/PageCount.tsx
167
+ function PageCount(props) {
168
+ return /* @__PURE__ */ jsx(PageCounter, {
169
+ ...props,
170
+ type: "page-count"
171
+ });
172
+ }
173
+
174
+ //#endregion
175
+ //#region src/Counter.tsx
176
+ /**
177
+ * A counter whose value survives pagination. Unlike a CSS counter, which resets
178
+ * on every page, this is resolved by Format before pages are split, so the
179
+ * number stays correct wherever the content lands.
180
+ *
181
+ * By default it advances the counter and shows the new value — the usual "this
182
+ * is Figure N" case. `peek` reads without advancing, `set` jumps to a value, and
183
+ * `reset` starts the count over. These three are mutually exclusive; when more
184
+ * than one is set, `reset` wins, then `set`, then `peek`. `by` applies only to
185
+ * the default advance.
186
+ *
187
+ * Give the counter an `id` to make it referenceable. A `<Ref to="that-id" />`
188
+ * then prints the exact value this counter showed, and `<Ref to="that-id" page />`
189
+ * the page it landed on — the same way a heading's id yields its section number.
190
+ */
191
+ function Counter({ name, peek, reset, set, by, join, as: Tag = "span", counterStyle, ...rest }) {
192
+ if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production" && set !== void 0 && by !== void 0) console.error("<Counter>: `set` and `by` are mutually exclusive; `set` jumps to an exact value and wins, `by` is ignored.");
193
+ const action = reset ? "reset" : set !== void 0 ? "set" : peek ? "peek" : "next";
194
+ const value = set !== void 0 ? set : action === "next" ? by : void 0;
195
+ return /* @__PURE__ */ jsx(Tag, {
196
+ "data-type": "counter",
197
+ "data-name": name,
198
+ "data-action": action,
199
+ "data-value": value,
200
+ "data-join": join,
201
+ "data-counter-style": counterStyle,
202
+ ...rest
203
+ });
204
+ }
205
+
206
+ //#endregion
207
+ //#region src/Numbering.tsx
208
+ /**
209
+ * Turns on document-wide numbering. With no children it numbers headings `h1`
210
+ * through `h6` hierarchically — `1`, `1.1`, `1.1.1` — with each level resetting
211
+ * the ones beneath it. Add <NumberingRule> children to number other things or
212
+ * change the format.
213
+ *
214
+ * Numbers are resolved before pages are split, so they stay correct across page
215
+ * breaks where plain CSS counters would reset.
216
+ *
217
+ * ```tsx
218
+ * <Document title="Report">
219
+ * <Numbering />
220
+ * ...
221
+ * </Document>
222
+ * ```
223
+ */
224
+ function Numbering({ counterStyle, children }) {
225
+ return /* @__PURE__ */ jsx(Template, {
226
+ "data-type": "numbering",
227
+ "data-counter-style": counterStyle,
228
+ children
229
+ });
230
+ }
231
+ /**
232
+ * One numbering rule, used as `<NumberingRule>` inside `<Numbering>`. Each rule
233
+ * matches a selector and advances (and optionally inserts) a counter. Add rules
234
+ * to number things beyond the default headings, or to change the heading format.
235
+ */
236
+ function NumberingRule({ match, counter, format, increment, set, counterStyle, insert }) {
237
+ if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production" && set !== void 0 && increment !== void 0) console.error("<NumberingRule>: `set` and `increment` are mutually exclusive; `set` forces an exact value and wins, `increment` is ignored.");
238
+ return /* @__PURE__ */ jsx(Template, {
239
+ "data-type": "numbering-rule",
240
+ "data-match": match,
241
+ "data-counter": counter,
242
+ "data-format": format,
243
+ "data-increment": increment,
244
+ "data-set": set,
245
+ "data-counter-style": counterStyle,
246
+ "data-insert": insert
247
+ });
248
+ }
249
+ /**
250
+ * Declares one counter's behaviour, used as `<CounterDef>` inside `<Numbering>`. Name
251
+ * the counter and, optionally, the owner counter it restarts under. A counter with an
252
+ * owner returns to 0 every time the owner's value changes; one with no owner restarts
253
+ * only when you reset or set it yourself.
254
+ *
255
+ * ```tsx
256
+ * <Numbering>
257
+ * <CounterDef name="figure" resetEach="chapter" />
258
+ * <NumberingRule match="figcaption" counter="figure" format="Figure {chapter}.{figure}: " />
259
+ * </Numbering>
260
+ * ```
261
+ */
262
+ function CounterDef({ name, resetEach }) {
263
+ return /* @__PURE__ */ jsx(Template, {
264
+ "data-type": "counter-def",
265
+ "data-name": name,
266
+ "data-reset-each": resetEach
267
+ });
268
+ }
269
+
270
+ //#endregion
271
+ //#region src/Scope.tsx
272
+ /**
273
+ * Opens a counter scope around its children and adds no element to the output: a
274
+ * `<Scope>` is the fallback for nesting content that has no element of its own to carry
275
+ * the scope. When the content already sits in a container or a `<Flow>`, mark that
276
+ * directly (`<ol data-scope="item">`, `<Flow scope="item">`) instead of wrapping.
277
+ *
278
+ * ```tsx
279
+ * <Scope counter="item">
280
+ * <Counter name="item" join="." /> First
281
+ * <Scope counter="item">
282
+ * <Counter name="item" join="." /> Nested
283
+ * </Scope>
284
+ * </Scope>
285
+ * ```
286
+ */
287
+ function Scope({ counter, children }) {
288
+ return /* @__PURE__ */ jsx(Template, {
289
+ "data-scope": counter,
290
+ children
291
+ });
292
+ }
293
+
294
+ //#endregion
295
+ //#region src/Ref.tsx
296
+ /**
297
+ * A cross-reference to a numbered element — "see Section 2.1" or "Figure 3".
298
+ * Point it at an `id`: a heading's id yields its section number, a `<Counter>`'s
299
+ * id yields the value that counter printed. Add `page` for the page the target
300
+ * landed on, or `counter` to read a named counter's running value at the target.
301
+ *
302
+ * References resolve before pages are split and can point forward to an element
303
+ * that appears later in the document.
304
+ *
305
+ * ```tsx
306
+ * <figcaption>Figure <Counter name="figure" id="flow" />: the data flow</figcaption>
307
+ * // ...anywhere else in the document:
308
+ * <p>The method (see Section <Ref to="method" />) reads Figure <Ref to="flow" />,
309
+ * shown in full on page <Ref to="flow" page />.</p>
310
+ * ```
311
+ */
312
+ function Ref({ to, counter, page, as: Tag = "span", counterStyle, ...rest }) {
313
+ return /* @__PURE__ */ jsx(Tag, {
314
+ "data-type": "ref",
315
+ "data-to": to,
316
+ "data-counter": page ? void 0 : counter,
317
+ "data-page": page ? "" : void 0,
318
+ "data-counter-style": counterStyle,
319
+ ...rest
320
+ });
321
+ }
322
+
323
+ //#endregion
324
+ //#region src/TableOfContents.tsx
325
+ /**
326
+ * A table of contents. Format fills it after laying out the document: one entry
327
+ * per heading the `collect` selector matches, each with the heading's number, its
328
+ * title, and the page it landed on.
329
+ *
330
+ * The entries are flat anchors in a `<div data-type="toc-entries">` inside a
331
+ * `<nav data-type="toc">`: each is an `<a data-type="toc-entry" data-depth="N">`
332
+ * (depth 0 at the top of the outline) holding `toc-number`, `toc-title`, and
333
+ * `toc-page` spans. Depth is data, not nesting, so the stylesheet indents and sizes
334
+ * by depth and a long contents paginates by breaking between anchors. Style it through
335
+ * the `data-type` hooks and the `--toc-*` custom properties (root size, per-depth size
336
+ * and indent, page-number size, leader, and vertical rhythm), or set a `className` (or
337
+ * `styled(TableOfContents)`) on the nav. Set `leader="none"` to omit the dot leader
338
+ * entirely, so no leader is drawn between a title and its page number.
339
+ *
340
+ * Children are leading content shown above the entries — put a "Contents" heading there.
341
+ * It shows once by default; set `repeatHead` to repeat it with the nav on every page.
342
+ *
343
+ * Give a collected heading a `data-toc-description` and its entry gains a
344
+ * `toc-description` line under the title (a one-line summary, as on a magazine or
345
+ * report contents):
346
+ *
347
+ * ```tsx
348
+ * <TableOfContents collect="h1, h2">
349
+ * <h2>Contents</h2>
350
+ * </TableOfContents>
351
+ *
352
+ * <h1 data-toc-description="Defining the studio's personality and direction.">
353
+ * Visual Positioning
354
+ * </h1>
355
+ * ```
356
+ */
357
+ function TableOfContents({ collect, leader, repeatHead, className, style, children }) {
358
+ return /* @__PURE__ */ jsx(Template, {
359
+ "data-type": "toc",
360
+ "data-collect": collect,
361
+ "data-leader": leader,
362
+ "data-repeat-head": repeatHead === void 0 ? void 0 : repeatHead ? "true" : "false",
363
+ className,
364
+ style,
365
+ children
366
+ });
367
+ }
368
+
369
+ //#endregion
370
+ //#region src/Footnote.tsx
371
+ /**
372
+ * A footnote. Write the note's text as the children, at the point it's
373
+ * referenced; Format leaves a numbered marker inline and moves the text to the
374
+ * footer of whichever page the marker lands on. Footnotes are numbered
375
+ * continuously through the document.
376
+ *
377
+ * Pair it with a `<Footnotes />` region in the Layout to control where the notes
378
+ * sit; without one, Format adds a footer area to each page that needs it.
379
+ *
380
+ * ```tsx
381
+ * <p>The result holds<Footnote>under the stated assumptions</Footnote>.</p>
382
+ * ```
383
+ */
384
+ function Footnote({ children }) {
385
+ return /* @__PURE__ */ jsx(Template, {
386
+ "data-type": "footnote",
387
+ children
388
+ });
389
+ }
390
+
391
+ //#endregion
392
+ //#region src/Footnotes.tsx
393
+ /**
394
+ * The region that collects a page's footnotes, authored as a `<template>` Format
395
+ * fills. In a Layout it is a per-page footer gathering the notes whose markers
396
+ * landed there; in a flow's content it is an endnotes list. Format renders it as an
397
+ * `<aside data-type="footnotes">` holding a `<dl data-type="footnote-entries">`, where
398
+ * each note is a `<dt data-type="footnote-number">` term and a
399
+ * `<dd data-type="footnote-content">` definition; style the list as a grid with your
400
+ * own CSS.
401
+ *
402
+ * Put a heading or rule inside `<Footnotes>` to render it above the generated list,
403
+ * the way a table of contents renders its leading content above the entries:
404
+ *
405
+ * ```tsx
406
+ * <Footnotes>
407
+ * <h4>Notes</h4>
408
+ * </Footnotes>
409
+ * ```
410
+ *
411
+ * Omit it and Format adds a plain footer to each page that has footnotes.
412
+ */
413
+ function Footnotes({ counterStyle, restartEachPage, repeatHead, className, style, children }) {
414
+ return /* @__PURE__ */ jsx(Template, {
415
+ "data-type": "footnotes",
416
+ "data-counter-style": counterStyle,
417
+ "data-restart-each-page": restartEachPage ? "" : void 0,
418
+ "data-repeat-head": repeatHead === void 0 ? void 0 : repeatHead ? "true" : "false",
419
+ className,
420
+ style,
421
+ children
422
+ });
423
+ }
424
+
425
+ //#endregion
426
+ //#region src/types.ts
427
+ /**
428
+ * How a Flow splits content that overflows a page: at a `sentence`, `word`, or
429
+ * `grapheme` boundary, or `none` to keep the block whole and move it to the next
430
+ * page intact. Use the constant (`SplitGranularity.None`) or the plain string
431
+ * (`'none'`); both are accepted.
432
+ */
433
+ const SplitGranularity = {
434
+ Sentence: "sentence",
435
+ Word: "word",
436
+ Grapheme: "grapheme",
437
+ None: "none"
438
+ };
439
+ /**
440
+ * The dot leader between a contents entry's title and its page number. The default,
441
+ * `dots`, draws it; `none` leaves the run between them blank. Use the constant
442
+ * (`TocLeader.None`) or the plain string (`'none'`); both are accepted.
443
+ */
444
+ const TocLeader = {
445
+ Dots: "dots",
446
+ None: "none"
447
+ };
448
+
449
+ //#endregion
450
+ export { Counter, CounterDef, Document, Flow, Footnote, Footnotes, Layout, Numbering, NumberingRule, PageBreak, PageCount, PageNumber, Ref, Scope, SplitGranularity, Stream, TableOfContents, TocLeader, css };
451
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["engineTarget: string","sdkVersion: string","mergedStyle: CSSProperties | undefined"],"sources":["../src/utils.ts","../src/Template.tsx","../src/engine-target.ts","../src/sdk-version.ts","../src/Document.tsx","../src/Layout.tsx","../src/Flow.tsx","../src/Stream.tsx","../src/PageBreak.tsx","../src/PageCounter.tsx","../src/PageNumber.tsx","../src/PageCount.tsx","../src/Counter.tsx","../src/Numbering.tsx","../src/Scope.tsx","../src/Ref.tsx","../src/TableOfContents.tsx","../src/Footnote.tsx","../src/Footnotes.tsx","../src/types.ts"],"sourcesContent":["// react's attribute order is not guaranteed, so rel and as are matched independently\nconst IMAGE_PRELOAD_LINK = /<link\\b(?=[^>]*\\brel=\"preload\")(?=[^>]*\\bas=\"image\")[^>]*>/g\n\n/**\n * Removes the `<link rel=\"preload\" as=\"image\">` tags that React's server\n * renderer emits ahead of every eager `<img>`. The engine allows a `<link>`\n * only when its `rel` is `stylesheet`, and fails the render with an\n * `INVALID_HTML_LINK_ELEMENT` 400 otherwise.\n */\nexport function stripImagePreloads(html: string): string {\n\treturn html.replace(IMAGE_PRELOAD_LINK, '')\n}\n\n/**\n * Tagged template for authoring CSS, typically inside a `<style>` element.\n * Returns the string from the raw segments, so CSS escapes (`\\2014`,\n * icon-font codepoints, escaped selectors) survive intact. Interpolated\n * `null`, `undefined`, and `false` collapse to an empty string for clean\n * conditional rules. The `css` name also lets editors and the Format docs\n * highlighter treat the contents as CSS.\n */\nexport function css(parts: TemplateStringsArray, ...vals: unknown[]): string {\n\tlet out = parts.raw[0] ?? ''\n\tfor (let i = 0; i < vals.length; i++) {\n\t\tconst v = vals[i]\n\t\tout += (v == null || v === false ? '' : String(v)) + parts.raw[i + 1]!\n\t}\n\treturn out\n}\n","import type { PropsWithChildren } from 'react'\nimport { renderToStaticMarkup } from 'react-dom/server'\nimport { stripImagePreloads } from './utils'\n\nexport type TemplateProps = React.HTMLAttributes<HTMLTemplateElement>\n\nexport function Template({ children, ...props }: PropsWithChildren<TemplateProps>) {\n\tconst html = stripImagePreloads(renderToStaticMarkup(children))\n\treturn <template {...props} dangerouslySetInnerHTML={{ __html: html }} />\n}\n","// The released engine version targeted by documents built from this package.\n// Each build supplies `FORMAT_ENGINE_TARGET` for itself, so the same source can\n// be built against different engines. It has to arrive as a free identifier,\n// because `define` substitutes those and not import bindings; see\n// build/release/README.md.\ndeclare const FORMAT_ENGINE_TARGET: string\n\nexport const engineTarget: string = FORMAT_ENGINE_TARGET\n","// The Format release this package belongs to, written into every document it\n// renders as `data-sdk`. It names the SDK/toolchain that produced the markup,\n// which is a different question from the engine that will lay it out\n// (`data-engine`) and from the client that will submit it.\n//\n// Each build supplies `FORMAT_JS_VERSION` for itself, so the same source can be\n// built at different release numbers. It has to arrive as a free identifier,\n// because `define` substitutes those and not import bindings; see\n// build/release/README.md.\ndeclare const FORMAT_JS_VERSION: string\n\nexport const sdkVersion: string = FORMAT_JS_VERSION\n","import type { PropsWithChildren } from 'react'\nimport { Template } from './Template'\nimport type { FontMode } from './types'\nimport { engineTarget } from './engine-target'\nimport { sdkVersion } from './sdk-version'\n\nexport interface DocumentProps {\n\ttitle: string\n\tsubject?: string\n\tauthor?: string\n\tkeywords?: string[]\n\t/**\n\t * How the PDF embeds its fonts — file size against rendering quality. Leave\n\t * unset for most documents; set `'fidelity'` when exact text rendering\n\t * matters more than file size.\n\t *\n\t * - Compact (the default) keeps files small: the fonts embed as subset CID\n\t * instances, so the optical size is fixed and strokes can look slightly\n\t * heavier in some viewers (for example macOS Preview).\n\t * - Fidelity gives the best-looking output: text keeps its exact optical\n\t * sizing and renders at the same weight in every PDF viewer. The cost is a\n\t * larger file, since the fonts embed as Type 3.\n\t */\n\tfonts?: FontMode\n}\n\n/**\n * Props the Format runtime passes to a document entry function. The\n * generic parameter is the shape of the active data variant.\n *\n * ```tsx\n * import type { Invoice } from './types'\n *\n * export default function InvoiceDocument({ data }: RenderProps<Invoice>) {\n * return <Document title={`Invoice #${data.id}`}>{/* ... *\\/}</Document>\n * }\n * ```\n */\nexport interface RenderProps<T = unknown> {\n\tdata: T\n}\n\nexport function Document({ title, subject, author, keywords, fonts, children }: PropsWithChildren<DocumentProps>) {\n\tconst keywordsString = keywords?.join(', ')\n\n\treturn (\n\t\t<Template\n\t\t\tdata-sdk={sdkVersion}\n\t\t\tdata-engine={engineTarget}\n\t\t\tdata-type='document'\n\t\t\tdata-title={title}\n\t\t\tdata-subject={subject}\n\t\t\tdata-author={author}\n\t\t\tdata-keywords={keywordsString}\n\t\t\tdata-fonts={fonts}>\n\t\t\t{children}\n\t\t</Template>\n\t)\n}\n","import type { PropsWithChildren } from 'react'\nimport { Template } from './Template'\nimport type { PaginationStrategy, SplitGranularity } from './types'\n\nexport interface LayoutProps {\n\t/** Design label, mirrored to each page as `data-layout-id` for CSS. Optional:\n\t * when omitted, the engine generates one from the Layout's document position. */\n\tid?: string\n\twidth: number\n\theight: number\n\tpaginationStrategy?: PaginationStrategy\n\tsplitGranularity?: SplitGranularity\n}\n\nexport function Layout({\n\tid,\n\twidth,\n\theight,\n\tpaginationStrategy,\n\tsplitGranularity,\n\tchildren\n}: PropsWithChildren<LayoutProps>) {\n\treturn (\n\t\t<Template\n\t\t\tdata-type='layout'\n\t\t\tdata-id={id}\n\t\t\tdata-width={`${width}px`}\n\t\t\tdata-height={`${height}px`}\n\t\t\tdata-pagination-strategy={paginationStrategy}\n\t\t\tdata-split-granularity={splitGranularity}>\n\t\t\t{children}\n\t\t</Template>\n\t)\n}\n","import type { PropsWithChildren } from 'react'\nimport { Template } from './Template'\nimport type { PaginationStrategy, SplitGranularity } from './types'\n\nexport interface FlowProps {\n\t/** How content breaks when it doesn't fit the current page. When unset, it\n\t * inherits from the enclosing Flow, then the Layout, then defaults to `none`. */\n\tsplitGranularity?: SplitGranularity\n\t/** Whether this Flow paginates on overflow (`auto`) or only at PageBreak\n\t * markers (`manual`). Inherits the owning Layout's strategy when unset. */\n\tpaginationStrategy?: PaginationStrategy\n\t/** Opens a numbering scope of this counter name around the Flow's content, so\n\t * a counter nested inside restarts per Flow instance (e.g. `1.1`, `1.2`). */\n\tscope?: string\n}\n\n/**\n * A Flow is a region whose content paginates across pages. Everything inside the\n * Flow that isn't its Stream is scaffolding that repeats on every page the\n * content spans; the stream's items appear once and flow.\n *\n * Author the stream two ways:\n *\n * - **bare** — `<Flow>{items}</Flow>`: the Flow's own children are the stream,\n * injected with no wrapper element.\n * - **scaffolded** — wrap the stream in a `<Stream>` inside surrounding markup,\n * e.g. `<Flow><table><thead/><Stream>{rows}</Stream><tfoot/></table></Flow>`:\n * the table, thead, and tfoot repeat per page; the rows flow.\n *\n * Flows nest: a Flow placed inside another Flow's stream paginates against the\n * nearest enclosing sealing region (a Frame, else the page), re-cloning its own\n * scaffolding on each page its content reaches.\n */\nexport function Flow({ splitGranularity, paginationStrategy, scope, children }: PropsWithChildren<FlowProps>) {\n\treturn (\n\t\t<Template\n\t\t\tdata-type='flow'\n\t\t\tdata-split-granularity={splitGranularity}\n\t\t\tdata-pagination-strategy={paginationStrategy}\n\t\t\tdata-scope={scope}>\n\t\t\t{children}\n\t\t</Template>\n\t)\n}\n","import type { PropsWithChildren } from 'react'\nimport { Template } from './Template'\n\n/**\n * A Stream marks where a scaffolded Flow's items land. Use it when a Flow wraps\n * its content in repeating scaffolding (a table's header and footer, a titled\n * panel) and you need to say where in that scaffolding the stream flows in:\n *\n * ```tsx\n * <Flow>\n * <table>\n * <thead>…</thead>\n * <Stream>{rows}</Stream>\n * <tfoot>…</tfoot>\n * </table>\n * </Flow>\n * ```\n *\n * Omit it for a bare Flow, where the Flow's own children are the stream.\n */\nexport function Stream({ children }: PropsWithChildren) {\n\treturn <Template data-type='stream'>{children}</Template>\n}\n","export function PageBreak() {\n\treturn <template data-type='page-break' />\n}\n","import type { CSSProperties, ElementType, HTMLAttributes } from 'react'\nimport type { CounterStyle } from './types'\n\nexport interface PageCounterBaseProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n\t/**\n\t * HTML tag to render. Defaults to `span`. Use `div` (or another block-level\n\t * element) when the counter needs its own line.\n\t */\n\tas?: ElementType\n\t/**\n\t * CSS `<counter-style>` used to format the counter — e.g. `decimal`,\n\t * `lower-roman`, `upper-alpha`, or a custom `@counter-style` name. Sets\n\t * `--page-counter-style` inline; defaults to `decimal` from the base\n\t * stylesheet when omitted.\n\t */\n\tcounterStyle?: CounterStyle\n}\n\ninterface PageCounterProps extends PageCounterBaseProps {\n\ttype: 'page-number' | 'page-count'\n}\n\nexport function PageCounter({ type, as: Tag = 'span', counterStyle, style, ...rest }: PageCounterProps) {\n\tconst mergedStyle: CSSProperties | undefined = counterStyle\n\t\t? ({ ...style, '--page-counter-style': counterStyle } as CSSProperties)\n\t\t: style\n\treturn <Tag data-type={type} style={mergedStyle} {...rest} />\n}\n","import { PageCounter, type PageCounterBaseProps } from './PageCounter'\n\nexport type PageNumberProps = PageCounterBaseProps\n\nexport function PageNumber(props: PageNumberProps) {\n\treturn <PageCounter {...props} type='page-number' />\n}\n","import { PageCounter, type PageCounterBaseProps } from './PageCounter'\n\nexport type PageCountProps = PageCounterBaseProps\n\nexport function PageCount(props: PageCountProps) {\n\treturn <PageCounter {...props} type='page-count' />\n}\n","import type { ElementType, HTMLAttributes } from 'react'\nimport type { CounterStyle } from './types'\n\ninterface CounterBase extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n\t/**\n\t * The counter to read or advance. Counters are created on first use, so any\n\t * name works — `figure`, `table`, `step`. The same name shares one running\n\t * value across the whole document.\n\t */\n\tname: string\n\t/**\n\t * Read the current value without advancing it. Use this to refer back to a\n\t * number you already showed, e.g. \"see Figure <Counter name='figure' peek />\".\n\t */\n\tpeek?: boolean\n\t/**\n\t * Reset the counter to 0 at this point and render nothing — the start of a\n\t * fresh run (a new chapter restarting its figures).\n\t */\n\treset?: boolean\n\t/**\n\t * Join the whole nested chain of this counter with the given separator — the\n\t * `counters()` read, for nested lists: `join=\".\"` shows `1.2.1`. Without it,\n\t * only the innermost value is shown.\n\t */\n\tjoin?: string\n\t/**\n\t * HTML tag to render. Defaults to `span`.\n\t */\n\tas?: ElementType\n\t/**\n\t * CSS `<counter-style>` used to format the value — e.g. `decimal`,\n\t * `lower-roman`, `upper-alpha`. Defaults to `decimal`.\n\t */\n\tcounterStyle?: CounterStyle\n}\n\n/**\n * `set` and `by` are mutually exclusive: `set` jumps to an exact value, `by`\n * advances. Passing both is a contradiction the type rejects.\n */\nexport type CounterProps = CounterBase &\n\t(\n\t\t| {\n\t\t\t\tset?: undefined\n\t\t\t\t/** How much to advance by before showing the value. Defaults to 1. */\n\t\t\t\tby?: number\n\t\t }\n\t\t| {\n\t\t\t\t/** Set the counter to an exact value and show it. */\n\t\t\t\tset: number\n\t\t\t\tby?: undefined\n\t\t }\n\t)\n\n/**\n * A counter whose value survives pagination. Unlike a CSS counter, which resets\n * on every page, this is resolved by Format before pages are split, so the\n * number stays correct wherever the content lands.\n *\n * By default it advances the counter and shows the new value — the usual \"this\n * is Figure N\" case. `peek` reads without advancing, `set` jumps to a value, and\n * `reset` starts the count over. These three are mutually exclusive; when more\n * than one is set, `reset` wins, then `set`, then `peek`. `by` applies only to\n * the default advance.\n *\n * Give the counter an `id` to make it referenceable. A `<Ref to=\"that-id\" />`\n * then prints the exact value this counter showed, and `<Ref to=\"that-id\" page />`\n * the page it landed on — the same way a heading's id yields its section number.\n */\nexport function Counter({ name, peek, reset, set, by, join, as: Tag = 'span', counterStyle, ...rest }: CounterProps) {\n\tif (\n\t\ttypeof process !== 'undefined' &&\n\t\tprocess.env?.NODE_ENV !== 'production' &&\n\t\tset !== undefined &&\n\t\tby !== undefined\n\t) {\n\t\tconsole.error(\n\t\t\t'<Counter>: `set` and `by` are mutually exclusive; `set` jumps to an exact value and wins, `by` is ignored.'\n\t\t)\n\t}\n\tconst action = reset ? 'reset' : set !== undefined ? 'set' : peek ? 'peek' : 'next'\n\t// data-value seeds both actions: the exact value for `set`, the step size for `next`\n\tconst value = set !== undefined ? set : action === 'next' ? by : undefined\n\n\treturn (\n\t\t<Tag\n\t\t\tdata-type='counter'\n\t\t\tdata-name={name}\n\t\t\tdata-action={action}\n\t\t\tdata-value={value}\n\t\t\tdata-join={join}\n\t\t\tdata-counter-style={counterStyle}\n\t\t\t{...rest}\n\t\t/>\n\t)\n}\n","import type { PropsWithChildren } from 'react'\nimport { Template } from './Template'\nimport type { CounterStyle } from './types'\n\ninterface NumberingRuleBase {\n\t/**\n\t * CSS selector for the elements this rule numbers, e.g. `h2`, `figure figcaption`,\n\t * `.step`. Every match advances the counter in document order.\n\t */\n\tmatch: string\n\t/**\n\t * The counter this rule advances. Defaults to the selector, so a single-tag\n\t * rule needs no separate name.\n\t */\n\tcounter?: string\n\t/**\n\t * The text inserted into each match, with `{counter}` placeholders. For\n\t * example `Figure {figure}: ` or `{chapter:upper-roman}. `. A placeholder may\n\t * carry its own style after a colon. When omitted, the rule advances the\n\t * counter but inserts nothing — pair it with a <Counter> read.\n\t */\n\tformat?: string\n\t/**\n\t * Default `<counter-style>` for placeholders in `format`. Defaults to `decimal`.\n\t */\n\tcounterStyle?: CounterStyle\n\t/**\n\t * Where the formatted number goes relative to the matched element:\n\t * `before` its content (the default), `after` it, or `none` to only keep the\n\t * counter running. To restart a counter under another, declare it with\n\t * `<CounterDef resetEach>`; to nest a counter, mark the container `data-scope`.\n\t */\n\tinsert?: 'before' | 'after' | 'none'\n}\n\n/**\n * `set` and `increment` are mutually exclusive: `set` forces an exact value on\n * each match, `increment` advances. Passing both is a contradiction the type\n * rejects.\n */\nexport type NumberingRuleProps = NumberingRuleBase &\n\t(\n\t\t| {\n\t\t\t\tset?: undefined\n\t\t\t\t/**\n\t\t\t\t * How much to advance the counter on each match. Defaults to 1. Set to `0` when a\n\t\t\t\t * rule should not advance a counter of its own, e.g. a rule whose only job is to\n\t\t\t\t * reset another counter (a nested-list rule that opens a fresh scope for the\n\t\t\t\t * counter you read).\n\t\t\t\t */\n\t\t\t\tincrement?: number\n\t\t }\n\t\t| {\n\t\t\t\t/** Set the counter to this exact value on each match instead of advancing it. */\n\t\t\t\tset: number\n\t\t\t\tincrement?: undefined\n\t\t }\n\t)\n\nexport interface NumberingProps {\n\t/**\n\t * The default counter style for every counter the document numbers. Per-rule,\n\t * per-Counter, and per-Footnotes styles override it. Defaults to `decimal`.\n\t */\n\tcounterStyle?: CounterStyle\n}\n\n/**\n * Turns on document-wide numbering. With no children it numbers headings `h1`\n * through `h6` hierarchically — `1`, `1.1`, `1.1.1` — with each level resetting\n * the ones beneath it. Add <NumberingRule> children to number other things or\n * change the format.\n *\n * Numbers are resolved before pages are split, so they stay correct across page\n * breaks where plain CSS counters would reset.\n *\n * ```tsx\n * <Document title=\"Report\">\n * <Numbering />\n * ...\n * </Document>\n * ```\n */\nexport function Numbering({ counterStyle, children }: PropsWithChildren<NumberingProps>) {\n\treturn (\n\t\t<Template data-type='numbering' data-counter-style={counterStyle}>\n\t\t\t{children}\n\t\t</Template>\n\t)\n}\n\n/**\n * One numbering rule, used as `<NumberingRule>` inside `<Numbering>`. Each rule\n * matches a selector and advances (and optionally inserts) a counter. Add rules\n * to number things beyond the default headings, or to change the heading format.\n */\nexport function NumberingRule({ match, counter, format, increment, set, counterStyle, insert }: NumberingRuleProps) {\n\tif (\n\t\ttypeof process !== 'undefined' &&\n\t\tprocess.env?.NODE_ENV !== 'production' &&\n\t\tset !== undefined &&\n\t\tincrement !== undefined\n\t) {\n\t\tconsole.error(\n\t\t\t'<NumberingRule>: `set` and `increment` are mutually exclusive; `set` forces an exact value and wins, `increment` is ignored.'\n\t\t)\n\t}\n\treturn (\n\t\t<Template\n\t\t\tdata-type='numbering-rule'\n\t\t\tdata-match={match}\n\t\t\tdata-counter={counter}\n\t\t\tdata-format={format}\n\t\t\tdata-increment={increment}\n\t\t\tdata-set={set}\n\t\t\tdata-counter-style={counterStyle}\n\t\t\tdata-insert={insert}\n\t\t/>\n\t)\n}\n\nexport interface CounterDefProps {\n\t/** The counter this defines. Shared by name across the document. */\n\tname: string\n\t/**\n\t * The counter this one restarts under, if any: whenever that owner advances, this\n\t * counter returns to 0. A `figure` set to restart under `chapter` reads \"Figure 2.1\".\n\t * The restart cascades, so a new chapter zeros section and, under section, figure.\n\t */\n\tresetEach?: string\n}\n\n/**\n * Declares one counter's behaviour, used as `<CounterDef>` inside `<Numbering>`. Name\n * the counter and, optionally, the owner counter it restarts under. A counter with an\n * owner returns to 0 every time the owner's value changes; one with no owner restarts\n * only when you reset or set it yourself.\n *\n * ```tsx\n * <Numbering>\n * <CounterDef name=\"figure\" resetEach=\"chapter\" />\n * <NumberingRule match=\"figcaption\" counter=\"figure\" format=\"Figure {chapter}.{figure}: \" />\n * </Numbering>\n * ```\n */\nexport function CounterDef({ name, resetEach }: CounterDefProps) {\n\treturn <Template data-type='counter-def' data-name={name} data-reset-each={resetEach} />\n}\n","import type { PropsWithChildren } from 'react'\nimport { Template } from './Template'\n\nexport interface ScopeProps {\n\t/**\n\t * The counter to open a fresh nested instance for across this wrapper's content — a\n\t * level of a nested list. Pass several space-separated to scope more than one. A\n\t * `<Counter join>` inside reads the whole open stack.\n\t */\n\tcounter: string\n}\n\n/**\n * Opens a counter scope around its children and adds no element to the output: a\n * `<Scope>` is the fallback for nesting content that has no element of its own to carry\n * the scope. When the content already sits in a container or a `<Flow>`, mark that\n * directly (`<ol data-scope=\"item\">`, `<Flow scope=\"item\">`) instead of wrapping.\n *\n * ```tsx\n * <Scope counter=\"item\">\n * <Counter name=\"item\" join=\".\" /> First\n * <Scope counter=\"item\">\n * <Counter name=\"item\" join=\".\" /> Nested\n * </Scope>\n * </Scope>\n * ```\n */\nexport function Scope({ counter, children }: PropsWithChildren<ScopeProps>) {\n\treturn <Template data-scope={counter}>{children}</Template>\n}\n","import type { ElementType, HTMLAttributes } from 'react'\nimport type { CounterStyle } from './types'\n\nexport interface RefProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n\t/**\n\t * The `id` to point at. Put an id on a heading to reference its section number,\n\t * or on a `<Counter>` to reference the value that counter printed. The target\n\t * can appear anywhere in the document, before or after this reference.\n\t */\n\tto: string\n\t/**\n\t * Read a named counter's value as it stood at the target, e.g. `counter=\"figure\"`\n\t * for the figure count at that point in the document. Omit it to show the\n\t * target's own number — a heading's section number, or the value a\n\t * `<Counter id=\"…\">` printed.\n\t */\n\tcounter?: string\n\t/**\n\t * Show the page the target landed on, e.g. \"see page 12\". Resolved after\n\t * pagination. Takes precedence over `counter`.\n\t */\n\tpage?: boolean\n\t/**\n\t * HTML tag to render. Defaults to `span`.\n\t */\n\tas?: ElementType\n\t/**\n\t * CSS `<counter-style>` used to format the value. Defaults to `decimal`.\n\t */\n\tcounterStyle?: CounterStyle\n}\n\n/**\n * A cross-reference to a numbered element — \"see Section 2.1\" or \"Figure 3\".\n * Point it at an `id`: a heading's id yields its section number, a `<Counter>`'s\n * id yields the value that counter printed. Add `page` for the page the target\n * landed on, or `counter` to read a named counter's running value at the target.\n *\n * References resolve before pages are split and can point forward to an element\n * that appears later in the document.\n *\n * ```tsx\n * <figcaption>Figure <Counter name=\"figure\" id=\"flow\" />: the data flow</figcaption>\n * // ...anywhere else in the document:\n * <p>The method (see Section <Ref to=\"method\" />) reads Figure <Ref to=\"flow\" />,\n * shown in full on page <Ref to=\"flow\" page />.</p>\n * ```\n */\nexport function Ref({ to, counter, page, as: Tag = 'span', counterStyle, ...rest }: RefProps) {\n\treturn (\n\t\t<Tag\n\t\t\tdata-type='ref'\n\t\t\tdata-to={to}\n\t\t\tdata-counter={page ? undefined : counter}\n\t\t\tdata-page={page ? '' : undefined}\n\t\t\tdata-counter-style={counterStyle}\n\t\t\t{...rest}\n\t\t/>\n\t)\n}\n","import type { CSSProperties, ReactNode } from 'react'\nimport { Template } from './Template'\nimport type { TocLeader } from './types'\n\nexport interface TableOfContentsProps {\n\t/**\n\t * CSS selector for the headings to list. Defaults to `h1, h2, h3`.\n\t */\n\tcollect?: string\n\t/**\n\t * The dot leader between each entry's title and its page number. The default,\n\t * `dots`, draws it; `none` leaves the run between them blank.\n\t */\n\tleader?: TocLeader\n\t/**\n\t * Repeat the leading content with the nav on every page the contents spans, like a\n\t * running header. Off by default: the leading content shows once, above the entries.\n\t */\n\trepeatHead?: boolean\n\t/**\n\t * Leading content rendered at the top of the contents, above the entries — a\n\t * \"Contents\" heading, an intro line, a rule. Shown once by default; set `repeatHead`\n\t * to repeat it with the nav on every page the contents spans.\n\t */\n\tchildren?: ReactNode\n\t/**\n\t * A class on the rendered `<nav>`. Style the contents with your own CSS, or use\n\t * `styled(TableOfContents)`.\n\t */\n\tclassName?: string\n\t/** An inline style on the rendered `<nav>`. */\n\tstyle?: CSSProperties\n}\n\n/**\n * A table of contents. Format fills it after laying out the document: one entry\n * per heading the `collect` selector matches, each with the heading's number, its\n * title, and the page it landed on.\n *\n * The entries are flat anchors in a `<div data-type=\"toc-entries\">` inside a\n * `<nav data-type=\"toc\">`: each is an `<a data-type=\"toc-entry\" data-depth=\"N\">`\n * (depth 0 at the top of the outline) holding `toc-number`, `toc-title`, and\n * `toc-page` spans. Depth is data, not nesting, so the stylesheet indents and sizes\n * by depth and a long contents paginates by breaking between anchors. Style it through\n * the `data-type` hooks and the `--toc-*` custom properties (root size, per-depth size\n * and indent, page-number size, leader, and vertical rhythm), or set a `className` (or\n * `styled(TableOfContents)`) on the nav. Set `leader=\"none\"` to omit the dot leader\n * entirely, so no leader is drawn between a title and its page number.\n *\n * Children are leading content shown above the entries — put a \"Contents\" heading there.\n * It shows once by default; set `repeatHead` to repeat it with the nav on every page.\n *\n * Give a collected heading a `data-toc-description` and its entry gains a\n * `toc-description` line under the title (a one-line summary, as on a magazine or\n * report contents):\n *\n * ```tsx\n * <TableOfContents collect=\"h1, h2\">\n * <h2>Contents</h2>\n * </TableOfContents>\n *\n * <h1 data-toc-description=\"Defining the studio's personality and direction.\">\n * Visual Positioning\n * </h1>\n * ```\n */\nexport function TableOfContents({ collect, leader, repeatHead, className, style, children }: TableOfContentsProps) {\n\treturn (\n\t\t<Template\n\t\t\tdata-type='toc'\n\t\t\tdata-collect={collect}\n\t\t\tdata-leader={leader}\n\t\t\tdata-repeat-head={repeatHead === undefined ? undefined : repeatHead ? 'true' : 'false'}\n\t\t\tclassName={className}\n\t\t\tstyle={style}>\n\t\t\t{children}\n\t\t</Template>\n\t)\n}\n","import type { PropsWithChildren } from 'react'\nimport { Template } from './Template'\n\n/**\n * A footnote. Write the note's text as the children, at the point it's\n * referenced; Format leaves a numbered marker inline and moves the text to the\n * footer of whichever page the marker lands on. Footnotes are numbered\n * continuously through the document.\n *\n * Pair it with a `<Footnotes />` region in the Layout to control where the notes\n * sit; without one, Format adds a footer area to each page that needs it.\n *\n * ```tsx\n * <p>The result holds<Footnote>under the stated assumptions</Footnote>.</p>\n * ```\n */\nexport function Footnote({ children }: PropsWithChildren) {\n\t// a `<template>` so the note's text stays inert and out of the inline flow until\n\t// the engine moves it to the footer, leaving just the marker behind\n\treturn <Template data-type='footnote'>{children}</Template>\n}\n","import type { CSSProperties, PropsWithChildren } from 'react'\nimport { Template } from './Template'\nimport type { CounterStyle } from './types'\n\nexport interface FootnotesProps {\n\t/**\n\t * The counter style for the note numbers and their inline markers. Defaults to\n\t * the document's numbering style, or `decimal`.\n\t */\n\tcounterStyle?: CounterStyle\n\t/**\n\t * Restart the numbering on each page, so every page's footer reads 1, 2, 3 rather\n\t * than a count that runs the whole document. For a per-page footer in a Layout; the\n\t * inline markers renumber to match. Off by default (continuous numbering).\n\t */\n\trestartEachPage?: boolean\n\t/**\n\t * Whether the leading content (a heading, a rule) repeats in every page's footer. On by\n\t * default for a per-page Layout footer; an inline endnotes block shows it once. Set `false`\n\t * to show a Layout footer's head on its first page only.\n\t */\n\trepeatHead?: boolean\n\t/** A class name passed through to the wrapping footnotes container. */\n\tclassName?: string\n\t/** An inline style passed through to the wrapping footnotes container. */\n\tstyle?: CSSProperties\n}\n\n/**\n * The region that collects a page's footnotes, authored as a `<template>` Format\n * fills. In a Layout it is a per-page footer gathering the notes whose markers\n * landed there; in a flow's content it is an endnotes list. Format renders it as an\n * `<aside data-type=\"footnotes\">` holding a `<dl data-type=\"footnote-entries\">`, where\n * each note is a `<dt data-type=\"footnote-number\">` term and a\n * `<dd data-type=\"footnote-content\">` definition; style the list as a grid with your\n * own CSS.\n *\n * Put a heading or rule inside `<Footnotes>` to render it above the generated list,\n * the way a table of contents renders its leading content above the entries:\n *\n * ```tsx\n * <Footnotes>\n * <h4>Notes</h4>\n * </Footnotes>\n * ```\n *\n * Omit it and Format adds a plain footer to each page that has footnotes.\n */\nexport function Footnotes({\n\tcounterStyle,\n\trestartEachPage,\n\trepeatHead,\n\tclassName,\n\tstyle,\n\tchildren\n}: PropsWithChildren<FootnotesProps>) {\n\treturn (\n\t\t<Template\n\t\t\tdata-type='footnotes'\n\t\t\tdata-counter-style={counterStyle}\n\t\t\tdata-restart-each-page={restartEachPage ? '' : undefined}\n\t\t\tdata-repeat-head={repeatHead === undefined ? undefined : repeatHead ? 'true' : 'false'}\n\t\t\tclassName={className}\n\t\t\tstyle={style}>\n\t\t\t{children}\n\t\t</Template>\n\t)\n}\n","/**\n * How a Flow splits content that overflows a page: at a `sentence`, `word`, or\n * `grapheme` boundary, or `none` to keep the block whole and move it to the next\n * page intact. Use the constant (`SplitGranularity.None`) or the plain string\n * (`'none'`); both are accepted.\n */\nexport const SplitGranularity = {\n\tSentence: 'sentence',\n\tWord: 'word',\n\tGrapheme: 'grapheme',\n\tNone: 'none'\n} as const\n\nexport type SplitGranularity = (typeof SplitGranularity)[keyof typeof SplitGranularity]\n\n/**\n * The dot leader between a contents entry's title and its page number. The default,\n * `dots`, draws it; `none` leaves the run between them blank. Use the constant\n * (`TocLeader.None`) or the plain string (`'none'`); both are accepted.\n */\nexport const TocLeader = {\n\tDots: 'dots',\n\tNone: 'none'\n} as const\n\nexport type TocLeader = (typeof TocLeader)[keyof typeof TocLeader]\n\n/** How a Layout or Flow decides where pages break: `auto` on overflow\n * and at PageBreak markers, `manual` at PageBreak markers only. */\nexport type PaginationStrategy = 'auto' | 'manual'\n\n/**\n * How the PDF embeds its fonts. Mirrors `FontMode` in `@format.dev/fonts`, which owns\n * the canonical list and the default.\n */\nexport type FontMode = 'fidelity' | 'compact'\n\n/**\n * A CSS `<counter-style>` name. The predefined styles autocomplete; any custom\n * `@counter-style` name you define is accepted too.\n */\nexport type CounterStyle =\n\t| 'decimal'\n\t| 'decimal-leading-zero'\n\t| 'lower-roman'\n\t| 'upper-roman'\n\t| 'lower-alpha'\n\t| 'upper-alpha'\n\t| 'lower-latin'\n\t| 'upper-latin'\n\t| 'lower-greek'\n\t| (string & {})\n"],"mappings":"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"}
package/package.json CHANGED
@@ -1,32 +1,50 @@
1
1
  {
2
- "name": "@format.dev/react",
3
- "version": "0.0.0",
4
- "description": "A bootstrap placeholder reserving this package name. Format is not released yet.",
5
- "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/format-hq/format-js.git",
9
- "directory": "packages/react"
10
- },
11
- "homepage": "https://format.dev",
12
- "files": [
13
- "LICENSE",
14
- "README.md",
15
- "index.d.ts",
16
- "index.js"
17
- ],
18
- "type": "module",
19
- "main": "./index.js",
20
- "types": "./index.d.ts",
21
- "exports": {
22
- ".": {
23
- "types": "./index.d.ts",
24
- "default": "./index.js"
25
- }
26
- },
27
- "publishConfig": {
28
- "access": "public",
29
- "tag": "bootstrap",
30
- "registry": "https://registry.npmjs.org/"
31
- }
32
- }
2
+ "name": "@format.dev/react",
3
+ "description": "Format PDF React SDK",
4
+ "version": "0.1.0",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/format-hq/format-js.git",
9
+ "directory": "packages/react"
10
+ },
11
+ "type": "module",
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": {
18
+ "import": "./dist/index.d.ts",
19
+ "require": "./dist/index.d.cts"
20
+ },
21
+ "import": "./dist/index.js",
22
+ "require": "./dist/index.cjs"
23
+ },
24
+ "./package.json": "./package.json"
25
+ },
26
+ "peerDependencies": {
27
+ "react": "^18 || ^19",
28
+ "react-dom": "^18 || ^19"
29
+ },
30
+ "devDependencies": {
31
+ "@types/react": "^19.2.7",
32
+ "@types/react-dom": "^19.2.3",
33
+ "rimraf": "^6.0.1",
34
+ "tsdown": "^0.18.4",
35
+ "typescript": "^5.9.3"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "LICENSE"
40
+ ],
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "sideEffects": false,
45
+ "scripts": {
46
+ "clean": "rimraf dist",
47
+ "dev": "tsdown --watch",
48
+ "build": "NODE_ENV=production tsdown"
49
+ }
50
+ }
package/README.md DELETED
@@ -1,32 +0,0 @@
1
- # @format.dev/react
2
-
3
- **This is a bootstrap placeholder. It reserves the package name and does nothing else.**
4
-
5
- Format is not released yet. Version `0.0.0` is not a usable version of this
6
- package: it contains no implementation, and installing it gets you an empty
7
- module.
8
-
9
- ## Why it exists
10
-
11
- npm binds a package’s trusted publisher, and its staged-publishing flow, to a
12
- package that already exists. Creating these names ahead of the first release is
13
- what lets every real release go out through a reviewed, credential-free
14
- workflow rather than through a token somebody holds.
15
-
16
- This version is published deliberately and deprecated immediately.
17
-
18
- ## Why a bare install resolves it
19
-
20
- npm creates a `latest` tag on a package’s first publish and will not remove it,
21
- so `latest` points at this placeholder until Format reaches general
22
- availability. That is why the deprecation warning is there.
23
-
24
- - Beta releases go out under the `beta` tag.
25
- - General availability is when `latest` moves to a real release.
26
-
27
- ## Format
28
-
29
- - https://format.dev
30
- - https://github.com/format-hq/format-js
31
-
32
- Licensed under MIT. The full text ships beside this file.
package/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- // This is a bootstrap placeholder. Format is not released yet.
2
- export {}
package/index.js DELETED
@@ -1,3 +0,0 @@
1
- // This is a bootstrap placeholder. Format is not released yet, and this version
2
- // carries no implementation. See README.md.
3
- export {}