angular-three-soba 2.0.0-beta.26 → 2.0.0-beta.261

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