@motifx/core 1.2.0-rc.2 → 1.2.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/chunks/{core-CX1Sz73P.cjs → core-DD3SssnS.cjs} +1083 -833
- package/dist/chunks/core-DD3SssnS.cjs.map +1 -0
- package/dist/chunks/{core-C5z0P3iY.esm.js → core-W7wNt8bq.esm.js} +1081 -834
- package/dist/chunks/core-W7wNt8bq.esm.js.map +1 -0
- package/dist/devtools.cjs +1 -1
- package/dist/devtools.esm.js +1 -1
- package/dist/index.cjs +101 -156
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -18
- package/dist/index.d.ts +46 -18
- package/dist/index.esm.js +92 -147
- 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 +1151 -959
- 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/package.json +1 -1
- package/dist/chunks/core-C5z0P3iY.esm.js.map +0 -1
- package/dist/chunks/core-CX1Sz73P.cjs.map +0 -1
|
@@ -4,10 +4,12 @@ function rethrowLater(error) {
|
|
|
4
4
|
setTimeout(() => { throw error; }, 0);
|
|
5
5
|
}
|
|
6
6
|
class ErrorHandler {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
constructor() {
|
|
8
|
+
this.unexpectedErrorHandler = rethrowLater;
|
|
9
|
+
this.listeners = [];
|
|
10
|
+
this._isDevelopment = false;
|
|
11
|
+
this._enableConsoleLogging = true;
|
|
12
|
+
}
|
|
11
13
|
setDevelopmentMode(isDev) {
|
|
12
14
|
this._isDevelopment = isDev;
|
|
13
15
|
}
|
|
@@ -348,7 +350,6 @@ const motifMessages = {
|
|
|
348
350
|
MJX611: () => `The devtools panel failed to load.`,
|
|
349
351
|
};
|
|
350
352
|
class MotifError extends Error {
|
|
351
|
-
code;
|
|
352
353
|
constructor(code, message, options) {
|
|
353
354
|
super(message, options);
|
|
354
355
|
this.name = 'MotifError';
|
|
@@ -380,7 +381,9 @@ function reportWarning(code, args, details) {
|
|
|
380
381
|
}
|
|
381
382
|
|
|
382
383
|
class DisposableCore {
|
|
383
|
-
|
|
384
|
+
constructor() {
|
|
385
|
+
this.disposableTracker = null;
|
|
386
|
+
}
|
|
384
387
|
notifyCreated(target) {
|
|
385
388
|
this.disposableTracker?.trackDisposable(target);
|
|
386
389
|
return target;
|
|
@@ -409,9 +412,8 @@ class DisposableCore {
|
|
|
409
412
|
const disposableCore = new DisposableCore();
|
|
410
413
|
|
|
411
414
|
class DisposableStore {
|
|
412
|
-
_items = new Set();
|
|
413
|
-
_closed = false;
|
|
414
415
|
constructor() {
|
|
416
|
+
this._closed = false;
|
|
415
417
|
disposableCore.notifyCreated(this);
|
|
416
418
|
}
|
|
417
419
|
get isDisposed() {
|
|
@@ -429,7 +431,7 @@ class DisposableStore {
|
|
|
429
431
|
reportWarning('MJX504', [], new Error().stack);
|
|
430
432
|
}
|
|
431
433
|
else {
|
|
432
|
-
this._items.add(item);
|
|
434
|
+
(this._items ??= new Set()).add(item);
|
|
433
435
|
}
|
|
434
436
|
return item;
|
|
435
437
|
}
|
|
@@ -440,20 +442,21 @@ class DisposableStore {
|
|
|
440
442
|
if (item === this) {
|
|
441
443
|
throw motifError('MJX505');
|
|
442
444
|
}
|
|
443
|
-
this._items
|
|
445
|
+
this._items?.delete(item);
|
|
444
446
|
item.dispose();
|
|
445
447
|
}
|
|
446
448
|
detach(item) {
|
|
447
|
-
if (item && this._items
|
|
449
|
+
if (item && this._items?.delete(item)) {
|
|
448
450
|
disposableCore.notifyOwner(item, null);
|
|
449
451
|
}
|
|
450
452
|
}
|
|
451
453
|
clear() {
|
|
452
|
-
|
|
454
|
+
const items = this._items;
|
|
455
|
+
if (!items || items.size === 0) {
|
|
453
456
|
return;
|
|
454
457
|
}
|
|
455
458
|
const failures = [];
|
|
456
|
-
for (const item of
|
|
459
|
+
for (const item of items) {
|
|
457
460
|
try {
|
|
458
461
|
item?.dispose();
|
|
459
462
|
}
|
|
@@ -461,7 +464,7 @@ class DisposableStore {
|
|
|
461
464
|
failures.push(error);
|
|
462
465
|
}
|
|
463
466
|
}
|
|
464
|
-
|
|
467
|
+
items.clear();
|
|
465
468
|
if (failures.length === 1) {
|
|
466
469
|
throw failures[0];
|
|
467
470
|
}
|
|
@@ -479,16 +482,34 @@ class DisposableStore {
|
|
|
479
482
|
}
|
|
480
483
|
}
|
|
481
484
|
|
|
485
|
+
let closedStore;
|
|
486
|
+
function sharedClosedStore() {
|
|
487
|
+
if (closedStore === undefined) {
|
|
488
|
+
closedStore = new DisposableStore();
|
|
489
|
+
closedStore.dispose();
|
|
490
|
+
}
|
|
491
|
+
return closedStore;
|
|
492
|
+
}
|
|
482
493
|
class Disposable {
|
|
483
|
-
_disposables
|
|
494
|
+
get _disposables() {
|
|
495
|
+
let store = this._store;
|
|
496
|
+
if (store === undefined) {
|
|
497
|
+
store = this._store = new DisposableStore();
|
|
498
|
+
disposableCore.notifyOwner(store, this);
|
|
499
|
+
}
|
|
500
|
+
return store;
|
|
501
|
+
}
|
|
484
502
|
constructor() {
|
|
503
|
+
this._store = undefined;
|
|
485
504
|
disposableCore.notifyCreated(this);
|
|
486
|
-
disposableCore.notifyOwner(this._disposables, this);
|
|
487
505
|
}
|
|
488
506
|
dispose() {
|
|
489
507
|
disposableCore.notifyDisposed(this);
|
|
490
|
-
const owned = this.
|
|
491
|
-
if (owned
|
|
508
|
+
const owned = this._store;
|
|
509
|
+
if (owned === undefined) {
|
|
510
|
+
this._store = sharedClosedStore();
|
|
511
|
+
}
|
|
512
|
+
else if (owned && typeof owned.dispose === 'function') {
|
|
492
513
|
owned.dispose();
|
|
493
514
|
}
|
|
494
515
|
else {
|
|
@@ -593,27 +614,17 @@ function removeArrayStack() {
|
|
|
593
614
|
}
|
|
594
615
|
|
|
595
616
|
class ListBinding {
|
|
596
|
-
component;
|
|
597
|
-
itemsFn;
|
|
598
|
-
renderFn;
|
|
599
|
-
options;
|
|
600
|
-
propertyName = "__list__";
|
|
601
|
-
dataSource;
|
|
602
|
-
dataMember;
|
|
603
|
-
formatString;
|
|
604
|
-
converter;
|
|
605
|
-
converterBack;
|
|
606
|
-
updateMode;
|
|
607
|
-
_isActive = false;
|
|
608
|
-
_effectCleanup;
|
|
609
|
-
_rendered = [];
|
|
610
|
-
_identityMap = new WeakMap();
|
|
611
|
-
container = motifFragment('list-container');
|
|
612
617
|
constructor(component, itemsFn, renderFn, options) {
|
|
613
618
|
this.component = component;
|
|
614
619
|
this.itemsFn = itemsFn;
|
|
615
620
|
this.renderFn = renderFn;
|
|
616
621
|
this.options = options;
|
|
622
|
+
this.propertyName = "__list__";
|
|
623
|
+
this._isActive = false;
|
|
624
|
+
this._rendered = [];
|
|
625
|
+
this._identityMap = new WeakMap();
|
|
626
|
+
this.container = motifFragment('list-container');
|
|
627
|
+
this.olditems = [];
|
|
617
628
|
this.component.controls.add(this.container);
|
|
618
629
|
}
|
|
619
630
|
activate() { if (this._isActive)
|
|
@@ -697,7 +708,6 @@ class ListBinding {
|
|
|
697
708
|
}
|
|
698
709
|
return component;
|
|
699
710
|
}
|
|
700
|
-
olditems = [];
|
|
701
711
|
get _indexSensitive() {
|
|
702
712
|
try {
|
|
703
713
|
return this.renderFn.length >= 2;
|
|
@@ -901,6 +911,10 @@ class ListBinding {
|
|
|
901
911
|
return oi === undefined ? -1 : oi;
|
|
902
912
|
});
|
|
903
913
|
const stable = new Set(longestIncreasingIndices(sources));
|
|
914
|
+
if (newComponents.length === items.length && isPermutation(sources, newComponents, this.container)) {
|
|
915
|
+
controls._reorder(newComponents, stable);
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
904
918
|
let anchor = null;
|
|
905
919
|
for (let i = newComponents.length - 1; i >= 0; i--) {
|
|
906
920
|
const comp = newComponents[i];
|
|
@@ -923,6 +937,19 @@ class ListBinding {
|
|
|
923
937
|
}
|
|
924
938
|
}
|
|
925
939
|
}
|
|
940
|
+
function isPermutation(sources, components, owner) {
|
|
941
|
+
const seen = new Uint8Array(sources.length);
|
|
942
|
+
for (let i = 0; i < sources.length; i++) {
|
|
943
|
+
const s = sources[i];
|
|
944
|
+
if (s === -1 || seen[s])
|
|
945
|
+
return false;
|
|
946
|
+
seen[s] = 1;
|
|
947
|
+
const c = components[i];
|
|
948
|
+
if (c.isDisposed || c.parent !== owner)
|
|
949
|
+
return false;
|
|
950
|
+
}
|
|
951
|
+
return true;
|
|
952
|
+
}
|
|
926
953
|
function longestIncreasingIndices(sources) {
|
|
927
954
|
const predecessors = new Array(sources.length).fill(-1);
|
|
928
955
|
const tails = [];
|
|
@@ -1010,13 +1037,11 @@ function findAppendableComponent$1(component) {
|
|
|
1010
1037
|
}
|
|
1011
1038
|
|
|
1012
1039
|
class LeakMonitor {
|
|
1013
|
-
threshold;
|
|
1014
|
-
name;
|
|
1015
|
-
_origins = new Map();
|
|
1016
|
-
_quietChecks = 0;
|
|
1017
1040
|
constructor(threshold, name) {
|
|
1018
1041
|
this.threshold = threshold;
|
|
1019
1042
|
this.name = name;
|
|
1043
|
+
this._origins = new Map();
|
|
1044
|
+
this._quietChecks = 0;
|
|
1020
1045
|
}
|
|
1021
1046
|
check(size) {
|
|
1022
1047
|
if (this.threshold <= 0 || size < this.threshold) {
|
|
@@ -1052,8 +1077,10 @@ function createRing() {
|
|
|
1052
1077
|
return ring;
|
|
1053
1078
|
}
|
|
1054
1079
|
class LinkedList {
|
|
1055
|
-
|
|
1056
|
-
|
|
1080
|
+
constructor() {
|
|
1081
|
+
this._ring = createRing();
|
|
1082
|
+
this._count = 0;
|
|
1083
|
+
}
|
|
1057
1084
|
get size() {
|
|
1058
1085
|
return this._count;
|
|
1059
1086
|
}
|
|
@@ -1111,11 +1138,12 @@ class LinkedList {
|
|
|
1111
1138
|
}
|
|
1112
1139
|
}
|
|
1113
1140
|
|
|
1114
|
-
const COMPILER_CONTRACT =
|
|
1141
|
+
const COMPILER_CONTRACT = 2;
|
|
1142
|
+
const SUPPORTED_CONTRACTS = [1, 2];
|
|
1115
1143
|
const reported = new Set();
|
|
1116
1144
|
const pending = new Set();
|
|
1117
1145
|
function motifCompiled(contract) {
|
|
1118
|
-
if (contract
|
|
1146
|
+
if (SUPPORTED_CONTRACTS.includes(contract) || reported.has(contract))
|
|
1119
1147
|
return;
|
|
1120
1148
|
if (!isDevLike()) {
|
|
1121
1149
|
pending.add(contract);
|
|
@@ -1150,15 +1178,12 @@ exports.NodeTypes = void 0;
|
|
|
1150
1178
|
})(exports.NodeTypes || (exports.NodeTypes = {}));
|
|
1151
1179
|
|
|
1152
1180
|
class Effect {
|
|
1153
|
-
fn;
|
|
1154
|
-
callback;
|
|
1155
|
-
deps = [];
|
|
1156
|
-
active = true;
|
|
1157
|
-
running = false;
|
|
1158
|
-
scheduler;
|
|
1159
1181
|
constructor(fn, callback) {
|
|
1160
1182
|
this.fn = fn;
|
|
1161
1183
|
this.callback = callback;
|
|
1184
|
+
this.deps = [];
|
|
1185
|
+
this.active = true;
|
|
1186
|
+
this.running = false;
|
|
1162
1187
|
}
|
|
1163
1188
|
run() {
|
|
1164
1189
|
let value;
|
|
@@ -1404,21 +1429,10 @@ function readModelValue(el) {
|
|
|
1404
1429
|
return el.value;
|
|
1405
1430
|
}
|
|
1406
1431
|
class Binding {
|
|
1407
|
-
propertyName;
|
|
1408
|
-
dataSource;
|
|
1409
|
-
dataMember;
|
|
1410
|
-
formatString;
|
|
1411
|
-
converter;
|
|
1412
|
-
converterBack;
|
|
1413
|
-
setter;
|
|
1414
|
-
formatInfo;
|
|
1415
|
-
updateMode = 'onPropertyChanged';
|
|
1416
|
-
_isActive = false;
|
|
1417
|
-
_component;
|
|
1418
|
-
_effectCleanup;
|
|
1419
|
-
_memberPath = null;
|
|
1420
|
-
_memberPathSource;
|
|
1421
1432
|
constructor(component, propertyName, dataSource, dataMember, formatString, formatInfo) {
|
|
1433
|
+
this.updateMode = 'onPropertyChanged';
|
|
1434
|
+
this._isActive = false;
|
|
1435
|
+
this._memberPath = null;
|
|
1422
1436
|
this._component = component;
|
|
1423
1437
|
this.propertyName = propertyName;
|
|
1424
1438
|
this.dataSource = dataSource;
|
|
@@ -1670,10 +1684,9 @@ function isWritablePathKey(target, key) {
|
|
|
1670
1684
|
return true;
|
|
1671
1685
|
}
|
|
1672
1686
|
class BindingCollection {
|
|
1673
|
-
_items = [];
|
|
1674
|
-
_component;
|
|
1675
|
-
_branchScope = null;
|
|
1676
1687
|
constructor(component) {
|
|
1688
|
+
this._items = [];
|
|
1689
|
+
this._branchScope = null;
|
|
1677
1690
|
this._component = component;
|
|
1678
1691
|
}
|
|
1679
1692
|
_own(stop) {
|
|
@@ -1942,6 +1955,38 @@ class BindingCollection {
|
|
|
1942
1955
|
const [dataSource, dataMember, formatString, formatInfo] = args;
|
|
1943
1956
|
binding = new Binding(this._component, propertyName, dataSource, dataMember, formatString, formatInfo);
|
|
1944
1957
|
}
|
|
1958
|
+
const write = (raw) => {
|
|
1959
|
+
let value = raw;
|
|
1960
|
+
const b = binding;
|
|
1961
|
+
if (typeof b.converterBack === 'function') {
|
|
1962
|
+
value = b.converterBack(value);
|
|
1963
|
+
}
|
|
1964
|
+
if (typeof b.setter === 'function') {
|
|
1965
|
+
b.setter(value);
|
|
1966
|
+
return;
|
|
1967
|
+
}
|
|
1968
|
+
const member = b.dataMember;
|
|
1969
|
+
const source = b.dataSource;
|
|
1970
|
+
if (member && source != null) {
|
|
1971
|
+
const path = member.split('.');
|
|
1972
|
+
let target = source;
|
|
1973
|
+
for (let i = 0; i < path.length && target != null; i++) {
|
|
1974
|
+
const key = path[i];
|
|
1975
|
+
if (!isWritablePathKey(target, key))
|
|
1976
|
+
return;
|
|
1977
|
+
if (i === path.length - 1) {
|
|
1978
|
+
target[key] = value;
|
|
1979
|
+
}
|
|
1980
|
+
else {
|
|
1981
|
+
target = target[key];
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
else if (source != null && typeof source === 'object' && 'value' in source) {
|
|
1986
|
+
source.value = value;
|
|
1987
|
+
}
|
|
1988
|
+
};
|
|
1989
|
+
(this._modelWriters ??= new WeakMap()).set(binding, write);
|
|
1945
1990
|
const lowerTag = tn.toLowerCase();
|
|
1946
1991
|
if (lowerTag === 'input' || lowerTag === 'select' || lowerTag === 'textarea') {
|
|
1947
1992
|
const writeBack = () => {
|
|
@@ -1949,35 +1994,7 @@ class BindingCollection {
|
|
|
1949
1994
|
const el = this._component.element;
|
|
1950
1995
|
if (!el)
|
|
1951
1996
|
return;
|
|
1952
|
-
|
|
1953
|
-
const b = binding;
|
|
1954
|
-
if (typeof b.converterBack === 'function') {
|
|
1955
|
-
value = b.converterBack(value);
|
|
1956
|
-
}
|
|
1957
|
-
if (typeof b.setter === 'function') {
|
|
1958
|
-
b.setter(value);
|
|
1959
|
-
return;
|
|
1960
|
-
}
|
|
1961
|
-
const member = b.dataMember;
|
|
1962
|
-
const source = b.dataSource;
|
|
1963
|
-
if (member && source != null) {
|
|
1964
|
-
const path = member.split('.');
|
|
1965
|
-
let target = source;
|
|
1966
|
-
for (let i = 0; i < path.length && target != null; i++) {
|
|
1967
|
-
const key = path[i];
|
|
1968
|
-
if (!isWritablePathKey(target, key))
|
|
1969
|
-
return;
|
|
1970
|
-
if (i === path.length - 1) {
|
|
1971
|
-
target[key] = value;
|
|
1972
|
-
}
|
|
1973
|
-
else {
|
|
1974
|
-
target = target[key];
|
|
1975
|
-
}
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
else if (source != null && typeof source === 'object' && 'value' in source) {
|
|
1979
|
-
source.value = value;
|
|
1980
|
-
}
|
|
1997
|
+
write(readModelValue(el));
|
|
1981
1998
|
}
|
|
1982
1999
|
catch { /* ignore */ }
|
|
1983
2000
|
};
|
|
@@ -1990,6 +2007,23 @@ class BindingCollection {
|
|
|
1990
2007
|
}
|
|
1991
2008
|
return binding;
|
|
1992
2009
|
}
|
|
2010
|
+
writeModel(value) {
|
|
2011
|
+
const writers = this._modelWriters;
|
|
2012
|
+
if (!writers)
|
|
2013
|
+
return false;
|
|
2014
|
+
let written = false;
|
|
2015
|
+
for (const binding of this._items) {
|
|
2016
|
+
const write = writers.get(binding);
|
|
2017
|
+
if (!write)
|
|
2018
|
+
continue;
|
|
2019
|
+
try {
|
|
2020
|
+
write(value);
|
|
2021
|
+
written = true;
|
|
2022
|
+
}
|
|
2023
|
+
catch { /* ignore */ }
|
|
2024
|
+
}
|
|
2025
|
+
return written;
|
|
2026
|
+
}
|
|
1993
2027
|
deactivateAll() {
|
|
1994
2028
|
this._items.forEach(binding => binding.deactivate());
|
|
1995
2029
|
this._items = [];
|
|
@@ -2049,10 +2083,10 @@ lazyBindMethods(BindingCollection.prototype, [
|
|
|
2049
2083
|
]);
|
|
2050
2084
|
|
|
2051
2085
|
class Emitter {
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2086
|
+
constructor() {
|
|
2087
|
+
this._subscriptions = [];
|
|
2088
|
+
this._disposed = false;
|
|
2089
|
+
}
|
|
2056
2090
|
get event() {
|
|
2057
2091
|
if (!this._subscribe) {
|
|
2058
2092
|
this._subscribe = (listener, thisArgs, disposables) => {
|
|
@@ -2136,10 +2170,6 @@ class Emitter {
|
|
|
2136
2170
|
}
|
|
2137
2171
|
|
|
2138
2172
|
class ComponentEmiter {
|
|
2139
|
-
component;
|
|
2140
|
-
_emitters;
|
|
2141
|
-
_sourceDisposables;
|
|
2142
|
-
_listenerDisposables;
|
|
2143
2173
|
constructor(component) {
|
|
2144
2174
|
this.component = component;
|
|
2145
2175
|
}
|
|
@@ -2290,9 +2320,6 @@ const WHEN_TRUTHY_METHODS = new Set(['close', 'hidePopover', 'requestSubmit', 'c
|
|
|
2290
2320
|
const ARGUMENT_METHODS = new Set(['setSelectionRange', 'setRangeText', 'setPointerCapture', 'releasePointerCapture', 'fastSeek']);
|
|
2291
2321
|
const PROPERTY_FIRST = new Set(['checked', 'selected', 'muted', 'indeterminate', 'srcObject']);
|
|
2292
2322
|
class controlAttribute {
|
|
2293
|
-
_parent;
|
|
2294
|
-
_attrMapStore;
|
|
2295
|
-
_watchersStore;
|
|
2296
2323
|
constructor(parent) {
|
|
2297
2324
|
this._parent = parent;
|
|
2298
2325
|
}
|
|
@@ -2824,14 +2851,10 @@ class controlAttribute {
|
|
|
2824
2851
|
}
|
|
2825
2852
|
|
|
2826
2853
|
class controlClass {
|
|
2827
|
-
_parent;
|
|
2828
2854
|
constructor(parent) {
|
|
2855
|
+
this._watcherSeq = 0;
|
|
2829
2856
|
this._parent = parent;
|
|
2830
2857
|
}
|
|
2831
|
-
_countsStore;
|
|
2832
|
-
_staticSetStore;
|
|
2833
|
-
_watchersStore;
|
|
2834
|
-
_watcherSeq = 0;
|
|
2835
2858
|
get _counts() { return this._countsStore ??= new Map(); }
|
|
2836
2859
|
get _staticSet() { return this._staticSetStore ??= new Set(); }
|
|
2837
2860
|
get _watchers() { return this._watchersStore ??= new Map(); }
|
|
@@ -2847,13 +2870,7 @@ class controlClass {
|
|
|
2847
2870
|
this._addStaticFromObject(value);
|
|
2848
2871
|
}
|
|
2849
2872
|
else {
|
|
2850
|
-
|
|
2851
|
-
if (valueStr.split(' ').length > 1) {
|
|
2852
|
-
this._addStaticFromArray(valueStr.split(' '));
|
|
2853
|
-
}
|
|
2854
|
-
else {
|
|
2855
|
-
this._addStaticFromString(valueStr);
|
|
2856
|
-
}
|
|
2873
|
+
this._addStaticNames(this._splitClasses(String(value ?? '')));
|
|
2857
2874
|
}
|
|
2858
2875
|
}
|
|
2859
2876
|
return this._parent;
|
|
@@ -2919,10 +2936,11 @@ class controlClass {
|
|
|
2919
2936
|
return null;
|
|
2920
2937
|
}
|
|
2921
2938
|
_splitClasses(input) {
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2939
|
+
if (!input)
|
|
2940
|
+
return [];
|
|
2941
|
+
if (!/\s/.test(input))
|
|
2942
|
+
return [input];
|
|
2943
|
+
return input.split(/\s+/).filter(s => s.length > 0);
|
|
2926
2944
|
}
|
|
2927
2945
|
_normalizeToSet(values, key) {
|
|
2928
2946
|
const result = new Set();
|
|
@@ -3021,14 +3039,31 @@ class controlClass {
|
|
|
3021
3039
|
}
|
|
3022
3040
|
}
|
|
3023
3041
|
}
|
|
3024
|
-
|
|
3025
|
-
if (
|
|
3042
|
+
_addStaticNames(names) {
|
|
3043
|
+
if (names.length === 0)
|
|
3026
3044
|
return;
|
|
3027
3045
|
const el = this._getElement();
|
|
3028
|
-
const
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3046
|
+
const staticSet = this._staticSet;
|
|
3047
|
+
const fresh = el && !el.hasAttribute('class') ? [] : null;
|
|
3048
|
+
for (const cls of names) {
|
|
3049
|
+
if (staticSet.has(cls))
|
|
3050
|
+
continue;
|
|
3051
|
+
staticSet.add(cls);
|
|
3052
|
+
const prevCount = this._counts.get(cls) || 0;
|
|
3053
|
+
this._counts.set(cls, prevCount + 1);
|
|
3054
|
+
if (prevCount === 0 && el) {
|
|
3055
|
+
if (fresh)
|
|
3056
|
+
fresh.push(cls);
|
|
3057
|
+
else {
|
|
3058
|
+
try {
|
|
3059
|
+
el.classList.add(cls);
|
|
3060
|
+
}
|
|
3061
|
+
catch { }
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
if (fresh && fresh.length > 0)
|
|
3066
|
+
el.setAttribute('class', fresh.join(' '));
|
|
3032
3067
|
}
|
|
3033
3068
|
_addStaticFromArray(arr) {
|
|
3034
3069
|
const el = this._getElement();
|
|
@@ -3349,8 +3384,6 @@ function runCssTransition(el, props, phase, done, appear = false) {
|
|
|
3349
3384
|
}
|
|
3350
3385
|
|
|
3351
3386
|
class ComponentMotif {
|
|
3352
|
-
_component;
|
|
3353
|
-
options;
|
|
3354
3387
|
constructor(component, options) {
|
|
3355
3388
|
this._component = component;
|
|
3356
3389
|
this.options = options;
|
|
@@ -3393,15 +3426,11 @@ class ComponentMotif {
|
|
|
3393
3426
|
const SIGNAL_TARGET = Symbol('SignalTarget');
|
|
3394
3427
|
const SIGNAL_KEY = Symbol('SignalKey');
|
|
3395
3428
|
class Signal {
|
|
3396
|
-
_value;
|
|
3397
|
-
_target;
|
|
3398
|
-
_key;
|
|
3399
|
-
_equals;
|
|
3400
|
-
_disposed = false;
|
|
3401
3429
|
static create(initialValue, equals) {
|
|
3402
3430
|
return new Signal(initialValue, equals);
|
|
3403
3431
|
}
|
|
3404
3432
|
constructor(initialValue, equals = Object.is) {
|
|
3433
|
+
this._disposed = false;
|
|
3405
3434
|
this._value = initialValue;
|
|
3406
3435
|
this._target = { [SIGNAL_TARGET]: true };
|
|
3407
3436
|
this._key = SIGNAL_KEY;
|
|
@@ -3458,14 +3487,9 @@ class Signal {
|
|
|
3458
3487
|
}
|
|
3459
3488
|
}
|
|
3460
3489
|
class Computed {
|
|
3461
|
-
_value;
|
|
3462
|
-
_dirty = true;
|
|
3463
|
-
_computing = false;
|
|
3464
|
-
_target;
|
|
3465
|
-
_key;
|
|
3466
|
-
_getter;
|
|
3467
|
-
_cleanup;
|
|
3468
3490
|
constructor(getter) {
|
|
3491
|
+
this._dirty = true;
|
|
3492
|
+
this._computing = false;
|
|
3469
3493
|
this._getter = getter;
|
|
3470
3494
|
this._target = { [SIGNAL_TARGET]: true };
|
|
3471
3495
|
this._key = SIGNAL_KEY;
|
|
@@ -3530,14 +3554,9 @@ class Computed {
|
|
|
3530
3554
|
}
|
|
3531
3555
|
}
|
|
3532
3556
|
class LazyComputed {
|
|
3533
|
-
_value;
|
|
3534
|
-
_dirty = true;
|
|
3535
|
-
_disposed = false;
|
|
3536
|
-
_target;
|
|
3537
|
-
_key;
|
|
3538
|
-
_getter;
|
|
3539
|
-
_runner;
|
|
3540
3557
|
constructor(getter) {
|
|
3558
|
+
this._dirty = true;
|
|
3559
|
+
this._disposed = false;
|
|
3541
3560
|
this._getter = getter;
|
|
3542
3561
|
this._target = { [SIGNAL_TARGET]: true };
|
|
3543
3562
|
this._key = SIGNAL_KEY;
|
|
@@ -3701,24 +3720,25 @@ function retireServiceOwner(owner) {
|
|
|
3701
3720
|
pins.set(owner, { scope: pinnedScopeOf(owner) ?? navigatingRoot._currentScope(), live: false });
|
|
3702
3721
|
}
|
|
3703
3722
|
class ServiceProvider {
|
|
3704
|
-
services;
|
|
3705
|
-
parent;
|
|
3706
|
-
root;
|
|
3707
|
-
scopeName;
|
|
3708
|
-
kind;
|
|
3709
|
-
singletonCache;
|
|
3710
|
-
scopedCache = new Map();
|
|
3711
|
-
transientSet = new Set();
|
|
3712
|
-
_autoDisposeTransients = false;
|
|
3713
|
-
pendingSingleton;
|
|
3714
|
-
pendingScoped = new Map();
|
|
3715
|
-
_navigation;
|
|
3716
|
-
_ownerlessSlot = { owner: null, ownerless: true };
|
|
3717
|
-
_navigationDisposed = false;
|
|
3718
|
-
_livePins = 0;
|
|
3719
|
-
_pending = false;
|
|
3720
3723
|
constructor(services, parent, root) {
|
|
3721
3724
|
this.services = services;
|
|
3725
|
+
this.scopedCache = new Map();
|
|
3726
|
+
this.transientSet = new Set();
|
|
3727
|
+
this._autoDisposeTransients = false;
|
|
3728
|
+
this.pendingScoped = new Map();
|
|
3729
|
+
this._ownerlessSlot = { owner: null, ownerless: true };
|
|
3730
|
+
this._navigationDisposed = false;
|
|
3731
|
+
this._livePins = 0;
|
|
3732
|
+
this._pending = false;
|
|
3733
|
+
this.describeToken = (t) => {
|
|
3734
|
+
if (typeof t === 'string')
|
|
3735
|
+
return t;
|
|
3736
|
+
if (typeof t === 'symbol')
|
|
3737
|
+
return t.toString();
|
|
3738
|
+
if (typeof t === 'function')
|
|
3739
|
+
return t.name || '[AnonymousClass]';
|
|
3740
|
+
return String(t);
|
|
3741
|
+
};
|
|
3722
3742
|
this.parent = parent;
|
|
3723
3743
|
this.root = root ?? this;
|
|
3724
3744
|
this.kind = this.root === this ? 'root' : 'user';
|
|
@@ -4102,15 +4122,6 @@ class ServiceProvider {
|
|
|
4102
4122
|
throw motifError('MJX404', chain);
|
|
4103
4123
|
}
|
|
4104
4124
|
}
|
|
4105
|
-
describeToken = (t) => {
|
|
4106
|
-
if (typeof t === 'string')
|
|
4107
|
-
return t;
|
|
4108
|
-
if (typeof t === 'symbol')
|
|
4109
|
-
return t.toString();
|
|
4110
|
-
if (typeof t === 'function')
|
|
4111
|
-
return t.name || '[AnonymousClass]';
|
|
4112
|
-
return String(t);
|
|
4113
|
-
};
|
|
4114
4125
|
describeTokenWithSource(t) {
|
|
4115
4126
|
const name = this.describeToken(t);
|
|
4116
4127
|
const d = this.services.getDescriptor(t);
|
|
@@ -4217,8 +4228,22 @@ function describeServiceToken(t) {
|
|
|
4217
4228
|
return t.name || '[AnonymousClass]';
|
|
4218
4229
|
return String(t);
|
|
4219
4230
|
}
|
|
4231
|
+
const F_BUILT = 1;
|
|
4232
|
+
const F_INITIALIZED = 2;
|
|
4233
|
+
const F_DISPOSED = 4;
|
|
4234
|
+
const F_CONFIGURED = 8;
|
|
4235
|
+
const F_PAINTING = 16;
|
|
4236
|
+
const F_PAINTED = 32;
|
|
4237
|
+
const F_HIDDEN = 64;
|
|
4238
|
+
const F_WAIT = 128;
|
|
4239
|
+
const F_POSTCONFIG = 256;
|
|
4240
|
+
const F_PREBOUND = 512;
|
|
4241
|
+
const F_DISPOSED_FIRED = 1024;
|
|
4242
|
+
function optionsOf(c) {
|
|
4243
|
+
return c?._motif?.options;
|
|
4244
|
+
}
|
|
4220
4245
|
function peekTransition(c) {
|
|
4221
|
-
return c?.
|
|
4246
|
+
return c?._motif?.options?.[TRANSITION_SLOT];
|
|
4222
4247
|
}
|
|
4223
4248
|
/**WAAPI keyframe (transitionIn) YA DA CSS class transition (name/classes) tanımlı olarak enter animasyonu varmı */
|
|
4224
4249
|
function clearNavDirection(c) {
|
|
@@ -4240,15 +4265,15 @@ function enterModeOf(container) {
|
|
|
4240
4265
|
const node = c.element;
|
|
4241
4266
|
if (!node || node.nodeType !== Node.COMMENT_NODE)
|
|
4242
4267
|
break;
|
|
4243
|
-
c = c.parent ?? c.
|
|
4268
|
+
c = c.parent ?? c._leaveContainer;
|
|
4244
4269
|
}
|
|
4245
4270
|
return transitionSettings.mode;
|
|
4246
4271
|
}
|
|
4247
4272
|
function leaveModeOf(c) {
|
|
4248
|
-
return enterModeOf(c.parent ?? c.
|
|
4273
|
+
return enterModeOf(c.parent ?? c._leaveContainer);
|
|
4249
4274
|
}
|
|
4250
4275
|
function wantsEnterTransition(c) {
|
|
4251
|
-
const o = c?.
|
|
4276
|
+
const o = c?._motif?.options;
|
|
4252
4277
|
const t = o?.[TRANSITION_SLOT];
|
|
4253
4278
|
return !!(o?.transitionIn || (t && (t.classes || (t.name && t.name.length > 0))));
|
|
4254
4279
|
}
|
|
@@ -4403,8 +4428,6 @@ function createTransitionApi(owner) {
|
|
|
4403
4428
|
return t;
|
|
4404
4429
|
}
|
|
4405
4430
|
class ComponentOptionsImpl {
|
|
4406
|
-
[OPTIONS_OWNER];
|
|
4407
|
-
[TRANSITION_SLOT];
|
|
4408
4431
|
constructor(owner) {
|
|
4409
4432
|
this[OPTIONS_OWNER] = owner;
|
|
4410
4433
|
}
|
|
@@ -4444,24 +4467,44 @@ class ComponentOptionsImpl {
|
|
|
4444
4467
|
}
|
|
4445
4468
|
}
|
|
4446
4469
|
hasEvent(name) {
|
|
4447
|
-
return
|
|
4470
|
+
return hasEventKey(this[OPTIONS_OWNER], name);
|
|
4448
4471
|
}
|
|
4449
4472
|
}
|
|
4450
4473
|
lazyBindMethods(ComponentOptionsImpl.prototype, ['getInstance', 'hasEvent']);
|
|
4451
4474
|
function fireLifecycle(component, name, ev) {
|
|
4452
|
-
const base = component.
|
|
4475
|
+
const base = component._baseCtx;
|
|
4453
4476
|
if (base)
|
|
4454
|
-
base.
|
|
4477
|
+
base._emiters?.fire(name, ev);
|
|
4478
|
+
}
|
|
4479
|
+
function runHooks(base, listName, sender, ev, label) {
|
|
4480
|
+
if (!base)
|
|
4481
|
+
return;
|
|
4482
|
+
let slot = base[listName];
|
|
4483
|
+
if (!slot)
|
|
4484
|
+
return;
|
|
4485
|
+
let from = 0;
|
|
4486
|
+
if (typeof slot === 'function') {
|
|
4487
|
+
const fn = slot;
|
|
4488
|
+
callReported(() => fn(sender, ev), 'MJX122', label);
|
|
4489
|
+
slot = base[listName];
|
|
4490
|
+
if (!Array.isArray(slot))
|
|
4491
|
+
return;
|
|
4492
|
+
from = 1;
|
|
4493
|
+
}
|
|
4494
|
+
for (let i = from; i < slot.length; i++) {
|
|
4495
|
+
const fn = slot[i];
|
|
4496
|
+
callReported(() => fn(sender, ev), 'MJX122', label);
|
|
4497
|
+
}
|
|
4455
4498
|
}
|
|
4456
4499
|
function hasLifecycleHook(component, hook, listName, lowerName, legacyProp) {
|
|
4457
4500
|
if (component[hook])
|
|
4458
4501
|
return true;
|
|
4459
|
-
const
|
|
4460
|
-
if (
|
|
4502
|
+
const base = component._baseCtx;
|
|
4503
|
+
if (base?.[listName])
|
|
4461
4504
|
return true;
|
|
4462
4505
|
if (legacyProp && component[legacyProp])
|
|
4463
4506
|
return true;
|
|
4464
|
-
return
|
|
4507
|
+
return !!base?._emiters?.hasListeners(lowerName);
|
|
4465
4508
|
}
|
|
4466
4509
|
const RESERVED_METHODS = ['build', 'setState', 'reState', 'setText', 'style', 'dispose', 'disposeAsync', 'using', 'doWork', 'getService', '$', 'useModel', 'context', 'siblings', 'serviceProvider', 'isWait'];
|
|
4467
4510
|
const checkedComponentClasses = new WeakSet();
|
|
@@ -4530,21 +4573,17 @@ const ComponentHelper = {
|
|
|
4530
4573
|
callReported(() => component.initializeComponent(sender, ev), 'MJX122', 'initializeComponent');
|
|
4531
4574
|
}
|
|
4532
4575
|
// 2) aggregated extra initializeComponent handlers (örn, from props)
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
}
|
|
4576
|
+
const compiled = component._init;
|
|
4577
|
+
if (compiled) {
|
|
4578
|
+
callReported(() => compiled(sender, ev), 'MJX122', 'initializeComponent');
|
|
4537
4579
|
}
|
|
4580
|
+
runHooks(component._baseCtx, '_initializeComponentHandlers', sender, ev, 'initializeComponent');
|
|
4538
4581
|
// 3) class method oninitializeComponent
|
|
4539
4582
|
if (typeof component.oninitializeComponent === 'function') {
|
|
4540
4583
|
callReported(() => component.oninitializeComponent(sender, ev), 'MJX122', 'oninitializeComponent');
|
|
4541
4584
|
}
|
|
4542
4585
|
// 4) aggregated extra oninitializeComponent handlers (örn, from props)
|
|
4543
|
-
|
|
4544
|
-
for (const fn of component._base._onInitializeComponentHandlers) {
|
|
4545
|
-
callReported(() => fn(sender, ev), 'MJX122', 'oninitializeComponent');
|
|
4546
|
-
}
|
|
4547
|
-
}
|
|
4586
|
+
runHooks(component._baseCtx, '_onInitializeComponentHandlers', sender, ev, 'oninitializeComponent');
|
|
4548
4587
|
},
|
|
4549
4588
|
callDisposing(component) {
|
|
4550
4589
|
if (!component || component.isDisposed) {
|
|
@@ -4557,11 +4596,7 @@ const ComponentHelper = {
|
|
|
4557
4596
|
if (component.onDisposing) {
|
|
4558
4597
|
callReported(() => component.onDisposing(sender, ev), 'MJX122', 'onDisposing');
|
|
4559
4598
|
}
|
|
4560
|
-
|
|
4561
|
-
for (const fn of component._base._onDisposingHandlers) {
|
|
4562
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onDisposing');
|
|
4563
|
-
}
|
|
4564
|
-
}
|
|
4599
|
+
runHooks(component._baseCtx, '_onDisposingHandlers', sender, ev, 'onDisposing');
|
|
4565
4600
|
if (component.ondisposing) {
|
|
4566
4601
|
callReported(() => component.ondisposing(sender, ev), 'MJX122', 'ondisposing');
|
|
4567
4602
|
}
|
|
@@ -4575,11 +4610,7 @@ const ComponentHelper = {
|
|
|
4575
4610
|
if (component.onActivated) {
|
|
4576
4611
|
callReported(() => component.onActivated(sender, ev), 'MJX122', 'onActivated');
|
|
4577
4612
|
}
|
|
4578
|
-
|
|
4579
|
-
for (const fn of component._base._onActivatedHandlers) {
|
|
4580
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onActivated');
|
|
4581
|
-
}
|
|
4582
|
-
}
|
|
4613
|
+
runHooks(component._baseCtx, '_onActivatedHandlers', sender, ev, 'onActivated');
|
|
4583
4614
|
fireLifecycle(component, 'onactivated', ev);
|
|
4584
4615
|
},
|
|
4585
4616
|
callDeactivated(component) {
|
|
@@ -4590,11 +4621,7 @@ const ComponentHelper = {
|
|
|
4590
4621
|
if (component.onDeactivated) {
|
|
4591
4622
|
callReported(() => component.onDeactivated(sender, ev), 'MJX122', 'onDeactivated');
|
|
4592
4623
|
}
|
|
4593
|
-
|
|
4594
|
-
for (const fn of component._base._onDeactivatedHandlers) {
|
|
4595
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onDeactivated');
|
|
4596
|
-
}
|
|
4597
|
-
}
|
|
4624
|
+
runHooks(component._baseCtx, '_onDeactivatedHandlers', sender, ev, 'onDeactivated');
|
|
4598
4625
|
fireLifecycle(component, 'ondeactivated', ev);
|
|
4599
4626
|
},
|
|
4600
4627
|
deactivateTree(component, deep = true) {
|
|
@@ -4606,7 +4633,7 @@ const ComponentHelper = {
|
|
|
4606
4633
|
if (!deep || component.isDisposed) {
|
|
4607
4634
|
return;
|
|
4608
4635
|
}
|
|
4609
|
-
for (const c of component.
|
|
4636
|
+
for (const c of childrenOf(component).slice()) {
|
|
4610
4637
|
if (c && !c.isDisposed && c.isVisible && !c.isWait) {
|
|
4611
4638
|
ComponentHelper.deactivateTree(c, true);
|
|
4612
4639
|
}
|
|
@@ -4621,27 +4648,26 @@ const ComponentHelper = {
|
|
|
4621
4648
|
if (!deep || component.isDisposed) {
|
|
4622
4649
|
return;
|
|
4623
4650
|
}
|
|
4624
|
-
for (const c of component.
|
|
4651
|
+
for (const c of childrenOf(component).slice()) {
|
|
4625
4652
|
if (c && !c.isDisposed && c.isVisible && !c.isWait) {
|
|
4626
4653
|
ComponentHelper.activateTree(c, true);
|
|
4627
4654
|
}
|
|
4628
4655
|
}
|
|
4629
4656
|
},
|
|
4630
4657
|
callDisposed(component) {
|
|
4631
|
-
if (!component ||
|
|
4658
|
+
if (!component || (component._flags & F_DISPOSED_FIRED) !== 0) {
|
|
4659
|
+
return;
|
|
4660
|
+
}
|
|
4661
|
+
if (component.isDisposed && !component.element && component._baseCtx === undefined) {
|
|
4632
4662
|
return;
|
|
4633
4663
|
}
|
|
4634
|
-
component.
|
|
4664
|
+
component._flags |= F_DISPOSED_FIRED;
|
|
4635
4665
|
if (hasLifecycleHook(component, 'onDisposed', '_onDisposedHandlers', 'ondisposed', 'ondisposed')) {
|
|
4636
4666
|
const sender = component, ev = { cancel: false };
|
|
4637
4667
|
if (component.onDisposed) {
|
|
4638
4668
|
callReported(() => component.onDisposed(sender, ev), 'MJX122', 'onDisposed');
|
|
4639
4669
|
}
|
|
4640
|
-
|
|
4641
|
-
for (const fn of component._base._onDisposedHandlers) {
|
|
4642
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onDisposed');
|
|
4643
|
-
}
|
|
4644
|
-
}
|
|
4670
|
+
runHooks(component._baseCtx, '_onDisposedHandlers', sender, ev, 'onDisposed');
|
|
4645
4671
|
if (component.ondisposed) {
|
|
4646
4672
|
callReported(() => component.ondisposed(sender, ev), 'MJX122', 'ondisposed');
|
|
4647
4673
|
}
|
|
@@ -4661,11 +4687,7 @@ const ComponentHelper = {
|
|
|
4661
4687
|
if (component.onBuilt) {
|
|
4662
4688
|
callReported(() => component.onBuilt(sender, ev), 'MJX122', 'onBuilt');
|
|
4663
4689
|
}
|
|
4664
|
-
|
|
4665
|
-
for (const fn of component._base._onBuiltHandlers) {
|
|
4666
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onBuilt');
|
|
4667
|
-
}
|
|
4668
|
-
}
|
|
4690
|
+
runHooks(component._baseCtx, '_onBuiltHandlers', sender, ev, 'onBuilt');
|
|
4669
4691
|
if (component.onbuilt) {
|
|
4670
4692
|
callReported(() => component.onbuilt(sender, ev), 'MJX122', 'onbuilt');
|
|
4671
4693
|
}
|
|
@@ -4677,11 +4699,11 @@ const ComponentHelper = {
|
|
|
4677
4699
|
catch { }
|
|
4678
4700
|
},
|
|
4679
4701
|
scheduleMounted(component) {
|
|
4680
|
-
if (!component || component.isDisposed || component.
|
|
4702
|
+
if (!component || component.isDisposed || component._baseCtx?._mountedScheduled) {
|
|
4681
4703
|
return;
|
|
4682
4704
|
}
|
|
4683
4705
|
const hasHook = typeof component.onMounted === 'function'
|
|
4684
|
-
||
|
|
4706
|
+
|| !!component._baseCtx?._onMountedHandlers
|
|
4685
4707
|
|| typeof component.onmounted === 'function';
|
|
4686
4708
|
if (!hasHook) {
|
|
4687
4709
|
return;
|
|
@@ -4710,11 +4732,7 @@ const ComponentHelper = {
|
|
|
4710
4732
|
if (component.onMounted) {
|
|
4711
4733
|
callReported(() => component.onMounted(sender, ev), 'MJX122', 'onMounted');
|
|
4712
4734
|
}
|
|
4713
|
-
|
|
4714
|
-
for (const fn of component._base._onMountedHandlers) {
|
|
4715
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onMounted');
|
|
4716
|
-
}
|
|
4717
|
-
}
|
|
4735
|
+
runHooks(component._baseCtx, '_onMountedHandlers', sender, ev, 'onMounted');
|
|
4718
4736
|
if (component.onmounted) {
|
|
4719
4737
|
callReported(() => component.onmounted(sender, ev), 'MJX122', 'onmounted');
|
|
4720
4738
|
}
|
|
@@ -4731,11 +4749,7 @@ const ComponentHelper = {
|
|
|
4731
4749
|
if (component.onBuilding) {
|
|
4732
4750
|
callReported(() => component.onBuilding(sender, ev), 'MJX122', 'onBuilding');
|
|
4733
4751
|
}
|
|
4734
|
-
|
|
4735
|
-
for (const fn of component._base._onBuildingHandlers) {
|
|
4736
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onBuilding');
|
|
4737
|
-
}
|
|
4738
|
-
}
|
|
4752
|
+
runHooks(component._baseCtx, '_onBuildingHandlers', sender, ev, 'onBuilding');
|
|
4739
4753
|
fireLifecycle(component, 'onbuilding', ev);
|
|
4740
4754
|
},
|
|
4741
4755
|
callConfig(component) {
|
|
@@ -4743,8 +4757,9 @@ const ComponentHelper = {
|
|
|
4743
4757
|
return;
|
|
4744
4758
|
}
|
|
4745
4759
|
component.isConfigured = true;
|
|
4746
|
-
|
|
4747
|
-
|
|
4760
|
+
const preconfig = component._motif?.options?._preconfig;
|
|
4761
|
+
if (preconfig) {
|
|
4762
|
+
safeCallSilent(() => preconfig(component), 'Component._preconfig');
|
|
4748
4763
|
}
|
|
4749
4764
|
if (!hasLifecycleHook(component, 'onConfig', '_onConfigHandlers', 'onconfig')) {
|
|
4750
4765
|
return;
|
|
@@ -4753,21 +4768,17 @@ const ComponentHelper = {
|
|
|
4753
4768
|
if (component.onConfig) {
|
|
4754
4769
|
callReported(() => component.onConfig(sender, ev), 'MJX122', 'onConfig');
|
|
4755
4770
|
}
|
|
4756
|
-
|
|
4757
|
-
for (const fn of component._base._onConfigHandlers) {
|
|
4758
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onConfig');
|
|
4759
|
-
}
|
|
4760
|
-
}
|
|
4771
|
+
runHooks(component._baseCtx, '_onConfigHandlers', sender, ev, 'onConfig');
|
|
4761
4772
|
fireLifecycle(component, 'onconfig', ev);
|
|
4762
4773
|
},
|
|
4763
4774
|
callConfigured(component) {
|
|
4764
|
-
if (component.
|
|
4775
|
+
if ((component._flags & F_POSTCONFIG) !== 0) {
|
|
4765
4776
|
return;
|
|
4766
4777
|
}
|
|
4767
|
-
if (component?.
|
|
4778
|
+
if (component?._baseCtx?._configDeferred && !component.isConfigured) {
|
|
4768
4779
|
ComponentHelper.callConfig(component);
|
|
4769
4780
|
}
|
|
4770
|
-
component.
|
|
4781
|
+
component._flags |= F_POSTCONFIG;
|
|
4771
4782
|
if (!component || component.isDisposed) {
|
|
4772
4783
|
return;
|
|
4773
4784
|
}
|
|
@@ -4778,11 +4789,7 @@ const ComponentHelper = {
|
|
|
4778
4789
|
if (component.onConfigured) {
|
|
4779
4790
|
callReported(() => component.onConfigured(sender, ev), 'MJX122', 'onConfigured');
|
|
4780
4791
|
}
|
|
4781
|
-
|
|
4782
|
-
for (const fn of component._base._onConfiguredHandlers) {
|
|
4783
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onConfigured');
|
|
4784
|
-
}
|
|
4785
|
-
}
|
|
4792
|
+
runHooks(component._baseCtx, '_onConfiguredHandlers', sender, ev, 'onConfigured');
|
|
4786
4793
|
fireLifecycle(component, 'onconfigured', ev);
|
|
4787
4794
|
},
|
|
4788
4795
|
callOnInitialized(component) {
|
|
@@ -4797,11 +4804,7 @@ const ComponentHelper = {
|
|
|
4797
4804
|
if (component.onInitialized) {
|
|
4798
4805
|
callReported(() => component.onInitialized(sender, ev), 'MJX122', 'onInitialized');
|
|
4799
4806
|
}
|
|
4800
|
-
|
|
4801
|
-
for (const fn of component._base._onInitializedHandlers) {
|
|
4802
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onInitialized');
|
|
4803
|
-
}
|
|
4804
|
-
}
|
|
4807
|
+
runHooks(component._baseCtx, '_onInitializedHandlers', sender, ev, 'onInitialized');
|
|
4805
4808
|
fireLifecycle(component, 'oninitialized', ev);
|
|
4806
4809
|
},
|
|
4807
4810
|
callOnInitializing(component) {
|
|
@@ -4815,29 +4818,21 @@ const ComponentHelper = {
|
|
|
4815
4818
|
if (component.onInitializing) {
|
|
4816
4819
|
callReported(() => component.onInitializing(sender, ev), 'MJX122', 'onInitializing');
|
|
4817
4820
|
}
|
|
4818
|
-
|
|
4819
|
-
for (const fn of component._base._onInitializingHandlers) {
|
|
4820
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onInitializing');
|
|
4821
|
-
}
|
|
4822
|
-
}
|
|
4821
|
+
runHooks(component._baseCtx, '_onInitializingHandlers', sender, ev, 'onInitializing');
|
|
4823
4822
|
fireLifecycle(component, 'oninitializing', ev);
|
|
4824
4823
|
},
|
|
4825
|
-
callVisibilityChanged(component) {
|
|
4824
|
+
callVisibilityChanged(component, visible) {
|
|
4826
4825
|
if (!component || component.isDisposed) {
|
|
4827
4826
|
return;
|
|
4828
4827
|
}
|
|
4829
4828
|
if (!hasLifecycleHook(component, 'onVisibilityChanged', '_onVisibilityChangedHandlers', 'onvisibilitychanged')) {
|
|
4830
4829
|
return;
|
|
4831
4830
|
}
|
|
4832
|
-
const sender = component, ev = { cancel: false };
|
|
4831
|
+
const sender = component, ev = { cancel: false, visible };
|
|
4833
4832
|
if (component.onVisibilityChanged) {
|
|
4834
4833
|
callReported(() => component.onVisibilityChanged(sender, ev), 'MJX122', 'onVisibilityChanged');
|
|
4835
4834
|
}
|
|
4836
|
-
|
|
4837
|
-
for (const fn of component._base._onVisibilityChangedHandlers) {
|
|
4838
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onVisibilityChanged');
|
|
4839
|
-
}
|
|
4840
|
-
}
|
|
4835
|
+
runHooks(component._baseCtx, '_onVisibilityChangedHandlers', sender, ev, 'onVisibilityChanged');
|
|
4841
4836
|
fireLifecycle(component, 'onvisibilitychanged', ev);
|
|
4842
4837
|
},
|
|
4843
4838
|
findFragmentContent(c) {
|
|
@@ -4866,9 +4861,12 @@ const ComponentHelper = {
|
|
|
4866
4861
|
ComponentHelper.callConfigured(c);
|
|
4867
4862
|
if (c.isDisposed)
|
|
4868
4863
|
return;
|
|
4869
|
-
c
|
|
4870
|
-
if (c.isWait)
|
|
4864
|
+
activatePreBindings(c);
|
|
4865
|
+
if (c.isWait) {
|
|
4866
|
+
if (this.isBuilt)
|
|
4867
|
+
placeTrace(this, c);
|
|
4871
4868
|
return;
|
|
4869
|
+
}
|
|
4872
4870
|
const cisBuilt = c.isBuilt;
|
|
4873
4871
|
if (!this.isBuilt) {
|
|
4874
4872
|
return;
|
|
@@ -4876,7 +4874,7 @@ const ComponentHelper = {
|
|
|
4876
4874
|
if (c.isWait) {
|
|
4877
4875
|
return;
|
|
4878
4876
|
}
|
|
4879
|
-
const enterSeq = c.
|
|
4877
|
+
const enterSeq = c._baseCtx?._enterSeq;
|
|
4880
4878
|
if (!c.isBuilt) {
|
|
4881
4879
|
c.build();
|
|
4882
4880
|
}
|
|
@@ -4905,40 +4903,12 @@ const ComponentHelper = {
|
|
|
4905
4903
|
if (cisBuilt && c.element.nodeType == Node.COMMENT_NODE && controlElement?.childNodes.length == 0 && c.controls.length > 0) {
|
|
4906
4904
|
controlElement = ComponentHelper.getContent.call(c);
|
|
4907
4905
|
}
|
|
4908
|
-
let referenceNode = null;
|
|
4909
4906
|
const insertHost = appendableElement?.element;
|
|
4910
|
-
const
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
const candidate = n.isVisible
|
|
4914
|
-
? n.element
|
|
4915
|
-
: (n.motif.options?.placeholder ?? null);
|
|
4916
|
-
if (!candidate)
|
|
4917
|
-
return null;
|
|
4918
|
-
return (insertHost && candidate.parentNode === insertHost) ? candidate : null;
|
|
4919
|
-
};
|
|
4920
|
-
const siblings = this.controls.items;
|
|
4921
|
-
for (let i = currentIndex + 1; i < siblings.length; i++) {
|
|
4922
|
-
const candidate = domReferenceOf(siblings[i]);
|
|
4923
|
-
if (candidate) {
|
|
4924
|
-
referenceNode = candidate;
|
|
4925
|
-
break;
|
|
4926
|
-
}
|
|
4927
|
-
}
|
|
4928
|
-
if (!referenceNode) {
|
|
4929
|
-
if (this.element.nodeType === Node.COMMENT_NODE) {
|
|
4930
|
-
const close = this.motif.options.closeFragment;
|
|
4931
|
-
referenceNode = (close && insertHost && close.parentNode === insertHost) ? close : null;
|
|
4932
|
-
}
|
|
4933
|
-
else {
|
|
4934
|
-
referenceNode = null;
|
|
4935
|
-
}
|
|
4936
|
-
}
|
|
4907
|
+
const trace = c.motif.options.placeholder;
|
|
4908
|
+
const ownTrace = c.isVisible && trace && insertHost && trace.parentNode === insertHost ? trace : null;
|
|
4909
|
+
const referenceNode = ownTrace ?? (insertHost ? followingAnchor(this, currentIndex + 1, insertHost) : null);
|
|
4937
4910
|
if (!c.isVisible) {
|
|
4938
|
-
|
|
4939
|
-
const isFromListOrKeyed = !!(c.motif.options?.__fromList || typeof c.motif.options?.indexkey !== 'undefined' || typeof c.motif.options?.__key !== 'undefined');
|
|
4940
|
-
const strategy = cfg === 'placeholder' ? 'placeholder' : (cfg === 'detach' ? 'detach' : (isFromListOrKeyed ? 'detach' : 'placeholder'));
|
|
4941
|
-
if (strategy === 'placeholder') {
|
|
4911
|
+
if (keepsTrace(c)) {
|
|
4942
4912
|
if (!c.motif.options.placeholder) {
|
|
4943
4913
|
c.motif.options.placeholder = dom.createComment("h");
|
|
4944
4914
|
}
|
|
@@ -4976,9 +4946,11 @@ const ComponentHelper = {
|
|
|
4976
4946
|
else {
|
|
4977
4947
|
appendableElement?.element.appendChild(controlElement);
|
|
4978
4948
|
}
|
|
4949
|
+
if (ownTrace && ownTrace.parentNode)
|
|
4950
|
+
ownTrace.parentNode.removeChild(ownTrace);
|
|
4979
4951
|
}
|
|
4980
4952
|
if (c.isVisible) {
|
|
4981
|
-
const enteredInBuild = !cisBuilt && c.
|
|
4953
|
+
const enteredInBuild = !cisBuilt && c._baseCtx?._enterSeq !== enterSeq;
|
|
4982
4954
|
!enteredInBuild && wantsEnterTransition(c) && c.motif.options.transition.enterTransition(() => { });
|
|
4983
4955
|
if (cisBuilt) {
|
|
4984
4956
|
ComponentHelper.activateTree(c);
|
|
@@ -4992,7 +4964,11 @@ const ComponentHelper = {
|
|
|
4992
4964
|
if (this.element.nodeType == Node.COMMENT_NODE) {
|
|
4993
4965
|
this.motif.options.cache?.appendChild(this.element);
|
|
4994
4966
|
this.controls.forEach(child => {
|
|
4995
|
-
|
|
4967
|
+
const node = child.isWait || !child.isVisible
|
|
4968
|
+
? (keepsTrace(child) ? (child.motif.options.placeholder ??= dom.createComment("h")) : undefined)
|
|
4969
|
+
: ComponentHelper.getContent.call(child);
|
|
4970
|
+
if (node)
|
|
4971
|
+
this.motif.options.cache?.appendChild(node);
|
|
4996
4972
|
});
|
|
4997
4973
|
this.motif.options.cache?.appendChild(this.motif.options.closeFragment);
|
|
4998
4974
|
return this.motif.options.cache;
|
|
@@ -5041,34 +5017,72 @@ const ComponentHelper = {
|
|
|
5041
5017
|
}
|
|
5042
5018
|
}
|
|
5043
5019
|
};
|
|
5020
|
+
function keepsTrace(c) {
|
|
5021
|
+
return optionsOf(c)?.hideStrategy !== 'detach';
|
|
5022
|
+
}
|
|
5023
|
+
function domAnchor(c, host) {
|
|
5024
|
+
const trace = optionsOf(c)?.placeholder;
|
|
5025
|
+
if (trace && trace.parentNode === host)
|
|
5026
|
+
return trace;
|
|
5027
|
+
const node = c.element;
|
|
5028
|
+
return node && node.parentNode === host ? node : null;
|
|
5029
|
+
}
|
|
5030
|
+
function followingAnchor(owner, start, host) {
|
|
5031
|
+
const siblings = owner.controls.items;
|
|
5032
|
+
for (let i = start; i < siblings.length; i++) {
|
|
5033
|
+
const anchor = siblings[i] ? domAnchor(siblings[i], host) : null;
|
|
5034
|
+
if (anchor)
|
|
5035
|
+
return anchor;
|
|
5036
|
+
}
|
|
5037
|
+
if (owner.element.nodeType === Node.COMMENT_NODE) {
|
|
5038
|
+
const close = optionsOf(owner)?.closeFragment;
|
|
5039
|
+
return close && close.parentNode === host ? close : null;
|
|
5040
|
+
}
|
|
5041
|
+
return null;
|
|
5042
|
+
}
|
|
5043
|
+
function placeTrace(owner, c) {
|
|
5044
|
+
if (!keepsTrace(c))
|
|
5045
|
+
return;
|
|
5046
|
+
const host = findAppendableComponent(owner)?.element;
|
|
5047
|
+
if (!host)
|
|
5048
|
+
return;
|
|
5049
|
+
const element = c.element;
|
|
5050
|
+
if (element && element.parentNode === host)
|
|
5051
|
+
return;
|
|
5052
|
+
const opts = c.motif.options;
|
|
5053
|
+
const trace = opts.placeholder ?? (opts.placeholder = dom.createComment("h"));
|
|
5054
|
+
if (trace.parentNode === host)
|
|
5055
|
+
return;
|
|
5056
|
+
host.insertBefore(trace, followingAnchor(owner, owner.controls.items.indexOf(c) + 1, host));
|
|
5057
|
+
}
|
|
5044
5058
|
function removeComponentDom(c, node, alsoPlaceholder) {
|
|
5045
|
-
const opts = c
|
|
5059
|
+
const opts = optionsOf(c);
|
|
5046
5060
|
const parent = node.parentNode;
|
|
5047
5061
|
if (node.nodeType === Node.COMMENT_NODE) {
|
|
5048
|
-
if (
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5062
|
+
if (parent) {
|
|
5063
|
+
const close = opts?.closeFragment || null;
|
|
5064
|
+
if (close) {
|
|
5065
|
+
let current = node;
|
|
5066
|
+
while (current) {
|
|
5067
|
+
const after = current.nextSibling;
|
|
5068
|
+
try {
|
|
5069
|
+
parent.removeChild(current);
|
|
5070
|
+
}
|
|
5071
|
+
catch { }
|
|
5072
|
+
if (current === close)
|
|
5073
|
+
break;
|
|
5074
|
+
current = after;
|
|
5075
|
+
}
|
|
5076
|
+
}
|
|
5077
|
+
else {
|
|
5055
5078
|
try {
|
|
5056
|
-
parent.removeChild(
|
|
5079
|
+
parent.removeChild(node);
|
|
5057
5080
|
}
|
|
5058
5081
|
catch { }
|
|
5059
|
-
if (current === close)
|
|
5060
|
-
break;
|
|
5061
|
-
current = after;
|
|
5062
|
-
}
|
|
5063
|
-
}
|
|
5064
|
-
else {
|
|
5065
|
-
try {
|
|
5066
|
-
parent.removeChild(node);
|
|
5067
5082
|
}
|
|
5068
|
-
|
|
5083
|
+
if (!alsoPlaceholder)
|
|
5084
|
+
return;
|
|
5069
5085
|
}
|
|
5070
|
-
if (!alsoPlaceholder)
|
|
5071
|
-
return;
|
|
5072
5086
|
}
|
|
5073
5087
|
else if (parent) {
|
|
5074
5088
|
try {
|
|
@@ -5155,23 +5169,23 @@ function disposeShallow(c) {
|
|
|
5155
5169
|
return;
|
|
5156
5170
|
ComponentHelper.callDisposing.call(c, c);
|
|
5157
5171
|
try {
|
|
5158
|
-
c
|
|
5172
|
+
offAll(c);
|
|
5159
5173
|
}
|
|
5160
5174
|
catch {
|
|
5161
5175
|
}
|
|
5162
5176
|
c.motif.stopAnimations();
|
|
5163
|
-
c
|
|
5164
|
-
if (c.
|
|
5165
|
-
for (const child of c.
|
|
5177
|
+
deactivateBindings(c);
|
|
5178
|
+
if (childrenOf(c).length) {
|
|
5179
|
+
for (const child of c._controls.items) {
|
|
5166
5180
|
try {
|
|
5167
|
-
child
|
|
5181
|
+
disposeShallow(child);
|
|
5168
5182
|
}
|
|
5169
5183
|
catch {
|
|
5170
5184
|
}
|
|
5171
5185
|
}
|
|
5172
5186
|
}
|
|
5173
5187
|
ComponentHelper.callDisposed.call(c, c);
|
|
5174
|
-
safeCall(() => { c.
|
|
5188
|
+
safeCall(() => { c._baseCtx?._emiters?.clear(); }, 'disposeShallow.emiters');
|
|
5175
5189
|
c.isDisposed = true;
|
|
5176
5190
|
Disposable.prototype.dispose.call(c);
|
|
5177
5191
|
}
|
|
@@ -5180,33 +5194,29 @@ function deepCleanup(c) {
|
|
|
5180
5194
|
c.parent = null;
|
|
5181
5195
|
}
|
|
5182
5196
|
catch { }
|
|
5183
|
-
try {
|
|
5184
|
-
c._eventHandlers?.clear();
|
|
5185
|
-
}
|
|
5186
|
-
catch {
|
|
5187
|
-
}
|
|
5188
5197
|
c._eventHandlers = undefined;
|
|
5189
5198
|
try {
|
|
5190
|
-
c.
|
|
5199
|
+
c._class?._countsStore?.clear();
|
|
5191
5200
|
}
|
|
5192
5201
|
catch { }
|
|
5193
5202
|
try {
|
|
5194
|
-
c.
|
|
5203
|
+
c._class?._watchersStore?.clear();
|
|
5195
5204
|
}
|
|
5196
5205
|
catch { }
|
|
5197
5206
|
try {
|
|
5198
|
-
c.
|
|
5207
|
+
c._attr?._attrMapStore?.clear();
|
|
5199
5208
|
}
|
|
5200
5209
|
catch { }
|
|
5201
5210
|
try {
|
|
5202
|
-
c.
|
|
5211
|
+
c._attr?._watchersStore?.clear();
|
|
5203
5212
|
}
|
|
5204
5213
|
catch { }
|
|
5205
5214
|
try {
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5215
|
+
const opts = c._motif?.options;
|
|
5216
|
+
if (opts) {
|
|
5217
|
+
opts.cache = undefined;
|
|
5218
|
+
opts.closeFragment = undefined;
|
|
5219
|
+
opts.placeholder = undefined;
|
|
5210
5220
|
}
|
|
5211
5221
|
}
|
|
5212
5222
|
catch {
|
|
@@ -5236,20 +5246,22 @@ function deepCleanup(c) {
|
|
|
5236
5246
|
}
|
|
5237
5247
|
catch { }
|
|
5238
5248
|
try {
|
|
5239
|
-
c.
|
|
5249
|
+
if (c._motif)
|
|
5250
|
+
c._motif.options = undefined;
|
|
5240
5251
|
}
|
|
5241
5252
|
catch { }
|
|
5242
5253
|
const keys = Object.keys(c);
|
|
5243
5254
|
for (let i = 0; i < keys.length; i++) {
|
|
5244
5255
|
const key = keys[i];
|
|
5245
|
-
if (key === '
|
|
5256
|
+
if (key === '_motif' || key === '_flags')
|
|
5246
5257
|
continue;
|
|
5247
5258
|
try {
|
|
5248
5259
|
c[key] = undefined;
|
|
5249
5260
|
}
|
|
5250
5261
|
catch { }
|
|
5251
5262
|
}
|
|
5252
|
-
c.
|
|
5263
|
+
c._store = null;
|
|
5264
|
+
c._flags = F_DISPOSED | F_HIDDEN | F_DISPOSED_FIRED | F_POSTCONFIG | F_PREBOUND;
|
|
5253
5265
|
}
|
|
5254
5266
|
const DISPOSE_STARTED = Promise.resolve();
|
|
5255
5267
|
function subtreeDisposesSync(c, root) {
|
|
@@ -5257,7 +5269,7 @@ function subtreeDisposesSync(c, root) {
|
|
|
5257
5269
|
return false;
|
|
5258
5270
|
if (c.disposeAsync !== ComponentBase.prototype.disposeAsync)
|
|
5259
5271
|
return false;
|
|
5260
|
-
const opts = c
|
|
5272
|
+
const opts = optionsOf(c);
|
|
5261
5273
|
if (opts) {
|
|
5262
5274
|
if (opts.transitionOut)
|
|
5263
5275
|
return false;
|
|
@@ -5271,8 +5283,8 @@ function subtreeDisposesSync(c, root) {
|
|
|
5271
5283
|
return false;
|
|
5272
5284
|
}
|
|
5273
5285
|
}
|
|
5274
|
-
const items = c
|
|
5275
|
-
if (items) {
|
|
5286
|
+
const items = childrenOf(c);
|
|
5287
|
+
if (items.length) {
|
|
5276
5288
|
for (let i = 0; i < items.length; i++) {
|
|
5277
5289
|
const child = items[i];
|
|
5278
5290
|
if (child && !child.isDisposed && !subtreeDisposesSync(child, false))
|
|
@@ -5303,27 +5315,28 @@ function disposePrefix(c, options, asChild) {
|
|
|
5303
5315
|
c.motif.options.transition.skipNextLeave = true;
|
|
5304
5316
|
}
|
|
5305
5317
|
safeCall(() => { ComponentHelper.callDisposing.call(c, c); }, ctx + '.callDisposing');
|
|
5306
|
-
c
|
|
5307
|
-
c
|
|
5318
|
+
offAll(c);
|
|
5319
|
+
deactivateBindings(c);
|
|
5308
5320
|
safeCall(() => { c.parent?.controls?.silentDetach?.(c, true); }, ctx + '.silentDetach');
|
|
5309
5321
|
}
|
|
5310
5322
|
function disposeFinish(c, options, asChild) {
|
|
5311
5323
|
c.isDisposed = true;
|
|
5312
5324
|
Disposable.prototype.dispose.call(c);
|
|
5313
5325
|
if (asChild) {
|
|
5314
|
-
c.
|
|
5326
|
+
if (c._controls)
|
|
5327
|
+
c._controls.items = [];
|
|
5315
5328
|
safeCall(() => { ComponentHelper.callDisposed.call(c, c); }, 'disposeAsync.callDisposed');
|
|
5316
|
-
safeCall(() => { c.
|
|
5329
|
+
safeCall(() => { c._baseCtx?._emiters?.clear(); }, 'disposeAsync.emiters');
|
|
5317
5330
|
if (options?.deep) {
|
|
5318
|
-
c
|
|
5331
|
+
deepCleanup(c);
|
|
5319
5332
|
}
|
|
5320
5333
|
return;
|
|
5321
5334
|
}
|
|
5322
5335
|
c.element = null;
|
|
5323
5336
|
safeCall(() => { ComponentHelper.callDisposed.call(c, c); }, 'dispose.callDisposed');
|
|
5324
|
-
safeCall(() => { c.
|
|
5325
|
-
c
|
|
5326
|
-
c
|
|
5337
|
+
safeCall(() => { c._baseCtx?._emiters?.clear(); }, 'dispose.emiters');
|
|
5338
|
+
offAll(c);
|
|
5339
|
+
deepCleanup(c);
|
|
5327
5340
|
}
|
|
5328
5341
|
async function disposeRemainderAsync(c, options, asChild, leave) {
|
|
5329
5342
|
if (leave) {
|
|
@@ -5336,7 +5349,7 @@ async function disposeRemainderAsync(c, options, asChild, leave) {
|
|
|
5336
5349
|
else if (peekTransition(c)?.skipNextLeave) {
|
|
5337
5350
|
await c.motif.stopAnimations();
|
|
5338
5351
|
}
|
|
5339
|
-
await c
|
|
5352
|
+
await detachDomWithAnimationAsync(c);
|
|
5340
5353
|
}
|
|
5341
5354
|
if (!asChild && c.constructor.name !== 'TransportTo') {
|
|
5342
5355
|
await disposeContentBlocks(c);
|
|
@@ -5346,7 +5359,7 @@ async function disposeRemainderAsync(c, options, asChild, leave) {
|
|
|
5346
5359
|
if (c.isDisposed) {
|
|
5347
5360
|
return;
|
|
5348
5361
|
}
|
|
5349
|
-
const ctrls = Array.from(c
|
|
5362
|
+
const ctrls = Array.from(childrenOf(c));
|
|
5350
5363
|
if (ctrls.length) {
|
|
5351
5364
|
await Promise.all(ctrls.map(child => asChild
|
|
5352
5365
|
? safeCallAsync(async () => { await child.disposeAsync(childOptions); }, 'disposeAsync.disposeAsyncChildren.handler')
|
|
@@ -5376,8 +5389,8 @@ function disposeRemainderSync(root, options, asChild, rootDetached) {
|
|
|
5376
5389
|
const node = nodes[n];
|
|
5377
5390
|
if (node.isDisposed)
|
|
5378
5391
|
continue;
|
|
5379
|
-
const items = node
|
|
5380
|
-
if (
|
|
5392
|
+
const items = childrenOf(node);
|
|
5393
|
+
if (items.length === 0)
|
|
5381
5394
|
continue;
|
|
5382
5395
|
const ctrls = Array.from(items);
|
|
5383
5396
|
for (let j = 0; j < ctrls.length; j++) {
|
|
@@ -5392,7 +5405,8 @@ function disposeRemainderSync(root, options, asChild, rootDetached) {
|
|
|
5392
5405
|
retireServiceOwner(child);
|
|
5393
5406
|
child._disposing = root._disposing;
|
|
5394
5407
|
disposePrefix(child, childOptions, true);
|
|
5395
|
-
|
|
5408
|
+
if (child.element?.isConnected !== false)
|
|
5409
|
+
detachDomWithAnimation(child);
|
|
5396
5410
|
nodes.push(child);
|
|
5397
5411
|
parents.push(n);
|
|
5398
5412
|
}
|
|
@@ -5431,68 +5445,24 @@ function disposeRemainderSync(root, options, asChild, rootDetached) {
|
|
|
5431
5445
|
return null;
|
|
5432
5446
|
}
|
|
5433
5447
|
const BASE_PROTO = {
|
|
5448
|
+
get emiters() {
|
|
5449
|
+
const base = this;
|
|
5450
|
+
return base._emiters ??= new ComponentEmiter(base.owner);
|
|
5451
|
+
},
|
|
5434
5452
|
_offAll() {
|
|
5435
|
-
|
|
5436
|
-
if (!c._eventHandlers)
|
|
5437
|
-
return;
|
|
5438
|
-
for (const [full, set] of c._eventHandlers) {
|
|
5439
|
-
const name = full.split(":")[0];
|
|
5440
|
-
const evt = name.startsWith("on") ? name.slice(2).toLowerCase() : name.toLowerCase();
|
|
5441
|
-
for (const rec of set) {
|
|
5442
|
-
if (!rec || !rec.wrapped) {
|
|
5443
|
-
continue;
|
|
5444
|
-
}
|
|
5445
|
-
if (rec.domEvent === false) {
|
|
5446
|
-
continue;
|
|
5447
|
-
}
|
|
5448
|
-
const cap = rec.capture === true;
|
|
5449
|
-
try {
|
|
5450
|
-
c.element.removeEventListener(evt, rec.wrapped, cap);
|
|
5451
|
-
}
|
|
5452
|
-
catch { }
|
|
5453
|
-
try {
|
|
5454
|
-
if (rec.capture === undefined) {
|
|
5455
|
-
c.element.removeEventListener(evt, rec.wrapped, !cap);
|
|
5456
|
-
}
|
|
5457
|
-
}
|
|
5458
|
-
catch { }
|
|
5459
|
-
}
|
|
5460
|
-
}
|
|
5461
|
-
c._eventHandlers.clear();
|
|
5462
|
-
c._eventHandlers = undefined;
|
|
5453
|
+
offAll(this.owner);
|
|
5463
5454
|
},
|
|
5464
5455
|
_deactivateBindings() {
|
|
5465
|
-
|
|
5466
|
-
try {
|
|
5467
|
-
c.bindings?.deactivateAll();
|
|
5468
|
-
}
|
|
5469
|
-
catch { }
|
|
5456
|
+
deactivateBindings(this.owner);
|
|
5470
5457
|
},
|
|
5471
5458
|
_activateBindings() {
|
|
5472
|
-
|
|
5473
|
-
try {
|
|
5474
|
-
c.bindings?.activateAll();
|
|
5475
|
-
}
|
|
5476
|
-
catch { }
|
|
5459
|
+
activateBindings(this.owner);
|
|
5477
5460
|
},
|
|
5478
5461
|
_reactivateBindings() {
|
|
5479
|
-
|
|
5480
|
-
try {
|
|
5481
|
-
c.bindings?.reActivateAll();
|
|
5482
|
-
}
|
|
5483
|
-
catch { }
|
|
5462
|
+
reactivateBindings(this.owner);
|
|
5484
5463
|
},
|
|
5485
5464
|
_activatePreBindings() {
|
|
5486
|
-
|
|
5487
|
-
return;
|
|
5488
|
-
const c = this.owner;
|
|
5489
|
-
const registered = c.bindings?._items;
|
|
5490
|
-
if (registered && registered.length > 0) {
|
|
5491
|
-
c.bindings.items.filter((x) => x.propertyName == "isWait" || x.propertyName == "display").forEach((b) => {
|
|
5492
|
-
b.activate();
|
|
5493
|
-
});
|
|
5494
|
-
}
|
|
5495
|
-
this.prebinding_Activated = true;
|
|
5465
|
+
activatePreBindings(this.owner);
|
|
5496
5466
|
},
|
|
5497
5467
|
_detachDomWithAnimation() {
|
|
5498
5468
|
detachDomWithAnimation(this.owner);
|
|
@@ -5507,13 +5477,184 @@ const BASE_PROTO = {
|
|
|
5507
5477
|
deepCleanup(this.owner);
|
|
5508
5478
|
},
|
|
5509
5479
|
};
|
|
5480
|
+
const EV_SELF = 1;
|
|
5481
|
+
const EV_TRUSTED = 2;
|
|
5482
|
+
const EV_PREVENT = 4;
|
|
5483
|
+
const EV_STOP = 8;
|
|
5484
|
+
const EV_CAPTURE = 16;
|
|
5485
|
+
const EV_DOM = 32;
|
|
5486
|
+
const EV_REMOVED = 64;
|
|
5487
|
+
const NO_MODS = [];
|
|
5488
|
+
let eventDispatchDepth = 0;
|
|
5489
|
+
class EventRecord {
|
|
5490
|
+
constructor(owner, key, original, type, flags) {
|
|
5491
|
+
this.owner = owner;
|
|
5492
|
+
this.key = key;
|
|
5493
|
+
this.original = original;
|
|
5494
|
+
this.type = type;
|
|
5495
|
+
this.flags = flags;
|
|
5496
|
+
this.next = undefined;
|
|
5497
|
+
}
|
|
5498
|
+
handleEvent(ev) {
|
|
5499
|
+
const flags = this.flags;
|
|
5500
|
+
const owner = this.owner;
|
|
5501
|
+
if ((flags & EV_SELF) !== 0 && ev.target !== owner.element)
|
|
5502
|
+
return;
|
|
5503
|
+
if ((flags & EV_TRUSTED) !== 0 && !ev.isTrusted)
|
|
5504
|
+
return;
|
|
5505
|
+
const cb = this.original;
|
|
5506
|
+
let res;
|
|
5507
|
+
try {
|
|
5508
|
+
if (cb && cb.length <= 1) {
|
|
5509
|
+
res = cb(ev);
|
|
5510
|
+
}
|
|
5511
|
+
else if (cb) {
|
|
5512
|
+
res = cb(owner, ev);
|
|
5513
|
+
}
|
|
5514
|
+
}
|
|
5515
|
+
catch (error) {
|
|
5516
|
+
reportError('MJX123', error, this.type);
|
|
5517
|
+
}
|
|
5518
|
+
if (res && typeof res.then === 'function') {
|
|
5519
|
+
const type = this.type;
|
|
5520
|
+
res.then(undefined, (error) => reportError('MJX123', error, type));
|
|
5521
|
+
}
|
|
5522
|
+
if ((flags & EV_PREVENT) !== 0) {
|
|
5523
|
+
preventEvent(ev);
|
|
5524
|
+
}
|
|
5525
|
+
if ((flags & EV_STOP) !== 0) {
|
|
5526
|
+
stopEvent(ev);
|
|
5527
|
+
}
|
|
5528
|
+
if (res && res.cancel === true) {
|
|
5529
|
+
preventEvent(ev);
|
|
5530
|
+
stopEvent(ev);
|
|
5531
|
+
}
|
|
5532
|
+
}
|
|
5533
|
+
}
|
|
5534
|
+
function preventEvent(ev) {
|
|
5535
|
+
if (typeof ev?.preventDefault === 'function')
|
|
5536
|
+
ev.preventDefault();
|
|
5537
|
+
}
|
|
5538
|
+
function stopEvent(ev) {
|
|
5539
|
+
if (typeof ev?.stopPropagation === 'function')
|
|
5540
|
+
ev.stopPropagation();
|
|
5541
|
+
}
|
|
5542
|
+
function addEventRecord(c, record) {
|
|
5543
|
+
let last = c._eventHandlers;
|
|
5544
|
+
if (last === undefined) {
|
|
5545
|
+
c._eventHandlers = record;
|
|
5546
|
+
return;
|
|
5547
|
+
}
|
|
5548
|
+
while (last.next !== undefined)
|
|
5549
|
+
last = last.next;
|
|
5550
|
+
last.next = record;
|
|
5551
|
+
}
|
|
5552
|
+
function compactEventRecords(c) {
|
|
5553
|
+
let head;
|
|
5554
|
+
let tail;
|
|
5555
|
+
for (let r = c._eventHandlers; r !== undefined; r = r.next) {
|
|
5556
|
+
if ((r.flags & EV_REMOVED) !== 0)
|
|
5557
|
+
continue;
|
|
5558
|
+
if (tail === undefined)
|
|
5559
|
+
head = r;
|
|
5560
|
+
else
|
|
5561
|
+
tail.next = r;
|
|
5562
|
+
tail = r;
|
|
5563
|
+
}
|
|
5564
|
+
if (tail !== undefined)
|
|
5565
|
+
tail.next = undefined;
|
|
5566
|
+
c._eventHandlers = head;
|
|
5567
|
+
}
|
|
5568
|
+
function hasEventKey(c, key) {
|
|
5569
|
+
for (let r = c._eventHandlers; r !== undefined; r = r.next) {
|
|
5570
|
+
if ((r.flags & EV_REMOVED) === 0 && r.key === key)
|
|
5571
|
+
return true;
|
|
5572
|
+
}
|
|
5573
|
+
return false;
|
|
5574
|
+
}
|
|
5575
|
+
function offAll(c) {
|
|
5576
|
+
const head = c._eventHandlers;
|
|
5577
|
+
if (head === undefined)
|
|
5578
|
+
return;
|
|
5579
|
+
for (let r = head; r !== undefined; r = r.next) {
|
|
5580
|
+
if ((r.flags & (EV_DOM | EV_REMOVED)) !== EV_DOM) {
|
|
5581
|
+
continue;
|
|
5582
|
+
}
|
|
5583
|
+
try {
|
|
5584
|
+
c.element.removeEventListener(r.type, r, (r.flags & EV_CAPTURE) !== 0);
|
|
5585
|
+
}
|
|
5586
|
+
catch { }
|
|
5587
|
+
}
|
|
5588
|
+
c._eventHandlers = undefined;
|
|
5589
|
+
}
|
|
5590
|
+
function deactivateBindings(c) {
|
|
5591
|
+
try {
|
|
5592
|
+
if (c._bindings?._items?.length)
|
|
5593
|
+
c._bindings.deactivateAll();
|
|
5594
|
+
}
|
|
5595
|
+
catch { }
|
|
5596
|
+
}
|
|
5597
|
+
function activateBindings(c) {
|
|
5598
|
+
try {
|
|
5599
|
+
c._bindings?.activateAll();
|
|
5600
|
+
}
|
|
5601
|
+
catch { }
|
|
5602
|
+
}
|
|
5603
|
+
function reactivateBindings(c) {
|
|
5604
|
+
try {
|
|
5605
|
+
c._bindings?.reActivateAll();
|
|
5606
|
+
}
|
|
5607
|
+
catch { }
|
|
5608
|
+
}
|
|
5609
|
+
function activatePreBindings(c) {
|
|
5610
|
+
if ((c._flags & F_PREBOUND) !== 0)
|
|
5611
|
+
return;
|
|
5612
|
+
const registered = c._bindings?._items;
|
|
5613
|
+
if (registered && registered.length > 0) {
|
|
5614
|
+
c._bindings.items.filter((x) => x.propertyName == "isWait" || x.propertyName == "display").forEach((b) => {
|
|
5615
|
+
b.activate();
|
|
5616
|
+
});
|
|
5617
|
+
}
|
|
5618
|
+
c._flags |= F_PREBOUND;
|
|
5619
|
+
}
|
|
5510
5620
|
function createBaseCtx(owner) {
|
|
5511
5621
|
const base = Object.create(BASE_PROTO);
|
|
5512
5622
|
base.owner = owner;
|
|
5513
|
-
base.prebinding_Activated = false;
|
|
5514
|
-
base.emiters = new ComponentEmiter(owner);
|
|
5515
5623
|
return base;
|
|
5516
5624
|
}
|
|
5625
|
+
function controlsOwner(collection) {
|
|
5626
|
+
return collection.owner;
|
|
5627
|
+
}
|
|
5628
|
+
const NO_CHILDREN = Object.freeze([]);
|
|
5629
|
+
const NO_BINDINGS = Object.freeze([]);
|
|
5630
|
+
function childrenOf(c) {
|
|
5631
|
+
return c._controls?.items ?? NO_CHILDREN;
|
|
5632
|
+
}
|
|
5633
|
+
function createOwnedControls(c) {
|
|
5634
|
+
const controls = new ControlCollection(c);
|
|
5635
|
+
controls.onAdd = ownerControlAdded;
|
|
5636
|
+
controls.onAddBeforeBuild = ownerControlAddedBeforeBuild;
|
|
5637
|
+
controls.onRemove = ownerControlRemoved;
|
|
5638
|
+
return controls;
|
|
5639
|
+
}
|
|
5640
|
+
function ownerControlAdded(c) {
|
|
5641
|
+
const owner = controlsOwner(this);
|
|
5642
|
+
if (hasEventKey(owner, 'controladded'))
|
|
5643
|
+
owner.motif.trigger('controladded', { control: c });
|
|
5644
|
+
if (!owner.isVisible && owner.element?.nodeType === Node.COMMENT_NODE)
|
|
5645
|
+
return;
|
|
5646
|
+
ComponentHelper.internalBuild.call(owner, c);
|
|
5647
|
+
}
|
|
5648
|
+
function ownerControlAddedBeforeBuild(c) {
|
|
5649
|
+
const owner = controlsOwner(this);
|
|
5650
|
+
if (hasEventKey(owner, 'controladded'))
|
|
5651
|
+
owner.motif.trigger('controladded', { control: c });
|
|
5652
|
+
}
|
|
5653
|
+
function ownerControlRemoved(c) {
|
|
5654
|
+
const owner = controlsOwner(this);
|
|
5655
|
+
if (hasEventKey(owner, 'controlremoved'))
|
|
5656
|
+
owner.motif.trigger('controlremoved', { control: c });
|
|
5657
|
+
}
|
|
5517
5658
|
const fragmentCloseMarkers = new WeakMap();
|
|
5518
5659
|
const LIFECYCLE_X_EVENTS = new Set([
|
|
5519
5660
|
'building', 'built', 'initializing', 'initialized', 'disposing', 'disposed',
|
|
@@ -5552,37 +5693,83 @@ function createScopedContext(app, owner) {
|
|
|
5552
5693
|
});
|
|
5553
5694
|
}
|
|
5554
5695
|
class ComponentBase extends Disposable {
|
|
5555
|
-
motif
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5696
|
+
get motif() {
|
|
5697
|
+
return this._motif !== undefined ? this._motif : (this._motif = new ComponentMotif(this, (this.isDisposed && !this.element ? undefined : new ComponentOptionsImpl(this))));
|
|
5698
|
+
}
|
|
5699
|
+
set motif(value) {
|
|
5700
|
+
this._motif = value;
|
|
5701
|
+
}
|
|
5702
|
+
get isBuilt() {
|
|
5703
|
+
return (this._flags & F_BUILT) !== 0;
|
|
5704
|
+
}
|
|
5705
|
+
set isBuilt(value) {
|
|
5706
|
+
this._flags = value ? this._flags | F_BUILT : this._flags & ~F_BUILT;
|
|
5707
|
+
}
|
|
5708
|
+
get isInitialized() {
|
|
5709
|
+
return (this._flags & F_INITIALIZED) !== 0;
|
|
5710
|
+
}
|
|
5711
|
+
set isInitialized(value) {
|
|
5712
|
+
this._flags = value ? this._flags | F_INITIALIZED : this._flags & ~F_INITIALIZED;
|
|
5713
|
+
}
|
|
5714
|
+
get isDisposed() {
|
|
5715
|
+
return (this._flags & F_DISPOSED) !== 0;
|
|
5716
|
+
}
|
|
5717
|
+
set isDisposed(value) {
|
|
5718
|
+
this._flags = value ? this._flags | F_DISPOSED : this._flags & ~F_DISPOSED;
|
|
5719
|
+
}
|
|
5720
|
+
get isConfigured() {
|
|
5721
|
+
return (this._flags & F_CONFIGURED) !== 0;
|
|
5722
|
+
}
|
|
5723
|
+
set isConfigured(value) {
|
|
5724
|
+
this._flags = value ? this._flags | F_CONFIGURED : this._flags & ~F_CONFIGURED;
|
|
5725
|
+
}
|
|
5726
|
+
get isPainting() {
|
|
5727
|
+
return (this._flags & F_PAINTING) !== 0;
|
|
5728
|
+
}
|
|
5729
|
+
set isPainting(value) {
|
|
5730
|
+
this._flags = value ? this._flags | F_PAINTING : this._flags & ~F_PAINTING;
|
|
5731
|
+
}
|
|
5732
|
+
get isPainted() {
|
|
5733
|
+
return (this._flags & F_PAINTED) !== 0;
|
|
5734
|
+
}
|
|
5735
|
+
set isPainted(value) {
|
|
5736
|
+
this._flags = value ? this._flags | F_PAINTED : this._flags & ~F_PAINTED;
|
|
5737
|
+
}
|
|
5738
|
+
get isVisible() {
|
|
5739
|
+
return (this._flags & F_HIDDEN) === 0;
|
|
5740
|
+
}
|
|
5741
|
+
set isVisible(value) {
|
|
5742
|
+
this._flags = value ? this._flags & ~F_HIDDEN : this._flags | F_HIDDEN;
|
|
5743
|
+
}
|
|
5744
|
+
get controls() {
|
|
5745
|
+
return this._controls !== undefined || (this.isDisposed && !this.element) ? this._controls : (this._controls = createOwnedControls(this));
|
|
5746
|
+
}
|
|
5747
|
+
set controls(value) {
|
|
5748
|
+
this._controls = value;
|
|
5749
|
+
}
|
|
5750
|
+
get class() {
|
|
5751
|
+
return this._class !== undefined || (this.isDisposed && !this.element) ? this._class : (this._class = new controlClass(this));
|
|
5752
|
+
}
|
|
5753
|
+
set class(value) {
|
|
5754
|
+
this._class = value;
|
|
5755
|
+
}
|
|
5756
|
+
get attr() {
|
|
5757
|
+
return this._attr !== undefined || (this.isDisposed && !this.element) ? this._attr : (this._attr = new controlAttribute(this));
|
|
5758
|
+
}
|
|
5759
|
+
set attr(value) {
|
|
5760
|
+
this._attr = value;
|
|
5761
|
+
}
|
|
5762
|
+
get bindings() {
|
|
5763
|
+
return this._bindings !== undefined || (this.isDisposed && !this.element) ? this._bindings : (this._bindings = new BindingCollection(this));
|
|
5764
|
+
}
|
|
5765
|
+
set bindings(value) {
|
|
5766
|
+
this._bindings = value;
|
|
5767
|
+
}
|
|
5573
5768
|
useModel(modelCtor) {
|
|
5574
5769
|
return reactive(modelCtor);
|
|
5575
5770
|
}
|
|
5576
5771
|
_computeHideStrategy() {
|
|
5577
|
-
|
|
5578
|
-
if (cfg === 'placeholder')
|
|
5579
|
-
return 'placeholder';
|
|
5580
|
-
if (cfg === 'detach')
|
|
5581
|
-
return 'detach';
|
|
5582
|
-
if (this.motif.options?.__fromList || typeof this.motif.options?.indexkey !== 'undefined' || typeof this.motif.options?.__key !== 'undefined') {
|
|
5583
|
-
return 'detach';
|
|
5584
|
-
}
|
|
5585
|
-
return 'placeholder';
|
|
5772
|
+
return keepsTrace(this) ? 'placeholder' : 'detach';
|
|
5586
5773
|
}
|
|
5587
5774
|
_isInDom() {
|
|
5588
5775
|
try {
|
|
@@ -5599,7 +5786,7 @@ class ComponentBase extends Disposable {
|
|
|
5599
5786
|
}
|
|
5600
5787
|
}
|
|
5601
5788
|
set isWait(value) {
|
|
5602
|
-
this.
|
|
5789
|
+
this._flags = value ? this._flags | F_WAIT : this._flags & ~F_WAIT;
|
|
5603
5790
|
if (this.isBuilt) {
|
|
5604
5791
|
if (value) {
|
|
5605
5792
|
this.motif.hide();
|
|
@@ -5614,10 +5801,22 @@ class ComponentBase extends Disposable {
|
|
|
5614
5801
|
}
|
|
5615
5802
|
}
|
|
5616
5803
|
get isWait() {
|
|
5617
|
-
return this.
|
|
5804
|
+
return (this._flags & F_WAIT) !== 0;
|
|
5618
5805
|
}
|
|
5619
5806
|
constructor(element, props = {}) {
|
|
5620
5807
|
super();
|
|
5808
|
+
this._motif = undefined;
|
|
5809
|
+
this._flags = 0;
|
|
5810
|
+
this._controls = undefined;
|
|
5811
|
+
this._class = undefined;
|
|
5812
|
+
this._attr = undefined;
|
|
5813
|
+
this._bindings = undefined;
|
|
5814
|
+
this._baseCtx = undefined;
|
|
5815
|
+
this._init = undefined;
|
|
5816
|
+
this._leaveContainer = undefined;
|
|
5817
|
+
this.parent = null;
|
|
5818
|
+
const asComponentRoot = constructingComponentRoot;
|
|
5819
|
+
constructingComponentRoot = false;
|
|
5621
5820
|
recordServiceOwner(this);
|
|
5622
5821
|
if (this.onElementCreating) {
|
|
5623
5822
|
this.element = this.onElementCreating.call(this);
|
|
@@ -5628,44 +5827,38 @@ class ComponentBase extends Disposable {
|
|
|
5628
5827
|
else {
|
|
5629
5828
|
this.element = element;
|
|
5630
5829
|
}
|
|
5631
|
-
if (
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
for (const fn of takePendingRefs(this, refs)) {
|
|
5635
|
-
callReported(() => fn(this), 'MJX122', 'ref');
|
|
5636
|
-
}
|
|
5637
|
-
}
|
|
5830
|
+
if (this.element?.nodeType !== 3) {
|
|
5831
|
+
if (this._controls === undefined)
|
|
5832
|
+
this._controls = new ControlCollection(this);
|
|
5638
5833
|
}
|
|
5639
|
-
props
|
|
5834
|
+
const refs = props ? extractRefs(props, this) : [];
|
|
5835
|
+
if (props && ParseProps(props, this))
|
|
5836
|
+
props = {};
|
|
5640
5837
|
applyComponentOptions(props?.options, this);
|
|
5641
5838
|
this.props = props;
|
|
5642
5839
|
// (class/style/id/tabindex/role/aria-*/data-*) kök düğüme (root node) düşer, prop'lar this.props'ta kalır.
|
|
5643
5840
|
if (props) {
|
|
5644
5841
|
const ctor0 = new.target;
|
|
5645
|
-
const plain = ctor0 === ComponentBase || Object.getPrototypeOf(ctor0) === ComponentBase;
|
|
5842
|
+
const plain = !asComponentRoot && (ctor0 === ComponentBase || Object.getPrototypeOf(ctor0) === ComponentBase);
|
|
5646
5843
|
if (plain)
|
|
5647
5844
|
applyPlainElementProps(props, this);
|
|
5648
5845
|
else
|
|
5649
5846
|
applyFallthroughProps(props, this);
|
|
5650
5847
|
}
|
|
5848
|
+
if (refs.length > 0) {
|
|
5849
|
+
for (const fn of takePendingRefs(this, refs)) {
|
|
5850
|
+
callReported(() => fn(this), 'MJX122', 'ref');
|
|
5851
|
+
}
|
|
5852
|
+
}
|
|
5651
5853
|
ComponentHelper.callOnInitializing(this);
|
|
5652
5854
|
if (this.isDisposed)
|
|
5653
5855
|
return;
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
};
|
|
5661
|
-
this.controls.onAddBeforeBuild = (c) => {
|
|
5662
|
-
if (this._eventHandlers?.has('controladded'))
|
|
5663
|
-
this.motif.trigger('controladded', { control: c });
|
|
5664
|
-
};
|
|
5665
|
-
this.controls.onRemove = (c) => {
|
|
5666
|
-
if (this._eventHandlers?.has('controlremoved'))
|
|
5667
|
-
this.motif.trigger('controlremoved', { control: c });
|
|
5668
|
-
};
|
|
5856
|
+
const controls = this._controls;
|
|
5857
|
+
if (controls) {
|
|
5858
|
+
controls.onAdd = ownerControlAdded;
|
|
5859
|
+
controls.onAddBeforeBuild = ownerControlAddedBeforeBuild;
|
|
5860
|
+
controls.onRemove = ownerControlRemoved;
|
|
5861
|
+
}
|
|
5669
5862
|
ComponentHelper.callOnInitialized(this);
|
|
5670
5863
|
const ctor = new.target;
|
|
5671
5864
|
const isBaseCtor = ctor === ComponentBase || Object.getPrototypeOf(ctor) === ComponentBase;
|
|
@@ -5676,10 +5869,9 @@ class ComponentBase extends Disposable {
|
|
|
5676
5869
|
this._base._configDeferred = true;
|
|
5677
5870
|
}
|
|
5678
5871
|
}
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
_scopedContext;
|
|
5872
|
+
get _base() {
|
|
5873
|
+
return this._baseCtx !== undefined || (this.isDisposed && !this.element) ? this._baseCtx : (this._baseCtx = createBaseCtx(this));
|
|
5874
|
+
}
|
|
5683
5875
|
get context() {
|
|
5684
5876
|
const parentCtx = this.parent?.context;
|
|
5685
5877
|
const app = parentCtx?.[RAW_APPLICATION] ?? parentCtx ?? teardownApplications.get(this) ?? Application.main;
|
|
@@ -5706,7 +5898,7 @@ class ComponentBase extends Disposable {
|
|
|
5706
5898
|
build(building = true) {
|
|
5707
5899
|
checkReservedMembers(this);
|
|
5708
5900
|
ComponentHelper.callConfigured(this);
|
|
5709
|
-
this
|
|
5901
|
+
activatePreBindings(this);
|
|
5710
5902
|
if (this.isDisposed || !this.element || this.isWait) {
|
|
5711
5903
|
return;
|
|
5712
5904
|
}
|
|
@@ -5743,7 +5935,7 @@ class ComponentBase extends Disposable {
|
|
|
5743
5935
|
}
|
|
5744
5936
|
const deferredSelectValue = this.element?.nodeName === 'SELECT'
|
|
5745
5937
|
? this.bindings.items.filter(b => b.propertyName === 'value')
|
|
5746
|
-
:
|
|
5938
|
+
: NO_BINDINGS;
|
|
5747
5939
|
if (deferredSelectValue.length) {
|
|
5748
5940
|
try {
|
|
5749
5941
|
this.bindings.items.filter(b => !deferredSelectValue.includes(b)).forEach(b => b.activate());
|
|
@@ -5751,32 +5943,41 @@ class ComponentBase extends Disposable {
|
|
|
5751
5943
|
catch { }
|
|
5752
5944
|
}
|
|
5753
5945
|
else {
|
|
5754
|
-
this
|
|
5946
|
+
activateBindings(this);
|
|
5755
5947
|
}
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
element
|
|
5948
|
+
const kids = childrenOf(this);
|
|
5949
|
+
for (const element of kids.length ? kids.slice() : kids) {
|
|
5950
|
+
var target = isFragment ? this.motif.options.cache : this.element;
|
|
5951
|
+
if (!element.isWait) {
|
|
5952
|
+
element.parent = this;
|
|
5953
|
+
element.build(false);
|
|
5954
|
+
}
|
|
5759
5955
|
if (element.isWait) {
|
|
5956
|
+
if (keepsTrace(element)) {
|
|
5957
|
+
const opts = element.motif.options;
|
|
5958
|
+
(building ? ph : target).appendChild(opts.placeholder ?? (opts.placeholder = dom.createComment("h")));
|
|
5959
|
+
}
|
|
5760
5960
|
continue;
|
|
5761
5961
|
}
|
|
5762
|
-
var target = isFragment ? this.motif.options.cache : this.element;
|
|
5763
5962
|
if (building) {
|
|
5764
|
-
|
|
5765
|
-
|
|
5963
|
+
const cache = optionsOf(element)?.cache;
|
|
5964
|
+
if (cache) {
|
|
5965
|
+
ph.appendChild(cache);
|
|
5766
5966
|
}
|
|
5767
5967
|
else {
|
|
5768
5968
|
ph.appendChild(element.element);
|
|
5769
5969
|
}
|
|
5770
5970
|
}
|
|
5771
5971
|
else {
|
|
5772
|
-
|
|
5773
|
-
|
|
5972
|
+
const cache = optionsOf(element)?.cache;
|
|
5973
|
+
if (cache) {
|
|
5974
|
+
target.appendChild(cache);
|
|
5774
5975
|
}
|
|
5775
5976
|
else {
|
|
5776
5977
|
target.appendChild(element.element);
|
|
5777
5978
|
}
|
|
5778
5979
|
}
|
|
5779
|
-
if (element.
|
|
5980
|
+
if (element._baseCtx?._inactive && element.isVisible) {
|
|
5780
5981
|
ComponentHelper.activateTree(element);
|
|
5781
5982
|
}
|
|
5782
5983
|
}
|
|
@@ -5839,10 +6040,10 @@ class ComponentBase extends Disposable {
|
|
|
5839
6040
|
this.controls.forEach(c => {
|
|
5840
6041
|
c.setState();
|
|
5841
6042
|
});
|
|
5842
|
-
this
|
|
6043
|
+
reactivateBindings(this);
|
|
5843
6044
|
}
|
|
5844
6045
|
reState() {
|
|
5845
|
-
this
|
|
6046
|
+
reactivateBindings(this);
|
|
5846
6047
|
this.controls.forEach(c => {
|
|
5847
6048
|
c.reState();
|
|
5848
6049
|
});
|
|
@@ -5966,6 +6167,9 @@ class ComponentBase extends Disposable {
|
|
|
5966
6167
|
if (this.isVisible) {
|
|
5967
6168
|
return;
|
|
5968
6169
|
} /* A*/
|
|
6170
|
+
if (this.isWait) {
|
|
6171
|
+
return;
|
|
6172
|
+
}
|
|
5969
6173
|
if (this.parent && enterModeOf(this.parent) === 'out-in') {
|
|
5970
6174
|
const showHost = (this.motif.options.placeholder?.parentNode)
|
|
5971
6175
|
?? findAppendableComponent(this.parent)?.element;
|
|
@@ -5987,7 +6191,7 @@ class ComponentBase extends Disposable {
|
|
|
5987
6191
|
/** A*/
|
|
5988
6192
|
const strategy = this._computeHideStrategy();
|
|
5989
6193
|
if (strategy === 'detach') {
|
|
5990
|
-
ComponentHelper.callVisibilityChanged(this);
|
|
6194
|
+
ComponentHelper.callVisibilityChanged(this, true);
|
|
5991
6195
|
if (this.isDisposed) {
|
|
5992
6196
|
return;
|
|
5993
6197
|
}
|
|
@@ -6004,6 +6208,10 @@ class ComponentBase extends Disposable {
|
|
|
6004
6208
|
const expectedParent = findAppendableComponent(this.parent)?.element;
|
|
6005
6209
|
if (this.motif.options.placeholder && placeholderParent && placeholderParent !== expectedParent) {
|
|
6006
6210
|
reportWarning('MJX106', []);
|
|
6211
|
+
ComponentHelper.callVisibilityChanged(this, true);
|
|
6212
|
+
if (this.isDisposed) {
|
|
6213
|
+
return;
|
|
6214
|
+
}
|
|
6007
6215
|
this.isVisible = true;
|
|
6008
6216
|
if (this.parent?.isBuilt) {
|
|
6009
6217
|
ComponentHelper.internalBuild.call(this.parent, this);
|
|
@@ -6012,11 +6220,12 @@ class ComponentBase extends Disposable {
|
|
|
6012
6220
|
}
|
|
6013
6221
|
/** A*/
|
|
6014
6222
|
wantsEnterTransition(this) && this.motif.options.transition.enterTransition(() => { });
|
|
6015
|
-
ComponentHelper.callVisibilityChanged(this);
|
|
6223
|
+
ComponentHelper.callVisibilityChanged(this, true);
|
|
6016
6224
|
if (this.isDisposed) {
|
|
6017
6225
|
return;
|
|
6018
6226
|
}
|
|
6019
6227
|
if (this.element.nodeType === Node.COMMENT_NODE) {
|
|
6228
|
+
this.controls.items.filter(c => !c.isBuilt).forEach(c => ComponentHelper.internalBuild.call(this, c));
|
|
6020
6229
|
this.controls.forEach(c => {
|
|
6021
6230
|
c.motif.show();
|
|
6022
6231
|
});
|
|
@@ -6024,6 +6233,10 @@ class ComponentBase extends Disposable {
|
|
|
6024
6233
|
ComponentHelper.activateTree(this, false);
|
|
6025
6234
|
return;
|
|
6026
6235
|
}
|
|
6236
|
+
if (!this.isBuilt) {
|
|
6237
|
+
this.isVisible = true;
|
|
6238
|
+
return;
|
|
6239
|
+
}
|
|
6027
6240
|
var parent = this.motif.options.placeholder?.parentElement;
|
|
6028
6241
|
if (parent) {
|
|
6029
6242
|
parent.replaceChild(this.element, this.motif.options.placeholder);
|
|
@@ -6042,7 +6255,7 @@ class ComponentBase extends Disposable {
|
|
|
6042
6255
|
}
|
|
6043
6256
|
const strategy = this._computeHideStrategy();
|
|
6044
6257
|
if (strategy === 'detach') {
|
|
6045
|
-
ComponentHelper.callVisibilityChanged(this);
|
|
6258
|
+
ComponentHelper.callVisibilityChanged(this, false);
|
|
6046
6259
|
if (this.isDisposed) {
|
|
6047
6260
|
return;
|
|
6048
6261
|
}
|
|
@@ -6057,7 +6270,7 @@ class ComponentBase extends Disposable {
|
|
|
6057
6270
|
if (skip)
|
|
6058
6271
|
transition.skipNextLeave = false;
|
|
6059
6272
|
const finish = () => {
|
|
6060
|
-
ComponentHelper.callVisibilityChanged(this);
|
|
6273
|
+
ComponentHelper.callVisibilityChanged(this, false);
|
|
6061
6274
|
if (this.isDisposed) {
|
|
6062
6275
|
return;
|
|
6063
6276
|
}
|
|
@@ -6140,61 +6353,36 @@ class ComponentBase extends Disposable {
|
|
|
6140
6353
|
return this;
|
|
6141
6354
|
}
|
|
6142
6355
|
}
|
|
6143
|
-
const
|
|
6356
|
+
const colon = full.indexOf(":");
|
|
6357
|
+
const name = colon < 0 ? full : full.slice(0, colon);
|
|
6358
|
+
const mods = colon < 0 ? NO_MODS : full.slice(colon + 1).split(":");
|
|
6144
6359
|
const evt = name.startsWith("on") ? name.slice(2).toLowerCase() : name.toLowerCase();
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
if (mods.includes("
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
reportError('MJX123', error, evt);
|
|
6168
|
-
}
|
|
6169
|
-
if (res && typeof res.then === 'function') {
|
|
6170
|
-
res.then(undefined, (error) => reportError('MJX123', error, evt));
|
|
6171
|
-
}
|
|
6172
|
-
const prevent = () => { if (typeof ev?.preventDefault === 'function')
|
|
6173
|
-
ev.preventDefault(); };
|
|
6174
|
-
const stop = () => { if (typeof ev?.stopPropagation === 'function')
|
|
6175
|
-
ev.stopPropagation(); };
|
|
6176
|
-
if (mods.includes("prevent")) {
|
|
6177
|
-
prevent();
|
|
6178
|
-
}
|
|
6179
|
-
if (mods.includes("stop")) {
|
|
6180
|
-
stop();
|
|
6181
|
-
}
|
|
6182
|
-
if (res && res.cancel === true) {
|
|
6183
|
-
prevent();
|
|
6184
|
-
stop();
|
|
6185
|
-
}
|
|
6186
|
-
};
|
|
6360
|
+
let flags = domEvent ? EV_DOM : 0;
|
|
6361
|
+
let options;
|
|
6362
|
+
if (mods.length) {
|
|
6363
|
+
options = {};
|
|
6364
|
+
if (mods.includes("once"))
|
|
6365
|
+
options.once = true;
|
|
6366
|
+
if (mods.includes("passive"))
|
|
6367
|
+
options.passive = true;
|
|
6368
|
+
if (mods.includes("capture")) {
|
|
6369
|
+
options.capture = true;
|
|
6370
|
+
flags |= EV_CAPTURE;
|
|
6371
|
+
}
|
|
6372
|
+
if (mods.includes("self"))
|
|
6373
|
+
flags |= EV_SELF;
|
|
6374
|
+
if (mods.includes("trusted"))
|
|
6375
|
+
flags |= EV_TRUSTED;
|
|
6376
|
+
if (mods.includes("prevent"))
|
|
6377
|
+
flags |= EV_PREVENT;
|
|
6378
|
+
if (mods.includes("stop"))
|
|
6379
|
+
flags |= EV_STOP;
|
|
6380
|
+
}
|
|
6381
|
+
const record = new EventRecord(this, full.toLowerCase(), cb, evt, flags);
|
|
6187
6382
|
if (domEvent) {
|
|
6188
|
-
this.element.addEventListener(evt,
|
|
6189
|
-
}
|
|
6190
|
-
this
|
|
6191
|
-
const key = full.toLowerCase();
|
|
6192
|
-
const set = this._eventHandlers.get(key) ?? new Set();
|
|
6193
|
-
set.add({ original: cb, wrapped, capture: !!options.capture, domEvent: !!domEvent, type: evt });
|
|
6194
|
-
this._eventHandlers.set(key, set);
|
|
6195
|
-
this._register(disposableCore.toDisposable(() => {
|
|
6196
|
-
this.motif.off(event, cb);
|
|
6197
|
-
}));
|
|
6383
|
+
this.element.addEventListener(evt, record, options);
|
|
6384
|
+
}
|
|
6385
|
+
addEventRecord(this, record);
|
|
6198
6386
|
return this;
|
|
6199
6387
|
}
|
|
6200
6388
|
async _trigger(event, ev) {
|
|
@@ -6203,15 +6391,20 @@ class ComponentBase extends Disposable {
|
|
|
6203
6391
|
}
|
|
6204
6392
|
const name = String(event).toLowerCase();
|
|
6205
6393
|
safeCall(() => {
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6394
|
+
eventDispatchDepth++;
|
|
6395
|
+
try {
|
|
6396
|
+
for (let r = this._eventHandlers; r !== undefined; r = r.next) {
|
|
6397
|
+
if ((r.flags & EV_REMOVED) !== 0 || r.key !== name)
|
|
6398
|
+
continue;
|
|
6209
6399
|
try {
|
|
6210
|
-
|
|
6400
|
+
r.handleEvent(ev);
|
|
6211
6401
|
}
|
|
6212
6402
|
catch {
|
|
6213
6403
|
}
|
|
6214
|
-
}
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
finally {
|
|
6407
|
+
eventDispatchDepth--;
|
|
6215
6408
|
}
|
|
6216
6409
|
}, 'trigger');
|
|
6217
6410
|
return this;
|
|
@@ -6234,38 +6427,24 @@ class ComponentBase extends Disposable {
|
|
|
6234
6427
|
return this;
|
|
6235
6428
|
}
|
|
6236
6429
|
if (LIFECYCLE_X_EVENTS.has(xName)) {
|
|
6237
|
-
this._base.
|
|
6430
|
+
this._base._emiters?.off("on" + xName, cb);
|
|
6238
6431
|
}
|
|
6239
6432
|
return this;
|
|
6240
6433
|
}
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
return this;
|
|
6248
|
-
for (const rec of Array.from(set)) {
|
|
6249
|
-
if (rec.original === cb) {
|
|
6250
|
-
if (rec.domEvent !== false) {
|
|
6251
|
-
const cap = rec.capture === true;
|
|
6252
|
-
safeCall(() => { this.element.removeEventListener(evt, rec.wrapped, cap); }, 'off.removeEventListener');
|
|
6253
|
-
safeCall(() => {
|
|
6254
|
-
if (rec.capture === undefined) {
|
|
6255
|
-
this.element.removeEventListener(evt, rec.wrapped, !cap);
|
|
6256
|
-
}
|
|
6257
|
-
}, 'off.removeEventListener.fallback');
|
|
6258
|
-
}
|
|
6259
|
-
set.delete(rec);
|
|
6260
|
-
break;
|
|
6434
|
+
for (let r = this._eventHandlers; r !== undefined; r = r.next) {
|
|
6435
|
+
if ((r.flags & EV_REMOVED) !== 0 || r.key !== full || r.original !== cb)
|
|
6436
|
+
continue;
|
|
6437
|
+
if ((r.flags & EV_DOM) !== 0) {
|
|
6438
|
+
const rec = r;
|
|
6439
|
+
safeCall(() => { this.element.removeEventListener(rec.type, rec, (rec.flags & EV_CAPTURE) !== 0); }, 'off.removeEventListener');
|
|
6261
6440
|
}
|
|
6441
|
+
r.flags |= EV_REMOVED;
|
|
6442
|
+
break;
|
|
6262
6443
|
}
|
|
6263
|
-
if (
|
|
6264
|
-
this
|
|
6444
|
+
if (eventDispatchDepth === 0)
|
|
6445
|
+
compactEventRecords(this);
|
|
6265
6446
|
return this;
|
|
6266
6447
|
}
|
|
6267
|
-
/** Süren bertaraf: ikinci bir dispose/disposeAsync çağrısı yenisini başlatmaz, bunu bekler. */
|
|
6268
|
-
_disposing;
|
|
6269
6448
|
dispose(options = { deep: true }) {
|
|
6270
6449
|
if (this.isDisposed) {
|
|
6271
6450
|
return Promise.resolve();
|
|
@@ -6336,8 +6515,6 @@ class ComponentBase extends Disposable {
|
|
|
6336
6515
|
}
|
|
6337
6516
|
});
|
|
6338
6517
|
}
|
|
6339
|
-
_siblingsApi;
|
|
6340
|
-
_siblingsSet;
|
|
6341
6518
|
get siblings() {
|
|
6342
6519
|
if (this._siblingsSet) {
|
|
6343
6520
|
return this._siblingsApi;
|
|
@@ -6529,6 +6706,16 @@ function takePendingRefs(component, ref) {
|
|
|
6529
6706
|
}
|
|
6530
6707
|
return pending;
|
|
6531
6708
|
}
|
|
6709
|
+
function disposeUnplacedChilds(owner, kids) {
|
|
6710
|
+
if (!Array.isArray(kids) || !kids.some(kid => kid instanceof ComponentBase))
|
|
6711
|
+
return;
|
|
6712
|
+
owner.motif.setDisposable(() => {
|
|
6713
|
+
for (const kid of kids) {
|
|
6714
|
+
if (kid instanceof ComponentBase && !kid.isDisposed && !kid.parent)
|
|
6715
|
+
kid.dispose();
|
|
6716
|
+
}
|
|
6717
|
+
});
|
|
6718
|
+
}
|
|
6532
6719
|
const isCallableRef = (ref) => typeof ref === 'function' || Array.isArray(ref);
|
|
6533
6720
|
function extractRefs(props, component) {
|
|
6534
6721
|
const refs = [];
|
|
@@ -6580,26 +6767,38 @@ function collectLifecycleHandlers(component, lowerKey, value) {
|
|
|
6580
6767
|
const fns = Array.isArray(value) ? value : [value];
|
|
6581
6768
|
if (fns.length === 0 || !fns.every(fn => typeof fn === 'function'))
|
|
6582
6769
|
return false;
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
if (!
|
|
6587
|
-
|
|
6770
|
+
const target = component;
|
|
6771
|
+
let from = 0;
|
|
6772
|
+
if (listName === '_initializeComponentHandlers') {
|
|
6773
|
+
if (target._init === undefined && !target._baseCtx?._initializeComponentHandlers) {
|
|
6774
|
+
target._init = fns[0];
|
|
6775
|
+
from = 1;
|
|
6776
|
+
}
|
|
6777
|
+
}
|
|
6778
|
+
if (from >= fns.length)
|
|
6779
|
+
return true;
|
|
6780
|
+
const base = target._base;
|
|
6781
|
+
for (let i = from; i < fns.length; i++) {
|
|
6782
|
+
const fn = fns[i];
|
|
6783
|
+
if (listName === '_initializeComponentHandlers' && fn === target._init)
|
|
6784
|
+
continue;
|
|
6785
|
+
const slot = base[listName];
|
|
6786
|
+
if (slot === undefined)
|
|
6787
|
+
base[listName] = fn;
|
|
6788
|
+
else if (typeof slot === 'function') {
|
|
6789
|
+
if (slot !== fn)
|
|
6790
|
+
base[listName] = [slot, fn];
|
|
6791
|
+
}
|
|
6792
|
+
else if (!slot.includes(fn))
|
|
6793
|
+
slot.push(fn);
|
|
6588
6794
|
}
|
|
6589
6795
|
return true;
|
|
6590
6796
|
}
|
|
6591
6797
|
function ParseProps(props, component) {
|
|
6592
6798
|
if (props) {
|
|
6593
|
-
if (component.motif.options.props) {
|
|
6594
|
-
Object.assign(component.motif.options.props, props);
|
|
6595
|
-
}
|
|
6596
|
-
else {
|
|
6597
|
-
component.motif.options.props = {};
|
|
6598
|
-
Object.assign(component.motif.options.props, props);
|
|
6599
|
-
}
|
|
6600
6799
|
var keys = Object.keys(props);
|
|
6601
6800
|
if (keys.length === 0)
|
|
6602
|
-
return;
|
|
6801
|
+
return false;
|
|
6603
6802
|
keys.forEach(key => {
|
|
6604
6803
|
if (key == 'initializeComponent' || key == 'oninitializeComponent' || key.startsWith('on')) {
|
|
6605
6804
|
if (collectLifecycleHandlers(component, key.toLowerCase(), props[key])) {
|
|
@@ -6610,6 +6809,7 @@ function ParseProps(props, component) {
|
|
|
6610
6809
|
else if (key == 'childs') {
|
|
6611
6810
|
const flat = [].concat(...props[key]);
|
|
6612
6811
|
component.childs = flat;
|
|
6812
|
+
disposeUnplacedChilds(component, flat);
|
|
6613
6813
|
delete props[key];
|
|
6614
6814
|
}
|
|
6615
6815
|
else if (key === 'transition') {
|
|
@@ -6654,9 +6854,14 @@ function ParseProps(props, component) {
|
|
|
6654
6854
|
component.motif.options._preconfig = props[key];
|
|
6655
6855
|
delete props[key];
|
|
6656
6856
|
}
|
|
6857
|
+
else if (key === '__childExpr') {
|
|
6858
|
+
delete props[key];
|
|
6859
|
+
}
|
|
6657
6860
|
else ;
|
|
6658
6861
|
});
|
|
6862
|
+
return typeof props === 'object' && Reflect.ownKeys(props).length === 0;
|
|
6659
6863
|
}
|
|
6864
|
+
return false;
|
|
6660
6865
|
}
|
|
6661
6866
|
const _transitionSources = new WeakMap();
|
|
6662
6867
|
function setTransition(component, value, live) {
|
|
@@ -6827,6 +7032,16 @@ const FALLTHROUGH_KEYS = new Set(['class', 'className', 'style', 'id', 'tabindex
|
|
|
6827
7032
|
function isFallthroughKey(key) {
|
|
6828
7033
|
return FALLTHROUGH_KEYS.has(key) || key.startsWith('aria-') || key.startsWith('data-');
|
|
6829
7034
|
}
|
|
7035
|
+
let constructingComponentRoot = false;
|
|
7036
|
+
function constructComponentRoot(make) {
|
|
7037
|
+
constructingComponentRoot = true;
|
|
7038
|
+
try {
|
|
7039
|
+
return make();
|
|
7040
|
+
}
|
|
7041
|
+
finally {
|
|
7042
|
+
constructingComponentRoot = false;
|
|
7043
|
+
}
|
|
7044
|
+
}
|
|
6830
7045
|
function applyFallthroughProps(props, component) {
|
|
6831
7046
|
if (!props || typeof props !== 'object' || component.isDisposed)
|
|
6832
7047
|
return;
|
|
@@ -6876,35 +7091,51 @@ function findAppendableComponent(component) {
|
|
|
6876
7091
|
return null;
|
|
6877
7092
|
}, 'findAppendableComponent', null);
|
|
6878
7093
|
}
|
|
7094
|
+
const attachWaiters = new Set();
|
|
7095
|
+
let attachObserver = null;
|
|
7096
|
+
function releaseAttachObserver() {
|
|
7097
|
+
if (attachWaiters.size || !attachObserver) {
|
|
7098
|
+
return;
|
|
7099
|
+
}
|
|
7100
|
+
try {
|
|
7101
|
+
attachObserver.disconnect();
|
|
7102
|
+
}
|
|
7103
|
+
catch { /* ignore */ }
|
|
7104
|
+
attachObserver = null;
|
|
7105
|
+
}
|
|
7106
|
+
function flushAttachWaiters() {
|
|
7107
|
+
for (const waiter of [...attachWaiters]) {
|
|
7108
|
+
if (!attachWaiters.has(waiter) || !document.contains(waiter.element)) {
|
|
7109
|
+
continue;
|
|
7110
|
+
}
|
|
7111
|
+
attachWaiters.delete(waiter);
|
|
7112
|
+
try {
|
|
7113
|
+
waiter.callback();
|
|
7114
|
+
}
|
|
7115
|
+
catch (error) {
|
|
7116
|
+
queueMicrotask(() => { throw error; });
|
|
7117
|
+
}
|
|
7118
|
+
}
|
|
7119
|
+
releaseAttachObserver();
|
|
7120
|
+
}
|
|
6879
7121
|
function onElementAttached(element, callback) {
|
|
6880
7122
|
if (document.contains(element)) {
|
|
6881
7123
|
callback();
|
|
6882
7124
|
return null;
|
|
6883
7125
|
}
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
}
|
|
6894
|
-
});
|
|
6895
|
-
observer.observe(document.documentElement, {
|
|
6896
|
-
childList: true,
|
|
6897
|
-
subtree: true,
|
|
6898
|
-
});
|
|
7126
|
+
const waiter = { element, callback };
|
|
7127
|
+
attachWaiters.add(waiter);
|
|
7128
|
+
if (!attachObserver) {
|
|
7129
|
+
attachObserver = new MutationObserver(flushAttachWaiters);
|
|
7130
|
+
attachObserver.observe(document.documentElement, {
|
|
7131
|
+
childList: true,
|
|
7132
|
+
subtree: true,
|
|
7133
|
+
});
|
|
7134
|
+
}
|
|
6899
7135
|
return () => {
|
|
6900
|
-
if (
|
|
6901
|
-
|
|
7136
|
+
if (attachWaiters.delete(waiter)) {
|
|
7137
|
+
releaseAttachObserver();
|
|
6902
7138
|
}
|
|
6903
|
-
done = true;
|
|
6904
|
-
try {
|
|
6905
|
-
observer.disconnect();
|
|
6906
|
-
}
|
|
6907
|
-
catch { /* ignore */ }
|
|
6908
7139
|
};
|
|
6909
7140
|
}
|
|
6910
7141
|
function notifyActivated(component) {
|
|
@@ -6960,8 +7191,6 @@ function createDeclaredElement(tag, ctor, props) {
|
|
|
6960
7191
|
return dom.createElement(tag, props);
|
|
6961
7192
|
}
|
|
6962
7193
|
class Component extends ComponentBase {
|
|
6963
|
-
static elementTag;
|
|
6964
|
-
static elementNamespace;
|
|
6965
7194
|
constructor() {
|
|
6966
7195
|
const derivedCtor = new.target;
|
|
6967
7196
|
var args = arguments;
|
|
@@ -7041,9 +7270,11 @@ class Component extends ComponentBase {
|
|
|
7041
7270
|
// Alt sınıflar initializeComponent'i ezdiği için FragmentNode.initializeComponent'e güvenilemez.
|
|
7042
7271
|
const kids = this.childs;
|
|
7043
7272
|
if (Array.isArray(kids) && kids.length) {
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7273
|
+
if (derivedCtor?._placesChilds !== true) {
|
|
7274
|
+
for (const kid of kids) {
|
|
7275
|
+
if (kid)
|
|
7276
|
+
this.controls.add(kid);
|
|
7277
|
+
}
|
|
7047
7278
|
}
|
|
7048
7279
|
}
|
|
7049
7280
|
}
|
|
@@ -7065,6 +7296,7 @@ function applyJsxFrameworkProps(target, props, refs) {
|
|
|
7065
7296
|
if (!(target instanceof ComponentBase))
|
|
7066
7297
|
return target;
|
|
7067
7298
|
applyRefs(target, refs.concat(extractRefs(props)));
|
|
7299
|
+
disposeUnplacedChilds(target, props.childs);
|
|
7068
7300
|
// Fonksiyon bileşeni etiketindeki ortak öznitelikler (class/id/aria-*…) döndürülen köke düşer.
|
|
7069
7301
|
// Kök `<div {...props}/>` ise aynı değerler zaten uygulanmıştır; ikinci kez uygulanmaz.
|
|
7070
7302
|
applyFallthroughProps(props, target);
|
|
@@ -7075,8 +7307,7 @@ function applyJsxFrameworkProps(target, props, refs) {
|
|
|
7075
7307
|
const runover = props.runover;
|
|
7076
7308
|
if (!runover || typeof runover !== 'object')
|
|
7077
7309
|
return target;
|
|
7078
|
-
const
|
|
7079
|
-
const configuredBefore = Array.isArray(handlers) ? handlers.length : 0;
|
|
7310
|
+
const configuredBefore = handlerCount(target, '_onConfigHandlers');
|
|
7080
7311
|
const initializingBefore = handlerCount(target, '_onInitializingHandlers');
|
|
7081
7312
|
const initializedBefore = handlerCount(target, '_onInitializedHandlers');
|
|
7082
7313
|
ParseProps(runover, target);
|
|
@@ -7090,12 +7321,9 @@ function applyJsxFrameworkProps(target, props, refs) {
|
|
|
7090
7321
|
if (typeof pre === 'function') {
|
|
7091
7322
|
safeCallSilent(() => pre(target), 'motifComponent.preconfig');
|
|
7092
7323
|
}
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
const fn = after[i];
|
|
7097
|
-
callReported(() => fn(target, { cancel: false }), 'MJX122', 'onConfig');
|
|
7098
|
-
}
|
|
7324
|
+
for (let i = configuredBefore; i < handlerCount(target, '_onConfigHandlers'); i++) {
|
|
7325
|
+
const fn = hookList(target, '_onConfigHandlers')[i];
|
|
7326
|
+
callReported(() => fn(target, { cancel: false }), 'MJX122', 'onConfig');
|
|
7099
7327
|
}
|
|
7100
7328
|
}
|
|
7101
7329
|
return target;
|
|
@@ -7108,18 +7336,18 @@ function applyRefs(target, refs) {
|
|
|
7108
7336
|
}
|
|
7109
7337
|
return target;
|
|
7110
7338
|
}
|
|
7339
|
+
function hookList(target, listName) {
|
|
7340
|
+
const slot = target._base?.[listName];
|
|
7341
|
+
return !slot ? [] : typeof slot === 'function' ? [slot] : slot;
|
|
7342
|
+
}
|
|
7111
7343
|
function handlerCount(target, listName) {
|
|
7112
|
-
|
|
7113
|
-
return Array.isArray(list) ? list.length : 0;
|
|
7344
|
+
return hookList(target, listName).length;
|
|
7114
7345
|
}
|
|
7115
7346
|
function callAddedHandlers(target, listName, from, hook) {
|
|
7116
|
-
|
|
7117
|
-
if (!Array.isArray(list))
|
|
7118
|
-
return;
|
|
7119
|
-
for (let i = from; i < list.length; i++) {
|
|
7347
|
+
for (let i = from; i < handlerCount(target, listName); i++) {
|
|
7120
7348
|
if (target.isDisposed)
|
|
7121
7349
|
return;
|
|
7122
|
-
const fn =
|
|
7350
|
+
const fn = hookList(target, listName)[i];
|
|
7123
7351
|
callReported(() => fn(target, { cancel: false }), 'MJX122', hook);
|
|
7124
7352
|
}
|
|
7125
7353
|
}
|
|
@@ -7142,6 +7370,11 @@ function resolveChildExpression(probe) {
|
|
|
7142
7370
|
function motifComponent(element, props) {
|
|
7143
7371
|
// Etiket adı: element yaratımı (HTML/SVG) ve spread prop uygulaması Component ctor'ının string parametresinde
|
|
7144
7372
|
if (typeof element === "string") {
|
|
7373
|
+
if (typeof props === "function") {
|
|
7374
|
+
const compiled = new Component(element);
|
|
7375
|
+
compiled._init = props;
|
|
7376
|
+
return compiled;
|
|
7377
|
+
}
|
|
7145
7378
|
if (element === "text" && props && props.__childExpr) {
|
|
7146
7379
|
const resolved = resolveChildExpression(props.__childExpr);
|
|
7147
7380
|
if (resolved !== undefined)
|
|
@@ -7203,7 +7436,9 @@ function resolveToComponent(input, props) {
|
|
|
7203
7436
|
return resolved;
|
|
7204
7437
|
}
|
|
7205
7438
|
function materializeOptionsObject(spec, props) {
|
|
7206
|
-
const result =
|
|
7439
|
+
const result = typeof spec.el === 'string'
|
|
7440
|
+
? constructComponentRoot(() => motifComponent(spec.el, props))
|
|
7441
|
+
: motifComponent(spec.el, props);
|
|
7207
7442
|
Object.getOwnPropertyNames(spec).forEach(key => {
|
|
7208
7443
|
if (key !== 'el' && key !== 'ctor') {
|
|
7209
7444
|
result[key] = spec[key];
|
|
@@ -7239,7 +7474,7 @@ class FragmentNode extends Component {
|
|
|
7239
7474
|
}
|
|
7240
7475
|
}
|
|
7241
7476
|
safeCallSilent(() => {
|
|
7242
|
-
const nodes = this.
|
|
7477
|
+
const nodes = this.props?.nodes;
|
|
7243
7478
|
if (Array.isArray(nodes) && nodes.length) {
|
|
7244
7479
|
for (const n of nodes) {
|
|
7245
7480
|
if (n)
|
|
@@ -7401,11 +7636,10 @@ function $(description, attrs, ...children) {
|
|
|
7401
7636
|
|
|
7402
7637
|
// import { dom } from "../browser";
|
|
7403
7638
|
class ControlCollection {
|
|
7404
|
-
owner;
|
|
7405
7639
|
constructor(owner) {
|
|
7406
7640
|
this.owner = owner;
|
|
7641
|
+
this.items = [];
|
|
7407
7642
|
}
|
|
7408
|
-
items = [];
|
|
7409
7643
|
add() {
|
|
7410
7644
|
const count = arguments.length;
|
|
7411
7645
|
if (count === 0)
|
|
@@ -7485,7 +7719,7 @@ class ControlCollection {
|
|
|
7485
7719
|
this.items.splice(index, 1);
|
|
7486
7720
|
if (control.isDisposed)
|
|
7487
7721
|
return Promise.resolve();
|
|
7488
|
-
control.
|
|
7722
|
+
control._leaveContainer = this.owner;
|
|
7489
7723
|
control.parent = null;
|
|
7490
7724
|
return runLeaveThenDetach(control, () => { if (this.onRemove)
|
|
7491
7725
|
this.onRemove(control); });
|
|
@@ -7515,7 +7749,7 @@ class ControlCollection {
|
|
|
7515
7749
|
if (index === -1)
|
|
7516
7750
|
return;
|
|
7517
7751
|
this.items.splice(index, 1);
|
|
7518
|
-
control.
|
|
7752
|
+
control._leaveContainer = this.owner;
|
|
7519
7753
|
control.parent = null;
|
|
7520
7754
|
}
|
|
7521
7755
|
async clearAsync() {
|
|
@@ -7540,9 +7774,6 @@ class ControlCollection {
|
|
|
7540
7774
|
map(callbackfn) {
|
|
7541
7775
|
return this.items.map(callbackfn);
|
|
7542
7776
|
}
|
|
7543
|
-
onAdd;
|
|
7544
|
-
onRemove;
|
|
7545
|
-
onAddBeforeBuild;
|
|
7546
7777
|
move(control, before) {
|
|
7547
7778
|
if (!control || control.isDisposed)
|
|
7548
7779
|
return;
|
|
@@ -7570,14 +7801,29 @@ class ControlCollection {
|
|
|
7570
7801
|
const insertAt = newBeforeIndex >= 0 ? newBeforeIndex : this.items.length;
|
|
7571
7802
|
this.items.splice(insertAt, 0, control);
|
|
7572
7803
|
}
|
|
7573
|
-
if (control.isWait) {
|
|
7574
|
-
return;
|
|
7575
|
-
}
|
|
7576
7804
|
const container = findAppendableElement(this.owner);
|
|
7577
|
-
if (!container)
|
|
7805
|
+
if (!container || !domAnchor(control, container))
|
|
7578
7806
|
return;
|
|
7579
|
-
const
|
|
7580
|
-
moveComponentDomRange(control, container,
|
|
7807
|
+
const at = before ? this.items.indexOf(before) : -1;
|
|
7808
|
+
moveComponentDomRange(control, container, at >= 0 ? anchorFrom(this.owner, this.items, at, container) : computeAppendReference(this.owner));
|
|
7809
|
+
}
|
|
7810
|
+
_reorder(order, stable) {
|
|
7811
|
+
const container = findAppendableElement(this.owner);
|
|
7812
|
+
if (container) {
|
|
7813
|
+
let ref = computeAppendReference(this.owner);
|
|
7814
|
+
for (let i = order.length - 1; i >= 0; i--) {
|
|
7815
|
+
const control = order[i];
|
|
7816
|
+
const node = domAnchor(control, container);
|
|
7817
|
+
if (!node)
|
|
7818
|
+
continue;
|
|
7819
|
+
if (!stable.has(i))
|
|
7820
|
+
moveComponentDomRange(control, container, ref);
|
|
7821
|
+
ref = node;
|
|
7822
|
+
}
|
|
7823
|
+
}
|
|
7824
|
+
const items = this.items;
|
|
7825
|
+
for (let i = 0; i < order.length; i++)
|
|
7826
|
+
items[i] = order[i];
|
|
7581
7827
|
}
|
|
7582
7828
|
moveToIndex(control, index) {
|
|
7583
7829
|
if (!control || control.isDisposed)
|
|
@@ -7614,12 +7860,20 @@ function computeAppendReference(owner) {
|
|
|
7614
7860
|
}
|
|
7615
7861
|
return null;
|
|
7616
7862
|
}
|
|
7863
|
+
function anchorFrom(owner, items, start, container) {
|
|
7864
|
+
for (let i = start; i < items.length; i++) {
|
|
7865
|
+
const anchor = domAnchor(items[i], container);
|
|
7866
|
+
if (anchor)
|
|
7867
|
+
return anchor;
|
|
7868
|
+
}
|
|
7869
|
+
return computeAppendReference(owner);
|
|
7870
|
+
}
|
|
7617
7871
|
/** Bir component'in kök DOM aralığını (tek element veya fragment aralığı) referenceNode öncesine taşır. */
|
|
7618
7872
|
function moveComponentDomRange(control, container, referenceNode) {
|
|
7619
|
-
const node = control
|
|
7873
|
+
const node = domAnchor(control, container);
|
|
7620
7874
|
if (!node)
|
|
7621
7875
|
return;
|
|
7622
|
-
if (node.nodeType !== Node.COMMENT_NODE) {
|
|
7876
|
+
if (node.nodeType !== Node.COMMENT_NODE || node !== control.element) {
|
|
7623
7877
|
try {
|
|
7624
7878
|
container.insertBefore(node, referenceNode);
|
|
7625
7879
|
}
|
|
@@ -7702,9 +7956,7 @@ function detachComponentDom(control) {
|
|
|
7702
7956
|
if (!node)
|
|
7703
7957
|
return;
|
|
7704
7958
|
const opts = control.motif.options;
|
|
7705
|
-
if (node.nodeType === Node.COMMENT_NODE) {
|
|
7706
|
-
if (!node.parentNode)
|
|
7707
|
-
return;
|
|
7959
|
+
if (node.nodeType === Node.COMMENT_NODE && node.parentNode) {
|
|
7708
7960
|
const close = opts?.closeFragment || null;
|
|
7709
7961
|
const cache = opts.cache ?? (opts.cache = dom.createDocumentFragment());
|
|
7710
7962
|
let current = node;
|
|
@@ -8177,13 +8429,12 @@ async function navigateHost(host, page, keepOldControl = false) {
|
|
|
8177
8429
|
}
|
|
8178
8430
|
|
|
8179
8431
|
class Frame extends Component {
|
|
8180
|
-
current = null;
|
|
8181
|
-
_latestNavigateId = 0;
|
|
8182
|
-
_navLock = Promise.resolve();
|
|
8183
|
-
_navAbort;
|
|
8184
|
-
isBusy = false;
|
|
8185
8432
|
constructor(props) {
|
|
8186
8433
|
super(dom.createComment(''), props);
|
|
8434
|
+
this.current = null;
|
|
8435
|
+
this._latestNavigateId = 0;
|
|
8436
|
+
this._navLock = Promise.resolve();
|
|
8437
|
+
this.isBusy = false;
|
|
8187
8438
|
if (props && props.childs && Array.isArray(props.childs) && props.childs.length > 0) {
|
|
8188
8439
|
this.controls.add(props.childs);
|
|
8189
8440
|
}
|
|
@@ -8198,7 +8449,6 @@ class Frame extends Component {
|
|
|
8198
8449
|
async _clear() {
|
|
8199
8450
|
await disposeNavigationTarget(this.current);
|
|
8200
8451
|
}
|
|
8201
|
-
previouspage;
|
|
8202
8452
|
async navigate(page, keepOldControl = false) {
|
|
8203
8453
|
await navigateHost(this, page, keepOldControl);
|
|
8204
8454
|
}
|
|
@@ -8208,6 +8458,25 @@ class Frame extends Component {
|
|
|
8208
8458
|
}
|
|
8209
8459
|
}
|
|
8210
8460
|
|
|
8461
|
+
const SLOT_REGISTERED_EVENT = Symbol('slotRegistered');
|
|
8462
|
+
const SLOT_UNREGISTERED_EVENT = Symbol('slotUnregistered');
|
|
8463
|
+
class TransportRegistry {
|
|
8464
|
+
static { this.slots = new Map(); }
|
|
8465
|
+
static registerSlot(name, slot) {
|
|
8466
|
+
this.slots.set(name, slot);
|
|
8467
|
+
Application.main.fire(SLOT_REGISTERED_EVENT, { name, slot });
|
|
8468
|
+
}
|
|
8469
|
+
static unregisterSlot(name, slot) {
|
|
8470
|
+
if (this.slots.get(name) === slot) {
|
|
8471
|
+
this.slots.delete(name);
|
|
8472
|
+
Application.main.fire(SLOT_UNREGISTERED_EVENT, { name, slot });
|
|
8473
|
+
}
|
|
8474
|
+
}
|
|
8475
|
+
static getSlot(name) {
|
|
8476
|
+
return this.slots.get(name);
|
|
8477
|
+
}
|
|
8478
|
+
}
|
|
8479
|
+
|
|
8211
8480
|
const ARRAY_MUTATORS = new Set(['push', 'pop', 'shift', 'unshift', 'splice', 'reverse', 'sort']);
|
|
8212
8481
|
const NOT_META = Symbol('');
|
|
8213
8482
|
const metaReaders = new Map([
|
|
@@ -8345,11 +8614,10 @@ const PATCHED_ARRAY_METHODS = [
|
|
|
8345
8614
|
];
|
|
8346
8615
|
const isLookupMiss = (outcome) => outcome === false || outcome === -1;
|
|
8347
8616
|
class ArrayMethods {
|
|
8348
|
-
engine;
|
|
8349
8617
|
constructor(engine) {
|
|
8350
8618
|
this.engine = engine;
|
|
8619
|
+
this.get = this.createArrayMethods();
|
|
8351
8620
|
}
|
|
8352
|
-
get = this.createArrayMethods();
|
|
8353
8621
|
createArrayMethods() {
|
|
8354
8622
|
const table = {};
|
|
8355
8623
|
for (const [name, kind] of PATCHED_ARRAY_METHODS) {
|
|
@@ -8541,7 +8809,6 @@ const ReactiveEngineMapper = new WeakSet();
|
|
|
8541
8809
|
const AllreactiveMap = new WeakMap();
|
|
8542
8810
|
function armgetter() { return AllreactiveMap; }
|
|
8543
8811
|
class ReactiveEngine {
|
|
8544
|
-
_gci;
|
|
8545
8812
|
startGc(_intervalMs = 10000) { }
|
|
8546
8813
|
stopGc() { if (this._gci) {
|
|
8547
8814
|
try {
|
|
@@ -8551,31 +8818,30 @@ class ReactiveEngine {
|
|
|
8551
8818
|
this._gci = undefined;
|
|
8552
8819
|
} }
|
|
8553
8820
|
constructor() {
|
|
8821
|
+
this.DisposeMapper = new LinkedList();
|
|
8822
|
+
this.arrayTriggerCache = new Map();
|
|
8823
|
+
this.ReactiveMap = () => armgetter();
|
|
8824
|
+
this.isReadonly = false;
|
|
8825
|
+
this.superficial = false;
|
|
8826
|
+
this.arrayMethods = new ArrayMethods(this);
|
|
8827
|
+
this.arrayHandler = {
|
|
8828
|
+
get: createGetter(this),
|
|
8829
|
+
set: createSetter(this),
|
|
8830
|
+
has: createHas(),
|
|
8831
|
+
deleteProperty: createDelete(),
|
|
8832
|
+
ownKeys: createOwn()
|
|
8833
|
+
};
|
|
8834
|
+
this.deepHandler = {
|
|
8835
|
+
get: createGetter(this),
|
|
8836
|
+
set: createSetter(this),
|
|
8837
|
+
has: createHas(),
|
|
8838
|
+
deleteProperty: createDelete(),
|
|
8839
|
+
ownKeys: createOwn()
|
|
8840
|
+
};
|
|
8841
|
+
this.collectionHandler = createCollectionHandler(this);
|
|
8554
8842
|
ReactiveEngineMapper.add(this);
|
|
8555
8843
|
this.startGc();
|
|
8556
8844
|
}
|
|
8557
|
-
DisposeMapper = new LinkedList();
|
|
8558
|
-
arrayTriggerCache = new Map();
|
|
8559
|
-
ReactiveMap = () => armgetter();
|
|
8560
|
-
activeCallback;
|
|
8561
|
-
isReadonly = false;
|
|
8562
|
-
superficial = false;
|
|
8563
|
-
arrayMethods = new ArrayMethods(this);
|
|
8564
|
-
arrayHandler = {
|
|
8565
|
-
get: createGetter(this),
|
|
8566
|
-
set: createSetter(this),
|
|
8567
|
-
has: createHas(),
|
|
8568
|
-
deleteProperty: createDelete(),
|
|
8569
|
-
ownKeys: createOwn()
|
|
8570
|
-
};
|
|
8571
|
-
deepHandler = {
|
|
8572
|
-
get: createGetter(this),
|
|
8573
|
-
set: createSetter(this),
|
|
8574
|
-
has: createHas(),
|
|
8575
|
-
deleteProperty: createDelete(),
|
|
8576
|
-
ownKeys: createOwn()
|
|
8577
|
-
};
|
|
8578
|
-
collectionHandler = createCollectionHandler(this);
|
|
8579
8845
|
reactive(model) {
|
|
8580
8846
|
if (!isObject(model)) {
|
|
8581
8847
|
model = { value: model };
|
|
@@ -8638,7 +8904,6 @@ class ReactiveEngine {
|
|
|
8638
8904
|
ArrayTrigger(target, key, ...args) {
|
|
8639
8905
|
this.trigger(target, key, args);
|
|
8640
8906
|
}
|
|
8641
|
-
onValueChanged;
|
|
8642
8907
|
toRaw(item) {
|
|
8643
8908
|
return JSON.parse(JSON.stringify(this.deepClone(item)));
|
|
8644
8909
|
}
|
|
@@ -8824,7 +9089,9 @@ function isConstructor(fn) {
|
|
|
8824
9089
|
}
|
|
8825
9090
|
}
|
|
8826
9091
|
class ServiceCollection {
|
|
8827
|
-
|
|
9092
|
+
constructor() {
|
|
9093
|
+
this.descriptors = new Map();
|
|
9094
|
+
}
|
|
8828
9095
|
reset() {
|
|
8829
9096
|
this.descriptors.clear();
|
|
8830
9097
|
}
|
|
@@ -9081,7 +9348,7 @@ function initOverlayIfEnabled() {
|
|
|
9081
9348
|
}
|
|
9082
9349
|
|
|
9083
9350
|
class RouterViewRegistry {
|
|
9084
|
-
static outlets = new Map();
|
|
9351
|
+
static { this.outlets = new Map(); }
|
|
9085
9352
|
static register(name, scopeId, instance) {
|
|
9086
9353
|
if (!this.outlets.has(name))
|
|
9087
9354
|
this.outlets.set(name, new Map());
|
|
@@ -9110,9 +9377,12 @@ const RouterViewBuilt = Symbol.for("RouterView.built");
|
|
|
9110
9377
|
class RouterView extends Component {
|
|
9111
9378
|
constructor(props) {
|
|
9112
9379
|
super(props);
|
|
9380
|
+
this._navLock = Promise.resolve();
|
|
9381
|
+
this.disposingChilds = false;
|
|
9382
|
+
this.current = null;
|
|
9383
|
+
this._latestNavigateId = 0;
|
|
9384
|
+
this.isBusy = false;
|
|
9113
9385
|
}
|
|
9114
|
-
_navLock = Promise.resolve();
|
|
9115
|
-
_navAbort;
|
|
9116
9386
|
get __isRouterView() {
|
|
9117
9387
|
return true;
|
|
9118
9388
|
}
|
|
@@ -9124,11 +9394,6 @@ class RouterView extends Component {
|
|
|
9124
9394
|
}
|
|
9125
9395
|
return ids.join('>');
|
|
9126
9396
|
}
|
|
9127
|
-
disposingChilds = false;
|
|
9128
|
-
previouspage;
|
|
9129
|
-
current = null;
|
|
9130
|
-
_latestNavigateId = 0;
|
|
9131
|
-
isBusy = false;
|
|
9132
9397
|
async navigate(page, keepOldControl = false) {
|
|
9133
9398
|
await navigateHost(this, page, keepOldControl);
|
|
9134
9399
|
}
|
|
@@ -9159,18 +9424,16 @@ const DEFAULT_LIMIT = 60;
|
|
|
9159
9424
|
const DEFAULT_SETTLE_MS = 1200;
|
|
9160
9425
|
const USER_INPUT = ['wheel', 'touchstart', 'keydown', 'mousedown'];
|
|
9161
9426
|
class ScrollMemory {
|
|
9162
|
-
options;
|
|
9163
|
-
viewport;
|
|
9164
|
-
positions = new Map();
|
|
9165
|
-
currentKey = '';
|
|
9166
|
-
currentPath = null;
|
|
9167
|
-
visited = false;
|
|
9168
|
-
restoring = false;
|
|
9169
|
-
cancelFrame = null;
|
|
9170
|
-
disarmAbort = null;
|
|
9171
|
-
offs = [];
|
|
9172
|
-
locationAnchor = true;
|
|
9173
9427
|
constructor(options = {}, viewport) {
|
|
9428
|
+
this.positions = new Map();
|
|
9429
|
+
this.currentKey = '';
|
|
9430
|
+
this.currentPath = null;
|
|
9431
|
+
this.visited = false;
|
|
9432
|
+
this.restoring = false;
|
|
9433
|
+
this.cancelFrame = null;
|
|
9434
|
+
this.disarmAbort = null;
|
|
9435
|
+
this.offs = [];
|
|
9436
|
+
this.locationAnchor = true;
|
|
9174
9437
|
this.options = options;
|
|
9175
9438
|
this.viewport = viewport ?? (options.container ? containerViewport(options.container) : windowViewport());
|
|
9176
9439
|
this.load();
|
|
@@ -9573,24 +9836,18 @@ function overlay(floating, anchor, above) {
|
|
|
9573
9836
|
}
|
|
9574
9837
|
}
|
|
9575
9838
|
class NavigationStack {
|
|
9576
|
-
retainAttached;
|
|
9577
|
-
depth;
|
|
9578
|
-
persist;
|
|
9579
|
-
animation;
|
|
9580
|
-
duration;
|
|
9581
|
-
swipe;
|
|
9582
|
-
session = null;
|
|
9583
|
-
entries = new Map();
|
|
9584
|
-
uris = new Map();
|
|
9585
|
-
loaded = null;
|
|
9586
|
-
current = null;
|
|
9587
|
-
currentTop = null;
|
|
9588
|
-
offs = [];
|
|
9589
|
-
gesture = null;
|
|
9590
|
-
gestureCommitted = false;
|
|
9591
|
-
awaitingGestureResult = false;
|
|
9592
|
-
disposed = false;
|
|
9593
9839
|
constructor(options) {
|
|
9840
|
+
this.session = null;
|
|
9841
|
+
this.entries = new Map();
|
|
9842
|
+
this.uris = new Map();
|
|
9843
|
+
this.loaded = null;
|
|
9844
|
+
this.current = null;
|
|
9845
|
+
this.currentTop = null;
|
|
9846
|
+
this.offs = [];
|
|
9847
|
+
this.gesture = null;
|
|
9848
|
+
this.gestureCommitted = false;
|
|
9849
|
+
this.awaitingGestureResult = false;
|
|
9850
|
+
this.disposed = false;
|
|
9594
9851
|
const o = options === true ? {} : options;
|
|
9595
9852
|
this.retainAttached = o.retain === true;
|
|
9596
9853
|
this.depth = Math.max(0, Math.floor(o.depth ?? 5));
|
|
@@ -10099,13 +10356,28 @@ class NavigationStack {
|
|
|
10099
10356
|
}
|
|
10100
10357
|
|
|
10101
10358
|
class Scanner {
|
|
10102
|
-
source;
|
|
10103
10359
|
constructor(source) {
|
|
10104
10360
|
this.source = source;
|
|
10361
|
+
this.currentColumn = 0;
|
|
10362
|
+
this.tokens = [];
|
|
10363
|
+
this.parameters = {};
|
|
10364
|
+
this.codePointAt = String.prototype.codePointAt ?
|
|
10365
|
+
(s, i) => s.codePointAt(i) : function codePointAt(str, i) {
|
|
10366
|
+
const size = str.length;
|
|
10367
|
+
if (i < 0 || i >= size) {
|
|
10368
|
+
return undefined;
|
|
10369
|
+
}
|
|
10370
|
+
const first = str.charCodeAt(i);
|
|
10371
|
+
if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) {
|
|
10372
|
+
const second = str.charCodeAt(i + 1);
|
|
10373
|
+
if (second >= 0xDC00 && second <= 0xDFFF) {
|
|
10374
|
+
return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
|
|
10375
|
+
}
|
|
10376
|
+
}
|
|
10377
|
+
return first;
|
|
10378
|
+
};
|
|
10105
10379
|
this.tokens = [];
|
|
10106
10380
|
}
|
|
10107
|
-
currentColumn = 0;
|
|
10108
|
-
tokens = [];
|
|
10109
10381
|
addToken(token) {
|
|
10110
10382
|
this.tokens.push(token);
|
|
10111
10383
|
}
|
|
@@ -10333,7 +10605,6 @@ class Scanner {
|
|
|
10333
10605
|
pattern += '$';
|
|
10334
10606
|
return new RegExp(pattern, "i");
|
|
10335
10607
|
}
|
|
10336
|
-
parameters = {};
|
|
10337
10608
|
exist(input, pageSearch) {
|
|
10338
10609
|
const hashIdx = input.indexOf('#');
|
|
10339
10610
|
const withoutHash = hashIdx >= 0 ? input.substring(0, hashIdx) : input;
|
|
@@ -10417,21 +10688,6 @@ class Scanner {
|
|
|
10417
10688
|
}
|
|
10418
10689
|
return false;
|
|
10419
10690
|
}
|
|
10420
|
-
codePointAt = String.prototype.codePointAt ?
|
|
10421
|
-
(s, i) => s.codePointAt(i) : function codePointAt(str, i) {
|
|
10422
|
-
const size = str.length;
|
|
10423
|
-
if (i < 0 || i >= size) {
|
|
10424
|
-
return undefined;
|
|
10425
|
-
}
|
|
10426
|
-
const first = str.charCodeAt(i);
|
|
10427
|
-
if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) {
|
|
10428
|
-
const second = str.charCodeAt(i + 1);
|
|
10429
|
-
if (second >= 0xDC00 && second <= 0xDFFF) {
|
|
10430
|
-
return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
|
|
10431
|
-
}
|
|
10432
|
-
}
|
|
10433
|
-
return first;
|
|
10434
|
-
};
|
|
10435
10691
|
}
|
|
10436
10692
|
|
|
10437
10693
|
/** Bir fullPath'in statik (parametresiz) ve parametreli segment sayıları. */
|
|
@@ -10459,11 +10715,41 @@ function compareRouteRecords(a, b) {
|
|
|
10459
10715
|
return b.fullPath.length - a.fullPath.length;
|
|
10460
10716
|
}
|
|
10461
10717
|
class RouteCollection {
|
|
10462
|
-
routes;
|
|
10463
|
-
records = [];
|
|
10464
|
-
routesMap = new Map();
|
|
10465
10718
|
constructor(routes) {
|
|
10466
10719
|
this.routes = routes;
|
|
10720
|
+
this.records = [];
|
|
10721
|
+
this.routesMap = new Map();
|
|
10722
|
+
this.walk = (chain, parentPath, node, viaAlias = false) => {
|
|
10723
|
+
const fullPath = this.joinPaths(parentPath, node.path);
|
|
10724
|
+
if (!viaAlias) {
|
|
10725
|
+
const existing = node.fullPath;
|
|
10726
|
+
if (existing == null || (typeof existing === 'string' && existing.trim() === '')) {
|
|
10727
|
+
node.fullPath = fullPath;
|
|
10728
|
+
}
|
|
10729
|
+
if (node.name != null) {
|
|
10730
|
+
this.routesMap.set(node.name, node);
|
|
10731
|
+
}
|
|
10732
|
+
}
|
|
10733
|
+
const nextChain = [...chain, node];
|
|
10734
|
+
const aliases = node.alias == null ? [] : (Array.isArray(node.alias) ? node.alias : [node.alias]);
|
|
10735
|
+
const variants = [
|
|
10736
|
+
{ path: fullPath, isAlias: viaAlias },
|
|
10737
|
+
...aliases.map(a => ({ path: this.joinPaths(parentPath, a), isAlias: true }))
|
|
10738
|
+
];
|
|
10739
|
+
for (const variant of variants) {
|
|
10740
|
+
this.records.push({
|
|
10741
|
+
fullPath: variant.path,
|
|
10742
|
+
chain: nextChain,
|
|
10743
|
+
leaf: node,
|
|
10744
|
+
scanner: new Scanner(variant.path),
|
|
10745
|
+
aliasOf: variant.isAlias ? (node.fullPath ?? null) : null
|
|
10746
|
+
});
|
|
10747
|
+
if (node.childs && node.childs.length) {
|
|
10748
|
+
for (const child of node.childs)
|
|
10749
|
+
this.walk(nextChain, variant.path, child, variant.isAlias);
|
|
10750
|
+
}
|
|
10751
|
+
}
|
|
10752
|
+
};
|
|
10467
10753
|
this.build();
|
|
10468
10754
|
}
|
|
10469
10755
|
build() {
|
|
@@ -10473,37 +10759,6 @@ class RouteCollection {
|
|
|
10473
10759
|
this.walk([], "", r);
|
|
10474
10760
|
this.records.sort(compareRouteRecords);
|
|
10475
10761
|
}
|
|
10476
|
-
walk = (chain, parentPath, node, viaAlias = false) => {
|
|
10477
|
-
const fullPath = this.joinPaths(parentPath, node.path);
|
|
10478
|
-
if (!viaAlias) {
|
|
10479
|
-
const existing = node.fullPath;
|
|
10480
|
-
if (existing == null || (typeof existing === 'string' && existing.trim() === '')) {
|
|
10481
|
-
node.fullPath = fullPath;
|
|
10482
|
-
}
|
|
10483
|
-
if (node.name != null) {
|
|
10484
|
-
this.routesMap.set(node.name, node);
|
|
10485
|
-
}
|
|
10486
|
-
}
|
|
10487
|
-
const nextChain = [...chain, node];
|
|
10488
|
-
const aliases = node.alias == null ? [] : (Array.isArray(node.alias) ? node.alias : [node.alias]);
|
|
10489
|
-
const variants = [
|
|
10490
|
-
{ path: fullPath, isAlias: viaAlias },
|
|
10491
|
-
...aliases.map(a => ({ path: this.joinPaths(parentPath, a), isAlias: true }))
|
|
10492
|
-
];
|
|
10493
|
-
for (const variant of variants) {
|
|
10494
|
-
this.records.push({
|
|
10495
|
-
fullPath: variant.path,
|
|
10496
|
-
chain: nextChain,
|
|
10497
|
-
leaf: node,
|
|
10498
|
-
scanner: new Scanner(variant.path),
|
|
10499
|
-
aliasOf: variant.isAlias ? (node.fullPath ?? null) : null
|
|
10500
|
-
});
|
|
10501
|
-
if (node.childs && node.childs.length) {
|
|
10502
|
-
for (const child of node.childs)
|
|
10503
|
-
this.walk(nextChain, variant.path, child, variant.isAlias);
|
|
10504
|
-
}
|
|
10505
|
-
}
|
|
10506
|
-
};
|
|
10507
10762
|
joinPaths(parent, child) {
|
|
10508
10763
|
parent = parent || "";
|
|
10509
10764
|
child = child || "";
|
|
@@ -10520,19 +10775,22 @@ class RouteCollection {
|
|
|
10520
10775
|
}
|
|
10521
10776
|
|
|
10522
10777
|
class RoutingEngine {
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10778
|
+
constructor() {
|
|
10779
|
+
this.stack = null;
|
|
10780
|
+
this._revealed = new Set();
|
|
10781
|
+
this._previousPath = null;
|
|
10782
|
+
this._previousInstances = [];
|
|
10783
|
+
this.controlCache = new Map();
|
|
10784
|
+
this._navVersion = 0;
|
|
10785
|
+
this._pendingActivate = new Set();
|
|
10786
|
+
this.pendingMount = new WeakMap();
|
|
10787
|
+
this.pendingListeners = new WeakMap();
|
|
10788
|
+
}
|
|
10530
10789
|
register(mainApp, application, routingModule) {
|
|
10531
10790
|
this.root = mainApp;
|
|
10532
10791
|
this.application = application;
|
|
10533
10792
|
this.routingModule = routingModule;
|
|
10534
10793
|
}
|
|
10535
|
-
controlCache = new Map();
|
|
10536
10794
|
async evict(route) {
|
|
10537
10795
|
const targets = route ? [route] : Array.from(this.controlCache.keys());
|
|
10538
10796
|
for (const r of targets) {
|
|
@@ -10594,8 +10852,6 @@ class RoutingEngine {
|
|
|
10594
10852
|
}
|
|
10595
10853
|
return result;
|
|
10596
10854
|
}
|
|
10597
|
-
_navVersion = 0;
|
|
10598
|
-
_pendingActivate = new Set();
|
|
10599
10855
|
async execute(path, nav, route) {
|
|
10600
10856
|
route ??= {
|
|
10601
10857
|
target: path,
|
|
@@ -11066,9 +11322,7 @@ class RoutingEngine {
|
|
|
11066
11322
|
}
|
|
11067
11323
|
async activator(container) {
|
|
11068
11324
|
}
|
|
11069
|
-
|
|
11070
|
-
pendingListeners = new WeakMap();
|
|
11071
|
-
static OUTLET_WARN_MS = 3000;
|
|
11325
|
+
static { this.OUTLET_WARN_MS = 3000; }
|
|
11072
11326
|
async mountChain(instances, chain, container, navVersion) {
|
|
11073
11327
|
for (let index = 0; index < instances.length;) {
|
|
11074
11328
|
if (navVersion !== this._navVersion)
|
|
@@ -11200,17 +11454,20 @@ class RoutingEngine {
|
|
|
11200
11454
|
const pathOf = (uri) => uri.split('#')[0].split('?')[0];
|
|
11201
11455
|
const newHistorySession = () => Math.random().toString(36).slice(2, 10) + Date.now().toString(36);
|
|
11202
11456
|
class UrlRoutingModule {
|
|
11203
|
-
static MAX_REDIRECTS = 10;
|
|
11204
|
-
_routerOptions;
|
|
11205
|
-
routingEngine;
|
|
11206
|
-
routeCollection;
|
|
11207
|
-
routesMap = new Map();
|
|
11208
|
-
mainApp;
|
|
11209
|
-
application;
|
|
11210
|
-
_suppressBeforeEachOnce = false;
|
|
11211
|
-
_suppressMiddlewaresOnce = false;
|
|
11212
|
-
_scroll = null;
|
|
11457
|
+
static { this.MAX_REDIRECTS = 10; }
|
|
11213
11458
|
constructor(options, application) {
|
|
11459
|
+
this.routesMap = new Map();
|
|
11460
|
+
this._suppressBeforeEachOnce = false;
|
|
11461
|
+
this._suppressMiddlewaresOnce = false;
|
|
11462
|
+
this._scroll = null;
|
|
11463
|
+
this._stack = null;
|
|
11464
|
+
this._windowNavListener = null;
|
|
11465
|
+
this._historyStamp = null;
|
|
11466
|
+
this._pendingTraversal = null;
|
|
11467
|
+
this._currentUri = '___startup___';
|
|
11468
|
+
this._previousRoute = null;
|
|
11469
|
+
this._fallbackRoutes = {};
|
|
11470
|
+
this._navHandler = null;
|
|
11214
11471
|
this._routerOptions = options;
|
|
11215
11472
|
this.routeCollection = new RouteCollection(options.RouteItems);
|
|
11216
11473
|
this.routingEngine = new RoutingEngine();
|
|
@@ -11226,11 +11483,9 @@ class UrlRoutingModule {
|
|
|
11226
11483
|
this.routingEngine.stack = this._stack;
|
|
11227
11484
|
}
|
|
11228
11485
|
}
|
|
11229
|
-
_stack = null;
|
|
11230
11486
|
getHooks() {
|
|
11231
11487
|
return this._routerOptions.hooks;
|
|
11232
11488
|
}
|
|
11233
|
-
_windowNavListener = null;
|
|
11234
11489
|
start(mainApp, shellUri) {
|
|
11235
11490
|
this.mainApp = mainApp;
|
|
11236
11491
|
this.routingEngine.register(this.mainApp, this.application, this);
|
|
@@ -11262,8 +11517,7 @@ class UrlRoutingModule {
|
|
|
11262
11517
|
return '/';
|
|
11263
11518
|
}
|
|
11264
11519
|
}
|
|
11265
|
-
static HISTORY_STAMP_KEY = '__motifHistory';
|
|
11266
|
-
_historyStamp = null;
|
|
11520
|
+
static { this.HISTORY_STAMP_KEY = '__motifHistory'; }
|
|
11267
11521
|
_addressMode() {
|
|
11268
11522
|
const w = window;
|
|
11269
11523
|
return this._routerOptions.mode || (w?.location?.protocol === 'file:' ? 'hash' : 'history');
|
|
@@ -11359,7 +11613,6 @@ class UrlRoutingModule {
|
|
|
11359
11613
|
this._stampCurrentEntry(stamp);
|
|
11360
11614
|
this._historyStamp = stamp;
|
|
11361
11615
|
}
|
|
11362
|
-
_pendingTraversal = null;
|
|
11363
11616
|
async _onHistoryTraversal() {
|
|
11364
11617
|
const shown = this._historyStamp;
|
|
11365
11618
|
const arrived = this._readHistoryStamp();
|
|
@@ -11395,8 +11648,6 @@ class UrlRoutingModule {
|
|
|
11395
11648
|
}
|
|
11396
11649
|
catch { }
|
|
11397
11650
|
}
|
|
11398
|
-
_currentUri = '___startup___';
|
|
11399
|
-
_previousRoute = null;
|
|
11400
11651
|
get currentUri() {
|
|
11401
11652
|
return this._currentUri;
|
|
11402
11653
|
}
|
|
@@ -11635,7 +11886,6 @@ class UrlRoutingModule {
|
|
|
11635
11886
|
}
|
|
11636
11887
|
await this.routingEngine.evict(item);
|
|
11637
11888
|
}
|
|
11638
|
-
_fallbackRoutes = {};
|
|
11639
11889
|
_getFallbackRoute(kind) {
|
|
11640
11890
|
const existing = this._fallbackRoutes[kind];
|
|
11641
11891
|
if (existing)
|
|
@@ -11708,7 +11958,7 @@ class UrlRoutingModule {
|
|
|
11708
11958
|
}
|
|
11709
11959
|
return best ? { chain: best.rec.chain, params: best.params } : null;
|
|
11710
11960
|
}
|
|
11711
|
-
static _builtinNotFound = () => new Component('div', {
|
|
11961
|
+
static { this._builtinNotFound = () => new Component('div', {
|
|
11712
11962
|
initializeComponent(sender) {
|
|
11713
11963
|
sender.style({
|
|
11714
11964
|
padding: '20px', fontFamily: 'Arial, sans-serif', display: 'flex', 'flex-direction': 'column', 'align-items': 'center'
|
|
@@ -11716,8 +11966,8 @@ class UrlRoutingModule {
|
|
|
11716
11966
|
sender.element.appendChild($('h2', {}, ...['404 - Not Found']));
|
|
11717
11967
|
sender.element.appendChild($('p', {}, ...['The requested page was not found.']));
|
|
11718
11968
|
},
|
|
11719
|
-
});
|
|
11720
|
-
static _builtinError = () => new Component('div', {
|
|
11969
|
+
}); }
|
|
11970
|
+
static { this._builtinError = () => new Component('div', {
|
|
11721
11971
|
initializeComponent(sender) {
|
|
11722
11972
|
sender.style({
|
|
11723
11973
|
padding: '20px', fontFamily: 'Arial, sans-serif', display: 'flex', 'flex-direction': 'column', 'align-items': 'center'
|
|
@@ -11725,7 +11975,7 @@ class UrlRoutingModule {
|
|
|
11725
11975
|
sender.element.appendChild($('h2', {}, ...['Error']));
|
|
11726
11976
|
sender.element.appendChild($('p', {}, ...['The requested page could not be loaded.']));
|
|
11727
11977
|
},
|
|
11728
|
-
});
|
|
11978
|
+
}); }
|
|
11729
11979
|
async navigateByName(name, params, options) {
|
|
11730
11980
|
return await this.navigate(this.href(name, params), options);
|
|
11731
11981
|
}
|
|
@@ -11881,7 +12131,6 @@ class UrlRoutingModule {
|
|
|
11881
12131
|
}
|
|
11882
12132
|
return true;
|
|
11883
12133
|
}
|
|
11884
|
-
_navHandler = null;
|
|
11885
12134
|
_installLinkInterceptor() {
|
|
11886
12135
|
try {
|
|
11887
12136
|
if (this._navHandler)
|
|
@@ -12086,9 +12335,11 @@ class UrlRoutingModule {
|
|
|
12086
12335
|
}
|
|
12087
12336
|
|
|
12088
12337
|
class RouterState {
|
|
12089
|
-
|
|
12090
|
-
|
|
12091
|
-
|
|
12338
|
+
constructor() {
|
|
12339
|
+
this.version = new Signal(0);
|
|
12340
|
+
this._current = null;
|
|
12341
|
+
this._constructing = null;
|
|
12342
|
+
}
|
|
12092
12343
|
read() {
|
|
12093
12344
|
this.version.value;
|
|
12094
12345
|
return this._constructing ?? this._current;
|
|
@@ -12169,8 +12420,8 @@ function createRouter(state, module) {
|
|
|
12169
12420
|
let _globalApplication = null;
|
|
12170
12421
|
let startedApplicationBuilder = false;
|
|
12171
12422
|
class ApplicationBuilder {
|
|
12172
|
-
services = new ServiceCollection();
|
|
12173
12423
|
constructor() {
|
|
12424
|
+
this.services = new ServiceCollection();
|
|
12174
12425
|
if ((_globalApplication && _globalApplication.state !== 'disposing') || startedApplicationBuilder) {
|
|
12175
12426
|
throw new MotifError('MJX405', formatMotifMessage('MJX405'), { cause: _globalApplication });
|
|
12176
12427
|
}
|
|
@@ -12197,28 +12448,31 @@ class ApplicationBuilder {
|
|
|
12197
12448
|
}
|
|
12198
12449
|
}
|
|
12199
12450
|
class Application {
|
|
12200
|
-
provider;
|
|
12201
12451
|
static get main() {
|
|
12202
12452
|
return _globalApplication;
|
|
12203
12453
|
}
|
|
12204
12454
|
constructor(provider) {
|
|
12205
12455
|
this.provider = provider;
|
|
12456
|
+
this._state = 'initializing';
|
|
12457
|
+
this._middlewares = [];
|
|
12458
|
+
this._beforeEachGuards = [];
|
|
12459
|
+
this._routerState = new RouterState();
|
|
12460
|
+
this.router = createRouter(this._routerState, () => this.urlRoutingModule);
|
|
12461
|
+
this.events = new Map();
|
|
12462
|
+
this._routerConfig = null;
|
|
12463
|
+
this._routerRoot = null;
|
|
12464
|
+
this._startedRouter = null;
|
|
12465
|
+
this._lifecycleOff = null;
|
|
12466
|
+
this._isDevelopment = false;
|
|
12467
|
+
this._enableErrorLogging = true;
|
|
12206
12468
|
}
|
|
12207
|
-
static _disposingCount = 0;
|
|
12208
|
-
_state = 'initializing';
|
|
12209
|
-
_disposing;
|
|
12469
|
+
static { this._disposingCount = 0; }
|
|
12210
12470
|
get state() {
|
|
12211
12471
|
return this._state;
|
|
12212
12472
|
}
|
|
12213
|
-
_middlewares = [];
|
|
12214
|
-
_beforeEachGuards = [];
|
|
12215
|
-
_routerState = new RouterState();
|
|
12216
|
-
router = createRouter(this._routerState, () => this.urlRoutingModule);
|
|
12217
|
-
events = new Map();
|
|
12218
12473
|
static CreateBuilder() {
|
|
12219
12474
|
return new ApplicationBuilder();
|
|
12220
12475
|
}
|
|
12221
|
-
appShell;
|
|
12222
12476
|
getAppShell() {
|
|
12223
12477
|
return this.appShell;
|
|
12224
12478
|
}
|
|
@@ -12362,10 +12616,6 @@ class Application {
|
|
|
12362
12616
|
}
|
|
12363
12617
|
return true;
|
|
12364
12618
|
}
|
|
12365
|
-
urlRoutingModule;
|
|
12366
|
-
_routerConfig = null;
|
|
12367
|
-
_routerRoot = null;
|
|
12368
|
-
_startedRouter = null;
|
|
12369
12619
|
useRouter(options) {
|
|
12370
12620
|
let routes;
|
|
12371
12621
|
let mode;
|
|
@@ -12485,7 +12735,6 @@ class Application {
|
|
|
12485
12735
|
return true;
|
|
12486
12736
|
}
|
|
12487
12737
|
}
|
|
12488
|
-
_lifecycleOff = null;
|
|
12489
12738
|
onLifecycle(handler) {
|
|
12490
12739
|
this._installLifecycleListeners();
|
|
12491
12740
|
return this.on('motifjs-app-lifecycle', handler);
|
|
@@ -12527,8 +12776,6 @@ class Application {
|
|
|
12527
12776
|
for (const off of offs)
|
|
12528
12777
|
off();
|
|
12529
12778
|
}
|
|
12530
|
-
_isDevelopment = false;
|
|
12531
|
-
_enableErrorLogging = true;
|
|
12532
12779
|
get isDevelopmentModeEnabled() {
|
|
12533
12780
|
return this._isDevelopment;
|
|
12534
12781
|
}
|
|
@@ -12588,10 +12835,13 @@ exports.RouteCollection = RouteCollection;
|
|
|
12588
12835
|
exports.RouterState = RouterState;
|
|
12589
12836
|
exports.RouterView = RouterView;
|
|
12590
12837
|
exports.RoutingEngine = RoutingEngine;
|
|
12838
|
+
exports.SLOT_REGISTERED_EVENT = SLOT_REGISTERED_EVENT;
|
|
12839
|
+
exports.SLOT_UNREGISTERED_EVENT = SLOT_UNREGISTERED_EVENT;
|
|
12591
12840
|
exports.Scanner = Scanner;
|
|
12592
12841
|
exports.ServiceCollection = ServiceCollection;
|
|
12593
12842
|
exports.ServiceProvider = ServiceProvider;
|
|
12594
12843
|
exports.Signal = Signal;
|
|
12844
|
+
exports.TransportRegistry = TransportRegistry;
|
|
12595
12845
|
exports.UrlRoutingModule = UrlRoutingModule;
|
|
12596
12846
|
exports.asyncTracking = asyncTracking;
|
|
12597
12847
|
exports.autoRegistry = autoRegistry;
|
|
@@ -12629,4 +12879,4 @@ exports.untracked = untracked;
|
|
|
12629
12879
|
exports.useApplication = useApplication;
|
|
12630
12880
|
exports.useModel = useModel;
|
|
12631
12881
|
exports.useNavigation = useNavigation;
|
|
12632
|
-
//# sourceMappingURL=core-
|
|
12882
|
+
//# sourceMappingURL=core-DD3SssnS.cjs.map
|