@adobe/data 0.5.3 → 0.5.5

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 (366) hide show
  1. package/dist/ecs/database/create-database.d.ts +2 -2
  2. package/dist/ecs/database/database-schema/create-database-schema-test.d.ts +1 -0
  3. package/dist/ecs/database/database-schema/create-database-schema-test.js +42 -0
  4. package/dist/ecs/database/database-schema/create-database-schema-test.js.map +1 -0
  5. package/dist/ecs/database/database-schema/create-database-schema.d.ts +14 -0
  6. package/dist/ecs/database/database-schema/create-database-schema.js +32 -0
  7. package/dist/ecs/database/database-schema/create-database-schema.js.map +1 -0
  8. package/dist/ecs/database/database-schema/database-schema.d.ts +13 -0
  9. package/dist/ecs/database/database-schema/database-schema.js +23 -0
  10. package/dist/ecs/database/database-schema/database-schema.js.map +1 -0
  11. package/dist/ecs/database/database-schema/index.d.ts +2 -0
  12. package/dist/{services → ecs/database/database-schema}/index.js +2 -3
  13. package/dist/ecs/database/database-schema/index.js.map +1 -0
  14. package/dist/ecs/database/database.d.ts +3 -1
  15. package/dist/ecs/database/index.d.ts +1 -0
  16. package/dist/ecs/database/index.js +1 -0
  17. package/dist/ecs/database/index.js.map +1 -1
  18. package/dist/ecs/index.d.ts +2 -1
  19. package/dist/ecs/index.js +2 -1
  20. package/dist/ecs/index.js.map +1 -1
  21. package/dist/ecs/store/archetype-components.d.ts +3 -1
  22. package/dist/ecs/store/core/core.d.ts +1 -8
  23. package/dist/ecs/store/core/create-core.js +9 -4
  24. package/dist/ecs/store/core/create-core.js.map +1 -1
  25. package/dist/ecs/store/core/create-core.test.js +0 -109
  26. package/dist/ecs/store/core/create-core.test.js.map +1 -1
  27. package/dist/ecs/store/create-store.js +21 -0
  28. package/dist/ecs/store/create-store.js.map +1 -1
  29. package/dist/ecs/store/store-schema/create-store-schema-test.js +4 -7
  30. package/dist/ecs/store/store-schema/create-store-schema-test.js.map +1 -1
  31. package/dist/ecs/store/store-schema/create-store-schema.d.ts +2 -0
  32. package/dist/ecs/store/store-schema/create-store-schema.js +5 -0
  33. package/dist/ecs/store/store-schema/create-store-schema.js.map +1 -1
  34. package/dist/ecs/store/store-schema/index.d.ts +1 -1
  35. package/dist/ecs/store/store-schema/index.js +1 -1
  36. package/dist/ecs/store/store-schema/index.js.map +1 -1
  37. package/dist/ecs/store/store-schema/store-schema.d.ts +1 -1
  38. package/dist/ecs/world/create-world.d.ts +7 -0
  39. package/dist/ecs/world/create-world.js +108 -0
  40. package/dist/ecs/world/create-world.js.map +1 -0
  41. package/dist/ecs/world/create-world.test.d.ts +1 -0
  42. package/dist/ecs/world/create-world.test.js +499 -0
  43. package/dist/ecs/world/create-world.test.js.map +1 -0
  44. package/dist/ecs/world/index.d.ts +4 -0
  45. package/dist/ecs/world/index.js +26 -0
  46. package/dist/ecs/world/index.js.map +1 -0
  47. package/dist/ecs/world/system.d.ts +20 -0
  48. package/dist/ecs/world/system.js +2 -0
  49. package/dist/ecs/world/system.js.map +1 -0
  50. package/dist/ecs/world/world-schema/create-world-schema-test.d.ts +1 -0
  51. package/dist/ecs/world/world-schema/create-world-schema-test.js +55 -0
  52. package/dist/ecs/world/world-schema/create-world-schema-test.js.map +1 -0
  53. package/dist/ecs/world/world-schema/create-world-schema.d.ts +19 -0
  54. package/dist/ecs/world/world-schema/create-world-schema.js +33 -0
  55. package/dist/ecs/world/world-schema/create-world-schema.js.map +1 -0
  56. package/dist/ecs/world/world-schema/index.d.ts +2 -0
  57. package/dist/ecs/world/world-schema/index.js +24 -0
  58. package/dist/ecs/world/world-schema/index.js.map +1 -0
  59. package/dist/ecs/world/world-schema/world-schema.d.ts +18 -0
  60. package/dist/ecs/world/world-schema/world-schema.js +23 -0
  61. package/dist/ecs/world/world-schema/world-schema.js.map +1 -0
  62. package/dist/ecs/world/world.d.ts +9 -0
  63. package/dist/ecs/world/world.js +2 -0
  64. package/dist/ecs/world/world.js.map +1 -0
  65. package/dist/functions/serialization/serialization.test.js +78 -0
  66. package/dist/functions/serialization/serialization.test.js.map +1 -1
  67. package/dist/graphics/camera/camera.d.ts +62 -0
  68. package/dist/graphics/camera/camera.js +17 -0
  69. package/dist/graphics/camera/camera.js.map +1 -0
  70. package/dist/graphics/camera/index.d.ts +4 -0
  71. package/dist/graphics/camera/index.js +5 -0
  72. package/dist/graphics/camera/index.js.map +1 -0
  73. package/dist/graphics/camera/screen-to-world-ray.d.ts +12 -0
  74. package/dist/graphics/camera/screen-to-world-ray.js +49 -0
  75. package/dist/graphics/camera/screen-to-world-ray.js.map +1 -0
  76. package/dist/graphics/camera/screen-to-world-ray.test.d.ts +1 -0
  77. package/dist/graphics/camera/screen-to-world-ray.test.js +171 -0
  78. package/dist/graphics/camera/screen-to-world-ray.test.js.map +1 -0
  79. package/dist/graphics/camera/to-view-projection.d.ts +3 -0
  80. package/dist/graphics/camera/to-view-projection.js +8 -0
  81. package/dist/graphics/camera/to-view-projection.js.map +1 -0
  82. package/dist/graphics/camera/world-to-screen.d.ts +12 -0
  83. package/dist/graphics/camera/world-to-screen.js +38 -0
  84. package/dist/graphics/camera/world-to-screen.js.map +1 -0
  85. package/dist/graphics/camera/world-to-screen.test.d.ts +1 -0
  86. package/dist/graphics/camera/world-to-screen.test.js +124 -0
  87. package/dist/graphics/camera/world-to-screen.test.js.map +1 -0
  88. package/dist/graphics/create-struct-gpu-buffer.d.ts +7 -0
  89. package/dist/graphics/create-struct-gpu-buffer.js +17 -0
  90. package/dist/graphics/create-struct-gpu-buffer.js.map +1 -0
  91. package/dist/graphics/extract-wgsl-bindings.d.ts +5 -0
  92. package/dist/graphics/extract-wgsl-bindings.js +10 -0
  93. package/dist/graphics/extract-wgsl-bindings.js.map +1 -0
  94. package/dist/graphics/frame.d.ts +22 -0
  95. package/dist/graphics/frame.js +12 -0
  96. package/dist/graphics/frame.js.map +1 -0
  97. package/dist/graphics/get-web-gpu-device-and-context.d.ts +2 -0
  98. package/dist/graphics/get-web-gpu-device-and-context.js +21 -0
  99. package/dist/graphics/get-web-gpu-device-and-context.js.map +1 -0
  100. package/dist/graphics/graphics-context.d.ts +5 -0
  101. package/dist/graphics/graphics-context.js +2 -0
  102. package/dist/graphics/graphics-context.js.map +1 -0
  103. package/dist/graphics/index.d.ts +5 -0
  104. package/dist/graphics/index.js +5 -0
  105. package/dist/graphics/index.js.map +1 -0
  106. package/dist/graphics/to-gpu-buffer.d.ts +2 -0
  107. package/dist/graphics/to-gpu-buffer.js +14 -0
  108. package/dist/graphics/to-gpu-buffer.js.map +1 -0
  109. package/dist/internal/array/index.d.ts +1 -0
  110. package/dist/internal/array/index.js +23 -0
  111. package/dist/internal/array/index.js.map +1 -0
  112. package/dist/internal/array/topological-sort.d.ts +26 -0
  113. package/dist/internal/array/topological-sort.js +79 -0
  114. package/dist/internal/array/topological-sort.js.map +1 -0
  115. package/dist/internal/array/topological-sort.test.d.ts +1 -0
  116. package/dist/internal/array/topological-sort.test.js +100 -0
  117. package/dist/internal/array/topological-sort.test.js.map +1 -0
  118. package/dist/internal/function/debounce.d.ts +70 -0
  119. package/dist/internal/function/debounce.js +155 -0
  120. package/dist/internal/function/debounce.js.map +1 -0
  121. package/dist/internal/function/debounce.test.d.ts +1 -0
  122. package/dist/internal/function/debounce.test.js +306 -0
  123. package/dist/internal/function/debounce.test.js.map +1 -0
  124. package/dist/lit/elements/application-element.d.ts +9 -0
  125. package/dist/lit/elements/application-element.js +62 -0
  126. package/dist/lit/elements/application-element.js.map +1 -0
  127. package/dist/lit/elements/application-host.d.ts +16 -0
  128. package/dist/lit/elements/application-host.js +59 -0
  129. package/dist/lit/elements/application-host.js.map +1 -0
  130. package/dist/lit/elements/index.d.ts +2 -0
  131. package/dist/lit/elements/index.js +2 -0
  132. package/dist/lit/elements/index.js.map +1 -1
  133. package/dist/lit/elements/service-application.js +4 -1
  134. package/dist/lit/elements/service-application.js.map +1 -1
  135. package/dist/lit/functions/index.d.ts +1 -0
  136. package/dist/lit/functions/index.js +23 -0
  137. package/dist/lit/functions/index.js.map +1 -0
  138. package/dist/lit/functions/iterate-self-and-ancestors.d.ts +1 -0
  139. package/dist/lit/functions/iterate-self-and-ancestors.js +44 -0
  140. package/dist/lit/functions/iterate-self-and-ancestors.js.map +1 -0
  141. package/dist/lit/hooks/attach-decorator.d.ts +4 -0
  142. package/dist/lit/hooks/attach-decorator.js +46 -0
  143. package/dist/lit/hooks/attach-decorator.js.map +1 -0
  144. package/dist/lit/hooks/index.d.ts +4 -0
  145. package/dist/lit/hooks/index.js +4 -0
  146. package/dist/lit/hooks/index.js.map +1 -1
  147. package/dist/lit/hooks/use-drag-observe.d.ts +22 -0
  148. package/dist/lit/hooks/use-drag-observe.js +55 -0
  149. package/dist/lit/hooks/use-drag-observe.js.map +1 -0
  150. package/dist/lit/hooks/use-drag-transaction.d.ts +7 -0
  151. package/dist/lit/hooks/use-drag-transaction.js +56 -0
  152. package/dist/lit/hooks/use-drag-transaction.js.map +1 -0
  153. package/dist/lit/hooks/use-draggable.d.ts +16 -0
  154. package/dist/lit/hooks/use-draggable.js +122 -0
  155. package/dist/lit/hooks/use-draggable.js.map +1 -0
  156. package/dist/math/aabb/aabb.d.ts +48 -0
  157. package/dist/math/aabb/aabb.js +86 -0
  158. package/dist/math/aabb/aabb.js.map +1 -0
  159. package/dist/math/aabb/line-intersection.test.d.ts +1 -0
  160. package/dist/math/aabb/line-intersection.test.js +210 -0
  161. package/dist/math/aabb/line-intersection.test.js.map +1 -0
  162. package/dist/math/constants.d.ts +4 -0
  163. package/dist/math/constants.js +26 -0
  164. package/dist/math/constants.js.map +1 -0
  165. package/dist/math/index.d.ts +18 -0
  166. package/dist/math/index.js +40 -0
  167. package/dist/math/index.js.map +1 -0
  168. package/dist/math/line2/intersects.test.d.ts +1 -0
  169. package/dist/math/line2/intersects.test.js +104 -0
  170. package/dist/math/line2/intersects.test.js.map +1 -0
  171. package/dist/math/line2/line2.d.ts +42 -0
  172. package/dist/math/line2/line2.js +78 -0
  173. package/dist/math/line2/line2.js.map +1 -0
  174. package/dist/math/line3/closest-point-on-line.test.d.ts +1 -0
  175. package/dist/math/line3/closest-point-on-line.test.js +107 -0
  176. package/dist/math/line3/closest-point-on-line.test.js.map +1 -0
  177. package/dist/math/line3/interpolate.test.d.ts +1 -0
  178. package/dist/math/line3/interpolate.test.js +66 -0
  179. package/dist/math/line3/interpolate.test.js.map +1 -0
  180. package/dist/math/line3/line3.d.ts +49 -0
  181. package/dist/math/line3/line3.js +77 -0
  182. package/dist/math/line3/line3.js.map +1 -0
  183. package/dist/math/line3/sub-line.test.d.ts +1 -0
  184. package/dist/math/line3/sub-line.test.js +70 -0
  185. package/dist/math/line3/sub-line.test.js.map +1 -0
  186. package/dist/math/mat4x4/mat4x4.d.ts +37 -0
  187. package/dist/math/mat4x4/mat4x4.js +246 -0
  188. package/dist/math/mat4x4/mat4x4.js.map +1 -0
  189. package/dist/math/picking/index.d.ts +1 -0
  190. package/dist/math/picking/index.js +23 -0
  191. package/dist/math/picking/index.js.map +1 -0
  192. package/dist/math/picking/pick-from-tables.d.ts +18 -0
  193. package/dist/math/picking/pick-from-tables.js +154 -0
  194. package/dist/math/picking/pick-from-tables.js.map +1 -0
  195. package/dist/math/picking/pick-result.d.ts +7 -0
  196. package/dist/{services/service.js → math/picking/pick-result.js} +1 -1
  197. package/dist/math/picking/pick-result.js.map +1 -0
  198. package/dist/math/quat/quat.d.ts +42 -0
  199. package/dist/math/quat/quat.js +220 -0
  200. package/dist/math/quat/quat.js.map +1 -0
  201. package/dist/math/vec2/vec2.d.ts +63 -0
  202. package/dist/math/vec2/vec2.js +114 -0
  203. package/dist/math/vec2/vec2.js.map +1 -0
  204. package/dist/math/vec3/vec3.d.ts +65 -0
  205. package/dist/math/vec3/vec3.js +154 -0
  206. package/dist/math/vec3/vec3.js.map +1 -0
  207. package/dist/math/vec4/vec4.d.ts +63 -0
  208. package/dist/math/vec4/vec4.js +154 -0
  209. package/dist/math/vec4/vec4.js.map +1 -0
  210. package/dist/observe/to-async-generator.js +4 -0
  211. package/dist/observe/to-async-generator.js.map +1 -1
  212. package/dist/observe/with-filter.d.ts +1 -1
  213. package/dist/observe/with-filter.js.map +1 -1
  214. package/dist/samples/index.d.ts +13 -0
  215. package/dist/samples/index.js +27 -0
  216. package/dist/samples/index.js.map +1 -0
  217. package/dist/samples/todo/elements/todo-list/todo-list-presentation.d.ts +25 -0
  218. package/dist/samples/todo/elements/todo-list/todo-list-presentation.js +12 -0
  219. package/dist/samples/todo/elements/todo-list/todo-list-presentation.js.map +1 -0
  220. package/dist/samples/todo/elements/todo-list/todo-list.css.d.ts +18 -0
  221. package/dist/samples/todo/elements/todo-list/todo-list.css.js +27 -0
  222. package/dist/samples/todo/elements/todo-list/todo-list.css.js.map +1 -0
  223. package/dist/samples/todo/elements/todo-list/todo-list.d.ts +12 -0
  224. package/dist/samples/todo/elements/todo-list/todo-list.js +60 -0
  225. package/dist/samples/todo/elements/todo-list/todo-list.js.map +1 -0
  226. package/dist/samples/todo/elements/todo-row/index.d.ts +18 -0
  227. package/dist/samples/todo/elements/todo-row/index.js +19 -0
  228. package/dist/samples/todo/elements/todo-row/index.js.map +1 -0
  229. package/dist/samples/todo/elements/todo-row/todo-row-presentation.d.ts +18 -0
  230. package/dist/samples/todo/elements/todo-row/todo-row-presentation.js +66 -0
  231. package/dist/samples/todo/elements/todo-row/todo-row-presentation.js.map +1 -0
  232. package/dist/samples/todo/elements/todo-row/todo-row.css.d.ts +1 -0
  233. package/dist/samples/todo/elements/todo-row/todo-row.css.js +65 -0
  234. package/dist/samples/todo/elements/todo-row/todo-row.css.js.map +1 -0
  235. package/dist/samples/todo/elements/todo-row/todo-row.d.ts +14 -0
  236. package/dist/samples/todo/elements/todo-row/todo-row.js +60 -0
  237. package/dist/samples/todo/elements/todo-row/todo-row.js.map +1 -0
  238. package/dist/samples/todo/elements/todo-toolbar/index.d.ts +18 -0
  239. package/dist/samples/todo/elements/todo-toolbar/index.js +19 -0
  240. package/dist/samples/todo/elements/todo-toolbar/index.js.map +1 -0
  241. package/dist/samples/todo/elements/todo-toolbar/todo-toolbar-presentation.d.ts +22 -0
  242. package/dist/samples/todo/elements/todo-toolbar/todo-toolbar-presentation.js +57 -0
  243. package/dist/samples/todo/elements/todo-toolbar/todo-toolbar-presentation.js.map +1 -0
  244. package/dist/samples/todo/elements/todo-toolbar/todo-toolbar.css.d.ts +1 -0
  245. package/dist/samples/todo/elements/todo-toolbar/todo-toolbar.css.js +50 -0
  246. package/dist/samples/todo/elements/todo-toolbar/todo-toolbar.css.js.map +1 -0
  247. package/dist/samples/todo/elements/todo-toolbar/todo-toolbar.d.ts +11 -0
  248. package/dist/samples/todo/elements/todo-toolbar/todo-toolbar.js +77 -0
  249. package/dist/samples/todo/elements/todo-toolbar/todo-toolbar.js.map +1 -0
  250. package/dist/samples/todo/elements/todo-undo-redo/index.d.ts +18 -0
  251. package/dist/samples/todo/elements/todo-undo-redo/index.js +19 -0
  252. package/dist/samples/todo/elements/todo-undo-redo/index.js.map +1 -0
  253. package/dist/samples/todo/elements/todo-undo-redo/todo-undo-redo-presentation.d.ts +17 -0
  254. package/dist/samples/todo/elements/todo-undo-redo/todo-undo-redo-presentation.js +45 -0
  255. package/dist/samples/todo/elements/todo-undo-redo/todo-undo-redo-presentation.js.map +1 -0
  256. package/dist/samples/todo/elements/todo-undo-redo/todo-undo-redo.css.d.ts +1 -0
  257. package/dist/samples/todo/elements/todo-undo-redo/todo-undo-redo.css.js +28 -0
  258. package/dist/samples/todo/elements/todo-undo-redo/todo-undo-redo.css.js.map +1 -0
  259. package/dist/samples/todo/elements/todo-undo-redo/todo-undo-redo.d.ts +11 -0
  260. package/dist/samples/todo/elements/todo-undo-redo/todo-undo-redo.js +52 -0
  261. package/dist/samples/todo/elements/todo-undo-redo/todo-undo-redo.js.map +1 -0
  262. package/dist/samples/todo/services/dependent-state-service/create-dependent-state-service.d.ts +6 -0
  263. package/dist/samples/todo/services/dependent-state-service/create-dependent-state-service.js +21 -0
  264. package/dist/samples/todo/services/dependent-state-service/create-dependent-state-service.js.map +1 -0
  265. package/dist/samples/todo/services/dependent-state-service/dependent-state/all-todos.d.ts +19 -0
  266. package/dist/samples/todo/services/dependent-state-service/dependent-state/all-todos.js +2 -0
  267. package/dist/samples/todo/services/dependent-state-service/dependent-state/all-todos.js.map +1 -0
  268. package/dist/samples/todo/services/dependent-state-service/dependent-state/complete-todos.d.ts +19 -0
  269. package/dist/samples/todo/services/dependent-state-service/dependent-state/complete-todos.js +2 -0
  270. package/dist/samples/todo/services/dependent-state-service/dependent-state/complete-todos.js.map +1 -0
  271. package/dist/samples/todo/services/dependent-state-service/dependent-state/incomplete-todos.d.ts +19 -0
  272. package/dist/samples/todo/services/dependent-state-service/dependent-state/incomplete-todos.js +2 -0
  273. package/dist/samples/todo/services/dependent-state-service/dependent-state/incomplete-todos.js.map +1 -0
  274. package/dist/samples/todo/services/dependent-state-service/dependent-state/index.d.ts +20 -0
  275. package/dist/samples/todo/services/dependent-state-service/dependent-state/index.js +21 -0
  276. package/dist/samples/todo/services/dependent-state-service/dependent-state/index.js.map +1 -0
  277. package/dist/samples/todo/services/dependent-state-service/dependent-state-service.d.ts +19 -0
  278. package/dist/samples/todo/services/dependent-state-service/dependent-state-service.js +2 -0
  279. package/dist/samples/todo/services/dependent-state-service/dependent-state-service.js.map +1 -0
  280. package/dist/samples/todo/services/main-service/create-main-service.d.ts +25 -0
  281. package/dist/samples/todo/services/main-service/create-main-service.js +39 -0
  282. package/dist/samples/todo/services/main-service/create-main-service.js.map +1 -0
  283. package/dist/samples/todo/services/main-service/todo-main-service.d.ts +35 -0
  284. package/dist/samples/todo/services/main-service/todo-main-service.js +2 -0
  285. package/dist/samples/todo/services/main-service/todo-main-service.js.map +1 -0
  286. package/dist/samples/todo/services/state-service/create-todo-database.d.ts +13 -0
  287. package/dist/samples/todo/services/state-service/create-todo-database.js +26 -0
  288. package/dist/samples/todo/services/state-service/create-todo-database.js.map +1 -0
  289. package/dist/samples/todo/services/state-service/create-todo-store.d.ts +13 -0
  290. package/dist/samples/todo/services/state-service/create-todo-store.js +41 -0
  291. package/dist/samples/todo/services/state-service/create-todo-store.js.map +1 -0
  292. package/dist/samples/todo/services/state-service/todo-state-service.d.ts +22 -0
  293. package/dist/samples/todo/services/state-service/todo-state-service.js +2 -0
  294. package/dist/samples/todo/services/state-service/todo-state-service.js.map +1 -0
  295. package/dist/samples/todo/services/state-service/transactions/create-bulk-todos.d.ts +2 -0
  296. package/dist/samples/todo/services/state-service/transactions/create-bulk-todos.js +26 -0
  297. package/dist/samples/todo/services/state-service/transactions/create-bulk-todos.js.map +1 -0
  298. package/dist/samples/todo/services/state-service/transactions/create-todo.d.ts +22 -0
  299. package/dist/samples/todo/services/state-service/transactions/create-todo.js +13 -0
  300. package/dist/samples/todo/services/state-service/transactions/create-todo.js.map +1 -0
  301. package/dist/samples/todo/services/state-service/transactions/create-todo.test.d.ts +1 -0
  302. package/dist/samples/todo/services/state-service/transactions/create-todo.test.js +32 -0
  303. package/dist/samples/todo/services/state-service/transactions/create-todo.test.js.map +1 -0
  304. package/dist/samples/todo/services/state-service/transactions/delete-all-todos.d.ts +19 -0
  305. package/dist/samples/todo/services/state-service/transactions/delete-all-todos.js +16 -0
  306. package/dist/samples/todo/services/state-service/transactions/delete-all-todos.js.map +1 -0
  307. package/dist/samples/todo/services/state-service/transactions/delete-todo.d.ts +3 -0
  308. package/dist/samples/todo/services/state-service/transactions/delete-todo.js +24 -0
  309. package/dist/samples/todo/services/state-service/transactions/delete-todo.js.map +1 -0
  310. package/dist/samples/todo/services/state-service/transactions/delete-todo.test.d.ts +1 -0
  311. package/dist/samples/todo/services/state-service/transactions/delete-todo.test.js +40 -0
  312. package/dist/samples/todo/services/state-service/transactions/delete-todo.test.js.map +1 -0
  313. package/dist/samples/todo/services/state-service/transactions/drag-todo.d.ts +7 -0
  314. package/dist/samples/todo/services/state-service/transactions/drag-todo.js +33 -0
  315. package/dist/samples/todo/services/state-service/transactions/drag-todo.js.map +1 -0
  316. package/dist/samples/todo/services/state-service/transactions/index.d.ts +23 -0
  317. package/dist/samples/todo/services/state-service/transactions/index.js +25 -0
  318. package/dist/samples/todo/services/state-service/transactions/index.js.map +1 -0
  319. package/dist/samples/todo/services/state-service/transactions/reorder-todos.d.ts +23 -0
  320. package/dist/samples/todo/services/state-service/transactions/reorder-todos.js +11 -0
  321. package/dist/samples/todo/services/state-service/transactions/reorder-todos.js.map +1 -0
  322. package/dist/samples/todo/services/state-service/transactions/toggle-complete.d.ts +20 -0
  323. package/dist/samples/todo/services/state-service/transactions/toggle-complete.js +11 -0
  324. package/dist/samples/todo/services/state-service/transactions/toggle-complete.js.map +1 -0
  325. package/dist/samples/todo/services/state-service/transactions/toggle-complete.test.d.ts +1 -0
  326. package/dist/samples/todo/services/state-service/transactions/toggle-complete.test.js +81 -0
  327. package/dist/samples/todo/services/state-service/transactions/toggle-complete.test.js.map +1 -0
  328. package/dist/samples/todo/todo-element.d.ts +21 -0
  329. package/dist/samples/todo/todo-element.js +4 -0
  330. package/dist/samples/todo/todo-element.js.map +1 -0
  331. package/dist/samples/todo/todo-host.d.ts +8 -0
  332. package/dist/samples/todo/todo-host.js +55 -0
  333. package/dist/samples/todo/todo-host.js.map +1 -0
  334. package/dist/samples/todo/todo-main-element.d.ts +27 -0
  335. package/dist/samples/todo/todo-main-element.js +63 -0
  336. package/dist/samples/todo/todo-main-element.js.map +1 -0
  337. package/dist/samples/todo/todo-sample.d.ts +3 -0
  338. package/dist/samples/todo/todo-sample.js +39 -0
  339. package/dist/samples/todo/todo-sample.js.map +1 -0
  340. package/dist/schema/schema.d.ts +7 -6
  341. package/dist/schema/schema.js.map +1 -1
  342. package/dist/service/disposable.d.ts +4 -0
  343. package/dist/{services/is-service.js → service/disposable.js} +3 -3
  344. package/dist/service/disposable.js.map +1 -0
  345. package/dist/service/progressive-result.d.ts +7 -10
  346. package/dist/service/progressive-result.js +0 -6
  347. package/dist/service/progressive-result.js.map +1 -1
  348. package/dist/service/service.d.ts +11 -1
  349. package/dist/tsconfig.tsbuildinfo +1 -1
  350. package/dist/typed-buffer/register-typed-buffer-codecs.js +39 -22
  351. package/dist/typed-buffer/register-typed-buffer-codecs.js.map +1 -1
  352. package/dist/typed-buffer/structs/get-struct-layout.js +3 -0
  353. package/dist/typed-buffer/structs/get-struct-layout.js.map +1 -1
  354. package/package.json +20 -3
  355. package/dist/services/add-observable-actions.d.ts +0 -29
  356. package/dist/services/add-observable-actions.js +0 -108
  357. package/dist/services/add-observable-actions.js.map +0 -1
  358. package/dist/services/index.d.ts +0 -4
  359. package/dist/services/index.js.map +0 -1
  360. package/dist/services/is-service.d.ts +0 -2
  361. package/dist/services/is-service.js.map +0 -1
  362. package/dist/services/progressive-result.d.ts +0 -96
  363. package/dist/services/progressive-result.js +0 -99
  364. package/dist/services/progressive-result.js.map +0 -1
  365. package/dist/services/service.d.ts +0 -4
  366. package/dist/services/service.js.map +0 -1
