angular-three-soba 2.0.0-beta.8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/README.md +62 -4
  2. package/abstractions/README.md +279 -2
  3. package/abstractions/index.d.ts +13 -6
  4. package/abstractions/lib/billboard.d.ts +19 -0
  5. package/abstractions/lib/catmull-rom-line.d.ts +617 -0
  6. package/abstractions/lib/cubic-bezier-line.d.ts +19 -0
  7. package/abstractions/lib/edges.d.ts +800 -0
  8. package/abstractions/lib/gradient-texture.d.ts +24 -0
  9. package/abstractions/lib/grid.d.ts +315 -0
  10. package/abstractions/lib/helper.d.ts +25 -0
  11. package/abstractions/lib/line.d.ts +41 -0
  12. package/abstractions/lib/prism-geometry.d.ts +32 -0
  13. package/abstractions/lib/quadratic-bezier-line.d.ts +21 -0
  14. package/abstractions/lib/rounded-box.d.ts +41 -0
  15. package/abstractions/lib/text-3d.d.ts +314 -0
  16. package/abstractions/lib/text.d.ts +54 -0
  17. package/cameras/README.md +91 -2
  18. package/cameras/index.d.ts +4 -4
  19. package/cameras/lib/camera-content.d.ts +10 -0
  20. package/cameras/lib/cube-camera.d.ts +38 -0
  21. package/cameras/lib/orthographic-camera.d.ts +40 -0
  22. package/cameras/lib/perspective-camera.d.ts +36 -0
  23. package/controls/README.md +96 -2
  24. package/controls/index.d.ts +4 -1
  25. package/controls/lib/camera-controls.d.ts +31 -0
  26. package/controls/lib/orbit-controls.d.ts +38 -0
  27. package/controls/lib/pivot-controls/axis-arrow.d.ts +31 -0
  28. package/controls/lib/pivot-controls/axis-rotator.d.ts +30 -0
  29. package/controls/lib/pivot-controls/pivot-controls.d.ts +110 -0
  30. package/controls/lib/pivot-controls/plane-slider.d.ts +32 -0
  31. package/controls/lib/pivot-controls/scaling-sphere.d.ts +32 -0
  32. package/controls/lib/scroll-controls.d.ts +78 -0
  33. package/esm2022/abstractions/index.mjs +14 -7
  34. package/esm2022/abstractions/lib/billboard.mjs +69 -0
  35. package/esm2022/abstractions/lib/catmull-rom-line.mjs +76 -0
  36. package/esm2022/abstractions/lib/cubic-bezier-line.mjs +51 -0
  37. package/esm2022/abstractions/lib/edges.mjs +70 -0
  38. package/esm2022/abstractions/lib/gradient-texture.mjs +91 -0
  39. package/esm2022/abstractions/lib/grid.mjs +103 -0
  40. package/esm2022/abstractions/lib/helper.mjs +76 -0
  41. package/esm2022/abstractions/lib/line.mjs +126 -0
  42. package/esm2022/abstractions/lib/prism-geometry.mjs +46 -0
  43. package/esm2022/abstractions/lib/quadratic-bezier-line.mjs +73 -0
  44. package/esm2022/abstractions/lib/rounded-box.mjs +111 -0
  45. package/esm2022/abstractions/lib/text-3d.mjs +98 -0
  46. package/esm2022/abstractions/lib/text.mjs +91 -0
  47. package/esm2022/cameras/index.mjs +5 -5
  48. package/esm2022/cameras/lib/camera-content.mjs +14 -0
  49. package/esm2022/cameras/lib/cube-camera.mjs +111 -0
  50. package/esm2022/cameras/lib/orthographic-camera.mjs +131 -0
  51. package/esm2022/cameras/lib/perspective-camera.mjs +104 -0
  52. package/esm2022/controls/index.mjs +5 -2
  53. package/esm2022/controls/lib/camera-controls.mjs +127 -0
  54. package/esm2022/controls/lib/orbit-controls.mjs +132 -0
  55. package/esm2022/controls/lib/pivot-controls/axis-arrow.mjs +263 -0
  56. package/esm2022/controls/lib/pivot-controls/axis-rotator.mjs +264 -0
  57. package/esm2022/controls/lib/pivot-controls/pivot-controls.mjs +340 -0
  58. package/esm2022/controls/lib/pivot-controls/plane-slider.mjs +266 -0
  59. package/esm2022/controls/lib/pivot-controls/scaling-sphere.mjs +232 -0
  60. package/esm2022/controls/lib/scroll-controls.mjs +268 -0
  61. package/esm2022/loaders/index.mjs +6 -5
  62. package/esm2022/loaders/lib/font-loader.mjs +49 -0
  63. package/esm2022/loaders/lib/gltf-loader.mjs +51 -0
  64. package/esm2022/loaders/lib/loader.mjs +109 -0
  65. package/esm2022/loaders/lib/progress.mjs +51 -0
  66. package/esm2022/loaders/lib/texture-loader.mjs +32 -0
  67. package/esm2022/materials/index.mjs +8 -7
  68. package/esm2022/materials/lib/custom-shader-material.mjs +71 -0
  69. package/esm2022/materials/lib/mesh-distort-material.mjs +42 -0
  70. package/esm2022/materials/lib/mesh-reflector-material.mjs +278 -0
  71. package/esm2022/materials/lib/mesh-refraction-material.mjs +144 -0
  72. package/esm2022/materials/lib/mesh-transmission-material.mjs +188 -0
  73. package/esm2022/materials/lib/mesh-wobble-material.mjs +42 -0
  74. package/esm2022/materials/lib/point-material.mjs +33 -0
  75. package/esm2022/misc/index.mjs +14 -14
  76. package/esm2022/misc/lib/animations.mjs +71 -0
  77. package/esm2022/misc/lib/bake-shadows.mjs +26 -0
  78. package/esm2022/misc/lib/computed-attribute.mjs +55 -0
  79. package/esm2022/misc/lib/constants.mjs +5 -0
  80. package/esm2022/misc/lib/decal.mjs +139 -0
  81. package/esm2022/misc/lib/deprecated.mjs +15 -0
  82. package/esm2022/misc/lib/depth-buffer.mjs +39 -0
  83. package/esm2022/misc/lib/fbo.mjs +86 -0
  84. package/esm2022/misc/lib/html/html-content.mjs +327 -0
  85. package/esm2022/misc/lib/html/html.mjs +129 -0
  86. package/esm2022/misc/lib/html/utils.mjs +74 -0
  87. package/esm2022/misc/lib/intersect.mjs +52 -0
  88. package/esm2022/misc/lib/sampler.mjs +122 -0
  89. package/esm2022/misc/lib/scale-factor.mjs +29 -0
  90. package/esm2022/performances/index.mjs +7 -6
  91. package/esm2022/performances/lib/adaptive-dpr.mjs +52 -0
  92. package/esm2022/performances/lib/adaptive-events.mjs +28 -0
  93. package/esm2022/performances/lib/detailed.mjs +57 -0
  94. package/esm2022/performances/lib/instances/instances.mjs +183 -0
  95. package/esm2022/performances/lib/instances/position-mesh.mjs +51 -0
  96. package/esm2022/performances/lib/points/points.mjs +278 -0
  97. package/esm2022/performances/lib/points/position-point.mjs +53 -0
  98. package/esm2022/performances/lib/segments/segment-object.mjs +9 -0
  99. package/esm2022/performances/lib/segments/segments.mjs +129 -0
  100. package/esm2022/shaders/index.mjs +4 -18
  101. package/esm2022/shaders/lib/grid-material.mjs +81 -0
  102. package/esm2022/shaders/lib/mesh-refraction-material.mjs +163 -0
  103. package/esm2022/shaders/lib/point-material.mjs +24 -0
  104. package/esm2022/staging/index.mjs +19 -22
  105. package/esm2022/staging/lib/accumulative-shadows.mjs +182 -0
  106. package/esm2022/staging/lib/backdrop.mjs +73 -0
  107. package/esm2022/staging/lib/bb-anchor.mjs +58 -0
  108. package/esm2022/staging/lib/bounds.mjs +286 -0
  109. package/esm2022/staging/lib/camera-shake.mjs +69 -0
  110. package/esm2022/staging/lib/caustics.mjs +188 -0
  111. package/esm2022/staging/lib/center.mjs +118 -0
  112. package/esm2022/staging/lib/contact-shadows.mjs +214 -0
  113. package/esm2022/staging/lib/environment.mjs +481 -0
  114. package/esm2022/staging/lib/float.mjs +70 -0
  115. package/esm2022/staging/lib/lightformer.mjs +107 -0
  116. package/esm2022/staging/lib/matcap-texture.mjs +81 -0
  117. package/esm2022/staging/lib/normal-texture.mjs +81 -0
  118. package/esm2022/staging/lib/randomized-lights.mjs +104 -0
  119. package/esm2022/staging/lib/render-texture.mjs +203 -0
  120. package/esm2022/staging/lib/sky.mjs +86 -0
  121. package/esm2022/staging/lib/spot-light.mjs +453 -0
  122. package/esm2022/staging/lib/stage.mjs +236 -0
  123. package/esm2022/{utils/angular-three-soba-utils.mjs → stats/angular-three-soba-stats.mjs} +1 -1
  124. package/esm2022/stats/index.mjs +2 -0
  125. package/esm2022/stats/lib/stats.mjs +63 -0
  126. package/esm2022/vanilla-exports/angular-three-soba-vanilla-exports.mjs +5 -0
  127. package/esm2022/vanilla-exports/index.mjs +3 -0
  128. package/fesm2022/angular-three-soba-abstractions.mjs +884 -697
  129. package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
  130. package/fesm2022/angular-three-soba-cameras.mjs +261 -308
  131. package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
  132. package/fesm2022/angular-three-soba-controls.mjs +1776 -109
  133. package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
  134. package/fesm2022/angular-three-soba-loaders.mjs +191 -145
  135. package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
  136. package/fesm2022/angular-three-soba-materials.mjs +527 -748
  137. package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
  138. package/fesm2022/angular-three-soba-misc.mjs +783 -1935
  139. package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
  140. package/fesm2022/angular-three-soba-performances.mjs +591 -475
  141. package/fesm2022/angular-three-soba-performances.mjs.map +1 -1
  142. package/fesm2022/angular-three-soba-shaders.mjs +51 -1369
  143. package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
  144. package/fesm2022/angular-three-soba-staging.mjs +2350 -3521
  145. package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
  146. package/fesm2022/angular-three-soba-stats.mjs +70 -0
  147. package/fesm2022/angular-three-soba-stats.mjs.map +1 -0
  148. package/fesm2022/angular-three-soba-vanilla-exports.mjs +6 -0
  149. package/fesm2022/angular-three-soba-vanilla-exports.mjs.map +1 -0
  150. package/loaders/README.md +130 -2
  151. package/loaders/index.d.ts +5 -4
  152. package/loaders/lib/font-loader.d.ts +27 -0
  153. package/loaders/lib/gltf-loader.d.ts +24 -0
  154. package/loaders/lib/loader.d.ts +29 -0
  155. package/loaders/lib/progress.d.ts +9 -0
  156. package/loaders/lib/texture-loader.d.ts +13 -0
  157. package/materials/README.md +160 -2
  158. package/materials/index.d.ts +7 -6
  159. package/materials/lib/custom-shader-material.d.ts +20 -0
  160. package/materials/lib/mesh-distort-material.d.ts +17 -0
  161. package/materials/lib/mesh-reflector-material.d.ts +51 -0
  162. package/materials/lib/mesh-refraction-material.d.ts +42 -0
  163. package/materials/lib/mesh-transmission-material.d.ts +77 -0
  164. package/materials/lib/mesh-wobble-material.d.ts +15 -0
  165. package/materials/lib/point-material.d.ts +11 -0
  166. package/metadata.json +1 -1
  167. package/misc/README.md +217 -2
  168. package/misc/index.d.ts +13 -13
  169. package/misc/lib/animations.d.ts +17 -0
  170. package/misc/lib/computed-attribute.d.ts +64 -0
  171. package/misc/lib/constants.d.ts +1 -0
  172. package/misc/lib/decal.d.ts +27 -0
  173. package/misc/lib/deprecated.d.ts +14 -0
  174. package/misc/lib/depth-buffer.d.ts +8 -0
  175. package/misc/lib/fbo.d.ts +46 -0
  176. package/misc/lib/html/html-content.d.ts +47 -0
  177. package/misc/lib/html/html.d.ts +30 -0
  178. package/misc/lib/html/utils.d.ts +14 -0
  179. package/misc/lib/intersect.d.ts +13 -0
  180. package/misc/lib/sampler.d.ts +73 -0
  181. package/misc/lib/scale-factor.d.ts +3 -0
  182. package/package.json +89 -48
  183. package/performances/index.d.ts +6 -5
  184. package/performances/lib/adaptive-dpr.d.ts +7 -0
  185. package/performances/{adaptive-events → lib}/adaptive-events.d.ts +0 -3
  186. package/performances/lib/detailed.d.ts +17 -0
  187. package/performances/lib/instances/instances.d.ts +122 -0
  188. package/performances/lib/instances/position-mesh.d.ts +20 -0
  189. package/performances/lib/points/points.d.ts +224 -0
  190. package/performances/lib/points/position-point.d.ts +21 -0
  191. package/performances/lib/segments/segment-object.d.ts +17 -0
  192. package/performances/lib/segments/segments.d.ts +97 -0
  193. package/shaders/index.d.ts +3 -17
  194. package/shaders/lib/grid-material.d.ts +69 -0
  195. package/shaders/lib/mesh-refraction-material.d.ts +11 -0
  196. package/shaders/lib/point-material.d.ts +14 -0
  197. package/staging/README.md +473 -2
  198. package/staging/index.d.ts +18 -21
  199. package/staging/lib/accumulative-shadows.d.ts +75 -0
  200. package/staging/lib/backdrop.d.ts +22 -0
  201. package/staging/lib/bb-anchor.d.ts +17 -0
  202. package/staging/lib/bounds.d.ts +47 -0
  203. package/staging/lib/camera-shake.d.ts +29 -0
  204. package/staging/lib/caustics.d.ts +53 -0
  205. package/staging/lib/center.d.ts +390 -0
  206. package/staging/lib/contact-shadows.d.ts +55 -0
  207. package/staging/lib/environment.d.ts +132 -0
  208. package/staging/lib/float.d.ts +20 -0
  209. package/staging/lib/lightformer.d.ts +310 -0
  210. package/staging/lib/matcap-texture.d.ts +32 -0
  211. package/staging/lib/normal-texture.d.ts +37 -0
  212. package/staging/lib/randomized-lights.d.ts +54 -0
  213. package/staging/lib/render-texture.d.ts +64 -0
  214. package/staging/lib/sky.d.ts +32 -0
  215. package/staging/lib/spot-light.d.ts +119 -0
  216. package/staging/lib/stage.d.ts +352 -0
  217. package/stats/README.md +3 -0
  218. package/stats/index.d.ts +1 -0
  219. package/stats/lib/stats.d.ts +14 -0
  220. package/vanilla-exports/README.md +3 -0
  221. package/vanilla-exports/index.d.ts +27 -0
  222. package/web-types.json +1 -1
  223. package/abstractions/billboard/billboard.d.ts +0 -28
  224. package/abstractions/detailed/detailed.d.ts +0 -26
  225. package/abstractions/edges/edges.d.ts +0 -34
  226. package/abstractions/grid/grid.d.ts +0 -50
  227. package/abstractions/text/text.d.ts +0 -82
  228. package/abstractions/text-3d/text-3d.d.ts +0 -81
  229. package/assets/distort.vert.glsl +0 -1
  230. package/cameras/camera/camera-content.d.ts +0 -13
  231. package/cameras/camera/camera.d.ts +0 -26
  232. package/cameras/cube-camera/cube-camera.d.ts +0 -69
  233. package/cameras/orthographic-camera/orthographic-camera.d.ts +0 -37
  234. package/cameras/perspective-camera/perspective-camera.d.ts +0 -18
  235. package/controls/orbit-controls/orbit-controls.d.ts +0 -54
  236. package/esm2022/abstractions/billboard/billboard.mjs +0 -74
  237. package/esm2022/abstractions/detailed/detailed.mjs +0 -64
  238. package/esm2022/abstractions/edges/edges.mjs +0 -88
  239. package/esm2022/abstractions/grid/grid.mjs +0 -180
  240. package/esm2022/abstractions/text/text.mjs +0 -274
  241. package/esm2022/abstractions/text-3d/text-3d.mjs +0 -165
  242. package/esm2022/cameras/camera/camera-content.mjs +0 -20
  243. package/esm2022/cameras/camera/camera.mjs +0 -77
  244. package/esm2022/cameras/cube-camera/cube-camera.mjs +0 -161
  245. package/esm2022/cameras/orthographic-camera/orthographic-camera.mjs +0 -102
  246. package/esm2022/cameras/perspective-camera/perspective-camera.mjs +0 -46
  247. package/esm2022/controls/orbit-controls/orbit-controls.mjs +0 -181
  248. package/esm2022/loaders/gltf-loader/gltf-loader.mjs +0 -30
  249. package/esm2022/loaders/loader/loader.mjs +0 -138
  250. package/esm2022/loaders/progress/progress.mjs +0 -45
  251. package/esm2022/loaders/texture-loader/texture-loader.mjs +0 -28
  252. package/esm2022/materials/mesh-distort-material/mesh-distort-material.mjs +0 -82
  253. package/esm2022/materials/mesh-reflector-material/mesh-reflector-material.mjs +0 -367
  254. package/esm2022/materials/mesh-refraction-material/mesh-refraction-material.mjs +0 -171
  255. package/esm2022/materials/mesh-transmission-material/mesh-transmission-material.mjs +0 -278
  256. package/esm2022/materials/mesh-wobble-material/mesh-wobble-material.mjs +0 -68
  257. package/esm2022/materials/point-material/point-material.mjs +0 -46
  258. package/esm2022/misc/animations/animations.mjs +0 -59
  259. package/esm2022/misc/bake-shadows/bake-shadows.mjs +0 -24
  260. package/esm2022/misc/caustics/caustics.mjs +0 -387
  261. package/esm2022/misc/decal/decal.mjs +0 -187
  262. package/esm2022/misc/depth-buffer/depth-buffer.mjs +0 -44
  263. package/esm2022/misc/example/example.mjs +0 -160
  264. package/esm2022/misc/fbo/fbo.mjs +0 -47
  265. package/esm2022/misc/html/html-wrapper.mjs +0 -478
  266. package/esm2022/misc/html/html.mjs +0 -304
  267. package/esm2022/misc/sampler/sampler.mjs +0 -142
  268. package/esm2022/misc/shadow/shadow.mjs +0 -111
  269. package/esm2022/misc/stats-gl/stats-gl.mjs +0 -61
  270. package/esm2022/misc/trail/trail.mjs +0 -209
  271. package/esm2022/misc/trail-texture/inject-trail-texture.mjs +0 -17
  272. package/esm2022/misc/trail-texture/trail-texture.mjs +0 -106
  273. package/esm2022/modifiers/angular-three-soba-modifiers.mjs +0 -5
  274. package/esm2022/modifiers/curve-modifier/curve-modifier.mjs +0 -64
  275. package/esm2022/modifiers/index.mjs +0 -2
  276. package/esm2022/performances/adaptive-dpr/adaptive-dpr.mjs +0 -44
  277. package/esm2022/performances/adaptive-events/adaptive-events.mjs +0 -27
  278. package/esm2022/performances/points/points-input.mjs +0 -64
  279. package/esm2022/performances/points/points.mjs +0 -329
  280. package/esm2022/performances/points/position-point.mjs +0 -54
  281. package/esm2022/performances/segments/segment-object.mjs +0 -9
  282. package/esm2022/performances/segments/segments.mjs +0 -182
  283. package/esm2022/shaders/blur-pass/blur-pass.mjs +0 -61
  284. package/esm2022/shaders/caustics/caustics-material.mjs +0 -130
  285. package/esm2022/shaders/caustics/caustics-projection-material.mjs +0 -31
  286. package/esm2022/shaders/convolution-material/convolution-material.mjs +0 -94
  287. package/esm2022/shaders/discard-material/discard-material.mjs +0 -3
  288. package/esm2022/shaders/grid-material/grid-material.mjs +0 -77
  289. package/esm2022/shaders/mesh-distort-material/mesh-distort-material.mjs +0 -56
  290. package/esm2022/shaders/mesh-reflector-material/mesh-reflector-material.mjs +0 -223
  291. package/esm2022/shaders/mesh-refraction-material/mesh-refraction-material.mjs +0 -170
  292. package/esm2022/shaders/mesh-transmission-material/mesh-transmission-material.mjs +0 -268
  293. package/esm2022/shaders/mesh-wobble-material/mesh-wobble-material.mjs +0 -37
  294. package/esm2022/shaders/shader-material/shader-material.mjs +0 -34
  295. package/esm2022/shaders/soft-shadow-material/soft-shadow-material.mjs +0 -25
  296. package/esm2022/shaders/sparkles-material/sparkles-material.mjs +0 -33
  297. package/esm2022/shaders/spot-light-material/spot-light-material.mjs +0 -86
  298. package/esm2022/shaders/star-field-material/star-field-material.mjs +0 -33
  299. package/esm2022/shaders/wireframe-material/wireframe-material.mjs +0 -247
  300. package/esm2022/staging/accumulative-shadows/accumulative-shadows.mjs +0 -267
  301. package/esm2022/staging/accumulative-shadows/progressive-light-map.mjs +0 -108
  302. package/esm2022/staging/accumulative-shadows/randomized-lights.mjs +0 -206
  303. package/esm2022/staging/backdrop/backdrop.mjs +0 -77
  304. package/esm2022/staging/bb-anchor/bb-anchor.mjs +0 -70
  305. package/esm2022/staging/bounds/bounds.mjs +0 -308
  306. package/esm2022/staging/camera-shake/camera-shake.mjs +0 -123
  307. package/esm2022/staging/center/center.mjs +0 -163
  308. package/esm2022/staging/cloud/cloud.mjs +0 -158
  309. package/esm2022/staging/contact-shadows/contact-shadows.mjs +0 -246
  310. package/esm2022/staging/environment/assets.mjs +0 -13
  311. package/esm2022/staging/environment/environment-cube.mjs +0 -47
  312. package/esm2022/staging/environment/environment-ground.mjs +0 -41
  313. package/esm2022/staging/environment/environment-input.mjs +0 -119
  314. package/esm2022/staging/environment/environment-map.mjs +0 -53
  315. package/esm2022/staging/environment/environment-portal.mjs +0 -113
  316. package/esm2022/staging/environment/environment.mjs +0 -61
  317. package/esm2022/staging/environment/utils.mjs +0 -105
  318. package/esm2022/staging/float/float.mjs +0 -94
  319. package/esm2022/staging/matcap-texture/matcap-texture.mjs +0 -64
  320. package/esm2022/staging/normal-texture/normal-texture.mjs +0 -53
  321. package/esm2022/staging/sky/sky.mjs +0 -119
  322. package/esm2022/staging/sparkles/sparkles.mjs +0 -164
  323. package/esm2022/staging/spot-light/shadow-mesh-input.mjs +0 -63
  324. package/esm2022/staging/spot-light/shadow-mesh.mjs +0 -266
  325. package/esm2022/staging/spot-light/spot-light-input.mjs +0 -84
  326. package/esm2022/staging/spot-light/spot-light.mjs +0 -81
  327. package/esm2022/staging/spot-light/volumetric-mesh.mjs +0 -98
  328. package/esm2022/staging/stage/stage.mjs +0 -388
  329. package/esm2022/staging/stars/stars.mjs +0 -147
  330. package/esm2022/staging/wireframe/wireframe-input.mjs +0 -191
  331. package/esm2022/staging/wireframe/wireframe.mjs +0 -224
  332. package/esm2022/utils/content/content.mjs +0 -15
  333. package/esm2022/utils/index.mjs +0 -2
  334. package/fesm2022/angular-three-soba-modifiers.mjs +0 -71
  335. package/fesm2022/angular-three-soba-modifiers.mjs.map +0 -1
  336. package/fesm2022/angular-three-soba-utils.mjs +0 -22
  337. package/fesm2022/angular-three-soba-utils.mjs.map +0 -1
  338. package/loaders/gltf-loader/gltf-loader.d.ts +0 -10
  339. package/loaders/loader/loader.d.ts +0 -33
  340. package/loaders/progress/progress.d.ts +0 -9
  341. package/loaders/texture-loader/texture-loader.d.ts +0 -7
  342. package/materials/mesh-distort-material/mesh-distort-material.d.ts +0 -40
  343. package/materials/mesh-reflector-material/mesh-reflector-material.d.ts +0 -99
  344. package/materials/mesh-refraction-material/mesh-refraction-material.d.ts +0 -62
  345. package/materials/mesh-transmission-material/mesh-transmission-material.d.ts +0 -107
  346. package/materials/mesh-wobble-material/mesh-wobble-material.d.ts +0 -29
  347. package/materials/point-material/point-material.d.ts +0 -24
  348. package/misc/animations/animations.d.ts +0 -15
  349. package/misc/caustics/caustics.d.ts +0 -87
  350. package/misc/decal/decal.d.ts +0 -49
  351. package/misc/depth-buffer/depth-buffer.d.ts +0 -9
  352. package/misc/example/example.d.ts +0 -81
  353. package/misc/fbo/fbo.d.ts +0 -17
  354. package/misc/html/html-wrapper.d.ts +0 -559
  355. package/misc/html/html.d.ts +0 -214
  356. package/misc/sampler/sampler.d.ts +0 -67
  357. package/misc/shadow/shadow.d.ts +0 -37
  358. package/misc/stats-gl/stats-gl.d.ts +0 -24
  359. package/misc/trail/trail.d.ts +0 -57
  360. package/misc/trail-texture/inject-trail-texture.d.ts +0 -9
  361. package/misc/trail-texture/trail-texture.d.ts +0 -50
  362. package/modifiers/README.md +0 -3
  363. package/modifiers/curve-modifier/curve-modifier.d.ts +0 -23
  364. package/modifiers/index.d.ts +0 -1
  365. package/performances/adaptive-dpr/adaptive-dpr.d.ts +0 -14
  366. package/performances/points/points-input.d.ts +0 -32
  367. package/performances/points/points.d.ts +0 -92
  368. package/performances/points/position-point.d.ts +0 -11
  369. package/performances/segments/segment-object.d.ts +0 -7
  370. package/performances/segments/segments.d.ts +0 -124
  371. package/shaders/blur-pass/blur-pass.d.ts +0 -23
  372. package/shaders/caustics/caustics-material.d.ts +0 -4
  373. package/shaders/caustics/caustics-projection-material.d.ts +0 -4
  374. package/shaders/convolution-material/convolution-material.d.ts +0 -7
  375. package/shaders/discard-material/discard-material.d.ts +0 -3
  376. package/shaders/grid-material/grid-material.d.ts +0 -37
  377. package/shaders/mesh-distort-material/mesh-distort-material.d.ts +0 -295
  378. package/shaders/mesh-reflector-material/mesh-reflector-material.d.ts +0 -50
  379. package/shaders/mesh-refraction-material/mesh-refraction-material.d.ts +0 -4
  380. package/shaders/mesh-transmission-material/mesh-transmission-material.d.ts +0 -25
  381. package/shaders/mesh-wobble-material/mesh-wobble-material.d.ts +0 -16
  382. package/shaders/shader-material/shader-material.d.ts +0 -6
  383. package/shaders/soft-shadow-material/soft-shadow-material.d.ts +0 -19
  384. package/shaders/sparkles-material/sparkles-material.d.ts +0 -17
  385. package/shaders/spot-light-material/spot-light-material.d.ts +0 -13
  386. package/shaders/star-field-material/star-field-material.d.ts +0 -13
  387. package/shaders/wireframe-material/wireframe-material.d.ts +0 -58
  388. package/staging/accumulative-shadows/accumulative-shadows.d.ts +0 -146
  389. package/staging/accumulative-shadows/progressive-light-map.d.ts +0 -34
  390. package/staging/accumulative-shadows/randomized-lights.d.ts +0 -90
  391. package/staging/backdrop/backdrop.d.ts +0 -30
  392. package/staging/bb-anchor/bb-anchor.d.ts +0 -27
  393. package/staging/bounds/bounds.d.ts +0 -134
  394. package/staging/camera-shake/camera-shake.d.ts +0 -43
  395. package/staging/center/center.d.ts +0 -70
  396. package/staging/cloud/cloud.d.ts +0 -51
  397. package/staging/contact-shadows/contact-shadows.d.ts +0 -70
  398. package/staging/environment/assets.d.ts +0 -13
  399. package/staging/environment/environment-cube.d.ts +0 -15
  400. package/staging/environment/environment-ground.d.ts +0 -13
  401. package/staging/environment/environment-input.d.ts +0 -68
  402. package/staging/environment/environment-map.d.ts +0 -16
  403. package/staging/environment/environment-portal.d.ts +0 -18
  404. package/staging/environment/environment.d.ts +0 -8
  405. package/staging/environment/utils.d.ts +0 -7
  406. package/staging/float/float.d.ts +0 -31
  407. package/staging/matcap-texture/matcap-texture.d.ts +0 -13
  408. package/staging/normal-texture/normal-texture.d.ts +0 -16
  409. package/staging/sky/sky.d.ts +0 -48
  410. package/staging/sparkles/sparkles.d.ts +0 -63
  411. package/staging/spot-light/shadow-mesh-input.d.ts +0 -29
  412. package/staging/spot-light/shadow-mesh.d.ts +0 -37
  413. package/staging/spot-light/spot-light-input.d.ts +0 -38
  414. package/staging/spot-light/spot-light.d.ts +0 -39
  415. package/staging/spot-light/volumetric-mesh.d.ts +0 -24
  416. package/staging/stage/stage.d.ts +0 -130
  417. package/staging/stars/stars.d.ts +0 -45
  418. package/staging/wireframe/wireframe-input.d.ts +0 -65
  419. package/staging/wireframe/wireframe.d.ts +0 -28
  420. package/utils/README.md +0 -3
  421. package/utils/content/content.d.ts +0 -8
  422. package/utils/index.d.ts +0 -1
  423. /package/misc/{bake-shadows → lib}/bake-shadows.d.ts +0 -0
