angular-three-soba 4.0.0-next.97 → 4.0.0-next.99

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 (66) hide show
  1. package/abstractions/lib/catmull-rom-line.d.ts +88 -88
  2. package/abstractions/lib/edges.d.ts +88 -88
  3. package/abstractions/lib/gradient-texture.d.ts +1 -1
  4. package/abstractions/lib/helper.d.ts +6 -1
  5. package/abstractions/lib/line.d.ts +1 -1
  6. package/abstractions/lib/text-3d.d.ts +1 -1
  7. package/cameras/lib/cube-camera.d.ts +7 -2
  8. package/cameras/lib/orthographic-camera.d.ts +1 -1
  9. package/cameras/lib/perspective-camera.d.ts +1 -1
  10. package/fesm2022/angular-three-soba-abstractions.mjs +16 -11
  11. package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
  12. package/fesm2022/angular-three-soba-cameras.mjs +16 -11
  13. package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
  14. package/fesm2022/angular-three-soba-controls.mjs +7 -7
  15. package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
  16. package/fesm2022/angular-three-soba-gizmos.mjs +10 -10
  17. package/fesm2022/angular-three-soba-gizmos.mjs.map +1 -1
  18. package/fesm2022/angular-three-soba-loaders.mjs +186 -49
  19. package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
  20. package/fesm2022/angular-three-soba-materials.mjs +14 -14
  21. package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
  22. package/fesm2022/angular-three-soba-misc.mjs +68 -52
  23. package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
  24. package/fesm2022/angular-three-soba-performances.mjs +6 -6
  25. package/fesm2022/angular-three-soba-performances.mjs.map +1 -1
  26. package/fesm2022/angular-three-soba-staging.mjs +142 -54
  27. package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
  28. package/gizmos/lib/pivot-controls/axis-arrow.d.ts +1 -1
  29. package/gizmos/lib/pivot-controls/axis-rotator.d.ts +1 -1
  30. package/gizmos/lib/pivot-controls/pivot-controls.d.ts +1 -1
  31. package/gizmos/lib/pivot-controls/plane-slider.d.ts +1 -1
  32. package/gizmos/lib/pivot-controls/scaling-sphere.d.ts +1 -1
  33. package/loaders/index.d.ts +4 -0
  34. package/loaders/lib/fbx-loader.d.ts +9 -1
  35. package/loaders/lib/fbx-resource.d.ts +7 -0
  36. package/loaders/lib/font-loader.d.ts +6 -20
  37. package/loaders/lib/font-resource.d.ts +28 -0
  38. package/loaders/lib/gltf-loader.d.ts +8 -0
  39. package/loaders/lib/gltf-resource.d.ts +32 -0
  40. package/loaders/lib/loader.d.ts +2 -2
  41. package/loaders/lib/progress.d.ts +6 -1
  42. package/loaders/lib/texture-loader.d.ts +8 -0
  43. package/loaders/lib/texture-resource.d.ts +10 -0
  44. package/misc/lib/animations.d.ts +6 -1
  45. package/misc/lib/decal.d.ts +1 -1
  46. package/misc/lib/depth-buffer.d.ts +6 -1
  47. package/misc/lib/fbo.d.ts +7 -2
  48. package/misc/lib/html/html.d.ts +2 -2
  49. package/misc/lib/intersect.d.ts +6 -1
  50. package/misc/lib/sampler.d.ts +1 -1
  51. package/package.json +9 -9
  52. package/staging/index.d.ts +1 -0
  53. package/staging/lib/accumulative-shadows.d.ts +1 -1
  54. package/staging/lib/caustics.d.ts +1 -1
  55. package/staging/lib/center.d.ts +2 -2
  56. package/staging/lib/contact-shadows.d.ts +1 -1
  57. package/staging/lib/environment/environment-resource.d.ts +35 -0
  58. package/staging/lib/environment/environment.d.ts +3 -3
  59. package/staging/lib/environment/inject-environment.d.ts +8 -24
  60. package/staging/lib/lightformer.d.ts +1 -1
  61. package/staging/lib/mask.d.ts +1 -1
  62. package/staging/lib/matcap-texture.d.ts +17 -4
  63. package/staging/lib/normal-texture.d.ts +20 -7
  64. package/staging/lib/sky.d.ts +1 -1
  65. package/staging/lib/spot-light.d.ts +4 -4
  66. package/staging/lib/stage.d.ts +6 -6
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { computed, isSignal, signal, effect, untracked, Directive, input, viewChild, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, inject, DestroyRef, TemplateRef, ViewContainerRef, output, ElementRef, Renderer2, model } from '@angular/core';
3
- import { injectBeforeRender, resolveRef, injectStore, getInstanceState, NgtArgs, omit, pick, extend, is, applyProps, NgtHTML, addEffect, addAfterEffect, checkUpdate } from 'angular-three';
2
+ import { computed, isSignal, inject, DestroyRef, effect, Directive, input, viewChild, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, untracked, TemplateRef, ViewContainerRef, output, ElementRef, Renderer2, signal, model } from '@angular/core';
3
+ import { beforeRender, resolveRef, injectStore, getInstanceState, NgtArgs, omit, pick, extend, is, applyProps, NgtHTML, addEffect, addAfterEffect, checkUpdate } from 'angular-three';
4
4
  import { assertInjector } from 'ngxtension/assert-injector';
