verstak 0.22.503 → 0.22.504

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.
@@ -23,26 +23,26 @@ export interface Bounds {
23
23
  widthSpan?: number;
24
24
  widthMin?: string;
25
25
  widthMax?: string;
26
- widthGrab?: number;
26
+ widthGrowth?: number;
27
27
  widthOverlap?: boolean;
28
28
  heightSpan?: number;
29
29
  heightMin?: string;
30
30
  heightMax?: string;
31
- heightGrab?: number;
31
+ heightGrowth?: number;
32
32
  heightOverlap?: boolean;
33
- align?: To;
34
- dock?: To;
33
+ alignContent?: To;
34
+ alignFrame?: To;
35
35
  }
36
36
  export interface Place {
37
37
  exact: CellRange | undefined;
38
38
  widthMin: string;
39
39
  widthMax: string;
40
- widthGrab: number;
40
+ widthGrowth: number;
41
41
  heightMin: string;
42
42
  heightMax: string;
43
- heightGrab: number;
44
- align: To;
45
- dock: To;
43
+ heightGrowth: number;
44
+ alignContent: To;
45
+ alignFrame: To;
46
46
  }
47
47
  export declare class Allocator {
48
48
  reset(): void;
@@ -21,12 +21,12 @@ export class Allocator {
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 : "",
23
23
  widthMax: (_b = bounds.widthMax) !== null && _b !== void 0 ? _b : "",
24
- widthGrab: (_c = bounds.widthGrab) !== null && _c !== void 0 ? _c : 0,
24
+ widthGrowth: (_c = bounds.widthGrowth) !== null && _c !== void 0 ? _c : 0,
25
25
  heightMin: (_d = bounds.heightMin) !== null && _d !== void 0 ? _d : "",
26
26
  heightMax: (_e = bounds.heightMax) !== null && _e !== void 0 ? _e : "",
27
- heightGrab: (_f = bounds.heightGrab) !== null && _f !== void 0 ? _f : 0,
28
- align: (_g = bounds.align) !== null && _g !== void 0 ? _g : To.Default,
29
- dock: (_h = bounds.dock) !== null && _h !== void 0 ? _h : To.Default,
27
+ heightGrowth: (_f = bounds.heightGrowth) !== null && _f !== void 0 ? _f : 0,
28
+ alignContent: (_g = bounds.alignContent) !== null && _g !== void 0 ? _g : To.Default,
29
+ alignFrame: (_h = bounds.alignFrame) !== null && _h !== void 0 ? _h : To.Default,
30
30
  };
31
31
  }
32
32
  }
