angular-three-soba 1.14.0 → 2.0.0-beta.3

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 (343) hide show
  1. package/README.md +2 -2
  2. package/abstractions/{lib/billboard → billboard}/billboard.d.ts +14 -4
  3. package/abstractions/catmull-rom-line/catmull-rom-line.d.ts +25 -0
  4. package/abstractions/cubic-bezier-line/cubic-bezier-line.d.ts +25 -0
  5. package/abstractions/{lib/edges → edges}/edges.d.ts +11 -7
  6. package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-helper.d.ts +16 -23
  7. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +22 -0
  8. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +30 -0
  9. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +32 -0
  10. package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-viewcube/gizmo-viewcube.d.ts +2 -3
  11. package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-viewport/gizmo-viewport-axis.d.ts +28 -9
  12. package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-viewport/gizmo-viewport.d.ts +23 -4
  13. package/abstractions/index.d.ts +11 -11
  14. package/abstractions/line/line-input.d.ts +42 -0
  15. package/abstractions/line/line.d.ts +35 -0
  16. package/abstractions/{lib/quadratic-bezier-line → quadratic-bezier-line}/quadratic-bezier-line.d.ts +12 -8
  17. package/abstractions/text/text.d.ts +77 -0
  18. package/abstractions/text-3d/text-3d.d.ts +74 -0
  19. package/cameras/{lib/camera → camera}/camera-content.d.ts +1 -1
  20. package/cameras/{lib/camera → camera}/camera.d.ts +12 -8
  21. package/cameras/cube-camera/cube-camera.d.ts +42 -0
  22. package/cameras/index.d.ts +5 -4
  23. package/cameras/{lib/orthographic-camera → orthographic-camera}/orthographic-camera.d.ts +14 -5
  24. package/controls/index.d.ts +1 -1
  25. package/controls/{lib/orbit-controls → orbit-controls}/orbit-controls.d.ts +19 -11
  26. package/esm2022/abstractions/angular-three-soba-abstractions.mjs +1 -1
  27. package/esm2022/abstractions/billboard/billboard.mjs +71 -0
  28. package/esm2022/abstractions/catmull-rom-line/catmull-rom-line.mjs +131 -0
  29. package/esm2022/abstractions/cubic-bezier-line/cubic-bezier-line.mjs +113 -0
  30. package/esm2022/abstractions/edges/edges.mjs +93 -0
  31. package/esm2022/abstractions/gizmo-helper/gizmo-helper.mjs +210 -0
  32. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/constants.mjs +31 -0
  33. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +95 -0
  34. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +155 -0
  35. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +62 -0
  36. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +80 -0
  37. package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +206 -0
  38. package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +273 -0
  39. package/esm2022/abstractions/index.mjs +12 -12
  40. package/esm2022/abstractions/line/line-input.mjs +113 -0
  41. package/esm2022/abstractions/line/line.mjs +165 -0
  42. package/esm2022/abstractions/quadratic-bezier-line/quadratic-bezier-line.mjs +128 -0
  43. package/esm2022/abstractions/text/text.mjs +275 -0
  44. package/esm2022/abstractions/text-3d/text-3d.mjs +167 -0
  45. package/esm2022/angular-three-soba.mjs +1 -1
  46. package/esm2022/cameras/angular-three-soba-cameras.mjs +1 -1
  47. package/esm2022/cameras/camera/camera-content.mjs +21 -0
  48. package/esm2022/cameras/camera/camera.mjs +71 -0
  49. package/esm2022/cameras/cube-camera/cube-camera.mjs +131 -0
  50. package/esm2022/cameras/index.mjs +6 -5
  51. package/esm2022/cameras/orthographic-camera/orthographic-camera.mjs +99 -0
  52. package/esm2022/cameras/perspective-camera/perspective-camera.mjs +47 -0
  53. package/esm2022/controls/angular-three-soba-controls.mjs +1 -1
  54. package/esm2022/controls/index.mjs +2 -2
  55. package/esm2022/controls/orbit-controls/orbit-controls.mjs +165 -0
  56. package/esm2022/index.mjs +1 -1
  57. package/esm2022/loaders/angular-three-soba-loaders.mjs +1 -1
  58. package/esm2022/loaders/gltf-loader/gltf-loader.mjs +33 -0
  59. package/esm2022/loaders/index.mjs +5 -6
  60. package/esm2022/loaders/loader/loader.mjs +133 -0
  61. package/esm2022/loaders/progress/progress.mjs +52 -0
  62. package/esm2022/loaders/texture-loader/texture-loader.mjs +28 -0
  63. package/esm2022/materials/angular-three-soba-materials.mjs +1 -1
  64. package/esm2022/materials/index.mjs +6 -6
  65. package/esm2022/materials/mesh-distort-material/mesh-distort-material.mjs +73 -0
  66. package/esm2022/materials/mesh-reflector-material/mesh-reflector-material.mjs +383 -0
  67. package/esm2022/materials/mesh-refraction-material/mesh-refraction-material.mjs +168 -0
  68. package/esm2022/materials/mesh-transmission-material/mesh-transmission-material.mjs +257 -0
  69. package/esm2022/materials/mesh-wobble-material/mesh-wobble-material.mjs +66 -0
  70. package/esm2022/misc/angular-three-soba-misc.mjs +1 -1
  71. package/esm2022/misc/animations/animations.mjs +55 -0
  72. package/esm2022/misc/bake-shadows/bake-shadows.mjs +24 -0
  73. package/esm2022/misc/depth-buffer/depth-buffer.mjs +46 -0
  74. package/esm2022/misc/fbo/fbo.mjs +47 -0
  75. package/esm2022/misc/index.mjs +5 -5
  76. package/esm2022/performance/adaptive/adaptive-dpr.mjs +46 -0
  77. package/esm2022/performance/adaptive/adaptive-events.mjs +31 -0
  78. package/esm2022/performance/angular-three-soba-performance.mjs +1 -1
  79. package/esm2022/performance/detailed/detailed.mjs +61 -0
  80. package/esm2022/performance/index.mjs +7 -5
  81. package/esm2022/performance/instances/instance.mjs +48 -0
  82. package/esm2022/performance/instances/instances.mjs +189 -0
  83. package/esm2022/performance/instances/position-mesh.mjs +52 -0
  84. package/esm2022/performance/stats/stats.mjs +79 -0
  85. package/esm2022/shaders/angular-three-soba-shaders.mjs +1 -1
  86. package/esm2022/shaders/blur-pass/blur-pass.mjs +61 -0
  87. package/esm2022/shaders/caustics-material/caustics-material.mjs +128 -0
  88. package/esm2022/shaders/caustics-material/caustics-projection-material.mjs +33 -0
  89. package/esm2022/shaders/convolution-material/convolution-material.mjs +94 -0
  90. package/esm2022/shaders/discard-material/discard-material.mjs +3 -0
  91. package/esm2022/shaders/index.mjs +15 -15
  92. package/esm2022/shaders/mesh-distort-material/mesh-distort-material.mjs +55 -0
  93. package/esm2022/shaders/mesh-reflector-material/mesh-reflector-material.mjs +223 -0
  94. package/esm2022/shaders/mesh-refraction-material/mesh-refraction-material.mjs +170 -0
  95. package/esm2022/shaders/mesh-transmission-material/mesh-transmission-material.mjs +268 -0
  96. package/esm2022/shaders/mesh-wobble-material/mesh-wobble-material.mjs +37 -0
  97. package/esm2022/shaders/shader-material/shader-material.mjs +34 -0
  98. package/esm2022/shaders/soft-shadow-material/soft-shadow-material.mjs +33 -0
  99. package/esm2022/shaders/sparkles-material/sparkles-material.mjs +47 -0
  100. package/esm2022/shaders/spot-light-material/spot-light-material.mjs +86 -0
  101. package/esm2022/shaders/star-field-material/star-field-material.mjs +32 -0
  102. package/esm2022/staging/accumulative-shadows/accumulative-shadows.mjs +283 -0
  103. package/esm2022/staging/accumulative-shadows/progressive-light-map.mjs +108 -0
  104. package/esm2022/staging/accumulative-shadows/randomized-lights.mjs +208 -0
  105. package/esm2022/staging/angular-three-soba-staging.mjs +1 -1
  106. package/esm2022/staging/bounds/bounds.mjs +307 -0
  107. package/esm2022/staging/camera-shake/camera-shake.mjs +117 -0
  108. package/esm2022/staging/caustics/caustisc.mjs +384 -0
  109. package/esm2022/staging/center/center.mjs +148 -0
  110. package/esm2022/staging/cloud/cloud.mjs +164 -0
  111. package/esm2022/staging/contact-shadows/contact-shadows.mjs +249 -0
  112. package/esm2022/staging/environment/assets.mjs +13 -0
  113. package/esm2022/staging/environment/environment-cube.mjs +49 -0
  114. package/esm2022/staging/environment/environment-ground.mjs +43 -0
  115. package/esm2022/staging/environment/environment-input.mjs +106 -0
  116. package/esm2022/staging/environment/environment-map.mjs +53 -0
  117. package/esm2022/staging/environment/environment-portal.mjs +135 -0
  118. package/esm2022/staging/environment/environment.mjs +78 -0
  119. package/esm2022/staging/environment/utils.mjs +84 -0
  120. package/esm2022/staging/float/float.mjs +82 -0
  121. package/esm2022/staging/index.mjs +18 -18
  122. package/esm2022/staging/sky/sky.mjs +114 -0
  123. package/esm2022/staging/sparkles/sparkles.mjs +161 -0
  124. package/esm2022/staging/spot-light/spot-light-input.mjs +75 -0
  125. package/esm2022/staging/spot-light/spot-light-shadow-mesh-input.mjs +57 -0
  126. package/esm2022/staging/spot-light/spot-light-shadow-mesh.mjs +256 -0
  127. package/esm2022/staging/spot-light/spot-light.mjs +94 -0
  128. package/esm2022/staging/spot-light/volumetric-mesh.mjs +101 -0
  129. package/esm2022/staging/stage/stage.mjs +374 -0
  130. package/esm2022/staging/stars/stars.mjs +148 -0
  131. package/fesm2022/angular-three-soba-abstractions.mjs +1116 -890
  132. package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
  133. package/fesm2022/angular-three-soba-cameras.mjs +126 -122
  134. package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
  135. package/fesm2022/angular-three-soba-controls.mjs +72 -54
  136. package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
  137. package/fesm2022/angular-three-soba-loaders.mjs +147 -131
  138. package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
  139. package/fesm2022/angular-three-soba-materials.mjs +340 -258
  140. package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
  141. package/fesm2022/angular-three-soba-misc.mjs +140 -123
  142. package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
  143. package/fesm2022/angular-three-soba-performance.mjs +383 -106
  144. package/fesm2022/angular-three-soba-performance.mjs.map +1 -1
  145. package/fesm2022/angular-three-soba-shaders.mjs +57 -9
  146. package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
  147. package/fesm2022/angular-three-soba-staging.mjs +1609 -1561
  148. package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
  149. package/fesm2022/angular-three-soba.mjs.map +1 -1
  150. package/loaders/gltf-loader/gltf-loader.d.ts +9 -0
  151. package/loaders/index.d.ts +4 -5
  152. package/loaders/{lib/loader → loader}/loader.d.ts +20 -15
  153. package/loaders/progress/progress.d.ts +9 -0
  154. package/loaders/texture-loader/texture-loader.d.ts +7 -0
  155. package/materials/index.d.ts +5 -5
  156. package/materials/{lib/mesh-distort-material → mesh-distort-material}/mesh-distort-material.d.ts +11 -5
  157. package/materials/mesh-reflector-material/mesh-reflector-material.d.ts +81 -0
  158. package/materials/mesh-refraction-material/mesh-refraction-material.d.ts +50 -0
  159. package/materials/{lib/mesh-transmission-material → mesh-transmission-material}/mesh-transmission-material.d.ts +51 -6
  160. package/materials/{lib/mesh-wobble-material → mesh-wobble-material}/mesh-wobble-material.d.ts +9 -3
  161. package/misc/animations/animations.d.ts +13 -0
  162. package/misc/{lib/bake-shadows → bake-shadows}/bake-shadows.d.ts +2 -5
  163. package/misc/depth-buffer/depth-buffer.d.ts +9 -0
  164. package/misc/{lib/fbo → fbo}/fbo.d.ts +4 -2
  165. package/misc/index.d.ts +4 -4
  166. package/package.json +25 -23
  167. package/performance/{lib/adaptive → adaptive}/adaptive-dpr.d.ts +4 -7
  168. package/performance/{lib/adaptive → adaptive}/adaptive-events.d.ts +2 -6
  169. package/performance/detailed/detailed.d.ts +20 -0
  170. package/performance/index.d.ts +6 -4
  171. package/performance/instances/instance.d.ts +9 -0
  172. package/performance/instances/instances.d.ts +35 -0
  173. package/performance/instances/position-mesh.d.ts +10 -0
  174. package/performance/{lib/stats → stats}/stats.d.ts +10 -7
  175. package/plugin/package.json +1 -1
  176. package/plugin/src/generators/init/compat.js.map +1 -1
  177. package/plugin/src/generators/init/init.d.ts +1 -1
  178. package/plugin/src/generators/init/init.js +1 -1
  179. package/plugin/src/generators/init/init.js.map +1 -1
  180. package/plugin/src/index.js.map +1 -1
  181. package/shaders/{lib/blur-pass → blur-pass}/blur-pass.d.ts +2 -2
  182. package/shaders/index.d.ts +14 -14
  183. package/shaders/{lib/mesh-distort-material → mesh-distort-material}/mesh-distort-material.d.ts +1 -1
  184. package/shaders/{lib/mesh-wobble-material → mesh-wobble-material}/mesh-wobble-material.d.ts +1 -0
  185. package/shaders/{lib/soft-shadow-material → soft-shadow-material}/soft-shadow-material.d.ts +2 -2
  186. package/shaders/sparkles-material/sparkles-material.d.ts +3 -0
  187. package/staging/{lib/accumulative-shadows → accumulative-shadows}/accumulative-shadows.d.ts +55 -17
  188. package/staging/{lib/accumulative-shadows → accumulative-shadows}/progressive-light-map.d.ts +2 -2
  189. package/staging/{lib/accumulative-shadows → accumulative-shadows}/randomized-lights.d.ts +45 -10
  190. package/staging/{lib/bounds → bounds}/bounds.d.ts +32 -22
  191. package/staging/{lib/camera-shake → camera-shake}/camera-shake.d.ts +15 -11
  192. package/staging/{lib/caustics/caustics.d.ts → caustics/caustisc.d.ts} +36 -13
  193. package/staging/{lib/center → center}/center.d.ts +30 -8
  194. package/staging/cloud/cloud.d.ts +48 -0
  195. package/staging/{lib/contact-shadows → contact-shadows}/contact-shadows.d.ts +38 -10
  196. package/staging/environment/environment-cube.d.ts +11 -0
  197. package/staging/environment/environment-ground.d.ts +13 -0
  198. package/staging/environment/environment-input.d.ts +68 -0
  199. package/staging/environment/environment-map.d.ts +11 -0
  200. package/staging/{lib/environment → environment}/environment-portal.d.ts +5 -7
  201. package/staging/{lib/environment → environment}/environment.d.ts +2 -2
  202. package/staging/environment/utils.d.ts +7 -0
  203. package/staging/float/float.d.ts +27 -0
  204. package/staging/index.d.ts +17 -17
  205. package/staging/{lib/sky → sky}/sky.d.ts +26 -5
  206. package/staging/{lib/sparkles → sparkles}/sparkles.d.ts +30 -10
  207. package/staging/{lib/spot-light → spot-light}/spot-light-input.d.ts +24 -2
  208. package/staging/{lib/spot-light/shadow-mesh-input.d.ts → spot-light/spot-light-shadow-mesh-input.d.ts} +18 -3
  209. package/staging/spot-light/spot-light-shadow-mesh.d.ts +38 -0
  210. package/staging/{lib/spot-light → spot-light}/spot-light.d.ts +11 -5
  211. package/staging/{lib/spot-light → spot-light}/volumetric-mesh.d.ts +8 -5
  212. package/staging/{lib/stage → stage}/stage.d.ts +33 -14
  213. package/staging/{lib/stars → stars}/stars.d.ts +21 -7
  214. package/abstractions/lib/catmull-rom-line/catmull-rom-line.d.ts +0 -15
  215. package/abstractions/lib/cubic-bezier-line/cubic-bezier-line.d.ts +0 -15
  216. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +0 -16
  217. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +0 -24
  218. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +0 -14
  219. package/abstractions/lib/line/line-input.d.ts +0 -19
  220. package/abstractions/lib/line/line.d.ts +0 -21
  221. package/abstractions/lib/text/text.d.ts +0 -21
  222. package/abstractions/lib/text-3d/text-3d.d.ts +0 -39
  223. package/assets/default-spot-light-shadow.glsl +0 -10
  224. package/cameras/lib/cube-camera/cube-camera.d.ts +0 -27
  225. package/esm2022/abstractions/lib/billboard/billboard.mjs +0 -74
  226. package/esm2022/abstractions/lib/catmull-rom-line/catmull-rom-line.mjs +0 -120
  227. package/esm2022/abstractions/lib/cubic-bezier-line/cubic-bezier-line.mjs +0 -99
  228. package/esm2022/abstractions/lib/edges/edges.mjs +0 -96
  229. package/esm2022/abstractions/lib/gizmo-helper/gizmo-helper.mjs +0 -213
  230. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/constants.mjs +0 -31
  231. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +0 -92
  232. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +0 -184
  233. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +0 -46
  234. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +0 -134
  235. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +0 -195
  236. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +0 -267
  237. package/esm2022/abstractions/lib/line/line-input.mjs +0 -76
  238. package/esm2022/abstractions/lib/line/line.mjs +0 -133
  239. package/esm2022/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.mjs +0 -128
  240. package/esm2022/abstractions/lib/text/text.mjs +0 -115
  241. package/esm2022/abstractions/lib/text-3d/text-3d.mjs +0 -145
  242. package/esm2022/cameras/lib/camera/camera-content.mjs +0 -21
  243. package/esm2022/cameras/lib/camera/camera.mjs +0 -75
  244. package/esm2022/cameras/lib/cube-camera/cube-camera.mjs +0 -131
  245. package/esm2022/cameras/lib/orthographic-camera/orthographic-camera.mjs +0 -93
  246. package/esm2022/cameras/lib/perspective-camera/perspective-camera.mjs +0 -47
  247. package/esm2022/controls/lib/orbit-controls/orbit-controls.mjs +0 -147
  248. package/esm2022/loaders/lib/cube-texture-loader/cube-texture-loader.mjs +0 -10
  249. package/esm2022/loaders/lib/gltf-loader/gltf-loader.mjs +0 -32
  250. package/esm2022/loaders/lib/loader/loader.mjs +0 -134
  251. package/esm2022/loaders/lib/progress/progress.mjs +0 -39
  252. package/esm2022/loaders/lib/texture-loader/texture-loader.mjs +0 -19
  253. package/esm2022/materials/lib/mesh-distort-material/mesh-distort-material.mjs +0 -75
  254. package/esm2022/materials/lib/mesh-reflector-material/mesh-reflector-material.mjs +0 -328
  255. package/esm2022/materials/lib/mesh-refraction-material/mesh-refraction-material.mjs +0 -158
  256. package/esm2022/materials/lib/mesh-transmission-material/mesh-transmission-material.mjs +0 -238
  257. package/esm2022/materials/lib/mesh-wobble-material/mesh-wobble-material.mjs +0 -68
  258. package/esm2022/misc/lib/animations/animations.mjs +0 -52
  259. package/esm2022/misc/lib/bake-shadows/bake-shadows.mjs +0 -26
  260. package/esm2022/misc/lib/depth-buffer/depth-buffer.mjs +0 -39
  261. package/esm2022/misc/lib/fbo/fbo.mjs +0 -39
  262. package/esm2022/performance/lib/adaptive/adaptive-dpr.mjs +0 -47
  263. package/esm2022/performance/lib/adaptive/adaptive-events.mjs +0 -37
  264. package/esm2022/performance/lib/detailed/detailed.mjs +0 -54
  265. package/esm2022/performance/lib/stats/stats.mjs +0 -80
  266. package/esm2022/shaders/lib/blur-pass/blur-pass.mjs +0 -61
  267. package/esm2022/shaders/lib/caustics-material/caustics-material.mjs +0 -128
  268. package/esm2022/shaders/lib/caustics-projection-material/caustics-projection-material.mjs +0 -33
  269. package/esm2022/shaders/lib/convolution-material/convolution-material.mjs +0 -94
  270. package/esm2022/shaders/lib/discard-material/discard-material.mjs +0 -3
  271. package/esm2022/shaders/lib/mesh-distort-material/mesh-distort-material.mjs +0 -55
  272. package/esm2022/shaders/lib/mesh-reflector-material/mesh-reflector-material.mjs +0 -223
  273. package/esm2022/shaders/lib/mesh-refraction-material/mesh-refraction-material.mjs +0 -169
  274. package/esm2022/shaders/lib/mesh-transmission-material/mesh-transmission-material.mjs +0 -268
  275. package/esm2022/shaders/lib/mesh-wobble-material/mesh-wobble-material.mjs +0 -37
  276. package/esm2022/shaders/lib/shader-material/shader-material.mjs +0 -34
  277. package/esm2022/shaders/lib/soft-shadow-material/soft-shadow-material.mjs +0 -33
  278. package/esm2022/shaders/lib/spot-light-material/spot-light-material.mjs +0 -86
  279. package/esm2022/shaders/lib/star-field-material/star-field-material.mjs +0 -32
  280. package/esm2022/staging/lib/accumulative-shadows/accumulative-shadows.mjs +0 -249
  281. package/esm2022/staging/lib/accumulative-shadows/progressive-light-map.mjs +0 -108
  282. package/esm2022/staging/lib/accumulative-shadows/randomized-lights.mjs +0 -201
  283. package/esm2022/staging/lib/bounds/bounds.mjs +0 -284
  284. package/esm2022/staging/lib/camera-shake/camera-shake.mjs +0 -122
  285. package/esm2022/staging/lib/caustics/caustics.mjs +0 -364
  286. package/esm2022/staging/lib/center/center.mjs +0 -143
  287. package/esm2022/staging/lib/cloud/cloud.mjs +0 -160
  288. package/esm2022/staging/lib/contact-shadows/contact-shadows.mjs +0 -228
  289. package/esm2022/staging/lib/environment/assets.mjs +0 -13
  290. package/esm2022/staging/lib/environment/environment-cube.mjs +0 -41
  291. package/esm2022/staging/lib/environment/environment-ground.mjs +0 -67
  292. package/esm2022/staging/lib/environment/environment-inputs.mjs +0 -87
  293. package/esm2022/staging/lib/environment/environment-map.mjs +0 -39
  294. package/esm2022/staging/lib/environment/environment-portal.mjs +0 -111
  295. package/esm2022/staging/lib/environment/environment.mjs +0 -165
  296. package/esm2022/staging/lib/environment/utils.mjs +0 -70
  297. package/esm2022/staging/lib/float/float.mjs +0 -77
  298. package/esm2022/staging/lib/sky/sky.mjs +0 -109
  299. package/esm2022/staging/lib/sparkles/sparkles.mjs +0 -210
  300. package/esm2022/staging/lib/spot-light/common.mjs +0 -42
  301. package/esm2022/staging/lib/spot-light/shadow-mesh-input.mjs +0 -51
  302. package/esm2022/staging/lib/spot-light/spot-light-input.mjs +0 -62
  303. package/esm2022/staging/lib/spot-light/spot-light-shadow-no-shader.mjs +0 -74
  304. package/esm2022/staging/lib/spot-light/spot-light-shadow-shader.mjs +0 -126
  305. package/esm2022/staging/lib/spot-light/spot-light-shadow.mjs +0 -63
  306. package/esm2022/staging/lib/spot-light/spot-light.mjs +0 -117
  307. package/esm2022/staging/lib/spot-light/volumetric-mesh.mjs +0 -86
  308. package/esm2022/staging/lib/stage/stage.mjs +0 -368
  309. package/esm2022/staging/lib/stars/stars.mjs +0 -140
  310. package/loaders/lib/cube-texture-loader/cube-texture-loader.d.ts +0 -3
  311. package/loaders/lib/gltf-loader/gltf-loader.d.ts +0 -8
  312. package/loaders/lib/progress/progress.d.ts +0 -16
  313. package/loaders/lib/texture-loader/texture-loader.d.ts +0 -5
  314. package/materials/lib/mesh-reflector-material/mesh-reflector-material.d.ts +0 -41
  315. package/materials/lib/mesh-refraction-material/mesh-refraction-material.d.ts +0 -28
  316. package/misc/lib/animations/animations.d.ts +0 -13
  317. package/misc/lib/depth-buffer/depth-buffer.d.ts +0 -7
  318. package/performance/lib/detailed/detailed.d.ts +0 -13
  319. package/staging/lib/cloud/cloud.d.ts +0 -23
  320. package/staging/lib/environment/environment-cube.d.ts +0 -11
  321. package/staging/lib/environment/environment-ground.d.ts +0 -9
  322. package/staging/lib/environment/environment-inputs.d.ts +0 -28
  323. package/staging/lib/environment/environment-map.d.ts +0 -10
  324. package/staging/lib/environment/utils.d.ts +0 -8
  325. package/staging/lib/float/float.d.ts +0 -16
  326. package/staging/lib/spot-light/common.d.ts +0 -3
  327. package/staging/lib/spot-light/spot-light-shadow-no-shader.d.ts +0 -14
  328. package/staging/lib/spot-light/spot-light-shadow-shader.d.ts +0 -25
  329. package/staging/lib/spot-light/spot-light-shadow.d.ts +0 -6
  330. /package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-viewcube/constants.d.ts +0 -0
  331. /package/cameras/{lib/perspective-camera → perspective-camera}/perspective-camera.d.ts +0 -0
  332. /package/plugin/{README.md → libs/plugin/README.md} +0 -0
  333. /package/shaders/{lib/caustics-material → caustics-material}/caustics-material.d.ts +0 -0
  334. /package/shaders/{lib/caustics-projection-material → caustics-material}/caustics-projection-material.d.ts +0 -0
  335. /package/shaders/{lib/convolution-material → convolution-material}/convolution-material.d.ts +0 -0
  336. /package/shaders/{lib/discard-material → discard-material}/discard-material.d.ts +0 -0
  337. /package/shaders/{lib/mesh-reflector-material → mesh-reflector-material}/mesh-reflector-material.d.ts +0 -0
  338. /package/shaders/{lib/mesh-refraction-material → mesh-refraction-material}/mesh-refraction-material.d.ts +0 -0
  339. /package/shaders/{lib/mesh-transmission-material → mesh-transmission-material}/mesh-transmission-material.d.ts +0 -0
  340. /package/shaders/{lib/shader-material → shader-material}/shader-material.d.ts +0 -0
  341. /package/shaders/{lib/spot-light-material → spot-light-material}/spot-light-material.d.ts +0 -0
  342. /package/shaders/{lib/star-field-material → star-field-material}/star-field-material.d.ts +0 -0
  343. /package/staging/{lib/environment → environment}/assets.d.ts +0 -0
