angular-three 2.0.0-beta.40 → 2.0.0-beta.42

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.
Files changed (45) hide show
  1. package/esm2022/index.mjs +2 -1
  2. package/esm2022/lib/before-render.mjs +3 -4
  3. package/esm2022/lib/canvas.mjs +12 -13
  4. package/esm2022/lib/directives/args.mjs +3 -3
  5. package/esm2022/lib/directives/common.mjs +3 -3
  6. package/esm2022/lib/directives/key.mjs +3 -3
  7. package/esm2022/lib/directives/parent.mjs +3 -3
  8. package/esm2022/lib/instance.mjs +32 -29
  9. package/esm2022/lib/loader.mjs +6 -6
  10. package/esm2022/lib/portal.mjs +33 -36
  11. package/esm2022/lib/ref.mjs +15 -13
  12. package/esm2022/lib/renderer/index.mjs +15 -8
  13. package/esm2022/lib/renderer/store.mjs +9 -11
  14. package/esm2022/lib/renderer/utils.mjs +10 -18
  15. package/esm2022/lib/roots.mjs +11 -6
  16. package/esm2022/lib/routed-scene.mjs +3 -3
  17. package/esm2022/lib/utils/apply-props.mjs +5 -7
  18. package/esm2022/lib/utils/create-api-token.mjs +13 -0
  19. package/esm2022/lib/utils/signal-store.mjs +7 -4
  20. package/esm2022/lib/utils/update.mjs +1 -1
  21. package/fesm2022/angular-three.mjs +163 -149
  22. package/fesm2022/angular-three.mjs.map +1 -1
  23. package/index.d.ts +1 -0
  24. package/lib/instance.d.ts +10 -6
  25. package/lib/portal.d.ts +5 -10
  26. package/lib/ref.d.ts +0 -1
  27. package/lib/roots.d.ts +1 -1
  28. package/lib/store.d.ts +2 -2
  29. package/lib/utils/create-api-token.d.ts +17 -0
  30. package/package.json +6 -4
  31. package/plugin/generators.json +10 -0
  32. package/plugin/package.json +5 -4
  33. package/plugin/src/generators/init-rapier/compat.d.ts +2 -0
  34. package/plugin/src/generators/init-rapier/compat.js +6 -0
  35. package/plugin/src/generators/init-rapier/compat.js.map +1 -0
  36. package/plugin/src/generators/init-rapier/generator.d.ts +2 -0
  37. package/plugin/src/generators/init-rapier/generator.js +22 -0
  38. package/plugin/src/generators/init-rapier/generator.js.map +1 -0
  39. package/plugin/src/generators/init-rapier/schema.json +6 -0
  40. package/plugin/src/generators/versions.d.ts +1 -0
  41. package/plugin/src/generators/versions.js +2 -1
  42. package/plugin/src/generators/versions.js.map +1 -1
  43. package/plugin/src/index.d.ts +2 -0
  44. package/plugin/src/index.js +11 -7
  45. package/plugin/src/index.js.map +1 -1
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { untracked, computed, signal, ElementRef, runInInjectionContext, inject, DestroyRef, effect, ChangeDetectorRef, InjectionToken, Injector, Optional, SkipSelf, ViewContainerRef, NgZone, TemplateRef, Directive, Input, EventEmitter, getDebugNode, RendererFactory2, Injectable, makeEnvironmentProviders, provideZoneChangeDetection, EnvironmentInjector, createEnvironmentInjector, Component, ChangeDetectionStrategy, Output, ViewChild, ContentChild } from '@angular/core';
2
+ import { untracked, computed, signal, ElementRef, inject, Injector, DestroyRef, effect, runInInjectionContext, ChangeDetectorRef, InjectionToken, Optional, SkipSelf, ViewContainerRef, NgZone, TemplateRef, Directive, Input, EventEmitter, getDebugNode, RendererFactory2, Injectable, makeEnvironmentProviders, provideZoneChangeDetection, EnvironmentInjector, createEnvironmentInjector, Component, ChangeDetectionStrategy, Output, ViewChild, CUSTOM_ELEMENTS_SCHEMA, ContentChild, forwardRef } from '@angular/core';
3
3
  import { assertInjector } from 'ngxtension/assert-injector';
4
4
  import { DOCUMENT, NgIf } from '@angular/common';
5
5
  import { createInjectionToken } from 'ngxtension/create-injection-token';
@@ -58,7 +58,7 @@ const selector = (_state, computedCache) => (...keysAndOptions) => {
58
58
  }
59
59
  const [keys, options] = parseStoreOptions(keysAndOptions);
60
60
  const joinedKeys = keys.join('-');
61
- const cachedKeys = joinedKeys.concat(options ? JSON.stringify(options) : '');
61
+ const cachedKeys = joinedKeys.concat(JSON.stringify(options));
62
62
  if (!computedCache.has(cachedKeys)) {
63
63
  computedCache.set(cachedKeys, computed(() => keys.reduce((value, key) => value[key], _state()), options));
64
64
  }