@@ -1,831 +1,1018 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, CUSTOM_ELEMENTS_SCHEMA, Input, effect, TemplateRef, ContentChild, computed, EventEmitter, inject, DestroyRef, Output } from '@angular/core';
3
- import { extend, signalStore, injectNgtRef, injectBeforeRender, NgtArgs, injectNgtStore } from 'angular-three';
4
- import * as THREE from 'three';
5
- import { Group, LOD, LineSegments, LineBasicMaterial, Mesh, PlaneGeometry } from 'three';
6
- import { NgIf, NgTemplateOutlet } from '@angular/common';
7
- import { NgtsSobaContent } from 'angular-three-soba/utils';
2
+ import { input, viewChild, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, computed, afterNextRender, untracked, inject, signal, effect, output, DestroyRef } from '@angular/core';
3
+ import { omit, extend, injectBeforeRender, injectStore, pick, checkNeedsUpdate, NgtArgs, getLocalState, resolveRef } from 'angular-three';
4
+ import { mergeInputs } from 'ngxtension/inject-inputs';
5
+ import { Group, Quaternion, Vector3, Vector4, Vector2, Color, CatmullRomCurve3, CubicBezierCurve3, EdgesGeometry, CanvasTexture, BackSide, Plane, Mesh, PlaneGeometry, Object3D, Shape, ExtrudeGeometry, QuadraticBezierCurve3 } from 'three';
6
+ import { injectAutoEffect } from 'ngxtension/auto-effect';
7
+ import { LineSegments2, Line2, LineMaterial, LineSegmentsGeometry, LineGeometry, toCreasedNormals, TextGeometry, mergeVertices } from 'three-stdlib';
8
+ import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
8
9
  import { GridMaterial } from 'angular-three-soba/shaders';
