verstak 0.22.412 → 0.22.500

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/README.md CHANGED
@@ -3,11 +3,12 @@
3
3
  [![NPM Version](https://img.shields.io/npm/v/verstak.svg?style=flat&colorB=success)](https://www.npmjs.com/package/verstak)
4
4
  [![Package Size](https://img.shields.io/bundlephobia/minzip/verstak.svg?colorB=success)](https://bundlephobia.com/result?p=verstak)
5
5
 
6
- # **Verstak** - Transactional Reactive Front-End Development Framework
6
+ # **Verstak** - Experimental Front-End Library
7
7
 
8
8
  Verstak is an experimental JavaScript library that provides
9
+ grid-based layout and
9
10
  [transactional reactive](https://blog.nezaboodka.com/post/2019/593-modern-database-should-natively-support-transactionally-reactive-programming)
10
- facilities and grid-based layout for building front-end applications.
11
+ facilities for building front-end applications.
11
12
 
12
13
  Transactional reactivity means that state changes are being made in an
13
14
  isolated data snapshot and then, once atomically applied, are
@@ -0,0 +1,62 @@
1
+ import { Monitor, LoggingOptions, Item, CollectionReader } from 'reactronic';
2
+ export declare type Callback<T = unknown> = (impl: T) => void;
3
+ export declare type Render<T = unknown, M = unknown, P = void, R = void> = (impl: T, block: Block<T, M, P, R>) => R;
4
+ export declare type AsyncRender<T = unknown, M = unknown, P = void> = (impl: T, block: Block<T, M, P, Promise<void>>) => Promise<void>;
5
+ export declare const enum Priority {
6
+ SyncP0 = 0,
7
+ AsyncP1 = 1,
8
+ AsyncP2 = 2
9
+ }
10
+ export interface BlockOptions<P = void> {
11
+ place?: P;
12
+ triggers?: unknown;
13
+ priority?: Priority;
14
+ monitor?: Monitor;
15
+ throttling?: number;
16
+ logging?: Partial<LoggingOptions>;
17
+ shuffle?: boolean;
18
+ }
19
+ export declare abstract class Block<T = unknown, M = unknown, P = void, R = void> {
20
+ static readonly shortFrameDuration = 16;
21
+ static readonly longFrameDuration = 300;
22
+ static currentRenderingPriority: Priority;
23
+ static frameDuration: number;
24
+ abstract readonly name: string;
25
+ abstract readonly factory: BlockFactory<T>;
26
+ abstract readonly inline: boolean;
27
+ abstract readonly renderer: Render<T, M, P, R>;
28
+ abstract readonly wrapper: Render<T, M, P, R> | undefined;
29
+ abstract readonly options: Readonly<BlockOptions<P>> | undefined;
30
+ abstract model?: M;
31
+ abstract readonly level: number;
32
+ abstract readonly parent: Block;
33
+ abstract readonly children: CollectionReader<Block>;
34
+ abstract readonly item: Item<Block> | undefined;
35
+ abstract readonly stamp: number;
36
+ abstract readonly impl?: T;
37
+ render(): R;
38
+ get isInitialRendering(): boolean;
39
+ abstract wrapBy(renderer: Render<T, M, P, R> | undefined): this;
40
+ static root(render: () => void): void;
41
+ static get current(): Block;
42
+ static renderChildrenThenDo(action: (error: unknown) => void): void;
43
+ static forAllBlocksDo<T>(action: (e: T) => void): void;
44
+ static claim<T = undefined, M = unknown, P = void, R = void>(name: string, inline: boolean, options: BlockOptions<P> | undefined, renderer: Render<T, M, P, R>, factory?: BlockFactory<T>): Block<T, M, P, R>;
45
+ static getDefaultLoggingOptions(): LoggingOptions | undefined;
46
+ static setDefaultLoggingOptions(logging?: LoggingOptions): void;
47
+ }
48
+ export declare class BlockFactory<T> {
49
+ static readonly default: BlockFactory<any>;
50
+ readonly name: string;
51
+ readonly strict: boolean;
52
+ constructor(name: string, strict: boolean);
53
+ initialize(block: Block<T>, impl: T | undefined): void;
54
+ finalize(block: Block<T>, isLeader: boolean): boolean;
55
+ layout(block: Block<T>, strict: boolean): void;
56
+ render(block: Block<T>): void | Promise<void>;
57
+ }
58
+ export declare class StaticBlockFactory<T> extends BlockFactory<T> {
59
+ readonly element: T;
60
+ constructor(name: string, sequential: boolean, element: T);
61
+ initialize(block: Block<T>, element: T | undefined): void;
62
+ }
@@ -23,9 +23,9 @@ export var Priority;
23
23
  Priority[Priority["AsyncP1"] = 1] = "AsyncP1";
24
24
  Priority[Priority["AsyncP2"] = 2] = "AsyncP2";
25
25
  })(Priority || (Priority = {}));
26
- export class RxNode {
26
+ export class Block {
27
27
  render() {
28
- return this.renderer(this.element, this);
28
+ return this.renderer(this.impl, this);
29
29
  }
30
30
  get isInitialRendering() {
31
31
  return this.stamp === 2;
@@ -37,109 +37,105 @@ export class RxNode {
37
37
  static get current() {
38
38
  return gContext.self;
39
39
  }
40
- static shuffleChildrenRendering(shuffle) {
41
- gContext.self.shuffle = shuffle;
42
- }
43
40
  static renderChildrenThenDo(action) {
44
41
  runRenderChildrenThenDo(undefined, action);
45
42
  }
46
- static forAllNodesDo(action) {
43
+ static forAllBlocksDo(action) {
47
44
  forEachChildRecursively(gSysRoot, action);
48
45
  }
49
- static claim(name, triggers, inline, renderer, priority, monitor, throttling, logging, factory) {
46
+ static claim(name, inline, options, renderer, factory) {
47
+ var _a;
50
48
  const parent = gContext.self;
51
49
  const children = parent.children;
52
50
  const item = children.claim(name);
53
- let node;
51
+ let block;
54
52
  if (item) {
55
- node = item.self;
56
- if (node.factory !== factory && factory !== undefined)
57
- throw new Error(`changing node type is not yet supported: "${node.factory.name}" -> "${factory === null || factory === void 0 ? void 0 : factory.name}"`);
58
- if (node.inline || !triggersAreEqual(node.triggers, triggers))
59
- node.triggers = triggers;
60
- node.renderer = renderer;
61
- node.priority = priority !== null && priority !== void 0 ? priority : Priority.SyncP0;
53
+ block = item.self;
54
+ if (block.factory !== factory && factory !== undefined)
55
+ throw new Error(`changing block type is not yet supported: "${block.factory.name}" -> "${factory === null || factory === void 0 ? void 0 : factory.name}"`);
56
+ if (options) {
57
+ const existingTriggers = (_a = block.options) === null || _a === void 0 ? void 0 : _a.triggers;
58
+ if (triggersAreEqual(options.triggers, existingTriggers))
59
+ options.triggers = existingTriggers;
60
+ }
61
+ block.options = options;
62
+ block.renderer = renderer;
62
63
  }
63
64
  else {
64
- node = new RxNodeImpl(name, factory !== null && factory !== void 0 ? factory : NodeFactory.default, inline !== null && inline !== void 0 ? inline : false, parent, triggers, renderer, undefined, priority, monitor, throttling, logging);
65
- node.item = children.add(node);
66
- RxNodeImpl.grandCount++;
67
- if (!node.inline)
68
- RxNodeImpl.disposableCount++;
65
+ block = new VerstakBlock(name, factory !== null && factory !== void 0 ? factory : BlockFactory.default, inline !== null && inline !== void 0 ? inline : false, parent, options, renderer, undefined);
66
+ block.item = children.add(block);
67
+ VerstakBlock.grandCount++;
68
+ if (!block.inline)
69
+ VerstakBlock.disposableCount++;
69
70
  }
70
- return node;
71
+ return block;
71
72
  }
72
73
  static getDefaultLoggingOptions() {
73
- return RxNodeImpl.logging;
74
+ return VerstakBlock.logging;
74
75
  }
75
76
  static setDefaultLoggingOptions(logging) {
76
- RxNodeImpl.logging = logging;
77
+ VerstakBlock.logging = logging;
77
78
  }
78
79
  }
79
- RxNode.currentRenderingPriority = Priority.SyncP0;
80
- RxNode.shortFrameDuration = 16;
81
- RxNode.longFrameDuration = 300;
82
- RxNode.frameDuration = RxNode.longFrameDuration;
80
+ Block.shortFrameDuration = 16;
81
+ Block.longFrameDuration = 300;
82
+ Block.currentRenderingPriority = Priority.SyncP0;
83
+ Block.frameDuration = Block.longFrameDuration;
83
84
  const NOP = () => { };
84
- export class NodeFactory {
85
+ export class BlockFactory {
85
86
  constructor(name, strict) {
86
87
  this.name = name;
87
88
  this.strict = strict;
88
89
  }
89
- initialize(node, element) {
90
- const impl = node;
91
- impl.element = element;
90
+ initialize(block, impl) {
91
+ const b = block;
92
+ b.impl = impl;
92
93
  }
93
- finalize(node, isLeader) {
94
- const impl = node;
95
- impl.element = undefined;
94
+ finalize(block, isLeader) {
95
+ const b = block;
96
+ b.impl = undefined;
96
97
  return isLeader;
97
98
  }
98
- arrange(node, strict) {
99
+ layout(block, strict) {
99
100
  }
100
- render(node) {
101
+ render(block) {
101
102
  let result;
102
- if (node.wrapper)
103
- result = node.wrapper(node.element, node);
103
+ if (block.wrapper)
104
+ result = block.wrapper(block.impl, block);
104
105
  else
105
- result = node.render();
106
+ result = block.render();
106
107
  return result;
107
108
  }
108
109
  }
109
- NodeFactory.default = new NodeFactory('default', false);
110
- export class StaticNodeFactory extends NodeFactory {
110
+ BlockFactory.default = new BlockFactory('default', false);
111
+ export class StaticBlockFactory extends BlockFactory {
111
112
  constructor(name, sequential, element) {
112
113
  super(name, sequential);
113
114
  this.element = element;
114
115
  }
115
- initialize(node, element) {
116
- super.initialize(node, this.element);
116
+ initialize(block, element) {
117
+ super.initialize(block, this.element);
117
118
  }
118
119
  }
119
- function getNodeName(node) {
120
- return node.stamp >= 0 ? node.name : undefined;
120
+ function getBlockName(block) {
121
+ return block.stamp >= 0 ? block.name : undefined;
121
122
  }
122
- class RxNodeImpl extends RxNode {
123
- constructor(name, factory, inline, parent, triggers, renderer, wrapper, priority, monitor, throttling, logging) {
123
+ class VerstakBlock extends Block {
124
+ constructor(name, factory, inline, parent, options, renderer, wrapper) {
124
125
  super();
125
126
  this.name = name;
126
127
  this.factory = factory;
127
128
  this.inline = inline;
128
- this.triggers = triggers;
129
+ this.options = options;
129
130
  this.renderer = renderer;
130
131
  this.wrapper = wrapper;
131
- this.monitor = monitor;
132
- this.throttling = throttling !== null && throttling !== void 0 ? throttling : -1;
133
- this.logging = logging !== null && logging !== void 0 ? logging : RxNodeImpl.logging;
134
- this.priority = priority !== null && priority !== void 0 ? priority : Priority.SyncP0;
135
- this.shuffle = false;
136
132
  this.model = undefined;
137
133
  this.level = parent.level + 1;
138
134
  this.parent = parent;
139
- this.children = new Collection(factory.strict, getNodeName);
135
+ this.children = new Collection(factory.strict, getBlockName);
140
136
  this.item = undefined;
141
137
  this.stamp = 0;
142
- this.element = undefined;
138
+ this.impl = undefined;
143
139
  }
144
140
  autorender(_triggers) {
145
141
  runRender(this.item);
@@ -149,9 +145,9 @@ class RxNodeImpl extends RxNode {
149
145
  return this;
150
146
  }
151
147
  }
152
- RxNodeImpl.grandCount = 0;
153
- RxNodeImpl.disposableCount = 0;
154
- RxNodeImpl.logging = undefined;
148
+ VerstakBlock.grandCount = 0;
149
+ VerstakBlock.disposableCount = 0;
150
+ VerstakBlock.logging = undefined;
155
151
  __decorate([
156
152
  reactive,
157
153
  options({
@@ -162,11 +158,12 @@ __decorate([
162
158
  __metadata("design:type", Function),
163
159
  __metadata("design:paramtypes", [Object]),
164
160
  __metadata("design:returntype", void 0)
165
- ], RxNodeImpl.prototype, "autorender", null);
161
+ ], VerstakBlock.prototype, "autorender", null);
166
162
  function runRenderChildrenThenDo(error, action) {
163
+ var _a, _b;
167
164
  const context = gContext;
168
- const node = context.self;
169
- const children = node.children;
165
+ const block = context.self;
166
+ const children = block.children;
170
167
  if (children.isMergeInProgress) {
171
168
  let promised = undefined;
172
169
  try {
@@ -181,21 +178,15 @@ function runRenderChildrenThenDo(error, action) {
181
178
  for (const child of children.items()) {
182
179
  if (Transaction.isCanceled)
183
180
  break;
181
+ isMoved = checkIsMoved(isMoved, child, children, strict);
184
182
  const x = child.self;
185
- if (x.element) {
186
- if (isMoved) {
187
- children.markAsMoved(child);
188
- isMoved = false;
189
- }
190
- }
191
- else if (strict && children.isMoved(child))
192
- isMoved = true;
193
- if (x.priority === Priority.SyncP0)
183
+ const priority = (_b = (_a = x.options) === null || _a === void 0 ? void 0 : _a.priority) !== null && _b !== void 0 ? _b : Priority.SyncP0;
184
+ if (priority === Priority.SyncP0)
194
185
  prepareThenRunRender(child, children.isMoved(child), strict);
195
- else if (x.priority === Priority.AsyncP1)
196
- p1 = push(p1, child);
186
+ else if (priority === Priority.AsyncP1)
187
+ p1 = push(child, p1);
197
188
  else
198
- p2 = push(p2, child);
189
+ p2 = push(child, p2);
199
190
  }
200
191
  if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
201
192
  promised = startIncrementalRendering(context, children, p1, p2).then(() => action(error), e => action(e));
@@ -207,6 +198,17 @@ function runRenderChildrenThenDo(error, action) {
207
198
  }
208
199
  }
209
200
  }
201
+ function checkIsMoved(isMoved, child, children, strict) {
202
+ if (child.self.impl) {
203
+ if (isMoved) {
204
+ children.markAsMoved(child);
205
+ isMoved = false;
206
+ }
207
+ }
208
+ else if (strict && children.isMoved(child))
209
+ isMoved = true;
210
+ return isMoved;
211
+ }
210
212
  function startIncrementalRendering(parent, allChildren, priority1, priority2) {
211
213
  return __awaiter(this, void 0, void 0, function* () {
212
214
  const stamp = parent.self.stamp;
@@ -217,80 +219,83 @@ function startIncrementalRendering(parent, allChildren, priority1, priority2) {
217
219
  });
218
220
  }
219
221
  function renderIncrementally(parent, stamp, allChildren, items, priority) {
222
+ var _a;
220
223
  return __awaiter(this, void 0, void 0, function* () {
221
224
  yield Transaction.requestNextFrame();
222
- const node = parent.self;
223
- if (!Transaction.isCanceled || !Transaction.isFrameOver(1, RxNode.shortFrameDuration / 3)) {
224
- let outerPriority = RxNode.currentRenderingPriority;
225
- RxNode.currentRenderingPriority = priority;
225
+ const block = parent.self;
226
+ if (!Transaction.isCanceled || !Transaction.isFrameOver(1, Block.shortFrameDuration / 3)) {
227
+ let outerPriority = Block.currentRenderingPriority;
228
+ Block.currentRenderingPriority = priority;
226
229
  try {
227
- const strict = node.children.strict;
228
- if (node.shuffle)
230
+ const strict = block.children.strict;
231
+ if ((_a = block.options) === null || _a === void 0 ? void 0 : _a.shuffle)
229
232
  shuffle(items);
230
- const frameDurationLimit = priority === Priority.AsyncP2 ? RxNode.shortFrameDuration : Infinity;
231
- let frameDuration = Math.min(frameDurationLimit, Math.max(RxNode.frameDuration / 4, RxNode.shortFrameDuration));
233
+ const frameDurationLimit = priority === Priority.AsyncP2 ? Block.shortFrameDuration : Infinity;
234
+ let frameDuration = Math.min(frameDurationLimit, Math.max(Block.frameDuration / 4, Block.shortFrameDuration));
232
235
  for (const child of items) {
233
236
  prepareThenRunRender(child, allChildren.isMoved(child), strict);
234
237
  if (Transaction.isFrameOver(1, frameDuration)) {
235
- RxNode.currentRenderingPriority = outerPriority;
238
+ Block.currentRenderingPriority = outerPriority;
236
239
  yield Transaction.requestNextFrame(0);
237
- outerPriority = RxNode.currentRenderingPriority;
238
- RxNode.currentRenderingPriority = priority;
239
- frameDuration = Math.min(4 * frameDuration, Math.min(frameDurationLimit, RxNode.frameDuration));
240
+ outerPriority = Block.currentRenderingPriority;
241
+ Block.currentRenderingPriority = priority;
242
+ frameDuration = Math.min(4 * frameDuration, Math.min(frameDurationLimit, Block.frameDuration));
240
243
  }
241
- if (Transaction.isCanceled && Transaction.isFrameOver(1, RxNode.shortFrameDuration / 3))
244
+ if (Transaction.isCanceled && Transaction.isFrameOver(1, Block.shortFrameDuration / 3))
242
245
  break;
243
246
  }
244
247
  }
245
248
  finally {
246
- RxNode.currentRenderingPriority = outerPriority;
249
+ Block.currentRenderingPriority = outerPriority;
247
250
  }
248
251
  }
249
252
  });
250
253
  }
251
254
  function prepareThenRunRender(item, moved, strict) {
252
- const node = item.self;
253
- if (node.stamp >= 0) {
255
+ var _a;
256
+ const block = item.self;
257
+ if (block.stamp >= 0) {
254
258
  prepareRender(item, moved, strict);
255
- if (node.inline)
259
+ if (block.inline)
256
260
  runRender(item);
257
261
  else
258
- nonreactive(node.autorender, node.triggers);
262
+ nonreactive(block.autorender, (_a = block.options) === null || _a === void 0 ? void 0 : _a.triggers);
259
263
  }
260
264
  }
261
265
  function prepareRender(item, moved, strict) {
262
266
  var _a, _b, _c;
263
- const node = item.self;
264
- const factory = node.factory;
265
- if (node.stamp === 0) {
266
- node.stamp = 1;
267
- if (!node.inline) {
267
+ const block = item.self;
268
+ const factory = block.factory;
269
+ if (block.stamp === 0) {
270
+ block.stamp = 1;
271
+ if (!block.inline) {
268
272
  Transaction.outside(() => {
273
+ var _a, _b, _c;
269
274
  if (Rx.isLogging)
270
- Rx.setLoggingHint(node, node.name);
271
- Rx.getController(node.autorender).configure({
272
- order: node.level,
273
- monitor: node.monitor,
274
- throttling: node.throttling,
275
- logging: node.logging,
275
+ Rx.setLoggingHint(block, block.name);
276
+ Rx.getController(block.autorender).configure({
277
+ order: block.level,
278
+ monitor: (_a = block.options) === null || _a === void 0 ? void 0 : _a.monitor,
279
+ throttling: (_b = block.options) === null || _b === void 0 ? void 0 : _b.throttling,
280
+ logging: (_c = block.options) === null || _c === void 0 ? void 0 : _c.logging,
276
281
  });
277
282
  });
278
283
  }
279
- (_a = factory.initialize) === null || _a === void 0 ? void 0 : _a.call(factory, node, undefined);
280
- (_b = factory.arrange) === null || _b === void 0 ? void 0 : _b.call(factory, node, strict);
284
+ (_a = factory.initialize) === null || _a === void 0 ? void 0 : _a.call(factory, block, undefined);
285
+ (_b = factory.layout) === null || _b === void 0 ? void 0 : _b.call(factory, block, strict);
281
286
  }
282
287
  else if (moved)
283
- (_c = factory.arrange) === null || _c === void 0 ? void 0 : _c.call(factory, node, strict);
288
+ (_c = factory.layout) === null || _c === void 0 ? void 0 : _c.call(factory, block, strict);
284
289
  }
285
290
  function runRender(item) {
286
- const node = item.self;
287
- if (node.stamp >= 0) {
291
+ const block = item.self;
292
+ if (block.stamp >= 0) {
288
293
  runUnder(item, () => {
289
294
  let result = undefined;
290
295
  try {
291
- node.stamp++;
292
- node.children.beginMerge();
293
- result = node.factory.render(node);
296
+ block.stamp++;
297
+ block.children.beginMerge();
298
+ result = block.factory.render(block);
294
299
  if (result instanceof Promise)
295
300
  result.then(v => { runRenderChildrenThenDo(undefined, NOP); return v; }, e => { console.log(e); runRenderChildrenThenDo(e !== null && e !== void 0 ? e : new Error('unknown error'), NOP); });
296
301
  else
@@ -298,18 +303,18 @@ function runRender(item) {
298
303
  }
299
304
  catch (e) {
300
305
  runRenderChildrenThenDo(e, NOP);
301
- console.log(`Rendering failed: ${node.name}`);
306
+ console.log(`Rendering failed: ${block.name}`);
302
307
  console.log(`${e}`);
303
308
  }
304
309
  });
305
310
  }
306
311
  }
307
312
  function runFinalize(item, isLeader) {
308
- const node = item.self;
309
- if (node.stamp >= 0) {
310
- node.stamp = ~node.stamp;
311
- const childrenAreLeaders = node.factory.finalize(node, isLeader);
312
- if (!node.inline) {
313
+ const block = item.self;
314
+ if (block.stamp >= 0) {
315
+ block.stamp = ~block.stamp;
316
+ const childrenAreLeaders = block.factory.finalize(block, isLeader);
317
+ if (!block.inline) {
313
318
  item.aux = undefined;
314
319
  const last = gLastToDispose;
315
320
  if (last)
@@ -321,9 +326,9 @@ function runFinalize(item, isLeader) {
321
326
  void runDisposalLoop().then(NOP, error => console.log(error));
322
327
  });
323
328
  }
324
- for (const item of node.children.items())
329
+ for (const item of block.children.items())
325
330
  runFinalize(item, childrenAreLeaders);
326
- RxNodeImpl.grandCount--;
331
+ VerstakBlock.grandCount--;
327
332
  }
328
333
  }
329
334
  function runDisposalLoop() {
@@ -335,16 +340,16 @@ function runDisposalLoop() {
335
340
  yield Transaction.requestNextFrame();
336
341
  Rx.dispose(item.self);
337
342
  item = item.aux;
338
- RxNodeImpl.disposableCount--;
343
+ VerstakBlock.disposableCount--;
339
344
  }
340
345
  gFirstToDispose = gLastToDispose = undefined;
341
346
  });
342
347
  }
343
348
  function forEachChildRecursively(item, action) {
344
- const node = item.self;
345
- const e = node.element;
346
- e && action(e);
347
- for (const item of node.children.items())
349
+ const block = item.self;
350
+ const impl = block.impl;
351
+ impl && action(impl);
352
+ for (const item of block.children.items())
348
353
  forEachChildRecursively(item, action);
349
354
  }
350
355
  function wrap(func) {
@@ -382,7 +387,7 @@ function triggersAreEqual(a1, a2) {
382
387
  }
383
388
  return result;
384
389
  }
385
- function push(array, item) {
390
+ function push(item, array) {
386
391
  if (array == undefined)
387
392
  array = new Array();
388
393
  array.push(item);
@@ -413,7 +418,7 @@ function defaultReject(error) {
413
418
  throw error;
414
419
  }
415
420
  Promise.prototype.then = reactronicDomHookedThen;
416
- const gSysRoot = Collection.createItem(new RxNodeImpl('SYSTEM', new StaticNodeFactory('SYSTEM', false, null), false, { level: 0 }, undefined, NOP));
421
+ const gSysRoot = Collection.createItem(new VerstakBlock('SYSTEM', new StaticBlockFactory('SYSTEM', false, null), false, { level: 0 }, undefined, NOP));
417
422
  gSysRoot.self.item = gSysRoot;
418
423
  Object.defineProperty(gSysRoot, 'parent', {
419
424
  value: gSysRoot,
@@ -1,4 +1,3 @@
1
- import { Monitor, LoggingOptions } from 'reactronic';
2
- import { RxNode, Render, NodeFactory, Priority } from './RxNode';
3
- export declare function Reaction<E = undefined, M = unknown, R = void>(name: string, triggers: unknown, renderer: Render<E, M, R>, priority?: Priority, monitor?: Monitor, throttling?: number, logging?: Partial<LoggingOptions>, factory?: NodeFactory<E>): RxNode<E, M, R>;
4
- export declare function Inline<E = undefined, M = unknown, R = void>(name: string, renderer: Render<E, M, R>, priority?: Priority, factory?: NodeFactory<E>): RxNode<E, M, R>;
1
+ import { Block, Render, BlockFactory, BlockOptions } from './Block';
2
+ export declare function Reaction<T = undefined, M = unknown, P = void, R = void>(name: string, options: BlockOptions<P> | undefined, renderer: Render<T, M, P, R>, factory?: BlockFactory<T>): Block<T, M, P, R>;
3
+ export declare function Inline<T = undefined, M = unknown, P = void, R = void>(name: string, options: BlockOptions<P> | undefined, renderer: Render<T, M, P, R>, factory?: BlockFactory<T>): Block<T, M, P, R>;
@@ -1,7 +1,7 @@
1
- import { RxNode } from './RxNode';
2
- export function Reaction(name, triggers, renderer, priority, monitor, throttling, logging, factory) {
3
- return RxNode.claim(name, triggers, false, renderer, priority, monitor, throttling, logging, factory);
1
+ import { Block } from './Block';
2
+ export function Reaction(name, options, renderer, factory) {
3
+ return Block.claim(name, false, options, renderer, factory);
4
4
  }
5
- export function Inline(name, renderer, priority, factory) {
6
- return RxNode.claim(name, undefined, true, renderer, priority, undefined, undefined, undefined, factory);
5
+ export function Inline(name, options, renderer, factory) {
6
+ return Block.claim(name, true, options, renderer, factory);
7
7
  }
@@ -0,0 +1,27 @@
1
+ export interface Place {
2
+ lineBegin?: boolean;
3
+ area?: string;
4
+ columns?: number;
5
+ rows?: number;
6
+ cursorRight?: boolean;
7
+ cursorDown?: boolean;
8
+ }
9
+ export interface CellRange {
10
+ x1: number;
11
+ y1: number;
12
+ x2: number;
13
+ y2: number;
14
+ }
15
+ export declare class Layout {
16
+ private maxColumnCount;
17
+ private maxRowCount;
18
+ private actualColumnCount;
19
+ private actualRowCount;
20
+ private columnCursor;
21
+ private rowCursor;
22
+ private newRowCursor;
23
+ reset(maxColumnCount: number, maxRowCount: number): void;
24
+ claim(p: Place, result: CellRange): CellRange;
25
+ static parseCellRange(text: string, result: CellRange): CellRange;
26
+ static emitCellRange(value: CellRange): string;
27
+ }