@vectojs/markdown 0.21.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Markdown.d.ts +36 -0
- package/dist/index.js +20 -1
- package/dist/index.mjs +20 -1
- package/package.json +2 -2
package/dist/Markdown.d.ts
CHANGED
|
@@ -100,6 +100,33 @@ export interface MarkdownOptions {
|
|
|
100
100
|
virtualize?: boolean | {
|
|
101
101
|
overscan?: number;
|
|
102
102
|
};
|
|
103
|
+
/**
|
|
104
|
+
* Give every table body a fixed pixel viewport, so `Table` virtualizes its
|
|
105
|
+
* rows: only the rows inside that viewport (plus overscan) mount cells and
|
|
106
|
+
* project `row`/`gridcell` semantics. Off by default.
|
|
107
|
+
*
|
|
108
|
+
* This is **not** {@link MarkdownOptions.virtualize}, and the two are
|
|
109
|
+
* independent. That one windows top-level *blocks* and cannot be combined with
|
|
110
|
+
* streaming; this one windows the *rows inside one table* and works while
|
|
111
|
+
* streaming, because `Table.appendRows` already mounts lazily when virtualized.
|
|
112
|
+
* A streaming reader whose cost is dominated by wide tables wants this one.
|
|
113
|
+
*
|
|
114
|
+
* Opt-in rather than automatic because it is a layout change, not just a
|
|
115
|
+
* performance one: a virtualized `Table` sets its height to exactly this value
|
|
116
|
+
* and turns its body into an internally scrolling region, so a 200-row table
|
|
117
|
+
* stops being a 200-row-tall block in the document flow. Applying it past some
|
|
118
|
+
* row-count threshold would silently reshape long tables.
|
|
119
|
+
*
|
|
120
|
+
* Applies to **every** table in the document, short ones included — so a
|
|
121
|
+
* two-row table is also fixed to this height. That is deliberate: `Table` takes
|
|
122
|
+
* `viewportHeight` as `readonly` and builds its body clip in the constructor, so
|
|
123
|
+
* a table cannot start plain and become virtualized once it grows. Every
|
|
124
|
+
* streamed table is lexed with zero rows the moment its delimiter row arrives,
|
|
125
|
+
* so a row-count condition would exclude precisely the streaming documents this
|
|
126
|
+
* option exists for. Choose a height that suits the document's tables, or leave
|
|
127
|
+
* it unset for mixed content where a few short tables are the whole cost.
|
|
128
|
+
*/
|
|
129
|
+
tableViewportHeight?: number;
|
|
103
130
|
}
|
|
104
131
|
/**
|
|
105
132
|
* Renders Markdown content into a VectoJS entity tree using {@link marked}.
|
|
@@ -159,6 +186,15 @@ export declare class Markdown extends UIComponent {
|
|
|
159
186
|
private readonly virtualizeBlocks;
|
|
160
187
|
/** Overscan margin (px) added above/below the visible window before mounting. */
|
|
161
188
|
private readonly virtualOverscan;
|
|
189
|
+
/**
|
|
190
|
+
* Fixed body viewport for table blocks, from `opts.tableViewportHeight`; `0`
|
|
191
|
+
* leaves every table in `Table`'s classic grow-to-fit mode.
|
|
192
|
+
*
|
|
193
|
+
* Independent of {@link virtualizeBlocks}: that windows top-level blocks and
|
|
194
|
+
* is incompatible with streaming, whereas `Table`'s row virtualization works
|
|
195
|
+
* mid-stream because `appendRows` mounts lazily when virtualized.
|
|
196
|
+
*/
|
|
197
|
+
private readonly tableViewportHeight;
|
|
162
198
|
/** Top-level tokens that produce a child entity, in document order. */
|
|
163
199
|
private virtualTokens;
|
|
164
200
|
/** Fenwick tree over per-block strides (height + blockGap) when virtualizing. */
|
package/dist/index.js
CHANGED
|
@@ -3503,6 +3503,15 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
3503
3503
|
virtualizeBlocks;
|
|
3504
3504
|
/** Overscan margin (px) added above/below the visible window before mounting. */
|
|
3505
3505
|
virtualOverscan;
|
|
3506
|
+
/**
|
|
3507
|
+
* Fixed body viewport for table blocks, from `opts.tableViewportHeight`; `0`
|
|
3508
|
+
* leaves every table in `Table`'s classic grow-to-fit mode.
|
|
3509
|
+
*
|
|
3510
|
+
* Independent of {@link virtualizeBlocks}: that windows top-level blocks and
|
|
3511
|
+
* is incompatible with streaming, whereas `Table`'s row virtualization works
|
|
3512
|
+
* mid-stream because `appendRows` mounts lazily when virtualized.
|
|
3513
|
+
*/
|
|
3514
|
+
tableViewportHeight;
|
|
3506
3515
|
/** Top-level tokens that produce a child entity, in document order. */
|
|
3507
3516
|
virtualTokens = null;
|
|
3508
3517
|
/** Fenwick tree over per-block strides (height + blockGap) when virtualizing. */
|
|
@@ -3800,6 +3809,8 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
3800
3809
|
const virt = opts.virtualize;
|
|
3801
3810
|
this.virtualizeBlocks = virt === true || typeof virt === "object" && virt !== null;
|
|
3802
3811
|
this.virtualOverscan = typeof virt === "object" && virt !== null && typeof virt.overscan === "number" ? virt.overscan : 800;
|
|
3812
|
+
const tableViewport = opts.tableViewportHeight;
|
|
3813
|
+
this.tableViewportHeight = typeof tableViewport === "number" && Number.isFinite(tableViewport) && tableViewport > 0 ? tableViewport : 0;
|
|
3803
3814
|
this.content = new import_ui4.Stack({
|
|
3804
3815
|
direction: "vertical",
|
|
3805
3816
|
gap: this.theme.blockGap,
|
|
@@ -6266,7 +6277,15 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
6266
6277
|
borderColor: t.hrColor,
|
|
6267
6278
|
bg: t.tableBgColor,
|
|
6268
6279
|
headerBg: t.tableHeaderBgColor,
|
|
6269
|
-
selectable: this.selectable
|
|
6280
|
+
selectable: this.selectable,
|
|
6281
|
+
// 0 = Table's classic grow-to-fit mode, so the default is unchanged.
|
|
6282
|
+
// Applied unconditionally when set, including to a table that lexes
|
|
6283
|
+
// with zero rows: `Table.viewportHeight` is readonly and its body clip
|
|
6284
|
+
// is built in the constructor, so a table cannot become virtualized
|
|
6285
|
+
// later — and every streamed table starts empty and grows through
|
|
6286
|
+
// `appendRows`. Deciding by row count here would leave exactly the
|
|
6287
|
+
// streaming case this exists for permanently unvirtualized.
|
|
6288
|
+
viewportHeight: this.tableViewportHeight
|
|
6270
6289
|
}),
|
|
6271
6290
|
() => this.tableAffordances(tblToken)
|
|
6272
6291
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -3457,6 +3457,15 @@ var Markdown = class _Markdown extends UIComponent3 {
|
|
|
3457
3457
|
virtualizeBlocks;
|
|
3458
3458
|
/** Overscan margin (px) added above/below the visible window before mounting. */
|
|
3459
3459
|
virtualOverscan;
|
|
3460
|
+
/**
|
|
3461
|
+
* Fixed body viewport for table blocks, from `opts.tableViewportHeight`; `0`
|
|
3462
|
+
* leaves every table in `Table`'s classic grow-to-fit mode.
|
|
3463
|
+
*
|
|
3464
|
+
* Independent of {@link virtualizeBlocks}: that windows top-level blocks and
|
|
3465
|
+
* is incompatible with streaming, whereas `Table`'s row virtualization works
|
|
3466
|
+
* mid-stream because `appendRows` mounts lazily when virtualized.
|
|
3467
|
+
*/
|
|
3468
|
+
tableViewportHeight;
|
|
3460
3469
|
/** Top-level tokens that produce a child entity, in document order. */
|
|
3461
3470
|
virtualTokens = null;
|
|
3462
3471
|
/** Fenwick tree over per-block strides (height + blockGap) when virtualizing. */
|
|
@@ -3754,6 +3763,8 @@ var Markdown = class _Markdown extends UIComponent3 {
|
|
|
3754
3763
|
const virt = opts.virtualize;
|
|
3755
3764
|
this.virtualizeBlocks = virt === true || typeof virt === "object" && virt !== null;
|
|
3756
3765
|
this.virtualOverscan = typeof virt === "object" && virt !== null && typeof virt.overscan === "number" ? virt.overscan : 800;
|
|
3766
|
+
const tableViewport = opts.tableViewportHeight;
|
|
3767
|
+
this.tableViewportHeight = typeof tableViewport === "number" && Number.isFinite(tableViewport) && tableViewport > 0 ? tableViewport : 0;
|
|
3757
3768
|
this.content = new Stack({
|
|
3758
3769
|
direction: "vertical",
|
|
3759
3770
|
gap: this.theme.blockGap,
|
|
@@ -6220,7 +6231,15 @@ var Markdown = class _Markdown extends UIComponent3 {
|
|
|
6220
6231
|
borderColor: t.hrColor,
|
|
6221
6232
|
bg: t.tableBgColor,
|
|
6222
6233
|
headerBg: t.tableHeaderBgColor,
|
|
6223
|
-
selectable: this.selectable
|
|
6234
|
+
selectable: this.selectable,
|
|
6235
|
+
// 0 = Table's classic grow-to-fit mode, so the default is unchanged.
|
|
6236
|
+
// Applied unconditionally when set, including to a table that lexes
|
|
6237
|
+
// with zero rows: `Table.viewportHeight` is readonly and its body clip
|
|
6238
|
+
// is built in the constructor, so a table cannot become virtualized
|
|
6239
|
+
// later — and every streamed table starts empty and grows through
|
|
6240
|
+
// `appendRows`. Deciding by row count here would leave exactly the
|
|
6241
|
+
// streaming case this exists for permanently unvirtualized.
|
|
6242
|
+
viewportHeight: this.tableViewportHeight
|
|
6224
6243
|
}),
|
|
6225
6244
|
() => this.tableAffordances(tblToken)
|
|
6226
6245
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vectojs/markdown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@vectojs/ui": "workspace:*",
|
|
57
57
|
"esbuild": "^0.28.1",
|
|
58
58
|
"prettier": "^3.9.6",
|
|
59
|
-
"puppeteer-core": "^25.
|
|
59
|
+
"puppeteer-core": "^25.7.0",
|
|
60
60
|
"tsup": "^8.3.5",
|
|
61
61
|
"vitest": "^4.1.10"
|
|
62
62
|
}
|