verstak 0.23.105 → 0.23.106
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/build/dist/source/core/Cursor.d.ts +7 -7
- package/build/dist/source/core/Cursor.js +32 -32
- package/build/dist/source/core/Utils.js +1 -1
- package/build/dist/source/core/VBlock.d.ts +2 -2
- package/build/dist/source/core/VBlock.js +15 -14
- package/build/dist/source/html/Blocks.d.ts +4 -4
- package/build/dist/source/html/Blocks.js +13 -13
- package/build/dist/source/html/HtmlBlocks.d.ts +1 -1
- package/build/dist/source/html/HtmlBlocks.js +1 -1
- package/package.json +1 -1
|
@@ -18,11 +18,11 @@ export interface ElasticSize {
|
|
|
18
18
|
export interface TrackSize extends ElasticSize {
|
|
19
19
|
track?: string | number;
|
|
20
20
|
}
|
|
21
|
-
export type
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
export type Bounds = undefined | string | number | {
|
|
22
|
+
widthInCells?: number;
|
|
23
|
+
heightInCells?: number;
|
|
24
|
+
widthOverlap?: boolean;
|
|
25
|
+
heightOverlap?: boolean;
|
|
26
26
|
};
|
|
27
27
|
export declare class Cursor {
|
|
28
28
|
static readonly UndefinedCellRange: Readonly<{
|
|
@@ -32,7 +32,7 @@ export declare class Cursor {
|
|
|
32
32
|
y2: 0;
|
|
33
33
|
}>;
|
|
34
34
|
reset(): void;
|
|
35
|
-
onwards(
|
|
35
|
+
onwards(bounds: Bounds): CellRange;
|
|
36
36
|
lineFeed(): void;
|
|
37
37
|
}
|
|
38
38
|
export declare class GridCursor extends Cursor {
|
|
@@ -44,6 +44,6 @@ export declare class GridCursor extends Cursor {
|
|
|
44
44
|
private rowCursor;
|
|
45
45
|
private newRowCursor;
|
|
46
46
|
reset(): void;
|
|
47
|
-
onwards(
|
|
47
|
+
onwards(bounds: Bounds): CellRange;
|
|
48
48
|
lineFeed(): void;
|
|
49
49
|
}
|
|
@@ -12,7 +12,7 @@ export var Align;
|
|
|
12
12
|
})(Align || (Align = {}));
|
|
13
13
|
export class Cursor {
|
|
14
14
|
reset() { }
|
|
15
|
-
onwards(
|
|
15
|
+
onwards(bounds) { return Cursor.UndefinedCellRange; }
|
|
16
16
|
lineFeed() { }
|
|
17
17
|
}
|
|
18
18
|
Cursor.UndefinedCellRange = Object.freeze({ x1: 0, y1: 0, x2: 0, y2: 0 });
|
|
@@ -36,59 +36,59 @@ export class GridCursor extends Cursor {
|
|
|
36
36
|
this.rowCursor = 0;
|
|
37
37
|
this.newRowCursor = 0;
|
|
38
38
|
}
|
|
39
|
-
onwards(
|
|
39
|
+
onwards(bounds) {
|
|
40
40
|
var _a, _b, _c, _d;
|
|
41
41
|
let result;
|
|
42
|
-
if (typeof (
|
|
43
|
-
result = parseCellRange(
|
|
42
|
+
if (typeof (bounds) === "string") {
|
|
43
|
+
result = parseCellRange(bounds, { x1: 0, y1: 0, x2: 0, y2: 0 });
|
|
44
44
|
absolutizeCellRange(result, this.columnCursor + 1, this.rowCursor + 1, this.maxColumnCount || Infinity, this.maxRowCount || Infinity, result);
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
let
|
|
48
|
-
let
|
|
49
|
-
let
|
|
50
|
-
let
|
|
51
|
-
if (typeof (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
let w;
|
|
48
|
+
let h;
|
|
49
|
+
let wOverlap;
|
|
50
|
+
let hOverlap;
|
|
51
|
+
if (typeof (bounds) === "number") {
|
|
52
|
+
w = bounds;
|
|
53
|
+
h = 1;
|
|
54
|
+
wOverlap = hOverlap = false;
|
|
55
55
|
}
|
|
56
|
-
else if (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
else if (bounds) {
|
|
57
|
+
w = (_a = bounds.widthInCells) !== null && _a !== void 0 ? _a : 1;
|
|
58
|
+
h = (_b = bounds.heightInCells) !== null && _b !== void 0 ? _b : 1;
|
|
59
|
+
wOverlap = (_c = bounds.widthOverlap) !== null && _c !== void 0 ? _c : false;
|
|
60
|
+
hOverlap = (_d = bounds.heightOverlap) !== null && _d !== void 0 ? _d : false;
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
w = 1;
|
|
64
|
+
h = 1;
|
|
65
|
+
wOverlap = hOverlap = false;
|
|
66
66
|
}
|
|
67
67
|
const totalColumnCount = this.maxColumnCount !== 0 ? this.maxColumnCount : this.actualColumnCount;
|
|
68
68
|
const totalRowCount = this.maxRowCount !== 0 ? this.maxRowCount : this.actualRowCount;
|
|
69
69
|
result = { x1: 0, y1: 0, x2: 0, y2: 0 };
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
if (
|
|
70
|
+
if (w === 0)
|
|
71
|
+
w = totalColumnCount || 1;
|
|
72
|
+
if (w >= 0) {
|
|
73
73
|
result.x1 = this.columnCursor + 1;
|
|
74
|
-
result.x2 = absolutizePosition(result.x1 +
|
|
75
|
-
if (!
|
|
74
|
+
result.x2 = absolutizePosition(result.x1 + w - 1, 0, this.maxColumnCount || Infinity);
|
|
75
|
+
if (!wOverlap)
|
|
76
76
|
this.columnCursor = result.x2;
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
79
|
-
result.x1 = Math.max(this.columnCursor +
|
|
79
|
+
result.x1 = Math.max(this.columnCursor + w, 1);
|
|
80
80
|
result.x2 = this.columnCursor;
|
|
81
81
|
}
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
if (
|
|
82
|
+
if (h === 0)
|
|
83
|
+
h = totalRowCount || 1;
|
|
84
|
+
if (h >= 0) {
|
|
85
85
|
result.y1 = this.rowCursor + 1;
|
|
86
|
-
result.y2 = absolutizePosition(result.y1 +
|
|
87
|
-
if (!
|
|
86
|
+
result.y2 = absolutizePosition(result.y1 + h - 1, 0, this.maxRowCount || Infinity);
|
|
87
|
+
if (!hOverlap && result.y2 > this.newRowCursor)
|
|
88
88
|
this.newRowCursor = result.y2;
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
|
-
result.y1 = Math.max(this.rowCursor +
|
|
91
|
+
result.y1 = Math.max(this.rowCursor + h, 1);
|
|
92
92
|
result.y2 = this.rowCursor;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LoggingOptions, Item, CollectionReader, MemberOptions } from "reactronic";
|
|
2
2
|
import { CellRange } from "./CellRange";
|
|
3
|
-
import { Cursor, Align,
|
|
3
|
+
import { Cursor, Align, Bounds } from "./Cursor";
|
|
4
4
|
export type Callback<T = unknown> = (native: T) => void;
|
|
5
5
|
export type Operation<T = unknown, M = unknown, R = void> = (block: VBlock<T, M, R>, base: () => R) => R;
|
|
6
6
|
export type AsyncOperation<T = unknown, M = unknown> = (block: VBlock<T, M, Promise<void>>) => Promise<void>;
|
|
@@ -28,7 +28,7 @@ export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
|
|
|
28
28
|
abstract readonly driver: AbstractDriver<T>;
|
|
29
29
|
abstract readonly body: Readonly<BlockBody<T, M, R>>;
|
|
30
30
|
abstract model: M;
|
|
31
|
-
abstract
|
|
31
|
+
abstract bounds: Bounds;
|
|
32
32
|
abstract widthGrowth: number;
|
|
33
33
|
abstract minWidth: string;
|
|
34
34
|
abstract maxWidth: string;
|
|
@@ -241,7 +241,7 @@ class VBlockImpl extends VBlock {
|
|
|
241
241
|
this.driver = driver;
|
|
242
242
|
this.body = body;
|
|
243
243
|
this.model = undefined;
|
|
244
|
-
this.
|
|
244
|
+
this.assignedBounds = undefined;
|
|
245
245
|
this.assignedStyle = false;
|
|
246
246
|
this.appliedCellRange = Cursor.UndefinedCellRange;
|
|
247
247
|
this.appliedWidthGrowth = 0;
|
|
@@ -276,16 +276,16 @@ class VBlockImpl extends VBlock {
|
|
|
276
276
|
render(_triggers) {
|
|
277
277
|
renderNow(this.item);
|
|
278
278
|
}
|
|
279
|
-
get
|
|
280
|
-
set
|
|
281
|
-
if (this.
|
|
279
|
+
get bounds() { return this.assignedBounds; }
|
|
280
|
+
set bounds(value) {
|
|
281
|
+
if (this.assignedBounds !== undefined)
|
|
282
282
|
throw new Error("cells can be assigned only once during rendering");
|
|
283
283
|
const cellRange = this.host.cursor.onwards(value);
|
|
284
284
|
if (!equalCellRanges(cellRange, this.appliedCellRange)) {
|
|
285
285
|
this.driver.applyCellRange(this, cellRange);
|
|
286
286
|
this.appliedCellRange = cellRange;
|
|
287
287
|
}
|
|
288
|
-
this.
|
|
288
|
+
this.assignedBounds = value !== null && value !== void 0 ? value : {};
|
|
289
289
|
}
|
|
290
290
|
get widthGrowth() { return this.appliedWidthGrowth; }
|
|
291
291
|
set widthGrowth(value) {
|
|
@@ -428,9 +428,8 @@ function runRenderNestedTreesThenDo(error, action) {
|
|
|
428
428
|
let promised = undefined;
|
|
429
429
|
try {
|
|
430
430
|
children.endMerge(error);
|
|
431
|
-
for (const item of children.removedItems(true))
|
|
431
|
+
for (const item of children.removedItems(true))
|
|
432
432
|
triggerFinalization(item, true, true);
|
|
433
|
-
}
|
|
434
433
|
if (!error) {
|
|
435
434
|
const ownerIsBlock = owner.driver.isBlock;
|
|
436
435
|
const sequential = children.strict;
|
|
@@ -543,11 +542,13 @@ function redeployIfNecessary(block) {
|
|
|
543
542
|
const driver = block.driver;
|
|
544
543
|
if (block.stamp === 0) {
|
|
545
544
|
block.stamp = 1;
|
|
546
|
-
|
|
547
|
-
|
|
545
|
+
nonreactive(() => {
|
|
546
|
+
driver.initialize(block, undefined);
|
|
547
|
+
driver.deploy(block);
|
|
548
|
+
});
|
|
548
549
|
}
|
|
549
550
|
else if (block.isMoved)
|
|
550
|
-
driver.deploy(block);
|
|
551
|
+
nonreactive(() => driver.deploy(block));
|
|
551
552
|
}
|
|
552
553
|
function renderNow(item) {
|
|
553
554
|
const block = item.instance;
|
|
@@ -558,14 +559,14 @@ function renderNow(item) {
|
|
|
558
559
|
redeployIfNecessary(block);
|
|
559
560
|
block.stamp++;
|
|
560
561
|
block.numerator = 0;
|
|
561
|
-
block.
|
|
562
|
+
block.assignedBounds = undefined;
|
|
562
563
|
block.assignedStyle = false;
|
|
563
564
|
block.children.beginMerge();
|
|
564
565
|
result = block.driver.render(block);
|
|
565
566
|
if (block.driver.isLine)
|
|
566
567
|
block.host.cursor.lineFeed();
|
|
567
|
-
else if (block.
|
|
568
|
-
block.
|
|
568
|
+
else if (block.assignedBounds === undefined)
|
|
569
|
+
block.bounds = undefined;
|
|
569
570
|
if (result instanceof Promise)
|
|
570
571
|
result.then(v => { runRenderNestedTreesThenDo(undefined, NOP); return v; }, e => { console.log(e); runRenderNestedTreesThenDo(e !== null && e !== void 0 ? e : new Error("unknown error"), NOP); });
|
|
571
572
|
else
|
|
@@ -585,7 +586,7 @@ function triggerFinalization(item, isLeader, individual) {
|
|
|
585
586
|
if (individual && block.key !== block.body.key && !block.driver.isLine)
|
|
586
587
|
console.log(`WARNING: it is recommended to assign explicit key for conditionally rendered block in order to avoid unexpected side effects: ${block.key}`);
|
|
587
588
|
block.stamp = ~block.stamp;
|
|
588
|
-
const childrenAreLeaders = block.driver.finalize(block, isLeader);
|
|
589
|
+
const childrenAreLeaders = nonreactive(() => block.driver.finalize(block, isLeader));
|
|
589
590
|
if (isReaction(block.body)) {
|
|
590
591
|
item.aux = undefined;
|
|
591
592
|
const last = gLastToDispose;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { VBlock, BlockBody, Align, CellRange } from "../core/api";
|
|
2
2
|
import { HtmlDriver } from "./HtmlDriver";
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function HtmlText(content: string, body?: BlockBody<HTMLElement, void, void>): VBlock<HTMLElement, void, void>;
|
|
6
|
-
export declare function Grid<M = unknown, R = void>(body?: BlockBody<HTMLElement, M, R>, base?: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
3
|
+
export declare function Ribbon<M = unknown, R = void>(body?: BlockBody<HTMLElement, M, R>, base?: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
4
|
+
export declare function Table<M = unknown, R = void>(body?: BlockBody<HTMLElement, M, R>, base?: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
7
5
|
export declare function line<T = void>(body: (block: void) => T): void;
|
|
8
6
|
export declare function lineFeed(noCoalescing?: boolean, key?: string): VBlock<HTMLElement>;
|
|
7
|
+
export declare function Note(content: string, body?: BlockBody<HTMLElement, void, void>): VBlock<HTMLElement, void, void>;
|
|
8
|
+
export declare function HtmlNote(content: string, body?: BlockBody<HTMLElement, void, void>): VBlock<HTMLElement, void, void>;
|
|
9
9
|
export declare function Group<M = unknown, R = void>(body?: BlockBody<HTMLElement, M, R>, base?: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
10
10
|
export declare class VerstakDriver<T extends HTMLElement> extends HtmlDriver<T> {
|
|
11
11
|
applyCellRange(block: VBlock<T>, cellRange: CellRange | undefined): void;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { VBlock, LayoutKind, Align, GridCursor } from "../core/api";
|
|
2
2
|
import { HtmlDriver } from "./HtmlDriver";
|
|
3
|
-
export function
|
|
3
|
+
export function Ribbon(body, base) {
|
|
4
4
|
return VBlock.claim(VerstakTags.block, body, base);
|
|
5
5
|
}
|
|
6
|
-
export function
|
|
6
|
+
export function Table(body, base) {
|
|
7
|
+
return VBlock.claim(VerstakTags.grid, body, base);
|
|
8
|
+
}
|
|
9
|
+
export function line(body) {
|
|
10
|
+
lineFeed();
|
|
11
|
+
body();
|
|
12
|
+
}
|
|
13
|
+
export function lineFeed(noCoalescing, key) {
|
|
14
|
+
return VBlock.claim(VerstakTags.line, { key });
|
|
15
|
+
}
|
|
16
|
+
export function Note(content, body) {
|
|
7
17
|
return VBlock.claim(VerstakTags.text, body, {
|
|
8
18
|
render(b) {
|
|
9
19
|
b.native.innerText = content;
|
|
10
20
|
}
|
|
11
21
|
});
|
|
12
22
|
}
|
|
13
|
-
export function
|
|
23
|
+
export function HtmlNote(content, body) {
|
|
14
24
|
return VBlock.claim(VerstakTags.text, body, {
|
|
15
25
|
render(b) {
|
|
16
26
|
b.native.innerHTML = content;
|
|
17
27
|
}
|
|
18
28
|
});
|
|
19
29
|
}
|
|
20
|
-
export function Grid(body, base) {
|
|
21
|
-
return VBlock.claim(VerstakTags.grid, body, base);
|
|
22
|
-
}
|
|
23
|
-
export function line(body) {
|
|
24
|
-
lineFeed();
|
|
25
|
-
body();
|
|
26
|
-
}
|
|
27
|
-
export function lineFeed(noCoalescing, key) {
|
|
28
|
-
return VBlock.claim(VerstakTags.line, { key });
|
|
29
|
-
}
|
|
30
30
|
export function Group(body, base) {
|
|
31
31
|
return VBlock.claim(VerstakTags.group, body, base);
|
|
32
32
|
}
|
|
@@ -97,7 +97,7 @@ export declare function Style<M = unknown, R = void>(body?: BlockBody<HTMLStyleE
|
|
|
97
97
|
export declare function Sub<M = unknown, R = void>(body?: BlockBody<HTMLElement, M, R>, base?: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
98
98
|
export declare function Summary<M = unknown, R = void>(body?: BlockBody<HTMLElement, M, R>, base?: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
99
99
|
export declare function Sup<M = unknown, R = void>(body?: BlockBody<HTMLElement, M, R>, base?: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
100
|
-
export declare function
|
|
100
|
+
export declare function Tbl<M = unknown, R = void>(body?: BlockBody<HTMLTableElement, M, R>, base?: BlockBody<HTMLTableElement, M, R>): VBlock<HTMLTableElement, M, R>;
|
|
101
101
|
export declare function Template<M = unknown, R = void>(body?: BlockBody<HTMLTemplateElement, M, R>, base?: BlockBody<HTMLTemplateElement, M, R>): VBlock<HTMLTemplateElement, M, R>;
|
|
102
102
|
export declare function TBody<M = unknown, R = void>(body?: BlockBody<HTMLTableSectionElement, M, R>, base?: BlockBody<HTMLTableSectionElement, M, R>): VBlock<HTMLTableSectionElement, M, R>;
|
|
103
103
|
export declare function TD<M = unknown, R = void>(body?: BlockBody<HTMLTableCellElement, M, R>, base?: BlockBody<HTMLTableCellElement, M, R>): VBlock<HTMLTableCellElement, M, R>;
|
|
@@ -101,7 +101,7 @@ export function Style(body, base) { return VBlock.claim(HtmlTags.style, body, ba
|
|
|
101
101
|
export function Sub(body, base) { return VBlock.claim(HtmlTags.sub, body, base); }
|
|
102
102
|
export function Summary(body, base) { return VBlock.claim(HtmlTags.summary, body, base); }
|
|
103
103
|
export function Sup(body, base) { return VBlock.claim(HtmlTags.sup, body, base); }
|
|
104
|
-
export function
|
|
104
|
+
export function Tbl(body, base) { return VBlock.claim(HtmlTags.table, body, base); }
|
|
105
105
|
export function Template(body, base) { return VBlock.claim(HtmlTags.template, body, base); }
|
|
106
106
|
export function TBody(body, base) { return VBlock.claim(HtmlTags.tbody, body, base); }
|
|
107
107
|
export function TD(body, base) { return VBlock.claim(HtmlTags.td, body, base); }
|