verstak 0.22.516 → 0.23.101

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.
@@ -22,35 +22,17 @@ import { emitLetters, equalCellRanges } from "./CellRange";
22
22
  import { Cursor, Align } from "./Cursor";
23
23
  export var Priority;
24
24
  (function (Priority) {
25
- Priority[Priority["SyncP0"] = 0] = "SyncP0";
26
- Priority[Priority["AsyncP1"] = 1] = "AsyncP1";
27
- Priority[Priority["AsyncP2"] = 2] = "AsyncP2";
25
+ Priority[Priority["Realtime"] = 0] = "Realtime";
26
+ Priority[Priority["Normal"] = 1] = "Normal";
27
+ Priority[Priority["Background"] = 2] = "Background";
28
28
  })(Priority || (Priority = {}));
29
- export function asBaseFor(outer, base) {
30
- if (outer instanceof Function)
31
- outer = { render: outer };
32
- if (base instanceof Function)
33
- base = { render: base };
34
- 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) });
35
- return result;
36
- }
37
- function via(outer, base) {
38
- const inherited = base !== null && base !== void 0 ? base : NOP;
39
- return outer ? b => outer(b, () => inherited(b)) : inherited;
40
- }
41
- export function nestedContext(type, context) {
42
- return VBlockImpl.setContext(type, context);
43
- }
44
- export function useContext(type) {
45
- return VBlockImpl.use(type);
46
- }
47
29
  export class VBlock {
48
30
  get isInitialRendering() {
49
31
  return this.stamp === 2;
50
32
  }
51
33
  static root(render) {
52
34
  gSysRoot.instance.body.render = render;
53
- prepareAndRunRender(gSysRoot, false, false);
35
+ triggerRendering(gSysRoot);
54
36
  }
55
37
  static get current() {
56
38
  return gCurrent.instance;
@@ -61,15 +43,17 @@ export class VBlock {
61
43
  static runForAllBlocks(action) {
62
44
  forEachChildRecursively(gSysRoot, action);
63
45
  }
64
- static claim(driver, body) {
65
- var _a, _b;
46
+ static claim(driver, body, base) {
47
+ var _a;
66
48
  let result;
67
49
  const owner = gCurrent.instance;
68
50
  const children = owner.children;
69
51
  let ex = undefined;
52
+ if (body)
53
+ body.base = base;
54
+ else
55
+ body = base !== null && base !== void 0 ? base : {};
70
56
  driver !== null && driver !== void 0 ? driver : (driver = AbstractDriver.group);
71
- if (body instanceof Function)
72
- body = { render: body };
73
57
  let key = body.key;
74
58
  if (driver.isLine) {
75
59
  const last = children.lastClaimedItem();
@@ -81,7 +65,7 @@ export class VBlock {
81
65
  result = ex.instance;
82
66
  if (result.driver !== driver && driver !== undefined)
83
67
  throw new Error(`changing block driver is not yet supported: "${result.driver.name}" -> "${driver === null || driver === void 0 ? void 0 : driver.name}"`);
84
- const exTriggers = (_b = result.body) === null || _b === void 0 ? void 0 : _b.triggers;
68
+ const exTriggers = result.body.triggers;
85
69
  if (triggersAreEqual(body.triggers, exTriggers))
86
70
  body.triggers = exTriggers;
87
71
  result.body = body;
@@ -90,7 +74,7 @@ export class VBlock {
90
74
  result = new VBlockImpl(key || VBlock.generateKey(owner), driver, owner, body);
91
75
  result.item = children.add(result);
92
76
  VBlockImpl.grandCount++;
93
- if (body.reacting)
77
+ if (isReaction(body))
94
78
  VBlockImpl.disposableCount++;
95
79
  }
96
80
  return result;
@@ -100,9 +84,9 @@ export class VBlock {
100
84
  const lettered = emitLetters(n);
101
85
  let result;
102
86
  if (Rx.isLogging)
103
- result = `[${getCallerInfo(lettered)}]`;
87
+ result = `·${getCallerInfo(lettered)}`;
104
88
  else
105
- result = `[${lettered}]`;
89
+ result = `·${lettered}`;
106
90
  return result;
107
91
  }
108
92
  static getDefaultLoggingOptions() {
@@ -114,43 +98,44 @@ export class VBlock {
114
98
  }
115
99
  VBlock.shortFrameDuration = 16;
116
100
  VBlock.longFrameDuration = 300;
117
- VBlock.currentRenderingPriority = Priority.SyncP0;
101
+ VBlock.currentRenderingPriority = Priority.Realtime;
118
102
  VBlock.frameDuration = VBlock.longFrameDuration;
119
103
  export var LayoutKind;
120
104
  (function (LayoutKind) {
121
105
  LayoutKind[LayoutKind["Block"] = 0] = "Block";
122
106
  LayoutKind[LayoutKind["Grid"] = 1] = "Grid";
123
107
  LayoutKind[LayoutKind["Line"] = 2] = "Line";
124
- LayoutKind[LayoutKind["Group"] = 3] = "Group";
108
+ LayoutKind[LayoutKind["Fragment"] = 3] = "Fragment";
125
109
  LayoutKind[LayoutKind["Text"] = 4] = "Text";
126
110
  })(LayoutKind || (LayoutKind = {}));
127
111
  const createDefaultCursor = () => new Cursor();
128
112
  export class AbstractDriver {
129
- constructor(name, layout, createCursor) {
130
- this.name = name;
131
- this.layout = layout;
132
- this.createCursor = createCursor !== null && createCursor !== void 0 ? createCursor : createDefaultCursor;
133
- }
134
113
  get isSequential() { return (this.layout & 1) === 0; }
135
114
  get isAuxiliary() { return (this.layout & 2) === 2; }
136
115
  get isBlock() { return this.layout === LayoutKind.Block; }
137
116
  get isGrid() { return this.layout === LayoutKind.Grid; }
138
117
  get isLine() { return this.layout === LayoutKind.Line; }
118
+ constructor(name, layout, createCursor) {
119
+ this.name = name;
120
+ this.layout = layout;
121
+ this.createCursor = createCursor !== null && createCursor !== void 0 ? createCursor : createDefaultCursor;
122
+ }
139
123
  initialize(block, native) {
140
- var _a, _b;
141
124
  const b = block;
142
125
  b.native = native;
143
- (_b = (_a = block.body).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, block, NOP);
126
+ invokeInitializeChain(b, b.body);
127
+ }
128
+ deploy(block) {
129
+ }
130
+ render(block) {
131
+ invokeRenderChain(block, block.body);
144
132
  }
145
133
  finalize(block, isLeader) {
146
- var _a, _b;
147
134
  const b = block;
148
- (_b = (_a = block.body).finalize) === null || _b === void 0 ? void 0 : _b.call(_a, block, NOP);
135
+ invokeFinalizeChain(b, b.body);
149
136
  b.native = null;
150
137
  return isLeader;
151
138
  }
152
- deploy(block, sequential) {
153
- }
154
139
  applyCellRange(block, cellRange) {
155
140
  }
156
141
  applyWidthGrowth(block, widthGrowth) {
@@ -171,24 +156,39 @@ export class AbstractDriver {
171
156
  }
172
157
  applyContentWrapping(block, contentWrapping) {
173
158
  }
174
- applyFloating(block, floating) {
159
+ applyOverlayVisible(block, overlayVisible) {
175
160
  }
176
- render(block) {
177
- var _a;
178
- let result;
179
- const override = (_a = block.body) === null || _a === void 0 ? void 0 : _a.override;
180
- if (override)
181
- result = override(block, NOP);
182
- else
183
- result = invokeRenderFunction(block);
184
- return result;
161
+ applyStyling(block, secondary, styleName, enabled) {
185
162
  }
186
163
  }
187
- AbstractDriver.group = new AbstractDriver("group", LayoutKind.Group);
188
- function invokeRenderFunction(block) {
164
+ AbstractDriver.group = new AbstractDriver("group", LayoutKind.Fragment);
165
+ function isReaction(body) {
189
166
  var _a;
190
- const r = (_a = block.body.render) !== null && _a !== void 0 ? _a : NOP;
191
- return r(block, NOP);
167
+ return (_a = body === null || body === void 0 ? void 0 : body.reaction) !== null && _a !== void 0 ? _a : ((body === null || body === void 0 ? void 0 : body.base) ? isReaction(body === null || body === void 0 ? void 0 : body.base) : false);
168
+ }
169
+ function invokeInitializeChain(block, body) {
170
+ const initialize = body.initialize;
171
+ const base = body.base;
172
+ if (initialize)
173
+ initialize(block, base ? () => invokeInitializeChain(block, base) : NOP);
174
+ else if (base)
175
+ invokeInitializeChain(block, base);
176
+ }
177
+ function invokeRenderChain(block, body) {
178
+ const render = body.render;
179
+ const base = body.base;
180
+ if (render)
181
+ render(block, base ? () => invokeRenderChain(block, base) : NOP);
182
+ else if (base)
183
+ invokeRenderChain(block, base);
184
+ }
185
+ function invokeFinalizeChain(block, body) {
186
+ const finalize = body.finalize;
187
+ const base = body.base;
188
+ if (finalize)
189
+ finalize(block, base ? () => invokeFinalizeChain(block, base) : NOP);
190
+ else if (base)
191
+ invokeFinalizeChain(block, base);
192
192
  }
193
193
  export class StaticDriver extends AbstractDriver {
194
194
  constructor(element, name, layout, createCursor) {
@@ -199,20 +199,39 @@ export class StaticDriver extends AbstractDriver {
199
199
  super.initialize(block, this.element);
200
200
  }
201
201
  }
202
+ export class ContextVariable {
203
+ constructor(defaultValue) {
204
+ this.defaultValue = defaultValue;
205
+ }
206
+ set value(value) {
207
+ VBlockImpl.setContextVariableValue(this, value);
208
+ }
209
+ get value() {
210
+ return VBlockImpl.useContextVariableValue(this);
211
+ }
212
+ get valueOrUndefined() {
213
+ return VBlockImpl.tryUseContextVariable(this);
214
+ }
215
+ }
202
216
  function getBlockKey(block) {
203
217
  return block.stamp >= 0 ? block.key : undefined;
204
218
  }
205
219
  class VBlockContext extends ObservableObject {
206
- constructor(type, instance) {
220
+ constructor(variable, value) {
207
221
  super();
208
- this.type = type;
209
- this.instance = instance;
222
+ this.next = undefined;
223
+ this.variable = variable;
224
+ this.value = value;
210
225
  }
211
226
  }
212
227
  __decorate([
213
228
  raw,
214
229
  __metadata("design:type", Object)
215
- ], VBlockContext.prototype, "type", void 0);
230
+ ], VBlockContext.prototype, "next", void 0);
231
+ __decorate([
232
+ raw,
233
+ __metadata("design:type", ContextVariable)
234
+ ], VBlockContext.prototype, "variable", void 0);
216
235
  class VBlockImpl extends VBlock {
217
236
  constructor(key, driver, owner, body) {
218
237
  super();
@@ -221,6 +240,7 @@ class VBlockImpl extends VBlock {
221
240
  this.body = body;
222
241
  this.model = undefined;
223
242
  this.assignedCells = undefined;
243
+ this.assignedStyle = false;
224
244
  this.appliedCellRange = Cursor.UndefinedCellRange;
225
245
  this.appliedWidthGrowth = 0;
226
246
  this.appliedMinWidth = "";
@@ -231,9 +251,9 @@ class VBlockImpl extends VBlock {
231
251
  this.appliedContentAlignment = Align.Default;
232
252
  this.appliedFrameAlignment = Align.Default;
233
253
  this.appliedContentWrapping = false;
234
- this.appliedFloating = false;
254
+ this.appliedOverlayVisible = undefined;
235
255
  this.childrenShuffling = false;
236
- this.renderingPriority = Priority.SyncP0;
256
+ this.renderingPriority = Priority.Realtime;
237
257
  this.level = owner.level + 1;
238
258
  this.host = owner;
239
259
  this.children = new Collection(driver.isSequential, getBlockKey);
@@ -242,11 +262,17 @@ class VBlockImpl extends VBlock {
242
262
  this.stamp = 0;
243
263
  this.native = undefined;
244
264
  this.cursor = driver.createCursor();
245
- this.senior = owner.context ? owner : owner.senior;
265
+ this.outer = owner.context ? owner : owner.outer;
246
266
  this.context = undefined;
247
267
  }
248
- rerender(_triggers) {
249
- runRender(this.item);
268
+ get isMoved() {
269
+ let owner = this.host;
270
+ if (owner.driver.isLine)
271
+ owner = owner.host;
272
+ return owner.children.isMoved(this.item);
273
+ }
274
+ render(_triggers) {
275
+ renderNow(this.item);
250
276
  }
251
277
  get cells() { return this.assignedCells; }
252
278
  set cells(value) {
@@ -322,50 +348,59 @@ class VBlockImpl extends VBlock {
322
348
  this.appliedContentWrapping = value;
323
349
  }
324
350
  }
325
- get floating() { return this.appliedFloating; }
326
- set floating(value) {
327
- if (value !== this.appliedFloating) {
328
- this.driver.applyFloating(this, value);
329
- this.appliedFloating = value;
351
+ get overlayVisible() { return this.appliedOverlayVisible; }
352
+ set overlayVisible(value) {
353
+ if (value !== this.appliedOverlayVisible) {
354
+ this.driver.applyOverlayVisible(this, value);
355
+ this.appliedOverlayVisible = value;
330
356
  }
331
357
  }
358
+ style(styleName, enabled) {
359
+ this.driver.applyStyling(this, this.assignedStyle, styleName, enabled);
360
+ this.assignedStyle = true;
361
+ }
332
362
  configureReactronic(options) {
333
- if (this.stamp !== 1 || !this.body.reacting)
363
+ if (this.stamp !== 1 || !isReaction(this.body))
334
364
  throw new Error("reactronic can be configured only for reacting blocks and only inside initialize");
335
- return Rx.getController(this.rerender).configure(options);
365
+ return Rx.getController(this.render).configure(options);
336
366
  }
337
- static use(type) {
367
+ static tryUseContextVariable(variable) {
338
368
  var _a, _b;
339
369
  let b = gCurrent.instance;
340
- while (((_a = b.context) === null || _a === void 0 ? void 0 : _a.type) !== type && b.host !== b)
341
- b = b.senior;
342
- if (b.host === b)
343
- throw new Error(`${type.name} context doesn't exist`);
344
- return (_b = b.context) === null || _b === void 0 ? void 0 : _b.instance;
370
+ while (((_a = b.context) === null || _a === void 0 ? void 0 : _a.variable) !== variable && b.host !== b)
371
+ b = b.outer;
372
+ return (_b = b.context) === null || _b === void 0 ? void 0 : _b.value;
373
+ }
374
+ static useContextVariableValue(variable) {
375
+ var _a;
376
+ const result = (_a = VBlockImpl.tryUseContextVariable(variable)) !== null && _a !== void 0 ? _a : variable.defaultValue;
377
+ if (!result)
378
+ throw new Error("context doesn't exist");
379
+ return result;
345
380
  }
346
- static setContext(type, context) {
381
+ static setContextVariableValue(variable, value) {
347
382
  const block = gCurrent.instance;
348
383
  const host = block.host;
349
- const hostCtx = nonreactive(() => { var _a; return (_a = host.context) === null || _a === void 0 ? void 0 : _a.instance; });
350
- if (context && context !== hostCtx) {
384
+ const hostCtx = nonreactive(() => { var _a; return (_a = host.context) === null || _a === void 0 ? void 0 : _a.value; });
385
+ if (value && value !== hostCtx) {
351
386
  if (hostCtx)
352
- block.senior = host;
387
+ block.outer = host;
353
388
  else
354
- block.senior = host.senior;
389
+ block.outer = host.outer;
355
390
  Transaction.run({ separation: true }, () => {
356
391
  const ctx = block.context;
357
392
  if (ctx) {
358
- ctx.type = type;
359
- ctx.instance = context;
393
+ ctx.variable = variable;
394
+ ctx.value = value;
360
395
  }
361
396
  else
362
- block.context = new VBlockContext(type, context);
397
+ block.context = new VBlockContext(variable, value);
363
398
  });
364
399
  }
365
400
  else if (hostCtx)
366
- block.senior = host;
401
+ block.outer = host;
367
402
  else
368
- block.senior = host.senior;
403
+ block.outer = host.outer;
369
404
  }
370
405
  }
371
406
  VBlockImpl.grandCount = 0;
@@ -381,7 +416,7 @@ __decorate([
381
416
  __metadata("design:type", Function),
382
417
  __metadata("design:paramtypes", [Object]),
383
418
  __metadata("design:returntype", void 0)
384
- ], VBlockImpl.prototype, "rerender", null);
419
+ ], VBlockImpl.prototype, "render", null);
385
420
  function runRenderNestedTreesThenDo(error, action) {
386
421
  var _a;
387
422
  const current = gCurrent;
@@ -392,7 +427,7 @@ function runRenderNestedTreesThenDo(error, action) {
392
427
  try {
393
428
  children.endMerge(error);
394
429
  for (const item of children.removedItems(true)) {
395
- runFinalize(item, true, true);
430
+ triggerFinalization(item, true, true);
396
431
  }
397
432
  if (!error) {
398
433
  const ownerIsBlock = owner.driver.isBlock;
@@ -409,11 +444,11 @@ function runRenderNestedTreesThenDo(error, action) {
409
444
  const block = item.instance;
410
445
  const driver = block.driver;
411
446
  const host = driver.isLine ? owner : partHost;
412
- const p = (_a = block.renderingPriority) !== null && _a !== void 0 ? _a : Priority.SyncP0;
447
+ const p = (_a = block.renderingPriority) !== null && _a !== void 0 ? _a : Priority.Realtime;
413
448
  redeploy = markToRedeployIfNecessary(redeploy, host, item, children, sequential);
414
- if (p === Priority.SyncP0)
415
- prepareAndRunRender(item, children.isMoved(item), sequential);
416
- else if (p === Priority.AsyncP1)
449
+ if (p === Priority.Realtime)
450
+ triggerRendering(item);
451
+ else if (p === Priority.Normal)
417
452
  p1 = push(item, p1);
418
453
  else
419
454
  p2 = push(item, p2);
@@ -447,9 +482,9 @@ function startIncrementalRendering(owner, allChildren, priority1, priority2) {
447
482
  return __awaiter(this, void 0, void 0, function* () {
448
483
  const stamp = owner.instance.stamp;
449
484
  if (priority1)
450
- yield renderIncrementally(owner, stamp, allChildren, priority1, Priority.AsyncP1);
485
+ yield renderIncrementally(owner, stamp, allChildren, priority1, Priority.Normal);
451
486
  if (priority2)
452
- yield renderIncrementally(owner, stamp, allChildren, priority2, Priority.AsyncP2);
487
+ yield renderIncrementally(owner, stamp, allChildren, priority2, Priority.Background);
453
488
  });
454
489
  }
455
490
  function renderIncrementally(owner, stamp, allChildren, items, priority) {
@@ -460,13 +495,12 @@ function renderIncrementally(owner, stamp, allChildren, items, priority) {
460
495
  let outerPriority = VBlock.currentRenderingPriority;
461
496
  VBlock.currentRenderingPriority = priority;
462
497
  try {
463
- const sequential = block.children.strict;
464
498
  if (block.childrenShuffling)
465
499
  shuffle(items);
466
- const frameDurationLimit = priority === Priority.AsyncP2 ? VBlock.shortFrameDuration : Infinity;
500
+ const frameDurationLimit = priority === Priority.Background ? VBlock.shortFrameDuration : Infinity;
467
501
  let frameDuration = Math.min(frameDurationLimit, Math.max(VBlock.frameDuration / 4, VBlock.shortFrameDuration));
468
502
  for (const child of items) {
469
- prepareAndRunRender(child, allChildren.isMoved(child), sequential);
503
+ triggerRendering(child);
470
504
  if (Transaction.isFrameOver(1, frameDuration)) {
471
505
  VBlock.currentRenderingPriority = outerPriority;
472
506
  yield Transaction.requestNextFrame(0);
@@ -484,51 +518,46 @@ function renderIncrementally(owner, stamp, allChildren, items, priority) {
484
518
  }
485
519
  });
486
520
  }
487
- function prepareAndRunRender(item, redeploy, sequential) {
488
- var _a, _b;
521
+ function triggerRendering(item) {
489
522
  const block = item.instance;
490
523
  if (block.stamp >= 0) {
491
- prepareRender(item, redeploy, sequential);
492
- if ((_a = block.body) === null || _a === void 0 ? void 0 : _a.reacting)
493
- nonreactive(block.rerender, (_b = block.body) === null || _b === void 0 ? void 0 : _b.triggers);
494
- else
495
- runRender(item);
496
- }
497
- }
498
- function prepareRender(item, redeploy, sequential) {
499
- const block = item.instance;
500
- const driver = block.driver;
501
- if (block.stamp === 0) {
502
- block.stamp = 1;
503
- runUnder(item, () => {
504
- var _a;
505
- if ((_a = block.body) === null || _a === void 0 ? void 0 : _a.reacting) {
524
+ if (isReaction(block.body)) {
525
+ if (block.stamp === 0) {
506
526
  Transaction.outside(() => {
507
527
  if (Rx.isLogging)
508
528
  Rx.setLoggingHint(block, block.key);
509
- Rx.getController(block.rerender).configure({
529
+ Rx.getController(block.render).configure({
510
530
  order: block.level,
511
531
  });
512
532
  });
513
533
  }
514
- driver.initialize(block, undefined);
515
- driver.deploy(block, sequential);
516
- });
534
+ nonreactive(block.render, block.body.triggers);
535
+ }
536
+ else
537
+ renderNow(item);
517
538
  }
518
- else if (redeploy)
519
- runUnder(item, () => {
520
- driver.deploy(block, sequential);
521
- });
522
539
  }
523
- function runRender(item) {
540
+ function redeployIfNecessary(block) {
541
+ const driver = block.driver;
542
+ if (block.stamp === 0) {
543
+ block.stamp = 1;
544
+ driver.initialize(block, undefined);
545
+ driver.deploy(block);
546
+ }
547
+ else if (block.isMoved)
548
+ driver.deploy(block);
549
+ }
550
+ function renderNow(item) {
524
551
  const block = item.instance;
525
552
  if (block.stamp >= 0) {
526
553
  let result = undefined;
527
554
  runUnder(item, () => {
528
555
  try {
556
+ redeployIfNecessary(block);
529
557
  block.stamp++;
530
558
  block.numerator = 0;
531
559
  block.assignedCells = undefined;
560
+ block.assignedStyle = false;
532
561
  block.children.beginMerge();
533
562
  result = block.driver.render(block);
534
563
  if (block.driver.isLine)
@@ -548,15 +577,14 @@ function runRender(item) {
548
577
  });
549
578
  }
550
579
  }
551
- function runFinalize(item, isLeader, individual) {
552
- var _a;
580
+ function triggerFinalization(item, isLeader, individual) {
553
581
  const block = item.instance;
554
582
  if (block.stamp >= 0) {
555
583
  if (individual && block.key !== block.body.key && !block.driver.isLine)
556
584
  console.log(`WARNING: it is recommended to assign explicit key for conditionally rendered block in order to avoid unexpected side effects: ${block.key}`);
557
585
  block.stamp = ~block.stamp;
558
586
  const childrenAreLeaders = block.driver.finalize(block, isLeader);
559
- if ((_a = block.body) === null || _a === void 0 ? void 0 : _a.reacting) {
587
+ if (isReaction(block.body)) {
560
588
  item.aux = undefined;
561
589
  const last = gLastToDispose;
562
590
  if (last)
@@ -569,7 +597,7 @@ function runFinalize(item, isLeader, individual) {
569
597
  });
570
598
  }
571
599
  for (const item of block.children.items())
572
- runFinalize(item, childrenAreLeaders, false);
600
+ triggerFinalization(item, childrenAreLeaders, false);
573
601
  VBlockImpl.grandCount--;
574
602
  }
575
603
  }
@@ -661,8 +689,8 @@ function defaultReject(error) {
661
689
  }
662
690
  Promise.prototype.then = reactronicDomHookedThen;
663
691
  const NOP = (...args) => { };
664
- const gSysDriver = new StaticDriver(null, "SYSTEM", LayoutKind.Group);
665
- const gSysRoot = Collection.createItem(new VBlockImpl(gSysDriver.name, gSysDriver, { level: 0 }, { reacting: true, render: NOP }));
692
+ const gSysDriver = new StaticDriver(null, "SYSTEM", LayoutKind.Fragment);
693
+ const gSysRoot = Collection.createItem(new VBlockImpl(gSysDriver.name, gSysDriver, { level: 0 }, { reaction: true, render: NOP }));
666
694
  gSysRoot.instance.item = gSysRoot;
667
695
  Object.defineProperty(gSysRoot.instance, "host", {
668
696
  value: gSysRoot.instance,
@@ -1,12 +1,12 @@
1
1
  import { VBlock, BlockBody, Align, CellRange } from "../core/api";
2
2
  import { HtmlDriver } from "./HtmlDriver";
3
- export declare function Block<M = unknown, R = void>(body: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
3
+ export declare function Block<M = unknown, R = void>(body?: BlockBody<HTMLElement, M, R>, base?: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
4
4
  export declare function PlainText(content: string, body?: BlockBody<HTMLElement, void, void>): VBlock<HTMLElement, void, void>;
5
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>): VBlock<HTMLElement, M, R>;
6
+ export declare function Grid<M = unknown, R = void>(body?: BlockBody<HTMLElement, M, R>, base?: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
7
7
  export declare function line<T = void>(body: (block: void) => T): void;
8
8
  export declare function lineFeed(noCoalescing?: boolean, key?: string): VBlock<HTMLElement>;
9
- export declare function Group<M = unknown, R = void>(body: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
9
+ export declare function Fragment<M = unknown, R = void>(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;
@@ -18,6 +18,7 @@ export declare class VerstakDriver<T extends HTMLElement> extends HtmlDriver<T>
18
18
  applyContentAlignment(block: VBlock<T>, contentAlign: Align): void;
19
19
  applyFrameAlignment(block: VBlock<T>, frameAlign: Align): void;
20
20
  applyContentWrapping(block: VBlock<T>, contentWrapping: boolean): void;
21
- applyFloating(block: VBlock<T>, floating: boolean): void;
21
+ applyOverlayVisible(block: VBlock<T>, overlayVisible: boolean | undefined): void;
22
+ applyStyling(block: VBlock<T, any, any>, secondary: boolean, styleName: string, enabled?: boolean): void;
22
23
  render(block: VBlock<T>): void | Promise<void>;
23
24
  }
@@ -1,24 +1,24 @@
1
- import { VBlock, LayoutKind, Align, GridCursor, asBaseFor } from "../core/api";
1
+ import { VBlock, LayoutKind, Align, GridCursor } from "../core/api";
2
2
  import { HtmlDriver } from "./HtmlDriver";
3
- export function Block(body) {
4
- return VBlock.claim(VerstakTags.block, body);
3
+ export function Block(body, base) {
4
+ return VBlock.claim(VerstakTags.block, body, base);
5
5
  }
6
6
  export function PlainText(content, body) {
7
- return VBlock.claim(VerstakTags.text, asBaseFor(body, {
7
+ return VBlock.claim(VerstakTags.text, body, {
8
8
  render(b) {
9
9
  b.native.innerText = content;
10
- },
11
- }));
10
+ }
11
+ });
12
12
  }
13
13
  export function HtmlText(content, body) {
14
- return VBlock.claim(VerstakTags.text, asBaseFor(body, {
14
+ return VBlock.claim(VerstakTags.text, body, {
15
15
  render(b) {
16
16
  b.native.innerHTML = content;
17
- },
18
- }));
17
+ }
18
+ });
19
19
  }
20
- export function Grid(body) {
21
- return VBlock.claim(VerstakTags.grid, body);
20
+ export function Grid(body, base) {
21
+ return VBlock.claim(VerstakTags.grid, body, base);
22
22
  }
23
23
  export function line(body) {
24
24
  lineFeed();
@@ -27,8 +27,8 @@ export function line(body) {
27
27
  export function lineFeed(noCoalescing, key) {
28
28
  return VBlock.claim(VerstakTags.line, { key });
29
29
  }
30
- export function Group(body) {
31
- return VBlock.claim(VerstakTags.group, body);
30
+ export function Fragment(body) {
31
+ return VBlock.claim(VerstakTags.fragment, body);
32
32
  }
33
33
  export class VerstakDriver extends HtmlDriver {
34
34
  applyCellRange(block, cellRange) {
@@ -110,11 +110,32 @@ export class VerstakDriver extends HtmlDriver {
110
110
  else
111
111
  block.native.removeAttribute("wrapping");
112
112
  }
113
- applyFloating(block, floating) {
114
- if (floating)
115
- block.native.setAttribute("floating", "true");
113
+ applyOverlayVisible(block, overlayVisible) {
114
+ const e = block.native;
115
+ const parent = HtmlDriver.findNearestParentHtmlBlock(block).native;
116
+ if (overlayVisible === true) {
117
+ const doc = document.body;
118
+ const rect = parent.getBoundingClientRect();
119
+ const h = doc.offsetWidth - rect.left > rect.right ? "rightward" : "leftward";
120
+ const v = doc.clientHeight - rect.top > rect.bottom ? "downward" : "upward";
121
+ e.setAttribute("overlay", `${h}-${v}`);
122
+ parent.setAttribute("stacking", "true");
123
+ }
124
+ else {
125
+ parent.removeAttribute("stacking");
126
+ if (overlayVisible === false)
127
+ e.setAttribute("overlay", "hidden");
128
+ else
129
+ e.removeAttribute("overlay");
130
+ }
131
+ }
132
+ applyStyling(block, secondary, styleName, enabled) {
133
+ const e = block.native;
134
+ enabled !== null && enabled !== void 0 ? enabled : (enabled = true);
135
+ if (secondary)
136
+ e.classList.toggle(styleName, enabled);
116
137
  else
117
- block.native.removeAttribute("floating");
138
+ e.className = enabled ? styleName : "";
118
139
  }
119
140
  render(block) {
120
141
  if (block.driver.layout < LayoutKind.Line)
@@ -127,7 +148,7 @@ const VerstakTags = {
127
148
  text: new VerstakDriver("v-text", LayoutKind.Text),
128
149
  grid: new VerstakDriver("v-grid", LayoutKind.Grid, () => new GridCursor()),
129
150
  line: new VerstakDriver("v-line", LayoutKind.Line),
130
- group: new VerstakDriver("v-group", LayoutKind.Group),
151
+ fragment: new VerstakDriver("v-fragment", LayoutKind.Fragment),
131
152
  };
132
153
  const AlignToCss = ["stretch", "start", "center", "end"];
133
154
  const TextAlignCss = ["justify", "left", "center", "right"];