9
- import { toSignal, toObservable } from '@angular/core/rxjs-interop';
10
- import { switchMap, of, map } from 'rxjs';
11
- import { TextGeometry, FontLoader } from 'three-stdlib';
10
+ import { assertInjector } from 'ngxtension/assert-injector';
12
11
  import { Text, preloadFont } from 'troika-three-text';
12
+ import { injectFont } from 'angular-three-soba/loaders';
13
13
 
14
- extend({ Group });
14
+ const defaultOptions$b = {
15
+ follow: true,
16
+ lockX: false,
17
+ lockY: false,
18
+ lockZ: false,
19
+ };
15
20
  class NgtsBillboard {
16
- set _follow(follow) {
17
- this.inputs.set({ follow });
18
- }
19
- set _lockX(lockX) {
20
- this.inputs.set({ lockX });
21
- }
22
- set _lockY(lockY) {
23
- this.inputs.set({ lockY });
24
- }
25
- set _lockZ(lockZ) {
26
- this.inputs.set({ lockZ });
27
- }
28
21
  constructor() {
29
- this.inputs = signalStore({ follow: true, lockX: false, lockY: false, lockZ: false });
30
- this.billboardRef = injectNgtRef();
22
+ this.options = input(defaultOptions$b, { transform: mergeInputs(defaultOptions$b) });
23
+ this.parameters = omit(this.options, ['follow', 'lockX', 'lockY', 'lockZ']);
24
+ this.groupRef = viewChild.required('group');
25
+ this.innerRef = viewChild.required('inner');
26
+ extend({ Group });
27
+ const q = new Quaternion();
31
28
  injectBeforeRender(({ camera }) => {
32
- const ref = this.billboardRef.untracked;
33
- const { follow, lockX, lockY, lockZ } = this.inputs.get();
34
- if (!ref || !follow)
29
+ const [{ follow, lockX, lockY, lockZ }, group, inner] = [
30
+ this.options(),
31
+ this.groupRef().nativeElement,
32
+ this.innerRef().nativeElement,
33
+ ];
34
+ if (!follow || !group)
35
35
  return;
36
36
  // save previous rotation in case we're locking an axis
37
- const prevRotation = ref.rotation.clone();
37
+ const prevRotation = group.rotation.clone();
38
38
  // always face the camera
39
- camera.getWorldQuaternion(ref.quaternion);
40
- // re-adjust any axis that is locked
39
+ group.updateMatrix();
40
+ group.updateWorldMatrix(false, false);
41
+ group.getWorldQuaternion(q);
42
+ camera.getWorldQuaternion(inner.quaternion).premultiply(q.invert());
43
+ // readjust any axis that is locked
41
44
  if (lockX)
42
- ref.rotation.x = prevRotation.x;
45
+ group.rotation.x = prevRotation.x;
43
46
  if (lockY)
44
- ref.rotation.y = prevRotation.y;
47
+ group.rotation.y = prevRotation.y;
45
48
  if (lockZ)
46
- ref.rotation.z = prevRotation.z;
49
+ group.rotation.z = prevRotation.z;
47
50
  });
48
51
  }
49
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsBillboard, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
50
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsBillboard, isStandalone: true, selector: "ngts-billboard", inputs: { billboardRef: "billboardRef", _follow: ["follow", "_follow"], _lockX: ["lockX", "_lockX"], _lockY: ["lockY", "_lockY"], _lockZ: ["lockZ", "_lockZ"] }, ngImport: i0, template: `
51
- <ngt-group ngtCompound [ref]="billboardRef">
52
- <ng-content />
52
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsBillboard, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
53
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsBillboard, isStandalone: true, selector: "ngts-billboard", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "innerRef", first: true, predicate: ["inner"], descendants: true, isSignal: true }], ngImport: i0, template: `
54
+ <ngt-group #group [parameters]="parameters()">
55
+ <ngt-group #inner>
56
+ <ng-content />
57
+ </ngt-group>
53
58
  </ngt-group>
54
- `, isInline: true }); }
59
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
55
60
  }
56
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsBillboard, decorators: [{
61
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsBillboard, decorators: [{
57
62
  type: Component,
58
63
  args: [{
59
64
  selector: 'ngts-billboard',
60
65
  standalone: true,
61
66
  template: `
62
- <ngt-group ngtCompound [ref]="billboardRef">
63
- <ng-content />
67
+ <ngt-group #group [parameters]="parameters()">
68
+ <ngt-group #inner>
69
+ <ng-content />
70
+ </ngt-group>
64
71
  </ngt-group>
65
72
  `,
66
73
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
74
+ changeDetection: ChangeDetectionStrategy.OnPush,
67
75
  }]
68
- }], ctorParameters: function () { return []; }, propDecorators: { billboardRef: [{
69
- type: Input
70
- }], _follow: [{
71
- type: Input,
72
- args: [{ alias: 'follow' }]
73
- }], _lockX: [{
74
- type: Input,
75
- args: [{ alias: 'lockX' }]
76
- }], _lockY: [{
77
- type: Input,
78
- args: [{ alias: 'lockY' }]
79
- }], _lockZ: [{
80
- type: Input,
81
- args: [{ alias: 'lockZ' }]
82
- }] } });
76
+ }], ctorParameters: () => [] });
83
77
 
84
- extend({ LOD });
85
- class NgtsDetailed {
86
- set _distances(distances) {
87
- this.inputs.set({ distances });
88
- }
89
- set _hysteresis(hysteresis) {
90
- this.inputs.set({ hysteresis });
78
+ const defaultOptions$a = {
79
+ lineWidth: 1,
80
+ segments: false,
81
+ color: 0xffffff,
82
+ };
83
+ class NgtsLine {
84
+ // NOTE: use attached event to call computeLineDistances to ensure the geometry has been attached
85
+ onGeometryAttached({ parent }) {
86
+ parent.computeLineDistances();
91
87
  }
92
88
  constructor() {
93
- this.inputs = signalStore({ hysteresis: 0 });
94
- this.lodRef = injectNgtRef();
95
- this.updateChildren();
96
- }
97
- onBeforeRender({ object, state }) {
98
- object.update(state.camera);
99
- }
100
- updateChildren() {
101
- const lodChildren = this.lodRef.children();
102
- const _distances = this.inputs.select('distances');
103
- const _hysteresis = this.inputs.select('hysteresis');
104
- effect(() => {
105
- const lod = this.lodRef.nativeElement;
106
- if (!lod)
107
- return;
108
- const [distances, hysteresis, children] = [_distances(), _hysteresis(), lodChildren()];
109
- lod.levels.length = 0;
110
- children.forEach((child, index) => {
111
- lod.addLevel(child, distances[index], hysteresis);
89
+ this.points = input.required();
90
+ this.options = input(defaultOptions$a, { transform: mergeInputs(defaultOptions$a) });
91
+ this.parameters = omit(this.options, ['color', 'vertexColors', 'lineWidth', 'segments', 'linewidth', 'dashed']);
92
+ this.lineRef = viewChild('line');
93
+ this.store = injectStore();
94
+ this.size = this.store.select('size');
95
+ this.segments = pick(this.options, 'segments');
96
+ this.vertexColors = pick(this.options, 'vertexColors');
97
+ this.dashed = pick(this.options, 'dashed');
98
+ this.color = pick(this.options, 'color');
99
+ this.lineWidth = pick(this.options, 'lineWidth');
100
+ this.linewidth = pick(this.options, 'linewidth');
101
+ this.vertex = computed(() => Boolean(this.vertexColors()));
102
+ this.resolution = computed(() => [this.size().width, this.size().height]);
103
+ this.line2 = computed(() => (this.segments() ? new LineSegments2() : new Line2()));
104
+ this.lineMaterial = new LineMaterial();
105
+ this.itemSize = computed(() => (this.vertexColors()?.[0]?.length === 4 ? 4 : 3));
106
+ this.lineGeometry = computed(() => {
107
+ const geom = this.segments() ? new LineSegmentsGeometry() : new LineGeometry();
108
+ const pValues = this.points().map((p) => {
109
+ const isArray = Array.isArray(p);
110
+ return p instanceof Vector3 || p instanceof Vector4
111
+ ? [p.x, p.y, p.z]
112
+ : p instanceof Vector2
113
+ ? [p.x, p.y, 0]
114
+ : isArray && p.length === 3
115
+ ? [p[0], p[1], p[2]]
116
+ : isArray && p.length === 2
117
+ ? [p[0], p[1], 0]
118
+ : p;
119
+ });
120
+ geom.setPositions(pValues.flat());
121
+ const vertexColors = this.vertexColors();
122
+ if (vertexColors) {
123
+ const cValues = vertexColors.map((c) => (c instanceof Color ? c.toArray() : c));
124
+ // @ts-expect-error - flat() isn't defined
125
+ geom.setColors(cValues.flat(), this.itemSize());
126
+ }
127
+ return geom;
128
+ });
129
+ const autoEffect = injectAutoEffect();
130
+ afterNextRender(() => {
131
+ autoEffect(() => {
132
+ const [lineMaterial, dashed] = [this.lineMaterial, this.dashed()];
133
+ if (dashed) {
134
+ lineMaterial.defines['USE_DASH'] = '';
135
+ }
136
+ else {
137
+ delete lineMaterial.defines['USE_DASH'];
138
+ }
139
+ checkNeedsUpdate(lineMaterial);
140
+ });
141
+ autoEffect(() => {
142
+ const [lineGeometry, lineMaterial] = [this.lineGeometry(), this.lineMaterial];
143
+ return () => {
144
+ lineGeometry.dispose();
145
+ lineMaterial.dispose();
146
+ };
112
147
  });
113
148
  });
114
149
  }
115
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsDetailed, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
116
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsDetailed, isStandalone: true, selector: "ngts-detailed", inputs: { lodRef: "lodRef", _distances: ["distances", "_distances"], _hysteresis: ["hysteresis", "_hysteresis"] }, ngImport: i0, template: `
117
- <ngt-lOD ngtCompound [ref]="lodRef" (beforeRender)="onBeforeRender($event)">
150
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsLine, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
151
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsLine, isStandalone: true, selector: "ngts-line", inputs: { points: { classPropertyName: "points", publicName: "points", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "lineRef", first: true, predicate: ["line"], descendants: true, isSignal: true }], ngImport: i0, template: `
152
+ <ngt-primitive *args="[line2()]" #line [parameters]="parameters()">
153
+ <ngt-primitive *args="[lineGeometry()]" attach="geometry" (attached)="onGeometryAttached($any($event))" />
154
+ <ngt-primitive
155
+ *args="[lineMaterial]"
156
+ attach="material"
157
+ [color]="color()"
158
+ [vertexColors]="vertex()"
159
+ [resolution]="resolution()"
160
+ [linewidth]="linewidth() ?? lineWidth() ?? 1"
161
+ [dashed]="dashed()"
162
+ [transparent]="itemSize() === 4"
163
+ [parameters]="parameters()"
164
+ />
118
165
  <ng-content />
119
- </ngt-lOD>
120
- `, isInline: true }); }
166
+ </ngt-primitive>
167
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
121
168
  }
