@motifx/core 1.0.1 → 1.2.0-rc.0
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/dist/chunks/{core-DfzGo_Ti.cjs → core-SS-LXi1V.cjs} +3722 -1338
- package/dist/chunks/core-SS-LXi1V.cjs.map +1 -0
- package/dist/chunks/{core-DxINgP83.esm.js → core-vVL0WG0n.esm.js} +3527 -1173
- package/dist/chunks/core-vVL0WG0n.esm.js.map +1 -0
- package/dist/devtools.cjs +1 -1
- package/dist/devtools.cjs.map +1 -1
- package/dist/devtools.esm.js +1 -1
- package/dist/devtools.esm.js.map +1 -1
- package/dist/index.cjs +87 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -24
- package/dist/index.d.ts +55 -24
- package/dist/index.esm.js +42 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.umd.js +1943 -1172
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/jsx-runtime.cjs.map +1 -1
- package/dist/jsx-runtime.d.cts +17 -3
- package/dist/jsx-runtime.d.ts +17 -3
- package/dist/jsx-runtime.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/core-BDvHkZLQ.esm.js +0 -1601
- package/dist/chunks/core-BDvHkZLQ.esm.js.map +0 -1
- package/dist/chunks/core-DXGu4dNE.cjs +0 -1642
- package/dist/chunks/core-DXGu4dNE.cjs.map +0 -1
- package/dist/chunks/core-DfzGo_Ti.cjs.map +0 -1
- package/dist/chunks/core-DxINgP83.esm.js.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
function isDevLike() {
|
|
189
189
|
return state.enabled || globalThis.__MOTIF_DEV__ === true;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function isRequestedByFlag() {
|
|
192
192
|
try {
|
|
193
193
|
if (typeof window === 'undefined')
|
|
194
194
|
return false;
|
|
@@ -199,25 +199,31 @@
|
|
|
199
199
|
return true;
|
|
200
200
|
if (globalThis.__MOTIF_DEVTOOLS_FLAG === true)
|
|
201
201
|
return true;
|
|
202
|
-
const qs = (w.location && w.location.search) || '';
|
|
203
|
-
if (qs && /(?:[?&])devtools=1(?:&|$)/i.test(qs))
|
|
204
|
-
return true;
|
|
205
202
|
return false;
|
|
206
203
|
}
|
|
207
204
|
catch {
|
|
208
205
|
return false;
|
|
209
206
|
}
|
|
210
207
|
}
|
|
208
|
+
function exposeBus(visible) {
|
|
209
|
+
try {
|
|
210
|
+
if (visible)
|
|
211
|
+
window.__motifDevBus = { on, emit, warn, getWarnings, isEnabled, setRoutes, getRoutes };
|
|
212
|
+
else
|
|
213
|
+
delete window.__motifDevBus;
|
|
214
|
+
}
|
|
215
|
+
catch { }
|
|
216
|
+
}
|
|
211
217
|
function ensureDevtoolsFlagInitialized() {
|
|
212
218
|
if (state.enabled)
|
|
213
219
|
return;
|
|
214
|
-
state.enabled =
|
|
215
|
-
if (state.enabled)
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
220
|
+
state.enabled = isRequestedByFlag();
|
|
221
|
+
if (state.enabled)
|
|
222
|
+
exposeBus(true);
|
|
223
|
+
}
|
|
224
|
+
function setDevtoolsEnabled(enabled) {
|
|
225
|
+
state.enabled = enabled || isRequestedByFlag();
|
|
226
|
+
exposeBus(state.enabled);
|
|
221
227
|
}
|
|
222
228
|
function isEnabled() { return state.enabled; }
|
|
223
229
|
function on(listener) {
|
|
@@ -280,6 +286,17 @@
|
|
|
280
286
|
MJX121: (compiled, runtime) => `This code was compiled for compiler contract ${compiled}, but the @motifx/core runtime implements contract ${runtime}. Install matching versions of @motifx/compiler and @motifx/core, and rebuild packages that ship compiled JSX.`,
|
|
281
287
|
MJX122: (hook) => `The component ${hook} hook threw.`,
|
|
282
288
|
MJX123: (event) => `The '${event}' event handler threw.`,
|
|
289
|
+
MJX124: (key) => `A spread object on a DOM tag cannot set ${key}; the key was ignored. Write it on the tag, or use x-html, for HTML you trust.`,
|
|
290
|
+
MJX125: (key) => `A spread object on a DOM tag cannot set a javascript: URL on '${key}'; the value was ignored. Write the attribute on the tag if it is intended.`,
|
|
291
|
+
MJX126: () => `Lazy: loading the component failed and no Fallbackview is set; the host was cleared.`,
|
|
292
|
+
MJX127: (got) => got === 'module'
|
|
293
|
+
? `The loaded module has no default export. Export the component as default, or map it: () => import('./X').then(m => m.X).`
|
|
294
|
+
: `The loaded value is not a component (got ${got}). Return a component class, a function component, an Options API factory or a component instance.`,
|
|
295
|
+
MJX128: (cls, member, how) => how === 'method'
|
|
296
|
+
? `${cls} overrides ${member} without calling super.${member}; MotifJS relies on this ComponentBase member. Rename your member, or call super.${member} in the override.`
|
|
297
|
+
: how === 'field'
|
|
298
|
+
? `${cls} defines '${member}' as an instance field, which hides the ComponentBase member MotifJS relies on. Rename your field.`
|
|
299
|
+
: `${cls} replaces '${member}', which MotifJS created for the component (a class field or an assignment with that name). Rename your member.`,
|
|
283
300
|
MJX201: () => `ListBinding: renderFn must return a component instance, a component class, or a factory function.`,
|
|
284
301
|
MJX202: (key, index) => `ListBinding: duplicate key "${String(key)}" at index ${index}. Rows are matched by the item object, not by key, so rendering is not affected; keep keys unique so they identify items.`,
|
|
285
302
|
MJX203: (max) => `An effect ran ${max} times in one flush and keeps triggering itself; it is skipped for the rest of this flush. It probably writes a value it reads (for example state.n++). Wrap the write in untracked(...).`,
|
|
@@ -490,20 +507,27 @@
|
|
|
490
507
|
}
|
|
491
508
|
}
|
|
492
509
|
|
|
510
|
+
const Flags = {
|
|
511
|
+
IS_REACTIVE: Symbol.for('motif.isReactive'),
|
|
512
|
+
IS_READONLY: Symbol.for('motif.isReadonly'),
|
|
513
|
+
IS_SUPERFICIAL: Symbol.for('motif.isSuperficial'),
|
|
514
|
+
RAW: Symbol.for('motif.raw'),
|
|
515
|
+
GET_SETUP: Symbol.for('motif.getSetup'),
|
|
516
|
+
};
|
|
493
517
|
const ITERATE_KEY = Symbol('');
|
|
494
518
|
let followTracking = true;
|
|
495
519
|
let arrayScope = { enabled: false, key: '' };
|
|
496
520
|
function getRaw(value) {
|
|
497
521
|
let current = value;
|
|
498
|
-
while (current && current[
|
|
499
|
-
current = current[
|
|
522
|
+
while (current && current[Flags.RAW]) {
|
|
523
|
+
current = current[Flags.RAW];
|
|
500
524
|
}
|
|
501
525
|
return current;
|
|
502
526
|
}
|
|
503
527
|
function isReadonly(candidate) {
|
|
504
528
|
if (candidate == null)
|
|
505
529
|
return false;
|
|
506
|
-
return Boolean(candidate[
|
|
530
|
+
return Boolean(candidate[Flags.IS_READONLY]);
|
|
507
531
|
}
|
|
508
532
|
function hasOwn(target, key) {
|
|
509
533
|
return Object.prototype.hasOwnProperty.call(target, key);
|
|
@@ -691,13 +715,28 @@
|
|
|
691
715
|
}
|
|
692
716
|
_setupBinding() {
|
|
693
717
|
const update = () => {
|
|
694
|
-
const
|
|
718
|
+
const source = this._toArray(this.itemsFn());
|
|
719
|
+
const rawSource = getRaw(source);
|
|
720
|
+
const count = source.length;
|
|
721
|
+
let items;
|
|
722
|
+
if (rawSource === source) {
|
|
723
|
+
items = source;
|
|
724
|
+
}
|
|
725
|
+
else {
|
|
726
|
+
items = new Array(count);
|
|
727
|
+
for (let i = 0; i < count; i++) {
|
|
728
|
+
if (i in rawSource)
|
|
729
|
+
items[i] = source[i];
|
|
730
|
+
else
|
|
731
|
+
void source[i];
|
|
732
|
+
}
|
|
733
|
+
}
|
|
695
734
|
const prevItems = this.olditems;
|
|
696
735
|
const prevComponents = this._rendered;
|
|
697
736
|
if (this.olditems.length > 0) {
|
|
698
737
|
const currentRaws = new Set();
|
|
699
|
-
for (
|
|
700
|
-
currentRaws.add(getRaw(
|
|
738
|
+
for (let i = 0; i < count; i++)
|
|
739
|
+
currentRaws.add(getRaw(items[i]));
|
|
701
740
|
for (const old of this.olditems) {
|
|
702
741
|
const raw = getRaw(old);
|
|
703
742
|
if (!currentRaws.has(raw)) {
|
|
@@ -814,8 +853,8 @@
|
|
|
814
853
|
});
|
|
815
854
|
this._syncContainer(newComponents);
|
|
816
855
|
this._rendered = newComponents;
|
|
817
|
-
this.olditems = items.slice();
|
|
818
|
-
return
|
|
856
|
+
this.olditems = items === source ? source.slice() : items;
|
|
857
|
+
return count;
|
|
819
858
|
};
|
|
820
859
|
this._effectCleanup = effect(() => update());
|
|
821
860
|
}
|
|
@@ -831,6 +870,34 @@
|
|
|
831
870
|
}
|
|
832
871
|
return;
|
|
833
872
|
}
|
|
873
|
+
if (newComponents.length >= items.length) {
|
|
874
|
+
let appendOnly = true;
|
|
875
|
+
for (let i = 0; i < items.length; i++) {
|
|
876
|
+
if (newComponents[i] !== items[i]) {
|
|
877
|
+
appendOnly = false;
|
|
878
|
+
break;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
if (appendOnly && newComponents.length > items.length) {
|
|
882
|
+
const existing = new Set(items);
|
|
883
|
+
for (let i = items.length; i < newComponents.length; i++) {
|
|
884
|
+
if (existing.has(newComponents[i])) {
|
|
885
|
+
appendOnly = false;
|
|
886
|
+
break;
|
|
887
|
+
}
|
|
888
|
+
existing.add(newComponents[i]);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
if (appendOnly) {
|
|
892
|
+
for (let i = items.length; i < newComponents.length; i++) {
|
|
893
|
+
try {
|
|
894
|
+
controls.add(newComponents[i]);
|
|
895
|
+
}
|
|
896
|
+
catch { }
|
|
897
|
+
}
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
834
901
|
const oldIndex = new Map();
|
|
835
902
|
items.forEach((c, i) => oldIndex.set(c, i));
|
|
836
903
|
const sources = newComponents.map(c => {
|
|
@@ -947,10 +1014,11 @@
|
|
|
947
1014
|
}
|
|
948
1015
|
;
|
|
949
1016
|
remove(item) {
|
|
1017
|
+
const index = this.__list.indexOf(item);
|
|
1018
|
+
if (index === -1)
|
|
1019
|
+
return [];
|
|
950
1020
|
this._map.delete(item);
|
|
951
|
-
this.__list.splice(
|
|
952
|
-
item = null;
|
|
953
|
-
return [];
|
|
1021
|
+
return this.__list.splice(index, 1);
|
|
954
1022
|
}
|
|
955
1023
|
;
|
|
956
1024
|
indexOf(item) {
|
|
@@ -977,7 +1045,7 @@
|
|
|
977
1045
|
this.__list?.forEach(callbackfn);
|
|
978
1046
|
}
|
|
979
1047
|
ReverseClone() {
|
|
980
|
-
return this.__list.reverse();
|
|
1048
|
+
return this.__list.slice().reverse();
|
|
981
1049
|
}
|
|
982
1050
|
filter(callbackfn) {
|
|
983
1051
|
return this.__list.filter(callbackfn);
|
|
@@ -1092,8 +1160,7 @@
|
|
|
1092
1160
|
}
|
|
1093
1161
|
OnItemAdded;
|
|
1094
1162
|
removeIndex(index) {
|
|
1095
|
-
|
|
1096
|
-
return i;
|
|
1163
|
+
return this.__values.removeIndex(index);
|
|
1097
1164
|
}
|
|
1098
1165
|
;
|
|
1099
1166
|
remove(Key) {
|
|
@@ -1763,27 +1830,67 @@
|
|
|
1763
1830
|
}
|
|
1764
1831
|
}
|
|
1765
1832
|
|
|
1833
|
+
const RAW_KEY = Flags.RAW;
|
|
1834
|
+
function isPrototypeObject(o) {
|
|
1835
|
+
return Object.prototype.hasOwnProperty.call(o, 'constructor') && typeof o.constructor === 'function' && o.constructor.prototype === o;
|
|
1836
|
+
}
|
|
1837
|
+
function overridesBelow(instance, proto, name) {
|
|
1838
|
+
let p = Object.getPrototypeOf(instance);
|
|
1839
|
+
while (p && p !== proto) {
|
|
1840
|
+
if (Object.prototype.hasOwnProperty.call(p, name))
|
|
1841
|
+
return true;
|
|
1842
|
+
p = Object.getPrototypeOf(p);
|
|
1843
|
+
}
|
|
1844
|
+
return false;
|
|
1845
|
+
}
|
|
1846
|
+
function lazyBindMethods(proto, names) {
|
|
1847
|
+
for (const name of names) {
|
|
1848
|
+
let fn = proto[name];
|
|
1849
|
+
if (typeof fn !== 'function')
|
|
1850
|
+
continue;
|
|
1851
|
+
Object.defineProperty(proto, name, {
|
|
1852
|
+
configurable: true,
|
|
1853
|
+
enumerable: false,
|
|
1854
|
+
get() {
|
|
1855
|
+
if (this === proto || isPrototypeObject(this))
|
|
1856
|
+
return fn;
|
|
1857
|
+
const target = this[RAW_KEY] ?? this;
|
|
1858
|
+
const bound = fn.bind(target);
|
|
1859
|
+
if (!overridesBelow(target, proto, name)) {
|
|
1860
|
+
try {
|
|
1861
|
+
Object.defineProperty(target, name, { value: bound, writable: true, configurable: true, enumerable: true });
|
|
1862
|
+
}
|
|
1863
|
+
catch { }
|
|
1864
|
+
}
|
|
1865
|
+
return bound;
|
|
1866
|
+
},
|
|
1867
|
+
set(value) {
|
|
1868
|
+
if (this === proto && typeof value === 'function') {
|
|
1869
|
+
fn = value;
|
|
1870
|
+
return;
|
|
1871
|
+
}
|
|
1872
|
+
Object.defineProperty(this, name, { value, writable: true, configurable: true, enumerable: true });
|
|
1873
|
+
},
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
function resolveValue(value) {
|
|
1879
|
+
return typeof value === 'function' ? resolveValue(value()) : value;
|
|
1880
|
+
}
|
|
1881
|
+
function isWritablePathKey(target, key) {
|
|
1882
|
+
if (key === '__proto__')
|
|
1883
|
+
return false;
|
|
1884
|
+
if (key === 'constructor' || key === 'prototype')
|
|
1885
|
+
return Object.prototype.hasOwnProperty.call(target, key);
|
|
1886
|
+
return true;
|
|
1887
|
+
}
|
|
1766
1888
|
class BindingCollection {
|
|
1767
1889
|
_items = [];
|
|
1768
1890
|
_component;
|
|
1769
1891
|
_branchScope = null;
|
|
1770
1892
|
constructor(component) {
|
|
1771
1893
|
this._component = component;
|
|
1772
|
-
this.add = this.add.bind(this);
|
|
1773
|
-
this.remove = this.remove.bind(this);
|
|
1774
|
-
this.clear = this.clear.bind(this);
|
|
1775
|
-
this.activateAll = this.activateAll.bind(this);
|
|
1776
|
-
this.deactivateAll = this.deactivateAll.bind(this);
|
|
1777
|
-
this.reActivateAll = this.reActivateAll.bind(this);
|
|
1778
|
-
this.when = this.when.bind(this);
|
|
1779
|
-
this.text = this.text.bind(this);
|
|
1780
|
-
this.value = this.value.bind(this);
|
|
1781
|
-
this.list = this.list.bind(this);
|
|
1782
|
-
this.loop = this.loop.bind(this);
|
|
1783
|
-
this.method = this.method.bind(this);
|
|
1784
|
-
this.watch = this.watch.bind(this);
|
|
1785
|
-
this.display = this.display.bind(this);
|
|
1786
|
-
this.wait = this.wait.bind(this);
|
|
1787
1894
|
}
|
|
1788
1895
|
_own(stop) {
|
|
1789
1896
|
if (this._branchScope) {
|
|
@@ -1854,7 +1961,7 @@
|
|
|
1854
1961
|
return binding;
|
|
1855
1962
|
}
|
|
1856
1963
|
display(predicate) {
|
|
1857
|
-
const binding = new Binding(this._component, 'isWait', () => !predicate());
|
|
1964
|
+
const binding = new Binding(this._component, 'isWait', () => !resolveValue(predicate()));
|
|
1858
1965
|
this._items.push(binding);
|
|
1859
1966
|
if (this._component.isBuilt) {
|
|
1860
1967
|
binding.activate();
|
|
@@ -1980,12 +2087,12 @@
|
|
|
1980
2087
|
stopInner();
|
|
1981
2088
|
});
|
|
1982
2089
|
}
|
|
1983
|
-
ternaryCall
|
|
2090
|
+
ternaryCall(condFn, onTrue, onFalse) {
|
|
1984
2091
|
this._ternarySchedule(condFn, onTrue, onFalse, (run) => queueMicrotask(run));
|
|
1985
|
-
}
|
|
1986
|
-
_ternaryCallTop
|
|
2092
|
+
}
|
|
2093
|
+
_ternaryCallTop(condFn, onTrue, onFalse) {
|
|
1987
2094
|
this._ternarySchedule(condFn, onTrue, onFalse, (run) => setTimeout(run, 0));
|
|
1988
|
-
}
|
|
2095
|
+
}
|
|
1989
2096
|
watch(cb) {
|
|
1990
2097
|
const ef = effect(() => {
|
|
1991
2098
|
cb();
|
|
@@ -2072,11 +2179,17 @@
|
|
|
2072
2179
|
if (member && source != null) {
|
|
2073
2180
|
const path = member.split('.');
|
|
2074
2181
|
let target = source;
|
|
2075
|
-
for (let i = 0; i < path.length
|
|
2076
|
-
|
|
2182
|
+
for (let i = 0; i < path.length && target != null; i++) {
|
|
2183
|
+
const key = path[i];
|
|
2184
|
+
if (!isWritablePathKey(target, key))
|
|
2185
|
+
return;
|
|
2186
|
+
if (i === path.length - 1) {
|
|
2187
|
+
target[key] = value;
|
|
2188
|
+
}
|
|
2189
|
+
else {
|
|
2190
|
+
target = target[key];
|
|
2191
|
+
}
|
|
2077
2192
|
}
|
|
2078
|
-
if (target != null)
|
|
2079
|
-
target[path[path.length - 1]] = value;
|
|
2080
2193
|
}
|
|
2081
2194
|
else if (source != null && typeof source === 'object' && 'value' in source) {
|
|
2082
2195
|
source.value = value;
|
|
@@ -2145,6 +2258,11 @@
|
|
|
2145
2258
|
return null;
|
|
2146
2259
|
}
|
|
2147
2260
|
}
|
|
2261
|
+
lazyBindMethods(BindingCollection.prototype, [
|
|
2262
|
+
'add', 'remove', 'clear', 'activateAll', 'deactivateAll', 'reActivateAll',
|
|
2263
|
+
'when', 'text', 'value', 'list', 'loop', 'method', 'watch', 'display', 'wait',
|
|
2264
|
+
'ternaryCall', '_ternaryCallTop'
|
|
2265
|
+
]);
|
|
2148
2266
|
|
|
2149
2267
|
class Emitter {
|
|
2150
2268
|
_subscriptions = [];
|
|
@@ -2235,18 +2353,14 @@
|
|
|
2235
2353
|
|
|
2236
2354
|
class ComponentEmiter {
|
|
2237
2355
|
component;
|
|
2238
|
-
_emitters
|
|
2239
|
-
_sourceDisposables
|
|
2240
|
-
_listenerDisposables
|
|
2356
|
+
_emitters;
|
|
2357
|
+
_sourceDisposables;
|
|
2358
|
+
_listenerDisposables;
|
|
2241
2359
|
constructor(component) {
|
|
2242
2360
|
this.component = component;
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
this.
|
|
2246
|
-
this.createEvent = this.createEvent.bind(this);
|
|
2247
|
-
this.getOrCreateEmitter = this.getOrCreateEmitter.bind(this);
|
|
2248
|
-
this.addSource = this.addSource.bind(this);
|
|
2249
|
-
this.clear = this.clear.bind(this);
|
|
2361
|
+
}
|
|
2362
|
+
hasListeners(eventName) {
|
|
2363
|
+
return this._emitters !== undefined && this._emitters.has(eventName);
|
|
2250
2364
|
}
|
|
2251
2365
|
fire(eventName, args) {
|
|
2252
2366
|
try {
|
|
@@ -2266,7 +2380,7 @@
|
|
|
2266
2380
|
}
|
|
2267
2381
|
off(event, cb) {
|
|
2268
2382
|
const lower = String(event).toLowerCase();
|
|
2269
|
-
const map = this._listenerDisposables
|
|
2383
|
+
const map = this._listenerDisposables?.get(lower);
|
|
2270
2384
|
if (!map)
|
|
2271
2385
|
return this;
|
|
2272
2386
|
const list = map.get(cb);
|
|
@@ -2278,10 +2392,11 @@
|
|
|
2278
2392
|
return this;
|
|
2279
2393
|
}
|
|
2280
2394
|
getOrCreateEmitter(name) {
|
|
2281
|
-
|
|
2395
|
+
const emitters = this._emitters ??= new Map();
|
|
2396
|
+
let e = emitters.get(name);
|
|
2282
2397
|
if (!e) {
|
|
2283
|
-
|
|
2284
|
-
|
|
2398
|
+
e = new Emitter();
|
|
2399
|
+
emitters.set(name, e);
|
|
2285
2400
|
}
|
|
2286
2401
|
return e;
|
|
2287
2402
|
}
|
|
@@ -2299,10 +2414,11 @@
|
|
|
2299
2414
|
};
|
|
2300
2415
|
const emitter = this.getOrCreateEmitter(lowerFull);
|
|
2301
2416
|
const disp = emitter.event((e) => invoke(e));
|
|
2302
|
-
|
|
2417
|
+
const listeners = this._listenerDisposables ??= new Map();
|
|
2418
|
+
let map = listeners.get(lowerFull);
|
|
2303
2419
|
if (!map) {
|
|
2304
2420
|
map = new Map();
|
|
2305
|
-
|
|
2421
|
+
listeners.set(lowerFull, map);
|
|
2306
2422
|
}
|
|
2307
2423
|
const list = map.get(cb);
|
|
2308
2424
|
if (list) {
|
|
@@ -2328,10 +2444,11 @@
|
|
|
2328
2444
|
}
|
|
2329
2445
|
catch { }
|
|
2330
2446
|
if (disp) {
|
|
2331
|
-
|
|
2447
|
+
const sources = this._sourceDisposables ??= new Map();
|
|
2448
|
+
let set = sources.get(lower);
|
|
2332
2449
|
if (!set) {
|
|
2333
2450
|
set = new Set();
|
|
2334
|
-
|
|
2451
|
+
sources.set(lower, set);
|
|
2335
2452
|
}
|
|
2336
2453
|
set.add(disp);
|
|
2337
2454
|
this.component.motif.register(disposableCore.toDisposable(() => {
|
|
@@ -2350,21 +2467,21 @@
|
|
|
2350
2467
|
clear(event) {
|
|
2351
2468
|
if (event) {
|
|
2352
2469
|
const lower = event.toLowerCase();
|
|
2353
|
-
const srcs = this._sourceDisposables
|
|
2470
|
+
const srcs = this._sourceDisposables?.get(lower);
|
|
2354
2471
|
srcs?.forEach(d => { try {
|
|
2355
2472
|
d.dispose();
|
|
2356
2473
|
}
|
|
2357
2474
|
catch { } });
|
|
2358
|
-
this._sourceDisposables
|
|
2359
|
-
const agg = this._emitters
|
|
2475
|
+
this._sourceDisposables?.delete(lower);
|
|
2476
|
+
const agg = this._emitters?.get(lower);
|
|
2360
2477
|
try {
|
|
2361
2478
|
agg?.dispose();
|
|
2362
2479
|
}
|
|
2363
2480
|
catch { }
|
|
2364
|
-
this._emitters
|
|
2365
|
-
this._listenerDisposables
|
|
2481
|
+
this._emitters?.delete(lower);
|
|
2482
|
+
this._listenerDisposables?.delete(lower);
|
|
2366
2483
|
}
|
|
2367
|
-
else {
|
|
2484
|
+
else if (this._emitters) {
|
|
2368
2485
|
for (const key of Array.from(this._emitters.keys())) {
|
|
2369
2486
|
this.clear(key);
|
|
2370
2487
|
}
|
|
@@ -2372,6 +2489,7 @@
|
|
|
2372
2489
|
return this;
|
|
2373
2490
|
}
|
|
2374
2491
|
}
|
|
2492
|
+
lazyBindMethods(ComponentEmiter.prototype, ['fire', 'on', 'off', 'createEvent', 'getOrCreateEmitter', 'addSource', 'clear']);
|
|
2375
2493
|
|
|
2376
2494
|
const METHOD_ATTRS = new Set([
|
|
2377
2495
|
'focus', 'blur', 'click', 'pause', 'submit', 'reset',
|
|
@@ -2389,11 +2507,13 @@
|
|
|
2389
2507
|
const PROPERTY_FIRST = new Set(['checked', 'selected', 'muted', 'indeterminate', 'srcObject']);
|
|
2390
2508
|
class controlAttribute {
|
|
2391
2509
|
_parent;
|
|
2392
|
-
|
|
2393
|
-
|
|
2510
|
+
_attrMapStore;
|
|
2511
|
+
_watchersStore;
|
|
2394
2512
|
constructor(parent) {
|
|
2395
2513
|
this._parent = parent;
|
|
2396
2514
|
}
|
|
2515
|
+
get _attrMap() { return this._attrMapStore ??= new Map(); }
|
|
2516
|
+
get _watchers() { return this._watchersStore ??= new Map(); }
|
|
2397
2517
|
/** @deprecated Tek kaynak `_attrMap`; geriye dönük okuma için türetilmiş görünüm. */
|
|
2398
2518
|
get attributes() {
|
|
2399
2519
|
return Array.from(this._attrMap.entries(), ([name, value]) => ({ name: String(name), value }));
|
|
@@ -2924,10 +3044,13 @@
|
|
|
2924
3044
|
constructor(parent) {
|
|
2925
3045
|
this._parent = parent;
|
|
2926
3046
|
}
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
3047
|
+
_countsStore;
|
|
3048
|
+
_staticSetStore;
|
|
3049
|
+
_watchersStore;
|
|
2930
3050
|
_watcherSeq = 0;
|
|
3051
|
+
get _counts() { return this._countsStore ??= new Map(); }
|
|
3052
|
+
get _staticSet() { return this._staticSetStore ??= new Set(); }
|
|
3053
|
+
get _watchers() { return this._watchersStore ??= new Map(); }
|
|
2931
3054
|
add(...values) {
|
|
2932
3055
|
for (const value of values) {
|
|
2933
3056
|
if (typeof value === 'function') {
|
|
@@ -4214,6 +4337,92 @@
|
|
|
4214
4337
|
}
|
|
4215
4338
|
}
|
|
4216
4339
|
|
|
4340
|
+
const contentBlocks = { live: 0 };
|
|
4341
|
+
|
|
4342
|
+
const OPTIONS_OWNER = Symbol('motif.optionsOwner');
|
|
4343
|
+
const TRANSITION_SLOT = Symbol('motif.transition');
|
|
4344
|
+
|
|
4345
|
+
const transitionSettings = { mode: 'concurrent' };
|
|
4346
|
+
const noop = () => { };
|
|
4347
|
+
function createTracker() {
|
|
4348
|
+
const running = new WeakMap();
|
|
4349
|
+
function track(node, resolve, via) {
|
|
4350
|
+
const host = node?.parentNode ?? via?.parentNode;
|
|
4351
|
+
if (!host)
|
|
4352
|
+
return { done: resolve, release: noop };
|
|
4353
|
+
let set = running.get(host);
|
|
4354
|
+
if (!set)
|
|
4355
|
+
running.set(host, (set = new Set()));
|
|
4356
|
+
let finish = noop;
|
|
4357
|
+
const entry = { node: node, via: via ?? null, done: new Promise(r => { finish = r; }) };
|
|
4358
|
+
set.add(entry);
|
|
4359
|
+
let settled = false;
|
|
4360
|
+
const release = () => {
|
|
4361
|
+
if (settled)
|
|
4362
|
+
return;
|
|
4363
|
+
settled = true;
|
|
4364
|
+
set.delete(entry);
|
|
4365
|
+
finish();
|
|
4366
|
+
};
|
|
4367
|
+
return {
|
|
4368
|
+
done: () => {
|
|
4369
|
+
const first = !settled;
|
|
4370
|
+
release();
|
|
4371
|
+
if (first && resolve)
|
|
4372
|
+
resolve();
|
|
4373
|
+
},
|
|
4374
|
+
release,
|
|
4375
|
+
finished: entry.done,
|
|
4376
|
+
};
|
|
4377
|
+
}
|
|
4378
|
+
function pending(host, except) {
|
|
4379
|
+
if (!host)
|
|
4380
|
+
return null;
|
|
4381
|
+
const set = running.get(host);
|
|
4382
|
+
if (!set || set.size === 0)
|
|
4383
|
+
return null;
|
|
4384
|
+
let waits = null;
|
|
4385
|
+
for (const entry of set) {
|
|
4386
|
+
if (entry.node === except)
|
|
4387
|
+
continue;
|
|
4388
|
+
if (entry.node.parentNode !== host && entry.via?.parentNode !== host) {
|
|
4389
|
+
set.delete(entry);
|
|
4390
|
+
continue;
|
|
4391
|
+
}
|
|
4392
|
+
(waits ??= []).push(entry.done);
|
|
4393
|
+
}
|
|
4394
|
+
return waits ? Promise.all(waits).then(noop) : null;
|
|
4395
|
+
}
|
|
4396
|
+
return { track, pending };
|
|
4397
|
+
}
|
|
4398
|
+
const leaves = createTracker();
|
|
4399
|
+
const enters = createTracker();
|
|
4400
|
+
const trackLeave = leaves.track;
|
|
4401
|
+
const pendingLeaves = leaves.pending;
|
|
4402
|
+
const trackEnter = enters.track;
|
|
4403
|
+
const pendingEnters = enters.pending;
|
|
4404
|
+
function deferUntilEntered(node, run, play) {
|
|
4405
|
+
const host = node.parentNode;
|
|
4406
|
+
const handle = {
|
|
4407
|
+
finished: run.finished ?? Promise.resolve(),
|
|
4408
|
+
playState: 'pending',
|
|
4409
|
+
addEventListener: noop,
|
|
4410
|
+
removeEventListener: noop,
|
|
4411
|
+
cancel: noop,
|
|
4412
|
+
};
|
|
4413
|
+
queueMicrotask(() => {
|
|
4414
|
+
const wait = pendingEnters(host, node);
|
|
4415
|
+
if (wait)
|
|
4416
|
+
wait.then(() => { play(); });
|
|
4417
|
+
else
|
|
4418
|
+
play();
|
|
4419
|
+
});
|
|
4420
|
+
return handle;
|
|
4421
|
+
}
|
|
4422
|
+
function isTransitionMode(value) {
|
|
4423
|
+
return value === 'concurrent' || value === 'out-in' || value === 'in-out';
|
|
4424
|
+
}
|
|
4425
|
+
|
|
4217
4426
|
/** DI token'ını okunur biçime çevirir (dev uyarıları için). */
|
|
4218
4427
|
function describeServiceToken$1(t) {
|
|
4219
4428
|
if (typeof t === 'string')
|
|
@@ -4224,9 +4433,12 @@
|
|
|
4224
4433
|
return t.name || '[AnonymousClass]';
|
|
4225
4434
|
return String(t);
|
|
4226
4435
|
}
|
|
4436
|
+
function peekTransition(c) {
|
|
4437
|
+
return c?.motif?.options?.[TRANSITION_SLOT];
|
|
4438
|
+
}
|
|
4227
4439
|
/**WAAPI keyframe (transitionIn) YA DA CSS class transition (name/classes) tanımlı olarak enter animasyonu varmı */
|
|
4228
4440
|
function clearNavDirection(c) {
|
|
4229
|
-
const t = c
|
|
4441
|
+
const t = peekTransition(c);
|
|
4230
4442
|
if (!t?._markedDirection)
|
|
4231
4443
|
return;
|
|
4232
4444
|
t._markedDirection = false;
|
|
@@ -4235,9 +4447,292 @@
|
|
|
4235
4447
|
}
|
|
4236
4448
|
catch { }
|
|
4237
4449
|
}
|
|
4450
|
+
function enterModeOf(container) {
|
|
4451
|
+
let c = container;
|
|
4452
|
+
while (c) {
|
|
4453
|
+
const mode = peekTransition(c)?.mode;
|
|
4454
|
+
if (mode)
|
|
4455
|
+
return mode;
|
|
4456
|
+
const node = c.element;
|
|
4457
|
+
if (!node || node.nodeType !== Node.COMMENT_NODE)
|
|
4458
|
+
break;
|
|
4459
|
+
c = c.parent ?? c._base?._leaveContainer;
|
|
4460
|
+
}
|
|
4461
|
+
return transitionSettings.mode;
|
|
4462
|
+
}
|
|
4463
|
+
function leaveModeOf(c) {
|
|
4464
|
+
return enterModeOf(c.parent ?? c._base?._leaveContainer);
|
|
4465
|
+
}
|
|
4238
4466
|
function wantsEnterTransition(c) {
|
|
4239
|
-
const
|
|
4240
|
-
|
|
4467
|
+
const o = c?.motif?.options;
|
|
4468
|
+
const t = o?.[TRANSITION_SLOT];
|
|
4469
|
+
return !!(o?.transitionIn || (t && (t.classes || (t.name && t.name.length > 0))));
|
|
4470
|
+
}
|
|
4471
|
+
function createTransitionApi(owner) {
|
|
4472
|
+
const cur = () => owner.motif.options?.[TRANSITION_SLOT] ?? t;
|
|
4473
|
+
const t = {
|
|
4474
|
+
transitionInfo: () => {
|
|
4475
|
+
const s = cur();
|
|
4476
|
+
return {
|
|
4477
|
+
in: getTransitionInfo(owner.element, `${s.name}-enter ${s.name}-enter-start`),
|
|
4478
|
+
out: getTransitionInfo(owner.element, `${s.name}-leave ${s.name}-leave-start`),
|
|
4479
|
+
};
|
|
4480
|
+
},
|
|
4481
|
+
name: '',
|
|
4482
|
+
mode: undefined,
|
|
4483
|
+
classes: undefined,
|
|
4484
|
+
activeCssCancel: null,
|
|
4485
|
+
activeCssPhase: null,
|
|
4486
|
+
cssProps: () => {
|
|
4487
|
+
const s = cur();
|
|
4488
|
+
if (s.classes) {
|
|
4489
|
+
return { name: s.classes.name || s.name || '', ...s.classes };
|
|
4490
|
+
}
|
|
4491
|
+
if (s.name && s.name.length > 0) {
|
|
4492
|
+
return { name: s.name };
|
|
4493
|
+
}
|
|
4494
|
+
return null;
|
|
4495
|
+
},
|
|
4496
|
+
skipNextLeave: false,
|
|
4497
|
+
_suppressEnter: false,
|
|
4498
|
+
_markedDirection: false,
|
|
4499
|
+
in: (op) => {
|
|
4500
|
+
owner.motif.options.transitionIn = op;
|
|
4501
|
+
},
|
|
4502
|
+
out: (op) => {
|
|
4503
|
+
owner.motif.options.transitionOut = op;
|
|
4504
|
+
},
|
|
4505
|
+
enterTransition: (resolve) => {
|
|
4506
|
+
const s = cur();
|
|
4507
|
+
const base = owner._base;
|
|
4508
|
+
const appear = !base._enterPlayed;
|
|
4509
|
+
base._enterPlayed = true;
|
|
4510
|
+
base._enterSeq = (base._enterSeq ?? 0) + 1;
|
|
4511
|
+
if (s._suppressEnter) {
|
|
4512
|
+
resolve && resolve();
|
|
4513
|
+
return shimAnimation;
|
|
4514
|
+
}
|
|
4515
|
+
const attempt = {};
|
|
4516
|
+
base._enterRun = attempt;
|
|
4517
|
+
const enter = trackEnter(owner.element, () => {
|
|
4518
|
+
if (owner._base?._enterRun === attempt) {
|
|
4519
|
+
owner._base._enterRun = null;
|
|
4520
|
+
clearNavDirection(owner);
|
|
4521
|
+
}
|
|
4522
|
+
resolve && resolve();
|
|
4523
|
+
}, owner.motif.options.placeholder);
|
|
4524
|
+
const transitionIn = owner.motif.options.transitionIn;
|
|
4525
|
+
const animation = transitionIn
|
|
4526
|
+
? s.run(transitionIn.keyframes, transitionIn.options, enter.done)
|
|
4527
|
+
: s._runCss('enter', enter.done, appear);
|
|
4528
|
+
if (animation && animation !== shimAnimation && typeof animation.addEventListener === 'function') {
|
|
4529
|
+
animation.addEventListener('cancel', enter.release);
|
|
4530
|
+
}
|
|
4531
|
+
return animation;
|
|
4532
|
+
},
|
|
4533
|
+
leaveTransition: (resolve) => {
|
|
4534
|
+
const s = cur();
|
|
4535
|
+
const node = owner.element;
|
|
4536
|
+
const leave = trackLeave(node, resolve);
|
|
4537
|
+
const play = () => {
|
|
4538
|
+
const transitionOut = owner.motif.options?.transitionOut;
|
|
4539
|
+
const animation = transitionOut
|
|
4540
|
+
? s.run(transitionOut.keyframes, transitionOut.options, leave.done)
|
|
4541
|
+
: s._runCss('leave', leave.done);
|
|
4542
|
+
if (animation && animation !== shimAnimation && typeof animation.addEventListener === 'function') {
|
|
4543
|
+
animation.addEventListener('cancel', leave.release);
|
|
4544
|
+
}
|
|
4545
|
+
return animation;
|
|
4546
|
+
};
|
|
4547
|
+
if (leave.finished && leaveModeOf(owner) === 'in-out') {
|
|
4548
|
+
return deferUntilEntered(node, leave, play);
|
|
4549
|
+
}
|
|
4550
|
+
return play();
|
|
4551
|
+
},
|
|
4552
|
+
_runCss: (phase, resolve, appear = false) => {
|
|
4553
|
+
const s = cur();
|
|
4554
|
+
if (phase === 'enter' && s.activeCssPhase === 'leave') {
|
|
4555
|
+
resolve && resolve();
|
|
4556
|
+
return shimAnimation;
|
|
4557
|
+
}
|
|
4558
|
+
const cssProps = s.cssProps();
|
|
4559
|
+
const el = owner.element;
|
|
4560
|
+
if (cssProps && el && el.nodeType === 1 && el.classList) {
|
|
4561
|
+
try {
|
|
4562
|
+
s.activeCssCancel?.();
|
|
4563
|
+
}
|
|
4564
|
+
catch { }
|
|
4565
|
+
const cancel = runCssTransition(el, cssProps, phase, () => {
|
|
4566
|
+
s.activeCssCancel = null;
|
|
4567
|
+
s.activeCssPhase = null;
|
|
4568
|
+
resolve && resolve();
|
|
4569
|
+
}, appear);
|
|
4570
|
+
s.activeCssCancel = cancel;
|
|
4571
|
+
s.activeCssPhase = phase;
|
|
4572
|
+
return shimAnimation;
|
|
4573
|
+
}
|
|
4574
|
+
resolve && resolve();
|
|
4575
|
+
return shimAnimation;
|
|
4576
|
+
},
|
|
4577
|
+
activeAnimations: [],
|
|
4578
|
+
run: (keyframes, options, resolve) => {
|
|
4579
|
+
const s = cur();
|
|
4580
|
+
owner.motif.stopAnimations();
|
|
4581
|
+
const element = owner.element;
|
|
4582
|
+
if (element.animate) {
|
|
4583
|
+
var x = element.animate(keyframes, options);
|
|
4584
|
+
s.activeAnimations.push(x);
|
|
4585
|
+
let cleanedUp = false;
|
|
4586
|
+
const safeCleanup = () => {
|
|
4587
|
+
if (cleanedUp)
|
|
4588
|
+
return;
|
|
4589
|
+
cleanedUp = true;
|
|
4590
|
+
try {
|
|
4591
|
+
if (s.activeAnimations) {
|
|
4592
|
+
s.activeAnimations = s.activeAnimations.filter(a => a !== x);
|
|
4593
|
+
}
|
|
4594
|
+
}
|
|
4595
|
+
catch { }
|
|
4596
|
+
};
|
|
4597
|
+
x.addEventListener('finish', () => {
|
|
4598
|
+
resolve && resolve();
|
|
4599
|
+
safeCleanup();
|
|
4600
|
+
});
|
|
4601
|
+
x.oncancel = () => {
|
|
4602
|
+
safeCleanup();
|
|
4603
|
+
};
|
|
4604
|
+
return x;
|
|
4605
|
+
}
|
|
4606
|
+
else {
|
|
4607
|
+
resolve && resolve();
|
|
4608
|
+
const g = globalThis;
|
|
4609
|
+
if (typeof g.Animation === 'function') {
|
|
4610
|
+
try {
|
|
4611
|
+
return new g.Animation();
|
|
4612
|
+
}
|
|
4613
|
+
catch { /* ignore */ }
|
|
4614
|
+
}
|
|
4615
|
+
return shimAnimation;
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4618
|
+
};
|
|
4619
|
+
return t;
|
|
4620
|
+
}
|
|
4621
|
+
class ComponentOptionsImpl {
|
|
4622
|
+
[OPTIONS_OWNER];
|
|
4623
|
+
[TRANSITION_SLOT];
|
|
4624
|
+
constructor(owner) {
|
|
4625
|
+
this[OPTIONS_OWNER] = owner;
|
|
4626
|
+
}
|
|
4627
|
+
get transition() {
|
|
4628
|
+
return this[TRANSITION_SLOT] ??= createTransitionApi(this[OPTIONS_OWNER]);
|
|
4629
|
+
}
|
|
4630
|
+
set transition(value) {
|
|
4631
|
+
this[TRANSITION_SLOT] = value;
|
|
4632
|
+
}
|
|
4633
|
+
set enableRouterClassing(value) {
|
|
4634
|
+
try {
|
|
4635
|
+
const ins = this[OPTIONS_OWNER];
|
|
4636
|
+
const callback = ins.context.onRouterChanged(() => {
|
|
4637
|
+
ComponentHelper.routerClassing.call(ins, value);
|
|
4638
|
+
});
|
|
4639
|
+
ins.motif.register(disposableCore.toDisposable(() => {
|
|
4640
|
+
callback();
|
|
4641
|
+
}));
|
|
4642
|
+
ComponentHelper.routerClassing.call(ins, value);
|
|
4643
|
+
}
|
|
4644
|
+
catch (error) {
|
|
4645
|
+
reportError('MJX105', error);
|
|
4646
|
+
}
|
|
4647
|
+
}
|
|
4648
|
+
getInstance() {
|
|
4649
|
+
return this[OPTIONS_OWNER];
|
|
4650
|
+
}
|
|
4651
|
+
get display() {
|
|
4652
|
+
return this[OPTIONS_OWNER].isVisible;
|
|
4653
|
+
}
|
|
4654
|
+
set display(value) {
|
|
4655
|
+
if (value) {
|
|
4656
|
+
this[OPTIONS_OWNER].motif.show();
|
|
4657
|
+
}
|
|
4658
|
+
else {
|
|
4659
|
+
this[OPTIONS_OWNER].motif.hide();
|
|
4660
|
+
}
|
|
4661
|
+
}
|
|
4662
|
+
hasEvent(name) {
|
|
4663
|
+
return !!this[OPTIONS_OWNER]._eventHandlers?.has(name);
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
lazyBindMethods(ComponentOptionsImpl.prototype, ['getInstance', 'hasEvent']);
|
|
4667
|
+
function fireLifecycle(component, name, ev) {
|
|
4668
|
+
const base = component._base;
|
|
4669
|
+
if (base)
|
|
4670
|
+
base.emiters.fire(name, ev);
|
|
4671
|
+
}
|
|
4672
|
+
function hasLifecycleHook(component, hook, listName, lowerName, legacyProp) {
|
|
4673
|
+
if (component[hook])
|
|
4674
|
+
return true;
|
|
4675
|
+
const list = component._base[listName];
|
|
4676
|
+
if (Array.isArray(list) && list.length > 0)
|
|
4677
|
+
return true;
|
|
4678
|
+
if (legacyProp && component[legacyProp])
|
|
4679
|
+
return true;
|
|
4680
|
+
return component._base.emiters.hasListeners(lowerName);
|
|
4681
|
+
}
|
|
4682
|
+
const RESERVED_METHODS = ['build', 'setState', 'reState', 'setText', 'style', 'dispose', 'disposeAsync', 'using', 'doWork', 'getService', '$', 'useModel', 'context', 'siblings', 'serviceProvider', 'isWait'];
|
|
4683
|
+
const checkedComponentClasses = new WeakSet();
|
|
4684
|
+
function callsSuper(fn, name) {
|
|
4685
|
+
if (typeof fn !== 'function')
|
|
4686
|
+
return false;
|
|
4687
|
+
const escaped = name.replace(/\$/g, '\\$');
|
|
4688
|
+
return new RegExp(`\\bsuper\\s*(\\.\\s*${escaped}(?![\\w$])|\\[)`).test(Function.prototype.toString.call(fn));
|
|
4689
|
+
}
|
|
4690
|
+
function reservedMemberProblems(c) {
|
|
4691
|
+
const problems = [];
|
|
4692
|
+
const own = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
|
4693
|
+
for (const name of RESERVED_METHODS) {
|
|
4694
|
+
if (own(c, name)) {
|
|
4695
|
+
problems.push([name, 'field']);
|
|
4696
|
+
continue;
|
|
4697
|
+
}
|
|
4698
|
+
for (let p = Object.getPrototypeOf(c); p && p !== ComponentBase.prototype; p = Object.getPrototypeOf(p)) {
|
|
4699
|
+
const d = Object.getOwnPropertyDescriptor(p, name);
|
|
4700
|
+
if (!d)
|
|
4701
|
+
continue;
|
|
4702
|
+
const fns = 'value' in d ? [d.value] : [d.get, d.set].filter(Boolean);
|
|
4703
|
+
if (!fns.some(fn => callsSuper(fn, name)))
|
|
4704
|
+
problems.push([name, 'method']);
|
|
4705
|
+
break;
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
const anyC = c;
|
|
4709
|
+
if (!(anyC.motif instanceof ComponentMotif))
|
|
4710
|
+
problems.push(['motif', 'replaced']);
|
|
4711
|
+
if (!(anyC.controls instanceof ControlCollection))
|
|
4712
|
+
problems.push(['controls', 'replaced']);
|
|
4713
|
+
if (!(anyC.class instanceof controlClass))
|
|
4714
|
+
problems.push(['class', 'replaced']);
|
|
4715
|
+
if (!(anyC.attr instanceof controlAttribute))
|
|
4716
|
+
problems.push(['attr', 'replaced']);
|
|
4717
|
+
if (!(anyC.bindings instanceof BindingCollection))
|
|
4718
|
+
problems.push(['bindings', 'replaced']);
|
|
4719
|
+
if (anyC.element != null && typeof Node !== 'undefined' && !(anyC.element instanceof Node))
|
|
4720
|
+
problems.push(['element', 'replaced']);
|
|
4721
|
+
if (anyC.parent != null && !(anyC.parent instanceof ComponentBase))
|
|
4722
|
+
problems.push(['parent', 'replaced']);
|
|
4723
|
+
return problems;
|
|
4724
|
+
}
|
|
4725
|
+
function checkReservedMembers(c) {
|
|
4726
|
+
if (!isDevLike())
|
|
4727
|
+
return;
|
|
4728
|
+
const ctor = c?.constructor;
|
|
4729
|
+
if (typeof ctor !== 'function' || checkedComponentClasses.has(ctor))
|
|
4730
|
+
return;
|
|
4731
|
+
checkedComponentClasses.add(ctor);
|
|
4732
|
+
const name = ctor.name || 'An anonymous component class';
|
|
4733
|
+
for (const [member, how] of reservedMemberProblems(c)) {
|
|
4734
|
+
reportWarning('MJX128', [name, member, how]);
|
|
4735
|
+
}
|
|
4241
4736
|
}
|
|
4242
4737
|
const ComponentHelper = {
|
|
4243
4738
|
callInitializeComponent(component) {
|
|
@@ -4267,25 +4762,26 @@
|
|
|
4267
4762
|
}
|
|
4268
4763
|
}
|
|
4269
4764
|
},
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
if (component.ondisposing) {
|
|
4285
|
-
callReported(() => component.ondisposing(sender, ev), 'MJX122', 'ondisposing');
|
|
4765
|
+
callDisposing(component) {
|
|
4766
|
+
if (!component || component.isDisposed) {
|
|
4767
|
+
return;
|
|
4768
|
+
}
|
|
4769
|
+
if (!hasLifecycleHook(component, 'onDisposing', '_onDisposingHandlers', 'ondisposing', 'ondisposing')) {
|
|
4770
|
+
return;
|
|
4771
|
+
}
|
|
4772
|
+
const sender = component, ev = { cancel: false };
|
|
4773
|
+
if (component.onDisposing) {
|
|
4774
|
+
callReported(() => component.onDisposing(sender, ev), 'MJX122', 'onDisposing');
|
|
4775
|
+
}
|
|
4776
|
+
if (Array.isArray(component._base._onDisposingHandlers)) {
|
|
4777
|
+
for (const fn of component._base._onDisposingHandlers) {
|
|
4778
|
+
callReported(() => fn(sender, ev), 'MJX122', 'onDisposing');
|
|
4286
4779
|
}
|
|
4287
|
-
|
|
4288
|
-
|
|
4780
|
+
}
|
|
4781
|
+
if (component.ondisposing) {
|
|
4782
|
+
callReported(() => component.ondisposing(sender, ev), 'MJX122', 'ondisposing');
|
|
4783
|
+
}
|
|
4784
|
+
fireLifecycle(component, 'ondisposing', ev);
|
|
4289
4785
|
},
|
|
4290
4786
|
callActivated(component) {
|
|
4291
4787
|
if (!component || component.isDisposed) {
|
|
@@ -4300,7 +4796,7 @@
|
|
|
4300
4796
|
callReported(() => fn(sender, ev), 'MJX122', 'onActivated');
|
|
4301
4797
|
}
|
|
4302
4798
|
}
|
|
4303
|
-
component
|
|
4799
|
+
fireLifecycle(component, 'onactivated', ev);
|
|
4304
4800
|
},
|
|
4305
4801
|
callDeactivated(component) {
|
|
4306
4802
|
if (!component || component.isDisposed) {
|
|
@@ -4315,7 +4811,7 @@
|
|
|
4315
4811
|
callReported(() => fn(sender, ev), 'MJX122', 'onDeactivated');
|
|
4316
4812
|
}
|
|
4317
4813
|
}
|
|
4318
|
-
component
|
|
4814
|
+
fireLifecycle(component, 'ondeactivated', ev);
|
|
4319
4815
|
},
|
|
4320
4816
|
deactivateTree(component, deep = true) {
|
|
4321
4817
|
if (!component || component.isDisposed || !component.isBuilt || !component._base || component._base._inactive) {
|
|
@@ -4323,7 +4819,7 @@
|
|
|
4323
4819
|
}
|
|
4324
4820
|
component._base._inactive = true;
|
|
4325
4821
|
ComponentHelper.callDeactivated(component);
|
|
4326
|
-
if (!deep) {
|
|
4822
|
+
if (!deep || component.isDisposed) {
|
|
4327
4823
|
return;
|
|
4328
4824
|
}
|
|
4329
4825
|
for (const c of component.controls.items.slice()) {
|
|
@@ -4338,7 +4834,7 @@
|
|
|
4338
4834
|
}
|
|
4339
4835
|
component._base._inactive = false;
|
|
4340
4836
|
ComponentHelper.callActivated(component);
|
|
4341
|
-
if (!deep) {
|
|
4837
|
+
if (!deep || component.isDisposed) {
|
|
4342
4838
|
return;
|
|
4343
4839
|
}
|
|
4344
4840
|
for (const c of component.controls.items.slice()) {
|
|
@@ -4347,34 +4843,36 @@
|
|
|
4347
4843
|
}
|
|
4348
4844
|
}
|
|
4349
4845
|
},
|
|
4350
|
-
|
|
4846
|
+
callDisposed(component) {
|
|
4351
4847
|
if (!component || !component._base || component._base._disposedFired) {
|
|
4352
4848
|
return;
|
|
4353
4849
|
}
|
|
4354
4850
|
component._base._disposedFired = true;
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
if (Array.isArray(component._base._onDisposedHandlers)) {
|
|
4360
|
-
for (const fn of component._base._onDisposedHandlers) {
|
|
4361
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onDisposed');
|
|
4851
|
+
if (hasLifecycleHook(component, 'onDisposed', '_onDisposedHandlers', 'ondisposed', 'ondisposed')) {
|
|
4852
|
+
const sender = component, ev = { cancel: false };
|
|
4853
|
+
if (component.onDisposed) {
|
|
4854
|
+
callReported(() => component.onDisposed(sender, ev), 'MJX122', 'onDisposed');
|
|
4362
4855
|
}
|
|
4856
|
+
if (Array.isArray(component._base._onDisposedHandlers)) {
|
|
4857
|
+
for (const fn of component._base._onDisposedHandlers) {
|
|
4858
|
+
callReported(() => fn(sender, ev), 'MJX122', 'onDisposed');
|
|
4859
|
+
}
|
|
4860
|
+
}
|
|
4861
|
+
if (component.ondisposed) {
|
|
4862
|
+
callReported(() => component.ondisposed(sender, ev), 'MJX122', 'ondisposed');
|
|
4863
|
+
}
|
|
4864
|
+
fireLifecycle(component, 'ondisposed', ev);
|
|
4363
4865
|
}
|
|
4364
|
-
if (component.ondisposed) {
|
|
4365
|
-
callReported(() => component.ondisposed(sender, ev), 'MJX122', 'ondisposed');
|
|
4366
|
-
}
|
|
4367
|
-
component._base.emiters.fire('ondisposed', ev);
|
|
4368
4866
|
try {
|
|
4369
4867
|
globalThis.__MOTIF_DEVTOOLS_BUS__?.publish?.('component:disposed', { id: component.id, type: component.constructor?.name });
|
|
4370
4868
|
}
|
|
4371
4869
|
catch { }
|
|
4372
4870
|
},
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4871
|
+
callBuilt(component) {
|
|
4872
|
+
if (!component || component.isDisposed) {
|
|
4873
|
+
return;
|
|
4874
|
+
}
|
|
4875
|
+
if (hasLifecycleHook(component, 'onBuilt', '_onBuiltHandlers', 'onbuilt', 'onbuilt')) {
|
|
4378
4876
|
const sender = component, ev = { cancel: false };
|
|
4379
4877
|
if (component.onBuilt) {
|
|
4380
4878
|
callReported(() => component.onBuilt(sender, ev), 'MJX122', 'onBuilt');
|
|
@@ -4387,12 +4885,12 @@
|
|
|
4387
4885
|
if (component.onbuilt) {
|
|
4388
4886
|
callReported(() => component.onbuilt(sender, ev), 'MJX122', 'onbuilt');
|
|
4389
4887
|
}
|
|
4390
|
-
component
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
}
|
|
4394
|
-
|
|
4395
|
-
}
|
|
4888
|
+
fireLifecycle(component, 'onbuilt', ev);
|
|
4889
|
+
}
|
|
4890
|
+
try {
|
|
4891
|
+
globalThis.__MOTIF_DEVTOOLS_BUS__?.publish?.('component:mounted', { id: component.id, type: component.constructor?.name });
|
|
4892
|
+
}
|
|
4893
|
+
catch { }
|
|
4396
4894
|
},
|
|
4397
4895
|
scheduleMounted(component) {
|
|
4398
4896
|
if (!component || component.isDisposed || component._base._mountedScheduled) {
|
|
@@ -4436,47 +4934,49 @@
|
|
|
4436
4934
|
if (component.onmounted) {
|
|
4437
4935
|
callReported(() => component.onmounted(sender, ev), 'MJX122', 'onmounted');
|
|
4438
4936
|
}
|
|
4439
|
-
component
|
|
4937
|
+
fireLifecycle(component, 'onmounted', ev);
|
|
4440
4938
|
},
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4939
|
+
callBuilding(component) {
|
|
4940
|
+
if (!component || component.isDisposed) {
|
|
4941
|
+
return;
|
|
4942
|
+
}
|
|
4943
|
+
if (!hasLifecycleHook(component, 'onBuilding', '_onBuildingHandlers', 'onbuilding')) {
|
|
4944
|
+
return;
|
|
4945
|
+
}
|
|
4946
|
+
const sender = component, ev = { cancel: false };
|
|
4947
|
+
if (component.onBuilding) {
|
|
4948
|
+
callReported(() => component.onBuilding(sender, ev), 'MJX122', 'onBuilding');
|
|
4949
|
+
}
|
|
4950
|
+
if (Array.isArray(component._base._onBuildingHandlers)) {
|
|
4951
|
+
for (const fn of component._base._onBuildingHandlers) {
|
|
4952
|
+
callReported(() => fn(sender, ev), 'MJX122', 'onBuilding');
|
|
4454
4953
|
}
|
|
4455
|
-
|
|
4456
|
-
|
|
4954
|
+
}
|
|
4955
|
+
fireLifecycle(component, 'onbuilding', ev);
|
|
4457
4956
|
},
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4957
|
+
callConfig(component) {
|
|
4958
|
+
if (!component || component.isDisposed || component.isConfigured) {
|
|
4959
|
+
return;
|
|
4960
|
+
}
|
|
4961
|
+
component.isConfigured = true;
|
|
4962
|
+
if (component.motif.options._preconfig) {
|
|
4963
|
+
safeCallSilent(() => component.motif.options._preconfig(component), 'Component._preconfig');
|
|
4964
|
+
}
|
|
4965
|
+
if (!hasLifecycleHook(component, 'onConfig', '_onConfigHandlers', 'onconfig')) {
|
|
4966
|
+
return;
|
|
4967
|
+
}
|
|
4968
|
+
const sender = component, ev = { cancel: false };
|
|
4969
|
+
if (component.onConfig) {
|
|
4970
|
+
callReported(() => component.onConfig(sender, ev), 'MJX122', 'onConfig');
|
|
4971
|
+
}
|
|
4972
|
+
if (Array.isArray(component._base._onConfigHandlers)) {
|
|
4973
|
+
for (const fn of component._base._onConfigHandlers) {
|
|
4974
|
+
callReported(() => fn(sender, ev), 'MJX122', 'onConfig');
|
|
4475
4975
|
}
|
|
4476
|
-
|
|
4477
|
-
|
|
4976
|
+
}
|
|
4977
|
+
fireLifecycle(component, 'onconfig', ev);
|
|
4478
4978
|
},
|
|
4479
|
-
|
|
4979
|
+
callConfigured(component) {
|
|
4480
4980
|
if (component.motif.options && component.motif.options._postconfigdone) {
|
|
4481
4981
|
return;
|
|
4482
4982
|
}
|
|
@@ -4484,73 +4984,77 @@
|
|
|
4484
4984
|
ComponentHelper.callConfig(component);
|
|
4485
4985
|
}
|
|
4486
4986
|
component.motif.options._postconfigdone = true;
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4987
|
+
if (!component || component.isDisposed) {
|
|
4988
|
+
return;
|
|
4989
|
+
}
|
|
4990
|
+
if (!hasLifecycleHook(component, 'onConfigured', '_onConfiguredHandlers', 'onconfigured')) {
|
|
4991
|
+
return;
|
|
4992
|
+
}
|
|
4993
|
+
const sender = component, ev = { cancel: false };
|
|
4994
|
+
if (component.onConfigured) {
|
|
4995
|
+
callReported(() => component.onConfigured(sender, ev), 'MJX122', 'onConfigured');
|
|
4996
|
+
}
|
|
4997
|
+
if (Array.isArray(component._base._onConfiguredHandlers)) {
|
|
4998
|
+
for (const fn of component._base._onConfiguredHandlers) {
|
|
4999
|
+
callReported(() => fn(sender, ev), 'MJX122', 'onConfigured');
|
|
4499
5000
|
}
|
|
4500
|
-
|
|
4501
|
-
|
|
5001
|
+
}
|
|
5002
|
+
fireLifecycle(component, 'onconfigured', ev);
|
|
4502
5003
|
},
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
5004
|
+
callOnInitialized(component) {
|
|
5005
|
+
if (!component || component.isDisposed) {
|
|
5006
|
+
return;
|
|
5007
|
+
}
|
|
5008
|
+
component.isInitialized = true;
|
|
5009
|
+
if (!hasLifecycleHook(component, 'onInitialized', '_onInitializedHandlers', 'oninitialized')) {
|
|
5010
|
+
return;
|
|
5011
|
+
}
|
|
5012
|
+
const sender = component, ev = { cancel: false };
|
|
5013
|
+
if (component.onInitialized) {
|
|
5014
|
+
callReported(() => component.onInitialized(sender, ev), 'MJX122', 'onInitialized');
|
|
5015
|
+
}
|
|
5016
|
+
if (Array.isArray(component._base._onInitializedHandlers)) {
|
|
5017
|
+
for (const fn of component._base._onInitializedHandlers) {
|
|
5018
|
+
callReported(() => fn(sender, ev), 'MJX122', 'onInitialized');
|
|
4517
5019
|
}
|
|
4518
|
-
|
|
4519
|
-
|
|
5020
|
+
}
|
|
5021
|
+
fireLifecycle(component, 'oninitialized', ev);
|
|
4520
5022
|
},
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
5023
|
+
callOnInitializing(component) {
|
|
5024
|
+
if (!component || component.isDisposed) {
|
|
5025
|
+
return;
|
|
5026
|
+
}
|
|
5027
|
+
if (!hasLifecycleHook(component, 'onInitializing', '_onInitializingHandlers', 'oninitializing')) {
|
|
5028
|
+
return;
|
|
5029
|
+
}
|
|
5030
|
+
const sender = component, ev = { cancel: false };
|
|
5031
|
+
if (component.onInitializing) {
|
|
5032
|
+
callReported(() => component.onInitializing(sender, ev), 'MJX122', 'onInitializing');
|
|
5033
|
+
}
|
|
5034
|
+
if (Array.isArray(component._base._onInitializingHandlers)) {
|
|
5035
|
+
for (const fn of component._base._onInitializingHandlers) {
|
|
5036
|
+
callReported(() => fn(sender, ev), 'MJX122', 'onInitializing');
|
|
4534
5037
|
}
|
|
4535
|
-
|
|
4536
|
-
|
|
5038
|
+
}
|
|
5039
|
+
fireLifecycle(component, 'oninitializing', ev);
|
|
4537
5040
|
},
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
5041
|
+
callVisibilityChanged(component) {
|
|
5042
|
+
if (!component || component.isDisposed) {
|
|
5043
|
+
return;
|
|
5044
|
+
}
|
|
5045
|
+
if (!hasLifecycleHook(component, 'onVisibilityChanged', '_onVisibilityChangedHandlers', 'onvisibilitychanged')) {
|
|
5046
|
+
return;
|
|
5047
|
+
}
|
|
5048
|
+
const sender = component, ev = { cancel: false };
|
|
5049
|
+
if (component.onVisibilityChanged) {
|
|
5050
|
+
callReported(() => component.onVisibilityChanged(sender, ev), 'MJX122', 'onVisibilityChanged');
|
|
5051
|
+
}
|
|
5052
|
+
if (Array.isArray(component._base._onVisibilityChangedHandlers)) {
|
|
5053
|
+
for (const fn of component._base._onVisibilityChangedHandlers) {
|
|
5054
|
+
callReported(() => fn(sender, ev), 'MJX122', 'onVisibilityChanged');
|
|
4551
5055
|
}
|
|
4552
|
-
|
|
4553
|
-
|
|
5056
|
+
}
|
|
5057
|
+
fireLifecycle(component, 'onvisibilitychanged', ev);
|
|
4554
5058
|
},
|
|
4555
5059
|
findFragmentContent(c) {
|
|
4556
5060
|
const controlElement = c.element.nodeType == Node.COMMENT_NODE
|
|
@@ -4576,6 +5080,8 @@
|
|
|
4576
5080
|
return;
|
|
4577
5081
|
}
|
|
4578
5082
|
ComponentHelper.callConfigured(c);
|
|
5083
|
+
if (c.isDisposed)
|
|
5084
|
+
return;
|
|
4579
5085
|
c._base._activatePreBindings();
|
|
4580
5086
|
if (c.isWait)
|
|
4581
5087
|
return;
|
|
@@ -4603,8 +5109,11 @@
|
|
|
4603
5109
|
return;
|
|
4604
5110
|
}
|
|
4605
5111
|
}
|
|
5112
|
+
if (c.isDisposed || this.isDisposed)
|
|
5113
|
+
return;
|
|
4606
5114
|
c.parent = this;
|
|
4607
|
-
const
|
|
5115
|
+
const ownItems = this.controls.items;
|
|
5116
|
+
const currentIndex = ownItems.length > 0 && ownItems[ownItems.length - 1] === c ? ownItems.length - 1 : ownItems.indexOf(c);
|
|
4608
5117
|
const appendableElement = findAppendableComponent(this);
|
|
4609
5118
|
var controlElement = c.element.nodeType == Node.COMMENT_NODE
|
|
4610
5119
|
? c.motif.options.cache
|
|
@@ -4655,6 +5164,18 @@
|
|
|
4655
5164
|
return;
|
|
4656
5165
|
}
|
|
4657
5166
|
}
|
|
5167
|
+
if (insertHost && enterModeOf(this) === 'out-in') {
|
|
5168
|
+
const wait = pendingLeaves(insertHost, controlElement);
|
|
5169
|
+
if (wait) {
|
|
5170
|
+
c._base._enterSeq = (c._base._enterSeq ?? 0) + 1;
|
|
5171
|
+
wait.then(() => {
|
|
5172
|
+
if (this.isDisposed || c.isDisposed || c.parent !== this)
|
|
5173
|
+
return;
|
|
5174
|
+
ComponentHelper.internalBuild.call(this, c);
|
|
5175
|
+
});
|
|
5176
|
+
return;
|
|
5177
|
+
}
|
|
5178
|
+
}
|
|
4658
5179
|
const parentNode = appendableElement?.element;
|
|
4659
5180
|
if (controlElement && parentNode && (controlElement === parentNode || controlElement.contains(parentNode))) {
|
|
4660
5181
|
reportWarning('MJX104', []);
|
|
@@ -4736,717 +5257,648 @@
|
|
|
4736
5257
|
}
|
|
4737
5258
|
}
|
|
4738
5259
|
};
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
return new Proxy(app, {
|
|
4753
|
-
get(target, prop) {
|
|
4754
|
-
if (prop === RAW_APPLICATION) {
|
|
4755
|
-
return target;
|
|
4756
|
-
}
|
|
4757
|
-
const value = Reflect.get(target, prop, target);
|
|
4758
|
-
if (typeof value !== 'function') {
|
|
4759
|
-
return value;
|
|
4760
|
-
}
|
|
4761
|
-
const hit = cache.get(prop);
|
|
4762
|
-
if (hit && hit.fn === value) {
|
|
4763
|
-
return hit.bound;
|
|
4764
|
-
}
|
|
4765
|
-
const bound = SCOPED_SUBSCRIBERS.has(prop)
|
|
4766
|
-
? (...args) => owner._trackContextSubscription(value.apply(target, args))
|
|
4767
|
-
: value.bind(target);
|
|
4768
|
-
cache.set(prop, { fn: value, bound });
|
|
4769
|
-
return bound;
|
|
4770
|
-
},
|
|
4771
|
-
set(target, prop, value) {
|
|
4772
|
-
return Reflect.set(target, prop, value, target);
|
|
4773
|
-
},
|
|
4774
|
-
});
|
|
4775
|
-
}
|
|
4776
|
-
class ComponentBase extends Disposable {
|
|
4777
|
-
motif = new ComponentMotif(this, {
|
|
4778
|
-
transition: {
|
|
4779
|
-
transitionInfo: () => {
|
|
4780
|
-
return {
|
|
4781
|
-
in: getTransitionInfo(this.element, `${this.motif.options.transition.name}-enter ${this.motif.options.transition.name}-enter-start`),
|
|
4782
|
-
out: getTransitionInfo(this.element, `${this.motif.options.transition.name}-leave ${this.motif.options.transition.name}-leave-start`),
|
|
4783
|
-
};
|
|
4784
|
-
},
|
|
4785
|
-
name: '',
|
|
4786
|
-
classes: undefined,
|
|
4787
|
-
activeCssCancel: null,
|
|
4788
|
-
activeCssPhase: null,
|
|
4789
|
-
cssProps: () => {
|
|
4790
|
-
const t = this.motif.options.transition;
|
|
4791
|
-
if (t.classes) {
|
|
4792
|
-
return { name: t.classes.name || t.name || '', ...t.classes };
|
|
4793
|
-
}
|
|
4794
|
-
if (t.name && t.name.length > 0) {
|
|
4795
|
-
return { name: t.name };
|
|
4796
|
-
}
|
|
4797
|
-
return null;
|
|
4798
|
-
},
|
|
4799
|
-
skipNextLeave: false,
|
|
4800
|
-
_suppressEnter: false,
|
|
4801
|
-
_markedDirection: false,
|
|
4802
|
-
in: (op) => {
|
|
4803
|
-
this.motif.options.transitionIn = op;
|
|
4804
|
-
},
|
|
4805
|
-
out: (op) => {
|
|
4806
|
-
this.motif.options.transitionOut = op;
|
|
4807
|
-
},
|
|
4808
|
-
enterTransition: (resolve) => {
|
|
4809
|
-
const t = this.motif.options.transition;
|
|
4810
|
-
const appear = !this._base._enterPlayed;
|
|
4811
|
-
this._base._enterPlayed = true;
|
|
4812
|
-
this._base._enterSeq = (this._base._enterSeq ?? 0) + 1;
|
|
4813
|
-
if (t._suppressEnter) {
|
|
4814
|
-
resolve && resolve();
|
|
4815
|
-
return shimAnimation;
|
|
4816
|
-
}
|
|
4817
|
-
const attempt = {};
|
|
4818
|
-
this._base._enterRun = attempt;
|
|
4819
|
-
const done = () => {
|
|
4820
|
-
if (this._base?._enterRun === attempt) {
|
|
4821
|
-
this._base._enterRun = null;
|
|
4822
|
-
clearNavDirection(this);
|
|
4823
|
-
}
|
|
4824
|
-
resolve && resolve();
|
|
4825
|
-
};
|
|
4826
|
-
if (this.motif.options.transitionIn) {
|
|
4827
|
-
return t.run(this.motif.options.transitionIn.keyframes, this.motif.options.transitionIn.options, done);
|
|
4828
|
-
}
|
|
4829
|
-
return t._runCss('enter', done, appear);
|
|
4830
|
-
},
|
|
4831
|
-
leaveTransition: (resolve) => {
|
|
4832
|
-
if (this.motif.options.transitionOut) {
|
|
4833
|
-
return this.motif.options.transition.run(this.motif.options.transitionOut.keyframes, this.motif.options.transitionOut.options, resolve);
|
|
4834
|
-
}
|
|
4835
|
-
return this.motif.options.transition._runCss('leave', resolve);
|
|
4836
|
-
},
|
|
4837
|
-
_runCss: (phase, resolve, appear = false) => {
|
|
4838
|
-
const t = this.motif.options.transition;
|
|
4839
|
-
if (phase === 'enter' && t.activeCssPhase === 'leave') {
|
|
4840
|
-
resolve && resolve();
|
|
4841
|
-
return shimAnimation;
|
|
4842
|
-
}
|
|
4843
|
-
const cssProps = t.cssProps();
|
|
4844
|
-
const el = this.element;
|
|
4845
|
-
if (cssProps && el && el.nodeType === 1 && el.classList) {
|
|
4846
|
-
try {
|
|
4847
|
-
t.activeCssCancel?.();
|
|
4848
|
-
}
|
|
4849
|
-
catch { }
|
|
4850
|
-
const cancel = runCssTransition(el, cssProps, phase, () => {
|
|
4851
|
-
if (this.motif.options?.transition) {
|
|
4852
|
-
this.motif.options.transition.activeCssCancel = null;
|
|
4853
|
-
this.motif.options.transition.activeCssPhase = null;
|
|
4854
|
-
}
|
|
4855
|
-
resolve && resolve();
|
|
4856
|
-
}, appear);
|
|
4857
|
-
t.activeCssCancel = cancel;
|
|
4858
|
-
t.activeCssPhase = phase;
|
|
4859
|
-
return shimAnimation;
|
|
4860
|
-
}
|
|
4861
|
-
resolve && resolve();
|
|
4862
|
-
return shimAnimation;
|
|
4863
|
-
},
|
|
4864
|
-
activeAnimations: [],
|
|
4865
|
-
run: (keyframes, options, resolve) => {
|
|
4866
|
-
this.motif.stopAnimations();
|
|
4867
|
-
const element = this.element;
|
|
4868
|
-
if (element.animate) {
|
|
4869
|
-
var x = element.animate(keyframes, options);
|
|
4870
|
-
this.motif.options.transition.activeAnimations.push(x);
|
|
4871
|
-
let cleanedUp = false;
|
|
4872
|
-
const safeCleanup = () => {
|
|
4873
|
-
if (cleanedUp)
|
|
4874
|
-
return;
|
|
4875
|
-
cleanedUp = true;
|
|
4876
|
-
try {
|
|
4877
|
-
if (this?.motif.options?.transition?.activeAnimations) {
|
|
4878
|
-
this.motif.options.transition.activeAnimations = this.motif.options.transition.activeAnimations.filter(a => a !== x);
|
|
4879
|
-
}
|
|
4880
|
-
}
|
|
4881
|
-
catch { }
|
|
4882
|
-
};
|
|
4883
|
-
x.addEventListener('finish', () => {
|
|
4884
|
-
resolve && resolve();
|
|
4885
|
-
safeCleanup();
|
|
4886
|
-
});
|
|
4887
|
-
x.oncancel = () => {
|
|
4888
|
-
safeCleanup();
|
|
4889
|
-
};
|
|
4890
|
-
return x;
|
|
4891
|
-
}
|
|
4892
|
-
else {
|
|
4893
|
-
resolve && resolve();
|
|
4894
|
-
const g = globalThis;
|
|
4895
|
-
if (typeof g.Animation === 'function') {
|
|
4896
|
-
try {
|
|
4897
|
-
return new g.Animation();
|
|
4898
|
-
}
|
|
4899
|
-
catch { /* ignore */ }
|
|
4900
|
-
}
|
|
4901
|
-
return shimAnimation;
|
|
5260
|
+
function removeComponentDom(c, node, alsoPlaceholder) {
|
|
5261
|
+
const opts = c.motif?.options;
|
|
5262
|
+
const parent = node.parentNode;
|
|
5263
|
+
if (node.nodeType === Node.COMMENT_NODE) {
|
|
5264
|
+
if (!parent)
|
|
5265
|
+
return;
|
|
5266
|
+
const close = opts?.closeFragment || null;
|
|
5267
|
+
if (close) {
|
|
5268
|
+
let current = node;
|
|
5269
|
+
while (current) {
|
|
5270
|
+
const after = current.nextSibling;
|
|
5271
|
+
try {
|
|
5272
|
+
parent.removeChild(current);
|
|
4902
5273
|
}
|
|
5274
|
+
catch { }
|
|
5275
|
+
if (current === close)
|
|
5276
|
+
break;
|
|
5277
|
+
current = after;
|
|
4903
5278
|
}
|
|
4904
|
-
}
|
|
4905
|
-
|
|
5279
|
+
}
|
|
5280
|
+
else {
|
|
4906
5281
|
try {
|
|
4907
|
-
|
|
4908
|
-
const callback = ins.context.onRouterChanged(() => {
|
|
4909
|
-
ComponentHelper.routerClassing.call(ins, value);
|
|
4910
|
-
});
|
|
4911
|
-
ins.motif.register(disposableCore.toDisposable(() => {
|
|
4912
|
-
callback();
|
|
4913
|
-
}));
|
|
4914
|
-
ComponentHelper.routerClassing.call(ins, value);
|
|
4915
|
-
}
|
|
4916
|
-
catch (error) {
|
|
4917
|
-
reportError('MJX105', error);
|
|
4918
|
-
}
|
|
4919
|
-
},
|
|
4920
|
-
getInstance: () => {
|
|
4921
|
-
return this;
|
|
4922
|
-
},
|
|
4923
|
-
get display() {
|
|
4924
|
-
return this.getInstance().isVisible;
|
|
4925
|
-
},
|
|
4926
|
-
set display(value) {
|
|
4927
|
-
if (value) {
|
|
4928
|
-
this.getInstance().motif.show();
|
|
4929
|
-
}
|
|
4930
|
-
else {
|
|
4931
|
-
this.getInstance().motif.hide();
|
|
5282
|
+
parent.removeChild(node);
|
|
4932
5283
|
}
|
|
4933
|
-
|
|
4934
|
-
hasEvent: (name) => {
|
|
4935
|
-
const ins = this._eventHandlers?.has(name);
|
|
4936
|
-
if (ins)
|
|
4937
|
-
return true;
|
|
4938
|
-
return false;
|
|
5284
|
+
catch { }
|
|
4939
5285
|
}
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
props;
|
|
4943
|
-
isBuilt = false;
|
|
4944
|
-
isInitialized = false;
|
|
4945
|
-
isDisposed = false;
|
|
4946
|
-
isConfigured = false;
|
|
4947
|
-
isPainting = false;
|
|
4948
|
-
isPainted = false;
|
|
4949
|
-
isVisible = true;
|
|
4950
|
-
controls = new ControlCollection(this);
|
|
4951
|
-
_eventHandlers;
|
|
4952
|
-
_isWait = false;
|
|
4953
|
-
class = new controlClass(this);
|
|
4954
|
-
attr = new controlAttribute(this);
|
|
4955
|
-
bindings = new BindingCollection(this);
|
|
4956
|
-
/** style(fn) izleyicisi: tek tek tutulur, yeniden çağrıda önceki durdurulur. */
|
|
4957
|
-
_styleFx;
|
|
4958
|
-
useModel(modelCtor) {
|
|
4959
|
-
return reactive(modelCtor);
|
|
5286
|
+
if (!alsoPlaceholder)
|
|
5287
|
+
return;
|
|
4960
5288
|
}
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
return 'placeholder';
|
|
4965
|
-
if (cfg === 'detach')
|
|
4966
|
-
return 'detach';
|
|
4967
|
-
if (this.motif.options?.__fromList || typeof this.motif.options?.indexkey !== 'undefined' || typeof this.motif.options?.__key !== 'undefined') {
|
|
4968
|
-
return 'detach';
|
|
5289
|
+
else if (parent) {
|
|
5290
|
+
try {
|
|
5291
|
+
parent.removeChild(node);
|
|
4969
5292
|
}
|
|
4970
|
-
|
|
5293
|
+
catch { }
|
|
5294
|
+
if (!alsoPlaceholder)
|
|
5295
|
+
return;
|
|
4971
5296
|
}
|
|
4972
|
-
|
|
5297
|
+
const placeholder = opts?.placeholder;
|
|
5298
|
+
if (placeholder && placeholder.parentNode) {
|
|
4973
5299
|
try {
|
|
4974
|
-
|
|
4975
|
-
return false;
|
|
4976
|
-
const node = this.element;
|
|
4977
|
-
if (node.nodeType === Node.COMMENT_NODE) {
|
|
4978
|
-
return !!node.parentNode;
|
|
4979
|
-
}
|
|
4980
|
-
return !!node.parentNode;
|
|
4981
|
-
}
|
|
4982
|
-
catch {
|
|
4983
|
-
return false;
|
|
5300
|
+
placeholder.parentNode.removeChild(placeholder);
|
|
4984
5301
|
}
|
|
5302
|
+
catch { }
|
|
4985
5303
|
}
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
5304
|
+
}
|
|
5305
|
+
function detachDomWithAnimation(c) {
|
|
5306
|
+
const node = c.element;
|
|
5307
|
+
if (!node || c._keepElementOnDispose === true)
|
|
5308
|
+
return;
|
|
5309
|
+
const opts = c.motif.options;
|
|
5310
|
+
const t = opts?.[TRANSITION_SLOT];
|
|
5311
|
+
try {
|
|
5312
|
+
const skip = t?.skipNextLeave === true || c._forceInstantDetach === true;
|
|
5313
|
+
if (skip) {
|
|
5314
|
+
if (t)
|
|
5315
|
+
t.skipNextLeave = false;
|
|
5316
|
+
c._forceInstantDetach = false;
|
|
5317
|
+
removeComponentDom(c, node, true);
|
|
4995
5318
|
return;
|
|
4996
5319
|
}
|
|
4997
|
-
if (value === false && this.parent && this.parent.isBuilt) {
|
|
4998
|
-
ComponentHelper.internalBuild.call(this.parent, this);
|
|
4999
|
-
}
|
|
5000
5320
|
}
|
|
5001
|
-
|
|
5002
|
-
|
|
5321
|
+
catch { }
|
|
5322
|
+
if (!t && !opts?.transitionOut) {
|
|
5323
|
+
removeComponentDom(c, node, false);
|
|
5324
|
+
return;
|
|
5003
5325
|
}
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5326
|
+
try {
|
|
5327
|
+
opts.transition.leaveTransition(() => {
|
|
5328
|
+
removeComponentDom(c, node, false);
|
|
5329
|
+
});
|
|
5330
|
+
}
|
|
5331
|
+
catch {
|
|
5332
|
+
removeComponentDom(c, node, false);
|
|
5333
|
+
}
|
|
5334
|
+
}
|
|
5335
|
+
async function detachDomWithAnimationAsync(c) {
|
|
5336
|
+
const node = c.element;
|
|
5337
|
+
if (!node || c._keepElementOnDispose === true)
|
|
5338
|
+
return;
|
|
5339
|
+
const opts = c.motif.options;
|
|
5340
|
+
const t = opts?.[TRANSITION_SLOT];
|
|
5341
|
+
try {
|
|
5342
|
+
const skip = t?.skipNextLeave === true || c._forceInstantDetach === true;
|
|
5343
|
+
if (skip) {
|
|
5344
|
+
if (t)
|
|
5345
|
+
t.skipNextLeave = false;
|
|
5346
|
+
c._forceInstantDetach = false;
|
|
5347
|
+
removeComponentDom(c, node, true);
|
|
5348
|
+
return;
|
|
5009
5349
|
}
|
|
5010
|
-
|
|
5011
|
-
|
|
5350
|
+
}
|
|
5351
|
+
catch { }
|
|
5352
|
+
if (!t && !opts?.transitionOut) {
|
|
5353
|
+
removeComponentDom(c, node, false);
|
|
5354
|
+
return;
|
|
5355
|
+
}
|
|
5356
|
+
return new Promise((resolve) => {
|
|
5357
|
+
try {
|
|
5358
|
+
opts.transition.leaveTransition(() => {
|
|
5359
|
+
removeComponentDom(c, node, false);
|
|
5360
|
+
resolve();
|
|
5361
|
+
});
|
|
5012
5362
|
}
|
|
5013
|
-
|
|
5014
|
-
|
|
5363
|
+
catch {
|
|
5364
|
+
removeComponentDom(c, node, false);
|
|
5365
|
+
resolve();
|
|
5015
5366
|
}
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5367
|
+
});
|
|
5368
|
+
}
|
|
5369
|
+
function disposeShallow(c) {
|
|
5370
|
+
if (c.isDisposed)
|
|
5371
|
+
return;
|
|
5372
|
+
ComponentHelper.callDisposing.call(c, c);
|
|
5373
|
+
try {
|
|
5374
|
+
c._base._offAll();
|
|
5375
|
+
}
|
|
5376
|
+
catch {
|
|
5377
|
+
}
|
|
5378
|
+
c.motif.stopAnimations();
|
|
5379
|
+
c._base._deactivateBindings();
|
|
5380
|
+
if (c.controls?.items?.length) {
|
|
5381
|
+
for (const child of c.controls.items) {
|
|
5382
|
+
try {
|
|
5383
|
+
child._base._disposeShallow();
|
|
5384
|
+
}
|
|
5385
|
+
catch {
|
|
5019
5386
|
}
|
|
5020
5387
|
}
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5388
|
+
}
|
|
5389
|
+
ComponentHelper.callDisposed.call(c, c);
|
|
5390
|
+
safeCall(() => { c._base.emiters.clear(); }, 'disposeShallow.emiters');
|
|
5391
|
+
c.isDisposed = true;
|
|
5392
|
+
Disposable.prototype.dispose.call(c);
|
|
5393
|
+
}
|
|
5394
|
+
function deepCleanup(c) {
|
|
5395
|
+
try {
|
|
5396
|
+
c.parent = null;
|
|
5397
|
+
}
|
|
5398
|
+
catch { }
|
|
5399
|
+
try {
|
|
5400
|
+
c._eventHandlers?.clear();
|
|
5401
|
+
}
|
|
5402
|
+
catch {
|
|
5403
|
+
}
|
|
5404
|
+
c._eventHandlers = undefined;
|
|
5405
|
+
try {
|
|
5406
|
+
c.class?._countsStore?.clear();
|
|
5407
|
+
}
|
|
5408
|
+
catch { }
|
|
5409
|
+
try {
|
|
5410
|
+
c.class?._watchersStore?.clear();
|
|
5411
|
+
}
|
|
5412
|
+
catch { }
|
|
5413
|
+
try {
|
|
5414
|
+
c.attr?._attrMapStore?.clear();
|
|
5415
|
+
}
|
|
5416
|
+
catch { }
|
|
5417
|
+
try {
|
|
5418
|
+
c.attr?._watchersStore?.clear();
|
|
5419
|
+
}
|
|
5420
|
+
catch { }
|
|
5421
|
+
try {
|
|
5422
|
+
if (c.motif.options) {
|
|
5423
|
+
c.motif.options.cache = undefined;
|
|
5424
|
+
c.motif.options.closeFragment = undefined;
|
|
5425
|
+
c.motif.options.placeholder = undefined;
|
|
5032
5426
|
}
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5427
|
+
}
|
|
5428
|
+
catch {
|
|
5429
|
+
}
|
|
5430
|
+
try {
|
|
5431
|
+
c.element = null;
|
|
5432
|
+
}
|
|
5433
|
+
catch { }
|
|
5434
|
+
try {
|
|
5435
|
+
c.props = undefined;
|
|
5436
|
+
}
|
|
5437
|
+
catch { }
|
|
5438
|
+
try {
|
|
5439
|
+
c.childs = undefined;
|
|
5440
|
+
}
|
|
5441
|
+
catch { }
|
|
5442
|
+
try {
|
|
5443
|
+
c.class = undefined;
|
|
5444
|
+
}
|
|
5445
|
+
catch { }
|
|
5446
|
+
try {
|
|
5447
|
+
c.attr = undefined;
|
|
5448
|
+
}
|
|
5449
|
+
catch { }
|
|
5450
|
+
try {
|
|
5451
|
+
c.parent = null;
|
|
5452
|
+
}
|
|
5453
|
+
catch { }
|
|
5454
|
+
try {
|
|
5455
|
+
c.motif.options = undefined;
|
|
5456
|
+
}
|
|
5457
|
+
catch { }
|
|
5458
|
+
const keys = Object.keys(c);
|
|
5459
|
+
for (let i = 0; i < keys.length; i++) {
|
|
5460
|
+
const key = keys[i];
|
|
5461
|
+
if (key === 'motif')
|
|
5462
|
+
continue;
|
|
5463
|
+
try {
|
|
5464
|
+
c[key] = undefined;
|
|
5051
5465
|
}
|
|
5052
|
-
|
|
5053
|
-
|
|
5466
|
+
catch { }
|
|
5467
|
+
}
|
|
5468
|
+
c.isDisposed = true;
|
|
5469
|
+
}
|
|
5470
|
+
const DISPOSE_STARTED = Promise.resolve();
|
|
5471
|
+
function subtreeDisposesSync(c, root) {
|
|
5472
|
+
if (!root && c._disposing && !c.isDisposed)
|
|
5473
|
+
return false;
|
|
5474
|
+
if (c.disposeAsync !== ComponentBase.prototype.disposeAsync)
|
|
5475
|
+
return false;
|
|
5476
|
+
const opts = c.motif?.options;
|
|
5477
|
+
if (opts) {
|
|
5478
|
+
if (opts.transitionOut)
|
|
5479
|
+
return false;
|
|
5480
|
+
const t = opts[TRANSITION_SLOT];
|
|
5481
|
+
if (t) {
|
|
5482
|
+
if (t.activeAnimations && t.activeAnimations.length > 0)
|
|
5483
|
+
return false;
|
|
5484
|
+
if (t.activeCssCancel)
|
|
5485
|
+
return false;
|
|
5486
|
+
if (t.classes || (t.name && t.name.length > 0))
|
|
5487
|
+
return false;
|
|
5054
5488
|
}
|
|
5055
5489
|
}
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
if (!
|
|
5061
|
-
return;
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
parent.removeChild(current);
|
|
5137
|
-
}
|
|
5138
|
-
catch { }
|
|
5139
|
-
if (current === close)
|
|
5140
|
-
break;
|
|
5141
|
-
current = after;
|
|
5142
|
-
}
|
|
5143
|
-
}
|
|
5144
|
-
else {
|
|
5145
|
-
try {
|
|
5146
|
-
parent.removeChild(open);
|
|
5147
|
-
}
|
|
5148
|
-
catch { }
|
|
5149
|
-
}
|
|
5150
|
-
}
|
|
5151
|
-
else if (parent) {
|
|
5152
|
-
try {
|
|
5153
|
-
parent.removeChild(node);
|
|
5154
|
-
}
|
|
5155
|
-
catch { }
|
|
5156
|
-
}
|
|
5157
|
-
const placeholder = this.motif.options?.placeholder;
|
|
5158
|
-
if (placeholder && placeholder.parentNode) {
|
|
5159
|
-
try {
|
|
5160
|
-
placeholder.parentNode.removeChild(placeholder);
|
|
5161
|
-
}
|
|
5162
|
-
catch { }
|
|
5163
|
-
}
|
|
5164
|
-
};
|
|
5165
|
-
immediate();
|
|
5166
|
-
return;
|
|
5167
|
-
}
|
|
5168
|
-
}
|
|
5169
|
-
catch { }
|
|
5170
|
-
const removeNow = () => {
|
|
5171
|
-
if (node.nodeType === Node.COMMENT_NODE) {
|
|
5172
|
-
const open = node;
|
|
5173
|
-
const close = this.motif.options?.closeFragment || null;
|
|
5174
|
-
const parent = open.parentNode;
|
|
5175
|
-
if (!parent)
|
|
5176
|
-
return;
|
|
5177
|
-
if (close) {
|
|
5178
|
-
let current = open;
|
|
5179
|
-
while (current) {
|
|
5180
|
-
const after = current.nextSibling;
|
|
5181
|
-
try {
|
|
5182
|
-
parent.removeChild(current);
|
|
5183
|
-
}
|
|
5184
|
-
catch { }
|
|
5185
|
-
if (current === close)
|
|
5186
|
-
break;
|
|
5187
|
-
current = after;
|
|
5188
|
-
}
|
|
5189
|
-
}
|
|
5190
|
-
else {
|
|
5191
|
-
try {
|
|
5192
|
-
parent.removeChild(open);
|
|
5193
|
-
}
|
|
5194
|
-
catch { }
|
|
5195
|
-
}
|
|
5196
|
-
return;
|
|
5197
|
-
}
|
|
5198
|
-
const parent = node.parentNode;
|
|
5199
|
-
if (parent) {
|
|
5200
|
-
try {
|
|
5201
|
-
parent.removeChild(node);
|
|
5202
|
-
}
|
|
5203
|
-
catch { }
|
|
5204
|
-
return;
|
|
5205
|
-
}
|
|
5206
|
-
const placeholder = this.motif.options?.placeholder;
|
|
5207
|
-
if (placeholder && placeholder.parentNode) {
|
|
5208
|
-
try {
|
|
5209
|
-
placeholder.parentNode.removeChild(placeholder);
|
|
5210
|
-
}
|
|
5211
|
-
catch { }
|
|
5212
|
-
}
|
|
5213
|
-
};
|
|
5214
|
-
try {
|
|
5215
|
-
this.motif.options.transition.leaveTransition(() => {
|
|
5216
|
-
removeNow();
|
|
5217
|
-
});
|
|
5218
|
-
}
|
|
5219
|
-
catch {
|
|
5220
|
-
removeNow();
|
|
5221
|
-
}
|
|
5222
|
-
},
|
|
5223
|
-
_detachDomWithAnimationAsync: async () => {
|
|
5224
|
-
const node = this.element;
|
|
5225
|
-
if (!node)
|
|
5226
|
-
return Promise.resolve();
|
|
5227
|
-
try {
|
|
5228
|
-
const skip = this.motif.options.transition.skipNextLeave === true || this?._forceInstantDetach === true;
|
|
5229
|
-
if (skip) {
|
|
5230
|
-
if (this.motif.options.transition)
|
|
5231
|
-
this.motif.options.transition.skipNextLeave = false;
|
|
5232
|
-
this._forceInstantDetach = false;
|
|
5233
|
-
const immediateRemove = () => {
|
|
5234
|
-
if (node.nodeType === Node.COMMENT_NODE) {
|
|
5235
|
-
const open = node;
|
|
5236
|
-
const close = this.motif.options?.closeFragment || null;
|
|
5237
|
-
const parent = open.parentNode;
|
|
5238
|
-
if (!parent)
|
|
5239
|
-
return;
|
|
5240
|
-
if (close) {
|
|
5241
|
-
let current = open;
|
|
5242
|
-
while (current) {
|
|
5243
|
-
const after = current.nextSibling;
|
|
5244
|
-
try {
|
|
5245
|
-
parent.removeChild(current);
|
|
5246
|
-
}
|
|
5247
|
-
catch { }
|
|
5248
|
-
if (current === close)
|
|
5249
|
-
break;
|
|
5250
|
-
current = after;
|
|
5251
|
-
}
|
|
5252
|
-
}
|
|
5253
|
-
else {
|
|
5254
|
-
try {
|
|
5255
|
-
parent.removeChild(open);
|
|
5256
|
-
}
|
|
5257
|
-
catch { }
|
|
5258
|
-
}
|
|
5259
|
-
}
|
|
5260
|
-
else {
|
|
5261
|
-
const parent = node.parentNode;
|
|
5262
|
-
if (parent) {
|
|
5263
|
-
try {
|
|
5264
|
-
parent.removeChild(node);
|
|
5265
|
-
}
|
|
5266
|
-
catch { }
|
|
5267
|
-
}
|
|
5268
|
-
}
|
|
5269
|
-
const placeholder = this.motif.options?.placeholder;
|
|
5270
|
-
if (placeholder && placeholder.parentNode) {
|
|
5271
|
-
try {
|
|
5272
|
-
placeholder.parentNode.removeChild(placeholder);
|
|
5273
|
-
}
|
|
5274
|
-
catch { }
|
|
5275
|
-
}
|
|
5276
|
-
};
|
|
5277
|
-
immediateRemove();
|
|
5278
|
-
return Promise.resolve();
|
|
5279
|
-
}
|
|
5280
|
-
}
|
|
5281
|
-
catch { }
|
|
5282
|
-
const removeNow = () => {
|
|
5283
|
-
if (node.nodeType === Node.COMMENT_NODE) {
|
|
5284
|
-
const open = node;
|
|
5285
|
-
const close = this.motif.options?.closeFragment || null;
|
|
5286
|
-
const parent = open.parentNode;
|
|
5287
|
-
if (!parent)
|
|
5288
|
-
return;
|
|
5289
|
-
if (close) {
|
|
5290
|
-
let current = open;
|
|
5291
|
-
while (current) {
|
|
5292
|
-
const after = current.nextSibling;
|
|
5293
|
-
try {
|
|
5294
|
-
parent.removeChild(current);
|
|
5295
|
-
}
|
|
5296
|
-
catch { }
|
|
5297
|
-
if (current === close)
|
|
5298
|
-
break;
|
|
5299
|
-
current = after;
|
|
5300
|
-
}
|
|
5301
|
-
}
|
|
5302
|
-
else {
|
|
5303
|
-
try {
|
|
5304
|
-
parent.removeChild(open);
|
|
5305
|
-
}
|
|
5306
|
-
catch { }
|
|
5307
|
-
}
|
|
5308
|
-
return;
|
|
5309
|
-
}
|
|
5310
|
-
const parent = node.parentNode;
|
|
5311
|
-
if (parent) {
|
|
5312
|
-
try {
|
|
5313
|
-
parent.removeChild(node);
|
|
5314
|
-
}
|
|
5315
|
-
catch { }
|
|
5316
|
-
return;
|
|
5317
|
-
}
|
|
5318
|
-
const placeholder = this.motif.options?.placeholder;
|
|
5319
|
-
if (placeholder && placeholder.parentNode) {
|
|
5320
|
-
try {
|
|
5321
|
-
placeholder.parentNode.removeChild(placeholder);
|
|
5322
|
-
}
|
|
5323
|
-
catch { }
|
|
5324
|
-
}
|
|
5325
|
-
};
|
|
5326
|
-
return new Promise((resolve) => {
|
|
5327
|
-
try {
|
|
5328
|
-
this.motif.options.transition.leaveTransition(() => {
|
|
5329
|
-
removeNow();
|
|
5330
|
-
resolve();
|
|
5331
|
-
});
|
|
5332
|
-
}
|
|
5333
|
-
catch {
|
|
5334
|
-
removeNow();
|
|
5335
|
-
resolve();
|
|
5336
|
-
}
|
|
5337
|
-
});
|
|
5338
|
-
},
|
|
5339
|
-
_disposeShallow: () => {
|
|
5340
|
-
if (this.isDisposed)
|
|
5341
|
-
return;
|
|
5342
|
-
ComponentHelper.callDisposing.call(this, this);
|
|
5343
|
-
try {
|
|
5344
|
-
this._base._offAll();
|
|
5345
|
-
}
|
|
5346
|
-
catch {
|
|
5347
|
-
}
|
|
5348
|
-
this.motif.stopAnimations();
|
|
5349
|
-
this._base._deactivateBindings();
|
|
5350
|
-
if (this.controls?.items?.length) {
|
|
5351
|
-
for (const c of this.controls.items) {
|
|
5490
|
+
const items = c.controls?.items;
|
|
5491
|
+
if (items) {
|
|
5492
|
+
for (let i = 0; i < items.length; i++) {
|
|
5493
|
+
const child = items[i];
|
|
5494
|
+
if (child && !child.isDisposed && !subtreeDisposesSync(child, false))
|
|
5495
|
+
return false;
|
|
5496
|
+
}
|
|
5497
|
+
}
|
|
5498
|
+
return true;
|
|
5499
|
+
}
|
|
5500
|
+
const teardownApplications = new WeakMap();
|
|
5501
|
+
function owningApplication(c) {
|
|
5502
|
+
for (let p = c; p; p = p.parent) {
|
|
5503
|
+
if (p.application)
|
|
5504
|
+
return p.application;
|
|
5505
|
+
const recorded = teardownApplications.get(p);
|
|
5506
|
+
if (recorded)
|
|
5507
|
+
return recorded;
|
|
5508
|
+
}
|
|
5509
|
+
return Application.main ?? null;
|
|
5510
|
+
}
|
|
5511
|
+
function disposePrefix(c, options, asChild) {
|
|
5512
|
+
const ctx = asChild ? 'disposeAsync' : 'dispose';
|
|
5513
|
+
if (Application._disposingCount > 0) {
|
|
5514
|
+
const app = owningApplication(c);
|
|
5515
|
+
if (app && app.state === 'disposing')
|
|
5516
|
+
teardownApplications.set(c, app);
|
|
5517
|
+
}
|
|
5518
|
+
if (!asChild && options?.skipLeaveTransition) {
|
|
5519
|
+
c.motif.options.transition.skipNextLeave = true;
|
|
5520
|
+
}
|
|
5521
|
+
safeCall(() => { ComponentHelper.callDisposing.call(c, c); }, ctx + '.callDisposing');
|
|
5522
|
+
c._base._offAll();
|
|
5523
|
+
c._base._deactivateBindings();
|
|
5524
|
+
safeCall(() => { c.parent?.controls?.silentDetach?.(c, true); }, ctx + '.silentDetach');
|
|
5525
|
+
}
|
|
5526
|
+
function disposeFinish(c, options, asChild) {
|
|
5527
|
+
c.isDisposed = true;
|
|
5528
|
+
Disposable.prototype.dispose.call(c);
|
|
5529
|
+
if (asChild) {
|
|
5530
|
+
c.controls.items = [];
|
|
5531
|
+
safeCall(() => { ComponentHelper.callDisposed.call(c, c); }, 'disposeAsync.callDisposed');
|
|
5532
|
+
safeCall(() => { c._base.emiters.clear(); }, 'disposeAsync.emiters');
|
|
5533
|
+
if (options?.deep) {
|
|
5534
|
+
c._base._deepCleanup();
|
|
5535
|
+
}
|
|
5536
|
+
return;
|
|
5537
|
+
}
|
|
5538
|
+
c.element = null;
|
|
5539
|
+
safeCall(() => { ComponentHelper.callDisposed.call(c, c); }, 'dispose.callDisposed');
|
|
5540
|
+
safeCall(() => { c._base.emiters.clear(); }, 'dispose.emiters');
|
|
5541
|
+
c._base._offAll();
|
|
5542
|
+
c._base._deepCleanup();
|
|
5543
|
+
}
|
|
5544
|
+
async function disposeRemainderAsync(c, options, asChild, leave) {
|
|
5545
|
+
if (leave) {
|
|
5546
|
+
await leave;
|
|
5547
|
+
}
|
|
5548
|
+
else {
|
|
5549
|
+
if (asChild) {
|
|
5550
|
+
await c.motif.stopAnimations();
|
|
5551
|
+
}
|
|
5552
|
+
else if (peekTransition(c)?.skipNextLeave) {
|
|
5553
|
+
await c.motif.stopAnimations();
|
|
5554
|
+
}
|
|
5555
|
+
await c._base._detachDomWithAnimationAsync();
|
|
5556
|
+
}
|
|
5557
|
+
if (!asChild && c.constructor.name !== 'TransportTo') {
|
|
5558
|
+
await disposeContentBlocks(c);
|
|
5559
|
+
}
|
|
5560
|
+
const childOptions = { deep: options?.deep };
|
|
5561
|
+
await safeCallAsync(async () => {
|
|
5562
|
+
if (c.isDisposed) {
|
|
5563
|
+
return;
|
|
5564
|
+
}
|
|
5565
|
+
const ctrls = Array.from(c.controls.items);
|
|
5566
|
+
if (ctrls.length) {
|
|
5567
|
+
await Promise.all(ctrls.map(child => asChild
|
|
5568
|
+
? safeCallAsync(async () => { await child.disposeAsync(childOptions); }, 'disposeAsync.disposeAsyncChildren.handler')
|
|
5569
|
+
: (async () => {
|
|
5352
5570
|
try {
|
|
5353
|
-
|
|
5571
|
+
await child.disposeAsync(childOptions);
|
|
5354
5572
|
}
|
|
5355
|
-
catch {
|
|
5573
|
+
catch (error) {
|
|
5574
|
+
reportError('MJX107', error);
|
|
5356
5575
|
}
|
|
5357
|
-
}
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
this.attr?._attrMap?.clear();
|
|
5388
|
-
}
|
|
5389
|
-
catch { }
|
|
5390
|
-
try {
|
|
5391
|
-
this.attr?._watchers?.clear();
|
|
5392
|
-
}
|
|
5393
|
-
catch { }
|
|
5394
|
-
try {
|
|
5395
|
-
if (this.motif.options) {
|
|
5396
|
-
this.motif.options.cache = undefined;
|
|
5397
|
-
this.motif.options.closeFragment = undefined;
|
|
5398
|
-
this.motif.options.placeholder = undefined;
|
|
5399
|
-
}
|
|
5400
|
-
}
|
|
5401
|
-
catch {
|
|
5402
|
-
}
|
|
5403
|
-
try {
|
|
5404
|
-
this.element = null;
|
|
5405
|
-
}
|
|
5406
|
-
catch { }
|
|
5407
|
-
try {
|
|
5408
|
-
this.props = undefined;
|
|
5409
|
-
}
|
|
5410
|
-
catch { }
|
|
5411
|
-
try {
|
|
5412
|
-
this.childs = undefined;
|
|
5576
|
+
})()));
|
|
5577
|
+
}
|
|
5578
|
+
}, asChild ? 'disposeAsync.disposeAsyncChildren' : 'dispose.disposeAsync');
|
|
5579
|
+
if (!asChild && c.isDisposed) {
|
|
5580
|
+
return;
|
|
5581
|
+
}
|
|
5582
|
+
disposeFinish(c, options, asChild);
|
|
5583
|
+
}
|
|
5584
|
+
function disposeRemainderSync(root, options, asChild, rootDetached) {
|
|
5585
|
+
const childOptions = { deep: options?.deep };
|
|
5586
|
+
const nodes = [root];
|
|
5587
|
+
const parents = [-1];
|
|
5588
|
+
let pending = null;
|
|
5589
|
+
if (!rootDetached)
|
|
5590
|
+
detachDomWithAnimation(root);
|
|
5591
|
+
for (let n = 0; n < nodes.length; n++) {
|
|
5592
|
+
const node = nodes[n];
|
|
5593
|
+
if (node.isDisposed)
|
|
5594
|
+
continue;
|
|
5595
|
+
const items = node.controls?.items;
|
|
5596
|
+
if (!items || items.length === 0)
|
|
5597
|
+
continue;
|
|
5598
|
+
const ctrls = Array.from(items);
|
|
5599
|
+
for (let j = 0; j < ctrls.length; j++) {
|
|
5600
|
+
const child = ctrls[j];
|
|
5601
|
+
if (child.isDisposed)
|
|
5602
|
+
continue;
|
|
5603
|
+
if (child._disposing) {
|
|
5604
|
+
(pending ??= []).push(child._disposing);
|
|
5605
|
+
continue;
|
|
5413
5606
|
}
|
|
5414
|
-
catch { }
|
|
5415
5607
|
try {
|
|
5416
|
-
|
|
5608
|
+
retireServiceOwner(child);
|
|
5609
|
+
child._disposing = root._disposing;
|
|
5610
|
+
disposePrefix(child, childOptions, true);
|
|
5611
|
+
detachDomWithAnimation(child);
|
|
5612
|
+
nodes.push(child);
|
|
5613
|
+
parents.push(n);
|
|
5417
5614
|
}
|
|
5418
|
-
catch {
|
|
5419
|
-
|
|
5420
|
-
this.attr = undefined;
|
|
5615
|
+
catch (error) {
|
|
5616
|
+
reportError('MJX107', error);
|
|
5421
5617
|
}
|
|
5422
|
-
|
|
5618
|
+
}
|
|
5619
|
+
}
|
|
5620
|
+
const count = nodes.length;
|
|
5621
|
+
if (count > 1) {
|
|
5622
|
+
const heights = new Array(count).fill(0);
|
|
5623
|
+
for (let i = count - 1; i >= 1; i--) {
|
|
5624
|
+
const p = parents[i];
|
|
5625
|
+
if (heights[i] + 1 > heights[p])
|
|
5626
|
+
heights[p] = heights[i] + 1;
|
|
5627
|
+
}
|
|
5628
|
+
const order = [];
|
|
5629
|
+
for (let i = 1; i < count; i++)
|
|
5630
|
+
order.push(i);
|
|
5631
|
+
order.sort((a, b) => heights[a] - heights[b] || a - b);
|
|
5632
|
+
for (let k = 0; k < order.length; k++) {
|
|
5423
5633
|
try {
|
|
5424
|
-
|
|
5634
|
+
disposeFinish(nodes[order[k]], childOptions, true);
|
|
5425
5635
|
}
|
|
5426
|
-
catch {
|
|
5427
|
-
|
|
5428
|
-
this.motif.options = undefined;
|
|
5636
|
+
catch (error) {
|
|
5637
|
+
reportError('MJX107', error);
|
|
5429
5638
|
}
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5639
|
+
}
|
|
5640
|
+
}
|
|
5641
|
+
if (pending)
|
|
5642
|
+
return pending;
|
|
5643
|
+
if (!asChild && root.isDisposed) {
|
|
5644
|
+
return null;
|
|
5645
|
+
}
|
|
5646
|
+
disposeFinish(root, options, asChild);
|
|
5647
|
+
return null;
|
|
5648
|
+
}
|
|
5649
|
+
const BASE_PROTO = {
|
|
5650
|
+
_offAll() {
|
|
5651
|
+
const c = this.owner;
|
|
5652
|
+
if (!c._eventHandlers)
|
|
5653
|
+
return;
|
|
5654
|
+
for (const [full, set] of c._eventHandlers) {
|
|
5655
|
+
const name = full.split(":")[0];
|
|
5656
|
+
const evt = name.startsWith("on") ? name.slice(2).toLowerCase() : name.toLowerCase();
|
|
5657
|
+
for (const rec of set) {
|
|
5658
|
+
if (!rec || !rec.wrapped) {
|
|
5659
|
+
continue;
|
|
5660
|
+
}
|
|
5661
|
+
if (rec.domEvent === false) {
|
|
5662
|
+
continue;
|
|
5663
|
+
}
|
|
5664
|
+
const cap = rec.capture === true;
|
|
5434
5665
|
try {
|
|
5435
|
-
|
|
5436
|
-
delete this[key];
|
|
5666
|
+
c.element.removeEventListener(evt, rec.wrapped, cap);
|
|
5437
5667
|
}
|
|
5438
|
-
catch {
|
|
5668
|
+
catch { }
|
|
5669
|
+
try {
|
|
5670
|
+
if (rec.capture === undefined) {
|
|
5671
|
+
c.element.removeEventListener(evt, rec.wrapped, !cap);
|
|
5672
|
+
}
|
|
5439
5673
|
}
|
|
5674
|
+
catch { }
|
|
5675
|
+
}
|
|
5676
|
+
}
|
|
5677
|
+
c._eventHandlers.clear();
|
|
5678
|
+
c._eventHandlers = undefined;
|
|
5679
|
+
},
|
|
5680
|
+
_deactivateBindings() {
|
|
5681
|
+
const c = this.owner;
|
|
5682
|
+
try {
|
|
5683
|
+
c.bindings?.deactivateAll();
|
|
5684
|
+
}
|
|
5685
|
+
catch { }
|
|
5686
|
+
},
|
|
5687
|
+
_activateBindings() {
|
|
5688
|
+
const c = this.owner;
|
|
5689
|
+
try {
|
|
5690
|
+
c.bindings?.activateAll();
|
|
5691
|
+
}
|
|
5692
|
+
catch { }
|
|
5693
|
+
},
|
|
5694
|
+
_reactivateBindings() {
|
|
5695
|
+
const c = this.owner;
|
|
5696
|
+
try {
|
|
5697
|
+
c.bindings?.reActivateAll();
|
|
5698
|
+
}
|
|
5699
|
+
catch { }
|
|
5700
|
+
},
|
|
5701
|
+
_activatePreBindings() {
|
|
5702
|
+
if (this.prebinding_Activated)
|
|
5703
|
+
return;
|
|
5704
|
+
const c = this.owner;
|
|
5705
|
+
const registered = c.bindings?._items;
|
|
5706
|
+
if (registered && registered.length > 0) {
|
|
5707
|
+
c.bindings.items.filter((x) => x.propertyName == "isWait" || x.propertyName == "display").forEach((b) => {
|
|
5708
|
+
b.activate();
|
|
5440
5709
|
});
|
|
5441
|
-
|
|
5710
|
+
}
|
|
5711
|
+
this.prebinding_Activated = true;
|
|
5712
|
+
},
|
|
5713
|
+
_detachDomWithAnimation() {
|
|
5714
|
+
detachDomWithAnimation(this.owner);
|
|
5715
|
+
},
|
|
5716
|
+
_detachDomWithAnimationAsync() {
|
|
5717
|
+
return detachDomWithAnimationAsync(this.owner);
|
|
5718
|
+
},
|
|
5719
|
+
_disposeShallow() {
|
|
5720
|
+
disposeShallow(this.owner);
|
|
5721
|
+
},
|
|
5722
|
+
_deepCleanup() {
|
|
5723
|
+
deepCleanup(this.owner);
|
|
5724
|
+
},
|
|
5725
|
+
};
|
|
5726
|
+
function createBaseCtx(owner) {
|
|
5727
|
+
const base = Object.create(BASE_PROTO);
|
|
5728
|
+
base.owner = owner;
|
|
5729
|
+
base.prebinding_Activated = false;
|
|
5730
|
+
base.emiters = new ComponentEmiter(owner);
|
|
5731
|
+
return base;
|
|
5732
|
+
}
|
|
5733
|
+
const fragmentCloseMarkers = new WeakMap();
|
|
5734
|
+
const LIFECYCLE_X_EVENTS = new Set([
|
|
5735
|
+
'building', 'built', 'initializing', 'initialized', 'disposing', 'disposed',
|
|
5736
|
+
'config', 'configured', 'visibilitychanged', 'activated', 'deactivated'
|
|
5737
|
+
]);
|
|
5738
|
+
const RAW_APPLICATION = Symbol('motif.rawApplication');
|
|
5739
|
+
const SCOPED_SUBSCRIBERS = new Set(['on', 'onRouterChanged']);
|
|
5740
|
+
/**
|
|
5741
|
+
* Uygulamanın bileşene bağlı görünümü. `on`/`onRouterChanged` aboneliklerini sahibin ömrüne
|
|
5742
|
+
* kaydeder; diğer tüm üyeler (alanlar, metotlar, atamalar) uygulamanın kendisine yönlenir.
|
|
5743
|
+
*/
|
|
5744
|
+
function createScopedContext(app, owner) {
|
|
5745
|
+
const cache = new Map();
|
|
5746
|
+
return new Proxy(app, {
|
|
5747
|
+
get(target, prop) {
|
|
5748
|
+
if (prop === RAW_APPLICATION) {
|
|
5749
|
+
return target;
|
|
5750
|
+
}
|
|
5751
|
+
const value = Reflect.get(target, prop, target);
|
|
5752
|
+
if (typeof value !== 'function') {
|
|
5753
|
+
return value;
|
|
5754
|
+
}
|
|
5755
|
+
const hit = cache.get(prop);
|
|
5756
|
+
if (hit && hit.fn === value) {
|
|
5757
|
+
return hit.bound;
|
|
5758
|
+
}
|
|
5759
|
+
const bound = SCOPED_SUBSCRIBERS.has(prop)
|
|
5760
|
+
? (...args) => owner._trackContextSubscription(value.apply(target, args))
|
|
5761
|
+
: value.bind(target);
|
|
5762
|
+
cache.set(prop, { fn: value, bound });
|
|
5763
|
+
return bound;
|
|
5442
5764
|
},
|
|
5443
|
-
|
|
5444
|
-
|
|
5765
|
+
set(target, prop, value) {
|
|
5766
|
+
return Reflect.set(target, prop, value, target);
|
|
5767
|
+
},
|
|
5768
|
+
});
|
|
5769
|
+
}
|
|
5770
|
+
class ComponentBase extends Disposable {
|
|
5771
|
+
motif = new ComponentMotif(this, new ComponentOptionsImpl(this));
|
|
5772
|
+
element;
|
|
5773
|
+
props;
|
|
5774
|
+
isBuilt = false;
|
|
5775
|
+
isInitialized = false;
|
|
5776
|
+
isDisposed = false;
|
|
5777
|
+
isConfigured = false;
|
|
5778
|
+
isPainting = false;
|
|
5779
|
+
isPainted = false;
|
|
5780
|
+
isVisible = true;
|
|
5781
|
+
controls = new ControlCollection(this);
|
|
5782
|
+
_eventHandlers;
|
|
5783
|
+
_isWait = false;
|
|
5784
|
+
class = new controlClass(this);
|
|
5785
|
+
attr = new controlAttribute(this);
|
|
5786
|
+
bindings = new BindingCollection(this);
|
|
5787
|
+
/** style(fn) izleyicisi: tek tek tutulur, yeniden çağrıda önceki durdurulur. */
|
|
5788
|
+
_styleFx;
|
|
5789
|
+
useModel(modelCtor) {
|
|
5790
|
+
return reactive(modelCtor);
|
|
5791
|
+
}
|
|
5792
|
+
_computeHideStrategy() {
|
|
5793
|
+
const cfg = this.motif.options?.hideStrategy ?? 'auto';
|
|
5794
|
+
if (cfg === 'placeholder')
|
|
5795
|
+
return 'placeholder';
|
|
5796
|
+
if (cfg === 'detach')
|
|
5797
|
+
return 'detach';
|
|
5798
|
+
if (this.motif.options?.__fromList || typeof this.motif.options?.indexkey !== 'undefined' || typeof this.motif.options?.__key !== 'undefined') {
|
|
5799
|
+
return 'detach';
|
|
5800
|
+
}
|
|
5801
|
+
return 'placeholder';
|
|
5802
|
+
}
|
|
5803
|
+
_isInDom() {
|
|
5804
|
+
try {
|
|
5805
|
+
if (!this.element)
|
|
5806
|
+
return false;
|
|
5807
|
+
const node = this.element;
|
|
5808
|
+
if (node.nodeType === Node.COMMENT_NODE) {
|
|
5809
|
+
return !!node.parentNode;
|
|
5810
|
+
}
|
|
5811
|
+
return !!node.parentNode;
|
|
5812
|
+
}
|
|
5813
|
+
catch {
|
|
5814
|
+
return false;
|
|
5815
|
+
}
|
|
5816
|
+
}
|
|
5817
|
+
set isWait(value) {
|
|
5818
|
+
this._isWait = value;
|
|
5819
|
+
if (this.isBuilt) {
|
|
5820
|
+
if (value) {
|
|
5821
|
+
this.motif.hide();
|
|
5822
|
+
}
|
|
5823
|
+
else {
|
|
5824
|
+
this.motif.show();
|
|
5825
|
+
}
|
|
5826
|
+
return;
|
|
5827
|
+
}
|
|
5828
|
+
if (value === false && this.parent && this.parent.isBuilt) {
|
|
5829
|
+
ComponentHelper.internalBuild.call(this.parent, this);
|
|
5830
|
+
}
|
|
5831
|
+
}
|
|
5832
|
+
get isWait() {
|
|
5833
|
+
return this._isWait;
|
|
5834
|
+
}
|
|
5835
|
+
constructor(element, props = {}) {
|
|
5836
|
+
super();
|
|
5837
|
+
recordServiceOwner(this);
|
|
5838
|
+
if (this.onElementCreating) {
|
|
5839
|
+
this.element = this.onElementCreating.call(this);
|
|
5840
|
+
}
|
|
5841
|
+
else if (props?.onElementCreating) {
|
|
5842
|
+
this.element = props.onElementCreating.call(this);
|
|
5843
|
+
}
|
|
5844
|
+
else {
|
|
5845
|
+
this.element = element;
|
|
5846
|
+
}
|
|
5847
|
+
if (props) {
|
|
5848
|
+
const refs = extractRefs(props, this);
|
|
5849
|
+
if (refs.length > 0) {
|
|
5850
|
+
for (const fn of takePendingRefs(this, refs)) {
|
|
5851
|
+
callReported(() => fn(this), 'MJX122', 'ref');
|
|
5852
|
+
}
|
|
5853
|
+
}
|
|
5854
|
+
}
|
|
5855
|
+
props && ParseProps(props, this);
|
|
5856
|
+
applyComponentOptions(props?.options, this);
|
|
5857
|
+
this.props = props;
|
|
5858
|
+
// (class/style/id/tabindex/role/aria-*/data-*) kök düğüme (root node) düşer, prop'lar this.props'ta kalır.
|
|
5859
|
+
if (props) {
|
|
5860
|
+
const ctor0 = new.target;
|
|
5861
|
+
const plain = ctor0 === ComponentBase || Object.getPrototypeOf(ctor0) === ComponentBase;
|
|
5862
|
+
if (plain)
|
|
5863
|
+
applyPlainElementProps(props, this);
|
|
5864
|
+
else
|
|
5865
|
+
applyFallthroughProps(props, this);
|
|
5866
|
+
}
|
|
5867
|
+
ComponentHelper.callOnInitializing(this);
|
|
5868
|
+
if (this.isDisposed)
|
|
5869
|
+
return;
|
|
5870
|
+
this.controls.onAdd = (c) => {
|
|
5871
|
+
if (this._eventHandlers?.has('controladded'))
|
|
5872
|
+
this.motif.trigger('controladded', { control: c });
|
|
5873
|
+
if (this.isWait || this.parent?.isWait)
|
|
5874
|
+
return;
|
|
5875
|
+
ComponentHelper.internalBuild.call(this, c);
|
|
5876
|
+
};
|
|
5877
|
+
this.controls.onAddBeforeBuild = (c) => {
|
|
5878
|
+
if (this._eventHandlers?.has('controladded'))
|
|
5879
|
+
this.motif.trigger('controladded', { control: c });
|
|
5880
|
+
};
|
|
5881
|
+
this.controls.onRemove = (c) => {
|
|
5882
|
+
if (this._eventHandlers?.has('controlremoved'))
|
|
5883
|
+
this.motif.trigger('controlremoved', { control: c });
|
|
5884
|
+
};
|
|
5885
|
+
ComponentHelper.callOnInitialized(this);
|
|
5886
|
+
const ctor = new.target;
|
|
5887
|
+
const isBaseCtor = ctor === ComponentBase || Object.getPrototypeOf(ctor) === ComponentBase;
|
|
5888
|
+
if (isBaseCtor) {
|
|
5889
|
+
ComponentHelper.callConfig(this);
|
|
5890
|
+
}
|
|
5891
|
+
else {
|
|
5892
|
+
this._base._configDeferred = true;
|
|
5893
|
+
}
|
|
5894
|
+
}
|
|
5895
|
+
childs;
|
|
5896
|
+
_base = createBaseCtx(this);
|
|
5445
5897
|
parent = null;
|
|
5446
5898
|
_scopedContext;
|
|
5447
5899
|
get context() {
|
|
5448
5900
|
const parentCtx = this.parent?.context;
|
|
5449
|
-
const app = parentCtx?.[RAW_APPLICATION] ?? parentCtx ?? Application.main;
|
|
5901
|
+
const app = parentCtx?.[RAW_APPLICATION] ?? parentCtx ?? teardownApplications.get(this) ?? Application.main;
|
|
5450
5902
|
if (!app) {
|
|
5451
5903
|
return app;
|
|
5452
5904
|
}
|
|
@@ -5468,6 +5920,7 @@
|
|
|
5468
5920
|
return () => { this._disposables.detach(d); off(); };
|
|
5469
5921
|
}
|
|
5470
5922
|
build(building = true) {
|
|
5923
|
+
checkReservedMembers(this);
|
|
5471
5924
|
ComponentHelper.callConfigured(this);
|
|
5472
5925
|
this._base._activatePreBindings();
|
|
5473
5926
|
if (this.isDisposed || !this.element || this.isWait) {
|
|
@@ -5477,6 +5930,9 @@
|
|
|
5477
5930
|
return;
|
|
5478
5931
|
}
|
|
5479
5932
|
ComponentHelper.callBuilding(this);
|
|
5933
|
+
if (this.isDisposed) {
|
|
5934
|
+
return;
|
|
5935
|
+
}
|
|
5480
5936
|
var ph = this.element;
|
|
5481
5937
|
if (building) {
|
|
5482
5938
|
ph = dom.createDocumentFragment();
|
|
@@ -5491,9 +5947,15 @@
|
|
|
5491
5947
|
return;
|
|
5492
5948
|
}
|
|
5493
5949
|
ComponentHelper.callInitializeComponent(this);
|
|
5950
|
+
if (this.isDisposed) {
|
|
5951
|
+
return;
|
|
5952
|
+
}
|
|
5494
5953
|
if (this.view) {
|
|
5495
5954
|
const templ = this.view();
|
|
5496
5955
|
this.controls.add(templ);
|
|
5956
|
+
if (this.isDisposed) {
|
|
5957
|
+
return;
|
|
5958
|
+
}
|
|
5497
5959
|
}
|
|
5498
5960
|
const deferredSelectValue = this.element?.nodeName === 'SELECT'
|
|
5499
5961
|
? this.bindings.items.filter(b => b.propertyName === 'value')
|
|
@@ -5534,6 +5996,9 @@
|
|
|
5534
5996
|
ComponentHelper.activateTree(element);
|
|
5535
5997
|
}
|
|
5536
5998
|
}
|
|
5999
|
+
if (this.isDisposed) {
|
|
6000
|
+
return;
|
|
6001
|
+
}
|
|
5537
6002
|
if (wantsEnterTransition(this)) {
|
|
5538
6003
|
const node = this.element;
|
|
5539
6004
|
if (node && node.isConnected) {
|
|
@@ -5717,7 +6182,20 @@
|
|
|
5717
6182
|
if (this.isVisible) {
|
|
5718
6183
|
return;
|
|
5719
6184
|
} /* A*/
|
|
5720
|
-
if (this.
|
|
6185
|
+
if (this.parent && enterModeOf(this.parent) === 'out-in') {
|
|
6186
|
+
const showHost = (this.motif.options.placeholder?.parentNode)
|
|
6187
|
+
?? findAppendableComponent(this.parent)?.element;
|
|
6188
|
+
const wait = pendingLeaves(showHost, this.element);
|
|
6189
|
+
if (wait) {
|
|
6190
|
+
const seq = this._base._showSeq = (this._base._showSeq ?? 0) + 1;
|
|
6191
|
+
return wait.then(() => {
|
|
6192
|
+
if (this.isDisposed || this._base._showSeq !== seq)
|
|
6193
|
+
return;
|
|
6194
|
+
return this._show();
|
|
6195
|
+
});
|
|
6196
|
+
}
|
|
6197
|
+
}
|
|
6198
|
+
if (peekTransition(this)?.activeAnimations?.length) {
|
|
5721
6199
|
safeCall(async () => {
|
|
5722
6200
|
await Promise.all(this.motif.options.transition.activeAnimations.map(a => a.finished?.catch(() => { })));
|
|
5723
6201
|
}, 'show.waitForLeaveAnimations');
|
|
@@ -5726,6 +6204,9 @@
|
|
|
5726
6204
|
const strategy = this._computeHideStrategy();
|
|
5727
6205
|
if (strategy === 'detach') {
|
|
5728
6206
|
ComponentHelper.callVisibilityChanged(this);
|
|
6207
|
+
if (this.isDisposed) {
|
|
6208
|
+
return;
|
|
6209
|
+
}
|
|
5729
6210
|
const needAttach = !this._isInDom() && this.parent && this.parent.isBuilt && !this.isWait;
|
|
5730
6211
|
this.isVisible = true;
|
|
5731
6212
|
if (needAttach) {
|
|
@@ -5748,6 +6229,9 @@
|
|
|
5748
6229
|
/** A*/
|
|
5749
6230
|
wantsEnterTransition(this) && this.motif.options.transition.enterTransition(() => { });
|
|
5750
6231
|
ComponentHelper.callVisibilityChanged(this);
|
|
6232
|
+
if (this.isDisposed) {
|
|
6233
|
+
return;
|
|
6234
|
+
}
|
|
5751
6235
|
if (this.element.nodeType === Node.COMMENT_NODE) {
|
|
5752
6236
|
this.controls.forEach(c => {
|
|
5753
6237
|
c.motif.show();
|
|
@@ -5768,12 +6252,16 @@
|
|
|
5768
6252
|
if (this.isDisposed || !this.element) {
|
|
5769
6253
|
return;
|
|
5770
6254
|
}
|
|
6255
|
+
this._base._showSeq = (this._base._showSeq ?? 0) + 1;
|
|
5771
6256
|
if (!this.isVisible) {
|
|
5772
6257
|
return;
|
|
5773
6258
|
}
|
|
5774
6259
|
const strategy = this._computeHideStrategy();
|
|
5775
6260
|
if (strategy === 'detach') {
|
|
5776
6261
|
ComponentHelper.callVisibilityChanged(this);
|
|
6262
|
+
if (this.isDisposed) {
|
|
6263
|
+
return;
|
|
6264
|
+
}
|
|
5777
6265
|
await this._base._detachDomWithAnimationAsync();
|
|
5778
6266
|
this.isVisible = false;
|
|
5779
6267
|
ComponentHelper.deactivateTree(this);
|
|
@@ -5786,6 +6274,9 @@
|
|
|
5786
6274
|
transition.skipNextLeave = false;
|
|
5787
6275
|
const finish = () => {
|
|
5788
6276
|
ComponentHelper.callVisibilityChanged(this);
|
|
6277
|
+
if (this.isDisposed) {
|
|
6278
|
+
return;
|
|
6279
|
+
}
|
|
5789
6280
|
if (this.element.nodeType === Node.COMMENT_NODE) {
|
|
5790
6281
|
this.controls.forEach(c => {
|
|
5791
6282
|
if (skip && c.isVisible && c.element && !c.isDisposed && c.motif.options?.transition) {
|
|
@@ -5904,7 +6395,7 @@
|
|
|
5904
6395
|
if (mods.includes("stop")) {
|
|
5905
6396
|
stop();
|
|
5906
6397
|
}
|
|
5907
|
-
if (res
|
|
6398
|
+
if (res && res.cancel === true) {
|
|
5908
6399
|
prevent();
|
|
5909
6400
|
stop();
|
|
5910
6401
|
}
|
|
@@ -5990,114 +6481,48 @@
|
|
|
5990
6481
|
return this;
|
|
5991
6482
|
}
|
|
5992
6483
|
/** Süren bertaraf: ikinci bir dispose/disposeAsync çağrısı yenisini başlatmaz, bunu bekler. */
|
|
5993
|
-
_disposing;
|
|
5994
|
-
dispose(options = { deep: true }) {
|
|
5995
|
-
if (this.isDisposed) {
|
|
5996
|
-
return Promise.resolve();
|
|
5997
|
-
}
|
|
5998
|
-
if (!this._disposing) {
|
|
5999
|
-
retireServiceOwner(this);
|
|
6000
|
-
}
|
|
6001
|
-
return this._disposing ??= this._disposeCore(options);
|
|
6002
|
-
}
|
|
6003
|
-
async _disposeCore(options) {
|
|
6004
|
-
if (options?.skipLeaveTransition) {
|
|
6005
|
-
this.motif.options.transition.skipNextLeave = true;
|
|
6006
|
-
}
|
|
6007
|
-
safeCall(() => {
|
|
6008
|
-
ComponentHelper.callDisposing.call(this, this);
|
|
6009
|
-
}, 'dispose.callDisposing');
|
|
6010
|
-
// DOM dinleyicileri hemen sökülür, aşağıda isDisposed true olunca off() boşa döner,
|
|
6011
|
-
// element null'lanınca da _offAll dom'dan sökülemez — DOM'dan çıkmış öğeye sonradan gelen
|
|
6012
|
-
this._base._offAll();
|
|
6013
|
-
this._base._deactivateBindings();
|
|
6014
|
-
safeCall(() => {
|
|
6015
|
-
this.parent?.controls?.silentDetach?.(this, true);
|
|
6016
|
-
}, 'dispose.silentDetach');
|
|
6017
|
-
this.motif.options.transition.skipNextLeave && await this.motif.stopAnimations();
|
|
6018
|
-
await this._base._detachDomWithAnimationAsync();
|
|
6019
|
-
if (this.constructor.name !== 'TransportTo') {
|
|
6020
|
-
await disposeContentBlocks(this);
|
|
6021
|
-
}
|
|
6022
|
-
await safeCallAsync(async () => {
|
|
6023
|
-
if (this.isDisposed) {
|
|
6024
|
-
return;
|
|
6025
|
-
}
|
|
6026
|
-
const ctrls = Array.from(this.controls.items);
|
|
6027
|
-
if (ctrls.length) {
|
|
6028
|
-
await Promise.all(ctrls.map(async (c) => {
|
|
6029
|
-
try {
|
|
6030
|
-
await c.disposeAsync({ deep: options?.deep });
|
|
6031
|
-
}
|
|
6032
|
-
catch (error) {
|
|
6033
|
-
reportError('MJX107', error);
|
|
6034
|
-
}
|
|
6035
|
-
}));
|
|
6036
|
-
}
|
|
6037
|
-
}, 'dispose.disposeAsync');
|
|
6484
|
+
_disposing;
|
|
6485
|
+
dispose(options = { deep: true }) {
|
|
6038
6486
|
if (this.isDisposed) {
|
|
6487
|
+
return Promise.resolve();
|
|
6488
|
+
}
|
|
6489
|
+
if (this._disposing) {
|
|
6490
|
+
return this._disposing;
|
|
6491
|
+
}
|
|
6492
|
+
retireServiceOwner(this);
|
|
6493
|
+
this._disposing = DISPOSE_STARTED;
|
|
6494
|
+
return this._disposing = this._disposeCore(options, false);
|
|
6495
|
+
}
|
|
6496
|
+
async _disposeCore(options, asChild) {
|
|
6497
|
+
disposePrefix(this, options, asChild);
|
|
6498
|
+
let leave;
|
|
6499
|
+
if (!asChild && !peekTransition(this)?.skipNextLeave) {
|
|
6500
|
+
leave = this._base._detachDomWithAnimationAsync();
|
|
6501
|
+
}
|
|
6502
|
+
await undefined;
|
|
6503
|
+
if (contentBlocks.live === 0 && subtreeDisposesSync(this, true)) {
|
|
6504
|
+
const pending = disposeRemainderSync(this, options, asChild, leave !== undefined);
|
|
6505
|
+
if (pending) {
|
|
6506
|
+
await Promise.all(pending);
|
|
6507
|
+
if (!asChild && this.isDisposed) {
|
|
6508
|
+
return;
|
|
6509
|
+
}
|
|
6510
|
+
disposeFinish(this, options, asChild);
|
|
6511
|
+
}
|
|
6039
6512
|
return;
|
|
6040
6513
|
}
|
|
6041
|
-
this
|
|
6042
|
-
super.dispose();
|
|
6043
|
-
this.element = null;
|
|
6044
|
-
//if (options?.deep) {
|
|
6045
|
-
safeCall(() => {
|
|
6046
|
-
ComponentHelper.callDisposed.call(this, this);
|
|
6047
|
-
}, 'dispose.callDisposed');
|
|
6048
|
-
safeCall(() => { this._base.emiters.clear(); }, 'dispose.emiters');
|
|
6049
|
-
this._base._offAll();
|
|
6050
|
-
this._base._deepCleanup();
|
|
6051
|
-
// var k = Object.keys(this);
|
|
6052
|
-
// for (var i = 0; i < k.length; i++) {
|
|
6053
|
-
// try {
|
|
6054
|
-
// } catch {
|
|
6514
|
+
await disposeRemainderAsync(this, options, asChild, leave);
|
|
6055
6515
|
}
|
|
6056
6516
|
disposeAsync(options = { deep: true }) {
|
|
6057
6517
|
if (this.isDisposed) {
|
|
6058
6518
|
return Promise.resolve();
|
|
6059
6519
|
}
|
|
6060
|
-
if (
|
|
6061
|
-
|
|
6062
|
-
}
|
|
6063
|
-
return this._disposing ??= this._disposeAsyncCore(options);
|
|
6064
|
-
}
|
|
6065
|
-
async _disposeAsyncCore(options) {
|
|
6066
|
-
safeCall(() => {
|
|
6067
|
-
ComponentHelper.callDisposing.call(this, this);
|
|
6068
|
-
}, 'disposeAsync.callDisposing');
|
|
6069
|
-
this._base._offAll();
|
|
6070
|
-
this._base._deactivateBindings();
|
|
6071
|
-
safeCall(() => {
|
|
6072
|
-
this.parent?.controls?.silentDetach?.(this, true);
|
|
6073
|
-
}, 'disposeAsync.silentDetach');
|
|
6074
|
-
await this.motif.stopAnimations();
|
|
6075
|
-
await this._base._detachDomWithAnimationAsync();
|
|
6076
|
-
await safeCallAsync(async () => {
|
|
6077
|
-
if (this.isDisposed) {
|
|
6078
|
-
return;
|
|
6079
|
-
}
|
|
6080
|
-
const ctrls = Array.from(this.controls.items);
|
|
6081
|
-
if (ctrls.length) {
|
|
6082
|
-
await Promise.all(ctrls.map(c => safeCallAsync(async () => {
|
|
6083
|
-
await c.disposeAsync({ deep: options?.deep });
|
|
6084
|
-
}, 'disposeAsync.disposeAsyncChildren.handler')));
|
|
6085
|
-
}
|
|
6086
|
-
}, 'disposeAsync.disposeAsyncChildren');
|
|
6087
|
-
this.isDisposed = true;
|
|
6088
|
-
super.dispose();
|
|
6089
|
-
this.controls.items = [];
|
|
6090
|
-
safeCall(() => {
|
|
6091
|
-
ComponentHelper.callDisposed.call(this, this);
|
|
6092
|
-
}, 'disposeAsync.callDisposed');
|
|
6093
|
-
safeCall(() => { this._base.emiters.clear(); }, 'disposeAsync.emiters');
|
|
6094
|
-
if (options?.deep) {
|
|
6095
|
-
this._base._deepCleanup();
|
|
6520
|
+
if (this._disposing) {
|
|
6521
|
+
return this._disposing;
|
|
6096
6522
|
}
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
// } catch { }
|
|
6523
|
+
retireServiceOwner(this);
|
|
6524
|
+
this._disposing = DISPOSE_STARTED;
|
|
6525
|
+
return this._disposing = this._disposeCore(options, true);
|
|
6101
6526
|
}
|
|
6102
6527
|
async _clear() {
|
|
6103
6528
|
if (this.isDisposed == true) {
|
|
@@ -6127,39 +6552,59 @@
|
|
|
6127
6552
|
}
|
|
6128
6553
|
});
|
|
6129
6554
|
}
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
const idx = this.parent.controls.items.indexOf(this);
|
|
6136
|
-
return this.parent.controls.items[idx + 1];
|
|
6137
|
-
},
|
|
6138
|
-
prev: () => {
|
|
6139
|
-
if (!this.parent)
|
|
6140
|
-
return undefined;
|
|
6141
|
-
const idx = this.parent.controls.items.indexOf(this);
|
|
6142
|
-
return this.parent.controls.items[idx - 1];
|
|
6143
|
-
},
|
|
6144
|
-
nextAll: () => {
|
|
6145
|
-
if (!this.parent)
|
|
6146
|
-
return undefined;
|
|
6147
|
-
const idx = this.parent.controls.items.indexOf(this);
|
|
6148
|
-
return this.parent.controls.items.slice(idx + 1);
|
|
6149
|
-
},
|
|
6150
|
-
prevAll: () => {
|
|
6151
|
-
if (!this.parent)
|
|
6152
|
-
return undefined;
|
|
6153
|
-
const idx = this.parent.controls.items.indexOf(this);
|
|
6154
|
-
return this.parent.controls.items.slice(0, idx);
|
|
6555
|
+
_siblingsApi;
|
|
6556
|
+
_siblingsSet;
|
|
6557
|
+
get siblings() {
|
|
6558
|
+
if (this._siblingsSet) {
|
|
6559
|
+
return this._siblingsApi;
|
|
6155
6560
|
}
|
|
6156
|
-
|
|
6561
|
+
if (this.isDisposed && !this.motif?.options) {
|
|
6562
|
+
return this._siblingsApi;
|
|
6563
|
+
}
|
|
6564
|
+
return this._siblingsApi ??= this._createSiblingsApi();
|
|
6565
|
+
}
|
|
6566
|
+
set siblings(value) {
|
|
6567
|
+
this._siblingsApi = value;
|
|
6568
|
+
this._siblingsSet = true;
|
|
6569
|
+
}
|
|
6570
|
+
_createSiblingsApi() {
|
|
6571
|
+
return {
|
|
6572
|
+
all: () => { return this.parent?.controls.items; },
|
|
6573
|
+
next: () => {
|
|
6574
|
+
if (!this.parent)
|
|
6575
|
+
return undefined;
|
|
6576
|
+
const idx = this.parent.controls.items.indexOf(this);
|
|
6577
|
+
return this.parent.controls.items[idx + 1];
|
|
6578
|
+
},
|
|
6579
|
+
prev: () => {
|
|
6580
|
+
if (!this.parent)
|
|
6581
|
+
return undefined;
|
|
6582
|
+
const idx = this.parent.controls.items.indexOf(this);
|
|
6583
|
+
return this.parent.controls.items[idx - 1];
|
|
6584
|
+
},
|
|
6585
|
+
nextAll: () => {
|
|
6586
|
+
if (!this.parent)
|
|
6587
|
+
return undefined;
|
|
6588
|
+
const idx = this.parent.controls.items.indexOf(this);
|
|
6589
|
+
return this.parent.controls.items.slice(idx + 1);
|
|
6590
|
+
},
|
|
6591
|
+
prevAll: () => {
|
|
6592
|
+
if (!this.parent)
|
|
6593
|
+
return undefined;
|
|
6594
|
+
const idx = this.parent.controls.items.indexOf(this);
|
|
6595
|
+
return this.parent.controls.items.slice(0, idx);
|
|
6596
|
+
}
|
|
6597
|
+
};
|
|
6598
|
+
}
|
|
6157
6599
|
get serviceProvider() {
|
|
6158
6600
|
let c = this;
|
|
6159
6601
|
while (c) {
|
|
6160
6602
|
const p = c.provider;
|
|
6161
6603
|
if (p)
|
|
6162
6604
|
return p;
|
|
6605
|
+
const recorded = teardownApplications.get(c);
|
|
6606
|
+
if (recorded)
|
|
6607
|
+
return recorded.state === 'disposed' ? null : recorded.provider;
|
|
6163
6608
|
c = c.parent;
|
|
6164
6609
|
}
|
|
6165
6610
|
try {
|
|
@@ -6235,14 +6680,15 @@
|
|
|
6235
6680
|
return result;
|
|
6236
6681
|
}
|
|
6237
6682
|
async _stopAnimations() {
|
|
6683
|
+
const t = peekTransition(this);
|
|
6238
6684
|
try {
|
|
6239
|
-
|
|
6685
|
+
t?.activeCssCancel?.();
|
|
6240
6686
|
}
|
|
6241
6687
|
catch { }
|
|
6242
6688
|
try {
|
|
6243
|
-
if (
|
|
6689
|
+
if (t?.activeAnimations?.length) {
|
|
6244
6690
|
try {
|
|
6245
|
-
await Promise.all(
|
|
6691
|
+
await Promise.all(t.activeAnimations.map(a => a.finished?.catch(() => { })));
|
|
6246
6692
|
}
|
|
6247
6693
|
catch { /* ignore */ }
|
|
6248
6694
|
}
|
|
@@ -6251,7 +6697,8 @@
|
|
|
6251
6697
|
}
|
|
6252
6698
|
if (this.isDisposed)
|
|
6253
6699
|
return;
|
|
6254
|
-
|
|
6700
|
+
if (t)
|
|
6701
|
+
t.activeAnimations = [];
|
|
6255
6702
|
}
|
|
6256
6703
|
}
|
|
6257
6704
|
function findContentBlocks(root, results = []) {
|
|
@@ -6266,8 +6713,10 @@
|
|
|
6266
6713
|
return results;
|
|
6267
6714
|
}
|
|
6268
6715
|
async function disposeContentBlocks(root) {
|
|
6269
|
-
|
|
6270
|
-
|
|
6716
|
+
if (contentBlocks.live === 0)
|
|
6717
|
+
return;
|
|
6718
|
+
const contentBlocks$1 = findContentBlocks(root);
|
|
6719
|
+
return await Promise.all(contentBlocks$1.map(async (block) => {
|
|
6271
6720
|
block.motif.options.transition.skipNextLeave = root.motif.options.transition.skipNextLeave;
|
|
6272
6721
|
for (const element of block.controls.items) {
|
|
6273
6722
|
element.motif.options.transition.skipNextLeave = block.motif.options.transition.skipNextLeave;
|
|
@@ -6322,7 +6771,7 @@
|
|
|
6322
6771
|
runover.ref = component;
|
|
6323
6772
|
}
|
|
6324
6773
|
}
|
|
6325
|
-
return [].concat(...refs);
|
|
6774
|
+
return refs.length === 0 ? refs : [].concat(...refs);
|
|
6326
6775
|
}
|
|
6327
6776
|
const LIFECYCLE_HANDLER_LISTS = {
|
|
6328
6777
|
'initializecomponent': '_initializeComponentHandlers',
|
|
@@ -6365,6 +6814,8 @@
|
|
|
6365
6814
|
Object.assign(component.motif.options.props, props);
|
|
6366
6815
|
}
|
|
6367
6816
|
var keys = Object.keys(props);
|
|
6817
|
+
if (keys.length === 0)
|
|
6818
|
+
return;
|
|
6368
6819
|
keys.forEach(key => {
|
|
6369
6820
|
if (key == 'initializeComponent' || key == 'oninitializeComponent' || key.startsWith('on')) {
|
|
6370
6821
|
if (collectLifecycleHandlers(component, key.toLowerCase(), props[key])) {
|
|
@@ -6435,7 +6886,18 @@
|
|
|
6435
6886
|
if (typeof value.name === 'string' && value.name.length > 0) {
|
|
6436
6887
|
transition.name = value.name;
|
|
6437
6888
|
}
|
|
6438
|
-
|
|
6889
|
+
if (!('mode' in value)) {
|
|
6890
|
+
transition.classes = value;
|
|
6891
|
+
}
|
|
6892
|
+
else {
|
|
6893
|
+
const { mode, ...classes } = value;
|
|
6894
|
+
if (isTransitionMode(mode)) {
|
|
6895
|
+
transition.mode = mode;
|
|
6896
|
+
}
|
|
6897
|
+
if (Object.keys(classes).length > 0) {
|
|
6898
|
+
transition.classes = classes;
|
|
6899
|
+
}
|
|
6900
|
+
}
|
|
6439
6901
|
}
|
|
6440
6902
|
else if (live) {
|
|
6441
6903
|
transition.name = '';
|
|
@@ -6487,17 +6949,46 @@
|
|
|
6487
6949
|
'ref', 'key', 'indexkey', 'inject', 'options', 'props', 'settings', 'isSvg',
|
|
6488
6950
|
'childs', 'initializeComponent', 'runover', 'transition', 'preconfig', 'nodes', 'onElementCreating'
|
|
6489
6951
|
]);
|
|
6952
|
+
const SPREAD_HTML_KEYS = new Set(['innerhtml', 'srcdoc']);
|
|
6953
|
+
const SPREAD_URL_ATTRIBUTES = new Set(['href', 'src', 'action', 'formaction', 'xlink:href']);
|
|
6954
|
+
const JAVASCRIPT_URL = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;
|
|
6955
|
+
function isJavascriptUrl(value) {
|
|
6956
|
+
if (value === undefined || value === null || typeof value === 'boolean')
|
|
6957
|
+
return false;
|
|
6958
|
+
try {
|
|
6959
|
+
return JAVASCRIPT_URL.test(String(value));
|
|
6960
|
+
}
|
|
6961
|
+
catch {
|
|
6962
|
+
return false;
|
|
6963
|
+
}
|
|
6964
|
+
}
|
|
6965
|
+
function guardSpreadUrl(key, read) {
|
|
6966
|
+
return () => {
|
|
6967
|
+
let value = read();
|
|
6968
|
+
if (typeof value === 'function')
|
|
6969
|
+
value = value();
|
|
6970
|
+
if (typeof value === 'function')
|
|
6971
|
+
value = value();
|
|
6972
|
+
if (!isJavascriptUrl(value))
|
|
6973
|
+
return value;
|
|
6974
|
+
reportWarning('MJX125', [key]);
|
|
6975
|
+
return null;
|
|
6976
|
+
};
|
|
6977
|
+
}
|
|
6490
6978
|
function applyPlainElementProps(props, component) {
|
|
6491
6979
|
if (!props || typeof props !== 'object' || component.isDisposed)
|
|
6492
6980
|
return;
|
|
6493
|
-
const
|
|
6494
|
-
|
|
6495
|
-
|
|
6981
|
+
const keys = Object.keys(props);
|
|
6982
|
+
if (keys.length === 0)
|
|
6983
|
+
return;
|
|
6984
|
+
let attrs = null;
|
|
6985
|
+
let applied = null;
|
|
6986
|
+
for (const key of keys) {
|
|
6496
6987
|
if (PLAIN_ELEMENT_SKIP.has(key))
|
|
6497
6988
|
continue;
|
|
6498
6989
|
if (key.startsWith('x-') || key.startsWith('x:') || key.startsWith('__'))
|
|
6499
6990
|
continue;
|
|
6500
|
-
|
|
6991
|
+
let v = props[key];
|
|
6501
6992
|
if (v === undefined)
|
|
6502
6993
|
continue;
|
|
6503
6994
|
if (/^on/i.test(key)) {
|
|
@@ -6507,7 +6998,21 @@
|
|
|
6507
6998
|
}
|
|
6508
6999
|
if (typeof v === 'function' && v.length > 0)
|
|
6509
7000
|
continue;
|
|
6510
|
-
|
|
7001
|
+
const lowerKey = key.toLowerCase();
|
|
7002
|
+
if (SPREAD_HTML_KEYS.has(lowerKey)) {
|
|
7003
|
+
reportWarning('MJX124', [key]);
|
|
7004
|
+
continue;
|
|
7005
|
+
}
|
|
7006
|
+
if (SPREAD_URL_ATTRIBUTES.has(lowerKey)) {
|
|
7007
|
+
if (typeof v === 'function') {
|
|
7008
|
+
v = guardSpreadUrl(key, v);
|
|
7009
|
+
}
|
|
7010
|
+
else if (isJavascriptUrl(v)) {
|
|
7011
|
+
reportWarning('MJX125', [key]);
|
|
7012
|
+
continue;
|
|
7013
|
+
}
|
|
7014
|
+
}
|
|
7015
|
+
(applied ??= appliedDomProps(component)).set(key, v);
|
|
6511
7016
|
if (key === 'class' || key === 'className') {
|
|
6512
7017
|
component.class.add(v && typeof v === 'object' && !Array.isArray(v) ? [v] : v);
|
|
6513
7018
|
}
|
|
@@ -6518,10 +7023,10 @@
|
|
|
6518
7023
|
component.bindings.add(key, v);
|
|
6519
7024
|
}
|
|
6520
7025
|
else {
|
|
6521
|
-
attrs[key] = v;
|
|
7026
|
+
(attrs ??= {})[key] = v;
|
|
6522
7027
|
}
|
|
6523
7028
|
}
|
|
6524
|
-
if (
|
|
7029
|
+
if (attrs)
|
|
6525
7030
|
component.attr.add(attrs);
|
|
6526
7031
|
}
|
|
6527
7032
|
const _appliedDomProps = new WeakMap();
|
|
@@ -6541,8 +7046,8 @@
|
|
|
6541
7046
|
function applyFallthroughProps(props, component) {
|
|
6542
7047
|
if (!props || typeof props !== 'object' || component.isDisposed)
|
|
6543
7048
|
return;
|
|
6544
|
-
const applied =
|
|
6545
|
-
|
|
7049
|
+
const applied = _appliedDomProps.get(component);
|
|
7050
|
+
let subset = null;
|
|
6546
7051
|
for (const key of Object.keys(props)) {
|
|
6547
7052
|
if (!isFallthroughKey(key))
|
|
6548
7053
|
continue;
|
|
@@ -6551,11 +7056,11 @@
|
|
|
6551
7056
|
continue;
|
|
6552
7057
|
if (typeof v === 'function' && v.length > 0)
|
|
6553
7058
|
continue;
|
|
6554
|
-
if (applied.has(key) && Object.is(applied.get(key), v))
|
|
7059
|
+
if (applied && applied.has(key) && Object.is(applied.get(key), v))
|
|
6555
7060
|
continue;
|
|
6556
|
-
subset[key] = v;
|
|
7061
|
+
(subset ??= {})[key] = v;
|
|
6557
7062
|
}
|
|
6558
|
-
if (
|
|
7063
|
+
if (subset)
|
|
6559
7064
|
applyPlainElementProps(subset, component);
|
|
6560
7065
|
}
|
|
6561
7066
|
const componentMethods = {
|
|
@@ -6687,6 +7192,9 @@
|
|
|
6687
7192
|
}
|
|
6688
7193
|
if (elementOrParams instanceof Function) {
|
|
6689
7194
|
elementOrParams = resolveComponent(elementOrParams, options);
|
|
7195
|
+
if (isOptionsObject(elementOrParams)) {
|
|
7196
|
+
return materializeOptionsObject(elementOrParams, options);
|
|
7197
|
+
}
|
|
6690
7198
|
}
|
|
6691
7199
|
if (Array.isArray(elementOrParams)) {
|
|
6692
7200
|
const letter = CreateFragment();
|
|
@@ -6876,6 +7384,40 @@
|
|
|
6876
7384
|
}
|
|
6877
7385
|
return new Component(element, props);
|
|
6878
7386
|
}
|
|
7387
|
+
function isOptionsObject(value) {
|
|
7388
|
+
return typeof value == "object" && value !== null && !(value instanceof ComponentBase) && 'el' in value;
|
|
7389
|
+
}
|
|
7390
|
+
function unwrapModule(result) {
|
|
7391
|
+
if (result && typeof result === "object" && !(result instanceof ComponentBase) && result.default != null) {
|
|
7392
|
+
return result.default;
|
|
7393
|
+
}
|
|
7394
|
+
return result;
|
|
7395
|
+
}
|
|
7396
|
+
function describeLoaded(value) {
|
|
7397
|
+
if (value === null)
|
|
7398
|
+
return 'null';
|
|
7399
|
+
if (Array.isArray(value))
|
|
7400
|
+
return 'array';
|
|
7401
|
+
if (typeof value === "object" && (Object.prototype.toString.call(value) === '[object Module]' || value.__esModule))
|
|
7402
|
+
return 'module';
|
|
7403
|
+
return typeof value;
|
|
7404
|
+
}
|
|
7405
|
+
function assertLoadedComponent(value) {
|
|
7406
|
+
if (value === null || typeof value !== "object")
|
|
7407
|
+
return;
|
|
7408
|
+
if (value instanceof ComponentBase || Array.isArray(value) || value instanceof Node)
|
|
7409
|
+
return;
|
|
7410
|
+
if (typeof value.then === "function")
|
|
7411
|
+
return;
|
|
7412
|
+
throw motifError('MJX127', describeLoaded(value));
|
|
7413
|
+
}
|
|
7414
|
+
function resolveToComponent(input, props) {
|
|
7415
|
+
const resolved = resolveComponent(input, props);
|
|
7416
|
+
if (isOptionsObject(resolved)) {
|
|
7417
|
+
return materializeOptionsObject(resolved, undefined);
|
|
7418
|
+
}
|
|
7419
|
+
return resolved;
|
|
7420
|
+
}
|
|
6879
7421
|
function materializeOptionsObject(spec, props) {
|
|
6880
7422
|
const result = motifComponent(spec.el, props);
|
|
6881
7423
|
Object.getOwnPropertyNames(spec).forEach(key => {
|
|
@@ -7074,7 +7616,6 @@
|
|
|
7074
7616
|
}
|
|
7075
7617
|
|
|
7076
7618
|
// import { dom } from "../browser";
|
|
7077
|
-
// import { effect } from "../store";
|
|
7078
7619
|
class ControlCollection {
|
|
7079
7620
|
owner;
|
|
7080
7621
|
constructor(owner) {
|
|
@@ -7082,9 +7623,16 @@
|
|
|
7082
7623
|
}
|
|
7083
7624
|
items = [];
|
|
7084
7625
|
add() {
|
|
7085
|
-
const
|
|
7086
|
-
if (
|
|
7626
|
+
const count = arguments.length;
|
|
7627
|
+
if (count === 0)
|
|
7087
7628
|
return [];
|
|
7629
|
+
const first = arguments[0];
|
|
7630
|
+
if (count === 1 && first instanceof ComponentBase) {
|
|
7631
|
+
if (first.isDisposed)
|
|
7632
|
+
return [];
|
|
7633
|
+
return [this._insertOne(undefined, first)];
|
|
7634
|
+
}
|
|
7635
|
+
const args = Array.from(arguments);
|
|
7088
7636
|
if (typeof args[0] === 'number' && args.length > 1) {
|
|
7089
7637
|
const index = args[0];
|
|
7090
7638
|
const children = [].concat(...args.slice(1));
|
|
@@ -7097,42 +7645,44 @@
|
|
|
7097
7645
|
}
|
|
7098
7646
|
insert(index, ...controls) {
|
|
7099
7647
|
const flat = [].concat(...controls);
|
|
7100
|
-
return flat.filter(x => x != undefined && !x.isDisposed).map(control =>
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
pendingLeave.promise.then(() => {
|
|
7121
|
-
if (control.isDisposed || this.owner.isDisposed || control.parent !== this.owner)
|
|
7122
|
-
return;
|
|
7123
|
-
if (this.onAdd && this.owner.isBuilt)
|
|
7124
|
-
this.onAdd(control);
|
|
7125
|
-
});
|
|
7126
|
-
return control;
|
|
7127
|
-
}
|
|
7128
|
-
if (this.onAdd && this.owner.isBuilt) {
|
|
7129
|
-
this.onAdd(control);
|
|
7130
|
-
}
|
|
7648
|
+
return flat.filter(x => x != undefined && !x.isDisposed).map(control => this._insertOne(index, control));
|
|
7649
|
+
}
|
|
7650
|
+
_insertOne(index, control) {
|
|
7651
|
+
control = resolveComponent(control);
|
|
7652
|
+
if (typeof control == 'string' || typeof control == 'number' || typeof control == 'boolean' || typeof control == 'bigint') {
|
|
7653
|
+
control = new Component(dom.createTextNode(control), null);
|
|
7654
|
+
}
|
|
7655
|
+
checkReservedMembers(control);
|
|
7656
|
+
if (control.parent) {
|
|
7657
|
+
control.parent.controls.detach(control);
|
|
7658
|
+
}
|
|
7659
|
+
if (index != undefined && index >= 0) {
|
|
7660
|
+
this.items.splice(index, 0, control);
|
|
7661
|
+
}
|
|
7662
|
+
else {
|
|
7663
|
+
this.items.push(control);
|
|
7664
|
+
}
|
|
7665
|
+
control.parent = this.owner;
|
|
7666
|
+
const pendingLeave = control.__pendingLeave;
|
|
7667
|
+
if (pendingLeave) {
|
|
7131
7668
|
if (this.onAddBeforeBuild && !this.owner.isBuilt) {
|
|
7132
7669
|
this.onAddBeforeBuild(control);
|
|
7133
7670
|
}
|
|
7671
|
+
pendingLeave.promise.then(() => {
|
|
7672
|
+
if (control.isDisposed || this.owner.isDisposed || control.parent !== this.owner)
|
|
7673
|
+
return;
|
|
7674
|
+
if (this.onAdd && this.owner.isBuilt)
|
|
7675
|
+
this.onAdd(control);
|
|
7676
|
+
});
|
|
7134
7677
|
return control;
|
|
7135
|
-
}
|
|
7678
|
+
}
|
|
7679
|
+
if (this.onAdd && this.owner.isBuilt) {
|
|
7680
|
+
this.onAdd(control);
|
|
7681
|
+
}
|
|
7682
|
+
if (this.onAddBeforeBuild && !this.owner.isBuilt) {
|
|
7683
|
+
this.onAddBeforeBuild(control);
|
|
7684
|
+
}
|
|
7685
|
+
return control;
|
|
7136
7686
|
}
|
|
7137
7687
|
remove(control) {
|
|
7138
7688
|
var index = this.items.indexOf(control);
|
|
@@ -7151,6 +7701,7 @@
|
|
|
7151
7701
|
this.items.splice(index, 1);
|
|
7152
7702
|
if (control.isDisposed)
|
|
7153
7703
|
return Promise.resolve();
|
|
7704
|
+
control._base && (control._base._leaveContainer = this.owner);
|
|
7154
7705
|
control.parent = null;
|
|
7155
7706
|
return runLeaveThenDetach(control, () => { if (this.onRemove)
|
|
7156
7707
|
this.onRemove(control); });
|
|
@@ -7180,6 +7731,7 @@
|
|
|
7180
7731
|
if (index === -1)
|
|
7181
7732
|
return;
|
|
7182
7733
|
this.items.splice(index, 1);
|
|
7734
|
+
control._base && (control._base._leaveContainer = this.owner);
|
|
7183
7735
|
control.parent = null;
|
|
7184
7736
|
}
|
|
7185
7737
|
async clearAsync() {
|
|
@@ -7442,7 +7994,12 @@
|
|
|
7442
7994
|
arrive();
|
|
7443
7995
|
};
|
|
7444
7996
|
try {
|
|
7445
|
-
c.motif.options
|
|
7997
|
+
const opts = c.motif.options;
|
|
7998
|
+
if (!opts[TRANSITION_SLOT] && !opts.transitionOut) {
|
|
7999
|
+
once();
|
|
8000
|
+
return;
|
|
8001
|
+
}
|
|
8002
|
+
opts.transition.leaveTransition(once);
|
|
7446
8003
|
}
|
|
7447
8004
|
catch {
|
|
7448
8005
|
once();
|
|
@@ -7467,10 +8024,7 @@
|
|
|
7467
8024
|
return { count: 0, delayMs: 0, whenOnline: false };
|
|
7468
8025
|
}
|
|
7469
8026
|
function defaultMapper(result) {
|
|
7470
|
-
|
|
7471
|
-
return result.default;
|
|
7472
|
-
}
|
|
7473
|
-
return result;
|
|
8027
|
+
return unwrapModule(result);
|
|
7474
8028
|
}
|
|
7475
8029
|
function Lazy(props) {
|
|
7476
8030
|
const opts = (props && props.options) || {};
|
|
@@ -7499,7 +8053,7 @@
|
|
|
7499
8053
|
catch { }
|
|
7500
8054
|
const initial = opts.Placeholderview ?? opts.Loaderview;
|
|
7501
8055
|
if (initial != null) {
|
|
7502
|
-
frame.navigate(
|
|
8056
|
+
frame.navigate(resolveToComponent(initial));
|
|
7503
8057
|
}
|
|
7504
8058
|
const attemptLoad = () => {
|
|
7505
8059
|
if (!opts.timeoutMs && !opts.signal) {
|
|
@@ -7625,6 +8179,36 @@
|
|
|
7625
8179
|
};
|
|
7626
8180
|
const loadPromise = retry.count > 0 ? loadWithRetry() : attemptLoad();
|
|
7627
8181
|
const startTs = Date.now();
|
|
8182
|
+
const fail = (err) => {
|
|
8183
|
+
try {
|
|
8184
|
+
opts.onError?.(err);
|
|
8185
|
+
}
|
|
8186
|
+
catch { /* swallow */ }
|
|
8187
|
+
if (opts.signal?.aborted)
|
|
8188
|
+
return;
|
|
8189
|
+
if (opts.Fallbackview != null) {
|
|
8190
|
+
frame.navigate(resolveToComponent(opts.Fallbackview));
|
|
8191
|
+
}
|
|
8192
|
+
else {
|
|
8193
|
+
reportError('MJX126', err);
|
|
8194
|
+
try {
|
|
8195
|
+
frame.motif.clear().catch(() => { });
|
|
8196
|
+
}
|
|
8197
|
+
catch { }
|
|
8198
|
+
}
|
|
8199
|
+
};
|
|
8200
|
+
const place = (target) => {
|
|
8201
|
+
let component;
|
|
8202
|
+
try {
|
|
8203
|
+
component = resolveToComponent(target);
|
|
8204
|
+
assertLoadedComponent(component);
|
|
8205
|
+
}
|
|
8206
|
+
catch (err) {
|
|
8207
|
+
fail(err);
|
|
8208
|
+
return;
|
|
8209
|
+
}
|
|
8210
|
+
frame.navigate(component);
|
|
8211
|
+
};
|
|
7628
8212
|
loadPromise
|
|
7629
8213
|
.then((result) => {
|
|
7630
8214
|
if (opts.signal?.aborted) {
|
|
@@ -7638,7 +8222,7 @@
|
|
|
7638
8222
|
if (remaining > 0) {
|
|
7639
8223
|
const id = trackTimer(setTimeout(() => {
|
|
7640
8224
|
if (!opts.signal?.aborted) {
|
|
7641
|
-
|
|
8225
|
+
place(target);
|
|
7642
8226
|
}
|
|
7643
8227
|
}, remaining));
|
|
7644
8228
|
if (opts.signal) {
|
|
@@ -7654,30 +8238,27 @@
|
|
|
7654
8238
|
}
|
|
7655
8239
|
}
|
|
7656
8240
|
else {
|
|
7657
|
-
|
|
8241
|
+
place(target);
|
|
7658
8242
|
}
|
|
7659
8243
|
})
|
|
7660
|
-
.catch(
|
|
7661
|
-
try {
|
|
7662
|
-
opts.onError?.(err);
|
|
7663
|
-
}
|
|
7664
|
-
catch { /* swallow */ }
|
|
7665
|
-
if (opts.signal?.aborted)
|
|
7666
|
-
return;
|
|
7667
|
-
if (opts.Fallbackview != null) {
|
|
7668
|
-
frame.navigate(resolveComponent(opts.Fallbackview));
|
|
7669
|
-
}
|
|
7670
|
-
else {
|
|
7671
|
-
errorHandler.reportSuppressed('Lazy.load (no Fallbackview)', err);
|
|
7672
|
-
try {
|
|
7673
|
-
frame.motif.clear().catch(() => { });
|
|
7674
|
-
}
|
|
7675
|
-
catch { }
|
|
7676
|
-
}
|
|
7677
|
-
});
|
|
8244
|
+
.catch(fail);
|
|
7678
8245
|
return frame;
|
|
7679
8246
|
}
|
|
7680
8247
|
|
|
8248
|
+
function hasOwnTransition(component, phase) {
|
|
8249
|
+
const options = component?.motif?.options;
|
|
8250
|
+
if (!options)
|
|
8251
|
+
return false;
|
|
8252
|
+
const transition = options.transition;
|
|
8253
|
+
return !!((phase === 'enter' ? options.transitionIn : options.transitionOut) || (transition && (transition.classes || (transition.name && transition.name.length > 0))));
|
|
8254
|
+
}
|
|
8255
|
+
function playsLeave(target) {
|
|
8256
|
+
if (!target)
|
|
8257
|
+
return false;
|
|
8258
|
+
if (Array.isArray(target))
|
|
8259
|
+
return target.some(t => !!t && !t.isDisposed && hasOwnTransition(t, 'leave'));
|
|
8260
|
+
return !target.isDisposed && hasOwnTransition(target, 'leave');
|
|
8261
|
+
}
|
|
7681
8262
|
function cancelAnimationsDeep(target) {
|
|
7682
8263
|
if (!target || target.isDisposed)
|
|
7683
8264
|
return;
|
|
@@ -7713,26 +8294,20 @@
|
|
|
7713
8294
|
}
|
|
7714
8295
|
catch { }
|
|
7715
8296
|
}
|
|
7716
|
-
async function disposeNavigationTarget(target) {
|
|
8297
|
+
async function disposeNavigationTarget(target, options = { deep: true }) {
|
|
7717
8298
|
if (!target)
|
|
7718
8299
|
return;
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
}
|
|
7726
|
-
catch (err) {
|
|
7727
|
-
reportError('MJX115', err);
|
|
7728
|
-
}
|
|
8300
|
+
const list = Array.isArray(target) ? target : [target];
|
|
8301
|
+
await Promise.all(list.map(async (xr) => {
|
|
8302
|
+
if (!xr || xr.isDisposed)
|
|
8303
|
+
return;
|
|
8304
|
+
try {
|
|
8305
|
+
await xr.dispose(options);
|
|
7729
8306
|
}
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
if (!target.isDisposed) {
|
|
7733
|
-
await target.dispose({ deep: true, skipLeaveTransition: true });
|
|
8307
|
+
catch (err) {
|
|
8308
|
+
reportError('MJX115', err);
|
|
7734
8309
|
}
|
|
7735
|
-
}
|
|
8310
|
+
}));
|
|
7736
8311
|
}
|
|
7737
8312
|
async function navigateHost(host, page, keepOldControl = false) {
|
|
7738
8313
|
if (host.isDisposed || page == null)
|
|
@@ -7786,10 +8361,14 @@
|
|
|
7786
8361
|
if (oldPage && !keepOldControl) {
|
|
7787
8362
|
cancelAnimationsDeep(oldPage);
|
|
7788
8363
|
cancelAnimationsDeep(host);
|
|
7789
|
-
|
|
7790
|
-
|
|
8364
|
+
const animated = playsLeave(oldPage);
|
|
8365
|
+
const leaving = disposeNavigationTarget(oldPage);
|
|
8366
|
+
if (animated) {
|
|
8367
|
+
leaving.catch(() => { });
|
|
8368
|
+
}
|
|
8369
|
+
else {
|
|
8370
|
+
await leaving;
|
|
7791
8371
|
}
|
|
7792
|
-
catch { }
|
|
7793
8372
|
}
|
|
7794
8373
|
try {
|
|
7795
8374
|
if (page instanceof Promise) {
|
|
@@ -7825,9 +8404,9 @@
|
|
|
7825
8404
|
this.controls.add(props.childs);
|
|
7826
8405
|
}
|
|
7827
8406
|
}
|
|
7828
|
-
async dispose() {
|
|
7829
|
-
await disposeNavigationTarget(this.current);
|
|
7830
|
-
await super.dispose();
|
|
8407
|
+
async dispose(options = { deep: true }) {
|
|
8408
|
+
await disposeNavigationTarget(this.current, options);
|
|
8409
|
+
await super.dispose(options);
|
|
7831
8410
|
}
|
|
7832
8411
|
async flush() {
|
|
7833
8412
|
await disposeNavigationTarget(this.current);
|
|
@@ -7867,20 +8446,16 @@
|
|
|
7867
8446
|
// } else {
|
|
7868
8447
|
// var cb = ContentBodyCollectionHandable.get(props.target);
|
|
7869
8448
|
// if (cb) {
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
if (cb) {
|
|
7873
|
-
control.motif.options["ownerContentBlock"] = this;
|
|
7874
|
-
cb.controls.add(control);
|
|
7875
|
-
}
|
|
7876
|
-
};
|
|
7877
|
-
this.controls.onAddBeforeBuild = (control) => {
|
|
8449
|
+
const forward = (control) => {
|
|
8450
|
+
this.motif.trigger('controladded', { control });
|
|
7878
8451
|
var cb = ContentBodyCollectionHandable.get(this.props.target);
|
|
7879
8452
|
if (cb) {
|
|
7880
8453
|
control.motif.options["ownerContentBlock"] = this;
|
|
7881
8454
|
cb.controls.add(control);
|
|
7882
8455
|
}
|
|
7883
8456
|
};
|
|
8457
|
+
this.controls.onAdd = forward;
|
|
8458
|
+
this.controls.onAddBeforeBuild = forward;
|
|
7884
8459
|
if (this.childs) {
|
|
7885
8460
|
this.controls.add(...this.childs);
|
|
7886
8461
|
}
|
|
@@ -7924,7 +8499,9 @@
|
|
|
7924
8499
|
this.context.fire(changeBodyCollectionHandler);
|
|
7925
8500
|
}
|
|
7926
8501
|
ondisposing(sender) {
|
|
7927
|
-
ContentBodyCollectionHandable.
|
|
8502
|
+
if (ContentBodyCollectionHandable.get(this.props.name) === this) {
|
|
8503
|
+
ContentBodyCollectionHandable.delete(this.props.name);
|
|
8504
|
+
}
|
|
7928
8505
|
}
|
|
7929
8506
|
}
|
|
7930
8507
|
|
|
@@ -7956,7 +8533,7 @@
|
|
|
7956
8533
|
initializeComponent(sender) {
|
|
7957
8534
|
TransportRegistry.registerSlot(this.props.name, this);
|
|
7958
8535
|
this.onDisposing = () => {
|
|
7959
|
-
(this.controls.items || []).forEach(child => {
|
|
8536
|
+
[...(this.controls.items || [])].forEach(child => {
|
|
7960
8537
|
this.controls.remove(child);
|
|
7961
8538
|
child.dispose?.();
|
|
7962
8539
|
});
|
|
@@ -7964,7 +8541,7 @@
|
|
|
7964
8541
|
};
|
|
7965
8542
|
}
|
|
7966
8543
|
clearSlot() {
|
|
7967
|
-
(this.controls.items || []).forEach(child => {
|
|
8544
|
+
[...(this.controls.items || [])].forEach(child => {
|
|
7968
8545
|
this.controls.remove(child);
|
|
7969
8546
|
child.dispose?.();
|
|
7970
8547
|
});
|
|
@@ -7978,7 +8555,7 @@
|
|
|
7978
8555
|
if (child.parent === newParent && newParent.controls.items.includes(child))
|
|
7979
8556
|
return;
|
|
7980
8557
|
if (child.parent && child.parent !== newParent) {
|
|
7981
|
-
child.parent.controls.
|
|
8558
|
+
child.parent.controls.silentDetach(child, true);
|
|
7982
8559
|
}
|
|
7983
8560
|
if (options.owner) {
|
|
7984
8561
|
child.motif.options.ownerTransporter = options.owner;
|
|
@@ -8041,8 +8618,11 @@
|
|
|
8041
8618
|
_slotRegisteredListener;
|
|
8042
8619
|
_slotUnregisteredListener;
|
|
8043
8620
|
_transported = [];
|
|
8621
|
+
_countedLive = false;
|
|
8044
8622
|
constructor(props) {
|
|
8045
8623
|
super('div', props);
|
|
8624
|
+
contentBlocks.live++;
|
|
8625
|
+
this._countedLive = true;
|
|
8046
8626
|
}
|
|
8047
8627
|
_handleSlotChange = (eventArgs) => {
|
|
8048
8628
|
if (eventArgs.name === this.props.name) {
|
|
@@ -8052,9 +8632,17 @@
|
|
|
8052
8632
|
}
|
|
8053
8633
|
const all = [...(this.childs || []), ...this.controls.items];
|
|
8054
8634
|
Transporter.transportMany(all, slot);
|
|
8055
|
-
this.
|
|
8635
|
+
this._rememberTransported(all);
|
|
8056
8636
|
}
|
|
8057
8637
|
};
|
|
8638
|
+
_rememberTransported(children) {
|
|
8639
|
+
const kept = this._transported.filter(c => !c.isDisposed);
|
|
8640
|
+
for (const child of children) {
|
|
8641
|
+
if (!kept.includes(child))
|
|
8642
|
+
kept.push(child);
|
|
8643
|
+
}
|
|
8644
|
+
this._transported = kept;
|
|
8645
|
+
}
|
|
8058
8646
|
_clearChildrenFromSlot = (slot) => {
|
|
8059
8647
|
(this.childs || []).forEach(child => {
|
|
8060
8648
|
slot.controls.remove(child);
|
|
@@ -8073,7 +8661,7 @@
|
|
|
8073
8661
|
}
|
|
8074
8662
|
const all = [...(this.childs || []), ...this.controls.items];
|
|
8075
8663
|
Transporter.transportMany(all, slot);
|
|
8076
|
-
this.
|
|
8664
|
+
this._rememberTransported(all);
|
|
8077
8665
|
}
|
|
8078
8666
|
this._slotRegisteredListener = Application.main.on(SLOT_REGISTERED_EVENT, this._handleSlotChange);
|
|
8079
8667
|
this._slotUnregisteredListener = Application.main.on(SLOT_UNREGISTERED_EVENT, (eventArgs) => {
|
|
@@ -8082,9 +8670,11 @@
|
|
|
8082
8670
|
}
|
|
8083
8671
|
});
|
|
8084
8672
|
this._onAddRef = (child) => {
|
|
8673
|
+
this.motif.trigger('controladded', { control: child });
|
|
8085
8674
|
const currentSlot = TransportRegistry.getSlot(this.props.name);
|
|
8086
8675
|
if (currentSlot) {
|
|
8087
8676
|
Transporter.transport(child, currentSlot);
|
|
8677
|
+
this._rememberTransported([child]);
|
|
8088
8678
|
}
|
|
8089
8679
|
};
|
|
8090
8680
|
this._onRemoveRef = (child) => {
|
|
@@ -8092,17 +8682,20 @@
|
|
|
8092
8682
|
if (currentSlot) {
|
|
8093
8683
|
currentSlot.controls.remove(child);
|
|
8094
8684
|
}
|
|
8685
|
+
this._transported = this._transported.filter(c => c !== child);
|
|
8095
8686
|
};
|
|
8096
8687
|
this.controls.onAdd = this._onAddRef;
|
|
8097
8688
|
this.controls.onRemove = this._onRemoveRef;
|
|
8098
8689
|
}
|
|
8099
8690
|
onDisposing(sender, e) {
|
|
8691
|
+
if (this._countedLive) {
|
|
8692
|
+
this._countedLive = false;
|
|
8693
|
+
contentBlocks.live--;
|
|
8694
|
+
}
|
|
8100
8695
|
const currentSlot = TransportRegistry.getSlot(this.props.name);
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
child.dispose();
|
|
8105
|
-
});
|
|
8696
|
+
for (const child of this._transported || []) {
|
|
8697
|
+
currentSlot?.controls.remove(child);
|
|
8698
|
+
child.dispose();
|
|
8106
8699
|
}
|
|
8107
8700
|
if (this._slotRegisteredListener) {
|
|
8108
8701
|
Application.main.off(SLOT_REGISTERED_EVENT, this._handleSlotChange);
|
|
@@ -8125,14 +8718,14 @@
|
|
|
8125
8718
|
const ARRAY_MUTATORS = new Set(['push', 'pop', 'shift', 'unshift', 'splice', 'reverse', 'sort']);
|
|
8126
8719
|
const NOT_META = Symbol('');
|
|
8127
8720
|
const metaReaders = new Map([
|
|
8128
|
-
[
|
|
8129
|
-
[
|
|
8130
|
-
[
|
|
8131
|
-
[
|
|
8132
|
-
[
|
|
8721
|
+
[Flags.IS_REACTIVE, () => true],
|
|
8722
|
+
[Flags.IS_READONLY, engine => engine.isReadonly],
|
|
8723
|
+
[Flags.IS_SUPERFICIAL, engine => engine.superficial],
|
|
8724
|
+
[Flags.GET_SETUP, (_engine, target) => target],
|
|
8725
|
+
[Flags.RAW, (engine, target, receiver) => engine.ReactiveMap().get(target) === receiver ? target : NOT_META],
|
|
8133
8726
|
]);
|
|
8134
8727
|
function readMeta(engine, target, key, receiver) {
|
|
8135
|
-
if (typeof key !== '
|
|
8728
|
+
if (typeof key !== 'symbol')
|
|
8136
8729
|
return NOT_META;
|
|
8137
8730
|
const reader = metaReaders.get(key);
|
|
8138
8731
|
return reader === undefined ? NOT_META : reader(engine, target, receiver);
|
|
@@ -8313,6 +8906,144 @@
|
|
|
8313
8906
|
}
|
|
8314
8907
|
}
|
|
8315
8908
|
|
|
8909
|
+
const KEYS_KEY = Symbol('');
|
|
8910
|
+
function changed(target, key, keysChanged) {
|
|
8911
|
+
trigger(target, key);
|
|
8912
|
+
trigger(target, ITERATE_KEY);
|
|
8913
|
+
if (keysChanged)
|
|
8914
|
+
trigger(target, KEYS_KEY);
|
|
8915
|
+
}
|
|
8916
|
+
function lookupKey(target, key) {
|
|
8917
|
+
return target.has(key) ? key : getRaw(key);
|
|
8918
|
+
}
|
|
8919
|
+
function wrapIterator(source, convert) {
|
|
8920
|
+
return {
|
|
8921
|
+
next() {
|
|
8922
|
+
const step = source.next();
|
|
8923
|
+
return step.done ? step : { value: convert(step.value), done: false };
|
|
8924
|
+
},
|
|
8925
|
+
[Symbol.iterator]() {
|
|
8926
|
+
return this;
|
|
8927
|
+
},
|
|
8928
|
+
};
|
|
8929
|
+
}
|
|
8930
|
+
function createCollectionMethods(engine) {
|
|
8931
|
+
const wrap = (value) => isObject(value) ? engine.reactive(value) : value;
|
|
8932
|
+
const wrapEntry = (target) => target instanceof Map
|
|
8933
|
+
? ([key, value]) => [key, wrap(value)]
|
|
8934
|
+
: ([value]) => { const item = wrap(value); return [item, item]; };
|
|
8935
|
+
return {
|
|
8936
|
+
get(key) {
|
|
8937
|
+
const target = getRaw(this);
|
|
8938
|
+
const found = lookupKey(target, key);
|
|
8939
|
+
track(target, found);
|
|
8940
|
+
return wrap(target.get(found));
|
|
8941
|
+
},
|
|
8942
|
+
has(key) {
|
|
8943
|
+
const target = getRaw(this);
|
|
8944
|
+
const found = lookupKey(target, key);
|
|
8945
|
+
track(target, found);
|
|
8946
|
+
return target.has(found);
|
|
8947
|
+
},
|
|
8948
|
+
set(key, value) {
|
|
8949
|
+
const target = getRaw(this);
|
|
8950
|
+
const stored = lookupKey(target, key);
|
|
8951
|
+
const raw = getRaw(value);
|
|
8952
|
+
const existed = target.has(stored);
|
|
8953
|
+
const previous = target.get(stored);
|
|
8954
|
+
target.set(stored, raw);
|
|
8955
|
+
if (!existed)
|
|
8956
|
+
changed(target, stored, true);
|
|
8957
|
+
else if (!Object.is(previous, raw))
|
|
8958
|
+
changed(target, stored, false);
|
|
8959
|
+
return this;
|
|
8960
|
+
},
|
|
8961
|
+
add(value) {
|
|
8962
|
+
const target = getRaw(this);
|
|
8963
|
+
const stored = lookupKey(target, value);
|
|
8964
|
+
if (!target.has(stored)) {
|
|
8965
|
+
target.add(stored);
|
|
8966
|
+
changed(target, stored, true);
|
|
8967
|
+
}
|
|
8968
|
+
return this;
|
|
8969
|
+
},
|
|
8970
|
+
delete(key) {
|
|
8971
|
+
const target = getRaw(this);
|
|
8972
|
+
const found = lookupKey(target, key);
|
|
8973
|
+
const removed = target.delete(found);
|
|
8974
|
+
if (removed)
|
|
8975
|
+
changed(target, found, true);
|
|
8976
|
+
return removed;
|
|
8977
|
+
},
|
|
8978
|
+
clear() {
|
|
8979
|
+
const target = getRaw(this);
|
|
8980
|
+
if (target.size === 0)
|
|
8981
|
+
return;
|
|
8982
|
+
const keys = Array.from(target.keys());
|
|
8983
|
+
target.clear();
|
|
8984
|
+
for (const key of keys)
|
|
8985
|
+
trigger(target, key);
|
|
8986
|
+
trigger(target, ITERATE_KEY);
|
|
8987
|
+
trigger(target, KEYS_KEY);
|
|
8988
|
+
},
|
|
8989
|
+
forEach(callback, thisArg) {
|
|
8990
|
+
const target = getRaw(this);
|
|
8991
|
+
track(target, ITERATE_KEY);
|
|
8992
|
+
const owner = this;
|
|
8993
|
+
const isMap = target instanceof Map;
|
|
8994
|
+
target.forEach((value, key) => {
|
|
8995
|
+
const item = wrap(value);
|
|
8996
|
+
callback.call(thisArg, item, isMap ? key : item, owner);
|
|
8997
|
+
});
|
|
8998
|
+
},
|
|
8999
|
+
keys() {
|
|
9000
|
+
const target = getRaw(this);
|
|
9001
|
+
if (target instanceof Map) {
|
|
9002
|
+
track(target, KEYS_KEY);
|
|
9003
|
+
return target.keys();
|
|
9004
|
+
}
|
|
9005
|
+
track(target, ITERATE_KEY);
|
|
9006
|
+
return wrapIterator(target.keys(), wrap);
|
|
9007
|
+
},
|
|
9008
|
+
values() {
|
|
9009
|
+
const target = getRaw(this);
|
|
9010
|
+
track(target, ITERATE_KEY);
|
|
9011
|
+
return wrapIterator(target.values(), wrap);
|
|
9012
|
+
},
|
|
9013
|
+
entries() {
|
|
9014
|
+
const target = getRaw(this);
|
|
9015
|
+
track(target, ITERATE_KEY);
|
|
9016
|
+
return wrapIterator(target.entries(), wrapEntry(target));
|
|
9017
|
+
},
|
|
9018
|
+
[Symbol.iterator]() {
|
|
9019
|
+
const target = getRaw(this);
|
|
9020
|
+
track(target, ITERATE_KEY);
|
|
9021
|
+
return target instanceof Map
|
|
9022
|
+
? wrapIterator(target.entries(), wrapEntry(target))
|
|
9023
|
+
: wrapIterator(target.values(), wrap);
|
|
9024
|
+
},
|
|
9025
|
+
};
|
|
9026
|
+
}
|
|
9027
|
+
function createCollectionHandler(engine) {
|
|
9028
|
+
const methods = createCollectionMethods(engine);
|
|
9029
|
+
return {
|
|
9030
|
+
get(target, key, receiver) {
|
|
9031
|
+
const meta = readMeta(engine, target, key, receiver);
|
|
9032
|
+
if (meta !== NOT_META)
|
|
9033
|
+
return meta;
|
|
9034
|
+
if (key === 'size') {
|
|
9035
|
+
track(target, ITERATE_KEY);
|
|
9036
|
+
return target.size;
|
|
9037
|
+
}
|
|
9038
|
+
if ((typeof key === 'string' || key === Symbol.iterator) && hasOwn(methods, key) && key in target) {
|
|
9039
|
+
return methods[key];
|
|
9040
|
+
}
|
|
9041
|
+
const value = Reflect.get(target, key, target);
|
|
9042
|
+
return typeof value === 'function' ? value.bind(target) : value;
|
|
9043
|
+
},
|
|
9044
|
+
};
|
|
9045
|
+
}
|
|
9046
|
+
|
|
8316
9047
|
const ReactiveEngineMapper = new WeakSet();
|
|
8317
9048
|
const AllreactiveMap = new WeakMap();
|
|
8318
9049
|
function armgetter() { return AllreactiveMap; }
|
|
@@ -8351,12 +9082,13 @@
|
|
|
8351
9082
|
deleteProperty: createDelete(),
|
|
8352
9083
|
ownKeys: createOwn()
|
|
8353
9084
|
};
|
|
9085
|
+
collectionHandler = createCollectionHandler(this);
|
|
8354
9086
|
reactive(model) {
|
|
8355
9087
|
if (!isObject(model)) {
|
|
8356
9088
|
model = { value: model };
|
|
8357
9089
|
}
|
|
8358
9090
|
const targetType = getTargetType(model);
|
|
8359
|
-
if (targetType === 0 /* TargetType.SYSTEM */ ||
|
|
9091
|
+
if (targetType === 0 /* TargetType.SYSTEM */ || 0 /* TargetType.INVALID */) {
|
|
8360
9092
|
return model;
|
|
8361
9093
|
}
|
|
8362
9094
|
let existingProxy = AllreactiveMap.get(model);
|
|
@@ -8368,7 +9100,12 @@
|
|
|
8368
9100
|
return existingProxy;
|
|
8369
9101
|
}
|
|
8370
9102
|
// if (targetType === TargetType.INVALID) {
|
|
8371
|
-
if (
|
|
9103
|
+
if (targetType === 2 /* TargetType.COLLECTION */) {
|
|
9104
|
+
var proxy = new Proxy(model, this.collectionHandler);
|
|
9105
|
+
AllreactiveMap.set(model, proxy);
|
|
9106
|
+
return proxy;
|
|
9107
|
+
}
|
|
9108
|
+
else if (Array.isArray(model)) {
|
|
8372
9109
|
var proxy = new Proxy(model, this.arrayHandler);
|
|
8373
9110
|
// var original = Object.getPrototypeOf(proxy);
|
|
8374
9111
|
// original["copy"] = () => { return model; }
|
|
@@ -9410,12 +10147,12 @@
|
|
|
9410
10147
|
function toggle(force) {
|
|
9411
10148
|
if (!overlayHost)
|
|
9412
10149
|
return;
|
|
9413
|
-
visible =
|
|
10150
|
+
visible = !visible;
|
|
9414
10151
|
overlayHost.style.display = visible ? 'block' : 'none';
|
|
9415
10152
|
}
|
|
9416
10153
|
function initOverlayIfEnabled() {
|
|
9417
10154
|
ensureDevtoolsFlagInitialized();
|
|
9418
|
-
if (!
|
|
10155
|
+
if (!isRequestedByFlag())
|
|
9419
10156
|
return;
|
|
9420
10157
|
try {
|
|
9421
10158
|
if (!overlayHost) {
|
|
@@ -9433,9 +10170,6 @@
|
|
|
9433
10170
|
});
|
|
9434
10171
|
on((ev) => { if (ev.type === 'warning' && visible)
|
|
9435
10172
|
render(); });
|
|
9436
|
-
const qs = location.search || '';
|
|
9437
|
-
if (Application.main.isDevelopmentModeEnabled)
|
|
9438
|
-
toggle(true);
|
|
9439
10173
|
}
|
|
9440
10174
|
}
|
|
9441
10175
|
catch { }
|
|
@@ -9793,13 +10527,6 @@
|
|
|
9793
10527
|
const SLIDE_OFFSET = 30;
|
|
9794
10528
|
const EASING = 'cubic-bezier(0.2, 0.8, 0.2, 1)';
|
|
9795
10529
|
const isElement = (node) => !!node && node.nodeType === 1 && !!node.style;
|
|
9796
|
-
function hasOwnTransition(component, phase) {
|
|
9797
|
-
const options = component?.motif?.options;
|
|
9798
|
-
if (!options)
|
|
9799
|
-
return false;
|
|
9800
|
-
const transition = options.transition;
|
|
9801
|
-
return !!((phase === 'enter' ? options.transitionIn : options.transitionOut) || (transition && (transition.classes || (transition.name && transition.name.length > 0))));
|
|
9802
|
-
}
|
|
9803
10530
|
function markDirection(component, direction) {
|
|
9804
10531
|
const el = component?.element;
|
|
9805
10532
|
if (!component || component.isDisposed || !isElement(el))
|
|
@@ -10182,7 +10909,7 @@
|
|
|
10182
10909
|
if (!top || top.isDisposed)
|
|
10183
10910
|
return;
|
|
10184
10911
|
try {
|
|
10185
|
-
await disposeNavigationTarget(top);
|
|
10912
|
+
await disposeNavigationTarget(top, { deep: true, skipLeaveTransition: true });
|
|
10186
10913
|
}
|
|
10187
10914
|
catch (error) {
|
|
10188
10915
|
reportError('MJX307', error);
|
|
@@ -11367,18 +12094,16 @@
|
|
|
11367
12094
|
}
|
|
11368
12095
|
let val = control;
|
|
11369
12096
|
if (val instanceof Promise) {
|
|
11370
|
-
val = await val
|
|
11371
|
-
return result.default ? result.default : result;
|
|
11372
|
-
});
|
|
12097
|
+
val = unwrapModule(await val);
|
|
11373
12098
|
}
|
|
11374
12099
|
instance = this._construct(scope, route, () => this._resolveFrom(scope, val));
|
|
11375
12100
|
if (instance) {
|
|
11376
12101
|
return instance;
|
|
11377
12102
|
}
|
|
11378
12103
|
if (typeof val === 'function') {
|
|
11379
|
-
return this.parseControl(this._construct(scope, route, () =>
|
|
12104
|
+
return this.parseControl(this._construct(scope, route, () => resolveToComponent(val, this.application)), scope, route);
|
|
11380
12105
|
}
|
|
11381
|
-
return val;
|
|
12106
|
+
return resolveToComponent(val);
|
|
11382
12107
|
}
|
|
11383
12108
|
_resolveFrom(scope, token) {
|
|
11384
12109
|
const provider = scope ?? this._rootProvider();
|
|
@@ -11399,6 +12124,7 @@
|
|
|
11399
12124
|
}
|
|
11400
12125
|
async _instanceCreator(control, scope, route) {
|
|
11401
12126
|
let val = await this.parseControl(control, scope, route);
|
|
12127
|
+
assertLoadedComponent(val);
|
|
11402
12128
|
// if (val instanceof Promise) {
|
|
11403
12129
|
// return result.default ? result.default : result;
|
|
11404
12130
|
// if (typeof val === 'function') {
|
|
@@ -12435,10 +13161,11 @@
|
|
|
12435
13161
|
catch { }
|
|
12436
13162
|
this._scroll = null;
|
|
12437
13163
|
this._historyStamp = null;
|
|
13164
|
+
let done = Promise.resolve();
|
|
12438
13165
|
try {
|
|
12439
13166
|
// keepAlive önbelleğindeki örnekleri bırak
|
|
12440
13167
|
try {
|
|
12441
|
-
|
|
13168
|
+
done = this.routingEngine.dispose();
|
|
12442
13169
|
}
|
|
12443
13170
|
catch { }
|
|
12444
13171
|
if (this._navHandler) {
|
|
@@ -12458,6 +13185,7 @@
|
|
|
12458
13185
|
}
|
|
12459
13186
|
}
|
|
12460
13187
|
catch { }
|
|
13188
|
+
return done;
|
|
12461
13189
|
}
|
|
12462
13190
|
}
|
|
12463
13191
|
|
|
@@ -12543,7 +13271,7 @@
|
|
|
12543
13271
|
class ApplicationBuilder {
|
|
12544
13272
|
services = new ServiceCollection();
|
|
12545
13273
|
constructor() {
|
|
12546
|
-
if (_globalApplication || startedApplicationBuilder) {
|
|
13274
|
+
if ((_globalApplication && _globalApplication.state !== 'disposing') || startedApplicationBuilder) {
|
|
12547
13275
|
throw new MotifError('MJX405', formatMotifMessage('MJX405'), { cause: _globalApplication });
|
|
12548
13276
|
}
|
|
12549
13277
|
startedApplicationBuilder = true;
|
|
@@ -12576,6 +13304,12 @@
|
|
|
12576
13304
|
constructor(provider) {
|
|
12577
13305
|
this.provider = provider;
|
|
12578
13306
|
}
|
|
13307
|
+
static _disposingCount = 0;
|
|
13308
|
+
_state = 'initializing';
|
|
13309
|
+
_disposing;
|
|
13310
|
+
get state() {
|
|
13311
|
+
return this._state;
|
|
13312
|
+
}
|
|
12579
13313
|
_middlewares = [];
|
|
12580
13314
|
_beforeEachGuards = [];
|
|
12581
13315
|
_routerState = new RouterState();
|
|
@@ -12602,9 +13336,11 @@
|
|
|
12602
13336
|
target = host;
|
|
12603
13337
|
}
|
|
12604
13338
|
let rootInstance = appRoot;
|
|
13339
|
+
this._state = 'running';
|
|
12605
13340
|
const AppShell = new Component(target);
|
|
12606
13341
|
this.appShell = AppShell;
|
|
12607
13342
|
safeCallSilent(() => {
|
|
13343
|
+
AppShell._keepElementOnDispose = true;
|
|
12608
13344
|
AppShell.application = this;
|
|
12609
13345
|
AppShell.provider = this.provider;
|
|
12610
13346
|
}, 'Application.run.setupAppShell');
|
|
@@ -12639,10 +13375,14 @@
|
|
|
12639
13375
|
this.appShell.element?.appendChild(component);
|
|
12640
13376
|
}
|
|
12641
13377
|
dispose() {
|
|
13378
|
+
if (this._disposing)
|
|
13379
|
+
return this._disposing;
|
|
13380
|
+
this._state = 'disposing';
|
|
13381
|
+
Application._disposingCount++;
|
|
12642
13382
|
startedApplicationBuilder = false;
|
|
13383
|
+
let routerDone;
|
|
12643
13384
|
safeCallSilent(() => { this._removeLifecycleListeners(); }, 'Application.dispose.lifecycle');
|
|
12644
|
-
safeCallSilent(() => { this.urlRoutingModule?.dispose?.(); }, 'Application.dispose.router');
|
|
12645
|
-
safeCallSilent(() => { this.provider.dispose(); }, 'Application.dispose.preDispose');
|
|
13385
|
+
safeCallSilent(() => { routerDone = this.urlRoutingModule?.dispose?.(); }, 'Application.dispose.router');
|
|
12646
13386
|
safeCallSilent(() => { engine.stopGc(); }, 'Application.dispose.gcStop');
|
|
12647
13387
|
safeCallSilent(() => {
|
|
12648
13388
|
try {
|
|
@@ -12654,7 +13394,37 @@
|
|
|
12654
13394
|
}
|
|
12655
13395
|
catch { /* ignore */ }
|
|
12656
13396
|
}, 'Application.dispose.resetUrl');
|
|
12657
|
-
|
|
13397
|
+
transitionSettings.mode = 'concurrent';
|
|
13398
|
+
const shell = this.appShell;
|
|
13399
|
+
return this._disposing = (async () => {
|
|
13400
|
+
try {
|
|
13401
|
+
await routerDone;
|
|
13402
|
+
}
|
|
13403
|
+
catch (error) {
|
|
13404
|
+
reportError('MJX307', error);
|
|
13405
|
+
}
|
|
13406
|
+
if (shell && !shell.isDisposed) {
|
|
13407
|
+
try {
|
|
13408
|
+
await shell.dispose();
|
|
13409
|
+
}
|
|
13410
|
+
catch (error) {
|
|
13411
|
+
reportError('MJX307', error);
|
|
13412
|
+
}
|
|
13413
|
+
}
|
|
13414
|
+
try {
|
|
13415
|
+
await this.provider.dispose();
|
|
13416
|
+
}
|
|
13417
|
+
catch { }
|
|
13418
|
+
if (_globalApplication === this)
|
|
13419
|
+
_globalApplication = null;
|
|
13420
|
+
this._state = 'disposed';
|
|
13421
|
+
Application._disposingCount--;
|
|
13422
|
+
})();
|
|
13423
|
+
}
|
|
13424
|
+
useTransitions(options) {
|
|
13425
|
+
if (isTransitionMode(options?.mode))
|
|
13426
|
+
transitionSettings.mode = options.mode;
|
|
13427
|
+
return this;
|
|
12658
13428
|
}
|
|
12659
13429
|
use(callback) {
|
|
12660
13430
|
this._middlewares.push(callback);
|
|
@@ -12871,6 +13641,7 @@
|
|
|
12871
13641
|
this._isDevelopment = isDev;
|
|
12872
13642
|
errorHandler.setDevelopmentMode(isDev);
|
|
12873
13643
|
safeCallSilent(() => { globalThis.__MOTIF_DEV__ = isDev; }, 'Application.useDevelopment.flag');
|
|
13644
|
+
safeCallSilent(() => { setDevtoolsEnabled(isDev); }, 'Application.useDevelopment.devtools');
|
|
12874
13645
|
if (isDev)
|
|
12875
13646
|
flushCompilerContractWarnings();
|
|
12876
13647
|
return this;
|
|
@@ -13111,7 +13882,7 @@
|
|
|
13111
13882
|
super();
|
|
13112
13883
|
this.tokensPerInterval = opts.tokensPerInterval ?? 1;
|
|
13113
13884
|
this.intervalMs = opts.intervalMs ?? 1000;
|
|
13114
|
-
this.capacity = opts.capacity ??
|
|
13885
|
+
this.capacity = opts.capacity ?? this.tokensPerInterval;
|
|
13115
13886
|
this.tokens = this.capacity;
|
|
13116
13887
|
this.lastRefill = Date.now();
|
|
13117
13888
|
}
|