@format.dev/react 0.2.0 → 0.3.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 CHANGED
@@ -41,15 +41,15 @@ function Template({ children, ...props }) {
41
41
 
42
42
  //#endregion
43
43
  //#region src/engine-target.ts
44
- const engineTarget = "0.2.0";
44
+ const engineTarget = "0.3.0";
45
45
 
46
46
  //#endregion
47
47
  //#region src/sdk-version.ts
48
- const sdkVersion = "0.2.0";
48
+ const sdkVersion = "0.3.0";
49
49
 
50
50
  //#endregion
51
51
  //#region src/Document.tsx
52
- function Document({ title, subject, author, keywords, fonts, children }) {
52
+ function Document({ title, subject, author, keywords, lang, fonts, children }) {
53
53
  const keywordsString = keywords?.join(", ");
54
54
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Template, {
55
55
  "data-sdk": sdkVersion,
@@ -59,6 +59,7 @@ function Document({ title, subject, author, keywords, fonts, children }) {
59
59
  "data-subject": subject,
60
60
  "data-author": author,
61
61
  "data-keywords": keywordsString,
62
+ "data-lang": lang,
62
63
  "data-fonts": fonts,
63
64
  children
64
65
  });
@@ -216,7 +217,7 @@ function Counter({ name, peek, reset, set, by, join, as: Tag = "span", counterSt
216
217
  * breaks where plain CSS counters would reset.
217
218
  *
218
219
  * ```tsx
219
- * <Document title="Report">
220
+ * <Document title="Report" lang="en">
220
221
  * <Numbering />
221
222
  * ...
222
223
  * </Document>
@@ -270,6 +271,32 @@ function CounterDef({ name, resetEach }) {
270
271
  });
271
272
  }
272
273
 
274
+ //#endregion
275
+ //#region src/Bookmarks.tsx
276
+ /**
277
+ * Controls how heading numbers appear in the PDF's bookmarks, the clickable outline
278
+ * that PDF viewers show beside the pages. By default, each bookmark matches its
279
+ * heading, number included. Set `numbers={false}` to leave the numbers out, or set
280
+ * `separator` to change the text between each number and its title. The pages, the
281
+ * table of contents, and the running heads keep their numbers. Place one directly
282
+ * inside `<Document>`.
283
+ *
284
+ * ```tsx
285
+ * <Document title="Handbook">
286
+ * <Numbering />
287
+ * <Bookmarks separator=". " />
288
+ * ...
289
+ * </Document>
290
+ * ```
291
+ */
292
+ function Bookmarks({ numbers, separator }) {
293
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Template, {
294
+ "data-type": "bookmarks",
295
+ "data-numbers": numbers === void 0 ? void 0 : numbers ? "true" : "false",
296
+ "data-separator": separator
297
+ });
298
+ }
299
+
273
300
  //#endregion
274
301
  //#region src/Scope.tsx
275
302
  /**
@@ -323,6 +350,56 @@ function Ref({ to, counter, page, as: Tag = "span", counterStyle, ...rest }) {
323
350
  });
324
351
  }
325
352
 
353
+ //#endregion
354
+ //#region src/RunningHead.tsx
355
+ /**
356
+ * Names, in a page's header or footer, the section the page belongs to: the title
357
+ * of the heading `match` picks out, with its number. Place it in a Layout's
358
+ * scaffolding, and Format fills it on every page once the page's content is placed,
359
+ * so a chapter that starts halfway down a page is named correctly. The heading, its
360
+ * table of contents entry, and the running head always show the same number and
361
+ * title.
362
+ *
363
+ * Set `data-running-head` on a heading to show a shorter title (an empty value shows
364
+ * nothing for it), and `data-running-head-reset` on any element to end the current
365
+ * section, e.g. on an appendix's title page. For the heading's PDF bookmark, set
366
+ * `data-bookmark` the same way.
367
+ *
368
+ * The box keeps one size whatever text lands in it: one line tall, or as many lines
369
+ * as `--running-head-lines` sets. Give it a width in your layout, such as a grid
370
+ * column; text that doesn't fit is cut off, with an ellipsis when the box holds its
371
+ * lines. The text sits in the box's own shadow root, where your selectors don't
372
+ * reach: style it with `::part()`, such as `::part(title)`.
373
+ *
374
+ * ```tsx
375
+ * <Numbering>
376
+ * <NumberingRule match="h1" format="{h1:decimal-leading-zero}." />
377
+ * </Numbering>
378
+ * <Layout id="page" width={595} height={842}>
379
+ * <header>
380
+ * <RunningHead match="h1" show="start" />
381
+ * <PageNumber />
382
+ * </header>
383
+ * <Flow>
384
+ * <h1>General information</h1>
385
+ * ...
386
+ * </Flow>
387
+ * </Layout>
388
+ * ```
389
+ */
390
+ function RunningHead({ match, show, within, format, counterStyle, rangeSeparator, as: Tag = "span", ...rest }) {
391
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
392
+ "data-type": "running-head",
393
+ "data-match": match,
394
+ "data-show": show,
395
+ "data-within": within,
396
+ "data-format": format,
397
+ "data-counter-style": counterStyle,
398
+ "data-range-separator": rangeSeparator,
399
+ ...rest
400
+ });
401
+ }
402
+
326
403
  //#endregion
327
404
  //#region src/TableOfContents.tsx
328
405
  /**
@@ -343,6 +420,21 @@ function Ref({ to, counter, page, as: Tag = "span", counterStyle, ...rest }) {
343
420
  * Children are leading content shown above the entries — put a "Contents" heading there.
344
421
  * It shows once by default; set `repeatHead` to repeat it with the nav on every page.
345
422
  *
423
+ * Place it directly in a `<Flow>` or its `<Stream>`. Inside other content, such as a
424
+ * `<section>`, it renders nothing.
425
+ *
426
+ * A contents lists the headings after it, up to the next contents without `within`.
427
+ * Set `within` to give one its own section instead, such as a chapter's sections
428
+ * beside the book's chapters:
429
+ *
430
+ * ```tsx
431
+ * <TableOfContents collect="h1">…</TableOfContents>
432
+ *
433
+ * <h1>Admissions</h1>
434
+ * <TableOfContents collect="h2" within="h1" />
435
+ * <h2>Requirements</h2>
436
+ * ```
437
+ *
346
438
  * Give a collected heading a `data-toc-description` and its entry gains a
347
439
  * `toc-description` line under the title (a one-line summary, as on a magazine or
348
440
  * report contents):
@@ -357,12 +449,13 @@ function Ref({ to, counter, page, as: Tag = "span", counterStyle, ...rest }) {
357
449
  * </h1>
358
450
  * ```
359
451
  */
360
- function TableOfContents({ collect, leader, repeatHead, className, style, children }) {
452
+ function TableOfContents({ collect, leader, repeatHead, within, className, style, children }) {
361
453
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Template, {
362
454
  "data-type": "toc",
363
455
  "data-collect": collect,
364
456
  "data-leader": leader,
365
457
  "data-repeat-head": repeatHead === void 0 ? void 0 : repeatHead ? "true" : "false",
458
+ "data-within": within,
366
459
  className,
367
460
  style,
368
461
  children
@@ -450,6 +543,7 @@ const TocLeader = {
450
543
  };
451
544
 
452
545
  //#endregion
546
+ exports.Bookmarks = Bookmarks;
453
547
  exports.Counter = Counter;
454
548
  exports.CounterDef = CounterDef;
455
549
  exports.Document = Document;
@@ -463,6 +557,7 @@ exports.PageBreak = PageBreak;
463
557
  exports.PageCount = PageCount;
464
558
  exports.PageNumber = PageNumber;
465
559
  exports.Ref = Ref;
560
+ exports.RunningHead = RunningHead;
466
561
  exports.Scope = Scope;
467
562
  exports.SplitGranularity = SplitGranularity;
468
563
  exports.Stream = Stream;
package/dist/index.d.cts CHANGED
@@ -29,6 +29,18 @@ type TocLeader = (typeof TocLeader)[keyof typeof TocLeader];
29
29
  /** How a Layout or Flow decides where pages break: `auto` on overflow
30
30
  * and at PageBreak markers, `manual` at PageBreak markers only. */
31
31
  type PaginationStrategy = 'auto' | 'manual';
32
+ /**
33
+ * Which matched heading a `<RunningHead>` shows on a page: the `first` or `last`
34
+ * match on the page, the one the page `start`s with, `firstExcept` to show nothing
35
+ * on a page where a match appears, or the `range` of sections the page holds. On a
36
+ * page with no match, each shows the section carried over from earlier pages.
37
+ */
38
+ type RunningHeadShow = 'first' | 'start' | 'last' | 'firstExcept' | 'range';
39
+ /**
40
+ * The elements a `<RunningHead>` can render as: those that can hold a shadow root,
41
+ * where its text goes.
42
+ */
43
+ type RunningHeadElement = 'span' | 'div' | 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'header' | 'footer' | 'nav' | 'section' | 'article' | 'aside' | 'blockquote' | 'main' | 'body';
32
44
  /**
33
45
  * How the PDF embeds its fonts. Mirrors `FontMode` in `@format.dev/fonts`, which owns
34
46
  * the canonical list and the default.
@@ -47,16 +59,21 @@ interface DocumentProps {
47
59
  author?: string;
48
60
  keywords?: string[];
49
61
  /**
50
- * How the PDF embeds its fonts — file size against rendering quality. Leave
51
- * unset for most documents; set `'fidelity'` when exact text rendering
52
- * matters more than file size.
53
- *
54
- * - Compact (the default) keeps files small: the fonts embed as subset CID
55
- * instances, so the optical size is fixed and strokes can look slightly
56
- * heavier in some viewers (for example macOS Preview).
57
- * - Fidelity gives the best-looking output: text keeps its exact optical
58
- * sizing and renders at the same weight in every PDF viewer. The cost is a
59
- * larger file, since the fonts embed as Type 3.
62
+ * The language the document is written in, as a BCP 47 language tag such as
63
+ * `'fr'` or `'pt-BR'`. Format adds it to your PDF, and screen readers use it to
64
+ * choose the right voice and pronunciation. Format also applies that language's
65
+ * conventions for quotation marks and letter case to every page. Set it on
66
+ * every document: without it, your PDF has no language and doesn't meet
67
+ * accessibility standards such as WCAG and PDF/UA. Format ignores invalid tags,
68
+ * such as `'en_US'` or `'english'`. To mark a passage in a different language,
69
+ * add a `lang` attribute to its element.
70
+ */
71
+ lang?: string;
72
+ /**
73
+ * Selects the versions of Format's built-in Sans, Serif, and Mono fonts.
74
+ * `compact` (default) uses static fonts for smaller PDFs. `fidelity` uses
75
+ * variable fonts, preserving optical sizing where supported, but typically
76
+ * produces larger PDFs. Custom fonts are used as supplied in either mode.
60
77
  */
61
78
  fonts?: FontMode;
62
79
  }
@@ -68,7 +85,7 @@ interface DocumentProps {
68
85
  * import type { Invoice } from './types'
69
86
  *
70
87
  * export default function InvoiceDocument({ data }: RenderProps<Invoice>) {
71
- * return <Document title={`Invoice #${data.id}`}>{/* ... *\/}</Document>
88
+ * return <Document title={`Invoice #${data.id}`} lang="en">{/* ... *\/}</Document>
72
89
  * }
73
90
  * ```
74
91
  */
@@ -80,6 +97,7 @@ declare function Document({
80
97
  subject,
81
98
  author,
82
99
  keywords,
100
+ lang,
83
101
  fonts,
84
102
  children
85
103
  }: PropsWithChildren<DocumentProps>): react0.JSX.Element;
@@ -266,7 +284,9 @@ declare function Counter({
266
284
  interface NumberingRuleBase {
267
285
  /**
268
286
  * CSS selector for the elements this rule numbers, e.g. `h2`, `figure figcaption`,
269
- * `.step`. Every match advances the counter in document order.
287
+ * `.step`. Every match advances the counter in document order. It matches the
288
+ * content that flows across pages, without the Layout or Flow scaffolding around
289
+ * it: when a Layout wraps its Flow in `<main>`, `main h2` matches nothing.
270
290
  */
271
291
  match: string;
272
292
  /**
@@ -336,7 +356,7 @@ interface NumberingProps {
336
356
  * breaks where plain CSS counters would reset.
337
357
  *
338
358
  * ```tsx
339
- * <Document title="Report">
359
+ * <Document title="Report" lang="en">
340
360
  * <Numbering />
341
361
  * ...
342
362
  * </Document>
@@ -390,6 +410,42 @@ declare function CounterDef({
390
410
  resetEach
391
411
  }: CounterDefProps): react0.JSX.Element;
392
412
  //#endregion
413
+ //#region src/Bookmarks.d.ts
414
+ interface BookmarksProps {
415
+ /**
416
+ * Whether bookmarks include the numbers `<Numbering>` adds to headings. On by
417
+ * default. Set `false` to show titles alone, such as "Fees" instead of "3 Fees".
418
+ * Text you write in a heading always stays, including digits and the value of a
419
+ * `<Counter>`.
420
+ */
421
+ numbers?: boolean;
422
+ /**
423
+ * The text between each number and its title, such as `". "` for "3. Fees".
424
+ * Defaults to a space, as on the page. An empty string joins them, as in "3Fees".
425
+ */
426
+ separator?: string;
427
+ }
428
+ /**
429
+ * Controls how heading numbers appear in the PDF's bookmarks, the clickable outline
430
+ * that PDF viewers show beside the pages. By default, each bookmark matches its
431
+ * heading, number included. Set `numbers={false}` to leave the numbers out, or set
432
+ * `separator` to change the text between each number and its title. The pages, the
433
+ * table of contents, and the running heads keep their numbers. Place one directly
434
+ * inside `<Document>`.
435
+ *
436
+ * ```tsx
437
+ * <Document title="Handbook">
438
+ * <Numbering />
439
+ * <Bookmarks separator=". " />
440
+ * ...
441
+ * </Document>
442
+ * ```
443
+ */
444
+ declare function Bookmarks({
445
+ numbers,
446
+ separator
447
+ }: BookmarksProps): react0.JSX.Element;
448
+ //#endregion
393
449
  //#region src/Scope.d.ts
394
450
  interface ScopeProps {
395
451
  /**
@@ -473,10 +529,104 @@ declare function Ref({
473
529
  ...rest
474
530
  }: RefProps): react0.JSX.Element;
475
531
  //#endregion
532
+ //#region src/RunningHead.d.ts
533
+ interface RunningHeadProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
534
+ /**
535
+ * CSS selector for the headings to follow, e.g. `h1`. Like a `<NumberingRule>`'s
536
+ * `match`, it matches the content that flows across pages, without the scaffolding
537
+ * around it: select on the heading itself, e.g. `h1` rather than `main h1`.
538
+ */
539
+ match: string;
540
+ /**
541
+ * Which match to show on each page. `first` (the default) shows the first match on
542
+ * the page; `start` shows the match the page opens with, else the section the page
543
+ * continues; `last` shows the last match; `firstExcept` shows nothing on a page
544
+ * where a match appears; `range` shows the first and last section the page holds.
545
+ * A page with no match shows the section carried over from earlier pages.
546
+ */
547
+ show?: RunningHeadShow;
548
+ /**
549
+ * CSS selector for the headings that enclose the followed ones, e.g. `h1` for a
550
+ * running head that follows `h2` sections. A match ends the current section, and
551
+ * only sections of the chapter in effect are shown. A chapter running head and a
552
+ * section running head on one page agree when they use the same `show` other
553
+ * than `range`, or when the chapter uses `start` beside a section `range`.
554
+ */
555
+ within?: string;
556
+ /**
557
+ * The number to show, with `{counter}` placeholders read where the heading sits,
558
+ * e.g. `{h1:decimal-leading-zero}.`. Defaults to the number the heading shows.
559
+ */
560
+ format?: string;
561
+ /**
562
+ * Default `<counter-style>` for placeholders in `format`. Defaults to the
563
+ * document's numbering style, or `decimal`.
564
+ */
565
+ counterStyle?: CounterStyle;
566
+ /**
567
+ * The text between the first and last section when `show` is `range`. Defaults to
568
+ * an en dash with a space either side.
569
+ */
570
+ rangeSeparator?: string;
571
+ /**
572
+ * HTML tag to render: `span` (the default), `div`, `p`, a heading, or a sectioning
573
+ * element such as `header`. The text goes in a shadow root, which only these
574
+ * elements can hold.
575
+ */
576
+ as?: RunningHeadElement;
577
+ }
578
+ /**
579
+ * Names, in a page's header or footer, the section the page belongs to: the title
580
+ * of the heading `match` picks out, with its number. Place it in a Layout's
581
+ * scaffolding, and Format fills it on every page once the page's content is placed,
582
+ * so a chapter that starts halfway down a page is named correctly. The heading, its
583
+ * table of contents entry, and the running head always show the same number and
584
+ * title.
585
+ *
586
+ * Set `data-running-head` on a heading to show a shorter title (an empty value shows
587
+ * nothing for it), and `data-running-head-reset` on any element to end the current
588
+ * section, e.g. on an appendix's title page. For the heading's PDF bookmark, set
589
+ * `data-bookmark` the same way.
590
+ *
591
+ * The box keeps one size whatever text lands in it: one line tall, or as many lines
592
+ * as `--running-head-lines` sets. Give it a width in your layout, such as a grid
593
+ * column; text that doesn't fit is cut off, with an ellipsis when the box holds its
594
+ * lines. The text sits in the box's own shadow root, where your selectors don't
595
+ * reach: style it with `::part()`, such as `::part(title)`.
596
+ *
597
+ * ```tsx
598
+ * <Numbering>
599
+ * <NumberingRule match="h1" format="{h1:decimal-leading-zero}." />
600
+ * </Numbering>
601
+ * <Layout id="page" width={595} height={842}>
602
+ * <header>
603
+ * <RunningHead match="h1" show="start" />
604
+ * <PageNumber />
605
+ * </header>
606
+ * <Flow>
607
+ * <h1>General information</h1>
608
+ * ...
609
+ * </Flow>
610
+ * </Layout>
611
+ * ```
612
+ */
613
+ declare function RunningHead({
614
+ match,
615
+ show,
616
+ within,
617
+ format,
618
+ counterStyle,
619
+ rangeSeparator,
620
+ as: Tag,
621
+ ...rest
622
+ }: RunningHeadProps): react0.JSX.Element;
623
+ //#endregion
476
624
  //#region src/TableOfContents.d.ts
477
625
  interface TableOfContentsProps {
478
626
  /**
479
- * CSS selector for the headings to list. Defaults to `h1, h2, h3`.
627
+ * CSS selector for the headings to list. Defaults to `h1, h2, h3`. Like a
628
+ * `<NumberingRule>`'s `match`, it matches the content that flows across pages,
629
+ * without the scaffolding around it.
480
630
  */
481
631
  collect?: string;
482
632
  /**
@@ -489,6 +639,15 @@ interface TableOfContentsProps {
489
639
  * running header. Off by default: the leading content shows once, above the entries.
490
640
  */
491
641
  repeatHead?: boolean;
642
+ /**
643
+ * CSS selector for the headings that enclose the listed ones, e.g. `h1` for a
644
+ * chapter's list of its sections. Place the contents after the chapter's heading:
645
+ * it lists the headings up to the next match. It runs independently of every other
646
+ * contents, so a book's contents can list every chapter while each chapter lists
647
+ * its own sections. Without it, a contents runs to the next contents without
648
+ * `within`.
649
+ */
650
+ within?: string;
492
651
  /**
493
652
  * Leading content rendered at the top of the contents, above the entries — a
494
653
  * "Contents" heading, an intro line, a rule. Shown once by default; set `repeatHead`
@@ -521,6 +680,21 @@ interface TableOfContentsProps {
521
680
  * Children are leading content shown above the entries — put a "Contents" heading there.
522
681
  * It shows once by default; set `repeatHead` to repeat it with the nav on every page.
523
682
  *
683
+ * Place it directly in a `<Flow>` or its `<Stream>`. Inside other content, such as a
684
+ * `<section>`, it renders nothing.
685
+ *
686
+ * A contents lists the headings after it, up to the next contents without `within`.
687
+ * Set `within` to give one its own section instead, such as a chapter's sections
688
+ * beside the book's chapters:
689
+ *
690
+ * ```tsx
691
+ * <TableOfContents collect="h1">…</TableOfContents>
692
+ *
693
+ * <h1>Admissions</h1>
694
+ * <TableOfContents collect="h2" within="h1" />
695
+ * <h2>Requirements</h2>
696
+ * ```
697
+ *
524
698
  * Give a collected heading a `data-toc-description` and its entry gains a
525
699
  * `toc-description` line under the title (a one-line summary, as on a magazine or
526
700
  * report contents):
@@ -539,6 +713,7 @@ declare function TableOfContents({
539
713
  collect,
540
714
  leader,
541
715
  repeatHead,
716
+ within,
542
717
  className,
543
718
  style,
544
719
  children
@@ -626,5 +801,5 @@ declare function Footnotes({
626
801
  */
627
802
  declare function css(parts: TemplateStringsArray, ...vals: unknown[]): string;
628
803
  //#endregion
629
- export { Counter, CounterDef, type CounterDefProps, type CounterProps, type CounterStyle, Document, type DocumentProps, Flow, type FlowProps, type FontMode, Footnote, Footnotes, type FootnotesProps, Layout, type LayoutProps, Numbering, type NumberingProps, NumberingRule, type NumberingRuleProps, PageBreak, PageCount, type PageCountProps, PageNumber, type PageNumberProps, type PaginationStrategy, Ref, type RefProps, type RenderProps, Scope, type ScopeProps, SplitGranularity, Stream, TableOfContents, type TableOfContentsProps, TocLeader, css };
804
+ export { Bookmarks, type BookmarksProps, Counter, CounterDef, type CounterDefProps, type CounterProps, type CounterStyle, Document, type DocumentProps, Flow, type FlowProps, type FontMode, Footnote, Footnotes, type FootnotesProps, Layout, type LayoutProps, Numbering, type NumberingProps, NumberingRule, type NumberingRuleProps, PageBreak, PageCount, type PageCountProps, PageNumber, type PageNumberProps, type PaginationStrategy, Ref, type RefProps, type RenderProps, RunningHead, type RunningHeadElement, type RunningHeadProps, type RunningHeadShow, Scope, type ScopeProps, SplitGranularity, Stream, TableOfContents, type TableOfContentsProps, TocLeader, css };
630
805
  //# sourceMappingURL=index.d.cts.map
@@ -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;EAMlB,SAAA,QAAQ,EAAA,UAAA;EAMR,SAAA,IAAA,EAAY,MAAA;;KA5BZ,gBAAA,WAA2B,+BAA+B;;ACPtE;AAgCA;AAIA;;AAAkC,cDtBrB,SCsBqB,EAAA;EAAS,SAAA,IAAA,EAAA,MAAA;EAAQ,SAAA,IAAA,EAAA,MAAA;CAAU;AAAO,KDjBxD,SAAA,GCiBwD,CAAA,ODjBpC,SCiBoC,CAAA,CAAA,MAAA,ODjBZ,SCiBY,CAAA;;;AAA4C,KDbpG,kBAAA,GCaoG,MAAA,GAAA,QAAA;;;;;ACtC/F,KF+BL,QAAA,GE/BgB,UAMN,GAAA,SAAA;AAItB;;;;AAIC,KFuBW,YAAA,GEvBX,SAAA,GAA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CnB,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"}
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/Bookmarks.tsx","../src/Scope.tsx","../src/Ref.tsx","../src/RunningHead.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;EAQlB,SAAA,QAAA,EAAe,UAAA;EAMf,SAAA,IAAA,EAAA,MAAkB;AAwB9B,CAAA;AAMY,KA5DA,gBAAA,GA4DY,CAAA,OA5De,gBA4Df,CAAA,CAAA,MAAA,OA5D8C,gBA4D9C,CAAA;;;;ACnExB;AAqCA;AAIgB,cD3BH,SC2BW,EAAA;EACvB,SAAA,IAAA,EAAA,MAAA;EACA,SAAA,IAAA,EAAA,MAAA;CACA;AACA,KD1BW,SAAA,GC0BX,CAAA,OD1B+B,SC0B/B,CAAA,CAAA,MAAA,OD1BuD,SC0BvD,CAAA;;;AAGA,KDzBW,kBAAA,GCyBX,MAAA,GAAA,QAAA;;;;;;;KDjBW,eAAA;AEjCZ;AAUA;;;AAGC,KF0BW,kBAAA,GE1BX,MAAA,GAAA,KAAA,GAAA,GAAA,GAAA,IAAA,GAAA,IAAA,GAAA,IAAA,GAAA,IAAA,GAAA,IAAA,GAAA,IAAA,GAA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A,CAAA,EAAA,MAAA;EAQA;AAMZ;AAwBA;AAMA;We1DU;;;AdTV;AAqCA;EAIgB,UAAA,CAAQ,EAAA,OAAA;EACvB;;;;;;;;EAOE,MAAA,CAAA,EAAA,MAAA;EAAgC;;;;;ECnDlB,QAAA,CAAA,Ea+BL,Sb/BgB;EAUZ;;;;EAIf,SAAA,CAAA,EAAA,MAAA;EACA;EACA,KAAA,CAAA,EasBQ,abtBR;;;;;;;;AChBD;AA6BA;;;;;;;;;;;;ACbA;;;;;;;;ACpBA;;;;ACGA;;;;;;;;;;ACDA;AAEA;;;;ACFA;AAEgB,iBOwFA,eAAA,CPxFiB;EAAA,OAAc;EAAA,MAAA;EAAA,UAAA;EAAA,MAAA;EAAA,SAAA;EAAA,KAAA;EAAA;AAAA,CAAA,EOgG5C,oBPhG4C,CAAA,EOgGxB,MAAA,CAAA,GAAA,CAAA,OPhGwB;;;;;;ARE/C;AAOA;AAOA;AAKA;AAIA;AAQA;AAMA;AAwBA;AAMA;;iBgBzDgB,QAAA;;GAAuB,oBAAiB,MAAA,CAAA,GAAA,CAAA;;;UCZvC,cAAA;;AjBEjB;AAOA;AAOA;EAKY,YAAS,CAAA,EiBhBL,YjBgBgB;EAIpB;AAQZ;AAMA;AAwBA;AAMA;;;;ACnEA;AAqCA;AAIA;EACC,UAAA,CAAA,EAAA,OAAA;EACA;EACA,SAAA,CAAA,EAAA,MAAA;EACA;EACA,KAAA,CAAA,EgB3BQ,ahB2BR;;;;;;;;;;AChDD;AAUA;;;;;;;;;;;iBekCgB,SAAA;;;;;;;GAOb,kBAAkB,kBAAe,MAAA,CAAA,GAAA,CAAA;;;AjB9BpC;AAIA;AAQA;AAMA;AAwBA;AAMA;;;iBkBpDgB,GAAA,QAAW"}
package/dist/index.d.ts CHANGED
@@ -29,6 +29,18 @@ type TocLeader = (typeof TocLeader)[keyof typeof TocLeader];
29
29
  /** How a Layout or Flow decides where pages break: `auto` on overflow
30
30
  * and at PageBreak markers, `manual` at PageBreak markers only. */
31
31
  type PaginationStrategy = 'auto' | 'manual';
32
+ /**
33
+ * Which matched heading a `<RunningHead>` shows on a page: the `first` or `last`
34
+ * match on the page, the one the page `start`s with, `firstExcept` to show nothing
35
+ * on a page where a match appears, or the `range` of sections the page holds. On a
36
+ * page with no match, each shows the section carried over from earlier pages.
37
+ */
38
+ type RunningHeadShow = 'first' | 'start' | 'last' | 'firstExcept' | 'range';
39
+ /**
40
+ * The elements a `<RunningHead>` can render as: those that can hold a shadow root,
41
+ * where its text goes.
42
+ */
43
+ type RunningHeadElement = 'span' | 'div' | 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'header' | 'footer' | 'nav' | 'section' | 'article' | 'aside' | 'blockquote' | 'main' | 'body';
32
44
  /**
33
45
  * How the PDF embeds its fonts. Mirrors `FontMode` in `@format.dev/fonts`, which owns
34
46
  * the canonical list and the default.
@@ -47,16 +59,21 @@ interface DocumentProps {
47
59
  author?: string;
48
60
  keywords?: string[];
49
61
  /**
50
- * How the PDF embeds its fonts — file size against rendering quality. Leave
51
- * unset for most documents; set `'fidelity'` when exact text rendering
52
- * matters more than file size.
53
- *
54
- * - Compact (the default) keeps files small: the fonts embed as subset CID
55
- * instances, so the optical size is fixed and strokes can look slightly
56
- * heavier in some viewers (for example macOS Preview).
57
- * - Fidelity gives the best-looking output: text keeps its exact optical
58
- * sizing and renders at the same weight in every PDF viewer. The cost is a
59
- * larger file, since the fonts embed as Type 3.
62
+ * The language the document is written in, as a BCP 47 language tag such as
63
+ * `'fr'` or `'pt-BR'`. Format adds it to your PDF, and screen readers use it to
64
+ * choose the right voice and pronunciation. Format also applies that language's
65
+ * conventions for quotation marks and letter case to every page. Set it on
66
+ * every document: without it, your PDF has no language and doesn't meet
67
+ * accessibility standards such as WCAG and PDF/UA. Format ignores invalid tags,
68
+ * such as `'en_US'` or `'english'`. To mark a passage in a different language,
69
+ * add a `lang` attribute to its element.
70
+ */
71
+ lang?: string;
72
+ /**
73
+ * Selects the versions of Format's built-in Sans, Serif, and Mono fonts.
74
+ * `compact` (default) uses static fonts for smaller PDFs. `fidelity` uses
75
+ * variable fonts, preserving optical sizing where supported, but typically
76
+ * produces larger PDFs. Custom fonts are used as supplied in either mode.
60
77
  */
61
78
  fonts?: FontMode;
62
79
  }
@@ -68,7 +85,7 @@ interface DocumentProps {
68
85
  * import type { Invoice } from './types'
69
86
  *
70
87
  * export default function InvoiceDocument({ data }: RenderProps<Invoice>) {
71
- * return <Document title={`Invoice #${data.id}`}>{/* ... *\/}</Document>
88
+ * return <Document title={`Invoice #${data.id}`} lang="en">{/* ... *\/}</Document>
72
89
  * }
73
90
  * ```
74
91
  */
@@ -80,6 +97,7 @@ declare function Document({
80
97
  subject,
81
98
  author,
82
99
  keywords,
100
+ lang,
83
101
  fonts,
84
102
  children
85
103
  }: PropsWithChildren<DocumentProps>): react0.JSX.Element;
@@ -266,7 +284,9 @@ declare function Counter({
266
284
  interface NumberingRuleBase {
267
285
  /**
268
286
  * CSS selector for the elements this rule numbers, e.g. `h2`, `figure figcaption`,
269
- * `.step`. Every match advances the counter in document order.
287
+ * `.step`. Every match advances the counter in document order. It matches the
288
+ * content that flows across pages, without the Layout or Flow scaffolding around
289
+ * it: when a Layout wraps its Flow in `<main>`, `main h2` matches nothing.
270
290
  */
271
291
  match: string;
272
292
  /**
@@ -336,7 +356,7 @@ interface NumberingProps {
336
356
  * breaks where plain CSS counters would reset.
337
357
  *
338
358
  * ```tsx
339
- * <Document title="Report">
359
+ * <Document title="Report" lang="en">
340
360
  * <Numbering />
341
361
  * ...
342
362
  * </Document>
@@ -390,6 +410,42 @@ declare function CounterDef({
390
410
  resetEach
391
411
  }: CounterDefProps): react0.JSX.Element;
392
412
  //#endregion
413
+ //#region src/Bookmarks.d.ts
414
+ interface BookmarksProps {
415
+ /**
416
+ * Whether bookmarks include the numbers `<Numbering>` adds to headings. On by
417
+ * default. Set `false` to show titles alone, such as "Fees" instead of "3 Fees".
418
+ * Text you write in a heading always stays, including digits and the value of a
419
+ * `<Counter>`.
420
+ */
421
+ numbers?: boolean;
422
+ /**
423
+ * The text between each number and its title, such as `". "` for "3. Fees".
424
+ * Defaults to a space, as on the page. An empty string joins them, as in "3Fees".
425
+ */
426
+ separator?: string;
427
+ }
428
+ /**
429
+ * Controls how heading numbers appear in the PDF's bookmarks, the clickable outline
430
+ * that PDF viewers show beside the pages. By default, each bookmark matches its
431
+ * heading, number included. Set `numbers={false}` to leave the numbers out, or set
432
+ * `separator` to change the text between each number and its title. The pages, the
433
+ * table of contents, and the running heads keep their numbers. Place one directly
434
+ * inside `<Document>`.
435
+ *
436
+ * ```tsx
437
+ * <Document title="Handbook">
438
+ * <Numbering />
439
+ * <Bookmarks separator=". " />
440
+ * ...
441
+ * </Document>
442
+ * ```
443
+ */
444
+ declare function Bookmarks({
445
+ numbers,
446
+ separator
447
+ }: BookmarksProps): react0.JSX.Element;
448
+ //#endregion
393
449
  //#region src/Scope.d.ts
394
450
  interface ScopeProps {
395
451
  /**
@@ -473,10 +529,104 @@ declare function Ref({
473
529
  ...rest
474
530
  }: RefProps): react0.JSX.Element;
475
531
  //#endregion
532
+ //#region src/RunningHead.d.ts
533
+ interface RunningHeadProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
534
+ /**
535
+ * CSS selector for the headings to follow, e.g. `h1`. Like a `<NumberingRule>`'s
536
+ * `match`, it matches the content that flows across pages, without the scaffolding
537
+ * around it: select on the heading itself, e.g. `h1` rather than `main h1`.
538
+ */
539
+ match: string;
540
+ /**
541
+ * Which match to show on each page. `first` (the default) shows the first match on
542
+ * the page; `start` shows the match the page opens with, else the section the page
543
+ * continues; `last` shows the last match; `firstExcept` shows nothing on a page
544
+ * where a match appears; `range` shows the first and last section the page holds.
545
+ * A page with no match shows the section carried over from earlier pages.
546
+ */
547
+ show?: RunningHeadShow;
548
+ /**
549
+ * CSS selector for the headings that enclose the followed ones, e.g. `h1` for a
550
+ * running head that follows `h2` sections. A match ends the current section, and
551
+ * only sections of the chapter in effect are shown. A chapter running head and a
552
+ * section running head on one page agree when they use the same `show` other
553
+ * than `range`, or when the chapter uses `start` beside a section `range`.
554
+ */
555
+ within?: string;
556
+ /**
557
+ * The number to show, with `{counter}` placeholders read where the heading sits,
558
+ * e.g. `{h1:decimal-leading-zero}.`. Defaults to the number the heading shows.
559
+ */
560
+ format?: string;
561
+ /**
562
+ * Default `<counter-style>` for placeholders in `format`. Defaults to the
563
+ * document's numbering style, or `decimal`.
564
+ */
565
+ counterStyle?: CounterStyle;
566
+ /**
567
+ * The text between the first and last section when `show` is `range`. Defaults to
568
+ * an en dash with a space either side.
569
+ */
570
+ rangeSeparator?: string;
571
+ /**
572
+ * HTML tag to render: `span` (the default), `div`, `p`, a heading, or a sectioning
573
+ * element such as `header`. The text goes in a shadow root, which only these
574
+ * elements can hold.
575
+ */
576
+ as?: RunningHeadElement;
577
+ }
578
+ /**
579
+ * Names, in a page's header or footer, the section the page belongs to: the title
580
+ * of the heading `match` picks out, with its number. Place it in a Layout's
581
+ * scaffolding, and Format fills it on every page once the page's content is placed,
582
+ * so a chapter that starts halfway down a page is named correctly. The heading, its
583
+ * table of contents entry, and the running head always show the same number and
584
+ * title.
585
+ *
586
+ * Set `data-running-head` on a heading to show a shorter title (an empty value shows
587
+ * nothing for it), and `data-running-head-reset` on any element to end the current
588
+ * section, e.g. on an appendix's title page. For the heading's PDF bookmark, set
589
+ * `data-bookmark` the same way.
590
+ *
591
+ * The box keeps one size whatever text lands in it: one line tall, or as many lines
592
+ * as `--running-head-lines` sets. Give it a width in your layout, such as a grid
593
+ * column; text that doesn't fit is cut off, with an ellipsis when the box holds its
594
+ * lines. The text sits in the box's own shadow root, where your selectors don't
595
+ * reach: style it with `::part()`, such as `::part(title)`.
596
+ *
597
+ * ```tsx
598
+ * <Numbering>
599
+ * <NumberingRule match="h1" format="{h1:decimal-leading-zero}." />
600
+ * </Numbering>
601
+ * <Layout id="page" width={595} height={842}>
602
+ * <header>
603
+ * <RunningHead match="h1" show="start" />
604
+ * <PageNumber />
605
+ * </header>
606
+ * <Flow>
607
+ * <h1>General information</h1>
608
+ * ...
609
+ * </Flow>
610
+ * </Layout>
611
+ * ```
612
+ */
613
+ declare function RunningHead({
614
+ match,
615
+ show,
616
+ within,
617
+ format,
618
+ counterStyle,
619
+ rangeSeparator,
620
+ as: Tag,
621
+ ...rest
622
+ }: RunningHeadProps): react0.JSX.Element;
623
+ //#endregion
476
624
  //#region src/TableOfContents.d.ts
477
625
  interface TableOfContentsProps {
478
626
  /**
479
- * CSS selector for the headings to list. Defaults to `h1, h2, h3`.
627
+ * CSS selector for the headings to list. Defaults to `h1, h2, h3`. Like a
628
+ * `<NumberingRule>`'s `match`, it matches the content that flows across pages,
629
+ * without the scaffolding around it.
480
630
  */
481
631
  collect?: string;
482
632
  /**
@@ -489,6 +639,15 @@ interface TableOfContentsProps {
489
639
  * running header. Off by default: the leading content shows once, above the entries.
490
640
  */
491
641
  repeatHead?: boolean;
642
+ /**
643
+ * CSS selector for the headings that enclose the listed ones, e.g. `h1` for a
644
+ * chapter's list of its sections. Place the contents after the chapter's heading:
645
+ * it lists the headings up to the next match. It runs independently of every other
646
+ * contents, so a book's contents can list every chapter while each chapter lists
647
+ * its own sections. Without it, a contents runs to the next contents without
648
+ * `within`.
649
+ */
650
+ within?: string;
492
651
  /**
493
652
  * Leading content rendered at the top of the contents, above the entries — a
494
653
  * "Contents" heading, an intro line, a rule. Shown once by default; set `repeatHead`
@@ -521,6 +680,21 @@ interface TableOfContentsProps {
521
680
  * Children are leading content shown above the entries — put a "Contents" heading there.
522
681
  * It shows once by default; set `repeatHead` to repeat it with the nav on every page.
523
682
  *
683
+ * Place it directly in a `<Flow>` or its `<Stream>`. Inside other content, such as a
684
+ * `<section>`, it renders nothing.
685
+ *
686
+ * A contents lists the headings after it, up to the next contents without `within`.
687
+ * Set `within` to give one its own section instead, such as a chapter's sections
688
+ * beside the book's chapters:
689
+ *
690
+ * ```tsx
691
+ * <TableOfContents collect="h1">…</TableOfContents>
692
+ *
693
+ * <h1>Admissions</h1>
694
+ * <TableOfContents collect="h2" within="h1" />
695
+ * <h2>Requirements</h2>
696
+ * ```
697
+ *
524
698
  * Give a collected heading a `data-toc-description` and its entry gains a
525
699
  * `toc-description` line under the title (a one-line summary, as on a magazine or
526
700
  * report contents):
@@ -539,6 +713,7 @@ declare function TableOfContents({
539
713
  collect,
540
714
  leader,
541
715
  repeatHead,
716
+ within,
542
717
  className,
543
718
  style,
544
719
  children
@@ -626,5 +801,5 @@ declare function Footnotes({
626
801
  */
627
802
  declare function css(parts: TemplateStringsArray, ...vals: unknown[]): string;
628
803
  //#endregion
629
- export { Counter, CounterDef, type CounterDefProps, type CounterProps, type CounterStyle, Document, type DocumentProps, Flow, type FlowProps, type FontMode, Footnote, Footnotes, type FootnotesProps, Layout, type LayoutProps, Numbering, type NumberingProps, NumberingRule, type NumberingRuleProps, PageBreak, PageCount, type PageCountProps, PageNumber, type PageNumberProps, type PaginationStrategy, Ref, type RefProps, type RenderProps, Scope, type ScopeProps, SplitGranularity, Stream, TableOfContents, type TableOfContentsProps, TocLeader, css };
804
+ export { Bookmarks, type BookmarksProps, Counter, CounterDef, type CounterDefProps, type CounterProps, type CounterStyle, Document, type DocumentProps, Flow, type FlowProps, type FontMode, Footnote, Footnotes, type FootnotesProps, Layout, type LayoutProps, Numbering, type NumberingProps, NumberingRule, type NumberingRuleProps, PageBreak, PageCount, type PageCountProps, PageNumber, type PageNumberProps, type PaginationStrategy, Ref, type RefProps, type RenderProps, RunningHead, type RunningHeadElement, type RunningHeadProps, type RunningHeadShow, Scope, type ScopeProps, SplitGranularity, Stream, TableOfContents, type TableOfContentsProps, TocLeader, css };
630
805
  //# sourceMappingURL=index.d.ts.map
@@ -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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kBwD;EAA8B;;;;;;UYXzF;AX3BT;AAUA;;;;;;;;;;;;;;ACVA;AA6BA;;;;;;;;;;;;ACbA;;;;;iBS8CgB,eAAA;;;;;;;GAA6E,uBAAoB,MAAA,CAAA,GAAA,CAAA;;;;;;Ab5DjH;AAOA;AAOA;AAKA;AAIA;AAMA;AAMA;;;;ACnCiB,iBaUD,QAAA,CbOP;EAAA;AAAQ,CAAA,EaPsB,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"}
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/Bookmarks.tsx","../src/Scope.tsx","../src/Ref.tsx","../src/RunningHead.tsx","../src/TableOfContents.tsx","../src/Footnote.tsx","../src/Footnotes.tsx","../src/utils.ts"],"sourc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,MAAA,CAAA,GAAA,CAAA,OPhGwB;;;;;;ARE/C;AAOA;AAOA;AAKA;AAIA;AAQA;AAMA;AAwBA;AAMA;;iBgBzDgB,QAAA;;GAAuB,oBAAiB,MAAA,CAAA,GAAA,CAAA;;;UCZvC,cAAA;;AjBEjB;AAOA;AAOA;EAKY,YAAS,CAAA,EiBhBL,YjBgBgB;EAIpB;AAQZ;AAMA;AAwBA;AAMA;;;;ACnEA;AAqCA;AAIA;EACC,UAAA,CAAA,EAAA,OAAA;EACA;EACA,SAAA,CAAA,EAAA,MAAA;EACA;EACA,KAAA,CAAA,EgB3BQ,ahB2BR;;;;;;;;;;AChDD;AAUA;;;;;;;;;;;iBekCgB,SAAA;;;;;;;GAOb,kBAAkB,kBAAe,MAAA,CAAA,GAAA,CAAA;;;AjB9BpC;AAIA;AAQA;AAMA;AAwBA;AAMA;;;iBkBpDgB,GAAA,QAAW"}
package/dist/index.js CHANGED
@@ -41,15 +41,15 @@ function Template({ children, ...props }) {
41
41
 
42
42
  //#endregion
43
43
  //#region src/engine-target.ts
44
- const engineTarget = "0.2.0";
44
+ const engineTarget = "0.3.0";
45
45
 
46
46
  //#endregion
47
47
  //#region src/sdk-version.ts
48
- const sdkVersion = "0.2.0";
48
+ const sdkVersion = "0.3.0";
49
49
 
50
50
  //#endregion
51
51
  //#region src/Document.tsx
52
- function Document({ title, subject, author, keywords, fonts, children }) {
52
+ function Document({ title, subject, author, keywords, lang, fonts, children }) {
53
53
  const keywordsString = keywords?.join(", ");
54
54
  return /* @__PURE__ */ jsx(Template, {
55
55
  "data-sdk": sdkVersion,
@@ -59,6 +59,7 @@ function Document({ title, subject, author, keywords, fonts, children }) {
59
59
  "data-subject": subject,
60
60
  "data-author": author,
61
61
  "data-keywords": keywordsString,
62
+ "data-lang": lang,
62
63
  "data-fonts": fonts,
63
64
  children
64
65
  });
@@ -216,7 +217,7 @@ function Counter({ name, peek, reset, set, by, join, as: Tag = "span", counterSt
216
217
  * breaks where plain CSS counters would reset.
217
218
  *
218
219
  * ```tsx
219
- * <Document title="Report">
220
+ * <Document title="Report" lang="en">
220
221
  * <Numbering />
221
222
  * ...
222
223
  * </Document>
@@ -270,6 +271,32 @@ function CounterDef({ name, resetEach }) {
270
271
  });
271
272
  }
272
273
 
274
+ //#endregion
275
+ //#region src/Bookmarks.tsx
276
+ /**
277
+ * Controls how heading numbers appear in the PDF's bookmarks, the clickable outline
278
+ * that PDF viewers show beside the pages. By default, each bookmark matches its
279
+ * heading, number included. Set `numbers={false}` to leave the numbers out, or set
280
+ * `separator` to change the text between each number and its title. The pages, the
281
+ * table of contents, and the running heads keep their numbers. Place one directly
282
+ * inside `<Document>`.
283
+ *
284
+ * ```tsx
285
+ * <Document title="Handbook">
286
+ * <Numbering />
287
+ * <Bookmarks separator=". " />
288
+ * ...
289
+ * </Document>
290
+ * ```
291
+ */
292
+ function Bookmarks({ numbers, separator }) {
293
+ return /* @__PURE__ */ jsx(Template, {
294
+ "data-type": "bookmarks",
295
+ "data-numbers": numbers === void 0 ? void 0 : numbers ? "true" : "false",
296
+ "data-separator": separator
297
+ });
298
+ }
299
+
273
300
  //#endregion
274
301
  //#region src/Scope.tsx
275
302
  /**
@@ -323,6 +350,56 @@ function Ref({ to, counter, page, as: Tag = "span", counterStyle, ...rest }) {
323
350
  });
324
351
  }
325
352
 
353
+ //#endregion
354
+ //#region src/RunningHead.tsx
355
+ /**
356
+ * Names, in a page's header or footer, the section the page belongs to: the title
357
+ * of the heading `match` picks out, with its number. Place it in a Layout's
358
+ * scaffolding, and Format fills it on every page once the page's content is placed,
359
+ * so a chapter that starts halfway down a page is named correctly. The heading, its
360
+ * table of contents entry, and the running head always show the same number and
361
+ * title.
362
+ *
363
+ * Set `data-running-head` on a heading to show a shorter title (an empty value shows
364
+ * nothing for it), and `data-running-head-reset` on any element to end the current
365
+ * section, e.g. on an appendix's title page. For the heading's PDF bookmark, set
366
+ * `data-bookmark` the same way.
367
+ *
368
+ * The box keeps one size whatever text lands in it: one line tall, or as many lines
369
+ * as `--running-head-lines` sets. Give it a width in your layout, such as a grid
370
+ * column; text that doesn't fit is cut off, with an ellipsis when the box holds its
371
+ * lines. The text sits in the box's own shadow root, where your selectors don't
372
+ * reach: style it with `::part()`, such as `::part(title)`.
373
+ *
374
+ * ```tsx
375
+ * <Numbering>
376
+ * <NumberingRule match="h1" format="{h1:decimal-leading-zero}." />
377
+ * </Numbering>
378
+ * <Layout id="page" width={595} height={842}>
379
+ * <header>
380
+ * <RunningHead match="h1" show="start" />
381
+ * <PageNumber />
382
+ * </header>
383
+ * <Flow>
384
+ * <h1>General information</h1>
385
+ * ...
386
+ * </Flow>
387
+ * </Layout>
388
+ * ```
389
+ */
390
+ function RunningHead({ match, show, within, format, counterStyle, rangeSeparator, as: Tag = "span", ...rest }) {
391
+ return /* @__PURE__ */ jsx(Tag, {
392
+ "data-type": "running-head",
393
+ "data-match": match,
394
+ "data-show": show,
395
+ "data-within": within,
396
+ "data-format": format,
397
+ "data-counter-style": counterStyle,
398
+ "data-range-separator": rangeSeparator,
399
+ ...rest
400
+ });
401
+ }
402
+
326
403
  //#endregion
327
404
  //#region src/TableOfContents.tsx
328
405
  /**
@@ -343,6 +420,21 @@ function Ref({ to, counter, page, as: Tag = "span", counterStyle, ...rest }) {
343
420
  * Children are leading content shown above the entries — put a "Contents" heading there.
344
421
  * It shows once by default; set `repeatHead` to repeat it with the nav on every page.
345
422
  *
423
+ * Place it directly in a `<Flow>` or its `<Stream>`. Inside other content, such as a
424
+ * `<section>`, it renders nothing.
425
+ *
426
+ * A contents lists the headings after it, up to the next contents without `within`.
427
+ * Set `within` to give one its own section instead, such as a chapter's sections
428
+ * beside the book's chapters:
429
+ *
430
+ * ```tsx
431
+ * <TableOfContents collect="h1">…</TableOfContents>
432
+ *
433
+ * <h1>Admissions</h1>
434
+ * <TableOfContents collect="h2" within="h1" />
435
+ * <h2>Requirements</h2>
436
+ * ```
437
+ *
346
438
  * Give a collected heading a `data-toc-description` and its entry gains a
347
439
  * `toc-description` line under the title (a one-line summary, as on a magazine or
348
440
  * report contents):
@@ -357,12 +449,13 @@ function Ref({ to, counter, page, as: Tag = "span", counterStyle, ...rest }) {
357
449
  * </h1>
358
450
  * ```
359
451
  */
360
- function TableOfContents({ collect, leader, repeatHead, className, style, children }) {
452
+ function TableOfContents({ collect, leader, repeatHead, within, className, style, children }) {
361
453
  return /* @__PURE__ */ jsx(Template, {
362
454
  "data-type": "toc",
363
455
  "data-collect": collect,
364
456
  "data-leader": leader,
365
457
  "data-repeat-head": repeatHead === void 0 ? void 0 : repeatHead ? "true" : "false",
458
+ "data-within": within,
366
459
  className,
367
460
  style,
368
461
  children
@@ -450,5 +543,5 @@ const TocLeader = {
450
543
  };
451
544
 
452
545
  //#endregion
453
- export { Counter, CounterDef, Document, Flow, Footnote, Footnotes, Layout, Numbering, NumberingRule, PageBreak, PageCount, PageNumber, Ref, Scope, SplitGranularity, Stream, TableOfContents, TocLeader, css };
546
+ export { Bookmarks, Counter, CounterDef, Document, Flow, Footnote, Footnotes, Layout, Numbering, NumberingRule, PageBreak, PageCount, PageNumber, Ref, RunningHead, Scope, SplitGranularity, Stream, TableOfContents, TocLeader, css };
454
547
  //# sourceMappingURL=index.js.map
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\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,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;;;;;;;;;;;;;;;;;;;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ACA,WACA,OACA,YACqC;AACrC,QACC,oBAAC;EACA,aAAU;EACV,sBAAoB;EACpB,0BAAwB,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/Bookmarks.tsx","../src/Scope.tsx","../src/Ref.tsx","../src/RunningHead.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 * The language the document is written in, as a BCP 47 language tag such as\n\t * `'fr'` or `'pt-BR'`. Format adds it to your PDF, and screen readers use it to\n\t * choose the right voice and pronunciation. Format also applies that language's\n\t * conventions for quotation marks and letter case to every page. Set it on\n\t * every document: without it, your PDF has no language and doesn't meet\n\t * accessibility standards such as WCAG and PDF/UA. Format ignores invalid tags,\n\t * such as `'en_US'` or `'english'`. To mark a passage in a different language,\n\t * add a `lang` attribute to its element.\n\t */\n\tlang?: string\n\t/**\n\t * Selects the versions of Format's built-in Sans, Serif, and Mono fonts.\n\t * `compact` (default) uses static fonts for smaller PDFs. `fidelity` uses\n\t * variable fonts, preserving optical sizing where supported, but typically\n\t * produces larger PDFs. Custom fonts are used as supplied in either mode.\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}`} lang=\"en\">{/* ... *\\/}</Document>\n * }\n * ```\n */\nexport interface RenderProps<T = unknown> {\n\tdata: T\n}\n\nexport function Document({\n\ttitle,\n\tsubject,\n\tauthor,\n\tkeywords,\n\tlang,\n\tfonts,\n\tchildren\n}: 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-lang={lang}\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. It matches the\n\t * content that flows across pages, without the Layout or Flow scaffolding around\n\t * it: when a Layout wraps its Flow in `<main>`, `main h2` matches nothing.\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\" lang=\"en\">\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 { Template } from './Template'\n\nexport interface BookmarksProps {\n\t/**\n\t * Whether bookmarks include the numbers `<Numbering>` adds to headings. On by\n\t * default. Set `false` to show titles alone, such as \"Fees\" instead of \"3 Fees\".\n\t * Text you write in a heading always stays, including digits and the value of a\n\t * `<Counter>`.\n\t */\n\tnumbers?: boolean\n\t/**\n\t * The text between each number and its title, such as `\". \"` for \"3. Fees\".\n\t * Defaults to a space, as on the page. An empty string joins them, as in \"3Fees\".\n\t */\n\tseparator?: string\n}\n\n/**\n * Controls how heading numbers appear in the PDF's bookmarks, the clickable outline\n * that PDF viewers show beside the pages. By default, each bookmark matches its\n * heading, number included. Set `numbers={false}` to leave the numbers out, or set\n * `separator` to change the text between each number and its title. The pages, the\n * table of contents, and the running heads keep their numbers. Place one directly\n * inside `<Document>`.\n *\n * ```tsx\n * <Document title=\"Handbook\">\n * <Numbering />\n * <Bookmarks separator=\". \" />\n * ...\n * </Document>\n * ```\n */\nexport function Bookmarks({ numbers, separator }: BookmarksProps) {\n\treturn (\n\t\t<Template\n\t\t\tdata-type='bookmarks'\n\t\t\tdata-numbers={numbers === undefined ? undefined : numbers ? 'true' : 'false'}\n\t\t\tdata-separator={separator}\n\t\t/>\n\t)\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 { HTMLAttributes } from 'react'\nimport type { CounterStyle, RunningHeadElement, RunningHeadShow } from './types'\n\nexport interface RunningHeadProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n\t/**\n\t * CSS selector for the headings to follow, e.g. `h1`. Like a `<NumberingRule>`'s\n\t * `match`, it matches the content that flows across pages, without the scaffolding\n\t * around it: select on the heading itself, e.g. `h1` rather than `main h1`.\n\t */\n\tmatch: string\n\t/**\n\t * Which match to show on each page. `first` (the default) shows the first match on\n\t * the page; `start` shows the match the page opens with, else the section the page\n\t * continues; `last` shows the last match; `firstExcept` shows nothing on a page\n\t * where a match appears; `range` shows the first and last section the page holds.\n\t * A page with no match shows the section carried over from earlier pages.\n\t */\n\tshow?: RunningHeadShow\n\t/**\n\t * CSS selector for the headings that enclose the followed ones, e.g. `h1` for a\n\t * running head that follows `h2` sections. A match ends the current section, and\n\t * only sections of the chapter in effect are shown. A chapter running head and a\n\t * section running head on one page agree when they use the same `show` other\n\t * than `range`, or when the chapter uses `start` beside a section `range`.\n\t */\n\twithin?: string\n\t/**\n\t * The number to show, with `{counter}` placeholders read where the heading sits,\n\t * e.g. `{h1:decimal-leading-zero}.`. Defaults to the number the heading shows.\n\t */\n\tformat?: string\n\t/**\n\t * Default `<counter-style>` for placeholders in `format`. Defaults to the\n\t * document's numbering style, or `decimal`.\n\t */\n\tcounterStyle?: CounterStyle\n\t/**\n\t * The text between the first and last section when `show` is `range`. Defaults to\n\t * an en dash with a space either side.\n\t */\n\trangeSeparator?: string\n\t/**\n\t * HTML tag to render: `span` (the default), `div`, `p`, a heading, or a sectioning\n\t * element such as `header`. The text goes in a shadow root, which only these\n\t * elements can hold.\n\t */\n\tas?: RunningHeadElement\n}\n\n/**\n * Names, in a page's header or footer, the section the page belongs to: the title\n * of the heading `match` picks out, with its number. Place it in a Layout's\n * scaffolding, and Format fills it on every page once the page's content is placed,\n * so a chapter that starts halfway down a page is named correctly. The heading, its\n * table of contents entry, and the running head always show the same number and\n * title.\n *\n * Set `data-running-head` on a heading to show a shorter title (an empty value shows\n * nothing for it), and `data-running-head-reset` on any element to end the current\n * section, e.g. on an appendix's title page. For the heading's PDF bookmark, set\n * `data-bookmark` the same way.\n *\n * The box keeps one size whatever text lands in it: one line tall, or as many lines\n * as `--running-head-lines` sets. Give it a width in your layout, such as a grid\n * column; text that doesn't fit is cut off, with an ellipsis when the box holds its\n * lines. The text sits in the box's own shadow root, where your selectors don't\n * reach: style it with `::part()`, such as `::part(title)`.\n *\n * ```tsx\n * <Numbering>\n * <NumberingRule match=\"h1\" format=\"{h1:decimal-leading-zero}.\" />\n * </Numbering>\n * <Layout id=\"page\" width={595} height={842}>\n * <header>\n * <RunningHead match=\"h1\" show=\"start\" />\n * <PageNumber />\n * </header>\n * <Flow>\n * <h1>General information</h1>\n * ...\n * </Flow>\n * </Layout>\n * ```\n */\nexport function RunningHead({\n\tmatch,\n\tshow,\n\twithin,\n\tformat,\n\tcounterStyle,\n\trangeSeparator,\n\tas: Tag = 'span',\n\t...rest\n}: RunningHeadProps) {\n\treturn (\n\t\t<Tag\n\t\t\tdata-type='running-head'\n\t\t\tdata-match={match}\n\t\t\tdata-show={show}\n\t\t\tdata-within={within}\n\t\t\tdata-format={format}\n\t\t\tdata-counter-style={counterStyle}\n\t\t\tdata-range-separator={rangeSeparator}\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`. Like a\n\t * `<NumberingRule>`'s `match`, it matches the content that flows across pages,\n\t * without the scaffolding around it.\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 * CSS selector for the headings that enclose the listed ones, e.g. `h1` for a\n\t * chapter's list of its sections. Place the contents after the chapter's heading:\n\t * it lists the headings up to the next match. It runs independently of every other\n\t * contents, so a book's contents can list every chapter while each chapter lists\n\t * its own sections. Without it, a contents runs to the next contents without\n\t * `within`.\n\t */\n\twithin?: string\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 * Place it directly in a `<Flow>` or its `<Stream>`. Inside other content, such as a\n * `<section>`, it renders nothing.\n *\n * A contents lists the headings after it, up to the next contents without `within`.\n * Set `within` to give one its own section instead, such as a chapter's sections\n * beside the book's chapters:\n *\n * ```tsx\n * <TableOfContents collect=\"h1\">…</TableOfContents>\n *\n * <h1>Admissions</h1>\n * <TableOfContents collect=\"h2\" within=\"h1\" />\n * <h2>Requirements</h2>\n * ```\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({\n\tcollect,\n\tleader,\n\trepeatHead,\n\twithin,\n\tclassName,\n\tstyle,\n\tchildren\n}: 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\tdata-within={within}\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 * Which matched heading a `<RunningHead>` shows on a page: the `first` or `last`\n * match on the page, the one the page `start`s with, `firstExcept` to show nothing\n * on a page where a match appears, or the `range` of sections the page holds. On a\n * page with no match, each shows the section carried over from earlier pages.\n */\nexport type RunningHeadShow = 'first' | 'start' | 'last' | 'firstExcept' | 'range'\n\n/**\n * The elements a `<RunningHead>` can render as: those that can hold a shadow root,\n * where its text goes.\n */\nexport type RunningHeadElement =\n\t| 'span'\n\t| 'div'\n\t| 'p'\n\t| 'h1'\n\t| 'h2'\n\t| 'h3'\n\t| 'h4'\n\t| 'h5'\n\t| 'h6'\n\t| 'header'\n\t| 'footer'\n\t| 'nav'\n\t| 'section'\n\t| 'article'\n\t| 'aside'\n\t| 'blockquote'\n\t| 'main'\n\t| 'body'\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;;;;ACoCb,SAAgB,SAAS,EACxB,OACA,SACA,QACA,UACA,MACA,OACA,YACoC;CACpC,MAAM,iBAAiB,UAAU,KAAK,KAAK;AAE3C,QACC,oBAAC;EACA,YAAU;EACV,eAAa;EACb,aAAU;EACV,cAAY;EACZ,gBAAc;EACd,eAAa;EACb,iBAAe;EACf,aAAW;EACX,cAAY;EACX;GACS;;;;;ACxDb,SAAgB,OAAO,EACtB,IACA,OACA,QACA,oBACA,kBACA,YACkC;AAClC,QACC,oBAAC;EACA,aAAU;EACV,WAAS;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iB;AACpB,QACC,oBAAC;EACA,aAAU;EACV,cAAY;EACZ,aAAW;EACX,eAAa;EACb,eAAa;EACb,sBAAoB;EACpB,wBAAsB;EACtB,GAAI;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACZJ,SAAgB,gBAAgB,EAC/B,SACA,QACA,YACA,QACA,WACA,OACA,YACwB;AACxB,QACC,oBAAC;EACA,aAAU;EACV,gBAAc;EACd,eAAa;EACb,oBAAkB,eAAe,SAAY,SAAY,aAAa,SAAS;EAC/E,eAAa;EACF;EACJ;EACN;GACS;;;;;;;;;;;;;;;;;;AC/Fb,SAAgB,SAAS,EAAE,YAA+B;AAGzD,QAAO,oBAAC;EAAS,aAAU;EAAY;GAAoB;;;;;;;;;;;;;;;;;;;;;;;;;AC6B5D,SAAgB,UAAU,EACzB,cACA,iBACA,YACA,WACA,OACA,YACqC;AACrC,QACC,oBAAC;EACA,aAAU;EACV,sBAAoB;EACpB,0BAAwB,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"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@format.dev/react",
3
3
  "description": "Format PDF React SDK",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",