122
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsDetailed, decorators: [{
169
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsLine, decorators: [{
123
170
  type: Component,
124
171
  args: [{
125
- selector: 'ngts-detailed',
172
+ selector: 'ngts-line',
126
173
  standalone: true,
127
174
  template: `
128
- <ngt-lOD ngtCompound [ref]="lodRef" (beforeRender)="onBeforeRender($event)">
175
+ <ngt-primitive *args="[line2()]" #line [parameters]="parameters()">
176
+ <ngt-primitive *args="[lineGeometry()]" attach="geometry" (attached)="onGeometryAttached($any($event))" />
177
+ <ngt-primitive
178
+ *args="[lineMaterial]"
179
+ attach="material"
180
+ [color]="color()"
181
+ [vertexColors]="vertex()"
182
+ [resolution]="resolution()"
183
+ [linewidth]="linewidth() ?? lineWidth() ?? 1"
184
+ [dashed]="dashed()"
185
+ [transparent]="itemSize() === 4"
186
+ [parameters]="parameters()"
187
+ />
129
188
  <ng-content />
130
- </ngt-lOD>
189
+ </ngt-primitive>
131
190
  `,
132
191
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
192
+ changeDetection: ChangeDetectionStrategy.OnPush,
193
+ imports: [NgtArgs],
133
194
  }]
134
- }], ctorParameters: function () { return []; }, propDecorators: { lodRef: [{
135
- type: Input
136
- }], _distances: [{
137
- type: Input,
138
- args: [{ required: true, alias: 'distances' }]
139
- }], _hysteresis: [{
140
- type: Input,
141
- args: [{ alias: 'hysteresis' }]
142
- }] } });
195
+ }], ctorParameters: () => [] });
143
196
 
