postext 1.33.11 → 1.34.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.
Files changed (140) hide show
  1. package/README.md +2 -2
  2. package/dist/__tests__/bundle/designOverflowPin.test.js +1 -1
  3. package/dist/__tests__/bundle/gridBreakRulesPin.test.js +2 -2
  4. package/dist/__tests__/bundle/shapingLanguagePin.test.js +3 -3
  5. package/dist/__tests__/bundle/taskBoxPin.test.js +1 -1
  6. package/dist/__tests__/bundle.test.js +1 -1
  7. package/dist/__tests__/codeBlocks.test.js +1 -1
  8. package/dist/__tests__/composed/corpus.test.d.ts +2 -0
  9. package/dist/__tests__/composed/corpus.test.d.ts.map +1 -0
  10. package/dist/__tests__/composed/corpus.test.js +33 -0
  11. package/dist/__tests__/composed/corpus.test.js.map +1 -0
  12. package/dist/__tests__/composed/slotChecks.test.d.ts +2 -0
  13. package/dist/__tests__/composed/slotChecks.test.d.ts.map +1 -0
  14. package/dist/__tests__/composed/slotChecks.test.js +148 -0
  15. package/dist/__tests__/composed/slotChecks.test.js.map +1 -0
  16. package/dist/__tests__/composedTemplates.test.d.ts +2 -0
  17. package/dist/__tests__/composedTemplates.test.d.ts.map +1 -0
  18. package/dist/__tests__/composedTemplates.test.js +349 -0
  19. package/dist/__tests__/composedTemplates.test.js.map +1 -0
  20. package/dist/__tests__/contentInConfig.test.d.ts +2 -0
  21. package/dist/__tests__/contentInConfig.test.d.ts.map +1 -0
  22. package/dist/__tests__/contentInConfig.test.js +201 -0
  23. package/dist/__tests__/contentInConfig.test.js.map +1 -0
  24. package/dist/__tests__/defaults/stripRoundTrip.test.js +3 -1
  25. package/dist/__tests__/defaults/stripRoundTrip.test.js.map +1 -1
  26. package/dist/__tests__/exports.test.js +22 -0
  27. package/dist/__tests__/exports.test.js.map +1 -1
  28. package/dist/__tests__/hardBreaks.test.js +1 -1
  29. package/dist/__tests__/headingInlineMarks.test.js +1 -1
  30. package/dist/__tests__/mathSizeMigration.test.js +2 -2
  31. package/dist/__tests__/parse/composedPages.test.d.ts +2 -0
  32. package/dist/__tests__/parse/composedPages.test.d.ts.map +1 -0
  33. package/dist/__tests__/parse/composedPages.test.js +323 -0
  34. package/dist/__tests__/parse/composedPages.test.js.map +1 -0
  35. package/dist/__tests__/parse/containers.test.js +2 -2
  36. package/dist/__tests__/parse/containers.test.js.map +1 -1
  37. package/dist/__tests__/pipeline/calloutInlineResourceGap.test.js +1 -1
  38. package/dist/__tests__/pipeline/calloutSplitMinLinesChild.test.js +1 -1
  39. package/dist/__tests__/pipeline/colonListRoom.test.js +1 -1
  40. package/dist/__tests__/pipeline/compoundBreaks.test.js +1 -1
  41. package/dist/__tests__/pipeline/dashBreaks.test.js +1 -1
  42. package/dist/__tests__/pipeline/headingSplitOrphans.test.js +1 -1
  43. package/dist/__tests__/pipeline/inlineFigureSpace.test.js +1 -1
  44. package/dist/__tests__/pipeline/paragraphContainerTail.test.js +1 -1
  45. package/dist/__tests__/pipeline/raggedOptimal.test.js +1 -1
  46. package/dist/__tests__/tocGroups.test.d.ts +2 -0
  47. package/dist/__tests__/tocGroups.test.d.ts.map +1 -0
  48. package/dist/__tests__/tocGroups.test.js +213 -0
  49. package/dist/__tests__/tocGroups.test.js.map +1 -0
  50. package/dist/__tests__/verseLines.test.js +1 -1
  51. package/dist/bundle/configVersion.d.ts +16 -5
  52. package/dist/bundle/configVersion.d.ts.map +1 -1
  53. package/dist/bundle/configVersion.js +17 -4
  54. package/dist/bundle/configVersion.js.map +1 -1
  55. package/dist/bundle/types.d.ts +4 -3
  56. package/dist/bundle/types.d.ts.map +1 -1
  57. package/dist/composed/document.d.ts +43 -0
  58. package/dist/composed/document.d.ts.map +1 -0
  59. package/dist/composed/document.js +88 -0
  60. package/dist/composed/document.js.map +1 -0
  61. package/dist/composed/slotChecks.d.ts +29 -0
  62. package/dist/composed/slotChecks.d.ts.map +1 -0
  63. package/dist/composed/slotChecks.js +109 -0
  64. package/dist/composed/slotChecks.js.map +1 -0
  65. package/dist/composed/templates.d.ts +133 -0
  66. package/dist/composed/templates.d.ts.map +1 -0
  67. package/dist/composed/templates.js +702 -0
  68. package/dist/composed/templates.js.map +1 -0
  69. package/dist/composed/types.d.ts +404 -0
  70. package/dist/composed/types.d.ts.map +1 -0
  71. package/dist/composed/types.js +2 -0
  72. package/dist/composed/types.js.map +1 -0
  73. package/dist/composed/validate.d.ts +26 -0
  74. package/dist/composed/validate.d.ts.map +1 -0
  75. package/dist/composed/validate.js +276 -0
  76. package/dist/composed/validate.js.map +1 -0
  77. package/dist/configWarnings.d.ts +19 -3
  78. package/dist/configWarnings.d.ts.map +1 -1
  79. package/dist/configWarnings.js +170 -40
  80. package/dist/configWarnings.js.map +1 -1
  81. package/dist/defaults/checks.d.ts +7 -0
  82. package/dist/defaults/checks.d.ts.map +1 -0
  83. package/dist/defaults/checks.js +49 -0
  84. package/dist/defaults/checks.js.map +1 -0
  85. package/dist/defaults/index.d.ts +1 -0
  86. package/dist/defaults/index.d.ts.map +1 -1
  87. package/dist/defaults/index.js +26 -0
  88. package/dist/defaults/index.js.map +1 -1
  89. package/dist/defaults/toc.d.ts +17 -2
  90. package/dist/defaults/toc.d.ts.map +1 -1
  91. package/dist/defaults/toc.js +53 -1
  92. package/dist/defaults/toc.js.map +1 -1
  93. package/dist/design/slots.d.ts +29 -0
  94. package/dist/design/slots.d.ts.map +1 -0
  95. package/dist/design/slots.js +48 -0
  96. package/dist/design/slots.js.map +1 -0
  97. package/dist/index.d.ts +17 -3
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/index.js +10 -1
  100. package/dist/index.js.map +1 -1
  101. package/dist/parse/blockParser.d.ts.map +1 -1
  102. package/dist/parse/blockParser.js +295 -36
  103. package/dist/parse/blockParser.js.map +1 -1
  104. package/dist/parse/index.d.ts +1 -1
  105. package/dist/parse/index.d.ts.map +1 -1
  106. package/dist/parse/index.js.map +1 -1
  107. package/dist/parse/indexMarks.d.ts.map +1 -1
  108. package/dist/parse/indexMarks.js +24 -0
  109. package/dist/parse/indexMarks.js.map +1 -1
  110. package/dist/parse/types.d.ts +95 -2
  111. package/dist/parse/types.d.ts.map +1 -1
  112. package/dist/pipeline/build.d.ts.map +1 -1
  113. package/dist/pipeline/build.js +178 -3
  114. package/dist/pipeline/build.js.map +1 -1
  115. package/dist/pipeline/config.d.ts.map +1 -1
  116. package/dist/pipeline/config.js +17 -2
  117. package/dist/pipeline/config.js.map +1 -1
  118. package/dist/pipeline/contentWarnings.d.ts.map +1 -1
  119. package/dist/pipeline/contentWarnings.js +73 -0
  120. package/dist/pipeline/contentWarnings.js.map +1 -1
  121. package/dist/pipeline/placeholders.d.ts +7 -0
  122. package/dist/pipeline/placeholders.d.ts.map +1 -1
  123. package/dist/pipeline/placeholders.js +41 -0
  124. package/dist/pipeline/placeholders.js.map +1 -1
  125. package/dist/pipeline/textWrap.js +1 -1
  126. package/dist/pipeline/textWrap.js.map +1 -1
  127. package/dist/pipeline/toc.d.ts +11 -1
  128. package/dist/pipeline/toc.d.ts.map +1 -1
  129. package/dist/pipeline/toc.js +147 -8
  130. package/dist/pipeline/toc.js.map +1 -1
  131. package/dist/types.d.ts +99 -0
  132. package/dist/types.d.ts.map +1 -1
  133. package/dist/util/closestKey.d.ts +4 -0
  134. package/dist/util/closestKey.d.ts.map +1 -0
  135. package/dist/util/closestKey.js +40 -0
  136. package/dist/util/closestKey.js.map +1 -0
  137. package/dist/vdt.d.ts +125 -7
  138. package/dist/vdt.d.ts.map +1 -1
  139. package/dist/vdt.js.map +1 -1
  140. package/package.json +1 -1
