angular-three-soba 1.5.0 → 1.6.0-beta.0

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 (41) hide show
  1. package/abstractions/lib/line/line.d.ts +4 -4
  2. package/abstractions/lib/text/text.d.ts +1 -1
  3. package/esm2020/abstractions/lib/billboard/billboard.mjs +6 -5
  4. package/esm2020/abstractions/lib/gizmo-helper/gizmo-helper.mjs +6 -6
  5. package/esm2020/abstractions/lib/line/line.mjs +58 -69
  6. package/esm2020/abstractions/lib/text/text.mjs +28 -26
  7. package/esm2020/cameras/lib/orthographic-camera/orthographic-camera.mjs +6 -6
  8. package/esm2020/cameras/lib/perspective-camera/perspective-camera.mjs +6 -6
  9. package/esm2020/performance/lib/detailed/detailed.mjs +6 -5
  10. package/esm2020/staging/lib/accumulative-shadows/accumulative-shadows.mjs +8 -8
  11. package/esm2020/staging/lib/accumulative-shadows/randomized-lights.mjs +6 -6
  12. package/esm2020/staging/lib/bounds/bounds.mjs +6 -5
  13. package/esm2020/staging/lib/center/center.mjs +10 -9
  14. package/esm2020/staging/lib/cloud/cloud.mjs +6 -6
  15. package/esm2020/staging/lib/contact-shadows/contact-shadows.mjs +14 -10
  16. package/esm2020/staging/lib/environment/environment-portal.mjs +10 -6
  17. package/esm2020/staging/lib/float/float.mjs +6 -5
  18. package/esm2020/staging/lib/sky/sky.mjs +23 -22
  19. package/esm2020/staging/lib/sparkles/sparkles.mjs +8 -8
  20. package/esm2020/staging/lib/stage/stage.mjs +2 -5
  21. package/esm2020/staging/lib/stars/stars.mjs +6 -6
  22. package/fesm2015/angular-three-soba-abstractions.mjs +91 -99
  23. package/fesm2015/angular-three-soba-abstractions.mjs.map +1 -1
  24. package/fesm2015/angular-three-soba-cameras.mjs +9 -9
  25. package/fesm2015/angular-three-soba-cameras.mjs.map +1 -1
  26. package/fesm2015/angular-three-soba-performance.mjs +5 -4
  27. package/fesm2015/angular-three-soba-performance.mjs.map +1 -1
  28. package/fesm2015/angular-three-soba-staging.mjs +83 -74
  29. package/fesm2015/angular-three-soba-staging.mjs.map +1 -1
  30. package/fesm2020/angular-three-soba-abstractions.mjs +91 -99
  31. package/fesm2020/angular-three-soba-abstractions.mjs.map +1 -1
  32. package/fesm2020/angular-three-soba-cameras.mjs +9 -9
  33. package/fesm2020/angular-three-soba-cameras.mjs.map +1 -1
  34. package/fesm2020/angular-three-soba-performance.mjs +5 -4
  35. package/fesm2020/angular-three-soba-performance.mjs.map +1 -1
  36. package/fesm2020/angular-three-soba-staging.mjs +83 -74
  37. package/fesm2020/angular-three-soba-staging.mjs.map +1 -1
  38. package/package.json +3 -3
  39. package/plugin/package.json +1 -1
  40. package/staging/lib/sky/sky.d.ts +2 -3
  41. package/staging/lib/stage/stage.d.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Component, CUSTOM_ELEMENTS_SCHEMA, Input, Directive, inject, InjectionToken, EventEmitter, TemplateRef, Output, ContentChild } from '@angular/core';
3
- import { extend, NgtRxStore, injectNgtRef, NgtStore, startWithUndefined, NgtArgs, NgtPortal, NgtPortalContent, NgtRepeat, NgtPush } from 'angular-three';
3
+ import { extend, NgtRxStore, injectNgtRef, NgtRef, NgtStore, startWithUndefined, NgtArgs, NgtPortal, NgtPortalContent, NgtRepeat, NgtPush } from 'angular-three';
4
4
  import * as THREE from 'three';
5
5
  import { Group, CatmullRomCurve3, Vector3, Quaternion, Object3D, Matrix4, Mesh, BoxGeometry, MeshBasicMaterial, MeshLambertMaterial, CanvasTexture, AmbientLight, PointLight, Sprite, SpriteMaterial } from 'three';
6
6
  import { combineLatest, map, switchMap, of } from 'rxjs';
@@ -52,20 +52,21 @@ class NgtsBillboard extends NgtRxStore {
52
52
  }
53
53
  NgtsBillboard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsBillboard, deps: null, target: i0.ɵɵFactoryTarget.Component });