@@ -57,10 +57,10 @@ export class GridBasedAllocator {
57
57
  var _a, _b, _c, _d;
58
58
  const result = {
59
59
  exact: undefined,
60
- widthMin: "", widthMax: "", widthGrab: 0,
61
- heightMin: "", heightMax: "", heightGrab: 0,
62
- align: (_a = bounds === null || bounds === void 0 ? void 0 : bounds.align) !== null && _a !== void 0 ? _a : To.Default,
63
- dock: (_b = bounds === null || bounds === void 0 ? void 0 : bounds.dock) !== null && _b !== void 0 ? _b : To.Default,
60
+ widthMin: "", widthMax: "", widthGrowth: 0,
61
+ heightMin: "", heightMax: "", heightGrowth: 0,
62
+ alignContent: (_a = bounds === null || bounds === void 0 ? void 0 : bounds.alignContent) !== null && _a !== void 0 ? _a : To.Default,
63
+ alignFrame: (_b = bounds === null || bounds === void 0 ? void 0 : bounds.alignFrame) !== null && _b !== void 0 ? _b : To.Default,
64
64
  };
65
65
  if (bounds === null || bounds === void 0 ? void 0 : bounds.place) {
66
66
  result.exact = parseCellRange(bounds.place, { x1: 0, y1: 0, x2: 0, y2: 0 });
@@ -128,7 +128,7 @@ export function equalPlaces(a, b) {
128
128
  let result;
129
129
  if (a) {
130
130
  if (b) {
131
- result = a.widthGrab == b.widthGrab;
131
+ result = a.widthGrowth == b.widthGrowth;
132
132
  }
133
133
  else
134
134
  result = false;
@@ -10,16 +10,20 @@ export declare const enum Priority {
10
10
  }
11
11
  export interface BlockArgs<T = unknown, M = unknown, R = void> extends Bounds {
12
12
  reacting?: boolean;
13
- mixins?: Array<Render<T, M, R>>;
14
13
  triggers?: unknown;
15
14
  priority?: Priority;
16
15
  monitor?: Monitor;
17
16
  throttling?: number;
18
17
  logging?: Partial<LoggingOptions>;
19
18
  shuffle?: boolean;
20
- wrapper?: Render<T, M, R>;
21
19
  render: Render<T, M, R>;
20
+ initialize?: Render<T, M, R> | Array<Render<T, M, R>>;
21
+ finalize?: Render<T, M, R> | Array<Render<T, M, R>>;
22
+ override?: Render<T, M, R>;
23
+ subTreeContext?: Object;
24
+ subTreeContextType?: Object;
22
25
  }
26
+ export declare function useContext<T extends Object>(type: new (...args: any[]) => T): T;
23
27
  export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
24
28
  static readonly shortFrameDuration = 16;
25
29
  static readonly longFrameDuration = 300;
@@ -36,15 +40,16 @@ export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
36
40
  abstract readonly stamp: number;
37
41
  abstract readonly native: T | undefined;
38
42
  abstract readonly place: Readonly<Place> | undefined;
39
- baseRender(): R;
43
+ render(): R;
40
44
  get isInitialRendering(): boolean;
41
45
  static root(render: () => void): void;
42
46
  static get current(): VBlock;
43
47
  static renderNestedTreesThenDo(action: (error: unknown) => void): void;
44
48
  static runForAllBlocks<T>(action: (e: T) => void): void;
45
- static claim<T = undefined, M = unknown, R = void>(name: string, args: BlockArgs<T, M, R>, driver?: AbstractDriver<T>): VBlock<T, M, R>;
49
+ static claim<T = undefined, M = unknown, R = void, C = void>(name: string, args: BlockArgs<T, M, R>, driver?: AbstractDriver<T>): VBlock<T, M, R>;
46
50
  static getDefaultLoggingOptions(): LoggingOptions | undefined;
47
51
  static setDefaultLoggingOptions(logging?: LoggingOptions): void;
52
+ private static trySwitchContext;
48
53
  }
49
54
  export declare enum LayoutKind {
50
55
  Block = 0,
@@ -67,7 +72,7 @@ export declare class AbstractDriver<T> {
67
72
  initialize(block: VBlock<T>, native: T | undefined): void;
68
73
  finalize(block: VBlock<T>, isLeader: boolean): boolean;
69
74
  deploy(block: VBlock<T>, sequential: boolean): void;
70
- arrange(block: VBlock<T>, place: Place | undefined, heightGrab: number | undefined): void;
75
+ arrange(block: VBlock<T>, place: Place | undefined, heightGrowth: number | undefined): void;
71
76
  render(block: VBlock<T>): void | Promise<void>;
72
77
  }
73
78
  export declare class StaticDriver<T> extends AbstractDriver<T> {
@@ -24,9 +24,17 @@ export var Priority;
24
24
  Priority[Priority["AsyncP1"] = 1] = "AsyncP1";
25
25
  Priority[Priority["AsyncP2"] = 2] = "AsyncP2";
26
26
  })(Priority || (Priority = {}));
27
+ export function useContext(type) {
28
+ let b = gCurrent.instance;
29
+ while (b.args.subTreeContextType !== type && b.host !== b)
30
+ b = b.context;
31
+ if (b.host === b)
32
+ throw new Error(`context ${type.name} is not found`);
33
+ return b.args.subTreeContext;
34
+ }
27
35
  export class VBlock {
28
- baseRender() {
29
- return callRenderFunctions(this);
36
+ render() {
37
+ return invokeRenderFunction(this);
30
38
  }
31
39
  get isInitialRendering() {
32
40
  return this.stamp === 2;
@@ -36,7 +44,7 @@ export class VBlock {
36
44
  prepareAndRunRender(gSysRoot, false, false);
37
45
  }
38
46
  static get current() {
39
- return gContext.instance;
47
+ return gCurrent.instance;
40
48
  }
41
49
  static renderNestedTreesThenDo(action) {
42
50
  runRenderNestedTreesThenDo(undefined, action);
@@ -45,30 +53,35 @@ export class VBlock {
45
53
  forEachChildRecursively(gSysRoot, action);
46
54
  }
47
55
  static claim(name, args, driver) {
48
- var _a, _b;
56
+ var _a, _b, _c;
49
57
  let result;
50
- const owner = gContext.instance;
58
+ const owner = gCurrent.instance;
51
59
  const children = owner.children;
52
- let existing = undefined;
60
+ let ex = undefined;
53
61
  driver !== null && driver !== void 0 ? driver : (driver = AbstractDriver.group);
54
62
  name || (name = `${++owner.numerator}`);
55
63
  if (driver.isLine) {
56
64
  const last = children.lastClaimedItem();
57
65
  if (((_a = last === null || last === void 0 ? void 0 : last.instance) === null || _a === void 0 ? void 0 : _a.driver) === driver)
58
- existing = last;
66
+ ex = last;
59
67
  }
60
- existing !== null && existing !== void 0 ? existing : (existing = children.claim(name));
61
- if (existing) {
62
- result = existing.instance;
68
+ ex !== null && ex !== void 0 ? ex : (ex = children.claim(name, undefined, "nested blocks can be declared inside render function only"));
69
+ if (ex) {
70
+ result = ex.instance;
63
71
  if (result.driver !== driver && driver !== undefined)
64
72
  throw new Error(`changing block driver is not yet supported: "${result.driver.name}" -> "${driver === null || driver === void 0 ? void 0 : driver.name}"`);
65
- const exTriggers = (_b = result.args) === null || _b === void 0 ? void 0 : _b.triggers;
66
- if (triggersAreEqual(args.triggers, exTriggers))
67
- args.triggers = exTriggers;
73
+ if (!VBlock.trySwitchContext(args, result, owner)) {
74
+ const exTriggers = (_b = result.args) === null || _b === void 0 ? void 0 : _b.triggers;
75
+ if (triggersAreEqual(args.triggers, exTriggers))
76
+ args.triggers = exTriggers;
77
+ }
78
+ else
79
+ (_c = args.triggers) !== null && _c !== void 0 ? _c : (args.triggers = { [CONTEXT_SWITCH]: args.subTreeContext });
68
80
  result.args = args;
69
81
  }
70
82
  else {
71
83
  result = new VBlockImpl(name, driver, owner, args);
84
+ VBlock.trySwitchContext(args, result, owner);
72
85
  result.item = children.add(result);
73
86
  VBlockImpl.grandCount++;
74
87
  if (args.reacting)
@@ -82,6 +95,26 @@ export class VBlock {
82
95
  static setDefaultLoggingOptions(logging) {
83
96
  VBlockImpl.logging = logging;
84
97
  }
98
+ static trySwitchContext(newArgs, block, owner) {
99
+ var _a, _b;
100
+ const ownerArgs = owner.args;
101
+ const ownerCtx = ownerArgs.subTreeContext;
102
+ const ownerTriggers = ownerArgs.triggers;
103
+ const ctx = newArgs.subTreeContext;
104
+ const result = ctx !== ((_a = block.args) === null || _a === void 0 ? void 0 : _a.subTreeContext) || (ownerTriggers === null || ownerTriggers === void 0 ? void 0 : ownerTriggers[CONTEXT_SWITCH]) !== undefined;
105
+ if (ctx && ctx !== ownerCtx) {
106
+ (_b = newArgs.subTreeContextType) !== null && _b !== void 0 ? _b : (newArgs.subTreeContextType = 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
+ }
85
118
  }
86
119
  VBlock.shortFrameDuration = 16;
87
120
  VBlock.longFrameDuration = 300;
@@ -95,6 +128,7 @@ export var LayoutKind;
95
128
  LayoutKind[LayoutKind["Group"] = 3] = "Group";
96
129
  LayoutKind[LayoutKind["Text"] = 4] = "Text";
97
130
  })(LayoutKind || (LayoutKind = {}));
131
+ const CONTEXT_SWITCH = Symbol("V-CONTEXT-SWITCH");
98
132
  const createDefaultAllocator = () => new Allocator();
99
133
  export class AbstractDriver {
100
134
  constructor(name, layout, createAllocator) {
@@ -108,59 +142,73 @@ export class AbstractDriver {
108
142
  get isGrid() { return this.layout === LayoutKind.Grid; }
109
143
  get isLine() { return this.layout === LayoutKind.Line; }
110
144
  initialize(block, native) {
145
+ var _a;
111
146
  const b = block;
112
147
  b.native = native;
148
+ const initialize = (_a = block.args) === null || _a === void 0 ? void 0 : _a.initialize;
149
+ if (initialize) {
150
+ if (Array.isArray(initialize))
151
+ for (const init of initialize)
152
+ init(native, block);
153
+ else
154
+ initialize(native, block);
155
+ }
113
156
  }
114
157
  finalize(block, isLeader) {
158
+ var _a;
115
159
  const b = block;
160
+ const finalize = (_a = block.args) === null || _a === void 0 ? void 0 : _a.finalize;
161
+ if (finalize) {
162
+ const native = block.native;
163
+ if (Array.isArray(finalize))
164
+ for (const fin of finalize)
165
+ fin(native, block);
166
+ else
167
+ finalize(native, block);
168
+ }
116
169
  b.native = undefined;
117
170
  return isLeader;
118
171
  }
119
172
  deploy(block, sequential) {
120
173
  }
121
- arrange(block, place, heightGrab) {
174
+ arrange(block, place, heightGrowth) {
122
175
  var _a, _b, _c;
123
176
  const b = block;
124
- if (heightGrab === undefined) {
177
+ if (heightGrowth === undefined) {
125
178
  b.place = place;
126
179
  const host = b.host;
127
180
  if (host.driver.isLine) {
128
- const grab = (_a = place === null || place === void 0 ? void 0 : place.heightGrab) !== null && _a !== void 0 ? _a : 0;
129
- if (grab > 0 && ((_c = (_b = host.place) === null || _b === void 0 ? void 0 : _b.heightGrab) !== null && _c !== void 0 ? _c : 0) < grab)
130
- host.driver.arrange(host, undefined, grab);
181
+ const growth = (_a = place === null || place === void 0 ? void 0 : place.heightGrowth) !== null && _a !== void 0 ? _a : 0;
182
+ if (growth > 0 && ((_c = (_b = host.place) === null || _b === void 0 ? void 0 : _b.heightGrowth) !== null && _c !== void 0 ? _c : 0) < growth)
183
+ host.driver.arrange(host, undefined, growth);
131
184
  }
132
185
  }
133
- else if (heightGrab > 0) {
186
+ else if (heightGrowth > 0) {
134
187
  if (b.place === undefined)
135
188
  b.place = {
136
189
  exact: undefined,
137
- widthMin: "", widthMax: "", widthGrab: 0,
138
- heightMin: "", heightMax: "", heightGrab,
139
- align: To.Default,
140
- dock: To.Default,
190
+ widthMin: "", widthMax: "", widthGrowth: 0,
191
+ heightMin: "", heightMax: "", heightGrowth,
192
+ alignContent: To.Default,
193
+ alignFrame: To.Default,
141
194
  };
142
195
  else
143
- b.place.heightGrab = heightGrab;
196
+ b.place.heightGrowth = heightGrowth;
144
197
  }
145
198
  }
146
199
  render(block) {
147
200
  var _a;
148
201
  let result;
149
- const wrapper = (_a = block.args) === null || _a === void 0 ? void 0 : _a.wrapper;
150
- if (wrapper)
151
- result = wrapper(block.native, block);
202
+ const override = (_a = block.args) === null || _a === void 0 ? void 0 : _a.override;
203
+ if (override)
204
+ result = override(block.native, block);
152
205
  else
153
- result = callRenderFunctions(block);
206
+ result = invokeRenderFunction(block);
154
207
  return result;
155
208
  }
156
209
  }
157
210
  AbstractDriver.group = new AbstractDriver("group", LayoutKind.Group);
158
- function callRenderFunctions(block) {
159
- var _a;
160
- const uses = (_a = block.args) === null || _a === void 0 ? void 0 : _a.mixins;
161
- if (uses)
162
- for (const use of uses)
163
- use(block.native, block);
211
+ function invokeRenderFunction(block) {
164
212
  return block.args.render(block.native, block);
165
213
  }
166
214
  export class StaticDriver extends AbstractDriver {
@@ -176,11 +224,11 @@ function getBlockName(block) {
176
224
  return block.stamp >= 0 ? block.name : undefined;
177
225
  }
178
226
  class VBlockImpl extends VBlock {
179
- constructor(name, driver, owner, options) {
227
+ constructor(name, driver, owner, args) {
180
228
  super();
181
229
  this.name = name;
182
230
  this.driver = driver;
183
- this.args = options;
231
+ this.args = args;
184
232
  this.model = undefined;
185
233
  this.level = owner.level + 1;
186
234
  this.host = owner;
@@ -191,6 +239,7 @@ class VBlockImpl extends VBlock {
191
239
  this.native = undefined;
192
240
  this.place = undefined;
193
241
  this.allocator = driver.createAllocator();
242
+ this.context = owner.context;
194
243
  }
195
244
  rerender(_triggers) {
196
245
  runRender(this.item);
@@ -212,8 +261,8 @@ __decorate([
212
261
  ], VBlockImpl.prototype, "rerender", null);
213
262
  function runRenderNestedTreesThenDo(error, action) {
214
263
  var _a;
215
- const context = gContext;
216
- const owner = context.instance;
264
+ const current = gCurrent;
265
+ const owner = current.instance;
217
266
  const children = owner.children;
218
267
  if (children.isMergeInProgress) {
219
268
  let promised = undefined;
@@ -222,7 +271,7 @@ function runRenderNestedTreesThenDo(error, action) {
222
271
  for (const item of children.removedItems(true))
223
272
  runFinalize(item, true);
224
273
  if (!error) {
225
- const isBlockOwner = owner.driver.isBlock;
274
+ const ownerIsBlock = owner.driver.isBlock;
226
275
  const sequential = children.strict;
227
276
  const allocator = owner.allocator;
228
277
  allocator.reset();
@@ -251,11 +300,11 @@ function runRenderNestedTreesThenDo(error, action) {
251
300
  p1 = push(item, p1);
252
301
  else
253
302
  p2 = push(item, p2);
254
- if (isBlockOwner && driver.isLine)
303
+ if (ownerIsBlock && driver.isLine)
255
304
  lineHost = block;
256
305
  }
257
306
  if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
258
- promised = startIncrementalRendering(context, children, p1, p2).then(() => action(error), e => action(e));
307
+ promised = startIncrementalRendering(current, children, p1, p2).then(() => action(error), e => action(e));
259
308
  }
260
309
  }
261
310
  finally {
@@ -320,14 +369,16 @@ function renderIncrementally(owner, stamp, allChildren, items, priority) {
320
369
  });
321
370
  }
322
371
  function prepareAndRunRender(item, redeploy, sequential) {
323
- var _a, _b;
324
372
  const block = item.instance;
325
373
  if (block.stamp >= 0) {
326
- prepareRender(item, redeploy, sequential);
327
- if ((_a = block.args) === null || _a === void 0 ? void 0 : _a.reacting)
328
- nonreactive(block.rerender, (_b = block.args) === null || _b === void 0 ? void 0 : _b.triggers);
329
- else
330
- runRender(item);
374
+ runUnder(item, () => {
375
+ var _a, _b;
376
+ prepareRender(item, redeploy, sequential);
377
+ if ((_a = block.args) === null || _a === void 0 ? void 0 : _a.reacting)
378
+ nonreactive(block.rerender, (_b = block.args) === null || _b === void 0 ? void 0 : _b.triggers);
379
+ else
380
+ runRender(item);
381
+ });
331
382
  }
332
383
  }
333
384
  function prepareRender(item, redeploy, sequential) {
@@ -359,24 +410,22 @@ function prepareRender(item, redeploy, sequential) {
359
410
  function runRender(item) {
360
411
  const block = item.instance;
361
412
  if (block.stamp >= 0) {
362
- runUnder(item, () => {
363
- let result = undefined;
364
- try {
365
- block.stamp++;
366
- block.numerator = 0;
367
- block.children.beginMerge();
368
- result = block.driver.render(block);
369
- if (result instanceof Promise)
370
- result.then(v => { runRenderNestedTreesThenDo(undefined, NOP); return v; }, e => { console.log(e); runRenderNestedTreesThenDo(e !== null && e !== void 0 ? e : new Error("unknown error"), NOP); });
371
- else
372
- runRenderNestedTreesThenDo(undefined, NOP);
373
- }
374
- catch (e) {
375
- runRenderNestedTreesThenDo(e, NOP);
376
- console.log(`Rendering failed: ${block.name}`);
377
- console.log(`${e}`);
378
- }
379
- });
413
+ let result = undefined;
414
+ try {
415
+ block.stamp++;
416
+ block.numerator = 0;
417
+ block.children.beginMerge();
418
+ result = block.driver.render(block);
419
+ if (result instanceof Promise)
420
+ result.then(v => { runRenderNestedTreesThenDo(undefined, NOP); return v; }, e => { console.log(e); runRenderNestedTreesThenDo(e !== null && e !== void 0 ? e : new Error("unknown error"), NOP); });
421
+ else
422
+ runRenderNestedTreesThenDo(undefined, NOP);
423
+ }
424
+ catch (e) {
425
+ runRenderNestedTreesThenDo(e, NOP);
426
+ console.log(`Rendering failed: ${block.name}`);
427
+ console.log(`${e}`);
428
+ }
380
429
  }
381
430
  }
382
431
  function runFinalize(item, isLeader) {
@@ -424,20 +473,20 @@ function forEachChildRecursively(item, action) {
424
473
  forEachChildRecursively(item, action);
425
474
  }
426
475
  function wrap(func) {
427
- const ctx = gContext;
476
+ const current = gCurrent;
428
477
  const wrappedRunUnder = (...args) => {
429
- return runUnder(ctx, func, ...args);
478
+ return runUnder(current, func, ...args);
430
479
  };
431
480
  return wrappedRunUnder;
432
481
  }
433
482
  function runUnder(item, func, ...args) {
434
- const outer = gContext;
483
+ const outer = gCurrent;
435
484
  try {
436
- gContext = item;
485
+ gCurrent = item;
437
486
  return func(...args);
438
487
  }
439
488
  finally {
440
- gContext = outer;
489
+ gCurrent = outer;
441
490
  }
442
491
  }
443
492
  function triggersAreEqual(a1, a2) {
@@ -499,6 +548,12 @@ Object.defineProperty(gSysRoot.instance, "host", {
499
548
  configurable: false,
500
549
  enumerable: true,
501
550
  });
502
- let gContext = gSysRoot;
551
+ Object.defineProperty(gSysRoot.instance, "context", {
552
+ value: gSysRoot.instance,
553
+ writable: false,
554
+ configurable: false,
555
+ enumerable: true,
556
+ });
557
+ let gCurrent = gSysRoot;
503
558
  let gFirstToDispose = undefined;
504
559
  let gLastToDispose = undefined;
@@ -2,13 +2,12 @@ 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
4
  export declare function PlainText(content: string): VBlock<HTMLElement, void, void>;
5
- export declare function MdText(content: string): VBlock<HTMLElement, void, void>;
6
5
  export declare function HtmlText(content: string): VBlock<HTMLElement, void, void>;
7
6
  export declare function Grid<M = unknown, R = void>(name: string, args: BlockArgs<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
8
7
  export declare function Line<T = void>(claim: (x: void) => T): VBlock<HTMLElement>;
9
8
  export declare function lineFeed(args?: BlockArgs<HTMLElement, void, void>, noCoalescing?: boolean): VBlock<HTMLElement>;
10
9
  export declare function Group<M = unknown, R = void>(name: string, args: BlockArgs<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
11
10
  export declare class VerstakDriver<T extends HTMLElement> extends HtmlDriver<T> {
12
- arrange(block: VBlock<T>, place: Place | undefined, heightGrab: number | undefined): void;
11
+ arrange(block: VBlock<T>, place: Place | undefined, heightGrowth: number | undefined): void;
13
12
  render(block: VBlock<T>): void | Promise<void>;
14
13
  }
@@ -6,9 +6,6 @@ export function Block(name, args) {
6
6
  export function PlainText(content) {
7
7
  return VBlock.claim("", { render(e) { e.innerText = content; } }, VerstakTags.text);
8
8
  }
9
- export function MdText(content) {
10
- return VBlock.claim("", { render(e) { e.innerHTML = content; } }, VerstakTags.text);
11
- }
12
9
  export function HtmlText(content) {
13
10
  return VBlock.claim("", { render(e) { e.innerHTML = content; } }, VerstakTags.text);
14
11
  }
@@ -28,15 +25,15 @@ export function Group(name, args) {
28
25
  return VBlock.claim(name, args, VerstakTags.group);
29
26
  }
30
27
  export class VerstakDriver extends HtmlDriver {
31
- arrange(block, place, heightGrab) {
28
+ arrange(block, place, heightGrowth) {
32
29
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
33
30
  if (block.native) {
34
- if (heightGrab === undefined) {
35
- const existing = block.stamp > 1 ? block.place : undefined;
36
- if (place !== existing) {
31
+ if (heightGrowth === undefined) {
32
+ const ex = block.stamp > 1 ? block.place : undefined;
33
+ if (place !== ex) {
37
34
  const css = block.native.style;
38
35
  const exact = place === null || place === void 0 ? void 0 : place.exact;
39
- if (exact !== (existing === null || existing === void 0 ? void 0 : existing.exact)) {
36
+ if (exact !== (ex === null || ex === void 0 ? void 0 : ex.exact)) {
40
37
  if (exact) {
41
38
  const x1 = exact.x1 || 1;
42
39
  const y1 = exact.y1 || 1;
@@ -47,31 +44,31 @@ export class VerstakDriver extends HtmlDriver {
47
44
  else
48
45
  css.gridArea = "";
49
46
  }
50
- const widthGrab = (_a = place === null || place === void 0 ? void 0 : place.widthGrab) !== null && _a !== void 0 ? _a : 0;
51
- if (widthGrab !== ((_b = existing === null || existing === void 0 ? void 0 : existing.widthGrab) !== null && _b !== void 0 ? _b : 0)) {
52
- if (widthGrab > 0)
53
- css.flexGrow = `${widthGrab}`;
47
+ const widthGrowth = (_a = place === null || place === void 0 ? void 0 : place.widthGrowth) !== null && _a !== void 0 ? _a : 0;
48
+ if (widthGrowth !== ((_b = ex === null || ex === void 0 ? void 0 : ex.widthGrowth) !== null && _b !== void 0 ? _b : 0)) {
49
+ if (widthGrowth > 0)
50
+ css.flexGrow = `${widthGrowth}`;
54
51
  else
55
52
  css.flexGrow = "";
56
53
  }
57
54
  const widthMin = (_c = place === null || place === void 0 ? void 0 : place.widthMin) !== null && _c !== void 0 ? _c : "";
58
- if (widthMin !== ((_d = existing === null || existing === void 0 ? void 0 : existing.widthMin) !== null && _d !== void 0 ? _d : ""))
55
+ if (widthMin !== ((_d = ex === null || ex === void 0 ? void 0 : ex.widthMin) !== null && _d !== void 0 ? _d : ""))
59
56
  css.minWidth = `${widthMin}`;
60
57
  const widthMax = (_e = place === null || place === void 0 ? void 0 : place.widthMax) !== null && _e !== void 0 ? _e : "";
61
- if (widthMax !== ((_f = existing === null || existing === void 0 ? void 0 : existing.widthMax) !== null && _f !== void 0 ? _f : ""))
58
+ if (widthMax !== ((_f = ex === null || ex === void 0 ? void 0 : ex.widthMax) !== null && _f !== void 0 ? _f : ""))
62
59
  css.maxWidth = `${widthMax}`;
63
60
  const heightMin = (_g = place === null || place === void 0 ? void 0 : place.heightMin) !== null && _g !== void 0 ? _g : "";
64
- if (heightMin !== ((_h = existing === null || existing === void 0 ? void 0 : existing.heightMin) !== null && _h !== void 0 ? _h : ""))
61
+ if (heightMin !== ((_h = ex === null || ex === void 0 ? void 0 : ex.heightMin) !== null && _h !== void 0 ? _h : ""))
65
62
  css.minHeight = `${heightMin}`;
66
63
  const heightMax = (_j = place === null || place === void 0 ? void 0 : place.heightMax) !== null && _j !== void 0 ? _j : "";
67
- if (heightMax !== ((_k = existing === null || existing === void 0 ? void 0 : existing.heightMax) !== null && _k !== void 0 ? _k : ""))
64
+ if (heightMax !== ((_k = ex === null || ex === void 0 ? void 0 : ex.heightMax) !== null && _k !== void 0 ? _k : ""))
68
65
  css.maxHeight = `${heightMax}`;
69
- const align = (_l = place === null || place === void 0 ? void 0 : place.align) !== null && _l !== void 0 ? _l : To.Default;
70
- if (align !== ((_m = existing === null || existing === void 0 ? void 0 : existing.align) !== null && _m !== void 0 ? _m : To.Default)) {
71
- if ((align & To.Default) === 0) {
72
- const v = AlignCss[(align >> 2) & 0b11];
73
- const h = AlignCss[align & 0b11];
74
- const t = TextAlignCss[align & 0b11];
66
+ const alignContent = (_l = place === null || place === void 0 ? void 0 : place.alignContent) !== null && _l !== void 0 ? _l : To.Default;
67
+ if (alignContent !== ((_m = ex === null || ex === void 0 ? void 0 : ex.alignContent) !== null && _m !== void 0 ? _m : To.Default)) {
68
+ if ((alignContent & To.Default) === 0) {
69
+ const v = AlignToCss[(alignContent >> 2) & 0b11];
70
+ const h = AlignToCss[alignContent & 0b11];
71
+ const t = TextAlignCss[alignContent & 0b11];
75
72
  css.justifyContent = v;
76
73
  css.alignItems = h;
77
74
  css.textAlign = t;
@@ -79,18 +76,18 @@ export class VerstakDriver extends HtmlDriver {
79
76
  else
80
77
  css.justifyContent = css.alignItems = css.textAlign = "";
81
78
  }
82
- const heightGrab = (_o = place === null || place === void 0 ? void 0 : place.heightGrab) !== null && _o !== void 0 ? _o : 0;
83
- const dock = (_p = place === null || place === void 0 ? void 0 : place.dock) !== null && _p !== void 0 ? _p : To.Default;
84
- if (dock !== ((_q = existing === null || existing === void 0 ? void 0 : existing.dock) !== null && _q !== void 0 ? _q : To.Default) ||
85
- heightGrab !== ((_r = existing === null || existing === void 0 ? void 0 : existing.heightGrab) !== null && _r !== void 0 ? _r : 0)) {
86
- if ((dock & To.Default) === 0) {
87
- const v = AlignCss[(dock >> 2) & 0b11];
88
- const h = AlignCss[dock & 0b11];
79
+ const heightGrowth = (_o = place === null || place === void 0 ? void 0 : place.heightGrowth) !== null && _o !== void 0 ? _o : 0;
80
+ const alignFrame = (_p = place === null || place === void 0 ? void 0 : place.alignFrame) !== null && _p !== void 0 ? _p : To.Default;
81
+ if (alignFrame !== ((_q = ex === null || ex === void 0 ? void 0 : ex.alignFrame) !== null && _q !== void 0 ? _q : To.Default) ||
82
+ heightGrowth !== ((_r = ex === null || ex === void 0 ? void 0 : ex.heightGrowth) !== null && _r !== void 0 ? _r : 0)) {
83
+ if ((alignFrame & To.Default) === 0) {
84
+ const v = AlignToCss[(alignFrame >> 2) & 0b11];
85
+ const h = AlignToCss[alignFrame & 0b11];
89
86
  css.alignSelf = v;
90
87
  css.justifySelf = h;
91
88
  }
92
- else if (heightGrab > 0) {
93
- css.alignSelf = AlignCss[To.Fit];
89
+ else if (heightGrowth > 0) {
90
+ css.alignSelf = AlignToCss[To.Fit];
94
91
  }
95
92
  else
96
93
  css.alignSelf = css.justifySelf = "";
@@ -98,13 +95,13 @@ export class VerstakDriver extends HtmlDriver {
98
95
  }
99
96
  }
100
97
  else {
101
- if (heightGrab > 0)
102
- block.native.style.flexGrow = `${heightGrab}`;
98
+ if (heightGrowth > 0)
99
+ block.native.style.flexGrow = `${heightGrowth}`;
103
100
  else
104
101
  block.native.style.flexGrow = "";
105
102
  }
106
103
  }
107
- super.arrange(block, place, heightGrab);
104
+ super.arrange(block, place, heightGrowth);
108
105
  }
109
106
  render(block) {
110
107
  if (!block.driver.isLine)
@@ -120,5 +117,5 @@ const VerstakTags = {
120
117
  group: new VerstakDriver("v-group", LayoutKind.Group),
121
118
  };
122
119
  const EMPTY_RENDER = { render() { } };
123
- const AlignCss = ["stretch", "start", "center", "end"];
120
+ const AlignToCss = ["stretch", "start", "center", "end"];
124
121
  const TextAlignCss = ["justify", "left", "center", "right"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verstak",
3
- "version": "0.22.503",
3
+ "version": "0.22.504",
4
4
  "description": "Verstak - Front-End Library",
5
5
  "publisher": "Nezaboodka Software",
6
6
  "license": "Apache-2.0",
@@ -31,15 +31,15 @@
31
31
  },
32
32
  "homepage": "https://github.com/nezaboodka/verstak/blob/master/README.md#readme",
33
33
  "dependencies": {
34
- "reactronic": "^0.22.503"
34
+ "reactronic": "^0.22.504"
35
35
  },
36
36
  "devDependencies": {
37
- "@types/node": "18.11.7",
38
- "@typescript-eslint/eslint-plugin": "5.41.0",
39
- "@typescript-eslint/parser": "5.41.0",
37
+ "@types/node": "18.11.9",
38
+ "@typescript-eslint/eslint-plugin": "5.42.1",
39
+ "@typescript-eslint/parser": "5.42.1",
40
40
  "ava": "4.3.3",
41
41
  "c8": "7.12.0",
42
- "eslint": "8.26.0",
42
+ "eslint": "8.27.0",
43
43
  "ts-node": "10.9.1",
44
44
  "tsconfig-paths": "4.1.0",
45
45
  "typescript": "4.8.4"