@@ -0,0 +1,220 @@
1
+ /*MIT License
2
+
3
+ © Copyright 2025 Adobe. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.*/
22
+ import { F32Schema } from "../../schema/index.js";
23
+ import { getStructLayout } from "../../typed-buffer/index.js";
24
+ import { Vec3 } from "../index.js";
25
+ export const schema = {
26
+ type: 'array',
27
+ items: F32Schema,
28
+ minItems: 4,
29
+ maxItems: 4,
30
+ default: [0, 0, 0, 1], // identity quaternion
31
+ };
32
+ export const layout = getStructLayout(schema);
33
+ // Basic Quaternion Operations
34
+ export const add = ([x1, y1, z1, w1], [x2, y2, z2, w2]) => [
35
+ x1 + x2,
36
+ y1 + y2,
37
+ z1 + z2,
38
+ w1 + w2
39
+ ];
40
+ export const subtract = ([x1, y1, z1, w1], [x2, y2, z2, w2]) => [
41
+ x1 - x2,
42
+ y1 - y2,
43
+ z1 - z2,
44
+ w1 - w2
45
+ ];
46
+ export const scale = ([x, y, z, w], s) => [x * s, y * s, z * s, w * s];
47
+ export const negate = ([x, y, z, w]) => [-x, -y, -z, -w];
48
+ export const conjugate = ([x, y, z, w]) => [-x, -y, -z, w];
49
+ export const multiply = ([x1, y1, z1, w1], [x2, y2, z2, w2]) => [
50
+ x1 * w2 + w1 * x2 + y1 * z2 - z1 * y2,
51
+ y1 * w2 + w1 * y2 + z1 * x2 - x1 * z2,
52
+ z1 * w2 + w1 * z2 + x1 * y2 - y1 * x2,
53
+ w1 * w2 - x1 * x2 - y1 * y2 - z1 * z2
54
+ ];
55
+ // Geometric Functions
56
+ export const length = ([x, y, z, w]) => Math.sqrt(x * x + y * y + z * z + w * w);
57
+ export const lengthSquared = ([x, y, z, w]) => x * x + y * y + z * z + w * w;
58
+ export const normalize = (q) => {
59
+ const len = length(q);
60
+ return len === 0 ? [0, 0, 0, 1] : scale(q, 1 / len);
61
+ };
62
+ export const dot = ([x1, y1, z1, w1], [x2, y2, z2, w2]) => x1 * x2 + y1 * y2 + z1 * z2 + w1 * w2;
63
+ export const distance = (a, b) => length(subtract(b, a));
64
+ // Rotation Functions
65
+ export const fromAxisAngle = (axis, angle) => {
66
+ const halfAngle = angle * 0.5;
67
+ const s = Math.sin(halfAngle);
68
+ const c = Math.cos(halfAngle);
69
+ return [axis[0] * s, axis[1] * s, axis[2] * s, c];
70
+ };
71
+ export const toAxisAngle = ([x, y, z, w]) => {
72
+ const angle = 2 * Math.acos(Math.abs(w));
73
+ const s = Math.sin(angle * 0.5);
74
+ if (s === 0) {
75
+ return { axis: [0, 0, 1], angle: 0 };
76
+ }
77
+ return {
78
+ axis: [x / s, y / s, z / s],
79
+ angle: w < 0 ? -angle : angle
80
+ };
81
+ };
82
+ export const fromEuler = (x, y, z) => {
83
+ const cx = Math.cos(x * 0.5);
84
+ const sx = Math.sin(x * 0.5);
85
+ const cy = Math.cos(y * 0.5);
86
+ const sy = Math.sin(y * 0.5);
87
+ const cz = Math.cos(z * 0.5);
88
+ const sz = Math.sin(z * 0.5);
89
+ return [
90
+ sx * cy * cz - cx * sy * sz,
91
+ cx * sy * cz + sx * cy * sz,
92
+ cx * cy * sz - sx * sy * cz,
93
+ cx * cy * cz + sx * sy * sz
94
+ ];
95
+ };
96
+ export const toEuler = ([x, y, z, w]) => {
97
+ // Roll (x-axis rotation)
98
+ const sinr_cosp = 2 * (w * x + y * z);
99
+ const cosr_cosp = 1 - 2 * (x * x + y * y);
100
+ const roll = Math.atan2(sinr_cosp, cosr_cosp);
101
+ // Pitch (y-axis rotation)
102
+ const sinp = 2 * (w * y - z * x);
103
+ let pitch;
104
+ if (Math.abs(sinp) >= 1) {
105
+ pitch = Math.sign(sinp) * Math.PI / 2; // use 90 degrees if out of range
106
+ }
107
+ else {
108
+ pitch = Math.asin(sinp);
109
+ }
110
+ // Yaw (z-axis rotation)
111
+ const siny_cosp = 2 * (w * z + x * y);
112
+ const cosy_cosp = 1 - 2 * (y * y + z * z);
113
+ const yaw = Math.atan2(siny_cosp, cosy_cosp);
114
+ return [roll, pitch, yaw];
115
+ };
116
+ // Vector Rotation
117
+ export const rotateVec3 = ([x, y, z, w], v) => {
118
+ // q * v * q^-1
119
+ const qv = [x, y, z];
120
+ const uv = Vec3.cross(qv, v);
121
+ const uuv = Vec3.cross(qv, uv);
122
+ const scaleFactor = 2 * w;
123
+ return [
124
+ v[0] + scaleFactor * uv[0] + 2 * uuv[0],
125
+ v[1] + scaleFactor * uv[1] + 2 * uuv[1],
126
+ v[2] + scaleFactor * uv[2] + 2 * uuv[2]
127
+ ];
128
+ };
129
+ // Interpolation
130
+ export const slerp = (q1, q2, t) => {
131
+ const dotProduct = dot(q1, q2);
132
+ // If the dot product is negative, slerp won't take the shorter route
133
+ const q2Adjusted = dotProduct < 0 ? negate(q2) : q2;
134
+ const adjustedDot = Math.abs(dotProduct);
135
+ // If the inputs are too close for comfort, linearly interpolate
136
+ if (adjustedDot > 0.9995) {
137
+ return normalize(add(scale(q1, 1 - t), scale(q2Adjusted, t)));
138
+ }
139
+ const theta = Math.acos(adjustedDot);
140
+ const sinTheta = Math.sin(theta);
141
+ const factor1 = Math.sin((1 - t) * theta) / sinTheta;
142
+ const factor2 = Math.sin(t * theta) / sinTheta;
143
+ return normalize(add(scale(q1, factor1), scale(q2Adjusted, factor2)));
144
+ };
145
+ export const lerp = (q1, q2, t) => {
146
+ return normalize(add(scale(q1, 1 - t), scale(q2, t)));
147
+ };
148
+ // Matrix Conversion
149
+ export const toMat4 = ([x, y, z, w]) => {
150
+ const xx = x * x;
151
+ const yy = y * y;
152
+ const zz = z * z;
153
+ const xy = x * y;
154
+ const xz = x * z;
155
+ const yz = y * z;
156
+ const wx = w * x;
157
+ const wy = w * y;
158
+ const wz = w * z;
159
+ return [
160
+ 1 - 2 * (yy + zz), 2 * (xy - wz), 2 * (xz + wy), 0,
161
+ 2 * (xy + wz), 1 - 2 * (xx + zz), 2 * (yz - wx), 0,
162
+ 2 * (xz - wy), 2 * (yz + wx), 1 - 2 * (xx + yy), 0,
163
+ 0, 0, 0, 1
164
+ ];
165
+ };
166
+ // Utility Functions
167
+ export const identity = () => [0, 0, 0, 1];
168
+ export const inverse = (q) => {
169
+ const lenSq = lengthSquared(q);
170
+ if (lenSq === 0)
171
+ return [0, 0, 0, 1];
172
+ return scale(conjugate(q), 1 / lenSq);
173
+ };
174
+ export const lookAt = (forward, up) => {
175
+ // Normalize forward vector
176
+ const f = Vec3.normalize(forward);
177
+ // Calculate right vector
178
+ const r = Vec3.normalize(Vec3.cross(f, up));
179
+ // Recalculate up vector
180
+ const u = Vec3.cross(r, f);
181
+ // Convert to quaternion
182
+ const trace = r[0] + u[1] + f[2];
183
+ if (trace > 0) {
184
+ const s = Math.sqrt(trace + 1) * 2;
185
+ return [
186
+ (u[2] - f[1]) / s,
187
+ (f[0] - r[2]) / s,
188
+ (r[1] - u[0]) / s,
189
+ 0.25 * s
190
+ ];
191
+ }
192
+ else if (r[0] > u[1] && r[0] > f[2]) {
193
+ const s = Math.sqrt(1 + r[0] - u[1] - f[2]) * 2;
194
+ return [
195
+ 0.25 * s,
196
+ (u[0] + r[1]) / s,
197
+ (f[0] + r[2]) / s,
198
+ (u[2] - f[1]) / s
199
+ ];
200
+ }
201
+ else if (u[1] > f[2]) {
202
+ const s = Math.sqrt(1 + u[1] - r[0] - f[2]) * 2;
203
+ return [
204
+ (u[0] + r[1]) / s,
205
+ 0.25 * s,
206
+ (f[1] + u[2]) / s,
207
+ (f[0] - r[2]) / s
208
+ ];
209
+ }
210
+ else {
211
+ const s = Math.sqrt(1 + f[2] - r[0] - u[1]) * 2;
212
+ return [
213
+ (f[0] + r[2]) / s,
214
+ (f[1] + u[2]) / s,
215
+ 0.25 * s,
216
+ (r[1] - u[0]) / s
217
+ ];
218
+ }
219
+ };
220
+ //# sourceMappingURL=quat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quat.js","sourceRoot":"","sources":["../../../src/math/quat/quat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,SAAS,EAAsB,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,eAAe,EAA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GAAG,CAAC;YACjB,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;SACpB,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAChD,OAAO;YACH,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;YACjB,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;YACjB,IAAI,GAAG,CAAC;YACR,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;SACpB,CAAC;IACN,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { FromSchema } from "../../schema/index.js";
2
+ export declare const schema: {
3
+ readonly type: "array";
4
+ readonly items: {
5
+ readonly type: "number";
6
+ readonly precision: 1;
7
+ readonly default: number;
8
+ };
9
+ readonly minItems: 2;
10
+ readonly maxItems: 2;
11
+ readonly default: readonly [0, 0];
12
+ };
13
+ export type Type = FromSchema<typeof schema>;
14
+ type Vec2 = Type;
15
+ export declare const layout: import("../../typed-buffer/index.js").StructLayout;
16
+ export declare const abs: ([x, y]: Vec2) => Vec2;
17
+ export declare const ceil: ([x, y]: Vec2) => Vec2;
18
+ export declare const floor: ([x, y]: Vec2) => Vec2;
19
+ export declare const round: ([x, y]: Vec2) => Vec2;
20
+ export declare const trunc: ([x, y]: Vec2) => Vec2;
21
+ export declare const min: ([x1, y1]: Vec2, [x2, y2]: Vec2) => Vec2;
22
+ export declare const max: ([x1, y1]: Vec2, [x2, y2]: Vec2) => Vec2;
23
+ export declare const clamp: (v: Vec2, minVec: Vec2, maxVec: Vec2) => Vec2;
24
+ export declare const mix: ([x1, y1]: Vec2, [x2, y2]: Vec2, t: number) => Vec2;
25
+ export declare const step: ([edge1, edge2]: Vec2, [x, y]: Vec2) => Vec2;
26
+ export declare const smoothstep: ([e0x, e0y]: Vec2, [e1x, e1y]: Vec2, [x, y]: Vec2) => Vec2;
27
+ export declare const length: ([x, y]: Vec2) => number;
28
+ export declare const distance: (a: Vec2, b: Vec2) => number;
29
+ export declare const dot: ([x1, y1]: Vec2, [x2, y2]: Vec2) => number;
30
+ export declare const normalize: (v: Vec2) => Vec2;
31
+ export declare const faceforward: (n: Vec2, i: Vec2, nref: Vec2) => Vec2;
32
+ export declare const reflect: (i: Vec2, n: Vec2) => Vec2;
33
+ export declare const refract: (i: Vec2, n: Vec2, eta: number) => Vec2;
34
+ export declare const sin: ([x, y]: Vec2) => Vec2;
35
+ export declare const cos: ([x, y]: Vec2) => Vec2;
36
+ export declare const tan: ([x, y]: Vec2) => Vec2;
37
+ export declare const asin: ([x, y]: Vec2) => Vec2;
38
+ export declare const acos: ([x, y]: Vec2) => Vec2;
39
+ export declare const atan: ([x, y]: Vec2) => Vec2;
40
+ export declare const sinh: ([x, y]: Vec2) => Vec2;
41
+ export declare const cosh: ([x, y]: Vec2) => Vec2;
42
+ export declare const tanh: ([x, y]: Vec2) => Vec2;
43
+ export declare const asinh: ([x, y]: Vec2) => Vec2;
44
+ export declare const acosh: ([x, y]: Vec2) => Vec2;
45
+ export declare const atanh: ([x, y]: Vec2) => Vec2;
46
+ export declare const sign: ([x, y]: Vec2) => Vec2;
47
+ export declare const fract: ([x, y]: Vec2) => Vec2;
48
+ export declare const mod: ([x, y]: Vec2, m: number) => Vec2;
49
+ export declare const modf: ([x, y]: Vec2) => {
50
+ fract: Vec2;
51
+ whole: Vec2;
52
+ };
53
+ export declare const pow: ([x1, y1]: Vec2, [x2, y2]: Vec2) => Vec2;
54
+ export declare const exp: ([x, y]: Vec2) => Vec2;
55
+ export declare const exp2: ([x, y]: Vec2) => Vec2;
56
+ export declare const log: ([x, y]: Vec2) => Vec2;
57
+ export declare const log2: ([x, y]: Vec2) => Vec2;
58
+ export declare const sqrt: ([x, y]: Vec2) => Vec2;
59
+ export declare const add: ([x1, y1]: Vec2, [x2, y2]: Vec2) => Vec2;
60
+ export declare const subtract: ([x1, y1]: Vec2, [x2, y2]: Vec2) => Vec2;
61
+ export declare const scale: ([x, y]: Vec2, s: number) => Vec2;
62
+ export declare const negate: ([x, y]: Vec2) => Vec2;
63
+ export {};
@@ -0,0 +1,114 @@
1
+ /*MIT License
2
+
3
+ © Copyright 2025 Adobe. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.*/
22
+ import { F32Schema } from "../../schema/index.js";
23
+ import { getStructLayout } from "../../typed-buffer/index.js";
24
+ export const schema = {
25
+ type: 'array',
26
+ items: F32Schema,
27
+ minItems: 2,
28
+ maxItems: 2,
29
+ default: [0, 0],
30
+ };
31
+ export const layout = getStructLayout(schema);
32
+ // Mathematical Operations
33
+ export const abs = ([x, y]) => [Math.abs(x), Math.abs(y)];
34
+ export const ceil = ([x, y]) => [Math.ceil(x), Math.ceil(y)];
35
+ export const floor = ([x, y]) => [Math.floor(x), Math.floor(y)];
36
+ export const round = ([x, y]) => [Math.round(x), Math.round(y)];
37
+ export const trunc = ([x, y]) => [Math.trunc(x), Math.trunc(y)];
38
+ export const min = ([x1, y1], [x2, y2]) => [Math.min(x1, x2), Math.min(y1, y2)];
39
+ export const max = ([x1, y1], [x2, y2]) => [Math.max(x1, x2), Math.max(y1, y2)];
40
+ export const clamp = (v, minVec, maxVec) => min(max(v, minVec), maxVec);
41
+ export const mix = ([x1, y1], [x2, y2], t) => [
42
+ x1 * (1 - t) + x2 * t,
43
+ y1 * (1 - t) + y2 * t
44
+ ];
45
+ export const step = ([edge1, edge2], [x, y]) => [
46
+ x < edge1 ? 0 : 1,
47
+ y < edge2 ? 0 : 1
48
+ ];
49
+ export const smoothstep = ([e0x, e0y], [e1x, e1y], [x, y]) => {
50
+ const tx = Math.max(0, Math.min(1, (x - e0x) / (e1x - e0x)));
51
+ const ty = Math.max(0, Math.min(1, (y - e0y) / (e1y - e0y)));
52
+ return [tx * tx * (3 - 2 * tx), ty * ty * (3 - 2 * ty)];
53
+ };
54
+ // Geometric Functions
55
+ export const length = ([x, y]) => Math.sqrt(x * x + y * y);
56
+ export const distance = (a, b) => length(subtract(b, a));
57
+ export const dot = ([x1, y1], [x2, y2]) => x1 * x2 + y1 * y2;
58
+ export const normalize = (v) => {
59
+ const len = length(v);
60
+ return len === 0 ? [0, 0] : scale(v, 1 / len);
61
+ };
62
+ export const faceforward = (n, i, nref) => dot(nref, i) < 0 ? n : negate(n);
63
+ export const reflect = (i, n) => {
64
+ const dot2 = dot(n, i) * 2;
65
+ return subtract(i, scale(n, dot2));
66
+ };
67
+ export const refract = (i, n, eta) => {
68
+ const dotProduct = dot(n, i);
69
+ const k = 1.0 - eta * eta * (1.0 - dotProduct * dotProduct);
70
+ if (k < 0.0) {
71
+ return [0, 0];
72
+ }
73
+ const scaleFactor = eta * dotProduct + Math.sqrt(k);
74
+ return subtract(scale(i, eta), scale(n, scaleFactor));
75
+ };
76
+ // Trigonometric Functions
77
+ export const sin = ([x, y]) => [Math.sin(x), Math.sin(y)];
78
+ export const cos = ([x, y]) => [Math.cos(x), Math.cos(y)];
79
+ export const tan = ([x, y]) => [Math.tan(x), Math.tan(y)];
80
+ export const asin = ([x, y]) => [Math.asin(x), Math.asin(y)];
81
+ export const acos = ([x, y]) => [Math.acos(x), Math.acos(y)];
82
+ export const atan = ([x, y]) => [Math.atan(x), Math.atan(y)];
83
+ export const sinh = ([x, y]) => [Math.sinh(x), Math.sinh(y)];
84
+ export const cosh = ([x, y]) => [Math.cosh(x), Math.cosh(y)];
85
+ export const tanh = ([x, y]) => [Math.tanh(x), Math.tanh(y)];
86
+ export const asinh = ([x, y]) => [Math.asinh(x), Math.asinh(y)];
87
+ export const acosh = ([x, y]) => [Math.acosh(x), Math.acosh(y)];
88
+ export const atanh = ([x, y]) => [Math.atanh(x), Math.atanh(y)];
89
+ // Common Functions
90
+ export const sign = ([x, y]) => [Math.sign(x), Math.sign(y)];
91
+ export const fract = ([x, y]) => [x - Math.floor(x), y - Math.floor(y)];
92
+ export const mod = ([x, y], m) => [
93
+ ((x % m) + m) % m,
94
+ ((y % m) + m) % m
95
+ ];
96
+ export const modf = ([x, y]) => ({
97
+ whole: [Math.trunc(x), Math.trunc(y)],
98
+ fract: [x - Math.trunc(x), y - Math.trunc(y)]
99
+ });
100
+ export const pow = ([x1, y1], [x2, y2]) => [
101
+ Math.pow(x1, x2),
102
+ Math.pow(y1, y2)
103
+ ];
104
+ export const exp = ([x, y]) => [Math.exp(x), Math.exp(y)];
105
+ export const exp2 = ([x, y]) => [Math.pow(2, x), Math.pow(2, y)];
106
+ export const log = ([x, y]) => [Math.log(x), Math.log(y)];
107
+ export const log2 = ([x, y]) => [Math.log2(x), Math.log2(y)];
108
+ export const sqrt = ([x, y]) => [Math.sqrt(x), Math.sqrt(y)];
109
+ // Helper functions needed by some of the above
110
+ export const add = ([x1, y1], [x2, y2]) => [x1 + x2, y1 + y2];
111
+ export const subtract = ([x1, y1], [x2, y2]) => [x1 - x2, y1 - y2];
112
+ export const scale = ([x, y], s) => [x * s, y * s];
113
+ export const negate = ([x, y]) => [-x, -y];
114
+ //# sourceMappingURL=vec2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vec2.js","sourceRoot":"","sources":["../../../src/math/vec2/vec2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,SAAS,EAAsB,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CACQ,CAAC;AAI5B,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;AAE9C,0BAA0B;AAC1B,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAO,EAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAO,EAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,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C,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAO,EAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzE,+CAA+C;AAC/C,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAO,EAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AAChF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAO,EAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACrF,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAO,EAAE,CAAS,EAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAO,EAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { FromSchema } from "../../schema/index.js";
2
+ export declare const schema: {
3
+ readonly type: "array";
4
+ readonly items: {
5
+ readonly type: "number";
6
+ readonly precision: 1;
7
+ readonly default: number;
8
+ };
9
+ readonly minItems: 3;
10
+ readonly maxItems: 3;
11
+ readonly default: readonly [0, 0, 0];
12
+ };
13
+ export type Type = FromSchema<typeof schema>;
14
+ type Vec3 = Type;
15
+ export declare const layout: import("../../typed-buffer/index.js").StructLayout;
16
+ export declare const abs: ([x, y, z]: Vec3) => Vec3;
17
+ export declare const ceil: ([x, y, z]: Vec3) => Vec3;
18
+ export declare const floor: ([x, y, z]: Vec3) => Vec3;
19
+ export declare const round: ([x, y, z]: Vec3) => Vec3;
20
+ export declare const trunc: ([x, y, z]: Vec3) => Vec3;
21
+ export declare const min: ([x1, y1, z1]: Vec3, [x2, y2, z2]: Vec3) => Vec3;
22
+ export declare const max: ([x1, y1, z1]: Vec3, [x2, y2, z2]: Vec3) => Vec3;
23
+ export declare const clamp: (v: Vec3, minVec: Vec3, maxVec: Vec3) => Vec3;
24
+ export declare const mix: ([x1, y1, z1]: Vec3, [x2, y2, z2]: Vec3, t: number) => Vec3;
25
+ export declare const step: ([edge1, edge2, edge3]: Vec3, [x, y, z]: Vec3) => Vec3;
26
+ export declare const smoothstep: ([e0x, e0y, e0z]: Vec3, [e1x, e1y, e1z]: Vec3, [x, y, z]: Vec3) => Vec3;
27
+ export declare const length: ([x, y, z]: Vec3) => number;
28
+ export declare const distance: (a: Vec3, b: Vec3) => number;
29
+ export declare const distanceSquared: (a: Vec3, b: Vec3) => number;
30
+ export declare const dot: ([x1, y1, z1]: Vec3, [x2, y2, z2]: Vec3) => number;
31
+ export declare const cross: ([x1, y1, z1]: Vec3, [x2, y2, z2]: Vec3) => Vec3;
32
+ export declare const normalize: (v: Vec3) => Vec3;
33
+ export declare const faceforward: (n: Vec3, i: Vec3, nref: Vec3) => Vec3;
34
+ export declare const reflect: (i: Vec3, n: Vec3) => Vec3;
35
+ export declare const refract: (i: Vec3, n: Vec3, eta: number) => Vec3;
36
+ export declare const sin: ([x, y, z]: Vec3) => Vec3;
37
+ export declare const cos: ([x, y, z]: Vec3) => Vec3;
38
+ export declare const tan: ([x, y, z]: Vec3) => Vec3;
39
+ export declare const asin: ([x, y, z]: Vec3) => Vec3;
40
+ export declare const acos: ([x, y, z]: Vec3) => Vec3;
41
+ export declare const atan: ([x, y, z]: Vec3) => Vec3;
42
+ export declare const sinh: ([x, y, z]: Vec3) => Vec3;
43
+ export declare const cosh: ([x, y, z]: Vec3) => Vec3;
44
+ export declare const tanh: ([x, y, z]: Vec3) => Vec3;
45
+ export declare const asinh: ([x, y, z]: Vec3) => Vec3;
46
+ export declare const acosh: ([x, y, z]: Vec3) => Vec3;
47
+ export declare const atanh: ([x, y, z]: Vec3) => Vec3;
48
+ export declare const sign: ([x, y, z]: Vec3) => Vec3;
49
+ export declare const fract: ([x, y, z]: Vec3) => Vec3;
50
+ export declare const mod: ([x, y, z]: Vec3, m: number) => Vec3;
51
+ export declare const modf: ([x, y, z]: Vec3) => {
52
+ fract: Vec3;
53
+ whole: Vec3;
54
+ };
55
+ export declare const pow: ([x1, y1, z1]: Vec3, [x2, y2, z2]: Vec3) => Vec3;
56
+ export declare const exp: ([x, y, z]: Vec3) => Vec3;
57
+ export declare const exp2: ([x, y, z]: Vec3) => Vec3;
58
+ export declare const log: ([x, y, z]: Vec3) => Vec3;
59
+ export declare const log2: ([x, y, z]: Vec3) => Vec3;
60
+ export declare const sqrt: ([x, y, z]: Vec3) => Vec3;
61
+ export declare const add: ([x1, y1, z1]: Vec3, [x2, y2, z2]: Vec3) => Vec3;
62
+ export declare const subtract: ([x1, y1, z1]: Vec3, [x2, y2, z2]: Vec3) => Vec3;
63
+ export declare const scale: ([x, y, z]: Vec3, s: number) => Vec3;
64
+ export declare const negate: ([x, y, z]: Vec3) => Vec3;
65
+ export {};
@@ -0,0 +1,154 @@
1
+ /*MIT License
2
+
3
+ © Copyright 2025 Adobe. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.*/
22
+ import { F32Schema } from "../../schema/index.js";
23
+ import { getStructLayout } from "../../typed-buffer/index.js";
24
+ export const schema = {
25
+ type: 'array',
26
+ items: F32Schema,
27
+ minItems: 3,
28
+ maxItems: 3,
29
+ default: [0, 0, 0],
30
+ };
31
+ export const layout = getStructLayout(schema);
32
+ // Mathematical Operations
33
+ export const abs = ([x, y, z]) => [Math.abs(x), Math.abs(y), Math.abs(z)];
34
+ export const ceil = ([x, y, z]) => [Math.ceil(x), Math.ceil(y), Math.ceil(z)];
35
+ export const floor = ([x, y, z]) => [Math.floor(x), Math.floor(y), Math.floor(z)];
36
+ export const round = ([x, y, z]) => [Math.round(x), Math.round(y), Math.round(z)];
37
+ export const trunc = ([x, y, z]) => [Math.trunc(x), Math.trunc(y), Math.trunc(z)];
38
+ export const min = ([x1, y1, z1], [x2, y2, z2]) => [
39
+ Math.min(x1, x2),
40
+ Math.min(y1, y2),
41
+ Math.min(z1, z2)
42
+ ];
43
+ export const max = ([x1, y1, z1], [x2, y2, z2]) => [
44
+ Math.max(x1, x2),
45
+ Math.max(y1, y2),
46
+ Math.max(z1, z2)
47
+ ];
48
+ export const clamp = (v, minVec, maxVec) => min(max(v, minVec), maxVec);
49
+ export const mix = ([x1, y1, z1], [x2, y2, z2], t) => [
50
+ x1 * (1 - t) + x2 * t,
51
+ y1 * (1 - t) + y2 * t,
52
+ z1 * (1 - t) + z2 * t
53
+ ];
54
+ export const step = ([edge1, edge2, edge3], [x, y, z]) => [
55
+ x < edge1 ? 0 : 1,
56
+ y < edge2 ? 0 : 1,
57
+ z < edge3 ? 0 : 1
58
+ ];
59
+ export const smoothstep = ([e0x, e0y, e0z], [e1x, e1y, e1z], [x, y, z]) => {
60
+ const tx = Math.max(0, Math.min(1, (x - e0x) / (e1x - e0x)));
61
+ const ty = Math.max(0, Math.min(1, (y - e0y) / (e1y - e0y)));
62
+ const tz = Math.max(0, Math.min(1, (z - e0z) / (e1z - e0z)));
63
+ return [
64
+ tx * tx * (3 - 2 * tx),
65
+ ty * ty * (3 - 2 * ty),
66
+ tz * tz * (3 - 2 * tz)
67
+ ];
68
+ };
69
+ // Geometric Functions
70
+ export const length = ([x, y, z]) => Math.sqrt(x * x + y * y + z * z);
71
+ export const distance = (a, b) => length(subtract(b, a));
72
+ export const distanceSquared = (a, b) => {
73
+ const dx = b[0] - a[0];
74
+ const dy = b[1] - a[1];
75
+ const dz = b[2] - a[2];
76
+ return dx * dx + dy * dy + dz * dz;
77
+ };
78
+ export const dot = ([x1, y1, z1], [x2, y2, z2]) => x1 * x2 + y1 * y2 + z1 * z2;
79
+ export const cross = ([x1, y1, z1], [x2, y2, z2]) => [
80
+ y1 * z2 - z1 * y2,
81
+ z1 * x2 - x1 * z2,
82
+ x1 * y2 - y1 * x2
83
+ ];
84
+ export const normalize = (v) => {
85
+ const len = length(v);
86
+ return len === 0 ? [0, 0, 0] : scale(v, 1 / len);
87
+ };
88
+ export const faceforward = (n, i, nref) => dot(nref, i) < 0 ? n : negate(n);
89
+ export const reflect = (i, n) => {
90
+ const dot2 = dot(n, i) * 2;
91
+ return subtract(i, scale(n, dot2));
92
+ };
93
+ export const refract = (i, n, eta) => {
94
+ const dotProduct = dot(n, i);
95
+ const k = 1.0 - eta * eta * (1.0 - dotProduct * dotProduct);
96
+ if (k < 0.0) {
97
+ return [0, 0, 0];
98
+ }
99
+ const scaleFactor = eta * dotProduct + Math.sqrt(k);
100
+ return subtract(scale(i, eta), scale(n, scaleFactor));
101
+ };
102
+ // Trigonometric Functions
103
+ export const sin = ([x, y, z]) => [Math.sin(x), Math.sin(y), Math.sin(z)];
104
+ export const cos = ([x, y, z]) => [Math.cos(x), Math.cos(y), Math.cos(z)];
105
+ export const tan = ([x, y, z]) => [Math.tan(x), Math.tan(y), Math.tan(z)];
106
+ export const asin = ([x, y, z]) => [Math.asin(x), Math.asin(y), Math.asin(z)];
107
+ export const acos = ([x, y, z]) => [Math.acos(x), Math.acos(y), Math.acos(z)];
108
+ export const atan = ([x, y, z]) => [Math.atan(x), Math.atan(y), Math.atan(z)];
109
+ export const sinh = ([x, y, z]) => [Math.sinh(x), Math.sinh(y), Math.sinh(z)];
110
+ export const cosh = ([x, y, z]) => [Math.cosh(x), Math.cosh(y), Math.cosh(z)];
111
+ export const tanh = ([x, y, z]) => [Math.tanh(x), Math.tanh(y), Math.tanh(z)];
112
+ export const asinh = ([x, y, z]) => [Math.asinh(x), Math.asinh(y), Math.asinh(z)];
113
+ export const acosh = ([x, y, z]) => [Math.acosh(x), Math.acosh(y), Math.acosh(z)];
114
+ export const atanh = ([x, y, z]) => [Math.atanh(x), Math.atanh(y), Math.atanh(z)];
115
+ // Common Functions
116
+ export const sign = ([x, y, z]) => [Math.sign(x), Math.sign(y), Math.sign(z)];
117
+ export const fract = ([x, y, z]) => [
118
+ x - Math.floor(x),
119
+ y - Math.floor(y),
120
+ z - Math.floor(z)
121
+ ];
122
+ export const mod = ([x, y, z], m) => [
123
+ ((x % m) + m) % m,
124
+ ((y % m) + m) % m,
125
+ ((z % m) + m) % m
126
+ ];
127
+ export const modf = ([x, y, z]) => ({
128
+ whole: [Math.trunc(x), Math.trunc(y), Math.trunc(z)],
129
+ fract: [x - Math.trunc(x), y - Math.trunc(y), z - Math.trunc(z)]
130
+ });
131
+ export const pow = ([x1, y1, z1], [x2, y2, z2]) => [
132
+ Math.pow(x1, x2),
133
+ Math.pow(y1, y2),
134
+ Math.pow(z1, z2)
135
+ ];
136
+ export const exp = ([x, y, z]) => [Math.exp(x), Math.exp(y), Math.exp(z)];
137
+ export const exp2 = ([x, y, z]) => [Math.pow(2, x), Math.pow(2, y), Math.pow(2, z)];
138
+ export const log = ([x, y, z]) => [Math.log(x), Math.log(y), Math.log(z)];
139
+ export const log2 = ([x, y, z]) => [Math.log2(x), Math.log2(y), Math.log2(z)];
140
+ export const sqrt = ([x, y, z]) => [Math.sqrt(x), Math.sqrt(y), Math.sqrt(z)];
141
+ // Helper functions needed by some of the above
142
+ export const add = ([x1, y1, z1], [x2, y2, z2]) => [
143
+ x1 + x2,
144
+ y1 + y2,
145
+ z1 + z2
146
+ ];
147
+ export const subtract = ([x1, y1, z1], [x2, y2, z2]) => [
148
+ x1 - x2,
149
+ y1 - y2,
150
+ z1 - z2
151
+ ];
152
+ export const scale = ([x, y, z], s) => [x * s, y * s, z * s];
153
+ export const negate = ([x, y, z]) => [-x, -y, -z];
154
+ //# sourceMappingURL=vec3.js.map