verstak 0.22.505 → 0.22.506
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/Allocator.d.ts +2 -0
- package/build/dist/source/core/Allocator.js +6 -4
- package/build/dist/source/core/{Kernel.d.ts → VBlock.d.ts} +5 -7
- package/build/dist/source/core/{Kernel.js → VBlock.js} +102 -80
- package/build/dist/source/core/api.d.ts +1 -1
- package/build/dist/source/core/api.js +1 -1
- package/build/dist/source/html/Blocks.d.ts +2 -2
- package/build/dist/source/html/Blocks.js +21 -9
- package/build/dist/source/html/HtmlBlocks.d.ts +1 -1
- package/build/dist/source/html/HtmlBlocks.js +2 -2
- package/build/dist/source/html/HtmlDriver.js +5 -2
- package/package.json +1 -1
|
@@ -32,6 +32,7 @@ export interface Bounds {
|
|
|
32
32
|
heightOverlap?: boolean;
|
|
33
33
|
alignContent?: To;
|
|
34
34
|
alignFrame?: To;
|
|
35
|
+
wrapping?: boolean;
|
|
35
36
|
}
|
|
36
37
|
export interface Place {
|
|
37
38
|
exact: CellRange | undefined;
|
|
@@ -43,6 +44,7 @@ export interface Place {
|
|
|
43
44
|
heightGrowth: number;
|
|
44
45
|
alignContent: To;
|
|
45
46
|
alignFrame: To;
|
|
47
|
+
wrapping: boolean;
|
|
46
48
|
}
|
|
47
49
|
export declare class Allocator {
|
|
48
50
|
reset(): void;
|
|
@@ -16,7 +16,7 @@ export class Allocator {
|
|
|
16
16
|
lineFeed() {
|
|
17
17
|
}
|
|
18
18
|
allocate(bounds) {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
20
20
|
return !bounds ? undefined : {
|
|
21
21
|
exact: bounds.place ? parseCellRange(bounds.place, { x1: 0, y1: 0, x2: 0, y2: 0 }) : undefined,
|
|
22
22
|
widthMin: (_a = bounds.widthMin) !== null && _a !== void 0 ? _a : "",
|
|
@@ -27,6 +27,7 @@ export class Allocator {
|
|
|
27
27
|
heightGrowth: (_f = bounds.heightGrowth) !== null && _f !== void 0 ? _f : 0,
|
|
28
28
|
alignContent: (_g = bounds.alignContent) !== null && _g !== void 0 ? _g : To.Default,
|
|
29
29
|
alignFrame: (_h = bounds.alignFrame) !== null && _h !== void 0 ? _h : To.Default,
|
|
30
|
+
wrapping: (_j = bounds.wrapping) !== null && _j !== void 0 ? _j : false,
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -54,13 +55,14 @@ export class GridBasedAllocator {
|
|
|
54
55
|
this.rowCursor = this.newRowCursor;
|
|
55
56
|
}
|
|
56
57
|
allocate(bounds) {
|
|
57
|
-
var _a, _b, _c, _d;
|
|
58
|
+
var _a, _b, _c, _d, _e;
|
|
58
59
|
const result = {
|
|
59
60
|
exact: undefined,
|
|
60
61
|
widthMin: "", widthMax: "", widthGrowth: 0,
|
|
61
62
|
heightMin: "", heightMax: "", heightGrowth: 0,
|
|
62
63
|
alignContent: (_a = bounds === null || bounds === void 0 ? void 0 : bounds.alignContent) !== null && _a !== void 0 ? _a : To.Default,
|
|
63
64
|
alignFrame: (_b = bounds === null || bounds === void 0 ? void 0 : bounds.alignFrame) !== null && _b !== void 0 ? _b : To.Default,
|
|
65
|
+
wrapping: (_c = bounds === null || bounds === void 0 ? void 0 : bounds.wrapping) !== null && _c !== void 0 ? _c : false,
|
|
64
66
|
};
|
|
65
67
|
if (bounds === null || bounds === void 0 ? void 0 : bounds.place) {
|
|
66
68
|
result.exact = parseCellRange(bounds.place, { x1: 0, y1: 0, x2: 0, y2: 0 });
|
|
@@ -70,7 +72,7 @@ export class GridBasedAllocator {
|
|
|
70
72
|
const totalColumnCount = this.maxColumnCount !== 0 ? this.maxColumnCount : this.actualColumnCount;
|
|
71
73
|
const totalRowCount = this.maxRowCount !== 0 ? this.maxRowCount : this.actualRowCount;
|
|
72
74
|
const cr = result.exact = { x1: 0, y1: 0, x2: 0, y2: 0 };
|
|
73
|
-
let w = (
|
|
75
|
+
let w = (_d = bounds === null || bounds === void 0 ? void 0 : bounds.widthSpan) !== null && _d !== void 0 ? _d : 1;
|
|
74
76
|
if (w === 0)
|
|
75
77
|
w = totalColumnCount || 1;
|
|
76
78
|
if (w >= 0) {
|
|
@@ -83,7 +85,7 @@ export class GridBasedAllocator {
|
|
|
83
85
|
cr.x1 = Math.max(this.columnCursor + w, 1);
|
|
84
86
|
cr.x2 = this.columnCursor;
|
|
85
87
|
}
|
|
86
|
-
let h = (
|
|
88
|
+
let h = (_e = bounds === null || bounds === void 0 ? void 0 : bounds.heightSpan) !== null && _e !== void 0 ? _e : 1;
|
|
87
89
|
if (h === 0)
|
|
88
90
|
h = totalRowCount || 1;
|
|
89
91
|
if (h >= 0) {
|
|
@@ -16,14 +16,13 @@ export interface BlockArgs<T = unknown, M = unknown, R = void> extends Bounds {
|
|
|
16
16
|
throttling?: number;
|
|
17
17
|
logging?: Partial<LoggingOptions>;
|
|
18
18
|
shuffle?: boolean;
|
|
19
|
-
render: Render<T, M, R>;
|
|
20
19
|
initialize?: Render<T, M, R> | Array<Render<T, M, R>>;
|
|
21
|
-
finalize?: Render<T, M, R> | Array<Render<T, M, R>>;
|
|
22
20
|
override?: Render<T, M, R>;
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
render: Render<T, M, R>;
|
|
22
|
+
finalize?: Render<T, M, R> | Array<Render<T, M, R>>;
|
|
25
23
|
}
|
|
26
|
-
export declare function
|
|
24
|
+
export declare function setContext<T extends Object>(type: new (...args: any[]) => T, context: T): void;
|
|
25
|
+
export declare function use<T extends Object>(type: new (...args: any[]) => T): T;
|
|
27
26
|
export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
|
|
28
27
|
static readonly shortFrameDuration = 16;
|
|
29
28
|
static readonly longFrameDuration = 300;
|
|
@@ -32,7 +31,7 @@ export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
|
|
|
32
31
|
abstract readonly name: string;
|
|
33
32
|
abstract readonly driver: AbstractDriver<T>;
|
|
34
33
|
abstract readonly args: Readonly<BlockArgs<T, M, R>>;
|
|
35
|
-
abstract model
|
|
34
|
+
abstract model: M;
|
|
36
35
|
abstract readonly level: number;
|
|
37
36
|
abstract readonly host: VBlock;
|
|
38
37
|
abstract readonly children: CollectionReader<VBlock>;
|
|
@@ -49,7 +48,6 @@ export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
|
|
|
49
48
|
static claim<T = undefined, M = unknown, R = void, C = void>(name: string, args: BlockArgs<T, M, R>, driver?: AbstractDriver<T>): VBlock<T, M, R>;
|
|
50
49
|
static getDefaultLoggingOptions(): LoggingOptions | undefined;
|
|
51
50
|
static setDefaultLoggingOptions(logging?: LoggingOptions): void;
|
|
52
|
-
private static trySwitchContext;
|
|
53
51
|
}
|
|
54
52
|
export declare enum LayoutKind {
|
|
55
53
|
Block = 0,
|
|
@@ -16,7 +16,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
16
16
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
|
-
import { reactive, nonreactive, Transaction, options, Reentrance, Rx, Collection } from "reactronic";
|
|
19
|
+
import { reactive, nonreactive, Transaction, options, Reentrance, Rx, Collection, ObservableObject, raw } from "reactronic";
|
|
20
20
|
import { Allocator, To } from "./Allocator";
|
|
21
21
|
export var Priority;
|
|
22
22
|
(function (Priority) {
|
|
@@ -24,13 +24,11 @@ export var Priority;
|
|
|
24
24
|
Priority[Priority["AsyncP1"] = 1] = "AsyncP1";
|
|
25
25
|
Priority[Priority["AsyncP2"] = 2] = "AsyncP2";
|
|
26
26
|
})(Priority || (Priority = {}));
|
|
27
|
-
export function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
throw new Error(`context ${type.name} is not found`);
|
|
33
|
-
return b.args.nestedContext;
|
|
27
|
+
export function setContext(type, context) {
|
|
28
|
+
return VBlockImpl.setContext(type, context);
|
|
29
|
+
}
|
|
30
|
+
export function use(type) {
|
|
31
|
+
return VBlockImpl.use(type);
|
|
34
32
|
}
|
|
35
33
|
export class VBlock {
|
|
36
34
|
render() {
|
|
@@ -53,7 +51,7 @@ export class VBlock {
|
|
|
53
51
|
forEachChildRecursively(gSysRoot, action);
|
|
54
52
|
}
|
|
55
53
|
static claim(name, args, driver) {
|
|
56
|
-
var _a, _b
|
|
54
|
+
var _a, _b;
|
|
57
55
|
let result;
|
|
58
56
|
const owner = gCurrent.instance;
|
|
59
57
|
const children = owner.children;
|
|
@@ -70,18 +68,13 @@ export class VBlock {
|
|
|
70
68
|
result = ex.instance;
|
|
71
69
|
if (result.driver !== driver && driver !== undefined)
|
|
72
70
|
throw new Error(`changing block driver is not yet supported: "${result.driver.name}" -> "${driver === null || driver === void 0 ? void 0 : driver.name}"`);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
args.triggers = exTriggers;
|
|
77
|
-
}
|
|
78
|
-
else
|
|
79
|
-
(_c = args.triggers) !== null && _c !== void 0 ? _c : (args.triggers = { [CONTEXT_SWITCH]: args.nestedContext });
|
|
71
|
+
const exTriggers = (_b = result.args) === null || _b === void 0 ? void 0 : _b.triggers;
|
|
72
|
+
if (triggersAreEqual(args.triggers, exTriggers))
|
|
73
|
+
args.triggers = exTriggers;
|
|
80
74
|
result.args = args;
|
|
81
75
|
}
|
|
82
76
|
else {
|
|
83
77
|
result = new VBlockImpl(name, driver, owner, args);
|
|
84
|
-
VBlock.trySwitchContext(args, result, owner);
|
|
85
78
|
result.item = children.add(result);
|
|
86
79
|
VBlockImpl.grandCount++;
|
|
87
80
|
if (args.reacting)
|
|
@@ -95,26 +88,6 @@ export class VBlock {
|
|
|
95
88
|
static setDefaultLoggingOptions(logging) {
|
|
96
89
|
VBlockImpl.logging = logging;
|
|
97
90
|
}
|
|
98
|
-
static trySwitchContext(newArgs, block, owner) {
|
|
99
|
-
var _a, _b;
|
|
100
|
-
const ownerArgs = owner.args;
|
|
101
|
-
const ownerCtx = ownerArgs.nestedContext;
|
|
102
|
-
const ownerTriggers = ownerArgs.triggers;
|
|
103
|
-
const ctx = newArgs.nestedContext;
|
|
104
|
-
const result = ctx !== ((_a = block.args) === null || _a === void 0 ? void 0 : _a.nestedContext) || (ownerTriggers === null || ownerTriggers === void 0 ? void 0 : ownerTriggers[CONTEXT_SWITCH]) !== undefined;
|
|
105
|
-
if (ctx && ctx !== ownerCtx) {
|
|
106
|
-
(_b = newArgs.nestedContextType) !== null && _b !== void 0 ? _b : (newArgs.nestedContextType = ctx.constructor);
|
|
107
|
-
if (ownerCtx)
|
|
108
|
-
block.context = owner;
|
|
109
|
-
else
|
|
110
|
-
block.context = owner.context;
|
|
111
|
-
}
|
|
112
|
-
else if (ownerCtx)
|
|
113
|
-
block.context = owner;
|
|
114
|
-
else
|
|
115
|
-
block.context = owner.context;
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
91
|
}
|
|
119
92
|
VBlock.shortFrameDuration = 16;
|
|
120
93
|
VBlock.longFrameDuration = 300;
|
|
@@ -128,7 +101,6 @@ export var LayoutKind;
|
|
|
128
101
|
LayoutKind[LayoutKind["Group"] = 3] = "Group";
|
|
129
102
|
LayoutKind[LayoutKind["Text"] = 4] = "Text";
|
|
130
103
|
})(LayoutKind || (LayoutKind = {}));
|
|
131
|
-
const CONTEXT_SWITCH = Symbol("V-CONTEXT-SWITCH");
|
|
132
104
|
const createDefaultAllocator = () => new Allocator();
|
|
133
105
|
export class AbstractDriver {
|
|
134
106
|
constructor(name, layout, createAllocator) {
|
|
@@ -191,6 +163,7 @@ export class AbstractDriver {
|
|
|
191
163
|
heightMin: "", heightMax: "", heightGrowth,
|
|
192
164
|
alignContent: To.Default,
|
|
193
165
|
alignFrame: To.Default,
|
|
166
|
+
wrapping: false,
|
|
194
167
|
};
|
|
195
168
|
else
|
|
196
169
|
b.place.heightGrowth = heightGrowth;
|
|
@@ -223,6 +196,17 @@ export class StaticDriver extends AbstractDriver {
|
|
|
223
196
|
function getBlockName(block) {
|
|
224
197
|
return block.stamp >= 0 ? block.name : undefined;
|
|
225
198
|
}
|
|
199
|
+
class VBlockContext extends ObservableObject {
|
|
200
|
+
constructor(type, instance) {
|
|
201
|
+
super();
|
|
202
|
+
this.type = type;
|
|
203
|
+
this.instance = instance;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
__decorate([
|
|
207
|
+
raw,
|
|
208
|
+
__metadata("design:type", Function)
|
|
209
|
+
], VBlockContext.prototype, "type", void 0);
|
|
226
210
|
class VBlockImpl extends VBlock {
|
|
227
211
|
constructor(name, driver, owner, args) {
|
|
228
212
|
super();
|
|
@@ -239,11 +223,45 @@ class VBlockImpl extends VBlock {
|
|
|
239
223
|
this.native = undefined;
|
|
240
224
|
this.place = undefined;
|
|
241
225
|
this.allocator = driver.createAllocator();
|
|
242
|
-
this.
|
|
226
|
+
this.senior = owner.context ? owner : owner.senior;
|
|
227
|
+
this.context = undefined;
|
|
243
228
|
}
|
|
244
229
|
rerender(_triggers) {
|
|
245
230
|
runRender(this.item);
|
|
246
231
|
}
|
|
232
|
+
static use(type) {
|
|
233
|
+
var _a, _b;
|
|
234
|
+
let b = gCurrent.instance;
|
|
235
|
+
while (((_a = b.context) === null || _a === void 0 ? void 0 : _a.type) !== type && b.host !== b)
|
|
236
|
+
b = b.senior;
|
|
237
|
+
if (b.host === b)
|
|
238
|
+
throw new Error(`${type.name} context doesn't exist`);
|
|
239
|
+
return (_b = b.context) === null || _b === void 0 ? void 0 : _b.instance;
|
|
240
|
+
}
|
|
241
|
+
static setContext(type, context) {
|
|
242
|
+
const block = gCurrent.instance;
|
|
243
|
+
const host = block.host;
|
|
244
|
+
const hostCtx = nonreactive(() => { var _a; return (_a = host.context) === null || _a === void 0 ? void 0 : _a.instance; });
|
|
245
|
+
if (context && context !== hostCtx) {
|
|
246
|
+
if (hostCtx)
|
|
247
|
+
block.senior = host;
|
|
248
|
+
else
|
|
249
|
+
block.senior = host.senior;
|
|
250
|
+
Transaction.run({ separation: true }, () => {
|
|
251
|
+
const ctx = block.context;
|
|
252
|
+
if (ctx) {
|
|
253
|
+
ctx.type = type;
|
|
254
|
+
ctx.instance = context;
|
|
255
|
+
}
|
|
256
|
+
else
|
|
257
|
+
block.context = new VBlockContext(type, context);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
else if (hostCtx)
|
|
261
|
+
block.senior = host;
|
|
262
|
+
else
|
|
263
|
+
block.senior = host.senior;
|
|
264
|
+
}
|
|
247
265
|
}
|
|
248
266
|
VBlockImpl.grandCount = 0;
|
|
249
267
|
VBlockImpl.disposableCount = 0;
|
|
@@ -369,63 +387,67 @@ function renderIncrementally(owner, stamp, allChildren, items, priority) {
|
|
|
369
387
|
});
|
|
370
388
|
}
|
|
371
389
|
function prepareAndRunRender(item, redeploy, sequential) {
|
|
390
|
+
var _a, _b;
|
|
372
391
|
const block = item.instance;
|
|
373
392
|
if (block.stamp >= 0) {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
else
|
|
380
|
-
runRender(item);
|
|
381
|
-
});
|
|
393
|
+
prepareRender(item, redeploy, sequential);
|
|
394
|
+
if ((_a = block.args) === null || _a === void 0 ? void 0 : _a.reacting)
|
|
395
|
+
nonreactive(block.rerender, (_b = block.args) === null || _b === void 0 ? void 0 : _b.triggers);
|
|
396
|
+
else
|
|
397
|
+
runRender(item);
|
|
382
398
|
}
|
|
383
399
|
}
|
|
384
400
|
function prepareRender(item, redeploy, sequential) {
|
|
385
|
-
var _a;
|
|
386
401
|
const block = item.instance;
|
|
387
402
|
const driver = block.driver;
|
|
388
403
|
if (block.stamp === 0) {
|
|
389
404
|
block.stamp = 1;
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
405
|
+
runUnder(item, () => {
|
|
406
|
+
var _a;
|
|
407
|
+
if ((_a = block.args) === null || _a === void 0 ? void 0 : _a.reacting) {
|
|
408
|
+
Transaction.outside(() => {
|
|
409
|
+
var _a, _b, _c;
|
|
410
|
+
if (Rx.isLogging)
|
|
411
|
+
Rx.setLoggingHint(block, block.name);
|
|
412
|
+
Rx.getController(block.rerender).configure({
|
|
413
|
+
order: block.level,
|
|
414
|
+
monitor: (_a = block.args) === null || _a === void 0 ? void 0 : _a.monitor,
|
|
415
|
+
throttling: (_b = block.args) === null || _b === void 0 ? void 0 : _b.throttling,
|
|
416
|
+
logging: (_c = block.args) === null || _c === void 0 ? void 0 : _c.logging,
|
|
417
|
+
});
|
|
400
418
|
});
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
419
|
+
}
|
|
420
|
+
driver.initialize(block, undefined);
|
|
421
|
+
driver.deploy(block, sequential);
|
|
422
|
+
driver.arrange(block, block.place, undefined);
|
|
423
|
+
});
|
|
406
424
|
}
|
|
407
425
|
else if (redeploy)
|
|
408
|
-
|
|
426
|
+
runUnder(item, () => {
|
|
427
|
+
driver.deploy(block, sequential);
|
|
428
|
+
});
|
|
409
429
|
}
|
|
410
430
|
function runRender(item) {
|
|
411
431
|
const block = item.instance;
|
|
412
432
|
if (block.stamp >= 0) {
|
|
413
433
|
let result = undefined;
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
434
|
+
runUnder(item, () => {
|
|
435
|
+
try {
|
|
436
|
+
block.stamp++;
|
|
437
|
+
block.numerator = 0;
|
|
438
|
+
block.children.beginMerge();
|
|
439
|
+
result = block.driver.render(block);
|
|
440
|
+
if (result instanceof Promise)
|
|
441
|
+
result.then(v => { runRenderNestedTreesThenDo(undefined, NOP); return v; }, e => { console.log(e); runRenderNestedTreesThenDo(e !== null && e !== void 0 ? e : new Error("unknown error"), NOP); });
|
|
442
|
+
else
|
|
443
|
+
runRenderNestedTreesThenDo(undefined, NOP);
|
|
444
|
+
}
|
|
445
|
+
catch (e) {
|
|
446
|
+
runRenderNestedTreesThenDo(e, NOP);
|
|
447
|
+
console.log(`Rendering failed: ${block.name}`);
|
|
448
|
+
console.log(`${e}`);
|
|
449
|
+
}
|
|
450
|
+
});
|
|
429
451
|
}
|
|
430
452
|
}
|
|
431
453
|
function runFinalize(item, isLeader) {
|
|
@@ -548,7 +570,7 @@ Object.defineProperty(gSysRoot.instance, "host", {
|
|
|
548
570
|
configurable: false,
|
|
549
571
|
enumerable: true,
|
|
550
572
|
});
|
|
551
|
-
Object.defineProperty(gSysRoot.instance, "
|
|
573
|
+
Object.defineProperty(gSysRoot.instance, "senior", {
|
|
552
574
|
value: gSysRoot.instance,
|
|
553
575
|
writable: false,
|
|
554
576
|
configurable: false,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VBlock, Place, BlockArgs } from "../core/api";
|
|
2
2
|
import { HtmlDriver } from "./HtmlDriver";
|
|
3
3
|
export declare function Block<M = unknown, R = void>(name: string, args: BlockArgs<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
4
|
-
export declare function PlainText(content: string): VBlock<HTMLElement, void, void>;
|
|
5
|
-
export declare function HtmlText(content: string): VBlock<HTMLElement, void, void>;
|
|
4
|
+
export declare function PlainText(content: string, wrapping?: boolean): VBlock<HTMLElement, void, void>;
|
|
5
|
+
export declare function HtmlText(content: string, wrapping?: boolean): VBlock<HTMLElement, void, void>;
|
|
6
6
|
export declare function Grid<M = unknown, R = void>(name: string, args: BlockArgs<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
7
7
|
export declare function Line<T = void>(claim: (x: void) => T): VBlock<HTMLElement>;
|
|
8
8
|
export declare function lineFeed(args?: BlockArgs<HTMLElement, void, void>, noCoalescing?: boolean): VBlock<HTMLElement>;
|
|
@@ -3,11 +3,11 @@ import { HtmlDriver } from "./HtmlDriver";
|
|
|
3
3
|
export function Block(name, args) {
|
|
4
4
|
return VBlock.claim(name, args, VerstakTags.block);
|
|
5
5
|
}
|
|
6
|
-
export function PlainText(content) {
|
|
7
|
-
return VBlock.claim("", { render(e) { e.innerText = content; } }, VerstakTags.text);
|
|
6
|
+
export function PlainText(content, wrapping) {
|
|
7
|
+
return VBlock.claim("", { wrapping, render(e) { e.innerText = content; } }, VerstakTags.text);
|
|
8
8
|
}
|
|
9
|
-
export function HtmlText(content) {
|
|
10
|
-
return VBlock.claim("", { render(e) { e.innerHTML = content; } }, VerstakTags.text);
|
|
9
|
+
export function HtmlText(content, wrapping) {
|
|
10
|
+
return VBlock.claim("", { wrapping, render(e) { e.innerHTML = content; } }, VerstakTags.text);
|
|
11
11
|
}
|
|
12
12
|
export function Grid(name, args) {
|
|
13
13
|
return VBlock.claim(name, args, VerstakTags.grid);
|
|
@@ -26,12 +26,13 @@ export function Group(name, args) {
|
|
|
26
26
|
}
|
|
27
27
|
export class VerstakDriver extends HtmlDriver {
|
|
28
28
|
arrange(block, place, heightGrowth) {
|
|
29
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
30
|
-
|
|
29
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
30
|
+
const native = block.native;
|
|
31
|
+
if (native) {
|
|
31
32
|
if (heightGrowth === undefined) {
|
|
32
33
|
const ex = block.stamp > 1 ? block.place : undefined;
|
|
33
34
|
if (place !== ex) {
|
|
34
|
-
const css =
|
|
35
|
+
const css = native.style;
|
|
35
36
|
const exact = place === null || place === void 0 ? void 0 : place.exact;
|
|
36
37
|
if (exact !== (ex === null || ex === void 0 ? void 0 : ex.exact)) {
|
|
37
38
|
if (exact) {
|
|
@@ -46,10 +47,14 @@ export class VerstakDriver extends HtmlDriver {
|
|
|
46
47
|
}
|
|
47
48
|
const widthGrowth = (_a = place === null || place === void 0 ? void 0 : place.widthGrowth) !== null && _a !== void 0 ? _a : 0;
|
|
48
49
|
if (widthGrowth !== ((_b = ex === null || ex === void 0 ? void 0 : ex.widthGrowth) !== null && _b !== void 0 ? _b : 0)) {
|
|
49
|
-
if (widthGrowth > 0)
|
|
50
|
+
if (widthGrowth > 0) {
|
|
50
51
|
css.flexGrow = `${widthGrowth}`;
|
|
51
|
-
|
|
52
|
+
css.flexBasis = "0";
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
52
55
|
css.flexGrow = "";
|
|
56
|
+
css.flexBasis = "";
|
|
57
|
+
}
|
|
53
58
|
}
|
|
54
59
|
const widthMin = (_c = place === null || place === void 0 ? void 0 : place.widthMin) !== null && _c !== void 0 ? _c : "";
|
|
55
60
|
if (widthMin !== ((_d = ex === null || ex === void 0 ? void 0 : ex.widthMin) !== null && _d !== void 0 ? _d : ""))
|
|
@@ -92,6 +97,13 @@ export class VerstakDriver extends HtmlDriver {
|
|
|
92
97
|
else
|
|
93
98
|
css.alignSelf = css.justifySelf = "";
|
|
94
99
|
}
|
|
100
|
+
const wrapping = (_s = place === null || place === void 0 ? void 0 : place.wrapping) !== null && _s !== void 0 ? _s : false;
|
|
101
|
+
if (wrapping !== ((_t = ex === null || ex === void 0 ? void 0 : ex.wrapping) !== null && _t !== void 0 ? _t : false)) {
|
|
102
|
+
if (wrapping)
|
|
103
|
+
native.setAttribute("wrapping", "");
|
|
104
|
+
else
|
|
105
|
+
native.removeAttribute("wrapping");
|
|
106
|
+
}
|
|
95
107
|
}
|
|
96
108
|
}
|
|
97
109
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VBlock, Render, BlockArgs } from "../core/api";
|
|
2
|
-
export declare function HtmlBody(name: string,
|
|
2
|
+
export declare function HtmlBody(name: string, args: BlockArgs<HTMLElement>): VBlock<HTMLElement>;
|
|
3
3
|
export declare function A<M = unknown, R = void>(name: string, args: BlockArgs<HTMLAnchorElement, M, R> | Render<HTMLAnchorElement, M, R>): VBlock<HTMLAnchorElement, M, R>;
|
|
4
4
|
export declare function Abbr<M = unknown, R = void>(name: string, args: BlockArgs<HTMLElement, M, R> | Render<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
5
5
|
export declare function Address<M = unknown, R = void>(name: string, args: BlockArgs<HTMLElement, M, R> | Render<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VBlock, StaticDriver, LayoutKind } from "../core/api";
|
|
2
2
|
import { HtmlDriver, SvgDriver } from "./HtmlDriver";
|
|
3
|
-
export function HtmlBody(name,
|
|
3
|
+
export function HtmlBody(name, args) {
|
|
4
4
|
const driver = new StaticDriver(global.document.body, name, LayoutKind.Block);
|
|
5
|
-
return VBlock.claim(name,
|
|
5
|
+
return VBlock.claim(name, args, driver);
|
|
6
6
|
}
|
|
7
7
|
export function A(name, args) { return VBlock.claim(name, args instanceof Function ? { render: args } : args, HtmlTags.a); }
|
|
8
8
|
export function Abbr(name, args) { return VBlock.claim(name, args instanceof Function ? { render: args } : args, HtmlTags.abbr); }
|
|
@@ -57,8 +57,11 @@ export class BaseHtmlDriver extends AbstractDriver {
|
|
|
57
57
|
if (value === undefined) {
|
|
58
58
|
const effect = gBlinkingEffect;
|
|
59
59
|
VBlock.runForAllBlocks((e) => {
|
|
60
|
-
if (e instanceof HTMLElement)
|
|
61
|
-
e.classList.remove(`${effect}-0`, `${effect}-1`);
|
|
60
|
+
if (e instanceof HTMLElement) {
|
|
61
|
+
e.classList.remove(`${effect}-0-0`, `${effect}-0-1`);
|
|
62
|
+
e.classList.remove(`${effect}-1-0`, `${effect}-1-1`);
|
|
63
|
+
e.classList.remove(`${effect}-2-0`, `${effect}-2-1`);
|
|
64
|
+
}
|
|
62
65
|
});
|
|
63
66
|
}
|
|
64
67
|
gBlinkingEffect = value;
|