verstak 0.24.508 → 0.92.25003

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.
Files changed (38) hide show
  1. package/build/dist/source/core/ElDriver.js +7 -7
  2. package/build/dist/source/core/Elements.d.ts +10 -10
  3. package/build/dist/source/core/Elements.js +28 -28
  4. package/build/dist/source/core/Restyler.js +3 -3
  5. package/build/dist/source/core/WebDriver.d.ts +4 -4
  6. package/build/dist/source/core/WebDriver.js +7 -7
  7. package/build/dist/source/express/Button.v.js +3 -3
  8. package/build/dist/source/express/Field.v.js +4 -4
  9. package/build/dist/source/express/Icon.v.js +1 -1
  10. package/build/dist/source/express/Image.v.js +1 -1
  11. package/build/dist/source/express/Spinner.v.js +1 -1
  12. package/build/dist/source/express/Theme.js +2 -2
  13. package/build/dist/source/express/Toggle.v.js +10 -7
  14. package/build/dist/source/express/common/Utils.js +2 -2
  15. package/build/dist/source/express/theme/Button.s.js +4 -4
  16. package/build/dist/source/express/theme/Field.s.js +5 -5
  17. package/build/dist/source/express/theme/Icon.s.js +2 -2
  18. package/build/dist/source/express/theme/Styling.js +2 -2
  19. package/build/dist/source/express/theme/Toggle.s.js +4 -4
  20. package/build/dist/source/html/DraggableArea.view.js +1 -1
  21. package/build/dist/source/sensors/ButtonSensor.js +7 -7
  22. package/build/dist/source/sensors/FocusSensor.js +6 -6
  23. package/build/dist/source/sensors/Handlers.d.ts +1 -1
  24. package/build/dist/source/sensors/Handlers.js +11 -11
  25. package/build/dist/source/sensors/HoverSensor.js +6 -6
  26. package/build/dist/source/sensors/HtmlDragSensor.js +20 -20
  27. package/build/dist/source/sensors/HtmlElementSensor.js +5 -5
  28. package/build/dist/source/sensors/KeyboardSensor.js +4 -4
  29. package/build/dist/source/sensors/PointerSensor.js +17 -17
  30. package/build/dist/source/sensors/ResizeSensor.js +3 -3
  31. package/build/dist/source/sensors/ScrollSensor.js +3 -3
  32. package/build/dist/source/sensors/WheelSensor.js +3 -3
  33. package/build/dist/source/sensors/WindowSensor.js +2 -2
  34. package/package.json +8 -8
  35. package/build/dist/source/archive/RxDomV1.Types.d.ts +0 -46
  36. package/build/dist/source/archive/RxDomV1.Types.js +0 -22
  37. package/build/dist/source/archive/RxDomV1.d.ts +0 -45
  38. package/build/dist/source/archive/RxDomV1.js +0 -557
