postext 1.49.0 → 1.50.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/__tests__/composed/emptyTabFrame.test.d.ts +2 -0
- package/dist/__tests__/composed/emptyTabFrame.test.d.ts.map +1 -0
- package/dist/__tests__/composed/emptyTabFrame.test.js +122 -0
- package/dist/__tests__/composed/emptyTabFrame.test.js.map +1 -0
- package/dist/__tests__/composed/fenceCondition.test.d.ts +2 -0
- package/dist/__tests__/composed/fenceCondition.test.d.ts.map +1 -0
- package/dist/__tests__/composed/fenceCondition.test.js +171 -0
- package/dist/__tests__/composed/fenceCondition.test.js.map +1 -0
- package/dist/__tests__/composed/fixtures/moduleRows.d.ts +40 -0
- package/dist/__tests__/composed/fixtures/moduleRows.d.ts.map +1 -0
- package/dist/__tests__/composed/fixtures/moduleRows.js +65 -0
- package/dist/__tests__/composed/fixtures/moduleRows.js.map +1 -0
- package/dist/__tests__/composed/frameLooks.test.d.ts +2 -0
- package/dist/__tests__/composed/frameLooks.test.d.ts.map +1 -0
- package/dist/__tests__/composed/frameLooks.test.js +151 -0
- package/dist/__tests__/composed/frameLooks.test.js.map +1 -0
- package/dist/__tests__/composed/moduleRows.test.d.ts +2 -0
- package/dist/__tests__/composed/moduleRows.test.d.ts.map +1 -0
- package/dist/__tests__/composed/moduleRows.test.js +233 -0
- package/dist/__tests__/composed/moduleRows.test.js.map +1 -0
- package/dist/__tests__/composed/modules.test.js +3 -2
- package/dist/__tests__/composed/modules.test.js.map +1 -1
- package/dist/__tests__/composed/pillWord.test.d.ts +2 -0
- package/dist/__tests__/composed/pillWord.test.d.ts.map +1 -0
- package/dist/__tests__/composed/pillWord.test.js +128 -0
- package/dist/__tests__/composed/pillWord.test.js.map +1 -0
- package/dist/__tests__/exports.test.js +8 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/composed/modules.d.ts.map +1 -1
- package/dist/composed/modules.js +9 -2
- package/dist/composed/modules.js.map +1 -1
- package/dist/composed/reflowLog.js +1 -1
- package/dist/composed/reflowLog.js.map +1 -1
- package/dist/composed/slotChecks.d.ts +10 -0
- package/dist/composed/slotChecks.d.ts.map +1 -1
- package/dist/composed/slotChecks.js +39 -0
- package/dist/composed/slotChecks.js.map +1 -1
- package/dist/composed/templates.d.ts +14 -1
- package/dist/composed/templates.d.ts.map +1 -1
- package/dist/composed/templates.js +73 -5
- package/dist/composed/templates.js.map +1 -1
- package/dist/composed/types.d.ts +55 -4
- package/dist/composed/types.d.ts.map +1 -1
- package/dist/composed/validate.d.ts.map +1 -1
- package/dist/composed/validate.js +63 -6
- package/dist/composed/validate.js.map +1 -1
- package/dist/composed/wrap.d.ts.map +1 -1
- package/dist/composed/wrap.js +22 -5
- package/dist/composed/wrap.js.map +1 -1
- package/dist/configWarnings.d.ts +3 -1
- package/dist/configWarnings.d.ts.map +1 -1
- package/dist/configWarnings.js +32 -3
- package/dist/configWarnings.js.map +1 -1
- package/dist/defaults/headerFooter.d.ts +10 -0
- package/dist/defaults/headerFooter.d.ts.map +1 -1
- package/dist/defaults/headerFooter.js +21 -1
- package/dist/defaults/headerFooter.js.map +1 -1
- package/dist/design/fenceCondition.d.ts +45 -0
- package/dist/design/fenceCondition.d.ts.map +1 -0
- package/dist/design/fenceCondition.js +66 -0
- package/dist/design/fenceCondition.js.map +1 -0
- package/dist/design/layout.d.ts.map +1 -1
- package/dist/design/layout.js +33 -1
- package/dist/design/layout.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/pipeline/composedLayout.d.ts +5 -1
- package/dist/pipeline/composedLayout.d.ts.map +1 -1
- package/dist/pipeline/composedLayout.js +309 -84
- package/dist/pipeline/composedLayout.js.map +1 -1
- package/dist/pipeline/config.d.ts.map +1 -1
- package/dist/pipeline/config.js +8 -1
- package/dist/pipeline/config.js.map +1 -1
- package/dist/pipeline/contentWarnings.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings.js +8 -1
- package/dist/pipeline/contentWarnings.js.map +1 -1
- package/dist/types.d.ts +68 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/vdt.d.ts +21 -2
- package/dist/vdt.d.ts.map +1 -1
- package/dist/vdt.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { PostextConfig } from '../types';
|
|
2
|
+
import type { DesignContextKind } from './placeholders';
|
|
3
|
+
import { type ConfigDesignSlotKind } from './slots';
|
|
4
|
+
/**
|
|
5
|
+
* Decoration drawn when the page fence says so (#1087). A design element of
|
|
6
|
+
* a running head or of a page template's decoration may carry `when: 'x'`
|
|
7
|
+
* (drawn only on a composed page whose `::::page{…}` fence sets `x`) or
|
|
8
|
+
* `unless: 'x'` (not drawn there). One shell then serves the front matter,
|
|
9
|
+
* which prints no folio, and the body, which does: the Markdown says what a
|
|
10
|
+
* page is, the config keeps the drawing.
|
|
11
|
+
*/
|
|
12
|
+
/** Where a design slot reads the condition: running heads and a composed
|
|
13
|
+
* page's decoration. A heading's, a part's or a box's design ignores it. */
|
|
14
|
+
export declare const FENCE_CONDITION_CONTEXTS: ReadonlySet<DesignContextKind>;
|
|
15
|
+
/** The configuration slots whose elements read the condition (see
|
|
16
|
+
* {@link FENCE_CONDITION_CONTEXTS}). */
|
|
17
|
+
export declare const FENCE_CONDITION_SLOTS: ReadonlySet<ConfigDesignSlotKind>;
|
|
18
|
+
/** Whether a fence's attributes set `key`: written as a flag
|
|
19
|
+
* (`{frontmatter}`) or with any value but `false`. */
|
|
20
|
+
export declare function fenceSetsAttribute(attrs: Readonly<Record<string, string>> | undefined, key: string): boolean;
|
|
21
|
+
/** Whether an element with `when` / `unless` is drawn on a page whose fence
|
|
22
|
+
* has `attrs` (none: a page that is not composed). An element with
|
|
23
|
+
* neither is always drawn. */
|
|
24
|
+
export declare function fenceConditionMet(el: {
|
|
25
|
+
when?: string;
|
|
26
|
+
unless?: string;
|
|
27
|
+
}, attrs: Readonly<Record<string, string>> | undefined): boolean;
|
|
28
|
+
/** A condition written in the configuration. */
|
|
29
|
+
export interface FenceConditionUse {
|
|
30
|
+
/** The element's key: `pageTemplates[0].decoration.elements[2].when`. */
|
|
31
|
+
path: string;
|
|
32
|
+
condition: 'when' | 'unless';
|
|
33
|
+
attribute: string;
|
|
34
|
+
}
|
|
35
|
+
/** Every `when` / `unless` the configuration writes on an element of a slot
|
|
36
|
+
* that reads it, in `configDesignSlots` order. Pure. */
|
|
37
|
+
export declare function fenceConditionUses(config: PostextConfig | undefined): FenceConditionUse[];
|
|
38
|
+
/** The conditions on an attribute no page of the book sets
|
|
39
|
+
* (`conditionNeverMet`, an information note of `postext check`): a `when`
|
|
40
|
+
* element never drawn, an `unless` one always drawn. `attributes` are the
|
|
41
|
+
* attributes the book's page fences set (see {@link fenceSetsAttribute}). */
|
|
42
|
+
export declare function fenceConditionsNeverMet(config: PostextConfig | undefined, attributes: Iterable<string>): FenceConditionUse[];
|
|
43
|
+
/** The attributes a fence sets, for {@link fenceConditionsNeverMet}. */
|
|
44
|
+
export declare function fenceAttributesSet(attrs: Readonly<Record<string, string>> | undefined): string[];
|
|
45
|
+
//# sourceMappingURL=fenceCondition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fenceCondition.d.ts","sourceRoot":"","sources":["../../src/design/fenceCondition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAqB,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEvE;;;;;;;GAOG;AAEH;6EAC6E;AAC7E,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,iBAAiB,CAA6C,CAAC;AAElH;yCACyC;AACzC,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,oBAAoB,CAA+C,CAAC;AAEpH;uDACuD;AACvD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAI5G;AAED;;+BAE+B;AAC/B,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EACtC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,GAClD,OAAO,CAIT;AAED,gDAAgD;AAChD,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;yDACyD;AACzD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,GAAG,iBAAiB,EAAE,CAczF;AAED;;;8EAG8E;AAC9E,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,iBAAiB,EAAE,CAG5H;AAED,wEAAwE;AACxE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,CAEhG"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { configDesignSlots } from './slots';
|
|
2
|
+
/**
|
|
3
|
+
* Decoration drawn when the page fence says so (#1087). A design element of
|
|
4
|
+
* a running head or of a page template's decoration may carry `when: 'x'`
|
|
5
|
+
* (drawn only on a composed page whose `::::page{…}` fence sets `x`) or
|
|
6
|
+
* `unless: 'x'` (not drawn there). One shell then serves the front matter,
|
|
7
|
+
* which prints no folio, and the body, which does: the Markdown says what a
|
|
8
|
+
* page is, the config keeps the drawing.
|
|
9
|
+
*/
|
|
10
|
+
/** Where a design slot reads the condition: running heads and a composed
|
|
11
|
+
* page's decoration. A heading's, a part's or a box's design ignores it. */
|
|
12
|
+
export const FENCE_CONDITION_CONTEXTS = new Set(['header', 'footer', 'composed']);
|
|
13
|
+
/** The configuration slots whose elements read the condition (see
|
|
14
|
+
* {@link FENCE_CONDITION_CONTEXTS}). */
|
|
15
|
+
export const FENCE_CONDITION_SLOTS = new Set(['header', 'footer', 'decoration']);
|
|
16
|
+
/** Whether a fence's attributes set `key`: written as a flag
|
|
17
|
+
* (`{frontmatter}`) or with any value but `false`. */
|
|
18
|
+
export function fenceSetsAttribute(attrs, key) {
|
|
19
|
+
if (!attrs || !Object.prototype.hasOwnProperty.call(attrs, key))
|
|
20
|
+
return false;
|
|
21
|
+
const value = attrs[key];
|
|
22
|
+
return typeof value === 'string' && value.trim().toLowerCase() !== 'false';
|
|
23
|
+
}
|
|
24
|
+
/** Whether an element with `when` / `unless` is drawn on a page whose fence
|
|
25
|
+
* has `attrs` (none: a page that is not composed). An element with
|
|
26
|
+
* neither is always drawn. */
|
|
27
|
+
export function fenceConditionMet(el, attrs) {
|
|
28
|
+
if (el.when !== undefined && !fenceSetsAttribute(attrs, el.when))
|
|
29
|
+
return false;
|
|
30
|
+
if (el.unless !== undefined && fenceSetsAttribute(attrs, el.unless))
|
|
31
|
+
return false;
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
/** Every `when` / `unless` the configuration writes on an element of a slot
|
|
35
|
+
* that reads it, in `configDesignSlots` order. Pure. */
|
|
36
|
+
export function fenceConditionUses(config) {
|
|
37
|
+
const out = [];
|
|
38
|
+
for (const slot of configDesignSlots(config)) {
|
|
39
|
+
if (!FENCE_CONDITION_SLOTS.has(slot.kind))
|
|
40
|
+
continue;
|
|
41
|
+
slot.slot.elements.forEach((el, i) => {
|
|
42
|
+
const e = el;
|
|
43
|
+
if (!e || typeof e !== 'object')
|
|
44
|
+
return;
|
|
45
|
+
for (const condition of ['when', 'unless']) {
|
|
46
|
+
const v = e[condition];
|
|
47
|
+
if (typeof v === 'string' && v.trim() !== '')
|
|
48
|
+
out.push({ path: `${slot.path}.elements[${i}].${condition}`, condition, attribute: v.trim() });
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/** The conditions on an attribute no page of the book sets
|
|
55
|
+
* (`conditionNeverMet`, an information note of `postext check`): a `when`
|
|
56
|
+
* element never drawn, an `unless` one always drawn. `attributes` are the
|
|
57
|
+
* attributes the book's page fences set (see {@link fenceSetsAttribute}). */
|
|
58
|
+
export function fenceConditionsNeverMet(config, attributes) {
|
|
59
|
+
const set = new Set(attributes);
|
|
60
|
+
return fenceConditionUses(config).filter((u) => !set.has(u.attribute));
|
|
61
|
+
}
|
|
62
|
+
/** The attributes a fence sets, for {@link fenceConditionsNeverMet}. */
|
|
63
|
+
export function fenceAttributesSet(attrs) {
|
|
64
|
+
return Object.keys(attrs ?? {}).filter((k) => fenceSetsAttribute(attrs, k));
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=fenceCondition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fenceCondition.js","sourceRoot":"","sources":["../../src/design/fenceCondition.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAA6B,MAAM,SAAS,CAAC;AAEvE;;;;;;;GAOG;AAEH;6EAC6E;AAC7E,MAAM,CAAC,MAAM,wBAAwB,GAAmC,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAElH;yCACyC;AACzC,MAAM,CAAC,MAAM,qBAAqB,GAAsC,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;AAEpH;uDACuD;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BAAyB,EAC7B,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,GAAG,EAAE,MAAM,EACX,KAAK,GAAE;IAAE,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAO,GACrF,qBAAqB,CAQvB"}
|
package/dist/design/layout.js
CHANGED
|
@@ -18,6 +18,7 @@ import { BREAKING_SPACE_RUNS_SPLIT_RE, NO_BREAK_SPACES, isBreakingSpaceRun } fro
|
|
|
18
18
|
import { LEADER_MARK, resolveDesignResourceId, resolveDesignText, } from './placeholders';
|
|
19
19
|
import { fitLeader } from '../measure/leader';
|
|
20
20
|
import { layoutConnector } from './connector';
|
|
21
|
+
import { FENCE_CONDITION_CONTEXTS, fenceConditionMet } from './fenceCondition';
|
|
21
22
|
import { repeatInstance } from '../composed/templates';
|
|
22
23
|
import { hasJoiningScript, joinsWithNext } from '../bidi';
|
|
23
24
|
import { designBaseDirection, directRuns, directedTextWidth, measuresRunsAsPainted, paintedRunWidth } from './bidiText';
|
|
@@ -901,6 +902,37 @@ function layoutConnectorElement(el, resolvedGeo, frames, issues, dpi, startRight
|
|
|
901
902
|
}
|
|
902
903
|
return layoutConnector(el, from, ends, { dpi, startRight });
|
|
903
904
|
}
|
|
905
|
+
/** The elements a page's fence lets draw (#1087): a running head's or a
|
|
906
|
+
* composed page's decoration leaves out an element whose `when` the fence
|
|
907
|
+
* does not set or whose `unless` it does, and with it every element placed
|
|
908
|
+
* on it or sized to it (as a frame that takes no room drops what hangs
|
|
909
|
+
* from it). Other slots (heading, part and box designs) ignore the
|
|
910
|
+
* condition. The same array when nothing is left out. */
|
|
911
|
+
function drawnOnFence(elements, placeholders) {
|
|
912
|
+
if (!FENCE_CONDITION_CONTEXTS.has(placeholders.kind))
|
|
913
|
+
return elements;
|
|
914
|
+
if (!elements.some((el) => el.when !== undefined || el.unless !== undefined))
|
|
915
|
+
return elements;
|
|
916
|
+
const dropped = new Set();
|
|
917
|
+
for (const el of elements)
|
|
918
|
+
if (!fenceConditionMet(el, placeholders.pageAttrs))
|
|
919
|
+
dropped.add(el.id);
|
|
920
|
+
if (dropped.size === 0)
|
|
921
|
+
return elements;
|
|
922
|
+
for (let changed = true; changed;) {
|
|
923
|
+
changed = false;
|
|
924
|
+
for (const el of elements) {
|
|
925
|
+
if (dropped.has(el.id) || el.kind === 'connector')
|
|
926
|
+
continue;
|
|
927
|
+
const target = anchorTargetId(el.placement);
|
|
928
|
+
if ((target !== undefined && dropped.has(target)) || sizeTargetIds(el.placement).some((id) => dropped.has(id))) {
|
|
929
|
+
dropped.add(el.id);
|
|
930
|
+
changed = true;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
return elements.filter((el) => !dropped.has(el.id));
|
|
935
|
+
}
|
|
904
936
|
/** Layout one design slot against its container. */
|
|
905
937
|
export function layoutDesignSlot(slot, context, pageIndex) {
|
|
906
938
|
const issues = [];
|
|
@@ -913,7 +945,7 @@ export function layoutDesignSlot(slot, context, pageIndex) {
|
|
|
913
945
|
// Filter by parity and page role first; then let the current part's
|
|
914
946
|
// palette overrides recolour the palette-linked colours.
|
|
915
947
|
const overrides = context.placeholders.partPaletteByPageIndex?.[context.placeholders.page.index];
|
|
916
|
-
const candidates = slot.elements
|
|
948
|
+
const candidates = drawnOnFence(slot.elements, context.placeholders)
|
|
917
949
|
.filter((el) => pageMatchesParity(pageIndex, el.parity) && pageMatchesRole(el.pages, context.pageRole))
|
|
918
950
|
.map((el) => (overrides && Object.keys(overrides).length > 0 ? applyPaletteOverrides(el, overrides) : el))
|
|
919
951
|
// Start and end edges read as the physical ones of this page (#936).
|