@motifx/core 1.1.0 → 1.2.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{core-BI6Lk585.cjs → core-SS-LXi1V.cjs} +364 -47
- package/dist/chunks/core-SS-LXi1V.cjs.map +1 -0
- package/dist/chunks/{core-BGdhUeHu.esm.js → core-vVL0WG0n.esm.js} +364 -47
- package/dist/chunks/core-vVL0WG0n.esm.js.map +1 -0
- package/dist/devtools.cjs +1 -1
- package/dist/devtools.esm.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -8
- package/dist/index.d.ts +19 -8
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.umd.js +363 -46
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/jsx-runtime.cjs.map +1 -1
- package/dist/jsx-runtime.d.cts +17 -3
- package/dist/jsx-runtime.d.ts +17 -3
- package/dist/jsx-runtime.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/core-BGdhUeHu.esm.js.map +0 -1
- package/dist/chunks/core-BI6Lk585.cjs.map +0 -1
|
@@ -280,9 +280,17 @@ const motifMessages = {
|
|
|
280
280
|
MJX121: (compiled, runtime) => `This code was compiled for compiler contract ${compiled}, but the @motifx/core runtime implements contract ${runtime}. Install matching versions of @motifx/compiler and @motifx/core, and rebuild packages that ship compiled JSX.`,
|
|
281
281
|
MJX122: (hook) => `The component ${hook} hook threw.`,
|
|
282
282
|
MJX123: (event) => `The '${event}' event handler threw.`,
|
|
283
|
-
MJX124: () => `A spread object on a DOM tag cannot set
|
|
283
|
+
MJX124: (key) => `A spread object on a DOM tag cannot set ${key}; the key was ignored. Write it on the tag, or use x-html, for HTML you trust.`,
|
|
284
284
|
MJX125: (key) => `A spread object on a DOM tag cannot set a javascript: URL on '${key}'; the value was ignored. Write the attribute on the tag if it is intended.`,
|
|
285
285
|
MJX126: () => `Lazy: loading the component failed and no Fallbackview is set; the host was cleared.`,
|
|
286
|
+
MJX127: (got) => got === 'module'
|
|
287
|
+
? `The loaded module has no default export. Export the component as default, or map it: () => import('./X').then(m => m.X).`
|
|
288
|
+
: `The loaded value is not a component (got ${got}). Return a component class, a function component, an Options API factory or a component instance.`,
|
|
289
|
+
MJX128: (cls, member, how) => how === 'method'
|
|
290
|
+
? `${cls} overrides ${member} without calling super.${member}; MotifJS relies on this ComponentBase member. Rename your member, or call super.${member} in the override.`
|
|
291
|
+
: how === 'field'
|
|
292
|
+
? `${cls} defines '${member}' as an instance field, which hides the ComponentBase member MotifJS relies on. Rename your field.`
|
|
293
|
+
: `${cls} replaces '${member}', which MotifJS created for the component (a class field or an assignment with that name). Rename your member.`,
|
|
286
294
|
MJX201: () => `ListBinding: renderFn must return a component instance, a component class, or a factory function.`,
|
|
287
295
|
MJX202: (key, index) => `ListBinding: duplicate key "${String(key)}" at index ${index}. Rows are matched by the item object, not by key, so rendering is not affected; keep keys unique so they identify items.`,
|
|
288
296
|
MJX203: (max) => `An effect ran ${max} times in one flush and keeps triggering itself; it is skipped for the rest of this flush. It probably writes a value it reads (for example state.n++). Wrap the write in untracked(...).`,
|
|
@@ -1649,6 +1657,9 @@ function lazyBindMethods(proto, names) {
|
|
|
1649
1657
|
}
|
|
1650
1658
|
}
|
|
1651
1659
|
|
|
1660
|
+
function resolveValue(value) {
|
|
1661
|
+
return typeof value === 'function' ? resolveValue(value()) : value;
|
|
1662
|
+
}
|
|
1652
1663
|
function isWritablePathKey(target, key) {
|
|
1653
1664
|
if (key === '__proto__')
|
|
1654
1665
|
return false;
|
|
@@ -1732,7 +1743,7 @@ class BindingCollection {
|
|
|
1732
1743
|
return binding;
|
|
1733
1744
|
}
|
|
1734
1745
|
display(predicate) {
|
|
1735
|
-
const binding = new Binding(this._component, 'isWait', () => !predicate());
|
|
1746
|
+
const binding = new Binding(this._component, 'isWait', () => !resolveValue(predicate()));
|
|
1736
1747
|
this._items.push(binding);
|
|
1737
1748
|
if (this._component.isBuilt) {
|
|
1738
1749
|
binding.activate();
|
|
@@ -4450,6 +4461,61 @@ function hasLifecycleHook(component, hook, listName, lowerName, legacyProp) {
|
|
|
4450
4461
|
return true;
|
|
4451
4462
|
return component._base.emiters.hasListeners(lowerName);
|
|
4452
4463
|
}
|
|
4464
|
+
const RESERVED_METHODS = ['build', 'setState', 'reState', 'setText', 'style', 'dispose', 'disposeAsync', 'using', 'doWork', 'getService', '$', 'useModel', 'context', 'siblings', 'serviceProvider', 'isWait'];
|
|
4465
|
+
const checkedComponentClasses = new WeakSet();
|
|
4466
|
+
function callsSuper(fn, name) {
|
|
4467
|
+
if (typeof fn !== 'function')
|
|
4468
|
+
return false;
|
|
4469
|
+
const escaped = name.replace(/\$/g, '\\$');
|
|
4470
|
+
return new RegExp(`\\bsuper\\s*(\\.\\s*${escaped}(?![\\w$])|\\[)`).test(Function.prototype.toString.call(fn));
|
|
4471
|
+
}
|
|
4472
|
+
function reservedMemberProblems(c) {
|
|
4473
|
+
const problems = [];
|
|
4474
|
+
const own = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
|
4475
|
+
for (const name of RESERVED_METHODS) {
|
|
4476
|
+
if (own(c, name)) {
|
|
4477
|
+
problems.push([name, 'field']);
|
|
4478
|
+
continue;
|
|
4479
|
+
}
|
|
4480
|
+
for (let p = Object.getPrototypeOf(c); p && p !== ComponentBase.prototype; p = Object.getPrototypeOf(p)) {
|
|
4481
|
+
const d = Object.getOwnPropertyDescriptor(p, name);
|
|
4482
|
+
if (!d)
|
|
4483
|
+
continue;
|
|
4484
|
+
const fns = 'value' in d ? [d.value] : [d.get, d.set].filter(Boolean);
|
|
4485
|
+
if (!fns.some(fn => callsSuper(fn, name)))
|
|
4486
|
+
problems.push([name, 'method']);
|
|
4487
|
+
break;
|
|
4488
|
+
}
|
|
4489
|
+
}
|
|
4490
|
+
const anyC = c;
|
|
4491
|
+
if (!(anyC.motif instanceof ComponentMotif))
|
|
4492
|
+
problems.push(['motif', 'replaced']);
|
|
4493
|
+
if (!(anyC.controls instanceof ControlCollection))
|
|
4494
|
+
problems.push(['controls', 'replaced']);
|
|
4495
|
+
if (!(anyC.class instanceof controlClass))
|
|
4496
|
+
problems.push(['class', 'replaced']);
|
|
4497
|
+
if (!(anyC.attr instanceof controlAttribute))
|
|
4498
|
+
problems.push(['attr', 'replaced']);
|
|
4499
|
+
if (!(anyC.bindings instanceof BindingCollection))
|
|
4500
|
+
problems.push(['bindings', 'replaced']);
|
|
4501
|
+
if (anyC.element != null && typeof Node !== 'undefined' && !(anyC.element instanceof Node))
|
|
4502
|
+
problems.push(['element', 'replaced']);
|
|
4503
|
+
if (anyC.parent != null && !(anyC.parent instanceof ComponentBase))
|
|
4504
|
+
problems.push(['parent', 'replaced']);
|
|
4505
|
+
return problems;
|
|
4506
|
+
}
|
|
4507
|
+
function checkReservedMembers(c) {
|
|
4508
|
+
if (!isDevLike())
|
|
4509
|
+
return;
|
|
4510
|
+
const ctor = c?.constructor;
|
|
4511
|
+
if (typeof ctor !== 'function' || checkedComponentClasses.has(ctor))
|
|
4512
|
+
return;
|
|
4513
|
+
checkedComponentClasses.add(ctor);
|
|
4514
|
+
const name = ctor.name || 'An anonymous component class';
|
|
4515
|
+
for (const [member, how] of reservedMemberProblems(c)) {
|
|
4516
|
+
reportWarning('MJX128', [name, member, how]);
|
|
4517
|
+
}
|
|
4518
|
+
}
|
|
4453
4519
|
const ComponentHelper = {
|
|
4454
4520
|
callInitializeComponent(component) {
|
|
4455
4521
|
const sender = component;
|
|
@@ -5020,7 +5086,7 @@ function removeComponentDom(c, node, alsoPlaceholder) {
|
|
|
5020
5086
|
}
|
|
5021
5087
|
function detachDomWithAnimation(c) {
|
|
5022
5088
|
const node = c.element;
|
|
5023
|
-
if (!node)
|
|
5089
|
+
if (!node || c._keepElementOnDispose === true)
|
|
5024
5090
|
return;
|
|
5025
5091
|
const opts = c.motif.options;
|
|
5026
5092
|
const t = opts?.[TRANSITION_SLOT];
|
|
@@ -5050,7 +5116,7 @@ function detachDomWithAnimation(c) {
|
|
|
5050
5116
|
}
|
|
5051
5117
|
async function detachDomWithAnimationAsync(c) {
|
|
5052
5118
|
const node = c.element;
|
|
5053
|
-
if (!node)
|
|
5119
|
+
if (!node || c._keepElementOnDispose === true)
|
|
5054
5120
|
return;
|
|
5055
5121
|
const opts = c.motif.options;
|
|
5056
5122
|
const t = opts?.[TRANSITION_SLOT];
|
|
@@ -5213,8 +5279,24 @@ function subtreeDisposesSync(c, root) {
|
|
|
5213
5279
|
}
|
|
5214
5280
|
return true;
|
|
5215
5281
|
}
|
|
5282
|
+
const teardownApplications = new WeakMap();
|
|
5283
|
+
function owningApplication(c) {
|
|
5284
|
+
for (let p = c; p; p = p.parent) {
|
|
5285
|
+
if (p.application)
|
|
5286
|
+
return p.application;
|
|
5287
|
+
const recorded = teardownApplications.get(p);
|
|
5288
|
+
if (recorded)
|
|
5289
|
+
return recorded;
|
|
5290
|
+
}
|
|
5291
|
+
return Application.main ?? null;
|
|
5292
|
+
}
|
|
5216
5293
|
function disposePrefix(c, options, asChild) {
|
|
5217
5294
|
const ctx = asChild ? 'disposeAsync' : 'dispose';
|
|
5295
|
+
if (Application._disposingCount > 0) {
|
|
5296
|
+
const app = owningApplication(c);
|
|
5297
|
+
if (app && app.state === 'disposing')
|
|
5298
|
+
teardownApplications.set(c, app);
|
|
5299
|
+
}
|
|
5218
5300
|
if (!asChild && options?.skipLeaveTransition) {
|
|
5219
5301
|
c.motif.options.transition.skipNextLeave = true;
|
|
5220
5302
|
}
|
|
@@ -5598,7 +5680,7 @@ class ComponentBase extends Disposable {
|
|
|
5598
5680
|
_scopedContext;
|
|
5599
5681
|
get context() {
|
|
5600
5682
|
const parentCtx = this.parent?.context;
|
|
5601
|
-
const app = parentCtx?.[RAW_APPLICATION] ?? parentCtx ?? Application.main;
|
|
5683
|
+
const app = parentCtx?.[RAW_APPLICATION] ?? parentCtx ?? teardownApplications.get(this) ?? Application.main;
|
|
5602
5684
|
if (!app) {
|
|
5603
5685
|
return app;
|
|
5604
5686
|
}
|
|
@@ -5620,6 +5702,7 @@ class ComponentBase extends Disposable {
|
|
|
5620
5702
|
return () => { this._disposables.detach(d); off(); };
|
|
5621
5703
|
}
|
|
5622
5704
|
build(building = true) {
|
|
5705
|
+
checkReservedMembers(this);
|
|
5623
5706
|
ComponentHelper.callConfigured(this);
|
|
5624
5707
|
this._base._activatePreBindings();
|
|
5625
5708
|
if (this.isDisposed || !this.element || this.isWait) {
|
|
@@ -6094,7 +6177,7 @@ class ComponentBase extends Disposable {
|
|
|
6094
6177
|
if (mods.includes("stop")) {
|
|
6095
6178
|
stop();
|
|
6096
6179
|
}
|
|
6097
|
-
if (res
|
|
6180
|
+
if (res && res.cancel === true) {
|
|
6098
6181
|
prevent();
|
|
6099
6182
|
stop();
|
|
6100
6183
|
}
|
|
@@ -6301,6 +6384,9 @@ class ComponentBase extends Disposable {
|
|
|
6301
6384
|
const p = c.provider;
|
|
6302
6385
|
if (p)
|
|
6303
6386
|
return p;
|
|
6387
|
+
const recorded = teardownApplications.get(c);
|
|
6388
|
+
if (recorded)
|
|
6389
|
+
return recorded.state === 'disposed' ? null : recorded.provider;
|
|
6304
6390
|
c = c.parent;
|
|
6305
6391
|
}
|
|
6306
6392
|
try {
|
|
@@ -6645,6 +6731,7 @@ const PLAIN_ELEMENT_SKIP = new Set([
|
|
|
6645
6731
|
'ref', 'key', 'indexkey', 'inject', 'options', 'props', 'settings', 'isSvg',
|
|
6646
6732
|
'childs', 'initializeComponent', 'runover', 'transition', 'preconfig', 'nodes', 'onElementCreating'
|
|
6647
6733
|
]);
|
|
6734
|
+
const SPREAD_HTML_KEYS = new Set(['innerhtml', 'srcdoc']);
|
|
6648
6735
|
const SPREAD_URL_ATTRIBUTES = new Set(['href', 'src', 'action', 'formaction', 'xlink:href']);
|
|
6649
6736
|
const JAVASCRIPT_URL = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;
|
|
6650
6737
|
function isJavascriptUrl(value) {
|
|
@@ -6693,11 +6780,12 @@ function applyPlainElementProps(props, component) {
|
|
|
6693
6780
|
}
|
|
6694
6781
|
if (typeof v === 'function' && v.length > 0)
|
|
6695
6782
|
continue;
|
|
6696
|
-
|
|
6697
|
-
|
|
6783
|
+
const lowerKey = key.toLowerCase();
|
|
6784
|
+
if (SPREAD_HTML_KEYS.has(lowerKey)) {
|
|
6785
|
+
reportWarning('MJX124', [key]);
|
|
6698
6786
|
continue;
|
|
6699
6787
|
}
|
|
6700
|
-
if (SPREAD_URL_ATTRIBUTES.has(
|
|
6788
|
+
if (SPREAD_URL_ATTRIBUTES.has(lowerKey)) {
|
|
6701
6789
|
if (typeof v === 'function') {
|
|
6702
6790
|
v = guardSpreadUrl(key, v);
|
|
6703
6791
|
}
|
|
@@ -6886,6 +6974,9 @@ class Component extends ComponentBase {
|
|
|
6886
6974
|
}
|
|
6887
6975
|
if (elementOrParams instanceof Function) {
|
|
6888
6976
|
elementOrParams = resolveComponent(elementOrParams, options);
|
|
6977
|
+
if (isOptionsObject(elementOrParams)) {
|
|
6978
|
+
return materializeOptionsObject(elementOrParams, options);
|
|
6979
|
+
}
|
|
6889
6980
|
}
|
|
6890
6981
|
if (Array.isArray(elementOrParams)) {
|
|
6891
6982
|
const letter = CreateFragment();
|
|
@@ -7075,6 +7166,40 @@ function motifComponent(element, props) {
|
|
|
7075
7166
|
}
|
|
7076
7167
|
return new Component(element, props);
|
|
7077
7168
|
}
|
|
7169
|
+
function isOptionsObject(value) {
|
|
7170
|
+
return typeof value == "object" && value !== null && !(value instanceof ComponentBase) && 'el' in value;
|
|
7171
|
+
}
|
|
7172
|
+
function unwrapModule(result) {
|
|
7173
|
+
if (result && typeof result === "object" && !(result instanceof ComponentBase) && result.default != null) {
|
|
7174
|
+
return result.default;
|
|
7175
|
+
}
|
|
7176
|
+
return result;
|
|
7177
|
+
}
|
|
7178
|
+
function describeLoaded(value) {
|
|
7179
|
+
if (value === null)
|
|
7180
|
+
return 'null';
|
|
7181
|
+
if (Array.isArray(value))
|
|
7182
|
+
return 'array';
|
|
7183
|
+
if (typeof value === "object" && (Object.prototype.toString.call(value) === '[object Module]' || value.__esModule))
|
|
7184
|
+
return 'module';
|
|
7185
|
+
return typeof value;
|
|
7186
|
+
}
|
|
7187
|
+
function assertLoadedComponent(value) {
|
|
7188
|
+
if (value === null || typeof value !== "object")
|
|
7189
|
+
return;
|
|
7190
|
+
if (value instanceof ComponentBase || Array.isArray(value) || value instanceof Node)
|
|
7191
|
+
return;
|
|
7192
|
+
if (typeof value.then === "function")
|
|
7193
|
+
return;
|
|
7194
|
+
throw motifError('MJX127', describeLoaded(value));
|
|
7195
|
+
}
|
|
7196
|
+
function resolveToComponent(input, props) {
|
|
7197
|
+
const resolved = resolveComponent(input, props);
|
|
7198
|
+
if (isOptionsObject(resolved)) {
|
|
7199
|
+
return materializeOptionsObject(resolved, undefined);
|
|
7200
|
+
}
|
|
7201
|
+
return resolved;
|
|
7202
|
+
}
|
|
7078
7203
|
function materializeOptionsObject(spec, props) {
|
|
7079
7204
|
const result = motifComponent(spec.el, props);
|
|
7080
7205
|
Object.getOwnPropertyNames(spec).forEach(key => {
|
|
@@ -7309,6 +7434,7 @@ class ControlCollection {
|
|
|
7309
7434
|
if (typeof control == 'string' || typeof control == 'number' || typeof control == 'boolean' || typeof control == 'bigint') {
|
|
7310
7435
|
control = new Component(dom.createTextNode(control), null);
|
|
7311
7436
|
}
|
|
7437
|
+
checkReservedMembers(control);
|
|
7312
7438
|
if (control.parent) {
|
|
7313
7439
|
control.parent.controls.detach(control);
|
|
7314
7440
|
}
|
|
@@ -7680,10 +7806,7 @@ function normalizeRetry(retry) {
|
|
|
7680
7806
|
return { count: 0, delayMs: 0, whenOnline: false };
|
|
7681
7807
|
}
|
|
7682
7808
|
function defaultMapper(result) {
|
|
7683
|
-
|
|
7684
|
-
return result.default;
|
|
7685
|
-
}
|
|
7686
|
-
return result;
|
|
7809
|
+
return unwrapModule(result);
|
|
7687
7810
|
}
|
|
7688
7811
|
function Lazy(props) {
|
|
7689
7812
|
const opts = (props && props.options) || {};
|
|
@@ -7712,7 +7835,7 @@ function Lazy(props) {
|
|
|
7712
7835
|
catch { }
|
|
7713
7836
|
const initial = opts.Placeholderview ?? opts.Loaderview;
|
|
7714
7837
|
if (initial != null) {
|
|
7715
|
-
frame.navigate(
|
|
7838
|
+
frame.navigate(resolveToComponent(initial));
|
|
7716
7839
|
}
|
|
7717
7840
|
const attemptLoad = () => {
|
|
7718
7841
|
if (!opts.timeoutMs && !opts.signal) {
|
|
@@ -7838,6 +7961,36 @@ function Lazy(props) {
|
|
|
7838
7961
|
};
|
|
7839
7962
|
const loadPromise = retry.count > 0 ? loadWithRetry() : attemptLoad();
|
|
7840
7963
|
const startTs = Date.now();
|
|
7964
|
+
const fail = (err) => {
|
|
7965
|
+
try {
|
|
7966
|
+
opts.onError?.(err);
|
|
7967
|
+
}
|
|
7968
|
+
catch { /* swallow */ }
|
|
7969
|
+
if (opts.signal?.aborted)
|
|
7970
|
+
return;
|
|
7971
|
+
if (opts.Fallbackview != null) {
|
|
7972
|
+
frame.navigate(resolveToComponent(opts.Fallbackview));
|
|
7973
|
+
}
|
|
7974
|
+
else {
|
|
7975
|
+
reportError('MJX126', err);
|
|
7976
|
+
try {
|
|
7977
|
+
frame.motif.clear().catch(() => { });
|
|
7978
|
+
}
|
|
7979
|
+
catch { }
|
|
7980
|
+
}
|
|
7981
|
+
};
|
|
7982
|
+
const place = (target) => {
|
|
7983
|
+
let component;
|
|
7984
|
+
try {
|
|
7985
|
+
component = resolveToComponent(target);
|
|
7986
|
+
assertLoadedComponent(component);
|
|
7987
|
+
}
|
|
7988
|
+
catch (err) {
|
|
7989
|
+
fail(err);
|
|
7990
|
+
return;
|
|
7991
|
+
}
|
|
7992
|
+
frame.navigate(component);
|
|
7993
|
+
};
|
|
7841
7994
|
loadPromise
|
|
7842
7995
|
.then((result) => {
|
|
7843
7996
|
if (opts.signal?.aborted) {
|
|
@@ -7851,7 +8004,7 @@ function Lazy(props) {
|
|
|
7851
8004
|
if (remaining > 0) {
|
|
7852
8005
|
const id = trackTimer(setTimeout(() => {
|
|
7853
8006
|
if (!opts.signal?.aborted) {
|
|
7854
|
-
|
|
8007
|
+
place(target);
|
|
7855
8008
|
}
|
|
7856
8009
|
}, remaining));
|
|
7857
8010
|
if (opts.signal) {
|
|
@@ -7867,27 +8020,10 @@ function Lazy(props) {
|
|
|
7867
8020
|
}
|
|
7868
8021
|
}
|
|
7869
8022
|
else {
|
|
7870
|
-
|
|
8023
|
+
place(target);
|
|
7871
8024
|
}
|
|
7872
8025
|
})
|
|
7873
|
-
.catch(
|
|
7874
|
-
try {
|
|
7875
|
-
opts.onError?.(err);
|
|
7876
|
-
}
|
|
7877
|
-
catch { /* swallow */ }
|
|
7878
|
-
if (opts.signal?.aborted)
|
|
7879
|
-
return;
|
|
7880
|
-
if (opts.Fallbackview != null) {
|
|
7881
|
-
frame.navigate(resolveComponent(opts.Fallbackview));
|
|
7882
|
-
}
|
|
7883
|
-
else {
|
|
7884
|
-
reportError('MJX126', err);
|
|
7885
|
-
try {
|
|
7886
|
-
frame.motif.clear().catch(() => { });
|
|
7887
|
-
}
|
|
7888
|
-
catch { }
|
|
7889
|
-
}
|
|
7890
|
-
});
|
|
8026
|
+
.catch(fail);
|
|
7891
8027
|
return frame;
|
|
7892
8028
|
}
|
|
7893
8029
|
|
|
@@ -8261,6 +8397,144 @@ class ArrayMethods {
|
|
|
8261
8397
|
}
|
|
8262
8398
|
}
|
|
8263
8399
|
|
|
8400
|
+
const KEYS_KEY = Symbol('');
|
|
8401
|
+
function changed(target, key, keysChanged) {
|
|
8402
|
+
trigger(target, key);
|
|
8403
|
+
trigger(target, ITERATE_KEY);
|
|
8404
|
+
if (keysChanged)
|
|
8405
|
+
trigger(target, KEYS_KEY);
|
|
8406
|
+
}
|
|
8407
|
+
function lookupKey(target, key) {
|
|
8408
|
+
return target.has(key) ? key : getRaw(key);
|
|
8409
|
+
}
|
|
8410
|
+
function wrapIterator(source, convert) {
|
|
8411
|
+
return {
|
|
8412
|
+
next() {
|
|
8413
|
+
const step = source.next();
|
|
8414
|
+
return step.done ? step : { value: convert(step.value), done: false };
|
|
8415
|
+
},
|
|
8416
|
+
[Symbol.iterator]() {
|
|
8417
|
+
return this;
|
|
8418
|
+
},
|
|
8419
|
+
};
|
|
8420
|
+
}
|
|
8421
|
+
function createCollectionMethods(engine) {
|
|
8422
|
+
const wrap = (value) => isObject(value) ? engine.reactive(value) : value;
|
|
8423
|
+
const wrapEntry = (target) => target instanceof Map
|
|
8424
|
+
? ([key, value]) => [key, wrap(value)]
|
|
8425
|
+
: ([value]) => { const item = wrap(value); return [item, item]; };
|
|
8426
|
+
return {
|
|
8427
|
+
get(key) {
|
|
8428
|
+
const target = getRaw(this);
|
|
8429
|
+
const found = lookupKey(target, key);
|
|
8430
|
+
track(target, found);
|
|
8431
|
+
return wrap(target.get(found));
|
|
8432
|
+
},
|
|
8433
|
+
has(key) {
|
|
8434
|
+
const target = getRaw(this);
|
|
8435
|
+
const found = lookupKey(target, key);
|
|
8436
|
+
track(target, found);
|
|
8437
|
+
return target.has(found);
|
|
8438
|
+
},
|
|
8439
|
+
set(key, value) {
|
|
8440
|
+
const target = getRaw(this);
|
|
8441
|
+
const stored = lookupKey(target, key);
|
|
8442
|
+
const raw = getRaw(value);
|
|
8443
|
+
const existed = target.has(stored);
|
|
8444
|
+
const previous = target.get(stored);
|
|
8445
|
+
target.set(stored, raw);
|
|
8446
|
+
if (!existed)
|
|
8447
|
+
changed(target, stored, true);
|
|
8448
|
+
else if (!Object.is(previous, raw))
|
|
8449
|
+
changed(target, stored, false);
|
|
8450
|
+
return this;
|
|
8451
|
+
},
|
|
8452
|
+
add(value) {
|
|
8453
|
+
const target = getRaw(this);
|
|
8454
|
+
const stored = lookupKey(target, value);
|
|
8455
|
+
if (!target.has(stored)) {
|
|
8456
|
+
target.add(stored);
|
|
8457
|
+
changed(target, stored, true);
|
|
8458
|
+
}
|
|
8459
|
+
return this;
|
|
8460
|
+
},
|
|
8461
|
+
delete(key) {
|
|
8462
|
+
const target = getRaw(this);
|
|
8463
|
+
const found = lookupKey(target, key);
|
|
8464
|
+
const removed = target.delete(found);
|
|
8465
|
+
if (removed)
|
|
8466
|
+
changed(target, found, true);
|
|
8467
|
+
return removed;
|
|
8468
|
+
},
|
|
8469
|
+
clear() {
|
|
8470
|
+
const target = getRaw(this);
|
|
8471
|
+
if (target.size === 0)
|
|
8472
|
+
return;
|
|
8473
|
+
const keys = Array.from(target.keys());
|
|
8474
|
+
target.clear();
|
|
8475
|
+
for (const key of keys)
|
|
8476
|
+
trigger(target, key);
|
|
8477
|
+
trigger(target, ITERATE_KEY);
|
|
8478
|
+
trigger(target, KEYS_KEY);
|
|
8479
|
+
},
|
|
8480
|
+
forEach(callback, thisArg) {
|
|
8481
|
+
const target = getRaw(this);
|
|
8482
|
+
track(target, ITERATE_KEY);
|
|
8483
|
+
const owner = this;
|
|
8484
|
+
const isMap = target instanceof Map;
|
|
8485
|
+
target.forEach((value, key) => {
|
|
8486
|
+
const item = wrap(value);
|
|
8487
|
+
callback.call(thisArg, item, isMap ? key : item, owner);
|
|
8488
|
+
});
|
|
8489
|
+
},
|
|
8490
|
+
keys() {
|
|
8491
|
+
const target = getRaw(this);
|
|
8492
|
+
if (target instanceof Map) {
|
|
8493
|
+
track(target, KEYS_KEY);
|
|
8494
|
+
return target.keys();
|
|
8495
|
+
}
|
|
8496
|
+
track(target, ITERATE_KEY);
|
|
8497
|
+
return wrapIterator(target.keys(), wrap);
|
|
8498
|
+
},
|
|
8499
|
+
values() {
|
|
8500
|
+
const target = getRaw(this);
|
|
8501
|
+
track(target, ITERATE_KEY);
|
|
8502
|
+
return wrapIterator(target.values(), wrap);
|
|
8503
|
+
},
|
|
8504
|
+
entries() {
|
|
8505
|
+
const target = getRaw(this);
|
|
8506
|
+
track(target, ITERATE_KEY);
|
|
8507
|
+
return wrapIterator(target.entries(), wrapEntry(target));
|
|
8508
|
+
},
|
|
8509
|
+
[Symbol.iterator]() {
|
|
8510
|
+
const target = getRaw(this);
|
|
8511
|
+
track(target, ITERATE_KEY);
|
|
8512
|
+
return target instanceof Map
|
|
8513
|
+
? wrapIterator(target.entries(), wrapEntry(target))
|
|
8514
|
+
: wrapIterator(target.values(), wrap);
|
|
8515
|
+
},
|
|
8516
|
+
};
|
|
8517
|
+
}
|
|
8518
|
+
function createCollectionHandler(engine) {
|
|
8519
|
+
const methods = createCollectionMethods(engine);
|
|
8520
|
+
return {
|
|
8521
|
+
get(target, key, receiver) {
|
|
8522
|
+
const meta = readMeta(engine, target, key, receiver);
|
|
8523
|
+
if (meta !== NOT_META)
|
|
8524
|
+
return meta;
|
|
8525
|
+
if (key === 'size') {
|
|
8526
|
+
track(target, ITERATE_KEY);
|
|
8527
|
+
return target.size;
|
|
8528
|
+
}
|
|
8529
|
+
if ((typeof key === 'string' || key === Symbol.iterator) && hasOwn(methods, key) && key in target) {
|
|
8530
|
+
return methods[key];
|
|
8531
|
+
}
|
|
8532
|
+
const value = Reflect.get(target, key, target);
|
|
8533
|
+
return typeof value === 'function' ? value.bind(target) : value;
|
|
8534
|
+
},
|
|
8535
|
+
};
|
|
8536
|
+
}
|
|
8537
|
+
|
|
8264
8538
|
const ReactiveEngineMapper = new WeakSet();
|
|
8265
8539
|
const AllreactiveMap = new WeakMap();
|
|
8266
8540
|
function armgetter() { return AllreactiveMap; }
|
|
@@ -8299,12 +8573,13 @@ class ReactiveEngine {
|
|
|
8299
8573
|
deleteProperty: createDelete(),
|
|
8300
8574
|
ownKeys: createOwn()
|
|
8301
8575
|
};
|
|
8576
|
+
collectionHandler = createCollectionHandler(this);
|
|
8302
8577
|
reactive(model) {
|
|
8303
8578
|
if (!isObject(model)) {
|
|
8304
8579
|
model = { value: model };
|
|
8305
8580
|
}
|
|
8306
8581
|
const targetType = getTargetType(model);
|
|
8307
|
-
if (targetType === 0 /* TargetType.SYSTEM */ ||
|
|
8582
|
+
if (targetType === 0 /* TargetType.SYSTEM */ || 0 /* TargetType.INVALID */) {
|
|
8308
8583
|
return model;
|
|
8309
8584
|
}
|
|
8310
8585
|
let existingProxy = AllreactiveMap.get(model);
|
|
@@ -8316,7 +8591,12 @@ class ReactiveEngine {
|
|
|
8316
8591
|
return existingProxy;
|
|
8317
8592
|
}
|
|
8318
8593
|
// if (targetType === TargetType.INVALID) {
|
|
8319
|
-
if (
|
|
8594
|
+
if (targetType === 2 /* TargetType.COLLECTION */) {
|
|
8595
|
+
var proxy = new Proxy(model, this.collectionHandler);
|
|
8596
|
+
AllreactiveMap.set(model, proxy);
|
|
8597
|
+
return proxy;
|
|
8598
|
+
}
|
|
8599
|
+
else if (Array.isArray(model)) {
|
|
8320
8600
|
var proxy = new Proxy(model, this.arrayHandler);
|
|
8321
8601
|
// var original = Object.getPrototypeOf(proxy);
|
|
8322
8602
|
// original["copy"] = () => { return model; }
|
|
@@ -10717,18 +10997,16 @@ class RoutingEngine {
|
|
|
10717
10997
|
}
|
|
10718
10998
|
let val = control;
|
|
10719
10999
|
if (val instanceof Promise) {
|
|
10720
|
-
val = await val
|
|
10721
|
-
return result.default ? result.default : result;
|
|
10722
|
-
});
|
|
11000
|
+
val = unwrapModule(await val);
|
|
10723
11001
|
}
|
|
10724
11002
|
instance = this._construct(scope, route, () => this._resolveFrom(scope, val));
|
|
10725
11003
|
if (instance) {
|
|
10726
11004
|
return instance;
|
|
10727
11005
|
}
|
|
10728
11006
|
if (typeof val === 'function') {
|
|
10729
|
-
return this.parseControl(this._construct(scope, route, () =>
|
|
11007
|
+
return this.parseControl(this._construct(scope, route, () => resolveToComponent(val, this.application)), scope, route);
|
|
10730
11008
|
}
|
|
10731
|
-
return val;
|
|
11009
|
+
return resolveToComponent(val);
|
|
10732
11010
|
}
|
|
10733
11011
|
_resolveFrom(scope, token) {
|
|
10734
11012
|
const provider = scope ?? this._rootProvider();
|
|
@@ -10749,6 +11027,7 @@ class RoutingEngine {
|
|
|
10749
11027
|
}
|
|
10750
11028
|
async _instanceCreator(control, scope, route) {
|
|
10751
11029
|
let val = await this.parseControl(control, scope, route);
|
|
11030
|
+
assertLoadedComponent(val);
|
|
10752
11031
|
// if (val instanceof Promise) {
|
|
10753
11032
|
// return result.default ? result.default : result;
|
|
10754
11033
|
// if (typeof val === 'function') {
|
|
@@ -11745,10 +12024,11 @@ class UrlRoutingModule {
|
|
|
11745
12024
|
catch { }
|
|
11746
12025
|
this._scroll = null;
|
|
11747
12026
|
this._historyStamp = null;
|
|
12027
|
+
let done = Promise.resolve();
|
|
11748
12028
|
try {
|
|
11749
12029
|
// keepAlive önbelleğindeki örnekleri bırak
|
|
11750
12030
|
try {
|
|
11751
|
-
|
|
12031
|
+
done = this.routingEngine.dispose();
|
|
11752
12032
|
}
|
|
11753
12033
|
catch { }
|
|
11754
12034
|
if (this._navHandler) {
|
|
@@ -11768,6 +12048,7 @@ class UrlRoutingModule {
|
|
|
11768
12048
|
}
|
|
11769
12049
|
}
|
|
11770
12050
|
catch { }
|
|
12051
|
+
return done;
|
|
11771
12052
|
}
|
|
11772
12053
|
}
|
|
11773
12054
|
|
|
@@ -11853,7 +12134,7 @@ let startedApplicationBuilder = false;
|
|
|
11853
12134
|
class ApplicationBuilder {
|
|
11854
12135
|
services = new ServiceCollection();
|
|
11855
12136
|
constructor() {
|
|
11856
|
-
if (_globalApplication || startedApplicationBuilder) {
|
|
12137
|
+
if ((_globalApplication && _globalApplication.state !== 'disposing') || startedApplicationBuilder) {
|
|
11857
12138
|
throw new MotifError('MJX405', formatMotifMessage('MJX405'), { cause: _globalApplication });
|
|
11858
12139
|
}
|
|
11859
12140
|
startedApplicationBuilder = true;
|
|
@@ -11886,6 +12167,12 @@ class Application {
|
|
|
11886
12167
|
constructor(provider) {
|
|
11887
12168
|
this.provider = provider;
|
|
11888
12169
|
}
|
|
12170
|
+
static _disposingCount = 0;
|
|
12171
|
+
_state = 'initializing';
|
|
12172
|
+
_disposing;
|
|
12173
|
+
get state() {
|
|
12174
|
+
return this._state;
|
|
12175
|
+
}
|
|
11889
12176
|
_middlewares = [];
|
|
11890
12177
|
_beforeEachGuards = [];
|
|
11891
12178
|
_routerState = new RouterState();
|
|
@@ -11912,9 +12199,11 @@ class Application {
|
|
|
11912
12199
|
target = host;
|
|
11913
12200
|
}
|
|
11914
12201
|
let rootInstance = appRoot;
|
|
12202
|
+
this._state = 'running';
|
|
11915
12203
|
const AppShell = new Component(target);
|
|
11916
12204
|
this.appShell = AppShell;
|
|
11917
12205
|
safeCallSilent(() => {
|
|
12206
|
+
AppShell._keepElementOnDispose = true;
|
|
11918
12207
|
AppShell.application = this;
|
|
11919
12208
|
AppShell.provider = this.provider;
|
|
11920
12209
|
}, 'Application.run.setupAppShell');
|
|
@@ -11949,10 +12238,14 @@ class Application {
|
|
|
11949
12238
|
this.appShell.element?.appendChild(component);
|
|
11950
12239
|
}
|
|
11951
12240
|
dispose() {
|
|
12241
|
+
if (this._disposing)
|
|
12242
|
+
return this._disposing;
|
|
12243
|
+
this._state = 'disposing';
|
|
12244
|
+
Application._disposingCount++;
|
|
11952
12245
|
startedApplicationBuilder = false;
|
|
12246
|
+
let routerDone;
|
|
11953
12247
|
safeCallSilent(() => { this._removeLifecycleListeners(); }, 'Application.dispose.lifecycle');
|
|
11954
|
-
safeCallSilent(() => { this.urlRoutingModule?.dispose?.(); }, 'Application.dispose.router');
|
|
11955
|
-
safeCallSilent(() => { this.provider.dispose(); }, 'Application.dispose.preDispose');
|
|
12248
|
+
safeCallSilent(() => { routerDone = this.urlRoutingModule?.dispose?.(); }, 'Application.dispose.router');
|
|
11956
12249
|
safeCallSilent(() => { engine.stopGc(); }, 'Application.dispose.gcStop');
|
|
11957
12250
|
safeCallSilent(() => {
|
|
11958
12251
|
try {
|
|
@@ -11965,7 +12258,31 @@ class Application {
|
|
|
11965
12258
|
catch { /* ignore */ }
|
|
11966
12259
|
}, 'Application.dispose.resetUrl');
|
|
11967
12260
|
transitionSettings.mode = 'concurrent';
|
|
11968
|
-
|
|
12261
|
+
const shell = this.appShell;
|
|
12262
|
+
return this._disposing = (async () => {
|
|
12263
|
+
try {
|
|
12264
|
+
await routerDone;
|
|
12265
|
+
}
|
|
12266
|
+
catch (error) {
|
|
12267
|
+
reportError('MJX307', error);
|
|
12268
|
+
}
|
|
12269
|
+
if (shell && !shell.isDisposed) {
|
|
12270
|
+
try {
|
|
12271
|
+
await shell.dispose();
|
|
12272
|
+
}
|
|
12273
|
+
catch (error) {
|
|
12274
|
+
reportError('MJX307', error);
|
|
12275
|
+
}
|
|
12276
|
+
}
|
|
12277
|
+
try {
|
|
12278
|
+
await this.provider.dispose();
|
|
12279
|
+
}
|
|
12280
|
+
catch { }
|
|
12281
|
+
if (_globalApplication === this)
|
|
12282
|
+
_globalApplication = null;
|
|
12283
|
+
this._state = 'disposed';
|
|
12284
|
+
Application._disposingCount--;
|
|
12285
|
+
})();
|
|
11969
12286
|
}
|
|
11970
12287
|
useTransitions(options) {
|
|
11971
12288
|
if (isTransitionMode(options?.mode))
|
|
@@ -12213,4 +12530,4 @@ function useApplication() {
|
|
|
12213
12530
|
}
|
|
12214
12531
|
|
|
12215
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 };
|
|
12216
|
-
//# sourceMappingURL=core-
|
|
12533
|
+
//# sourceMappingURL=core-vVL0WG0n.esm.js.map
|