@@ -1,557 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
11
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
12
- return new (P || (P = Promise))(function (resolve, reject) {
13
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
14
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
15
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
16
- step((generator = generator.apply(thisArg, _arguments || [])).next());
17
- });
18
- };
19
- import { reactive, unobs, Transaction, ReactiveSystem, options, Reentrance } from "reactronic";
20
- import { RxNode } from "./RxDomV1.Types.js";
21
- export class BasicNodeType {
22
- constructor(name, sequential) {
23
- this.name = name;
24
- this.sequential = sequential;
25
- }
26
- initialize(node) {
27
- if (!node.inline)
28
- ReactiveSystem.setLoggingHint(node, node.id);
29
- }
30
- render(node, args) {
31
- const inst = node.instance;
32
- if (!inst)
33
- throw new Error("element must be initialized before rendering");
34
- if (inst.buffer)
35
- throw new Error("rendering re-entrance is not supported yet");
36
- const native = inst.native;
37
- inst.buffer = [];
38
- let result;
39
- if (node.superRender)
40
- result = node.superRender(options => {
41
- const res = node.render(native, options);
42
- if (res instanceof Promise)
43
- return res.then();
44
- else
45
- return options;
46
- }, native);
47
- else
48
- result = node.render(native, args);
49
- if (result instanceof Promise)
50
- result = result.then(value => { RxDom.renderChildrenThenDo(NOP); return value; }, error => { console.log(error); RxDom.renderChildrenThenDo(NOP); });
51
- else
52
- RxDom.renderChildrenThenDo(NOP);
53
- }
54
- finalize(node, initiator) {
55
- const inst = node.instance;
56
- if (inst) {
57
- inst.native = undefined;
58
- if (!node.inline && node.instance)
59
- Transaction.isolate(() => ReactiveSystem.dispose(node.instance));
60
- for (const x of inst.children)
61
- tryToFinalize(x, initiator);
62
- for (const x of inst.guests)
63
- tryToFinalize(x, initiator);
64
- }
65
- }
66
- }
67
- export class RxNodeInstanceImpl {
68
- constructor(level) {
69
- this.revision = ~0;
70
- this.native = undefined;
71
- this.model = undefined;
72
- this.children = EMPTY;
73
- this.buffer = undefined;
74
- this.guests = EMPTY;
75
- this.resizeObserver = undefined;
76
- this.uuid = ++RxNodeInstanceImpl.gUuid;
77
- this.level = level;
78
- }
79
- rerender(node) {
80
- invokeRender(node, node.args);
81
- ReactiveSystem.configureCurrentOperation({ order: this.level });
82
- }
83
- }
84
- RxNodeInstanceImpl.gUuid = 0;
85
- __decorate([
86
- reactive,
87
- options({
88
- reentrance: Reentrance.cancelPrevious,
89
- triggeringArgs: true,
90
- noSideEffects: true
91
- }),
92
- __metadata("design:type", Function),
93
- __metadata("design:paramtypes", [RxNode]),
94
- __metadata("design:returntype", void 0)
95
- ], RxNodeInstanceImpl.prototype, "rerender", null);
96
- export class RxDom {
97
- static Root(render) {
98
- const inst = SYSTEM.instance;
99
- if (inst.buffer)
100
- throw new Error("rendering re-entrance is not supported yet");
101
- inst.buffer = [];
102
- let result = render();
103
- if (result instanceof Promise)
104
- result = result.then(value => { Transaction.run(null, RxDom.renderChildrenThenDo, NOP); return value; }, error => { console.log(error); Transaction.run(null, RxDom.renderChildrenThenDo, NOP); });
105
- else
106
- Transaction.run(null, RxDom.renderChildrenThenDo, NOP);
107
- return result;
108
- }
109
- static Node(id, args, render, superRender, type, inline, creator, host) {
110
- var _a, _b;
111
- const o = creator !== null && creator !== void 0 ? creator : gCreator;
112
- const inst = o.instance;
113
- if (!inst)
114
- throw new Error("element must be initialized before children");
115
- if (type === undefined)
116
- type = RxDom.basic;
117
- if (!host)
118
- host = gHost;
119
- const node = new RxNode(id, args, render, superRender, 0, false, type, inline !== null && inline !== void 0 ? inline : false, o, host);
120
- if (inst.buffer === undefined)
121
- throw new Error("children are rendered already");
122
- const rev = (_b = (_a = host.instance) === null || _a === void 0 ? void 0 : _a.revision) !== null && _b !== void 0 ? _b : ~1;
123
- if (rev >= ~0)
124
- inst.buffer.push(node);
125
- return node;
126
- }
127
- static renderChildrenThenDo(action) {
128
- const node = gCreator;
129
- if (node.type.sequential)
130
- RxDom.mergeAndRenderSequentialChildren(node, action);
131
- else
132
- RxDom.mergeAndRenderChildren(node, action);
133
- }
134
- static usingAnotherHost(host, run) {
135
- var _a;
136
- const native = (_a = host.instance) === null || _a === void 0 ? void 0 : _a.native;
137
- if (native !== undefined) {
138
- const outer = gHost;
139
- try {
140
- gHost = host;
141
- run(native);
142
- }
143
- finally {
144
- gHost = outer;
145
- }
146
- }
147
- }
148
- static createRootNode(id, sequential, native) {
149
- const inst = new RxNodeInstanceImpl(0);
150
- const node = new RxNode(id, null, () => { }, undefined, 0, false, { name: id, sequential }, false, {}, {}, inst);
151
- const a = node;
152
- a["creator"] = node;
153
- a["host"] = node;
154
- inst.native = native;
155
- return node;
156
- }
157
- static get self() {
158
- return gCreator;
159
- }
160
- static currentNodeInstance() {
161
- const inst = gCreator.instance;
162
- if (!inst)
163
- throw new Error("currentNodeInstance function can be called only inside rendering function");
164
- return inst;
165
- }
166
- static currentNodeInstanceInternal() {
167
- const inst = gCreator.instance;
168
- if (!inst)
169
- throw new Error("currentNodeInstanceInternal function can be called only inside rendering function");
170
- return inst;
171
- }
172
- static currentNodeRevision() {
173
- var _a, _b;
174
- return (_b = (_a = gCreator.instance) === null || _a === void 0 ? void 0 : _a.revision) !== null && _b !== void 0 ? _b : ~0;
175
- }
176
- static forAll(action) {
177
- RxDom.forEachChildRecursively(SYSTEM, action);
178
- }
179
- static mergeAndRenderSequentialChildren(node, finish) {
180
- var _a, _b, _c;
181
- const inst = node.instance;
182
- if (inst !== undefined && inst.buffer !== undefined) {
183
- try {
184
- const existing = inst.children;
185
- const sequenced = inst.buffer;
186
- const sorted = sequenced.slice().sort(compareNodes);
187
- inst.buffer = undefined;
188
- let host = inst;
189
- let guests = EMPTY;
190
- let sibling = undefined;
191
- let i = 0, j = 0;
192
- while (i < existing.length) {
193
- const old = existing[i];
194
- const x = sorted[j];
195
- const diff = x !== undefined ? compareNodes(x, old) : 1;
196
- if (diff <= 0) {
197
- const h = x.host.instance;
198
- if (h !== inst) {
199
- if (h !== host) {
200
- RxDom.mergeGuests(host, inst, guests);
201
- guests = [];
202
- host = h;
203
- }
204
- guests.push(x);
205
- }
206
- if (sibling !== undefined && x.id === sibling.id)
207
- throw new Error(`duplicate id '${sibling.id}' inside '${node.id}'`);
208
- if (diff === 0) {
209
- x.instance = old.instance;
210
- x.old = old;
211
- i++, j++;
212
- }
213
- else
214
- j++;
215
- sibling = x;
216
- }
217
- else {
218
- if (!Transaction.isCanceled)
219
- tryToFinalize(old, old);
220
- i++;
221
- }
222
- }
223
- if (host !== inst)
224
- RxDom.mergeGuests(host, inst, guests);
225
- sibling = undefined;
226
- i = 0;
227
- while (i < sequenced.length && !Transaction.isCanceled) {
228
- const x = sequenced[i];
229
- const old = x.old;
230
- x.old = undefined;
231
- x.prevSibling = sibling;
232
- const instance = x.instance;
233
- if (old && instance) {
234
- if ((sibling === null || sibling === void 0 ? void 0 : sibling.instance) !== ((_a = old.prevSibling) === null || _a === void 0 ? void 0 : _a.instance))
235
- (_c = (_b = x.type).mount) === null || _c === void 0 ? void 0 : _c.call(_b, x);
236
- if (x.inline || !argsAreEqual(x.args, old.args))
237
- tryToRender(x);
238
- }
239
- else {
240
- tryToInitialize(x);
241
- tryToRender(x);
242
- }
243
- if (x.native)
244
- sibling = x;
245
- i++;
246
- }
247
- if (!Transaction.isCanceled)
248
- inst.children = sorted;
249
- }
250
- finally {
251
- finish();
252
- }
253
- }
254
- }
255
- static mergeAndRenderChildren(node, finish) {
256
- const inst = node.instance;
257
- if (inst !== undefined && inst.buffer !== undefined) {
258
- let promised = undefined;
259
- try {
260
- const existing = inst.children;
261
- const buffer = inst.buffer.sort(compareNodes);
262
- inst.buffer = undefined;
263
- let p1 = undefined;
264
- let p2 = undefined;
265
- let host = inst;
266
- let guests = EMPTY;
267
- let sibling = undefined;
268
- let i = 0, j = 0;
269
- while (i < existing.length || j < buffer.length) {
270
- const old = existing[i];
271
- const x = buffer[j];
272
- const diff = compareNullable(x, old, compareNodes);
273
- if (diff <= 0) {
274
- const h = x.host.instance;
275
- if (h !== inst) {
276
- if (h !== host) {
277
- RxDom.mergeGuests(host, inst, guests);
278
- guests = [];
279
- host = h;
280
- }
281
- guests.push(x);
282
- }
283
- if (sibling !== undefined && x.id === sibling.id)
284
- throw new Error(`duplicate id '${sibling.id}' inside '${node.id}'`);
285
- if (diff === 0) {
286
- if (old.instance) {
287
- x.instance = old.instance;
288
- if (x.inline || !argsAreEqual(x.args, old.args)) {
289
- if (!Transaction.isCanceled) {
290
- if (x.priority === 0)
291
- tryToRender(x);
292
- else if (x.priority === 1)
293
- p1 = push(p1, x);
294
- else
295
- p2 = push(p2, x);
296
- }
297
- }
298
- }
299
- else {
300
- if (!Transaction.isCanceled) {
301
- if (x.priority === 0) {
302
- tryToInitialize(x);
303
- tryToRender(x);
304
- }
305
- else if (x.priority === 1)
306
- p1 = push(p1, x);
307
- else
308
- p2 = push(p2, x);
309
- }
310
- }
311
- i++, j++;
312
- }
313
- else {
314
- if (!Transaction.isCanceled) {
315
- if (x.priority === 0) {
316
- tryToInitialize(x);
317
- tryToRender(x);
318
- }
319
- else if (x.priority === 1)
320
- p1 = push(p1, x);
321
- else
322
- p2 = push(p2, x);
323
- }
324
- j++;
325
- }
326
- sibling = x;
327
- }
328
- else {
329
- if (!Transaction.isCanceled)
330
- tryToFinalize(old, old);
331
- i++;
332
- }
333
- }
334
- if (host !== inst)
335
- RxDom.mergeGuests(host, inst, guests);
336
- if (!Transaction.isCanceled) {
337
- inst.children = buffer;
338
- if (p1 !== undefined || p2 !== undefined)
339
- promised = RxDom.renderIncrementally(node, p1, p2).then(finish, finish);
340
- }
341
- }
342
- finally {
343
- if (!promised)
344
- finish();
345
- }
346
- }
347
- }
348
- static renderIncrementally(parent_1, p1_1, p2_1) {
349
- return __awaiter(this, arguments, void 0, function* (parent, p1, p2, checkEveryN = 30, timeLimit = 12) {
350
- if (Transaction.isFrameOver(checkEveryN, timeLimit))
351
- yield Transaction.requestNextFrame();
352
- if (!Transaction.isCanceled) {
353
- if (p1 !== undefined) {
354
- if (parent.childrenShuffling)
355
- shuffle(p1);
356
- for (const x of p1) {
357
- if (!x.instance)
358
- tryToInitialize(x);
359
- tryToRender(x);
360
- if (Transaction.isCanceled)
361
- break;
362
- if (Transaction.isFrameOver(checkEveryN, timeLimit))
363
- yield Transaction.requestNextFrame();
364
- if (Transaction.isCanceled)
365
- break;
366
- }
367
- }
368
- if (p2 !== undefined) {
369
- if (parent.childrenShuffling)
370
- shuffle(p2);
371
- for (const x of p2) {
372
- if (!x.instance)
373
- tryToInitialize(x);
374
- tryToRender(x);
375
- if (Transaction.isCanceled)
376
- break;
377
- if (Transaction.isFrameOver(checkEveryN, timeLimit))
378
- yield Transaction.requestNextFrame();
379
- if (Transaction.isCanceled)
380
- break;
381
- }
382
- }
383
- }
384
- });
385
- }
386
- static mergeGuests(host, creator, guests) {
387
- if (host !== creator) {
388
- const existing = host.guests;
389
- const merged = [];
390
- let i = 0, j = 0;
391
- while (i < existing.length || j < guests.length) {
392
- const old = existing[i];
393
- const x = guests[j];
394
- const diff = compareNullable(x, old, compareNodes);
395
- if (diff <= 0) {
396
- merged.push(x);
397
- if (diff === 0)
398
- i++, j++;
399
- else
400
- j++;
401
- }
402
- else {
403
- if (old.creator.instance !== creator)
404
- merged.push(old);
405
- i++;
406
- }
407
- }
408
- host.guests = merged;
409
- }
410
- }
411
- static forEachChildRecursively(node, action) {
412
- const inst = node.instance;
413
- if (inst) {
414
- const native = inst.native;
415
- native && action(native);
416
- inst.children.forEach(x => RxDom.forEachChildRecursively(x, action));
417
- }
418
- }
419
- }
420
- RxDom.basic = new BasicNodeType("basic", false);
421
- function tryToRender(node) {
422
- const inst = node.instance;
423
- if (node.inline)
424
- invokeRender(node, node.args);
425
- else
426
- unobs(inst.rerender, node);
427
- }
428
- function tryToInitialize(node) {
429
- var _a, _b;
430
- const type = node.type;
431
- const inst = node.instance = new RxNodeInstanceImpl(node.creator.instance.level + 1);
432
- (_a = type.initialize) === null || _a === void 0 ? void 0 : _a.call(type, node);
433
- (_b = type.mount) === null || _b === void 0 ? void 0 : _b.call(type, node);
434
- if (!node.inline)
435
- ReactiveSystem.setLoggingHint(inst, node.id);
436
- return inst;
437
- }
438
- function tryToFinalize(node, initiator) {
439
- const inst = node.instance;
440
- if (inst && inst.revision >= ~0) {
441
- inst.revision = ~inst.revision;
442
- invokeFinalize(node, initiator);
443
- }
444
- }
445
- function invokeRender(node, args) {
446
- const host = node.native !== undefined ? node : node.host;
447
- runUnder(node, host, () => {
448
- node.instance.revision++;
449
- const type = node.type;
450
- if (type.render)
451
- type.render(node, args);
452
- else
453
- RxDom.basic.render(node, args);
454
- });
455
- }
456
- function invokeFinalize(node, initiator) {
457
- const type = node.type;
458
- if (type.finalize)
459
- type.finalize(node, initiator);
460
- else
461
- RxDom.basic.finalize(node, initiator);
462
- }
463
- function wrap(func) {
464
- const creator = gCreator;
465
- const host = gHost;
466
- const wrappedRendering = (...args) => {
467
- return runUnder(creator, host, func, ...args);
468
- };
469
- return wrappedRendering;
470
- }
471
- function runUnder(creator, host, func, ...args) {
472
- const outerCreator = gCreator;
473
- const outerHost = gHost;
474
- try {
475
- gCreator = creator;
476
- gHost = host;
477
- return func(...args);
478
- }
479
- finally {
480
- gHost = outerHost;
481
- gCreator = outerCreator;
482
- }
483
- }
484
- function compareNodes(node1, node2) {
485
- let result = 0;
486
- const hp1 = node1.host.instance;
487
- const hp2 = node2.host.instance;
488
- if (hp1 !== hp2) {
489
- result = hp1.uuid - hp2.uuid;
490
- if (result === 0)
491
- result = node1.id.localeCompare(node2.id);
492
- }
493
- else
494
- result = node1.id.localeCompare(node2.id);
495
- return result;
496
- }
497
- function compareNullable(a, b, comparer) {
498
- let diff;
499
- if (b !== undefined)
500
- diff = a !== undefined ? comparer(a, b) : 1;
501
- else
502
- diff = a !== undefined ? -1 : 0;
503
- return diff;
504
- }
505
- function argsAreEqual(a1, a2) {
506
- let result = a1 === a2;
507
- if (!result) {
508
- if (Array.isArray(a1)) {
509
- result = Array.isArray(a2) &&
510
- a1.length === a2.length &&
511
- a1.every((t, i) => t === a2[i]);
512
- }
513
- else if (a1 === Object(a1) && a2 === Object(a2)) {
514
- for (const p in a1) {
515
- result = a1[p] === a2[p];
516
- if (!result)
517
- break;
518
- }
519
- }
520
- }
521
- return result;
522
- }
523
- function push(array, item) {
524
- if (array == undefined)
525
- array = new Array();
526
- array.push(item);
527
- return array;
528
- }
529
- function shuffle(array) {
530
- let i = array.length - 1;
531
- while (i >= 0) {
532
- const j = Math.floor(Math.random() * i);
533
- const t = array[i];
534
- array[i] = array[j];
535
- array[j] = t;
536
- i--;
537
- }
538
- return array;
539
- }
540
- const ORIGINAL_PROMISE_THEN = Promise.prototype.then;
541
- function reactronicDomHookedThen(resolve, reject) {
542
- resolve = resolve ? wrap(resolve) : resolveReturn;
543
- reject = reject ? wrap(reject) : rejectRethrow;
544
- return ORIGINAL_PROMISE_THEN.call(this, resolve, reject);
545
- }
546
- export function resolveReturn(value) {
547
- return value;
548
- }
549
- export function rejectRethrow(error) {
550
- throw error;
551
- }
552
- Promise.prototype.then = reactronicDomHookedThen;
553
- const NOP = () => { };
554
- const EMPTY = Object.freeze([]);
555
- const SYSTEM = RxDom.createRootNode("SYSTEM", false, "SYSTEM");
556
- let gCreator = SYSTEM;
557
- let gHost = SYSTEM;