@motifx/core 1.2.0-rc.1 → 1.2.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,10 +2,12 @@ function rethrowLater(error) {
2
2
  setTimeout(() => { throw error; }, 0);
3
3
  }
4
4
  class ErrorHandler {
5
- unexpectedErrorHandler = rethrowLater;
6
- listeners = [];
7
- _isDevelopment = false;
8
- _enableConsoleLogging = true;
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
- disposableTracker = null;
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.delete(item);
443
+ this._items?.delete(item);
442
444
  item.dispose();
443
445
  }
444
446
  detach(item) {
445
- if (item && this._items.delete(item)) {
447
+ if (item && this._items?.delete(item)) {
446
448
  disposableCore.notifyOwner(item, null);
447
449
  }
448
450
  }
449
451
  clear() {
450
- if (this._items.size === 0) {
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 this._items) {
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
- this._items.clear();
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 = new DisposableStore();
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._disposables;
489
- if (owned && typeof owned.dispose === 'function') {
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
- _ring = createRing();
1054
- _count = 0;
1078
+ constructor() {
1079
+ this._ring = createRing();
1080
+ this._count = 0;
1081
+ }
1055
1082
  get size() {
1056
1083
  return this._count;
1057
1084
  }
@@ -1109,11 +1136,12 @@ class LinkedList {
1109
1136
  }
1110
1137
  }
1111
1138
 
1112
- const COMPILER_CONTRACT = 1;
1139
+ const COMPILER_CONTRACT = 2;
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 === COMPILER_CONTRACT || reported.has(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
- let value = readModelValue(el);
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
- _subscriptions = [];
2051
- _delivery;
2052
- _subscribe;
2053
- _disposed = false;
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
- var valueStr = String(value ?? '').trim();
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
- return (input || '')
2921
- .split(/\s+/)
2922
- .map(s => s.trim())
2923
- .filter(s => s.length > 0);
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
- _addStaticFromString(s) {
3023
- if (!s)
3040
+ _addStaticNames(names) {
3041
+ if (names.length === 0)
3024
3042
  return;
3025
3043
  const el = this._getElement();
3026
- const prev = new Set(this._staticSet);
3027
- for (const cls of this._splitClasses(s))
3028
- this._staticSet.add(cls);
3029
- this._applySourceDiff('static', prev, new Set(this._staticSet), el);
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?.motif?.options?.[TRANSITION_SLOT];
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._base?._leaveContainer;
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._base?._leaveContainer);
4271
+ return enterModeOf(c.parent ?? c._leaveContainer);
4247
4272
  }
4248
4273
  function wantsEnterTransition(c) {
4249
- const o = c?.motif?.options;
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 !!this[OPTIONS_OWNER]._eventHandlers?.has(name);
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._base;
4473
+ const base = component._baseCtx;
4451
4474
  if (base)
4452
- base.emiters.fire(name, ev);
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 list = component._base[listName];
4458
- if (Array.isArray(list) && list.length > 0)
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 component._base.emiters.hasListeners(lowerName);
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
- if (Array.isArray(component._base._initializeComponentHandlers) && component._base._initializeComponentHandlers.length) {
4532
- for (const fn of component._base._initializeComponentHandlers) {
4533
- callReported(() => fn(sender, ev), 'MJX122', 'initializeComponent');
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
- if (Array.isArray(component._base._onInitializeComponentHandlers) && component._base._onInitializeComponentHandlers.length) {
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
- if (Array.isArray(component._base._onDisposingHandlers)) {
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
- if (Array.isArray(component._base._onActivatedHandlers)) {
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
- if (Array.isArray(component._base._onDeactivatedHandlers)) {
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.controls.items.slice()) {
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.controls.items.slice()) {
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 || !component._base || component._base._disposedFired) {
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._base._disposedFired = true;
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
- if (Array.isArray(component._base._onDisposedHandlers)) {
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
- if (Array.isArray(component._base._onBuiltHandlers)) {
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._base._mountedScheduled) {
4700
+ if (!component || component.isDisposed || component._baseCtx?._mountedScheduled) {
4679
4701
  return;
4680
4702
  }
4681
4703
  const hasHook = typeof component.onMounted === 'function'
4682
- || (Array.isArray(component._base._onMountedHandlers) && component._base._onMountedHandlers.length > 0)
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
- if (Array.isArray(component._base._onMountedHandlers)) {
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
- if (Array.isArray(component._base._onBuildingHandlers)) {
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
- if (component.motif.options._preconfig) {
4745
- safeCallSilent(() => component.motif.options._preconfig(component), 'Component._preconfig');
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
- if (Array.isArray(component._base._onConfigHandlers)) {
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.motif.options && component.motif.options._postconfigdone) {
4773
+ if ((component._flags & F_POSTCONFIG) !== 0) {
4763
4774
  return;
4764
4775
  }
4765
- if (component?._base?._configDeferred && !component.isConfigured) {
4776
+ if (component?._baseCtx?._configDeferred && !component.isConfigured) {
4766
4777
  ComponentHelper.callConfig(component);
4767
4778
  }
4768
- component.motif.options._postconfigdone = true;
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
- if (Array.isArray(component._base._onConfiguredHandlers)) {
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
- if (Array.isArray(component._base._onInitializedHandlers)) {
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
- if (Array.isArray(component._base._onInitializingHandlers)) {
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
- if (Array.isArray(component._base._onVisibilityChangedHandlers)) {
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._base._activatePreBindings();
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._base._enterSeq;
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 domReferenceOf = (n) => {
4909
- if (!n || !n.isBuilt)
4910
- return null;
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
- const cfg = c.motif.options?.hideStrategy ?? 'auto';
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._base._enterSeq !== enterSeq;
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
- this.motif.options.cache?.appendChild(ComponentHelper.getContent.call(child));
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.motif?.options;
5057
+ const opts = optionsOf(c);
5044
5058
  const parent = node.parentNode;
5045
5059
  if (node.nodeType === Node.COMMENT_NODE) {
5046
- if (!parent)
5047
- return;
5048
- const close = opts?.closeFragment || null;
5049
- if (close) {
5050
- let current = node;
5051
- while (current) {
5052
- const after = current.nextSibling;
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(current);
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
- catch { }
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._base._offAll();
5170
+ offAll(c);
5157
5171
  }
5158
5172
  catch {
5159
5173
  }
5160
5174
  c.motif.stopAnimations();
5161
- c._base._deactivateBindings();
5162
- if (c.controls?.items?.length) {
5163
- for (const child of c.controls.items) {
5175
+ deactivateBindings(c);
5176
+ if (childrenOf(c).length) {
5177
+ for (const child of c._controls.items) {
5164
5178
  try {
5165
- child._base._disposeShallow();
5179
+ disposeShallow(child);
5166
5180
  }
5167
5181
  catch {
5168
5182
  }
5169
5183
  }
5170
5184
  }
5171
5185
  ComponentHelper.callDisposed.call(c, c);
5172
- safeCall(() => { c._base.emiters.clear(); }, 'disposeShallow.emiters');
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.class?._countsStore?.clear();
5197
+ c._class?._countsStore?.clear();
5189
5198
  }
5190
5199
  catch { }
5191
5200
  try {
5192
- c.class?._watchersStore?.clear();
5201
+ c._class?._watchersStore?.clear();
5193
5202
  }
5194
5203
  catch { }
5195
5204
  try {
5196
- c.attr?._attrMapStore?.clear();
5205
+ c._attr?._attrMapStore?.clear();
5197
5206
  }
5198
5207
  catch { }
5199
5208
  try {
5200
- c.attr?._watchersStore?.clear();
5209
+ c._attr?._watchersStore?.clear();
5201
5210
  }
5202
5211
  catch { }
5203
5212
  try {
5204
- if (c.motif.options) {
5205
- c.motif.options.cache = undefined;
5206
- c.motif.options.closeFragment = undefined;
5207
- c.motif.options.placeholder = undefined;
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.motif.options = undefined;
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 === 'motif')
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.isDisposed = true;
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.motif?.options;
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.controls?.items;
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._base._offAll();
5305
- c._base._deactivateBindings();
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.controls.items = [];
5324
+ if (c._controls)
5325
+ c._controls.items = [];
5313
5326
  safeCall(() => { ComponentHelper.callDisposed.call(c, c); }, 'disposeAsync.callDisposed');
5314
- safeCall(() => { c._base.emiters.clear(); }, 'disposeAsync.emiters');
5327
+ safeCall(() => { c._baseCtx?._emiters?.clear(); }, 'disposeAsync.emiters');
5315
5328
  if (options?.deep) {
5316
- c._base._deepCleanup();
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._base.emiters.clear(); }, 'dispose.emiters');
5323
- c._base._offAll();
5324
- c._base._deepCleanup();
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._base._detachDomWithAnimationAsync();
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.controls.items);
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.controls?.items;
5378
- if (!items || items.length === 0)
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
- detachDomWithAnimation(child);
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
- const c = this.owner;
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
- const c = this.owner;
5464
- try {
5465
- c.bindings?.deactivateAll();
5466
- }
5467
- catch { }
5454
+ deactivateBindings(this.owner);
5468
5455
  },
5469
5456
  _activateBindings() {
5470
- const c = this.owner;
5471
- try {
5472
- c.bindings?.activateAll();
5473
- }
5474
- catch { }
5457
+ activateBindings(this.owner);
5475
5458
  },
5476
5459
  _reactivateBindings() {
5477
- const c = this.owner;
5478
- try {
5479
- c.bindings?.reActivateAll();
5480
- }
5481
- catch { }
5460
+ reactivateBindings(this.owner);
5482
5461
  },
5483
5462
  _activatePreBindings() {
5484
- if (this.prebinding_Activated)
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,83 @@ function createScopedContext(app, owner) {
5550
5691
  });
5551
5692
  }
5552
5693
  class ComponentBase extends Disposable {
5553
- motif = new ComponentMotif(this, new ComponentOptionsImpl(this));
5554
- element;
5555
- props;
5556
- isBuilt = false;
5557
- isInitialized = false;
5558
- isDisposed = false;
5559
- isConfigured = false;
5560
- isPainting = false;
5561
- isPainted = false;
5562
- isVisible = true;
5563
- controls = new ControlCollection(this);
5564
- _eventHandlers;
5565
- _isWait = false;
5566
- class = new controlClass(this);
5567
- attr = new controlAttribute(this);
5568
- bindings = new BindingCollection(this);
5569
- /** style(fn) izleyicisi: tek tek tutulur, yeniden çağrıda önceki durdurulur. */
5570
- _styleFx;
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
+ set motif(value) {
5698
+ this._motif = value;
5699
+ }
5700
+ get isBuilt() {
5701
+ return (this._flags & F_BUILT) !== 0;
5702
+ }
5703
+ set isBuilt(value) {
5704
+ this._flags = value ? this._flags | F_BUILT : this._flags & ~F_BUILT;
5705
+ }
5706
+ get isInitialized() {
5707
+ return (this._flags & F_INITIALIZED) !== 0;
5708
+ }
5709
+ set isInitialized(value) {
5710
+ this._flags = value ? this._flags | F_INITIALIZED : this._flags & ~F_INITIALIZED;
5711
+ }
5712
+ get isDisposed() {
5713
+ return (this._flags & F_DISPOSED) !== 0;
5714
+ }
5715
+ set isDisposed(value) {
5716
+ this._flags = value ? this._flags | F_DISPOSED : this._flags & ~F_DISPOSED;
5717
+ }
5718
+ get isConfigured() {
5719
+ return (this._flags & F_CONFIGURED) !== 0;
5720
+ }
5721
+ set isConfigured(value) {
5722
+ this._flags = value ? this._flags | F_CONFIGURED : this._flags & ~F_CONFIGURED;
5723
+ }
5724
+ get isPainting() {
5725
+ return (this._flags & F_PAINTING) !== 0;
5726
+ }
5727
+ set isPainting(value) {
5728
+ this._flags = value ? this._flags | F_PAINTING : this._flags & ~F_PAINTING;
5729
+ }
5730
+ get isPainted() {
5731
+ return (this._flags & F_PAINTED) !== 0;
5732
+ }
5733
+ set isPainted(value) {
5734
+ this._flags = value ? this._flags | F_PAINTED : this._flags & ~F_PAINTED;
5735
+ }
5736
+ get isVisible() {
5737
+ return (this._flags & F_HIDDEN) === 0;
5738
+ }
5739
+ set isVisible(value) {
5740
+ this._flags = value ? this._flags & ~F_HIDDEN : this._flags | F_HIDDEN;
5741
+ }
5742
+ get controls() {
5743
+ return this._controls !== undefined || (this.isDisposed && !this.element) ? this._controls : (this._controls = createOwnedControls(this));
5744
+ }
5745
+ set controls(value) {
5746
+ this._controls = value;
5747
+ }
5748
+ get class() {
5749
+ return this._class !== undefined || (this.isDisposed && !this.element) ? this._class : (this._class = new controlClass(this));
5750
+ }
5751
+ set class(value) {
5752
+ this._class = value;
5753
+ }
5754
+ get attr() {
5755
+ return this._attr !== undefined || (this.isDisposed && !this.element) ? this._attr : (this._attr = new controlAttribute(this));
5756
+ }
5757
+ set attr(value) {
5758
+ this._attr = value;
5759
+ }
5760
+ get bindings() {
5761
+ return this._bindings !== undefined || (this.isDisposed && !this.element) ? this._bindings : (this._bindings = new BindingCollection(this));
5762
+ }
5763
+ set bindings(value) {
5764
+ this._bindings = value;
5765
+ }
5571
5766
  useModel(modelCtor) {
5572
5767
  return reactive(modelCtor);
5573
5768
  }
5574
5769
  _computeHideStrategy() {
5575
- const cfg = this.motif.options?.hideStrategy ?? 'auto';
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';
5770
+ return keepsTrace(this) ? 'placeholder' : 'detach';
5584
5771
  }
5585
5772
  _isInDom() {
5586
5773
  try {
@@ -5597,7 +5784,7 @@ class ComponentBase extends Disposable {
5597
5784
  }
5598
5785
  }
5599
5786
  set isWait(value) {
5600
- this._isWait = value;
5787
+ this._flags = value ? this._flags | F_WAIT : this._flags & ~F_WAIT;
5601
5788
  if (this.isBuilt) {
5602
5789
  if (value) {
5603
5790
  this.motif.hide();
@@ -5612,10 +5799,22 @@ class ComponentBase extends Disposable {
5612
5799
  }
5613
5800
  }
5614
5801
  get isWait() {
5615
- return this._isWait;
5802
+ return (this._flags & F_WAIT) !== 0;
5616
5803
  }
5617
5804
  constructor(element, props = {}) {
5618
5805
  super();
5806
+ this._motif = undefined;
5807
+ this._flags = 0;
5808
+ this._controls = undefined;
5809
+ this._class = undefined;
5810
+ this._attr = undefined;
5811
+ this._bindings = undefined;
5812
+ this._baseCtx = undefined;
5813
+ this._init = undefined;
5814
+ this._leaveContainer = undefined;
5815
+ this.parent = null;
5816
+ const asComponentRoot = constructingComponentRoot;
5817
+ constructingComponentRoot = false;
5619
5818
  recordServiceOwner(this);
5620
5819
  if (this.onElementCreating) {
5621
5820
  this.element = this.onElementCreating.call(this);
@@ -5626,44 +5825,38 @@ class ComponentBase extends Disposable {
5626
5825
  else {
5627
5826
  this.element = element;
5628
5827
  }
5629
- if (props) {
5630
- const refs = extractRefs(props, this);
5631
- if (refs.length > 0) {
5632
- for (const fn of takePendingRefs(this, refs)) {
5633
- callReported(() => fn(this), 'MJX122', 'ref');
5634
- }
5635
- }
5828
+ if (this.element?.nodeType !== 3) {
5829
+ if (this._controls === undefined)
5830
+ this._controls = new ControlCollection(this);
5636
5831
  }
5637
- props && ParseProps(props, this);
5832
+ const refs = props ? extractRefs(props, this) : [];
5833
+ if (props && ParseProps(props, this))
5834
+ props = {};
5638
5835
  applyComponentOptions(props?.options, this);
5639
5836
  this.props = props;
5640
5837
  // (class/style/id/tabindex/role/aria-*/data-*) kök düğüme (root node) düşer, prop'lar this.props'ta kalır.
5641
5838
  if (props) {
5642
5839
  const ctor0 = new.target;
5643
- const plain = ctor0 === ComponentBase || Object.getPrototypeOf(ctor0) === ComponentBase;
5840
+ const plain = !asComponentRoot && (ctor0 === ComponentBase || Object.getPrototypeOf(ctor0) === ComponentBase);
5644
5841
  if (plain)
5645
5842
  applyPlainElementProps(props, this);
5646
5843
  else
5647
5844
  applyFallthroughProps(props, this);
5648
5845
  }
5846
+ if (refs.length > 0) {
5847
+ for (const fn of takePendingRefs(this, refs)) {
5848
+ callReported(() => fn(this), 'MJX122', 'ref');
5849
+ }
5850
+ }
5649
5851
  ComponentHelper.callOnInitializing(this);
5650
5852
  if (this.isDisposed)
5651
5853
  return;
5652
- this.controls.onAdd = (c) => {
5653
- if (this._eventHandlers?.has('controladded'))
5654
- this.motif.trigger('controladded', { control: c });
5655
- if (this.isWait || this.parent?.isWait)
5656
- return;
5657
- ComponentHelper.internalBuild.call(this, c);
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
- };
5854
+ const controls = this._controls;
5855
+ if (controls) {
5856
+ controls.onAdd = ownerControlAdded;
5857
+ controls.onAddBeforeBuild = ownerControlAddedBeforeBuild;
5858
+ controls.onRemove = ownerControlRemoved;
5859
+ }
5667
5860
  ComponentHelper.callOnInitialized(this);
5668
5861
  const ctor = new.target;
5669
5862
  const isBaseCtor = ctor === ComponentBase || Object.getPrototypeOf(ctor) === ComponentBase;
@@ -5674,10 +5867,9 @@ class ComponentBase extends Disposable {
5674
5867
  this._base._configDeferred = true;
5675
5868
  }
5676
5869
  }
5677
- childs;
5678
- _base = createBaseCtx(this);
5679
- parent = null;
5680
- _scopedContext;
5870
+ get _base() {
5871
+ return this._baseCtx !== undefined || (this.isDisposed && !this.element) ? this._baseCtx : (this._baseCtx = createBaseCtx(this));
5872
+ }
5681
5873
  get context() {
5682
5874
  const parentCtx = this.parent?.context;
5683
5875
  const app = parentCtx?.[RAW_APPLICATION] ?? parentCtx ?? teardownApplications.get(this) ?? Application.main;
@@ -5704,7 +5896,7 @@ class ComponentBase extends Disposable {
5704
5896
  build(building = true) {
5705
5897
  checkReservedMembers(this);
5706
5898
  ComponentHelper.callConfigured(this);
5707
- this._base._activatePreBindings();
5899
+ activatePreBindings(this);
5708
5900
  if (this.isDisposed || !this.element || this.isWait) {
5709
5901
  return;
5710
5902
  }
@@ -5741,7 +5933,7 @@ class ComponentBase extends Disposable {
5741
5933
  }
5742
5934
  const deferredSelectValue = this.element?.nodeName === 'SELECT'
5743
5935
  ? this.bindings.items.filter(b => b.propertyName === 'value')
5744
- : [];
5936
+ : NO_BINDINGS;
5745
5937
  if (deferredSelectValue.length) {
5746
5938
  try {
5747
5939
  this.bindings.items.filter(b => !deferredSelectValue.includes(b)).forEach(b => b.activate());
@@ -5749,32 +5941,41 @@ class ComponentBase extends Disposable {
5749
5941
  catch { }
5750
5942
  }
5751
5943
  else {
5752
- this._base._activateBindings();
5944
+ activateBindings(this);
5753
5945
  }
5754
- for (const element of this.controls.items.filter(c => !c.isWait)) {
5755
- element.parent = this;
5756
- element.build(false);
5946
+ const kids = childrenOf(this);
5947
+ for (const element of kids.length ? kids.slice() : kids) {
5948
+ var target = isFragment ? this.motif.options.cache : this.element;
5949
+ if (!element.isWait) {
5950
+ element.parent = this;
5951
+ element.build(false);
5952
+ }
5757
5953
  if (element.isWait) {
5954
+ if (keepsTrace(element)) {
5955
+ const opts = element.motif.options;
5956
+ (building ? ph : target).appendChild(opts.placeholder ?? (opts.placeholder = dom.createComment("h")));
5957
+ }
5758
5958
  continue;
5759
5959
  }
5760
- var target = isFragment ? this.motif.options.cache : this.element;
5761
5960
  if (building) {
5762
- if (element.motif.options.cache) {
5763
- ph.appendChild(element.motif.options.cache);
5961
+ const cache = optionsOf(element)?.cache;
5962
+ if (cache) {
5963
+ ph.appendChild(cache);
5764
5964
  }
5765
5965
  else {
5766
5966
  ph.appendChild(element.element);
5767
5967
  }
5768
5968
  }
5769
5969
  else {
5770
- if (element.motif.options.cache) {
5771
- target.appendChild(element.motif.options.cache);
5970
+ const cache = optionsOf(element)?.cache;
5971
+ if (cache) {
5972
+ target.appendChild(cache);
5772
5973
  }
5773
5974
  else {
5774
5975
  target.appendChild(element.element);
5775
5976
  }
5776
5977
  }
5777
- if (element._base?._inactive && element.isVisible) {
5978
+ if (element._baseCtx?._inactive && element.isVisible) {
5778
5979
  ComponentHelper.activateTree(element);
5779
5980
  }
5780
5981
  }
@@ -5837,10 +6038,10 @@ class ComponentBase extends Disposable {
5837
6038
  this.controls.forEach(c => {
5838
6039
  c.setState();
5839
6040
  });
5840
- this._base._reactivateBindings();
6041
+ reactivateBindings(this);
5841
6042
  }
5842
6043
  reState() {
5843
- this._base._reactivateBindings();
6044
+ reactivateBindings(this);
5844
6045
  this.controls.forEach(c => {
5845
6046
  c.reState();
5846
6047
  });
@@ -5964,6 +6165,9 @@ class ComponentBase extends Disposable {
5964
6165
  if (this.isVisible) {
5965
6166
  return;
5966
6167
  } /* A*/
6168
+ if (this.isWait) {
6169
+ return;
6170
+ }
5967
6171
  if (this.parent && enterModeOf(this.parent) === 'out-in') {
5968
6172
  const showHost = (this.motif.options.placeholder?.parentNode)
5969
6173
  ?? findAppendableComponent(this.parent)?.element;
@@ -5985,7 +6189,7 @@ class ComponentBase extends Disposable {
5985
6189
  /** A*/
5986
6190
  const strategy = this._computeHideStrategy();
5987
6191
  if (strategy === 'detach') {
5988
- ComponentHelper.callVisibilityChanged(this);
6192
+ ComponentHelper.callVisibilityChanged(this, true);
5989
6193
  if (this.isDisposed) {
5990
6194
  return;
5991
6195
  }
@@ -6002,6 +6206,10 @@ class ComponentBase extends Disposable {
6002
6206
  const expectedParent = findAppendableComponent(this.parent)?.element;
6003
6207
  if (this.motif.options.placeholder && placeholderParent && placeholderParent !== expectedParent) {
6004
6208
  reportWarning('MJX106', []);
6209
+ ComponentHelper.callVisibilityChanged(this, true);
6210
+ if (this.isDisposed) {
6211
+ return;
6212
+ }
6005
6213
  this.isVisible = true;
6006
6214
  if (this.parent?.isBuilt) {
6007
6215
  ComponentHelper.internalBuild.call(this.parent, this);
@@ -6010,11 +6218,12 @@ class ComponentBase extends Disposable {
6010
6218
  }
6011
6219
  /** A*/
6012
6220
  wantsEnterTransition(this) && this.motif.options.transition.enterTransition(() => { });
6013
- ComponentHelper.callVisibilityChanged(this);
6221
+ ComponentHelper.callVisibilityChanged(this, true);
6014
6222
  if (this.isDisposed) {
6015
6223
  return;
6016
6224
  }
6017
6225
  if (this.element.nodeType === Node.COMMENT_NODE) {
6226
+ this.controls.items.filter(c => !c.isBuilt).forEach(c => ComponentHelper.internalBuild.call(this, c));
6018
6227
  this.controls.forEach(c => {
6019
6228
  c.motif.show();
6020
6229
  });
@@ -6022,6 +6231,10 @@ class ComponentBase extends Disposable {
6022
6231
  ComponentHelper.activateTree(this, false);
6023
6232
  return;
6024
6233
  }
6234
+ if (!this.isBuilt) {
6235
+ this.isVisible = true;
6236
+ return;
6237
+ }
6025
6238
  var parent = this.motif.options.placeholder?.parentElement;
6026
6239
  if (parent) {
6027
6240
  parent.replaceChild(this.element, this.motif.options.placeholder);
@@ -6040,7 +6253,7 @@ class ComponentBase extends Disposable {
6040
6253
  }
6041
6254
  const strategy = this._computeHideStrategy();
6042
6255
  if (strategy === 'detach') {
6043
- ComponentHelper.callVisibilityChanged(this);
6256
+ ComponentHelper.callVisibilityChanged(this, false);
6044
6257
  if (this.isDisposed) {
6045
6258
  return;
6046
6259
  }
@@ -6055,7 +6268,7 @@ class ComponentBase extends Disposable {
6055
6268
  if (skip)
6056
6269
  transition.skipNextLeave = false;
6057
6270
  const finish = () => {
6058
- ComponentHelper.callVisibilityChanged(this);
6271
+ ComponentHelper.callVisibilityChanged(this, false);
6059
6272
  if (this.isDisposed) {
6060
6273
  return;
6061
6274
  }
@@ -6138,61 +6351,36 @@ class ComponentBase extends Disposable {
6138
6351
  return this;
6139
6352
  }
6140
6353
  }
6141
- const [name, ...mods] = full.split(":");
6354
+ const colon = full.indexOf(":");
6355
+ const name = colon < 0 ? full : full.slice(0, colon);
6356
+ const mods = colon < 0 ? NO_MODS : full.slice(colon + 1).split(":");
6142
6357
  const evt = name.startsWith("on") ? name.slice(2).toLowerCase() : name.toLowerCase();
6143
- const options = {};
6144
- if (mods.includes("once"))
6145
- options.once = true;
6146
- if (mods.includes("passive"))
6147
- options.passive = true;
6148
- if (mods.includes("capture"))
6149
- options.capture = true;
6150
- const wrapped = (ev) => {
6151
- if (mods.includes("self") && ev.target !== this.element)
6152
- return;
6153
- if (mods.includes("trusted") && !ev.isTrusted)
6154
- return;
6155
- let res;
6156
- try {
6157
- if (cb && cb.length <= 1) {
6158
- res = cb(ev);
6159
- }
6160
- else if (cb) {
6161
- res = cb(this, ev);
6162
- }
6163
- }
6164
- catch (error) {
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
- };
6358
+ let flags = domEvent ? EV_DOM : 0;
6359
+ let options;
6360
+ if (mods.length) {
6361
+ options = {};
6362
+ if (mods.includes("once"))
6363
+ options.once = true;
6364
+ if (mods.includes("passive"))
6365
+ options.passive = true;
6366
+ if (mods.includes("capture")) {
6367
+ options.capture = true;
6368
+ flags |= EV_CAPTURE;
6369
+ }
6370
+ if (mods.includes("self"))
6371
+ flags |= EV_SELF;
6372
+ if (mods.includes("trusted"))
6373
+ flags |= EV_TRUSTED;
6374
+ if (mods.includes("prevent"))
6375
+ flags |= EV_PREVENT;
6376
+ if (mods.includes("stop"))
6377
+ flags |= EV_STOP;
6378
+ }
6379
+ const record = new EventRecord(this, full.toLowerCase(), cb, evt, flags);
6185
6380
  if (domEvent) {
6186
- this.element.addEventListener(evt, wrapped, options);
6187
- }
6188
- this._eventHandlers ??= new Map();
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
- }));
6381
+ this.element.addEventListener(evt, record, options);
6382
+ }
6383
+ addEventRecord(this, record);
6196
6384
  return this;
6197
6385
  }
6198
6386
  async _trigger(event, ev) {
@@ -6201,15 +6389,20 @@ class ComponentBase extends Disposable {
6201
6389
  }
6202
6390
  const name = String(event).toLowerCase();
6203
6391
  safeCall(() => {
6204
- var eh = this._eventHandlers?.get(name);
6205
- if (eh) {
6206
- eh.forEach(rec => {
6392
+ eventDispatchDepth++;
6393
+ try {
6394
+ for (let r = this._eventHandlers; r !== undefined; r = r.next) {
6395
+ if ((r.flags & EV_REMOVED) !== 0 || r.key !== name)
6396
+ continue;
6207
6397
  try {
6208
- rec.wrapped(ev);
6398
+ r.handleEvent(ev);
6209
6399
  }
6210
6400
  catch {
6211
6401
  }
6212
- });
6402
+ }
6403
+ }
6404
+ finally {
6405
+ eventDispatchDepth--;
6213
6406
  }
6214
6407
  }, 'trigger');
6215
6408
  return this;
@@ -6232,38 +6425,24 @@ class ComponentBase extends Disposable {
6232
6425
  return this;
6233
6426
  }
6234
6427
  if (LIFECYCLE_X_EVENTS.has(xName)) {
6235
- this._base.emiters.off("on" + xName, cb);
6428
+ this._base._emiters?.off("on" + xName, cb);
6236
6429
  }
6237
6430
  return this;
6238
6431
  }
6239
- const name = full.split(":")[0];
6240
- const evt = name.startsWith("on") ? name.slice(2).toLowerCase() : name.toLowerCase();
6241
- if (!this._eventHandlers)
6242
- return this;
6243
- const set = this._eventHandlers.get(full);
6244
- if (!set)
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;
6432
+ for (let r = this._eventHandlers; r !== undefined; r = r.next) {
6433
+ if ((r.flags & EV_REMOVED) !== 0 || r.key !== full || r.original !== cb)
6434
+ continue;
6435
+ if ((r.flags & EV_DOM) !== 0) {
6436
+ const rec = r;
6437
+ safeCall(() => { this.element.removeEventListener(rec.type, rec, (rec.flags & EV_CAPTURE) !== 0); }, 'off.removeEventListener');
6259
6438
  }
6439
+ r.flags |= EV_REMOVED;
6440
+ break;
6260
6441
  }
6261
- if (set.size === 0)
6262
- this._eventHandlers.delete(full);
6442
+ if (eventDispatchDepth === 0)
6443
+ compactEventRecords(this);
6263
6444
  return this;
6264
6445
  }
6265
- /** Süren bertaraf: ikinci bir dispose/disposeAsync çağrısı yenisini başlatmaz, bunu bekler. */
6266
- _disposing;
6267
6446
  dispose(options = { deep: true }) {
6268
6447
  if (this.isDisposed) {
6269
6448
  return Promise.resolve();
@@ -6334,8 +6513,6 @@ class ComponentBase extends Disposable {
6334
6513
  }
6335
6514
  });
6336
6515
  }
6337
- _siblingsApi;
6338
- _siblingsSet;
6339
6516
  get siblings() {
6340
6517
  if (this._siblingsSet) {
6341
6518
  return this._siblingsApi;
@@ -6527,6 +6704,16 @@ function takePendingRefs(component, ref) {
6527
6704
  }
6528
6705
  return pending;
6529
6706
  }
6707
+ function disposeUnplacedChilds(owner, kids) {
6708
+ if (!Array.isArray(kids) || !kids.some(kid => kid instanceof ComponentBase))
6709
+ return;
6710
+ owner.motif.setDisposable(() => {
6711
+ for (const kid of kids) {
6712
+ if (kid instanceof ComponentBase && !kid.isDisposed && !kid.parent)
6713
+ kid.dispose();
6714
+ }
6715
+ });
6716
+ }
6530
6717
  const isCallableRef = (ref) => typeof ref === 'function' || Array.isArray(ref);
6531
6718
  function extractRefs(props, component) {
6532
6719
  const refs = [];
@@ -6578,26 +6765,38 @@ function collectLifecycleHandlers(component, lowerKey, value) {
6578
6765
  const fns = Array.isArray(value) ? value : [value];
6579
6766
  if (fns.length === 0 || !fns.every(fn => typeof fn === 'function'))
6580
6767
  return false;
6581
- component._base[listName] ??= [];
6582
- const list = component._base[listName];
6583
- for (const fn of fns) {
6584
- if (!list.includes(fn))
6585
- list.push(fn);
6768
+ const target = component;
6769
+ let from = 0;
6770
+ if (listName === '_initializeComponentHandlers') {
6771
+ if (target._init === undefined && !target._baseCtx?._initializeComponentHandlers) {
6772
+ target._init = fns[0];
6773
+ from = 1;
6774
+ }
6775
+ }
6776
+ if (from >= fns.length)
6777
+ return true;
6778
+ const base = target._base;
6779
+ for (let i = from; i < fns.length; i++) {
6780
+ const fn = fns[i];
6781
+ if (listName === '_initializeComponentHandlers' && fn === target._init)
6782
+ continue;
6783
+ const slot = base[listName];
6784
+ if (slot === undefined)
6785
+ base[listName] = fn;
6786
+ else if (typeof slot === 'function') {
6787
+ if (slot !== fn)
6788
+ base[listName] = [slot, fn];
6789
+ }
6790
+ else if (!slot.includes(fn))
6791
+ slot.push(fn);
6586
6792
  }
6587
6793
  return true;
6588
6794
  }
6589
6795
  function ParseProps(props, component) {
6590
6796
  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
6797
  var keys = Object.keys(props);
6599
6798
  if (keys.length === 0)
6600
- return;
6799
+ return false;
6601
6800
  keys.forEach(key => {
6602
6801
  if (key == 'initializeComponent' || key == 'oninitializeComponent' || key.startsWith('on')) {
6603
6802
  if (collectLifecycleHandlers(component, key.toLowerCase(), props[key])) {
@@ -6608,6 +6807,7 @@ function ParseProps(props, component) {
6608
6807
  else if (key == 'childs') {
6609
6808
  const flat = [].concat(...props[key]);
6610
6809
  component.childs = flat;
6810
+ disposeUnplacedChilds(component, flat);
6611
6811
  delete props[key];
6612
6812
  }
6613
6813
  else if (key === 'transition') {
@@ -6652,9 +6852,14 @@ function ParseProps(props, component) {
6652
6852
  component.motif.options._preconfig = props[key];
6653
6853
  delete props[key];
6654
6854
  }
6855
+ else if (key === '__childExpr') {
6856
+ delete props[key];
6857
+ }
6655
6858
  else ;
6656
6859
  });
6860
+ return typeof props === 'object' && Reflect.ownKeys(props).length === 0;
6657
6861
  }
6862
+ return false;
6658
6863
  }
6659
6864
  const _transitionSources = new WeakMap();
6660
6865
  function setTransition(component, value, live) {
@@ -6825,6 +7030,16 @@ const FALLTHROUGH_KEYS = new Set(['class', 'className', 'style', 'id', 'tabindex
6825
7030
  function isFallthroughKey(key) {
6826
7031
  return FALLTHROUGH_KEYS.has(key) || key.startsWith('aria-') || key.startsWith('data-');
6827
7032
  }
7033
+ let constructingComponentRoot = false;
7034
+ function constructComponentRoot(make) {
7035
+ constructingComponentRoot = true;
7036
+ try {
7037
+ return make();
7038
+ }
7039
+ finally {
7040
+ constructingComponentRoot = false;
7041
+ }
7042
+ }
6828
7043
  function applyFallthroughProps(props, component) {
6829
7044
  if (!props || typeof props !== 'object' || component.isDisposed)
6830
7045
  return;
@@ -6874,35 +7089,51 @@ function findAppendableComponent(component) {
6874
7089
  return null;
6875
7090
  }, 'findAppendableComponent', null);
6876
7091
  }
7092
+ const attachWaiters = new Set();
7093
+ let attachObserver = null;
7094
+ function releaseAttachObserver() {
7095
+ if (attachWaiters.size || !attachObserver) {
7096
+ return;
7097
+ }
7098
+ try {
7099
+ attachObserver.disconnect();
7100
+ }
7101
+ catch { /* ignore */ }
7102
+ attachObserver = null;
7103
+ }
7104
+ function flushAttachWaiters() {
7105
+ for (const waiter of [...attachWaiters]) {
7106
+ if (!attachWaiters.has(waiter) || !document.contains(waiter.element)) {
7107
+ continue;
7108
+ }
7109
+ attachWaiters.delete(waiter);
7110
+ try {
7111
+ waiter.callback();
7112
+ }
7113
+ catch (error) {
7114
+ queueMicrotask(() => { throw error; });
7115
+ }
7116
+ }
7117
+ releaseAttachObserver();
7118
+ }
6877
7119
  function onElementAttached(element, callback) {
6878
7120
  if (document.contains(element)) {
6879
7121
  callback();
6880
7122
  return null;
6881
7123
  }
6882
- let done = false;
6883
- const observer = new MutationObserver(() => {
6884
- if (done) {
6885
- return;
6886
- }
6887
- if (document.contains(element)) {
6888
- done = true;
6889
- observer.disconnect();
6890
- callback();
6891
- }
6892
- });
6893
- observer.observe(document.documentElement, {
6894
- childList: true,
6895
- subtree: true,
6896
- });
7124
+ const waiter = { element, callback };
7125
+ attachWaiters.add(waiter);
7126
+ if (!attachObserver) {
7127
+ attachObserver = new MutationObserver(flushAttachWaiters);
7128
+ attachObserver.observe(document.documentElement, {
7129
+ childList: true,
7130
+ subtree: true,
7131
+ });
7132
+ }
6897
7133
  return () => {
6898
- if (done) {
6899
- return;
7134
+ if (attachWaiters.delete(waiter)) {
7135
+ releaseAttachObserver();
6900
7136
  }
6901
- done = true;
6902
- try {
6903
- observer.disconnect();
6904
- }
6905
- catch { /* ignore */ }
6906
7137
  };
6907
7138
  }
6908
7139
  function notifyActivated(component) {
@@ -6958,8 +7189,6 @@ function createDeclaredElement(tag, ctor, props) {
6958
7189
  return dom.createElement(tag, props);
6959
7190
  }
6960
7191
  class Component extends ComponentBase {
6961
- static elementTag;
6962
- static elementNamespace;
6963
7192
  constructor() {
6964
7193
  const derivedCtor = new.target;
6965
7194
  var args = arguments;
@@ -7039,9 +7268,11 @@ class Component extends ComponentBase {
7039
7268
  // Alt sınıflar initializeComponent'i ezdiği için FragmentNode.initializeComponent'e güvenilemez.
7040
7269
  const kids = this.childs;
7041
7270
  if (Array.isArray(kids) && kids.length) {
7042
- for (const kid of kids) {
7043
- if (kid)
7044
- this.controls.add(kid);
7271
+ if (derivedCtor?._placesChilds !== true) {
7272
+ for (const kid of kids) {
7273
+ if (kid)
7274
+ this.controls.add(kid);
7275
+ }
7045
7276
  }
7046
7277
  }
7047
7278
  }
@@ -7063,6 +7294,7 @@ function applyJsxFrameworkProps(target, props, refs) {
7063
7294
  if (!(target instanceof ComponentBase))
7064
7295
  return target;
7065
7296
  applyRefs(target, refs.concat(extractRefs(props)));
7297
+ disposeUnplacedChilds(target, props.childs);
7066
7298
  // Fonksiyon bileşeni etiketindeki ortak öznitelikler (class/id/aria-*…) döndürülen köke düşer.
7067
7299
  // Kök `<div {...props}/>` ise aynı değerler zaten uygulanmıştır; ikinci kez uygulanmaz.
7068
7300
  applyFallthroughProps(props, target);
@@ -7073,8 +7305,7 @@ function applyJsxFrameworkProps(target, props, refs) {
7073
7305
  const runover = props.runover;
7074
7306
  if (!runover || typeof runover !== 'object')
7075
7307
  return target;
7076
- const handlers = target._base?._onConfigHandlers;
7077
- const configuredBefore = Array.isArray(handlers) ? handlers.length : 0;
7308
+ const configuredBefore = handlerCount(target, '_onConfigHandlers');
7078
7309
  const initializingBefore = handlerCount(target, '_onInitializingHandlers');
7079
7310
  const initializedBefore = handlerCount(target, '_onInitializedHandlers');
7080
7311
  ParseProps(runover, target);
@@ -7088,12 +7319,9 @@ function applyJsxFrameworkProps(target, props, refs) {
7088
7319
  if (typeof pre === 'function') {
7089
7320
  safeCallSilent(() => pre(target), 'motifComponent.preconfig');
7090
7321
  }
7091
- const after = target._base?._onConfigHandlers;
7092
- if (Array.isArray(after)) {
7093
- for (let i = configuredBefore; i < after.length; i++) {
7094
- const fn = after[i];
7095
- callReported(() => fn(target, { cancel: false }), 'MJX122', 'onConfig');
7096
- }
7322
+ for (let i = configuredBefore; i < handlerCount(target, '_onConfigHandlers'); i++) {
7323
+ const fn = hookList(target, '_onConfigHandlers')[i];
7324
+ callReported(() => fn(target, { cancel: false }), 'MJX122', 'onConfig');
7097
7325
  }
7098
7326
  }
7099
7327
  return target;
@@ -7106,18 +7334,18 @@ function applyRefs(target, refs) {
7106
7334
  }
7107
7335
  return target;
7108
7336
  }
7337
+ function hookList(target, listName) {
7338
+ const slot = target._base?.[listName];
7339
+ return !slot ? [] : typeof slot === 'function' ? [slot] : slot;
7340
+ }
7109
7341
  function handlerCount(target, listName) {
7110
- const list = target._base?.[listName];
7111
- return Array.isArray(list) ? list.length : 0;
7342
+ return hookList(target, listName).length;
7112
7343
  }
7113
7344
  function callAddedHandlers(target, listName, from, hook) {
7114
- const list = target._base?.[listName];
7115
- if (!Array.isArray(list))
7116
- return;
7117
- for (let i = from; i < list.length; i++) {
7345
+ for (let i = from; i < handlerCount(target, listName); i++) {
7118
7346
  if (target.isDisposed)
7119
7347
  return;
7120
- const fn = list[i];
7348
+ const fn = hookList(target, listName)[i];
7121
7349
  callReported(() => fn(target, { cancel: false }), 'MJX122', hook);
7122
7350
  }
7123
7351
  }
@@ -7140,6 +7368,11 @@ function resolveChildExpression(probe) {
7140
7368
  function motifComponent(element, props) {
7141
7369
  // Etiket adı: element yaratımı (HTML/SVG) ve spread prop uygulaması Component ctor'ının string parametresinde
7142
7370
  if (typeof element === "string") {
7371
+ if (typeof props === "function") {
7372
+ const compiled = new Component(element);
7373
+ compiled._init = props;
7374
+ return compiled;
7375
+ }
7143
7376
  if (element === "text" && props && props.__childExpr) {
7144
7377
  const resolved = resolveChildExpression(props.__childExpr);
7145
7378
  if (resolved !== undefined)
@@ -7201,7 +7434,9 @@ function resolveToComponent(input, props) {
7201
7434
  return resolved;
7202
7435
  }
7203
7436
  function materializeOptionsObject(spec, props) {
7204
- const result = motifComponent(spec.el, props);
7437
+ const result = typeof spec.el === 'string'
7438
+ ? constructComponentRoot(() => motifComponent(spec.el, props))
7439
+ : motifComponent(spec.el, props);
7205
7440
  Object.getOwnPropertyNames(spec).forEach(key => {
7206
7441
  if (key !== 'el' && key !== 'ctor') {
7207
7442
  result[key] = spec[key];
@@ -7237,7 +7472,7 @@ class FragmentNode extends Component {
7237
7472
  }
7238
7473
  }
7239
7474
  safeCallSilent(() => {
7240
- const nodes = this.motif.options?.props?.nodes;
7475
+ const nodes = this.props?.nodes;
7241
7476
  if (Array.isArray(nodes) && nodes.length) {
7242
7477
  for (const n of nodes) {
7243
7478
  if (n)
@@ -7399,11 +7634,10 @@ function $(description, attrs, ...children) {
7399
7634
 
7400
7635
  // import { dom } from "../browser";
7401
7636
  class ControlCollection {
7402
- owner;
7403
7637
  constructor(owner) {
7404
7638
  this.owner = owner;
7639
+ this.items = [];
7405
7640
  }
7406
- items = [];
7407
7641
  add() {
7408
7642
  const count = arguments.length;
7409
7643
  if (count === 0)
@@ -7483,7 +7717,7 @@ class ControlCollection {
7483
7717
  this.items.splice(index, 1);
7484
7718
  if (control.isDisposed)
7485
7719
  return Promise.resolve();
7486
- control._base && (control._base._leaveContainer = this.owner);
7720
+ control._leaveContainer = this.owner;
7487
7721
  control.parent = null;
7488
7722
  return runLeaveThenDetach(control, () => { if (this.onRemove)
7489
7723
  this.onRemove(control); });
@@ -7513,7 +7747,7 @@ class ControlCollection {
7513
7747
  if (index === -1)
7514
7748
  return;
7515
7749
  this.items.splice(index, 1);
7516
- control._base && (control._base._leaveContainer = this.owner);
7750
+ control._leaveContainer = this.owner;
7517
7751
  control.parent = null;
7518
7752
  }
7519
7753
  async clearAsync() {
@@ -7538,9 +7772,6 @@ class ControlCollection {
7538
7772
  map(callbackfn) {
7539
7773
  return this.items.map(callbackfn);
7540
7774
  }
7541
- onAdd;
7542
- onRemove;
7543
- onAddBeforeBuild;
7544
7775
  move(control, before) {
7545
7776
  if (!control || control.isDisposed)
7546
7777
  return;
@@ -7568,14 +7799,29 @@ class ControlCollection {
7568
7799
  const insertAt = newBeforeIndex >= 0 ? newBeforeIndex : this.items.length;
7569
7800
  this.items.splice(insertAt, 0, control);
7570
7801
  }
7571
- if (control.isWait) {
7572
- return;
7573
- }
7574
7802
  const container = findAppendableElement(this.owner);
7575
- if (!container)
7803
+ if (!container || !domAnchor(control, container))
7576
7804
  return;
7577
- const referenceNode = before ? before.element : computeAppendReference(this.owner);
7578
- moveComponentDomRange(control, container, referenceNode);
7805
+ const at = before ? this.items.indexOf(before) : -1;
7806
+ moveComponentDomRange(control, container, at >= 0 ? anchorFrom(this.owner, this.items, at, container) : computeAppendReference(this.owner));
7807
+ }
7808
+ _reorder(order, stable) {
7809
+ const container = findAppendableElement(this.owner);
7810
+ if (container) {
7811
+ let ref = computeAppendReference(this.owner);
7812
+ for (let i = order.length - 1; i >= 0; i--) {
7813
+ const control = order[i];
7814
+ const node = domAnchor(control, container);
7815
+ if (!node)
7816
+ continue;
7817
+ if (!stable.has(i))
7818
+ moveComponentDomRange(control, container, ref);
7819
+ ref = node;
7820
+ }
7821
+ }
7822
+ const items = this.items;
7823
+ for (let i = 0; i < order.length; i++)
7824
+ items[i] = order[i];
7579
7825
  }
7580
7826
  moveToIndex(control, index) {
7581
7827
  if (!control || control.isDisposed)
@@ -7612,12 +7858,20 @@ function computeAppendReference(owner) {
7612
7858
  }
7613
7859
  return null;
7614
7860
  }
7861
+ function anchorFrom(owner, items, start, container) {
7862
+ for (let i = start; i < items.length; i++) {
7863
+ const anchor = domAnchor(items[i], container);
7864
+ if (anchor)
7865
+ return anchor;
7866
+ }
7867
+ return computeAppendReference(owner);
7868
+ }
7615
7869
  /** Bir component'in kök DOM aralığını (tek element veya fragment aralığı) referenceNode öncesine taşır. */
7616
7870
  function moveComponentDomRange(control, container, referenceNode) {
7617
- const node = control.element;
7871
+ const node = domAnchor(control, container);
7618
7872
  if (!node)
7619
7873
  return;
7620
- if (node.nodeType !== Node.COMMENT_NODE) {
7874
+ if (node.nodeType !== Node.COMMENT_NODE || node !== control.element) {
7621
7875
  try {
7622
7876
  container.insertBefore(node, referenceNode);
7623
7877
  }
@@ -7700,9 +7954,7 @@ function detachComponentDom(control) {
7700
7954
  if (!node)
7701
7955
  return;
7702
7956
  const opts = control.motif.options;
7703
- if (node.nodeType === Node.COMMENT_NODE) {
7704
- if (!node.parentNode)
7705
- return;
7957
+ if (node.nodeType === Node.COMMENT_NODE && node.parentNode) {
7706
7958
  const close = opts?.closeFragment || null;
7707
7959
  const cache = opts.cache ?? (opts.cache = dom.createDocumentFragment());
7708
7960
  let current = node;
@@ -8175,13 +8427,12 @@ async function navigateHost(host, page, keepOldControl = false) {
8175
8427
  }
8176
8428
 
8177
8429
  class Frame extends Component {
8178
- current = null;
8179
- _latestNavigateId = 0;
8180
- _navLock = Promise.resolve();
8181
- _navAbort;
8182
- isBusy = false;
8183
8430
  constructor(props) {
8184
8431
  super(dom.createComment(''), props);
8432
+ this.current = null;
8433
+ this._latestNavigateId = 0;
8434
+ this._navLock = Promise.resolve();
8435
+ this.isBusy = false;
8185
8436
  if (props && props.childs && Array.isArray(props.childs) && props.childs.length > 0) {
8186
8437
  this.controls.add(props.childs);
8187
8438
  }
@@ -8196,7 +8447,6 @@ class Frame extends Component {
8196
8447
  async _clear() {
8197
8448
  await disposeNavigationTarget(this.current);
8198
8449
  }
8199
- previouspage;
8200
8450
  async navigate(page, keepOldControl = false) {
8201
8451
  await navigateHost(this, page, keepOldControl);
8202
8452
  }
@@ -8206,6 +8456,25 @@ class Frame extends Component {
8206
8456
  }
8207
8457
  }
8208
8458
 
8459
+ const SLOT_REGISTERED_EVENT = Symbol('slotRegistered');
8460
+ const SLOT_UNREGISTERED_EVENT = Symbol('slotUnregistered');
8461
+ class TransportRegistry {
8462
+ static { this.slots = new Map(); }
8463
+ static registerSlot(name, slot) {
8464
+ this.slots.set(name, slot);
8465
+ Application.main.fire(SLOT_REGISTERED_EVENT, { name, slot });
8466
+ }
8467
+ static unregisterSlot(name, slot) {
8468
+ if (this.slots.get(name) === slot) {
8469
+ this.slots.delete(name);
8470
+ Application.main.fire(SLOT_UNREGISTERED_EVENT, { name, slot });
8471
+ }
8472
+ }
8473
+ static getSlot(name) {
8474
+ return this.slots.get(name);
8475
+ }
8476
+ }
8477
+
8209
8478
  const ARRAY_MUTATORS = new Set(['push', 'pop', 'shift', 'unshift', 'splice', 'reverse', 'sort']);
8210
8479
  const NOT_META = Symbol('');
8211
8480
  const metaReaders = new Map([
@@ -8343,11 +8612,10 @@ const PATCHED_ARRAY_METHODS = [
8343
8612
  ];
8344
8613
  const isLookupMiss = (outcome) => outcome === false || outcome === -1;
8345
8614
  class ArrayMethods {
8346
- engine;
8347
8615
  constructor(engine) {
8348
8616
  this.engine = engine;
8617
+ this.get = this.createArrayMethods();
8349
8618
  }
8350
- get = this.createArrayMethods();
8351
8619
  createArrayMethods() {
8352
8620
  const table = {};
8353
8621
  for (const [name, kind] of PATCHED_ARRAY_METHODS) {
@@ -8539,7 +8807,6 @@ const ReactiveEngineMapper = new WeakSet();
8539
8807
  const AllreactiveMap = new WeakMap();
8540
8808
  function armgetter() { return AllreactiveMap; }
8541
8809
  class ReactiveEngine {
8542
- _gci;
8543
8810
  startGc(_intervalMs = 10000) { }
8544
8811
  stopGc() { if (this._gci) {
8545
8812
  try {
@@ -8549,31 +8816,30 @@ class ReactiveEngine {
8549
8816
  this._gci = undefined;
8550
8817
  } }
8551
8818
  constructor() {
8819
+ this.DisposeMapper = new LinkedList();
8820
+ this.arrayTriggerCache = new Map();
8821
+ this.ReactiveMap = () => armgetter();
8822
+ this.isReadonly = false;
8823
+ this.superficial = false;
8824
+ this.arrayMethods = new ArrayMethods(this);
8825
+ this.arrayHandler = {
8826
+ get: createGetter(this),
8827
+ set: createSetter(this),
8828
+ has: createHas(),
8829
+ deleteProperty: createDelete(),
8830
+ ownKeys: createOwn()
8831
+ };
8832
+ this.deepHandler = {
8833
+ get: createGetter(this),
8834
+ set: createSetter(this),
8835
+ has: createHas(),
8836
+ deleteProperty: createDelete(),
8837
+ ownKeys: createOwn()
8838
+ };
8839
+ this.collectionHandler = createCollectionHandler(this);
8552
8840
  ReactiveEngineMapper.add(this);
8553
8841
  this.startGc();
8554
8842
  }
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
8843
  reactive(model) {
8578
8844
  if (!isObject(model)) {
8579
8845
  model = { value: model };
@@ -8636,7 +8902,6 @@ class ReactiveEngine {
8636
8902
  ArrayTrigger(target, key, ...args) {
8637
8903
  this.trigger(target, key, args);
8638
8904
  }
8639
- onValueChanged;
8640
8905
  toRaw(item) {
8641
8906
  return JSON.parse(JSON.stringify(this.deepClone(item)));
8642
8907
  }
@@ -8822,7 +9087,9 @@ function isConstructor(fn) {
8822
9087
  }
8823
9088
  }
8824
9089
  class ServiceCollection {
8825
- descriptors = new Map();
9090
+ constructor() {
9091
+ this.descriptors = new Map();
9092
+ }
8826
9093
  reset() {
8827
9094
  this.descriptors.clear();
8828
9095
  }
@@ -9079,7 +9346,7 @@ function initOverlayIfEnabled() {
9079
9346
  }
9080
9347
 
9081
9348
  class RouterViewRegistry {
9082
- static outlets = new Map();
9349
+ static { this.outlets = new Map(); }
9083
9350
  static register(name, scopeId, instance) {
9084
9351
  if (!this.outlets.has(name))
9085
9352
  this.outlets.set(name, new Map());
@@ -9108,9 +9375,12 @@ const RouterViewBuilt = Symbol.for("RouterView.built");
9108
9375
  class RouterView extends Component {
9109
9376
  constructor(props) {
9110
9377
  super(props);
9378
+ this._navLock = Promise.resolve();
9379
+ this.disposingChilds = false;
9380
+ this.current = null;
9381
+ this._latestNavigateId = 0;
9382
+ this.isBusy = false;
9111
9383
  }
9112
- _navLock = Promise.resolve();
9113
- _navAbort;
9114
9384
  get __isRouterView() {
9115
9385
  return true;
9116
9386
  }
@@ -9122,11 +9392,6 @@ class RouterView extends Component {
9122
9392
  }
9123
9393
  return ids.join('>');
9124
9394
  }
9125
- disposingChilds = false;
9126
- previouspage;
9127
- current = null;
9128
- _latestNavigateId = 0;
9129
- isBusy = false;
9130
9395
  async navigate(page, keepOldControl = false) {
9131
9396
  await navigateHost(this, page, keepOldControl);
9132
9397
  }
@@ -9157,17 +9422,16 @@ const DEFAULT_LIMIT = 60;
9157
9422
  const DEFAULT_SETTLE_MS = 1200;
9158
9423
  const USER_INPUT = ['wheel', 'touchstart', 'keydown', 'mousedown'];
9159
9424
  class ScrollMemory {
9160
- options;
9161
- viewport;
9162
- positions = new Map();
9163
- currentKey = '';
9164
- visited = false;
9165
- restoring = false;
9166
- cancelFrame = null;
9167
- disarmAbort = null;
9168
- offs = [];
9169
- locationAnchor = true;
9170
9425
  constructor(options = {}, viewport) {
9426
+ this.positions = new Map();
9427
+ this.currentKey = '';
9428
+ this.currentPath = null;
9429
+ this.visited = false;
9430
+ this.restoring = false;
9431
+ this.cancelFrame = null;
9432
+ this.disarmAbort = null;
9433
+ this.offs = [];
9434
+ this.locationAnchor = true;
9171
9435
  this.options = options;
9172
9436
  this.viewport = viewport ?? (options.container ? containerViewport(options.container) : windowViewport());
9173
9437
  this.load();
@@ -9192,11 +9456,13 @@ class ScrollMemory {
9192
9456
  this.remember(this.currentKey, this.viewport.scrollTop());
9193
9457
  this.persist();
9194
9458
  }
9195
- arrived(uri) {
9459
+ arrived(uri, direction) {
9196
9460
  this.visited = true;
9197
9461
  const { path, hash } = splitUri(uri);
9462
+ const inPage = !!hash && path === this.currentPath && (direction === 'push' || direction === 'replace' || direction === 'traverse');
9463
+ this.currentPath = path;
9198
9464
  this.currentKey = this.keyOf(path);
9199
- this.restore(this.currentKey, this.options.anchor === false ? '' : hash || (this.locationAnchor ? locationHash() : ''));
9465
+ this.restore(this.currentKey, this.options.anchor === false ? '' : hash || (this.locationAnchor ? locationHash() : ''), inPage);
9200
9466
  }
9201
9467
  saved(key) {
9202
9468
  return this.positions.get(this.keyOf(splitUri(key).path)) ?? 0;
@@ -9223,7 +9489,7 @@ class ScrollMemory {
9223
9489
  this.positions.delete(oldest.value);
9224
9490
  }
9225
9491
  }
9226
- restore(key, anchor) {
9492
+ restore(key, anchor, follow) {
9227
9493
  this.cancelRestore();
9228
9494
  const target = this.positions.get(key) ?? 0;
9229
9495
  if (!anchor && target <= 0) {
@@ -9236,7 +9502,7 @@ class ScrollMemory {
9236
9502
  const startedAt = Date.now();
9237
9503
  const attempt = () => {
9238
9504
  this.cancelFrame = null;
9239
- const done = anchor ? this.viewport.scrollToAnchor(anchor) : this.reached(target);
9505
+ const done = anchor ? this.viewport.scrollToAnchor(anchor, follow) : this.reached(target);
9240
9506
  if (done || Date.now() - startedAt >= settleMs) {
9241
9507
  this.cancelRestore();
9242
9508
  this.remember(key, this.viewport.scrollTop());
@@ -9328,16 +9594,30 @@ function windowViewport() {
9328
9594
  },
9329
9595
  scrollTo: (top) => {
9330
9596
  try {
9331
- window.scrollTo(0, top);
9597
+ window.scrollTo({ top, behavior: 'instant' });
9598
+ }
9599
+ catch {
9600
+ try {
9601
+ window.scrollTo(0, top);
9602
+ }
9603
+ catch { }
9332
9604
  }
9333
- catch { }
9334
9605
  },
9335
- scrollToAnchor: (id) => {
9606
+ scrollToAnchor: (id, follow) => {
9336
9607
  try {
9337
9608
  const node = document.getElementById(id);
9338
9609
  if (!node)
9339
9610
  return false;
9340
- node.scrollIntoView();
9611
+ if (follow)
9612
+ node.scrollIntoView();
9613
+ else {
9614
+ try {
9615
+ node.scrollIntoView({ behavior: 'instant' });
9616
+ }
9617
+ catch {
9618
+ node.scrollIntoView();
9619
+ }
9620
+ }
9341
9621
  return true;
9342
9622
  }
9343
9623
  catch {
@@ -9374,11 +9654,16 @@ function containerViewport(container) {
9374
9654
  return;
9375
9655
  }
9376
9656
  try {
9377
- el.scrollTop = top;
9657
+ el.scrollTo({ top, behavior: 'instant' });
9658
+ }
9659
+ catch {
9660
+ try {
9661
+ el.scrollTop = top;
9662
+ }
9663
+ catch { }
9378
9664
  }
9379
- catch { }
9380
9665
  },
9381
- scrollToAnchor: (id) => fallback.scrollToAnchor(id),
9666
+ scrollToAnchor: (id, follow) => fallback.scrollToAnchor(id, follow),
9382
9667
  };
9383
9668
  }
9384
9669
  /** `/docs/x#bolum` → `{ path: '/docs/x', hash: 'bolum' }`. */
@@ -9549,24 +9834,18 @@ function overlay(floating, anchor, above) {
9549
9834
  }
9550
9835
  }
9551
9836
  class NavigationStack {
9552
- retainAttached;
9553
- depth;
9554
- persist;
9555
- animation;
9556
- duration;
9557
- swipe;
9558
- session = null;
9559
- entries = new Map();
9560
- uris = new Map();
9561
- loaded = null;
9562
- current = null;
9563
- currentTop = null;
9564
- offs = [];
9565
- gesture = null;
9566
- gestureCommitted = false;
9567
- awaitingGestureResult = false;
9568
- disposed = false;
9569
9837
  constructor(options) {
9838
+ this.session = null;
9839
+ this.entries = new Map();
9840
+ this.uris = new Map();
9841
+ this.loaded = null;
9842
+ this.current = null;
9843
+ this.currentTop = null;
9844
+ this.offs = [];
9845
+ this.gesture = null;
9846
+ this.gestureCommitted = false;
9847
+ this.awaitingGestureResult = false;
9848
+ this.disposed = false;
9570
9849
  const o = options === true ? {} : options;
9571
9850
  this.retainAttached = o.retain === true;
9572
9851
  this.depth = Math.max(0, Math.floor(o.depth ?? 5));
@@ -10075,13 +10354,28 @@ class NavigationStack {
10075
10354
  }
10076
10355
 
10077
10356
  class Scanner {
10078
- source;
10079
10357
  constructor(source) {
10080
10358
  this.source = source;
10359
+ this.currentColumn = 0;
10360
+ this.tokens = [];
10361
+ this.parameters = {};
10362
+ this.codePointAt = String.prototype.codePointAt ?
10363
+ (s, i) => s.codePointAt(i) : function codePointAt(str, i) {
10364
+ const size = str.length;
10365
+ if (i < 0 || i >= size) {
10366
+ return undefined;
10367
+ }
10368
+ const first = str.charCodeAt(i);
10369
+ if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) {
10370
+ const second = str.charCodeAt(i + 1);
10371
+ if (second >= 0xDC00 && second <= 0xDFFF) {
10372
+ return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
10373
+ }
10374
+ }
10375
+ return first;
10376
+ };
10081
10377
  this.tokens = [];
10082
10378
  }
10083
- currentColumn = 0;
10084
- tokens = [];
10085
10379
  addToken(token) {
10086
10380
  this.tokens.push(token);
10087
10381
  }
@@ -10309,7 +10603,6 @@ class Scanner {
10309
10603
  pattern += '$';
10310
10604
  return new RegExp(pattern, "i");
10311
10605
  }
10312
- parameters = {};
10313
10606
  exist(input, pageSearch) {
10314
10607
  const hashIdx = input.indexOf('#');
10315
10608
  const withoutHash = hashIdx >= 0 ? input.substring(0, hashIdx) : input;
@@ -10393,21 +10686,6 @@ class Scanner {
10393
10686
  }
10394
10687
  return false;
10395
10688
  }
10396
- codePointAt = String.prototype.codePointAt ?
10397
- (s, i) => s.codePointAt(i) : function codePointAt(str, i) {
10398
- const size = str.length;
10399
- if (i < 0 || i >= size) {
10400
- return undefined;
10401
- }
10402
- const first = str.charCodeAt(i);
10403
- if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) {
10404
- const second = str.charCodeAt(i + 1);
10405
- if (second >= 0xDC00 && second <= 0xDFFF) {
10406
- return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
10407
- }
10408
- }
10409
- return first;
10410
- };
10411
10689
  }
10412
10690
 
10413
10691
  /** Bir fullPath'in statik (parametresiz) ve parametreli segment sayıları. */
@@ -10435,11 +10713,41 @@ function compareRouteRecords(a, b) {
10435
10713
  return b.fullPath.length - a.fullPath.length;
10436
10714
  }
10437
10715
  class RouteCollection {
10438
- routes;
10439
- records = [];
10440
- routesMap = new Map();
10441
10716
  constructor(routes) {
10442
10717
  this.routes = routes;
10718
+ this.records = [];
10719
+ this.routesMap = new Map();
10720
+ this.walk = (chain, parentPath, node, viaAlias = false) => {
10721
+ const fullPath = this.joinPaths(parentPath, node.path);
10722
+ if (!viaAlias) {
10723
+ const existing = node.fullPath;
10724
+ if (existing == null || (typeof existing === 'string' && existing.trim() === '')) {
10725
+ node.fullPath = fullPath;
10726
+ }
10727
+ if (node.name != null) {
10728
+ this.routesMap.set(node.name, node);
10729
+ }
10730
+ }
10731
+ const nextChain = [...chain, node];
10732
+ const aliases = node.alias == null ? [] : (Array.isArray(node.alias) ? node.alias : [node.alias]);
10733
+ const variants = [
10734
+ { path: fullPath, isAlias: viaAlias },
10735
+ ...aliases.map(a => ({ path: this.joinPaths(parentPath, a), isAlias: true }))
10736
+ ];
10737
+ for (const variant of variants) {
10738
+ this.records.push({
10739
+ fullPath: variant.path,
10740
+ chain: nextChain,
10741
+ leaf: node,
10742
+ scanner: new Scanner(variant.path),
10743
+ aliasOf: variant.isAlias ? (node.fullPath ?? null) : null
10744
+ });
10745
+ if (node.childs && node.childs.length) {
10746
+ for (const child of node.childs)
10747
+ this.walk(nextChain, variant.path, child, variant.isAlias);
10748
+ }
10749
+ }
10750
+ };
10443
10751
  this.build();
10444
10752
  }
10445
10753
  build() {
@@ -10449,37 +10757,6 @@ class RouteCollection {
10449
10757
  this.walk([], "", r);
10450
10758
  this.records.sort(compareRouteRecords);
10451
10759
  }
10452
- walk = (chain, parentPath, node, viaAlias = false) => {
10453
- const fullPath = this.joinPaths(parentPath, node.path);
10454
- if (!viaAlias) {
10455
- const existing = node.fullPath;
10456
- if (existing == null || (typeof existing === 'string' && existing.trim() === '')) {
10457
- node.fullPath = fullPath;
10458
- }
10459
- if (node.name != null) {
10460
- this.routesMap.set(node.name, node);
10461
- }
10462
- }
10463
- const nextChain = [...chain, node];
10464
- const aliases = node.alias == null ? [] : (Array.isArray(node.alias) ? node.alias : [node.alias]);
10465
- const variants = [
10466
- { path: fullPath, isAlias: viaAlias },
10467
- ...aliases.map(a => ({ path: this.joinPaths(parentPath, a), isAlias: true }))
10468
- ];
10469
- for (const variant of variants) {
10470
- this.records.push({
10471
- fullPath: variant.path,
10472
- chain: nextChain,
10473
- leaf: node,
10474
- scanner: new Scanner(variant.path),
10475
- aliasOf: variant.isAlias ? (node.fullPath ?? null) : null
10476
- });
10477
- if (node.childs && node.childs.length) {
10478
- for (const child of node.childs)
10479
- this.walk(nextChain, variant.path, child, variant.isAlias);
10480
- }
10481
- }
10482
- };
10483
10760
  joinPaths(parent, child) {
10484
10761
  parent = parent || "";
10485
10762
  child = child || "";
@@ -10496,19 +10773,22 @@ class RouteCollection {
10496
10773
  }
10497
10774
 
10498
10775
  class RoutingEngine {
10499
- stack = null;
10500
- _revealed = new Set();
10501
- root;
10502
- application;
10503
- routingModule;
10504
- _previousPath = null;
10505
- _previousInstances = [];
10776
+ constructor() {
10777
+ this.stack = null;
10778
+ this._revealed = new Set();
10779
+ this._previousPath = null;
10780
+ this._previousInstances = [];
10781
+ this.controlCache = new Map();
10782
+ this._navVersion = 0;
10783
+ this._pendingActivate = new Set();
10784
+ this.pendingMount = new WeakMap();
10785
+ this.pendingListeners = new WeakMap();
10786
+ }
10506
10787
  register(mainApp, application, routingModule) {
10507
10788
  this.root = mainApp;
10508
10789
  this.application = application;
10509
10790
  this.routingModule = routingModule;
10510
10791
  }
10511
- controlCache = new Map();
10512
10792
  async evict(route) {
10513
10793
  const targets = route ? [route] : Array.from(this.controlCache.keys());
10514
10794
  for (const r of targets) {
@@ -10570,8 +10850,6 @@ class RoutingEngine {
10570
10850
  }
10571
10851
  return result;
10572
10852
  }
10573
- _navVersion = 0;
10574
- _pendingActivate = new Set();
10575
10853
  async execute(path, nav, route) {
10576
10854
  route ??= {
10577
10855
  target: path,
@@ -11042,9 +11320,7 @@ class RoutingEngine {
11042
11320
  }
11043
11321
  async activator(container) {
11044
11322
  }
11045
- pendingMount = new WeakMap();
11046
- pendingListeners = new WeakMap();
11047
- static OUTLET_WARN_MS = 3000;
11323
+ static { this.OUTLET_WARN_MS = 3000; }
11048
11324
  async mountChain(instances, chain, container, navVersion) {
11049
11325
  for (let index = 0; index < instances.length;) {
11050
11326
  if (navVersion !== this._navVersion)
@@ -11176,17 +11452,20 @@ class RoutingEngine {
11176
11452
  const pathOf = (uri) => uri.split('#')[0].split('?')[0];
11177
11453
  const newHistorySession = () => Math.random().toString(36).slice(2, 10) + Date.now().toString(36);
11178
11454
  class UrlRoutingModule {
11179
- static MAX_REDIRECTS = 10;
11180
- _routerOptions;
11181
- routingEngine;
11182
- routeCollection;
11183
- routesMap = new Map();
11184
- mainApp;
11185
- application;
11186
- _suppressBeforeEachOnce = false;
11187
- _suppressMiddlewaresOnce = false;
11188
- _scroll = null;
11455
+ static { this.MAX_REDIRECTS = 10; }
11189
11456
  constructor(options, application) {
11457
+ this.routesMap = new Map();
11458
+ this._suppressBeforeEachOnce = false;
11459
+ this._suppressMiddlewaresOnce = false;
11460
+ this._scroll = null;
11461
+ this._stack = null;
11462
+ this._windowNavListener = null;
11463
+ this._historyStamp = null;
11464
+ this._pendingTraversal = null;
11465
+ this._currentUri = '___startup___';
11466
+ this._previousRoute = null;
11467
+ this._fallbackRoutes = {};
11468
+ this._navHandler = null;
11190
11469
  this._routerOptions = options;
11191
11470
  this.routeCollection = new RouteCollection(options.RouteItems);
11192
11471
  this.routingEngine = new RoutingEngine();
@@ -11202,11 +11481,9 @@ class UrlRoutingModule {
11202
11481
  this.routingEngine.stack = this._stack;
11203
11482
  }
11204
11483
  }
11205
- _stack = null;
11206
11484
  getHooks() {
11207
11485
  return this._routerOptions.hooks;
11208
11486
  }
11209
- _windowNavListener = null;
11210
11487
  start(mainApp, shellUri) {
11211
11488
  this.mainApp = mainApp;
11212
11489
  this.routingEngine.register(this.mainApp, this.application, this);
@@ -11232,14 +11509,13 @@ class UrlRoutingModule {
11232
11509
  const h = w?.location?.hash || '';
11233
11510
  return h && h.startsWith('#') ? h.slice(1) || '/' : '/';
11234
11511
  }
11235
- return (w?.location?.pathname || '/') + (w?.location?.search || '');
11512
+ return (w?.location?.pathname || '/') + (w?.location?.search || '') + (w?.location?.hash || '');
11236
11513
  }
11237
11514
  catch {
11238
11515
  return '/';
11239
11516
  }
11240
11517
  }
11241
- static HISTORY_STAMP_KEY = '__motifHistory';
11242
- _historyStamp = null;
11518
+ static { this.HISTORY_STAMP_KEY = '__motifHistory'; }
11243
11519
  _addressMode() {
11244
11520
  const w = window;
11245
11521
  return this._routerOptions.mode || (w?.location?.protocol === 'file:' ? 'hash' : 'history');
@@ -11335,7 +11611,6 @@ class UrlRoutingModule {
11335
11611
  this._stampCurrentEntry(stamp);
11336
11612
  this._historyStamp = stamp;
11337
11613
  }
11338
- _pendingTraversal = null;
11339
11614
  async _onHistoryTraversal() {
11340
11615
  const shown = this._historyStamp;
11341
11616
  const arrived = this._readHistoryStamp();
@@ -11371,8 +11646,6 @@ class UrlRoutingModule {
11371
11646
  }
11372
11647
  catch { }
11373
11648
  }
11374
- _currentUri = '___startup___';
11375
- _previousRoute = null;
11376
11649
  get currentUri() {
11377
11650
  return this._currentUri;
11378
11651
  }
@@ -11507,7 +11780,7 @@ class UrlRoutingModule {
11507
11780
  }
11508
11781
  const snapshotOf = (result) => ({
11509
11782
  target: result,
11510
- chain: result.chain.map(r => this.routingEngine.generatePathString(r.path, result.params) || ''),
11783
+ chain: this.chainOf(result),
11511
11784
  direction,
11512
11785
  state: entryState,
11513
11786
  });
@@ -11551,7 +11824,7 @@ class UrlRoutingModule {
11551
11824
  this._handleScrollBehavior(navOptions.scroll);
11552
11825
  }
11553
11826
  else {
11554
- this._scroll?.arrived(this._uriWithHash(appliedPath, uri));
11827
+ this._scroll?.arrived(this._uriWithHash(appliedPath, uri), direction);
11555
11828
  }
11556
11829
  this.application.fire?.('motifjs-router-navigated', {
11557
11830
  uri: appliedPath,
@@ -11611,7 +11884,6 @@ class UrlRoutingModule {
11611
11884
  }
11612
11885
  await this.routingEngine.evict(item);
11613
11886
  }
11614
- _fallbackRoutes = {};
11615
11887
  _getFallbackRoute(kind) {
11616
11888
  const existing = this._fallbackRoutes[kind];
11617
11889
  if (existing)
@@ -11684,7 +11956,7 @@ class UrlRoutingModule {
11684
11956
  }
11685
11957
  return best ? { chain: best.rec.chain, params: best.params } : null;
11686
11958
  }
11687
- static _builtinNotFound = () => new Component('div', {
11959
+ static { this._builtinNotFound = () => new Component('div', {
11688
11960
  initializeComponent(sender) {
11689
11961
  sender.style({
11690
11962
  padding: '20px', fontFamily: 'Arial, sans-serif', display: 'flex', 'flex-direction': 'column', 'align-items': 'center'
@@ -11692,8 +11964,8 @@ class UrlRoutingModule {
11692
11964
  sender.element.appendChild($('h2', {}, ...['404 - Not Found']));
11693
11965
  sender.element.appendChild($('p', {}, ...['The requested page was not found.']));
11694
11966
  },
11695
- });
11696
- static _builtinError = () => new Component('div', {
11967
+ }); }
11968
+ static { this._builtinError = () => new Component('div', {
11697
11969
  initializeComponent(sender) {
11698
11970
  sender.style({
11699
11971
  padding: '20px', fontFamily: 'Arial, sans-serif', display: 'flex', 'flex-direction': 'column', 'align-items': 'center'
@@ -11701,7 +11973,7 @@ class UrlRoutingModule {
11701
11973
  sender.element.appendChild($('h2', {}, ...['Error']));
11702
11974
  sender.element.appendChild($('p', {}, ...['The requested page could not be loaded.']));
11703
11975
  },
11704
- });
11976
+ }); }
11705
11977
  async navigateByName(name, params, options) {
11706
11978
  return await this.navigate(this.href(name, params), options);
11707
11979
  }
@@ -11733,6 +12005,9 @@ class UrlRoutingModule {
11733
12005
  }
11734
12006
  return { proceed, uri: urix };
11735
12007
  }
12008
+ chainOf(result) {
12009
+ return result.chain.map(r => this.routingEngine.generatePathString(r.path, result.params) || '');
12010
+ }
11736
12011
  resolve(uri) {
11737
12012
  const candidates = [];
11738
12013
  const pageSearch = this._pageSearch();
@@ -11854,7 +12129,6 @@ class UrlRoutingModule {
11854
12129
  }
11855
12130
  return true;
11856
12131
  }
11857
- _navHandler = null;
11858
12132
  _installLinkInterceptor() {
11859
12133
  try {
11860
12134
  if (this._navHandler)
@@ -11930,8 +12204,14 @@ class UrlRoutingModule {
11930
12204
  return;
11931
12205
  }
11932
12206
  if (w?.history && typeof w.history.pushState === 'function') {
11933
- const current = (w.location.pathname || '/') + (w.location.search || '');
11934
- if (current !== uri) {
12207
+ const current = (w.location.pathname || '/') + (w.location.search || '') + (w.location.hash || '');
12208
+ let wanted = uri;
12209
+ try {
12210
+ const url = new URL(uri, w.location.href);
12211
+ wanted = url.pathname + url.search + url.hash;
12212
+ }
12213
+ catch { }
12214
+ if (current !== wanted) {
11935
12215
  if (options.replace) {
11936
12216
  const stamp = this._nextHistoryStamp(false);
11937
12217
  w.history.replaceState(this._routerState(options.state, stamp), '', uri);
@@ -12053,9 +12333,11 @@ class UrlRoutingModule {
12053
12333
  }
12054
12334
 
12055
12335
  class RouterState {
12056
- version = new Signal(0);
12057
- _current = null;
12058
- _constructing = null;
12336
+ constructor() {
12337
+ this.version = new Signal(0);
12338
+ this._current = null;
12339
+ this._constructing = null;
12340
+ }
12059
12341
  read() {
12060
12342
  this.version.value;
12061
12343
  return this._constructing ?? this._current;
@@ -12116,15 +12398,19 @@ function createRouter(state, module) {
12116
12398
  return module()?.routeInfos() ?? [];
12117
12399
  },
12118
12400
  navigate: async (uri, options) => {
12119
- await required().navigate(uri, options);
12401
+ return await required().navigate(uri, options);
12120
12402
  },
12121
12403
  navigateByName: async (name, params, options) => {
12122
- await required().navigateByName(name, params, options);
12404
+ return await required().navigateByName(name, params, options);
12123
12405
  },
12124
12406
  evict: async (route) => {
12125
12407
  await required().evict(route);
12126
12408
  },
12127
- resolve: (uri) => required().resolve(uri),
12409
+ resolve: (uri) => {
12410
+ const current = required();
12411
+ const result = current.resolve(uri);
12412
+ return { chain: current.chainOf(result), result };
12413
+ },
12128
12414
  href: (name, params) => required().href(name, params),
12129
12415
  };
12130
12416
  }
@@ -12132,8 +12418,8 @@ function createRouter(state, module) {
12132
12418
  let _globalApplication = null;
12133
12419
  let startedApplicationBuilder = false;
12134
12420
  class ApplicationBuilder {
12135
- services = new ServiceCollection();
12136
12421
  constructor() {
12422
+ this.services = new ServiceCollection();
12137
12423
  if ((_globalApplication && _globalApplication.state !== 'disposing') || startedApplicationBuilder) {
12138
12424
  throw new MotifError('MJX405', formatMotifMessage('MJX405'), { cause: _globalApplication });
12139
12425
  }
@@ -12160,28 +12446,31 @@ class ApplicationBuilder {
12160
12446
  }
12161
12447
  }
12162
12448
  class Application {
12163
- provider;
12164
12449
  static get main() {
12165
12450
  return _globalApplication;
12166
12451
  }
12167
12452
  constructor(provider) {
12168
12453
  this.provider = provider;
12454
+ this._state = 'initializing';
12455
+ this._middlewares = [];
12456
+ this._beforeEachGuards = [];
12457
+ this._routerState = new RouterState();
12458
+ this.router = createRouter(this._routerState, () => this.urlRoutingModule);
12459
+ this.events = new Map();
12460
+ this._routerConfig = null;
12461
+ this._routerRoot = null;
12462
+ this._startedRouter = null;
12463
+ this._lifecycleOff = null;
12464
+ this._isDevelopment = false;
12465
+ this._enableErrorLogging = true;
12169
12466
  }
12170
- static _disposingCount = 0;
12171
- _state = 'initializing';
12172
- _disposing;
12467
+ static { this._disposingCount = 0; }
12173
12468
  get state() {
12174
12469
  return this._state;
12175
12470
  }
12176
- _middlewares = [];
12177
- _beforeEachGuards = [];
12178
- _routerState = new RouterState();
12179
- router = createRouter(this._routerState, () => this.urlRoutingModule);
12180
- events = new Map();
12181
12471
  static CreateBuilder() {
12182
12472
  return new ApplicationBuilder();
12183
12473
  }
12184
- appShell;
12185
12474
  getAppShell() {
12186
12475
  return this.appShell;
12187
12476
  }
@@ -12325,10 +12614,6 @@ class Application {
12325
12614
  }
12326
12615
  return true;
12327
12616
  }
12328
- urlRoutingModule;
12329
- _routerConfig = null;
12330
- _routerRoot = null;
12331
- _startedRouter = null;
12332
12617
  useRouter(options) {
12333
12618
  let routes;
12334
12619
  let mode;
@@ -12448,7 +12733,6 @@ class Application {
12448
12733
  return true;
12449
12734
  }
12450
12735
  }
12451
- _lifecycleOff = null;
12452
12736
  onLifecycle(handler) {
12453
12737
  this._installLifecycleListeners();
12454
12738
  return this.on('motifjs-app-lifecycle', handler);
@@ -12490,8 +12774,6 @@ class Application {
12490
12774
  for (const off of offs)
12491
12775
  off();
12492
12776
  }
12493
- _isDevelopment = false;
12494
- _enableErrorLogging = true;
12495
12777
  get isDevelopmentModeEnabled() {
12496
12778
  return this._isDevelopment;
12497
12779
  }
@@ -12529,5 +12811,5 @@ function useApplication() {
12529
12811
  };
12530
12812
  }
12531
12813
 
12532
- export { useApplication as $, Application as A, ErrorHandler as B, Component as C, Disposable as D, Emitter as E, FNComponent as F, FragmentNode as G, Frame as H, inject as I, LazyComputed as J, LinkedList as K, Lazy as L, MotifError as M, motifCompiled as N, motifComponent as O, motifFragment as P, NodeTypes as Q, reactive as R, RouterView as S, safeCall as T, safeCallAsync as U, safeCallSilent as V, ServiceCollection as W, ServiceProvider as X, setUnexpectedErrorHandler as Y, Signal as Z, toDisposable as _, reportError as a, useModel as a0, useNavigation as a1, debugGetDeps as a2, debugGetDepMap as a3, UrlRoutingModule as a4, RoutingEngine as a5, RouterState as a6, createRouter as a7, Scanner as a8, RouteCollection as a9, ComponentBase as b, contentBlocks as c, autoRegistry as d, effect as e, findAppendableComponent$1 as f, formatMotifMessage as g, ApplicationBuilder as h, asyncTracking as i, clearModel as j, ComponentMotif as k, Computed as l, motifError as m, notifyDeactivated as n, configureReactivityLeakMonitor as o, ControlCollection as p, createComputed as q, reportWarning as r, createLazyComputed as s, createSignal as t, untracked as u, deepClone as v, disposableCore as w, DisposableStore as x, dom as y, errorHandler as z };
12533
- //# sourceMappingURL=core-vVL0WG0n.esm.js.map
12814
+ 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 };
12815
+ //# sourceMappingURL=core-W7wNt8bq.esm.js.map