@beltype/cicero 0.1.12 → 0.1.13
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/src/driver.d.ts
CHANGED
|
@@ -111,6 +111,15 @@ export declare function pageApplies(st: CSSStyleDeclaration, parent: CSSStyleDec
|
|
|
111
111
|
* The used page name of the box at `el` (css-page-3 §8.1): `effectivePageName` where the property applies to it, else its parent's. A box it does not apply to takes no name of its own; an inline box standing among blocks is in an anonymous block box, which the property applies to, named as its parent is.
|
|
112
112
|
*/
|
|
113
113
|
export declare function usedPageName(el: Element, styleOf: (el: Element) => CSSStyleDeclaration): string;
|
|
114
|
+
/**
|
|
115
|
+
* The depth in the counter log's terms of the place a cut names: the element its path reaches, below the ancestors, or one level further in where the cut falls inside it, among its children (a `word` or a `px`). What `counterStateAt` takes as its `depth`.
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* A place inside an element is taken at its children's depth, so an instance a grandchild opened before the cut is ended there even where the cut falls inside the child that holds it: a counter reset on an inline element nested in another inside a paragraph a page divides. No case claims it. Exported for a host that reads the same log over its own addresses (*the engine knows no view*).
|
|
119
|
+
*
|
|
120
|
+
* @param ancestors - How many elements the log records above the top-level blocks (`documentOpsOf`'s `ancestors`), two for the driver: `html` and `body`.
|
|
121
|
+
*/
|
|
122
|
+
export declare const depthOfCut: (cut: Pick<Address, 'path' | 'word' | 'px'>, ancestors: number) => number;
|
|
114
123
|
/**
|
|
115
124
|
* The start page value of a box (css-page-3 §8.1): *"the value (if any) propagated from its first … child box, else the used value on the box itself"*, where *"a child propagates its own start … page value if and only if the page property applies to it"*. So down the first in-flow child while it is a box the property applies to ({@link pageApplies}) and no run of words stands before it, then {@link usedPageName} from the box found. The driver's `nameAt` names a page by it, and the forcing index compares it against the end page value before it.
|
|
116
125
|
*
|
package/dist/src/driver.js
CHANGED
|
@@ -121,6 +121,15 @@ export function usedPageName(el, styleOf) {
|
|
|
121
121
|
const parent = el.parentElement;
|
|
122
122
|
return !parent || pageApplies(styleOf(el), styleOf(parent)) ? effectivePageName(el) : effectivePageName(parent);
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* The depth in the counter log's terms of the place a cut names: the element its path reaches, below the ancestors, or one level further in where the cut falls inside it, among its children (a `word` or a `px`). What `counterStateAt` takes as its `depth`.
|
|
126
|
+
*
|
|
127
|
+
* @remarks
|
|
128
|
+
* A place inside an element is taken at its children's depth, so an instance a grandchild opened before the cut is ended there even where the cut falls inside the child that holds it: a counter reset on an inline element nested in another inside a paragraph a page divides. No case claims it. Exported for a host that reads the same log over its own addresses (*the engine knows no view*).
|
|
129
|
+
*
|
|
130
|
+
* @param ancestors - How many elements the log records above the top-level blocks (`documentOpsOf`'s `ancestors`), two for the driver: `html` and `body`.
|
|
131
|
+
*/
|
|
132
|
+
export const depthOfCut = (cut, ancestors) => ancestors + cut.path.length - 1 + (cut.word != null || cut.px != null ? 1 : 0);
|
|
124
133
|
/**
|
|
125
134
|
* The start page value of a box (css-page-3 §8.1): *"the value (if any) propagated from its first … child box, else the used value on the box itself"*, where *"a child propagates its own start … page value if and only if the page property applies to it"*. So down the first in-flow child while it is a box the property applies to ({@link pageApplies}) and no run of words stands before it, then {@link usedPageName} from the box found. The driver's `nameAt` names a page by it, and the forcing index compares it against the end page value before it.
|
|
126
135
|
*
|
|
@@ -873,13 +882,6 @@ async function paginateOnce(doc, { composed = false, compositionCache = new Comp
|
|
|
873
882
|
pageCounters.set(key, ops = table.pageFor({ name: c.name, first: i === 0, parity: c.parity, blank: c.blank }).pageCounter);
|
|
874
883
|
return ops;
|
|
875
884
|
};
|
|
876
|
-
/**
|
|
877
|
-
* The depth in the counter log's terms of the place a cut names: the element its path reaches, below the ancestors, or one level further in where the cut falls inside it, among its children (a `word` or a `px`).
|
|
878
|
-
*
|
|
879
|
-
* @remarks
|
|
880
|
-
* A place inside an element is taken at its children's depth, so an instance a grandchild opened before the cut is ended there even where the cut falls inside the child that holds it: a counter reset on an inline element nested in another inside a paragraph a page divides. No case claims it.
|
|
881
|
-
*/
|
|
882
|
-
const depthOfCut = (cut) => ancestors.length + cut.path.length - 1 + (cut.word != null || cut.px != null ? 1 : 0);
|
|
883
885
|
/** The conditions of page `pageIndex`, which begins at `cut` (projected to `pos`) — {@link conditionsFor} with the cursor made a parameter, so a resumed run can write the conditions of a page it keeps from the address that page began at (*the run resumes from an entry*, build two, 2026-10-08). */
|
|
884
886
|
const conditionsAt = (pageIndex, cut, pos, { blank = false, carried = null } = {}) => {
|
|
885
887
|
const name = nameAt(cut);
|
|
@@ -889,7 +891,7 @@ async function paginateOnce(doc, { composed = false, compositionCache = new Comp
|
|
|
889
891
|
// The run's count, an author's reset of the page counter counted on from the page it begins on, and each page's own `@page` counter rules (`document-state.js`'s `pageNumberAt`). Entry `i` closes page `i`, so page `i` begins where entry `i - 1` ended, under the conditions it closes.
|
|
890
892
|
const pageNumber = pageNumberAt(documentOps, pageIndex, pos, { pages: (i) => ({ start: i === 0 ? 0 : account[i - 1].pos ?? 0, blank: account[i].blank === true, counter: pageCounterOf(i, account[i].closes) }), blank, counter: geo.pageCounter, away });
|
|
891
893
|
// The document's counters as they stand at this page's first word — strictly before it, which is §6.1's *spans the page break* in the flat position space (`document-state.js`) — less what the flows carried onto this page have still to show, which stands before that word and is on this page or after it (beltype#43). The page's own two are not among them: they are the host's, and `pageNumber` carries the reset.
|
|
892
|
-
const counters = withoutPageCounters(counterStateAt(documentOps, pos, away, depthOfCut(cut)));
|
|
894
|
+
const counters = withoutPageCounters(counterStateAt(documentOps, pos, away, depthOfCut(cut, ancestors.length)));
|
|
893
895
|
return Object.freeze({ ...geo, name, pageNumber, parity, blank, counters, dpr: win.devicePixelRatio });
|
|
894
896
|
};
|
|
895
897
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The fragmentation face: the engine's members a view adapter builds on, `@beltype/cicero/fragmentation`.
|
|
3
3
|
*
|
|
4
4
|
* @remarks
|
|
5
|
-
* Exactly the names the first view adapter imported by deep path on 2026-10-29 (68 of them, from 16 modules), re-exported unchanged, and the names a view has asked for since (the leading-decoration door, `WRAPPED`, `clonesDecoration` and `truncateLeadingDecoration`, 2026-11-07); nothing is un-exported. Which of them stay public, merge or leave is the shape round's question. The face loads in node: `chase.ts`, which defines the `<beltype-page>` element and so needs a DOM at load, is not here; a view imports it for that effect as `@beltype/cicero/page`.
|
|
5
|
+
* Exactly the names the first view adapter imported by deep path on 2026-10-29 (68 of them, from 16 modules), re-exported unchanged, and the names a view has asked for since (the leading-decoration door, `WRAPPED`, `clonesDecoration` and `truncateLeadingDecoration`, 2026-11-07; `usedPageName` and `depthOfCut`, by which the run names a page it resumes inside a box and closes its counters, 2026-11-13); nothing is un-exported. Which of them stay public, merge or leave is the shape round's question. The face loads in node: `chase.ts`, which defines the `<beltype-page>` element and so needs a DOM at load, is not here; a view imports it for that effect as `@beltype/cicero/page`.
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
@@ -10,7 +10,7 @@ export { effectivePageName, readGeometryTable, registerGcpmProperties, sheetReac
|
|
|
10
10
|
export { ADJOIN, ARTIFACT, AWAY, END, FRAGMENT, SHELL, SPLIT, START, WRAPPED, addWord, hasWord, removeWord } from './data-beltype.ts';
|
|
11
11
|
export { counterStateAt, documentOpsOf, namedStringsForPage, runningAssignmentsOf, stringAssignmentsOf } from './document-state.ts';
|
|
12
12
|
export { ensureContinuationDressing, ensureDressing } from './dressing.ts';
|
|
13
|
-
export { forcingIndexOf, gapAbove, pageNameDownFrom, runningBoxes, runningPosition, topLevelBlocks } from './driver.ts';
|
|
13
|
+
export { depthOfCut, forcingIndexOf, gapAbove, pageNameDownFrom, runningBoxes, runningPosition, topLevelBlocks, usedPageName } from './driver.ts';
|
|
14
14
|
export { ForcingMemo } from './forcing-memo.ts';
|
|
15
15
|
export type { Keep } from './forcing-memo.ts';
|
|
16
16
|
export { joinedWords, mutateToContinuation, mutateToFirstFragment, pinTrack, truncateLeadingDecoration } from './fragments.ts';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The fragmentation face: the engine's members a view adapter builds on, `@beltype/cicero/fragmentation`.
|
|
3
3
|
*
|
|
4
4
|
* @remarks
|
|
5
|
-
* Exactly the names the first view adapter imported by deep path on 2026-10-29 (68 of them, from 16 modules), re-exported unchanged, and the names a view has asked for since (the leading-decoration door, `WRAPPED`, `clonesDecoration` and `truncateLeadingDecoration`, 2026-11-07); nothing is un-exported. Which of them stay public, merge or leave is the shape round's question. The face loads in node: `chase.ts`, which defines the `<beltype-page>` element and so needs a DOM at load, is not here; a view imports it for that effect as `@beltype/cicero/page`.
|
|
5
|
+
* Exactly the names the first view adapter imported by deep path on 2026-10-29 (68 of them, from 16 modules), re-exported unchanged, and the names a view has asked for since (the leading-decoration door, `WRAPPED`, `clonesDecoration` and `truncateLeadingDecoration`, 2026-11-07; `usedPageName` and `depthOfCut`, by which the run names a page it resumes inside a box and closes its counters, 2026-11-13); nothing is un-exported. Which of them stay public, merge or leave is the shape round's question. The face loads in node: `chase.ts`, which defines the `<beltype-page>` element and so needs a DOM at load, is not here; a view imports it for that effect as `@beltype/cicero/page`.
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
@@ -10,7 +10,7 @@ export { effectivePageName, readGeometryTable, registerGcpmProperties, sheetReac
|
|
|
10
10
|
export { ADJOIN, ARTIFACT, AWAY, END, FRAGMENT, SHELL, SPLIT, START, WRAPPED, addWord, hasWord, removeWord } from './data-beltype.js';
|
|
11
11
|
export { counterStateAt, documentOpsOf, namedStringsForPage, runningAssignmentsOf, stringAssignmentsOf } from './document-state.js';
|
|
12
12
|
export { ensureContinuationDressing, ensureDressing } from './dressing.js';
|
|
13
|
-
export { forcingIndexOf, gapAbove, pageNameDownFrom, runningBoxes, runningPosition, topLevelBlocks } from './driver.js';
|
|
13
|
+
export { depthOfCut, forcingIndexOf, gapAbove, pageNameDownFrom, runningBoxes, runningPosition, topLevelBlocks, usedPageName } from './driver.js';
|
|
14
14
|
export { ForcingMemo } from './forcing-memo.js';
|
|
15
15
|
export { joinedWords, mutateToContinuation, mutateToFirstFragment, pinTrack, truncateLeadingDecoration } from './fragments.js';
|
|
16
16
|
export { takeReport } from './gauge.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beltype/cicero",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "Cicero, a paged-media engine for the live browser: it cuts a document into pages under CSS Paged Media and presents them as real frames. Beta.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|