144
- extend({ LineSegments, LineBasicMaterial });
145
- class NgtsEdges {
146
- set _threshold(threshold) {
147
- this.inputs.set({ threshold });
148
- }
149
- set _color(color) {
150
- this.inputs.set({ color });
151
- }
152
- set _geometry(geometry) {
153
- this.inputs.set({ geometry });
197
+ const defaultOptions$9 = {
198
+ curveType: 'centripetal',
199
+ tension: 0.5,
200
+ segments: 20,
201
+ closed: false,
202
+ lineWidth: 1,
203
+ };
204
+ class NgtsCatmullRomLine {
205
+ constructor() {
206
+ this.points = input.required();
207
+ this.options = input(defaultOptions$9, { transform: mergeInputs(defaultOptions$9) });
208
+ this.parameters = omit(this.options, ['curveType', 'tension', 'segments', 'closed', 'vertexColors']);
209
+ this.line = viewChild.required(NgtsLine);
210
+ this.closed = pick(this.options, 'closed');
211
+ this.curveType = pick(this.options, 'curveType');
212
+ this.tension = pick(this.options, 'tension');
213
+ this.segments = pick(this.options, 'segments');
214
+ this.vertexColors = pick(this.options, 'vertexColors');
215
+ this.curve = computed(() => {
216
+ const [points, closed, curveType, tension] = [this.points(), this.closed(), this.curveType(), this.tension()];
217
+ const mappedPoints = points.map((pt) => pt instanceof Vector3 ? pt : new Vector3(...pt));
218
+ return new CatmullRomCurve3(mappedPoints, closed, curveType, tension);
219
+ });
220
+ this.segmentedPoints = computed(() => {
221
+ const [curve, segments] = [this.curve(), this.segments()];
222
+ return curve.getPoints(segments);
223
+ });
224
+ this.interpolatedVertexColors = computed(() => {
225
+ const [vertexColors, segments] = [this.vertexColors(), this.segments()];
226
+ if (!vertexColors || vertexColors.length < 2)
227
+ return undefined;
228
+ if (vertexColors.length === segments + 1)
229
+ return vertexColors;
230
+ const mappedColors = vertexColors.map((color) => color instanceof Color ? color : new Color(...color));
231
+ if (untracked(this.closed))
232
+ mappedColors.push(mappedColors[0].clone());
233
+ const iColors = [mappedColors[0]];
234
+ const divisions = segments / (mappedColors.length - 1);
235
+ for (let i = 1; i < segments; i++) {
236
+ const alpha = (i % divisions) / divisions;
237
+ const colorIndex = Math.floor(i / divisions);
238
+ iColors.push(mappedColors[colorIndex].clone().lerp(mappedColors[colorIndex + 1], alpha));
239
+ }
240
+ iColors.push(mappedColors[mappedColors.length - 1]);
241
+ return iColors;
242
+ });
243
+ this.lineOptions = computed(() => ({ ...this.parameters(), vertexColors: this.interpolatedVertexColors() }));
154
244
  }
155
- set _userData(userData) {
156
- this.inputs.set({ userData });
245
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCatmullRomLine, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
246
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsCatmullRomLine, isStandalone: true, selector: "ngts-catmull-rom-line", inputs: { points: { classPropertyName: "points", publicName: "points", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "line", first: true, predicate: NgtsLine, descendants: true, isSignal: true }], ngImport: i0, template: `
247
+ <ngts-line [points]="segmentedPoints()" [options]="lineOptions()">
248
+ <ng-content />
249
+ </ngts-line>
250
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line", inputs: ["points", "options"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
251
+ }
252
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCatmullRomLine, decorators: [{
253
+ type: Component,
254
+ args: [{
255
+ selector: 'ngts-catmull-rom-line',
256
+ standalone: true,
257
+ template: `
258
+ <ngts-line [points]="segmentedPoints()" [options]="lineOptions()">
259
+ <ng-content />
260
+ </ngts-line>
261
+ `,
262
+ changeDetection: ChangeDetectionStrategy.OnPush,
263
+ imports: [NgtsLine],
264
+ }]
265
+ }] });
266
+
267
+ const defaultOptions$8 = {
268
+ lineWidth: 1,
269
+ segments: 20,
270
+ };
271
+ class NgtsCubicBezierLine {
272
+ constructor() {
273
+ this.start = input.required();
274
+ this.end = input.required();
275
+ this.midA = input.required();
276
+ this.midB = input.required();
277
+ this.options = input(defaultOptions$8, { transform: mergeInputs(defaultOptions$8) });
278
+ this.parameters = omit(this.options, ['segments']);
279
+ this.line = viewChild.required(NgtsLine);
280
+ this.segments = pick(this.options, 'segments');
281
+ this.points = computed(() => {
282
+ const [start, end, midA, midB, segments] = [this.start(), this.end(), this.midA(), this.midB(), this.segments()];
283
+ const startV = start instanceof Vector3 ? start : new Vector3(...start);
284
+ const endV = end instanceof Vector3 ? end : new Vector3(...end);
285
+ const midAV = midA instanceof Vector3 ? midA : new Vector3(...midA);
286
+ const midBV = midB instanceof Vector3 ? midB : new Vector3(...midB);
287
+ return new CubicBezierCurve3(startV, midAV, midBV, endV).getPoints(segments);
288
+ });
157
289
  }
290
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCubicBezierLine, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
291
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsCubicBezierLine, isStandalone: true, selector: "ngts-cubic-bezier-line", inputs: { start: { classPropertyName: "start", publicName: "start", isSignal: true, isRequired: true, transformFunction: null }, end: { classPropertyName: "end", publicName: "end", isSignal: true, isRequired: true, transformFunction: null }, midA: { classPropertyName: "midA", publicName: "midA", isSignal: true, isRequired: true, transformFunction: null }, midB: { classPropertyName: "midB", publicName: "midB", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "line", first: true, predicate: NgtsLine, descendants: true, isSignal: true }], ngImport: i0, template: `
292
+ <ngts-line [points]="points()" [options]="parameters()">
293
+ <ng-content />
294
+ </ngts-line>
295
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line", inputs: ["points", "options"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
296
+ }
297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCubicBezierLine, decorators: [{
298
+ type: Component,
299
+ args: [{
300
+ selector: 'ngts-cubic-bezier-line',
301
+ standalone: true,
302
+ template: `
303
+ <ngts-line [points]="points()" [options]="parameters()">
304
+ <ng-content />
305
+ </ngts-line>
306
+ `,
307
+ changeDetection: ChangeDetectionStrategy.OnPush,
308
+ imports: [NgtsLine],
309
+ }]
310
+ }] });
311
+
312
+ const defaultOptions$7 = {
313
+ lineWidth: 1,
314
+ threshold: 15,
315
+ };
316
+ class NgtsEdges {
158
317
  constructor() {
159
- this.nullRaycast = () => null;
160
- this.inputs = signalStore({ threshold: 15, color: 'black' });
161
- this.edgesRef = injectNgtRef();
162
- this.geometry = this.inputs.select('geometry');
163
- this.threshold = this.inputs.select('threshold');
164
- this.color = this.inputs.select('color');
165
- effect(() => {
166
- const edges = this.edgesRef.nativeElement;
167
- if (!edges)
168
- return;
169
- const parent = this.edgesRef.nativeElement.parent;
170
- if (parent) {
171
- const [geometry, threshold] = [this.geometry() || parent.geometry, this.threshold()];
172
- if (geometry !== edges.userData['currentGeom'] || threshold !== edges.userData['currentThreshold']) {
173
- edges.userData['currentGeom'] = geometry;
174
- edges.userData['currentThreshold'] = threshold;
175
- edges.geometry = new THREE.EdgesGeometry(geometry, threshold);
176
- }
177
- }
318
+ this.options = input(defaultOptions$7, { transform: mergeInputs(defaultOptions$7) });
319
+ this.parameters = omit(this.options, ['threshold', 'geometry']);
320
+ this.lineOptions = computed(() => ({ ...this.parameters(), raycast: () => null }));
321
+ this.tmpPoints = [0, 0, 0, 1, 0, 0];
322
+ this.line = viewChild.required(NgtsLine);
323
+ const autoEffect = injectAutoEffect();
324
+ afterNextRender(() => {
325
+ autoEffect(() => {
326
+ const line = this.line().lineRef()?.nativeElement;
327
+ if (!line)
328
+ return;
329
+ const lS = getLocalState(line);
330
+ if (!lS)
331
+ return;
332
+ const parent = lS.parent();
333
+ if (!parent)
334
+ return;
335
+ const { geometry: explicitGeometry, threshold } = this.options();
336
+ const geometry = explicitGeometry ?? parent.geometry;
337
+ if (!geometry)
338
+ return;
339
+ const cached = this.memoizedGeometry === geometry && this.memoizedThreshold === threshold;
340
+ if (cached)
341
+ return;
342
+ this.memoizedGeometry = geometry;
343
+ this.memoizedThreshold = threshold;
344
+ const points = new EdgesGeometry(geometry, threshold).attributes['position']
345
+ .array;
346
+ line.geometry.setPositions(points);
347
+ checkNeedsUpdate(line.geometry.attributes['instanceStart']);
348
+ checkNeedsUpdate(line.geometry.attributes['instanceEnd']);
349
+ line.computeLineDistances();
350
+ });
178
351
  });
179
352
  }
180
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsEdges, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
181
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsEdges, isStandalone: true, selector: "ngts-edges", inputs: { edgesRef: "edgesRef", _threshold: ["threshold", "_threshold"], _color: ["color", "_color"], _geometry: ["geometry", "_geometry"], _userData: ["userData", "_userData"] }, queries: [{ propertyName: "content", first: true, predicate: NgtsSobaContent, descendants: true, read: TemplateRef }], ngImport: i0, template: `
182
- <ngt-line-segments [ref]="edgesRef" [raycast]="nullRaycast" ngtCompound>
183
- <ng-container *ngIf="content; else defaultMaterial" [ngTemplateOutlet]="content" />
184
- <ng-template #defaultMaterial>
185
- <ngt-line-basic-material [color]="color()" />
186
- </ng-template>
187
- </ngt-line-segments>
188
- `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
353
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsEdges, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
354
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsEdges, isStandalone: true, selector: "ngts-edges", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "line", first: true, predicate: NgtsLine, descendants: true, isSignal: true }], ngImport: i0, template: `
355
+ <ngts-line [points]="tmpPoints" [options]="lineOptions()">
356
+ <ng-content />
357
+ </ngts-line>
358
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line", inputs: ["points", "options"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
189
359
  }
190
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsEdges, decorators: [{
360
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsEdges, decorators: [{
191
361
  type: Component,
192
362
  args: [{
193
363
  selector: 'ngts-edges',
194
364
  standalone: true,
195
365
  template: `
196
- <ngt-line-segments [ref]="edgesRef" [raycast]="nullRaycast" ngtCompound>
197
- <ng-container *ngIf="content; else defaultMaterial" [ngTemplateOutlet]="content" />
198
- <ng-template #defaultMaterial>
199
- <ngt-line-basic-material [color]="color()" />
200
- </ng-template>
201
- </ngt-line-segments>
366
+ <ngts-line [points]="tmpPoints" [options]="lineOptions()">
367
+ <ng-content />
368
+ </ngts-line>
369
+ `,
370
+ imports: [NgtsLine],
371
+ changeDetection: ChangeDetectionStrategy.OnPush,
372
+ }]
373
+ }], ctorParameters: () => [] });
374
+
375
+ const defaultOptions$6 = {
376
+ size: 1024,
377
+ width: 16,
378
+ type: 'linear',
379
+ innerCircleRadius: 0,
380
+ outerCircleRadius: 'auto',
381
+ };
382
+ class NgtsGradientTexture {
383
+ constructor() {
384
+ this.attach = input('map');
385
+ this.stops = input.required();
386
+ this.colors = input.required();
387
+ this.options = input(defaultOptions$6, { transform: mergeInputs(defaultOptions$6) });
388
+ this.parameters = omit(this.options, ['size', 'width', 'type', 'innerCircleRadius', 'outerCircleRadius']);
389
+ this.store = injectStore();
390
+ this.gl = this.store.select('gl');
391
+ this.document = inject(DOCUMENT);
392
+ this.canvas = computed(() => {
393
+ const canvas = this.document.createElement('canvas');
394
+ const context = canvas.getContext('2d');
395
+ const [{ width, size, type, outerCircleRadius, innerCircleRadius }, stops, colors] = [
396
+ untracked(this.options),
397
+ this.stops(),
398
+ this.colors(),
399
+ ];
400
+ canvas.width = width;
401
+ canvas.height = size;
402
+ let gradient;
403
+ if (type === 'linear') {
404
+ gradient = context.createLinearGradient(0, 0, 0, size);
405
+ }
406
+ else {
407
+ const canvasCenterX = canvas.width / 2;
408
+ const canvasCenterY = canvas.height / 2;
409
+ const radius = outerCircleRadius !== 'auto'
410
+ ? Math.abs(Number(outerCircleRadius))
411
+ : Math.sqrt(canvasCenterX ** 2 + canvasCenterY ** 2);
412
+ gradient = context.createRadialGradient(canvasCenterX, canvasCenterY, Math.abs(innerCircleRadius), canvasCenterX, canvasCenterY, radius);
413
+ }
414
+ const tempColor = new Color(); // reuse instance for performance
415
+ let i = stops.length;
416
+ while (i--) {
417
+ gradient.addColorStop(stops[i], tempColor.set(colors[i]).getStyle());
418
+ }
419
+ context.save();
420
+ context.fillStyle = gradient;
421
+ context.fillRect(0, 0, width, size);
422
+ context.restore();
423
+ return canvas;
424
+ });
425
+ extend({ CanvasTexture });
426
+ }
427
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsGradientTexture, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
428
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtsGradientTexture, isStandalone: true, selector: "ngts-gradient-texture", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, stops: { classPropertyName: "stops", publicName: "stops", isSignal: true, isRequired: true, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
429
+ <ngt-canvas-texture
430
+ *args="[canvas()]"
431
+ [attach]="attach()"
432
+ [colorSpace]="gl().outputColorSpace"
433
+ [parameters]="parameters()"
434
+ >
435
+ <ng-content />
436
+ </ngt-canvas-texture>
437
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
438
+ }
439
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsGradientTexture, decorators: [{
440
+ type: Component,
441
+ args: [{
442
+ selector: 'ngts-gradient-texture',
443
+ standalone: true,
444
+ template: `
445
+ <ngt-canvas-texture
446
+ *args="[canvas()]"
447
+ [attach]="attach()"
448
+ [colorSpace]="gl().outputColorSpace"
449
+ [parameters]="parameters()"
450
+ >
451
+ <ng-content />
452
+ </ngt-canvas-texture>
202
453
  `,
203
- imports: [NgIf, NgTemplateOutlet],
204
454
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
455
+ changeDetection: ChangeDetectionStrategy.OnPush,
456
+ imports: [NgtArgs],
205
457
  }]
206
- }], ctorParameters: function () { return []; }, propDecorators: { content: [{
207
- type: ContentChild,
208
- args: [NgtsSobaContent, { read: TemplateRef }]
209
- }], edgesRef: [{
210
- type: Input
211
- }], _threshold: [{
212
- type: Input,
213
- args: [{ alias: 'threshold' }]
214
- }], _color: [{
215
- type: Input,
216
- args: [{ alias: 'color' }]
217
- }], _geometry: [{
218
- type: Input,
219
- args: [{ alias: 'geometry' }]
220
- }], _userData: [{
221
- type: Input,
222
- args: [{ alias: 'userData' }]
223
- }] } });
458
+ }], ctorParameters: () => [] });
224
459
 
225
- extend({ GridMaterial, Mesh, PlaneGeometry });
460
+ const defaultOptions$5 = {
461
+ planeArgs: [],
462
+ cellSize: 0.5,
463
+ cellThickness: 0.5,
464
+ cellColor: 'black',
465
+ sectionSize: 1,
466
+ sectionThickness: 1,
467
+ sectionColor: '#2080ff',
468
+ infiniteGrid: false,
469
+ followCamera: false,
470
+ fadeDistance: 100,
471
+ fadeStrength: 1,
472
+ fadeFrom: 1,
473
+ side: BackSide,
474
+ };
226
475
  class NgtsGrid {
227
- set _cellSize(cellSize) {
228
- this.inputs.set({ cellSize });
229
- }
230
- set _cellThickness(cellThickness) {
231
- this.inputs.set({ cellThickness });
232
- }
233
- set _cellColor(cellColor) {
234
- this.inputs.set({ cellColor });
235
- }
236
- set _sectionSize(sectionSize) {
237
- this.inputs.set({ sectionSize });
238
- }
239
- set _sectionThickness(sectionThickness) {
240
- this.inputs.set({ sectionThickness });
241
- }
242
- set _sectionColor(sectionColor) {
243
- this.inputs.set({ sectionColor });
244
- }
245
- set _followCamera(followCamera) {
246
- this.inputs.set({ followCamera });
247
- }
248
- set _infiniteGrid(infiniteGrid) {
249
- this.inputs.set({ infiniteGrid });
250
- }
251
- set _fadeDistance(fadeDistance) {
252
- this.inputs.set({ fadeDistance });
253
- }
254
- set _fadeStrength(fadeStrength) {
255
- this.inputs.set({ fadeStrength });
256
- }
257
- set _side(side) {
258
- this.inputs.set({ side });
259
- }
260
- set _args(args) {
261
- this.inputs.set({ args });
262
- }
263
476
  constructor() {
264
- this.inputs = signalStore({
265
- cellColor: '#000000',
266
- sectionColor: '#2080ff',
267
- cellSize: 0.5,
268
- sectionSize: 1,
269
- followCamera: false,
270
- infiniteGrid: false,
271
- fadeDistance: 100,
272
- fadeStrength: 1,
273
- cellThickness: 0.5,
274
- sectionThickness: 1,
275
- side: THREE.BackSide,
276
- args: [1, 1, 1, 1],
477
+ this.options = input(defaultOptions$5, { transform: mergeInputs(defaultOptions$5) });
478
+ this.parameters = omit(this.options, [
479
+ 'planeArgs',
480
+ 'cellSize',
481
+ 'cellThickness',
482
+ 'cellColor',
483
+ 'sectionSize',
484
+ 'sectionThickness',
485
+ 'sectionColor',
486
+ 'infiniteGrid',
487
+ 'followCamera',
488
+ 'fadeDistance',
489
+ 'fadeStrength',
490
+ 'fadeFrom',
491
+ 'side',
492
+ ]);
493
+ this.meshRef = viewChild.required('mesh');
494
+ this.plane = new Plane();
495
+ this.upVector = new Vector3(0, 1, 0);
496
+ this.zeroVector = new Vector3(0, 0, 0);
497
+ this.planeArgs = pick(this.options, 'planeArgs');
498
+ this.side = pick(this.options, 'side');
499
+ this.uniforms = computed(() => {
500
+ const { cellSize, sectionSize, cellColor, sectionColor, cellThickness, sectionThickness, fadeDistance, fadeStrength, fadeFrom, infiniteGrid, followCamera, } = this.options();
501
+ return {
502
+ cellSize,
503
+ sectionSize,
504
+ cellColor,
505
+ sectionColor,
506
+ cellThickness,
507
+ sectionThickness,
508
+ fadeDistance,
509
+ fadeStrength,
510
+ fadeFrom,
511
+ infiniteGrid,
512
+ followCamera,
513
+ };
277
514
  });
278
- this.gridRef = injectNgtRef();
279
- this.cellSize = this.inputs.select('cellSize');
280
- this.sectionSize = this.inputs.select('sectionSize');
281
- this.fadeDistance = this.inputs.select('fadeDistance');
282
- this.fadeStrength = this.inputs.select('fadeStrength');
283
- this.cellThickness = this.inputs.select('cellThickness');
284
- this.sectionThickness = this.inputs.select('sectionThickness');
285
- this.infiniteGrid = this.inputs.select('infiniteGrid');
286
- this.followCamera = this.inputs.select('followCamera');
287
- this.cellColor = this.inputs.select('cellColor');
288
- this.sectionColor = this.inputs.select('sectionColor');
289
- this.side = this.inputs.select('side');
290
- this.args = this.inputs.select('args');
291
- this.plane = new THREE.Plane();
292
- this.upVector = new THREE.Vector3(0, 1, 0);
293
- this.zeroVector = new THREE.Vector3(0, 0, 0);
515
+ extend({ Mesh, PlaneGeometry, GridMaterial });
294
516
  injectBeforeRender(({ camera }) => {
295
- this.plane
296
- .setFromNormalAndCoplanarPoint(this.upVector, this.zeroVector)
297
- .applyMatrix4(this.gridRef.nativeElement.matrixWorld);
298
- const gridMaterial = this.gridRef.nativeElement.material;
517
+ const mesh = this.meshRef().nativeElement;
518
+ this.plane.setFromNormalAndCoplanarPoint(this.upVector, this.zeroVector).applyMatrix4(mesh.matrixWorld);
519
+ const gridMaterial = mesh.material;
299
520
  const worldCamProjPosition = gridMaterial.uniforms['worldCamProjPosition'];
300
521
  const worldPlanePosition = gridMaterial.uniforms['worldPlanePosition'];
301
522
  this.plane.projectPoint(camera.position, worldCamProjPosition.value);
302
- worldPlanePosition.value.set(0, 0, 0).applyMatrix4(this.gridRef.nativeElement.matrixWorld);
523
+ worldPlanePosition.value.set(0, 0, 0).applyMatrix4(mesh.matrixWorld);
303
524
  });
304
525
  }
305
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsGrid, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
306
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsGrid, isStandalone: true, selector: "ngts-grid", inputs: { gridRef: "gridRef", _cellSize: ["cellSize", "_cellSize"], _cellThickness: ["cellThickness", "_cellThickness"], _cellColor: ["cellColor", "_cellColor"], _sectionSize: ["sectionSize", "_sectionSize"], _sectionThickness: ["sectionThickness", "_sectionThickness"], _sectionColor: ["sectionColor", "_sectionColor"], _followCamera: ["followCamera", "_followCamera"], _infiniteGrid: ["infiniteGrid", "_infiniteGrid"], _fadeDistance: ["fadeDistance", "_fadeDistance"], _fadeStrength: ["fadeStrength", "_fadeStrength"], _side: ["side", "_side"], _args: ["args", "_args"] }, ngImport: i0, template: `
307
- <ngt-mesh ngtCompound [ref]="gridRef" [frustumCulled]="false">
308
- <ngt-plane-geometry *args="args()" />
309
- <ngt-grid-material
310
- [transparent]="true"
311
- [side]="side()"
312
- [cellSize]="cellSize()"
313
- [cellColor]="cellColor()"
314
- [cellThickness]="cellThickness()"
315
- [sectionSize]="sectionSize()"
316
- [sectionColor]="sectionColor()"
317
- [sectionThickness]="sectionThickness()"
318
- [fadeDistance]="fadeDistance()"
319
- [fadeStrength]="fadeStrength()"
320
- [infiniteGrid]="infiniteGrid()"
321
- [followCamera]="followCamera()"
322
- >
323
- <ngt-value attach="extensions.derivatives" [rawValue]="false" />
526
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsGrid, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
527
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsGrid, isStandalone: true, selector: "ngts-grid", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "meshRef", first: true, predicate: ["mesh"], descendants: true, isSignal: true }], ngImport: i0, template: `
528
+ <ngt-mesh #mesh [frustumCulled]="false" [parameters]="parameters()">
529
+ <ngt-plane-geometry *args="planeArgs()" />
530
+ <ngt-grid-material [transparent]="true" [side]="side()" [parameters]="uniforms()">
531
+ <ngt-value attach="extensions.derivatives" [rawValue]="true" />
324
532
  </ngt-grid-material>
325
533
  <ng-content />
326
534
  </ngt-mesh>
327
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
535
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
328
536
  }
329
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsGrid, decorators: [{
537
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsGrid, decorators: [{
330
538
  type: Component,
331
539
  args: [{
332
540
  selector: 'ngts-grid',
333
541
  standalone: true,
334
542
  template: `
