@format.dev/react 0.1.3 → 0.2.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.cjs +12 -9
- package/dist/index.d.cts +15 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +15 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -41,11 +41,11 @@ function Template({ children, ...props }) {
|
|
|
41
41
|
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/engine-target.ts
|
|
44
|
-
const engineTarget = "0.
|
|
44
|
+
const engineTarget = "0.2.0";
|
|
45
45
|
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/sdk-version.ts
|
|
48
|
-
const sdkVersion = "0.
|
|
48
|
+
const sdkVersion = "0.2.0";
|
|
49
49
|
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/Document.tsx
|
|
@@ -206,10 +206,11 @@ function Counter({ name, peek, reset, set, by, join, as: Tag = "span", counterSt
|
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/Numbering.tsx
|
|
208
208
|
/**
|
|
209
|
-
* Turns on document-wide numbering.
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
209
|
+
* Turns on document-wide numbering. By default it numbers headings `h1` through
|
|
210
|
+
* `h6` hierarchically — `1`, `1.1`, `1.1.1` — with each level resetting the ones
|
|
211
|
+
* beneath it. Add <NumberingRule> children to number other things; they add to the
|
|
212
|
+
* default headings. To number headings your own way, set `defaultHeadings={false}`
|
|
213
|
+
* and write rules for them.
|
|
213
214
|
*
|
|
214
215
|
* Numbers are resolved before pages are split, so they stay correct across page
|
|
215
216
|
* breaks where plain CSS counters would reset.
|
|
@@ -221,17 +222,19 @@ function Counter({ name, peek, reset, set, by, join, as: Tag = "span", counterSt
|
|
|
221
222
|
* </Document>
|
|
222
223
|
* ```
|
|
223
224
|
*/
|
|
224
|
-
function Numbering({ counterStyle, children }) {
|
|
225
|
+
function Numbering({ counterStyle, defaultHeadings, children }) {
|
|
225
226
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Template, {
|
|
226
227
|
"data-type": "numbering",
|
|
227
228
|
"data-counter-style": counterStyle,
|
|
229
|
+
"data-default-headings": defaultHeadings === void 0 ? void 0 : defaultHeadings ? "true" : "false",
|
|
228
230
|
children
|
|
229
231
|
});
|
|
230
232
|
}
|
|
231
233
|
/**
|
|
232
234
|
* One numbering rule, used as `<NumberingRule>` inside `<Numbering>`. Each rule
|
|
233
|
-
* matches a selector and advances (and optionally inserts) a counter.
|
|
234
|
-
*
|
|
235
|
+
* matches a selector and advances (and optionally inserts) a counter. Rules add to
|
|
236
|
+
* the default headings; to change the heading format, set
|
|
237
|
+
* `<Numbering defaultHeadings={false}>` and number the headings with rules.
|
|
235
238
|
*/
|
|
236
239
|
function NumberingRule({ match, counter, format, increment, set, counterStyle, insert }) {
|
|
237
240
|
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.");
|
package/dist/index.d.cts
CHANGED
|
@@ -318,12 +318,19 @@ interface NumberingProps {
|
|
|
318
318
|
* per-Counter, and per-Footnotes styles override it. Defaults to `decimal`.
|
|
319
319
|
*/
|
|
320
320
|
counterStyle?: CounterStyle;
|
|
321
|
+
/**
|
|
322
|
+
* Whether headings `h1` through `h6` get the built-in hierarchical numbers. On by
|
|
323
|
+
* default. Set `false` when your own rules number the headings; that removes the
|
|
324
|
+
* built-in restarts between heading levels as well as the built-in numbers.
|
|
325
|
+
*/
|
|
326
|
+
defaultHeadings?: boolean;
|
|
321
327
|
}
|
|
322
328
|
/**
|
|
323
|
-
* Turns on document-wide numbering.
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
329
|
+
* Turns on document-wide numbering. By default it numbers headings `h1` through
|
|
330
|
+
* `h6` hierarchically — `1`, `1.1`, `1.1.1` — with each level resetting the ones
|
|
331
|
+
* beneath it. Add <NumberingRule> children to number other things; they add to the
|
|
332
|
+
* default headings. To number headings your own way, set `defaultHeadings={false}`
|
|
333
|
+
* and write rules for them.
|
|
327
334
|
*
|
|
328
335
|
* Numbers are resolved before pages are split, so they stay correct across page
|
|
329
336
|
* breaks where plain CSS counters would reset.
|
|
@@ -337,12 +344,14 @@ interface NumberingProps {
|
|
|
337
344
|
*/
|
|
338
345
|
declare function Numbering({
|
|
339
346
|
counterStyle,
|
|
347
|
+
defaultHeadings,
|
|
340
348
|
children
|
|
341
349
|
}: PropsWithChildren<NumberingProps>): react0.JSX.Element;
|
|
342
350
|
/**
|
|
343
351
|
* One numbering rule, used as `<NumberingRule>` inside `<Numbering>`. Each rule
|
|
344
|
-
* matches a selector and advances (and optionally inserts) a counter.
|
|
345
|
-
*
|
|
352
|
+
* matches a selector and advances (and optionally inserts) a counter. Rules add to
|
|
353
|
+
* the default headings; to change the heading format, set
|
|
354
|
+
* `<Numbering defaultHeadings={false}>` and number the headings with rules.
|
|
346
355
|
*/
|
|
347
356
|
declare function NumberingRule({
|
|
348
357
|
match,
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.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/utils.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAMA;AAOA;AAOa,cAdA,gBAiBH,EAAA;EAEE,SAAA,QAAS,EAAA,UAAW;EAIpB,SAAA,IAAA,EAAA,MAAkB;EAMl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EOkBe,YPlBf;;;;;;AAKE,KOoBS,YAAA,GAAe,WPpBxB,GAAA,CAAA;EAA8B,GAAA,CAAA,EAAA,SAAA;EAAA;;;;ECjBhB,GAAA,EAAA,MAAA;EA6BD,EAAA,CAAA,EAAA,SAAI;CAAG,CAAA;;;;;;;;;;;ACbvB;;;;;iBKkDgB,OAAA;;;;;;;MAAgD;;;GAAuC,eAAY,MAAA,CAAA,GAAA,CAAA;;;UClEzG,iBAAA;;AVEV;AAOA;AAOA;EAKY,KAAA,EAAA,MAAS;EAIT;AAMZ;AAMA;;;;ACnCA;AAgCA;AAIA;;;EAA2C,MAAA,CAAA,EAAA,MAAA;EAAQ;;;EAA+C,YAAA,CAAA,ESjBlF,YTiBkF;EAAlB;;;;;;ECtC/D,MAAA,CAAA,EAAA,QAAW,GAAA,OAMN,GAAA,MAAA;AAItB;;;;;;AAMC,KQoBW,kBAAA,GAAqB,iBRpBhC,GAAA,CAAA;EACoB,GAAA,CAAA,EAAA,SAAA;EAAlB;;;;;;ECjBc,SAAA,CAAA,EAAS,MAAA;AA6B1B,CAAA,GAAgB;EAAO;EAAkB,GAAA,EAAA,MAAA;EAAoB,SAAA,CAAA,EAAA,SAAA;CAAO,CAAA;AAA8B,UO0BjF,cAAA,CP1BiF;EAAlB;;;;iBO+BhE;;AN5ChB
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.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/utils.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAMA;AAOA;AAOa,cAdA,gBAiBH,EAAA;EAEE,SAAA,QAAS,EAAA,UAAW;EAIpB,SAAA,IAAA,EAAA,MAAkB;EAMlB,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B,iBbOtB,CAAA,EaPuC,MAAA,CAAA,GAAA,CAAA,ObOvC;;;UcnBA,cAAA;;AfEjB;AAOA;AAOA;EAKY,YAAS,CAAA,EehBL,YfgBgB;EAIpB;AAMZ;AAMA;;;;ECnCiB;AAgCjB;AAIA;;;EAA2C,UAAA,CAAA,EAAA,OAAA;EAAQ;EAAU,SAAA,CAAA,EAAA,MAAA;EAAO;EAA8B,KAAA,CAAA,EcjBzF,adiByF;;;;;;;ACtClG;AAUA;;;;;;;;;;;;;;ACViB,iBY4CD,SAAA,CZzCI;EAAA,YAGE;EAAA,eAAkB;EAAA,UAAA;EAAA,SAAA;EAAA,KAAA;EAAA;AAAA,CAAA,EY6CrC,iBZ7CqC,CY6CnB,cZ7CmB,CAAA,CAAA,EY6CJ,MAAA,CAAA,GAAA,CAAA,OZ7CI;;;AHexC;AAIA;AAMA;AAMA;;;;ACnCA;AAgCiB,iBejBD,GAAA,CfiBY,KACpB,EelBmB,oBfkBnB,EAAA,GAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,MAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -318,12 +318,19 @@ interface NumberingProps {
|
|
|
318
318
|
* per-Counter, and per-Footnotes styles override it. Defaults to `decimal`.
|
|
319
319
|
*/
|
|
320
320
|
counterStyle?: CounterStyle;
|
|
321
|
+
/**
|
|
322
|
+
* Whether headings `h1` through `h6` get the built-in hierarchical numbers. On by
|
|
323
|
+
* default. Set `false` when your own rules number the headings; that removes the
|
|
324
|
+
* built-in restarts between heading levels as well as the built-in numbers.
|
|
325
|
+
*/
|
|
326
|
+
defaultHeadings?: boolean;
|
|
321
327
|
}
|
|
322
328
|
/**
|
|
323
|
-
* Turns on document-wide numbering.
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
329
|
+
* Turns on document-wide numbering. By default it numbers headings `h1` through
|
|
330
|
+
* `h6` hierarchically — `1`, `1.1`, `1.1.1` — with each level resetting the ones
|
|
331
|
+
* beneath it. Add <NumberingRule> children to number other things; they add to the
|
|
332
|
+
* default headings. To number headings your own way, set `defaultHeadings={false}`
|
|
333
|
+
* and write rules for them.
|
|
327
334
|
*
|
|
328
335
|
* Numbers are resolved before pages are split, so they stay correct across page
|
|
329
336
|
* breaks where plain CSS counters would reset.
|
|
@@ -337,12 +344,14 @@ interface NumberingProps {
|
|
|
337
344
|
*/
|
|
338
345
|
declare function Numbering({
|
|
339
346
|
counterStyle,
|
|
347
|
+
defaultHeadings,
|
|
340
348
|
children
|
|
341
349
|
}: PropsWithChildren<NumberingProps>): react0.JSX.Element;
|
|
342
350
|
/**
|
|
343
351
|
* One numbering rule, used as `<NumberingRule>` inside `<Numbering>`. Each rule
|
|
344
|
-
* matches a selector and advances (and optionally inserts) a counter.
|
|
345
|
-
*
|
|
352
|
+
* matches a selector and advances (and optionally inserts) a counter. Rules add to
|
|
353
|
+
* the default headings; to change the heading format, set
|
|
354
|
+
* `<Numbering defaultHeadings={false}>` and number the headings with rules.
|
|
346
355
|
*/
|
|
347
356
|
declare function NumberingRule({
|
|
348
357
|
match,
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.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/utils.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAMA;AAOA;AAOa,cAdA,gBAiBH,EAAA;EAEE,SAAA,QAAS,EAAA,UAAW;EAIpB,SAAA,IAAA,EAAA,MAAkB;EAMlB,SAAA,QAAQ,EAAA,UAAA;EAMR,SAAA,IAAA,EAAY,MAAA;;KA5BZ,gBAAA,WAA2B,+BAA+B;;ACPtE;AAgC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;;;ECjBhB,GAAA,EAAA,MAAA;EA6BD,EAAA,CAAA,EAAA,SAAI;CAAG,CAAA;;;;;;;;;;;ACbvB;;;;;iBKkDgB,OAAA;;;;;;;MAAgD;;;GAAuC,eAAY,MAAA,CAAA,GAAA,CAAA;;;UClEzG,iBAAA;;AVEV;AAOA;AAOA;EAKY,KAAA,EAAA,MAAS;EAIT;AAMZ;AAMA;;;;ACnCA;AAgCA;AAIA;;;EAA2C,MAAA,CAAA,EAAA,MAAA;EAAQ;;;EAA+C,YAAA,CAAA,ESjBlF,YTiBkF;EAAlB;;;;;;ECtC/D,MAAA,CAAA,EAAA,QAAW,GAAA,OAMN,GAAA,MAAA;AAItB;;;;;;AAMC,KQoBW,kBAAA,GAAqB,iBRpBhC,GAAA,CAAA;EACoB,GAAA,CAAA,EAAA,SAAA;EAAlB;;;;;;ECjBc,SAAA,CAAA,EAAS,MAAA;AA6B1B,CAAA,GAAgB;EAAO;EAAkB,GAAA,EAAA,MAAA;EAAoB,SAAA,CAAA,EAAA,SAAA;CAAO,CAAA;AAA8B,UO0BjF,cAAA,CP1BiF;EAAlB;;;;iBO+BhE;;AN5ChB
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.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/utils.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAMA;AAOA;AAOa,cAdA,gBAiBH,EAAA;EAEE,SAAA,QAAS,EAAA,UAAW;EAIpB,SAAA,IAAA,EAAA,MAAkB;EAMlB,SAAA,QAAQ,EAAA,UAAA;EAMR,SAAA,IAAA,EAAY,MAAA;;KA5BZ,gBAAA,WAA2B,+BAA+B;;ACPtE;AAgCA;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CAAA,EehBL,YfgBgB;EAIpB;AAMZ;AAMA;;;;ECnCiB;AAgCjB;AAIA;;;EAA2C,UAAA,CAAA,EAAA,OAAA;EAAQ;EAAU,SAAA,CAAA,EAAA,MAAA;EAAO;EAA8B,KAAA,CAAA,EcjBzF,adiByF;;;;;;;ACtClG;AAUA;;;;;;;;;;;;;;ACViB,iBY4CD,SAAA,CZzCI;EAAA,YAGE;EAAA,eAAkB;EAAA,UAAA;EAAA,SAAA;EAAA,KAAA;EAAA;AAAA,CAAA,EY6CrC,iBZ7CqC,CY6CnB,cZ7CmB,CAAA,CAAA,EY6CJ,MAAA,CAAA,GAAA,CAAA,OZ7CI;;;AHexC;AAIA;AAMA;AAMA;;;;ACnCA;AAgCiB,iBejBD,GAAA,CfiBY,KACpB,EelBmB,oBfkBnB,EAAA,GAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,MAAA"}
|
package/dist/index.js
CHANGED
|
@@ -41,11 +41,11 @@ function Template({ children, ...props }) {
|
|
|
41
41
|
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/engine-target.ts
|
|
44
|
-
const engineTarget = "0.
|
|
44
|
+
const engineTarget = "0.2.0";
|
|
45
45
|
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/sdk-version.ts
|
|
48
|
-
const sdkVersion = "0.
|
|
48
|
+
const sdkVersion = "0.2.0";
|
|
49
49
|
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/Document.tsx
|
|
@@ -206,10 +206,11 @@ function Counter({ name, peek, reset, set, by, join, as: Tag = "span", counterSt
|
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/Numbering.tsx
|
|
208
208
|
/**
|
|
209
|
-
* Turns on document-wide numbering.
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
209
|
+
* Turns on document-wide numbering. By default it numbers headings `h1` through
|
|
210
|
+
* `h6` hierarchically — `1`, `1.1`, `1.1.1` — with each level resetting the ones
|
|
211
|
+
* beneath it. Add <NumberingRule> children to number other things; they add to the
|
|
212
|
+
* default headings. To number headings your own way, set `defaultHeadings={false}`
|
|
213
|
+
* and write rules for them.
|
|
213
214
|
*
|
|
214
215
|
* Numbers are resolved before pages are split, so they stay correct across page
|
|
215
216
|
* breaks where plain CSS counters would reset.
|
|
@@ -221,17 +222,19 @@ function Counter({ name, peek, reset, set, by, join, as: Tag = "span", counterSt
|
|
|
221
222
|
* </Document>
|
|
222
223
|
* ```
|
|
223
224
|
*/
|
|
224
|
-
function Numbering({ counterStyle, children }) {
|
|
225
|
+
function Numbering({ counterStyle, defaultHeadings, children }) {
|
|
225
226
|
return /* @__PURE__ */ jsx(Template, {
|
|
226
227
|
"data-type": "numbering",
|
|
227
228
|
"data-counter-style": counterStyle,
|
|
229
|
+
"data-default-headings": defaultHeadings === void 0 ? void 0 : defaultHeadings ? "true" : "false",
|
|
228
230
|
children
|
|
229
231
|
});
|
|
230
232
|
}
|
|
231
233
|
/**
|
|
232
234
|
* One numbering rule, used as `<NumberingRule>` inside `<Numbering>`. Each rule
|
|
233
|
-
* matches a selector and advances (and optionally inserts) a counter.
|
|
234
|
-
*
|
|
235
|
+
* matches a selector and advances (and optionally inserts) a counter. Rules add to
|
|
236
|
+
* the default headings; to change the heading format, set
|
|
237
|
+
* `<Numbering defaultHeadings={false}>` and number the headings with rules.
|
|
235
238
|
*/
|
|
236
239
|
function NumberingRule({ match, counter, format, increment, set, counterStyle, insert }) {
|
|
237
240
|
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.");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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":";;;;AACA,MAAM,qBAAqB;;;;;;;AAQ3B,SAAgB,mBAAmB,MAAsB;AACxD,QAAO,KAAK,QAAQ,oBAAoB,GAAG;;;;;;;;;;AAW5C,SAAgB,IAAI,OAA6B,GAAG,MAAyB;CAC5E,IAAI,MAAM,MAAM,IAAI,MAAM;AAC1B,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACrC,MAAM,IAAI,KAAK;AACf,UAAQ,KAAK,QAAQ,MAAM,QAAQ,KAAK,OAAO,EAAE,IAAI,MAAM,IAAI,IAAI;;AAEpE,QAAO;;;;;ACrBR,SAAgB,SAAS,EAAE,UAAU,GAAG,SAA2C;CAClF,MAAM,OAAO,mBAAmB,qBAAqB,SAAS,CAAC;AAC/D,QAAO,oBAAC;EAAS,GAAI;EAAO,yBAAyB,EAAE,QAAQ,MAAM;GAAI;;;;;ACD1E,MAAaA;;;;ACIb,MAAaC;;;;AC+Bb,SAAgB,SAAS,EAAE,OAAO,SAAS,QAAQ,UAAU,OAAO,YAA8C;CACjH,MAAM,iBAAiB,UAAU,KAAK,KAAK;AAE3C,QACC,oBAAC;EACA,YAAU;EACV,eAAa;EACb,aAAU;EACV,cAAY;EACZ,gBAAc;EACd,eAAa;EACb,iBAAe;EACf,cAAY;EACX;GACS;;;;;AC1Cb,SAAgB,OAAO,EACtB,IACA,OACA,QACA,oBACA,kBACA,YACkC;AAClC,QACC,oBAAC;EACA,aAAU;EACV,WAAS;EACT,cAAY,GAAG,MAAM;EACrB,eAAa,GAAG,OAAO;EACvB,4BAA0B;EAC1B,0BAAwB;EACvB;GACS;;;;;;;;;;;;;;;;;;;;;;ACEb,S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AAwB,kBAAkB,KAAK;EAC/C,oBAAkB,eAAe,SAAY,SAAY,aAAa,SAAS;EACpE;EACJ;EACN;GACS;;;;;;;;;;;AC3Db,MAAa,mBAAmB;CAC/B,UAAU;CACV,MAAM;CACN,UAAU;CACV,MAAM;CACN;;;;;;AASD,MAAa,YAAY;CACxB,MAAM;CACN,MAAM;CACN"}
|
|
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\t/**\n\t * Whether headings `h1` through `h6` get the built-in hierarchical numbers. On by\n\t * default. Set `false` when your own rules number the headings; that removes the\n\t * built-in restarts between heading levels as well as the built-in numbers.\n\t */\n\tdefaultHeadings?: boolean\n}\n\n/**\n * Turns on document-wide numbering. By default it numbers headings `h1` through\n * `h6` hierarchically — `1`, `1.1`, `1.1.1` — with each level resetting the ones\n * beneath it. Add <NumberingRule> children to number other things; they add to the\n * default headings. To number headings your own way, set `defaultHeadings={false}`\n * and write rules for them.\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, defaultHeadings, children }: PropsWithChildren<NumberingProps>) {\n\treturn (\n\t\t<Template\n\t\t\tdata-type='numbering'\n\t\t\tdata-counter-style={counterStyle}\n\t\t\tdata-default-headings={defaultHeadings === undefined ? undefined : defaultHeadings ? 'true' : 'false'}>\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. Rules add to\n * the default headings; to change the heading format, set\n * `<Numbering defaultHeadings={false}>` and number the headings with rules.\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":";;;;AACA,MAAM,qBAAqB;;;;;;;AAQ3B,SAAgB,mBAAmB,MAAsB;AACxD,QAAO,KAAK,QAAQ,oBAAoB,GAAG;;;;;;;;;;AAW5C,SAAgB,IAAI,OAA6B,GAAG,MAAyB;CAC5E,IAAI,MAAM,MAAM,IAAI,MAAM;AAC1B,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACrC,MAAM,IAAI,KAAK;AACf,UAAQ,KAAK,QAAQ,MAAM,QAAQ,KAAK,OAAO,EAAE,IAAI,M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