@scrider/formatter 1.10.4 → 1.10.6
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/index.cjs +14 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -30,6 +30,15 @@ interface TablePresentation {
|
|
|
30
30
|
*/
|
|
31
31
|
defaultCellAlign?: TableCellAlign;
|
|
32
32
|
}
|
|
33
|
+
/** Default table border (HTML / clipboard / PDF host should share). */
|
|
34
|
+
declare const TABLE_BORDER_COLOR = "#e7e7e7";
|
|
35
|
+
/** Header shade fill — matches editor light `--color-bg-hover` (`#e9ecef`). */
|
|
36
|
+
declare const TABLE_HEADER_BG = "#e9ecef";
|
|
37
|
+
/**
|
|
38
|
+
* Zebra body-row fill — canon aligned with editor/demo light
|
|
39
|
+
* `--color-table-zebra` (`#f6f8fa`, arch-set1 #12).
|
|
40
|
+
*/
|
|
41
|
+
declare const TABLE_ZEBRA_BG = "#f6f8fa";
|
|
33
42
|
interface ResolvedTablePresentation {
|
|
34
43
|
grid: boolean;
|
|
35
44
|
line: boolean;
|
|
@@ -41,8 +50,12 @@ interface ResolvedTablePresentation {
|
|
|
41
50
|
defaultCellAlign: TableCellAlign;
|
|
42
51
|
}
|
|
43
52
|
declare function resolveTablePresentation(presentation?: TablePresentation): ResolvedTablePresentation;
|
|
44
|
-
/**
|
|
45
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Match editor/CSS zebra on `tbody tr:nth-child(even) td`.
|
|
55
|
+
* First body row stays light; 2nd, 4th, … get {@link TABLE_ZEBRA_BG}.
|
|
56
|
+
* `headerRowCount` is unused (thead/tbody split) — kept for call-site stability.
|
|
57
|
+
*/
|
|
58
|
+
declare function isZebraBodyRow(_headerRowCount: number, bodyRowIndex: number): boolean;
|
|
46
59
|
|
|
47
60
|
/**
|
|
48
61
|
* Document-level metadata (Scrider format extension).
|
|
@@ -2266,4 +2279,4 @@ declare function collectAdjacentTableLines<T extends {
|
|
|
2266
2279
|
*/
|
|
2267
2280
|
declare function extractTableRegion(ops: readonly Op[], hintOpIdx: number): TableRegion | null;
|
|
2268
2281
|
|
|
2269
|
-
export { ALERT_TYPES, type AlertBlockData, type AlertType, type AlignType, BOX_FLOAT_VALUES, BOX_OVERFLOW_VALUES, type BlockContext, type BlockHandler, BlockHandlerRegistry, type BlockRenderOptions, type BoxBlockData, type BoxFloat, type BoxOpAttributes, type BoxOverflow, BrowserDOMAdapter, type CellAlign, type CellData, type CellHorizontalAlign, type CellVerticalAlign, type CodeWidgetEmbedUrlFn, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type DocumentPresentation, type EmbedIsolationOptions, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatRenderContext, type FormatScope, HEADER_SIZE_PRESETS, type HtmlToDeltaOptions, LINE_HEIGHT_BLOCK_TAGS, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, PARAGRAPH_SPACING_BLOCK_TAGS, Registry, type RenderProfile, type ResolvedDocumentPresentation, type ResolvedTablePresentation, SCRIDER_LINE_HEIGHT_KEY, SCRIDER_MARGIN_AFTER_KEY, SCRIDER_MARGIN_BEFORE_KEY, SCRIDER_TEXT_INDENT_KEY, type SanitizeOptions, type ScriderDocumentMetadata, TEXT_INDENT_BLOCK_TAGS, type TableBlockData, type TableBlockFloat, type TableCellAlign, type TableCellCoords, type TableColAlignType, type TablePresentation, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockLineHeightStyleParts, blockMarginAfterStyleParts, blockMarginBeforeStyleParts, blockParagraphMarginStyleParts, blockPresentationStyleParts, blockTextIndentStyleParts, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, codeWidgetFormat, collectAdjacentTableLines, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToDom, deltaToHtml, deltaToMarkdown, dividerFormat, documentMetadataToPresentation, documentPresentationStyleParts, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, headingPolicyStyleParts, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isAdjacentSimpleTableGridBoundary, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, isZebraBodyRow, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, parseScriderLineHeightMultiplier, parseScriderMarginAfterEm, parseScriderMarginBeforeEm, parseScriderMarginEm, preloadRemark, renderDelta, resolveCodeWidgetEmbedSrc, resolveDocumentPresentation, resolveHeadingPolicy, resolveTablePresentation, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableCellCoordsFromAttributes, tableCellCoordsFromOp, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toCodeWidgetEmbedUrl, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
|
|
2282
|
+
export { ALERT_TYPES, type AlertBlockData, type AlertType, type AlignType, BOX_FLOAT_VALUES, BOX_OVERFLOW_VALUES, type BlockContext, type BlockHandler, BlockHandlerRegistry, type BlockRenderOptions, type BoxBlockData, type BoxFloat, type BoxOpAttributes, type BoxOverflow, BrowserDOMAdapter, type CellAlign, type CellData, type CellHorizontalAlign, type CellVerticalAlign, type CodeWidgetEmbedUrlFn, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type DocumentPresentation, type EmbedIsolationOptions, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatRenderContext, type FormatScope, HEADER_SIZE_PRESETS, type HtmlToDeltaOptions, LINE_HEIGHT_BLOCK_TAGS, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, PARAGRAPH_SPACING_BLOCK_TAGS, Registry, type RenderProfile, type ResolvedDocumentPresentation, type ResolvedTablePresentation, SCRIDER_LINE_HEIGHT_KEY, SCRIDER_MARGIN_AFTER_KEY, SCRIDER_MARGIN_BEFORE_KEY, SCRIDER_TEXT_INDENT_KEY, type SanitizeOptions, type ScriderDocumentMetadata, TABLE_BORDER_COLOR, TABLE_HEADER_BG, TABLE_ZEBRA_BG, TEXT_INDENT_BLOCK_TAGS, type TableBlockData, type TableBlockFloat, type TableCellAlign, type TableCellCoords, type TableColAlignType, type TablePresentation, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockLineHeightStyleParts, blockMarginAfterStyleParts, blockMarginBeforeStyleParts, blockParagraphMarginStyleParts, blockPresentationStyleParts, blockTextIndentStyleParts, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, codeWidgetFormat, collectAdjacentTableLines, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToDom, deltaToHtml, deltaToMarkdown, dividerFormat, documentMetadataToPresentation, documentPresentationStyleParts, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, headingPolicyStyleParts, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isAdjacentSimpleTableGridBoundary, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, isZebraBodyRow, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, parseScriderLineHeightMultiplier, parseScriderMarginAfterEm, parseScriderMarginBeforeEm, parseScriderMarginEm, preloadRemark, renderDelta, resolveCodeWidgetEmbedSrc, resolveDocumentPresentation, resolveHeadingPolicy, resolveTablePresentation, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableCellCoordsFromAttributes, tableCellCoordsFromOp, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toCodeWidgetEmbedUrl, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,15 @@ interface TablePresentation {
|
|
|
30
30
|
*/
|
|
31
31
|
defaultCellAlign?: TableCellAlign;
|
|
32
32
|
}
|
|
33
|
+
/** Default table border (HTML / clipboard / PDF host should share). */
|
|
34
|
+
declare const TABLE_BORDER_COLOR = "#e7e7e7";
|
|
35
|
+
/** Header shade fill — matches editor light `--color-bg-hover` (`#e9ecef`). */
|
|
36
|
+
declare const TABLE_HEADER_BG = "#e9ecef";
|
|
37
|
+
/**
|
|
38
|
+
* Zebra body-row fill — canon aligned with editor/demo light
|
|
39
|
+
* `--color-table-zebra` (`#f6f8fa`, arch-set1 #12).
|
|
40
|
+
*/
|
|
41
|
+
declare const TABLE_ZEBRA_BG = "#f6f8fa";
|
|
33
42
|
interface ResolvedTablePresentation {
|
|
34
43
|
grid: boolean;
|
|
35
44
|
line: boolean;
|
|
@@ -41,8 +50,12 @@ interface ResolvedTablePresentation {
|
|
|
41
50
|
defaultCellAlign: TableCellAlign;
|
|
42
51
|
}
|
|
43
52
|
declare function resolveTablePresentation(presentation?: TablePresentation): ResolvedTablePresentation;
|
|
44
|
-
/**
|
|
45
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Match editor/CSS zebra on `tbody tr:nth-child(even) td`.
|
|
55
|
+
* First body row stays light; 2nd, 4th, … get {@link TABLE_ZEBRA_BG}.
|
|
56
|
+
* `headerRowCount` is unused (thead/tbody split) — kept for call-site stability.
|
|
57
|
+
*/
|
|
58
|
+
declare function isZebraBodyRow(_headerRowCount: number, bodyRowIndex: number): boolean;
|
|
46
59
|
|
|
47
60
|
/**
|
|
48
61
|
* Document-level metadata (Scrider format extension).
|
|
@@ -2266,4 +2279,4 @@ declare function collectAdjacentTableLines<T extends {
|
|
|
2266
2279
|
*/
|
|
2267
2280
|
declare function extractTableRegion(ops: readonly Op[], hintOpIdx: number): TableRegion | null;
|
|
2268
2281
|
|
|
2269
|
-
export { ALERT_TYPES, type AlertBlockData, type AlertType, type AlignType, BOX_FLOAT_VALUES, BOX_OVERFLOW_VALUES, type BlockContext, type BlockHandler, BlockHandlerRegistry, type BlockRenderOptions, type BoxBlockData, type BoxFloat, type BoxOpAttributes, type BoxOverflow, BrowserDOMAdapter, type CellAlign, type CellData, type CellHorizontalAlign, type CellVerticalAlign, type CodeWidgetEmbedUrlFn, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type DocumentPresentation, type EmbedIsolationOptions, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatRenderContext, type FormatScope, HEADER_SIZE_PRESETS, type HtmlToDeltaOptions, LINE_HEIGHT_BLOCK_TAGS, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, PARAGRAPH_SPACING_BLOCK_TAGS, Registry, type RenderProfile, type ResolvedDocumentPresentation, type ResolvedTablePresentation, SCRIDER_LINE_HEIGHT_KEY, SCRIDER_MARGIN_AFTER_KEY, SCRIDER_MARGIN_BEFORE_KEY, SCRIDER_TEXT_INDENT_KEY, type SanitizeOptions, type ScriderDocumentMetadata, TEXT_INDENT_BLOCK_TAGS, type TableBlockData, type TableBlockFloat, type TableCellAlign, type TableCellCoords, type TableColAlignType, type TablePresentation, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockLineHeightStyleParts, blockMarginAfterStyleParts, blockMarginBeforeStyleParts, blockParagraphMarginStyleParts, blockPresentationStyleParts, blockTextIndentStyleParts, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, codeWidgetFormat, collectAdjacentTableLines, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToDom, deltaToHtml, deltaToMarkdown, dividerFormat, documentMetadataToPresentation, documentPresentationStyleParts, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, headingPolicyStyleParts, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isAdjacentSimpleTableGridBoundary, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, isZebraBodyRow, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, parseScriderLineHeightMultiplier, parseScriderMarginAfterEm, parseScriderMarginBeforeEm, parseScriderMarginEm, preloadRemark, renderDelta, resolveCodeWidgetEmbedSrc, resolveDocumentPresentation, resolveHeadingPolicy, resolveTablePresentation, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableCellCoordsFromAttributes, tableCellCoordsFromOp, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toCodeWidgetEmbedUrl, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
|
|
2282
|
+
export { ALERT_TYPES, type AlertBlockData, type AlertType, type AlignType, BOX_FLOAT_VALUES, BOX_OVERFLOW_VALUES, type BlockContext, type BlockHandler, BlockHandlerRegistry, type BlockRenderOptions, type BoxBlockData, type BoxFloat, type BoxOpAttributes, type BoxOverflow, BrowserDOMAdapter, type CellAlign, type CellData, type CellHorizontalAlign, type CellVerticalAlign, type CodeWidgetEmbedUrlFn, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type DocumentPresentation, type EmbedIsolationOptions, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatRenderContext, type FormatScope, HEADER_SIZE_PRESETS, type HtmlToDeltaOptions, LINE_HEIGHT_BLOCK_TAGS, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, PARAGRAPH_SPACING_BLOCK_TAGS, Registry, type RenderProfile, type ResolvedDocumentPresentation, type ResolvedTablePresentation, SCRIDER_LINE_HEIGHT_KEY, SCRIDER_MARGIN_AFTER_KEY, SCRIDER_MARGIN_BEFORE_KEY, SCRIDER_TEXT_INDENT_KEY, type SanitizeOptions, type ScriderDocumentMetadata, TABLE_BORDER_COLOR, TABLE_HEADER_BG, TABLE_ZEBRA_BG, TEXT_INDENT_BLOCK_TAGS, type TableBlockData, type TableBlockFloat, type TableCellAlign, type TableCellCoords, type TableColAlignType, type TablePresentation, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockLineHeightStyleParts, blockMarginAfterStyleParts, blockMarginBeforeStyleParts, blockParagraphMarginStyleParts, blockPresentationStyleParts, blockTextIndentStyleParts, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, codeWidgetFormat, collectAdjacentTableLines, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToDom, deltaToHtml, deltaToMarkdown, dividerFormat, documentMetadataToPresentation, documentPresentationStyleParts, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, headingPolicyStyleParts, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isAdjacentSimpleTableGridBoundary, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, isZebraBodyRow, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, parseScriderLineHeightMultiplier, parseScriderMarginAfterEm, parseScriderMarginBeforeEm, parseScriderMarginEm, preloadRemark, renderDelta, resolveCodeWidgetEmbedSrc, resolveDocumentPresentation, resolveHeadingPolicy, resolveTablePresentation, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableCellCoordsFromAttributes, tableCellCoordsFromOp, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toCodeWidgetEmbedUrl, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
|
package/dist/index.js
CHANGED
|
@@ -3213,9 +3213,12 @@ function headingPolicyStyleParts(tag, blockAttributes, policy) {
|
|
|
3213
3213
|
}
|
|
3214
3214
|
|
|
3215
3215
|
// src/conversion/html/table-presentation.ts
|
|
3216
|
-
var
|
|
3217
|
-
var
|
|
3218
|
-
var
|
|
3216
|
+
var TABLE_BORDER_COLOR = "#e7e7e7";
|
|
3217
|
+
var TABLE_HEADER_BG = "#e9ecef";
|
|
3218
|
+
var TABLE_ZEBRA_BG = "#f6f8fa";
|
|
3219
|
+
var DEFAULT_BORDER_COLOR = TABLE_BORDER_COLOR;
|
|
3220
|
+
var DEFAULT_HEADER_BG = TABLE_HEADER_BG;
|
|
3221
|
+
var DEFAULT_ZEBRA_BG = TABLE_ZEBRA_BG;
|
|
3219
3222
|
var CELL_PADDING = "6px 13px";
|
|
3220
3223
|
function resolveTablePresentation(presentation) {
|
|
3221
3224
|
return {
|
|
@@ -3229,8 +3232,8 @@ function resolveTablePresentation(presentation) {
|
|
|
3229
3232
|
defaultCellAlign: presentation?.defaultCellAlign ?? "left"
|
|
3230
3233
|
};
|
|
3231
3234
|
}
|
|
3232
|
-
function isZebraBodyRow(
|
|
3233
|
-
return
|
|
3235
|
+
function isZebraBodyRow(_headerRowCount, bodyRowIndex) {
|
|
3236
|
+
return bodyRowIndex % 2 === 1;
|
|
3234
3237
|
}
|
|
3235
3238
|
function isTableCellAlign(value) {
|
|
3236
3239
|
return value === "left" || value === "center" || value === "right";
|
|
@@ -6165,6 +6168,9 @@ export {
|
|
|
6165
6168
|
SCRIDER_MARGIN_AFTER_KEY,
|
|
6166
6169
|
SCRIDER_MARGIN_BEFORE_KEY,
|
|
6167
6170
|
SCRIDER_TEXT_INDENT_KEY,
|
|
6171
|
+
TABLE_BORDER_COLOR,
|
|
6172
|
+
TABLE_HEADER_BG,
|
|
6173
|
+
TABLE_ZEBRA_BG,
|
|
6168
6174
|
TEXT_INDENT_BLOCK_TAGS,
|
|
6169
6175
|
alertBlockHandler,
|
|
6170
6176
|
alignFormat,
|