335
- <ngt-mesh ngtCompound [ref]="gridRef" [frustumCulled]="false">
336
- <ngt-plane-geometry *args="args()" />
337
- <ngt-grid-material
338
- [transparent]="true"
339
- [side]="side()"
340
- [cellSize]="cellSize()"
341
- [cellColor]="cellColor()"
342
- [cellThickness]="cellThickness()"
343
- [sectionSize]="sectionSize()"
344
- [sectionColor]="sectionColor()"
345
- [sectionThickness]="sectionThickness()"
346
- [fadeDistance]="fadeDistance()"
347
- [fadeStrength]="fadeStrength()"
348
- [infiniteGrid]="infiniteGrid()"
349
- [followCamera]="followCamera()"
350
- >
351
- <ngt-value attach="extensions.derivatives" [rawValue]="false" />
543
+ <ngt-mesh #mesh [frustumCulled]="false" [parameters]="parameters()">
544
+ <ngt-plane-geometry *args="planeArgs()" />
545
+ <ngt-grid-material [transparent]="true" [side]="side()" [parameters]="uniforms()">
546
+ <ngt-value attach="extensions.derivatives" [rawValue]="true" />
352
547
  </ngt-grid-material>
353
548
  <ng-content />
354
549
  </ngt-mesh>
355
550
  `,
551
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
552
+ changeDetection: ChangeDetectionStrategy.OnPush,
356
553
  imports: [NgtArgs],
554
+ }]
555
+ }], ctorParameters: () => [] });
556
+
557
+ function injectHelper(object, helperConstructor, { injector, args = () => [], } = {}) {
558
+ return assertInjector(injectHelper, injector, () => {
559
+ const store = injectStore();
560
+ const scene = store.select('scene');
561
+ const helper = signal(null);
562
+ effect((onCleanup) => {
563
+ let currentHelper = undefined;
564
+ const maybeObject3D = object();
565
+ if (!maybeObject3D)
566
+ return;
567
+ const object3D = resolveRef(maybeObject3D);
568
+ if (!object3D)
569
+ return;
570
+ currentHelper = new (helperConstructor())(object3D, ...args());
571
+ if (!currentHelper)
572
+ return;
573
+ untracked(() => {
574
+ helper.set(currentHelper);
575
+ });
576
+ // Prevent the helpers from blocking rays
577
+ currentHelper.traverse((child) => (child.raycast = () => null));
578
+ scene().add(currentHelper);
579
+ onCleanup(() => {
580
+ helper.set(null);
581
+ scene().remove(currentHelper);
582
+ currentHelper.dispose?.();
583
+ });
584
+ });
585
+ injectBeforeRender(() => {
586
+ const currentHelper = helper();
587
+ if (currentHelper)
588
+ currentHelper.update();
589
+ });
590
+ return helper.asReadonly();
591
+ });
592
+ }
593
+ class NgtsHelper {
594
+ constructor() {
595
+ this.type = input.required();
596
+ this.options = input([]);
597
+ this.helperRef = viewChild.required('helper');
598
+ this.parent = computed(() => {
599
+ const helper = this.helperRef().nativeElement;
600
+ if (!helper)
601
+ return;
602
+ const localState = getLocalState(helper);
603
+ if (!localState)
604
+ return;
605
+ return localState.parent();
606
+ });
607
+ this.helper = injectHelper(this.parent, this.type, { args: this.options });
608
+ extend({ Object3D });
609
+ }
610
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsHelper, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
611
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsHelper, isStandalone: true, selector: "ngts-helper", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "helperRef", first: true, predicate: ["helper"], descendants: true, isSignal: true }], ngImport: i0, template: `
612
+ <ngt-object3D #helper />
613
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
614
+ }
615
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsHelper, decorators: [{
616
+ type: Component,
617
+ args: [{
618
+ standalone: true,
619
+ selector: 'ngts-helper',
620
+ template: `
621
+ <ngt-object3D #helper />
622
+ `,
357
623
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
624
+ changeDetection: ChangeDetectionStrategy.OnPush,
358
625
  }]
359
- }], ctorParameters: function () { return []; }, propDecorators: { gridRef: [{
360
- type: Input
361
- }], _cellSize: [{
362
- type: Input,
363
- args: [{ alias: 'cellSize' }]
364
- }], _cellThickness: [{
365
- type: Input,
366
- args: [{ alias: 'cellThickness' }]
367
- }], _cellColor: [{
368
- type: Input,
369
- args: [{ alias: 'cellColor' }]
370
- }], _sectionSize: [{
371
- type: Input,
372
- args: [{ alias: 'sectionSize' }]
373
- }], _sectionThickness: [{
374
- type: Input,
375
- args: [{ alias: 'sectionThickness' }]
376
- }], _sectionColor: [{
377
- type: Input,
378
- args: [{ alias: 'sectionColor' }]
379
- }], _followCamera: [{
380
- type: Input,
381
- args: [{ alias: 'followCamera' }]
382
- }], _infiniteGrid: [{
383
- type: Input,
384
- args: [{ alias: 'infiniteGrid' }]
385
- }], _fadeDistance: [{
386
- type: Input,
387
- args: [{ alias: 'fadeDistance' }]
388
- }], _fadeStrength: [{
389
- type: Input,
390
- args: [{ alias: 'fadeStrength' }]
391
- }], _side: [{
392
- type: Input,
393
- args: [{ alias: 'side' }]
394
- }], _args: [{
395
- type: Input,
396
- args: [{ alias: 'args' }]
397
- }] } });
626
+ }], ctorParameters: () => [] });
398
627
 
