verstak 0.22.510 → 0.22.512
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 +0 -17
- package/build/dist/source/core/VBlock.d.ts +16 -17
- package/build/dist/source/core/VBlock.js +48 -42
- package/build/dist/source/html/Blocks.d.ts +8 -8
- package/build/dist/source/html/Blocks.js +16 -16
- package/build/dist/source/html/HtmlBlocks.d.ts +175 -175
- package/build/dist/source/html/HtmlBlocks.js +175 -175
- package/build/dist/source/html/HtmlDriver.d.ts +1 -1
- package/build/dist/source/html/ReactingFocuser.js +3 -1
- package/package.json +1 -1
|
@@ -24,23 +24,6 @@ export declare type Cells = undefined | string | number | {
|
|
|
24
24
|
down?: number;
|
|
25
25
|
verticalOverlap?: boolean;
|
|
26
26
|
};
|
|
27
|
-
export interface Bounds {
|
|
28
|
-
place?: string;
|
|
29
|
-
widthSpan?: number;
|
|
30
|
-
widthMin?: string;
|
|
31
|
-
widthMax?: string;
|
|
32
|
-
widthGrowth?: number;
|
|
33
|
-
widthOverlap?: boolean;
|
|
34
|
-
heightSpan?: number;
|
|
35
|
-
heightMin?: string;
|
|
36
|
-
heightMax?: string;
|
|
37
|
-
heightGrowth?: number;
|
|
38
|
-
heightOverlap?: boolean;
|
|
39
|
-
alignContent?: Align;
|
|
40
|
-
alignFrame?: Align;
|
|
41
|
-
wrapping?: boolean;
|
|
42
|
-
dangling?: boolean;
|
|
43
|
-
}
|
|
44
27
|
export declare class Cursor {
|
|
45
28
|
static readonly UndefinedCellRange: Readonly<{
|
|
46
29
|
x1: 0;
|
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LoggingOptions, Item, CollectionReader, MemberOptions } from "reactronic";
|
|
2
2
|
import { CellRange } from "./CellRange";
|
|
3
3
|
import { Cursor, Align, Cells } from "./Cursor";
|
|
4
4
|
export declare type Callback<T = unknown> = (native: T) => void;
|
|
5
|
-
export declare type Render<T = unknown, M = unknown, R = void> = (
|
|
6
|
-
export declare type AsyncRender<T = unknown, M = unknown> = (
|
|
5
|
+
export declare type Render<T = unknown, M = unknown, R = void> = (block: VBlock<T, M, R>, base: () => R) => R;
|
|
6
|
+
export declare type AsyncRender<T = unknown, M = unknown> = (block: VBlock<T, M, Promise<void>>) => Promise<void>;
|
|
7
7
|
export declare const enum Priority {
|
|
8
8
|
SyncP0 = 0,
|
|
9
9
|
AsyncP1 = 1,
|
|
10
10
|
AsyncP2 = 2
|
|
11
11
|
}
|
|
12
12
|
export declare type Type<T> = new (...args: any[]) => T;
|
|
13
|
-
export
|
|
13
|
+
export declare type BlockBody<T = unknown, M = unknown, R = void> = Render<T, M, R> | BlockVmt<T, M, R>;
|
|
14
|
+
export interface BlockVmt<T = unknown, M = unknown, R = void> {
|
|
14
15
|
reacting?: boolean;
|
|
15
16
|
triggers?: unknown;
|
|
16
|
-
priority?: Priority;
|
|
17
|
-
monitor?: Monitor;
|
|
18
|
-
throttling?: number;
|
|
19
|
-
logging?: Partial<LoggingOptions>;
|
|
20
|
-
shuffle?: boolean;
|
|
21
17
|
initialize?: Render<T, M, R>;
|
|
22
18
|
override?: Render<T, M, R>;
|
|
23
19
|
render?: Render<T, M, R>;
|
|
24
20
|
finalize?: Render<T, M, R>;
|
|
25
21
|
}
|
|
26
|
-
export declare function asComponent<T, M, R>(outer:
|
|
22
|
+
export declare function asComponent<T, M, R>(outer: BlockBody<T, M, R> | undefined, base: BlockBody<T, M, R>): BlockVmt<T, M, R>;
|
|
27
23
|
export declare function setContext<T extends Object>(type: Type<T>, context: T): void;
|
|
28
24
|
export declare function use<T extends Object>(type: Type<T>): T;
|
|
29
25
|
export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
|
|
@@ -33,7 +29,7 @@ export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
|
|
|
33
29
|
static frameDuration: number;
|
|
34
30
|
abstract readonly name: string;
|
|
35
31
|
abstract readonly driver: AbstractDriver<T>;
|
|
36
|
-
abstract readonly
|
|
32
|
+
abstract readonly body: Readonly<BlockVmt<T, M, R>>;
|
|
37
33
|
abstract model: M;
|
|
38
34
|
abstract cells: Cells;
|
|
39
35
|
abstract widthGrowth: number;
|
|
@@ -44,20 +40,23 @@ export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
|
|
|
44
40
|
abstract heightMax: string;
|
|
45
41
|
abstract alignContent: Align;
|
|
46
42
|
abstract alignFrame: Align;
|
|
47
|
-
abstract
|
|
43
|
+
abstract wrapContent: boolean;
|
|
48
44
|
abstract dangling: boolean;
|
|
45
|
+
abstract shuffleChildren: boolean;
|
|
46
|
+
abstract renderingPriority?: Priority;
|
|
49
47
|
abstract readonly level: number;
|
|
50
48
|
abstract readonly host: VBlock;
|
|
51
49
|
abstract readonly children: CollectionReader<VBlock>;
|
|
52
50
|
abstract readonly item: Item<VBlock> | undefined;
|
|
53
51
|
abstract readonly stamp: number;
|
|
54
|
-
abstract readonly native: T
|
|
52
|
+
abstract readonly native: T;
|
|
55
53
|
get isInitialRendering(): boolean;
|
|
54
|
+
abstract configureReactronic(options: Partial<MemberOptions>): MemberOptions;
|
|
56
55
|
static root(render: () => void): void;
|
|
57
56
|
static get current(): VBlock;
|
|
58
57
|
static renderNestedTreesThenDo(action: (error: unknown) => void): void;
|
|
59
58
|
static runForAllBlocks<T>(action: (e: T) => void): void;
|
|
60
|
-
static claim<T = undefined, M = unknown, R = void>(name: string, driver: AbstractDriver<T> | undefined,
|
|
59
|
+
static claim<T = undefined, M = unknown, R = void>(name: string, driver: AbstractDriver<T> | undefined, body: BlockBody<T, M, R>): VBlock<T, M, R>;
|
|
61
60
|
static getDefaultLoggingOptions(): LoggingOptions | undefined;
|
|
62
61
|
static setDefaultLoggingOptions(logging?: LoggingOptions): void;
|
|
63
62
|
}
|
|
@@ -79,7 +78,7 @@ export declare class AbstractDriver<T> {
|
|
|
79
78
|
get isGrid(): boolean;
|
|
80
79
|
get isRow(): boolean;
|
|
81
80
|
constructor(name: string, layout: LayoutKind, createCursor?: () => Cursor);
|
|
82
|
-
initialize(block: VBlock<T>, native: T
|
|
81
|
+
initialize(block: VBlock<T>, native: T): void;
|
|
83
82
|
finalize(block: VBlock<T>, isLeader: boolean): boolean;
|
|
84
83
|
deploy(block: VBlock<T>, sequential: boolean): void;
|
|
85
84
|
applyCellRange(block: VBlock<T, any, any>, cellRange: CellRange | undefined): void;
|
|
@@ -91,12 +90,12 @@ export declare class AbstractDriver<T> {
|
|
|
91
90
|
applyHeightMax(block: VBlock<T, any, any>, heightMax: string): void;
|
|
92
91
|
applyAlignContent(block: VBlock<T, any, any>, alignContent: Align): void;
|
|
93
92
|
applyAlignFrame(block: VBlock<T, any, any>, alignFrame: Align): void;
|
|
94
|
-
|
|
93
|
+
applyWrapContent(block: VBlock<T, any, any>, wrapContent: boolean): void;
|
|
95
94
|
applyDangling(block: VBlock<T, any, any>, dangling: boolean): void;
|
|
96
95
|
render(block: VBlock<T>): void | Promise<void>;
|
|
97
96
|
}
|
|
98
97
|
export declare class StaticDriver<T> extends AbstractDriver<T> {
|
|
99
98
|
readonly element: T;
|
|
100
99
|
constructor(element: T, name: string, layout: LayoutKind, createCursor?: () => Cursor);
|
|
101
|
-
initialize(block: VBlock<T>, element: T
|
|
100
|
+
initialize(block: VBlock<T>, element: T): void;
|
|
102
101
|
}
|
|
@@ -26,12 +26,16 @@ export var Priority;
|
|
|
26
26
|
Priority[Priority["AsyncP2"] = 2] = "AsyncP2";
|
|
27
27
|
})(Priority || (Priority = {}));
|
|
28
28
|
export function asComponent(outer, base) {
|
|
29
|
+
if (outer instanceof Function)
|
|
30
|
+
outer = { render: outer };
|
|
31
|
+
if (base instanceof Function)
|
|
32
|
+
base = { render: base };
|
|
29
33
|
const result = Object.assign(Object.assign(Object.assign({}, base), outer), { initialize: via(outer === null || outer === void 0 ? void 0 : outer.initialize, base.initialize), render: via(outer === null || outer === void 0 ? void 0 : outer.render, base.render), finalize: via(outer === null || outer === void 0 ? void 0 : outer.finalize, base.finalize) });
|
|
30
34
|
return result;
|
|
31
35
|
}
|
|
32
36
|
function via(outer, base) {
|
|
33
37
|
const inherited = base !== null && base !== void 0 ? base : NOP;
|
|
34
|
-
return outer ?
|
|
38
|
+
return outer ? b => outer(b, () => inherited(b)) : inherited;
|
|
35
39
|
}
|
|
36
40
|
export function setContext(type, context) {
|
|
37
41
|
return VBlockImpl.setContext(type, context);
|
|
@@ -44,7 +48,7 @@ export class VBlock {
|
|
|
44
48
|
return this.stamp === 2;
|
|
45
49
|
}
|
|
46
50
|
static root(render) {
|
|
47
|
-
gSysRoot.instance.
|
|
51
|
+
gSysRoot.instance.body.render = render;
|
|
48
52
|
prepareAndRunRender(gSysRoot, false, false);
|
|
49
53
|
}
|
|
50
54
|
static get current() {
|
|
@@ -56,8 +60,10 @@ export class VBlock {
|
|
|
56
60
|
static runForAllBlocks(action) {
|
|
57
61
|
forEachChildRecursively(gSysRoot, action);
|
|
58
62
|
}
|
|
59
|
-
static claim(name, driver,
|
|
63
|
+
static claim(name, driver, body) {
|
|
60
64
|
var _a, _b;
|
|
65
|
+
if (body instanceof Function)
|
|
66
|
+
body = { render: body };
|
|
61
67
|
let result;
|
|
62
68
|
const owner = gCurrent.instance;
|
|
63
69
|
const children = owner.children;
|
|
@@ -74,16 +80,16 @@ export class VBlock {
|
|
|
74
80
|
result = ex.instance;
|
|
75
81
|
if (result.driver !== driver && driver !== undefined)
|
|
76
82
|
throw new Error(`changing block driver is not yet supported: "${result.driver.name}" -> "${driver === null || driver === void 0 ? void 0 : driver.name}"`);
|
|
77
|
-
const exTriggers = (_b = result.
|
|
78
|
-
if (triggersAreEqual(
|
|
79
|
-
|
|
80
|
-
result.
|
|
83
|
+
const exTriggers = (_b = result.body) === null || _b === void 0 ? void 0 : _b.triggers;
|
|
84
|
+
if (triggersAreEqual(body.triggers, exTriggers))
|
|
85
|
+
body.triggers = exTriggers;
|
|
86
|
+
result.body = body;
|
|
81
87
|
}
|
|
82
88
|
else {
|
|
83
|
-
result = new VBlockImpl(name, driver, owner,
|
|
89
|
+
result = new VBlockImpl(name, driver, owner, body);
|
|
84
90
|
result.item = children.add(result);
|
|
85
91
|
VBlockImpl.grandCount++;
|
|
86
|
-
if (
|
|
92
|
+
if (body.reacting)
|
|
87
93
|
VBlockImpl.disposableCount++;
|
|
88
94
|
}
|
|
89
95
|
return result;
|
|
@@ -123,14 +129,13 @@ export class AbstractDriver {
|
|
|
123
129
|
var _a, _b;
|
|
124
130
|
const b = block;
|
|
125
131
|
b.native = native;
|
|
126
|
-
(_b = (_a = block.
|
|
132
|
+
(_b = (_a = block.body).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, block, NOP);
|
|
127
133
|
}
|
|
128
134
|
finalize(block, isLeader) {
|
|
129
135
|
var _a, _b;
|
|
130
136
|
const b = block;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
b.native = undefined;
|
|
137
|
+
(_b = (_a = block.body).finalize) === null || _b === void 0 ? void 0 : _b.call(_a, block, NOP);
|
|
138
|
+
b.native = null;
|
|
134
139
|
return isLeader;
|
|
135
140
|
}
|
|
136
141
|
deploy(block, sequential) {
|
|
@@ -153,16 +158,16 @@ export class AbstractDriver {
|
|
|
153
158
|
}
|
|
154
159
|
applyAlignFrame(block, alignFrame) {
|
|
155
160
|
}
|
|
156
|
-
|
|
161
|
+
applyWrapContent(block, wrapContent) {
|
|
157
162
|
}
|
|
158
163
|
applyDangling(block, dangling) {
|
|
159
164
|
}
|
|
160
165
|
render(block) {
|
|
161
166
|
var _a;
|
|
162
167
|
let result;
|
|
163
|
-
const override = (_a = block.
|
|
168
|
+
const override = (_a = block.body) === null || _a === void 0 ? void 0 : _a.override;
|
|
164
169
|
if (override)
|
|
165
|
-
result = override(block
|
|
170
|
+
result = override(block, NOP);
|
|
166
171
|
else
|
|
167
172
|
result = invokeRenderFunction(block);
|
|
168
173
|
return result;
|
|
@@ -171,8 +176,8 @@ export class AbstractDriver {
|
|
|
171
176
|
AbstractDriver.group = new AbstractDriver("group", LayoutKind.Group);
|
|
172
177
|
function invokeRenderFunction(block) {
|
|
173
178
|
var _a;
|
|
174
|
-
const r = (_a = block.
|
|
175
|
-
return r(block
|
|
179
|
+
const r = (_a = block.body.render) !== null && _a !== void 0 ? _a : NOP;
|
|
180
|
+
return r(block, NOP);
|
|
176
181
|
}
|
|
177
182
|
export class StaticDriver extends AbstractDriver {
|
|
178
183
|
constructor(element, name, layout, createCursor) {
|
|
@@ -198,11 +203,11 @@ __decorate([
|
|
|
198
203
|
__metadata("design:type", Object)
|
|
199
204
|
], VBlockContext.prototype, "type", void 0);
|
|
200
205
|
class VBlockImpl extends VBlock {
|
|
201
|
-
constructor(name, driver, owner,
|
|
206
|
+
constructor(name, driver, owner, body) {
|
|
202
207
|
super();
|
|
203
208
|
this.name = name;
|
|
204
209
|
this.driver = driver;
|
|
205
|
-
this.
|
|
210
|
+
this.body = body;
|
|
206
211
|
this.model = undefined;
|
|
207
212
|
this.assignedCells = undefined;
|
|
208
213
|
this.appliedCellRange = Cursor.UndefinedCellRange;
|
|
@@ -214,8 +219,10 @@ class VBlockImpl extends VBlock {
|
|
|
214
219
|
this.appliedHeightMax = "";
|
|
215
220
|
this.appliedAlignContent = Align.Default;
|
|
216
221
|
this.appliedAlignFrame = Align.Default;
|
|
217
|
-
this.
|
|
222
|
+
this.appliedWrapContent = false;
|
|
218
223
|
this.appliedDangling = false;
|
|
224
|
+
this.shuffleChildren = false;
|
|
225
|
+
this.renderingPriority = Priority.SyncP0;
|
|
219
226
|
this.level = owner.level + 1;
|
|
220
227
|
this.host = owner;
|
|
221
228
|
this.children = new Collection(driver.isSequential, getBlockName);
|
|
@@ -297,11 +304,11 @@ class VBlockImpl extends VBlock {
|
|
|
297
304
|
this.appliedAlignFrame = value;
|
|
298
305
|
}
|
|
299
306
|
}
|
|
300
|
-
get
|
|
301
|
-
set
|
|
302
|
-
if (value !== this.
|
|
303
|
-
this.driver.
|
|
304
|
-
this.
|
|
307
|
+
get wrapContent() { return this.appliedWrapContent; }
|
|
308
|
+
set wrapContent(value) {
|
|
309
|
+
if (value !== this.appliedWrapContent) {
|
|
310
|
+
this.driver.applyWrapContent(this, value);
|
|
311
|
+
this.appliedWrapContent = value;
|
|
305
312
|
}
|
|
306
313
|
}
|
|
307
314
|
get dangling() { return this.appliedDangling; }
|
|
@@ -311,6 +318,11 @@ class VBlockImpl extends VBlock {
|
|
|
311
318
|
this.appliedDangling = value;
|
|
312
319
|
}
|
|
313
320
|
}
|
|
321
|
+
configureReactronic(options) {
|
|
322
|
+
if (this.stamp !== 1 || !this.body.reacting)
|
|
323
|
+
throw new Error("reactronic can be configured only for reacting blocks and only inside initialize");
|
|
324
|
+
return Rx.getController(this.rerender).configure(options);
|
|
325
|
+
}
|
|
314
326
|
static use(type) {
|
|
315
327
|
var _a, _b;
|
|
316
328
|
let b = gCurrent.instance;
|
|
@@ -384,13 +396,12 @@ function runRenderNestedTreesThenDo(error, action) {
|
|
|
384
396
|
break;
|
|
385
397
|
const block = item.instance;
|
|
386
398
|
const driver = block.driver;
|
|
387
|
-
const opt = block.args;
|
|
388
399
|
const host = driver.isRow ? owner : partHost;
|
|
400
|
+
const p = (_a = block.renderingPriority) !== null && _a !== void 0 ? _a : Priority.SyncP0;
|
|
389
401
|
redeploy = markToRedeployIfNecessary(redeploy, host, item, children, sequential);
|
|
390
|
-
|
|
391
|
-
if (priority === Priority.SyncP0)
|
|
402
|
+
if (p === Priority.SyncP0)
|
|
392
403
|
prepareAndRunRender(item, children.isMoved(item), sequential);
|
|
393
|
-
else if (
|
|
404
|
+
else if (p === Priority.AsyncP1)
|
|
394
405
|
p1 = push(item, p1);
|
|
395
406
|
else
|
|
396
407
|
p2 = push(item, p2);
|
|
@@ -430,7 +441,6 @@ function startIncrementalRendering(owner, allChildren, priority1, priority2) {
|
|
|
430
441
|
});
|
|
431
442
|
}
|
|
432
443
|
function renderIncrementally(owner, stamp, allChildren, items, priority) {
|
|
433
|
-
var _a;
|
|
434
444
|
return __awaiter(this, void 0, void 0, function* () {
|
|
435
445
|
yield Transaction.requestNextFrame();
|
|
436
446
|
const block = owner.instance;
|
|
@@ -439,7 +449,7 @@ function renderIncrementally(owner, stamp, allChildren, items, priority) {
|
|
|
439
449
|
VBlock.currentRenderingPriority = priority;
|
|
440
450
|
try {
|
|
441
451
|
const sequential = block.children.strict;
|
|
442
|
-
if (
|
|
452
|
+
if (block.shuffleChildren)
|
|
443
453
|
shuffle(items);
|
|
444
454
|
const frameDurationLimit = priority === Priority.AsyncP2 ? VBlock.shortFrameDuration : Infinity;
|
|
445
455
|
let frameDuration = Math.min(frameDurationLimit, Math.max(VBlock.frameDuration / 4, VBlock.shortFrameDuration));
|
|
@@ -467,8 +477,8 @@ function prepareAndRunRender(item, redeploy, sequential) {
|
|
|
467
477
|
const block = item.instance;
|
|
468
478
|
if (block.stamp >= 0) {
|
|
469
479
|
prepareRender(item, redeploy, sequential);
|
|
470
|
-
if ((_a = block.
|
|
471
|
-
nonreactive(block.rerender, (_b = block.
|
|
480
|
+
if ((_a = block.body) === null || _a === void 0 ? void 0 : _a.reacting)
|
|
481
|
+
nonreactive(block.rerender, (_b = block.body) === null || _b === void 0 ? void 0 : _b.triggers);
|
|
472
482
|
else
|
|
473
483
|
runRender(item);
|
|
474
484
|
}
|
|
@@ -480,16 +490,12 @@ function prepareRender(item, redeploy, sequential) {
|
|
|
480
490
|
block.stamp = 1;
|
|
481
491
|
runUnder(item, () => {
|
|
482
492
|
var _a;
|
|
483
|
-
if ((_a = block.
|
|
493
|
+
if ((_a = block.body) === null || _a === void 0 ? void 0 : _a.reacting) {
|
|
484
494
|
Transaction.outside(() => {
|
|
485
|
-
var _a, _b, _c;
|
|
486
495
|
if (Rx.isLogging)
|
|
487
496
|
Rx.setLoggingHint(block, block.name);
|
|
488
497
|
Rx.getController(block.rerender).configure({
|
|
489
498
|
order: block.level,
|
|
490
|
-
monitor: (_a = block.args) === null || _a === void 0 ? void 0 : _a.monitor,
|
|
491
|
-
throttling: (_b = block.args) === null || _b === void 0 ? void 0 : _b.throttling,
|
|
492
|
-
logging: (_c = block.args) === null || _c === void 0 ? void 0 : _c.logging,
|
|
493
499
|
});
|
|
494
500
|
});
|
|
495
501
|
}
|
|
@@ -536,7 +542,7 @@ function runFinalize(item, isLeader) {
|
|
|
536
542
|
if (block.stamp >= 0) {
|
|
537
543
|
block.stamp = ~block.stamp;
|
|
538
544
|
const childrenAreLeaders = block.driver.finalize(block, isLeader);
|
|
539
|
-
if ((_a = block.
|
|
545
|
+
if ((_a = block.body) === null || _a === void 0 ? void 0 : _a.reacting) {
|
|
540
546
|
item.aux = undefined;
|
|
541
547
|
const last = gLastToDispose;
|
|
542
548
|
if (last)
|
|
@@ -569,8 +575,8 @@ function runDisposalLoop() {
|
|
|
569
575
|
}
|
|
570
576
|
function forEachChildRecursively(item, action) {
|
|
571
577
|
const block = item.instance;
|
|
572
|
-
const
|
|
573
|
-
|
|
578
|
+
const e = block.native;
|
|
579
|
+
e && action(e);
|
|
574
580
|
for (const item of block.children.items())
|
|
575
581
|
forEachChildRecursively(item, action);
|
|
576
582
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { VBlock,
|
|
1
|
+
import { VBlock, BlockBody, Align, CellRange } from "../core/api";
|
|
2
2
|
import { HtmlDriver } from "./HtmlDriver";
|
|
3
|
-
export declare function Block<M = unknown, R = void>(name: string, args:
|
|
4
|
-
export declare function PlainText(content: string, name?: string, args?:
|
|
5
|
-
export declare function HtmlText(content: string, name?: string, args?:
|
|
6
|
-
export declare function Grid<M = unknown, R = void>(name: string,
|
|
3
|
+
export declare function Block<M = unknown, R = void>(name: string, args: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
4
|
+
export declare function PlainText(content: string, name?: string, args?: BlockBody<HTMLElement, void, void>): VBlock<HTMLElement, void, void>;
|
|
5
|
+
export declare function HtmlText(content: string, name?: string, args?: BlockBody<HTMLElement, void, void>): VBlock<HTMLElement, void, void>;
|
|
6
|
+
export declare function Grid<M = unknown, R = void>(name: string, body: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
7
7
|
export declare function Line<T = void>(claim: (x: void) => T): VBlock<HTMLElement>;
|
|
8
|
-
export declare function lineFeed(
|
|
9
|
-
export declare function Group<M = unknown, R = void>(name: string,
|
|
8
|
+
export declare function lineFeed(body?: BlockBody<HTMLElement, void, void>, noCoalescing?: boolean): VBlock<HTMLElement>;
|
|
9
|
+
export declare function Group<M = unknown, R = void>(name: string, body: 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;
|
|
12
12
|
applyWidthGrowth(block: VBlock<T>, widthGrowth: number): void;
|
|
@@ -17,7 +17,7 @@ export declare class VerstakDriver<T extends HTMLElement> extends HtmlDriver<T>
|
|
|
17
17
|
applyHeightMax(block: VBlock<T>, heightMax: string): void;
|
|
18
18
|
applyAlignContent(block: VBlock<T>, alignContent: Align): void;
|
|
19
19
|
applyAlignFrame(block: VBlock<T>, alignFrame: Align): void;
|
|
20
|
-
|
|
20
|
+
applyWrapContent(block: VBlock<T>, wrapContent: boolean): void;
|
|
21
21
|
applyDangling(block: VBlock<T>, dangling: boolean): void;
|
|
22
22
|
render(block: VBlock<T>): void | Promise<void>;
|
|
23
23
|
}
|
|
@@ -5,32 +5,32 @@ export function Block(name, args) {
|
|
|
5
5
|
}
|
|
6
6
|
export function PlainText(content, name, args) {
|
|
7
7
|
return VBlock.claim(name !== null && name !== void 0 ? name : "", VerstakTags.text, asComponent(args, {
|
|
8
|
-
render(
|
|
9
|
-
|
|
8
|
+
render(b) {
|
|
9
|
+
b.native.innerText = content;
|
|
10
10
|
},
|
|
11
11
|
}));
|
|
12
12
|
}
|
|
13
13
|
export function HtmlText(content, name, args) {
|
|
14
14
|
return VBlock.claim(name !== null && name !== void 0 ? name : "", VerstakTags.text, asComponent(args, {
|
|
15
|
-
render(
|
|
16
|
-
|
|
15
|
+
render(b) {
|
|
16
|
+
b.native.innerHTML = content;
|
|
17
17
|
},
|
|
18
18
|
}));
|
|
19
19
|
}
|
|
20
|
-
export function Grid(name,
|
|
21
|
-
return VBlock.claim(name, VerstakTags.grid,
|
|
20
|
+
export function Grid(name, body) {
|
|
21
|
+
return VBlock.claim(name, VerstakTags.grid, body);
|
|
22
22
|
}
|
|
23
23
|
export function Line(claim) {
|
|
24
|
-
const result = VBlock.claim("", VerstakTags.row,
|
|
24
|
+
const result = VBlock.claim("", VerstakTags.row, EMPTY_BLOCK_BODY);
|
|
25
25
|
claim();
|
|
26
|
-
VBlock.claim("", VerstakTags.row,
|
|
26
|
+
VBlock.claim("", VerstakTags.row, EMPTY_BLOCK_BODY);
|
|
27
27
|
return result;
|
|
28
28
|
}
|
|
29
|
-
export function lineFeed(
|
|
30
|
-
return VBlock.claim("", VerstakTags.row,
|
|
29
|
+
export function lineFeed(body, noCoalescing) {
|
|
30
|
+
return VBlock.claim("", VerstakTags.row, body !== null && body !== void 0 ? body : EMPTY_BLOCK_BODY);
|
|
31
31
|
}
|
|
32
|
-
export function Group(name,
|
|
33
|
-
return VBlock.claim(name, VerstakTags.group,
|
|
32
|
+
export function Group(name, body) {
|
|
33
|
+
return VBlock.claim(name, VerstakTags.group, body);
|
|
34
34
|
}
|
|
35
35
|
export class VerstakDriver extends HtmlDriver {
|
|
36
36
|
applyCellRange(block, cellRange) {
|
|
@@ -106,8 +106,8 @@ export class VerstakDriver extends HtmlDriver {
|
|
|
106
106
|
else
|
|
107
107
|
css.alignSelf = css.justifySelf = "";
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
if (
|
|
109
|
+
applyWrapContent(block, wrapContent) {
|
|
110
|
+
if (wrapContent)
|
|
111
111
|
block.native.setAttribute("wrapping", "true");
|
|
112
112
|
else
|
|
113
113
|
block.native.removeAttribute("wrapping");
|
|
@@ -120,7 +120,7 @@ export class VerstakDriver extends HtmlDriver {
|
|
|
120
120
|
}
|
|
121
121
|
render(block) {
|
|
122
122
|
if (block.driver.layout < LayoutKind.Row)
|
|
123
|
-
VBlock.claim("", VerstakTags.row,
|
|
123
|
+
VBlock.claim("", VerstakTags.row, EMPTY_BLOCK_BODY);
|
|
124
124
|
return super.render(block);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -131,6 +131,6 @@ const VerstakTags = {
|
|
|
131
131
|
row: new VerstakDriver("v-row", LayoutKind.Row),
|
|
132
132
|
group: new VerstakDriver("v-group", LayoutKind.Group),
|
|
133
133
|
};
|
|
134
|
-
const
|
|
134
|
+
const EMPTY_BLOCK_BODY = { render() { } };
|
|
135
135
|
const AlignToCss = ["stretch", "start", "center", "end"];
|
|
136
136
|
const TextAlignCss = ["justify", "left", "center", "right"];
|