@datalking/begonia-table 0.0.0-stage → 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.
@@ -0,0 +1 @@
1
+ function s(n){return n&&typeof n=="object"?n:null}function e(n){if(n==null||typeof n=="string"&&n.trim()==="")return null;let t=Number(n);return Number.isFinite(t)?t:null}function f(n){let t=String(n??"").trim().toLowerCase();return t==="left"||t==="center"||t==="right"?t:null}function u(n){let t=String(n??"").trim().toLowerCase();return t==="top"||t==="center"||t==="bottom"?t:null}function m(n){let t=s(n.position?.marginOffset);return e(t?.horizontal)??e(n.offsetX)??0}function h(n){let t=s(n.position?.marginOffset);return e(t?.top)??e(n.offsetY)??0}function g(n){let t=Math.max(0,e(n.containerWidth)??0),l=Math.max(0,e(n.objectWidth)??0),r=s(n.position),o=f(n.alignment)??f(r?.alignH)??"left",i=m(n);return o==="center"?(t-l)/2+i:o==="right"?t-l-i:i}function b(n){let t=Math.max(0,e(n.objectHeight)??0),l=s(n.position),r=h(n),o=String(l?.vRelativeFrom??"").trim().toLowerCase(),i=o===""?"top":u(n.alignment)??u(l?.alignV)??"top",c=o==="paragraph"||o===""?Math.max(0,e(n.paragraphTop)??0):0,a=o==="paragraph"?Math.max(0,e(n.firstLineHeight)??0):o===""?null:e(n.containerHeight)??null;return a==null?c+r:i==="center"?c+(a-t)/2+r:i==="bottom"?c+a-t+r:c+r}export{g as a,b};
@@ -0,0 +1 @@
1
+ function w(e,n,i){return e.toOffset>n&&e.fromOffset<i}function O(e,n,i,m){let a=Math.max(n,e.fromOffset),l=Math.min(i,e.toOffset);if(l<=a)return null;let t=a-e.fromOffset,s=l-e.fromOffset,g=e.text.slice(t,s),B=m(e.segment.inlineSpans,t,s),y=e.lineSlices??[],p=y.flatMap((r,o)=>r.toOffset>t&&r.fromOffset<s?[o]:[]),c=p.map((r,o,u)=>{let f=y[r],h=Math.max(t,f.fromOffset),C=Math.min(s,f.toOffset);return{...f,lineIndex:o,lineCount:u.length,text:e.text.slice(h,C),fromOffset:h-t,toOffset:C-t}}),S=e.lineFrames??[],x=p.map((r,o,u)=>({...S[r]??{leftInset:0,rightInset:0,availableWidth:e.containerWidth??1},lineIndex:o,lineCount:u.length})),T=t===0?e.segment.spacingBefore:0,b=s===e.text.length?e.segment.spacingAfter:0,d=r=>{let o=Number(r??0);return Number.isFinite(o)?Math.max(0,o):0},R=c.length>0?c.length*Math.max(1,Number(e.segment.lineHeight??1)):Math.max(0,e.flowHeight-d(e.segment.spacingBefore)-d(e.segment.spacingAfter));return{...e,fromOffset:a-n,toOffset:l-n,text:g,flowHeight:R+d(T)+d(b),lineSlices:c.length>0?c:null,lineFrames:x.length>0?x:null,segment:{...e.segment,text:g,spacingBefore:T,spacingAfter:b,inlineSpans:B??null}}}function P(e,n,i,m){if(!e||i<=n)return null;let a=[];for(let l of e)if(w(l,n,i)){if(l.kind==="text"){let t=O(l,n,i,m);t&&a.push(t);continue}a.push({...l,fromOffset:l.fromOffset-n,toOffset:l.toOffset-n})}return a.length>0?a:null}export{P as a};
File without changes
@@ -0,0 +1 @@
1
+ function e(l){return l?.table??null}export{e as a};
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The table contract surface: the leaf primitives, the table metrics reader and
3
+ * the table types every table planner consumes.
4
+ *
5
+ * The cell and planner modules are re-exported as types only, so this entry
6
+ * never pulls runtime placement code: a consumer that only types a snapshot or
7
+ * reads table metrics imports this subpath and never loads `table-layout`.
8
+ * Callers that need the placement planners import the module subpaths.
9
+ */
10
+ export * from './table-primitives.ts';
11
+ export * from './table-block-metrics.ts';
12
+ export type { TableCellAnchorHorizontalAlignment, TableCellAnchorVerticalAlignment, } from './table-cell-anchor-position.ts';
13
+ export type { TableCellBlockPlacement, TableCellDrawingBlockPlacement, TableCellImageBlockPlacement, TableCellInlineSpanSlicer, TableCellMediaBlockPlacement, TableCellTextBlockPlacement, } from './table-cell-blocks.ts';
14
+ export type { LayoutTableCellMargins } from './table-cell-margins.ts';
15
+ export type { TableCellMergeKind, TableCellPlacement, } from './table-cell-placement.ts';
16
+ export type { TableCellParagraphTextFlowOptions, TableCellTextSegment, } from './table-cell-text-segment.ts';
17
+ export type { TableCellVerticalAlign } from './table-cell-vertical-align.ts';
18
+ export type { RenderableTableCellPlacement, RenderableTableRowPlacement, ResolvedTableCellPlacement, ResolvedTableRowPlacement, TableFragmentLike, } from './table-layout.ts';
19
+ export type { LayoutTableRowMeasureMemo } from './table-row-measure-memo.ts';
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-VRAHV7NM.js";export{e as resolveLayoutTableBlockMetrics};
@@ -0,0 +1,11 @@
1
+ export * from './table-primitives.ts';
2
+ export * from './table-cell-text-segment.ts';
3
+ export * from './table-layout.ts';
4
+ export * from './table-block-metrics.ts';
5
+ export * from './table-cell-blocks.ts';
6
+ export * from './table-cell-margins.ts';
7
+ export * from './table-cell-vertical-align.ts';
8
+ export * from './table-cell-placement.ts';
9
+ export * from './table-column-box.ts';
10
+ export * from './table-cell-anchor-position.ts';
11
+ export * from './table-row-measure-memo.ts';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{a as l,b,c as h,d as M,e as c,f as d,g as s,h as g,i as w,j as N}from"./chunk-AYAWI6IR.js";import{a as u}from"./chunk-VRAHV7NM.js";import{a as B,b as C}from"./chunk-DODR4QN4.js";import{a as k}from"./chunk-N2TXWMCR.js";import"./chunk-RVGFFYBA.js";import"./chunk-36EAGHXY.js";import"./chunk-2OAH5RMT.js";import{a as v,b as y}from"./chunk-4VNOCJ4Y.js";function F(e,t,x,a,i){let o=Math.max(0,Math.min(t,e.length)),p=Math.max(o,Math.min(o+Math.max(1,x),e.length)),m=0;for(let r=0;r<o;r+=1)m+=f(e[r]);let n=0;for(let r=o;r<p;r+=1)n+=f(e[r]);return i?{left:Math.max(0,a-m-n),width:n}:{left:m,width:n}}function f(e){let t=Number(e);return Number.isFinite(t)&&t>0?t:0}export{b as TABLE_CELL_HORIZONTAL_PADDING,l as TABLE_CELL_TEXT_SEPARATOR,h as TABLE_CELL_VERTICAL_PADDING,M as normalizeMergeKind,v as normalizeTableCellVerticalAlign,u as resolveLayoutTableBlockMetrics,g as resolveRenderableTableRows,B as resolveTableCellAnchorOffsetX,C as resolveTableCellAnchorOffsetY,N as resolveTableCellColumnWidth,y as resolveTableCellVerticalOffset,F as resolveTableColumnBox,d as resolveTableFragmentRows,s as resolveTableHeaderStyleRowCount,w as resolveTableLogicalColumnCount,c as resolveTableRowCells,k as sliceTableCellBlocksByOffsets};
@@ -0,0 +1,58 @@
1
+ import type { TableCellPlacement } from './table-cell-placement.ts';
2
+ import type { LayoutTableCellMargins } from './table-cell-margins.ts';
3
+ /**
4
+ * Table-specific measurements a laid out block carries.
5
+ *
6
+ * The fields were historically flattened onto `LayoutBlockEstimate` as
7
+ * `tableRows`, `tableWidth` and so on. Keeping them behind one optional object
8
+ * gives the table contract a single type edge instead of one field per concern;
9
+ * the names inside drop the redundant `table` prefix because the object already
10
+ * says it.
11
+ */
12
+ export interface LayoutTableBlockMetrics {
13
+ /** Row texts, in fragment order. */
14
+ rows?: readonly (readonly string[])[];
15
+ /** Cell placements parallel to `rows`. */
16
+ cells?: readonly (readonly TableCellPlacement[])[];
17
+ /** Authored column widths, in CSS pixels. */
18
+ columnWidths?: readonly number[] | null;
19
+ /** Authored table width, in CSS pixels. */
20
+ width?: number | null;
21
+ /** Measured row heights for the rows in this fragment. */
22
+ rowHeights?: readonly number[] | null;
23
+ /** Source document row index for each fragment row. */
24
+ rowSourceIndexes?: readonly number[] | null;
25
+ /** `w:cantSplit`: a row that may not be broken across pages. */
26
+ rowCantSplit?: readonly boolean[] | null;
27
+ /** Footnote ids owned by each row. */
28
+ rowNoteIds?: readonly (readonly string[])[] | null;
29
+ /** Endnote ids owned by each row. */
30
+ rowEndnoteIds?: readonly (readonly string[])[] | null;
31
+ /** Leading rows the paginator repeats per fragment - OOXML `w:tblHeader`. */
32
+ headerRowCount?: number;
33
+ /**
34
+ * Leading rows formatted as a header. Distinct from the repeat count:
35
+ * `w:tblLook/@w:firstRow` styles a row without repeating it.
36
+ */
37
+ headerStyleRowCount?: number;
38
+ /** Authored cell margins, or null when the table inherits them. */
39
+ cellMargins?: Readonly<LayoutTableCellMargins> | null;
40
+ /** Horizontal offset `w:tblInd` puts on an inline table, in CSS pixels. */
41
+ leftIndent?: number | null;
42
+ /** `w:bidiVisual`: `rtl` mirrors column order, `ltr` leaves it alone. */
43
+ direction?: 'ltr' | 'rtl' | null;
44
+ displayMode?: string | null;
45
+ wrapMode?: string | null;
46
+ offsetX?: number | null;
47
+ offsetY?: number | null;
48
+ }
49
+ /**
50
+ * Reads the table metrics from a block.
51
+ *
52
+ * `block.table` is the only representation: the flat `tableRows`,
53
+ * `tableWidth` and friends were retired when the table contract moved into
54
+ * this package, and nothing writes or reads them anymore.
55
+ */
56
+ export declare function resolveLayoutTableBlockMetrics(block: {
57
+ readonly table?: LayoutTableBlockMetrics | null;
58
+ } | null | undefined): LayoutTableBlockMetrics | null;
@@ -0,0 +1,31 @@
1
+ export type TableCellAnchorHorizontalAlignment = 'left' | 'center' | 'right';
2
+ export type TableCellAnchorVerticalAlignment = 'top' | 'center' | 'bottom';
3
+ type AnchorRecord = Readonly<Record<string, unknown>>;
4
+ /**
5
+ * Resolves the horizontal position of anchored media in a table-cell content
6
+ * box. OOXML alignment is relative to the containing column; a positive offset
7
+ * moves left for right alignment, matching Word's `posOffset` semantics.
8
+ */
9
+ export declare function resolveTableCellAnchorOffsetX(input: {
10
+ containerWidth: number;
11
+ objectWidth: number;
12
+ offsetX: number | null | undefined;
13
+ alignment?: string | null;
14
+ position?: AnchorRecord | null;
15
+ }): number;
16
+ /**
17
+ * Resolves a table-cell anchor's local top offset. Paragraph-relative anchors
18
+ * use the anchor paragraph's first-line box, while page/margin-relative anchors
19
+ * use the supplied cell content height when it is known. Unknown non-paragraph
20
+ * geometry intentionally falls back to the authored offset.
21
+ */
22
+ export declare function resolveTableCellAnchorOffsetY(input: {
23
+ objectHeight: number;
24
+ offsetY: number | null | undefined;
25
+ alignment?: string | null;
26
+ position?: AnchorRecord | null;
27
+ paragraphTop?: number;
28
+ firstLineHeight?: number;
29
+ containerHeight?: number | null;
30
+ }): number;
31
+ export {};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk-DODR4QN4.js";export{a as resolveTableCellAnchorOffsetX,b as resolveTableCellAnchorOffsetY};
@@ -0,0 +1,51 @@
1
+ import type { TableCellTextSegment } from './table-cell-text-segment.ts';
2
+ import type { InlineRevisionSpan, LayoutDrawingPayload, MeasuredLineSlice, TextLineFrame } from './table-primitives.ts';
3
+ /** Rebases one block's inline revision spans onto a sliced text range. */
4
+ export type TableCellInlineSpanSlicer = (spans: readonly InlineRevisionSpan[] | null | undefined, fromOffset: number, toOffset: number) => readonly InlineRevisionSpan[] | null;
5
+ interface TableCellBlockRange {
6
+ /** Offsets in the flattened table-cell text, including media placeholders. */
7
+ readonly fromOffset: number;
8
+ readonly toOffset: number;
9
+ /** Height contributed to normal flow. Anchored objects may contribute zero. */
10
+ readonly flowHeight: number;
11
+ }
12
+ export interface TableCellTextBlockPlacement extends TableCellBlockRange {
13
+ readonly kind: 'text';
14
+ readonly text: string;
15
+ readonly segment: Readonly<TableCellTextSegment>;
16
+ readonly containerWidth?: number | null;
17
+ readonly lineSlices?: readonly MeasuredLineSlice[] | null;
18
+ readonly lineFrames?: readonly TextLineFrame[] | null;
19
+ }
20
+ export interface TableCellImageBlockPlacement extends TableCellBlockRange {
21
+ readonly kind: 'image';
22
+ readonly src: string;
23
+ readonly width: number;
24
+ readonly height: number;
25
+ readonly alt: string | null;
26
+ readonly title: string | null;
27
+ readonly objectId: string | null;
28
+ readonly displayMode: 'inline' | 'anchor';
29
+ readonly wrapMode: string | null;
30
+ readonly wrapSide: string | null;
31
+ readonly offsetX: number | null;
32
+ readonly offsetY: number | null;
33
+ readonly position: Readonly<Record<string, unknown>> | null;
34
+ readonly wrapDistances: Readonly<Record<string, unknown>> | null;
35
+ readonly anchorOptions: Readonly<Record<string, unknown>> | null;
36
+ readonly rotation: number | null;
37
+ readonly flipHorizontal: boolean;
38
+ readonly flipVertical: boolean;
39
+ readonly crop: Readonly<Record<string, unknown>> | null;
40
+ readonly decorative: boolean;
41
+ readonly hyperlink: Readonly<Record<string, unknown>> | null;
42
+ }
43
+ export interface TableCellDrawingBlockPlacement extends TableCellBlockRange {
44
+ readonly kind: 'drawing';
45
+ readonly drawing: Readonly<LayoutDrawingPayload>;
46
+ }
47
+ export type TableCellMediaBlockPlacement = TableCellImageBlockPlacement | TableCellDrawingBlockPlacement;
48
+ export type TableCellBlockPlacement = TableCellTextBlockPlacement | TableCellMediaBlockPlacement;
49
+ /** Selects and rebases ordered cell blocks for a paginated row fragment. */
50
+ export declare function sliceTableCellBlocksByOffsets(blocks: readonly TableCellBlockPlacement[] | null | undefined, fromOffset: number, toOffset: number, sliceInlineSpans: TableCellInlineSpanSlicer): TableCellBlockPlacement[] | null;
51
+ export {};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-N2TXWMCR.js";export{a as sliceTableCellBlocksByOffsets};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Authored table cell margins in CSS pixels, one entry per side.
3
+ *
4
+ * A side stays `null` when the document does not author it, which is not the
5
+ * same as zero: the layout has to fall back to the default padding for that side
6
+ * alone. Collapsing an unauthored side to zero would shrink the cell below what
7
+ * the renderer paints and put every caret in the cell on the wrong line.
8
+ *
9
+ * The importer already converts `w:tblCellMar` twips to pixels, so these values
10
+ * are layout units and need no further scaling.
11
+ */
12
+ export interface LayoutTableCellMargins {
13
+ top: number | null;
14
+ right: number | null;
15
+ bottom: number | null;
16
+ left: number | null;
17
+ }
@@ -0,0 +1 @@
1
+ import"./chunk-RVGFFYBA.js";
@@ -0,0 +1,23 @@
1
+ import type { TableCellBlockPlacement } from './table-cell-blocks.ts';
2
+ import type { TableCellVerticalAlign } from './table-cell-vertical-align.ts';
3
+ import type { InlineRevisionSpan, MeasuredLineSlice } from './table-primitives.ts';
4
+ import type { TableCellTextSegment } from './table-cell-text-segment.ts';
5
+ export type { TableCellParagraphTextFlowOptions, TableCellTextSegment, } from './table-cell-text-segment.ts';
6
+ /** Whether a cell starts a merge or continues the cell above it. */
7
+ export type TableCellMergeKind = 'start' | 'continue';
8
+ /** One cell of a laid out table row. */
9
+ export interface TableCellPlacement {
10
+ text: string;
11
+ blocks?: readonly TableCellBlockPlacement[] | null;
12
+ inlineSpans?: readonly InlineRevisionSpan[] | null;
13
+ lineSlices?: readonly MeasuredLineSlice[] | null;
14
+ lineHeights?: readonly number[] | null;
15
+ segments?: readonly TableCellTextSegment[] | null;
16
+ originRow?: number | null;
17
+ originColumn?: number | null;
18
+ rowSpan?: number | null;
19
+ colSpan?: number | null;
20
+ mergeKind?: TableCellMergeKind | null;
21
+ /** `w:vAlign`: where the cell's content sits inside the row's height. */
22
+ verticalAlign?: TableCellVerticalAlign | null;
23
+ }
@@ -0,0 +1 @@
1
+ import"./chunk-36EAGHXY.js";
@@ -0,0 +1,37 @@
1
+ import type { InlineRevisionSpan } from './table-primitives.ts';
2
+ /**
3
+ * Text-flow switches a table cell's paragraphs carry.
4
+ *
5
+ * Declared here rather than imported from `paragraph-text-flow.ts` so the table
6
+ * contract modules do not depend on the rest of layout-contracts. The shape is
7
+ * the same seven nullable booleans, so it remains assignable to the host's
8
+ * `ParagraphTextFlowOptions`.
9
+ */
10
+ export interface TableCellParagraphTextFlowOptions {
11
+ kinsoku?: boolean | null;
12
+ wordWrap?: boolean | null;
13
+ overflowPunct?: boolean | null;
14
+ topLinePunct?: boolean | null;
15
+ autoSpaceDE?: boolean | null;
16
+ autoSpaceDN?: boolean | null;
17
+ snapToGrid?: boolean | null;
18
+ }
19
+ export interface TableCellTextSegment {
20
+ text: string;
21
+ nodeType?: string | null;
22
+ fontSize?: number | null;
23
+ lineHeight?: number | null;
24
+ spacingBefore?: number | null;
25
+ spacingAfter?: number | null;
26
+ indentLeft?: number | null;
27
+ indentRight?: number | null;
28
+ firstLineIndent?: number | null;
29
+ tabs?: readonly {
30
+ position: number;
31
+ align?: string | null;
32
+ leader?: string | null;
33
+ }[] | null;
34
+ decimalSeparator?: string | null;
35
+ paragraphTextFlow?: TableCellParagraphTextFlowOptions | null;
36
+ inlineSpans?: readonly InlineRevisionSpan[] | null;
37
+ }
@@ -0,0 +1 @@
1
+ import"./chunk-2OAH5RMT.js";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Vertical alignment of a table cell's content, from `w:vAlign`.
3
+ *
4
+ * A cell is as tall as its row, and the content can sit at the top, in the
5
+ * middle or at the bottom of that box. LibreOffice paints the same cell text at
6
+ * three different heights for the three values, so this is a real vertical
7
+ * offset and not a paint-time decoration.
8
+ */
9
+ export type TableCellVerticalAlign = 'top' | 'center' | 'bottom';
10
+ /** Normalize a raw `w:vAlign` value. */
11
+ export declare function normalizeTableCellVerticalAlign(value: unknown): TableCellVerticalAlign | null;
12
+ /**
13
+ * Offset from the row's content top down to the cell's first line.
14
+ *
15
+ * Centring has to split the leftover space, which is why it needs both the row
16
+ * box and the content height rather than just a flag. A cell taller than the row
17
+ * has no leftover space, so every alignment collapses to the top there.
18
+ */
19
+ export declare function resolveTableCellVerticalOffset(align: TableCellVerticalAlign | null | undefined, rowContentHeight: number, cellContentHeight: number): number;
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk-4VNOCJ4Y.js";export{a as normalizeTableCellVerticalAlign,b as resolveTableCellVerticalOffset};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Horizontal box of one logical column inside a table.
3
+ *
4
+ * `w:bidiVisual` flips a table's column order without touching the cell data:
5
+ * LibreOffice paints the text of a two column table at x 72.1 then 288.1 in the
6
+ * default direction and at 288.1 then 72.1 once the flag is set. The cells keep
7
+ * their logical indices, so only the box moves - mirroring the data would
8
+ * reorder the document text itself.
9
+ */
10
+ export declare function resolveTableColumnBox(columnWidths: readonly number[], originColumn: number, colSpan: number, totalWidth: number, mirrored: boolean): {
11
+ left: number;
12
+ width: number;
13
+ };
@@ -0,0 +1,115 @@
1
+ import { type LayoutTableBlockMetrics } from './table-block-metrics.ts';
2
+ import type { TableCellMergeKind, TableCellPlacement } from './table-cell-placement.ts';
3
+ /**
4
+ * Separator inserted between non-empty cell texts when a table row is flattened
5
+ * into one text run.
6
+ *
7
+ * The renderer paints each cell in its own column, but the layout addresses the
8
+ * row as a single string. Both the projection and any DOM-first hit resolution
9
+ * must agree on this one value or a click lands a few characters off.
10
+ */
11
+ export declare const TABLE_CELL_TEXT_SEPARATOR = " | ";
12
+ /**
13
+ * Space between a cell's border and its text, on one horizontal side.
14
+ *
15
+ * Text is laid out inside the cell's content box, which is narrower than the
16
+ * column by this padding on each side. Wrapping against the column width instead
17
+ * lets a line accept text the browser then has to break, so the model and the
18
+ * paint disagree about how many lines a cell holds. Live measurement showed a
19
+ * 320px column with this padding wrapping 142 characters into 4 model lines
20
+ * while the browser painted 6, which put every caret in a wrapped cell on the
21
+ * wrong line.
22
+ */
23
+ export declare const TABLE_CELL_HORIZONTAL_PADDING = 10;
24
+ /**
25
+ * Space between a cell's border and its text, on one vertical side, when the
26
+ * document does not author one.
27
+ *
28
+ * Zero, because that is what OOXML says: a `tblCellMar` that omits `top` or
29
+ * `bottom` means no inset on that side. Word only writes the element when it
30
+ * means something, and a table produced without it paints its text flush to the
31
+ * border.
32
+ *
33
+ * Measured twice, on differently shaped tables. A 5x3 table with no `tblCellMar`
34
+ * renders its rows 13.40pt apart against a 13.20pt single-spaced line box for
35
+ * 11pt text - a 0.20pt difference, which is rounding, not inset. The same holds
36
+ * for a 3x2 table and, decisively, for a 30-row one: at 8px per side the rows
37
+ * measure 40.3px each against the reference 17.87px, and the 673px that
38
+ * accumulates over 30 rows turns a one-page document into two.
39
+ *
40
+ * The horizontal default stays non-zero - it has its own measurement behind it,
41
+ * and the two sides are set by different parts of Word's layout.
42
+ */
43
+ export declare const TABLE_CELL_VERTICAL_PADDING = 0;
44
+ export interface TableFragmentLike {
45
+ table?: LayoutTableBlockMetrics | null;
46
+ }
47
+ export interface ResolvedTableCellPlacement {
48
+ text: string;
49
+ layout: TableCellPlacement;
50
+ physicalIndex: number;
51
+ fragmentRowIndex: number;
52
+ sourceRowIndex: number;
53
+ originRow: number;
54
+ originColumn: number;
55
+ rowSpan: number;
56
+ colSpan: number;
57
+ mergeKind: TableCellMergeKind | null;
58
+ }
59
+ export interface ResolvedTableRowPlacement {
60
+ row: readonly string[];
61
+ cellLayouts: readonly TableCellPlacement[];
62
+ fragmentRowIndex: number;
63
+ sourceRowIndex: number;
64
+ cells: readonly ResolvedTableCellPlacement[];
65
+ }
66
+ export interface RenderableTableCellPlacement extends ResolvedTableCellPlacement {
67
+ rowSpanInFragment: number;
68
+ /**
69
+ * Offset of this cell's text inside the row's flattened text.
70
+ *
71
+ * A cell owns a slice of the row string, not the whole of it. Resolving a hit
72
+ * against the cell therefore needs this base to convert an in-cell character
73
+ * offset back into a row-relative one.
74
+ */
75
+ textStart: number;
76
+ }
77
+ export interface RenderableTableRowPlacement extends ResolvedTableRowPlacement {
78
+ cells: readonly RenderableTableCellPlacement[];
79
+ }
80
+ /**
81
+ * Narrows an unknown merge marker to the merge shape it names.
82
+ *
83
+ * Exported because the projection layer re-reads the same marker off a placed
84
+ * cell and must agree with the layout about what counts as a merge. Two copies of
85
+ * this predicate would drift exactly as the cell padding constants once did.
86
+ */
87
+ export declare function normalizeMergeKind(value: unknown): TableCellMergeKind | null;
88
+ export declare function resolveTableRowCells(input: {
89
+ row?: readonly string[] | null;
90
+ cellLayouts?: readonly TableCellPlacement[] | null;
91
+ fragmentRowIndex?: number;
92
+ sourceRowIndex?: number;
93
+ }): ResolvedTableCellPlacement[];
94
+ export declare function resolveTableFragmentRows(fragment: TableFragmentLike): ResolvedTableRowPlacement[];
95
+ /**
96
+ * How many leading rows of a table fragment carry the header look.
97
+ *
98
+ * A table's header is a property of the WHOLE table, but a fragment only holds
99
+ * the rows that fit on one page. Comparing a fragment-local row number against
100
+ * the table-wide header count marks row 0 of every fragment as a header - the
101
+ * second and third pages of a long table painted their first data row ("Row 8",
102
+ * "Row 16") bold on the tinted background, as though the header repeated, even
103
+ * with repetition switched off.
104
+ *
105
+ * So the test is made in whole-table coordinates: a row is a header when its
106
+ * SOURCE index is below the count. On the fragment that actually holds the
107
+ * header the two numberings agree and nothing changes; on later fragments no
108
+ * row qualifies and the rows paint as ordinary ones.
109
+ */
110
+ export declare function resolveTableHeaderStyleRowCount(row: {
111
+ sourceRowIndex: number;
112
+ }, headerCount: number | null | undefined, rowCount: number): number;
113
+ export declare function resolveRenderableTableRows(fragment: TableFragmentLike): RenderableTableRowPlacement[];
114
+ export declare function resolveTableLogicalColumnCount(fragment: TableFragmentLike): number;
115
+ export declare function resolveTableCellColumnWidth(columnWidths: readonly number[], cell: Pick<ResolvedTableCellPlacement, 'originColumn' | 'colSpan'>): number;
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i,j}from"./chunk-AYAWI6IR.js";import"./chunk-VRAHV7NM.js";export{b as TABLE_CELL_HORIZONTAL_PADDING,a as TABLE_CELL_TEXT_SEPARATOR,c as TABLE_CELL_VERTICAL_PADDING,d as normalizeMergeKind,h as resolveRenderableTableRows,j as resolveTableCellColumnWidth,f as resolveTableFragmentRows,g as resolveTableHeaderStyleRowCount,i as resolveTableLogicalColumnCount,e as resolveTableRowCells};