@@ -1,21 +1,17 @@
1
1
  import * as i0 from '@angular/core';
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';
2
+ import { Component, CUSTOM_ELEMENTS_SCHEMA, Input, computed, Directive, inject, effect, InjectionToken, EventEmitter, TemplateRef, Output, ContentChild, signal, DestroyRef } from '@angular/core';
3
+ import { extend, NgtSignalStore, injectNgtRef, injectBeforeRender, NgtStore, requestAnimationInInjectionContext, NgtArgs, NgtPortal, NgtPortalContent, NgtRepeat } from 'angular-three';
4
4
  import * as THREE from 'three';
5
5
  import { Group, CatmullRomCurve3, LineSegments, LineBasicMaterial, Vector3, Quaternion, Object3D, Matrix4, Mesh, BoxGeometry, MeshBasicMaterial, MeshLambertMaterial, CanvasTexture, AmbientLight, PointLight, Sprite, SpriteMaterial } from 'three';
6
- import { combineLatest, map, switchMap, of } from 'rxjs';
7
- import { LineMaterial, LineSegmentsGeometry, LineGeometry, LineSegments2, Line2, TextGeometry, FontLoader } from 'three-stdlib';
6
+ import { LineSegmentsGeometry, LineGeometry, LineMaterial, LineSegments2, Line2, TextGeometry, FontLoader } from 'three-stdlib';
8
7
  import { NgIf, NgTemplateOutlet, DOCUMENT, NgFor } from '@angular/common';
9
8
  import { NgtsOrthographicCamera } from 'angular-three-soba/cameras';
10
- import { RxActionFactory } from '@rx-angular/state/actions';
9
+ import { toSignal, toObservable } from '@angular/core/rxjs-interop';
10
+ import { switchMap, of, map } from 'rxjs';
11
11
  import { Text, preloadFont } from 'troika-three-text';
12
12
 
13
13
  extend({ Group });
14
- class NgtsBillboard extends NgtRxStore {
15
- constructor() {
16
- super(...arguments);
17
- this.billboardRef = injectNgtRef();
18
- }
14
+ class NgtsBillboard extends NgtSignalStore {
19
15
  set follow(follow) {
20
16
  this.set({ follow });
21
17
  }
@@ -28,29 +24,30 @@ class NgtsBillboard extends NgtRxStore {
28
24
  set lockZ(lockZ) {
29
25
  this.set({ lockZ });
30
26
  }
31
- initialize() {
32
- super.initialize();
33
- this.set({ follow: true, lockX: false, lockY: false, lockZ: false });
34
- }
35
- onBeforeRender({ state, object }) {
36
- const { follow, lockX, lockY, lockZ } = this.get();
37
- if (!follow)
38
- return;
39
- // save prev rotation in case we're locking axises
40
- const prevRotation = object.rotation.clone();
41
- // always face the camera
42
- state.camera.getWorldQuaternion(object.quaternion);
43
- // readjust any axis that is locked
44
- if (lockX)
45
- object.rotation.x = prevRotation.x;
46
- if (lockY)
47
- object.rotation.y = prevRotation.y;
48
- if (lockZ)
49
- object.rotation.z = prevRotation.z;
50
- }
51
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsBillboard, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
27
+ constructor() {
28
+ super({ follow: true, lockX: false, lockY: false, lockZ: false });
29
+ this.billboardRef = injectNgtRef();
30
+ injectBeforeRender(({ camera }) => {
31
+ const ref = this.billboardRef.untracked;
32
+ const { follow, lockX, lockY, lockZ } = this.get();
33
+ if (!ref || !follow)
34
+ return;
35
+ // save previous rotation in case we're locking an axis
36
+ const prevRotation = ref.rotation.clone();
37
+ // always face the camera
38
+ camera.getWorldQuaternion(ref.quaternion);
39
+ // re-adjust any axis that is locked
40
+ if (lockX)
41
+ ref.rotation.x = prevRotation.x;
42
+ if (lockY)
43
+ ref.rotation.y = prevRotation.y;
44
+ if (lockZ)
45
+ ref.rotation.z = prevRotation.z;
46
+ });
47
+ }
48
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsBillboard, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
52
49
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsBillboard, isStandalone: true, selector: "ngts-billboard", inputs: { billboardRef: "billboardRef", follow: "follow", lockX: "lockX", lockY: "lockY", lockZ: "lockZ" }, usesInheritance: true, ngImport: i0, template: `
53
- <ngt-group ngtCompound [ref]="billboardRef" (beforeRender)="onBeforeRender($any($event))">
50
+ <ngt-group ngtCompound [ref]="billboardRef">
54
51
  <ng-content />
55
52
  </ngt-group>
56
53
  `, isInline: true }); }
@@ -61,13 +58,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
61
58
  selector: 'ngts-billboard',
62
59
  standalone: true,
63
60
  template: `
64
- <ngt-group ngtCompound [ref]="billboardRef" (beforeRender)="onBeforeRender($any($event))">
61
+ <ngt-group ngtCompound [ref]="billboardRef">
65
62
  <ng-content />
66
63
  </ngt-group>
67
64
  `,
68
65
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
69
66
  }]
70
- }], propDecorators: { billboardRef: [{
67
+ }], ctorParameters: function () { return []; }, propDecorators: { billboardRef: [{
71
68
  type: Input
72
69
  }], follow: [{
73
70
  type: Input
@@ -79,7 +76,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
79
76
  type: Input
80
77
  }] } });
81
78
 
82
- class NgtsLineInput extends NgtRxStore {
79
+ class NgtsLineInputs extends NgtSignalStore {
83
80
  set vertexColors(vertexColors) {
84
81
  this.set({ vertexColors });
85
82
  }
@@ -116,16 +113,53 @@ class NgtsLineInput extends NgtRxStore {
116
113
  set worldUnits(worldUnits) {
117
114
  this.set({ worldUnits });
118
115
  }
119
- initialize() {
120
- super.initialize();
121
- this.set({ color: 'black' });
116
+ #color;
117
+ #vertexColors;
118
+ #resolution;
119
+ #linewidth;
120
+ #alphaToCoverage;
121
+ #dashed;
122
+ #dashScale;
123
+ #dashSize;
124
+ #dashOffset;
125
+ #gapSize;
126
+ #wireframe;
127
+ #worldUnits;
128
+ constructor() {
129
+ super({ color: 'black' });
130
+ this.#color = this.select('color');
131
+ this.#vertexColors = this.select('vertexColors');
132
+ this.#resolution = this.select('resolution');
133
+ this.#linewidth = this.select('lineWidth');
134
+ this.#alphaToCoverage = this.select('alphaToCoverage');
135
+ this.#dashed = this.select('dashed');
136
+ this.#dashScale = this.select('dashScale');
137
+ this.#dashSize = this.select('dashSize');
138
+ this.#dashOffset = this.select('dashOffset');
139
+ this.#gapSize = this.select('gapSize');
140
+ this.#wireframe = this.select('wireframe');
141
+ this.#worldUnits = this.select('worldUnits');
142
+ this.lineParameters = computed(() => ({
143
+ color: this.#color(),
144
+ vertexColors: this.#vertexColors(),
145
+ resolution: this.#resolution(),
146
+ linewidth: this.#linewidth(),
147
+ alphaToCoverage: this.#alphaToCoverage(),
148
+ dashed: this.#dashed(),
149
+ dashScale: this.#dashScale(),
150
+ dashSize: this.#dashSize(),
151
+ dashOffset: this.#dashOffset(),
152
+ gapSize: this.#gapSize(),
153
+ wireframe: this.#wireframe(),
154
+ worldUnits: this.#worldUnits(),
155
+ }));
122
156
  }
123
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsLineInput, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
124
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: NgtsLineInput, inputs: { vertexColors: "vertexColors", lineWidth: "lineWidth", alphaToCoverage: "alphaToCoverage", color: "color", dashed: "dashed", dashScale: "dashScale", dashSize: "dashSize", dashOffset: "dashOffset", gapSize: "gapSize", resolution: "resolution", wireframe: "wireframe", worldUnits: "worldUnits" }, usesInheritance: true, ngImport: i0 }); }
157
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsLineInputs, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
158
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: NgtsLineInputs, inputs: { vertexColors: "vertexColors", lineWidth: "lineWidth", alphaToCoverage: "alphaToCoverage", color: "color", dashed: "dashed", dashScale: "dashScale", dashSize: "dashSize", dashOffset: "dashOffset", gapSize: "gapSize", resolution: "resolution", wireframe: "wireframe", worldUnits: "worldUnits" }, usesInheritance: true, ngImport: i0 }); }
125
159
  }