54
54
  NgtsBillboard.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsBillboard, isStandalone: true, selector: "ngts-billboard", inputs: { billboardRef: "billboardRef", follow: "follow", lockX: "lockX", lockY: "lockY", lockZ: "lockZ" }, usesInheritance: true, ngImport: i0, template: `
55
- <ngt-group ngtCompound [ref]="billboardRef" (beforeRender)="onBeforeRender($any($event))">
55
+ <ngt-group ngtCompound *ref="billboardRef" (beforeRender)="onBeforeRender($any($event))">
56
56
  <ng-content />
57
57
  </ngt-group>
58
- `, isInline: true });
58
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtRef, selector: "[ref]", inputs: ["ref"] }] });
59
59
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsBillboard, decorators: [{
60
60
  type: Component,
61
61
  args: [{
62
62
  selector: 'ngts-billboard',
63
63
  standalone: true,
64
64
  template: `
65
- <ngt-group ngtCompound [ref]="billboardRef" (beforeRender)="onBeforeRender($any($event))">
65
+ <ngt-group ngtCompound *ref="billboardRef" (beforeRender)="onBeforeRender($any($event))">
66
66
  <ng-content />
67
67
  </ngt-group>
68
68
  `,
69
+ imports: [NgtRef],
69
70
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
70
71
  }]
71
72
  }], propDecorators: { billboardRef: [{
@@ -158,6 +159,7 @@ class NgtsLine extends NgtsLineInput {
158
159
  this.Boolean = Boolean;
159
160
  this.lineMaterial = new LineMaterial();
160
161
  this.store = inject(NgtStore);
162
+ this.line = null;
161
163
  this.lineRef = injectNgtRef();
162
164
  }
163
165
  set points(points) {
@@ -166,16 +168,8 @@ class NgtsLine extends NgtsLineInput {
166
168
  set segments(segments) {
167
169
  this.set({ segments });
168
170
  }
169
- // TODO: Figure out if this is the case for everything else.
170
- // We'd want to run computeLineDistances on the Line2 on "points" changed
171
- // Consequently,when "points" changes, LineGeometry also changes and that causes
172
- // the Renderer to replace the LineGeometry on the Line2, which is what's happening.
173
- // But the effect that runs line.computeLineDistances() runs a little BEFORE the new lineGeometry
174
- // has been attached. So it doesn't work with the props changed from the Material
175
- //
176
- // Alternatively, we can also run the effect on line#children changes.
177
- onAfterGeometryAttached({ parent }) {
178
- // parent.computeLineDistances();
171
+ onAfterAttach({ parent }) {
172
+ parent.computeLineDistances();
179
173
  }
180
174
  initialize() {
181
175
  super.initialize();
@@ -208,17 +202,9 @@ class NgtsLine extends NgtsLineInput {
208
202
  }
209
203
  ngOnInit() {
210
204
  this.connect('materialResolution', combineLatest([this.store.select('size'), this.select('resolution').pipe(startWithUndefined())]).pipe(map(([size, resolution]) => resolution ?? [size.width, size.height])));
211
- if (!this.lineRef.nativeElement) {
212
- this.lineRef.nativeElement = this.get('segments') ? new LineSegments2() : new Line2();
213
- }
214
- this.computeLineDistances();
205
+ this.line = this.get('segments') ? new LineSegments2() : new Line2();
215
206
  this.disposeGeometry();
216
207
  }
217
- computeLineDistances() {
218
- this.hold(combineLatest([this.lineRef.$, this.lineRef.children$('nonObjects'), this.select('points')]), ([line]) => {
219
- line.computeLineDistances();
220
- });
221
- }
222
208
  disposeGeometry() {
223
209
  this.effect(this.select('lineGeometry'), (lineGeometry) => {
224
210
  return () => lineGeometry.dispose();
@@ -227,61 +213,65 @@ class NgtsLine extends NgtsLineInput {
227
213
  }
228
214
  NgtsLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
229
215
  NgtsLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsLine, isStandalone: true, selector: "ngts-line[points]", inputs: { lineRef: "lineRef", points: "points", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
230
- <ngt-primitive *args="[lineRef.nativeElement]" [ref]="lineRef" ngtCompound>
231
- <ngt-primitive
232
- *args="[get('lineGeometry')]"
233
- attach="geometry"
234
- (afterAttach)="onAfterGeometryAttached($any($event))"
235
- />
236
- <ngt-primitive
237
- *args="[lineMaterial]"
238
- attach="material"
239
- [color]="get('color')"
240
- [vertexColors]="Boolean(get('vertexColors'))"
241
- [resolution]="get('materialResolution')"
242
- [linewidth]="get('lineWidth')"
243
- [alphaToCoverage]="get('alphaToCoverage')"
244
- [dashed]="get('dashed')"
245
- [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
246
- [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
247
- [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
248
- [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
249
- [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
250
- [worldUnits]="get('worldUnits')"
251
- />
252
- </ngt-primitive>
253
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
216
+ <ng-container *args="[line]">
217
+ <ngt-primitive *ref="lineRef" ngtCompound>
218
+ <ngt-primitive
219
+ *args="[get('lineGeometry')]"
220
+ attach="geometry"
221
+ (afterAttach)="onAfterAttach($any($event))"
222
+ />
223
+ <ngt-primitive
224
+ *args="[lineMaterial]"
225
+ attach="material"
226
+ [color]="get('color')"
227
+ [vertexColors]="Boolean(get('vertexColors'))"
228
+ [resolution]="get('materialResolution')"
229
+ [linewidth]="get('lineWidth')"
230
+ [alphaToCoverage]="get('alphaToCoverage')"
231
+ [dashed]="get('dashed')"
232
+ [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
233
+ [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
234
+ [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
235
+ [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
236
+ [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
237
+ [worldUnits]="get('worldUnits')"
238
+ />
239
+ </ngt-primitive>
240
+ </ng-container>
241
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }, { kind: "directive", type: NgtRef, selector: "[ref]", inputs: ["ref"] }] });
254
242
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLine, decorators: [{
255
243
  type: Component,
256
244
  args: [{
257
245
  selector: 'ngts-line[points]',
258
246
  standalone: true,
259
247
  template: `
260
- <ngt-primitive *args="[lineRef.nativeElement]" [ref]="lineRef" ngtCompound>
261
- <ngt-primitive
262
- *args="[get('lineGeometry')]"
263
- attach="geometry"
264
- (afterAttach)="onAfterGeometryAttached($any($event))"
265
- />
266
- <ngt-primitive
267
- *args="[lineMaterial]"
268
- attach="material"
269
- [color]="get('color')"
270
- [vertexColors]="Boolean(get('vertexColors'))"
271
- [resolution]="get('materialResolution')"
272
- [linewidth]="get('lineWidth')"
273
- [alphaToCoverage]="get('alphaToCoverage')"
274
- [dashed]="get('dashed')"
275
- [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
276
- [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
277
- [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
278
- [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
279
- [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
280
- [worldUnits]="get('worldUnits')"
281
- />
282
- </ngt-primitive>
248
+ <ng-container *args="[line]">
249
+ <ngt-primitive *ref="lineRef" ngtCompound>
250
+ <ngt-primitive
251
+ *args="[get('lineGeometry')]"
252
+ attach="geometry"
253
+ (afterAttach)="onAfterAttach($any($event))"
254
+ />
255
+ <ngt-primitive
256
+ *args="[lineMaterial]"
257
+ attach="material"
258
+ [color]="get('color')"
259
+ [vertexColors]="Boolean(get('vertexColors'))"
260
+ [resolution]="get('materialResolution')"
261
+ [linewidth]="get('lineWidth')"
262
+ [alphaToCoverage]="get('alphaToCoverage')"
263
+ [dashed]="get('dashed')"
264
+ [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
265
+ [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
266
+ [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
267
+ [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
268
+ [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
269
+ [worldUnits]="get('worldUnits')"
270
+ />
271
+ </ngt-primitive>
272
+ </ng-container>
283
273
  `,
284
- imports: [NgtArgs],
274
+ imports: [NgtArgs, NgtRef],
285
275
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
286
276
  }]
287
277
  }], propDecorators: { lineRef: [{
@@ -641,7 +631,7 @@ NgtsGizmoHelper.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
641
631
  [position]="[0, 0, 200]"
642
632
  />
643
633
  <ngt-group
644
- [ref]="gizmoRef"
634
+ *ref="gizmoRef"
645
635
  [position]="get('gizmoPosition')"
646
636
  (beforeRender)="onBeforeRender($any($event).state.delta)"
647
637
  >
@@ -649,7 +639,7 @@ NgtsGizmoHelper.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
649
639
  </ngt-group>
650
640
  </ng-template>
651
641
  </ngt-portal>
652
- `, isInline: true, dependencies: [{ kind: "component", type: NgtPortal, selector: "ngt-portal", inputs: ["container", "state", "autoRender", "autoRenderPriority"], outputs: ["beforeRender"] }, { kind: "directive", type: NgtPortalContent, selector: "ng-template[ngtPortalContent]" }, { kind: "component", type: NgtsOrthographicCamera, selector: "ngts-orthographic-camera", inputs: ["left", "right", "top", "bottom"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
642
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtPortal, selector: "ngt-portal", inputs: ["container", "state", "autoRender", "autoRenderPriority"], outputs: ["beforeRender"] }, { kind: "directive", type: NgtPortalContent, selector: "ng-template[ngtPortalContent]" }, { kind: "directive", type: NgtRef, selector: "[ref]", inputs: ["ref"] }, { kind: "component", type: NgtsOrthographicCamera, selector: "ngts-orthographic-camera", inputs: ["left", "right", "top", "bottom"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
653
643
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoHelper, decorators: [{
654
644
  type: Component,
655
645
  args: [{
@@ -664,7 +654,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
664
654
  [position]="[0, 0, 200]"
665
655
  />
666
656
  <ngt-group
667
- [ref]="gizmoRef"
657
+ *ref="gizmoRef"
668
658
  [position]="get('gizmoPosition')"
669
659
  (beforeRender)="onBeforeRender($any($event).state.delta)"
670
660
  >
@@ -673,7 +663,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
673
663
  </ng-template>
674
664
  </ngt-portal>
675
665
  `,
676
- imports: [NgtPortal, NgtPortalContent, NgtsOrthographicCamera, NgTemplateOutlet],
666
+ imports: [NgtPortal, NgtPortalContent, NgtRef, NgtsOrthographicCamera, NgTemplateOutlet],
677
667
  providers: [{ provide: NGTS_GIZMO_HELPER_API, useFactory: gizmoHelperApiFactory, deps: [NgtsGizmoHelper] }],
678
668
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
679
669
  }]
@@ -1878,8 +1868,6 @@ class NgtsText extends NgtRxStore {
1878
1868
  this.set({ anchorX: 'center', anchorY: 'middle', text: '' });
1879
1869
  }
1880
1870
  ngOnInit() {
1881
- if (!this.textRef.nativeElement)
1882
- this.textRef.nativeElement = this.troikaText;
1883
1871
  this.preloadFont();
1884
1872
  this.syncText();
1885
1873
  }
@@ -1906,35 +1894,39 @@ class NgtsText extends NgtRxStore {
1906
1894
  }
1907
1895
  NgtsText.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsText, deps: null, target: i0.ɵɵFactoryTarget.Component });
1908
1896
  NgtsText.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsText, isStandalone: true, selector: "ngts-text[text]", inputs: { textRef: "textRef", text: "text", characters: "characters", font: "font", anchorX: "anchorX", anchorY: "anchorY" }, outputs: { sync: "sync" }, providers: [RxActionFactory], usesInheritance: true, ngImport: i0, template: `
1909
- <ngt-primitive
1910
- ngtCompound
1911
- *args="[textRef.nativeElement]"
1912
- [text]="get('text')"
1913
- [anchorX]="get('anchorX')"
1914
- [anchorY]="get('anchorY')"
1915
- [font]="get('font')"
1916
- >
1917
- <ng-content />
1918
- </ngt-primitive>
1919
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
1897
+ <ng-container *args="[troikaText]">
1898
+ <ngt-primitive
1899
+ ngtCompound
1900
+ *ref="textRef"
1901
+ [text]="get('text')"
1902
+ [anchorX]="get('anchorX')"
1903
+ [anchorY]="get('anchorY')"
1904
+ [font]="get('font')"
1905
+ >
1906
+ <ng-content />
1907
+ </ngt-primitive>
1908
+ </ng-container>
1909
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }, { kind: "directive", type: NgtRef, selector: "[ref]", inputs: ["ref"] }] });
1920
1910
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsText, decorators: [{
1921
1911
  type: Component,
1922
1912
  args: [{
1923
1913
  selector: 'ngts-text[text]',
1924
1914
  standalone: true,
1925
1915
  template: `
1926
- <ngt-primitive
1927
- ngtCompound
1928
- *args="[textRef.nativeElement]"
1929
- [text]="get('text')"
1930
- [anchorX]="get('anchorX')"
1931
- [anchorY]="get('anchorY')"
1932
- [font]="get('font')"
1933
- >
1934
- <ng-content />
1935
- </ngt-primitive>
1916
+ <ng-container *args="[troikaText]">
1917
+ <ngt-primitive
1918
+ ngtCompound
1919
+ *ref="textRef"
1920
+ [text]="get('text')"
1921
+ [anchorX]="get('anchorX')"
1922
+ [anchorY]="get('anchorY')"
1923
+ [font]="get('font')"
1924
+ >
1925
+ <ng-content />
1926
+ </ngt-primitive>
1927
+ </ng-container>
1936
1928
  `,
1937
- imports: [NgtArgs],
1929
+ imports: [NgtArgs, NgtRef],
1938
1930
  providers: [RxActionFactory],
1939
1931
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1940
1932
  }]