@absolutejs/absolute 0.19.0-beta.876 → 0.19.0-beta.878

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.
@@ -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
@@ -251,7 +276,7 @@ export const remountComponentClass = async (
251
276
  continue;
252
277
  }
253
278
 
254
- spliceLViewIntoParent(target, fresh.newLView);
279
+ spliceLViewIntoParent(target, fresh.newLView, fresh.instance);
255
280
  teardownOldLView(target.oldLView);
256
281
 
257
282
  fresh.componentRef.hostView.detectChanges?.();
package/dist/index.js CHANGED
@@ -19171,26 +19171,41 @@ ${block}
19171
19171
  while ((idMatch = identRe.exec(provisionalMethodsBlock)) !== null) {
19172
19172
  referencedNames.add(idMatch[0]);
19173
19173
  }
19174
- const sourceImportedNames = new Set;
19174
+ const sourceScopeNames = new Set;
19175
19175
  for (const stmt of sourceFile.statements) {
19176
- if (!ts7.isImportDeclaration(stmt))
19177
- continue;
19178
- if (!ts7.isStringLiteral(stmt.moduleSpecifier))
19176
+ if (ts7.isImportDeclaration(stmt)) {
19177
+ if (!ts7.isStringLiteral(stmt.moduleSpecifier))
19178
+ continue;
19179
+ const clause = stmt.importClause;
19180
+ if (clause?.name)
19181
+ sourceScopeNames.add(clause.name.text);
19182
+ if (clause?.namedBindings && ts7.isNamedImports(clause.namedBindings)) {
19183
+ for (const el of clause.namedBindings.elements) {
19184
+ if (el.isTypeOnly)
19185
+ continue;
19186
+ sourceScopeNames.add(el.name.text);
19187
+ }
19188
+ } else if (clause?.namedBindings && ts7.isNamespaceImport(clause.namedBindings)) {
19189
+ sourceScopeNames.add(clause.namedBindings.name.text);
19190
+ }
19179
19191
  continue;
19180
- const clause = stmt.importClause;
19181
- if (clause?.name)
19182
- sourceImportedNames.add(clause.name.text);
19183
- if (clause?.namedBindings && ts7.isNamedImports(clause.namedBindings)) {
19184
- for (const el of clause.namedBindings.elements) {
19185
- if (el.isTypeOnly)
19186
- continue;
19187
- sourceImportedNames.add(el.name.text);
19192
+ }
19193
+ if (ts7.isVariableStatement(stmt) || stmt.kind === ts7.SyntaxKind.VariableStatement) {
19194
+ const varStmt = stmt;
19195
+ for (const decl of varStmt.declarationList.declarations) {
19196
+ if (ts7.isIdentifier(decl.name)) {
19197
+ sourceScopeNames.add(decl.name.text);
19198
+ }
19188
19199
  }
19189
- } else if (clause?.namedBindings && ts7.isNamespaceImport(clause.namedBindings)) {
19190
- sourceImportedNames.add(clause.namedBindings.name.text);
19200
+ continue;
19201
+ }
19202
+ if (ts7.isFunctionDeclaration(stmt) || ts7.isClassDeclaration(stmt)) {
19203
+ if (stmt.name)
19204
+ sourceScopeNames.add(stmt.name.text);
19191
19205
  }
19192
19206
  }
19193
- const depsToDestructure = [...sourceImportedNames].filter((n) => referencedNames.has(n));
19207
+ sourceScopeNames.delete(className);
19208
+ const depsToDestructure = [...sourceScopeNames].filter((n) => referencedNames.has(n));
19194
19209
  const tsSourceText = fnText;
19195
19210
  const transpiled = ts7.transpileModule(tsSourceText, {
19196
19211
  compilerOptions: {
@@ -30474,5 +30489,5 @@ export {
30474
30489
  ANGULAR_INIT_TIMEOUT_MS
30475
30490
  };
30476
30491
 
30477
- //# debugId=A11C9EA489CC1BAB64756E2164756E21
30492
+ //# debugId=4117F8576985AF1A64756E2164756E21
30478
30493
  //# sourceMappingURL=index.js.map