@absolutejs/absolute 0.19.0-beta.877 → 0.19.0-beta.879
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-wj25fP/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-wj25fP/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
|
|
|
48
48
|
getWarningController()?.maybeWarn(primitiveName);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
// .angular-partial-tmp-
|
|
51
|
+
// .angular-partial-tmp-wj25fP/src/core/streamingSlotRegistry.ts
|
|
52
52
|
var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
|
|
53
53
|
var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
|
|
54
54
|
var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
@@ -154,15 +154,40 @@ const createFreshAt = (
|
|
|
154
154
|
|
|
155
155
|
/* Splice `newLView` into `parentLView` at `slotIndex`, replacing
|
|
156
156
|
* `oldLView`. After the splice, the new LView lives in the parent's
|
|
157
|
-
* view tree; the old one is detached.
|
|
157
|
+
* view tree; the old one is detached.
|
|
158
|
+
*
|
|
159
|
+
* ALSO rewires the directive-instance slots in `parentLView` for
|
|
160
|
+
* this node from the OLD instance to the NEW one. Angular stores
|
|
161
|
+
* each directive instance at `parentLView[i]` for `i` in
|
|
162
|
+
* `[tNode.directiveStart, tNode.directiveEnd)`. Parent template
|
|
163
|
+
* binding ops like `ɵɵproperty('priority', value)` walk that range
|
|
164
|
+
* and write to `parentLView[i].priority` — if those slots still
|
|
165
|
+
* point at the OLD instance, parent CD writes to a dead reference
|
|
166
|
+
* and `@Input` bindings never make it to the new instance. */
|
|
158
167
|
const spliceLViewIntoParent = (
|
|
159
168
|
target: LiveInstance,
|
|
160
|
-
newLView: LView
|
|
169
|
+
newLView: LView,
|
|
170
|
+
newInstance: unknown
|
|
161
171
|
): void => {
|
|
162
172
|
const { parentLView, oldLView, slotIndex, tNode } = target;
|
|
163
173
|
replaceLViewInTree(parentLView, oldLView, newLView, slotIndex);
|
|
164
174
|
newLView[PARENT] = parentLView;
|
|
165
175
|
newLView[T_HOST] = tNode;
|
|
176
|
+
|
|
177
|
+
const oldInstance = oldLView[CONTEXT];
|
|
178
|
+
const tNodeWithDirectiveRange = tNode as TNode & {
|
|
179
|
+
directiveStart?: number;
|
|
180
|
+
directiveEnd?: number;
|
|
181
|
+
};
|
|
182
|
+
const start = tNodeWithDirectiveRange.directiveStart;
|
|
183
|
+
const end = tNodeWithDirectiveRange.directiveEnd;
|
|
184
|
+
if (typeof start === 'number' && typeof end === 'number') {
|
|
185
|
+
for (let i = start; i < end; i++) {
|
|
186
|
+
if (parentLView[i] === oldInstance) {
|
|
187
|
+
parentLView[i] = newInstance;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
166
191
|
};
|
|
167
192
|
|
|
168
193
|
/* Fire onDestroy + cleanup on the OLD LView so subscriptions, event
|
|
@@ -178,6 +203,47 @@ const teardownOldLView = (oldLView: LView): void => {
|
|
|
178
203
|
markLViewDestroyed(oldLView);
|
|
179
204
|
};
|
|
180
205
|
|
|
206
|
+
/* Copy `@Input` field values from the OLD instance to the NEW one.
|
|
207
|
+
*
|
|
208
|
+
* This is needed because Angular's parent template emits binding ops
|
|
209
|
+
* like `ɵɵproperty('priority', true)` that compare against a cached
|
|
210
|
+
* binding slot in the parent's LView before writing. After our
|
|
211
|
+
* splice the CACHED value is unchanged (the parent's LView wasn't
|
|
212
|
+
* re-rendered), so the next parent CD sees `true === true (cached)`
|
|
213
|
+
* and SKIPS the write. The new instance's `priority` would stay at
|
|
214
|
+
* its default until the parent's binding expression result changes.
|
|
215
|
+
*
|
|
216
|
+
* Pre-seeding the new instance with the old value sidesteps this:
|
|
217
|
+
* by the time the parent's binding op might run, the new instance
|
|
218
|
+
* already has the correct value, and any future change will fire
|
|
219
|
+
* normally because the binding-cache invariant is preserved.
|
|
220
|
+
*
|
|
221
|
+
* `def.inputs` metadata format (modern Angular):
|
|
222
|
+
* - `{ propName: 'classFieldName' }` (simple alias)
|
|
223
|
+
* - `{ propName: ['publicName', 'classFieldName', transformFn?] }` */
|
|
224
|
+
const copyInputsFromOldToNew = (
|
|
225
|
+
oldInstance: unknown,
|
|
226
|
+
newInstance: unknown
|
|
227
|
+
): void => {
|
|
228
|
+
if (!oldInstance || !newInstance) return;
|
|
229
|
+
const def = (newInstance as { constructor?: { ɵcmp?: unknown } }).constructor
|
|
230
|
+
?.ɵcmp as { inputs?: Record<string, unknown> } | undefined;
|
|
231
|
+
const inputs = def?.inputs;
|
|
232
|
+
if (!inputs) return;
|
|
233
|
+
|
|
234
|
+
// Modern Angular inputs format (since v17ish): the OBJECT KEY is
|
|
235
|
+
// the class property name; the value is either a string (binding
|
|
236
|
+
// name) or `[bindingName, flags, transformFn?]`. So the class
|
|
237
|
+
// field name is just `Object.keys(inputs)`.
|
|
238
|
+
for (const classField of Object.keys(inputs)) {
|
|
239
|
+
const oldRec = oldInstance as Record<string, unknown>;
|
|
240
|
+
const newRec = newInstance as Record<string, unknown>;
|
|
241
|
+
if (classField in oldRec) {
|
|
242
|
+
newRec[classField] = oldRec[classField];
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
181
247
|
export type RemountResult = {
|
|
182
248
|
className: string;
|
|
183
249
|
remounted: number;
|
|
@@ -251,7 +317,8 @@ export const remountComponentClass = async (
|
|
|
251
317
|
continue;
|
|
252
318
|
}
|
|
253
319
|
|
|
254
|
-
|
|
320
|
+
copyInputsFromOldToNew(target.oldLView[CONTEXT], fresh.instance);
|
|
321
|
+
spliceLViewIntoParent(target, fresh.newLView, fresh.instance);
|
|
255
322
|
teardownOldLView(target.oldLView);
|
|
256
323
|
|
|
257
324
|
fresh.componentRef.hostView.detectChanges?.();
|
package/package.json
CHANGED