5
5
  import * as THREE from 'three';
6
6
  import { REVISION, Mesh, BoxGeometry, MeshNormalMaterial, AxesHelper, Group, PlaneGeometry, ShaderMaterial } from 'three';
@@ -11,10 +11,10 @@ import { NgTemplateOutlet } from '@angular/common';
11
11
  /**
12
12
  * Use afterNextRender
13
13
  */
14
- function injectAnimations(animations, object, { injector } = {}) {
15
- return assertInjector(injectAnimations, injector, () => {
14
+ function animations(animationsFactory, object, { injector } = {}) {
15
+ return assertInjector(animations, injector, () => {
16
16
  const mixer = new THREE.AnimationMixer(null);
17
- injectBeforeRender(({ delta }) => {
17
+ beforeRender(({ delta }) => {
18
18
  if (!mixer.getRoot())
19
19
  return;
20
20
  mixer.update(delta);
@@ -23,19 +23,13 @@ function injectAnimations(animations, object, { injector } = {}) {
23
23
  const actions = {};
24
24
  const clips = [];
25
25
  const names = [];
26
- const actualObject = computed(() => {
27
- if (isSignal(object) || typeof object === 'function') {
28
- return resolveRef(object());
29
- }
30
- return resolveRef(object);
31
- });
32
- const ready = signal(false);
33
- effect((onCleanup) => {
26
+ const actualObject = computed(() => isSignal(object) || typeof object === 'function' ? resolveRef(object()) : resolveRef(object));
27
+ const isReady = computed(() => {
34
28
  const obj = actualObject();
35
29
  if (!obj)
36
- return;
30
+ return false;
37
31
  Object.assign(mixer, { _root: obj });
38
- const maybeAnimationClips = animations();
32
+ const maybeAnimationClips = animationsFactory();
39
33
  if (!maybeAnimationClips)
40
34
  return;
41
35
  const animationClips = Array.isArray(maybeAnimationClips)
@@ -57,25 +51,35 @@ function injectAnimations(animations, object, { injector } = {}) {
57
51
  });
58
52
  }
59
53
  }
60
- if (!untracked(ready)) {
61
- ready.set(true);
62
- }
63
- onCleanup(() => {
64
- // clear cached
65
- cached = {};
66
- // stop all actions
67
- mixer.stopAllAction();
68
- // uncache actions
69
- Object.values(actions).forEach((action) => {
70
- mixer.uncacheAction(action, obj);
71
- });
54
+ return true;
55
+ });
56
+ inject(DestroyRef).onDestroy(() => {
57
+ const obj = actualObject();
58
+ // clear cached
59
+ cached = {};
60
+ // stop all actions
61
+ mixer.stopAllAction();
62
+ // uncache actions
63
+ Object.values(actions).forEach((action) => {
64
+ mixer.uncacheAction(action, obj);
72
65
  });
73
66
  });
74
- const result = { ready, clips, mixer, actions, names };
75
- Object.defineProperty(result, 'isReady', { get: ready });
76
- return result;
67
+ return {
68
+ clips,
69
+ mixer,
70
+ actions,
71
+ names,
72
+ get isReady() {
73
+ return isReady();
74
+ },
75
+ };
77
76
  });
78
77
  }
78
+ /**
79
+ * @deprecated use animations instead. Will be removed in v5.0.0
80
+ * @since v4.0.0
81
+ */
82
+ const injectAnimations = animations;
79
83
 
80
84
  class NgtsBakeShadows {
81
85
  constructor() {
@@ -299,8 +303,8 @@ const setUpdateRange = (attribute, updateRange) => {
299
303
  }
300
304
  };
301
305
 
302
- function injectFBO(params = () => ({}), { injector } = {}) {
303
- return assertInjector(injectFBO, injector, () => {
306
+ function fbo(params = () => ({}), { injector } = {}) {
307
+ return assertInjector(fbo, injector, () => {
304
308
  const store = injectStore();
305
309
  const width = computed(() => {
306
310
  const { width } = params();
@@ -346,22 +350,24 @@ function injectFBO(params = () => ({}), { injector } = {}) {
346
350
  return target;
347
351
  });
348
352
  }
353
+ /**
354
+ * @deprecated use fbo instead. Will be removed in v5.0.0
355
+ * @since v4.0.0
356
+ */
357
+ const injectFBO = fbo;
349
358
  class NgtsFBO {
350
359
  constructor() {
351
360
  this.fbo = input({});
352
361
  this.template = inject(TemplateRef);
353
362
  this.viewContainerRef = inject(ViewContainerRef);
354
- let ref;
355
- const fboTarget = injectFBO(() => {
363
+ const fboTarget = fbo(() => {
356
364
  const { width, height, ...settings } = this.fbo();
357
365
  return { width, height, settings };
358
366
  });
359
- effect(() => {
360
- ref = this.viewContainerRef.createEmbeddedView(this.template, { $implicit: fboTarget });
367
+ effect((onCleanup) => {
368
+ const ref = this.viewContainerRef.createEmbeddedView(this.template, { $implicit: fboTarget });
361
369
  ref.detectChanges();
362
- });
363
- inject(DestroyRef).onDestroy(() => {
364
- ref?.destroy();
370
+ onCleanup(() => void ref.destroy());
365
371
  });
366
372
  }
367
373
  static ngTemplateContextGuard(_, ctx) {
@@ -375,8 +381,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
375
381
  args: [{ selector: 'ng-template[fbo]' }]
376
382
  }], ctorParameters: () => [] });
377
383
 
378
- function injectDepthBuffer(params = () => ({}), { injector } = {}) {
379
- return assertInjector(injectDepthBuffer, injector, () => {
384
+ function depthBuffer(params = () => ({}), { injector } = {}) {
385
+ return assertInjector(depthBuffer, injector, () => {
380
386
  const size = computed(() => params().size || 256);
381
387
  const frames = computed(() => params().frames || Infinity);
382
388
  const store = injectStore();
@@ -388,9 +394,9 @@ function injectDepthBuffer(params = () => ({}), { injector } = {}) {
388
394
  depthTexture.type = THREE.UnsignedShortType;
389
395
  return { depthTexture };
390
396
  });
391
- const depthFBO = injectFBO(() => ({ width: w(), height: h(), settings: depthConfig() }));
397
+ const depthFBO = fbo(() => ({ width: w(), height: h(), settings: depthConfig() }));
392
398
  let count = 0;
393
- injectBeforeRender(({ gl, scene, camera }) => {
399
+ beforeRender(({ gl, scene, camera }) => {
394
400
  if (frames() === Infinity || count < frames()) {
395
401
  gl.setRenderTarget(depthFBO);
396
402
  gl.render(scene, camera);
@@ -401,6 +407,11 @@ function injectDepthBuffer(params = () => ({}), { injector } = {}) {
401
407
  return depthFBO.depthTexture;
402
408
  });
403
409
  }
410
+ /**
411
+ * @deprecated use depthBuffer instead. Will be removed in v5.0.0
412
+ * @since v4.0.0
413
+ */
414
+ const injectDepthBuffer = depthBuffer;
404
415
 
405
416
  const v1 = new THREE.Vector3();
406
417
  const v2 = new THREE.Vector3();
@@ -582,7 +593,7 @@ class NgtsHTMLContent extends NgtHTML {
582
593
  let visible = true;
583
594
  let oldZoom = 0;
584
595
  let oldPosition = [0, 0];
585
- injectBeforeRender(({ camera: rootCamera }) => {
596
+ beforeRender(({ camera: rootCamera }) => {
586
597
  const [hostEl, transformOuterEl, transformInnerEl, group, occlusionMesh, occlusionGeometry, isRaycastOcclusion, { camera, size, viewport, raycaster, scene }, { calculatePosition, eps, zIndexRange, sprite, distanceFactor }, { transform, occlude, scale },] = [
587
598
  this.host.nativeElement,
588
599
  this.transformOuterRef()?.nativeElement,
@@ -717,8 +728,8 @@ class NgtsHTMLContent extends NgtHTML {
717
728
  <div
718
729
  #transformOuter
719
730
  style="position: absolute; top: 0; left: 0; transform-style: preserve-3d; pointer-events: none;"
720
- [style.width.px]="size().width"
721
- [style.height.px]="size().height"
731
+ [style.width.px]="size.width()"
732
+ [style.height.px]="size.height()"
722
733
  >
723
734
  <div #transformInner style="position: absolute" [style.pointer-events]="pointerEvents()">
724
735
  <div #container [class]="containerClass()" [style]="containerStyle()">
@@ -756,8 +767,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
756
767
  <div
757
768
  #transformOuter
758
769
  style="position: absolute; top: 0; left: 0; transform-style: preserve-3d; pointer-events: none;"
759
- [style.width.px]="size().width"
760
- [style.height.px]="size().height"
770
+ [style.width.px]="size.width()"
771
+ [style.height.px]="size.height()"
761
772
  >
762
773
  <div #transformInner style="position: absolute" [style.pointer-events]="pointerEvents()">
763
774
  <div #container [class]="containerClass()" [style]="containerStyle()">
@@ -914,8 +925,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
914
925
  }], ctorParameters: () => [] });
915
926
  const NgtsHTML = [NgtsHTMLImpl, NgtsHTMLContent];
916
927
 
917
- function injectIntersect(object, { injector, source = signal(false) } = {}) {
918
- return assertInjector(injectIntersect, injector, () => {
928
+ function intersect(object, { injector, source = signal(false) } = {}) {
929
+ return assertInjector(intersect, injector, () => {
919
930
  let check = false;
920
931
  let temp = false;
921
932
  effect((onCleanup) => {
@@ -945,11 +956,16 @@ function injectIntersect(object, { injector, source = signal(false) } = {}) {
945
956
  return source.asReadonly();
946
957
  });
947
958
  }
959
+ /**
960
+ * @deprecated Use `intersect` instead. Will be removed in v5.0.0
961
+ * @since v4.0.0
962
+ */
963
+ const injectIntersect = intersect;
948
964
  class NgtsIntersect {
949
965
  constructor() {
950
966
  this.intersect = model(false);
951
967
  const host = inject(ElementRef);
952
- injectIntersect(() => host, { source: this.intersect });
968
+ intersect(() => host, { source: this.intersect });
953
969
  }
954
970
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: NgtsIntersect, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
955
971
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.1", type: NgtsIntersect, isStandalone: true, selector: "[intersect]", inputs: { intersect: { classPropertyName: "intersect", publicName: "intersect", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { intersect: "intersectChange" }, ngImport: i0 }); }
@@ -1165,5 +1181,5 @@ function calculateScaleFactor(point3, radiusPx, camera, size) {
1165
1181
  * Generated bundle index. Do not edit.
1166
1182
  */
1167
1183
 
1168
- export { NgtsBakeShadows, NgtsComputedAttribute, NgtsDecal, NgtsFBO, NgtsHTML, NgtsHTMLContent, NgtsHTMLImpl, NgtsIntersect, NgtsPreload, NgtsSampler, calculateScaleFactor, getVersion, injectAnimations, injectDepthBuffer, injectFBO, injectIntersect, setUpdateRange, surfaceSampler };
1184
+ export { NgtsBakeShadows, NgtsComputedAttribute, NgtsDecal, NgtsFBO, NgtsHTML, NgtsHTMLContent, NgtsHTMLImpl, NgtsIntersect, NgtsPreload, NgtsSampler, animations, calculateScaleFactor, depthBuffer, fbo, getVersion, injectAnimations, injectDepthBuffer, injectFBO, injectIntersect, intersect, setUpdateRange, surfaceSampler };
1169
1185
  //# sourceMappingURL=angular-three-soba-misc.mjs.map