@@ -0,0 +1,133 @@
1
+ import type { Dimension, ElementPlacement } from '../types';
2
+ import type { FrameConfig, FrameSize, LabelStyle, PageTemplate, PageTemplateGrid, ResolvedFrame, ResolvedFrameFit, ResolvedLabelStyle, ResolvedPageTemplate, ResolvePageTemplateOptions } from './types';
3
+ export declare const DEFAULT_FRAME_FIT: Readonly<ResolvedFrameFit>;
4
+ /** What a frame that sets nothing comes to (besides its name). */
5
+ export declare const DEFAULT_FRAME: {
6
+ width: FrameSize;
7
+ height: FrameSize;
8
+ layer: number;
9
+ rotate: number;
10
+ verticalAlign: "top";
11
+ columns: number;
12
+ exclude: "none";
13
+ flow: boolean;
14
+ pin: boolean;
15
+ grow: number;
16
+ shrink: number;
17
+ priority: number;
18
+ optional: boolean;
19
+ crossGutter: boolean;
20
+ };
21
+ export declare const DEFAULT_FRAME_GROUP: {
22
+ kind: "stack";
23
+ gap: Dimension;
24
+ align: "start";
25
+ };
26
+ export declare const DEFAULT_PAGE_TEMPLATE: {
27
+ area: "content";
28
+ spread: boolean;
29
+ gutter: Dimension;
30
+ role: string;
31
+ };
32
+ export declare const DEFAULT_LABEL_STYLE: {
33
+ fontStyle: "normal";
34
+ textTransform: "none";
35
+ minScale: number;
36
+ };
37
+ export declare const FRAME_VERTICAL_ALIGNS: readonly ["top", "middle", "bottom", "justify"];
38
+ export declare const FRAME_EXCLUDES: readonly ["none", "push"];
39
+ export declare const FRAME_TAKES: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
40
+ export declare const FRAME_GROUP_KINDS: readonly ["stack", "row"];
41
+ export declare const FRAME_GROUP_ALIGNS: readonly ["start", "center", "end", "space-between"];
42
+ export declare const TEMPLATE_AREAS: readonly ["content", "trim", "bleed"];
43
+ export declare const FRAME_WRITING_MODES: readonly ["horizontal-tb", "vertical-rl"];
44
+ export declare const FRAME_DIRECTIONS: readonly ["ltr", "rtl"];
45
+ export declare const LABEL_FONT_STYLES: readonly ["normal", "italic"];
46
+ export declare const LABEL_TEXT_TRANSFORMS: readonly ["none", "uppercase"];
47
+ /** A length the engine can use: a finite, non-negative value in a known
48
+ * unit. */
49
+ export declare function isFrameDimension(v: unknown): v is Dimension;
50
+ /** `v` as a frame size, or undefined when it is none. A percentage is
51
+ * clamped to 0 … 100. */
52
+ export declare function normalizeFrameSize(v: unknown): FrameSize | undefined;
53
+ /** The id an anchor names (`'#dinero'` → `'dinero'`), or undefined. */
54
+ export declare function anchorTarget(placement: ElementPlacement | undefined): string | undefined;
55
+ /** The frame a `continueIn` of the form `'#frame'` names. */
56
+ export declare function continueInFrame(continueIn: unknown): string | undefined;
57
+ /** The template a `continueIn` of the form `'template:<id>'` names. */
58
+ export declare function continueInTemplate(continueIn: unknown): string | undefined;
59
+ /** The chain of template indices from `index` up to its root, nearest
60
+ * first; `null` when it loops back on itself. A parent that does not
61
+ * exist ends the chain (the template stands alone). */
62
+ export declare function templateChain(templates: readonly PageTemplate[], index: number, byId?: Map<string, number>): number[] | null;
63
+ /** The index of the template `id` means: the first with that id. */
64
+ export declare function templateIndex(templates: readonly PageTemplate[] | undefined, id: string): number | undefined;
65
+ /** A problem resolution met, with the JSON pointer of the field at fault.
66
+ * `validatePageTemplates` reports them as config warnings. */
67
+ export interface TemplateIssue {
68
+ kind: 'frameDuplicate' | 'frameStyleUnknown' | 'frameAnchorUnknown' | 'groupFrameUnknown' | 'groupFrameTwice' | 'frameChainLoop' | 'overflowTargetUnknown';
69
+ path: string;
70
+ value: string;
71
+ used: string;
72
+ /** For a name that does not exist: the closest that does (filled by the
73
+ * validator). */
74
+ known?: readonly string[];
75
+ }
76
+ /** A frame as the layout reads it: every default filled in, sizes read
77
+ * from `width`/`height` and else `placement.size`, values the engine
78
+ * cannot use replaced by their default. */
79
+ export declare function normalizeFrame(frame: FrameConfig, grid?: Required<PageTemplateGrid>, where?: {
80
+ configPath: string;
81
+ fieldPaths: Record<string, string>;
82
+ }): ResolvedFrame;
83
+ /** What `resolvePageTemplate` reads of a configuration: the raw or the
84
+ * resolved one alike. */
85
+ export interface PageTemplateSource {
86
+ pageTemplates?: readonly PageTemplate[];
87
+ /** The callout style ids frames may name. Unset: not checked. */
88
+ calloutStyles?: readonly {
89
+ id: string;
90
+ }[];
91
+ }
92
+ /**
93
+ * Resolve the template at `index` of `templates` (see
94
+ * {@link resolvePageTemplate}), with the issues met on the way. `prefix`
95
+ * is the JSON pointer of the list (`/pageTemplates`).
96
+ * @internal the validator's; hosts call `resolvePageTemplate`.
97
+ */
98
+ export declare function resolveTemplateAt(templates: readonly PageTemplate[], index: number, options?: ResolvePageTemplateOptions & {
99
+ calloutStyleIds?: ReadonlySet<string>;
100
+ prefix?: string;
101
+ }): {
102
+ template: ResolvedPageTemplate;
103
+ issues: TemplateIssue[];
104
+ } | undefined;
105
+ /**
106
+ * The template `id` of `config.pageTemplates`, ready to lay out: its
107
+ * `extends` chain merged (scalar fields replace, `grid` merges key by key,
108
+ * frames and groups merge by `name` with `remove: true` dropping one,
109
+ * decoration elements merge by `id`), then the variant of the page's side
110
+ * (`options.parity`; none on a spread), then every default filled in and
111
+ * every reference settled (see `validatePageTemplates` for what is fixed
112
+ * and reported). Undefined when no template has that id, or its chain
113
+ * loops. The first template with an id is the one it means.
114
+ *
115
+ * Memoised per `pageTemplates` array (the resolved configuration holds a
116
+ * copy of its own): treat the result as read-only, and give a changed list
117
+ * as a new array.
118
+ */
119
+ export declare function resolvePageTemplate(config: PageTemplateSource | undefined, id: string, options?: ResolvePageTemplateOptions): ResolvedPageTemplate | undefined;
120
+ /** The label styles with their defaults filled in. */
121
+ export declare function resolveLabelStyles(styles: readonly LabelStyle[] | undefined): ResolvedLabelStyle[];
122
+ /**
123
+ * The page templates as stored. Every field is kept as written, a value
124
+ * equal to its default included: in a template that `extends` another, or
125
+ * in a variant, it overrides the parent's, so it is never a restated
126
+ * default. Keys set to `undefined` are left out, and an empty list is no
127
+ * list.
128
+ */
129
+ export declare function stripPageTemplatesDefaults(templates: readonly PageTemplate[] | undefined): PageTemplate[] | undefined;
130
+ /** The label styles without the values that restate a default (and `name`
131
+ * equal to `id`); an empty list is no list. */
132
+ export declare function stripLabelStylesDefaults(styles: readonly LabelStyle[] | undefined): LabelStyle[] | undefined;
133
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/composed/templates.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAA6B,SAAS,E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