@absolutejs/absolute 0.19.0-beta.868 → 0.19.0-beta.869

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-V8Evbn/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-qkUlea/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-V8Evbn/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-qkUlea/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-V8Evbn/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-qkUlea/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";
@@ -29,14 +29,12 @@ import type {} from '../../../types/globals';
29
29
  * known limitation in ANGULAR_PER_COMPONENT_REMOUNT_RESEARCH.md. */
30
30
 
31
31
  import {
32
- CHILD_HEAD,
33
- CHILD_TAIL,
34
32
  CONTEXT,
35
33
  HOST,
36
34
  PARENT,
37
35
  T_HOST,
38
36
  TVIEW
39
- } from '../../angular/vendor/lview/slotConstants';
37
+ } from '../vendor/lview/slotConstants';
40
38
  import {
41
39
  executeOnDestroys,
42
40
  isLView,
@@ -46,7 +44,7 @@ import {
46
44
  type LView,
47
45
  type TView,
48
46
  type TNode
49
- } from '../../angular/vendor/lview/lViewOps';
47
+ } from '../vendor/lview/lViewOps';
50
48
 
51
49
  type AngularCoreNamespace = {
52
50
  createComponent: (
@@ -0,0 +1,194 @@
1
+ import type {} from '../../../../types/globals';
2
+ /* Vendored LView slot operations. Direct port from
3
+ * `@angular/core/fesm2022/_debug_node-chunk.mjs` of the small-and-pure
4
+ * helpers we need for per-component remount. The big helpers
5
+ * (renderView / refreshView / destroyLView's full DOM-removal path)
6
+ * stay in Angular — we invoke them indirectly via public
7
+ * `createComponent`. The ones here are slot-manipulation primitives
8
+ * with no transitive dependencies, so vendoring them is safe.
9
+ *
10
+ * Per-Angular-version chore: re-diff against the upstream functions
11
+ * after each minor bump. They've been stable since v17 — the algorithm
12
+ * shape hasn't changed since the LView FLAGS reshuffle. */
13
+
14
+ import {
15
+ CHILD_HEAD,
16
+ CHILD_TAIL,
17
+ CLEANUP,
18
+ FLAGS,
19
+ HEADER_OFFSET,
20
+ LFLAG_DESTROYED,
21
+ NEXT,
22
+ ON_DESTROY_HOOKS,
23
+ TVIEW
24
+ } from './slotConstants';
25
+
26
+ export type LView = unknown[];
27
+ export type LContainer = unknown[];
28
+ export type TView = {
29
+ bindingStartIndex: number;
30
+ cleanup: unknown[] | null;
31
+ destroyHooks: unknown[] | null;
32
+ };
33
+ export type TNode = { index: number };
34
+
35
+ /* `isLView` / `isLContainer` shape checks. The runtime distinguishes
36
+ * by whether slot 1 (TVIEW) is an object or undefined — LContainer
37
+ * doesn't have a TView. */
38
+ export const isLView = (v: unknown): v is LView =>
39
+ Array.isArray(v) && typeof (v as unknown[])[TVIEW] === 'object';
40
+
41
+ export const isLContainer = (v: unknown): v is LContainer =>
42
+ Array.isArray(v) && (v as unknown[])[TVIEW] === undefined;
43
+
44
+ export const isDestroyed = (lView: LView): boolean =>
45
+ ((lView[FLAGS] as number) & LFLAG_DESTROYED) !== 0;
46
+
47
+ /* Vendored from `replaceLViewInTree(parentLView, oldLView, newLView, index)`.
48
+ * Walks parent's slots looking for the LView/LContainer whose NEXT
49
+ * pointer is `oldLView` and rewires it to `newLView`, then patches
50
+ * CHILD_HEAD / CHILD_TAIL if `oldLView` was at either end, and finally
51
+ * places `newLView` at the indexed slot.
52
+ *
53
+ * Verbatim port — keep it that way to make diff-against-upstream cheap. */
54
+ export const replaceLViewInTree = (
55
+ parentLView: LView,
56
+ oldLView: LView,
57
+ newLView: LView,
58
+ index: number
59
+ ): void => {
60
+ const parentTView = parentLView[TVIEW] as TView;
61
+ for (let i = HEADER_OFFSET; i < parentTView.bindingStartIndex; i++) {
62
+ const current = parentLView[i];
63
+ if (
64
+ (isLView(current) || isLContainer(current)) &&
65
+ (current as LView)[NEXT] === oldLView
66
+ ) {
67
+ (current as LView)[NEXT] = newLView;
68
+ break;
69
+ }
70
+ }
71
+ if (parentLView[CHILD_HEAD] === oldLView) parentLView[CHILD_HEAD] = newLView;
72
+ if (parentLView[CHILD_TAIL] === oldLView) parentLView[CHILD_TAIL] = newLView;
73
+ newLView[NEXT] = oldLView[NEXT];
74
+ oldLView[NEXT] = null;
75
+ parentLView[index] = newLView;
76
+ };
77
+
78
+ /* Vendored from `executeOnDestroys(tView, lView)`. tView.destroyHooks
79
+ * is laid out as `[slotIdx, hook | hookList, slotIdx, hook | hookList, ...]`.
80
+ * Each `hook` is either a function (called with `lView[slotIdx]` as
81
+ * `this`) or an array of `[propertyKey, fn]` pairs (one per directive
82
+ * sharing the slot). NodeInjectorFactory contexts are skipped; they
83
+ * represent injector providers, not directive instances. */
84
+ type NodeInjectorFactoryLike = { multi?: unknown };
85
+
86
+ const isNodeInjectorFactoryLike = (
87
+ value: unknown
88
+ ): value is NodeInjectorFactoryLike =>
89
+ typeof value === 'object' &&
90
+ value !== null &&
91
+ value.constructor !== undefined &&
92
+ value.constructor.name === 'NodeInjectorFactory';
93
+
94
+ export const executeOnDestroys = (tView: TView, lView: LView): void => {
95
+ const destroyHooks = tView.destroyHooks;
96
+ if (destroyHooks == null) return;
97
+
98
+ for (let i = 0; i < destroyHooks.length; i += 2) {
99
+ const slotIdx = destroyHooks[i] as number;
100
+ const context = lView[slotIdx];
101
+ if (isNodeInjectorFactoryLike(context)) continue;
102
+
103
+ const toCall = destroyHooks[i + 1];
104
+ if (Array.isArray(toCall)) {
105
+ for (let j = 0; j < toCall.length; j += 2) {
106
+ const propKey = toCall[j] as string;
107
+ const hook = toCall[j + 1] as () => void;
108
+ const callContext = (context as Record<string, unknown>)[propKey];
109
+ try {
110
+ hook.call(callContext);
111
+ } catch (err) {
112
+ console.error('[absolutejs] onDestroy hook threw', err);
113
+ }
114
+ }
115
+ } else if (typeof toCall === 'function') {
116
+ try {
117
+ (toCall as (this: unknown) => void).call(context);
118
+ } catch (err) {
119
+ console.error('[absolutejs] onDestroy hook threw', err);
120
+ }
121
+ }
122
+ }
123
+ };
124
+
125
+ /* Vendored from `processCleanups(tView, lView)`. Walks tView.cleanup which
126
+ * is laid out as either:
127
+ * [eventName(string), targetIdx, listenerIdx, indirectIdx, ...]
128
+ * — DOM event listener; lCleanup[indirectIdx] is the unregister fn
129
+ * (or, if indirectIdx is negative, lCleanup[-indirectIdx] is a
130
+ * Subscription whose .unsubscribe() we call)
131
+ * [hookFn(function), contextSlotIdx, ...]
132
+ * — directive output / cleanup callback; call hookFn with
133
+ * lCleanup[contextSlotIdx] as `this`
134
+ * Then walks lView[ON_DESTROY_HOOKS] (component-level destroy hooks,
135
+ * registered via `inject(DestroyRef).onDestroy(...)` etc.) and fires
136
+ * each one. */
137
+ export const processCleanups = (tView: TView, lView: LView): void => {
138
+ const tCleanup = tView.cleanup;
139
+ const lCleanup = lView[CLEANUP] as unknown[] | null;
140
+
141
+ if (tCleanup !== null && lCleanup !== null) {
142
+ for (let i = 0; i < tCleanup.length - 1; i += 2) {
143
+ const entry = tCleanup[i];
144
+ if (typeof entry === 'string') {
145
+ const targetIdx = tCleanup[i + 3] as number;
146
+ try {
147
+ if (targetIdx >= 0) {
148
+ (lCleanup[targetIdx] as () => void)();
149
+ } else {
150
+ (
151
+ lCleanup[-targetIdx] as { unsubscribe: () => void }
152
+ ).unsubscribe();
153
+ }
154
+ } catch (err) {
155
+ console.error('[absolutejs] DOM cleanup threw', err);
156
+ }
157
+ i += 2;
158
+ } else if (typeof entry === 'function') {
159
+ const ctxIdx = tCleanup[i + 1] as number;
160
+ try {
161
+ (entry as (this: unknown) => void).call(lCleanup[ctxIdx]);
162
+ } catch (err) {
163
+ console.error('[absolutejs] cleanup callback threw', err);
164
+ }
165
+ }
166
+ }
167
+ }
168
+
169
+ if (lCleanup !== null) {
170
+ lView[CLEANUP] = null;
171
+ }
172
+
173
+ const onDestroyHooks = lView[ON_DESTROY_HOOKS] as
174
+ | Array<() => void>
175
+ | null;
176
+ if (onDestroyHooks !== null) {
177
+ lView[ON_DESTROY_HOOKS] = null;
178
+ for (const hook of onDestroyHooks) {
179
+ try {
180
+ hook();
181
+ } catch (err) {
182
+ console.error('[absolutejs] DestroyRef hook threw', err);
183
+ }
184
+ }
185
+ }
186
+ };
187
+
188
+ /* Mark an LView as destroyed so any later
189
+ * destroyLView/cleanUpView no-ops it. Without this flag the LView
190
+ * could get walked twice (e.g. if Angular's tree-walk later finds
191
+ * a stale reference). */
192
+ export const markLViewDestroyed = (lView: LView): void => {
193
+ lView[FLAGS] = ((lView[FLAGS] as number) | LFLAG_DESTROYED) >>> 0;
194
+ };
@@ -0,0 +1,44 @@
1
+ import type {} from '../../../../types/globals';
2
+ /* Vendored LView slot indices from `@angular/core`. The runtime represents
3
+ * each LView as a flat array; these constants name the structural slots
4
+ * before the per-template slots start at HEADER_OFFSET.
5
+ *
6
+ * Source: `node_modules/@angular/core/fesm2022/_effect-chunk2.mjs`
7
+ * (search for `const HOST = 0;`). These are NOT exported and Angular keeps
8
+ * them tightly held — but they have not shifted since the v9 ivy rewrite,
9
+ * so the maintenance cost is verifying once per Angular minor that
10
+ * `_effect-chunk2.mjs:HOST === 0` etc. still holds.
11
+ *
12
+ * If Angular reorders these, our LView traversal returns wrong slots
13
+ * (e.g. reading PARENT might yield CONTEXT). Symptom: per-component
14
+ * remount throws or silently swaps the wrong subtree. Verify at the
15
+ * top of `angularRemount.ts` via shape checks before doing anything
16
+ * destructive. */
17
+
18
+ export const HOST = 0;
19
+ export const TVIEW = 1;
20
+ export const FLAGS = 2;
21
+ export const PARENT = 3;
22
+ export const NEXT = 4;
23
+ export const T_HOST = 5;
24
+ export const HYDRATION = 6;
25
+ export const CLEANUP = 7;
26
+ export const CONTEXT = 8;
27
+ export const INJECTOR = 9;
28
+ export const ENVIRONMENT = 10;
29
+ export const RENDERER = 11;
30
+ export const CHILD_HEAD = 12;
31
+ export const CHILD_TAIL = 13;
32
+ export const DECLARATION_VIEW = 14;
33
+ export const DECLARATION_COMPONENT_VIEW = 15;
34
+ export const DECLARATION_LCONTAINER = 16;
35
+ export const PREORDER_HOOK_FLAGS = 17;
36
+ export const QUERIES = 18;
37
+ export const ID = 19;
38
+ export const EMBEDDED_VIEW_INJECTOR = 20;
39
+ export const ON_DESTROY_HOOKS = 21;
40
+ export const HEADER_OFFSET = 27;
41
+
42
+ /* LView FLAGS bitfield bits (from same source). We only care about
43
+ * the destroyed bit so that double-destroy is a no-op. */
44
+ export const LFLAG_DESTROYED = 256;
package/package.json CHANGED
@@ -385,5 +385,5 @@
385
385
  ]
386
386
  }