399
- extend({ Mesh, TextGeometry });
400
- class NgtsText3D {
628
+ const defaultOptions$4 = {
629
+ height: 1,
630
+ bevelEnabled: false,
631
+ };
632
+ class NgtsPrismGeometry {
401
633
  constructor() {
402
- this.inputs = signalStore({
403
- lineHeight: 1,
404
- letterSpacing: 0,
405
- size: 1,
406
- height: 0.2,
407
- bevelThickness: 0.1,
408
- bevelSize: 0.01,
409
- bevelEnabled: false,
410
- bevelOffset: 0,
411
- bevelSegments: 4,
412
- curveSegments: 8,
634
+ this.attach = input('geometry');
635
+ this.vertices = input.required();
636
+ this.options = input(defaultOptions$4, { transform: mergeInputs(defaultOptions$4) });
637
+ this.parameters = computed(() => ({ ...this.options(), depth: this.options().height }));
638
+ this.shape = computed(() => {
639
+ const vertices = this.vertices();
640
+ const interpolatedVertices = vertices.map((v) => (v instanceof Vector2 ? v : new Vector2(...v)));
641
+ return new Shape(interpolatedVertices);
413
642
  });
414
- this.textRef = injectNgtRef();
415
- this.fontData = toSignal(toObservable(this.inputs.select('font')).pipe(switchMap((font) => {
416
- if (typeof font === 'string')
417
- return fetch(font).then((res) => res.json());
418
- return of(font);
419
- }), map((fontData) => new FontLoader().parse(fontData))));
420
- this.text = this.inputs.select('text');
421
- this.size = this.inputs.select('size');
422
- this.height = this.inputs.select('height');
423
- this.bevelThickness = this.inputs.select('bevelThickness');
424
- this.bevelSize = this.inputs.select('bevelSize');
425
- this.bevelEnabled = this.inputs.select('bevelEnabled');
426
- this.bevelSegments = this.inputs.select('bevelSegments');
427
- this.bevelOffset = this.inputs.select('bevelOffset');
428
- this.curveSegments = this.inputs.select('curveSegments');
429
- this.letterSpacing = this.inputs.select('letterSpacing');
430
- this.lineHeight = this.inputs.select('lineHeight');
431
- this.geometryArgs = computed(() => {
432
- const fontData = this.fontData();
433
- if (!fontData || !fontData.data)
434
- return null;
435
- return [
436
- this.text(),
437
- {
438
- font: fontData,
439
- size: this.size(),
440
- height: this.height(),
441
- bevelThickness: this.bevelThickness(),
442
- bevelSize: this.bevelSize(),
443
- bevelSegments: this.bevelSegments(),
444
- bevelEnabled: this.bevelEnabled(),
445
- bevelOffset: this.bevelOffset(),
446
- curveSegments: this.curveSegments(),
447
- letterSpacing: this.letterSpacing(),
448
- lineHeight: this.lineHeight(),
449
- },
643
+ this.geometryRef = viewChild('geometry');
644
+ extend({ ExtrudeGeometry });
645
+ }
646
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsPrismGeometry, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
647
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsPrismGeometry, isStandalone: true, selector: "ngts-prism-geometry", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, vertices: { classPropertyName: "vertices", publicName: "vertices", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "geometryRef", first: true, predicate: ["geometry"], descendants: true, isSignal: true }], ngImport: i0, template: `
648
+ <ngt-extrude-geometry #geometry *args="[shape(), parameters()]" [attach]="attach()">
649
+ <ng-content />
650
+ </ngt-extrude-geometry>
651
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
652
+ }
653
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsPrismGeometry, decorators: [{
654
+ type: Component,
655
+ args: [{
656
+ selector: 'ngts-prism-geometry',
657
+ standalone: true,
658
+ template: `
659
+ <ngt-extrude-geometry #geometry *args="[shape(), parameters()]" [attach]="attach()">
660
+ <ng-content />
661
+ </ngt-extrude-geometry>
662
+ `,
663
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
664
+ changeDetection: ChangeDetectionStrategy.OnPush,
665
+ imports: [NgtArgs],
666
+ }]
667
+ }], ctorParameters: () => [] });
668
+
669
+ const defaultOptions$3 = {
670
+ lineWidth: 1,
671
+ segments: 20,
672
+ };
673
+ class NgtsQuadraticBezierLine {
674
+ constructor() {
675
+ this.start = input([0, 0, 0]);
676
+ this.end = input([0, 0, 0]);
677
+ this.mid = input();
678
+ this.options = input(defaultOptions$3, { transform: mergeInputs(defaultOptions$3) });
679
+ this.parameters = omit(this.options, ['segments']);
680
+ this.segments = pick(this.options, 'segments');
681
+ this.line = viewChild.required(NgtsLine);
682
+ this.points = computed(() => this.getPoints(this.start(), this.end(), this.mid(), this.segments()));
683
+ this.curve = new QuadraticBezierCurve3();
684
+ }
685
+ setPoints(start, end, mid) {
686
+ const points = this.getPoints(start, end, mid);
687
+ const geometry = this.line().lineGeometry();
688
+ if (geometry)
689
+ geometry.setPositions(points.map((p) => p.toArray()).flat());
690
+ }
691
+ getPoints(start, end, mid, segments = 20) {
692
+ if (start instanceof Vector3)
693
+ this.curve.v0.copy(start);
694
+ else
695
+ this.curve.v0.set(...start);
696
+ if (end instanceof Vector3)
697
+ this.curve.v2.copy(end);
698
+ else
699
+ this.curve.v2.set(...end);
700
+ if (mid instanceof Vector3) {
701
+ this.curve.v1.copy(mid);
702
+ }
703
+ else if (Array.isArray(mid)) {
704
+ this.curve.v1.set(...mid);
705
+ }
706
+ else {
707
+ this.curve.v1.copy(this.curve.v0
708
+ .clone()
709
+ .add(this.curve.v2.clone().sub(this.curve.v0))
710
+ .add(new Vector3(0, this.curve.v0.y - this.curve.v2.y, 0)));
711
+ }
712
+ return this.curve.getPoints(segments);
713
+ }
714
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsQuadraticBezierLine, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
715
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsQuadraticBezierLine, isStandalone: true, selector: "ngts-quadratic-bezier-line", inputs: { start: { classPropertyName: "start", publicName: "start", isSignal: true, isRequired: false, transformFunction: null }, end: { classPropertyName: "end", publicName: "end", isSignal: true, isRequired: false, transformFunction: null }, mid: { classPropertyName: "mid", publicName: "mid", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "line", first: true, predicate: NgtsLine, descendants: true, isSignal: true }], ngImport: i0, template: `
716
+ <ngts-line [points]="points()" [options]="parameters()">
717
+ <ng-content />
718
+ </ngts-line>
719
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line", inputs: ["points", "options"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
720
+ }
721
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsQuadraticBezierLine, decorators: [{
722
+ type: Component,
723
+ args: [{
724
+ selector: 'ngts-quadratic-bezier-line',
725
+ standalone: true,
726
+ template: `
727
+ <ngts-line [points]="points()" [options]="parameters()">
728
+ <ng-content />
729
+ </ngts-line>
730
+ `,
731
+ changeDetection: ChangeDetectionStrategy.OnPush,
732
+ imports: [NgtsLine],
733
+ }]
734
+ }] });
735
+
736
+ const eps = 0.00001;
737
+ function createShape(width, height, radius0) {
738
+ const shape = new Shape();
739
+ const radius = radius0 - eps;
740
+ shape.absarc(eps, eps, eps, -Math.PI / 2, -Math.PI, true);
741
+ shape.absarc(eps, height - radius * 2, eps, Math.PI, Math.PI / 2, true);
742
+ shape.absarc(width - radius * 2, height - radius * 2, eps, Math.PI / 2, 0, true);
743
+ shape.absarc(width - radius * 2, eps, eps, 0, -Math.PI / 2, true);
744
+ return shape;
745
+ }
746
+ const defaultOptions$2 = {
747
+ width: 1,
748
+ height: 1,
749
+ depth: 1,
750
+ radius: 0.05,
751
+ smoothness: 4,
752
+ bevelSegments: 4,
753
+ creaseAngle: 0.4,
754
+ steps: 1,
755
+ };
756
+ class NgtsRoundedBox {
757
+ constructor() {
758
+ this.options = input(defaultOptions$2, { transform: mergeInputs(defaultOptions$2) });
759
+ this.parameters = omit(this.options, [
760
+ 'width',
761
+ 'height',
762
+ 'depth',
763
+ 'radius',
764
+ 'smoothness',
765
+ 'bevelSegments',
766
+ 'steps',
767
+ 'creaseAngle',
768
+ ]);
769
+ this.width = pick(this.options, 'width');
770
+ this.height = pick(this.options, 'height');
771
+ this.depth = pick(this.options, 'depth');
772
+ this.radius = pick(this.options, 'radius');
773
+ this.smoothness = pick(this.options, 'smoothness');
774
+ this.bevelSegments = pick(this.options, 'bevelSegments');
775
+ this.steps = pick(this.options, 'steps');
776
+ this.creaseAngle = pick(this.options, 'creaseAngle');
777
+ this.meshRef = viewChild.required('mesh');
778
+ this.geometryRef = viewChild('geometry');
779
+ this.shape = computed(() => {
780
+ const [width, height, radius] = [this.width(), this.height(), this.radius()];
781
+ return createShape(width, height, radius);
782
+ });
783
+ this.params = computed(() => {
784
+ const [depth, radius, smoothness, bevelSegments, steps] = [
785
+ this.depth(),
786
+ this.radius(),
787
+ this.smoothness(),
788
+ untracked(this.bevelSegments),
789
+ untracked(this.steps),
450
790
  ];
791
+ return {
792
+ depth: depth - radius * 2,
793
+ bevelEnabled: true,
794
+ bevelSegments: bevelSegments * 2,
795
+ steps,
796
+ bevelSize: radius - eps,
797
+ bevelThickness: radius,
798
+ curveSegments: smoothness,
799
+ };
800
+ });
801
+ extend({ ExtrudeGeometry, Mesh });
802
+ const autoEffect = injectAutoEffect();
803
+ afterNextRender(() => {
804
+ autoEffect(() => {
805
+ const geometry = this.geometryRef()?.nativeElement;
806
+ if (!geometry)
807
+ return;
808
+ this.shape();
809
+ this.params();
810
+ geometry.center();
811
+ toCreasedNormals(geometry, untracked(this.creaseAngle));
812
+ });
451
813
  });
452
814
  }
453
- set _font(font) {
454
- this.inputs.set({ font });
455
- }
456
- set _text(text) {
457
- this.inputs.set({ text });
458
- }
459
- set _bevelEnabled(bevelEnabled) {
460
- this.inputs.set({ bevelEnabled });
461
- }
462
- set _bevelOffset(bevelOffset) {
463
- this.inputs.set({ bevelOffset });
464
- }
465
- set _bevelSize(bevelSize) {
466
- this.inputs.set({ bevelSize });
467
- }
468
- set _bevelThickness(bevelThickness) {
469
- this.inputs.set({ bevelThickness });
470
- }
471
- set _curveSegments(curveSegments) {
472
- this.inputs.set({ curveSegments });
473
- }
474
- set _bevelSegments(bevelSegments) {
475
- this.inputs.set({ bevelSegments });
476
- }
477
- set _height(height) {
478
- this.inputs.set({ height });
479
- }
480
- set _size(size) {
481
- this.inputs.set({ size });
482
- }
483
- set _lineHeight(lineHeight) {
484
- this.inputs.set({ lineHeight });
485
- }
486
- set _letterSpacing(letterSpacing) {
487
- this.inputs.set({ letterSpacing });
488
- }
489
- set _smooth(smooth) {
490
- this.inputs.set({ smooth });
491
- }
492
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsText3D, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
493
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsText3D, isStandalone: true, selector: "ngts-text-3d", inputs: { textRef: "textRef", _font: ["font", "_font"], _text: ["text", "_text"], _bevelEnabled: ["bevelEnabled", "_bevelEnabled"], _bevelOffset: ["bevelOffset", "_bevelOffset"], _bevelSize: ["bevelSize", "_bevelSize"], _bevelThickness: ["bevelThickness", "_bevelThickness"], _curveSegments: ["curveSegments", "_curveSegments"], _bevelSegments: ["bevelSegments", "_bevelSegments"], _height: ["height", "_height"], _size: ["size", "_size"], _lineHeight: ["lineHeight", "_lineHeight"], _letterSpacing: ["letterSpacing", "_letterSpacing"], _smooth: ["smooth", "_smooth"] }, ngImport: i0, template: `
494
- <ngt-mesh ngtCompound [ref]="textRef">
495
- <ngt-text-geometry *args="geometryArgs()" />
815
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsRoundedBox, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
816
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsRoundedBox, isStandalone: true, selector: "ngts-rounded-box", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "meshRef", first: true, predicate: ["mesh"], descendants: true, isSignal: true }, { propertyName: "geometryRef", first: true, predicate: ["geometry"], descendants: true, isSignal: true }], ngImport: i0, template: `
817
+ <ngt-mesh #mesh [parameters]="parameters()">
818
+ <ngt-extrude-geometry #geometry *args="[shape(), params()]" />
496
819
  <ng-content />
497
820
  </ngt-mesh>
498
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
821
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
499
822
  }
500
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsText3D, decorators: [{
823
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsRoundedBox, decorators: [{
501
824
  type: Component,
502
825
  args: [{
503
- selector: 'ngts-text-3d',
826
+ selector: 'ngts-rounded-box',
504
827
  standalone: true,
505
828
  template: `
506
- <ngt-mesh ngtCompound [ref]="textRef">
507
- <ngt-text-geometry *args="geometryArgs()" />
829
+ <ngt-mesh #mesh [parameters]="parameters()">
830
+ <ngt-extrude-geometry #geometry *args="[shape(), params()]" />
508
831
  <ng-content />
509
832
  </ngt-mesh>
510
833
  `,
511
- imports: [NgtArgs],
512
834
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
835
+ changeDetection: ChangeDetectionStrategy.OnPush,
836
+ imports: [NgtArgs],
513
837
  }]
514
- }], propDecorators: { textRef: [{
515
- type: Input
516
- }], _font: [{
517
- type: Input,
518
- args: [{ required: true, alias: 'font' }]
519
- }], _text: [{
520
- type: Input,
521
- args: [{ required: true, alias: 'text' }]
522
- }], _bevelEnabled: [{
523
- type: Input,
524
- args: [{ alias: 'bevelEnabled' }]
525
- }], _bevelOffset: [{
526
- type: Input,
527
- args: [{ alias: 'bevelOffset' }]
528
- }], _bevelSize: [{
529
- type: Input,
530
- args: [{ alias: 'bevelSize' }]
531
- }], _bevelThickness: [{
532
- type: Input,
533
- args: [{ alias: 'bevelThickness' }]
534
- }], _curveSegments: [{
535
- type: Input,
536
- args: [{ alias: 'curveSegments' }]
537
- }], _bevelSegments: [{
538
- type: Input,
539
- args: [{ alias: 'bevelSegments' }]
540
- }], _height: [{
541
- type: Input,
542
- args: [{ alias: 'height' }]
543
- }], _size: [{
544
- type: Input,
545
- args: [{ alias: 'size' }]
546
- }], _lineHeight: [{
547
- type: Input,
548
- args: [{ alias: 'lineHeight' }]
549
- }], _letterSpacing: [{
550
- type: Input,
551
- args: [{ alias: 'letterSpacing' }]
552
- }], _smooth: [{
553
- type: Input,
554
- args: [{ alias: 'smooth' }]
555
- }] } });
838
+ }], ctorParameters: () => [] });
556
839
 