126
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsLineInput, decorators: [{
160
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsLineInputs, decorators: [{
127
161
  type: Directive
128
- }], propDecorators: { vertexColors: [{
162
+ }], ctorParameters: function () { return []; }, propDecorators: { vertexColors: [{
129
163
  type: Input
130
164
  }], lineWidth: [{
131
165
  type: Input
@@ -151,86 +185,122 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
151
185
  type: Input
152
186
  }] } });
153
187
 
154
- class NgtsLine extends NgtsLineInput {
155
- constructor() {
156
- super(...arguments);
157
- this.Boolean = Boolean;
158
- this.lineMaterial = new LineMaterial();
159
- this.store = inject(NgtStore);
160
- this.line = null;
161
- this.lineRef = injectNgtRef();
162
- }
188
+ class NgtsLine extends NgtsLineInputs {
163
189
  set points(points) {
164
190
  this.set({ points });
165
191
  }
166
192
  set segments(segments) {
167
193
  this.set({ segments });
168
194
  }
169
- onAfterAttach({ parent }) {
170
- parent.computeLineDistances();
171
- }
172
- initialize() {
173
- super.initialize();
174
- this.set({ segments: false });
175
- this.connect('lineGeometry', combineLatest([
176
- this.select('points'),
177
- this.select('segments'),
178
- this.select('vertexColors').pipe(startWithUndefined()),
179
- ]).pipe(map(([points, segments, vertexColors]) => {
180
- const geometry = segments ? new LineSegmentsGeometry() : new LineGeometry();
181
- const pValues = points.map((p) => {
182
- const isArray = Array.isArray(p);
183
- return p instanceof THREE.Vector3
184
- ? [p.x, p.y, p.z]
185
- : p instanceof THREE.Vector2
186
- ? [p.x, p.y, 0]
187
- : isArray && p.length === 3
188
- ? [p[0], p[1], p[2]]
189
- : isArray && p.length === 2
190
- ? [p[0], p[1], 0]
191
- : p;
192
- });
193
- geometry.setPositions(pValues.flat());
194
- if (vertexColors) {
195
- const cValues = vertexColors.map((c) => c instanceof THREE.Color ? c.toArray() : c);
196
- geometry.setColors(cValues.flat());
195
+ #store;
196
+ #size;
197
+ #lineResolution;
198
+ #resolution;
199
+ #points;
200
+ #pointValues;
201
+ #vertexColors;
202
+ #vertexColorValues;
203
+ #segments;
204
+ constructor() {
205
+ super();
206
+ this.lineRef = injectNgtRef();
207
+ this.#store = inject(NgtStore);
208
+ this.#size = this.#store.select('size');
209
+ this.#lineResolution = this.select('resolution');
210
+ this.#resolution = computed(() => this.#lineResolution() ? this.#lineResolution() : [this.#size().width, this.#size().height]);
211
+ this.#points = this.select('points');
212
+ this.#pointValues = computed(() => this.#points().map((p) => {
213
+ const isArray = Array.isArray(p);
214
+ return p instanceof THREE.Vector3
215
+ ? [p.x, p.y, p.z]
216
+ : p instanceof THREE.Vector2
217
+ ? [p.x, p.y, 0]
218
+ : isArray && p.length === 3
219
+ ? [p[0], p[1], p[2]]
220
+ : isArray && p.length === 2
221
+ ? [p[0], p[1], 0]
222
+ : p;
223
+ }));
224
+ this.#vertexColors = this.select('vertexColors');
225
+ this.#vertexColorValues = computed(() => (this.#vertexColors() || []).map((c) => (c instanceof THREE.Color ? c.toArray() : c)));
226
+ this.#segments = this.select('segments');
227
+ this.lineGeometry = computed(() => {
228
+ const pointValues = this.#pointValues();
229
+ const vertexColors = this.#vertexColorValues();
230
+ const geometry = this.#segments() ? new LineSegmentsGeometry() : new LineGeometry();
231
+ geometry.setPositions(pointValues.flat());
232
+ if (vertexColors.length) {
233
+ geometry.setColors(vertexColors.flat());
197
234
  }
198
235
  return geometry;
199
- })));
236
+ });
237
+ this.lineMaterial = new LineMaterial();
238
+ this.line = computed(() => (this.#segments() ? new LineSegments2() : new Line2()));
239
+ this.lineMaterialParameters = computed(() => {
240
+ const parameters = this.lineParameters();
241
+ const resolution = this.#resolution();
242
+ const vertexColors = Boolean(parameters.vertexColors);
243
+ if (vertexColors) {
244
+ parameters.color = undefined;
245
+ }
246
+ return {
247
+ ...parameters,
248
+ vertexColors,
249
+ resolution,
250
+ dashScale: parameters.dashScale ?? this.lineMaterial.dashScale,
251
+ dashSize: parameters.dashSize ?? this.lineMaterial.dashSize,
252
+ dashOffset: parameters.dashOffset ?? this.lineMaterial.dashOffset,
253
+ gapSize: parameters.gapSize ?? this.lineMaterial.gapSize,
254
+ wireframe: parameters.wireframe ?? this.lineMaterial.wireframe,
255
+ worldUnits: parameters.worldUnits ?? this.lineMaterial.worldUnits,
256
+ };
257
+ });
258
+ this.set({ segments: false });
259
+ requestAnimationInInjectionContext(() => {
260
+ this.#disposeGeometry();
261
+ this.#computeLineDistances();
262
+ });
200
263
  }
201
- ngOnInit() {
202
- this.connect('materialResolution', combineLatest([this.store.select('size'), this.select('resolution').pipe(startWithUndefined())]).pipe(map(([size, resolution]) => resolution ?? [size.width, size.height])));
203
- this.line = this.get('segments') ? new LineSegments2() : new Line2();
204
- this.disposeGeometry();
264
+ #computeLineDistances() {
265
+ const points = this.select('points');
266
+ const trigger = computed(() => {
267
+ const lineGeometry = this.lineGeometry();
268
+ const line = this.lineRef.nativeElement;
269
+ const children = this.lineRef.children('nonObjects');
270
+ return { points: points(), lineGeometry, line, children: children() };
271
+ });
272
+ effect(() => {
273
+ const { line } = trigger();
274
+ if (!line)
275
+ return;
276
+ line.computeLineDistances();
277
+ });
205
278
  }
206
- disposeGeometry() {
207
- this.effect(this.select('lineGeometry'), (lineGeometry) => {
208
- return () => lineGeometry.dispose();
279
+ #disposeGeometry() {
280
+ effect((onCleanup) => {
281
+ const lineGeometry = this.lineGeometry();
282
+ onCleanup(() => lineGeometry.dispose());
209
283
  });
210
284
  }
211
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsLine, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
212
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsLine, isStandalone: true, selector: "ngts-line[points]", inputs: { lineRef: "lineRef", points: "points", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
213
- <ngt-primitive *args="[line]" [ref]="lineRef" ngtCompound>
214
- <ngt-primitive
215
- *args="[get('lineGeometry')]"
216
- attach="geometry"
217
- (afterAttach)="onAfterAttach($any($event))"
218
- />
285
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsLine, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
286
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsLine, isStandalone: true, selector: "ngts-line", inputs: { lineRef: "lineRef", points: "points", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
287
+ <ngt-primitive *args="[line()]" [ref]="lineRef" ngtCompound>
288
+ <ngt-primitive *args="[lineGeometry()]" attach="geometry" />
219
289
  <ngt-primitive
220
290
  *args="[lineMaterial]"
221
291
  attach="material"
222
- [color]="get('color')"
223
- [vertexColors]="Boolean(get('vertexColors'))"
224
- [resolution]="get('materialResolution')"
225
- [linewidth]="get('lineWidth')"
226
- [alphaToCoverage]="get('alphaToCoverage')"
227
- [dashed]="get('dashed')"
228
- [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
229
- [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
230
- [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
231
- [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
232
- [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
233
- [worldUnits]="get('worldUnits')"
292
+ [resolution]="lineMaterialParameters().resolution"
293
+ [color]="lineMaterialParameters().color"
294
+ [vertexColors]="lineMaterialParameters().vertexColors"
295
+ [linewidth]="lineMaterialParameters().linewidth"
296
+ [alphaToCoverage]="lineMaterialParameters().alphaToCoverage"
297
+ [dashed]="lineMaterialParameters().dashed"
298
+ [dashScale]="lineMaterialParameters().dashScale"
299
+ [dashSize]="lineMaterialParameters().dashSize"
300
+ [dashOffset]="lineMaterialParameters().dashOffset"
301
+ [gapSize]="lineMaterialParameters().gapSize"
302
+ [wireframe]="lineMaterialParameters().wireframe"
303
+ [worldUnits]="lineMaterialParameters().worldUnits"
234
304
  />
235
305
  </ngt-primitive>
236
306
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] }); }
@@ -238,49 +308,42 @@ class NgtsLine extends NgtsLineInput {
238
308
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsLine, decorators: [{
239
309
  type: Component,
240
310
  args: [{
241
- selector: 'ngts-line[points]',
311
+ selector: 'ngts-line',
242
312
  standalone: true,
243
313
  template: `
244
- <ngt-primitive *args="[line]" [ref]="lineRef" ngtCompound>
245
- <ngt-primitive
246
- *args="[get('lineGeometry')]"
247
- attach="geometry"
248
- (afterAttach)="onAfterAttach($any($event))"
249
- />
314
+ <ngt-primitive *args="[line()]" [ref]="lineRef" ngtCompound>
315
+ <ngt-primitive *args="[lineGeometry()]" attach="geometry" />
250
316
  <ngt-primitive
251
317
  *args="[lineMaterial]"
252
318
  attach="material"
253
- [color]="get('color')"
254
- [vertexColors]="Boolean(get('vertexColors'))"
255
- [resolution]="get('materialResolution')"
256
- [linewidth]="get('lineWidth')"
257
- [alphaToCoverage]="get('alphaToCoverage')"
258
- [dashed]="get('dashed')"
259
- [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
260
- [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
261
- [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
262
- [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
263
- [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
264
- [worldUnits]="get('worldUnits')"
319
+ [resolution]="lineMaterialParameters().resolution"
320
+ [color]="lineMaterialParameters().color"
321
+ [vertexColors]="lineMaterialParameters().vertexColors"
322
+ [linewidth]="lineMaterialParameters().linewidth"
323
+ [alphaToCoverage]="lineMaterialParameters().alphaToCoverage"
324
+ [dashed]="lineMaterialParameters().dashed"
325
+ [dashScale]="lineMaterialParameters().dashScale"
326
+ [dashSize]="lineMaterialParameters().dashSize"
327
+ [dashOffset]="lineMaterialParameters().dashOffset"
328
+ [gapSize]="lineMaterialParameters().gapSize"
329
+ [wireframe]="lineMaterialParameters().wireframe"
330
+ [worldUnits]="lineMaterialParameters().worldUnits"
265
331
  />
266
332
  </ngt-primitive>
267
333
  `,
268
334
  imports: [NgtArgs],
269
335
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
270
336
  }]
271
- }], propDecorators: { lineRef: [{
337
+ }], ctorParameters: function () { return []; }, propDecorators: { lineRef: [{
272
338
  type: Input
273
339
  }], points: [{
274
- type: Input
340
+ type: Input,
341
+ args: [{ required: true }]
275
342
  }], segments: [{
276
343
  type: Input
277
344
  }] } });
278
345
 
279
- class NgtsCatmullRomLine extends NgtsLineInput {
280
- constructor() {
281
- super(...arguments);
282
- this.lineRef = injectNgtRef();
283
- }
346
+ class NgtsCatmullRomLine extends NgtsLineInputs {
284
347
  set points(points) {
285
348
  this.set({ points });
286
349
  }
@@ -296,20 +359,33 @@ class NgtsCatmullRomLine extends NgtsLineInput {
296
359
  set segments(segments) {
297
360
  this.set({ segments });
298
361
  }
299
- initialize() {
300
- super.initialize();
301
- this.set({ closed: false, curveType: 'centripetal', tension: 0.5, segments: 64 });
302
- this.connect('curve', combineLatest([
303
- this.select('points'),
304
- this.select('closed'),
305
- this.select('curveType'),
306
- this.select('tension'),
307
- ]).pipe(map(([points, closed, curveType, tension]) => {
308
- const mappedPoints = points.map((p) => p instanceof THREE.Vector3 ? p : new THREE.Vector3(...p));
309
- return new CatmullRomCurve3(mappedPoints, closed, curveType, tension);
310
- })));
311
- this.connect('segmentedPoints', combineLatest([this.select('curve'), this.select('segments')]).pipe(map(([curve, segments]) => curve.getPoints(segments))));
312
- this.connect('interpolatedVertexColors', combineLatest([this.select('vertexColors').pipe(startWithUndefined()), this.select('segments')]).pipe(map(([vertexColors, segments]) => {
362
+ #points;
363
+ #closed;
364
+ #curveType;
365
+ #tension;
366
+ #vertexColors;
367
+ #curve;
368
+ #segments;
369
+ constructor() {
370
+ super();
371
+ this.lineRef = injectNgtRef();
372
+ this.#points = this.select('points');
373
+ this.#closed = this.select('closed');
374
+ this.#curveType = this.select('curveType');
375
+ this.#tension = this.select('tension');
376
+ this.#vertexColors = this.select('vertexColors');
377
+ this.#curve = computed(() => {
378
+ const mappedPoints = this.#points().map((p) => p instanceof THREE.Vector3 ? p : new THREE.Vector3(...p));
379
+ return new CatmullRomCurve3(mappedPoints, this.#closed(), this.#curveType(), this.#tension());
380
+ });
381
+ this.#segments = this.select('segments');
382
+ this.segmentedPoints = computed(() => {
383
+ const curve = this.#curve();
384
+ return curve.getPoints(this.#segments());
385
+ });
386
+ this.interpolatedVertexColors = computed(() => {
387
+ const vertexColors = this.#vertexColors();
388
+ const segments = this.#segments();
313
389
  if (!vertexColors || vertexColors.length < 2)
314
390
  return undefined;
315
391
  if (vertexColors.length === segments + 1)
@@ -325,58 +401,61 @@ class NgtsCatmullRomLine extends NgtsLineInput {
325
401
  iColors.push(mappedColors[colorIndex].clone().lerp(mappedColors[colorIndex + 1], alpha));
326
402
  }
327
403
  iColors.push(mappedColors[mappedColors.length - 1]);
328
- })));
404
+ return iColors;
405
+ });
406
+ this.set({ closed: false, curveType: 'centripetal', tension: 0.5, segments: 64 });
329
407
  }
330
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsCatmullRomLine, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
331
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsCatmullRomLine, isStandalone: true, selector: "ngts-catmull-rom-line[points]", inputs: { lineRef: "lineRef", points: "points", closed: "closed", curveType: "curveType", tension: "tension", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
408
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsCatmullRomLine, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
409
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsCatmullRomLine, isStandalone: true, selector: "ngts-catmull-rom-line", inputs: { lineRef: "lineRef", points: "points", closed: "closed", curveType: "curveType", tension: "tension", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
332
410
  <ngts-line
333
411
  [lineRef]="lineRef"
334
- [points]="get('segmentedPoints')"
335
- [color]="get('color')"
336
- [vertexColors]="get('interpolatedVertexColors')"
337
- [resolution]="get('resolution')"
338
- [lineWidth]="get('lineWidth')"
339
- [alphaToCoverage]="get('alphaToCoverage')"
340
- [dashed]="get('dashed')"
341
- [dashScale]="get('dashScale')"
342
- [dashOffset]="get('dashOffset')"
343
- [dashSize]="get('dashSize')"
344
- [gapSize]="get('gapSize')"
345
- [wireframe]="get('wireframe')"
346
- [worldUnits]="get('worldUnits')"
412
+ [points]="segmentedPoints()"
413
+ [vertexColors]="interpolatedVertexColors()"
414
+ [color]="lineParameters().color"
415
+ [resolution]="lineParameters().resolution"
416
+ [lineWidth]="lineParameters().linewidth"
417
+ [alphaToCoverage]="lineParameters().alphaToCoverage"
418
+ [dashed]="lineParameters().dashed"
419
+ [dashScale]="lineParameters().dashScale"
420
+ [dashSize]="lineParameters().dashSize"
421
+ [dashOffset]="lineParameters().dashOffset"
422
+ [gapSize]="lineParameters().gapSize"
423
+ [wireframe]="lineParameters().wireframe"
424
+ [worldUnits]="lineParameters().worldUnits"
347
425
  />
348
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] }); }
426
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line", inputs: ["lineRef", "points", "segments"] }] }); }
349
427
  }
350
428
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsCatmullRomLine, decorators: [{
351
429
  type: Component,
352
430
  args: [{
353
- selector: 'ngts-catmull-rom-line[points]',
431
+ selector: 'ngts-catmull-rom-line',
354
432
  standalone: true,
355
433
  template: `
356
434
  <ngts-line
357
435
  [lineRef]="lineRef"
358
- [points]="get('segmentedPoints')"
359
- [color]="get('color')"
360
- [vertexColors]="get('interpolatedVertexColors')"
361
- [resolution]="get('resolution')"
362
- [lineWidth]="get('lineWidth')"
363
- [alphaToCoverage]="get('alphaToCoverage')"
364
- [dashed]="get('dashed')"
365
- [dashScale]="get('dashScale')"
366
- [dashOffset]="get('dashOffset')"
367
- [dashSize]="get('dashSize')"
368
- [gapSize]="get('gapSize')"
369
- [wireframe]="get('wireframe')"
370
- [worldUnits]="get('worldUnits')"
436
+ [points]="segmentedPoints()"
437
+ [vertexColors]="interpolatedVertexColors()"
438
+ [color]="lineParameters().color"
439
+ [resolution]="lineParameters().resolution"
440
+ [lineWidth]="lineParameters().linewidth"
441
+ [alphaToCoverage]="lineParameters().alphaToCoverage"
442
+ [dashed]="lineParameters().dashed"
443
+ [dashScale]="lineParameters().dashScale"
444
+ [dashSize]="lineParameters().dashSize"
445
+ [dashOffset]="lineParameters().dashOffset"
446
+ [gapSize]="lineParameters().gapSize"
447
+ [wireframe]="lineParameters().wireframe"
448
+ [worldUnits]="lineParameters().worldUnits"
371
449
  />
372
450
  `,
373
451
  imports: [NgtsLine],
374
452
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
375
453
  }]
376
- }], propDecorators: { lineRef: [{
454
+ }], ctorParameters: function () { return []; }, propDecorators: { lineRef: [{
377
455
  type: Input
378
456
  }], points: [{
379
- type: Input
457
+ type: Input,
458
+ args: [{ required: true }]
380
459
  }], closed: [{
381
460
  type: Input
382
461
  }], curveType: [{
@@ -387,11 +466,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
387
466
  type: Input
388
467
  }] } });
389
468
 
390
- class NgtsCubicBezierLine extends NgtsLineInput {
391
- constructor() {
392
- super(...arguments);
393
- this.lineRef = injectNgtRef();
394
- }
469
+ class NgtsCubicBezierLine extends NgtsLineInputs {
395
470
  set start(start) {
396
471
  this.set({ start });
397
472
  }
@@ -407,85 +482,98 @@ class NgtsCubicBezierLine extends NgtsLineInput {
407
482
  set segments(segments) {
408
483
  this.set({ segments });
409
484
  }
410
- initialize() {
411
- super.initialize();
412
- this.set({ segments: 10 });
413
- this.connect('points', this.select(['start', 'end', 'midA', 'midB', 'segments'], ({ start, end, midA, midB, segments }) => {
485
+ #start;
486
+ #end;
487
+ #midA;
488
+ #midB;
489
+ #segments;
490
+ constructor() {
491
+ super();
492
+ this.lineRef = injectNgtRef();
493
+ this.#start = this.select('start');
494
+ this.#end = this.select('end');
495
+ this.#midA = this.select('midA');
496
+ this.#midB = this.select('midB');
497
+ this.#segments = this.select('segments');
498
+ this.points = computed(() => {
499
+ const start = this.#start();
500
+ const end = this.#end();
501
+ const midA = this.#midA();
502
+ const midB = this.#midB();
503
+ const segments = this.#segments();
414
504
  const startV = start instanceof THREE.Vector3 ? start : new THREE.Vector3(...start);
415
505
  const endV = end instanceof THREE.Vector3 ? end : new THREE.Vector3(...end);
416
506
  const midAV = midA instanceof THREE.Vector3 ? midA : new THREE.Vector3(...midA);
417
507
  const midBV = midB instanceof THREE.Vector3 ? midB : new THREE.Vector3(...midB);
418
508
  return new THREE.CubicBezierCurve3(startV, midAV, midBV, endV).getPoints(segments);
419
- }));
509
+ });
510
+ this.set({ segments: 10 });
420
511
  }
421
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsCubicBezierLine, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
422
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsCubicBezierLine, isStandalone: true, selector: "ngts-cubic-bezier-line[start][end][midA][midB]", inputs: { lineRef: "lineRef", start: "start", end: "end", midA: "midA", midB: "midB", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
512
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsCubicBezierLine, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
513
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsCubicBezierLine, isStandalone: true, selector: "ngts-cubic-bezier-line", inputs: { lineRef: "lineRef", start: "start", end: "end", midA: "midA", midB: "midB", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
423
514
  <ngts-line
424
515
  [lineRef]="lineRef"
425
- [points]="get('points')"
426
- [color]="get('color')"
427
- [vertexColors]="get('vertexColors')"
428
- [resolution]="get('resolution')"
429
- [lineWidth]="get('lineWidth')"
430
- [alphaToCoverage]="get('alphaToCoverage')"
431
- [dashed]="get('dashed')"
432
- [dashScale]="get('dashScale')"
433
- [dashSize]="get('dashSize')"
434
- [dashOffset]="get('dashOffset')"
435
- [gapSize]="get('gapSize')"
436
- [wireframe]="get('wireframe')"
437
- [worldUnits]="get('worldUnits')"
516
+ [points]="points()"
517
+ [color]="lineParameters().color"
518
+ [vertexColors]="lineParameters().vertexColors"
519
+ [resolution]="lineParameters().resolution"
520
+ [lineWidth]="lineParameters().linewidth"
521
+ [alphaToCoverage]="lineParameters().alphaToCoverage"
522
+ [dashed]="lineParameters().dashed"
523
+ [dashScale]="lineParameters().dashScale"
524
+ [dashSize]="lineParameters().dashSize"
525
+ [dashOffset]="lineParameters().dashOffset"
526
+ [gapSize]="lineParameters().gapSize"
527
+ [wireframe]="lineParameters().wireframe"
528
+ [worldUnits]="lineParameters().worldUnits"
438
529
  />
439
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] }); }
530
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line", inputs: ["lineRef", "points", "segments"] }] }); }
440
531
  }
441
532
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsCubicBezierLine, decorators: [{
442
533
  type: Component,
443
534
  args: [{
444
- selector: 'ngts-cubic-bezier-line[start][end][midA][midB]',
535
+ selector: 'ngts-cubic-bezier-line',
445
536
  standalone: true,
446
537
  template: `
447
538
  <ngts-line
448
539
  [lineRef]="lineRef"
449
- [points]="get('points')"
450
- [color]="get('color')"
451
- [vertexColors]="get('vertexColors')"
452
- [resolution]="get('resolution')"
453
- [lineWidth]="get('lineWidth')"
454
- [alphaToCoverage]="get('alphaToCoverage')"
455
- [dashed]="get('dashed')"
456
- [dashScale]="get('dashScale')"
457
- [dashSize]="get('dashSize')"
458
- [dashOffset]="get('dashOffset')"
459
- [gapSize]="get('gapSize')"
460
- [wireframe]="get('wireframe')"
461
- [worldUnits]="get('worldUnits')"
540
+ [points]="points()"
541
+ [color]="lineParameters().color"
542
+ [vertexColors]="lineParameters().vertexColors"
543
+ [resolution]="lineParameters().resolution"
544
+ [lineWidth]="lineParameters().linewidth"
545
+ [alphaToCoverage]="lineParameters().alphaToCoverage"
546
+ [dashed]="lineParameters().dashed"
547
+ [dashScale]="lineParameters().dashScale"
548
+ [dashSize]="lineParameters().dashSize"
549
+ [dashOffset]="lineParameters().dashOffset"
550
+ [gapSize]="lineParameters().gapSize"
551
+ [wireframe]="lineParameters().wireframe"
552
+ [worldUnits]="lineParameters().worldUnits"
462
553
  />
463
554
  `,
464
- imports: [NgtsLine, NgIf],
465
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
555
+ imports: [NgtsLine],
466
556
  }]
467
- }], propDecorators: { lineRef: [{
557
+ }], ctorParameters: function () { return []; }, propDecorators: { lineRef: [{
468
558
  type: Input
469
559
  }], start: [{
470
- type: Input
560
+ type: Input,
561
+ args: [{ required: true }]
471
562
  }], end: [{
472
- type: Input
563
+ type: Input,
564
+ args: [{ required: true }]
473
565
  }], midA: [{
474
- type: Input
566
+ type: Input,
567
+ args: [{ required: true }]
475
568
  }], midB: [{
476
- type: Input
569
+ type: Input,
570
+ args: [{ required: true }]
477
571
  }], segments: [{
478
572
  type: Input
479
573
  }] } });
480
574
 
481
575
  extend({ LineSegments, LineBasicMaterial });
482
- class NgtsEdges extends NgtRxStore {
483
- constructor() {
484
- super(...arguments);
485
- this.edgesRef = injectNgtRef();
486
- this.withChildren = false;
487
- this.noop = () => null;
488
- }
576
+ class NgtsEdges extends NgtSignalStore {
489
577
  set threshold(threshold) {
490
578
  this.set({ threshold });
491
579
  }
@@ -498,32 +586,35 @@ class NgtsEdges extends NgtRxStore {
498
586
  set userData(userData) {
499
587
  this.set({ userData });
500
588
  }
501
- initialize() {
502
- super.initialize();
503
- this.set({
589
+ constructor() {
590
+ super({
504
591
  threshold: 15,
505
592
  color: 'black',
506
593
  userData: {},
507
594
  });
508
- }
509
- ngOnInit() {
510
- this.setupGeometry();
511
- }
512
- setupGeometry() {
513
- this.hold(this.edgesRef.$, (segments) => {
514
- const parent = segments.parent;
595
+ this.edgesRef = injectNgtRef();
596
+ this.withChildren = false;
597
+ this.noop = () => null;
598
+ this.#setupGeometry();
599
+ }
600
+ #setupGeometry() {
601
+ effect(() => {
602
+ const edges = this.edgesRef.nativeElement;
603
+ if (!edges)
604
+ return;
605
+ const parent = edges.parent;
515
606
  if (parent) {
516
607
  const geom = this.get('geometry') || parent.geometry;
517
608
  const threshold = this.get('threshold');
518
- if (geom !== segments.userData['currentGeom'] || threshold !== segments.userData['currentThreshold']) {
519
- segments.userData['currentGeom'] = geom;
520
- segments.userData['currentThreshold'] = threshold;
521
- segments.geometry = new THREE.EdgesGeometry(geom, threshold);
609
+ if (geom !== edges.userData['currentGeom'] || threshold !== edges.userData['currentThreshold']) {
610
+ edges.userData['currentGeom'] = geom;
611
+ edges.userData['currentThreshold'] = threshold;
612
+ edges.geometry = new THREE.EdgesGeometry(geom, threshold);
522
613
  }
523
614
  }
524
615
  });
525
616
  }
526
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsEdges, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
617
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsEdges, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
527
618
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsEdges, isStandalone: true, selector: "ngts-edges", inputs: { edgesRef: "edgesRef", threshold: "threshold", color: "color", geometry: "geometry", userData: "userData", withChildren: "withChildren" }, usesInheritance: true, ngImport: i0, template: `
528
619
  <ngt-line-segments [ref]="edgesRef" [raycast]="noop" ngtCompound>
529
620
  <ng-container *ngIf="withChildren; else noChildren">
@@ -553,7 +644,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
553
644
  imports: [NgIf],
554
645
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
555
646
  }]
556
- }], propDecorators: { edgesRef: [{
647
+ }], ctorParameters: function () { return []; }, propDecorators: { edgesRef: [{
557
648
  type: Input
558
649
  }], threshold: [{
559
650
  type: Input
@@ -567,30 +658,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
567
658
  type: Input
568
659
  }] } });
569
660
 
570
- const isOrbitControls = (controls) => {
571
- return 'minPolarAngle' in controls;
572
- };
661
+ const isOrbitControls = (controls) => 'minPolarAngle' in controls;
573
662
  const NGTS_GIZMO_HELPER_API = new InjectionToken('NgtsGizmoHelper API');
574
- function gizmoHelperApiFactory(gizmo) {
575
- const store = inject(NgtStore);
576
- return {
577
- tweenCamera: (direction) => {
578
- const { controls, camera, invalidate } = store.get();
579
- const defaultControls = controls;
580
- gizmo.animating = true;
581
- if (defaultControls)
582
- gizmo.focusPoint = defaultControls.target;
583
- gizmo.radius = camera.position.distanceTo(gizmo.target);
584
- // rotate from current camera orientation
585
- gizmo.q1.copy(camera.quaternion);
586
- // to new current camera orientation
587
- gizmo.targetPosition.copy(direction).multiplyScalar(gizmo.radius).add(gizmo.target);
588
- gizmo.dummy.lookAt(gizmo.targetPosition);
589
- gizmo.q2.copy(gizmo.dummy.quaternion);
590
- invalidate();
591
- },
592
- };
593
- }
594
663
  extend({ Group });
595
664
  class NgtsGizmoHelperContent {
596
665
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoHelperContent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
@@ -598,30 +667,9 @@ class NgtsGizmoHelperContent {
598
667
  }
599
668
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoHelperContent, decorators: [{
600
669
  type: Directive,
601
- args: [{
602
- selector: 'ng-template[ngtsGizmoHelperContent]',
603
- standalone: true,
604
- }]
670
+ args: [{ selector: 'ng-template[ngtsGizmoHelperContent]', standalone: true }]
605
671
  }] });
606
- class NgtsGizmoHelper extends NgtRxStore {
607
- constructor() {
608
- super(...arguments);
609
- this.store = inject(NgtStore);
610
- this.gizmoRef = injectNgtRef();
611
- this.virtualCameraRef = injectNgtRef();
612
- this.animating = false;
613
- this.radius = 0;
614
- this.focusPoint = new Vector3(0, 0, 0);
615
- this.q1 = new Quaternion();
616
- this.q2 = new Quaternion();
617
- this.target = new Vector3();
618
- this.targetPosition = new Vector3();
619
- this.dummy = new Object3D();
620
- this.defaultUp = new Vector3(0, 0, 0);
621
- this.turnRate = 2 * Math.PI; // turn rate in angles per sec
622
- this.matrix = new Matrix4();
623
- this.updated = new EventEmitter();
624
- }
672
+ class NgtsGizmoHelper extends NgtSignalStore {
625
673
  set alignment(alignment) {
626
674
  this.set({ alignment });
627
675
  }
@@ -634,41 +682,105 @@ class NgtsGizmoHelper extends NgtRxStore {
634
682
  set autoClear(autoClear) {
635
683
  this.set({ autoClear });
636
684
  }
637
- initialize() {
638
- super.initialize();
639
- this.set({ alignment: 'bottom-right', margin: [80, 80], renderPriority: 1 });
640
- }
641
- ngOnInit() {
642
- this.updateDefaultUp();
643
- this.setGizmoPosition();
685
+ #store;
686
+ #camera;
687
+ #size;
688
+ #alignment;
689
+ #margin;
690
+ #animating;
691
+ #radius;
692
+ #focusPoint;
693
+ #q1;
694
+ #q2;
695
+ #target;
696
+ #targetPosition;
697
+ #dummy;
698
+ #defaultUp;
699
+ #turnRate; // turn rate in angles per sec
700
+ #matrix;
701
+ constructor() {
702
+ super({ alignment: 'bottom-right', margin: [80, 80], renderPriority: 1 });
703
+ this.gizmoRef = injectNgtRef();
704
+ this.virtualCameraRef = injectNgtRef();
705
+ this.updated = new EventEmitter();
706
+ this.#store = inject(NgtStore);
707
+ this.#camera = this.#store.select('camera');
708
+ this.#size = this.#store.select('size');
709
+ this.#alignment = this.select('alignment');
710
+ this.#margin = this.select('margin');
711
+ this.#animating = false;
712
+ this.#radius = 0;
713
+ this.#focusPoint = new Vector3(0, 0, 0);
714
+ this.#q1 = new Quaternion();
715
+ this.#q2 = new Quaternion();
716
+ this.#target = new Vector3();
717
+ this.#targetPosition = new Vector3();
718
+ this.#dummy = new Object3D();
719
+ this.#defaultUp = new Vector3(0, 0, 0);
720
+ this.#turnRate = 2 * Math.PI; // turn rate in angles per sec
721
+ this.#matrix = new Matrix4();
722
+ this.priority = this.select('renderPriority');
723
+ this.position = computed(() => {
724
+ const size = this.#size();
725
+ const alignment = this.#alignment();
726
+ const margin = this.#margin();
727
+ const [marginX, marginY] = margin;
728
+ const x = alignment.endsWith('-center')
729
+ ? 0
730
+ : alignment.endsWith('-left')
731
+ ? -size.width / 2 + marginX
732
+ : size.width / 2 - marginX;
733
+ const y = alignment.startsWith('center-')
734
+ ? 0
735
+ : alignment.startsWith('top-')
736
+ ? size.height / 2 - marginY
737
+ : -size.height / 2 + marginY;
738
+ return [x, y, 0];
739
+ });
740
+ this.api = computed(() => (direction) => {
741
+ const { controls, camera, invalidate } = this.#store.get();
742
+ const defaultControls = controls;
743
+ this.#animating = true;
744
+ if (defaultControls)
745
+ this.#focusPoint = defaultControls.target;
746
+ this.#radius = camera.position.distanceTo(this.#target);
747
+ // rotate from current camera orientation
748
+ this.#q1.copy(camera.quaternion);
749
+ // to new current camera orientation
750
+ this.#targetPosition.copy(direction).multiplyScalar(this.#radius).add(this.#target);
751
+ this.#dummy.lookAt(this.#targetPosition);
752
+ this.#q2.copy(this.#dummy.quaternion);
753
+ invalidate();
754
+ });
755
+ this.#updateDefaultUp();
644
756
  }
645
757
  onBeforeRender(delta) {
646
758
  if (this.virtualCameraRef.nativeElement && this.gizmoRef.nativeElement) {
647
- const { controls, camera: mainCamera, invalidate } = this.store.get();
759
+ const { controls, camera: mainCamera, invalidate } = this.#store.get();
648
760
  const defaultControls = controls;
649
761
  // Animate step
650
- if (this.animating) {
651
- if (this.q1.angleTo(this.q2) < 0.01) {
652
- this.animating = false;
762
+ if (this.#animating) {
763
+ if (this.#q1.angleTo(this.#q2) < 0.01) {
764
+ this.#animating = false;
653
765
  // Orbit controls uses UP vector as the orbit axes,
654
766
  // so we need to reset it after the animation is done
655
767
  // moving it around for the controls to work correctly
656
768
  if (isOrbitControls(defaultControls)) {
657
- mainCamera.up.copy(this.defaultUp);
769
+ mainCamera.up.copy(this.#defaultUp);
658
770
  }
659
771
  }
660
772
  else {
661
- const step = delta * this.turnRate;
773
+ const step = delta * this.#turnRate;
662
774
  // animate position by doing a slerp and then scaling the position on the unit sphere
663
- this.q1.rotateTowards(this.q2, step);
775
+ this.#q1.rotateTowards(this.#q2, step);
664
776
  // animate orientation
665
777
  mainCamera.position
666
778
  .set(0, 0, 1)
667
- .applyQuaternion(this.q1)
668
- .multiplyScalar(this.radius)
669
- .add(this.focusPoint);
670
- mainCamera.up.set(0, 1, 0).applyQuaternion(this.q1).normalize();
671
- mainCamera.quaternion.copy(this.q1);
779
+ .applyQuaternion(this.#q1)
780
+ .multiplyScalar(this.#radius)
781
+ .add(this.#focusPoint);
782
+ mainCamera.up.set(0, 1, 0).applyQuaternion(this.#q1).normalize();
783
+ mainCamera.quaternion.copy(this.#q1);
672
784
  if (this.updated.observed)
673
785
  this.updated.emit();
674
786
  else if (defaultControls) {
@@ -678,51 +790,30 @@ class NgtsGizmoHelper extends NgtRxStore {
678
790
  }
679
791
  }
680
792
  // Sync Gizmo with main camera orientation
681
- this.matrix.copy(mainCamera.matrix).invert();
682
- this.gizmoRef.nativeElement.quaternion.setFromRotationMatrix(this.matrix);
793
+ this.#matrix.copy(mainCamera.matrix).invert();
794
+ this.gizmoRef.nativeElement.quaternion.setFromRotationMatrix(this.#matrix);
683
795
  }
684
796
  }
685
- setGizmoPosition() {
686
- this.connect('gizmoPosition', combineLatest([
687
- this.store.select('size'),
688
- combineLatest({
689
- alignment: this.select('alignment'),
690
- margin: this.select('margin'),
691
- }),
692
- ]).pipe(map(([size, { alignment, margin }]) => {
693
- const [marginX, marginY] = margin;
694
- const x = alignment.endsWith('-center')
695
- ? 0
696
- : alignment.endsWith('-left')
697
- ? -size.width / 2 + marginX
698
- : size.width / 2 - marginX;
699
- const y = alignment.startsWith('center-')
700
- ? 0
701
- : alignment.startsWith('top-')
702
- ? size.height / 2 - marginY
703
- : -size.height / 2 + marginY;
704
- return [x, y, 0];
705
- })));
706
- }
707
- updateDefaultUp() {
708
- this.hold(this.store.select('camera'), (camera) => {
709
- this.defaultUp.copy(camera.up);
797
+ #updateDefaultUp() {
798
+ effect(() => {
799
+ const camera = this.#camera();
800
+ if (!camera)
801
+ return;
802
+ this.#defaultUp.copy(camera.up);
710
803
  });
711
804
  }
712
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoHelper, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
713
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoHelper, isStandalone: true, selector: "ngts-gizmo-helper", inputs: { alignment: "alignment", margin: "margin", renderPriority: "renderPriority", autoClear: "autoClear" }, outputs: { updated: "updated" }, providers: [{ provide: NGTS_GIZMO_HELPER_API, useFactory: gizmoHelperApiFactory, deps: [NgtsGizmoHelper] }], queries: [{ propertyName: "gizmoHelperContent", first: true, predicate: NgtsGizmoHelperContent, descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: `
714
- <ngt-portal [renderPriority]="get('renderPriority')">
805
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoHelper, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
806
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoHelper, isStandalone: true, selector: "ngts-gizmo-helper", inputs: { alignment: "alignment", margin: "margin", renderPriority: "renderPriority", autoClear: "autoClear" }, outputs: { updated: "updated" }, providers: [
807
+ { provide: NGTS_GIZMO_HELPER_API, useFactory: (gizmo) => gizmo.api, deps: [NgtsGizmoHelper] },
808
+ ], queries: [{ propertyName: "gizmoHelperContent", first: true, predicate: NgtsGizmoHelperContent, descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: `
809
+ <ngt-portal [renderPriority]="priority()">
715
810
  <ng-template ngtPortalContent>
716
811
  <ngts-orthographic-camera
717
812
  [cameraRef]="virtualCameraRef"
718
813
  [makeDefault]="true"
719
814
  [position]="[0, 0, 200]"
720
815
  />
721
- <ngt-group
722
- [ref]="gizmoRef"
723
- [position]="get('gizmoPosition')"
724
- (beforeRender)="onBeforeRender($any($event).state.delta)"
725
- >
816
+ <ngt-group [ref]="gizmoRef" [position]="position()" (beforeRender)="onBeforeRender($event.state.delta)">
726
817
  <ng-container *ngTemplateOutlet="gizmoHelperContent" />
727
818
  </ngt-group>
728
819
  </ng-template>
@@ -735,28 +826,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
735
826
  selector: 'ngts-gizmo-helper',
736
827
  standalone: true,
737
828
  template: `
738
- <ngt-portal [renderPriority]="get('renderPriority')">
829
+ <ngt-portal [renderPriority]="priority()">
739
830
  <ng-template ngtPortalContent>
740
831
  <ngts-orthographic-camera
741
832
  [cameraRef]="virtualCameraRef"
742
833
  [makeDefault]="true"
743
834
  [position]="[0, 0, 200]"
744
835
  />
745
- <ngt-group
746
- [ref]="gizmoRef"
747
- [position]="get('gizmoPosition')"
748
- (beforeRender)="onBeforeRender($any($event).state.delta)"
749
- >
836
+ <ngt-group [ref]="gizmoRef" [position]="position()" (beforeRender)="onBeforeRender($event.state.delta)">
750
837
  <ng-container *ngTemplateOutlet="gizmoHelperContent" />
751
838
  </ngt-group>
752
839
  </ng-template>
753
840
  </ngt-portal>
754
841
  `,
755
842
  imports: [NgtPortal, NgtPortalContent, NgtsOrthographicCamera, NgTemplateOutlet],
756
- providers: [{ provide: NGTS_GIZMO_HELPER_API, useFactory: gizmoHelperApiFactory, deps: [NgtsGizmoHelper] }],
843
+ providers: [
844
+ { provide: NGTS_GIZMO_HELPER_API, useFactory: (gizmo) => gizmo.api, deps: [NgtsGizmoHelper] },
845
+ ],
757
846
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
758
847
  }]
759
- }], propDecorators: { alignment: [{
848
+ }], ctorParameters: function () { return []; }, propDecorators: { alignment: [{
760
849
  type: Input
761
850
  }], margin: [{
762
851
  type: Input
@@ -801,10 +890,16 @@ const edges = [
801
890
  ].map(makePositionVector);
802
891
  const edgeDimensions = edges.map((edge) => edge.toArray().map((axis) => (axis == 0 ? 0.5 : 0.25)));
803
892
 
804
- class NgtsGizmoViewcubeInputs extends NgtRxStore {
893
+ class NgtsGizmoViewcubeInputs extends NgtSignalStore {
805
894
  constructor() {
806
895
  super(...arguments);
807
- this.store = inject(NgtStore);
896
+ this.viewcubeHoverColor = this.select('hoverColor');
897
+ this.viewcubeOpacity = this.select('opacity');
898
+ this.viewcubeTextColor = this.select('textColor');
899
+ this.viewcubeStrokeColor = this.select('strokeColor');
900
+ this.viewcubeFaces = this.select('faces');
901
+ this.viewcubeFont = this.select('font');
902
+ this.viewcubeColor = this.select('color');
808
903
  }
809
904
  set opacity(opacity) {
810
905
  this.set({ opacity });
@@ -821,11 +916,17 @@ class NgtsGizmoViewcubeInputs extends NgtRxStore {
821
916
  set faces(faces) {
822
917
  this.set({ faces });
823
918
  }
919
+ set font(font) {
920
+ this.set({ font });
921
+ }
922
+ set color(color) {
923
+ this.set({ color });
924
+ }
824
925
  set clickEmitter(clickEmitter) {
825
926
  this.set({ clickEmitter });
826
927
  }
827
928
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcubeInputs, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
828
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewcubeInputs, inputs: { opacity: "opacity", hoverColor: "hoverColor", textColor: "textColor", strokeColor: "strokeColor", faces: "faces", clickEmitter: "clickEmitter" }, usesInheritance: true, ngImport: i0 }); }
929
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewcubeInputs, inputs: { opacity: "opacity", hoverColor: "hoverColor", textColor: "textColor", strokeColor: "strokeColor", faces: "faces", font: "font", color: "color", clickEmitter: "clickEmitter" }, usesInheritance: true, ngImport: i0 }); }
829
930
  }
830
931
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcubeInputs, decorators: [{
831
932
  type: Directive
@@ -839,59 +940,64 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
839
940
  type: Input
840
941
  }], faces: [{
841
942
  type: Input
943
+ }], font: [{
944
+ type: Input
945
+ }], color: [{
946
+ type: Input
842
947
  }], clickEmitter: [{
843
948
  type: Input
844
949
  }] } });
845
950
 
846
951
  extend({ Mesh, BoxGeometry, MeshBasicMaterial });
847
- class NgtsGizmoViewcubeEdgeCube extends NgtsGizmoViewcubeInputs {
848
- constructor() {
849
- super(...arguments);
850
- this.gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
851
- this.hover = false;
852
- }
952
+ class NgtsGizmoViewcubeEdgeCube extends NgtSignalStore {
953
+ #gizmoHelperApi;
853
954
  set dimensions(dimensions) {
854
955
  this.set({ dimensions });
855
956
  }
856
957
  set position(position) {
857
958
  this.set({ position });
858
959
  }
859
- initialize() {
860
- super.initialize();
861
- this.set({ hoverColor: colors.hover });
960
+ constructor() {
961
+ super();
962
+ this.#gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
963
+ this.viewcubeInputs = inject(NgtsGizmoViewcubeInputs);
964
+ this.hover = signal(false);
965
+ this.edgePosition = this.select('position');
966
+ this.edgeDimensions = this.select('dimensions');
967
+ this.viewcubeInputs.patch({ hoverColor: colors.hover });
862
968
  }
863
969
  onPointerMove(event) {
864
970
  event.stopPropagation();
865
- this.hover = true;
971
+ this.hover.set(true);
866
972
  }
867
973
  onPointerOut(event) {
868
974
  event.stopPropagation();
869
- this.hover = false;
975
+ this.hover.set(false);
870
976
  }
871
977
  onClick(event) {
872
- if (this.get('clickEmitter')?.observed) {
873
- this.get('clickEmitter').emit(event);
978
+ if (this.viewcubeInputs.get('clickEmitter')?.observed) {
979
+ this.viewcubeInputs.get('clickEmitter').emit(event);
874
980
  }
875
981
  else {
876
982
  event.stopPropagation();
877
- this.gizmoHelperApi.tweenCamera(this.get('position'));
983
+ this.#gizmoHelperApi()(this.get('position'));
878
984
  }
879
985
  }
880
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcubeEdgeCube, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
881
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewcubeEdgeCube, isStandalone: true, selector: "ngts-gizmo-viewcube-edge-cube[dimensions][position]", inputs: { dimensions: "dimensions", position: "position" }, usesInheritance: true, ngImport: i0, template: `
986
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcubeEdgeCube, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
987
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewcubeEdgeCube, isStandalone: true, selector: "ngts-gizmo-viewcube-edge-cube", inputs: { dimensions: "dimensions", position: "position" }, usesInheritance: true, ngImport: i0, template: `
882
988
  <ngt-mesh
883
989
  [scale]="1.01"
884
- [position]="get('position')"
885
- (pointermove)="onPointerMove($any($event))"
886
- (pointerout)="onPointerOut($any($event))"
887
- (click)="onClick($any($event))"
990
+ [position]="edgePosition()"
991
+ (pointermove)="onPointerMove($event)"
992
+ (pointerout)="onPointerOut($event)"
993
+ (click)="onClick($event)"
888
994
  >
889
- <ngt-box-geometry *args="get('dimensions')" />
995
+ <ngt-box-geometry *args="edgeDimensions()" />
890
996
  <ngt-mesh-basic-material
891
- [color]="hover ? get('hoverColor') : 'white'"
997
+ [color]="hover() ? viewcubeInputs.viewcubeHoverColor() : 'white'"
892
998
  [transparent]="true"
893
999
  [opacity]="0.6"
894
- [visible]="hover"
1000
+ [visible]="hover()"
895
1001
  />
896
1002
  </ngt-mesh>
897
1003
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] }); }
@@ -899,65 +1005,62 @@ class NgtsGizmoViewcubeEdgeCube extends NgtsGizmoViewcubeInputs {
899
1005
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcubeEdgeCube, decorators: [{
900
1006
  type: Component,
901
1007
  args: [{
902
- selector: 'ngts-gizmo-viewcube-edge-cube[dimensions][position]',
1008
+ selector: 'ngts-gizmo-viewcube-edge-cube',
903
1009
  standalone: true,
904
1010
  template: `
905
1011
  <ngt-mesh
906
1012
  [scale]="1.01"
907
- [position]="get('position')"
908
- (pointermove)="onPointerMove($any($event))"
909
- (pointerout)="onPointerOut($any($event))"
910
- (click)="onClick($any($event))"
1013
+ [position]="edgePosition()"
1014
+ (pointermove)="onPointerMove($event)"
1015
+ (pointerout)="onPointerOut($event)"
1016
+ (click)="onClick($event)"
911
1017
  >
912
- <ngt-box-geometry *args="get('dimensions')" />
1018
+ <ngt-box-geometry *args="edgeDimensions()" />
913
1019
  <ngt-mesh-basic-material
914
- [color]="hover ? get('hoverColor') : 'white'"
1020
+ [color]="hover() ? viewcubeInputs.viewcubeHoverColor() : 'white'"
915
1021
  [transparent]="true"
916
1022
  [opacity]="0.6"
917
- [visible]="hover"
1023
+ [visible]="hover()"
918
1024
  />
919
1025
  </ngt-mesh>
920
1026
  `,
921
1027
  imports: [NgtArgs],
922
1028
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
923
1029
  }]
924
- }], propDecorators: { dimensions: [{
925
- type: Input
1030
+ }], ctorParameters: function () { return []; }, propDecorators: { dimensions: [{
1031
+ type: Input,
1032
+ args: [{ required: true }]
926
1033
  }], position: [{
927
- type: Input
1034
+ type: Input,
1035
+ args: [{ required: true }]
928
1036
  }] } });
929
1037
 
930
1038
  extend({ MeshLambertMaterial, Mesh, BoxGeometry });
931
- class NgtsGizmoViewcubeFaceMaterial extends NgtsGizmoViewcubeInputs {
932
- constructor() {
933
- super(...arguments);
934
- this.document = inject(DOCUMENT);
935
- }
1039
+ class NgtsGizmoViewcubeFaceMaterial extends NgtSignalStore {
1040
+ #document;
1041
+ #store;
936
1042
  set index(index) {
937
1043
  this.set({ index });
938
1044
  }
939
1045
  set hover(hover) {
940
1046
  this.set({ hover });
941
1047
  }
942
- set font(font) {
943
- this.set({ font });
944
- }
945
- set color(color) {
946
- this.set({ color });
947
- }
948
- initialize() {
949
- super.initialize();
950
- this.set({
951
- font: '20px Inter var, Arial, sans-serif',
952
- faces: defaultFaces,
953
- color: colors.bg,
954
- hoverColor: colors.hover,
955
- textColor: colors.text,
956
- strokeColor: colors.stroke,
957
- opacity: 1,
958
- });
959
- this.connect('texture', this.select(['index', 'faces', 'color', 'font', 'textColor', 'strokeColor'], ({ index, faces, color, font, textColor, strokeColor }) => {
960
- const canvas = this.document.createElement('canvas');
1048
+ constructor() {
1049
+ super();
1050
+ this.#document = inject(DOCUMENT);
1051
+ this.#store = inject(NgtStore);
1052
+ this.gl = this.#store.select('gl');
1053
+ this.viewcubeInputs = inject(NgtsGizmoViewcubeInputs);
1054
+ this.faceIndex = this.select('index');
1055
+ this.faceHover = this.select('hover');
1056
+ this.texture = computed(() => {
1057
+ const index = this.faceIndex();
1058
+ const color = this.viewcubeInputs.viewcubeColor();
1059
+ const font = this.viewcubeInputs.viewcubeFont();
1060
+ const faces = this.viewcubeInputs.viewcubeFaces();
1061
+ const textColor = this.viewcubeInputs.viewcubeTextColor();
1062
+ const strokeColor = this.viewcubeInputs.viewcubeStrokeColor();
1063
+ const canvas = this.#document.createElement('canvas');
961
1064
  canvas.width = 128;
962
1065
  canvas.height = 128;
963
1066
  const context = canvas.getContext('2d');
@@ -970,101 +1073,92 @@ class NgtsGizmoViewcubeFaceMaterial extends NgtsGizmoViewcubeInputs {
970
1073
  context.fillStyle = textColor;
971
1074
  context.fillText(faces[index].toUpperCase(), 64, 76);
972
1075
  return new CanvasTexture(canvas);
973
- }));
1076
+ });
1077
+ this.viewcubeInputs.patch({
1078
+ color: colors.bg,
1079
+ font: '20px Inter var, Arial, sans-serif',
1080
+ faces: defaultFaces,
1081
+ hoverColor: colors.hover,
1082
+ textColor: colors.text,
1083
+ strokeColor: colors.stroke,
1084
+ opacity: 1,
1085
+ });
974
1086
  }
975
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcubeFaceMaterial, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
976
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewcubeFaceMaterial, isStandalone: true, selector: "ngts-gizmo-viewcube-face-material[hover][index]", inputs: { index: "index", hover: "hover", font: "font", color: "color" }, usesInheritance: true, ngImport: i0, template: `
1087
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcubeFaceMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1088
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewcubeFaceMaterial, isStandalone: true, selector: "ngts-gizmo-viewcube-face-material", inputs: { index: "index", hover: "hover" }, usesInheritance: true, ngImport: i0, template: `
977
1089
  <ngt-mesh-lambert-material
978
- [attach]="['material', get('index')]"
979
- [map]="get('texture')"
980
- [color]="get('hover') ? get('hoverColor') : get('color')"
981
- [opacity]="get('opacity')"
1090
+ [attach]="['material', faceIndex()]"
1091
+ [map]="texture()"
1092
+ [color]="faceHover() ? viewcubeInputs.viewcubeHoverColor() : viewcubeInputs.viewcubeColor()"
1093
+ [opacity]="viewcubeInputs.viewcubeOpacity()"
982
1094
  [transparent]="true"
983
1095
  >
984
- <ngt-value [rawValue]="store.get('gl').outputEncoding" attach="map.encoding" />
985
- <ngt-value [rawValue]="store.get('gl').capabilities.getMaxAnisotropy() || 1" attach="map.anisotrophy" />
1096
+ <ngt-value [rawValue]="gl().outputEncoding" attach="map.encoding" />
1097
+ <ngt-value [rawValue]="gl().capabilities.getMaxAnisotropy() || 1" attach="map.anisotrophy" />
986
1098
  </ngt-mesh-lambert-material>
987
1099
  `, isInline: true }); }
988
1100
  }
989
1101
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcubeFaceMaterial, decorators: [{
990
1102
  type: Component,
991
1103
  args: [{
992
- selector: 'ngts-gizmo-viewcube-face-material[hover][index]',
1104
+ selector: 'ngts-gizmo-viewcube-face-material',
993
1105
  standalone: true,
994
1106
  template: `
995
1107
  <ngt-mesh-lambert-material
996
- [attach]="['material', get('index')]"
997
- [map]="get('texture')"
998
- [color]="get('hover') ? get('hoverColor') : get('color')"
999
- [opacity]="get('opacity')"
1108
+ [attach]="['material', faceIndex()]"
1109
+ [map]="texture()"
1110
+ [color]="faceHover() ? viewcubeInputs.viewcubeHoverColor() : viewcubeInputs.viewcubeColor()"
1111
+ [opacity]="viewcubeInputs.viewcubeOpacity()"
1000
1112
  [transparent]="true"
1001
1113
  >
1002
- <ngt-value [rawValue]="store.get('gl').outputEncoding" attach="map.encoding" />
1003
- <ngt-value [rawValue]="store.get('gl').capabilities.getMaxAnisotropy() || 1" attach="map.anisotrophy" />
1114
+ <ngt-value [rawValue]="gl().outputEncoding" attach="map.encoding" />
1115
+ <ngt-value [rawValue]="gl().capabilities.getMaxAnisotropy() || 1" attach="map.anisotrophy" />
1004
1116
  </ngt-mesh-lambert-material>
1005
1117
  `,
1006
1118
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1007
1119
  }]
1008
- }], propDecorators: { index: [{
1009
- type: Input
1120
+ }], ctorParameters: function () { return []; }, propDecorators: { index: [{
1121
+ type: Input,
1122
+ args: [{ required: true }]
1010
1123
  }], hover: [{
1011
- type: Input
1012
- }], font: [{
1013
- type: Input
1014
- }], color: [{
1015
- type: Input
1124
+ type: Input,
1125
+ args: [{ required: true }]
1016
1126
  }] } });
1017
- class NgtsGizmoViewcubeFaceCube extends NgtsGizmoViewcubeInputs {
1127
+ class NgtsGizmoViewcubeFaceCube {
1018
1128
  constructor() {
1019
- super(...arguments);
1020
- this.gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
1021
- this.hover = -1;
1022
- }
1023
- set font(font) {
1024
- this.set({ font });
1025
- }
1026
- set color(color) {
1027
- this.set({ color });
1129
+ this.#gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
1130
+ this.viewcubeInputs = inject(NgtsGizmoViewcubeInputs);
1131
+ this.hover = signal(-1);
1028
1132
  }
1133
+ #gizmoHelperApi;
1029
1134
  onPointerMove(event) {
1030
1135
  event.stopPropagation();
1031
- this.hover = Math.floor(event.faceIndex / 2);
1136
+ this.hover.set(Math.floor(event.faceIndex / 2));
1032
1137
  }
1033
1138
  onPointerOut(event) {
1034
1139
  event.stopPropagation();
1035
- this.hover = -1;
1140
+ this.hover.set(-1);
1036
1141
  }
1037
1142
  onClick(event) {
1038
- if (this.get('clickEmitter')?.observed) {
1039
- this.get('clickEmitter').emit(event);
1143
+ if (this.viewcubeInputs.get('clickEmitter')?.observed) {
1144
+ this.viewcubeInputs.get('clickEmitter').emit(event);
1040
1145
  }
1041
1146
  else {
1042
1147
  event.stopPropagation();
1043
- this.gizmoHelperApi.tweenCamera(event.face.normal);
1148
+ this.#gizmoHelperApi()(event.face.normal);
1044
1149
  }
1045
1150
  }
1046
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcubeFaceCube, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1047
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewcubeFaceCube, isStandalone: true, selector: "ngts-gizmo-viewcube-face-cube", inputs: { font: "font", color: "color" }, usesInheritance: true, ngImport: i0, template: `
1151
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcubeFaceCube, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1152
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewcubeFaceCube, isStandalone: true, selector: "ngts-gizmo-viewcube-face-cube", ngImport: i0, template: `
1048
1153
  <ngt-mesh
1049
1154
  (pointermove)="onPointerMove($any($event))"
1050
1155
  (pointerout)="onPointerOut($any($event))"
1051
1156
  (click)="onClick($any($event))"
1052
1157
  >
1053
1158
  <ngt-box-geometry />
1054
- <ngts-gizmo-viewcube-face-material
1055
- *ngFor="let i; repeat: 6"
1056
- [hover]="hover === i"
1057
- [index]="i"
1058
- [font]="get('font')"
1059
- [color]="get('color')"
1060
- [opacity]="get('opacity')"
1061
- [hoverColor]="get('hoverColor')"
1062
- [textColor]="get('textColor')"
1063
- [strokeColor]="get('strokeColor')"
1064
- [faces]="get('faces')"
1065
- />
1159
+ <ngts-gizmo-viewcube-face-material *ngFor="let i; repeat: 6" [hover]="hover() === i" [index]="i" />
1066
1160
  </ngt-mesh>
1067
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsGizmoViewcubeFaceMaterial, selector: "ngts-gizmo-viewcube-face-material[hover][index]", inputs: ["index", "hover", "font", "color"] }, { kind: "directive", type: NgtRepeat, selector: "[ngFor][ngForRepeat]", inputs: ["ngForRepeat"] }] }); }
1161
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsGizmoViewcubeFaceMaterial, selector: "ngts-gizmo-viewcube-face-material", inputs: ["index", "hover"] }, { kind: "directive", type: NgtRepeat, selector: "[ngFor][ngForRepeat]", inputs: ["ngForRepeat"] }] }); }
1068
1162
  }
1069
1163
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcubeFaceCube, decorators: [{
1070
1164
  type: Component,
@@ -1078,91 +1172,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
1078
1172
  (click)="onClick($any($event))"
1079
1173
  >
1080
1174
  <ngt-box-geometry />
1081
- <ngts-gizmo-viewcube-face-material
1082
- *ngFor="let i; repeat: 6"
1083
- [hover]="hover === i"
1084
- [index]="i"
1085
- [font]="get('font')"
1086
- [color]="get('color')"
1087
- [opacity]="get('opacity')"
1088
- [hoverColor]="get('hoverColor')"
1089
- [textColor]="get('textColor')"
1090
- [strokeColor]="get('strokeColor')"
1091
- [faces]="get('faces')"
1092
- />
1175
+ <ngts-gizmo-viewcube-face-material *ngFor="let i; repeat: 6" [hover]="hover() === i" [index]="i" />
1093
1176
  </ngt-mesh>
1094
1177
  `,
1095
1178
  imports: [NgtsGizmoViewcubeFaceMaterial, NgtRepeat],
1096
1179
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1097
1180
  }]
1098
- }], propDecorators: { font: [{
1099
- type: Input
1100
- }], color: [{
1101
- type: Input
1102
- }] } });
1181
+ }] });
1103
1182
 
1104
1183
  extend({ Group, AmbientLight, PointLight });
1105
1184
  class NgtsGizmoViewcube extends NgtsGizmoViewcubeInputs {
1106
1185
  constructor() {
1107
- super(...arguments);
1186
+ super();
1108
1187
  this.edges = edges;
1109
1188
  this.edgeDimensions = edgeDimensions;
1110
1189
  this.corners = corners;
1111
1190
  this.cornerDimensions = cornerDimensions;
1112
1191
  this.clicked = new EventEmitter();
1192
+ requestAnimationInInjectionContext(() => {
1193
+ if (this.clicked.observed) {
1194
+ this.set({ clickEmitter: this.clicked });
1195
+ }
1196
+ });
1113
1197
  }
1114
- set font(font) {
1115
- this.set({ font });
1116
- }
1117
- set color(color) {
1118
- this.set({ color });
1119
- }
1120
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcube, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1121
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewcube, isStandalone: true, selector: "ngts-gizmo-viewcube", inputs: { font: "font", color: "color" }, outputs: { clicked: "clicked" }, usesInheritance: true, ngImport: i0, template: `
1198
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcube, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1199
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewcube, isStandalone: true, selector: "ngts-gizmo-viewcube", outputs: { clicked: "clicked" }, providers: [{ provide: NgtsGizmoViewcubeInputs, useExisting: NgtsGizmoViewcube }], usesInheritance: true, ngImport: i0, template: `
1122
1200
  <ngt-group [scale]="60">
1123
- <ngts-gizmo-viewcube-face-cube
1124
- [font]="get('font')"
1125
- [color]="get('color')"
1126
- [opacity]="get('opacity')"
1127
- [hoverColor]="get('hoverColor')"
1128
- [textColor]="get('textColor')"
1129
- [strokeColor]="get('strokeColor')"
1130
- [faces]="get('faces')"
1131
- [clickEmitter]="clicked"
1132
- />
1201
+ <ngts-gizmo-viewcube-face-cube />
1133
1202
 
1134
1203
  <ngts-gizmo-viewcube-edge-cube
1135
1204
  *ngFor="let edge of edges; let i = index"
1136
1205
  [position]="edge"
1137
1206
  [dimensions]="edgeDimensions[i]"
1138
- [font]="get('font')"
1139
- [color]="get('color')"
1140
- [opacity]="get('opacity')"
1141
- [hoverColor]="get('hoverColor')"
1142
- [textColor]="get('textColor')"
1143
- [strokeColor]="get('strokeColor')"
1144
- [faces]="get('faces')"
1145
- [clickEmitter]="clicked"
1146
1207
  />
1147
1208
 
1148
1209
  <ngts-gizmo-viewcube-edge-cube
1149
1210
  *ngFor="let corner of corners"
1150
1211
  [position]="corner"
1151
1212
  [dimensions]="cornerDimensions"
1152
- [font]="get('font')"
1153
- [color]="get('color')"
1154
- [opacity]="get('opacity')"
1155
- [hoverColor]="get('hoverColor')"
1156
- [textColor]="get('textColor')"
1157
- [strokeColor]="get('strokeColor')"
1158
- [faces]="get('faces')"
1159
- [clickEmitter]="clicked"
1160
1213
  />
1161
1214
 
1162
1215
  <ngt-ambient-light [intensity]="0.5" />
1163
1216
  <ngt-point-light [position]="10" [intensity]="0.5" />
1164
1217
  </ngt-group>
1165
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsGizmoViewcubeEdgeCube, selector: "ngts-gizmo-viewcube-edge-cube[dimensions][position]", inputs: ["dimensions", "position"] }, { kind: "component", type: NgtsGizmoViewcubeFaceCube, selector: "ngts-gizmo-viewcube-face-cube", inputs: ["font", "color"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
1218
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsGizmoViewcubeEdgeCube, selector: "ngts-gizmo-viewcube-edge-cube", inputs: ["dimensions", "position"] }, { kind: "component", type: NgtsGizmoViewcubeFaceCube, selector: "ngts-gizmo-viewcube-face-cube" }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
1166
1219
  }
1167
1220
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewcube, decorators: [{
1168
1221
  type: Component,
@@ -1171,43 +1224,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
1171
1224
  standalone: true,
1172
1225
  template: `
1173
1226
  <ngt-group [scale]="60">
1174
- <ngts-gizmo-viewcube-face-cube
1175
- [font]="get('font')"
1176
- [color]="get('color')"
1177
- [opacity]="get('opacity')"
1178
- [hoverColor]="get('hoverColor')"
1179
- [textColor]="get('textColor')"
1180
- [strokeColor]="get('strokeColor')"
1181
- [faces]="get('faces')"
1182
- [clickEmitter]="clicked"
1183
- />
1227
+ <ngts-gizmo-viewcube-face-cube />
1184
1228
 
1185
1229
  <ngts-gizmo-viewcube-edge-cube
1186
1230
  *ngFor="let edge of edges; let i = index"
1187
1231
  [position]="edge"
1188
1232
  [dimensions]="edgeDimensions[i]"
1189
- [font]="get('font')"
1190
- [color]="get('color')"
1191
- [opacity]="get('opacity')"
1192
- [hoverColor]="get('hoverColor')"
1193
- [textColor]="get('textColor')"
1194
- [strokeColor]="get('strokeColor')"
1195
- [faces]="get('faces')"
1196
- [clickEmitter]="clicked"
1197
1233
  />
1198
1234
 
1199
1235
  <ngts-gizmo-viewcube-edge-cube
1200
1236
  *ngFor="let corner of corners"
1201
1237
  [position]="corner"
1202
1238
  [dimensions]="cornerDimensions"
1203
- [font]="get('font')"
1204
- [color]="get('color')"
1205
- [opacity]="get('opacity')"
1206
- [hoverColor]="get('hoverColor')"
1207
- [textColor]="get('textColor')"
1208
- [strokeColor]="get('strokeColor')"
1209
- [faces]="get('faces')"
1210
- [clickEmitter]="clicked"
1211
1239
  />
1212
1240
 
1213
1241
  <ngt-ambient-light [intensity]="0.5" />
@@ -1215,18 +1243,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
1215
1243
  </ngt-group>
1216
1244
  `,
1217
1245
  imports: [NgtsGizmoViewcubeEdgeCube, NgtsGizmoViewcubeFaceCube, NgFor],
1246
+ providers: [{ provide: NgtsGizmoViewcubeInputs, useExisting: NgtsGizmoViewcube }],
1218
1247
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1219
1248
  }]
1220
- }], propDecorators: { font: [{
1221
- type: Input
1222
- }], color: [{
1223
- type: Input
1224
- }], clicked: [{
1249
+ }], ctorParameters: function () { return []; }, propDecorators: { clicked: [{
1225
1250
  type: Output
1226
1251
  }] } });
1227
1252
 
1228
1253
  extend({ Group, Mesh, BoxGeometry, MeshBasicMaterial, Sprite, SpriteMaterial });
1229
- class NgtsGizmoViewportAxis extends NgtRxStore {
1254
+ class NgtsGizmoViewportAxis extends NgtSignalStore {
1230
1255
  set color(color) {
1231
1256
  this.set({ color });
1232
1257
  }
@@ -1234,18 +1259,20 @@ class NgtsGizmoViewportAxis extends NgtRxStore {
1234
1259
  this.set({ rotation });
1235
1260
  }
1236
1261
  set scale(scale) {
1237
- this.set({ scale: scale === undefined ? this.get('scale') : scale });
1238
- }
1239
- initialize() {
1240
- super.initialize();
1241
- this.set({ scale: [0.8, 0.05, 0.05] });
1262
+ this.set({ scale });
1242
1263
  }
1243
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewportAxis, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1244
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewportAxis, isStandalone: true, selector: "ngts-gizmo-viewport-axis[color][rotation]", inputs: { color: "color", rotation: "rotation", scale: "scale" }, usesInheritance: true, ngImport: i0, template: `
1245
- <ngt-group [rotation]="get('rotation')">
1264
+ constructor() {
1265
+ super({ scale: [0.8, 0.05, 0.05] });
1266
+ this.axisRotation = this.select('rotation');
1267
+ this.axisColor = this.select('color');
1268
+ this.axisScale = this.select('scale');
1269
+ }
1270
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewportAxis, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1271
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewportAxis, isStandalone: true, selector: "ngts-gizmo-viewport-axis", inputs: { color: "color", rotation: "rotation", scale: "scale" }, usesInheritance: true, ngImport: i0, template: `
1272
+ <ngt-group [rotation]="axisRotation()">
1246
1273
  <ngt-mesh [position]="[0.4, 0, 0]">
1247
- <ngt-box-geometry *args="get('scale')" />
1248
- <ngt-mesh-basic-material [color]="get('color')" [toneMapped]="false" />
1274
+ <ngt-box-geometry *args="axisScale()" />
1275
+ <ngt-mesh-basic-material [color]="axisColor()" [toneMapped]="false" />
1249
1276
  </ngt-mesh>
1250
1277
  </ngt-group>
1251
1278
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] }); }
@@ -1253,33 +1280,31 @@ class NgtsGizmoViewportAxis extends NgtRxStore {
1253
1280
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewportAxis, decorators: [{
1254
1281
  type: Component,
1255
1282
  args: [{
1256
- selector: 'ngts-gizmo-viewport-axis[color][rotation]',
1283
+ selector: 'ngts-gizmo-viewport-axis',
1257
1284
  standalone: true,
1258
1285
  template: `
1259
- <ngt-group [rotation]="get('rotation')">
1286
+ <ngt-group [rotation]="axisRotation()">
1260
1287
  <ngt-mesh [position]="[0.4, 0, 0]">
1261
- <ngt-box-geometry *args="get('scale')" />
1262
- <ngt-mesh-basic-material [color]="get('color')" [toneMapped]="false" />
1288
+ <ngt-box-geometry *args="axisScale()" />
1289
+ <ngt-mesh-basic-material [color]="axisColor()" [toneMapped]="false" />
1263
1290
  </ngt-mesh>
1264
1291
  </ngt-group>
1265
1292
  `,
1266
1293
  imports: [NgtArgs],
1267
1294
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1268
1295
  }]
1269
- }], propDecorators: { color: [{
1270
- type: Input
1296
+ }], ctorParameters: function () { return []; }, propDecorators: { color: [{
1297
+ type: Input,
1298
+ args: [{ required: true }]
1271
1299
  }], rotation: [{
1272
- type: Input
1300
+ type: Input,
1301
+ args: [{ required: true }]
1273
1302
  }], scale: [{
1274
1303
  type: Input
1275
1304
  }] } });
1276
- class NgtsGizmoViewportAxisHead extends NgtRxStore {
1277
- constructor() {
1278
- super(...arguments);
1279
- this.document = inject(DOCUMENT);
1280
- this.store = inject(NgtStore);
1281
- this.gl = this.store.get('gl');
1282
- }
1305
+ class NgtsGizmoViewportAxisHead extends NgtSignalStore {
1306
+ #document;
1307
+ #store;
1283
1308
  set arcStyle(arcStyle) {
1284
1309
  this.set({ arcStyle });
1285
1310
  }
@@ -1301,16 +1326,27 @@ class NgtsGizmoViewportAxisHead extends NgtRxStore {
1301
1326
  set clickEmitter(clickEmitter) {
1302
1327
  this.set({ clickEmitter });
1303
1328
  }
1304
- initialize() {
1305
- super.initialize();
1306
- this.set({ axisHeadScale: 1, active: false });
1307
- this.connect('texture', combineLatest([
1308
- this.select('arcStyle'),
1309
- this.select('labelColor'),
1310
- this.select('font'),
1311
- this.select('label').pipe(startWithUndefined()),
1312
- ]).pipe(map(([arcStyle, labelColor, font, label]) => {
1313
- const canvas = this.document.createElement('canvas');
1329
+ #arcStyle;
1330
+ #labelColor;
1331
+ #font;
1332
+ #axisHeadScale;
1333
+ constructor() {
1334
+ super({ axisHeadScale: 1 });
1335
+ this.#document = inject(DOCUMENT);
1336
+ this.#store = inject(NgtStore);
1337
+ this.gl = this.#store.select('gl');
1338
+ this.active = signal(false);
1339
+ this.#arcStyle = this.select('arcStyle');
1340
+ this.#labelColor = this.select('labelColor');
1341
+ this.#font = this.select('font');
1342
+ this.#axisHeadScale = this.select('axisHeadScale');
1343
+ this.axisLabel = this.select('label');
1344
+ this.texture = computed(() => {
1345
+ const arcStyle = this.#arcStyle();
1346
+ const labelColor = this.#labelColor();
1347
+ const font = this.#font();
1348
+ const label = this.axisLabel();
1349
+ const canvas = this.#document.createElement('canvas');
1314
1350
  canvas.width = 64;
1315
1351
  canvas.height = 64;
1316
1352
  const context = canvas.getContext('2d');
@@ -1326,17 +1362,18 @@ class NgtsGizmoViewportAxisHead extends NgtRxStore {
1326
1362
  context.fillText(label, 32, 41);
1327
1363
  }
1328
1364
  return new CanvasTexture(canvas);
1329
- })));
1330
- this.connect('scale', combineLatest([
1331
- this.select('active'),
1332
- this.select('axisHeadScale'),
1333
- this.select('label').pipe(startWithUndefined()),
1334
- ]).pipe(map(([active, axisHeadScale, label]) => (label ? 1 : 0.75) * (active ? 1.2 : 1) * axisHeadScale)));
1365
+ });
1366
+ this.scale = computed(() => {
1367
+ const active = this.active();
1368
+ const axisHeadScale = this.#axisHeadScale();
1369
+ const label = this.axisLabel();
1370
+ return (label ? 1 : 0.75) * (active ? 1.2 : 1) * axisHeadScale;
1371
+ });
1335
1372
  }
1336
1373
  onPointerOver(event) {
1337
1374
  if (!this.get('disabled')) {
1338
1375
  event.stopPropagation();
1339
- this.set({ active: true });
1376
+ this.active.set(true);
1340
1377
  }
1341
1378
  }
1342
1379
  onPointerOut(event) {
@@ -1346,26 +1383,26 @@ class NgtsGizmoViewportAxisHead extends NgtRxStore {
1346
1383
  }
1347
1384
  else {
1348
1385
  event.stopPropagation();
1349
- this.set({ active: false });
1386
+ this.active.set(false);
1350
1387
  }
1351
1388
  }
1352
1389
  }
1353
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewportAxisHead, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1390
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewportAxisHead, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1354
1391
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewportAxisHead, isStandalone: true, selector: "ngts-gizmo-viewport-axis-head", inputs: { arcStyle: "arcStyle", label: "label", labelColor: "labelColor", axisHeadScale: "axisHeadScale", disabled: "disabled", font: "font", clickEmitter: "clickEmitter" }, usesInheritance: true, ngImport: i0, template: `
1355
1392
  <ngt-sprite
1356
1393
  ngtCompound
1357
- [scale]="get('scale')"
1358
- (pointerover)="onPointerOver($any($event))"
1359
- (pointerout)="onPointerOut($any($event))"
1394
+ [scale]="scale()"
1395
+ (pointerover)="onPointerOver($event)"
1396
+ (pointerout)="onPointerOut($event)"
1360
1397
  >
1361
1398
  <ngt-sprite-material
1362
- [map]="get('texture')"
1363
- [opacity]="get('label') ? 1 : 0.75"
1399
+ [map]="texture()"
1400
+ [opacity]="axisLabel() ? 1 : 0.75"
1364
1401
  [alphaTest]="0.3"
1365
1402
  [toneMapped]="false"
1366
1403
  >
1367
- <ngt-value [rawValue]="gl.outputEncoding" attach="map.encoding" />
1368
- <ngt-value [rawValue]="gl.capabilities.getMaxAnisotropy() || 1" attach="map.anisotropy" />
1404
+ <ngt-value [rawValue]="gl().outputEncoding" attach="map.encoding" />
1405
+ <ngt-value [rawValue]="gl().capabilities.getMaxAnisotropy() || 1" attach="map.anisotropy" />
1369
1406
  </ngt-sprite-material>
1370
1407
  </ngt-sprite>
1371
1408
  `, isInline: true }); }
@@ -1378,25 +1415,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
1378
1415
  template: `
1379
1416
  <ngt-sprite
1380
1417
  ngtCompound
1381
- [scale]="get('scale')"
1382
- (pointerover)="onPointerOver($any($event))"
1383
- (pointerout)="onPointerOut($any($event))"
1418
+ [scale]="scale()"
1419
+ (pointerover)="onPointerOver($event)"
1420
+ (pointerout)="onPointerOut($event)"
1384
1421
  >
1385
1422
  <ngt-sprite-material
1386
- [map]="get('texture')"
1387
- [opacity]="get('label') ? 1 : 0.75"
1423
+ [map]="texture()"
1424
+ [opacity]="axisLabel() ? 1 : 0.75"
1388
1425
  [alphaTest]="0.3"
1389
1426
  [toneMapped]="false"
1390
1427
  >
1391
- <ngt-value [rawValue]="gl.outputEncoding" attach="map.encoding" />
1392
- <ngt-value [rawValue]="gl.capabilities.getMaxAnisotropy() || 1" attach="map.anisotropy" />
1428
+ <ngt-value [rawValue]="gl().outputEncoding" attach="map.encoding" />
1429
+ <ngt-value [rawValue]="gl().capabilities.getMaxAnisotropy() || 1" attach="map.anisotropy" />
1393
1430
  </ngt-sprite-material>
1394
1431
  </ngt-sprite>
1395
1432
  `,
1396
1433
  imports: [NgtArgs],
1397
1434
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1398
1435
  }]
1399
- }], propDecorators: { arcStyle: [{
1436
+ }], ctorParameters: function () { return []; }, propDecorators: { arcStyle: [{
1400
1437
  type: Input
1401
1438
  }], label: [{
1402
1439
  type: Input
@@ -1413,13 +1450,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
1413
1450
  }] } });
1414
1451
 
1415
1452
  extend({ Group, AmbientLight, PointLight });
1416
- class NgtsGizmoViewport extends NgtRxStore {
1417
- constructor() {
1418
- super(...arguments);
1419
- this.gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
1420
- this.Math = Math;
1421
- this.clicked = new EventEmitter();
1422
- }
1453
+ class NgtsGizmoViewport extends NgtSignalStore {
1454
+ #gizmoHelperApi;
1423
1455
  set axisColors(axisColors) {
1424
1456
  this.set({ axisColors });
1425
1457
  }
@@ -1447,103 +1479,114 @@ class NgtsGizmoViewport extends NgtRxStore {
1447
1479
  set font(font) {
1448
1480
  this.set({ font });
1449
1481
  }
1450
- initialize() {
1451
- super.initialize();
1452
- this.set({
1482
+ constructor() {
1483
+ super({
1453
1484
  font: '18px Inter var, Arial, sans-serif',
1454
1485
  axisColors: ['#ff2060', '#20df80', '#2080ff'],
1455
1486
  axisHeadScale: 1,
1456
1487
  labels: ['X', 'Y', 'Z'],
1457
1488
  labelColor: '#000',
1458
1489
  });
1490
+ this.#gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
1491
+ this.Math = Math;
1492
+ this.clicked = new EventEmitter();
1493
+ this.viewportAxisColors = this.select('axisColors');
1494
+ this.viewportAxisScale = this.select('axisScale');
1495
+ this.viewportLabels = this.select('labels');
1496
+ this.viewportAxisHeadScale = this.select('axisHeadScale');
1497
+ this.viewportLabelColor = this.select('labelColor');
1498
+ this.viewportHideNegativeAxes = this.select('hideNegativeAxes');
1499
+ this.viewportHideAxisHeads = this.select('hideAxisHeads');
1500
+ this.viewportDisabled = this.select('disabled');
1501
+ this.viewportFont = this.select('font');
1459
1502
  }
1460
1503
  onPointerDown(event) {
1461
1504
  if (!this.get('disabled')) {
1462
1505
  event.stopPropagation();
1463
- this.gizmoHelperApi.tweenCamera(event.object.position);
1506
+ this.#gizmoHelperApi()(event.object.position);
1464
1507
  }
1465
1508
  }
1466
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewport, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1509
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewport, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1467
1510
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsGizmoViewport, isStandalone: true, selector: "ngts-gizmo-viewport", inputs: { axisColors: "axisColors", axisScale: "axisScale", labels: "labels", axisHeadScale: "axisHeadScale", labelColor: "labelColor", hideNegativeAxes: "hideNegativeAxes", hideAxisHeads: "hideAxisHeads", disabled: "disabled", font: "font" }, outputs: { clicked: "clicked" }, usesInheritance: true, ngImport: i0, template: `
1468
1511
  <ngt-group ngtCompound [scale]="40">
1469
1512
  <ngts-gizmo-viewport-axis
1470
- [color]="get('axisColors')[0]"
1513
+ [color]="viewportAxisColors()[0]"
1471
1514
  [rotation]="[0, 0, 0]"
1472
- [scale]="get('axisScale')"
1515
+ [scale]="viewportAxisScale()"
1473
1516
  ></ngts-gizmo-viewport-axis>
1474
1517
  <ngts-gizmo-viewport-axis
1475
- [color]="get('axisColors')[1]"
1518
+ [color]="viewportAxisColors()[1]"
1476
1519
  [rotation]="[0, 0, Math.PI / 2]"
1477
- [scale]="get('axisScale')"
1520
+ [scale]="viewportAxisScale()"
1478
1521
  ></ngts-gizmo-viewport-axis>
1479
1522
  <ngts-gizmo-viewport-axis
1480
- [color]="get('axisColors')[2]"
1523
+ [color]="viewportAxisColors()[2]"
1481
1524
  [rotation]="[0, -Math.PI / 2, 0]"
1482
- [scale]="get('axisScale')"
1525
+ [scale]="viewportAxisScale()"
1483
1526
  ></ngts-gizmo-viewport-axis>
1484
- <ng-container *ngIf="!get('hideAxisHeads')">
1527
+ <ng-container *ngIf="!viewportHideAxisHeads()">
1485
1528
  <ngts-gizmo-viewport-axis-head
1486
- [arcStyle]="get('axisColors')[0]"
1529
+ [arcStyle]="viewportAxisColors()[0]"
1487
1530
  [position]="[1, 0, 0]"
1488
- [label]="get('labels')[0]"
1489
- [font]="get('font')"
1490
- [disabled]="get('disabled')"
1491
- [labelColor]="get('labelColor')"
1531
+ [label]="viewportLabels()[0]"
1532
+ [font]="viewportFont()"
1533
+ [disabled]="viewportDisabled()"
1534
+ [labelColor]="viewportLabelColor()"
1492
1535
  [clickEmitter]="clicked"
1493
- [axisHeadScale]="get('axisHeadScale')"
1536
+ [axisHeadScale]="viewportAxisHeadScale()"
1494
1537
  (pointerdown)="onPointerDown($any($event))"
1495
1538
  ></ngts-gizmo-viewport-axis-head>
1496
1539
  <ngts-gizmo-viewport-axis-head
1497
- [arcStyle]="get('axisColors')[1]"
1540
+ [arcStyle]="viewportAxisColors()[1]"
1498
1541
  [position]="[0, 1, 0]"
1499
- [label]="get('labels')[1]"
1500
- [font]="get('font')"
1501
- [disabled]="get('disabled')"
1502
- [labelColor]="get('labelColor')"
1542
+ [label]="viewportLabels()[1]"
1543
+ [font]="viewportFont()"
1544
+ [disabled]="viewportDisabled()"
1545
+ [labelColor]="viewportLabelColor()"
1503
1546
  [clickEmitter]="clicked"
1504
- [axisHeadScale]="get('axisHeadScale')"
1547
+ [axisHeadScale]="viewportAxisHeadScale()"
1505
1548
  (pointerdown)="onPointerDown($any($event))"
1506
1549
  ></ngts-gizmo-viewport-axis-head>
1507
1550
  <ngts-gizmo-viewport-axis-head
1508
- [arcStyle]="get('axisColors')[2]"
1551
+ [arcStyle]="viewportAxisColors()[2]"
1509
1552
  [position]="[0, 0, 1]"
1510
- [label]="get('labels')[2]"
1511
- [font]="get('font')"
1512
- [disabled]="get('disabled')"
1513
- [labelColor]="get('labelColor')"
1553
+ [label]="viewportLabels()[2]"
1554
+ [font]="viewportFont()"
1555
+ [disabled]="viewportDisabled()"
1556
+ [labelColor]="viewportLabelColor()"
1514
1557
  [clickEmitter]="clicked"
1515
- [axisHeadScale]="get('axisHeadScale')"
1558
+ [axisHeadScale]="viewportAxisHeadScale()"
1516
1559
  (pointerdown)="onPointerDown($any($event))"
1517
1560
  ></ngts-gizmo-viewport-axis-head>
1518
- <ng-container *ngIf="!get('hideNegativeAxes')">
1561
+ <ng-container *ngIf="!viewportHideNegativeAxes()">
1519
1562
  <ngts-gizmo-viewport-axis-head
1520
- [arcStyle]="get('axisColors')[0]"
1563
+ [arcStyle]="viewportAxisColors()[0]"
1521
1564
  [position]="[-1, 0, 0]"
1522
- [font]="get('font')"
1523
- [disabled]="get('disabled')"
1524
- [labelColor]="get('labelColor')"
1565
+ [font]="viewportFont()"
1566
+ [disabled]="viewportDisabled()"
1567
+ [labelColor]="viewportLabelColor()"
1525
1568
  [clickEmitter]="clicked"
1526
- [axisHeadScale]="get('axisHeadScale')"
1569
+ [axisHeadScale]="viewportAxisHeadScale()"
1527
1570
  (pointerdown)="onPointerDown($any($event))"
1528
1571
  ></ngts-gizmo-viewport-axis-head>
1529
1572
  <ngts-gizmo-viewport-axis-head
1530
- [arcStyle]="get('axisColors')[1]"
1573
+ [arcStyle]="viewportAxisColors()[1]"
1531
1574
  [position]="[0, -1, 0]"
1532
- [font]="get('font')"
1533
- [disabled]="get('disabled')"
1534
- [labelColor]="get('labelColor')"
1575
+ [font]="viewportFont()"
1576
+ [disabled]="viewportDisabled()"
1577
+ [labelColor]="viewportLabelColor()"
1535
1578
  [clickEmitter]="clicked"
1536
- [axisHeadScale]="get('axisHeadScale')"
1579
+ [axisHeadScale]="viewportAxisHeadScale()"
1537
1580
  (pointerdown)="onPointerDown($any($event))"
1538
1581
  ></ngts-gizmo-viewport-axis-head>
1539
1582
  <ngts-gizmo-viewport-axis-head
1540
- [arcStyle]="get('axisColors')[2]"
1583
+ [arcStyle]="viewportAxisColors()[2]"
1541
1584
  [position]="[0, 0, -1]"
1542
- [font]="get('font')"
1543
- [disabled]="get('disabled')"
1544
- [labelColor]="get('labelColor')"
1585
+ [font]="viewportFont()"
1586
+ [disabled]="viewportDisabled()"
1587
+ [labelColor]="viewportLabelColor()"
1545
1588
  [clickEmitter]="clicked"
1546
- [axisHeadScale]="get('axisHeadScale')"
1589
+ [axisHeadScale]="viewportAxisHeadScale()"
1547
1590
  (pointerdown)="onPointerDown($any($event))"
1548
1591
  ></ngts-gizmo-viewport-axis-head>
1549
1592
  </ng-container>
@@ -1551,7 +1594,7 @@ class NgtsGizmoViewport extends NgtRxStore {
1551
1594
  <ngt-ambient-light intensity="0.5"></ngt-ambient-light>
1552
1595
  <ngt-point-light position="10" intensity="0.5"></ngt-point-light>
1553
1596
  </ngt-group>
1554
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsGizmoViewportAxis, selector: "ngts-gizmo-viewport-axis[color][rotation]", inputs: ["color", "rotation", "scale"] }, { kind: "component", type: NgtsGizmoViewportAxisHead, selector: "ngts-gizmo-viewport-axis-head", inputs: ["arcStyle", "label", "labelColor", "axisHeadScale", "disabled", "font", "clickEmitter"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
1597
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsGizmoViewportAxis, selector: "ngts-gizmo-viewport-axis", inputs: ["color", "rotation", "scale"] }, { kind: "component", type: NgtsGizmoViewportAxisHead, selector: "ngts-gizmo-viewport-axis-head", inputs: ["arcStyle", "label", "labelColor", "axisHeadScale", "disabled", "font", "clickEmitter"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
1555
1598
  }
1556
1599
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsGizmoViewport, decorators: [{
1557
1600
  type: Component,
@@ -1561,83 +1604,83 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
1561
1604
  template: `
1562
1605
  <ngt-group ngtCompound [scale]="40">
1563
1606
  <ngts-gizmo-viewport-axis
1564
- [color]="get('axisColors')[0]"
1607
+ [color]="viewportAxisColors()[0]"
1565
1608
  [rotation]="[0, 0, 0]"
1566
- [scale]="get('axisScale')"
1609
+ [scale]="viewportAxisScale()"
1567
1610
  ></ngts-gizmo-viewport-axis>
1568
1611
  <ngts-gizmo-viewport-axis
1569
- [color]="get('axisColors')[1]"
1612
+ [color]="viewportAxisColors()[1]"
1570
1613
  [rotation]="[0, 0, Math.PI / 2]"
1571
- [scale]="get('axisScale')"
1614
+ [scale]="viewportAxisScale()"
1572
1615
  ></ngts-gizmo-viewport-axis>
1573
1616
  <ngts-gizmo-viewport-axis
1574
- [color]="get('axisColors')[2]"
1617
+ [color]="viewportAxisColors()[2]"
1575
1618
  [rotation]="[0, -Math.PI / 2, 0]"
1576
- [scale]="get('axisScale')"
1619
+ [scale]="viewportAxisScale()"
1577
1620
  ></ngts-gizmo-viewport-axis>
1578
- <ng-container *ngIf="!get('hideAxisHeads')">
1621
+ <ng-container *ngIf="!viewportHideAxisHeads()">
1579
1622
  <ngts-gizmo-viewport-axis-head
1580
- [arcStyle]="get('axisColors')[0]"
1623
+ [arcStyle]="viewportAxisColors()[0]"
1581
1624
  [position]="[1, 0, 0]"
1582
- [label]="get('labels')[0]"
1583
- [font]="get('font')"
1584
- [disabled]="get('disabled')"
1585
- [labelColor]="get('labelColor')"
1625
+ [label]="viewportLabels()[0]"
1626
+ [font]="viewportFont()"
1627
+ [disabled]="viewportDisabled()"
1628
+ [labelColor]="viewportLabelColor()"
1586
1629
  [clickEmitter]="clicked"
1587
- [axisHeadScale]="get('axisHeadScale')"
1630
+ [axisHeadScale]="viewportAxisHeadScale()"
1588
1631
  (pointerdown)="onPointerDown($any($event))"
1589
1632
  ></ngts-gizmo-viewport-axis-head>
1590
1633
  <ngts-gizmo-viewport-axis-head
1591
- [arcStyle]="get('axisColors')[1]"
1634
+ [arcStyle]="viewportAxisColors()[1]"
1592
1635
  [position]="[0, 1, 0]"
1593
- [label]="get('labels')[1]"
1594
- [font]="get('font')"
1595
- [disabled]="get('disabled')"
1596
- [labelColor]="get('labelColor')"
1636
+ [label]="viewportLabels()[1]"
1637
+ [font]="viewportFont()"
1638
+ [disabled]="viewportDisabled()"
1639
+ [labelColor]="viewportLabelColor()"
1597
1640
  [clickEmitter]="clicked"
1598
- [axisHeadScale]="get('axisHeadScale')"
1641
+ [axisHeadScale]="viewportAxisHeadScale()"
1599
1642
  (pointerdown)="onPointerDown($any($event))"
1600
1643
  ></ngts-gizmo-viewport-axis-head>
1601
1644
  <ngts-gizmo-viewport-axis-head
1602
- [arcStyle]="get('axisColors')[2]"
1645
+ [arcStyle]="viewportAxisColors()[2]"
1603
1646
  [position]="[0, 0, 1]"
1604
- [label]="get('labels')[2]"
1605
- [font]="get('font')"
1606
- [disabled]="get('disabled')"
1607
- [labelColor]="get('labelColor')"
1647
+ [label]="viewportLabels()[2]"
1648
+ [font]="viewportFont()"
1649
+ [disabled]="viewportDisabled()"
1650
+ [labelColor]="viewportLabelColor()"
1608
1651
  [clickEmitter]="clicked"
1609
- [axisHeadScale]="get('axisHeadScale')"
1652
+ [axisHeadScale]="viewportAxisHeadScale()"
1610
1653
  (pointerdown)="onPointerDown($any($event))"
1611
1654
  ></ngts-gizmo-viewport-axis-head>
1612
- <ng-container *ngIf="!get('hideNegativeAxes')">
1655
+ <ng-container *ngIf="!viewportHideNegativeAxes()">
1613
1656
  <ngts-gizmo-viewport-axis-head
1614
- [arcStyle]="get('axisColors')[0]"
1657
+ [arcStyle]="viewportAxisColors()[0]"
1615
1658
  [position]="[-1, 0, 0]"
1616
- [font]="get('font')"
1617
- [disabled]="get('disabled')"
1618
- [labelColor]="get('labelColor')"
1659
+ [font]="viewportFont()"
1660
+ [disabled]="viewportDisabled()"
1661
+ [labelColor]="viewportLabelColor()"
1619
1662
  [clickEmitter]="clicked"
1620
- [axisHeadScale]="get('axisHeadScale')"
1663
+ [axisHeadScale]="viewportAxisHeadScale()"
1621
1664
  (pointerdown)="onPointerDown($any($event))"
1622
1665
  ></ngts-gizmo-viewport-axis-head>
1623
1666
  <ngts-gizmo-viewport-axis-head
1624
- [arcStyle]="get('axisColors')[1]"
1667
+ [arcStyle]="viewportAxisColors()[1]"
1625
1668
  [position]="[0, -1, 0]"
1626
- [font]="get('font')"
1627
- [disabled]="get('disabled')"
1628
- [labelColor]="get('labelColor')"
1669
+ [font]="viewportFont()"
1670
+ [disabled]="viewportDisabled()"
1671
+ [labelColor]="viewportLabelColor()"
1629
1672
  [clickEmitter]="clicked"
1630
- [axisHeadScale]="get('axisHeadScale')"
1673
+ [axisHeadScale]="viewportAxisHeadScale()"
1631
1674
  (pointerdown)="onPointerDown($any($event))"
1632
1675
  ></ngts-gizmo-viewport-axis-head>
1633
1676
  <ngts-gizmo-viewport-axis-head
1634
- [arcStyle]="get('axisColors')[2]"
1677
+ [arcStyle]="viewportAxisColors()[2]"
1635
1678
  [position]="[0, 0, -1]"
1636
- [font]="get('font')"
1637
- [disabled]="get('disabled')"
1638
- [labelColor]="get('labelColor')"
1679
+ [font]="viewportFont()"
1680
+ [disabled]="viewportDisabled()"
1681
+ [labelColor]="viewportLabelColor()"
1639
1682
  [clickEmitter]="clicked"
1640
- [axisHeadScale]="get('axisHeadScale')"
1683
+ [axisHeadScale]="viewportAxisHeadScale()"
1641
1684
  (pointerdown)="onPointerDown($any($event))"
1642
1685
  ></ngts-gizmo-viewport-axis-head>
1643
1686
  </ng-container>
@@ -1649,7 +1692,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
1649
1692
  imports: [NgtsGizmoViewportAxis, NgtsGizmoViewportAxisHead, NgIf],
1650
1693
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1651
1694
  }]
1652
- }], propDecorators: { axisColors: [{
1695
+ }], ctorParameters: function () { return []; }, propDecorators: { axisColors: [{
1653
1696
  type: Input
1654
1697
  }], axisScale: [{
1655
1698
  type: Input
@@ -1672,12 +1715,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
1672
1715
  }] } });
1673
1716
 
1674
1717
  const v = new THREE.Vector3();
1675
- class NgtsQuadraticBezierLine extends NgtsLineInput {
1676
- constructor() {
1677
- super(...arguments);
1678
- this.curve = new THREE.QuadraticBezierCurve3(undefined, undefined, undefined);
1679
- this.lineRef = injectNgtRef();
1680
- }
1718
+ class NgtsQuadraticBezierLine extends NgtsLineInputs {
1681
1719
  set start(start) {
1682
1720
  this.set({ start });
1683
1721
  }
@@ -1690,68 +1728,75 @@ class NgtsQuadraticBezierLine extends NgtsLineInput {
1690
1728
  set segments(segments) {
1691
1729
  this.set({ segments });
1692
1730
  }
1693
- initialize() {
1694
- super.initialize();
1731
+ #curve;
1732
+ #start;
1733
+ #end;
1734
+ #mid;
1735
+ #segments;
1736
+ constructor() {
1737
+ super();
1738
+ this.lineRef = injectNgtRef();
1739
+ this.#curve = new THREE.QuadraticBezierCurve3(undefined, undefined, undefined);
1740
+ this.#start = this.select('start');
1741
+ this.#end = this.select('end');
1742
+ this.#mid = this.select('mid');
1743
+ this.#segments = this.select('segments');
1744
+ this.points = computed(() => this.#getPoints(this.#start(), this.#end(), this.#mid(), this.#segments()));
1695
1745
  this.set({ start: [0, 0, 0], end: [0, 0, 0], segments: 20 });
1746
+ this.#replaceSetPoints();
1696
1747
  }
1697
- ngOnInit() {
1698
- this.connect('points', combineLatest([
1699
- this.select('start'),
1700
- this.select('end'),
1701
- this.select('mid').pipe(startWithUndefined()),
1702
- this.select('segments'),
1703
- ]).pipe(map(([start, end, mid, segments]) => this.getPoints(start, end, mid, segments))));
1704
- this.replaceSetPoints();
1705
- }
1706
- replaceSetPoints() {
1707
- this.hold(this.lineRef.$, (line) => {
1748
+ #replaceSetPoints() {
1749
+ effect(() => {
1750
+ const line = this.lineRef.nativeElement;
1751
+ if (!line)
1752
+ return;
1708
1753
  line.setPoints = (start, end, mid) => {
1709
- const points = this.getPoints(start, end, mid);
1710
- if (this.lineRef.nativeElement.geometry) {
1711
- this.lineRef.nativeElement.geometry.setPositions(points.map((p) => p.toArray()).flat());
1754
+ const points = this.#getPoints(start, end, mid);
1755
+ if (line.geometry) {
1756
+ line.geometry.setPositions(points.map((p) => p.toArray()).flat());
1712
1757
  }
1713
1758
  };
1714
1759
  });
1715
1760
  }
1716
- getPoints(start, end, mid, segments = 20) {
1761
+ #getPoints(start, end, mid, segments = 20) {
1717
1762
  if (start instanceof THREE.Vector3)
1718
- this.curve.v0.copy(start);
1763
+ this.#curve.v0.copy(start);
1719
1764
  else
1720
- this.curve.v0.set(...start);
1765
+ this.#curve.v0.set(...start);
1721
1766
  if (end instanceof THREE.Vector3)
1722
- this.curve.v2.copy(end);
1767
+ this.#curve.v2.copy(end);
1723
1768
  else
1724
- this.curve.v2.set(...end);
1769
+ this.#curve.v2.set(...end);
1725
1770
  if (mid instanceof THREE.Vector3) {
1726
- this.curve.v1.copy(mid);
1771
+ this.#curve.v1.copy(mid);
1727
1772
  }
1728
1773
  else {
1729
- this.curve.v1.copy(this.curve.v0
1774
+ this.#curve.v1.copy(this.#curve.v0
1730
1775
  .clone()
1731
- .add(this.curve.v2.clone().sub(this.curve.v0))
1732
- .add(v.set(0, this.curve.v0.y - this.curve.v2.y, 0)));
1776
+ .add(this.#curve.v2.clone().sub(this.#curve.v0))
1777
+ .add(v.set(0, this.#curve.v0.y - this.#curve.v2.y, 0)));
1733
1778
  }
1734
- return this.curve.getPoints(segments);
1779
+ return this.#curve.getPoints(segments);
1735
1780
  }
1736
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsQuadraticBezierLine, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1781
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsQuadraticBezierLine, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1737
1782
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsQuadraticBezierLine, isStandalone: true, selector: "ngts-quadratic-bezier-line", inputs: { lineRef: "lineRef", start: "start", end: "end", mid: "mid", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
1738
1783
  <ngts-line
1739
1784
  [lineRef]="lineRef"
1740
- [points]="get('points')"
1741
- [color]="get('color')"
1742
- [vertexColors]="get('vertexColors')"
1743
- [resolution]="get('resolution')"
1744
- [lineWidth]="get('lineWidth')"
1745
- [alphaToCoverage]="get('alphaToCoverage')"
1746
- [dashed]="get('dashed')"
1747
- [dashScale]="get('dashScale')"
1748
- [dashSize]="get('dashSize')"
1749
- [dashOffset]="get('dashOffset')"
1750
- [gapSize]="get('gapSize')"
1751
- [wireframe]="get('wireframe')"
1752
- [worldUnits]="get('worldUnits')"
1785
+ [points]="points()"
1786
+ [color]="lineParameters().color"
1787
+ [vertexColors]="lineParameters().vertexColors"
1788
+ [resolution]="lineParameters().resolution"
1789
+ [lineWidth]="lineParameters().linewidth"
1790
+ [alphaToCoverage]="lineParameters().alphaToCoverage"
1791
+ [dashed]="lineParameters().dashed"
1792
+ [dashScale]="lineParameters().dashScale"
1793
+ [dashSize]="lineParameters().dashSize"
1794
+ [dashOffset]="lineParameters().dashOffset"
1795
+ [gapSize]="lineParameters().gapSize"
1796
+ [wireframe]="lineParameters().wireframe"
1797
+ [worldUnits]="lineParameters().worldUnits"
1753
1798
  />
1754
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] }); }
1799
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line", inputs: ["lineRef", "points", "segments"] }] }); }
1755
1800
  }
1756
1801
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsQuadraticBezierLine, decorators: [{
1757
1802
  type: Component,
@@ -1761,25 +1806,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
1761
1806
  template: `
1762
1807
  <ngts-line
1763
1808
  [lineRef]="lineRef"
1764
- [points]="get('points')"
1765
- [color]="get('color')"
1766
- [vertexColors]="get('vertexColors')"
1767
- [resolution]="get('resolution')"
1768
- [lineWidth]="get('lineWidth')"
1769
- [alphaToCoverage]="get('alphaToCoverage')"
1770
- [dashed]="get('dashed')"
1771
- [dashScale]="get('dashScale')"
1772
- [dashSize]="get('dashSize')"
1773
- [dashOffset]="get('dashOffset')"
1774
- [gapSize]="get('gapSize')"
1775
- [wireframe]="get('wireframe')"
1776
- [worldUnits]="get('worldUnits')"
1809
+ [points]="points()"
1810
+ [color]="lineParameters().color"
1811
+ [vertexColors]="lineParameters().vertexColors"
1812
+ [resolution]="lineParameters().resolution"
1813
+ [lineWidth]="lineParameters().linewidth"
1814
+ [alphaToCoverage]="lineParameters().alphaToCoverage"
1815
+ [dashed]="lineParameters().dashed"
1816
+ [dashScale]="lineParameters().dashScale"
1817
+ [dashSize]="lineParameters().dashSize"
1818
+ [dashOffset]="lineParameters().dashOffset"
1819
+ [gapSize]="lineParameters().gapSize"
1820
+ [wireframe]="lineParameters().wireframe"
1821
+ [worldUnits]="lineParameters().worldUnits"
1777
1822
  />
1778
1823
  `,
1779
1824
  imports: [NgtsLine],
1780
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
1781
1825
  }]
1782
- }], propDecorators: { lineRef: [{
1826
+ }], ctorParameters: function () { return []; }, propDecorators: { lineRef: [{
1783
1827
  type: Input
1784
1828
  }], start: [{
1785
1829
  type: Input
@@ -1792,44 +1836,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
1792
1836
  }] } });
1793
1837
 
1794
1838
  extend({ Mesh, TextGeometry });
1795
- class NgtsText3D extends NgtRxStore {
1796
- constructor() {
1797
- super(...arguments);
1798
- this.font$ = this.select('font').pipe(switchMap((font) => {
1799
- if (typeof font === 'string')
1800
- return fetch(font).then((res) => res.json());
1801
- return of(font);
1802
- }), map((fontData) => new FontLoader().parse(fontData)));
1803
- this.geometryArgs$ = combineLatest([
1804
- this.font$,
1805
- this.select('text'),
1806
- this.select('size'),
1807
- this.select('height'),
1808
- this.select('bevelThickness'),
1809
- this.select('bevelSize'),
1810
- this.select('bevelEnabled'),
1811
- this.select('bevelSegments'),
1812
- this.select('bevelOffset'),
1813
- this.select('curveSegments'),
1814
- this.select('letterSpacing'),
1815
- this.select('lineHeight'),
1816
- ]).pipe(map(([font, text, size, height, bevelThickness, bevelSize, bevelEnabled, bevelSegments, bevelOffset, curveSegments, letterSpacing, lineHeight,]) => [
1817
- text,
1818
- {
1819
- font,
1820
- size,
1821
- height,
1822
- bevelThickness,
1823
- bevelSize,
1824
- bevelSegments,
1825
- bevelEnabled,
1826
- bevelOffset,
1827
- curveSegments,
1828
- letterSpacing,
1829
- lineHeight,
1830
- },
1831
- ]));
1832
- }
1839
+ class NgtsText3D extends NgtSignalStore {
1833
1840
  set font(font) {
1834
1841
  this.set({ font });
1835
1842
  }
@@ -1866,11 +1873,13 @@ class NgtsText3D extends NgtRxStore {
1866
1873
  set letterSpacing(letterSpacing) {
1867
1874
  this.set({ letterSpacing });
1868
1875
  }
1869
- initialize() {
1870
- super.initialize();
1871
- this.set({
1872
- letterSpacing: 0,
1876
+ set smooth(smooth) {
1877
+ this.set({ smooth });
1878
+ }
1879
+ constructor() {
1880
+ super({
1873
1881
  lineHeight: 1,
1882
+ letterSpacing: 0,
1874
1883
  size: 1,
1875
1884
  height: 0.2,
1876
1885
  bevelThickness: 0.1,
@@ -1880,33 +1889,87 @@ class NgtsText3D extends NgtRxStore {
1880
1889
  bevelSegments: 4,
1881
1890
  curveSegments: 8,
1882
1891
  });
1892
+ this.textRef = injectNgtRef();
1893
+ this.#fontData = toSignal(toObservable(this.select('font')).pipe(switchMap((font) => {
1894
+ if (typeof font === 'string')
1895
+ return fetch(font).then((res) => res.json());
1896
+ return of(font);
1897
+ }), map((fontData) => new FontLoader().parse(fontData))));
1898
+ this.#text = this.select('text');
1899
+ this.#size = this.select('size');
1900
+ this.#height = this.select('height');
1901
+ this.#bevelThickness = this.select('bevelThickness');
1902
+ this.#bevelSize = this.select('bevelSize');
1903
+ this.#bevelEnabled = this.select('bevelEnabled');
1904
+ this.#bevelSegments = this.select('bevelSegments');
1905
+ this.#bevelOffset = this.select('bevelOffset');
1906
+ this.#curveSegments = this.select('curveSegments');
1907
+ this.#letterSpacing = this.select('letterSpacing');
1908
+ this.#lineHeight = this.select('lineHeight');
1909
+ this.geometryArgs = computed(() => {
1910
+ const fontData = this.#fontData();
1911
+ if (!fontData)
1912
+ return null;
1913
+ return [
1914
+ this.#text(),
1915
+ {
1916
+ font: fontData,
1917
+ size: this.#size(),
1918
+ height: this.#height(),
1919
+ bevelThickness: this.#bevelThickness(),
1920
+ bevelSize: this.#bevelSize(),
1921
+ bevelSegments: this.#bevelSegments(),
1922
+ bevelEnabled: this.#bevelEnabled(),
1923
+ bevelOffset: this.#bevelOffset(),
1924
+ curveSegments: this.#curveSegments(),
1925
+ letterSpacing: this.#letterSpacing(),
1926
+ lineHeight: this.#lineHeight(),
1927
+ },
1928
+ ];
1929
+ });
1883
1930
  }
1884
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsText3D, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1885
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsText3D, isStandalone: true, selector: "ngts-text-3d[font]", inputs: { font: "font", text: "text", bevelEnabled: "bevelEnabled", bevelOffset: "bevelOffset", bevelSize: "bevelSize", bevelThickness: "bevelThickness", curveSegments: "curveSegments", bevelSegments: "bevelSegments", height: "height", size: "size", lineHeight: "lineHeight", letterSpacing: "letterSpacing" }, usesInheritance: true, ngImport: i0, template: `
1886
- <ngt-mesh ngtCompound>
1887
- <ngt-text-geometry *args="geometryArgs$ | ngtPush : null" />
1931
+ #fontData;
1932
+ #text;
1933
+ #size;
1934
+ #height;
1935
+ #bevelThickness;
1936
+ #bevelSize;
1937
+ #bevelEnabled;
1938
+ #bevelSegments;
1939
+ #bevelOffset;
1940
+ #curveSegments;
1941
+ #letterSpacing;
1942
+ #lineHeight;
1943
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsText3D, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1944
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsText3D, isStandalone: true, selector: "ngts-text-3d", inputs: { textRef: "textRef", font: "font", text: "text", bevelEnabled: "bevelEnabled", bevelOffset: "bevelOffset", bevelSize: "bevelSize", bevelThickness: "bevelThickness", curveSegments: "curveSegments", bevelSegments: "bevelSegments", height: "height", size: "size", lineHeight: "lineHeight", letterSpacing: "letterSpacing", smooth: "smooth" }, usesInheritance: true, ngImport: i0, template: `
1945
+ <ngt-mesh ngtCompound [ref]="textRef">
1946
+ <ngt-text-geometry *args="geometryArgs()" />
1888
1947
  <ng-content />
1889
1948
  </ngt-mesh>
1890
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }, { kind: "pipe", type: NgtPush, name: "ngtPush" }] }); }
1949
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] }); }
1891
1950
  }
1892
1951
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsText3D, decorators: [{
1893
1952
  type: Component,
1894
1953
  args: [{
1895
- selector: 'ngts-text-3d[font]',
1954
+ selector: 'ngts-text-3d',
1896
1955
  standalone: true,
1897
1956
  template: `
1898
- <ngt-mesh ngtCompound>
1899
- <ngt-text-geometry *args="geometryArgs$ | ngtPush : null" />
1957
+ <ngt-mesh ngtCompound [ref]="textRef">
1958
+ <ngt-text-geometry *args="geometryArgs()" />
1900
1959
  <ng-content />
1901
1960
  </ngt-mesh>
1902
1961
  `,
1903
- imports: [NgtArgs, NgtPush],
1962
+ imports: [NgtArgs],
1904
1963
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1905
1964
  }]
1906
- }], propDecorators: { font: [{
1965
+ }], ctorParameters: function () { return []; }, propDecorators: { textRef: [{
1907
1966
  type: Input
1967
+ }], font: [{
1968
+ type: Input,
1969
+ args: [{ required: true }]
1908
1970
  }], text: [{
1909
- type: Input
1971
+ type: Input,
1972
+ args: [{ required: true }]
1910
1973
  }], bevelEnabled: [{
1911
1974
  type: Input
1912
1975
  }], bevelOffset: [{
@@ -1927,112 +1990,275 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
1927
1990
  type: Input
1928
1991
  }], letterSpacing: [{
1929
1992
  type: Input
1993
+ }], smooth: [{
1994
+ type: Input
1930
1995
  }] } });
1931
1996
 
1932
- class NgtsText extends NgtRxStore {
1933
- constructor() {
1934
- super(...arguments);
1935
- this.textRef = injectNgtRef();
1936
- this.sync = new EventEmitter();
1937
- this.store = inject(NgtStore);
1938
- this.troikaText = new Text();
1939
- }
1997
+ class NgtsText extends NgtSignalStore {
1940
1998
  set text(text) {
1941
1999
  this.set({ text });
1942
2000
  }
1943
- set characters(characters) {
1944
- this.set({ characters });
1945
- }
1946
2001
  set font(font) {
1947
2002
  this.set({ font });
1948
2003
  }
2004
+ set fontSize(fontSize) {
2005
+ this.set({ fontSize });
2006
+ }
1949
2007
  set anchorX(anchorX) {
1950
2008
  this.set({ anchorX });
1951
2009
  }
1952
2010
  set anchorY(anchorY) {
1953
2011
  this.set({ anchorY });
1954
2012
  }
1955
- initialize() {
1956
- super.initialize();
1957
- this.set({ anchorX: 'center', anchorY: 'middle', text: '' });
2013
+ set sdfGlyphSize(sdfGlyphSize) {
2014
+ this.set({ sdfGlyphSize });
1958
2015
  }
1959
- ngOnInit() {
1960
- this.preloadFont();
1961
- this.syncText();
2016
+ set characters(characters) {
2017
+ this.set({ characters });
1962
2018
  }
1963
- ngOnDestroy() {
1964
- this.troikaText.dispose();
1965
- super.ngOnDestroy();
2019
+ set color(color) {
2020
+ this.set({ color });
1966
2021
  }
1967
- preloadFont() {
1968
- const { font, characters } = this.get();
1969
- if (font && characters) {
1970
- preloadFont({ font, characters });
1971
- }
2022
+ set maxWidth(maxWidth) {
2023
+ this.set({ maxWidth });
2024
+ }
2025
+ set lineHeight(lineHeight) {
2026
+ this.set({ lineHeight });
2027
+ }
2028
+ set letterSpacing(letterSpacing) {
2029
+ this.set({ letterSpacing });
2030
+ }
2031
+ set textAlign(textAlign) {
2032
+ this.set({ textAlign });
2033
+ }
2034
+ set clipRect(clipRect) {
2035
+ this.set({ clipRect });
2036
+ }
2037
+ set depthOffset(depthOffset) {
2038
+ this.set({ depthOffset });
2039
+ }
2040
+ set direction(direction) {
2041
+ this.set({ direction });
2042
+ }
2043
+ set overflowWrap(overflowWrap) {
2044
+ this.set({ overflowWrap });
2045
+ }
2046
+ set whiteSpace(whiteSpace) {
2047
+ this.set({ whiteSpace });
2048
+ }
2049
+ set outlineWidth(outlineWidth) {
2050
+ this.set({ outlineWidth });
1972
2051
  }
1973
- syncText() {
1974
- this.hold(this.select(), () => {
1975
- const invalidate = this.store.get('invalidate');
2052
+ set outlineOffsetX(outlineOffsetX) {
2053
+ this.set({ outlineOffsetX });
2054
+ }
2055
+ set outlineOffsetY(outlineOffsetY) {
2056
+ this.set({ outlineOffsetY });
2057
+ }
2058
+ set outlineBlur(outlineBlur) {
2059
+ this.set({ outlineBlur });
2060
+ }
2061
+ set outlineColor(outlineColor) {
2062
+ this.set({ outlineColor });
2063
+ }
2064
+ set outlineOpacity(outlineOpacity) {
2065
+ this.set({ outlineOpacity });
2066
+ }
2067
+ set strokeWidth(strokeWidth) {
2068
+ this.set({ strokeWidth });
2069
+ }
2070
+ set strokeColor(strokeColor) {
2071
+ this.set({ strokeColor });
2072
+ }
2073
+ set strokeOpacity(strokeOpacity) {
2074
+ this.set({ strokeOpacity });
2075
+ }
2076
+ set fillOpacity(fillOpacity) {
2077
+ this.set({ fillOpacity });
2078
+ }
2079
+ set debugSDF(debugSDF) {
2080
+ this.set({ debugSDF });
2081
+ }
2082
+ #store;
2083
+ constructor() {
2084
+ super({ fontSize: 1, sdfGlyphSize: 64, anchorX: 'center', anchorY: 'middle' });
2085
+ this.textRef = injectNgtRef();
2086
+ this.sync = new EventEmitter();
2087
+ this.troikaText = new Text();
2088
+ this.#store = inject(NgtStore);
2089
+ this.state = this.select();
2090
+ inject(DestroyRef).onDestroy(() => {
2091
+ this.troikaText.dispose();
2092
+ });
2093
+ this.#preloadFont();
2094
+ this.#syncText();
2095
+ }
2096
+ #preloadFont() {
2097
+ const font = this.select('font');
2098
+ const characters = this.select('characters');
2099
+ const trigger = computed(() => ({ font: font(), characters: characters() }));
2100
+ effect(() => {
2101
+ const { font, characters } = trigger();
2102
+ const invalidate = this.#store.get('invalidate');
2103
+ preloadFont({ font, characters }, () => invalidate());
2104
+ });
2105
+ }
2106
+ #syncText() {
2107
+ const state = this.select();
2108
+ effect(() => {
2109
+ state();
2110
+ const invalidate = this.#store.get('invalidate');
1976
2111
  this.troikaText.sync(() => {
1977
2112
  invalidate();
1978
- if (this.sync.observed)
1979
- this.sync.next(this.troikaText);
2113
+ if (this.sync.observed) {
2114
+ this.sync.emit(this.troikaText);
2115
+ }
1980
2116
  });
1981
2117
  });
1982
2118
  }
1983
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsText, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1984
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", 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: `
1985
- <ng-container>
1986
- <ngt-primitive
1987
- ngtCompound
1988
- *args="[troikaText]"
1989
- [ref]="textRef"
1990
- [text]="get('text')"
1991
- [anchorX]="get('anchorX')"
1992
- [anchorY]="get('anchorY')"
1993
- [font]="get('font')"
1994
- >
1995
- <ng-content />
1996
- </ngt-primitive>
1997
- </ng-container>
2119
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsText, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2120
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsText, isStandalone: true, selector: "ngts-text", inputs: { textRef: "textRef", text: "text", font: "font", fontSize: "fontSize", anchorX: "anchorX", anchorY: "anchorY", sdfGlyphSize: "sdfGlyphSize", characters: "characters", color: "color", maxWidth: "maxWidth", lineHeight: "lineHeight", letterSpacing: "letterSpacing", textAlign: "textAlign", clipRect: "clipRect", depthOffset: "depthOffset", direction: "direction", overflowWrap: "overflowWrap", whiteSpace: "whiteSpace", outlineWidth: "outlineWidth", outlineOffsetX: "outlineOffsetX", outlineOffsetY: "outlineOffsetY", outlineBlur: "outlineBlur", outlineColor: "outlineColor", outlineOpacity: "outlineOpacity", strokeWidth: "strokeWidth", strokeColor: "strokeColor", strokeOpacity: "strokeOpacity", fillOpacity: "fillOpacity", debugSDF: "debugSDF" }, outputs: { sync: "sync" }, usesInheritance: true, ngImport: i0, template: `
2121
+ <ngt-primitive
2122
+ ngtCompound
2123
+ *args="[troikaText]"
2124
+ [ref]="textRef"
2125
+ [text]="state().text"
2126
+ [anchorX]="state().anchorX"
2127
+ [anchorY]="state().anchorY"
2128
+ [font]="state().font"
2129
+ [fontSize]="state().fontSize"
2130
+ [sdfGlyphSize]="state().sdfGlyphSize"
2131
+ [characters]="state().characters"
2132
+ [color]="state().color"
2133
+ [maxWidth]="state().maxWidth"
2134
+ [lineHeight]="state().lineHeight"
2135
+ [letterSpacing]="state().letterSpacing"
2136
+ [textAlign]="state().textAlign"
2137
+ [clipRect]="state().clipRect"
2138
+ [depthOffset]="state().depthOffset"
2139
+ [direction]="state().direction"
2140
+ [overflowWrap]="state().overflowWrap"
2141
+ [whiteSpace]="state().whiteSpace"
2142
+ [outlineWidth]="state().outlineWidth"
2143
+ [outlineOffsetX]="state().outlineOffsetX"
2144
+ [outlineOffsetY]="state().outlineOffsetY"
2145
+ [outlineBlur]="state().outlineBlur"
2146
+ [outlineColor]="state().outlineColor"
2147
+ [outlineOpacity]="state().outlineOpacity"
2148
+ [strokeWidth]="state().strokeWidth"
2149
+ [strokeColor]="state().strokeColor"
2150
+ [strokeOpacity]="state().strokeOpacity"
2151
+ [fillOpacity]="state().fillOpacity"
2152
+ [debugSDF]="state().debugSDF"
2153
+ >
2154
+ <ng-content />
2155
+ </ngt-primitive>
1998
2156
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] }); }
1999
2157
  }
2000
2158
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsText, decorators: [{
2001
2159
  type: Component,
2002
2160
  args: [{
2003
- selector: 'ngts-text[text]',
2161
+ selector: 'ngts-text',
2004
2162
  standalone: true,
2005
2163
  template: `
2006
- <ng-container>
2007
- <ngt-primitive
2008
- ngtCompound
2009
- *args="[troikaText]"
2010
- [ref]="textRef"
2011
- [text]="get('text')"
2012
- [anchorX]="get('anchorX')"
2013
- [anchorY]="get('anchorY')"
2014
- [font]="get('font')"
2015
- >
2016
- <ng-content />
2017
- </ngt-primitive>
2018
- </ng-container>
2164
+ <ngt-primitive
2165
+ ngtCompound
2166
+ *args="[troikaText]"
2167
+ [ref]="textRef"
2168
+ [text]="state().text"
2169
+ [anchorX]="state().anchorX"
2170
+ [anchorY]="state().anchorY"
2171
+ [font]="state().font"
2172
+ [fontSize]="state().fontSize"
2173
+ [sdfGlyphSize]="state().sdfGlyphSize"
2174
+ [characters]="state().characters"
2175
+ [color]="state().color"
2176
+ [maxWidth]="state().maxWidth"
2177
+ [lineHeight]="state().lineHeight"
2178
+ [letterSpacing]="state().letterSpacing"
2179
+ [textAlign]="state().textAlign"
2180
+ [clipRect]="state().clipRect"
2181
+ [depthOffset]="state().depthOffset"
2182
+ [direction]="state().direction"
2183
+ [overflowWrap]="state().overflowWrap"
2184
+ [whiteSpace]="state().whiteSpace"
2185
+ [outlineWidth]="state().outlineWidth"
2186
+ [outlineOffsetX]="state().outlineOffsetX"
2187
+ [outlineOffsetY]="state().outlineOffsetY"
2188
+ [outlineBlur]="state().outlineBlur"
2189
+ [outlineColor]="state().outlineColor"
2190
+ [outlineOpacity]="state().outlineOpacity"
2191
+ [strokeWidth]="state().strokeWidth"
2192
+ [strokeColor]="state().strokeColor"
2193
+ [strokeOpacity]="state().strokeOpacity"
2194
+ [fillOpacity]="state().fillOpacity"
2195
+ [debugSDF]="state().debugSDF"
2196
+ >
2197
+ <ng-content />
2198
+ </ngt-primitive>
2019
2199
  `,
2020
2200
  imports: [NgtArgs],
2021
- providers: [RxActionFactory],
2022
2201
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
2023
2202
  }]
2024
- }], propDecorators: { textRef: [{
2203
+ }], ctorParameters: function () { return []; }, propDecorators: { textRef: [{
2025
2204
  type: Input
2026
2205
  }], text: [{
2027
- type: Input
2028
- }], characters: [{
2029
- type: Input
2206
+ type: Input,
2207
+ args: [{ required: true }]
2030
2208
  }], font: [{
2031
2209
  type: Input
2210
+ }], fontSize: [{
2211
+ type: Input
2032
2212
  }], anchorX: [{
2033
2213
  type: Input
2034
2214
  }], anchorY: [{
2035
2215
  type: Input
2216
+ }], sdfGlyphSize: [{
2217
+ type: Input
2218
+ }], characters: [{
2219
+ type: Input
2220
+ }], color: [{
2221
+ type: Input
2222
+ }], maxWidth: [{
2223
+ type: Input
2224
+ }], lineHeight: [{
2225
+ type: Input
2226
+ }], letterSpacing: [{
2227
+ type: Input
2228
+ }], textAlign: [{
2229
+ type: Input
2230
+ }], clipRect: [{
2231
+ type: Input
2232
+ }], depthOffset: [{
2233
+ type: Input
2234
+ }], direction: [{
2235
+ type: Input
2236
+ }], overflowWrap: [{
2237
+ type: Input
2238
+ }], whiteSpace: [{
2239
+ type: Input
2240
+ }], outlineWidth: [{
2241
+ type: Input
2242
+ }], outlineOffsetX: [{
2243
+ type: Input
2244
+ }], outlineOffsetY: [{
2245
+ type: Input
2246
+ }], outlineBlur: [{
2247
+ type: Input
2248
+ }], outlineColor: [{
2249
+ type: Input
2250
+ }], outlineOpacity: [{
2251
+ type: Input
2252
+ }], strokeWidth: [{
2253
+ type: Input
2254
+ }], strokeColor: [{
2255
+ type: Input
2256
+ }], strokeOpacity: [{
2257
+ type: Input
2258
+ }], fillOpacity: [{
2259
+ type: Input
2260
+ }], debugSDF: [{
2261
+ type: Input
2036
2262
  }], sync: [{
2037
2263
  type: Output
2038
2264
  }] } });