verstak 0.22.508 → 0.22.510

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.
@@ -17,13 +17,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  });
18
18
  };
19
19
  import { reactive, nonreactive, Transaction, options, Reentrance, Rx, Collection, ObservableObject, raw } from "reactronic";
20
- import { Allocator, To } from "./Allocator";
20
+ import { equalCellRanges } from "./CellRange";
21
+ import { Cursor, Align } from "./Cursor";
21
22
  export var Priority;
22
23
  (function (Priority) {
23
24
  Priority[Priority["SyncP0"] = 0] = "SyncP0";
24
25
  Priority[Priority["AsyncP1"] = 1] = "AsyncP1";
25
26
  Priority[Priority["AsyncP2"] = 2] = "AsyncP2";
26
27
  })(Priority || (Priority = {}));
28
+ export function asComponent(outer, base) {
29
+ 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
+ return result;
31
+ }
32
+ function via(outer, base) {
33
+ const inherited = base !== null && base !== void 0 ? base : NOP;
34
+ return outer ? (e, b) => outer(e, b, () => inherited(e, b)) : inherited;
35
+ }
27
36
  export function setContext(type, context) {
28
37
  return VBlockImpl.setContext(type, context);
29
38
  }
@@ -31,9 +40,6 @@ export function use(type) {
31
40
  return VBlockImpl.use(type);
32
41
  }
