@motifx/core 1.2.0-rc.2 → 1.2.0-rc.4
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-C5z0P3iY.esm.js → core-C-BpS-QN.esm.js} +1092 -834
- package/dist/chunks/core-C-BpS-QN.esm.js.map +1 -0
- package/dist/chunks/{core-CX1Sz73P.cjs → core-ZMoM1273.cjs} +1094 -833
- package/dist/chunks/core-ZMoM1273.cjs.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 -19
- package/dist/index.d.ts +46 -19
- 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 +1162 -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
|
@@ -2,10 +2,12 @@ function rethrowLater(error) {
|
|
|
2
2
|
setTimeout(() => { throw error; }, 0);
|
|
3
3
|
}
|
|
4
4
|
class ErrorHandler {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
constructor() {
|
|
6
|
+
this.unexpectedErrorHandler = rethrowLater;
|
|
7
|
+
this.listeners = [];
|
|
8
|
+
this._isDevelopment = false;
|
|
9
|
+
this._enableConsoleLogging = true;
|
|
10
|
+
}
|
|
9
11
|
setDevelopmentMode(isDev) {
|
|
10
12
|
this._isDevelopment = isDev;
|
|
11
13
|
}
|
|
@@ -346,7 +348,6 @@ const motifMessages = {
|
|
|
346
348
|
MJX611: () => `The devtools panel failed to load.`,
|
|
347
349
|
};
|
|
348
350
|
class MotifError extends Error {
|
|
349
|
-
code;
|
|
350
351
|
constructor(code, message, options) {
|
|
351
352
|
super(message, options);
|
|
352
353
|
this.name = 'MotifError';
|
|
@@ -378,7 +379,9 @@ function reportWarning(code, args, details) {
|
|
|
378
379
|
}
|
|
379
380
|
|
|
380
381
|
class DisposableCore {
|
|
381
|
-
|
|
382
|
+
constructor() {
|
|
383
|
+
this.disposableTracker = null;
|
|
384
|
+
}
|
|
382
385
|
notifyCreated(target) {
|
|
383
386
|
this.disposableTracker?.trackDisposable(target);
|
|
384
387
|
return target;
|
|
@@ -407,9 +410,8 @@ class DisposableCore {
|
|
|
407
410
|
const disposableCore = new DisposableCore();
|
|
408
411
|
|
|
409
412
|
class DisposableStore {
|
|
410
|
-
_items = new Set();
|
|
411
|
-
_closed = false;
|
|
412
413
|
constructor() {
|
|
414
|
+
this._closed = false;
|
|
413
415
|
disposableCore.notifyCreated(this);
|
|
414
416
|
}
|
|
415
417
|
get isDisposed() {
|
|
@@ -427,7 +429,7 @@ class DisposableStore {
|
|
|
427
429
|
reportWarning('MJX504', [], new Error().stack);
|
|
428
430
|
}
|
|
429
431
|
else {
|
|
430
|
-
this._items.add(item);
|
|
432
|
+
(this._items ??= new Set()).add(item);
|
|
431
433
|
}
|
|
432
434
|
return item;
|
|
433
435
|
}
|
|
@@ -438,20 +440,21 @@ class DisposableStore {
|
|
|
438
440
|
if (item === this) {
|
|
439
441
|
throw motifError('MJX505');
|
|
440
442
|
}
|
|
441
|
-
this._items
|
|
443
|
+
this._items?.delete(item);
|
|
442
444
|
item.dispose();
|
|
443
445
|
}
|
|
444
446
|
detach(item) {
|
|
445
|
-
if (item && this._items
|
|
447
|
+
if (item && this._items?.delete(item)) {
|
|
446
448
|
disposableCore.notifyOwner(item, null);
|
|
447
449
|
}
|
|
448
450
|
}
|
|
449
451
|
clear() {
|
|
450
|
-
|
|
452
|
+
const items = this._items;
|
|
453
|
+
if (!items || items.size === 0) {
|
|
451
454
|
return;
|
|
452
455
|
}
|
|
453
456
|
const failures = [];
|
|
454
|
-
for (const item of
|
|
457
|
+
for (const item of items) {
|
|
455
458
|
try {
|
|
456
459
|
item?.dispose();
|
|
457
460
|
}
|
|
@@ -459,7 +462,7 @@ class DisposableStore {
|
|
|
459
462
|
failures.push(error);
|
|
460
463
|
}
|
|
461
464
|
}
|
|
462
|
-
|
|
465
|
+
items.clear();
|
|
463
466
|
if (failures.length === 1) {
|
|
464
467
|
throw failures[0];
|
|
465
468
|
}
|
|
@@ -477,16 +480,34 @@ class DisposableStore {
|
|
|
477
480
|
}
|
|
478
481
|
}
|
|
479
482
|
|
|
483
|
+
let closedStore;
|
|
484
|
+
function sharedClosedStore() {
|
|
485
|
+
if (closedStore === undefined) {
|
|
486
|
+
closedStore = new DisposableStore();
|
|
487
|
+
closedStore.dispose();
|
|
488
|
+
}
|
|
489
|
+
return closedStore;
|
|
490
|
+
}
|
|
480
491
|
class Disposable {
|
|
481
|
-
_disposables
|
|
492
|
+
get _disposables() {
|
|
493
|
+
let store = this._store;
|
|
494
|
+
if (store === undefined) {
|
|
495
|
+
store = this._store = new DisposableStore();
|
|
496
|
+
disposableCore.notifyOwner(store, this);
|
|
497
|
+
}
|
|
498
|
+
return store;
|
|
499
|
+
}
|
|
482
500
|
constructor() {
|
|
501
|
+
this._store = undefined;
|
|
483
502
|
disposableCore.notifyCreated(this);
|
|
484
|
-
disposableCore.notifyOwner(this._disposables, this);
|
|
485
503
|
}
|
|
486
504
|
dispose() {
|
|
487
505
|
disposableCore.notifyDisposed(this);
|
|
488
|
-
const owned = this.
|
|
489
|
-
if (owned
|
|
506
|
+
const owned = this._store;
|
|
507
|
+
if (owned === undefined) {
|
|
508
|
+
this._store = sharedClosedStore();
|
|
509
|
+
}
|
|
510
|
+
else if (owned && typeof owned.dispose === 'function') {
|
|
490
511
|
owned.dispose();
|
|
491
512
|
}
|
|
492
513
|
else {
|
|
@@ -591,27 +612,17 @@ function removeArrayStack() {
|
|
|
591
612
|
}
|
|
592
613
|
|
|
593
614
|
class ListBinding {
|
|
594
|
-
component;
|
|
595
|
-
itemsFn;
|
|
596
|
-
renderFn;
|
|
597
|
-
options;
|
|
598
|
-
propertyName = "__list__";
|
|
599
|
-
dataSource;
|
|
600
|
-
dataMember;
|
|
601
|
-
formatString;
|
|
602
|
-
converter;
|
|
603
|
-
converterBack;
|
|
604
|
-
updateMode;
|
|
605
|
-
_isActive = false;
|
|
606
|
-
_effectCleanup;
|
|
607
|
-
_rendered = [];
|
|
608
|
-
_identityMap = new WeakMap();
|
|
609
|
-
container = motifFragment('list-container');
|
|
610
615
|
constructor(component, itemsFn, renderFn, options) {
|
|
611
616
|
this.component = component;
|
|
612
617
|
this.itemsFn = itemsFn;
|
|
613
618
|
this.renderFn = renderFn;
|
|
614
619
|
this.options = options;
|
|
620
|
+
this.propertyName = "__list__";
|
|
621
|
+
this._isActive = false;
|
|
622
|
+
this._rendered = [];
|
|
623
|
+
this._identityMap = new WeakMap();
|
|
624
|
+
this.container = motifFragment('list-container');
|
|
625
|
+
this.olditems = [];
|
|
615
626
|
this.component.controls.add(this.container);
|
|
616
627
|
}
|
|
617
628
|
activate() { if (this._isActive)
|
|
@@ -695,7 +706,6 @@ class ListBinding {
|
|
|
695
706
|
}
|
|
696
707
|
return component;
|
|
697
708
|
}
|
|
698
|
-
olditems = [];
|
|
699
709
|
get _indexSensitive() {
|
|
700
710
|
try {
|
|
701
711
|
return this.renderFn.length >= 2;
|
|
@@ -899,6 +909,10 @@ class ListBinding {
|
|
|
899
909
|
return oi === undefined ? -1 : oi;
|
|
900
910
|
});
|
|
901
911
|
const stable = new Set(longestIncreasingIndices(sources));
|
|
912
|
+
if (newComponents.length === items.length && isPermutation(sources, newComponents, this.container)) {
|
|
913
|
+
controls._reorder(newComponents, stable);
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
902
916
|
let anchor = null;
|
|
903
917
|
for (let i = newComponents.length - 1; i >= 0; i--) {
|
|
904
918
|
const comp = newComponents[i];
|
|
@@ -921,6 +935,19 @@ class ListBinding {
|
|
|
921
935
|
}
|
|
922
936
|
}
|
|
923
937
|
}
|
|
938
|
+
function isPermutation(sources, components, owner) {
|
|
939
|
+
const seen = new Uint8Array(sources.length);
|
|
940
|
+
for (let i = 0; i < sources.length; i++) {
|
|
941
|
+
const s = sources[i];
|
|
942
|
+
if (s === -1 || seen[s])
|
|
943
|
+
return false;
|
|
944
|
+
seen[s] = 1;
|
|
945
|
+
const c = components[i];
|
|
946
|
+
if (c.isDisposed || c.parent !== owner)
|
|
947
|
+
return false;
|
|
948
|
+
}
|
|
949
|
+
return true;
|
|
950
|
+
}
|
|
924
951
|
function longestIncreasingIndices(sources) {
|
|
925
952
|
const predecessors = new Array(sources.length).fill(-1);
|
|
926
953
|
const tails = [];
|
|
@@ -1008,13 +1035,11 @@ function findAppendableComponent$1(component) {
|
|
|
1008
1035
|
}
|
|
1009
1036
|
|
|
1010
1037
|
class LeakMonitor {
|
|
1011
|
-
threshold;
|
|
1012
|
-
name;
|
|
1013
|
-
_origins = new Map();
|
|
1014
|
-
_quietChecks = 0;
|
|
1015
1038
|
constructor(threshold, name) {
|
|
1016
1039
|
this.threshold = threshold;
|
|
1017
1040
|
this.name = name;
|
|
1041
|
+
this._origins = new Map();
|
|
1042
|
+
this._quietChecks = 0;
|
|
1018
1043
|
}
|
|
1019
1044
|
check(size) {
|
|
1020
1045
|
if (this.threshold <= 0 || size < this.threshold) {
|
|
@@ -1050,8 +1075,10 @@ function createRing() {
|
|
|
1050
1075
|
return ring;
|
|
1051
1076
|
}
|
|
1052
1077
|
class LinkedList {
|
|
1053
|
-
|
|
1054
|
-
|
|
1078
|
+
constructor() {
|
|
1079
|
+
this._ring = createRing();
|
|
1080
|
+
this._count = 0;
|
|
1081
|
+
}
|
|
1055
1082
|
get size() {
|
|
1056
1083
|
return this._count;
|
|
1057
1084
|
}
|
|
@@ -1110,10 +1137,11 @@ class LinkedList {
|
|
|
1110
1137
|
}
|
|
1111
1138
|
|
|
1112
1139
|
const COMPILER_CONTRACT = 1;
|
|
1140
|
+
const SUPPORTED_CONTRACTS = [1, 2];
|
|
1113
1141
|
const reported = new Set();
|
|
1114
1142
|
const pending = new Set();
|
|
1115
1143
|
function motifCompiled(contract) {
|
|
1116
|
-
if (contract
|
|
1144
|
+
if (SUPPORTED_CONTRACTS.includes(contract) || reported.has(contract))
|
|
1117
1145
|
return;
|
|
1118
1146
|
if (!isDevLike()) {
|
|
1119
1147
|
pending.add(contract);
|
|
@@ -1148,15 +1176,12 @@ var NodeTypes;
|
|
|
1148
1176
|
})(NodeTypes || (NodeTypes = {}));
|
|
1149
1177
|
|
|
1150
1178
|
class Effect {
|
|
1151
|
-
fn;
|
|
1152
|
-
callback;
|
|
1153
|
-
deps = [];
|
|
1154
|
-
active = true;
|
|
1155
|
-
running = false;
|
|
1156
|
-
scheduler;
|
|
1157
1179
|
constructor(fn, callback) {
|
|
1158
1180
|
this.fn = fn;
|
|
1159
1181
|
this.callback = callback;
|
|
1182
|
+
this.deps = [];
|
|
1183
|
+
this.active = true;
|
|
1184
|
+
this.running = false;
|
|
1160
1185
|
}
|
|
1161
1186
|
run() {
|
|
1162
1187
|
let value;
|
|
@@ -1402,21 +1427,10 @@ function readModelValue(el) {
|
|
|
1402
1427
|
return el.value;
|
|
1403
1428
|
}
|
|
1404
1429
|
class Binding {
|
|
1405
|
-
propertyName;
|
|
1406
|
-
dataSource;
|
|
1407
|
-
dataMember;
|
|
1408
|
-
formatString;
|
|
1409
|
-
converter;
|
|
1410
|
-
converterBack;
|
|
1411
|
-
setter;
|
|
1412
|
-
formatInfo;
|
|
1413
|
-
updateMode = 'onPropertyChanged';
|
|
1414
|
-
_isActive = false;
|
|
1415
|
-
_component;
|
|
1416
|
-
_effectCleanup;
|
|
1417
|
-
_memberPath = null;
|
|
1418
|
-
_memberPathSource;
|
|
1419
1430
|
constructor(component, propertyName, dataSource, dataMember, formatString, formatInfo) {
|
|
1431
|
+
this.updateMode = 'onPropertyChanged';
|
|
1432
|
+
this._isActive = false;
|
|
1433
|
+
this._memberPath = null;
|
|
1420
1434
|
this._component = component;
|
|
1421
1435
|
this.propertyName = propertyName;
|
|
1422
1436
|
this.dataSource = dataSource;
|
|
@@ -1668,10 +1682,9 @@ function isWritablePathKey(target, key) {
|
|
|
1668
1682
|
return true;
|
|
1669
1683
|
}
|
|
1670
1684
|
class BindingCollection {
|
|
1671
|
-
_items = [];
|
|
1672
|
-
_component;
|
|
1673
|
-
_branchScope = null;
|
|
1674
1685
|
constructor(component) {
|
|
1686
|
+
this._items = [];
|
|
1687
|
+
this._branchScope = null;
|
|
1675
1688
|
this._component = component;
|
|
1676
1689
|
}
|
|
1677
1690
|
_own(stop) {
|
|
@@ -1940,6 +1953,38 @@ class BindingCollection {
|
|
|
1940
1953
|
const [dataSource, dataMember, formatString, formatInfo] = args;
|
|
1941
1954
|
binding = new Binding(this._component, propertyName, dataSource, dataMember, formatString, formatInfo);
|
|
1942
1955
|
}
|
|
1956
|
+
const write = (raw) => {
|
|
1957
|
+
let value = raw;
|
|
1958
|
+
const b = binding;
|
|
1959
|
+
if (typeof b.converterBack === 'function') {
|
|
1960
|
+
value = b.converterBack(value);
|
|
1961
|
+
}
|
|
1962
|
+
if (typeof b.setter === 'function') {
|
|
1963
|
+
b.setter(value);
|
|
1964
|
+
return;
|
|
1965
|
+
}
|
|
1966
|
+
const member = b.dataMember;
|
|
1967
|
+
const source = b.dataSource;
|
|
1968
|
+
if (member && source != null) {
|
|
1969
|
+
const path = member.split('.');
|
|
1970
|
+
let target = source;
|
|
1971
|
+
for (let i = 0; i < path.length && target != null; i++) {
|
|
1972
|
+
const key = path[i];
|
|
1973
|
+
if (!isWritablePathKey(target, key))
|
|
1974
|
+
return;
|
|
1975
|
+
if (i === path.length - 1) {
|
|
1976
|
+
target[key] = value;
|
|
1977
|
+
}
|
|
1978
|
+
else {
|
|
1979
|
+
target = target[key];
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
else if (source != null && typeof source === 'object' && 'value' in source) {
|
|
1984
|
+
source.value = value;
|
|
1985
|
+
}
|
|
1986
|
+
};
|
|
1987
|
+
(this._modelWriters ??= new WeakMap()).set(binding, write);
|
|
1943
1988
|
const lowerTag = tn.toLowerCase();
|
|
1944
1989
|
if (lowerTag === 'input' || lowerTag === 'select' || lowerTag === 'textarea') {
|
|
1945
1990
|
const writeBack = () => {
|
|
@@ -1947,35 +1992,7 @@ class BindingCollection {
|
|
|
1947
1992
|
const el = this._component.element;
|
|
1948
1993
|
if (!el)
|
|
1949
1994
|
return;
|
|
1950
|
-
|
|
1951
|
-
const b = binding;
|
|
1952
|
-
if (typeof b.converterBack === 'function') {
|
|
1953
|
-
value = b.converterBack(value);
|
|
1954
|
-
}
|
|
1955
|
-
if (typeof b.setter === 'function') {
|
|
1956
|
-
b.setter(value);
|
|
1957
|
-
return;
|
|
1958
|
-
}
|
|
1959
|
-
const member = b.dataMember;
|
|
1960
|
-
const source = b.dataSource;
|
|
1961
|
-
if (member && source != null) {
|
|
1962
|
-
const path = member.split('.');
|
|
1963
|
-
let target = source;
|
|
1964
|
-
for (let i = 0; i < path.length && target != null; i++) {
|
|
1965
|
-
const key = path[i];
|
|
1966
|
-
if (!isWritablePathKey(target, key))
|
|
1967
|
-
return;
|
|
1968
|
-
if (i === path.length - 1) {
|
|
1969
|
-
target[key] = value;
|
|
1970
|
-
}
|
|
1971
|
-
else {
|
|
1972
|
-
target = target[key];
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
else if (source != null && typeof source === 'object' && 'value' in source) {
|
|
1977
|
-
source.value = value;
|
|
1978
|
-
}
|
|
1995
|
+
write(readModelValue(el));
|
|
1979
1996
|
}
|
|
1980
1997
|
catch { /* ignore */ }
|
|
1981
1998
|
};
|
|
@@ -1988,6 +2005,23 @@ class BindingCollection {
|
|
|
1988
2005
|
}
|
|
1989
2006
|
return binding;
|
|
1990
2007
|
}
|
|
2008
|
+
writeModel(value) {
|
|
2009
|
+
const writers = this._modelWriters;
|
|
2010
|
+
if (!writers)
|
|
2011
|
+
return false;
|
|
2012
|
+
let written = false;
|
|
2013
|
+
for (const binding of this._items) {
|
|
2014
|
+
const write = writers.get(binding);
|
|
2015
|
+
if (!write)
|
|
2016
|
+
continue;
|
|
2017
|
+
try {
|
|
2018
|
+
write(value);
|
|
2019
|
+
written = true;
|
|
2020
|
+
}
|
|
2021
|
+
catch { /* ignore */ }
|
|
2022
|
+
}
|
|
2023
|
+
return written;
|
|
2024
|
+
}
|
|
1991
2025
|
deactivateAll() {
|
|
1992
2026
|
this._items.forEach(binding => binding.deactivate());
|
|
1993
2027
|
this._items = [];
|
|
@@ -2047,10 +2081,10 @@ lazyBindMethods(BindingCollection.prototype, [
|
|
|
2047
2081
|
]);
|
|
2048
2082
|
|
|
2049
2083
|
class Emitter {
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2084
|
+
constructor() {
|
|
2085
|
+
this._subscriptions = [];
|
|
2086
|
+
this._disposed = false;
|
|
2087
|
+
}
|
|
2054
2088
|
get event() {
|
|
2055
2089
|
if (!this._subscribe) {
|
|
2056
2090
|
this._subscribe = (listener, thisArgs, disposables) => {
|
|
@@ -2134,10 +2168,6 @@ class Emitter {
|
|
|
2134
2168
|
}
|
|
2135
2169
|
|
|
2136
2170
|
class ComponentEmiter {
|
|
2137
|
-
component;
|
|
2138
|
-
_emitters;
|
|
2139
|
-
_sourceDisposables;
|
|
2140
|
-
_listenerDisposables;
|
|
2141
2171
|
constructor(component) {
|
|
2142
2172
|
this.component = component;
|
|
2143
2173
|
}
|
|
@@ -2288,9 +2318,6 @@ const WHEN_TRUTHY_METHODS = new Set(['close', 'hidePopover', 'requestSubmit', 'c
|
|
|
2288
2318
|
const ARGUMENT_METHODS = new Set(['setSelectionRange', 'setRangeText', 'setPointerCapture', 'releasePointerCapture', 'fastSeek']);
|
|
2289
2319
|
const PROPERTY_FIRST = new Set(['checked', 'selected', 'muted', 'indeterminate', 'srcObject']);
|
|
2290
2320
|
class controlAttribute {
|
|
2291
|
-
_parent;
|
|
2292
|
-
_attrMapStore;
|
|
2293
|
-
_watchersStore;
|
|
2294
2321
|
constructor(parent) {
|
|
2295
2322
|
this._parent = parent;
|
|
2296
2323
|
}
|
|
@@ -2822,14 +2849,10 @@ class controlAttribute {
|
|
|
2822
2849
|
}
|
|
2823
2850
|
|
|
2824
2851
|
class controlClass {
|
|
2825
|
-
_parent;
|
|
2826
2852
|
constructor(parent) {
|
|
2853
|
+
this._watcherSeq = 0;
|
|
2827
2854
|
this._parent = parent;
|
|
2828
2855
|
}
|
|
2829
|
-
_countsStore;
|
|
2830
|
-
_staticSetStore;
|
|
2831
|
-
_watchersStore;
|
|
2832
|
-
_watcherSeq = 0;
|
|
2833
2856
|
get _counts() { return this._countsStore ??= new Map(); }
|
|
2834
2857
|
get _staticSet() { return this._staticSetStore ??= new Set(); }
|
|
2835
2858
|
get _watchers() { return this._watchersStore ??= new Map(); }
|
|
@@ -2845,13 +2868,7 @@ class controlClass {
|
|
|
2845
2868
|
this._addStaticFromObject(value);
|
|
2846
2869
|
}
|
|
2847
2870
|
else {
|
|
2848
|
-
|
|
2849
|
-
if (valueStr.split(' ').length > 1) {
|
|
2850
|
-
this._addStaticFromArray(valueStr.split(' '));
|
|
2851
|
-
}
|
|
2852
|
-
else {
|
|
2853
|
-
this._addStaticFromString(valueStr);
|
|
2854
|
-
}
|
|
2871
|
+
this._addStaticNames(this._splitClasses(String(value ?? '')));
|
|
2855
2872
|
}
|
|
2856
2873
|
}
|
|
2857
2874
|
return this._parent;
|
|
@@ -2917,10 +2934,11 @@ class controlClass {
|
|
|
2917
2934
|
return null;
|
|
2918
2935
|
}
|
|
2919
2936
|
_splitClasses(input) {
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2937
|
+
if (!input)
|
|
2938
|
+
return [];
|
|
2939
|
+
if (!/\s/.test(input))
|
|
2940
|
+
return [input];
|
|
2941
|
+
return input.split(/\s+/).filter(s => s.length > 0);
|
|
2924
2942
|
}
|
|
2925
2943
|
_normalizeToSet(values, key) {
|
|
2926
2944
|
const result = new Set();
|
|
@@ -3019,14 +3037,31 @@ class controlClass {
|
|
|
3019
3037
|
}
|
|
3020
3038
|
}
|
|
3021
3039
|
}
|
|
3022
|
-
|
|
3023
|
-
if (
|
|
3040
|
+
_addStaticNames(names) {
|
|
3041
|
+
if (names.length === 0)
|
|
3024
3042
|
return;
|
|
3025
3043
|
const el = this._getElement();
|
|
3026
|
-
const
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3044
|
+
const staticSet = this._staticSet;
|
|
3045
|
+
const fresh = el && !el.hasAttribute('class') ? [] : null;
|
|
3046
|
+
for (const cls of names) {
|
|
3047
|
+
if (staticSet.has(cls))
|
|
3048
|
+
continue;
|
|
3049
|
+
staticSet.add(cls);
|
|
3050
|
+
const prevCount = this._counts.get(cls) || 0;
|
|
3051
|
+
this._counts.set(cls, prevCount + 1);
|
|
3052
|
+
if (prevCount === 0 && el) {
|
|
3053
|
+
if (fresh)
|
|
3054
|
+
fresh.push(cls);
|
|
3055
|
+
else {
|
|
3056
|
+
try {
|
|
3057
|
+
el.classList.add(cls);
|
|
3058
|
+
}
|
|
3059
|
+
catch { }
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
if (fresh && fresh.length > 0)
|
|
3064
|
+
el.setAttribute('class', fresh.join(' '));
|
|
3030
3065
|
}
|
|
3031
3066
|
_addStaticFromArray(arr) {
|
|
3032
3067
|
const el = this._getElement();
|
|
@@ -3347,8 +3382,6 @@ function runCssTransition(el, props, phase, done, appear = false) {
|
|
|
3347
3382
|
}
|
|
3348
3383
|
|
|
3349
3384
|
class ComponentMotif {
|
|
3350
|
-
_component;
|
|
3351
|
-
options;
|
|
3352
3385
|
constructor(component, options) {
|
|
3353
3386
|
this._component = component;
|
|
3354
3387
|
this.options = options;
|
|
@@ -3391,15 +3424,11 @@ class ComponentMotif {
|
|
|
3391
3424
|
const SIGNAL_TARGET = Symbol('SignalTarget');
|
|
3392
3425
|
const SIGNAL_KEY = Symbol('SignalKey');
|
|
3393
3426
|
class Signal {
|
|
3394
|
-
_value;
|
|
3395
|
-
_target;
|
|
3396
|
-
_key;
|
|
3397
|
-
_equals;
|
|
3398
|
-
_disposed = false;
|
|
3399
3427
|
static create(initialValue, equals) {
|
|
3400
3428
|
return new Signal(initialValue, equals);
|
|
3401
3429
|
}
|
|
3402
3430
|
constructor(initialValue, equals = Object.is) {
|
|
3431
|
+
this._disposed = false;
|
|
3403
3432
|
this._value = initialValue;
|
|
3404
3433
|
this._target = { [SIGNAL_TARGET]: true };
|
|
3405
3434
|
this._key = SIGNAL_KEY;
|
|
@@ -3456,14 +3485,9 @@ class Signal {
|
|
|
3456
3485
|
}
|
|
3457
3486
|
}
|
|
3458
3487
|
class Computed {
|
|
3459
|
-
_value;
|
|
3460
|
-
_dirty = true;
|
|
3461
|
-
_computing = false;
|
|
3462
|
-
_target;
|
|
3463
|
-
_key;
|
|
3464
|
-
_getter;
|
|
3465
|
-
_cleanup;
|
|
3466
3488
|
constructor(getter) {
|
|
3489
|
+
this._dirty = true;
|
|
3490
|
+
this._computing = false;
|
|
3467
3491
|
this._getter = getter;
|
|
3468
3492
|
this._target = { [SIGNAL_TARGET]: true };
|
|
3469
3493
|
this._key = SIGNAL_KEY;
|
|
@@ -3528,14 +3552,9 @@ class Computed {
|
|
|
3528
3552
|
}
|
|
3529
3553
|
}
|
|
3530
3554
|
class LazyComputed {
|
|
3531
|
-
_value;
|
|
3532
|
-
_dirty = true;
|
|
3533
|
-
_disposed = false;
|
|
3534
|
-
_target;
|
|
3535
|
-
_key;
|
|
3536
|
-
_getter;
|
|
3537
|
-
_runner;
|
|
3538
3555
|
constructor(getter) {
|
|
3556
|
+
this._dirty = true;
|
|
3557
|
+
this._disposed = false;
|
|
3539
3558
|
this._getter = getter;
|
|
3540
3559
|
this._target = { [SIGNAL_TARGET]: true };
|
|
3541
3560
|
this._key = SIGNAL_KEY;
|
|
@@ -3699,24 +3718,25 @@ function retireServiceOwner(owner) {
|
|
|
3699
3718
|
pins.set(owner, { scope: pinnedScopeOf(owner) ?? navigatingRoot._currentScope(), live: false });
|
|
3700
3719
|
}
|
|
3701
3720
|
class ServiceProvider {
|
|
3702
|
-
services;
|
|
3703
|
-
parent;
|
|
3704
|
-
root;
|
|
3705
|
-
scopeName;
|
|
3706
|
-
kind;
|
|
3707
|
-
singletonCache;
|
|
3708
|
-
scopedCache = new Map();
|
|
3709
|
-
transientSet = new Set();
|
|
3710
|
-
_autoDisposeTransients = false;
|
|
3711
|
-
pendingSingleton;
|
|
3712
|
-
pendingScoped = new Map();
|
|
3713
|
-
_navigation;
|
|
3714
|
-
_ownerlessSlot = { owner: null, ownerless: true };
|
|
3715
|
-
_navigationDisposed = false;
|
|
3716
|
-
_livePins = 0;
|
|
3717
|
-
_pending = false;
|
|
3718
3721
|
constructor(services, parent, root) {
|
|
3719
3722
|
this.services = services;
|
|
3723
|
+
this.scopedCache = new Map();
|
|
3724
|
+
this.transientSet = new Set();
|
|
3725
|
+
this._autoDisposeTransients = false;
|
|
3726
|
+
this.pendingScoped = new Map();
|
|
3727
|
+
this._ownerlessSlot = { owner: null, ownerless: true };
|
|
3728
|
+
this._navigationDisposed = false;
|
|
3729
|
+
this._livePins = 0;
|
|
3730
|
+
this._pending = false;
|
|
3731
|
+
this.describeToken = (t) => {
|
|
3732
|
+
if (typeof t === 'string')
|
|
3733
|
+
return t;
|
|
3734
|
+
if (typeof t === 'symbol')
|
|
3735
|
+
return t.toString();
|
|
3736
|
+
if (typeof t === 'function')
|
|
3737
|
+
return t.name || '[AnonymousClass]';
|
|
3738
|
+
return String(t);
|
|
3739
|
+
};
|
|
3720
3740
|
this.parent = parent;
|
|
3721
3741
|
this.root = root ?? this;
|
|
3722
3742
|
this.kind = this.root === this ? 'root' : 'user';
|
|
@@ -4100,15 +4120,6 @@ class ServiceProvider {
|
|
|
4100
4120
|
throw motifError('MJX404', chain);
|
|
4101
4121
|
}
|
|
4102
4122
|
}
|
|
4103
|
-
describeToken = (t) => {
|
|
4104
|
-
if (typeof t === 'string')
|
|
4105
|
-
return t;
|
|
4106
|
-
if (typeof t === 'symbol')
|
|
4107
|
-
return t.toString();
|
|
4108
|
-
if (typeof t === 'function')
|
|
4109
|
-
return t.name || '[AnonymousClass]';
|
|
4110
|
-
return String(t);
|
|
4111
|
-
};
|
|
4112
4123
|
describeTokenWithSource(t) {
|
|
4113
4124
|
const name = this.describeToken(t);
|
|
4114
4125
|
const d = this.services.getDescriptor(t);
|
|
@@ -4215,8 +4226,22 @@ function describeServiceToken(t) {
|
|
|
4215
4226
|
return t.name || '[AnonymousClass]';
|
|
4216
4227
|
return String(t);
|
|
4217
4228
|
}
|
|
4229
|
+
const F_BUILT = 1;
|
|
4230
|
+
const F_INITIALIZED = 2;
|
|
4231
|
+
const F_DISPOSED = 4;
|
|
4232
|
+
const F_CONFIGURED = 8;
|
|
4233
|
+
const F_PAINTING = 16;
|
|
4234
|
+
const F_PAINTED = 32;
|
|
4235
|
+
const F_HIDDEN = 64;
|
|
4236
|
+
const F_WAIT = 128;
|
|
4237
|
+
const F_POSTCONFIG = 256;
|
|
4238
|
+
const F_PREBOUND = 512;
|
|
4239
|
+
const F_DISPOSED_FIRED = 1024;
|
|
4240
|
+
function optionsOf(c) {
|
|
4241
|
+
return c?._motif?.options;
|
|
4242
|
+
}
|
|
4218
4243
|
function peekTransition(c) {
|
|
4219
|
-
return c?.
|
|
4244
|
+
return c?._motif?.options?.[TRANSITION_SLOT];
|
|
4220
4245
|
}
|
|
4221
4246
|
/**WAAPI keyframe (transitionIn) YA DA CSS class transition (name/classes) tanımlı olarak enter animasyonu varmı */
|
|
4222
4247
|
function clearNavDirection(c) {
|
|
@@ -4238,15 +4263,15 @@ function enterModeOf(container) {
|
|
|
4238
4263
|
const node = c.element;
|
|
4239
4264
|
if (!node || node.nodeType !== Node.COMMENT_NODE)
|
|
4240
4265
|
break;
|
|
4241
|
-
c = c.parent ?? c.
|
|
4266
|
+
c = c.parent ?? c._leaveContainer;
|
|
4242
4267
|
}
|
|
4243
4268
|
return transitionSettings.mode;
|
|
4244
4269
|
}
|
|
4245
4270
|
function leaveModeOf(c) {
|
|
4246
|
-
return enterModeOf(c.parent ?? c.
|
|
4271
|
+
return enterModeOf(c.parent ?? c._leaveContainer);
|
|
4247
4272
|
}
|
|
4248
4273
|
function wantsEnterTransition(c) {
|
|
4249
|
-
const o = c?.
|
|
4274
|
+
const o = c?._motif?.options;
|
|
4250
4275
|
const t = o?.[TRANSITION_SLOT];
|
|
4251
4276
|
return !!(o?.transitionIn || (t && (t.classes || (t.name && t.name.length > 0))));
|
|
4252
4277
|
}
|
|
@@ -4401,8 +4426,6 @@ function createTransitionApi(owner) {
|
|
|
4401
4426
|
return t;
|
|
4402
4427
|
}
|
|
4403
4428
|
class ComponentOptionsImpl {
|
|
4404
|
-
[OPTIONS_OWNER];
|
|
4405
|
-
[TRANSITION_SLOT];
|
|
4406
4429
|
constructor(owner) {
|
|
4407
4430
|
this[OPTIONS_OWNER] = owner;
|
|
4408
4431
|
}
|
|
@@ -4442,24 +4465,44 @@ class ComponentOptionsImpl {
|
|
|
4442
4465
|
}
|
|
4443
4466
|
}
|
|
4444
4467
|
hasEvent(name) {
|
|
4445
|
-
return
|
|
4468
|
+
return hasEventKey(this[OPTIONS_OWNER], name);
|
|
4446
4469
|
}
|
|
4447
4470
|
}
|
|
4448
4471
|
lazyBindMethods(ComponentOptionsImpl.prototype, ['getInstance', 'hasEvent']);
|
|
4449
4472
|
function fireLifecycle(component, name, ev) {
|
|
4450
|
-
const base = component.
|
|
4473
|
+
const base = component._baseCtx;
|
|
4451
4474
|
if (base)
|
|
4452
|
-
base.
|
|
4475
|
+
base._emiters?.fire(name, ev);
|
|
4476
|
+
}
|
|
4477
|
+
function runHooks(base, listName, sender, ev, label) {
|
|
4478
|
+
if (!base)
|
|
4479
|
+
return;
|
|
4480
|
+
let slot = base[listName];
|
|
4481
|
+
if (!slot)
|
|
4482
|
+
return;
|
|
4483
|
+
let from = 0;
|
|
4484
|
+
if (typeof slot === 'function') {
|
|
4485
|
+
const fn = slot;
|
|
4486
|
+
callReported(() => fn(sender, ev), 'MJX122', label);
|
|
4487
|
+
slot = base[listName];
|
|
4488
|
+
if (!Array.isArray(slot))
|
|
4489
|
+
return;
|
|
4490
|
+
from = 1;
|
|
4491
|
+
}
|
|
4492
|
+
for (let i = from; i < slot.length; i++) {
|
|
4493
|
+
const fn = slot[i];
|
|
4494
|
+
callReported(() => fn(sender, ev), 'MJX122', label);
|
|
4495
|
+
}
|
|
4453
4496
|
}
|
|
4454
4497
|
function hasLifecycleHook(component, hook, listName, lowerName, legacyProp) {
|
|
4455
4498
|
if (component[hook])
|
|
4456
4499
|
return true;
|
|
4457
|
-
const
|
|
4458
|
-
if (
|
|
4500
|
+
const base = component._baseCtx;
|
|
4501
|
+
if (base?.[listName])
|
|
4459
4502
|
return true;
|
|
4460
4503
|
if (legacyProp && component[legacyProp])
|
|
4461
4504
|
return true;
|
|
4462
|
-
return
|
|
4505
|
+
return !!base?._emiters?.hasListeners(lowerName);
|
|
4463
4506
|
}
|
|
4464
4507
|
const RESERVED_METHODS = ['build', 'setState', 'reState', 'setText', 'style', 'dispose', 'disposeAsync', 'using', 'doWork', 'getService', '$', 'useModel', 'context', 'siblings', 'serviceProvider', 'isWait'];
|
|
4465
4508
|
const checkedComponentClasses = new WeakSet();
|
|
@@ -4528,21 +4571,17 @@ const ComponentHelper = {
|
|
|
4528
4571
|
callReported(() => component.initializeComponent(sender, ev), 'MJX122', 'initializeComponent');
|
|
4529
4572
|
}
|
|
4530
4573
|
// 2) aggregated extra initializeComponent handlers (örn, from props)
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
}
|
|
4574
|
+
const compiled = component._init;
|
|
4575
|
+
if (compiled) {
|
|
4576
|
+
callReported(() => compiled(sender, ev), 'MJX122', 'initializeComponent');
|
|
4535
4577
|
}
|
|
4578
|
+
runHooks(component._baseCtx, '_initializeComponentHandlers', sender, ev, 'initializeComponent');
|
|
4536
4579
|
// 3) class method oninitializeComponent
|
|
4537
4580
|
if (typeof component.oninitializeComponent === 'function') {
|
|
4538
4581
|
callReported(() => component.oninitializeComponent(sender, ev), 'MJX122', 'oninitializeComponent');
|
|
4539
4582
|
}
|
|
4540
4583
|
// 4) aggregated extra oninitializeComponent handlers (örn, from props)
|
|
4541
|
-
|
|
4542
|
-
for (const fn of component._base._onInitializeComponentHandlers) {
|
|
4543
|
-
callReported(() => fn(sender, ev), 'MJX122', 'oninitializeComponent');
|
|
4544
|
-
}
|
|
4545
|
-
}
|
|
4584
|
+
runHooks(component._baseCtx, '_onInitializeComponentHandlers', sender, ev, 'oninitializeComponent');
|
|
4546
4585
|
},
|
|
4547
4586
|
callDisposing(component) {
|
|
4548
4587
|
if (!component || component.isDisposed) {
|
|
@@ -4555,11 +4594,7 @@ const ComponentHelper = {
|
|
|
4555
4594
|
if (component.onDisposing) {
|
|
4556
4595
|
callReported(() => component.onDisposing(sender, ev), 'MJX122', 'onDisposing');
|
|
4557
4596
|
}
|
|
4558
|
-
|
|
4559
|
-
for (const fn of component._base._onDisposingHandlers) {
|
|
4560
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onDisposing');
|
|
4561
|
-
}
|
|
4562
|
-
}
|
|
4597
|
+
runHooks(component._baseCtx, '_onDisposingHandlers', sender, ev, 'onDisposing');
|
|
4563
4598
|
if (component.ondisposing) {
|
|
4564
4599
|
callReported(() => component.ondisposing(sender, ev), 'MJX122', 'ondisposing');
|
|
4565
4600
|
}
|
|
@@ -4573,11 +4608,7 @@ const ComponentHelper = {
|
|
|
4573
4608
|
if (component.onActivated) {
|
|
4574
4609
|
callReported(() => component.onActivated(sender, ev), 'MJX122', 'onActivated');
|
|
4575
4610
|
}
|
|
4576
|
-
|
|
4577
|
-
for (const fn of component._base._onActivatedHandlers) {
|
|
4578
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onActivated');
|
|
4579
|
-
}
|
|
4580
|
-
}
|
|
4611
|
+
runHooks(component._baseCtx, '_onActivatedHandlers', sender, ev, 'onActivated');
|
|
4581
4612
|
fireLifecycle(component, 'onactivated', ev);
|
|
4582
4613
|
},
|
|
4583
4614
|
callDeactivated(component) {
|
|
@@ -4588,11 +4619,7 @@ const ComponentHelper = {
|
|
|
4588
4619
|
if (component.onDeactivated) {
|
|
4589
4620
|
callReported(() => component.onDeactivated(sender, ev), 'MJX122', 'onDeactivated');
|
|
4590
4621
|
}
|
|
4591
|
-
|
|
4592
|
-
for (const fn of component._base._onDeactivatedHandlers) {
|
|
4593
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onDeactivated');
|
|
4594
|
-
}
|
|
4595
|
-
}
|
|
4622
|
+
runHooks(component._baseCtx, '_onDeactivatedHandlers', sender, ev, 'onDeactivated');
|
|
4596
4623
|
fireLifecycle(component, 'ondeactivated', ev);
|
|
4597
4624
|
},
|
|
4598
4625
|
deactivateTree(component, deep = true) {
|
|
@@ -4604,7 +4631,7 @@ const ComponentHelper = {
|
|
|
4604
4631
|
if (!deep || component.isDisposed) {
|
|
4605
4632
|
return;
|
|
4606
4633
|
}
|
|
4607
|
-
for (const c of component.
|
|
4634
|
+
for (const c of childrenOf(component).slice()) {
|
|
4608
4635
|
if (c && !c.isDisposed && c.isVisible && !c.isWait) {
|
|
4609
4636
|
ComponentHelper.deactivateTree(c, true);
|
|
4610
4637
|
}
|
|
@@ -4619,27 +4646,26 @@ const ComponentHelper = {
|
|
|
4619
4646
|
if (!deep || component.isDisposed) {
|
|
4620
4647
|
return;
|
|
4621
4648
|
}
|
|
4622
|
-
for (const c of component.
|
|
4649
|
+
for (const c of childrenOf(component).slice()) {
|
|
4623
4650
|
if (c && !c.isDisposed && c.isVisible && !c.isWait) {
|
|
4624
4651
|
ComponentHelper.activateTree(c, true);
|
|
4625
4652
|
}
|
|
4626
4653
|
}
|
|
4627
4654
|
},
|
|
4628
4655
|
callDisposed(component) {
|
|
4629
|
-
if (!component ||
|
|
4656
|
+
if (!component || (component._flags & F_DISPOSED_FIRED) !== 0) {
|
|
4657
|
+
return;
|
|
4658
|
+
}
|
|
4659
|
+
if (component.isDisposed && !component.element && component._baseCtx === undefined) {
|
|
4630
4660
|
return;
|
|
4631
4661
|
}
|
|
4632
|
-
component.
|
|
4662
|
+
component._flags |= F_DISPOSED_FIRED;
|
|
4633
4663
|
if (hasLifecycleHook(component, 'onDisposed', '_onDisposedHandlers', 'ondisposed', 'ondisposed')) {
|
|
4634
4664
|
const sender = component, ev = { cancel: false };
|
|
4635
4665
|
if (component.onDisposed) {
|
|
4636
4666
|
callReported(() => component.onDisposed(sender, ev), 'MJX122', 'onDisposed');
|
|
4637
4667
|
}
|
|
4638
|
-
|
|
4639
|
-
for (const fn of component._base._onDisposedHandlers) {
|
|
4640
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onDisposed');
|
|
4641
|
-
}
|
|
4642
|
-
}
|
|
4668
|
+
runHooks(component._baseCtx, '_onDisposedHandlers', sender, ev, 'onDisposed');
|
|
4643
4669
|
if (component.ondisposed) {
|
|
4644
4670
|
callReported(() => component.ondisposed(sender, ev), 'MJX122', 'ondisposed');
|
|
4645
4671
|
}
|
|
@@ -4659,11 +4685,7 @@ const ComponentHelper = {
|
|
|
4659
4685
|
if (component.onBuilt) {
|
|
4660
4686
|
callReported(() => component.onBuilt(sender, ev), 'MJX122', 'onBuilt');
|
|
4661
4687
|
}
|
|
4662
|
-
|
|
4663
|
-
for (const fn of component._base._onBuiltHandlers) {
|
|
4664
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onBuilt');
|
|
4665
|
-
}
|
|
4666
|
-
}
|
|
4688
|
+
runHooks(component._baseCtx, '_onBuiltHandlers', sender, ev, 'onBuilt');
|
|
4667
4689
|
if (component.onbuilt) {
|
|
4668
4690
|
callReported(() => component.onbuilt(sender, ev), 'MJX122', 'onbuilt');
|
|
4669
4691
|
}
|
|
@@ -4675,11 +4697,11 @@ const ComponentHelper = {
|
|
|
4675
4697
|
catch { }
|
|
4676
4698
|
},
|
|
4677
4699
|
scheduleMounted(component) {
|
|
4678
|
-
if (!component || component.isDisposed || component.
|
|
4700
|
+
if (!component || component.isDisposed || component._baseCtx?._mountedScheduled) {
|
|
4679
4701
|
return;
|
|
4680
4702
|
}
|
|
4681
4703
|
const hasHook = typeof component.onMounted === 'function'
|
|
4682
|
-
||
|
|
4704
|
+
|| !!component._baseCtx?._onMountedHandlers
|
|
4683
4705
|
|| typeof component.onmounted === 'function';
|
|
4684
4706
|
if (!hasHook) {
|
|
4685
4707
|
return;
|
|
@@ -4708,11 +4730,7 @@ const ComponentHelper = {
|
|
|
4708
4730
|
if (component.onMounted) {
|
|
4709
4731
|
callReported(() => component.onMounted(sender, ev), 'MJX122', 'onMounted');
|
|
4710
4732
|
}
|
|
4711
|
-
|
|
4712
|
-
for (const fn of component._base._onMountedHandlers) {
|
|
4713
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onMounted');
|
|
4714
|
-
}
|
|
4715
|
-
}
|
|
4733
|
+
runHooks(component._baseCtx, '_onMountedHandlers', sender, ev, 'onMounted');
|
|
4716
4734
|
if (component.onmounted) {
|
|
4717
4735
|
callReported(() => component.onmounted(sender, ev), 'MJX122', 'onmounted');
|
|
4718
4736
|
}
|
|
@@ -4729,11 +4747,7 @@ const ComponentHelper = {
|
|
|
4729
4747
|
if (component.onBuilding) {
|
|
4730
4748
|
callReported(() => component.onBuilding(sender, ev), 'MJX122', 'onBuilding');
|
|
4731
4749
|
}
|
|
4732
|
-
|
|
4733
|
-
for (const fn of component._base._onBuildingHandlers) {
|
|
4734
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onBuilding');
|
|
4735
|
-
}
|
|
4736
|
-
}
|
|
4750
|
+
runHooks(component._baseCtx, '_onBuildingHandlers', sender, ev, 'onBuilding');
|
|
4737
4751
|
fireLifecycle(component, 'onbuilding', ev);
|
|
4738
4752
|
},
|
|
4739
4753
|
callConfig(component) {
|
|
@@ -4741,8 +4755,9 @@ const ComponentHelper = {
|
|
|
4741
4755
|
return;
|
|
4742
4756
|
}
|
|
4743
4757
|
component.isConfigured = true;
|
|
4744
|
-
|
|
4745
|
-
|
|
4758
|
+
const preconfig = component._motif?.options?._preconfig;
|
|
4759
|
+
if (preconfig) {
|
|
4760
|
+
safeCallSilent(() => preconfig(component), 'Component._preconfig');
|
|
4746
4761
|
}
|
|
4747
4762
|
if (!hasLifecycleHook(component, 'onConfig', '_onConfigHandlers', 'onconfig')) {
|
|
4748
4763
|
return;
|
|
@@ -4751,21 +4766,17 @@ const ComponentHelper = {
|
|
|
4751
4766
|
if (component.onConfig) {
|
|
4752
4767
|
callReported(() => component.onConfig(sender, ev), 'MJX122', 'onConfig');
|
|
4753
4768
|
}
|
|
4754
|
-
|
|
4755
|
-
for (const fn of component._base._onConfigHandlers) {
|
|
4756
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onConfig');
|
|
4757
|
-
}
|
|
4758
|
-
}
|
|
4769
|
+
runHooks(component._baseCtx, '_onConfigHandlers', sender, ev, 'onConfig');
|
|
4759
4770
|
fireLifecycle(component, 'onconfig', ev);
|
|
4760
4771
|
},
|
|
4761
4772
|
callConfigured(component) {
|
|
4762
|
-
if (component.
|
|
4773
|
+
if ((component._flags & F_POSTCONFIG) !== 0) {
|
|
4763
4774
|
return;
|
|
4764
4775
|
}
|
|
4765
|
-
if (component?.
|
|
4776
|
+
if (component?._baseCtx?._configDeferred && !component.isConfigured) {
|
|
4766
4777
|
ComponentHelper.callConfig(component);
|
|
4767
4778
|
}
|
|
4768
|
-
component.
|
|
4779
|
+
component._flags |= F_POSTCONFIG;
|
|
4769
4780
|
if (!component || component.isDisposed) {
|
|
4770
4781
|
return;
|
|
4771
4782
|
}
|
|
@@ -4776,11 +4787,7 @@ const ComponentHelper = {
|
|
|
4776
4787
|
if (component.onConfigured) {
|
|
4777
4788
|
callReported(() => component.onConfigured(sender, ev), 'MJX122', 'onConfigured');
|
|
4778
4789
|
}
|
|
4779
|
-
|
|
4780
|
-
for (const fn of component._base._onConfiguredHandlers) {
|
|
4781
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onConfigured');
|
|
4782
|
-
}
|
|
4783
|
-
}
|
|
4790
|
+
runHooks(component._baseCtx, '_onConfiguredHandlers', sender, ev, 'onConfigured');
|
|
4784
4791
|
fireLifecycle(component, 'onconfigured', ev);
|
|
4785
4792
|
},
|
|
4786
4793
|
callOnInitialized(component) {
|
|
@@ -4795,11 +4802,7 @@ const ComponentHelper = {
|
|
|
4795
4802
|
if (component.onInitialized) {
|
|
4796
4803
|
callReported(() => component.onInitialized(sender, ev), 'MJX122', 'onInitialized');
|
|
4797
4804
|
}
|
|
4798
|
-
|
|
4799
|
-
for (const fn of component._base._onInitializedHandlers) {
|
|
4800
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onInitialized');
|
|
4801
|
-
}
|
|
4802
|
-
}
|
|
4805
|
+
runHooks(component._baseCtx, '_onInitializedHandlers', sender, ev, 'onInitialized');
|
|
4803
4806
|
fireLifecycle(component, 'oninitialized', ev);
|
|
4804
4807
|
},
|
|
4805
4808
|
callOnInitializing(component) {
|
|
@@ -4813,29 +4816,21 @@ const ComponentHelper = {
|
|
|
4813
4816
|
if (component.onInitializing) {
|
|
4814
4817
|
callReported(() => component.onInitializing(sender, ev), 'MJX122', 'onInitializing');
|
|
4815
4818
|
}
|
|
4816
|
-
|
|
4817
|
-
for (const fn of component._base._onInitializingHandlers) {
|
|
4818
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onInitializing');
|
|
4819
|
-
}
|
|
4820
|
-
}
|
|
4819
|
+
runHooks(component._baseCtx, '_onInitializingHandlers', sender, ev, 'onInitializing');
|
|
4821
4820
|
fireLifecycle(component, 'oninitializing', ev);
|
|
4822
4821
|
},
|
|
4823
|
-
callVisibilityChanged(component) {
|
|
4822
|
+
callVisibilityChanged(component, visible) {
|
|
4824
4823
|
if (!component || component.isDisposed) {
|
|
4825
4824
|
return;
|
|
4826
4825
|
}
|
|
4827
4826
|
if (!hasLifecycleHook(component, 'onVisibilityChanged', '_onVisibilityChangedHandlers', 'onvisibilitychanged')) {
|
|
4828
4827
|
return;
|
|
4829
4828
|
}
|
|
4830
|
-
const sender = component, ev = { cancel: false };
|
|
4829
|
+
const sender = component, ev = { cancel: false, visible };
|
|
4831
4830
|
if (component.onVisibilityChanged) {
|
|
4832
4831
|
callReported(() => component.onVisibilityChanged(sender, ev), 'MJX122', 'onVisibilityChanged');
|
|
4833
4832
|
}
|
|
4834
|
-
|
|
4835
|
-
for (const fn of component._base._onVisibilityChangedHandlers) {
|
|
4836
|
-
callReported(() => fn(sender, ev), 'MJX122', 'onVisibilityChanged');
|
|
4837
|
-
}
|
|
4838
|
-
}
|
|
4833
|
+
runHooks(component._baseCtx, '_onVisibilityChangedHandlers', sender, ev, 'onVisibilityChanged');
|
|
4839
4834
|
fireLifecycle(component, 'onvisibilitychanged', ev);
|
|
4840
4835
|
},
|
|
4841
4836
|
findFragmentContent(c) {
|
|
@@ -4864,9 +4859,12 @@ const ComponentHelper = {
|
|
|
4864
4859
|
ComponentHelper.callConfigured(c);
|
|
4865
4860
|
if (c.isDisposed)
|
|
4866
4861
|
return;
|
|
4867
|
-
c
|
|
4868
|
-
if (c.isWait)
|
|
4862
|
+
activatePreBindings(c);
|
|
4863
|
+
if (c.isWait) {
|
|
4864
|
+
if (this.isBuilt)
|
|
4865
|
+
placeTrace(this, c);
|
|
4869
4866
|
return;
|
|
4867
|
+
}
|
|
4870
4868
|
const cisBuilt = c.isBuilt;
|
|
4871
4869
|
if (!this.isBuilt) {
|
|
4872
4870
|
return;
|
|
@@ -4874,7 +4872,7 @@ const ComponentHelper = {
|
|
|
4874
4872
|
if (c.isWait) {
|
|
4875
4873
|
return;
|
|
4876
4874
|
}
|
|
4877
|
-
const enterSeq = c.
|
|
4875
|
+
const enterSeq = c._baseCtx?._enterSeq;
|
|
4878
4876
|
if (!c.isBuilt) {
|
|
4879
4877
|
c.build();
|
|
4880
4878
|
}
|
|
@@ -4903,40 +4901,12 @@ const ComponentHelper = {
|
|
|
4903
4901
|
if (cisBuilt && c.element.nodeType == Node.COMMENT_NODE && controlElement?.childNodes.length == 0 && c.controls.length > 0) {
|
|
4904
4902
|
controlElement = ComponentHelper.getContent.call(c);
|
|
4905
4903
|
}
|
|
4906
|
-
let referenceNode = null;
|
|
4907
4904
|
const insertHost = appendableElement?.element;
|
|
4908
|
-
const
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
const candidate = n.isVisible
|
|
4912
|
-
? n.element
|
|
4913
|
-
: (n.motif.options?.placeholder ?? null);
|
|
4914
|
-
if (!candidate)
|
|
4915
|
-
return null;
|
|
4916
|
-
return (insertHost && candidate.parentNode === insertHost) ? candidate : null;
|
|
4917
|
-
};
|
|
4918
|
-
const siblings = this.controls.items;
|
|
4919
|
-
for (let i = currentIndex + 1; i < siblings.length; i++) {
|
|
4920
|
-
const candidate = domReferenceOf(siblings[i]);
|
|
4921
|
-
if (candidate) {
|
|
4922
|
-
referenceNode = candidate;
|
|
4923
|
-
break;
|
|
4924
|
-
}
|
|
4925
|
-
}
|
|
4926
|
-
if (!referenceNode) {
|
|
4927
|
-
if (this.element.nodeType === Node.COMMENT_NODE) {
|
|
4928
|
-
const close = this.motif.options.closeFragment;
|
|
4929
|
-
referenceNode = (close && insertHost && close.parentNode === insertHost) ? close : null;
|
|
4930
|
-
}
|
|
4931
|
-
else {
|
|
4932
|
-
referenceNode = null;
|
|
4933
|
-
}
|
|
4934
|
-
}
|
|
4905
|
+
const trace = c.motif.options.placeholder;
|
|
4906
|
+
const ownTrace = c.isVisible && trace && insertHost && trace.parentNode === insertHost ? trace : null;
|
|
4907
|
+
const referenceNode = ownTrace ?? (insertHost ? followingAnchor(this, currentIndex + 1, insertHost) : null);
|
|
4935
4908
|
if (!c.isVisible) {
|
|
4936
|
-
|
|
4937
|
-
const isFromListOrKeyed = !!(c.motif.options?.__fromList || typeof c.motif.options?.indexkey !== 'undefined' || typeof c.motif.options?.__key !== 'undefined');
|
|
4938
|
-
const strategy = cfg === 'placeholder' ? 'placeholder' : (cfg === 'detach' ? 'detach' : (isFromListOrKeyed ? 'detach' : 'placeholder'));
|
|
4939
|
-
if (strategy === 'placeholder') {
|
|
4909
|
+
if (keepsTrace(c)) {
|
|
4940
4910
|
if (!c.motif.options.placeholder) {
|
|
4941
4911
|
c.motif.options.placeholder = dom.createComment("h");
|
|
4942
4912
|
}
|
|
@@ -4974,9 +4944,11 @@ const ComponentHelper = {
|
|
|
4974
4944
|
else {
|
|
4975
4945
|
appendableElement?.element.appendChild(controlElement);
|
|
4976
4946
|
}
|
|
4947
|
+
if (ownTrace && ownTrace.parentNode)
|
|
4948
|
+
ownTrace.parentNode.removeChild(ownTrace);
|
|
4977
4949
|
}
|
|
4978
4950
|
if (c.isVisible) {
|
|
4979
|
-
const enteredInBuild = !cisBuilt && c.
|
|
4951
|
+
const enteredInBuild = !cisBuilt && c._baseCtx?._enterSeq !== enterSeq;
|
|
4980
4952
|
!enteredInBuild && wantsEnterTransition(c) && c.motif.options.transition.enterTransition(() => { });
|
|
4981
4953
|
if (cisBuilt) {
|
|
4982
4954
|
ComponentHelper.activateTree(c);
|
|
@@ -4990,7 +4962,11 @@ const ComponentHelper = {
|
|
|
4990
4962
|
if (this.element.nodeType == Node.COMMENT_NODE) {
|
|
4991
4963
|
this.motif.options.cache?.appendChild(this.element);
|
|
4992
4964
|
this.controls.forEach(child => {
|
|
4993
|
-
|
|
4965
|
+
const node = child.isWait || !child.isVisible
|
|
4966
|
+
? (keepsTrace(child) ? (child.motif.options.placeholder ??= dom.createComment("h")) : undefined)
|
|
4967
|
+
: ComponentHelper.getContent.call(child);
|
|
4968
|
+
if (node)
|
|
4969
|
+
this.motif.options.cache?.appendChild(node);
|
|
4994
4970
|
});
|
|
4995
4971
|
this.motif.options.cache?.appendChild(this.motif.options.closeFragment);
|
|
4996
4972
|
return this.motif.options.cache;
|
|
@@ -5039,34 +5015,72 @@ const ComponentHelper = {
|
|
|
5039
5015
|
}
|
|
5040
5016
|
}
|
|
5041
5017
|
};
|
|
5018
|
+
function keepsTrace(c) {
|
|
5019
|
+
return optionsOf(c)?.hideStrategy !== 'detach';
|
|
5020
|
+
}
|
|
5021
|
+
function domAnchor(c, host) {
|
|
5022
|
+
const trace = optionsOf(c)?.placeholder;
|
|
5023
|
+
if (trace && trace.parentNode === host)
|
|
5024
|
+
return trace;
|
|
5025
|
+
const node = c.element;
|
|
5026
|
+
return node && node.parentNode === host ? node : null;
|
|
5027
|
+
}
|
|
5028
|
+
function followingAnchor(owner, start, host) {
|
|
5029
|
+
const siblings = owner.controls.items;
|
|
5030
|
+
for (let i = start; i < siblings.length; i++) {
|
|
5031
|
+
const anchor = siblings[i] ? domAnchor(siblings[i], host) : null;
|
|
5032
|
+
if (anchor)
|
|
5033
|
+
return anchor;
|
|
5034
|
+
}
|
|
5035
|
+
if (owner.element.nodeType === Node.COMMENT_NODE) {
|
|
5036
|
+
const close = optionsOf(owner)?.closeFragment;
|
|
5037
|
+
return close && close.parentNode === host ? close : null;
|
|
5038
|
+
}
|
|
5039
|
+
return null;
|
|
5040
|
+
}
|
|
5041
|
+
function placeTrace(owner, c) {
|
|
5042
|
+
if (!keepsTrace(c))
|
|
5043
|
+
return;
|
|
5044
|
+
const host = findAppendableComponent(owner)?.element;
|
|
5045
|
+
if (!host)
|
|
5046
|
+
return;
|
|
5047
|
+
const element = c.element;
|
|
5048
|
+
if (element && element.parentNode === host)
|
|
5049
|
+
return;
|
|
5050
|
+
const opts = c.motif.options;
|
|
5051
|
+
const trace = opts.placeholder ?? (opts.placeholder = dom.createComment("h"));
|
|
5052
|
+
if (trace.parentNode === host)
|
|
5053
|
+
return;
|
|
5054
|
+
host.insertBefore(trace, followingAnchor(owner, owner.controls.items.indexOf(c) + 1, host));
|
|
5055
|
+
}
|
|
5042
5056
|
function removeComponentDom(c, node, alsoPlaceholder) {
|
|
5043
|
-
const opts = c
|
|
5057
|
+
const opts = optionsOf(c);
|
|
5044
5058
|
const parent = node.parentNode;
|
|
5045
5059
|
if (node.nodeType === Node.COMMENT_NODE) {
|
|
5046
|
-
if (
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5060
|
+
if (parent) {
|
|
5061
|
+
const close = opts?.closeFragment || null;
|
|
5062
|
+
if (close) {
|
|
5063
|
+
let current = node;
|
|
5064
|
+
while (current) {
|
|
5065
|
+
const after = current.nextSibling;
|
|
5066
|
+
try {
|
|
5067
|
+
parent.removeChild(current);
|
|
5068
|
+
}
|
|
5069
|
+
catch { }
|
|
5070
|
+
if (current === close)
|
|
5071
|
+
break;
|
|
5072
|
+
current = after;
|
|
5073
|
+
}
|
|
5074
|
+
}
|
|
5075
|
+
else {
|
|
5053
5076
|
try {
|
|
5054
|
-
parent.removeChild(
|
|
5077
|
+
parent.removeChild(node);
|
|
5055
5078
|
}
|
|
5056
5079
|
catch { }
|
|
5057
|
-
if (current === close)
|
|
5058
|
-
break;
|
|
5059
|
-
current = after;
|
|
5060
|
-
}
|
|
5061
|
-
}
|
|
5062
|
-
else {
|
|
5063
|
-
try {
|
|
5064
|
-
parent.removeChild(node);
|
|
5065
5080
|
}
|
|
5066
|
-
|
|
5081
|
+
if (!alsoPlaceholder)
|
|
5082
|
+
return;
|
|
5067
5083
|
}
|
|
5068
|
-
if (!alsoPlaceholder)
|
|
5069
|
-
return;
|
|
5070
5084
|
}
|
|
5071
5085
|
else if (parent) {
|
|
5072
5086
|
try {
|
|
@@ -5153,23 +5167,23 @@ function disposeShallow(c) {
|
|
|
5153
5167
|
return;
|
|
5154
5168
|
ComponentHelper.callDisposing.call(c, c);
|
|
5155
5169
|
try {
|
|
5156
|
-
c
|
|
5170
|
+
offAll(c);
|
|
5157
5171
|
}
|
|
5158
5172
|
catch {
|
|
5159
5173
|
}
|
|
5160
5174
|
c.motif.stopAnimations();
|
|
5161
|
-
c
|
|
5162
|
-
if (c.
|
|
5163
|
-
for (const child of c.
|
|
5175
|
+
deactivateBindings(c);
|
|
5176
|
+
if (childrenOf(c).length) {
|
|
5177
|
+
for (const child of c._controls.items) {
|
|
5164
5178
|
try {
|
|
5165
|
-
child
|
|
5179
|
+
disposeShallow(child);
|
|
5166
5180
|
}
|
|
5167
5181
|
catch {
|
|
5168
5182
|
}
|
|
5169
5183
|
}
|
|
5170
5184
|
}
|
|
5171
5185
|
ComponentHelper.callDisposed.call(c, c);
|
|
5172
|
-
safeCall(() => { c.
|
|
5186
|
+
safeCall(() => { c._baseCtx?._emiters?.clear(); }, 'disposeShallow.emiters');
|
|
5173
5187
|
c.isDisposed = true;
|
|
5174
5188
|
Disposable.prototype.dispose.call(c);
|
|
5175
5189
|
}
|
|
@@ -5178,33 +5192,29 @@ function deepCleanup(c) {
|
|
|
5178
5192
|
c.parent = null;
|
|
5179
5193
|
}
|
|
5180
5194
|
catch { }
|
|
5181
|
-
try {
|
|
5182
|
-
c._eventHandlers?.clear();
|
|
5183
|
-
}
|
|
5184
|
-
catch {
|
|
5185
|
-
}
|
|
5186
5195
|
c._eventHandlers = undefined;
|
|
5187
5196
|
try {
|
|
5188
|
-
c.
|
|
5197
|
+
c._class?._countsStore?.clear();
|
|
5189
5198
|
}
|
|
5190
5199
|
catch { }
|
|
5191
5200
|
try {
|
|
5192
|
-
c.
|
|
5201
|
+
c._class?._watchersStore?.clear();
|
|
5193
5202
|
}
|
|
5194
5203
|
catch { }
|
|
5195
5204
|
try {
|
|
5196
|
-
c.
|
|
5205
|
+
c._attr?._attrMapStore?.clear();
|
|
5197
5206
|
}
|
|
5198
5207
|
catch { }
|
|
5199
5208
|
try {
|
|
5200
|
-
c.
|
|
5209
|
+
c._attr?._watchersStore?.clear();
|
|
5201
5210
|
}
|
|
5202
5211
|
catch { }
|
|
5203
5212
|
try {
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5213
|
+
const opts = c._motif?.options;
|
|
5214
|
+
if (opts) {
|
|
5215
|
+
opts.cache = undefined;
|
|
5216
|
+
opts.closeFragment = undefined;
|
|
5217
|
+
opts.placeholder = undefined;
|
|
5208
5218
|
}
|
|
5209
5219
|
}
|
|
5210
5220
|
catch {
|
|
@@ -5234,20 +5244,22 @@ function deepCleanup(c) {
|
|
|
5234
5244
|
}
|
|
5235
5245
|
catch { }
|
|
5236
5246
|
try {
|
|
5237
|
-
c.
|
|
5247
|
+
if (c._motif)
|
|
5248
|
+
c._motif.options = undefined;
|
|
5238
5249
|
}
|
|
5239
5250
|
catch { }
|
|
5240
5251
|
const keys = Object.keys(c);
|
|
5241
5252
|
for (let i = 0; i < keys.length; i++) {
|
|
5242
5253
|
const key = keys[i];
|
|
5243
|
-
if (key === '
|
|
5254
|
+
if (key === '_motif' || key === '_flags')
|
|
5244
5255
|
continue;
|
|
5245
5256
|
try {
|
|
5246
5257
|
c[key] = undefined;
|
|
5247
5258
|
}
|
|
5248
5259
|
catch { }
|
|
5249
5260
|
}
|
|
5250
|
-
c.
|
|
5261
|
+
c._store = null;
|
|
5262
|
+
c._flags = F_DISPOSED | F_HIDDEN | F_DISPOSED_FIRED | F_POSTCONFIG | F_PREBOUND;
|
|
5251
5263
|
}
|
|
5252
5264
|
const DISPOSE_STARTED = Promise.resolve();
|
|
5253
5265
|
function subtreeDisposesSync(c, root) {
|
|
@@ -5255,7 +5267,7 @@ function subtreeDisposesSync(c, root) {
|
|
|
5255
5267
|
return false;
|
|
5256
5268
|
if (c.disposeAsync !== ComponentBase.prototype.disposeAsync)
|
|
5257
5269
|
return false;
|
|
5258
|
-
const opts = c
|
|
5270
|
+
const opts = optionsOf(c);
|
|
5259
5271
|
if (opts) {
|
|
5260
5272
|
if (opts.transitionOut)
|
|
5261
5273
|
return false;
|
|
@@ -5269,8 +5281,8 @@ function subtreeDisposesSync(c, root) {
|
|
|
5269
5281
|
return false;
|
|
5270
5282
|
}
|
|
5271
5283
|
}
|
|
5272
|
-
const items = c
|
|
5273
|
-
if (items) {
|
|
5284
|
+
const items = childrenOf(c);
|
|
5285
|
+
if (items.length) {
|
|
5274
5286
|
for (let i = 0; i < items.length; i++) {
|
|
5275
5287
|
const child = items[i];
|
|
5276
5288
|
if (child && !child.isDisposed && !subtreeDisposesSync(child, false))
|
|
@@ -5301,27 +5313,28 @@ function disposePrefix(c, options, asChild) {
|
|
|
5301
5313
|
c.motif.options.transition.skipNextLeave = true;
|
|
5302
5314
|
}
|
|
5303
5315
|
safeCall(() => { ComponentHelper.callDisposing.call(c, c); }, ctx + '.callDisposing');
|
|
5304
|
-
c
|
|
5305
|
-
c
|
|
5316
|
+
offAll(c);
|
|
5317
|
+
deactivateBindings(c);
|
|
5306
5318
|
safeCall(() => { c.parent?.controls?.silentDetach?.(c, true); }, ctx + '.silentDetach');
|
|
5307
5319
|
}
|
|
5308
5320
|
function disposeFinish(c, options, asChild) {
|
|
5309
5321
|
c.isDisposed = true;
|
|
5310
5322
|
Disposable.prototype.dispose.call(c);
|
|
5311
5323
|
if (asChild) {
|
|
5312
|
-
c.
|
|
5324
|
+
if (c._controls)
|
|
5325
|
+
c._controls.items = [];
|
|
5313
5326
|
safeCall(() => { ComponentHelper.callDisposed.call(c, c); }, 'disposeAsync.callDisposed');
|
|
5314
|
-
safeCall(() => { c.
|
|
5327
|
+
safeCall(() => { c._baseCtx?._emiters?.clear(); }, 'disposeAsync.emiters');
|
|
5315
5328
|
if (options?.deep) {
|
|
5316
|
-
c
|
|
5329
|
+
deepCleanup(c);
|
|
5317
5330
|
}
|
|
5318
5331
|
return;
|
|
5319
5332
|
}
|
|
5320
5333
|
c.element = null;
|
|
5321
5334
|
safeCall(() => { ComponentHelper.callDisposed.call(c, c); }, 'dispose.callDisposed');
|
|
5322
|
-
safeCall(() => { c.
|
|
5323
|
-
c
|
|
5324
|
-
c
|
|
5335
|
+
safeCall(() => { c._baseCtx?._emiters?.clear(); }, 'dispose.emiters');
|
|
5336
|
+
offAll(c);
|
|
5337
|
+
deepCleanup(c);
|
|
5325
5338
|
}
|
|
5326
5339
|
async function disposeRemainderAsync(c, options, asChild, leave) {
|
|
5327
5340
|
if (leave) {
|
|
@@ -5334,7 +5347,7 @@ async function disposeRemainderAsync(c, options, asChild, leave) {
|
|
|
5334
5347
|
else if (peekTransition(c)?.skipNextLeave) {
|
|
5335
5348
|
await c.motif.stopAnimations();
|
|
5336
5349
|
}
|
|
5337
|
-
await c
|
|
5350
|
+
await detachDomWithAnimationAsync(c);
|
|
5338
5351
|
}
|
|
5339
5352
|
if (!asChild && c.constructor.name !== 'TransportTo') {
|
|
5340
5353
|
await disposeContentBlocks(c);
|
|
@@ -5344,7 +5357,7 @@ async function disposeRemainderAsync(c, options, asChild, leave) {
|
|
|
5344
5357
|
if (c.isDisposed) {
|
|
5345
5358
|
return;
|
|
5346
5359
|
}
|
|
5347
|
-
const ctrls = Array.from(c
|
|
5360
|
+
const ctrls = Array.from(childrenOf(c));
|
|
5348
5361
|
if (ctrls.length) {
|
|
5349
5362
|
await Promise.all(ctrls.map(child => asChild
|
|
5350
5363
|
? safeCallAsync(async () => { await child.disposeAsync(childOptions); }, 'disposeAsync.disposeAsyncChildren.handler')
|
|
@@ -5374,8 +5387,8 @@ function disposeRemainderSync(root, options, asChild, rootDetached) {
|
|
|
5374
5387
|
const node = nodes[n];
|
|
5375
5388
|
if (node.isDisposed)
|
|
5376
5389
|
continue;
|
|
5377
|
-
const items = node
|
|
5378
|
-
if (
|
|
5390
|
+
const items = childrenOf(node);
|
|
5391
|
+
if (items.length === 0)
|
|
5379
5392
|
continue;
|
|
5380
5393
|
const ctrls = Array.from(items);
|
|
5381
5394
|
for (let j = 0; j < ctrls.length; j++) {
|
|
@@ -5390,7 +5403,8 @@ function disposeRemainderSync(root, options, asChild, rootDetached) {
|
|
|
5390
5403
|
retireServiceOwner(child);
|
|
5391
5404
|
child._disposing = root._disposing;
|
|
5392
5405
|
disposePrefix(child, childOptions, true);
|
|
5393
|
-
|
|
5406
|
+
if (child.element?.isConnected !== false)
|
|
5407
|
+
detachDomWithAnimation(child);
|
|
5394
5408
|
nodes.push(child);
|
|
5395
5409
|
parents.push(n);
|
|
5396
5410
|
}
|
|
@@ -5429,68 +5443,24 @@ function disposeRemainderSync(root, options, asChild, rootDetached) {
|
|
|
5429
5443
|
return null;
|
|
5430
5444
|
}
|
|
5431
5445
|
const BASE_PROTO = {
|
|
5446
|
+
get emiters() {
|
|
5447
|
+
const base = this;
|
|
5448
|
+
return base._emiters ??= new ComponentEmiter(base.owner);
|
|
5449
|
+
},
|
|
5432
5450
|
_offAll() {
|
|
5433
|
-
|
|
5434
|
-
if (!c._eventHandlers)
|
|
5435
|
-
return;
|
|
5436
|
-
for (const [full, set] of c._eventHandlers) {
|
|
5437
|
-
const name = full.split(":")[0];
|
|
5438
|
-
const evt = name.startsWith("on") ? name.slice(2).toLowerCase() : name.toLowerCase();
|
|
5439
|
-
for (const rec of set) {
|
|
5440
|
-
if (!rec || !rec.wrapped) {
|
|
5441
|
-
continue;
|
|
5442
|
-
}
|
|
5443
|
-
if (rec.domEvent === false) {
|
|
5444
|
-
continue;
|
|
5445
|
-
}
|
|
5446
|
-
const cap = rec.capture === true;
|
|
5447
|
-
try {
|
|
5448
|
-
c.element.removeEventListener(evt, rec.wrapped, cap);
|
|
5449
|
-
}
|
|
5450
|
-
catch { }
|
|
5451
|
-
try {
|
|
5452
|
-
if (rec.capture === undefined) {
|
|
5453
|
-
c.element.removeEventListener(evt, rec.wrapped, !cap);
|
|
5454
|
-
}
|
|
5455
|
-
}
|
|
5456
|
-
catch { }
|
|
5457
|
-
}
|
|
5458
|
-
}
|
|
5459
|
-
c._eventHandlers.clear();
|
|
5460
|
-
c._eventHandlers = undefined;
|
|
5451
|
+
offAll(this.owner);
|
|
5461
5452
|
},
|
|
5462
5453
|
_deactivateBindings() {
|
|
5463
|
-
|
|
5464
|
-
try {
|
|
5465
|
-
c.bindings?.deactivateAll();
|
|
5466
|
-
}
|
|
5467
|
-
catch { }
|
|
5454
|
+
deactivateBindings(this.owner);
|
|
5468
5455
|
},
|
|
5469
5456
|
_activateBindings() {
|
|
5470
|
-
|
|
5471
|
-
try {
|
|
5472
|
-
c.bindings?.activateAll();
|
|
5473
|
-
}
|
|
5474
|
-
catch { }
|
|
5457
|
+
activateBindings(this.owner);
|
|
5475
5458
|
},
|
|
5476
5459
|
_reactivateBindings() {
|
|
5477
|
-
|
|
5478
|
-
try {
|
|
5479
|
-
c.bindings?.reActivateAll();
|
|
5480
|
-
}
|
|
5481
|
-
catch { }
|
|
5460
|
+
reactivateBindings(this.owner);
|
|
5482
5461
|
},
|
|
5483
5462
|
_activatePreBindings() {
|
|
5484
|
-
|
|
5485
|
-
return;
|
|
5486
|
-
const c = this.owner;
|
|
5487
|
-
const registered = c.bindings?._items;
|
|
5488
|
-
if (registered && registered.length > 0) {
|
|
5489
|
-
c.bindings.items.filter((x) => x.propertyName == "isWait" || x.propertyName == "display").forEach((b) => {
|
|
5490
|
-
b.activate();
|
|
5491
|
-
});
|
|
5492
|
-
}
|
|
5493
|
-
this.prebinding_Activated = true;
|
|
5463
|
+
activatePreBindings(this.owner);
|
|
5494
5464
|
},
|
|
5495
5465
|
_detachDomWithAnimation() {
|
|
5496
5466
|
detachDomWithAnimation(this.owner);
|
|
@@ -5505,13 +5475,184 @@ const BASE_PROTO = {
|
|
|
5505
5475
|
deepCleanup(this.owner);
|
|
5506
5476
|
},
|
|
5507
5477
|
};
|
|
5478
|
+
const EV_SELF = 1;
|
|
5479
|
+
const EV_TRUSTED = 2;
|
|
5480
|
+
const EV_PREVENT = 4;
|
|
5481
|
+
const EV_STOP = 8;
|
|
5482
|
+
const EV_CAPTURE = 16;
|
|
5483
|
+
const EV_DOM = 32;
|
|
5484
|
+
const EV_REMOVED = 64;
|
|
5485
|
+
const NO_MODS = [];
|
|
5486
|
+
let eventDispatchDepth = 0;
|
|
5487
|
+
class EventRecord {
|
|
5488
|
+
constructor(owner, key, original, type, flags) {
|
|
5489
|
+
this.owner = owner;
|
|
5490
|
+
this.key = key;
|
|
5491
|
+
this.original = original;
|
|
5492
|
+
this.type = type;
|
|
5493
|
+
this.flags = flags;
|
|
5494
|
+
this.next = undefined;
|
|
5495
|
+
}
|
|
5496
|
+
handleEvent(ev) {
|
|
5497
|
+
const flags = this.flags;
|
|
5498
|
+
const owner = this.owner;
|
|
5499
|
+
if ((flags & EV_SELF) !== 0 && ev.target !== owner.element)
|
|
5500
|
+
return;
|
|
5501
|
+
if ((flags & EV_TRUSTED) !== 0 && !ev.isTrusted)
|
|
5502
|
+
return;
|
|
5503
|
+
const cb = this.original;
|
|
5504
|
+
let res;
|
|
5505
|
+
try {
|
|
5506
|
+
if (cb && cb.length <= 1) {
|
|
5507
|
+
res = cb(ev);
|
|
5508
|
+
}
|
|
5509
|
+
else if (cb) {
|
|
5510
|
+
res = cb(owner, ev);
|
|
5511
|
+
}
|
|
5512
|
+
}
|
|
5513
|
+
catch (error) {
|
|
5514
|
+
reportError('MJX123', error, this.type);
|
|
5515
|
+
}
|
|
5516
|
+
if (res && typeof res.then === 'function') {
|
|
5517
|
+
const type = this.type;
|
|
5518
|
+
res.then(undefined, (error) => reportError('MJX123', error, type));
|
|
5519
|
+
}
|
|
5520
|
+
if ((flags & EV_PREVENT) !== 0) {
|
|
5521
|
+
preventEvent(ev);
|
|
5522
|
+
}
|
|
5523
|
+
if ((flags & EV_STOP) !== 0) {
|
|
5524
|
+
stopEvent(ev);
|
|
5525
|
+
}
|
|
5526
|
+
if (res && res.cancel === true) {
|
|
5527
|
+
preventEvent(ev);
|
|
5528
|
+
stopEvent(ev);
|
|
5529
|
+
}
|
|
5530
|
+
}
|
|
5531
|
+
}
|
|
5532
|
+
function preventEvent(ev) {
|
|
5533
|
+
if (typeof ev?.preventDefault === 'function')
|
|
5534
|
+
ev.preventDefault();
|
|
5535
|
+
}
|
|
5536
|
+
function stopEvent(ev) {
|
|
5537
|
+
if (typeof ev?.stopPropagation === 'function')
|
|
5538
|
+
ev.stopPropagation();
|
|
5539
|
+
}
|
|
5540
|
+
function addEventRecord(c, record) {
|
|
5541
|
+
let last = c._eventHandlers;
|
|
5542
|
+
if (last === undefined) {
|
|
5543
|
+
c._eventHandlers = record;
|
|
5544
|
+
return;
|
|
5545
|
+
}
|
|
5546
|
+
while (last.next !== undefined)
|
|
5547
|
+
last = last.next;
|
|
5548
|
+
last.next = record;
|
|
5549
|
+
}
|
|
5550
|
+
function compactEventRecords(c) {
|
|
5551
|
+
let head;
|
|
5552
|
+
let tail;
|
|
5553
|
+
for (let r = c._eventHandlers; r !== undefined; r = r.next) {
|
|
5554
|
+
if ((r.flags & EV_REMOVED) !== 0)
|
|
5555
|
+
continue;
|
|
5556
|
+
if (tail === undefined)
|
|
5557
|
+
head = r;
|
|
5558
|
+
else
|
|
5559
|
+
tail.next = r;
|
|
5560
|
+
tail = r;
|
|
5561
|
+
}
|
|
5562
|
+
if (tail !== undefined)
|
|
5563
|
+
tail.next = undefined;
|
|
5564
|
+
c._eventHandlers = head;
|
|
5565
|
+
}
|
|
5566
|
+
function hasEventKey(c, key) {
|
|
5567
|
+
for (let r = c._eventHandlers; r !== undefined; r = r.next) {
|
|
5568
|
+
if ((r.flags & EV_REMOVED) === 0 && r.key === key)
|
|
5569
|
+
return true;
|
|
5570
|
+
}
|
|
5571
|
+
return false;
|
|
5572
|
+
}
|
|
5573
|
+
function offAll(c) {
|
|
5574
|
+
const head = c._eventHandlers;
|
|
5575
|
+
if (head === undefined)
|
|
5576
|
+
return;
|
|
5577
|
+
for (let r = head; r !== undefined; r = r.next) {
|
|
5578
|
+
if ((r.flags & (EV_DOM | EV_REMOVED)) !== EV_DOM) {
|
|
5579
|
+
continue;
|
|
5580
|
+
}
|
|
5581
|
+
try {
|
|
5582
|
+
c.element.removeEventListener(r.type, r, (r.flags & EV_CAPTURE) !== 0);
|
|
5583
|
+
}
|
|
5584
|
+
catch { }
|
|
5585
|
+
}
|
|
5586
|
+
c._eventHandlers = undefined;
|
|
5587
|
+
}
|
|
5588
|
+
function deactivateBindings(c) {
|
|
5589
|
+
try {
|
|
5590
|
+
if (c._bindings?._items?.length)
|
|
5591
|
+
c._bindings.deactivateAll();
|
|
5592
|
+
}
|
|
5593
|
+
catch { }
|
|
5594
|
+
}
|
|
5595
|
+
function activateBindings(c) {
|
|
5596
|
+
try {
|
|
5597
|
+
c._bindings?.activateAll();
|
|
5598
|
+
}
|
|
5599
|
+
catch { }
|
|
5600
|
+
}
|
|
5601
|
+
function reactivateBindings(c) {
|
|
5602
|
+
try {
|
|
5603
|
+
c._bindings?.reActivateAll();
|
|
5604
|
+
}
|
|
5605
|
+
catch { }
|
|
5606
|
+
}
|
|
5607
|
+
function activatePreBindings(c) {
|
|
5608
|
+
if ((c._flags & F_PREBOUND) !== 0)
|
|
5609
|
+
return;
|
|
5610
|
+
const registered = c._bindings?._items;
|
|
5611
|
+
if (registered && registered.length > 0) {
|
|
5612
|
+
c._bindings.items.filter((x) => x.propertyName == "isWait" || x.propertyName == "display").forEach((b) => {
|
|
5613
|
+
b.activate();
|
|
5614
|
+
});
|
|
5615
|
+
}
|
|
5616
|
+
c._flags |= F_PREBOUND;
|
|
5617
|
+
}
|
|
5508
5618
|
function createBaseCtx(owner) {
|
|
5509
5619
|
const base = Object.create(BASE_PROTO);
|
|
5510
5620
|
base.owner = owner;
|
|
5511
|
-
base.prebinding_Activated = false;
|
|
5512
|
-
base.emiters = new ComponentEmiter(owner);
|
|
5513
5621
|
return base;
|
|
5514
5622
|
}
|
|
5623
|
+
function controlsOwner(collection) {
|
|
5624
|
+
return collection.owner;
|
|
5625
|
+
}
|
|
5626
|
+
const NO_CHILDREN = Object.freeze([]);
|
|
5627
|
+
const NO_BINDINGS = Object.freeze([]);
|
|
5628
|
+
function childrenOf(c) {
|
|
5629
|
+
return c._controls?.items ?? NO_CHILDREN;
|
|
5630
|
+
}
|
|
5631
|
+
function createOwnedControls(c) {
|
|
5632
|
+
const controls = new ControlCollection(c);
|
|
5633
|
+
controls.onAdd = ownerControlAdded;
|
|
5634
|
+
controls.onAddBeforeBuild = ownerControlAddedBeforeBuild;
|
|
5635
|
+
controls.onRemove = ownerControlRemoved;
|
|
5636
|
+
return controls;
|
|
5637
|
+
}
|
|
5638
|
+
function ownerControlAdded(c) {
|
|
5639
|
+
const owner = controlsOwner(this);
|
|
5640
|
+
if (hasEventKey(owner, 'controladded'))
|
|
5641
|
+
owner.motif.trigger('controladded', { control: c });
|
|
5642
|
+
if (!owner.isVisible && owner.element?.nodeType === Node.COMMENT_NODE)
|
|
5643
|
+
return;
|
|
5644
|
+
ComponentHelper.internalBuild.call(owner, c);
|
|
5645
|
+
}
|
|
5646
|
+
function ownerControlAddedBeforeBuild(c) {
|
|
5647
|
+
const owner = controlsOwner(this);
|
|
5648
|
+
if (hasEventKey(owner, 'controladded'))
|
|
5649
|
+
owner.motif.trigger('controladded', { control: c });
|
|
5650
|
+
}
|
|
5651
|
+
function ownerControlRemoved(c) {
|
|
5652
|
+
const owner = controlsOwner(this);
|
|
5653
|
+
if (hasEventKey(owner, 'controlremoved'))
|
|
5654
|
+
owner.motif.trigger('controlremoved', { control: c });
|
|
5655
|
+
}
|
|
5515
5656
|
const fragmentCloseMarkers = new WeakMap();
|
|
5516
5657
|
const LIFECYCLE_X_EVENTS = new Set([
|
|
5517
5658
|
'building', 'built', 'initializing', 'initialized', 'disposing', 'disposed',
|
|
@@ -5550,37 +5691,80 @@ function createScopedContext(app, owner) {
|
|
|
5550
5691
|
});
|
|
5551
5692
|
}
|
|
5552
5693
|
class ComponentBase extends Disposable {
|
|
5553
|
-
motif
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
isBuilt
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5694
|
+
get motif() {
|
|
5695
|
+
return this._motif !== undefined ? this._motif : (this._motif = new ComponentMotif(this, (this.isDisposed && !this.element ? undefined : new ComponentOptionsImpl(this))));
|
|
5696
|
+
}
|
|
5697
|
+
get isBuilt() {
|
|
5698
|
+
return (this._flags & F_BUILT) !== 0;
|
|
5699
|
+
}
|
|
5700
|
+
set isBuilt(value) {
|
|
5701
|
+
this._flags = value ? this._flags | F_BUILT : this._flags & ~F_BUILT;
|
|
5702
|
+
}
|
|
5703
|
+
get isInitialized() {
|
|
5704
|
+
return (this._flags & F_INITIALIZED) !== 0;
|
|
5705
|
+
}
|
|
5706
|
+
set isInitialized(value) {
|
|
5707
|
+
this._flags = value ? this._flags | F_INITIALIZED : this._flags & ~F_INITIALIZED;
|
|
5708
|
+
}
|
|
5709
|
+
get isDisposed() {
|
|
5710
|
+
return (this._flags & F_DISPOSED) !== 0;
|
|
5711
|
+
}
|
|
5712
|
+
set isDisposed(value) {
|
|
5713
|
+
this._flags = value ? this._flags | F_DISPOSED : this._flags & ~F_DISPOSED;
|
|
5714
|
+
}
|
|
5715
|
+
get isConfigured() {
|
|
5716
|
+
return (this._flags & F_CONFIGURED) !== 0;
|
|
5717
|
+
}
|
|
5718
|
+
set isConfigured(value) {
|
|
5719
|
+
this._flags = value ? this._flags | F_CONFIGURED : this._flags & ~F_CONFIGURED;
|
|
5720
|
+
}
|
|
5721
|
+
get isPainting() {
|
|
5722
|
+
return (this._flags & F_PAINTING) !== 0;
|
|
5723
|
+
}
|
|
5724
|
+
set isPainting(value) {
|
|
5725
|
+
this._flags = value ? this._flags | F_PAINTING : this._flags & ~F_PAINTING;
|
|
5726
|
+
}
|
|
5727
|
+
get isPainted() {
|
|
5728
|
+
return (this._flags & F_PAINTED) !== 0;
|
|
5729
|
+
}
|
|
5730
|
+
set isPainted(value) {
|
|
5731
|
+
this._flags = value ? this._flags | F_PAINTED : this._flags & ~F_PAINTED;
|
|
5732
|
+
}
|
|
5733
|
+
get isVisible() {
|
|
5734
|
+
return (this._flags & F_HIDDEN) === 0;
|
|
5735
|
+
}
|
|
5736
|
+
set isVisible(value) {
|
|
5737
|
+
this._flags = value ? this._flags & ~F_HIDDEN : this._flags | F_HIDDEN;
|
|
5738
|
+
}
|
|
5739
|
+
get controls() {
|
|
5740
|
+
return this._controls !== undefined || (this.isDisposed && !this.element) ? this._controls : (this._controls = createOwnedControls(this));
|
|
5741
|
+
}
|
|
5742
|
+
set controls(value) {
|
|
5743
|
+
this._controls = value;
|
|
5744
|
+
}
|
|
5745
|
+
get class() {
|
|
5746
|
+
return this._class !== undefined || (this.isDisposed && !this.element) ? this._class : (this._class = new controlClass(this));
|
|
5747
|
+
}
|
|
5748
|
+
set class(value) {
|
|
5749
|
+
this._class = value;
|
|
5750
|
+
}
|
|
5751
|
+
get attr() {
|
|
5752
|
+
return this._attr !== undefined || (this.isDisposed && !this.element) ? this._attr : (this._attr = new controlAttribute(this));
|
|
5753
|
+
}
|
|
5754
|
+
set attr(value) {
|
|
5755
|
+
this._attr = value;
|
|
5756
|
+
}
|
|
5757
|
+
get bindings() {
|
|
5758
|
+
return this._bindings !== undefined || (this.isDisposed && !this.element) ? this._bindings : (this._bindings = new BindingCollection(this));
|
|
5759
|
+
}
|
|
5760
|
+
set bindings(value) {
|
|
5761
|
+
this._bindings = value;
|
|
5762
|
+
}
|
|
5571
5763
|
useModel(modelCtor) {
|
|
5572
5764
|
return reactive(modelCtor);
|
|
5573
5765
|
}
|
|
5574
5766
|
_computeHideStrategy() {
|
|
5575
|
-
|
|
5576
|
-
if (cfg === 'placeholder')
|
|
5577
|
-
return 'placeholder';
|
|
5578
|
-
if (cfg === 'detach')
|
|
5579
|
-
return 'detach';
|
|
5580
|
-
if (this.motif.options?.__fromList || typeof this.motif.options?.indexkey !== 'undefined' || typeof this.motif.options?.__key !== 'undefined') {
|
|
5581
|
-
return 'detach';
|
|
5582
|
-
}
|
|
5583
|
-
return 'placeholder';
|
|
5767
|
+
return keepsTrace(this) ? 'placeholder' : 'detach';
|
|
5584
5768
|
}
|
|
5585
5769
|
_isInDom() {
|
|
5586
5770
|
try {
|
|
@@ -5597,7 +5781,7 @@ class ComponentBase extends Disposable {
|
|
|
5597
5781
|
}
|
|
5598
5782
|
}
|
|
5599
5783
|
set isWait(value) {
|
|
5600
|
-
this.
|
|
5784
|
+
this._flags = value ? this._flags | F_WAIT : this._flags & ~F_WAIT;
|
|
5601
5785
|
if (this.isBuilt) {
|
|
5602
5786
|
if (value) {
|
|
5603
5787
|
this.motif.hide();
|
|
@@ -5612,10 +5796,22 @@ class ComponentBase extends Disposable {
|
|
|
5612
5796
|
}
|
|
5613
5797
|
}
|
|
5614
5798
|
get isWait() {
|
|
5615
|
-
return this.
|
|
5799
|
+
return (this._flags & F_WAIT) !== 0;
|
|
5616
5800
|
}
|
|
5617
5801
|
constructor(element, props = {}) {
|
|
5618
5802
|
super();
|
|
5803
|
+
this._motif = undefined;
|
|
5804
|
+
this._flags = 0;
|
|
5805
|
+
this._controls = undefined;
|
|
5806
|
+
this._class = undefined;
|
|
5807
|
+
this._attr = undefined;
|
|
5808
|
+
this._bindings = undefined;
|
|
5809
|
+
this._baseCtx = undefined;
|
|
5810
|
+
this._init = undefined;
|
|
5811
|
+
this._leaveContainer = undefined;
|
|
5812
|
+
this.parent = null;
|
|
5813
|
+
const asComponentRoot = constructingComponentRoot;
|
|
5814
|
+
constructingComponentRoot = false;
|
|
5619
5815
|
recordServiceOwner(this);
|
|
5620
5816
|
if (this.onElementCreating) {
|
|
5621
5817
|
this.element = this.onElementCreating.call(this);
|
|
@@ -5626,44 +5822,38 @@ class ComponentBase extends Disposable {
|
|
|
5626
5822
|
else {
|
|
5627
5823
|
this.element = element;
|
|
5628
5824
|
}
|
|
5629
|
-
if (
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
for (const fn of takePendingRefs(this, refs)) {
|
|
5633
|
-
callReported(() => fn(this), 'MJX122', 'ref');
|
|
5634
|
-
}
|
|
5635
|
-
}
|
|
5825
|
+
if (this.element?.nodeType !== 3) {
|
|
5826
|
+
if (this._controls === undefined)
|
|
5827
|
+
this._controls = new ControlCollection(this);
|
|
5636
5828
|
}
|
|
5637
|
-
props
|
|
5829
|
+
const refs = props ? extractRefs(props, this) : [];
|
|
5830
|
+
if (props && ParseProps(props, this))
|
|
5831
|
+
props = {};
|
|
5638
5832
|
applyComponentOptions(props?.options, this);
|
|
5639
5833
|
this.props = props;
|
|
5640
5834
|
// (class/style/id/tabindex/role/aria-*/data-*) kök düğüme (root node) düşer, prop'lar this.props'ta kalır.
|
|
5641
5835
|
if (props) {
|
|
5642
5836
|
const ctor0 = new.target;
|
|
5643
|
-
const plain = ctor0 === ComponentBase || Object.getPrototypeOf(ctor0) === ComponentBase;
|
|
5837
|
+
const plain = !asComponentRoot && (ctor0 === ComponentBase || Object.getPrototypeOf(ctor0) === ComponentBase);
|
|
5644
5838
|
if (plain)
|
|
5645
5839
|
applyPlainElementProps(props, this);
|
|
5646
5840
|
else
|
|
5647
5841
|
applyFallthroughProps(props, this);
|
|
5648
5842
|
}
|
|
5843
|
+
if (refs.length > 0) {
|
|
5844
|
+
for (const fn of takePendingRefs(this, refs)) {
|
|
5845
|
+
callReported(() => fn(this), 'MJX122', 'ref');
|
|
5846
|
+
}
|
|
5847
|
+
}
|
|
5649
5848
|
ComponentHelper.callOnInitializing(this);
|
|
5650
5849
|
if (this.isDisposed)
|
|
5651
5850
|
return;
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
};
|
|
5659
|
-
this.controls.onAddBeforeBuild = (c) => {
|
|
5660
|
-
if (this._eventHandlers?.has('controladded'))
|
|
5661
|
-
this.motif.trigger('controladded', { control: c });
|
|
5662
|
-
};
|
|
5663
|
-
this.controls.onRemove = (c) => {
|
|
5664
|
-
if (this._eventHandlers?.has('controlremoved'))
|
|
5665
|
-
this.motif.trigger('controlremoved', { control: c });
|
|
5666
|
-
};
|
|
5851
|
+
const controls = this._controls;
|
|
5852
|
+
if (controls) {
|
|
5853
|
+
controls.onAdd = ownerControlAdded;
|
|
5854
|
+
controls.onAddBeforeBuild = ownerControlAddedBeforeBuild;
|
|
5855
|
+
controls.onRemove = ownerControlRemoved;
|
|
5856
|
+
}
|
|
5667
5857
|
ComponentHelper.callOnInitialized(this);
|
|
5668
5858
|
const ctor = new.target;
|
|
5669
5859
|
const isBaseCtor = ctor === ComponentBase || Object.getPrototypeOf(ctor) === ComponentBase;
|
|
@@ -5674,10 +5864,9 @@ class ComponentBase extends Disposable {
|
|
|
5674
5864
|
this._base._configDeferred = true;
|
|
5675
5865
|
}
|
|
5676
5866
|
}
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
_scopedContext;
|
|
5867
|
+
get _base() {
|
|
5868
|
+
return this._baseCtx !== undefined || (this.isDisposed && !this.element) ? this._baseCtx : (this._baseCtx = createBaseCtx(this));
|
|
5869
|
+
}
|
|
5681
5870
|
get context() {
|
|
5682
5871
|
const parentCtx = this.parent?.context;
|
|
5683
5872
|
const app = parentCtx?.[RAW_APPLICATION] ?? parentCtx ?? teardownApplications.get(this) ?? Application.main;
|
|
@@ -5704,7 +5893,7 @@ class ComponentBase extends Disposable {
|
|
|
5704
5893
|
build(building = true) {
|
|
5705
5894
|
checkReservedMembers(this);
|
|
5706
5895
|
ComponentHelper.callConfigured(this);
|
|
5707
|
-
this
|
|
5896
|
+
activatePreBindings(this);
|
|
5708
5897
|
if (this.isDisposed || !this.element || this.isWait) {
|
|
5709
5898
|
return;
|
|
5710
5899
|
}
|
|
@@ -5741,7 +5930,7 @@ class ComponentBase extends Disposable {
|
|
|
5741
5930
|
}
|
|
5742
5931
|
const deferredSelectValue = this.element?.nodeName === 'SELECT'
|
|
5743
5932
|
? this.bindings.items.filter(b => b.propertyName === 'value')
|
|
5744
|
-
:
|
|
5933
|
+
: NO_BINDINGS;
|
|
5745
5934
|
if (deferredSelectValue.length) {
|
|
5746
5935
|
try {
|
|
5747
5936
|
this.bindings.items.filter(b => !deferredSelectValue.includes(b)).forEach(b => b.activate());
|
|
@@ -5749,32 +5938,41 @@ class ComponentBase extends Disposable {
|
|
|
5749
5938
|
catch { }
|
|
5750
5939
|
}
|
|
5751
5940
|
else {
|
|
5752
|
-
this
|
|
5941
|
+
activateBindings(this);
|
|
5753
5942
|
}
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
element
|
|
5943
|
+
const kids = childrenOf(this);
|
|
5944
|
+
for (const element of kids.length ? kids.slice() : kids) {
|
|
5945
|
+
var target = isFragment ? this.motif.options.cache : this.element;
|
|
5946
|
+
if (!element.isWait) {
|
|
5947
|
+
element.parent = this;
|
|
5948
|
+
element.build(false);
|
|
5949
|
+
}
|
|
5757
5950
|
if (element.isWait) {
|
|
5951
|
+
if (keepsTrace(element)) {
|
|
5952
|
+
const opts = element.motif.options;
|
|
5953
|
+
(building ? ph : target).appendChild(opts.placeholder ?? (opts.placeholder = dom.createComment("h")));
|
|
5954
|
+
}
|
|
5758
5955
|
continue;
|
|
5759
5956
|
}
|
|
5760
|
-
var target = isFragment ? this.motif.options.cache : this.element;
|
|
5761
5957
|
if (building) {
|
|
5762
|
-
|
|
5763
|
-
|
|
5958
|
+
const cache = optionsOf(element)?.cache;
|
|
5959
|
+
if (cache) {
|
|
5960
|
+
ph.appendChild(cache);
|
|
5764
5961
|
}
|
|
5765
5962
|
else {
|
|
5766
5963
|
ph.appendChild(element.element);
|
|
5767
5964
|
}
|
|
5768
5965
|
}
|
|
5769
5966
|
else {
|
|
5770
|
-
|
|
5771
|
-
|
|
5967
|
+
const cache = optionsOf(element)?.cache;
|
|
5968
|
+
if (cache) {
|
|
5969
|
+
target.appendChild(cache);
|
|
5772
5970
|
}
|
|
5773
5971
|
else {
|
|
5774
5972
|
target.appendChild(element.element);
|
|
5775
5973
|
}
|
|
5776
5974
|
}
|
|
5777
|
-
if (element.
|
|
5975
|
+
if (element._baseCtx?._inactive && element.isVisible) {
|
|
5778
5976
|
ComponentHelper.activateTree(element);
|
|
5779
5977
|
}
|
|
5780
5978
|
}
|
|
@@ -5837,10 +6035,10 @@ class ComponentBase extends Disposable {
|
|
|
5837
6035
|
this.controls.forEach(c => {
|
|
5838
6036
|
c.setState();
|
|
5839
6037
|
});
|
|
5840
|
-
this
|
|
6038
|
+
reactivateBindings(this);
|
|
5841
6039
|
}
|
|
5842
6040
|
reState() {
|
|
5843
|
-
this
|
|
6041
|
+
reactivateBindings(this);
|
|
5844
6042
|
this.controls.forEach(c => {
|
|
5845
6043
|
c.reState();
|
|
5846
6044
|
});
|
|
@@ -5964,6 +6162,9 @@ class ComponentBase extends Disposable {
|
|
|
5964
6162
|
if (this.isVisible) {
|
|
5965
6163
|
return;
|
|
5966
6164
|
} /* A*/
|
|
6165
|
+
if (this.isWait) {
|
|
6166
|
+
return;
|
|
6167
|
+
}
|
|
5967
6168
|
if (this.parent && enterModeOf(this.parent) === 'out-in') {
|
|
5968
6169
|
const showHost = (this.motif.options.placeholder?.parentNode)
|
|
5969
6170
|
?? findAppendableComponent(this.parent)?.element;
|
|
@@ -5985,7 +6186,7 @@ class ComponentBase extends Disposable {
|
|
|
5985
6186
|
/** A*/
|
|
5986
6187
|
const strategy = this._computeHideStrategy();
|
|
5987
6188
|
if (strategy === 'detach') {
|
|
5988
|
-
ComponentHelper.callVisibilityChanged(this);
|
|
6189
|
+
ComponentHelper.callVisibilityChanged(this, true);
|
|
5989
6190
|
if (this.isDisposed) {
|
|
5990
6191
|
return;
|
|
5991
6192
|
}
|
|
@@ -6002,6 +6203,10 @@ class ComponentBase extends Disposable {
|
|
|
6002
6203
|
const expectedParent = findAppendableComponent(this.parent)?.element;
|
|
6003
6204
|
if (this.motif.options.placeholder && placeholderParent && placeholderParent !== expectedParent) {
|
|
6004
6205
|
reportWarning('MJX106', []);
|
|
6206
|
+
ComponentHelper.callVisibilityChanged(this, true);
|
|
6207
|
+
if (this.isDisposed) {
|
|
6208
|
+
return;
|
|
6209
|
+
}
|
|
6005
6210
|
this.isVisible = true;
|
|
6006
6211
|
if (this.parent?.isBuilt) {
|
|
6007
6212
|
ComponentHelper.internalBuild.call(this.parent, this);
|
|
@@ -6010,11 +6215,12 @@ class ComponentBase extends Disposable {
|
|
|
6010
6215
|
}
|
|
6011
6216
|
/** A*/
|
|
6012
6217
|
wantsEnterTransition(this) && this.motif.options.transition.enterTransition(() => { });
|
|
6013
|
-
ComponentHelper.callVisibilityChanged(this);
|
|
6218
|
+
ComponentHelper.callVisibilityChanged(this, true);
|
|
6014
6219
|
if (this.isDisposed) {
|
|
6015
6220
|
return;
|
|
6016
6221
|
}
|
|
6017
6222
|
if (this.element.nodeType === Node.COMMENT_NODE) {
|
|
6223
|
+
this.controls.items.filter(c => !c.isBuilt).forEach(c => ComponentHelper.internalBuild.call(this, c));
|
|
6018
6224
|
this.controls.forEach(c => {
|
|
6019
6225
|
c.motif.show();
|
|
6020
6226
|
});
|
|
@@ -6022,6 +6228,10 @@ class ComponentBase extends Disposable {
|
|
|
6022
6228
|
ComponentHelper.activateTree(this, false);
|
|
6023
6229
|
return;
|
|
6024
6230
|
}
|
|
6231
|
+
if (!this.isBuilt) {
|
|
6232
|
+
this.isVisible = true;
|
|
6233
|
+
return;
|
|
6234
|
+
}
|
|
6025
6235
|
var parent = this.motif.options.placeholder?.parentElement;
|
|
6026
6236
|
if (parent) {
|
|
6027
6237
|
parent.replaceChild(this.element, this.motif.options.placeholder);
|
|
@@ -6040,7 +6250,7 @@ class ComponentBase extends Disposable {
|
|
|
6040
6250
|
}
|
|
6041
6251
|
const strategy = this._computeHideStrategy();
|
|
6042
6252
|
if (strategy === 'detach') {
|
|
6043
|
-
ComponentHelper.callVisibilityChanged(this);
|
|
6253
|
+
ComponentHelper.callVisibilityChanged(this, false);
|
|
6044
6254
|
if (this.isDisposed) {
|
|
6045
6255
|
return;
|
|
6046
6256
|
}
|
|
@@ -6055,7 +6265,7 @@ class ComponentBase extends Disposable {
|
|
|
6055
6265
|
if (skip)
|
|
6056
6266
|
transition.skipNextLeave = false;
|
|
6057
6267
|
const finish = () => {
|
|
6058
|
-
ComponentHelper.callVisibilityChanged(this);
|
|
6268
|
+
ComponentHelper.callVisibilityChanged(this, false);
|
|
6059
6269
|
if (this.isDisposed) {
|
|
6060
6270
|
return;
|
|
6061
6271
|
}
|
|
@@ -6138,61 +6348,36 @@ class ComponentBase extends Disposable {
|
|
|
6138
6348
|
return this;
|
|
6139
6349
|
}
|
|
6140
6350
|
}
|
|
6141
|
-
const
|
|
6351
|
+
const colon = full.indexOf(":");
|
|
6352
|
+
const name = colon < 0 ? full : full.slice(0, colon);
|
|
6353
|
+
const mods = colon < 0 ? NO_MODS : full.slice(colon + 1).split(":");
|
|
6142
6354
|
const evt = name.startsWith("on") ? name.slice(2).toLowerCase() : name.toLowerCase();
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
if (mods.includes("
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
reportError('MJX123', error, evt);
|
|
6166
|
-
}
|
|
6167
|
-
if (res && typeof res.then === 'function') {
|
|
6168
|
-
res.then(undefined, (error) => reportError('MJX123', error, evt));
|
|
6169
|
-
}
|
|
6170
|
-
const prevent = () => { if (typeof ev?.preventDefault === 'function')
|
|
6171
|
-
ev.preventDefault(); };
|
|
6172
|
-
const stop = () => { if (typeof ev?.stopPropagation === 'function')
|
|
6173
|
-
ev.stopPropagation(); };
|
|
6174
|
-
if (mods.includes("prevent")) {
|
|
6175
|
-
prevent();
|
|
6176
|
-
}
|
|
6177
|
-
if (mods.includes("stop")) {
|
|
6178
|
-
stop();
|
|
6179
|
-
}
|
|
6180
|
-
if (res && res.cancel === true) {
|
|
6181
|
-
prevent();
|
|
6182
|
-
stop();
|
|
6183
|
-
}
|
|
6184
|
-
};
|
|
6355
|
+
let flags = domEvent ? EV_DOM : 0;
|
|
6356
|
+
let options;
|
|
6357
|
+
if (mods.length) {
|
|
6358
|
+
options = {};
|
|
6359
|
+
if (mods.includes("once"))
|
|
6360
|
+
options.once = true;
|
|
6361
|
+
if (mods.includes("passive"))
|
|
6362
|
+
options.passive = true;
|
|
6363
|
+
if (mods.includes("capture")) {
|
|
6364
|
+
options.capture = true;
|
|
6365
|
+
flags |= EV_CAPTURE;
|
|
6366
|
+
}
|
|
6367
|
+
if (mods.includes("self"))
|
|
6368
|
+
flags |= EV_SELF;
|
|
6369
|
+
if (mods.includes("trusted"))
|
|
6370
|
+
flags |= EV_TRUSTED;
|
|
6371
|
+
if (mods.includes("prevent"))
|
|
6372
|
+
flags |= EV_PREVENT;
|
|
6373
|
+
if (mods.includes("stop"))
|
|
6374
|
+
flags |= EV_STOP;
|
|
6375
|
+
}
|
|
6376
|
+
const record = new EventRecord(this, full.toLowerCase(), cb, evt, flags);
|
|
6185
6377
|
if (domEvent) {
|
|
6186
|
-
this.element.addEventListener(evt,
|
|
6187
|
-
}
|
|
6188
|
-
this
|
|
6189
|
-
const key = full.toLowerCase();
|
|
6190
|
-
const set = this._eventHandlers.get(key) ?? new Set();
|
|
6191
|
-
set.add({ original: cb, wrapped, capture: !!options.capture, domEvent: !!domEvent, type: evt });
|
|
6192
|
-
this._eventHandlers.set(key, set);
|
|
6193
|
-
this._register(disposableCore.toDisposable(() => {
|
|
6194
|
-
this.motif.off(event, cb);
|
|
6195
|
-
}));
|
|
6378
|
+
this.element.addEventListener(evt, record, options);
|
|
6379
|
+
}
|
|
6380
|
+
addEventRecord(this, record);
|
|
6196
6381
|
return this;
|
|
6197
6382
|
}
|
|
6198
6383
|
async _trigger(event, ev) {
|
|
@@ -6201,15 +6386,20 @@ class ComponentBase extends Disposable {
|
|
|
6201
6386
|
}
|
|
6202
6387
|
const name = String(event).toLowerCase();
|
|
6203
6388
|
safeCall(() => {
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6389
|
+
eventDispatchDepth++;
|
|
6390
|
+
try {
|
|
6391
|
+
for (let r = this._eventHandlers; r !== undefined; r = r.next) {
|
|
6392
|
+
if ((r.flags & EV_REMOVED) !== 0 || r.key !== name)
|
|
6393
|
+
continue;
|
|
6207
6394
|
try {
|
|
6208
|
-
|
|
6395
|
+
r.handleEvent(ev);
|
|
6209
6396
|
}
|
|
6210
6397
|
catch {
|
|
6211
6398
|
}
|
|
6212
|
-
}
|
|
6399
|
+
}
|
|
6400
|
+
}
|
|
6401
|
+
finally {
|
|
6402
|
+
eventDispatchDepth--;
|
|
6213
6403
|
}
|
|
6214
6404
|
}, 'trigger');
|
|
6215
6405
|
return this;
|
|
@@ -6232,38 +6422,24 @@ class ComponentBase extends Disposable {
|
|
|
6232
6422
|
return this;
|
|
6233
6423
|
}
|
|
6234
6424
|
if (LIFECYCLE_X_EVENTS.has(xName)) {
|
|
6235
|
-
this._base.
|
|
6425
|
+
this._base._emiters?.off("on" + xName, cb);
|
|
6236
6426
|
}
|
|
6237
6427
|
return this;
|
|
6238
6428
|
}
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
return this;
|
|
6246
|
-
for (const rec of Array.from(set)) {
|
|
6247
|
-
if (rec.original === cb) {
|
|
6248
|
-
if (rec.domEvent !== false) {
|
|
6249
|
-
const cap = rec.capture === true;
|
|
6250
|
-
safeCall(() => { this.element.removeEventListener(evt, rec.wrapped, cap); }, 'off.removeEventListener');
|
|
6251
|
-
safeCall(() => {
|
|
6252
|
-
if (rec.capture === undefined) {
|
|
6253
|
-
this.element.removeEventListener(evt, rec.wrapped, !cap);
|
|
6254
|
-
}
|
|
6255
|
-
}, 'off.removeEventListener.fallback');
|
|
6256
|
-
}
|
|
6257
|
-
set.delete(rec);
|
|
6258
|
-
break;
|
|
6429
|
+
for (let r = this._eventHandlers; r !== undefined; r = r.next) {
|
|
6430
|
+
if ((r.flags & EV_REMOVED) !== 0 || r.key !== full || r.original !== cb)
|
|
6431
|
+
continue;
|
|
6432
|
+
if ((r.flags & EV_DOM) !== 0) {
|
|
6433
|
+
const rec = r;
|
|
6434
|
+
safeCall(() => { this.element.removeEventListener(rec.type, rec, (rec.flags & EV_CAPTURE) !== 0); }, 'off.removeEventListener');
|
|
6259
6435
|
}
|
|
6436
|
+
r.flags |= EV_REMOVED;
|
|
6437
|
+
break;
|
|
6260
6438
|
}
|
|
6261
|
-
if (
|
|
6262
|
-
this
|
|
6439
|
+
if (eventDispatchDepth === 0)
|
|
6440
|
+
compactEventRecords(this);
|
|
6263
6441
|
return this;
|
|
6264
6442
|
}
|
|
6265
|
-
/** Süren bertaraf: ikinci bir dispose/disposeAsync çağrısı yenisini başlatmaz, bunu bekler. */
|
|
6266
|
-
_disposing;
|
|
6267
6443
|
dispose(options = { deep: true }) {
|
|
6268
6444
|
if (this.isDisposed) {
|
|
6269
6445
|
return Promise.resolve();
|
|
@@ -6334,8 +6510,6 @@ class ComponentBase extends Disposable {
|
|
|
6334
6510
|
}
|
|
6335
6511
|
});
|
|
6336
6512
|
}
|
|
6337
|
-
_siblingsApi;
|
|
6338
|
-
_siblingsSet;
|
|
6339
6513
|
get siblings() {
|
|
6340
6514
|
if (this._siblingsSet) {
|
|
6341
6515
|
return this._siblingsApi;
|
|
@@ -6483,6 +6657,12 @@ class ComponentBase extends Disposable {
|
|
|
6483
6657
|
t.activeAnimations = [];
|
|
6484
6658
|
}
|
|
6485
6659
|
}
|
|
6660
|
+
Object.defineProperty(ComponentBase.prototype, 'motif', {
|
|
6661
|
+
...Object.getOwnPropertyDescriptor(ComponentBase.prototype, 'motif'),
|
|
6662
|
+
set(value) {
|
|
6663
|
+
this._motif = value;
|
|
6664
|
+
},
|
|
6665
|
+
});
|
|
6486
6666
|
function findContentBlocks(root, results = []) {
|
|
6487
6667
|
if (!root || root.isDisposed)
|
|
6488
6668
|
return results;
|
|
@@ -6527,6 +6707,16 @@ function takePendingRefs(component, ref) {
|
|
|
6527
6707
|
}
|
|
6528
6708
|
return pending;
|
|
6529
6709
|
}
|
|
6710
|
+
function disposeUnplacedChilds(owner, kids) {
|
|
6711
|
+
if (!Array.isArray(kids) || !kids.some(kid => kid instanceof ComponentBase))
|
|
6712
|
+
return;
|
|
6713
|
+
owner.motif.setDisposable(() => {
|
|
6714
|
+
for (const kid of kids) {
|
|
6715
|
+
if (kid instanceof ComponentBase && !kid.isDisposed && !kid.parent)
|
|
6716
|
+
kid.dispose();
|
|
6717
|
+
}
|
|
6718
|
+
});
|
|
6719
|
+
}
|
|
6530
6720
|
const isCallableRef = (ref) => typeof ref === 'function' || Array.isArray(ref);
|
|
6531
6721
|
function extractRefs(props, component) {
|
|
6532
6722
|
const refs = [];
|
|
@@ -6578,26 +6768,38 @@ function collectLifecycleHandlers(component, lowerKey, value) {
|
|
|
6578
6768
|
const fns = Array.isArray(value) ? value : [value];
|
|
6579
6769
|
if (fns.length === 0 || !fns.every(fn => typeof fn === 'function'))
|
|
6580
6770
|
return false;
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
if (!
|
|
6585
|
-
|
|
6771
|
+
const target = component;
|
|
6772
|
+
let from = 0;
|
|
6773
|
+
if (listName === '_initializeComponentHandlers') {
|
|
6774
|
+
if (target._init === undefined && !target._baseCtx?._initializeComponentHandlers) {
|
|
6775
|
+
target._init = fns[0];
|
|
6776
|
+
from = 1;
|
|
6777
|
+
}
|
|
6778
|
+
}
|
|
6779
|
+
if (from >= fns.length)
|
|
6780
|
+
return true;
|
|
6781
|
+
const base = target._base;
|
|
6782
|
+
for (let i = from; i < fns.length; i++) {
|
|
6783
|
+
const fn = fns[i];
|
|
6784
|
+
if (listName === '_initializeComponentHandlers' && fn === target._init)
|
|
6785
|
+
continue;
|
|
6786
|
+
const slot = base[listName];
|
|
6787
|
+
if (slot === undefined)
|
|
6788
|
+
base[listName] = fn;
|
|
6789
|
+
else if (typeof slot === 'function') {
|
|
6790
|
+
if (slot !== fn)
|
|
6791
|
+
base[listName] = [slot, fn];
|
|
6792
|
+
}
|
|
6793
|
+
else if (!slot.includes(fn))
|
|
6794
|
+
slot.push(fn);
|
|
6586
6795
|
}
|
|
6587
6796
|
return true;
|
|
6588
6797
|
}
|
|
6589
6798
|
function ParseProps(props, component) {
|
|
6590
6799
|
if (props) {
|
|
6591
|
-
if (component.motif.options.props) {
|
|
6592
|
-
Object.assign(component.motif.options.props, props);
|
|
6593
|
-
}
|
|
6594
|
-
else {
|
|
6595
|
-
component.motif.options.props = {};
|
|
6596
|
-
Object.assign(component.motif.options.props, props);
|
|
6597
|
-
}
|
|
6598
6800
|
var keys = Object.keys(props);
|
|
6599
6801
|
if (keys.length === 0)
|
|
6600
|
-
return;
|
|
6802
|
+
return false;
|
|
6601
6803
|
keys.forEach(key => {
|
|
6602
6804
|
if (key == 'initializeComponent' || key == 'oninitializeComponent' || key.startsWith('on')) {
|
|
6603
6805
|
if (collectLifecycleHandlers(component, key.toLowerCase(), props[key])) {
|
|
@@ -6608,6 +6810,7 @@ function ParseProps(props, component) {
|
|
|
6608
6810
|
else if (key == 'childs') {
|
|
6609
6811
|
const flat = [].concat(...props[key]);
|
|
6610
6812
|
component.childs = flat;
|
|
6813
|
+
disposeUnplacedChilds(component, flat);
|
|
6611
6814
|
delete props[key];
|
|
6612
6815
|
}
|
|
6613
6816
|
else if (key === 'transition') {
|
|
@@ -6652,9 +6855,14 @@ function ParseProps(props, component) {
|
|
|
6652
6855
|
component.motif.options._preconfig = props[key];
|
|
6653
6856
|
delete props[key];
|
|
6654
6857
|
}
|
|
6858
|
+
else if (key === '__childExpr') {
|
|
6859
|
+
delete props[key];
|
|
6860
|
+
}
|
|
6655
6861
|
else ;
|
|
6656
6862
|
});
|
|
6863
|
+
return typeof props === 'object' && Reflect.ownKeys(props).length === 0;
|
|
6657
6864
|
}
|
|
6865
|
+
return false;
|
|
6658
6866
|
}
|
|
6659
6867
|
const _transitionSources = new WeakMap();
|
|
6660
6868
|
function setTransition(component, value, live) {
|
|
@@ -6825,6 +7033,16 @@ const FALLTHROUGH_KEYS = new Set(['class', 'className', 'style', 'id', 'tabindex
|
|
|
6825
7033
|
function isFallthroughKey(key) {
|
|
6826
7034
|
return FALLTHROUGH_KEYS.has(key) || key.startsWith('aria-') || key.startsWith('data-');
|
|
6827
7035
|
}
|
|
7036
|
+
let constructingComponentRoot = false;
|
|
7037
|
+
function constructComponentRoot(make) {
|
|
7038
|
+
constructingComponentRoot = true;
|
|
7039
|
+
try {
|
|
7040
|
+
return make();
|
|
7041
|
+
}
|
|
7042
|
+
finally {
|
|
7043
|
+
constructingComponentRoot = false;
|
|
7044
|
+
}
|
|
7045
|
+
}
|
|
6828
7046
|
function applyFallthroughProps(props, component) {
|
|
6829
7047
|
if (!props || typeof props !== 'object' || component.isDisposed)
|
|
6830
7048
|
return;
|
|
@@ -6874,35 +7092,51 @@ function findAppendableComponent(component) {
|
|
|
6874
7092
|
return null;
|
|
6875
7093
|
}, 'findAppendableComponent', null);
|
|
6876
7094
|
}
|
|
7095
|
+
const attachWaiters = new Set();
|
|
7096
|
+
let attachObserver = null;
|
|
7097
|
+
function releaseAttachObserver() {
|
|
7098
|
+
if (attachWaiters.size || !attachObserver) {
|
|
7099
|
+
return;
|
|
7100
|
+
}
|
|
7101
|
+
try {
|
|
7102
|
+
attachObserver.disconnect();
|
|
7103
|
+
}
|
|
7104
|
+
catch { /* ignore */ }
|
|
7105
|
+
attachObserver = null;
|
|
7106
|
+
}
|
|
7107
|
+
function flushAttachWaiters() {
|
|
7108
|
+
for (const waiter of [...attachWaiters]) {
|
|
7109
|
+
if (!attachWaiters.has(waiter) || !document.contains(waiter.element)) {
|
|
7110
|
+
continue;
|
|
7111
|
+
}
|
|
7112
|
+
attachWaiters.delete(waiter);
|
|
7113
|
+
try {
|
|
7114
|
+
waiter.callback();
|
|
7115
|
+
}
|
|
7116
|
+
catch (error) {
|
|
7117
|
+
queueMicrotask(() => { throw error; });
|
|
7118
|
+
}
|
|
7119
|
+
}
|
|
7120
|
+
releaseAttachObserver();
|
|
7121
|
+
}
|
|
6877
7122
|
function onElementAttached(element, callback) {
|
|
6878
7123
|
if (document.contains(element)) {
|
|
6879
7124
|
callback();
|
|
6880
7125
|
return null;
|
|
6881
7126
|
}
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
}
|
|
6892
|
-
});
|
|
6893
|
-
observer.observe(document.documentElement, {
|
|
6894
|
-
childList: true,
|
|
6895
|
-
subtree: true,
|
|
6896
|
-
});
|
|
7127
|
+
const waiter = { element, callback };
|
|
7128
|
+
attachWaiters.add(waiter);
|
|
7129
|
+
if (!attachObserver) {
|
|
7130
|
+
attachObserver = new MutationObserver(flushAttachWaiters);
|
|
7131
|
+
attachObserver.observe(document.documentElement, {
|
|
7132
|
+
childList: true,
|
|
7133
|
+
subtree: true,
|
|
7134
|
+
});
|
|
7135
|
+
}
|
|
6897
7136
|
return () => {
|
|
6898
|
-
if (
|
|
6899
|
-
|
|
6900
|
-
}
|
|
6901
|
-
done = true;
|
|
6902
|
-
try {
|
|
6903
|
-
observer.disconnect();
|
|
7137
|
+
if (attachWaiters.delete(waiter)) {
|
|
7138
|
+
releaseAttachObserver();
|
|
6904
7139
|
}
|
|
6905
|
-
catch { /* ignore */ }
|
|
6906
7140
|
};
|
|
6907
7141
|
}
|
|
6908
7142
|
function notifyActivated(component) {
|
|
@@ -6958,8 +7192,6 @@ function createDeclaredElement(tag, ctor, props) {
|
|
|
6958
7192
|
return dom.createElement(tag, props);
|
|
6959
7193
|
}
|
|
6960
7194
|
class Component extends ComponentBase {
|
|
6961
|
-
static elementTag;
|
|
6962
|
-
static elementNamespace;
|
|
6963
7195
|
constructor() {
|
|
6964
7196
|
const derivedCtor = new.target;
|
|
6965
7197
|
var args = arguments;
|
|
@@ -7039,9 +7271,11 @@ class Component extends ComponentBase {
|
|
|
7039
7271
|
// Alt sınıflar initializeComponent'i ezdiği için FragmentNode.initializeComponent'e güvenilemez.
|
|
7040
7272
|
const kids = this.childs;
|
|
7041
7273
|
if (Array.isArray(kids) && kids.length) {
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7274
|
+
if (derivedCtor?._placesChilds !== true) {
|
|
7275
|
+
for (const kid of kids) {
|
|
7276
|
+
if (kid)
|
|
7277
|
+
this.controls.add(kid);
|
|
7278
|
+
}
|
|
7045
7279
|
}
|
|
7046
7280
|
}
|
|
7047
7281
|
}
|
|
@@ -7063,6 +7297,7 @@ function applyJsxFrameworkProps(target, props, refs) {
|
|
|
7063
7297
|
if (!(target instanceof ComponentBase))
|
|
7064
7298
|
return target;
|
|
7065
7299
|
applyRefs(target, refs.concat(extractRefs(props)));
|
|
7300
|
+
disposeUnplacedChilds(target, props.childs);
|
|
7066
7301
|
// Fonksiyon bileşeni etiketindeki ortak öznitelikler (class/id/aria-*…) döndürülen köke düşer.
|
|
7067
7302
|
// Kök `<div {...props}/>` ise aynı değerler zaten uygulanmıştır; ikinci kez uygulanmaz.
|
|
7068
7303
|
applyFallthroughProps(props, target);
|
|
@@ -7073,8 +7308,7 @@ function applyJsxFrameworkProps(target, props, refs) {
|
|
|
7073
7308
|
const runover = props.runover;
|
|
7074
7309
|
if (!runover || typeof runover !== 'object')
|
|
7075
7310
|
return target;
|
|
7076
|
-
const
|
|
7077
|
-
const configuredBefore = Array.isArray(handlers) ? handlers.length : 0;
|
|
7311
|
+
const configuredBefore = handlerCount(target, '_onConfigHandlers');
|
|
7078
7312
|
const initializingBefore = handlerCount(target, '_onInitializingHandlers');
|
|
7079
7313
|
const initializedBefore = handlerCount(target, '_onInitializedHandlers');
|
|
7080
7314
|
ParseProps(runover, target);
|
|
@@ -7088,12 +7322,9 @@ function applyJsxFrameworkProps(target, props, refs) {
|
|
|
7088
7322
|
if (typeof pre === 'function') {
|
|
7089
7323
|
safeCallSilent(() => pre(target), 'motifComponent.preconfig');
|
|
7090
7324
|
}
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
const fn = after[i];
|
|
7095
|
-
callReported(() => fn(target, { cancel: false }), 'MJX122', 'onConfig');
|
|
7096
|
-
}
|
|
7325
|
+
for (let i = configuredBefore; i < handlerCount(target, '_onConfigHandlers'); i++) {
|
|
7326
|
+
const fn = hookList(target, '_onConfigHandlers')[i];
|
|
7327
|
+
callReported(() => fn(target, { cancel: false }), 'MJX122', 'onConfig');
|
|
7097
7328
|
}
|
|
7098
7329
|
}
|
|
7099
7330
|
return target;
|
|
@@ -7106,18 +7337,18 @@ function applyRefs(target, refs) {
|
|
|
7106
7337
|
}
|
|
7107
7338
|
return target;
|
|
7108
7339
|
}
|
|
7340
|
+
function hookList(target, listName) {
|
|
7341
|
+
const slot = target._base?.[listName];
|
|
7342
|
+
return !slot ? [] : typeof slot === 'function' ? [slot] : slot;
|
|
7343
|
+
}
|
|
7109
7344
|
function handlerCount(target, listName) {
|
|
7110
|
-
|
|
7111
|
-
return Array.isArray(list) ? list.length : 0;
|
|
7345
|
+
return hookList(target, listName).length;
|
|
7112
7346
|
}
|
|
7113
7347
|
function callAddedHandlers(target, listName, from, hook) {
|
|
7114
|
-
|
|
7115
|
-
if (!Array.isArray(list))
|
|
7116
|
-
return;
|
|
7117
|
-
for (let i = from; i < list.length; i++) {
|
|
7348
|
+
for (let i = from; i < handlerCount(target, listName); i++) {
|
|
7118
7349
|
if (target.isDisposed)
|
|
7119
7350
|
return;
|
|
7120
|
-
const fn =
|
|
7351
|
+
const fn = hookList(target, listName)[i];
|
|
7121
7352
|
callReported(() => fn(target, { cancel: false }), 'MJX122', hook);
|
|
7122
7353
|
}
|
|
7123
7354
|
}
|
|
@@ -7137,9 +7368,22 @@ function resolveChildExpression(probe) {
|
|
|
7137
7368
|
return value;
|
|
7138
7369
|
return undefined;
|
|
7139
7370
|
}
|
|
7140
|
-
function motifComponent(element, props) {
|
|
7371
|
+
function motifComponent(element, props, lone) {
|
|
7141
7372
|
// Etiket adı: element yaratımı (HTML/SVG) ve spread prop uygulaması Component ctor'ının string parametresinde
|
|
7142
7373
|
if (typeof element === "string") {
|
|
7374
|
+
if (typeof props === "function") {
|
|
7375
|
+
const compiled = new Component(element);
|
|
7376
|
+
compiled._init = props;
|
|
7377
|
+
return compiled;
|
|
7378
|
+
}
|
|
7379
|
+
if (lone === 1 && props !== null && typeof props === "object") {
|
|
7380
|
+
const init = props.initializeComponent;
|
|
7381
|
+
if (typeof init === "function") {
|
|
7382
|
+
const compiled = new Component(element);
|
|
7383
|
+
compiled._init = init;
|
|
7384
|
+
return compiled;
|
|
7385
|
+
}
|
|
7386
|
+
}
|
|
7143
7387
|
if (element === "text" && props && props.__childExpr) {
|
|
7144
7388
|
const resolved = resolveChildExpression(props.__childExpr);
|
|
7145
7389
|
if (resolved !== undefined)
|
|
@@ -7201,7 +7445,9 @@ function resolveToComponent(input, props) {
|
|
|
7201
7445
|
return resolved;
|
|
7202
7446
|
}
|
|
7203
7447
|
function materializeOptionsObject(spec, props) {
|
|
7204
|
-
const result =
|
|
7448
|
+
const result = typeof spec.el === 'string'
|
|
7449
|
+
? constructComponentRoot(() => motifComponent(spec.el, props))
|
|
7450
|
+
: motifComponent(spec.el, props);
|
|
7205
7451
|
Object.getOwnPropertyNames(spec).forEach(key => {
|
|
7206
7452
|
if (key !== 'el' && key !== 'ctor') {
|
|
7207
7453
|
result[key] = spec[key];
|
|
@@ -7237,7 +7483,7 @@ class FragmentNode extends Component {
|
|
|
7237
7483
|
}
|
|
7238
7484
|
}
|
|
7239
7485
|
safeCallSilent(() => {
|
|
7240
|
-
const nodes = this.
|
|
7486
|
+
const nodes = this.props?.nodes;
|
|
7241
7487
|
if (Array.isArray(nodes) && nodes.length) {
|
|
7242
7488
|
for (const n of nodes) {
|
|
7243
7489
|
if (n)
|
|
@@ -7399,11 +7645,10 @@ function $(description, attrs, ...children) {
|
|
|
7399
7645
|
|
|
7400
7646
|
// import { dom } from "../browser";
|
|
7401
7647
|
class ControlCollection {
|
|
7402
|
-
owner;
|
|
7403
7648
|
constructor(owner) {
|
|
7404
7649
|
this.owner = owner;
|
|
7650
|
+
this.items = [];
|
|
7405
7651
|
}
|
|
7406
|
-
items = [];
|
|
7407
7652
|
add() {
|
|
7408
7653
|
const count = arguments.length;
|
|
7409
7654
|
if (count === 0)
|
|
@@ -7483,7 +7728,7 @@ class ControlCollection {
|
|
|
7483
7728
|
this.items.splice(index, 1);
|
|
7484
7729
|
if (control.isDisposed)
|
|
7485
7730
|
return Promise.resolve();
|
|
7486
|
-
control.
|
|
7731
|
+
control._leaveContainer = this.owner;
|
|
7487
7732
|
control.parent = null;
|
|
7488
7733
|
return runLeaveThenDetach(control, () => { if (this.onRemove)
|
|
7489
7734
|
this.onRemove(control); });
|
|
@@ -7513,7 +7758,7 @@ class ControlCollection {
|
|
|
7513
7758
|
if (index === -1)
|
|
7514
7759
|
return;
|
|
7515
7760
|
this.items.splice(index, 1);
|
|
7516
|
-
control.
|
|
7761
|
+
control._leaveContainer = this.owner;
|
|
7517
7762
|
control.parent = null;
|
|
7518
7763
|
}
|
|
7519
7764
|
async clearAsync() {
|
|
@@ -7538,9 +7783,6 @@ class ControlCollection {
|
|
|
7538
7783
|
map(callbackfn) {
|
|
7539
7784
|
return this.items.map(callbackfn);
|
|
7540
7785
|
}
|
|
7541
|
-
onAdd;
|
|
7542
|
-
onRemove;
|
|
7543
|
-
onAddBeforeBuild;
|
|
7544
7786
|
move(control, before) {
|
|
7545
7787
|
if (!control || control.isDisposed)
|
|
7546
7788
|
return;
|
|
@@ -7568,14 +7810,29 @@ class ControlCollection {
|
|
|
7568
7810
|
const insertAt = newBeforeIndex >= 0 ? newBeforeIndex : this.items.length;
|
|
7569
7811
|
this.items.splice(insertAt, 0, control);
|
|
7570
7812
|
}
|
|
7571
|
-
if (control.isWait) {
|
|
7572
|
-
return;
|
|
7573
|
-
}
|
|
7574
7813
|
const container = findAppendableElement(this.owner);
|
|
7575
|
-
if (!container)
|
|
7814
|
+
if (!container || !domAnchor(control, container))
|
|
7576
7815
|
return;
|
|
7577
|
-
const
|
|
7578
|
-
moveComponentDomRange(control, container,
|
|
7816
|
+
const at = before ? this.items.indexOf(before) : -1;
|
|
7817
|
+
moveComponentDomRange(control, container, at >= 0 ? anchorFrom(this.owner, this.items, at, container) : computeAppendReference(this.owner));
|
|
7818
|
+
}
|
|
7819
|
+
_reorder(order, stable) {
|
|
7820
|
+
const container = findAppendableElement(this.owner);
|
|
7821
|
+
if (container) {
|
|
7822
|
+
let ref = computeAppendReference(this.owner);
|
|
7823
|
+
for (let i = order.length - 1; i >= 0; i--) {
|
|
7824
|
+
const control = order[i];
|
|
7825
|
+
const node = domAnchor(control, container);
|
|
7826
|
+
if (!node)
|
|
7827
|
+
continue;
|
|
7828
|
+
if (!stable.has(i))
|
|
7829
|
+
moveComponentDomRange(control, container, ref);
|
|
7830
|
+
ref = node;
|
|
7831
|
+
}
|
|
7832
|
+
}
|
|
7833
|
+
const items = this.items;
|
|
7834
|
+
for (let i = 0; i < order.length; i++)
|
|
7835
|
+
items[i] = order[i];
|
|
7579
7836
|
}
|
|
7580
7837
|
moveToIndex(control, index) {
|
|
7581
7838
|
if (!control || control.isDisposed)
|
|
@@ -7612,12 +7869,20 @@ function computeAppendReference(owner) {
|
|
|
7612
7869
|
}
|
|
7613
7870
|
return null;
|
|
7614
7871
|
}
|
|
7872
|
+
function anchorFrom(owner, items, start, container) {
|
|
7873
|
+
for (let i = start; i < items.length; i++) {
|
|
7874
|
+
const anchor = domAnchor(items[i], container);
|
|
7875
|
+
if (anchor)
|
|
7876
|
+
return anchor;
|
|
7877
|
+
}
|
|
7878
|
+
return computeAppendReference(owner);
|
|
7879
|
+
}
|
|
7615
7880
|
/** Bir component'in kök DOM aralığını (tek element veya fragment aralığı) referenceNode öncesine taşır. */
|
|
7616
7881
|
function moveComponentDomRange(control, container, referenceNode) {
|
|
7617
|
-
const node = control
|
|
7882
|
+
const node = domAnchor(control, container);
|
|
7618
7883
|
if (!node)
|
|
7619
7884
|
return;
|
|
7620
|
-
if (node.nodeType !== Node.COMMENT_NODE) {
|
|
7885
|
+
if (node.nodeType !== Node.COMMENT_NODE || node !== control.element) {
|
|
7621
7886
|
try {
|
|
7622
7887
|
container.insertBefore(node, referenceNode);
|
|
7623
7888
|
}
|
|
@@ -7700,9 +7965,7 @@ function detachComponentDom(control) {
|
|
|
7700
7965
|
if (!node)
|
|
7701
7966
|
return;
|
|
7702
7967
|
const opts = control.motif.options;
|
|
7703
|
-
if (node.nodeType === Node.COMMENT_NODE) {
|
|
7704
|
-
if (!node.parentNode)
|
|
7705
|
-
return;
|
|
7968
|
+
if (node.nodeType === Node.COMMENT_NODE && node.parentNode) {
|
|
7706
7969
|
const close = opts?.closeFragment || null;
|
|
7707
7970
|
const cache = opts.cache ?? (opts.cache = dom.createDocumentFragment());
|
|
7708
7971
|
let current = node;
|
|
@@ -8175,13 +8438,12 @@ async function navigateHost(host, page, keepOldControl = false) {
|
|
|
8175
8438
|
}
|
|
8176
8439
|
|
|
8177
8440
|
class Frame extends Component {
|
|
8178
|
-
current = null;
|
|
8179
|
-
_latestNavigateId = 0;
|
|
8180
|
-
_navLock = Promise.resolve();
|
|
8181
|
-
_navAbort;
|
|
8182
|
-
isBusy = false;
|
|
8183
8441
|
constructor(props) {
|
|
8184
8442
|
super(dom.createComment(''), props);
|
|
8443
|
+
this.current = null;
|
|
8444
|
+
this._latestNavigateId = 0;
|
|
8445
|
+
this._navLock = Promise.resolve();
|
|
8446
|
+
this.isBusy = false;
|
|
8185
8447
|
if (props && props.childs && Array.isArray(props.childs) && props.childs.length > 0) {
|
|
8186
8448
|
this.controls.add(props.childs);
|
|
8187
8449
|
}
|
|
@@ -8196,7 +8458,6 @@ class Frame extends Component {
|
|
|
8196
8458
|
async _clear() {
|
|
8197
8459
|
await disposeNavigationTarget(this.current);
|
|
8198
8460
|
}
|
|
8199
|
-
previouspage;
|
|
8200
8461
|
async navigate(page, keepOldControl = false) {
|
|
8201
8462
|
await navigateHost(this, page, keepOldControl);
|
|
8202
8463
|
}
|
|
@@ -8206,6 +8467,25 @@ class Frame extends Component {
|
|
|
8206
8467
|
}
|
|
8207
8468
|
}
|
|
8208
8469
|
|
|
8470
|
+
const SLOT_REGISTERED_EVENT = Symbol('slotRegistered');
|
|
8471
|
+
const SLOT_UNREGISTERED_EVENT = Symbol('slotUnregistered');
|
|
8472
|
+
class TransportRegistry {
|
|
8473
|
+
static { this.slots = new Map(); }
|
|
8474
|
+
static registerSlot(name, slot) {
|
|
8475
|
+
this.slots.set(name, slot);
|
|
8476
|
+
Application.main.fire(SLOT_REGISTERED_EVENT, { name, slot });
|
|
8477
|
+
}
|
|
8478
|
+
static unregisterSlot(name, slot) {
|
|
8479
|
+
if (this.slots.get(name) === slot) {
|
|
8480
|
+
this.slots.delete(name);
|
|
8481
|
+
Application.main.fire(SLOT_UNREGISTERED_EVENT, { name, slot });
|
|
8482
|
+
}
|
|
8483
|
+
}
|
|
8484
|
+
static getSlot(name) {
|
|
8485
|
+
return this.slots.get(name);
|
|
8486
|
+
}
|
|
8487
|
+
}
|
|
8488
|
+
|
|
8209
8489
|
const ARRAY_MUTATORS = new Set(['push', 'pop', 'shift', 'unshift', 'splice', 'reverse', 'sort']);
|
|
8210
8490
|
const NOT_META = Symbol('');
|
|
8211
8491
|
const metaReaders = new Map([
|
|
@@ -8343,11 +8623,10 @@ const PATCHED_ARRAY_METHODS = [
|
|
|
8343
8623
|
];
|
|
8344
8624
|
const isLookupMiss = (outcome) => outcome === false || outcome === -1;
|
|
8345
8625
|
class ArrayMethods {
|
|
8346
|
-
engine;
|
|
8347
8626
|
constructor(engine) {
|
|
8348
8627
|
this.engine = engine;
|
|
8628
|
+
this.get = this.createArrayMethods();
|
|
8349
8629
|
}
|
|
8350
|
-
get = this.createArrayMethods();
|
|
8351
8630
|
createArrayMethods() {
|
|
8352
8631
|
const table = {};
|
|
8353
8632
|
for (const [name, kind] of PATCHED_ARRAY_METHODS) {
|
|
@@ -8539,7 +8818,6 @@ const ReactiveEngineMapper = new WeakSet();
|
|
|
8539
8818
|
const AllreactiveMap = new WeakMap();
|
|
8540
8819
|
function armgetter() { return AllreactiveMap; }
|
|
8541
8820
|
class ReactiveEngine {
|
|
8542
|
-
_gci;
|
|
8543
8821
|
startGc(_intervalMs = 10000) { }
|
|
8544
8822
|
stopGc() { if (this._gci) {
|
|
8545
8823
|
try {
|
|
@@ -8549,31 +8827,30 @@ class ReactiveEngine {
|
|
|
8549
8827
|
this._gci = undefined;
|
|
8550
8828
|
} }
|
|
8551
8829
|
constructor() {
|
|
8830
|
+
this.DisposeMapper = new LinkedList();
|
|
8831
|
+
this.arrayTriggerCache = new Map();
|
|
8832
|
+
this.ReactiveMap = () => armgetter();
|
|
8833
|
+
this.isReadonly = false;
|
|
8834
|
+
this.superficial = false;
|
|
8835
|
+
this.arrayMethods = new ArrayMethods(this);
|
|
8836
|
+
this.arrayHandler = {
|
|
8837
|
+
get: createGetter(this),
|
|
8838
|
+
set: createSetter(this),
|
|
8839
|
+
has: createHas(),
|
|
8840
|
+
deleteProperty: createDelete(),
|
|
8841
|
+
ownKeys: createOwn()
|
|
8842
|
+
};
|
|
8843
|
+
this.deepHandler = {
|
|
8844
|
+
get: createGetter(this),
|
|
8845
|
+
set: createSetter(this),
|
|
8846
|
+
has: createHas(),
|
|
8847
|
+
deleteProperty: createDelete(),
|
|
8848
|
+
ownKeys: createOwn()
|
|
8849
|
+
};
|
|
8850
|
+
this.collectionHandler = createCollectionHandler(this);
|
|
8552
8851
|
ReactiveEngineMapper.add(this);
|
|
8553
8852
|
this.startGc();
|
|
8554
8853
|
}
|
|
8555
|
-
DisposeMapper = new LinkedList();
|
|
8556
|
-
arrayTriggerCache = new Map();
|
|
8557
|
-
ReactiveMap = () => armgetter();
|
|
8558
|
-
activeCallback;
|
|
8559
|
-
isReadonly = false;
|
|
8560
|
-
superficial = false;
|
|
8561
|
-
arrayMethods = new ArrayMethods(this);
|
|
8562
|
-
arrayHandler = {
|
|
8563
|
-
get: createGetter(this),
|
|
8564
|
-
set: createSetter(this),
|
|
8565
|
-
has: createHas(),
|
|
8566
|
-
deleteProperty: createDelete(),
|
|
8567
|
-
ownKeys: createOwn()
|
|
8568
|
-
};
|
|
8569
|
-
deepHandler = {
|
|
8570
|
-
get: createGetter(this),
|
|
8571
|
-
set: createSetter(this),
|
|
8572
|
-
has: createHas(),
|
|
8573
|
-
deleteProperty: createDelete(),
|
|
8574
|
-
ownKeys: createOwn()
|
|
8575
|
-
};
|
|
8576
|
-
collectionHandler = createCollectionHandler(this);
|
|
8577
8854
|
reactive(model) {
|
|
8578
8855
|
if (!isObject(model)) {
|
|
8579
8856
|
model = { value: model };
|
|
@@ -8636,7 +8913,6 @@ class ReactiveEngine {
|
|
|
8636
8913
|
ArrayTrigger(target, key, ...args) {
|
|
8637
8914
|
this.trigger(target, key, args);
|
|
8638
8915
|
}
|
|
8639
|
-
onValueChanged;
|
|
8640
8916
|
toRaw(item) {
|
|
8641
8917
|
return JSON.parse(JSON.stringify(this.deepClone(item)));
|
|
8642
8918
|
}
|
|
@@ -8822,7 +9098,9 @@ function isConstructor(fn) {
|
|
|
8822
9098
|
}
|
|
8823
9099
|
}
|
|
8824
9100
|
class ServiceCollection {
|
|
8825
|
-
|
|
9101
|
+
constructor() {
|
|
9102
|
+
this.descriptors = new Map();
|
|
9103
|
+
}
|
|
8826
9104
|
reset() {
|
|
8827
9105
|
this.descriptors.clear();
|
|
8828
9106
|
}
|
|
@@ -9079,7 +9357,7 @@ function initOverlayIfEnabled() {
|
|
|
9079
9357
|
}
|
|
9080
9358
|
|
|
9081
9359
|
class RouterViewRegistry {
|
|
9082
|
-
static outlets = new Map();
|
|
9360
|
+
static { this.outlets = new Map(); }
|
|
9083
9361
|
static register(name, scopeId, instance) {
|
|
9084
9362
|
if (!this.outlets.has(name))
|
|
9085
9363
|
this.outlets.set(name, new Map());
|
|
@@ -9108,9 +9386,12 @@ const RouterViewBuilt = Symbol.for("RouterView.built");
|
|
|
9108
9386
|
class RouterView extends Component {
|
|
9109
9387
|
constructor(props) {
|
|
9110
9388
|
super(props);
|
|
9389
|
+
this._navLock = Promise.resolve();
|
|
9390
|
+
this.disposingChilds = false;
|
|
9391
|
+
this.current = null;
|
|
9392
|
+
this._latestNavigateId = 0;
|
|
9393
|
+
this.isBusy = false;
|
|
9111
9394
|
}
|
|
9112
|
-
_navLock = Promise.resolve();
|
|
9113
|
-
_navAbort;
|
|
9114
9395
|
get __isRouterView() {
|
|
9115
9396
|
return true;
|
|
9116
9397
|
}
|
|
@@ -9122,11 +9403,6 @@ class RouterView extends Component {
|
|
|
9122
9403
|
}
|
|
9123
9404
|
return ids.join('>');
|
|
9124
9405
|
}
|
|
9125
|
-
disposingChilds = false;
|
|
9126
|
-
previouspage;
|
|
9127
|
-
current = null;
|
|
9128
|
-
_latestNavigateId = 0;
|
|
9129
|
-
isBusy = false;
|
|
9130
9406
|
async navigate(page, keepOldControl = false) {
|
|
9131
9407
|
await navigateHost(this, page, keepOldControl);
|
|
9132
9408
|
}
|
|
@@ -9157,18 +9433,16 @@ const DEFAULT_LIMIT = 60;
|
|
|
9157
9433
|
const DEFAULT_SETTLE_MS = 1200;
|
|
9158
9434
|
const USER_INPUT = ['wheel', 'touchstart', 'keydown', 'mousedown'];
|
|
9159
9435
|
class ScrollMemory {
|
|
9160
|
-
options;
|
|
9161
|
-
viewport;
|
|
9162
|
-
positions = new Map();
|
|
9163
|
-
currentKey = '';
|
|
9164
|
-
currentPath = null;
|
|
9165
|
-
visited = false;
|
|
9166
|
-
restoring = false;
|
|
9167
|
-
cancelFrame = null;
|
|
9168
|
-
disarmAbort = null;
|
|
9169
|
-
offs = [];
|
|
9170
|
-
locationAnchor = true;
|
|
9171
9436
|
constructor(options = {}, viewport) {
|
|
9437
|
+
this.positions = new Map();
|
|
9438
|
+
this.currentKey = '';
|
|
9439
|
+
this.currentPath = null;
|
|
9440
|
+
this.visited = false;
|
|
9441
|
+
this.restoring = false;
|
|
9442
|
+
this.cancelFrame = null;
|
|
9443
|
+
this.disarmAbort = null;
|
|
9444
|
+
this.offs = [];
|
|
9445
|
+
this.locationAnchor = true;
|
|
9172
9446
|
this.options = options;
|
|
9173
9447
|
this.viewport = viewport ?? (options.container ? containerViewport(options.container) : windowViewport());
|
|
9174
9448
|
this.load();
|
|
@@ -9571,24 +9845,18 @@ function overlay(floating, anchor, above) {
|
|
|
9571
9845
|
}
|
|
9572
9846
|
}
|
|
9573
9847
|
class NavigationStack {
|
|
9574
|
-
retainAttached;
|
|
9575
|
-
depth;
|
|
9576
|
-
persist;
|
|
9577
|
-
animation;
|
|
9578
|
-
duration;
|
|
9579
|
-
swipe;
|
|
9580
|
-
session = null;
|
|
9581
|
-
entries = new Map();
|
|
9582
|
-
uris = new Map();
|
|
9583
|
-
loaded = null;
|
|
9584
|
-
current = null;
|
|
9585
|
-
currentTop = null;
|
|
9586
|
-
offs = [];
|
|
9587
|
-
gesture = null;
|
|
9588
|
-
gestureCommitted = false;
|
|
9589
|
-
awaitingGestureResult = false;
|
|
9590
|
-
disposed = false;
|
|
9591
9848
|
constructor(options) {
|
|
9849
|
+
this.session = null;
|
|
9850
|
+
this.entries = new Map();
|
|
9851
|
+
this.uris = new Map();
|
|
9852
|
+
this.loaded = null;
|
|
9853
|
+
this.current = null;
|
|
9854
|
+
this.currentTop = null;
|
|
9855
|
+
this.offs = [];
|
|
9856
|
+
this.gesture = null;
|
|
9857
|
+
this.gestureCommitted = false;
|
|
9858
|
+
this.awaitingGestureResult = false;
|
|
9859
|
+
this.disposed = false;
|
|
9592
9860
|
const o = options === true ? {} : options;
|
|
9593
9861
|
this.retainAttached = o.retain === true;
|
|
9594
9862
|
this.depth = Math.max(0, Math.floor(o.depth ?? 5));
|
|
@@ -10097,13 +10365,28 @@ class NavigationStack {
|
|
|
10097
10365
|
}
|
|
10098
10366
|
|
|
10099
10367
|
class Scanner {
|
|
10100
|
-
source;
|
|
10101
10368
|
constructor(source) {
|
|
10102
10369
|
this.source = source;
|
|
10370
|
+
this.currentColumn = 0;
|
|
10371
|
+
this.tokens = [];
|
|
10372
|
+
this.parameters = {};
|
|
10373
|
+
this.codePointAt = String.prototype.codePointAt ?
|
|
10374
|
+
(s, i) => s.codePointAt(i) : function codePointAt(str, i) {
|
|
10375
|
+
const size = str.length;
|
|
10376
|
+
if (i < 0 || i >= size) {
|
|
10377
|
+
return undefined;
|
|
10378
|
+
}
|
|
10379
|
+
const first = str.charCodeAt(i);
|
|
10380
|
+
if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) {
|
|
10381
|
+
const second = str.charCodeAt(i + 1);
|
|
10382
|
+
if (second >= 0xDC00 && second <= 0xDFFF) {
|
|
10383
|
+
return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
|
|
10384
|
+
}
|
|
10385
|
+
}
|
|
10386
|
+
return first;
|
|
10387
|
+
};
|
|
10103
10388
|
this.tokens = [];
|
|
10104
10389
|
}
|
|
10105
|
-
currentColumn = 0;
|
|
10106
|
-
tokens = [];
|
|
10107
10390
|
addToken(token) {
|
|
10108
10391
|
this.tokens.push(token);
|
|
10109
10392
|
}
|
|
@@ -10331,7 +10614,6 @@ class Scanner {
|
|
|
10331
10614
|
pattern += '$';
|
|
10332
10615
|
return new RegExp(pattern, "i");
|
|
10333
10616
|
}
|
|
10334
|
-
parameters = {};
|
|
10335
10617
|
exist(input, pageSearch) {
|
|
10336
10618
|
const hashIdx = input.indexOf('#');
|
|
10337
10619
|
const withoutHash = hashIdx >= 0 ? input.substring(0, hashIdx) : input;
|
|
@@ -10415,21 +10697,6 @@ class Scanner {
|
|
|
10415
10697
|
}
|
|
10416
10698
|
return false;
|
|
10417
10699
|
}
|
|
10418
|
-
codePointAt = String.prototype.codePointAt ?
|
|
10419
|
-
(s, i) => s.codePointAt(i) : function codePointAt(str, i) {
|
|
10420
|
-
const size = str.length;
|
|
10421
|
-
if (i < 0 || i >= size) {
|
|
10422
|
-
return undefined;
|
|
10423
|
-
}
|
|
10424
|
-
const first = str.charCodeAt(i);
|
|
10425
|
-
if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) {
|
|
10426
|
-
const second = str.charCodeAt(i + 1);
|
|
10427
|
-
if (second >= 0xDC00 && second <= 0xDFFF) {
|
|
10428
|
-
return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
|
|
10429
|
-
}
|
|
10430
|
-
}
|
|
10431
|
-
return first;
|
|
10432
|
-
};
|
|
10433
10700
|
}
|
|
10434
10701
|
|
|
10435
10702
|
/** Bir fullPath'in statik (parametresiz) ve parametreli segment sayıları. */
|
|
@@ -10457,11 +10724,41 @@ function compareRouteRecords(a, b) {
|
|
|
10457
10724
|
return b.fullPath.length - a.fullPath.length;
|
|
10458
10725
|
}
|
|
10459
10726
|
class RouteCollection {
|
|
10460
|
-
routes;
|
|
10461
|
-
records = [];
|
|
10462
|
-
routesMap = new Map();
|
|
10463
10727
|
constructor(routes) {
|
|
10464
10728
|
this.routes = routes;
|
|
10729
|
+
this.records = [];
|
|
10730
|
+
this.routesMap = new Map();
|
|
10731
|
+
this.walk = (chain, parentPath, node, viaAlias = false) => {
|
|
10732
|
+
const fullPath = this.joinPaths(parentPath, node.path);
|
|
10733
|
+
if (!viaAlias) {
|
|
10734
|
+
const existing = node.fullPath;
|
|
10735
|
+
if (existing == null || (typeof existing === 'string' && existing.trim() === '')) {
|
|
10736
|
+
node.fullPath = fullPath;
|
|
10737
|
+
}
|
|
10738
|
+
if (node.name != null) {
|
|
10739
|
+
this.routesMap.set(node.name, node);
|
|
10740
|
+
}
|
|
10741
|
+
}
|
|
10742
|
+
const nextChain = [...chain, node];
|
|
10743
|
+
const aliases = node.alias == null ? [] : (Array.isArray(node.alias) ? node.alias : [node.alias]);
|
|
10744
|
+
const variants = [
|
|
10745
|
+
{ path: fullPath, isAlias: viaAlias },
|
|
10746
|
+
...aliases.map(a => ({ path: this.joinPaths(parentPath, a), isAlias: true }))
|
|
10747
|
+
];
|
|
10748
|
+
for (const variant of variants) {
|
|
10749
|
+
this.records.push({
|
|
10750
|
+
fullPath: variant.path,
|
|
10751
|
+
chain: nextChain,
|
|
10752
|
+
leaf: node,
|
|
10753
|
+
scanner: new Scanner(variant.path),
|
|
10754
|
+
aliasOf: variant.isAlias ? (node.fullPath ?? null) : null
|
|
10755
|
+
});
|
|
10756
|
+
if (node.childs && node.childs.length) {
|
|
10757
|
+
for (const child of node.childs)
|
|
10758
|
+
this.walk(nextChain, variant.path, child, variant.isAlias);
|
|
10759
|
+
}
|
|
10760
|
+
}
|
|
10761
|
+
};
|
|
10465
10762
|
this.build();
|
|
10466
10763
|
}
|
|
10467
10764
|
build() {
|
|
@@ -10471,37 +10768,6 @@ class RouteCollection {
|
|
|
10471
10768
|
this.walk([], "", r);
|
|
10472
10769
|
this.records.sort(compareRouteRecords);
|
|
10473
10770
|
}
|
|
10474
|
-
walk = (chain, parentPath, node, viaAlias = false) => {
|
|
10475
|
-
const fullPath = this.joinPaths(parentPath, node.path);
|
|
10476
|
-
if (!viaAlias) {
|
|
10477
|
-
const existing = node.fullPath;
|
|
10478
|
-
if (existing == null || (typeof existing === 'string' && existing.trim() === '')) {
|
|
10479
|
-
node.fullPath = fullPath;
|
|
10480
|
-
}
|
|
10481
|
-
if (node.name != null) {
|
|
10482
|
-
this.routesMap.set(node.name, node);
|
|
10483
|
-
}
|
|
10484
|
-
}
|
|
10485
|
-
const nextChain = [...chain, node];
|
|
10486
|
-
const aliases = node.alias == null ? [] : (Array.isArray(node.alias) ? node.alias : [node.alias]);
|
|
10487
|
-
const variants = [
|
|
10488
|
-
{ path: fullPath, isAlias: viaAlias },
|
|
10489
|
-
...aliases.map(a => ({ path: this.joinPaths(parentPath, a), isAlias: true }))
|
|
10490
|
-
];
|
|
10491
|
-
for (const variant of variants) {
|
|
10492
|
-
this.records.push({
|
|
10493
|
-
fullPath: variant.path,
|
|
10494
|
-
chain: nextChain,
|
|
10495
|
-
leaf: node,
|
|
10496
|
-
scanner: new Scanner(variant.path),
|
|
10497
|
-
aliasOf: variant.isAlias ? (node.fullPath ?? null) : null
|
|
10498
|
-
});
|
|
10499
|
-
if (node.childs && node.childs.length) {
|
|
10500
|
-
for (const child of node.childs)
|
|
10501
|
-
this.walk(nextChain, variant.path, child, variant.isAlias);
|
|
10502
|
-
}
|
|
10503
|
-
}
|
|
10504
|
-
};
|
|
10505
10771
|
joinPaths(parent, child) {
|
|
10506
10772
|
parent = parent || "";
|
|
10507
10773
|
child = child || "";
|
|
@@ -10518,19 +10784,22 @@ class RouteCollection {
|
|
|
10518
10784
|
}
|
|
10519
10785
|
|
|
10520
10786
|
class RoutingEngine {
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10787
|
+
constructor() {
|
|
10788
|
+
this.stack = null;
|
|
10789
|
+
this._revealed = new Set();
|
|
10790
|
+
this._previousPath = null;
|
|
10791
|
+
this._previousInstances = [];
|
|
10792
|
+
this.controlCache = new Map();
|
|
10793
|
+
this._navVersion = 0;
|
|
10794
|
+
this._pendingActivate = new Set();
|
|
10795
|
+
this.pendingMount = new WeakMap();
|
|
10796
|
+
this.pendingListeners = new WeakMap();
|
|
10797
|
+
}
|
|
10528
10798
|
register(mainApp, application, routingModule) {
|
|
10529
10799
|
this.root = mainApp;
|
|
10530
10800
|
this.application = application;
|
|
10531
10801
|
this.routingModule = routingModule;
|
|
10532
10802
|
}
|
|
10533
|
-
controlCache = new Map();
|
|
10534
10803
|
async evict(route) {
|
|
10535
10804
|
const targets = route ? [route] : Array.from(this.controlCache.keys());
|
|
10536
10805
|
for (const r of targets) {
|
|
@@ -10592,8 +10861,6 @@ class RoutingEngine {
|
|
|
10592
10861
|
}
|
|
10593
10862
|
return result;
|
|
10594
10863
|
}
|
|
10595
|
-
_navVersion = 0;
|
|
10596
|
-
_pendingActivate = new Set();
|
|
10597
10864
|
async execute(path, nav, route) {
|
|
10598
10865
|
route ??= {
|
|
10599
10866
|
target: path,
|
|
@@ -11064,9 +11331,7 @@ class RoutingEngine {
|
|
|
11064
11331
|
}
|
|
11065
11332
|
async activator(container) {
|
|
11066
11333
|
}
|
|
11067
|
-
|
|
11068
|
-
pendingListeners = new WeakMap();
|
|
11069
|
-
static OUTLET_WARN_MS = 3000;
|
|
11334
|
+
static { this.OUTLET_WARN_MS = 3000; }
|
|
11070
11335
|
async mountChain(instances, chain, container, navVersion) {
|
|
11071
11336
|
for (let index = 0; index < instances.length;) {
|
|
11072
11337
|
if (navVersion !== this._navVersion)
|
|
@@ -11198,17 +11463,20 @@ class RoutingEngine {
|
|
|
11198
11463
|
const pathOf = (uri) => uri.split('#')[0].split('?')[0];
|
|
11199
11464
|
const newHistorySession = () => Math.random().toString(36).slice(2, 10) + Date.now().toString(36);
|
|
11200
11465
|
class UrlRoutingModule {
|
|
11201
|
-
static MAX_REDIRECTS = 10;
|
|
11202
|
-
_routerOptions;
|
|
11203
|
-
routingEngine;
|
|
11204
|
-
routeCollection;
|
|
11205
|
-
routesMap = new Map();
|
|
11206
|
-
mainApp;
|
|
11207
|
-
application;
|
|
11208
|
-
_suppressBeforeEachOnce = false;
|
|
11209
|
-
_suppressMiddlewaresOnce = false;
|
|
11210
|
-
_scroll = null;
|
|
11466
|
+
static { this.MAX_REDIRECTS = 10; }
|
|
11211
11467
|
constructor(options, application) {
|
|
11468
|
+
this.routesMap = new Map();
|
|
11469
|
+
this._suppressBeforeEachOnce = false;
|
|
11470
|
+
this._suppressMiddlewaresOnce = false;
|
|
11471
|
+
this._scroll = null;
|
|
11472
|
+
this._stack = null;
|
|
11473
|
+
this._windowNavListener = null;
|
|
11474
|
+
this._historyStamp = null;
|
|
11475
|
+
this._pendingTraversal = null;
|
|
11476
|
+
this._currentUri = '___startup___';
|
|
11477
|
+
this._previousRoute = null;
|
|
11478
|
+
this._fallbackRoutes = {};
|
|
11479
|
+
this._navHandler = null;
|
|
11212
11480
|
this._routerOptions = options;
|
|
11213
11481
|
this.routeCollection = new RouteCollection(options.RouteItems);
|
|
11214
11482
|
this.routingEngine = new RoutingEngine();
|
|
@@ -11224,11 +11492,9 @@ class UrlRoutingModule {
|
|
|
11224
11492
|
this.routingEngine.stack = this._stack;
|
|
11225
11493
|
}
|
|
11226
11494
|
}
|
|
11227
|
-
_stack = null;
|
|
11228
11495
|
getHooks() {
|
|
11229
11496
|
return this._routerOptions.hooks;
|
|
11230
11497
|
}
|
|
11231
|
-
_windowNavListener = null;
|
|
11232
11498
|
start(mainApp, shellUri) {
|
|
11233
11499
|
this.mainApp = mainApp;
|
|
11234
11500
|
this.routingEngine.register(this.mainApp, this.application, this);
|
|
@@ -11260,8 +11526,7 @@ class UrlRoutingModule {
|
|
|
11260
11526
|
return '/';
|
|
11261
11527
|
}
|
|
11262
11528
|
}
|
|
11263
|
-
static HISTORY_STAMP_KEY = '__motifHistory';
|
|
11264
|
-
_historyStamp = null;
|
|
11529
|
+
static { this.HISTORY_STAMP_KEY = '__motifHistory'; }
|
|
11265
11530
|
_addressMode() {
|
|
11266
11531
|
const w = window;
|
|
11267
11532
|
return this._routerOptions.mode || (w?.location?.protocol === 'file:' ? 'hash' : 'history');
|
|
@@ -11357,7 +11622,6 @@ class UrlRoutingModule {
|
|
|
11357
11622
|
this._stampCurrentEntry(stamp);
|
|
11358
11623
|
this._historyStamp = stamp;
|
|
11359
11624
|
}
|
|
11360
|
-
_pendingTraversal = null;
|
|
11361
11625
|
async _onHistoryTraversal() {
|
|
11362
11626
|
const shown = this._historyStamp;
|
|
11363
11627
|
const arrived = this._readHistoryStamp();
|
|
@@ -11393,8 +11657,6 @@ class UrlRoutingModule {
|
|
|
11393
11657
|
}
|
|
11394
11658
|
catch { }
|
|
11395
11659
|
}
|
|
11396
|
-
_currentUri = '___startup___';
|
|
11397
|
-
_previousRoute = null;
|
|
11398
11660
|
get currentUri() {
|
|
11399
11661
|
return this._currentUri;
|
|
11400
11662
|
}
|
|
@@ -11633,7 +11895,6 @@ class UrlRoutingModule {
|
|
|
11633
11895
|
}
|
|
11634
11896
|
await this.routingEngine.evict(item);
|
|
11635
11897
|
}
|
|
11636
|
-
_fallbackRoutes = {};
|
|
11637
11898
|
_getFallbackRoute(kind) {
|
|
11638
11899
|
const existing = this._fallbackRoutes[kind];
|
|
11639
11900
|
if (existing)
|
|
@@ -11706,7 +11967,7 @@ class UrlRoutingModule {
|
|
|
11706
11967
|
}
|
|
11707
11968
|
return best ? { chain: best.rec.chain, params: best.params } : null;
|
|
11708
11969
|
}
|
|
11709
|
-
static _builtinNotFound = () => new Component('div', {
|
|
11970
|
+
static { this._builtinNotFound = () => new Component('div', {
|
|
11710
11971
|
initializeComponent(sender) {
|
|
11711
11972
|
sender.style({
|
|
11712
11973
|
padding: '20px', fontFamily: 'Arial, sans-serif', display: 'flex', 'flex-direction': 'column', 'align-items': 'center'
|
|
@@ -11714,8 +11975,8 @@ class UrlRoutingModule {
|
|
|
11714
11975
|
sender.element.appendChild($('h2', {}, ...['404 - Not Found']));
|
|
11715
11976
|
sender.element.appendChild($('p', {}, ...['The requested page was not found.']));
|
|
11716
11977
|
},
|
|
11717
|
-
});
|
|
11718
|
-
static _builtinError = () => new Component('div', {
|
|
11978
|
+
}); }
|
|
11979
|
+
static { this._builtinError = () => new Component('div', {
|
|
11719
11980
|
initializeComponent(sender) {
|
|
11720
11981
|
sender.style({
|
|
11721
11982
|
padding: '20px', fontFamily: 'Arial, sans-serif', display: 'flex', 'flex-direction': 'column', 'align-items': 'center'
|
|
@@ -11723,7 +11984,7 @@ class UrlRoutingModule {
|
|
|
11723
11984
|
sender.element.appendChild($('h2', {}, ...['Error']));
|
|
11724
11985
|
sender.element.appendChild($('p', {}, ...['The requested page could not be loaded.']));
|
|
11725
11986
|
},
|
|
11726
|
-
});
|
|
11987
|
+
}); }
|
|
11727
11988
|
async navigateByName(name, params, options) {
|
|
11728
11989
|
return await this.navigate(this.href(name, params), options);
|
|
11729
11990
|
}
|
|
@@ -11879,7 +12140,6 @@ class UrlRoutingModule {
|
|
|
11879
12140
|
}
|
|
11880
12141
|
return true;
|
|
11881
12142
|
}
|
|
11882
|
-
_navHandler = null;
|
|
11883
12143
|
_installLinkInterceptor() {
|
|
11884
12144
|
try {
|
|
11885
12145
|
if (this._navHandler)
|
|
@@ -12084,9 +12344,11 @@ class UrlRoutingModule {
|
|
|
12084
12344
|
}
|
|
12085
12345
|
|
|
12086
12346
|
class RouterState {
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
|
|
12347
|
+
constructor() {
|
|
12348
|
+
this.version = new Signal(0);
|
|
12349
|
+
this._current = null;
|
|
12350
|
+
this._constructing = null;
|
|
12351
|
+
}
|
|
12090
12352
|
read() {
|
|
12091
12353
|
this.version.value;
|
|
12092
12354
|
return this._constructing ?? this._current;
|
|
@@ -12167,8 +12429,8 @@ function createRouter(state, module) {
|
|
|
12167
12429
|
let _globalApplication = null;
|
|
12168
12430
|
let startedApplicationBuilder = false;
|
|
12169
12431
|
class ApplicationBuilder {
|
|
12170
|
-
services = new ServiceCollection();
|
|
12171
12432
|
constructor() {
|
|
12433
|
+
this.services = new ServiceCollection();
|
|
12172
12434
|
if ((_globalApplication && _globalApplication.state !== 'disposing') || startedApplicationBuilder) {
|
|
12173
12435
|
throw new MotifError('MJX405', formatMotifMessage('MJX405'), { cause: _globalApplication });
|
|
12174
12436
|
}
|
|
@@ -12195,28 +12457,31 @@ class ApplicationBuilder {
|
|
|
12195
12457
|
}
|
|
12196
12458
|
}
|
|
12197
12459
|
class Application {
|
|
12198
|
-
provider;
|
|
12199
12460
|
static get main() {
|
|
12200
12461
|
return _globalApplication;
|
|
12201
12462
|
}
|
|
12202
12463
|
constructor(provider) {
|
|
12203
12464
|
this.provider = provider;
|
|
12465
|
+
this._state = 'initializing';
|
|
12466
|
+
this._middlewares = [];
|
|
12467
|
+
this._beforeEachGuards = [];
|
|
12468
|
+
this._routerState = new RouterState();
|
|
12469
|
+
this.router = createRouter(this._routerState, () => this.urlRoutingModule);
|
|
12470
|
+
this.events = new Map();
|
|
12471
|
+
this._routerConfig = null;
|
|
12472
|
+
this._routerRoot = null;
|
|
12473
|
+
this._startedRouter = null;
|
|
12474
|
+
this._lifecycleOff = null;
|
|
12475
|
+
this._isDevelopment = false;
|
|
12476
|
+
this._enableErrorLogging = true;
|
|
12204
12477
|
}
|
|
12205
|
-
static _disposingCount = 0;
|
|
12206
|
-
_state = 'initializing';
|
|
12207
|
-
_disposing;
|
|
12478
|
+
static { this._disposingCount = 0; }
|
|
12208
12479
|
get state() {
|
|
12209
12480
|
return this._state;
|
|
12210
12481
|
}
|
|
12211
|
-
_middlewares = [];
|
|
12212
|
-
_beforeEachGuards = [];
|
|
12213
|
-
_routerState = new RouterState();
|
|
12214
|
-
router = createRouter(this._routerState, () => this.urlRoutingModule);
|
|
12215
|
-
events = new Map();
|
|
12216
12482
|
static CreateBuilder() {
|
|
12217
12483
|
return new ApplicationBuilder();
|
|
12218
12484
|
}
|
|
12219
|
-
appShell;
|
|
12220
12485
|
getAppShell() {
|
|
12221
12486
|
return this.appShell;
|
|
12222
12487
|
}
|
|
@@ -12360,10 +12625,6 @@ class Application {
|
|
|
12360
12625
|
}
|
|
12361
12626
|
return true;
|
|
12362
12627
|
}
|
|
12363
|
-
urlRoutingModule;
|
|
12364
|
-
_routerConfig = null;
|
|
12365
|
-
_routerRoot = null;
|
|
12366
|
-
_startedRouter = null;
|
|
12367
12628
|
useRouter(options) {
|
|
12368
12629
|
let routes;
|
|
12369
12630
|
let mode;
|
|
@@ -12483,7 +12744,6 @@ class Application {
|
|
|
12483
12744
|
return true;
|
|
12484
12745
|
}
|
|
12485
12746
|
}
|
|
12486
|
-
_lifecycleOff = null;
|
|
12487
12747
|
onLifecycle(handler) {
|
|
12488
12748
|
this._installLifecycleListeners();
|
|
12489
12749
|
return this.on('motifjs-app-lifecycle', handler);
|
|
@@ -12525,8 +12785,6 @@ class Application {
|
|
|
12525
12785
|
for (const off of offs)
|
|
12526
12786
|
off();
|
|
12527
12787
|
}
|
|
12528
|
-
_isDevelopment = false;
|
|
12529
|
-
_enableErrorLogging = true;
|
|
12530
12788
|
get isDevelopmentModeEnabled() {
|
|
12531
12789
|
return this._isDevelopment;
|
|
12532
12790
|
}
|
|
@@ -12564,5 +12822,5 @@ function useApplication() {
|
|
|
12564
12822
|
};
|
|
12565
12823
|
}
|
|
12566
12824
|
|
|
12567
|
-
export {
|
|
12568
|
-
//# sourceMappingURL=core-
|
|
12825
|
+
export { setUnexpectedErrorHandler as $, Application as A, errorHandler as B, Component as C, Disposable as D, Emitter as E, ErrorHandler as F, FNComponent as G, FragmentNode as H, Frame as I, inject as J, LazyComputed as K, Lazy as L, MotifError as M, LinkedList as N, motifCompiled as O, motifComponent as P, motifFragment as Q, NodeTypes as R, SLOT_REGISTERED_EVENT as S, TransportRegistry as T, reactive as U, RouterView as V, safeCall as W, safeCallAsync as X, safeCallSilent as Y, ServiceCollection as Z, ServiceProvider as _, SLOT_UNREGISTERED_EVENT as a, Signal as a0, toDisposable as a1, useApplication as a2, useModel as a3, useNavigation as a4, debugGetDeps as a5, debugGetDepMap as a6, UrlRoutingModule as a7, RoutingEngine as a8, RouterState as a9, createRouter as aa, Scanner as ab, RouteCollection as ac, reportError as b, contentBlocks as c, ComponentBase as d, effect as e, findAppendableComponent$1 as f, autoRegistry as g, formatMotifMessage as h, ApplicationBuilder as i, asyncTracking as j, clearModel as k, ComponentMotif as l, motifError as m, notifyDeactivated as n, Computed as o, configureReactivityLeakMonitor as p, ControlCollection as q, reportWarning as r, createComputed as s, createLazyComputed as t, untracked as u, createSignal as v, deepClone as w, disposableCore as x, DisposableStore as y, dom as z };
|
|
12826
|
+
//# sourceMappingURL=core-C-BpS-QN.esm.js.map
|