387
387
  },
388
- "version": "0.19.0-beta.868"
388
+ "version": "0.19.0-beta.869"
389
389
  }
@@ -1,17 +0,0 @@
1
- export type LView = unknown[];
2
- export type LContainer = unknown[];
3
- export type TView = {
4
- bindingStartIndex: number;
5
- cleanup: unknown[] | null;
6
- destroyHooks: unknown[] | null;
7
- };
8
- export type TNode = {
9
- index: number;
10
- };
11
- export declare const isLView: (v: unknown) => v is LView;
12
- export declare const isLContainer: (v: unknown) => v is LContainer;
13
- export declare const isDestroyed: (lView: LView) => boolean;
14
- export declare const replaceLViewInTree: (parentLView: LView, oldLView: LView, newLView: LView, index: number) => void;
15
- export declare const executeOnDestroys: (tView: TView, lView: LView) => void;
16
- export declare const processCleanups: (tView: TView, lView: LView) => void;
17
- export declare const markLViewDestroyed: (lView: LView) => void;
@@ -1,24 +0,0 @@
1
- export declare const HOST = 0;
2
- export declare const TVIEW = 1;
3
- export declare const FLAGS = 2;
4
- export declare const PARENT = 3;
5
- export declare const NEXT = 4;
6
- export declare const T_HOST = 5;
7
- export declare const HYDRATION = 6;
8
- export declare const CLEANUP = 7;
9
- export declare const CONTEXT = 8;
10
- export declare const INJECTOR = 9;
11
- export declare const ENVIRONMENT = 10;
12
- export declare const RENDERER = 11;
13
- export declare const CHILD_HEAD = 12;
14
- export declare const CHILD_TAIL = 13;
15
- export declare const DECLARATION_VIEW = 14;
16
- export declare const DECLARATION_COMPONENT_VIEW = 15;
17
- export declare const DECLARATION_LCONTAINER = 16;
18
- export declare const PREORDER_HOOK_FLAGS = 17;
19
- export declare const QUERIES = 18;
20
- export declare const ID = 19;
21
- export declare const EMBEDDED_VIEW_INJECTOR = 20;
22
- export declare const ON_DESTROY_HOOKS = 21;
23
- export declare const HEADER_OFFSET = 27;
24
- export declare const LFLAG_DESTROYED = 256;