@absolutejs/absolute 0.19.0-beta.874 → 0.19.0-beta.876
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/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/build.js +21 -9
- package/dist/build.js.map +4 -4
- package/dist/dev/client/handlers/angularRemount.ts +41 -14
- package/dist/index.js +21 -9
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
|
@@ -14,20 +14,24 @@ import type {} from '../../../types/globals';
|
|
|
14
14
|
* so it participates in the parent's view tree instead of being a
|
|
15
15
|
* detached root.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
17
|
+
* Lifecycle of one remount:
|
|
18
|
+
* 1. `applyMetadata` runs, returning `_Fresh` — a class with the
|
|
19
|
+
* full new body (fields + ctor + methods) and a `ɵfac` that
|
|
20
|
+
* delegates to the LIVE class's factory with `_Fresh` as the
|
|
21
|
+
* type override. The delegation preserves the bundle's resolved
|
|
22
|
+
* DI for explicit constructor params.
|
|
23
|
+
* 2. For each live instance: `createComponent(_Fresh, hostElement)`
|
|
24
|
+
* builds a fresh `ComponentRef` at the same host. Angular runs
|
|
25
|
+
* the new constructor (firing field initializers + lifecycle
|
|
26
|
+
* hooks) and renders the new template.
|
|
27
|
+
* 3. Splice the new LView into the parent's slot via vendored slot
|
|
28
|
+
* ops, replacing the old one in the parent's view tree.
|
|
29
|
+
* 4. Tear down the old LView (`executeOnDestroys` +
|
|
30
|
+
* `processCleanups`) so RxJS subscriptions, DOM event listeners,
|
|
31
|
+
* and `inject(DestroyRef).onDestroy(...)` callbacks all fire.
|
|
32
|
+
* 5. `ApplicationRef.tick()` so the parent's template re-runs
|
|
33
|
+
* against the new slot — re-applies `@Input` bindings and
|
|
34
|
+
* re-projects `<ng-content>` into the fresh child. */
|
|
31
35
|
|
|
32
36
|
import {
|
|
33
37
|
CONTEXT,
|
|
@@ -262,5 +266,28 @@ export const remountComponentClass = async (
|
|
|
262
266
|
}
|
|
263
267
|
}
|
|
264
268
|
|
|
269
|
+
if (remounted > 0) {
|
|
270
|
+
// Trigger an app-wide CD pass so the parent's template re-runs
|
|
271
|
+
// against the new child LView's slot. This is what re-applies
|
|
272
|
+
// `@Input` bindings (`<app-hero [foo]="bar">`) and re-projects
|
|
273
|
+
// `<ng-content>` content into the new instance — both are
|
|
274
|
+
// PARENT-template artifacts that Angular only re-evaluates
|
|
275
|
+
// during the parent's update pass, not during the child's
|
|
276
|
+
// fresh creation. Without this tick, a remounted component
|
|
277
|
+
// shows default field values until the user interacts and
|
|
278
|
+
// triggers a stray CD elsewhere.
|
|
279
|
+
const w = window as unknown as {
|
|
280
|
+
__ANGULAR_APP__?: { tick?: () => void };
|
|
281
|
+
};
|
|
282
|
+
try {
|
|
283
|
+
w.__ANGULAR_APP__?.tick?.();
|
|
284
|
+
} catch (err) {
|
|
285
|
+
console.error(
|
|
286
|
+
'[absolutejs] post-remount tick threw — partial state',
|
|
287
|
+
err
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
265
292
|
return { className, remounted, skipped };
|
|
266
293
|
};
|
package/dist/index.js
CHANGED
|
@@ -9832,12 +9832,12 @@ __export(exports_hmrInjectionPlugin, {
|
|
|
9832
9832
|
});
|
|
9833
9833
|
import { readFile as readFile5 } from "fs/promises";
|
|
9834
9834
|
import { relative as relative6, resolve as resolve15 } from "path";
|
|
9835
|
-
var ENTITY_DECORATOR_RE, IMPORT_RE,
|
|
9835
|
+
var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames = (jsSource) => {
|
|
9836
9836
|
const names = new Set;
|
|
9837
9837
|
IMPORT_RE.lastIndex = 0;
|
|
9838
|
-
let
|
|
9839
|
-
while ((
|
|
9840
|
-
const [, , nsName, defaultName, namedAfterDefault, named] =
|
|
9838
|
+
let importMatch;
|
|
9839
|
+
while ((importMatch = IMPORT_RE.exec(jsSource)) !== null) {
|
|
9840
|
+
const [, , nsName, defaultName, namedAfterDefault, named] = importMatch;
|
|
9841
9841
|
if (nsName)
|
|
9842
9842
|
names.add(nsName);
|
|
9843
9843
|
if (defaultName)
|
|
@@ -9855,6 +9855,13 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, extractImportedLocalNames = (jsSource) => {
|
|
|
9855
9855
|
}
|
|
9856
9856
|
}
|
|
9857
9857
|
}
|
|
9858
|
+
TOP_LEVEL_DECL_RE.lastIndex = 0;
|
|
9859
|
+
let declMatch;
|
|
9860
|
+
while ((declMatch = TOP_LEVEL_DECL_RE.exec(jsSource)) !== null) {
|
|
9861
|
+
const name = declMatch[1];
|
|
9862
|
+
if (name)
|
|
9863
|
+
names.add(name);
|
|
9864
|
+
}
|
|
9858
9865
|
return [...names];
|
|
9859
9866
|
}, buildHmrTail = (className, encodedIdLiteral) => `
|
|
9860
9867
|
|
|
@@ -9977,8 +9984,8 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, extractImportedLocalNames = (jsSource) => {
|
|
|
9977
9984
|
const id = `${projectRel}@${className}`;
|
|
9978
9985
|
return buildHmrTail(className, JSON.stringify(id));
|
|
9979
9986
|
}).join("");
|
|
9980
|
-
const
|
|
9981
|
-
const depsKeys =
|
|
9987
|
+
const topLevelNames = extractAllTopLevelNames(text);
|
|
9988
|
+
const depsKeys = topLevelNames.filter((n) => !classNames.includes(n)).join(", ");
|
|
9982
9989
|
const depsBlock = classNames.length > 0 && depsKeys ? `
|
|
9983
9990
|
|
|
9984
9991
|
// absolutejs HMR \u2014 Tier 1a class-deps registry
|
|
@@ -9993,6 +10000,7 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, extractImportedLocalNames = (jsSource) => {
|
|
|
9993
10000
|
var init_hmrInjectionPlugin = __esm(() => {
|
|
9994
10001
|
ENTITY_DECORATOR_RE = /([A-Z][A-Za-z0-9_$]*)\s*=\s*__legacyDecorateClassTS[A-Za-z0-9_$]*\s*\(\s*\[[\s\S]*?\b(?:Component|Directive|Pipe|Injectable)[A-Za-z0-9_$]*\s*\(/g;
|
|
9995
10002
|
IMPORT_RE = /^\s*import\s+(?:(?:(\*)\s+as\s+([A-Za-z_$][\w$]*)\s+from)|(?:([A-Za-z_$][\w$]*)(?:\s*,\s*\{([^}]*)\})?\s+from)|(?:\{([^}]*)\}\s+from))\s*['"][^'"]+['"]/gm;
|
|
10003
|
+
TOP_LEVEL_DECL_RE = /^(?:export\s+)?(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/gm;
|
|
9996
10004
|
});
|
|
9997
10005
|
|
|
9998
10006
|
// src/utils/cleanStaleOutputs.ts
|
|
@@ -19208,16 +19216,20 @@ ${block}
|
|
|
19208
19216
|
if (methodsBlock) {
|
|
19209
19217
|
const tail = `
|
|
19210
19218
|
if (typeof _Fresh !== 'undefined') {
|
|
19219
|
+
var __abs_liveFac = ${className}.\u0275fac;
|
|
19220
|
+
var __abs_freshFac = typeof __abs_liveFac === 'function'
|
|
19221
|
+
? function(t) { return __abs_liveFac(t || _Fresh); }
|
|
19222
|
+
: function() { return new _Fresh(); };
|
|
19211
19223
|
_Fresh.\u0275cmp = Object.assign(
|
|
19212
19224
|
Object.create(Object.getPrototypeOf(${className}.\u0275cmp)),
|
|
19213
19225
|
${className}.\u0275cmp,
|
|
19214
19226
|
{
|
|
19215
19227
|
type: _Fresh,
|
|
19216
|
-
factory:
|
|
19228
|
+
factory: __abs_freshFac,
|
|
19217
19229
|
tView: null
|
|
19218
19230
|
}
|
|
19219
19231
|
);
|
|
19220
|
-
_Fresh.\u0275fac =
|
|
19232
|
+
_Fresh.\u0275fac = __abs_freshFac;
|
|
19221
19233
|
return _Fresh;
|
|
19222
19234
|
}
|
|
19223
19235
|
`;
|
|
@@ -30462,5 +30474,5 @@ export {
|
|
|
30462
30474
|
ANGULAR_INIT_TIMEOUT_MS
|
|
30463
30475
|
};
|
|
30464
30476
|
|
|
30465
|
-
//# debugId=
|
|
30477
|
+
//# debugId=A11C9EA489CC1BAB64756E2164756E21
|
|
30466
30478
|
//# sourceMappingURL=index.js.map
|