33
42
  export class VBlock {
34
- render() {
35
- return invokeRenderFunction(this);
36
- }
37
43
  get isInitialRendering() {
38
44
  return this.stamp === 2;
39
45
  }
@@ -50,7 +56,7 @@ export class VBlock {
50
56
  static runForAllBlocks(action) {
51
57
  forEachChildRecursively(gSysRoot, action);
52
58
  }
53
- static claim(name, args, driver) {
59
+ static claim(name, driver, args) {
54
60
  var _a, _b;
55
61
  let result;
56
62
  const owner = gCurrent.instance;
@@ -58,7 +64,7 @@ export class VBlock {
58
64
  let ex = undefined;
59
65
  driver !== null && driver !== void 0 ? driver : (driver = AbstractDriver.group);
60
66
  name || (name = `${++owner.numerator}`);
61
- if (driver.isPart) {
67
+ if (driver.isRow) {
62
68
  const last = children.lastClaimedItem();
63
69
  if (((_a = last === null || last === void 0 ? void 0 : last.instance) === null || _a === void 0 ? void 0 : _a.driver) === driver)
64
70
  ex = last;
@@ -97,84 +103,66 @@ export var LayoutKind;
97
103
  (function (LayoutKind) {
98
104
  LayoutKind[LayoutKind["Block"] = 0] = "Block";
99
105
  LayoutKind[LayoutKind["Grid"] = 1] = "Grid";
100
- LayoutKind[LayoutKind["Part"] = 2] = "Part";
106
+ LayoutKind[LayoutKind["Row"] = 2] = "Row";
101
107
  LayoutKind[LayoutKind["Group"] = 3] = "Group";
102
108
  LayoutKind[LayoutKind["Text"] = 4] = "Text";
103
109
  })(LayoutKind || (LayoutKind = {}));
104
- const createDefaultAllocator = () => new Allocator();
110
+ const createDefaultCursor = () => new Cursor();
105
111
  export class AbstractDriver {
106
- constructor(name, layout, createAllocator) {
112
+ constructor(name, layout, createCursor) {
107
113
  this.name = name;
108
114
  this.layout = layout;
109
- this.createAllocator = createAllocator !== null && createAllocator !== void 0 ? createAllocator : createDefaultAllocator;
115
+ this.createCursor = createCursor !== null && createCursor !== void 0 ? createCursor : createDefaultCursor;
110
116
  }
111
117
  get isSequential() { return (this.layout & 1) === 0; }
112
118
  get isAuxiliary() { return (this.layout & 2) === 2; }
113
119
  get isBlock() { return this.layout === LayoutKind.Block; }
114
120
  get isGrid() { return this.layout === LayoutKind.Grid; }
115
- get isPart() { return this.layout === LayoutKind.Part; }
121
+ get isRow() { return this.layout === LayoutKind.Row; }
116
122
  initialize(block, native) {
117
- var _a;
123
+ var _a, _b;
118
124
  const b = block;
119
125
  b.native = native;
120
- const initialize = (_a = block.args) === null || _a === void 0 ? void 0 : _a.initialize;
121
- if (initialize) {
122
- if (Array.isArray(initialize))
123
- for (const init of initialize)
124
- init(native, block);
125
- else
126
- initialize(native, block);
127
- }
126
+ (_b = (_a = block.args).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, native, block, NOP);
128
127
  }
129
128
  finalize(block, isLeader) {
130
- var _a;
129
+ var _a, _b;
131
130
  const b = block;
132
- const finalize = (_a = block.args) === null || _a === void 0 ? void 0 : _a.finalize;
133
- if (finalize) {
134
- const native = block.native;
135
- if (Array.isArray(finalize))
136
- for (const fin of finalize)
137
- fin(native, block);
138
- else
139
- finalize(native, block);
140
- }
131
+ const native = block.native;
132
+ (_b = (_a = block.args).finalize) === null || _b === void 0 ? void 0 : _b.call(_a, native, block, NOP);
141
133
  b.native = undefined;
142
134
  return isLeader;
143
135
  }
144
136
  deploy(block, sequential) {
145
137
  }
146
- arrange(block, place, heightGrowth) {
147
- var _a, _b, _c;
148
- const b = block;
149
- if (heightGrowth === undefined) {
150
- b.place = place;
151
- const host = b.host;
152
- if (host.driver.isPart) {
153
- const growth = (_a = place === null || place === void 0 ? void 0 : place.heightGrowth) !== null && _a !== void 0 ? _a : 0;
154
- if (growth > 0 && ((_c = (_b = host.place) === null || _b === void 0 ? void 0 : _b.heightGrowth) !== null && _c !== void 0 ? _c : 0) < growth)
155
- host.driver.arrange(host, undefined, growth);
156
- }
157
- }
158
- else if (heightGrowth > 0) {
159
- if (b.place === undefined)
160
- b.place = {
161
- exact: undefined,
162
- widthMin: "", widthMax: "", widthGrowth: 0,
163
- heightMin: "", heightMax: "", heightGrowth,
164
- alignContent: To.Default,
165
- alignFrame: To.Default,
166
- flowWrap: false,
167
- };
168
- else
169
- b.place.heightGrowth = heightGrowth;
170
- }
138
+ applyCellRange(block, cellRange) {
139
+ }
140
+ applyWidthGrowth(block, widthGrowth) {
141
+ }
142
+ applyWidthMin(block, widthMin) {
143
+ }
144
+ applyWidthMax(block, widthMax) {
145
+ }
146
+ applyHeightGrowth(block, heightGrowth) {
147
+ }
148
+ applyHeightMin(block, heightMin) {
149
+ }
150
+ applyHeightMax(block, heightMax) {
151
+ }
152
+ applyAlignContent(block, alignContent) {
153
+ }
154
+ applyAlignFrame(block, alignFrame) {
155
+ }
156
+ applyWrapping(block, wrapping) {
157
+ }
158
+ applyDangling(block, dangling) {
171
159
  }
172
160
  render(block) {
173
161
  var _a;
174
162
  let result;
175
163
  const override = (_a = block.args) === null || _a === void 0 ? void 0 : _a.override;
176
164
  if (override)
177
- result = override(block.native, block);
165
+ result = override(block.native, block, NOP);
178
166
  else
179
167
  result = invokeRenderFunction(block);
180
168
  return result;
@@ -182,11 +170,13 @@ export class AbstractDriver {
182
170
  }
183
171
  AbstractDriver.group = new AbstractDriver("group", LayoutKind.Group);
184
172
  function invokeRenderFunction(block) {
185
- return block.args.render(block.native, block);
173
+ var _a;
174
+ const r = (_a = block.args.render) !== null && _a !== void 0 ? _a : NOP;
175
+ return r(block.native, block, NOP);
186
176
  }
187
177
  export class StaticDriver extends AbstractDriver {
188
- constructor(element, name, layout, createAllocator) {
189
- super(name, layout, createAllocator);
178
+ constructor(element, name, layout, createCursor) {
179
+ super(name, layout, createCursor);
190
180
  this.element = element;
191
181
  }
192
182
  initialize(block, element) {
@@ -205,7 +195,7 @@ class VBlockContext extends ObservableObject {
205
195
  }
206
196
  __decorate([
207
197
  raw,
208
- __metadata("design:type", Function)
198
+ __metadata("design:type", Object)
209
199
  ], VBlockContext.prototype, "type", void 0);
210
200
  class VBlockImpl extends VBlock {
211
201
  constructor(name, driver, owner, args) {
@@ -214,6 +204,18 @@ class VBlockImpl extends VBlock {
214
204
  this.driver = driver;
215
205
  this.args = args;
216
206
  this.model = undefined;
207
+ this.assignedCells = undefined;
208
+ this.appliedCellRange = Cursor.UndefinedCellRange;
209
+ this.appliedWidthGrowth = 0;
210
+ this.appliedWidthMin = "";
211
+ this.appliedWidthMax = "";
212
+ this.appliedHeightGrowth = 0;
213
+ this.appliedHeightMin = "";
214
+ this.appliedHeightMax = "";
215
+ this.appliedAlignContent = Align.Default;
216
+ this.appliedAlignFrame = Align.Default;
217
+ this.appliedWrapping = false;
218
+ this.appliedDangling = false;
217
219
  this.level = owner.level + 1;
218
220
  this.host = owner;
219
221
  this.children = new Collection(driver.isSequential, getBlockName);
@@ -221,14 +223,94 @@ class VBlockImpl extends VBlock {
221
223
  this.item = undefined;
222
224
  this.stamp = 0;
223
225
  this.native = undefined;
224
- this.place = undefined;
225
- this.allocator = driver.createAllocator();
226
+ this.cursor = driver.createCursor();
226
227
  this.senior = owner.context ? owner : owner.senior;
227
228
  this.context = undefined;
228
229
  }
229
230
  rerender(_triggers) {
230
231
  runRender(this.item);
231
232
  }
233
+ get cells() { return this.assignedCells; }
234
+ set cells(value) {
235
+ if (this.assignedCells !== undefined)
236
+ throw new Error("cells can be assigned only once during rendering");
237
+ const cellRange = this.host.cursor.onwards(value);
238
+ if (!equalCellRanges(cellRange, this.appliedCellRange)) {
239
+ this.driver.applyCellRange(this, cellRange);
240
+ this.appliedCellRange = cellRange;
241
+ }
242
+ this.assignedCells = value !== null && value !== void 0 ? value : {};
243
+ }
244
+ get widthGrowth() { return this.appliedWidthGrowth; }
245
+ set widthGrowth(value) {
246
+ if (value !== this.appliedWidthGrowth) {
247
+ this.driver.applyWidthGrowth(this, value);
248
+ this.appliedWidthGrowth = value;
249
+ }
250
+ }
251
+ get widthMin() { return this.appliedWidthMin; }
252
+ set widthMin(value) {
253
+ if (value !== this.appliedWidthMin) {
254
+ this.driver.applyWidthMin(this, value);
255
+ this.appliedWidthMin = value;
256
+ }
257
+ }
258
+ get widthMax() { return this.appliedWidthMax; }
259
+ set widthMax(value) {
260
+ if (value !== this.appliedWidthMax) {
261
+ this.driver.applyWidthMax(this, value);
262
+ this.appliedWidthMax = value;
263
+ }
264
+ }
265
+ get heightGrowth() { return this.appliedHeightGrowth; }
266
+ set heightGrowth(value) {
267
+ if (value !== this.appliedHeightGrowth) {
268
+ this.driver.applyHeightGrowth(this, value);
269
+ this.appliedHeightGrowth = value;
270
+ }
271
+ }
272
+ get heightMin() { return this.appliedHeightMin; }
273
+ set heightMin(value) {
274
+ if (value !== this.appliedWidthMin) {
275
+ this.driver.applyWidthMin(this, value);
276
+ this.appliedWidthMin = value;
277
+ }
278
+ }
279
+ get heightMax() { return this.appliedHeightMax; }
280
+ set heightMax(value) {
281
+ if (value !== this.appliedWidthMax) {
282
+ this.driver.applyWidthMax(this, value);
283
+ this.appliedWidthMax = value;
284
+ }
285
+ }
286
+ get alignContent() { return this.appliedAlignContent; }
287
+ set alignContent(value) {
288
+ if (value !== this.appliedAlignContent) {
289
+ this.driver.applyAlignContent(this, value);
290
+ this.appliedAlignContent = value;
291
+ }
292
+ }
293
+ get alignFrame() { return this.appliedAlignFrame; }
294
+ set alignFrame(value) {
295
+ if (value !== this.appliedAlignFrame) {
296
+ this.driver.applyAlignFrame(this, value);
297
+ this.appliedAlignFrame = value;
298
+ }
299
+ }
300
+ get wrapping() { return this.appliedWrapping; }
301
+ set wrapping(value) {
302
+ if (value !== this.appliedWrapping) {
303
+ this.driver.applyWrapping(this, value);
304
+ this.appliedWrapping = value;
305
+ }
306
+ }
307
+ get dangling() { return this.appliedDangling; }
308
+ set dangling(value) {
309
+ if (value !== this.appliedDangling) {
310
+ this.driver.applyDangling(this, value);
311
+ this.appliedDangling = value;
312
+ }
313
+ }
232
314
  static use(type) {
233
315
  var _a, _b;
234
316
  let b = gCurrent.instance;
@@ -291,25 +373,19 @@ function runRenderNestedTreesThenDo(error, action) {
291
373
  if (!error) {
292
374
  const ownerIsBlock = owner.driver.isBlock;
293
375
  const sequential = children.strict;
294
- const allocator = owner.allocator;
295
- allocator.reset();
376
+ const cursor = owner.cursor;
296
377
  let p1 = undefined;
297
378
  let p2 = undefined;
298
379
  let redeploy = false;
299
380
  let partHost = owner;
381
+ cursor.reset();
300
382
  for (const item of children.items()) {
301
383
  if (Transaction.isCanceled)
302
384
  break;
303
385
  const block = item.instance;
304
386
  const driver = block.driver;
305
387
  const opt = block.args;
306
- if (!driver.isPart) {
307
- const place = allocator.allocate(opt);
308
- driver.arrange(block, place, undefined);
309
- }
310
- else
311
- allocator.lineFeed();
312
- const host = driver.isPart ? owner : partHost;
388
+ const host = driver.isRow ? owner : partHost;
313
389
  redeploy = markToRedeployIfNecessary(redeploy, host, item, children, sequential);
314
390
  const priority = (_a = opt === null || opt === void 0 ? void 0 : opt.priority) !== null && _a !== void 0 ? _a : Priority.SyncP0;
315
391
  if (priority === Priority.SyncP0)
@@ -318,7 +394,7 @@ function runRenderNestedTreesThenDo(error, action) {
318
394
  p1 = push(item, p1);
319
395
  else
320
396
  p2 = push(item, p2);
321
- if (ownerIsBlock && driver.isPart)
397
+ if (ownerIsBlock && driver.isRow)
322
398
  partHost = block;
323
399
  }
324
400
  if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
@@ -419,7 +495,6 @@ function prepareRender(item, redeploy, sequential) {
419
495
  }
420
496
  driver.initialize(block, undefined);
421
497
  driver.deploy(block, sequential);
422
- driver.arrange(block, block.place, undefined);
423
498
  });
424
499
  }
425
500
  else if (redeploy)
@@ -435,8 +510,13 @@ function runRender(item) {
435
510
  try {
436
511
  block.stamp++;
437
512
  block.numerator = 0;
513
+ block.assignedCells = undefined;
438
514
  block.children.beginMerge();
439
515
  result = block.driver.render(block);
516
+ if (block.driver.isRow)
517
+ block.host.cursor.lineFeed();
518
+ else if (block.assignedCells === undefined)
519
+ block.cells = undefined;
440
520
  if (result instanceof Promise)
441
521
  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
522
  else
@@ -560,7 +640,7 @@ function defaultReject(error) {
560
640
  throw error;
561
641
  }
562
642
  Promise.prototype.then = reactronicDomHookedThen;
563
- const NOP = () => { };
643
+ const NOP = (...args) => { };
564
644
  const gSysDriver = new StaticDriver(null, "SYSTEM", LayoutKind.Group);
565
645
  const gSysRoot = Collection.createItem(new VBlockImpl("SYSTEM", gSysDriver, { level: 0 }, { reacting: true, render: NOP }));
566
646
  gSysRoot.instance.item = gSysRoot;
@@ -1,5 +1,5 @@
1
1
  export * from "./Utils";
2
2
  export * from "./CellRange";
3
- export * from "./Allocator";
3
+ export * from "./Cursor";
4
4
  export * from "./Restyler";
5
5
  export * from "./VBlock";
@@ -1,5 +1,5 @@
1
1
  export * from "./Utils";
2
2
  export * from "./CellRange";
3
- export * from "./Allocator";
3
+ export * from "./Cursor";
4
4
  export * from "./Restyler";
5
5
  export * from "./VBlock";
@@ -1,13 +1,23 @@
1
- import { VBlock, Place, BlockArgs } from "../core/api";
1
+ import { VBlock, BlockArgs, Align, CellRange } 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, name?: string, args?: Partial<BlockArgs<HTMLElement, void, void>>): VBlock<HTMLElement, void, void>;
5
- export declare function HtmlText(content: string, name?: string, args?: Partial<BlockArgs<HTMLElement, void, void>>): VBlock<HTMLElement, void, void>;
4
+ export declare function PlainText(content: string, name?: string, args?: BlockArgs<HTMLElement, void, void>): VBlock<HTMLElement, void, void>;
5
+ export declare function HtmlText(content: string, name?: string, args?: BlockArgs<HTMLElement, void, void>): 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>;
9
9
  export declare function Group<M = unknown, R = void>(name: string, args: BlockArgs<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
10
10
  export declare class VerstakDriver<T extends HTMLElement> extends HtmlDriver<T> {
11
- arrange(block: VBlock<T>, place: Place | undefined, heightGrowth: number | undefined): void;
11
+ applyCellRange(block: VBlock<T>, cellRange: CellRange | undefined): void;
12
+ applyWidthGrowth(block: VBlock<T>, widthGrowth: number): void;
13
+ applyWidthMin(block: VBlock<T>, widthMin: string): void;
14
+ applyWidthMax(block: VBlock<T>, widthMax: string): void;
15
+ applyHeightGrowth(block: VBlock<T>, heightGrowth: number): void;
16
+ applyHeightMin(block: VBlock<T>, heightMin: string): void;
17
+ applyHeightMax(block: VBlock<T>, heightMax: string): void;
18
+ applyAlignContent(block: VBlock<T>, alignContent: Align): void;
19
+ applyAlignFrame(block: VBlock<T>, alignFrame: Align): void;
20
+ applyWrapping(block: VBlock<T>, wrapping: boolean): void;
21
+ applyDangling(block: VBlock<T>, dangling: boolean): void;
12
22
  render(block: VBlock<T>): void | Promise<void>;
13
23
  }
@@ -1,131 +1,134 @@
1
- import { VBlock, LayoutKind, To, GridBasedAllocator } from "../core/api";
1
+ import { VBlock, LayoutKind, Align, GridCursor, asComponent } from "../core/api";
2
2
  import { HtmlDriver } from "./HtmlDriver";
3
3
  export function Block(name, args) {
4
- return VBlock.claim(name, args, VerstakTags.block);
4
+ return VBlock.claim(name, VerstakTags.block, args);
5
5
  }
6
6
  export function PlainText(content, name, args) {
7
- return VBlock.claim(name !== null && name !== void 0 ? name : "", Object.assign(Object.assign({}, args), { render(e) { e.innerText = content; } }), VerstakTags.text);
7
+ return VBlock.claim(name !== null && name !== void 0 ? name : "", VerstakTags.text, asComponent(args, {
8
+ render(e) {
9
+ e.innerText = content;
10
+ },
11
+ }));
8
12
  }
9
13
  export function HtmlText(content, name, args) {
10
- return VBlock.claim(name !== null && name !== void 0 ? name : "", Object.assign(Object.assign({}, args), { render(e) { e.innerHTML = content; } }), VerstakTags.text);
14
+ return VBlock.claim(name !== null && name !== void 0 ? name : "", VerstakTags.text, asComponent(args, {
15
+ render(e) {
16
+ e.innerHTML = content;
17
+ },
18
+ }));
11
19
  }
12
20
  export function Grid(name, args) {
13
- return VBlock.claim(name, args, VerstakTags.grid);
21
+ return VBlock.claim(name, VerstakTags.grid, args);
14
22
  }
15
23
  export function Line(claim) {
16
- const result = VBlock.claim("", EMPTY_RENDER, VerstakTags.part);
24
+ const result = VBlock.claim("", VerstakTags.row, EMPTY_RENDER);
17
25
  claim();
18
- VBlock.claim("", EMPTY_RENDER, VerstakTags.part);
26
+ VBlock.claim("", VerstakTags.row, EMPTY_RENDER);
19
27
  return result;
20
28
  }
21
29
  export function lineFeed(args, noCoalescing) {
22
- return VBlock.claim("", args !== null && args !== void 0 ? args : EMPTY_RENDER, VerstakTags.part);
30
+ return VBlock.claim("", VerstakTags.row, args !== null && args !== void 0 ? args : EMPTY_RENDER);
23
31
  }
24
32
  export function Group(name, args) {
25
- return VBlock.claim(name, args, VerstakTags.group);
33
+ return VBlock.claim(name, VerstakTags.group, args);
26
34
  }
27
35
  export class VerstakDriver extends HtmlDriver {
28
- arrange(block, place, heightGrowth) {
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) {
32
- if (heightGrowth === undefined) {
33
- const ex = block.stamp > 1 ? block.place : undefined;
34
- if (place !== ex) {
35
- const css = native.style;
36
- const exact = place === null || place === void 0 ? void 0 : place.exact;
37
- if (exact !== (ex === null || ex === void 0 ? void 0 : ex.exact)) {
38
- if (exact) {
39
- const x1 = exact.x1 || 1;
40
- const y1 = exact.y1 || 1;
41
- const x2 = exact.x2 || x1;
42
- const y2 = exact.y2 || y1;
43
- css.gridArea = `${y1} / ${x1} / span ${y2 - y1 + 1} / span ${x2 - x1 + 1}`;
44
- }
45
- else
46
- css.gridArea = "";
47
- }
48
- const widthGrowth = (_a = place === null || place === void 0 ? void 0 : place.widthGrowth) !== null && _a !== void 0 ? _a : 0;
49
- if (widthGrowth !== ((_b = ex === null || ex === void 0 ? void 0 : ex.widthGrowth) !== null && _b !== void 0 ? _b : 0)) {
50
- if (widthGrowth > 0) {
51
- css.flexGrow = `${widthGrowth}`;
52
- css.flexBasis = "0";
53
- }
54
- else {
55
- css.flexGrow = "";
56
- css.flexBasis = "";
57
- }
58
- }
59
- const widthMin = (_c = place === null || place === void 0 ? void 0 : place.widthMin) !== null && _c !== void 0 ? _c : "";
60
- if (widthMin !== ((_d = ex === null || ex === void 0 ? void 0 : ex.widthMin) !== null && _d !== void 0 ? _d : ""))
61
- css.minWidth = `${widthMin}`;
62
- const widthMax = (_e = place === null || place === void 0 ? void 0 : place.widthMax) !== null && _e !== void 0 ? _e : "";
63
- if (widthMax !== ((_f = ex === null || ex === void 0 ? void 0 : ex.widthMax) !== null && _f !== void 0 ? _f : ""))
64
- css.maxWidth = `${widthMax}`;
65
- const heightMin = (_g = place === null || place === void 0 ? void 0 : place.heightMin) !== null && _g !== void 0 ? _g : "";
66
- if (heightMin !== ((_h = ex === null || ex === void 0 ? void 0 : ex.heightMin) !== null && _h !== void 0 ? _h : ""))
67
- css.minHeight = `${heightMin}`;
68
- const heightMax = (_j = place === null || place === void 0 ? void 0 : place.heightMax) !== null && _j !== void 0 ? _j : "";
69
- if (heightMax !== ((_k = ex === null || ex === void 0 ? void 0 : ex.heightMax) !== null && _k !== void 0 ? _k : ""))
70
- css.maxHeight = `${heightMax}`;
71
- const alignContent = (_l = place === null || place === void 0 ? void 0 : place.alignContent) !== null && _l !== void 0 ? _l : To.Default;
72
- if (alignContent !== ((_m = ex === null || ex === void 0 ? void 0 : ex.alignContent) !== null && _m !== void 0 ? _m : To.Default)) {
73
- if ((alignContent & To.Default) === 0) {
74
- const v = AlignToCss[(alignContent >> 2) & 0b11];
75
- const h = AlignToCss[alignContent & 0b11];
76
- const t = TextAlignCss[alignContent & 0b11];
77
- css.justifyContent = v;
78
- css.alignContent = h;
79
- css.textAlign = t;
80
- }
81
- else
82
- css.justifyContent = css.alignContent = css.textAlign = "";
83
- }
84
- const heightGrowth = (_o = place === null || place === void 0 ? void 0 : place.heightGrowth) !== null && _o !== void 0 ? _o : 0;
85
- const alignFrame = (_p = place === null || place === void 0 ? void 0 : place.alignFrame) !== null && _p !== void 0 ? _p : To.Default;
86
- if (alignFrame !== ((_q = ex === null || ex === void 0 ? void 0 : ex.alignFrame) !== null && _q !== void 0 ? _q : To.Default) ||
87
- heightGrowth !== ((_r = ex === null || ex === void 0 ? void 0 : ex.heightGrowth) !== null && _r !== void 0 ? _r : 0)) {
88
- if ((alignFrame & To.Default) === 0) {
89
- const v = AlignToCss[(alignFrame >> 2) & 0b11];
90
- const h = AlignToCss[alignFrame & 0b11];
91
- css.alignSelf = v;
92
- css.justifySelf = h;
93
- }
94
- else if (heightGrowth > 0) {
95
- css.alignSelf = AlignToCss[To.Fit];
96
- }
97
- else
98
- css.alignSelf = css.justifySelf = "";
99
- }
100
- const flowWrap = (_s = place === null || place === void 0 ? void 0 : place.flowWrap) !== null && _s !== void 0 ? _s : false;
101
- if (flowWrap !== ((_t = ex === null || ex === void 0 ? void 0 : ex.flowWrap) !== null && _t !== void 0 ? _t : false)) {
102
- if (flowWrap)
103
- native.setAttribute("wrapping", "true");
104
- else
105
- native.removeAttribute("wrapping");
106
- }
107
- }
108
- }
109
- else {
110
- if (heightGrowth > 0)
111
- block.native.style.flexGrow = `${heightGrowth}`;
112
- else
113
- block.native.style.flexGrow = "";
114
- }
36
+ applyCellRange(block, cellRange) {
37
+ const css = block.native.style;
38
+ if (cellRange) {
39
+ const x1 = cellRange.x1 || 1;
40
+ const y1 = cellRange.y1 || 1;
41
+ const x2 = cellRange.x2 || x1;
42
+ const y2 = cellRange.y2 || y1;
43
+ css.gridArea = `${y1} / ${x1} / span ${y2 - y1 + 1} / span ${x2 - x1 + 1}`;
115
44
  }
116
- super.arrange(block, place, heightGrowth);
45
+ else
46
+ css.gridArea = "";
47
+ super.applyCellRange(block, cellRange);
48
+ }
49
+ applyWidthGrowth(block, widthGrowth) {
50
+ const css = block.native.style;
51
+ if (widthGrowth > 0) {
52
+ css.flexGrow = `${widthGrowth}`;
53
+ css.flexBasis = "0";
54
+ }
55
+ else {
56
+ css.flexGrow = "";
57
+ css.flexBasis = "";
58
+ }
59
+ }
60
+ applyWidthMin(block, widthMin) {
61
+ block.native.style.minWidth = `${widthMin}`;
62
+ }
63
+ applyWidthMax(block, widthMax) {
64
+ block.native.style.maxWidth = `${widthMax}`;
65
+ }
66
+ applyHeightGrowth(block, heightGrowth) {
67
+ if (block.driver.isRow) {
68
+ const css = block.native.style;
69
+ if (heightGrowth > 0)
70
+ css.flexGrow = `${heightGrowth}`;
71
+ else
72
+ css.flexGrow = "";
73
+ }
74
+ else if (block.host.driver.isRow) {
75
+ block.driver.applyAlignFrame(block, Align.Stretch);
76
+ block.host.driver.applyHeightGrowth(block.host, heightGrowth);
77
+ }
78
+ }
79
+ applyHeightMin(block, heightMin) {
80
+ block.native.style.minHeight = `${heightMin}`;
81
+ }
82
+ applyHeightMax(block, heightMax) {
83
+ block.native.style.maxHeight = `${heightMax}`;
84
+ }
85
+ applyAlignContent(block, alignContent) {
86
+ const css = block.native.style;
87
+ if ((alignContent & Align.Default) === 0) {
88
+ const v = AlignToCss[(alignContent >> 2) & 0b11];
89
+ const h = AlignToCss[alignContent & 0b11];
90
+ const t = TextAlignCss[alignContent & 0b11];
91
+ css.justifyContent = v;
92
+ css.alignItems = h;
93
+ css.textAlign = t;
94
+ }
95
+ else
96
+ css.justifyContent = css.alignContent = css.textAlign = "";
97
+ }
98
+ applyAlignFrame(block, alignFrame) {
99
+ const css = block.native.style;
100
+ if ((alignFrame & Align.Default) === 0) {
101
+ const v = AlignToCss[(alignFrame >> 2) & 0b11];
102
+ const h = AlignToCss[alignFrame & 0b11];
103
+ css.alignSelf = v;
104
+ css.justifySelf = h;
105
+ }
106
+ else
107
+ css.alignSelf = css.justifySelf = "";
108
+ }
109
+ applyWrapping(block, wrapping) {
110
+ if (wrapping)
111
+ block.native.setAttribute("wrapping", "true");
112
+ else
113
+ block.native.removeAttribute("wrapping");
114
+ }
115
+ applyDangling(block, dangling) {
116
+ if (dangling)
117
+ block.native.setAttribute("dangling", "true");
118
+ else
119
+ block.native.removeAttribute("dangling");
117
120
  }
118
121
  render(block) {
119
- if (!block.driver.isPart)
120
- VBlock.claim("", EMPTY_RENDER, VerstakTags.part);
122
+ if (block.driver.layout < LayoutKind.Row)
123
+ VBlock.claim("", VerstakTags.row, EMPTY_RENDER);
121
124
  return super.render(block);
122
125
  }
123
126
  }
124
127
  const VerstakTags = {
125
128
  block: new VerstakDriver("v-block", LayoutKind.Block),
126
129
  text: new VerstakDriver("v-text", LayoutKind.Text),
127
- grid: new VerstakDriver("v-grid", LayoutKind.Grid, () => new GridBasedAllocator()),
128
- part: new VerstakDriver("v-part", LayoutKind.Part),
130
+ grid: new VerstakDriver("v-grid", LayoutKind.Grid, () => new GridCursor()),
131
+ row: new VerstakDriver("v-row", LayoutKind.Row),
129
132
  group: new VerstakDriver("v-group", LayoutKind.Group),
130
133
  };
131
134
  const EMPTY_RENDER = { render() { } };