verstak 0.23.121 → 0.23.123
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/build/dist/source/core/Interfaces.d.ts +55 -57
- package/build/dist/source/core/Interfaces.js +10 -10
- package/build/dist/source/core/Utils.d.ts +4 -4
- package/build/dist/source/core/Utils.js +4 -4
- package/build/dist/source/core/Verstak.d.ts +30 -39
- package/build/dist/source/core/Verstak.js +291 -289
- package/build/dist/source/html/Elements.d.ts +27 -0
- package/build/dist/source/html/{Blocks.js → Elements.js} +76 -76
- package/build/dist/source/html/HtmlDriver.d.ts +11 -20
- package/build/dist/source/html/HtmlDriver.js +48 -48
- package/build/dist/source/html/HtmlElements.d.ts +175 -0
- package/build/dist/source/html/HtmlElements.js +356 -0
- package/build/dist/source/html/ReactingFocuser.js +1 -1
- package/build/dist/source/html/api.d.ts +2 -2
- package/build/dist/source/html/api.js +2 -2
- package/build/dist/source/html/sensors/ResizeSensor.d.ts +2 -2
- package/build/dist/source/html/sensors/ResizeSensor.js +3 -3
- package/package.json +8 -8
- package/build/dist/source/html/Blocks.d.ts +0 -27
- package/build/dist/source/html/HtmlBlocks.d.ts +0 -175
- package/build/dist/source/html/HtmlBlocks.js +0 -356
|
@@ -17,70 +17,70 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
import { reactive, unobs, Transaction, options, Reentrance, Rx, MergeList, ObservableObject, raw } from "reactronic";
|
|
20
|
-
import {
|
|
21
|
-
import { emitLetters,
|
|
20
|
+
import { ElKind, Priority, Mode, Align } from "./Interfaces.js";
|
|
21
|
+
import { emitLetters, equalElCoords, parseElCoords, getCallerInfo } from "./Utils.js";
|
|
22
22
|
export class Verstak {
|
|
23
|
-
static
|
|
23
|
+
static specify(driver, spec, base) {
|
|
24
24
|
var _a;
|
|
25
25
|
let result;
|
|
26
|
-
if (
|
|
27
|
-
|
|
26
|
+
if (spec)
|
|
27
|
+
spec.base = base;
|
|
28
28
|
else
|
|
29
|
-
|
|
30
|
-
let key =
|
|
29
|
+
spec = base !== null && base !== void 0 ? base : {};
|
|
30
|
+
let key = spec.key;
|
|
31
31
|
const owner = gCurrent === null || gCurrent === void 0 ? void 0 : gCurrent.instance;
|
|
32
32
|
if (owner) {
|
|
33
33
|
let ex = undefined;
|
|
34
34
|
const children = owner.node.children;
|
|
35
|
-
if (driver.
|
|
36
|
-
const last = children.
|
|
35
|
+
if (driver.isSeparator) {
|
|
36
|
+
const last = children.lastSpecifiedItem();
|
|
37
37
|
if (((_a = last === null || last === void 0 ? void 0 : last.instance) === null || _a === void 0 ? void 0 : _a.node.driver) === driver)
|
|
38
38
|
ex = last;
|
|
39
39
|
}
|
|
40
|
-
ex !== null && ex !== void 0 ? ex : (ex = children.
|
|
40
|
+
ex !== null && ex !== void 0 ? ex : (ex = children.specify(key = key || generateKey(owner), undefined, "nested elements can be declared inside update function only"));
|
|
41
41
|
if (ex) {
|
|
42
42
|
result = ex.instance;
|
|
43
43
|
const node = result.node;
|
|
44
44
|
if (node.driver !== driver && driver !== undefined)
|
|
45
|
-
throw new Error(`changing
|
|
46
|
-
const exTriggers = node.
|
|
47
|
-
if (triggersAreEqual(
|
|
48
|
-
|
|
49
|
-
node.
|
|
45
|
+
throw new Error(`changing element driver is not yet supported: "${result.node.driver.name}" -> "${driver === null || driver === void 0 ? void 0 : driver.name}"`);
|
|
46
|
+
const exTriggers = node.spec.triggers;
|
|
47
|
+
if (triggersAreEqual(spec.triggers, exTriggers))
|
|
48
|
+
spec.triggers = exTriggers;
|
|
49
|
+
node.spec = spec;
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
|
-
result = new
|
|
53
|
-
result.node.
|
|
52
|
+
result = new ElImpl(key || generateKey(owner), driver, owner, spec);
|
|
53
|
+
result.node.slot = children.add(result);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
|
-
result = new
|
|
58
|
-
result.node.
|
|
59
|
-
triggerUpdate(result.node.
|
|
57
|
+
result = new ElImpl(key || "", driver, owner, spec);
|
|
58
|
+
result.node.slot = MergeList.createItem(result);
|
|
59
|
+
triggerUpdate(result.node.slot);
|
|
60
60
|
}
|
|
61
61
|
return result;
|
|
62
62
|
}
|
|
63
|
-
static get
|
|
63
|
+
static get element() {
|
|
64
64
|
if (gCurrent === undefined)
|
|
65
|
-
throw new Error("current
|
|
65
|
+
throw new Error("current element is undefined");
|
|
66
66
|
return gCurrent.instance;
|
|
67
67
|
}
|
|
68
|
-
static triggerUpdate(
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
if (!triggersAreEqual(triggers,
|
|
72
|
-
|
|
73
|
-
triggerUpdate(
|
|
68
|
+
static triggerUpdate(element, triggers) {
|
|
69
|
+
const el = element;
|
|
70
|
+
const spec = el.node.spec;
|
|
71
|
+
if (!triggersAreEqual(triggers, spec.triggers)) {
|
|
72
|
+
spec.triggers = triggers;
|
|
73
|
+
triggerUpdate(el.node.slot);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
static updateNestedTreesThenDo(action) {
|
|
77
77
|
runUpdateNestedTreesThenDo(undefined, action);
|
|
78
78
|
}
|
|
79
79
|
static getDefaultLoggingOptions() {
|
|
80
|
-
return
|
|
80
|
+
return ElImpl.logging;
|
|
81
81
|
}
|
|
82
82
|
static setDefaultLoggingOptions(logging) {
|
|
83
|
-
|
|
83
|
+
ElImpl.logging = logging;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
Verstak.shortFrameDuration = 16;
|
|
@@ -88,49 +88,46 @@ Verstak.longFrameDuration = 300;
|
|
|
88
88
|
Verstak.currentUpdatePriority = Priority.Realtime;
|
|
89
89
|
Verstak.frameDuration = Verstak.longFrameDuration;
|
|
90
90
|
export class BaseDriver {
|
|
91
|
-
constructor(name,
|
|
91
|
+
constructor(name, isSeparator, preset) {
|
|
92
92
|
this.name = name;
|
|
93
|
-
this.
|
|
93
|
+
this.isSeparator = isSeparator;
|
|
94
94
|
this.preset = preset;
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
chainedClaim(b, b.node.builder);
|
|
96
|
+
specify(element) {
|
|
97
|
+
chainedSpecify(element, element.node.spec);
|
|
99
98
|
}
|
|
100
|
-
create(
|
|
101
|
-
chainedCreate(
|
|
99
|
+
create(element) {
|
|
100
|
+
chainedCreate(element, element.node.spec);
|
|
102
101
|
}
|
|
103
|
-
initialize(
|
|
102
|
+
initialize(element) {
|
|
104
103
|
var _a;
|
|
105
|
-
|
|
106
|
-
(
|
|
107
|
-
chainedInitialize(b, b.node.builder);
|
|
104
|
+
(_a = this.preset) === null || _a === void 0 ? void 0 : _a.call(this, element);
|
|
105
|
+
chainedInitialize(element, element.node.spec);
|
|
108
106
|
}
|
|
109
|
-
mount(
|
|
107
|
+
mount(element) {
|
|
110
108
|
}
|
|
111
|
-
update(
|
|
112
|
-
chainedUpdated(
|
|
109
|
+
update(element) {
|
|
110
|
+
chainedUpdated(element, element.node.spec);
|
|
113
111
|
}
|
|
114
|
-
finalize(
|
|
115
|
-
|
|
116
|
-
chainedFinalize(b, b.node.builder);
|
|
112
|
+
finalize(element, isLeader) {
|
|
113
|
+
chainedFinalize(element, element.node.spec);
|
|
117
114
|
return isLeader;
|
|
118
115
|
}
|
|
119
|
-
applyKind(
|
|
120
|
-
applyCoords(
|
|
121
|
-
applyWidthGrowth(
|
|
122
|
-
applyMinWidth(
|
|
123
|
-
applyMaxWidth(
|
|
124
|
-
applyHeightGrowth(
|
|
125
|
-
applyMinHeight(
|
|
126
|
-
applyMaxHeight(
|
|
127
|
-
applyContentAlignment(
|
|
128
|
-
|
|
129
|
-
applyContentWrapping(
|
|
130
|
-
applyOverlayVisible(
|
|
131
|
-
applyStyle(
|
|
132
|
-
}
|
|
133
|
-
BaseDriver.fragment = new BaseDriver("fragment", false,
|
|
116
|
+
applyKind(element, value) { }
|
|
117
|
+
applyCoords(element, value) { }
|
|
118
|
+
applyWidthGrowth(element, value) { }
|
|
119
|
+
applyMinWidth(element, value) { }
|
|
120
|
+
applyMaxWidth(element, value) { }
|
|
121
|
+
applyHeightGrowth(element, value) { }
|
|
122
|
+
applyMinHeight(element, value) { }
|
|
123
|
+
applyMaxHeight(element, value) { }
|
|
124
|
+
applyContentAlignment(element, value) { }
|
|
125
|
+
applyElementAlignment(element, value) { }
|
|
126
|
+
applyContentWrapping(element, value) { }
|
|
127
|
+
applyOverlayVisible(element, value) { }
|
|
128
|
+
applyStyle(element, secondary, styleName, enabled) { }
|
|
129
|
+
}
|
|
130
|
+
BaseDriver.fragment = new BaseDriver("fragment", false, el => el.kind = ElKind.Group);
|
|
134
131
|
function generateKey(owner) {
|
|
135
132
|
const n = owner.node.numerator++;
|
|
136
133
|
const lettered = emitLetters(n);
|
|
@@ -145,64 +142,64 @@ function chainedMode(bb) {
|
|
|
145
142
|
var _a;
|
|
146
143
|
return (_a = bb === null || bb === void 0 ? void 0 : bb.mode) !== null && _a !== void 0 ? _a : ((bb === null || bb === void 0 ? void 0 : bb.base) ? chainedMode(bb === null || bb === void 0 ? void 0 : bb.base) : Mode.Default);
|
|
147
144
|
}
|
|
148
|
-
function
|
|
149
|
-
const
|
|
150
|
-
const base =
|
|
151
|
-
if (
|
|
152
|
-
|
|
145
|
+
function chainedSpecify(element, elb) {
|
|
146
|
+
const specify = elb.specify;
|
|
147
|
+
const base = elb.base;
|
|
148
|
+
if (specify)
|
|
149
|
+
specify(element, base ? () => chainedSpecify(element, base) : NOP);
|
|
153
150
|
else if (base)
|
|
154
|
-
|
|
151
|
+
chainedSpecify(element, base);
|
|
155
152
|
}
|
|
156
|
-
function chainedCreate(
|
|
157
|
-
const create =
|
|
158
|
-
const base =
|
|
153
|
+
function chainedCreate(element, elb) {
|
|
154
|
+
const create = elb.create;
|
|
155
|
+
const base = elb.base;
|
|
159
156
|
if (create)
|
|
160
|
-
create(
|
|
157
|
+
create(element, base ? () => chainedCreate(element, base) : NOP);
|
|
161
158
|
else if (base)
|
|
162
|
-
chainedCreate(
|
|
159
|
+
chainedCreate(element, base);
|
|
163
160
|
}
|
|
164
|
-
function chainedInitialize(
|
|
165
|
-
const initialize =
|
|
166
|
-
const base =
|
|
161
|
+
function chainedInitialize(element, elb) {
|
|
162
|
+
const initialize = elb.initialize;
|
|
163
|
+
const base = elb.base;
|
|
167
164
|
if (initialize)
|
|
168
|
-
initialize(
|
|
165
|
+
initialize(element, base ? () => chainedInitialize(element, base) : NOP);
|
|
169
166
|
else if (base)
|
|
170
|
-
chainedInitialize(
|
|
167
|
+
chainedInitialize(element, base);
|
|
171
168
|
}
|
|
172
|
-
function chainedUpdated(
|
|
173
|
-
const update =
|
|
174
|
-
const base =
|
|
169
|
+
function chainedUpdated(element, elb) {
|
|
170
|
+
const update = elb.update;
|
|
171
|
+
const base = elb.base;
|
|
175
172
|
if (update)
|
|
176
|
-
update(
|
|
173
|
+
update(element, base ? () => chainedUpdated(element, base) : NOP);
|
|
177
174
|
else if (base)
|
|
178
|
-
chainedUpdated(
|
|
175
|
+
chainedUpdated(element, base);
|
|
179
176
|
}
|
|
180
|
-
function chainedFinalize(
|
|
181
|
-
const finalize =
|
|
182
|
-
const base =
|
|
177
|
+
function chainedFinalize(element, elb) {
|
|
178
|
+
const finalize = elb.finalize;
|
|
179
|
+
const base = elb.base;
|
|
183
180
|
if (finalize)
|
|
184
|
-
finalize(
|
|
181
|
+
finalize(element, base ? () => chainedFinalize(element, base) : NOP);
|
|
185
182
|
else if (base)
|
|
186
|
-
chainedFinalize(
|
|
183
|
+
chainedFinalize(element, base);
|
|
187
184
|
}
|
|
188
185
|
export class StaticDriver extends BaseDriver {
|
|
189
|
-
constructor(
|
|
186
|
+
constructor(native, name, isRow, preset) {
|
|
190
187
|
super(name, isRow, preset);
|
|
191
|
-
this.
|
|
188
|
+
this.native = native;
|
|
192
189
|
}
|
|
193
|
-
create(
|
|
194
|
-
|
|
190
|
+
create(element) {
|
|
191
|
+
element.native = this.native;
|
|
195
192
|
}
|
|
196
193
|
}
|
|
197
194
|
export class CursorCommand {
|
|
198
195
|
}
|
|
199
196
|
export class CursorCommandDriver extends BaseDriver {
|
|
200
197
|
constructor() {
|
|
201
|
-
super("cursor", false,
|
|
198
|
+
super("cursor", false, el => el.kind = ElKind.Cursor);
|
|
202
199
|
}
|
|
203
|
-
create(
|
|
204
|
-
|
|
205
|
-
super.create(
|
|
200
|
+
create(element) {
|
|
201
|
+
element.native = new CursorCommand();
|
|
202
|
+
super.create(element);
|
|
206
203
|
}
|
|
207
204
|
}
|
|
208
205
|
export class SubTreeVariable {
|
|
@@ -210,13 +207,13 @@ export class SubTreeVariable {
|
|
|
210
207
|
this.defaultValue = defaultValue;
|
|
211
208
|
}
|
|
212
209
|
set value(value) {
|
|
213
|
-
|
|
210
|
+
ElImpl.setSubTreeVariableValue(this, value);
|
|
214
211
|
}
|
|
215
212
|
get value() {
|
|
216
|
-
return
|
|
213
|
+
return ElImpl.useSubTreeVariableValue(this);
|
|
217
214
|
}
|
|
218
215
|
get valueOrUndefined() {
|
|
219
|
-
return
|
|
216
|
+
return ElImpl.tryUseSubTreeVariable(this);
|
|
220
217
|
}
|
|
221
218
|
}
|
|
222
219
|
class CursorPosition {
|
|
@@ -235,9 +232,9 @@ var CursorFlags;
|
|
|
235
232
|
CursorFlags[CursorFlags["UsesRunningColumnCount"] = 2] = "UsesRunningColumnCount";
|
|
236
233
|
CursorFlags[CursorFlags["UsesRunningRowCount"] = 4] = "UsesRunningRowCount";
|
|
237
234
|
})(CursorFlags || (CursorFlags = {}));
|
|
238
|
-
const
|
|
235
|
+
const UndefinedElCoords = Object.freeze({ x1: 0, y1: 0, x2: 0, y2: 0 });
|
|
239
236
|
const InitialCursorPosition = Object.freeze(new CursorPosition({ x: 1, y: 1, runningMaxX: 0, runningMaxY: 0, flags: CursorFlags.None }));
|
|
240
|
-
class
|
|
237
|
+
class RxNodeCtxImpl extends ObservableObject {
|
|
241
238
|
constructor(variable, value) {
|
|
242
239
|
super();
|
|
243
240
|
this.next = undefined;
|
|
@@ -248,49 +245,75 @@ class BlockCtxImpl extends ObservableObject {
|
|
|
248
245
|
__decorate([
|
|
249
246
|
raw,
|
|
250
247
|
__metadata("design:type", Object)
|
|
251
|
-
],
|
|
248
|
+
], RxNodeCtxImpl.prototype, "next", void 0);
|
|
252
249
|
__decorate([
|
|
253
250
|
raw,
|
|
254
251
|
__metadata("design:type", SubTreeVariable)
|
|
255
|
-
],
|
|
256
|
-
class
|
|
257
|
-
constructor(key, driver,
|
|
258
|
-
this.maxColumnCount = 0;
|
|
259
|
-
this.maxRowCount = 0;
|
|
252
|
+
], RxNodeCtxImpl.prototype, "variable", void 0);
|
|
253
|
+
class RxNodeImpl {
|
|
254
|
+
constructor(key, driver, spec, element, owner) {
|
|
260
255
|
this.key = key;
|
|
261
256
|
this.driver = driver;
|
|
262
|
-
this.
|
|
257
|
+
this.spec = spec;
|
|
263
258
|
if (owner) {
|
|
264
|
-
const node = owner
|
|
259
|
+
const node = owner;
|
|
265
260
|
this.level = node.level + 1;
|
|
266
261
|
this.owner = owner;
|
|
267
262
|
this.outer = node.context ? owner : node.outer;
|
|
268
263
|
}
|
|
269
264
|
else {
|
|
270
265
|
this.level = 1;
|
|
271
|
-
this.owner = owner =
|
|
272
|
-
this.outer =
|
|
266
|
+
this.owner = owner = this;
|
|
267
|
+
this.outer = this;
|
|
273
268
|
}
|
|
274
|
-
this.host =
|
|
275
|
-
this.children = new MergeList(
|
|
276
|
-
this.
|
|
277
|
-
this.stamp =
|
|
269
|
+
this.host = this;
|
|
270
|
+
this.children = new MergeList(getNodeKey, true);
|
|
271
|
+
this.slot = undefined;
|
|
272
|
+
this.stamp = Number.MAX_SAFE_INTEGER;
|
|
278
273
|
this.context = undefined;
|
|
279
274
|
this.numerator = 0;
|
|
275
|
+
this.priority = Priority.Realtime;
|
|
276
|
+
this.childrenShuffling = false;
|
|
277
|
+
RxNodeImpl.grandNodeCount++;
|
|
278
|
+
if (this.has(Mode.PinpointUpdate))
|
|
279
|
+
RxNodeImpl.disposableNodeCount++;
|
|
280
|
+
}
|
|
281
|
+
get isInitialUpdate() { return this.stamp === 1; }
|
|
282
|
+
get strictOrder() { return this.children.isStrict; }
|
|
283
|
+
set strictOrder(value) { this.children.isStrict = value; }
|
|
284
|
+
get isMoved() { return this.owner.children.isMoved(this.slot); }
|
|
285
|
+
has(mode) {
|
|
286
|
+
return (chainedMode(this.spec) & mode) === mode;
|
|
287
|
+
}
|
|
288
|
+
update(_triggers) {
|
|
289
|
+
updateNow(this.slot);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
RxNodeImpl.grandNodeCount = 0;
|
|
293
|
+
RxNodeImpl.disposableNodeCount = 0;
|
|
294
|
+
__decorate([
|
|
295
|
+
reactive,
|
|
296
|
+
options({
|
|
297
|
+
reentrance: Reentrance.CancelPrevious,
|
|
298
|
+
triggeringArgs: true,
|
|
299
|
+
noSideEffects: false,
|
|
300
|
+
}),
|
|
301
|
+
__metadata("design:type", Function),
|
|
302
|
+
__metadata("design:paramtypes", [Object]),
|
|
303
|
+
__metadata("design:returntype", void 0)
|
|
304
|
+
], RxNodeImpl.prototype, "update", null);
|
|
305
|
+
class ElImpl {
|
|
306
|
+
constructor(key, driver, owner, spec) {
|
|
307
|
+
this.node = new RxNodeImpl(key, driver, spec, this, owner === null || owner === void 0 ? void 0 : owner.node);
|
|
280
308
|
this.maxColumnCount = 0;
|
|
281
309
|
this.maxRowCount = 0;
|
|
282
310
|
this.cursorPosition = undefined;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
class BlockImpl {
|
|
286
|
-
constructor(key, driver, owner, builder) {
|
|
287
|
-
this.node = new BlockNodeImpl(key, driver, builder, this, owner);
|
|
288
311
|
this.native = undefined;
|
|
289
312
|
this.model = undefined;
|
|
290
313
|
this.controller = undefined;
|
|
291
|
-
this._kind =
|
|
314
|
+
this._kind = ElKind.Row;
|
|
292
315
|
this._area = undefined;
|
|
293
|
-
this._coords =
|
|
316
|
+
this._coords = UndefinedElCoords;
|
|
294
317
|
this._widthGrowth = 0;
|
|
295
318
|
this._minWidth = "";
|
|
296
319
|
this._maxWidth = "";
|
|
@@ -298,37 +321,21 @@ class BlockImpl {
|
|
|
298
321
|
this._minHeight = "";
|
|
299
322
|
this._maxHeight = "";
|
|
300
323
|
this._contentAlignment = Align.Default;
|
|
301
|
-
this.
|
|
324
|
+
this._elementAlignment = Align.Default;
|
|
302
325
|
this._contentWrapping = true;
|
|
303
326
|
this._overlayVisible = undefined;
|
|
304
327
|
this._hasStyles = false;
|
|
305
|
-
this.updatePriority = Priority.Realtime;
|
|
306
|
-
this.childrenShuffling = false;
|
|
307
|
-
BlockImpl.grandBlockCount++;
|
|
308
|
-
if (this.isOn(Mode.PinpointUpdate))
|
|
309
|
-
BlockImpl.disposableBlockCount++;
|
|
310
|
-
}
|
|
311
|
-
update(_triggers) {
|
|
312
|
-
updateNow(this.node.ties);
|
|
313
328
|
}
|
|
314
329
|
prepareForUpdate() {
|
|
315
330
|
this._area = undefined;
|
|
316
331
|
this._hasStyles = false;
|
|
317
332
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
get isInitialUpdate() { return this.node.stamp === 2; }
|
|
322
|
-
get isAuxiliary() { return this.kind > BlockKind.Note; }
|
|
323
|
-
get isSection() { return this.kind === BlockKind.Section; }
|
|
324
|
-
get isTable() { return this.kind === BlockKind.Table; }
|
|
325
|
-
get isAutoMountEnabled() { return !this.isOn(Mode.ManualMount) && this.node.host !== this; }
|
|
326
|
-
get isMoved() { return this.node.owner.node.children.isMoved(this.node.ties); }
|
|
327
|
-
get strictOrder() { return this.node.children.isStrict; }
|
|
328
|
-
set strictOrder(value) { this.node.children.isStrict = value; }
|
|
333
|
+
get isAuxiliary() { return this.kind > ElKind.Note; }
|
|
334
|
+
get isSection() { return this.kind === ElKind.Section; }
|
|
335
|
+
get isTable() { return this.kind === ElKind.Table; }
|
|
329
336
|
get kind() { return this._kind; }
|
|
330
337
|
set kind(value) {
|
|
331
|
-
if (value !== this._kind || this.node.stamp
|
|
338
|
+
if (value !== this._kind || this.node.stamp >= Number.MAX_SAFE_INTEGER - 1) {
|
|
332
339
|
this.node.driver.applyKind(this, value);
|
|
333
340
|
this._kind = value;
|
|
334
341
|
}
|
|
@@ -338,13 +345,14 @@ class BlockImpl {
|
|
|
338
345
|
var _a, _b;
|
|
339
346
|
const node = this.node;
|
|
340
347
|
const driver = node.driver;
|
|
341
|
-
if (!driver.
|
|
342
|
-
const owner = node.owner
|
|
343
|
-
const
|
|
344
|
-
const
|
|
345
|
-
const
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
+
if (!driver.isSeparator) {
|
|
349
|
+
const owner = node.owner;
|
|
350
|
+
const ownerEl = owner.slot.instance;
|
|
351
|
+
const cursorPosition = (_b = (_a = node.slot.prev) === null || _a === void 0 ? void 0 : _a.instance.cursorPosition) !== null && _b !== void 0 ? _b : InitialCursorPosition;
|
|
352
|
+
const newCursorPosition = this.cursorPosition = owner.children.isStrict ? new CursorPosition(cursorPosition) : undefined;
|
|
353
|
+
const isCursorElement = driver instanceof CursorCommandDriver;
|
|
354
|
+
const coords = getEffectiveElCoords(!isCursorElement, value, ownerEl.maxColumnCount, ownerEl.maxRowCount, cursorPosition, newCursorPosition);
|
|
355
|
+
if (!equalElCoords(coords, this._coords)) {
|
|
348
356
|
driver.applyCoords(this, coords);
|
|
349
357
|
this._coords = coords;
|
|
350
358
|
}
|
|
@@ -402,11 +410,11 @@ class BlockImpl {
|
|
|
402
410
|
this._contentAlignment = value;
|
|
403
411
|
}
|
|
404
412
|
}
|
|
405
|
-
get
|
|
406
|
-
set
|
|
407
|
-
if (value !== this.
|
|
408
|
-
this.node.driver.
|
|
409
|
-
this.
|
|
413
|
+
get elementAlignment() { return this._elementAlignment; }
|
|
414
|
+
set elementAlignment(value) {
|
|
415
|
+
if (value !== this._elementAlignment) {
|
|
416
|
+
this.node.driver.applyElementAlignment(this, value);
|
|
417
|
+
this._elementAlignment = value;
|
|
410
418
|
}
|
|
411
419
|
}
|
|
412
420
|
get contentWrapping() { return this._contentWrapping; }
|
|
@@ -428,39 +436,40 @@ class BlockImpl {
|
|
|
428
436
|
this._hasStyles = true;
|
|
429
437
|
}
|
|
430
438
|
configureReactronic(options) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
439
|
+
const node = this.node;
|
|
440
|
+
if (node.stamp < Number.MAX_SAFE_INTEGER - 1 || !node.has(Mode.PinpointUpdate))
|
|
441
|
+
throw new Error("reactronic can be configured only for elements with pinpoint update mode and only inside initialize");
|
|
442
|
+
return Rx.getReaction(node.update).configure(options);
|
|
434
443
|
}
|
|
435
444
|
static get curr() {
|
|
436
445
|
if (!gCurrent)
|
|
437
|
-
throw new Error("current
|
|
446
|
+
throw new Error("current element is undefined");
|
|
438
447
|
return gCurrent;
|
|
439
448
|
}
|
|
440
449
|
static tryUseSubTreeVariable(variable) {
|
|
441
450
|
var _a, _b;
|
|
442
|
-
let
|
|
443
|
-
while (((_a =
|
|
444
|
-
|
|
445
|
-
return (_b =
|
|
451
|
+
let el = ElImpl.curr.instance;
|
|
452
|
+
while (((_a = el.node.context) === null || _a === void 0 ? void 0 : _a.variable) !== variable && el.node.owner !== el.node)
|
|
453
|
+
el = el.node.outer.slot.instance;
|
|
454
|
+
return (_b = el.node.context) === null || _b === void 0 ? void 0 : _b.value;
|
|
446
455
|
}
|
|
447
456
|
static useSubTreeVariableValue(variable) {
|
|
448
457
|
var _a;
|
|
449
|
-
const result = (_a =
|
|
458
|
+
const result = (_a = ElImpl.tryUseSubTreeVariable(variable)) !== null && _a !== void 0 ? _a : variable.defaultValue;
|
|
450
459
|
if (!result)
|
|
451
460
|
throw new Error("context doesn't exist");
|
|
452
461
|
return result;
|
|
453
462
|
}
|
|
454
463
|
static setSubTreeVariableValue(variable, value) {
|
|
455
|
-
const
|
|
456
|
-
const node =
|
|
464
|
+
const el = ElImpl.curr.instance;
|
|
465
|
+
const node = el.node;
|
|
457
466
|
const owner = node.owner;
|
|
458
|
-
const hostCtx = unobs(() => { var _a; return (_a = owner.
|
|
467
|
+
const hostCtx = unobs(() => { var _a; return (_a = owner.context) === null || _a === void 0 ? void 0 : _a.value; });
|
|
459
468
|
if (value && value !== hostCtx) {
|
|
460
469
|
if (hostCtx)
|
|
461
470
|
node.outer = owner;
|
|
462
471
|
else
|
|
463
|
-
node.outer = owner.
|
|
472
|
+
node.outer = owner.outer;
|
|
464
473
|
Transaction.run({ separation: true }, () => {
|
|
465
474
|
const ctx = node.context;
|
|
466
475
|
if (ctx) {
|
|
@@ -468,49 +477,36 @@ class BlockImpl {
|
|
|
468
477
|
ctx.value = value;
|
|
469
478
|
}
|
|
470
479
|
else
|
|
471
|
-
node.context = new
|
|
480
|
+
node.context = new RxNodeCtxImpl(variable, value);
|
|
472
481
|
});
|
|
473
482
|
}
|
|
474
483
|
else if (hostCtx)
|
|
475
484
|
node.outer = owner;
|
|
476
485
|
else
|
|
477
|
-
node.outer = owner.
|
|
486
|
+
node.outer = owner.outer;
|
|
478
487
|
}
|
|
479
488
|
rowBreak() {
|
|
480
489
|
var _a, _b;
|
|
481
490
|
const node = this.node;
|
|
482
|
-
const cursorPosition = (_b = (_a = node.
|
|
483
|
-
const newCursorPosition = this.
|
|
491
|
+
const cursorPosition = (_b = (_a = node.slot.prev) === null || _a === void 0 ? void 0 : _a.instance.cursorPosition) !== null && _b !== void 0 ? _b : InitialCursorPosition;
|
|
492
|
+
const newCursorPosition = this.cursorPosition = new CursorPosition(cursorPosition);
|
|
484
493
|
newCursorPosition.x = 1;
|
|
485
494
|
newCursorPosition.y = newCursorPosition.runningMaxY + 1;
|
|
486
495
|
}
|
|
487
496
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
__decorate([
|
|
492
|
-
reactive,
|
|
493
|
-
options({
|
|
494
|
-
reentrance: Reentrance.CancelPrevious,
|
|
495
|
-
triggeringArgs: true,
|
|
496
|
-
noSideEffects: false,
|
|
497
|
-
}),
|
|
498
|
-
__metadata("design:type", Function),
|
|
499
|
-
__metadata("design:paramtypes", [Object]),
|
|
500
|
-
__metadata("design:returntype", void 0)
|
|
501
|
-
], BlockImpl.prototype, "update", null);
|
|
502
|
-
function getBlockKey(block) {
|
|
503
|
-
const node = block.node;
|
|
497
|
+
ElImpl.logging = undefined;
|
|
498
|
+
function getNodeKey(element) {
|
|
499
|
+
const node = element.node;
|
|
504
500
|
return node.stamp >= 0 ? node.key : undefined;
|
|
505
501
|
}
|
|
506
|
-
function
|
|
502
|
+
function getEffectiveElCoords(isRegularElement, area, maxX, maxY, cursorPosition, newCursorPosition) {
|
|
507
503
|
var _a, _b;
|
|
508
504
|
let result;
|
|
509
505
|
if (typeof (area) === "string") {
|
|
510
|
-
result =
|
|
511
|
-
|
|
506
|
+
result = parseElCoords(area, { x1: 0, y1: 0, x2: 0, y2: 0 });
|
|
507
|
+
absolutizeElCoords(result, cursorPosition.x, cursorPosition.y, maxX || Infinity, maxY || Infinity, result);
|
|
512
508
|
if (newCursorPosition) {
|
|
513
|
-
newCursorPosition.x =
|
|
509
|
+
newCursorPosition.x = isRegularElement ? result.x2 + 1 : result.x1;
|
|
514
510
|
newCursorPosition.y = result.y1;
|
|
515
511
|
newCursorPosition.flags = CursorFlags.OwnCursorPosition;
|
|
516
512
|
}
|
|
@@ -527,12 +523,12 @@ function getEffectiveBlockCoords(isRegularBlock, area, maxX, maxY, cursorPositio
|
|
|
527
523
|
const runningX = maxX !== 0 ? maxX : cursorPosition.runningMaxX;
|
|
528
524
|
const runningY = maxY !== 0 ? maxY : cursorPosition.runningMaxY;
|
|
529
525
|
result = { x1: 0, y1: 0, x2: 0, y2: 0 };
|
|
530
|
-
if (dx === 0 &&
|
|
526
|
+
if (dx === 0 && isRegularElement) {
|
|
531
527
|
dx = runningX || 1;
|
|
532
528
|
newCursorPosition.flags = CursorFlags.UsesRunningColumnCount;
|
|
533
529
|
}
|
|
534
530
|
if (dx >= 0) {
|
|
535
|
-
if (
|
|
531
|
+
if (isRegularElement) {
|
|
536
532
|
result.x1 = cursorPosition.x;
|
|
537
533
|
result.x2 = absolutizePosition(result.x1 + dx - 1, 0, maxX || Infinity);
|
|
538
534
|
newCursorPosition.x = result.x2 + 1;
|
|
@@ -543,7 +539,7 @@ function getEffectiveBlockCoords(isRegularBlock, area, maxX, maxY, cursorPositio
|
|
|
543
539
|
}
|
|
544
540
|
}
|
|
545
541
|
else {
|
|
546
|
-
if (
|
|
542
|
+
if (isRegularElement) {
|
|
547
543
|
result.x1 = Math.max(cursorPosition.x + dx, 1);
|
|
548
544
|
result.x2 = cursorPosition.x;
|
|
549
545
|
newCursorPosition.x = result.x2 + 1;
|
|
@@ -553,12 +549,12 @@ function getEffectiveBlockCoords(isRegularBlock, area, maxX, maxY, cursorPositio
|
|
|
553
549
|
newCursorPosition.x = result.x2;
|
|
554
550
|
}
|
|
555
551
|
}
|
|
556
|
-
if (dy === 0 &&
|
|
552
|
+
if (dy === 0 && isRegularElement) {
|
|
557
553
|
dy = runningY || 1;
|
|
558
554
|
newCursorPosition.flags |= CursorFlags.UsesRunningRowCount;
|
|
559
555
|
}
|
|
560
556
|
if (dy >= 0) {
|
|
561
|
-
if (
|
|
557
|
+
if (isRegularElement) {
|
|
562
558
|
result.y1 = cursorPosition.y;
|
|
563
559
|
result.y2 = absolutizePosition(result.y1 + dy - 1, 0, maxY || Infinity);
|
|
564
560
|
if (result.y2 > newCursorPosition.runningMaxY)
|
|
@@ -568,7 +564,7 @@ function getEffectiveBlockCoords(isRegularBlock, area, maxX, maxY, cursorPositio
|
|
|
568
564
|
result.y1 = result.y2 = cursorPosition.y + dy;
|
|
569
565
|
}
|
|
570
566
|
else {
|
|
571
|
-
if (
|
|
567
|
+
if (isRegularElement) {
|
|
572
568
|
result.y1 = Math.max(cursorPosition.y + dy, 1);
|
|
573
569
|
result.y2 = cursorPosition.y;
|
|
574
570
|
}
|
|
@@ -582,15 +578,15 @@ function getEffectiveBlockCoords(isRegularBlock, area, maxX, maxY, cursorPositio
|
|
|
582
578
|
}
|
|
583
579
|
function runUpdateNestedTreesThenDo(error, action) {
|
|
584
580
|
var _a;
|
|
585
|
-
const curr =
|
|
581
|
+
const curr = ElImpl.curr;
|
|
586
582
|
const owner = curr.instance;
|
|
587
583
|
const children = owner.node.children;
|
|
588
584
|
if (children.isMergeInProgress) {
|
|
589
585
|
let promised = undefined;
|
|
590
586
|
try {
|
|
591
587
|
children.endMerge(error);
|
|
592
|
-
for (const
|
|
593
|
-
triggerFinalization(
|
|
588
|
+
for (const slot of children.removedItems(true))
|
|
589
|
+
triggerFinalization(slot, true, true);
|
|
594
590
|
if (!error) {
|
|
595
591
|
const ownerIsSection = owner.isSection;
|
|
596
592
|
const sequential = children.isStrict;
|
|
@@ -598,22 +594,22 @@ function runUpdateNestedTreesThenDo(error, action) {
|
|
|
598
594
|
let p2 = undefined;
|
|
599
595
|
let mounting = false;
|
|
600
596
|
let hostingRow = owner;
|
|
601
|
-
for (const
|
|
597
|
+
for (const slot of children.items()) {
|
|
602
598
|
if (Transaction.isCanceled)
|
|
603
599
|
break;
|
|
604
|
-
const
|
|
605
|
-
const
|
|
606
|
-
const host =
|
|
607
|
-
const p = (_a =
|
|
608
|
-
mounting = markToMountIfNecessary(mounting, host,
|
|
600
|
+
const el = slot.instance;
|
|
601
|
+
const isSeparator = el.node.driver.isSeparator;
|
|
602
|
+
const host = isSeparator ? owner : hostingRow;
|
|
603
|
+
const p = (_a = el.node.priority) !== null && _a !== void 0 ? _a : Priority.Realtime;
|
|
604
|
+
mounting = markToMountIfNecessary(mounting, host, slot, children, sequential);
|
|
609
605
|
if (p === Priority.Realtime)
|
|
610
|
-
triggerUpdate(
|
|
606
|
+
triggerUpdate(slot);
|
|
611
607
|
else if (p === Priority.Normal)
|
|
612
|
-
p1 = push(
|
|
608
|
+
p1 = push(slot, p1);
|
|
613
609
|
else
|
|
614
|
-
p2 = push(
|
|
615
|
-
if (ownerIsSection &&
|
|
616
|
-
hostingRow =
|
|
610
|
+
p2 = push(slot, p2);
|
|
611
|
+
if (ownerIsSection && isSeparator)
|
|
612
|
+
hostingRow = el;
|
|
617
613
|
}
|
|
618
614
|
if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
|
|
619
615
|
promised = startIncrementalUpdate(curr, children, p1, p2).then(() => action(error), e => action(e));
|
|
@@ -625,18 +621,18 @@ function runUpdateNestedTreesThenDo(error, action) {
|
|
|
625
621
|
}
|
|
626
622
|
}
|
|
627
623
|
}
|
|
628
|
-
function markToMountIfNecessary(mounting, host,
|
|
629
|
-
const
|
|
630
|
-
const node =
|
|
631
|
-
if (
|
|
632
|
-
if (mounting || node.host !== host) {
|
|
633
|
-
children.markAsMoved(
|
|
624
|
+
function markToMountIfNecessary(mounting, host, slot, children, sequential) {
|
|
625
|
+
const el = slot.instance;
|
|
626
|
+
const node = el.node;
|
|
627
|
+
if (el.native && !node.has(Mode.ManualMount)) {
|
|
628
|
+
if (mounting || node.host !== host.node) {
|
|
629
|
+
children.markAsMoved(slot);
|
|
634
630
|
mounting = false;
|
|
635
631
|
}
|
|
636
632
|
}
|
|
637
|
-
else if (sequential && children.isMoved(
|
|
633
|
+
else if (sequential && children.isMoved(slot))
|
|
638
634
|
mounting = true;
|
|
639
|
-
node.host = host;
|
|
635
|
+
node.host = host.node;
|
|
640
636
|
return mounting;
|
|
641
637
|
}
|
|
642
638
|
function startIncrementalUpdate(owner, allChildren, priority1, priority2) {
|
|
@@ -651,12 +647,12 @@ function startIncrementalUpdate(owner, allChildren, priority1, priority2) {
|
|
|
651
647
|
function updateIncrementally(owner, stamp, allChildren, items, priority) {
|
|
652
648
|
return __awaiter(this, void 0, void 0, function* () {
|
|
653
649
|
yield Transaction.requestNextFrame();
|
|
654
|
-
const
|
|
650
|
+
const el = owner.instance;
|
|
655
651
|
if (!Transaction.isCanceled || !Transaction.isFrameOver(1, Verstak.shortFrameDuration / 3)) {
|
|
656
652
|
let outerPriority = Verstak.currentUpdatePriority;
|
|
657
653
|
Verstak.currentUpdatePriority = priority;
|
|
658
654
|
try {
|
|
659
|
-
if (
|
|
655
|
+
if (el.node.childrenShuffling)
|
|
660
656
|
shuffle(items);
|
|
661
657
|
const frameDurationLimit = priority === Priority.Background ? Verstak.shortFrameDuration : Infinity;
|
|
662
658
|
let frameDuration = Math.min(frameDurationLimit, Math.max(Verstak.frameDuration / 4, Verstak.shortFrameDuration));
|
|
@@ -679,108 +675,114 @@ function updateIncrementally(owner, stamp, allChildren, items, priority) {
|
|
|
679
675
|
}
|
|
680
676
|
});
|
|
681
677
|
}
|
|
682
|
-
function triggerUpdate(
|
|
683
|
-
const
|
|
684
|
-
const node =
|
|
678
|
+
function triggerUpdate(slot) {
|
|
679
|
+
const el = slot.instance;
|
|
680
|
+
const node = el.node;
|
|
685
681
|
if (node.stamp >= 0) {
|
|
686
|
-
if (
|
|
687
|
-
if (node.stamp ===
|
|
682
|
+
if (node.has(Mode.PinpointUpdate)) {
|
|
683
|
+
if (node.stamp === Number.MAX_SAFE_INTEGER) {
|
|
688
684
|
Transaction.outside(() => {
|
|
689
685
|
if (Rx.isLogging)
|
|
690
|
-
Rx.setLoggingHint(
|
|
691
|
-
Rx.getReaction(
|
|
686
|
+
Rx.setLoggingHint(el, node.key);
|
|
687
|
+
Rx.getReaction(node.update).configure({
|
|
692
688
|
order: node.level,
|
|
693
689
|
});
|
|
694
690
|
});
|
|
695
691
|
}
|
|
696
|
-
unobs(
|
|
692
|
+
unobs(node.update, node.spec.triggers);
|
|
697
693
|
}
|
|
698
694
|
else
|
|
699
|
-
updateNow(
|
|
695
|
+
updateNow(slot);
|
|
700
696
|
}
|
|
701
697
|
}
|
|
702
|
-
function
|
|
703
|
-
const node =
|
|
698
|
+
function mountOrRemountIfNecessary(element) {
|
|
699
|
+
const node = element.node;
|
|
704
700
|
const driver = node.driver;
|
|
705
|
-
if (node.stamp ===
|
|
706
|
-
node.stamp = 1;
|
|
701
|
+
if (node.stamp === Number.MAX_SAFE_INTEGER) {
|
|
702
|
+
node.stamp = Number.MAX_SAFE_INTEGER - 1;
|
|
707
703
|
unobs(() => {
|
|
708
|
-
driver.create(
|
|
709
|
-
driver.initialize(
|
|
710
|
-
if (
|
|
711
|
-
|
|
704
|
+
driver.create(element);
|
|
705
|
+
driver.initialize(element);
|
|
706
|
+
if (!node.has(Mode.ManualMount)) {
|
|
707
|
+
node.stamp = 0;
|
|
708
|
+
if (element.node.host !== element.node)
|
|
709
|
+
driver.mount(element);
|
|
710
|
+
}
|
|
711
|
+
node.stamp = 0;
|
|
712
712
|
});
|
|
713
713
|
}
|
|
714
|
-
else if (
|
|
715
|
-
unobs(() => driver.mount(
|
|
714
|
+
else if (node.isMoved && !node.has(Mode.ManualMount) && element.node.host !== element.node)
|
|
715
|
+
unobs(() => driver.mount(element));
|
|
716
716
|
}
|
|
717
|
-
function updateNow(
|
|
718
|
-
const
|
|
719
|
-
const node =
|
|
717
|
+
function updateNow(slot) {
|
|
718
|
+
const el = slot.instance;
|
|
719
|
+
const node = el.node;
|
|
720
720
|
if (node.stamp >= 0) {
|
|
721
721
|
let result = undefined;
|
|
722
|
-
runInside(
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
722
|
+
runInside(slot, () => {
|
|
723
|
+
mountOrRemountIfNecessary(el);
|
|
724
|
+
if (node.stamp < Number.MAX_SAFE_INTEGER - 1) {
|
|
725
|
+
try {
|
|
726
|
+
node.stamp++;
|
|
727
|
+
node.numerator = 0;
|
|
728
|
+
el.prepareForUpdate();
|
|
729
|
+
node.children.beginMerge();
|
|
730
|
+
const driver = node.driver;
|
|
731
|
+
result = driver.update(el);
|
|
732
|
+
if (el.area === undefined && node.owner.slot.instance.isTable)
|
|
733
|
+
el.area = undefined;
|
|
734
|
+
if (result instanceof Promise)
|
|
735
|
+
result.then(v => { runUpdateNestedTreesThenDo(undefined, NOP); return v; }, e => { console.log(e); runUpdateNestedTreesThenDo(e !== null && e !== void 0 ? e : new Error("unknown error"), NOP); });
|
|
736
|
+
else
|
|
737
|
+
runUpdateNestedTreesThenDo(undefined, NOP);
|
|
738
|
+
}
|
|
739
|
+
catch (e) {
|
|
740
|
+
runUpdateNestedTreesThenDo(e, NOP);
|
|
741
|
+
console.log(`Update failed: ${node.key}`);
|
|
742
|
+
console.log(`${e}`);
|
|
743
|
+
}
|
|
742
744
|
}
|
|
743
745
|
});
|
|
744
746
|
}
|
|
745
747
|
}
|
|
746
|
-
function triggerFinalization(
|
|
747
|
-
const
|
|
748
|
-
const node =
|
|
748
|
+
function triggerFinalization(slot, isLeader, individual) {
|
|
749
|
+
const el = slot.instance;
|
|
750
|
+
const node = el.node;
|
|
749
751
|
if (node.stamp >= 0) {
|
|
750
752
|
const driver = node.driver;
|
|
751
|
-
if (individual && node.key !== node.
|
|
752
|
-
console.log(`WARNING: it is recommended to assign explicit key for conditional
|
|
753
|
+
if (individual && node.key !== node.spec.key && !driver.isSeparator)
|
|
754
|
+
console.log(`WARNING: it is recommended to assign explicit key for conditional element in order to avoid unexpected side effects: ${node.key}`);
|
|
753
755
|
node.stamp = ~node.stamp;
|
|
754
|
-
const childrenAreLeaders = unobs(() => driver.finalize(
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
if (
|
|
758
|
-
|
|
756
|
+
const childrenAreLeaders = unobs(() => driver.finalize(el, isLeader));
|
|
757
|
+
el.native = null;
|
|
758
|
+
el.controller = null;
|
|
759
|
+
if (node.has(Mode.PinpointUpdate)) {
|
|
760
|
+
slot.aux = undefined;
|
|
759
761
|
const last = gLastToDispose;
|
|
760
762
|
if (last)
|
|
761
|
-
gLastToDispose = last.aux =
|
|
763
|
+
gLastToDispose = last.aux = slot;
|
|
762
764
|
else
|
|
763
|
-
gFirstToDispose = gLastToDispose =
|
|
764
|
-
if (gFirstToDispose ===
|
|
765
|
-
Transaction.run({ separation: "disposal", hint: `runDisposalLoop(initiator=${
|
|
765
|
+
gFirstToDispose = gLastToDispose = slot;
|
|
766
|
+
if (gFirstToDispose === slot)
|
|
767
|
+
Transaction.run({ separation: "disposal", hint: `runDisposalLoop(initiator=${slot.instance.node.key})` }, () => {
|
|
766
768
|
void runDisposalLoop().then(NOP, error => console.log(error));
|
|
767
769
|
});
|
|
768
770
|
}
|
|
769
|
-
for (const
|
|
770
|
-
triggerFinalization(
|
|
771
|
-
|
|
771
|
+
for (const slot of node.children.items())
|
|
772
|
+
triggerFinalization(slot, childrenAreLeaders, false);
|
|
773
|
+
RxNodeImpl.grandNodeCount--;
|
|
772
774
|
}
|
|
773
775
|
}
|
|
774
776
|
function runDisposalLoop() {
|
|
775
777
|
return __awaiter(this, void 0, void 0, function* () {
|
|
776
778
|
yield Transaction.requestNextFrame();
|
|
777
|
-
let
|
|
778
|
-
while (
|
|
779
|
+
let slot = gFirstToDispose;
|
|
780
|
+
while (slot !== undefined) {
|
|
779
781
|
if (Transaction.isFrameOver(500, 5))
|
|
780
782
|
yield Transaction.requestNextFrame();
|
|
781
|
-
Rx.dispose(
|
|
782
|
-
|
|
783
|
-
|
|
783
|
+
Rx.dispose(slot.instance);
|
|
784
|
+
slot = slot.aux;
|
|
785
|
+
RxNodeImpl.disposableNodeCount--;
|
|
784
786
|
}
|
|
785
787
|
gFirstToDispose = gLastToDispose = undefined;
|
|
786
788
|
});
|
|
@@ -796,10 +798,10 @@ function wrapToRunInside(func) {
|
|
|
796
798
|
wrappedToRunInside = func;
|
|
797
799
|
return wrappedToRunInside;
|
|
798
800
|
}
|
|
799
|
-
function runInside(
|
|
801
|
+
function runInside(slot, func, ...args) {
|
|
800
802
|
const outer = gCurrent;
|
|
801
803
|
try {
|
|
802
|
-
gCurrent =
|
|
804
|
+
gCurrent = slot;
|
|
803
805
|
return func(...args);
|
|
804
806
|
}
|
|
805
807
|
finally {
|
|
@@ -824,7 +826,7 @@ function triggersAreEqual(a1, a2) {
|
|
|
824
826
|
}
|
|
825
827
|
return result;
|
|
826
828
|
}
|
|
827
|
-
function
|
|
829
|
+
function absolutizeElCoords(area, cursorX, cursorY, maxWidth, maxHeight, result) {
|
|
828
830
|
const x1 = absolutizePosition(area.x1, cursorX, maxWidth);
|
|
829
831
|
const x2 = absolutizePosition(area.x2, x1, maxWidth);
|
|
830
832
|
if (x1 <= x2)
|