@@ -72,6 +72,9 @@ function signalStore(initialState = {}, options) {
72
72
  let select;
73
73
  let state;
74
74
  const computedCache = new Map();
75
+ if (!options) {
76
+ options = { equal: Object.is };
77
+ }
75
78
  if (typeof initialState === 'function') {
76
79
  source = signal({}, options);
77
80
  state = source.asReadonly();
@@ -92,7 +95,7 @@ function signalStore(initialState = {}, options) {
92
95
  const store = { select, get, set, patch, state };
93
96
  // NOTE: internal _snapshot to debug current state
94
97
  Object.defineProperty(store, '_snapshot', {
95
- get: state,
98
+ get: untracked.bind({}, state),
96
99
  configurable: false,
97
100
  enumerable: false,
98
101
  });
@@ -102,7 +105,7 @@ function parseStoreOptions(keysAndOptions) {
102
105
  if (typeof keysAndOptions.at(-1) === 'object') {
103
106
  return [keysAndOptions.slice(0, -1), keysAndOptions.at(-1)];
104
107
  }
105
- return [keysAndOptions];
108
+ return [keysAndOptions, { equal: Object.is }];
106
109
  }
107
110
 
108
111
  const is = {
@@ -200,37 +203,41 @@ function invalidateInstance(instance) {
200
203
  function prepare(object, localState) {
201
204
  const instance = object;
202
205
  if (localState?.primitive || !instance.__ngt__) {
203
- const { objects = signal([]), nonObjects = signal([]), ...rest } = localState || {};
206
+ const { instanceStore = signalStore({
207
+ nativeProps: {},
208
+ parent: null,
209
+ objects: [],
210
+ nonObjects: [],
211
+ }), ...rest } = localState || {};
204
212
  instance.__ngt__ = {
205
213
  previousAttach: null,
206
214
  store: null,
207
- parent: signal(null),
208
215
  memoized: {},
209
216
  eventCount: 0,
210
217
  handlers: {},
211
- objects,
212
- nonObjects,
213
- nativeProps: signalStore(),
218
+ instanceStore,
214
219
  add: (object, type) => {
215
- untracked(() => {
216
- const current = instance.__ngt__[type]();
217
- const foundIndex = current.indexOf((obj) => obj === object);
218
- if (foundIndex > -1) {
219
- // if we add an object with the same reference, then we switch it out
220
- current.splice(foundIndex, 1, object);
221
- instance.__ngt__[type].set(current);
222
- }
223
- else {
224
- instance.__ngt__[type].update((prev) => [...prev, object]);
225
- }
226
- notifyAncestors(instance.__ngt__.parent());
227
- });
220
+ const current = instance.__ngt__.instanceStore.get(type);
221
+ const foundIndex = current.indexOf((obj) => obj === object);
222
+ if (foundIndex > -1) {
223
+ // if we add an object with the same reference, then we switch it out
224
+ current.splice(foundIndex, 1, object);
225
+ instance.__ngt__.instanceStore.set({ [type]: current });
226
+ }
227
+ else {
228
+ instance.__ngt__.instanceStore.set((prev) => ({ [type]: [...prev[type], object] }));
229
+ }
230
+ notifyAncestors(instance.__ngt__.instanceStore.get('parent'));
228
231
  },
229
232
  remove: (object, type) => {
230
- untracked(() => {
231
- instance.__ngt__[type].update((prev) => prev.filter((o) => o !== object));
232
- notifyAncestors(instance.__ngt__.parent());
233
- });
233
+ instance.__ngt__.instanceStore.set((prev) => ({ [type]: prev[type].filter((o) => o !== object) }));
234
+ notifyAncestors(instance.__ngt__.instanceStore.get('parent'));
235
+ },
236
+ setNativeProps: (key, value) => {
237
+ instance.__ngt__.instanceStore.set((prev) => ({ nativeProps: { ...prev.nativeProps, [key]: value } }));
238
+ },
239
+ setParent: (parent) => {
240
+ instance.__ngt__.instanceStore.set({ parent });
234
241
  },
235
242
  ...rest,
236
243
  };
@@ -241,11 +248,10 @@ function notifyAncestors(instance) {
241
248
  if (!instance)
242
249
  return;
243
250
  const localState = getLocalState(instance);
244
- if (localState.objects)
245
- localState.objects.update((prev) => prev);
246
- if (localState.nonObjects)
247
- localState.nonObjects.update((prev) => prev);
248
- notifyAncestors(localState.parent());
251
+ if (localState.instanceStore) {
252
+ localState.instanceStore.set((prev) => ({ objects: prev.objects, nonObjects: prev.nonObjects }));
253
+ notifyAncestors(localState.instanceStore.get('parent'));
254
+ }
249
255
  }
250
256
 
251
257
  // This function prepares a set of changes to be applied to the instance
@@ -273,8 +279,7 @@ function applyProps(instance, props) {
273
279
  // if props is empty
274
280
  if (!Object.keys(props).length)
275
281
  return instance;
276
- // Filter equals, events and reserved props
277
- // filter equals, events , and reserved props
282
+ // filter equals, and reserved props
278
283
  const localState = getLocalState(instance);
279
284
  const rootState = localState.store?.get();
280
285
  const changes = diffProps(instance, props);
@@ -353,9 +358,9 @@ function applyProps(instance, props) {
353
358
  checkUpdate(targetProp);
354
359
  invalidateInstance(instance);
355
360
  }
356
- const instanceHandlers = localState.eventCount;
357
- const parent = localState.parent ? untracked(localState.parent) : null;
358
- if (parent && rootState.internal && instance['raycast'] && instanceHandlers !== localState.eventCount) {
361
+ const instanceHandlersCount = localState.eventCount;
362
+ const parent = localState.instanceStore?.get('parent');
363
+ if (parent && rootState.internal && instance['raycast'] && instanceHandlersCount !== localState.eventCount) {
359
364
  // Pre-emptively remove the instance from the interaction manager
360
365
  const index = rootState.internal.interaction.indexOf(instance);
361
366
  if (index > -1)
@@ -422,8 +427,8 @@ function makeObjectGraph(object) {
422
427
  const shallowLoose = { objects: 'shallow', strict: false };
423
428
  const roots = new Map();
424
429
  function injectCanvasRootInitializer(injector) {
425
- injector = assertInjector(injectCanvasRootInitializer, injector);
426
- return runInInjectionContext(injector, () => {
430
+ return assertInjector(injectCanvasRootInitializer, injector, () => {
431
+ const assertedInjector = inject(Injector);
427
432
  const injectedStore = injectNgtStore();
428
433
  const loop = injectNgtLoop();
429
434
  const destroyRef = inject(DestroyRef);
@@ -633,8 +638,13 @@ function injectCanvasRootInitializer(injector) {
633
638
  if (state.frameloop !== frameloop)
634
639
  state.setFrameloop(frameloop);
635
640
  isConfigured = true;
636
- invalidateRef?.destroy();
637
- invalidateRef = effect(() => void store.state().invalidate(), { manualCleanup: true, injector });
641
+ queueMicrotask(() => {
642
+ invalidateRef?.destroy();
643
+ invalidateRef = effect(() => void store.state().invalidate(), {
644
+ manualCleanup: true,
645
+ injector: assertedInjector,
646
+ });
647
+ });
638
648
  },
639
649
  };
640
650
  };
@@ -1008,8 +1018,7 @@ const [injectNgtStore, provideNgtStore] = createInjectionToken(storeFactory, {
1008
1018
  });
1009
1019
 
1010
1020
  function injectBeforeRender(cb, { priority = 0, injector } = {}) {
1011
- injector = assertInjector(injectBeforeRender, injector);
1012
- return runInInjectionContext(injector, () => {
1021
+ return assertInjector(injectBeforeRender, injector, () => {
1013
1022
  const store = injectNgtStore();
1014
1023
  const sub = store.get('internal').subscribe(cb, priority, store);
1015
1024
  inject(DestroyRef).onDestroy(() => void sub());
@@ -1464,8 +1473,9 @@ function load(loaderConstructorFactory, inputs, { extensions, onProgress, } = {}
1464
1473
  if (!cached.has(url)) {
1465
1474
  cached.set(url, new Promise((resolve, reject) => {
1466
1475
  loader.load(url, (data) => {
1467
- if ('scene' in data)
1476
+ if ('scene' in data) {
1468
1477
  Object.assign(data, makeObjectGraph(data['scene']));
1478
+ }
1469
1479
  resolve(data);
1470
1480
  }, onProgress, (error) => reject(new Error(`[NGT] Could not load ${url}: ${error}`)));
1471
1481
  }));
@@ -1475,9 +1485,8 @@ function load(loaderConstructorFactory, inputs, { extensions, onProgress, } = {}
1475
1485
  };
1476
1486
  }
1477
1487
  function _injectNgtLoader(loaderConstructorFactory, inputs, { extensions, onProgress, injector, } = {}) {
1478
- injector = assertInjector(_injectNgtLoader, injector);
1479
- const response = signal(null);
1480
- return runInInjectionContext(injector, () => {
1488
+ return assertInjector(_injectNgtLoader, injector, () => {
1489
+ const response = signal(null);
1481
1490
  const cdr = inject(ChangeDetectorRef);
1482
1491
  const effector = load(loaderConstructorFactory, inputs, { extensions, onProgress });
1483
1492
  effect(() => {
@@ -1565,10 +1574,10 @@ class NgtCommonDirective {
1565
1574
  }
1566
1575
  });
1567
1576
  }
1568
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtCommonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1569
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.3", type: NgtCommonDirective, ngImport: i0 }); }
1577
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtCommonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1578
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.9", type: NgtCommonDirective, ngImport: i0 }); }
1570
1579
  }
1571
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtCommonDirective, decorators: [{
1580
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtCommonDirective, decorators: [{
1572
1581
  type: Directive
1573
1582
  }], ctorParameters: function () { return []; } });
1574
1583
 
@@ -1594,10 +1603,10 @@ class NgtArgs extends NgtCommonDirective {
1594
1603
  validate() {
1595
1604
  return !this.injected && !!this.injectedArgs.length;
1596
1605
  }
1597
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtArgs, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
1598
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.3", type: NgtArgs, isStandalone: true, selector: "ng-template[args]", inputs: { args: "args" }, usesInheritance: true, ngImport: i0 }); }
1606
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtArgs, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
1607
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.9", type: NgtArgs, isStandalone: true, selector: "ng-template[args]", inputs: { args: "args" }, usesInheritance: true, ngImport: i0 }); }
1599
1608
  }
1600
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtArgs, decorators: [{
1609
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtArgs, decorators: [{
1601
1610
  type: Directive,
1602
1611
  args: [{ selector: 'ng-template[args]', standalone: true }]
1603
1612
  }], propDecorators: { args: [{
@@ -1626,10 +1635,10 @@ class NgtParent extends NgtCommonDirective {
1626
1635
  validate() {
1627
1636
  return !this.injected && !!this.injectedParent;
1628
1637
  }
1629
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtParent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
1630
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.3", type: NgtParent, isStandalone: true, selector: "ng-template[parent]", inputs: { parent: "parent" }, usesInheritance: true, ngImport: i0 }); }
1638
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtParent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
1639
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.9", type: NgtParent, isStandalone: true, selector: "ng-template[parent]", inputs: { parent: "parent" }, usesInheritance: true, ngImport: i0 }); }
1631
1640
  }
1632
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtParent, decorators: [{
1641
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtParent, decorators: [{
1633
1642
  type: Directive,
1634
1643
  args: [{ selector: 'ng-template[parent]', standalone: true }]
1635
1644
  }], propDecorators: { parent: [{
@@ -1734,10 +1743,8 @@ function attachThreeChild(parent, child) {
1734
1743
  }
1735
1744
  // attach
1736
1745
  if (cLS.isRaw) {
1737
- if (cLS.parent && cLS.parent() !== parent) {
1738
- untracked(() => {
1739
- cLS.parent.set(parent);
1740
- });
1746
+ if (cLS.instanceStore.get('parent') !== parent) {
1747
+ cLS.setParent(parent);
1741
1748
  }
1742
1749
  // at this point we don't have rawValue yet, so we bail and wait until the Renderer recalls attach
1743
1750
  if (child.__ngt_renderer__[NgtRendererClassId.rawValue] === undefined)
@@ -1756,10 +1763,8 @@ function attachThreeChild(parent, child) {
1756
1763
  added = true;
1757
1764
  }
1758
1765
  pLS.add(child, added ? 'objects' : 'nonObjects');
1759
- if (cLS.parent && cLS.parent() !== parent) {
1760
- untracked(() => {
1761
- cLS.parent.set(parent);
1762
- });
1766
+ if (cLS.instanceStore.get('parent') !== parent) {
1767
+ cLS.setParent(parent);
1763
1768
  }
1764
1769
  if (cLS.afterAttach)
1765
1770
  cLS.afterAttach.emit({ parent, node: child });
@@ -1770,14 +1775,10 @@ function removeThreeChild(parent, child, dispose) {
1770
1775
  const pLS = getLocalState(parent);
1771
1776
  const cLS = getLocalState(child);
1772
1777
  // clear parent ref
1773
- untracked(() => {
1774
- cLS.parent?.set(null);
1775
- });
1778
+ cLS.setParent?.(null);
1776
1779
  // remove child from parent
1777
- if (pLS.objects && untracked(pLS.objects))
1778
- pLS.remove(child, 'objects');
1779
- if (pLS.nonObjects && untracked(pLS.nonObjects))
1780
- pLS.remove(child, 'nonObjects');
1780
+ pLS.remove?.(child, 'objects');
1781
+ pLS.remove?.(child, 'nonObjects');
1781
1782
  if (cLS.attach) {
1782
1783
  detach(parent, child, cLS.attach);
1783
1784
  }
@@ -1787,7 +1788,7 @@ function removeThreeChild(parent, child, dispose) {
1787
1788
  }
1788
1789
  const isPrimitive = cLS.primitive;
1789
1790
  if (!isPrimitive) {
1790
- removeThreeRecursive(cLS.objects ? untracked(cLS.objects) : [], child, !!dispose);
1791
+ removeThreeRecursive(cLS.instanceStore?.get('objects') || [], child, !!dispose);
1791
1792
  removeThreeRecursive(child.children, child, !!dispose);
1792
1793
  }
1793
1794
  // dispose
@@ -2027,7 +2028,7 @@ class NgtRendererStore {
2027
2028
  value.nativeElement = node;
2028
2029
  return;
2029
2030
  }
2030
- const parent = getLocalState(node).parent() || rS[NgtRendererClassId.parent];
2031
+ const parent = getLocalState(node)?.instanceStore.get('parent') || rS[NgtRendererClassId.parent];
2031
2032
  // [rawValue]
2032
2033
  if (getLocalState(node).isRaw && name === SPECIAL_PROPERTIES.VALUE) {
2033
2034
  rS[NgtRendererClassId.rawValue] = value;
@@ -2116,11 +2117,9 @@ class NgtRendererStore {
2116
2117
  rS[NgtRendererClassId.compound] = undefined;
2117
2118
  rS[NgtRendererClassId.compoundParent] = undefined;
2118
2119
  const localState = getLocalState(node);
2119
- if (localState.objects) {
2120
- untracked(localState.objects).forEach((obj) => this.destroy(obj, parent));
2121
- }
2122
- if (localState.nonObjects) {
2123
- untracked(localState.nonObjects).forEach((obj) => this.destroy(obj, parent));
2120
+ if (localState.instanceStore) {
2121
+ localState.instanceStore.get('objects').forEach((obj) => this.destroy(obj, parent));
2122
+ localState.instanceStore.get('nonObjects').forEach((obj) => this.destroy(obj, parent));
2124
2123
  }
2125
2124
  if (localState.afterUpdate)
2126
2125
  localState.afterUpdate.complete();
@@ -2190,9 +2189,9 @@ class NgtRendererStore {
2190
2189
  }
2191
2190
  updateNativeProps(node, key, value) {
2192
2191
  const localState = getLocalState(node);
2193
- if (!localState || !localState.nativeProps)
2194
- return;
2195
- localState.nativeProps.set({ [key]: value });
2192
+ if (localState.instanceStore) {
2193
+ localState.setNativeProps(key, value);
2194
+ }
2196
2195
  }
2197
2196
  firstNonInjectedDirective(dir) {
2198
2197
  let directive;
@@ -2292,10 +2291,10 @@ class NgtRendererFactory {
2292
2291
  }
2293
2292
  return renderer;
2294
2293
  }
2295
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtRendererFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2296
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtRendererFactory }); }
2294
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtRendererFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2295
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtRendererFactory }); }
2297
2296
  }
2298
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtRendererFactory, decorators: [{
2297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtRendererFactory, decorators: [{
2299
2298
  type: Injectable
2300
2299
  }] });
2301
2300
  /**
@@ -2461,7 +2460,7 @@ class NgtRenderer {
2461
2460
  // if both are three instances, straightforward case
2462
2461
  if (pRS[NgtRendererClassId.type] === 'three' && cRS?.[NgtRendererClassId.type] === 'three') {
2463
2462
  // if child already attached to a parent, skip
2464
- if (getLocalState(newChild).parent && untracked(getLocalState(newChild).parent))
2463
+ if (getLocalState(newChild).instanceStore?.get('parent'))
2465
2464
  return;
2466
2465
  // attach THREE child
2467
2466
  attachThreeChild(parent, newChild);
@@ -2596,7 +2595,13 @@ class NgtRenderer {
2596
2595
  // if the target doesn't have __ngt_renderer__, we delegate
2597
2596
  // if target is DOM node, then we pass that to delegate Renderer
2598
2597
  if (!rS || this.store.isDOM(target)) {
2599
- return this.delegate.listen(target, eventName, callback);
2598
+ const targetCdr = getDebugNode(target)?.injector.get(ChangeDetectorRef, null);
2599
+ const updatedCallback = (event) => {
2600
+ const callbackValue = callback(event);
2601
+ safeDetectChanges(targetCdr || this.cdr);
2602
+ return callbackValue;
2603
+ };
2604
+ return this.delegate.listen(target, eventName, updatedCallback);
2600
2605
  }
2601
2606
  if (rS[NgtRendererClassId.type] === 'three' ||
2602
2607
  (rS[NgtRendererClassId.type] === 'compound' && rS[NgtRendererClassId.compounded])) {
@@ -2633,7 +2638,7 @@ class NgtRenderer {
2633
2638
  const isParentCompounded = pRS[NgtRendererClassId.compounded];
2634
2639
  const isChildCompounded = cRS[NgtRendererClassId.compounded];
2635
2640
  // if child is three but haven't been attached to a parent yet
2636
- const isDanglingThreeChild = cType === 'three' && !untracked(getLocalState(child).parent);
2641
+ const isDanglingThreeChild = cType === 'three' && !getLocalState(child).instanceStore?.get('parent');
2637
2642
  // or both parent and child are DOM elements
2638
2643
  // or they are compound AND haven't had a THREE instance yet
2639
2644
  const isParentStillDOM = pType === 'dom' || (pType === 'compound' && !isParentCompounded);
@@ -2755,7 +2760,6 @@ class NgtCanvas {
2755
2760
  if (result.width > 0 && result.height > 0) {
2756
2761
  this.resizeEffectRef?.destroy();
2757
2762
  const inputs = this.inputs.select();
2758
- // NOTE: go back into zone so that effect runs
2759
2763
  // TODO: Double-check when effect is made not depended on zone
2760
2764
  this.resizeEffectRef = this.zone.run(() => effect(() => {
2761
2765
  this.zone.runOutsideAngular(() => {
@@ -2763,7 +2767,7 @@ class NgtCanvas {
2763
2767
  this.configurator = this.initRoot(this.glCanvas.nativeElement);
2764
2768
  this.configurator.configure({ ...inputs(), size: result });
2765
2769
  if (this.glRef) {
2766
- this.cdr.detectChanges();
2770
+ safeDetectChanges(this.cdr);
2767
2771
  }
2768
2772
  else {
2769
2773
  this.render();
@@ -2772,13 +2776,13 @@ class NgtCanvas {
2772
2776
  }, { manualCleanup: true, injector: this.injector }));
2773
2777
  }
2774
2778
  }
2779
+ // NOTE: render outside of zone
2775
2780
  render() {
2776
2781
  this.glEnvironmentInjector?.destroy();
2777
2782
  this.glRef?.destroy();
2778
2783
  // Flag the canvas active, rendering will now begin
2779
2784
  this.store.set((state) => ({ internal: { ...state.internal, active: true } }));
2780
- const inputs = this.inputs.get();
2781
- const state = this.store.get();
2785
+ const [inputs, state] = [this.inputs.get(), this.store.get()];
2782
2786
  // connect to event source
2783
2787
  state.events.connect?.(inputs.eventSource
2784
2788
  ? is.ref(inputs.eventSource)
@@ -2789,11 +2793,11 @@ class NgtCanvas {
2789
2793
  if (inputs.eventPrefix) {
2790
2794
  state.setEvents({
2791
2795
  compute: (event, store) => {
2792
- const innerState = store.get();
2796
+ const { pointer, raycaster, camera, size } = store.get();
2793
2797
  const x = event[(inputs.eventPrefix + 'X')];
2794
2798
  const y = event[(inputs.eventPrefix + 'Y')];
2795
- innerState.pointer.set((x / innerState.size.width) * 2 - 1, -(y / innerState.size.height) * 2 + 1);
2796
- innerState.raycaster.setFromCamera(innerState.pointer, innerState.camera);
2799
+ pointer.set((x / size.width) * 2 - 1, -(y / size.height) * 2 + 1);
2800
+ raycaster.setFromCamera(pointer, camera);
2797
2801
  },
2798
2802
  });
2799
2803
  }
@@ -2819,7 +2823,7 @@ class NgtCanvas {
2819
2823
  const originalDetectChanges = this.cdr.detectChanges.bind(this.cdr);
2820
2824
  this.cdr.detectChanges = () => {
2821
2825
  originalDetectChanges();
2822
- safeDetectChanges(this.glRef?.changeDetectorRef);
2826
+ this.glRef && safeDetectChanges(this.glRef.changeDetectorRef);
2823
2827
  };
2824
2828
  }
2825
2829
  setSceneGraphInputs() {
@@ -2828,12 +2832,12 @@ class NgtCanvas {
2828
2832
  for (const [key, value] of Object.entries(this.sceneGraphInputs)) {
2829
2833
  this.glRef.setInput(key, value);
2830
2834
  }
2831
- this.glRef.changeDetectorRef.detectChanges();
2835
+ safeDetectChanges(this.glRef.changeDetectorRef);
2832
2836
  }
2833
2837
  });
2834
2838
  }
2835
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtCanvas, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2836
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtCanvas, isStandalone: true, selector: "ngt-canvas", inputs: { sceneGraph: "sceneGraph", sceneGraphInputs: "sceneGraphInputs", compoundPrefixes: "compoundPrefixes", linear: "linear", legacy: "legacy", flat: "flat", orthographic: "orthographic", frameloop: "frameloop", dpr: "dpr", raycaster: "raycaster", shadows: "shadows", camera: "camera", scene: "scene", gl: "gl", eventSource: "eventSource", eventPrefix: "eventPrefix", lookAt: "lookAt", performance: "performance" }, outputs: { created: "created" }, host: { properties: { "style.pointerEvents": "hbPointerEvents()" }, styleAttribute: "display: block;position: relative;width: 100%;height: 100%;overflow: hidden;" }, providers: [
2839
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtCanvas, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2840
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: NgtCanvas, isStandalone: true, selector: "ngt-canvas", inputs: { sceneGraph: "sceneGraph", sceneGraphInputs: "sceneGraphInputs", compoundPrefixes: "compoundPrefixes", linear: "linear", legacy: "legacy", flat: "flat", orthographic: "orthographic", frameloop: "frameloop", dpr: "dpr", raycaster: "raycaster", shadows: "shadows", camera: "camera", scene: "scene", gl: "gl", eventSource: "eventSource", eventPrefix: "eventPrefix", lookAt: "lookAt", performance: "performance" }, outputs: { created: "created" }, host: { properties: { "style.pointerEvents": "hbPointerEvents()" }, styleAttribute: "display: block;position: relative;width: 100%;height: 100%;overflow: hidden;" }, providers: [
2837
2841
  provideResizeOptions({ emitInZone: false, emitInitialResult: true }),
2838
2842
  provideNgtStore(),
2839
2843
  ], viewQueries: [{ propertyName: "glCanvas", first: true, predicate: ["glCanvas"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `
@@ -2842,7 +2846,7 @@ class NgtCanvas {
2842
2846
  </div>
2843
2847
  `, isInline: true, dependencies: [{ kind: "directive", type: NgxResize, selector: "[ngxResize]", inputs: ["ngxResizeOptions"], outputs: ["ngxResize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2844
2848
  }
2845
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtCanvas, decorators: [{
2849
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtCanvas, decorators: [{
2846
2850
  type: Component,
2847
2851
  args: [{
2848
2852
  selector: 'ngt-canvas',
@@ -2923,10 +2927,10 @@ class NgtKey extends NgtCommonDirective {
2923
2927
  this.createView();
2924
2928
  }
2925
2929
  }
2926
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtKey, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
2927
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.3", type: NgtKey, isStandalone: true, selector: "ng-template[key]", inputs: { key: "key" }, usesInheritance: true, ngImport: i0 }); }
2930
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtKey, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
2931
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.9", type: NgtKey, isStandalone: true, selector: "ng-template[key]", inputs: { key: "key" }, usesInheritance: true, ngImport: i0 }); }
2928
2932
  }
2929
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtKey, decorators: [{
2933
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtKey, decorators: [{
2930
2934
  type: Directive,
2931
2935
  args: [{ selector: 'ng-template[key]', standalone: true }]
2932
2936
  }], propDecorators: { key: [{
@@ -2934,12 +2938,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
2934
2938
  }] } });
2935
2939
 
2936
2940
  function injectNgtRef(initial = null, injector) {
2937
- injector = assertInjector(injectNgtRef, injector);
2938
- const ref = is.ref(initial) ? initial : new ElementRef(initial);
2939
- const refSignal = signal(ref.nativeElement);
2940
- const readonlyRef = refSignal.asReadonly();
2941
- const computedCached = new Map();
2942
- return runInInjectionContext(injector, () => {
2941
+ return assertInjector(injectNgtRef, injector, () => {
2942
+ const ref = is.ref(initial) ? initial : new ElementRef(initial);
2943
+ const refSignal = signal(ref.nativeElement);
2944
+ const readonlyRef = refSignal.asReadonly();
2945
+ const computedCached = new Map();
2943
2946
  inject(DestroyRef).onDestroy(() => void computedCached.clear());
2944
2947
  const children = (type = 'objects') => {
2945
2948
  if (!computedCached.has(type)) {
@@ -2948,13 +2951,17 @@ function injectNgtRef(initial = null, injector) {
2948
2951
  if (!instance)
2949
2952
  return [];
2950
2953
  const localState = getLocalState(instance);
2951
- if (!localState.objects || !localState.nonObjects)
2954
+ if (!localState.instanceStore)
2952
2955
  return [];
2956
+ const [objects, nonObjects] = [
2957
+ localState.instanceStore.select('objects'),
2958
+ localState.instanceStore.select('nonObjects'),
2959
+ ];
2953
2960
  if (type === 'objects')
2954
- return localState.objects();
2961
+ return objects();
2955
2962
  if (type === 'nonObjects')
2956
- return localState.nonObjects();
2957
- return [...localState.objects(), ...localState.nonObjects()];
2963
+ return nonObjects();
2964
+ return [...objects(), ...nonObjects()];
2958
2965
  }));
2959
2966
  }
2960
2967
  return computedCached.get(type);
@@ -2970,7 +2977,6 @@ function injectNgtRef(initial = null, injector) {
2970
2977
  },
2971
2978
  get: readonlyRef,
2972
2979
  },
2973
- untracked: { get: () => untracked(readonlyRef) },
2974
2980
  children: { get: () => children },
2975
2981
  });
2976
2982
  return ref;
@@ -2995,12 +3001,10 @@ class NgtPortalBeforeRender {
2995
3001
  this.portalStore = injectNgtStore();
2996
3002
  this.injector = inject(Injector);
2997
3003
  this.renderPriority = 1;
2998
- this.beforeRender = new EventEmitter();
2999
3004
  }
3000
3005
  ngOnInit() {
3001
3006
  let oldClear;
3002
- injectBeforeRender(({ delta, frame }) => {
3003
- this.beforeRender.emit({ ...this.portalStore.get(), delta, frame });
3007
+ injectBeforeRender(() => {
3004
3008
  const { gl, scene, camera } = this.portalStore.get();
3005
3009
  oldClear = gl.autoClear;
3006
3010
  if (this.renderPriority === 1) {
@@ -3016,12 +3020,26 @@ class NgtPortalBeforeRender {
3016
3020
  gl.autoClear = oldClear;
3017
3021
  }, { priority: this.renderPriority, injector: this.injector });
3018
3022
  }
3019
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtPortalBeforeRender, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3020
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.3", type: NgtPortalBeforeRender, isStandalone: true, selector: "[ngtPortalBeforeRender]", inputs: { renderPriority: "renderPriority", parentScene: "parentScene", parentCamera: "parentCamera" }, outputs: { beforeRender: "beforeRender" }, ngImport: i0 }); }
3023
+ onPointerOver() {
3024
+ /* noop */
3025
+ }
3026
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtPortalBeforeRender, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3027
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: NgtPortalBeforeRender, isStandalone: true, selector: "ngt-portal-before-render", inputs: { renderPriority: "renderPriority", parentScene: "parentScene", parentCamera: "parentCamera" }, ngImport: i0, template: `
3028
+ <!-- Without an element that receives pointer events state.pointer will always be 0/0 -->
3029
+ <ngt-group (pointerover)="onPointerOver()" />
3030
+ `, isInline: true }); }
3021
3031
  }
3022
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtPortalBeforeRender, decorators: [{
3023
- type: Directive,
3024
- args: [{ selector: '[ngtPortalBeforeRender]', standalone: true }]
3032
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtPortalBeforeRender, decorators: [{
3033
+ type: Component,
3034
+ args: [{
3035
+ selector: 'ngt-portal-before-render',
3036
+ standalone: true,
3037
+ template: `
3038
+ <!-- Without an element that receives pointer events state.pointer will always be 0/0 -->
3039
+ <ngt-group (pointerover)="onPointerOver()" />
3040
+ `,
3041
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
3042
+ }]
3025
3043
  }], propDecorators: { renderPriority: [{
3026
3044
  type: Input
3027
3045
  }], parentScene: [{
@@ -3030,8 +3048,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
3030
3048
  }], parentCamera: [{
3031
3049
  type: Input,
3032
3050
  args: [{ required: true }]
3033
- }], beforeRender: [{
3034
- type: Output
3035
3051
  }] } });
3036
3052
  class NgtPortalContent {
3037
3053
  constructor(vcr, parentVcr) {
@@ -3041,10 +3057,10 @@ class NgtPortalContent {
3041
3057
  delete commentNode[SPECIAL_INTERNAL_ADD_COMMENT];
3042
3058
  }
3043
3059
  }
3044
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtPortalContent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ViewContainerRef, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive }); }
3045
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.3", type: NgtPortalContent, isStandalone: true, selector: "ng-template[ngtPortalContent]", ngImport: i0 }); }
3060
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtPortalContent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ViewContainerRef, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive }); }
3061
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.9", type: NgtPortalContent, isStandalone: true, selector: "ng-template[ngtPortalContent]", ngImport: i0 }); }
3046
3062
  }
3047
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtPortalContent, decorators: [{
3063
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtPortalContent, decorators: [{
3048
3064
  type: Directive,
3049
3065
  args: [{ selector: 'ng-template[ngtPortalContent]', standalone: true }]
3050
3066
  }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ViewContainerRef, decorators: [{
@@ -3061,7 +3077,6 @@ class NgtPortal {
3061
3077
  this.inputs = signalStore({ container: injectNgtRef(prepare(new THREE.Scene())) });
3062
3078
  this.autoRender = true;
3063
3079
  this.autoRenderPriority = 1;
3064
- this.beforeRender = new EventEmitter();
3065
3080
  this.parentStore = injectNgtStore({ skipSelf: true });
3066
3081
  this.parentScene = this.parentStore.get('scene');
3067
3082
  this.parentCamera = this.parentStore.get('camera');
@@ -3118,12 +3133,6 @@ class NgtPortal {
3118
3133
  safeDetectChanges(this.portalContentView);
3119
3134
  this.portalContentRendered = true;
3120
3135
  }
3121
- onBeforeRender(portal) {
3122
- this.beforeRender.emit({
3123
- root: { ...this.parentStore.get(), delta: portal.delta, frame: portal.frame },
3124
- portal,
3125
- });
3126
- }
3127
3136
  inject(rootState, injectState) {
3128
3137
  const intersect = { ...rootState };
3129
3138
  Object.keys(intersect).forEach((key) => {
@@ -3153,39 +3162,35 @@ class NgtPortal {
3153
3162
  ...restInputsState,
3154
3163
  };
3155
3164
  }
3156
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtPortal, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3157
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtPortal, isStandalone: true, selector: "ngt-portal", inputs: { container: "container", portalState: ["state", "portalState"], autoRender: "autoRender", autoRenderPriority: "autoRenderPriority" }, outputs: { beforeRender: "beforeRender" }, providers: [{ provide: NGT_STORE, useFactory: () => signalStore({}) }], queries: [{ propertyName: "portalContentTemplate", first: true, predicate: NgtPortalContent, descendants: true, read: TemplateRef, static: true }], viewQueries: [{ propertyName: "portalContentAnchor", first: true, predicate: ["portalContentAnchor"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: `
3165
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtPortal, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3166
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: NgtPortal, isStandalone: true, selector: "ngt-portal", inputs: { container: "container", portalState: ["state", "portalState"], autoRender: "autoRender", autoRenderPriority: "autoRenderPriority" }, providers: [provideNgtStore(signalStore({}))], queries: [{ propertyName: "portalContentTemplate", first: true, predicate: NgtPortalContent, descendants: true, read: TemplateRef, static: true }], viewQueries: [{ propertyName: "portalContentAnchor", first: true, predicate: ["portalContentAnchor"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: `
3158
3167
  <ng-container #portalContentAnchor>
3159
- <ng-container
3168
+ <ngt-portal-before-render
3160
3169
  *ngIf="autoRender && portalContentRendered"
3161
- ngtPortalBeforeRender
3162
3170
  [renderPriority]="autoRenderPriority"
3163
3171
  [parentScene]="parentScene"
3164
3172
  [parentCamera]="parentCamera"
3165
- (beforeRender)="onBeforeRender($event)"
3166
3173
  />
3167
3174
  </ng-container>
3168
- `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgtPortalBeforeRender, selector: "[ngtPortalBeforeRender]", inputs: ["renderPriority", "parentScene", "parentCamera"], outputs: ["beforeRender"] }] }); }
3175
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: NgtPortalBeforeRender, selector: "ngt-portal-before-render", inputs: ["renderPriority", "parentScene", "parentCamera"] }] }); }
3169
3176
  }
3170
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtPortal, decorators: [{
3177
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtPortal, decorators: [{
3171
3178
  type: Component,
3172
3179
  args: [{
3173
3180
  selector: 'ngt-portal',
3174
3181
  standalone: true,
3175
3182
  template: `
3176
3183
  <ng-container #portalContentAnchor>
3177
- <ng-container
3184
+ <ngt-portal-before-render
3178
3185
  *ngIf="autoRender && portalContentRendered"
3179
- ngtPortalBeforeRender
3180
3186
  [renderPriority]="autoRenderPriority"
3181
3187
  [parentScene]="parentScene"
3182
3188
  [parentCamera]="parentCamera"
3183
- (beforeRender)="onBeforeRender($event)"
3184
3189
  />
3185
3190
  </ng-container>
3186
3191
  `,
3187
3192
  imports: [NgIf, NgtPortalBeforeRender],
3188
- providers: [{ provide: NGT_STORE, useFactory: () => signalStore({}) }],
3193
+ providers: [provideNgtStore(signalStore({}))],
3189
3194
  }]
3190
3195
  }], ctorParameters: function () { return []; }, propDecorators: { container: [{
3191
3196
  type: Input
@@ -3196,8 +3201,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
3196
3201
  type: Input
3197
3202
  }], autoRenderPriority: [{
3198
3203
  type: Input
3199
- }], beforeRender: [{
3200
- type: Output
3201
3204
  }], portalContentTemplate: [{
3202
3205
  type: ContentChild,
3203
3206
  args: [NgtPortalContent, { read: TemplateRef, static: true }]
@@ -3215,12 +3218,12 @@ class NgtRoutedScene {
3215
3218
  .pipe(filter((event) => event instanceof ActivationEnd), takeUntilDestroyed())
3216
3219
  .subscribe(() => safeDetectChanges(cdr));
3217
3220
  }
3218
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtRoutedScene, deps: [{ token: i1.Router }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
3219
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtRoutedScene, isStandalone: true, selector: "ngt-routed-scene", ngImport: i0, template: `
3221
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtRoutedScene, deps: [{ token: i1.Router }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
3222
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: NgtRoutedScene, isStandalone: true, selector: "ngt-routed-scene", ngImport: i0, template: `
3220
3223
  <router-outlet />
3221
3224
  `, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
3222
3225
  }
3223
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtRoutedScene, decorators: [{
3226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: NgtRoutedScene, decorators: [{
3224
3227
  type: Component,
3225
3228
  args: [{
3226
3229
  standalone: true,
@@ -3232,9 +3235,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
3232
3235
  }]
3233
3236
  }], ctorParameters: function () { return [{ type: i1.Router }, { type: i0.ChangeDetectorRef }]; } });
3234
3237
 
3238
+ function createApiToken(forwardedObject) {
3239
+ function apiFactory(obj) {
3240
+ return obj.api;
3241
+ }
3242
+ const [injectFn, provideFn] = createInjectionToken(apiFactory, {
3243
+ isRoot: false,
3244
+ deps: [forwardRef(forwardedObject)],
3245
+ });
3246
+ return [injectFn, () => provideFn()];
3247
+ }
3248
+
3235
3249
  /**
3236
3250
  * Generated bundle index. Do not edit.
3237
3251
  */
3238
3252
 
3239
- export { HTML, NGT_STORE, NgtArgs, NgtCanvas, NgtKey, NgtParent, NgtPortal, NgtPortalContent, NgtRoutedScene, addAfterEffect, addEffect, addTail, applyProps, checkNeedsUpdate, checkUpdate, createAttachFunction, diffProps, extend, getLocalState, injectBeforeRender, injectNgtLoader, injectNgtRef, injectNgtStore, invalidateInstance, is, makeDefaultCamera, makeDefaultRenderer, makeDpr, makeId, makeObjectGraph, prepare, provideNgtRenderer, provideNgtStore, safeDetectChanges, signalStore, updateCamera };
3253
+ export { HTML, NGT_STORE, NgtArgs, NgtCanvas, NgtKey, NgtParent, NgtPortal, NgtPortalContent, NgtRoutedScene, addAfterEffect, addEffect, addTail, applyProps, checkNeedsUpdate, checkUpdate, createApiToken, createAttachFunction, diffProps, extend, getLocalState, injectBeforeRender, injectNgtLoader, injectNgtRef, injectNgtStore, invalidateInstance, is, makeDefaultCamera, makeDefaultRenderer, makeDpr, makeId, makeObjectGraph, prepare, provideNgtRenderer, provideNgtStore, safeDetectChanges, signalStore, updateCamera };
3240
3254
  //# sourceMappingURL=angular-three.mjs.map