@sobree/core 0.1.13 → 0.1.15
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/doc/builders/block.d.ts +8 -0
- package/dist/doc/{builders.d.ts → builders/document.d.ts} +1 -12
- package/dist/doc/builders/index.d.ts +25 -0
- package/dist/doc/builders/inline.d.ts +38 -0
- package/dist/doc/builders/style.d.ts +7 -0
- package/dist/doc/builders/table.d.ts +20 -0
- package/dist/doc/formatting.types.d.ts +51 -0
- package/dist/doc/tableStyle.d.ts +24 -0
- package/dist/doc/tableStyle.types.d.ts +43 -0
- package/dist/doc/types.d.ts +15 -48
- package/dist/docx/import/tableStyle.d.ts +6 -0
- package/dist/docx/shared/tableBorders.d.ts +8 -0
- package/dist/index.css +1 -1
- package/dist/index.js +4440 -4113
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InlineRun, Paragraph, ParagraphProperties, SectionBreak } from '../types';
|
|
2
|
+
/** A paragraph with the given runs and properties (both optional). */
|
|
3
|
+
export declare function paragraph(runs?: InlineRun[], properties?: ParagraphProperties): Paragraph;
|
|
4
|
+
/** Heading paragraph (`Heading{level}` style, level clamped to 1..6). */
|
|
5
|
+
export declare function heading(level: number, runs?: InlineRun[], properties?: ParagraphProperties): Paragraph;
|
|
6
|
+
/** A section break that switches to `toSectionIndex` in the document's
|
|
7
|
+
* `sections` array for the content that follows. */
|
|
8
|
+
export declare function sectionBreak(toSectionIndex: number): SectionBreak;
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import { Block, HeaderFooterRef,
|
|
1
|
+
import { Block, HeaderFooterRef, NamedStyle, PageMargins, PageSize, Paragraph, SectionProperties, SobreeDocument, Table } from '../types';
|
|
2
2
|
/** A new, blank document with an A4 portrait section and the standard styles. */
|
|
3
3
|
export declare function emptyDocument(): SobreeDocument;
|
|
4
4
|
export declare function defaultSection(): SectionProperties;
|
|
5
5
|
export declare function defaultPageSize(): PageSize;
|
|
6
6
|
export declare function defaultMargins(): PageMargins;
|
|
7
|
-
/** A paragraph with no runs and no properties beyond the defaults. */
|
|
8
|
-
export declare function paragraph(runs?: InlineRun[], properties?: ParagraphProperties): Paragraph;
|
|
9
|
-
/** Heading paragraph (`Heading{level}` style, level clamped to 1..6). */
|
|
10
|
-
export declare function heading(level: number, runs?: InlineRun[], extra?: ParagraphProperties): Paragraph;
|
|
11
|
-
/** Plain text run with optional formatting. */
|
|
12
|
-
export declare function text(value: string, properties?: RunProperties): TextRun;
|
|
13
|
-
/** Convenience: emphasised (bold + italic) text run. */
|
|
14
|
-
export declare function emphasis(value: string, properties?: RunProperties): TextRun;
|
|
15
|
-
export declare function strong(value: string, properties?: RunProperties): TextRun;
|
|
16
|
-
export declare function softBreak(): InlineRun;
|
|
17
|
-
export declare function pageBreak(): InlineRun;
|
|
18
7
|
/** Default Word styles every doc declares so headings render correctly.
|
|
19
8
|
*
|
|
20
9
|
* Carries WORD-HARDCODED-DEFAULT typography — i.e. what Word uses
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constructors for AST nodes. Two reasons these exist as helpers instead
|
|
3
|
+
* of object literals at every call site:
|
|
4
|
+
* 1. Defaults — A4 paper, an empty cell's placeholder paragraph, equal
|
|
5
|
+
* column widths — without sprinkling magic numbers into caller code.
|
|
6
|
+
* 2. Future schema migration — when a new required field is added, all
|
|
7
|
+
* construction goes through here and the migration is one diff.
|
|
8
|
+
*
|
|
9
|
+
* Conventions across the layer:
|
|
10
|
+
* - The factory is named for the node it builds (`text`, `table`,
|
|
11
|
+
* `tableCell`, `hyperlink`, `sectionBreak`).
|
|
12
|
+
* - Required content is positional; optional formatting is a trailing
|
|
13
|
+
* `properties` argument (a leaf's `RunProperties`, a container's
|
|
14
|
+
* `*Properties`). Many-field nodes (`image`, `table`, `namedStyle`)
|
|
15
|
+
* take a single trailing options object instead.
|
|
16
|
+
* - Measurements keep their native OOXML unit, suffixed (`widthEmu`,
|
|
17
|
+
* `…Twips`), matching the AST.
|
|
18
|
+
*
|
|
19
|
+
* Organised by node category: document / block / inline / table / style.
|
|
20
|
+
*/
|
|
21
|
+
export { appendBlock, defaultMargins, defaultPageSize, defaultSection, defaultStyles, emptyDocument, isParagraph, isTable, makeHeaderFooterRef, } from './document';
|
|
22
|
+
export { heading, paragraph, sectionBreak } from './block';
|
|
23
|
+
export { columnBreak, commentRef, emphasis, field, footnoteRef, hyperlink, image, type ImageOptions, pageBreak, softBreak, strong, tab, text, } from './inline';
|
|
24
|
+
export { type CellProperties, type TableOptions, table, tableCell, tableRow } from './table';
|
|
25
|
+
export { type NamedStyleOptions, namedStyle } from './style';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BreakRun, CommentRefRun, DrawingRun, FieldRun, FootnoteRefRun, HyperlinkRun, InlineRun, RunProperties, TabRun, TextRun } from '../types';
|
|
2
|
+
/** Plain text run with optional formatting. */
|
|
3
|
+
export declare function text(value: string, properties?: RunProperties): TextRun;
|
|
4
|
+
/** Convenience: italic text run. */
|
|
5
|
+
export declare function emphasis(value: string, properties?: RunProperties): TextRun;
|
|
6
|
+
/** Convenience: bold text run. */
|
|
7
|
+
export declare function strong(value: string, properties?: RunProperties): TextRun;
|
|
8
|
+
/** Soft line break inside a paragraph (Shift-Enter). */
|
|
9
|
+
export declare function softBreak(): BreakRun;
|
|
10
|
+
/** Explicit page break. */
|
|
11
|
+
export declare function pageBreak(): BreakRun;
|
|
12
|
+
/** Column break (advances to the next column in a multi-column section). */
|
|
13
|
+
export declare function columnBreak(): BreakRun;
|
|
14
|
+
/** A tab character — advances to the next tab stop. */
|
|
15
|
+
export declare function tab(properties?: RunProperties): TabRun;
|
|
16
|
+
/** A hyperlink wrapping inline children. `href` is an external URL or an
|
|
17
|
+
* internal anchor id (`#bookmark`). */
|
|
18
|
+
export declare function hyperlink(href: string, children: InlineRun[], properties?: RunProperties): HyperlinkRun;
|
|
19
|
+
/** A field run (`PAGE`, `NUMPAGES`, `DATE`, …). `cached` is the preview
|
|
20
|
+
* text shown until a viewer recalculates the field. */
|
|
21
|
+
export declare function field(instruction: string, cached?: string, properties?: RunProperties): FieldRun;
|
|
22
|
+
/** Options for {@link image}. `partPath` references a binary in the
|
|
23
|
+
* document's `rawParts`; the caller is responsible for registering the
|
|
24
|
+
* bytes there (or use the editor's `insertImage`, which does both). */
|
|
25
|
+
export interface ImageOptions {
|
|
26
|
+
widthEmu: number;
|
|
27
|
+
heightEmu: number;
|
|
28
|
+
altText?: string;
|
|
29
|
+
/** Layout mode — defaults to `"inline"` (flows like a tall character). */
|
|
30
|
+
placement?: DrawingRun["placement"];
|
|
31
|
+
verticalAlign?: DrawingRun["verticalAlign"];
|
|
32
|
+
}
|
|
33
|
+
/** An image / drawing run referencing a part in `rawParts`. */
|
|
34
|
+
export declare function image(partPath: string, opts: ImageOptions): DrawingRun;
|
|
35
|
+
/** A footnote reference — `id` keys into `SobreeDocument.footnotes`. */
|
|
36
|
+
export declare function footnoteRef(id: number, properties?: RunProperties): FootnoteRefRun;
|
|
37
|
+
/** A comment reference — `id` keys into `SobreeDocument.comments`. */
|
|
38
|
+
export declare function commentRef(id: number, properties?: RunProperties): CommentRefRun;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NamedStyle } from '../types';
|
|
2
|
+
/** Everything on {@link NamedStyle} except `id` (the positional argument);
|
|
3
|
+
* `type` defaults to `"paragraph"` and `displayName` to the id. */
|
|
4
|
+
export type NamedStyleOptions = Partial<Omit<NamedStyle, "id">>;
|
|
5
|
+
/** A named style. `id` is required; `type` defaults to `"paragraph"` and
|
|
6
|
+
* `displayName` to `id` when not given. */
|
|
7
|
+
export declare function namedStyle(id: string, options?: NamedStyleOptions): NamedStyle;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Block, Table, TableCell, TableProperties, TableRow } from '../types';
|
|
2
|
+
/** A cell's properties — everything on {@link TableCell} except `content`
|
|
3
|
+
* (which is the positional argument). */
|
|
4
|
+
export type CellProperties = Partial<Omit<TableCell, "content">>;
|
|
5
|
+
/** A table cell. `content` defaults to a single empty paragraph (Word
|
|
6
|
+
* requires every cell to hold at least one paragraph). */
|
|
7
|
+
export declare function tableCell(content?: Block[], properties?: CellProperties): TableCell;
|
|
8
|
+
/** A table row. */
|
|
9
|
+
export declare function tableRow(cells: TableCell[], opts?: {
|
|
10
|
+
isHeader?: boolean;
|
|
11
|
+
}): TableRow;
|
|
12
|
+
export interface TableOptions {
|
|
13
|
+
/** Column widths in twips (length = column count). Derived as equal
|
|
14
|
+
* columns from {@link DEFAULT_TABLE_WIDTH_TWIPS} when omitted. */
|
|
15
|
+
grid?: number[];
|
|
16
|
+
properties?: TableProperties;
|
|
17
|
+
}
|
|
18
|
+
/** A table. The column `grid` is taken from `opts.grid`, else derived as
|
|
19
|
+
* equal-width columns from the widest row's column count. */
|
|
20
|
+
export declare function table(rows: TableRow[], opts?: TableOptions): Table;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual formatting primitives: borders, shading, and cell spacing.
|
|
3
|
+
*
|
|
4
|
+
* Low-level value-types shared across the AST — paragraphs, runs, and
|
|
5
|
+
* tables all paint with these. A dependency-free LEAF: none reference the
|
|
6
|
+
* recursive `Block` document graph, so keeping them here (out of
|
|
7
|
+
* `types.ts`) avoids a circular dependency. `types.ts` imports +
|
|
8
|
+
* re-exports them, so consumers still get every AST type from `./types`.
|
|
9
|
+
*/
|
|
10
|
+
export interface BorderSpec {
|
|
11
|
+
style: "single" | "double" | "dashed" | "dotted" | "thick" | "none";
|
|
12
|
+
/** Eighths of a point (Word's `w:sz`). */
|
|
13
|
+
sizeEighthsOfPt: number;
|
|
14
|
+
/** `#rrggbb` or `auto`. */
|
|
15
|
+
color: string;
|
|
16
|
+
/** Twips of clear space between border and text. */
|
|
17
|
+
spaceTwips?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface Shading {
|
|
20
|
+
/** Pattern (`clear`, `pct10`, `solid`, …). Most highlights are `clear`. */
|
|
21
|
+
pattern: string;
|
|
22
|
+
/** Background `#rrggbb` or `auto`. */
|
|
23
|
+
fill: string;
|
|
24
|
+
/** Pattern foreground `#rrggbb` or `auto`. */
|
|
25
|
+
color?: string;
|
|
26
|
+
}
|
|
27
|
+
/** A table's outer edges plus the inside-horizontal / inside-vertical
|
|
28
|
+
* separators (`<w:tblBorders>`). */
|
|
29
|
+
export interface TableBorders {
|
|
30
|
+
top?: BorderSpec;
|
|
31
|
+
right?: BorderSpec;
|
|
32
|
+
bottom?: BorderSpec;
|
|
33
|
+
left?: BorderSpec;
|
|
34
|
+
insideH?: BorderSpec;
|
|
35
|
+
insideV?: BorderSpec;
|
|
36
|
+
}
|
|
37
|
+
/** A single cell's four edges (`<w:tcBorders>`). */
|
|
38
|
+
export interface TableCellBorders {
|
|
39
|
+
top?: BorderSpec;
|
|
40
|
+
right?: BorderSpec;
|
|
41
|
+
bottom?: BorderSpec;
|
|
42
|
+
left?: BorderSpec;
|
|
43
|
+
}
|
|
44
|
+
/** Default cell padding (`<w:tblCellMar>` / `<w:tcMar>`), in twips. An
|
|
45
|
+
* absent side falls back to the renderer's Word default. */
|
|
46
|
+
export interface TableCellMargins {
|
|
47
|
+
topTwips?: number;
|
|
48
|
+
rightTwips?: number;
|
|
49
|
+
bottomTwips?: number;
|
|
50
|
+
leftTwips?: number;
|
|
51
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NamedStyle, TableLook, TableStyleCellFormat, TableStyleDefinition } from './types';
|
|
2
|
+
/** Logical position of a cell within its table (left/top edge of the
|
|
3
|
+
* cell when it spans multiple grid columns / rows). */
|
|
4
|
+
export interface TableCellPosition {
|
|
5
|
+
rowIndex: number;
|
|
6
|
+
colIndex: number;
|
|
7
|
+
rowCount: number;
|
|
8
|
+
colCount: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Merge a table style up its `basedOn` chain into one definition. Base
|
|
12
|
+
* ancestor first, the named style last so it wins. Sub-objects merge
|
|
13
|
+
* field-by-field (a child that sets only `firstRow` keeps the parent's
|
|
14
|
+
* `band1Horz`). Returns `null` if the style id is unknown or carries no
|
|
15
|
+
* table formatting.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveTableStyle(styles: readonly NamedStyle[], styleId: string | undefined): TableStyleDefinition | null;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the conditional cell formatting (shading + per-side border
|
|
20
|
+
* overrides) for one cell, gated by the table's `look`. Base whole-table
|
|
21
|
+
* borders are NOT included (the renderer draws those at table level);
|
|
22
|
+
* base shading IS, since nothing else applies it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveTableCellFormat(def: TableStyleDefinition, look: TableLook, pos: TableCellPosition): TableStyleCellFormat;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Shading, TableBorders, TableCellBorders, TableCellMargins } from './formatting.types';
|
|
2
|
+
/** `<w:tblLook>` flags. A flag absent ⇒ that conditional format is OFF. */
|
|
3
|
+
export interface TableLook {
|
|
4
|
+
firstRow?: boolean;
|
|
5
|
+
lastRow?: boolean;
|
|
6
|
+
firstColumn?: boolean;
|
|
7
|
+
lastColumn?: boolean;
|
|
8
|
+
/** Row (horizontal) banding active. */
|
|
9
|
+
hBand?: boolean;
|
|
10
|
+
/** Column (vertical) banding active. */
|
|
11
|
+
vBand?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A table style's conditional-format regions (`<w:tblStylePr w:type>`).
|
|
15
|
+
* Each names a slice of the table whose cells get extra formatting when
|
|
16
|
+
* the table's `<w:tblLook>` enables it. Resolution precedence (low→high,
|
|
17
|
+
* ECMA-376 §17.7.6): wholeTable → vBands → hBands → first/last column →
|
|
18
|
+
* first/last row → corner cells, then direct cell formatting wins.
|
|
19
|
+
*/
|
|
20
|
+
export type TableConditionalType = "firstRow" | "lastRow" | "firstCol" | "lastCol" | "band1Horz" | "band2Horz" | "band1Vert" | "band2Vert" | "nwCell" | "neCell" | "swCell" | "seCell";
|
|
21
|
+
/** The formatting one region (or the whole-table base) contributes. */
|
|
22
|
+
export interface TableStyleCellFormat {
|
|
23
|
+
shading?: Shading;
|
|
24
|
+
borders?: TableCellBorders;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A `<w:style w:type="table">` definition: whole-table base formatting +
|
|
28
|
+
* per-region conditional formatting + band sizes. Resolved per cell at
|
|
29
|
+
* render time against the table's `look`.
|
|
30
|
+
*/
|
|
31
|
+
export interface TableStyleDefinition {
|
|
32
|
+
/** Whole-table borders (`<w:tblBorders>` — incl. `insideH`/`insideV`). */
|
|
33
|
+
borders?: TableBorders;
|
|
34
|
+
/** Whole-table base cell shading. */
|
|
35
|
+
shading?: Shading;
|
|
36
|
+
/** Rows per horizontal band (`<w:tblStyleRowBandSize>`, default 1). */
|
|
37
|
+
rowBandSize?: number;
|
|
38
|
+
/** Columns per vertical band (`<w:tblStyleColBandSize>`, default 1). */
|
|
39
|
+
colBandSize?: number;
|
|
40
|
+
/** Whole-table default cell padding (`<w:tblCellMar>` in the style). */
|
|
41
|
+
cellMargins?: TableCellMargins;
|
|
42
|
+
conditional?: Partial<Record<TableConditionalType, TableStyleCellFormat>>;
|
|
43
|
+
}
|
package/dist/doc/types.d.ts
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
|
+
import { BorderSpec, Shading, TableBorders, TableCellBorders, TableCellMargins } from './formatting.types';
|
|
2
|
+
import { TableLook, TableStyleDefinition } from './tableStyle.types';
|
|
1
3
|
import { FontDeclaration as _FontDeclaration } from '../fonts/types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Every node here maps 1-to-1 to an OOXML construct so serialisation to
|
|
6
|
-
* `.docx` is mechanical (no decisions, no lossy translation). The names
|
|
7
|
-
* are JS-friendly — `Paragraph`, `RunProperties`, etc. — rather than
|
|
8
|
-
* `<w:p>`, `<w:rPr>` directly, but the shapes line up.
|
|
9
|
-
*
|
|
10
|
-
* Conventions:
|
|
11
|
-
* - All numeric measurements that originate in OOXML keep their native
|
|
12
|
-
* unit, suffixed in the field name: `wTwips`, `sizeHalfPt`, `widthEmu`.
|
|
13
|
-
* - All node objects are JSON-clean (no functions, classes, or
|
|
14
|
-
* references) so they cross any wire (Yjs sync messages, MCP,
|
|
15
|
-
* postMessage) untouched.
|
|
16
|
-
* - Optional fields are `?:` — absence means "not set", not "default".
|
|
17
|
-
* Defaults are applied at render time from the document's styles.
|
|
18
|
-
*/
|
|
4
|
+
export type { BorderSpec, Shading, TableBorders, TableCellBorders, TableCellMargins, } from './formatting.types';
|
|
5
|
+
export type { TableConditionalType, TableLook, TableStyleCellFormat, TableStyleDefinition, } from './tableStyle.types';
|
|
19
6
|
export interface SobreeDocument {
|
|
20
7
|
/** Top-level body content, in document order. */
|
|
21
8
|
body: Block[];
|
|
@@ -676,23 +663,6 @@ export interface ParagraphBorders {
|
|
|
676
663
|
left?: BorderSpec;
|
|
677
664
|
between?: BorderSpec;
|
|
678
665
|
}
|
|
679
|
-
export interface BorderSpec {
|
|
680
|
-
style: "single" | "double" | "dashed" | "dotted" | "thick" | "none";
|
|
681
|
-
/** Eighths of a point (Word's `w:sz`). */
|
|
682
|
-
sizeEighthsOfPt: number;
|
|
683
|
-
/** `#rrggbb` or `auto`. */
|
|
684
|
-
color: string;
|
|
685
|
-
/** Twips of clear space between border and text. */
|
|
686
|
-
spaceTwips?: number;
|
|
687
|
-
}
|
|
688
|
-
export interface Shading {
|
|
689
|
-
/** Pattern (`clear`, `pct10`, `solid`, …). Most highlights are `clear`. */
|
|
690
|
-
pattern: string;
|
|
691
|
-
/** Background `#rrggbb` or `auto`. */
|
|
692
|
-
fill: string;
|
|
693
|
-
/** Pattern foreground `#rrggbb` or `auto`. */
|
|
694
|
-
color?: string;
|
|
695
|
-
}
|
|
696
666
|
export interface Table {
|
|
697
667
|
kind: "table";
|
|
698
668
|
/** Column widths in twips. Length = number of columns. */
|
|
@@ -707,14 +677,14 @@ export interface TableProperties {
|
|
|
707
677
|
borders?: TableBorders;
|
|
708
678
|
/** Style reference (e.g. "TableGrid"). */
|
|
709
679
|
styleId?: string;
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
680
|
+
/** `<w:tblLook>` — which of the table style's conditional formats are
|
|
681
|
+
* active (first row / column, last row / column, row / column
|
|
682
|
+
* banding). Gates {@link TableStyleDefinition} resolution. */
|
|
683
|
+
look?: TableLook;
|
|
684
|
+
/** `<w:tblCellMar>` — default inner padding for every cell (the table's
|
|
685
|
+
* own value wins over the style's). Word's stock default is ~108 twips
|
|
686
|
+
* left / right and 0 top / bottom when omitted. */
|
|
687
|
+
cellMargins?: TableCellMargins;
|
|
718
688
|
}
|
|
719
689
|
export interface TableRow {
|
|
720
690
|
cells: TableCell[];
|
|
@@ -732,12 +702,6 @@ export interface TableCell {
|
|
|
732
702
|
/** Cell content — paragraphs and (rare) nested tables. */
|
|
733
703
|
content: Block[];
|
|
734
704
|
}
|
|
735
|
-
export interface TableCellBorders {
|
|
736
|
-
top?: BorderSpec;
|
|
737
|
-
right?: BorderSpec;
|
|
738
|
-
bottom?: BorderSpec;
|
|
739
|
-
left?: BorderSpec;
|
|
740
|
-
}
|
|
741
705
|
export interface SectionProperties {
|
|
742
706
|
pageSize: PageSize;
|
|
743
707
|
pageMargins: PageMargins;
|
|
@@ -826,6 +790,9 @@ export interface NamedStyle {
|
|
|
826
790
|
paragraphDefaults?: ParagraphProperties;
|
|
827
791
|
/** Default table properties (only for table styles). */
|
|
828
792
|
tableDefaults?: TableProperties;
|
|
793
|
+
/** Table-style borders + conditional formatting (only for table
|
|
794
|
+
* styles). Resolved per cell at render time. */
|
|
795
|
+
tableStyle?: TableStyleDefinition;
|
|
829
796
|
}
|
|
830
797
|
export interface NumberingDefinition {
|
|
831
798
|
/** `numId` referenced from `ParagraphProperties.numbering`. */
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TableStyleDefinition } from '../../doc/types';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a table-style `<w:style>` element into a TableStyleDefinition, or
|
|
4
|
+
* `null` if it carries no table-specific formatting worth keeping.
|
|
5
|
+
*/
|
|
6
|
+
export declare function readTableStyle(styleEl: Element): TableStyleDefinition | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TableBorders, TableCellBorders, TableCellMargins } from '../../doc/types';
|
|
2
|
+
/** Read `<w:tblBorders>` (outer edges + `insideH`/`insideV`). */
|
|
3
|
+
export declare function readTableBorders(el: Element): TableBorders | null;
|
|
4
|
+
/** Read `<w:tcBorders>` (a cell's four edges). */
|
|
5
|
+
export declare function readCellBorders(el: Element): TableCellBorders | null;
|
|
6
|
+
/** Read `<w:tblCellMar>` / `<w:tcMar>` — per-side cell padding in twips.
|
|
7
|
+
* Each side child (`<w:top>`, `<w:left>`, …) carries `w:w` (twips). */
|
|
8
|
+
export declare function readCellMargins(el: Element): TableCellMargins | null;
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.sobree-viewport{position:relative;overflow:hidden;overscroll-behavior:contain;touch-action:none;background:#ececee}.sobree-viewport__stage{position:absolute;top:0;left:0;transform-origin:0 0}.sobree-viewport__stage.is-gesturing,.sobree-viewport__stage.is-animating{will-change:transform}.sobree-viewport__stage.is-animating{transition:transform .32s cubic-bezier(.2,.7,.2,1)}.sobree-viewport__slot{display:block}.sobree-editor{position:relative;outline:none}.sobree-editor>:first-child{margin-top:0}.sobree-editor p,.sobree-editor h1,.sobree-editor h2,.sobree-editor h3,.sobree-editor h4,.sobree-editor h5,.sobree-editor h6,.sobree-editor ul,.sobree-editor ol,.sobree-editor li,.sobree-editor blockquote,.sobree-editor pre{margin:0;padding:0}.sobree-editor ul,.sobree-editor ol{padding-left:1.5em}.sobree-editor li.sobree-li-continuation{list-style-type:none}.sobree-editor li.sobree-li-continuation::marker{content:""}.sobree-editor .sobree-fragment-continued{text-align-last:justify}.sobree-editor .sobree-footnote-ref a{color:inherit;text-decoration:none}.sobree-editor .sobree-footnote-ref a:hover{text-decoration:underline}.sobree-editor .sobree-footnotes{margin-top:2em;padding-top:.5em;border-top:1pt solid currentColor;font-size:.85em}.sobree-editor .sobree-footnotes__list{padding-left:1.5em}.sobree-editor .sobree-footnotes__item{margin:.25em 0}.sobree-editor ins.sobree-revision-ins{text-decoration:underline}.sobree-editor del.sobree-revision-del{text-decoration:line-through}.sobree-editor .sobree-revision-format{text-decoration:underline dashed var(--sobree-format-revision-color, currentColor);text-underline-offset:3px}.sobree-editor [data-block-revision=ins]:after,.sobree-editor [data-block-revision=del]:after{content:" ¶";color:var(--sobree-block-revision-color, currentColor);opacity:.65;font-weight:600;-webkit-user-select:none;user-select:none}.sobree-editor [data-block-revision=del]:after{text-decoration:line-through}.sobree-editor .sobree-comment-range{background:var(--sobree-comment-range-bg, rgba(255, 217, 0, .25));border-bottom:1px dotted var(--sobree-comment-range-border, rgba(180, 130, 0, .5))}.sobree-editor .sobree-comment-ref{display:inline;font-size:.85em;margin:0 .1em}.sobree-editor .sobree-comment-ref a{color:inherit;text-decoration:none}.sobree-editor .sobree-comment-ref a:hover{filter:brightness(.7)}.sobree-editor h1,.sobree-editor h2,.sobree-editor h3,.sobree-editor h4,.sobree-editor h5,.sobree-editor h6{font-size:inherit;font-weight:inherit}.sobree-editor table{border-collapse:collapse;width:100%;position:relative}.sobree-editor th,.sobree-editor td{border:none;padding:0 .08in;vertical-align:top;transition:border-color .12s ease}.sobree-editor .sobree-section-break{display:flex;align-items:center;gap:8px;margin:8px 0;color:var(--fg-subtle, #7c7764);font-size:11px;letter-spacing:.04em;text-transform:uppercase;-webkit-user-select:none;user-select:none}.sobree-editor .sobree-section-break--continuous{visibility:hidden;height:0;margin:0;padding:0;border:none;overflow:hidden;font-size:0;line-height:0}.sobree-editor .sobree-section-break:before,.sobree-editor .sobree-section-break:after{content:"";flex:1;border-top:1px dashed var(--border, #dedbd0)}.sobree-editor .sobree-section-break__label{flex:none;padding:0 6px;background:var(--bg-elevated, #fff)}.sobree-editor .sobree-textbox-frame p{line-height:1.2}.sobree-editor .paper-content p,.sobree-editor .paper-content li,.sobree-editor .paper-header p,.sobree-editor .paper-header li,.sobree-editor .paper-footer p,.sobree-editor .paper-footer li,.sobree-editor .sobree-textbox-frame p{white-space:pre-wrap}.sobree-editor .sobree-section-trailer-empty{height:0;line-height:0;font-size:0;margin:0;padding:0;overflow:hidden}.sobree-editor .sobree-textbox-frame--placeholder{border:1px solid var(--border, #c8c4b8)}.sobree-editor .sobree-textbox-frame--placeholder.sobree-textbox-frame--filled{border:none;z-index:-1}.sobree-editor img.is-selected{outline:2px solid var(--sobree-primary, #d4521f);outline-offset:2px}.sobree-image-resize-handle{position:absolute;width:16px;height:16px;background:var(--sobree-primary, #d4521f);border:2px solid #fff;border-radius:3px;cursor:nwse-resize;z-index:1000;-webkit-user-select:none;user-select:none}.paper-stack{display:flex;flex-direction:column;padding:48px;gap:28px;outline:none}.paper-row{display:flex;flex-direction:row;align-items:flex-start;gap:24px}.paper{position:relative;background:#fff;border:1px solid rgba(0,0,0,.3);box-shadow:0 1px 2px #00000014,0 18px 60px #0000001f;padding-top:var(--margin-top, 25mm);padding-right:var(--margin-right, 20mm);padding-bottom:var(--margin-bottom, 25mm);padding-left:var(--margin-left, 20mm);overflow:hidden;flex:none}.paper-header,.paper-footer{position:absolute;left:var(--margin-left, 20mm);right:var(--margin-right, 20mm);font-size:10pt;color:#555;white-space:pre-wrap}.paper-header{top:0;min-height:var(--margin-top, 25mm);padding-top:var(--header-offset-mm, 12.7mm);padding-bottom:4mm;border-bottom:1px dashed transparent}.paper-footer{bottom:0;min-height:var(--margin-bottom, 25mm);padding-top:4mm;text-align:center;border-top:1px dashed transparent}.paper-anchors{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;isolation:isolate;z-index:1}.paper-anchors.is-empty{display:none}.paper-anchors-behind{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;isolation:isolate;z-index:0}.paper-anchors-behind.is-empty{display:none}.paper-zone-anchors{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;isolation:isolate;z-index:2}.paper-zone-anchors.is-empty{display:none}.paper-anchor{position:absolute;box-sizing:border-box;overflow:hidden}.paper-header>p,.paper-footer>p,.paper-header>ul,.paper-header>ol,.paper-footer>ul,.paper-footer>ol{margin:0}.paper-footnotes{position:absolute;left:var(--margin-left, 20mm);right:var(--margin-right, 20mm);bottom:var(--margin-bottom, 25mm);font-size:.85em;padding-top:.5em;border-top:1pt solid currentColor;background:#fffffff5;z-index:1;max-height:40%;overflow:hidden}.paper-footnotes.is-empty{display:none}.paper-comments{flex:0 0 70mm;max-width:70mm;font-size:.85em;padding:0 .5em;align-self:stretch;overflow-y:auto}.paper-comments.is-empty{display:none}.paper-footnotes .sobree-footnotes__list{margin:0;padding-left:1.5em}.paper-footnotes .sobree-footnotes__item{margin:.25em 0}.paper-content a{color:inherit;text-decoration:none}.paper-content{position:relative;height:100%;min-height:100px;display:flow-root}.paper-content td p:not([style*=line-height]),.paper-content td li:not([style*=line-height]),.paper-content th p:not([style*=line-height]),.paper-content th li:not([style*=line-height]){line-height:1}.paper-content td p:not([style*=margin]),.paper-content th p:not([style*=margin]){margin:0}.paper-content .sobree-hang>li{list-style:none}.paper-content .sobree-hang>li:before{display:inline-block;box-sizing:border-box;width:var(--sobree-list-hang, 0);margin-left:calc(-1 * var(--sobree-list-hang, 0));white-space:nowrap;color:var(--sobree-marker-color, currentColor);font-family:var(--sobree-marker-font, inherit);font-size:var(--sobree-marker-size, inherit)}.paper-content .sobree-hang.lst-bullet>li:before{content:var(--sobree-bullet, "•")}.paper-content .sobree-hang.lst-decimal>li:before{content:var(--mk-pre, "") counter(list-item,decimal) var(--mk-suf, ".")}.paper-content .sobree-hang.lst-decimal-zero>li:before{content:var(--mk-pre, "") counter(list-item,decimal-leading-zero) var(--mk-suf, ".")}.paper-content .sobree-hang.lst-lower-latin>li:before{content:var(--mk-pre, "") counter(list-item,lower-latin) var(--mk-suf, ".")}.paper-content .sobree-hang.lst-upper-latin>li:before{content:var(--mk-pre, "") counter(list-item,upper-latin) var(--mk-suf, ".")}.paper-content .sobree-hang.lst-lower-roman>li:before{content:var(--mk-pre, "") counter(list-item,lower-roman) var(--mk-suf, ".")}.paper-content .sobree-hang.lst-upper-roman>li:before{content:var(--mk-pre, "") counter(list-item,upper-roman) var(--mk-suf, ".")}.paper-content .sobree-tab-spread{display:flex;justify-content:space-between;align-items:baseline;gap:1em;white-space:nowrap}.paper-content .sobree-tab-spread .sobree-tab-spread__before,.paper-content .sobree-tab-spread .sobree-tab-spread__after{white-space:pre-wrap;min-width:0}.paper-content table.sobree-table-bordered td,.paper-content table.sobree-table-bordered th{
|
|
1
|
+
.sobree-viewport{position:relative;overflow:hidden;overscroll-behavior:contain;touch-action:none;background:#ececee}.sobree-viewport__stage{position:absolute;top:0;left:0;transform-origin:0 0}.sobree-viewport__stage.is-gesturing,.sobree-viewport__stage.is-animating{will-change:transform}.sobree-viewport__stage.is-animating{transition:transform .32s cubic-bezier(.2,.7,.2,1)}.sobree-viewport__slot{display:block}.sobree-editor{position:relative;outline:none}.sobree-editor>:first-child{margin-top:0}.sobree-editor p,.sobree-editor h1,.sobree-editor h2,.sobree-editor h3,.sobree-editor h4,.sobree-editor h5,.sobree-editor h6,.sobree-editor ul,.sobree-editor ol,.sobree-editor li,.sobree-editor blockquote,.sobree-editor pre{margin:0;padding:0}.sobree-editor ul,.sobree-editor ol{padding-left:1.5em}.sobree-editor li.sobree-li-continuation{list-style-type:none}.sobree-editor li.sobree-li-continuation::marker{content:""}.sobree-editor .sobree-fragment-continued{text-align-last:justify}.sobree-editor .sobree-footnote-ref a{color:inherit;text-decoration:none}.sobree-editor .sobree-footnote-ref a:hover{text-decoration:underline}.sobree-editor .sobree-footnotes{margin-top:2em;padding-top:.5em;border-top:1pt solid currentColor;font-size:.85em}.sobree-editor .sobree-footnotes__list{padding-left:1.5em}.sobree-editor .sobree-footnotes__item{margin:.25em 0}.sobree-editor ins.sobree-revision-ins{text-decoration:underline}.sobree-editor del.sobree-revision-del{text-decoration:line-through}.sobree-editor .sobree-revision-format{text-decoration:underline dashed var(--sobree-format-revision-color, currentColor);text-underline-offset:3px}.sobree-editor [data-block-revision=ins]:after,.sobree-editor [data-block-revision=del]:after{content:" ¶";color:var(--sobree-block-revision-color, currentColor);opacity:.65;font-weight:600;-webkit-user-select:none;user-select:none}.sobree-editor [data-block-revision=del]:after{text-decoration:line-through}.sobree-editor .sobree-comment-range{background:var(--sobree-comment-range-bg, rgba(255, 217, 0, .25));border-bottom:1px dotted var(--sobree-comment-range-border, rgba(180, 130, 0, .5))}.sobree-editor .sobree-comment-ref{display:inline;font-size:.85em;margin:0 .1em}.sobree-editor .sobree-comment-ref a{color:inherit;text-decoration:none}.sobree-editor .sobree-comment-ref a:hover{filter:brightness(.7)}.sobree-editor h1,.sobree-editor h2,.sobree-editor h3,.sobree-editor h4,.sobree-editor h5,.sobree-editor h6{font-size:inherit;font-weight:inherit}.sobree-editor table{border-collapse:collapse;width:100%;position:relative}.sobree-editor th,.sobree-editor td{border:none;padding:0 .08in;vertical-align:top;transition:border-color .12s ease}.sobree-editor .sobree-section-break{display:flex;align-items:center;gap:8px;margin:8px 0;color:var(--fg-subtle, #7c7764);font-size:11px;letter-spacing:.04em;text-transform:uppercase;-webkit-user-select:none;user-select:none}.sobree-editor .sobree-section-break--continuous{visibility:hidden;height:0;margin:0;padding:0;border:none;overflow:hidden;font-size:0;line-height:0}.sobree-editor .sobree-section-break:before,.sobree-editor .sobree-section-break:after{content:"";flex:1;border-top:1px dashed var(--border, #dedbd0)}.sobree-editor .sobree-section-break__label{flex:none;padding:0 6px;background:var(--bg-elevated, #fff)}.sobree-editor .sobree-textbox-frame p{line-height:1.2}.sobree-editor .paper-content p,.sobree-editor .paper-content li,.sobree-editor .paper-header p,.sobree-editor .paper-header li,.sobree-editor .paper-footer p,.sobree-editor .paper-footer li,.sobree-editor .sobree-textbox-frame p{white-space:pre-wrap}.sobree-editor .sobree-section-trailer-empty{height:0;line-height:0;font-size:0;margin:0;padding:0;overflow:hidden}.sobree-editor .sobree-textbox-frame--placeholder{border:1px solid var(--border, #c8c4b8)}.sobree-editor .sobree-textbox-frame--placeholder.sobree-textbox-frame--filled{border:none;z-index:-1}.sobree-editor img.is-selected{outline:2px solid var(--sobree-primary, #d4521f);outline-offset:2px}.sobree-image-resize-handle{position:absolute;width:16px;height:16px;background:var(--sobree-primary, #d4521f);border:2px solid #fff;border-radius:3px;cursor:nwse-resize;z-index:1000;-webkit-user-select:none;user-select:none}.paper-stack{display:flex;flex-direction:column;padding:48px;gap:28px;outline:none}.paper-row{display:flex;flex-direction:row;align-items:flex-start;gap:24px}.paper{position:relative;background:#fff;border:1px solid rgba(0,0,0,.3);box-shadow:0 1px 2px #00000014,0 18px 60px #0000001f;padding-top:var(--margin-top, 25mm);padding-right:var(--margin-right, 20mm);padding-bottom:var(--margin-bottom, 25mm);padding-left:var(--margin-left, 20mm);overflow:hidden;flex:none}.paper-header,.paper-footer{position:absolute;left:var(--margin-left, 20mm);right:var(--margin-right, 20mm);font-size:10pt;color:#555;white-space:pre-wrap}.paper-header{top:0;min-height:var(--margin-top, 25mm);padding-top:var(--header-offset-mm, 12.7mm);padding-bottom:4mm;border-bottom:1px dashed transparent}.paper-footer{bottom:0;min-height:var(--margin-bottom, 25mm);padding-top:4mm;text-align:center;border-top:1px dashed transparent}.paper-anchors{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;isolation:isolate;z-index:1}.paper-anchors.is-empty{display:none}.paper-anchors-behind{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;isolation:isolate;z-index:0}.paper-anchors-behind.is-empty{display:none}.paper-zone-anchors{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;isolation:isolate;z-index:2}.paper-zone-anchors.is-empty{display:none}.paper-anchor{position:absolute;box-sizing:border-box;overflow:hidden}.paper-header>p,.paper-footer>p,.paper-header>ul,.paper-header>ol,.paper-footer>ul,.paper-footer>ol{margin:0}.paper-footnotes{position:absolute;left:var(--margin-left, 20mm);right:var(--margin-right, 20mm);bottom:var(--margin-bottom, 25mm);font-size:.85em;padding-top:.5em;border-top:1pt solid currentColor;background:#fffffff5;z-index:1;max-height:40%;overflow:hidden}.paper-footnotes.is-empty{display:none}.paper-comments{flex:0 0 70mm;max-width:70mm;font-size:.85em;padding:0 .5em;align-self:stretch;overflow-y:auto}.paper-comments.is-empty{display:none}.paper-footnotes .sobree-footnotes__list{margin:0;padding-left:1.5em}.paper-footnotes .sobree-footnotes__item{margin:.25em 0}.paper-content a{color:inherit;text-decoration:none}.paper-content{position:relative;height:100%;min-height:100px;display:flow-root}.paper-content td p:not([style*=line-height]),.paper-content td li:not([style*=line-height]),.paper-content th p:not([style*=line-height]),.paper-content th li:not([style*=line-height]){line-height:1}.paper-content td p:not([style*=margin]),.paper-content th p:not([style*=margin]){margin:0}.paper-content .sobree-hang>li{list-style:none}.paper-content .sobree-hang>li:before{display:inline-block;box-sizing:border-box;width:var(--sobree-list-hang, 0);margin-left:calc(-1 * var(--sobree-list-hang, 0));white-space:nowrap;color:var(--sobree-marker-color, currentColor);font-family:var(--sobree-marker-font, inherit);font-size:var(--sobree-marker-size, inherit)}.paper-content .sobree-hang.lst-bullet>li:before{content:var(--sobree-bullet, "•")}.paper-content .sobree-hang.lst-decimal>li:before{content:var(--mk-pre, "") counter(list-item,decimal) var(--mk-suf, ".")}.paper-content .sobree-hang.lst-decimal-zero>li:before{content:var(--mk-pre, "") counter(list-item,decimal-leading-zero) var(--mk-suf, ".")}.paper-content .sobree-hang.lst-lower-latin>li:before{content:var(--mk-pre, "") counter(list-item,lower-latin) var(--mk-suf, ".")}.paper-content .sobree-hang.lst-upper-latin>li:before{content:var(--mk-pre, "") counter(list-item,upper-latin) var(--mk-suf, ".")}.paper-content .sobree-hang.lst-lower-roman>li:before{content:var(--mk-pre, "") counter(list-item,lower-roman) var(--mk-suf, ".")}.paper-content .sobree-hang.lst-upper-roman>li:before{content:var(--mk-pre, "") counter(list-item,upper-roman) var(--mk-suf, ".")}.paper-content .sobree-tab-spread{display:flex;justify-content:space-between;align-items:baseline;gap:1em;white-space:nowrap}.paper-content .sobree-tab-spread .sobree-tab-spread__before,.paper-content .sobree-tab-spread .sobree-tab-spread__after{white-space:pre-wrap;min-width:0}.paper-content table.sobree-table-bordered td,.paper-content table.sobree-table-bordered th{padding:0 4px}.paper-content .sobree-cols-unequal{display:flex;align-items:flex-start}.paper-content .sobree-cols-unequal .sobree-col{flex:0 0 auto}.paper-stack .paper-content,.paper-stack .paper-header,.paper-stack .paper-footer{transition:opacity .2s ease}.paper-stack.is-zone-editing .paper-content,.paper-stack.is-zone-editing .paper-header,.paper-stack.is-zone-editing .paper-footer{opacity:.2}.paper-stack.is-zone-editing .paper-header[contenteditable=true],.paper-stack.is-zone-editing .paper-footer[contenteditable=true]{opacity:1}.paper-header[contenteditable=true],.paper-footer[contenteditable=true]{outline:2px dotted var(--primary, #c96f22);outline-offset:4px;background:var(--primary-soft, #fdf6ee);color:var(--fg-strong, #14130f);border-radius:2px}
|