840
+ const defaultOptions$1 = {
841
+ sdfGlyphSize: 64,
842
+ anchorX: 'center',
843
+ anchorY: 'middle',
844
+ fontSize: 1,
845
+ };
557
846
  class NgtsText {
558
- set text(text) {
559
- this.inputs.set({ text });
560
- }
561
- set font(font) {
562
- this.inputs.set({ font });
563
- }
564
- set fontSize(fontSize) {
565
- this.inputs.set({ fontSize });
566
- }
567
- set anchorX(anchorX) {
568
- this.inputs.set({ anchorX });
569
- }
570
- set anchorY(anchorY) {
571
- this.inputs.set({ anchorY });
572
- }
573
- set sdfGlyphSize(sdfGlyphSize) {
574
- this.inputs.set({ sdfGlyphSize });
575
- }
576
- set characters(characters) {
577
- this.inputs.set({ characters });
578
- }
579
- set color(color) {
580
- this.inputs.set({ color });
581
- }
582
- set maxWidth(maxWidth) {
583
- this.inputs.set({ maxWidth });
584
- }
585
- set lineHeight(lineHeight) {
586
- this.inputs.set({ lineHeight });
587
- }
588
- set letterSpacing(letterSpacing) {
589
- this.inputs.set({ letterSpacing });
590
- }
591
- set textAlign(textAlign) {
592
- this.inputs.set({ textAlign });
593
- }
594
- set clipRect(clipRect) {
595
- this.inputs.set({ clipRect });
596
- }
597
- set depthOffset(depthOffset) {
598
- this.inputs.set({ depthOffset });
599
- }
600
- set direction(direction) {
601
- this.inputs.set({ direction });
602
- }
603
- set overflowWrap(overflowWrap) {
604
- this.inputs.set({ overflowWrap });
605
- }
606
- set whiteSpace(whiteSpace) {
607
- this.inputs.set({ whiteSpace });
608
- }
609
- set outlineWidth(outlineWidth) {
610
- this.inputs.set({ outlineWidth });
611
- }
612
- set outlineOffsetX(outlineOffsetX) {
613
- this.inputs.set({ outlineOffsetX });
614
- }
615
- set outlineOffsetY(outlineOffsetY) {
616
- this.inputs.set({ outlineOffsetY });
617
- }
618
- set outlineBlur(outlineBlur) {
619
- this.inputs.set({ outlineBlur });
620
- }
621
- set outlineColor(outlineColor) {
622
- this.inputs.set({ outlineColor });
623
- }
624
- set outlineOpacity(outlineOpacity) {
625
- this.inputs.set({ outlineOpacity });
626
- }
627
- set strokeWidth(strokeWidth) {
628
- this.inputs.set({ strokeWidth });
629
- }
630
- set strokeColor(strokeColor) {
631
- this.inputs.set({ strokeColor });
632
- }
633
- set strokeOpacity(strokeOpacity) {
634
- this.inputs.set({ strokeOpacity });
635
- }
636
- set fillOpacity(fillOpacity) {
637
- this.inputs.set({ fillOpacity });
638
- }
639
- set debugSDF(debugSDF) {
640
- this.inputs.set({ debugSDF });
641
- }
642
847
  constructor() {
643
- this.inputs = signalStore({
644
- fontSize: 1,
645
- sdfGlyphSize: 64,
646
- anchorX: 'center',
647
- anchorY: 'middle',
648
- });
649
- this.textRef = injectNgtRef();
650
- this.sync = new EventEmitter();
651
- this.troikaText = new Text();
652
- this.store = injectNgtStore();
848
+ this.text = input.required();
849
+ this.options = input(defaultOptions$1, { transform: mergeInputs(defaultOptions$1) });
850
+ this.parameters = omit(this.options, ['font', 'fontSize', 'sdfGlyphSize', 'anchorX', 'anchorY', 'characters']);
851
+ this.synced = output();
852
+ this.autoEffect = injectAutoEffect();
853
+ this.store = injectStore();
854
+ this.invalidate = this.store.select('invalidate');
855
+ this.characters = pick(this.options, 'characters');
856
+ this.font = pick(this.options, 'font');
857
+ this.anchorX = pick(this.options, 'anchorX');
858
+ this.anchorY = pick(this.options, 'anchorY');
859
+ this.sdfGlyphSize = pick(this.options, 'sdfGlyphSize');
860
+ this.fontSize = pick(this.options, 'fontSize');
861
+ this.troikaMesh = new Text();
653
862
  inject(DestroyRef).onDestroy(() => {
654
- this.troikaText.dispose();
863
+ this.troikaMesh.dispose();
655
864
  });
656
- this.preloadFont();
657
- this.syncText();
658
- }
659
- preloadFont() {
660
- const _font = this.inputs.select('font');
661
- const _characters = this.inputs.select('characters');
662
- effect(() => {
663
- const [font, characters] = [_font(), _characters()];
664
- const invalidate = this.store.get('invalidate');
665
- preloadFont({ font, characters }, () => invalidate());
865
+ // NOTE: this could be just effect but autoEffect is used for consistency
866
+ this.autoEffect(() => {
867
+ const [font, characters, invalidate] = [this.font(), this.characters(), this.invalidate()];
868
+ if (font) {
869
+ preloadFont({ font, characters }, () => invalidate());
870
+ }
666
871
  });
667
- }
668
- syncText() {
669
- effect(() => {
670
- const [invalidate] = [this.store.get('invalidate'), this.inputs.state()];
671
- this.troikaText.sync(() => {
672
- invalidate();
673
- if (this.sync.observed) {
674
- this.sync.emit(this.troikaText);
675
- }
872
+ afterNextRender(() => {
873
+ this.autoEffect(() => {
874
+ const [invalidate] = [this.invalidate(), this.text(), this.options()];
875
+ this.troikaMesh.sync(() => {
876
+ invalidate();
877
+ this.synced.emit(this.troikaMesh);
878
+ });
676
879
  });
677
880
  });
678
881
  }
679
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsText, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
680
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", 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" }, ngImport: i0, template: `
882
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsText, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
883
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtsText, isStandalone: true, selector: "ngts-text", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { synced: "synced" }, ngImport: i0, template: `
681
884
  <ngt-primitive
682
- ngtCompound
683
- *args="[troikaText]"
684
- [ref]="textRef"
685
- [text]="inputs.state().text"
686
- [anchorX]="inputs.state().anchorX"
687
- [anchorY]="inputs.state().anchorY"
688
- [font]="inputs.state().font"
689
- [fontSize]="inputs.state().fontSize"
690
- [sdfGlyphSize]="inputs.state().sdfGlyphSize"
691
- [characters]="inputs.state().characters"
692
- [color]="inputs.state().color"
693
- [maxWidth]="inputs.state().maxWidth"
694
- [lineHeight]="inputs.state().lineHeight"
695
- [letterSpacing]="inputs.state().letterSpacing"
696
- [textAlign]="inputs.state().textAlign"
697
- [clipRect]="inputs.state().clipRect"
698
- [depthOffset]="inputs.state().depthOffset"
699
- [direction]="inputs.state().direction"
700
- [overflowWrap]="inputs.state().overflowWrap"
701
- [whiteSpace]="inputs.state().whiteSpace"
702
- [outlineWidth]="inputs.state().outlineWidth"
703
- [outlineOffsetX]="inputs.state().outlineOffsetX"
704
- [outlineOffsetY]="inputs.state().outlineOffsetY"
705
- [outlineBlur]="inputs.state().outlineBlur"
706
- [outlineColor]="inputs.state().outlineColor"
707
- [outlineOpacity]="inputs.state().outlineOpacity"
708
- [strokeWidth]="inputs.state().strokeWidth"
709
- [strokeColor]="inputs.state().strokeColor"
710
- [strokeOpacity]="inputs.state().strokeOpacity"
711
- [fillOpacity]="inputs.state().fillOpacity"
712
- [debugSDF]="inputs.state().debugSDF"
885
+ *args="[troikaMesh]"
886
+ [text]="text()"
887
+ [font]="font()"
888
+ [anchorX]="anchorX()"
889
+ [anchorY]="anchorY()"
890
+ [sdfGlyphSize]="sdfGlyphSize()"
891
+ [fontSize]="fontSize()"
892
+ [parameters]="parameters()"
713
893
  >
714
894
  <ng-content />
715
895
  </ngt-primitive>
716
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
896
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
717
897
  }
718
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsText, decorators: [{
898
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsText, decorators: [{
719
899
  type: Component,
720
900
  args: [{
721
901
  selector: 'ngts-text',
722
902
  standalone: true,
723
903
  template: `
724
904
  <ngt-primitive
725
- ngtCompound
726
- *args="[troikaText]"
727
- [ref]="textRef"
728
- [text]="inputs.state().text"
729
- [anchorX]="inputs.state().anchorX"
730
- [anchorY]="inputs.state().anchorY"
731
- [font]="inputs.state().font"
732
- [fontSize]="inputs.state().fontSize"
733
- [sdfGlyphSize]="inputs.state().sdfGlyphSize"
734
- [characters]="inputs.state().characters"
735
- [color]="inputs.state().color"
736
- [maxWidth]="inputs.state().maxWidth"
737
- [lineHeight]="inputs.state().lineHeight"
738
- [letterSpacing]="inputs.state().letterSpacing"
739
- [textAlign]="inputs.state().textAlign"
740
- [clipRect]="inputs.state().clipRect"
741
- [depthOffset]="inputs.state().depthOffset"
742
- [direction]="inputs.state().direction"
743
- [overflowWrap]="inputs.state().overflowWrap"
744
- [whiteSpace]="inputs.state().whiteSpace"
745
- [outlineWidth]="inputs.state().outlineWidth"
746
- [outlineOffsetX]="inputs.state().outlineOffsetX"
747
- [outlineOffsetY]="inputs.state().outlineOffsetY"
748
- [outlineBlur]="inputs.state().outlineBlur"
749
- [outlineColor]="inputs.state().outlineColor"
750
- [outlineOpacity]="inputs.state().outlineOpacity"
751
- [strokeWidth]="inputs.state().strokeWidth"
752
- [strokeColor]="inputs.state().strokeColor"
753
- [strokeOpacity]="inputs.state().strokeOpacity"
754
- [fillOpacity]="inputs.state().fillOpacity"
755
- [debugSDF]="inputs.state().debugSDF"
905
+ *args="[troikaMesh]"
906
+ [text]="text()"
907
+ [font]="font()"
908
+ [anchorX]="anchorX()"
909
+ [anchorY]="anchorY()"
910
+ [sdfGlyphSize]="sdfGlyphSize()"
911
+ [fontSize]="fontSize()"
912
+ [parameters]="parameters()"
756
913
  >
757
914
  <ng-content />
758
915
  </ngt-primitive>
916
+ `,
917
+ imports: [NgtArgs, NgTemplateOutlet],
918
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
919
+ changeDetection: ChangeDetectionStrategy.OnPush,
920
+ }]
921
+ }], ctorParameters: () => [] });
922
+
923
+ const defaultOptions = {
924
+ letterSpacing: 0,
925
+ lineHeight: 1,
926
+ size: 1,
927
+ height: 0.2,
928
+ bevelThickness: 0.1,
929
+ bevelSize: 0.01,
930
+ bevelEnabled: false,
931
+ bevelOffset: 0,
932
+ bevelSegments: 4,
933
+ curveSegments: 8,
934
+ };
935
+ class NgtsText3D {
936
+ constructor() {
937
+ this.font = input.required();
938
+ this.text = input.required();
939
+ this.options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
940
+ this.parameters = omit(this.options, [
941
+ 'letterSpacing',
942
+ 'lineHeight',
943
+ 'size',
944
+ 'height',
945
+ 'bevelThickness',
946
+ 'bevelSize',
947
+ 'bevelEnabled',
948
+ 'bevelOffset',
949
+ 'bevelSegments',
950
+ 'curveSegments',
951
+ 'smooth',
952
+ ]);
953
+ this.meshRef = viewChild('mesh');
954
+ this.loadedFont = injectFont(this.font);
955
+ this.smooth = pick(this.options, 'smooth');
956
+ this.textOptions = pick(this.options, [
957
+ 'letterSpacing',
958
+ 'lineHeight',
959
+ 'size',
960
+ 'height',
961
+ 'bevelThickness',
962
+ 'bevelSize',
963
+ 'bevelEnabled',
964
+ 'bevelOffset',
965
+ 'bevelSegments',
966
+ 'curveSegments',
967
+ ]);
968
+ this.textArgs = computed(() => {
969
+ const [text, font, textOptions] = [this.text(), this.loadedFont(), this.textOptions()];
970
+ if (!font)
971
+ return null;
972
+ return [text, { font, ...textOptions }];
973
+ });
974
+ extend({ Mesh, TextGeometry });
975
+ const autoEffect = injectAutoEffect();
976
+ afterNextRender(() => {
977
+ autoEffect(() => {
978
+ const [mesh, smooth, textArgs] = [this.meshRef()?.nativeElement, this.smooth(), this.textArgs()];
979
+ if (!textArgs || !mesh)
980
+ return;
981
+ if (smooth) {
982
+ mesh.geometry = mergeVertices(mesh.geometry, smooth);
983
+ mesh.geometry.computeVertexNormals();
984
+ }
985
+ });
986
+ });
987
+ }
988
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsText3D, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
989
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsText3D, isStandalone: true, selector: "ngts-text-3d", inputs: { font: { classPropertyName: "font", publicName: "font", isSignal: true, isRequired: true, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "meshRef", first: true, predicate: ["mesh"], descendants: true, isSignal: true }], ngImport: i0, template: `
990
+ <ngt-mesh #mesh [parameters]="parameters()">
991
+ <ngt-text-geometry *args="textArgs()" />
992
+ <ng-content />
993
+ </ngt-mesh>
994
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
995
+ }
996
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsText3D, decorators: [{
997
+ type: Component,
998
+ args: [{
999
+ selector: 'ngts-text-3d',
1000
+ standalone: true,
1001
+ template: `
1002
+ <ngt-mesh #mesh [parameters]="parameters()">
1003
+ <ngt-text-geometry *args="textArgs()" />
1004
+ <ng-content />
1005
+ </ngt-mesh>
759
1006
  `,
760
1007
  imports: [NgtArgs],
761
1008
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1009
+ changeDetection: ChangeDetectionStrategy.OnPush,
762
1010
  }]
763
- }], ctorParameters: function () { return []; }, propDecorators: { textRef: [{
764
- type: Input
765
- }], text: [{
766
- type: Input,
767
- args: [{ required: true }]
768
- }], font: [{
769
- type: Input
770
- }], fontSize: [{
771
- type: Input
772
- }], anchorX: [{
773
- type: Input
774
- }], anchorY: [{
775
- type: Input
776
- }], sdfGlyphSize: [{
777
- type: Input
778
- }], characters: [{
779
- type: Input
780
- }], color: [{
781
- type: Input
782
- }], maxWidth: [{
783
- type: Input
784
- }], lineHeight: [{
785
- type: Input
786
- }], letterSpacing: [{
787
- type: Input
788
- }], textAlign: [{
789
- type: Input
790
- }], clipRect: [{
791
- type: Input
792
- }], depthOffset: [{
793
- type: Input
794
- }], direction: [{
795
- type: Input
796
- }], overflowWrap: [{
797
- type: Input
798
- }], whiteSpace: [{
799
- type: Input
800
- }], outlineWidth: [{
801
- type: Input
802
- }], outlineOffsetX: [{
803
- type: Input
804
- }], outlineOffsetY: [{
805
- type: Input
806
- }], outlineBlur: [{
807
- type: Input
808
- }], outlineColor: [{
809
- type: Input
810
- }], outlineOpacity: [{
811
- type: Input
812
- }], strokeWidth: [{
813
- type: Input
814
- }], strokeColor: [{
815
- type: Input
816
- }], strokeOpacity: [{
817
- type: Input
818
- }], fillOpacity: [{
819
- type: Input
820
- }], debugSDF: [{
821
- type: Input
822
- }], sync: [{
823
- type: Output
824
- }] } });
1011
+ }], ctorParameters: () => [] });
825
1012
 
826
1013
  /**
827
1014
  * Generated bundle index. Do not edit.
828
1015
  */
829
1016
 
830
- export { NgtsBillboard, NgtsDetailed, NgtsEdges, NgtsGrid, NgtsText, NgtsText3D };
1017
+ export { NgtsBillboard, NgtsCatmullRomLine, NgtsCubicBezierLine, NgtsEdges, NgtsGradientTexture, NgtsGrid, NgtsHelper, NgtsLine, NgtsPrismGeometry, NgtsQuadraticBezierLine, NgtsRoundedBox, NgtsText, NgtsText3D, injectHelper };
831
1018
  //# sourceMappingURL=angular-three-soba-abstractions.mjs.map