@supersoniks/concorde 4.9.98-visual-stack.0 → 4.9.98-visual-stack.2

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 (476) hide show
  1. package/.gitlab-ci.yml +0 -13
  2. package/build-infos.json +1 -1
  3. package/concorde-3d.bundle.js +201 -152
  4. package/concorde-3d.es.js +14688 -13906
  5. package/concorde-core.bundle.js +557 -622
  6. package/concorde-core.es.js +6025 -5575
  7. package/concorde-hugging-face-infer.bundle.js +1 -1
  8. package/concorde-hugging-face-infer.es.js +1 -1
  9. package/concorde-interactive.bundle.js +1162 -0
  10. package/concorde-interactive.es.js +10723 -0
  11. package/concorde-shader.bundle.js +31 -20
  12. package/concorde-shader.es.js +2773 -2547
  13. package/concorde-webgpu.bundle.js +43 -32
  14. package/concorde-webgpu.es.js +1819 -1553
  15. package/dist/concorde-3d.bundle.js +201 -152
  16. package/dist/concorde-3d.es.js +14688 -13906
  17. package/dist/concorde-core.bundle.js +557 -622
  18. package/dist/concorde-core.es.js +6025 -5575
  19. package/dist/concorde-hugging-face-infer.bundle.js +1 -1
  20. package/dist/concorde-hugging-face-infer.es.js +1 -1
  21. package/dist/concorde-interactive.bundle.js +1162 -0
  22. package/dist/concorde-interactive.es.js +10723 -0
  23. package/dist/concorde-shader.bundle.js +31 -20
  24. package/dist/concorde-shader.es.js +2773 -2547
  25. package/dist/concorde-webgpu.bundle.js +43 -32
  26. package/dist/concorde-webgpu.es.js +1819 -1553
  27. package/dist/docs-mock-api-sw.js +5 -1
  28. package/dist/docs-mock-api-sw.js.map +2 -2
  29. package/dist/js/addons/interactive.js +6 -0
  30. package/dist/js/addons/interactive.js.map +1 -0
  31. package/dist/js/core/components/functional/3d/3d.js +90 -2
  32. package/dist/js/core/components/functional/3d/3d.js.map +1 -1
  33. package/dist/js/core/components/functional/3d/constants.js +1 -0
  34. package/dist/js/core/components/functional/3d/constants.js.map +1 -1
  35. package/dist/js/core/components/functional/3d/ensure.js +6 -3
  36. package/dist/js/core/components/functional/3d/ensure.js.map +1 -1
  37. package/dist/js/core/components/functional/3d/form-params.js +2 -0
  38. package/dist/js/core/components/functional/3d/form-params.js.map +1 -1
  39. package/dist/js/core/components/functional/3d/life.js +2 -1
  40. package/dist/js/core/components/functional/3d/life.js.map +1 -1
  41. package/dist/js/core/components/functional/3d/out-publish.js +3 -2
  42. package/dist/js/core/components/functional/3d/out-publish.js.map +1 -1
  43. package/dist/js/core/components/functional/3d/playback.js +6 -1
  44. package/dist/js/core/components/functional/3d/playback.js.map +1 -1
  45. package/dist/js/core/components/functional/3d/post-bind.js +207 -0
  46. package/dist/js/core/components/functional/3d/post-bind.js.map +1 -0
  47. package/dist/js/core/components/functional/3d/post-channels.js +39 -0
  48. package/dist/js/core/components/functional/3d/post-channels.js.map +1 -0
  49. package/dist/js/core/components/functional/3d/post-fx.js +495 -0
  50. package/dist/js/core/components/functional/3d/post-fx.js.map +1 -0
  51. package/dist/js/core/components/functional/3d/props.js +142 -0
  52. package/dist/js/core/components/functional/3d/props.js.map +1 -1
  53. package/dist/js/core/components/functional/3d/reload.js +2 -0
  54. package/dist/js/core/components/functional/3d/reload.js.map +1 -1
  55. package/dist/js/core/components/functional/3d/runtime.js +80 -3
  56. package/dist/js/core/components/functional/3d/runtime.js.map +1 -1
  57. package/dist/js/core/components/functional/3d/scene-runtime.js +1 -1
  58. package/dist/js/core/components/functional/3d/scene-runtime.js.map +1 -1
  59. package/dist/js/core/components/functional/3d/tune.js +21 -0
  60. package/dist/js/core/components/functional/3d/tune.js.map +1 -1
  61. package/dist/js/core/components/functional/3d/updated.js +13 -1
  62. package/dist/js/core/components/functional/3d/updated.js.map +1 -1
  63. package/dist/js/core/components/functional/if/if.js +65 -7
  64. package/dist/js/core/components/functional/if/if.js.map +1 -1
  65. package/dist/js/core/components/functional/interactive/action.js +96 -0
  66. package/dist/js/core/components/functional/interactive/action.js.map +1 -0
  67. package/dist/js/core/components/functional/interactive/gamepad.js +206 -0
  68. package/dist/js/core/components/functional/interactive/gamepad.js.map +1 -0
  69. package/dist/js/core/components/functional/interactive/gesture.js +148 -0
  70. package/dist/js/core/components/functional/interactive/gesture.js.map +1 -0
  71. package/dist/js/core/components/functional/interactive/helpers.js +82 -0
  72. package/dist/js/core/components/functional/interactive/helpers.js.map +1 -0
  73. package/dist/js/core/components/functional/interactive/index.js +20 -0
  74. package/dist/js/core/components/functional/interactive/index.js.map +1 -0
  75. package/dist/js/core/components/functional/interactive/keyboard.js +183 -0
  76. package/dist/js/core/components/functional/interactive/keyboard.js.map +1 -0
  77. package/dist/js/core/components/functional/interactive/matrix.js +201 -0
  78. package/dist/js/core/components/functional/interactive/matrix.js.map +1 -0
  79. package/dist/js/core/components/functional/interactive/registry.js +28 -0
  80. package/dist/js/core/components/functional/interactive/registry.js.map +1 -0
  81. package/dist/js/core/components/functional/interactive/store.js +264 -0
  82. package/dist/js/core/components/functional/interactive/store.js.map +1 -0
  83. package/dist/js/core/components/functional/interactive/ticker.js +182 -0
  84. package/dist/js/core/components/functional/interactive/ticker.js.map +1 -0
  85. package/dist/js/core/components/functional/shader/gl-runtime.js +128 -14
  86. package/dist/js/core/components/functional/shader/gl-runtime.js.map +1 -1
  87. package/dist/js/core/components/functional/shader/shader.js +154 -57
  88. package/dist/js/core/components/functional/shader/shader.js.map +1 -1
  89. package/dist/js/core/components/functional/shader/shadertoy-prelude.js +39 -5
  90. package/dist/js/core/components/functional/shader/shadertoy-prelude.js.map +1 -1
  91. package/dist/js/core/components/functional/shader/types.js +58 -7
  92. package/dist/js/core/components/functional/shader/types.js.map +1 -1
  93. package/dist/js/core/components/functional/value/value.js +49 -4
  94. package/dist/js/core/components/functional/value/value.js.map +1 -1
  95. package/dist/js/core/components/functional/webgpu/gl-fallback.js +27 -6
  96. package/dist/js/core/components/functional/webgpu/gl-fallback.js.map +1 -1
  97. package/dist/js/core/components/functional/webgpu/gpu-runtime.js +115 -13
  98. package/dist/js/core/components/functional/webgpu/gpu-runtime.js.map +1 -1
  99. package/dist/js/core/components/functional/webgpu/helpers.js +8 -2
  100. package/dist/js/core/components/functional/webgpu/helpers.js.map +1 -1
  101. package/dist/js/core/components/functional/webgpu/webgpu.js +34 -1
  102. package/dist/js/core/components/functional/webgpu/webgpu.js.map +1 -1
  103. package/dist/js/core/components/ui/_css/rounded.js +34 -0
  104. package/dist/js/core/components/ui/_css/rounded.js.map +1 -0
  105. package/dist/js/core/components/ui/_css/type.js +44 -0
  106. package/dist/js/core/components/ui/_css/type.js.map +1 -1
  107. package/dist/js/core/components/ui/_i18n/ui-aria-labels.js +95 -0
  108. package/dist/js/core/components/ui/_i18n/ui-aria-labels.js.map +1 -0
  109. package/dist/js/core/components/ui/alert/alert.js +72 -87
  110. package/dist/js/core/components/ui/alert/alert.js.map +1 -1
  111. package/dist/js/core/components/ui/alert-messages/alert-messages.js +1 -0
  112. package/dist/js/core/components/ui/alert-messages/alert-messages.js.map +1 -1
  113. package/dist/js/core/components/ui/badge/badge.js +29 -80
  114. package/dist/js/core/components/ui/badge/badge.js.map +1 -1
  115. package/dist/js/core/components/ui/button/button.js +8 -7
  116. package/dist/js/core/components/ui/button/button.js.map +1 -1
  117. package/dist/js/core/components/ui/card/card-header.js +7 -2
  118. package/dist/js/core/components/ui/card/card-header.js.map +1 -1
  119. package/dist/js/core/components/ui/divider/divider.js +1 -1
  120. package/dist/js/core/components/ui/divider/divider.js.map +1 -1
  121. package/dist/js/core/components/ui/form/checkbox/checkbox.js +4 -20
  122. package/dist/js/core/components/ui/form/checkbox/checkbox.js.map +1 -1
  123. package/dist/js/core/components/ui/form/fieldset/legend-description.js +1 -1
  124. package/dist/js/core/components/ui/form/fieldset/legend.js +1 -1
  125. package/dist/js/core/components/ui/form/input/input.js +12 -15
  126. package/dist/js/core/components/ui/form/input/input.js.map +1 -1
  127. package/dist/js/core/components/ui/form/input-autocomplete/input-autocomplete.js +363 -158
  128. package/dist/js/core/components/ui/form/input-autocomplete/input-autocomplete.js.map +1 -1
  129. package/dist/js/core/components/ui/form/radio/radio.js +1 -1
  130. package/dist/js/core/components/ui/form/select/select.js +3 -6
  131. package/dist/js/core/components/ui/form/select/select.js.map +1 -1
  132. package/dist/js/core/components/ui/form/textarea/textarea.js +1 -2
  133. package/dist/js/core/components/ui/form/textarea/textarea.js.map +1 -1
  134. package/dist/js/core/components/ui/image/image.js +9 -37
  135. package/dist/js/core/components/ui/image/image.js.map +1 -1
  136. package/dist/js/core/components/ui/link/link.js +25 -26
  137. package/dist/js/core/components/ui/link/link.js.map +1 -1
  138. package/dist/js/core/components/ui/modal/modal-close.js +3 -12
  139. package/dist/js/core/components/ui/modal/modal-close.js.map +1 -1
  140. package/dist/js/core/components/ui/modal/modal.js +18 -18
  141. package/dist/js/core/components/ui/modal/modal.js.map +1 -1
  142. package/dist/js/core/components/ui/pop/pop.js +131 -112
  143. package/dist/js/core/components/ui/pop/pop.js.map +1 -1
  144. package/dist/js/core/components/ui/table/table.js.map +1 -1
  145. package/dist/js/core/components/ui/theme/theme.js +1 -1
  146. package/dist/js/core/components/ui/toast/dismissed.js +9 -0
  147. package/dist/js/core/components/ui/toast/dismissed.js.map +1 -0
  148. package/dist/js/core/components/ui/toast/render-content.js +14 -0
  149. package/dist/js/core/components/ui/toast/render-content.js.map +1 -0
  150. package/dist/js/core/components/ui/toast/toast-item.js +150 -96
  151. package/dist/js/core/components/ui/toast/toast-item.js.map +1 -1
  152. package/dist/js/core/components/ui/toast/toast.js +41 -13
  153. package/dist/js/core/components/ui/toast/toast.js.map +1 -1
  154. package/dist/js/core/components/ui/tooltip/tooltip.js +144 -143
  155. package/dist/js/core/components/ui/tooltip/tooltip.js.map +1 -1
  156. package/dist/js/core/decorators/subscriber/ancestorAttribute.js.map +1 -1
  157. package/dist/js/core/decorators/subscriber/derive.js +3 -1
  158. package/dist/js/core/decorators/subscriber/derive.js.map +1 -1
  159. package/dist/js/core/mixins/Fetcher.js.map +1 -1
  160. package/dist/js/core/mixins/FormCheckable.js +1 -8
  161. package/dist/js/core/mixins/FormCheckable.js.map +1 -1
  162. package/dist/js/core/mixins/FormElement.js +26 -53
  163. package/dist/js/core/mixins/FormElement.js.map +1 -1
  164. package/dist/js/core/utils/AncestorAttributeObserver.js +130 -55
  165. package/dist/js/core/utils/AncestorAttributeObserver.js.map +1 -1
  166. package/dist/js/core/utils/LocationHandler.js +1 -1
  167. package/dist/js/core/utils/LocationHandler.js.map +1 -1
  168. package/dist/js/core/utils/dismissed.js +23 -0
  169. package/dist/js/core/utils/dismissed.js.map +1 -0
  170. package/dist/js/core/utils/mediaRef.js +37 -0
  171. package/dist/js/core/utils/mediaRef.js.map +1 -1
  172. package/dist/js/core/utils/positioning.js +110 -0
  173. package/dist/js/core/utils/positioning.js.map +1 -0
  174. package/dist/js/directives.js +1 -2
  175. package/dist/js/directives.js.map +1 -1
  176. package/dist/types/addons/interactive.d.ts +6 -0
  177. package/dist/types/addons/interactive.d.ts.map +1 -0
  178. package/dist/types/core/components/functional/3d/3d.d.ts +26 -3
  179. package/dist/types/core/components/functional/3d/3d.d.ts.map +1 -1
  180. package/dist/types/core/components/functional/3d/constants.d.ts +1 -1
  181. package/dist/types/core/components/functional/3d/constants.d.ts.map +1 -1
  182. package/dist/types/core/components/functional/3d/ensure.d.ts +3 -0
  183. package/dist/types/core/components/functional/3d/ensure.d.ts.map +1 -1
  184. package/dist/types/core/components/functional/3d/form-params.d.ts.map +1 -1
  185. package/dist/types/core/components/functional/3d/life.d.ts +2 -0
  186. package/dist/types/core/components/functional/3d/life.d.ts.map +1 -1
  187. package/dist/types/core/components/functional/3d/out-publish.d.ts +1 -0
  188. package/dist/types/core/components/functional/3d/out-publish.d.ts.map +1 -1
  189. package/dist/types/core/components/functional/3d/playback.d.ts +9 -0
  190. package/dist/types/core/components/functional/3d/playback.d.ts.map +1 -1
  191. package/dist/types/core/components/functional/3d/post-bind.d.ts +52 -0
  192. package/dist/types/core/components/functional/3d/post-bind.d.ts.map +1 -0
  193. package/dist/types/core/components/functional/3d/post-channels.d.ts +40 -0
  194. package/dist/types/core/components/functional/3d/post-channels.d.ts.map +1 -0
  195. package/dist/types/core/components/functional/3d/post-fx.d.ts +73 -0
  196. package/dist/types/core/components/functional/3d/post-fx.d.ts.map +1 -0
  197. package/dist/types/core/components/functional/3d/props.d.ts +42 -0
  198. package/dist/types/core/components/functional/3d/props.d.ts.map +1 -1
  199. package/dist/types/core/components/functional/3d/reload.d.ts.map +1 -1
  200. package/dist/types/core/components/functional/3d/runtime.d.ts +16 -1
  201. package/dist/types/core/components/functional/3d/runtime.d.ts.map +1 -1
  202. package/dist/types/core/components/functional/3d/scene-runtime.d.ts +1 -1
  203. package/dist/types/core/components/functional/3d/scene-runtime.d.ts.map +1 -1
  204. package/dist/types/core/components/functional/3d/tune.d.ts +5 -0
  205. package/dist/types/core/components/functional/3d/tune.d.ts.map +1 -1
  206. package/dist/types/core/components/functional/3d/types.d.ts +9 -0
  207. package/dist/types/core/components/functional/3d/types.d.ts.map +1 -1
  208. package/dist/types/core/components/functional/3d/updated.d.ts.map +1 -1
  209. package/dist/types/core/components/functional/if/if.d.ts +14 -5
  210. package/dist/types/core/components/functional/if/if.d.ts.map +1 -1
  211. package/dist/types/core/components/functional/interactive/action.d.ts +22 -0
  212. package/dist/types/core/components/functional/interactive/action.d.ts.map +1 -0
  213. package/dist/types/core/components/functional/interactive/gamepad.d.ts +37 -0
  214. package/dist/types/core/components/functional/interactive/gamepad.d.ts.map +1 -0
  215. package/dist/types/core/components/functional/interactive/gesture.d.ts +26 -0
  216. package/dist/types/core/components/functional/interactive/gesture.d.ts.map +1 -0
  217. package/dist/types/core/components/functional/interactive/helpers.d.ts +23 -0
  218. package/dist/types/core/components/functional/interactive/helpers.d.ts.map +1 -0
  219. package/dist/types/core/components/functional/interactive/index.d.ts +20 -0
  220. package/dist/types/core/components/functional/interactive/index.d.ts.map +1 -0
  221. package/dist/types/core/components/functional/interactive/keyboard.d.ts +37 -0
  222. package/dist/types/core/components/functional/interactive/keyboard.d.ts.map +1 -0
  223. package/dist/types/core/components/functional/interactive/matrix.d.ts +31 -0
  224. package/dist/types/core/components/functional/interactive/matrix.d.ts.map +1 -0
  225. package/dist/types/core/components/functional/interactive/registry.d.ts +23 -0
  226. package/dist/types/core/components/functional/interactive/registry.d.ts.map +1 -0
  227. package/dist/types/core/components/functional/interactive/store.d.ts +46 -0
  228. package/dist/types/core/components/functional/interactive/store.d.ts.map +1 -0
  229. package/dist/types/core/components/functional/interactive/ticker.d.ts +33 -0
  230. package/dist/types/core/components/functional/interactive/ticker.d.ts.map +1 -0
  231. package/dist/types/core/components/functional/shader/gl-runtime.d.ts +33 -1
  232. package/dist/types/core/components/functional/shader/gl-runtime.d.ts.map +1 -1
  233. package/dist/types/core/components/functional/shader/shader.d.ts +28 -7
  234. package/dist/types/core/components/functional/shader/shader.d.ts.map +1 -1
  235. package/dist/types/core/components/functional/shader/shadertoy-prelude.d.ts +16 -2
  236. package/dist/types/core/components/functional/shader/shadertoy-prelude.d.ts.map +1 -1
  237. package/dist/types/core/components/functional/shader/types.d.ts +29 -5
  238. package/dist/types/core/components/functional/shader/types.d.ts.map +1 -1
  239. package/dist/types/core/components/functional/value/value.d.ts +6 -0
  240. package/dist/types/core/components/functional/value/value.d.ts.map +1 -1
  241. package/dist/types/core/components/functional/webgpu/gl-fallback.d.ts +4 -0
  242. package/dist/types/core/components/functional/webgpu/gl-fallback.d.ts.map +1 -1
  243. package/dist/types/core/components/functional/webgpu/gpu-runtime.d.ts +14 -0
  244. package/dist/types/core/components/functional/webgpu/gpu-runtime.d.ts.map +1 -1
  245. package/dist/types/core/components/functional/webgpu/helpers.d.ts +1 -0
  246. package/dist/types/core/components/functional/webgpu/helpers.d.ts.map +1 -1
  247. package/dist/types/core/components/functional/webgpu/webgpu.d.ts +7 -1
  248. package/dist/types/core/components/functional/webgpu/webgpu.d.ts.map +1 -1
  249. package/dist/types/core/components/ui/_css/rounded.d.ts +3 -0
  250. package/dist/types/core/components/ui/_css/rounded.d.ts.map +1 -0
  251. package/dist/types/core/components/ui/_css/type.d.ts +13 -0
  252. package/dist/types/core/components/ui/_css/type.d.ts.map +1 -1
  253. package/dist/types/core/components/ui/_i18n/ui-aria-labels.d.ts +83 -0
  254. package/dist/types/core/components/ui/_i18n/ui-aria-labels.d.ts.map +1 -0
  255. package/dist/types/core/components/ui/alert/alert.d.ts +14 -12
  256. package/dist/types/core/components/ui/alert/alert.d.ts.map +1 -1
  257. package/dist/types/core/components/ui/alert-messages/alert-messages.d.ts.map +1 -1
  258. package/dist/types/core/components/ui/badge/badge.d.ts +1 -1
  259. package/dist/types/core/components/ui/badge/badge.d.ts.map +1 -1
  260. package/dist/types/core/components/ui/button/button.d.ts +13 -29
  261. package/dist/types/core/components/ui/button/button.d.ts.map +1 -1
  262. package/dist/types/core/components/ui/card/card-header.d.ts.map +1 -1
  263. package/dist/types/core/components/ui/divider/divider.d.ts +2 -1
  264. package/dist/types/core/components/ui/divider/divider.d.ts.map +1 -1
  265. package/dist/types/core/components/ui/form/checkbox/checkbox.d.ts +25 -73
  266. package/dist/types/core/components/ui/form/checkbox/checkbox.d.ts.map +1 -1
  267. package/dist/types/core/components/ui/form/input/input.d.ts +14 -29
  268. package/dist/types/core/components/ui/form/input/input.d.ts.map +1 -1
  269. package/dist/types/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +63 -65
  270. package/dist/types/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts.map +1 -1
  271. package/dist/types/core/components/ui/form/radio/radio.d.ts +1 -1
  272. package/dist/types/core/components/ui/form/select/select.d.ts +3 -5
  273. package/dist/types/core/components/ui/form/select/select.d.ts.map +1 -1
  274. package/dist/types/core/components/ui/form/textarea/textarea.d.ts +12 -28
  275. package/dist/types/core/components/ui/form/textarea/textarea.d.ts.map +1 -1
  276. package/dist/types/core/components/ui/image/image.d.ts +2 -1
  277. package/dist/types/core/components/ui/image/image.d.ts.map +1 -1
  278. package/dist/types/core/components/ui/link/link.d.ts +10 -9
  279. package/dist/types/core/components/ui/link/link.d.ts.map +1 -1
  280. package/dist/types/core/components/ui/modal/modal-close.d.ts +2 -2
  281. package/dist/types/core/components/ui/modal/modal-close.d.ts.map +1 -1
  282. package/dist/types/core/components/ui/pop/pop.d.ts +12 -4
  283. package/dist/types/core/components/ui/pop/pop.d.ts.map +1 -1
  284. package/dist/types/core/components/ui/table/table.d.ts +2 -1
  285. package/dist/types/core/components/ui/table/table.d.ts.map +1 -1
  286. package/dist/types/core/components/ui/toast/dismissed.d.ts +3 -0
  287. package/dist/types/core/components/ui/toast/dismissed.d.ts.map +1 -0
  288. package/dist/types/core/components/ui/toast/render-content.d.ts +7 -0
  289. package/dist/types/core/components/ui/toast/render-content.d.ts.map +1 -0
  290. package/dist/types/core/components/ui/toast/toast-item.d.ts +26 -9
  291. package/dist/types/core/components/ui/toast/toast-item.d.ts.map +1 -1
  292. package/dist/types/core/components/ui/toast/toast.d.ts +6 -3
  293. package/dist/types/core/components/ui/toast/toast.d.ts.map +1 -1
  294. package/dist/types/core/components/ui/toast/types.d.ts +12 -2
  295. package/dist/types/core/components/ui/toast/types.d.ts.map +1 -1
  296. package/dist/types/core/components/ui/tooltip/tooltip.d.ts +19 -11
  297. package/dist/types/core/components/ui/tooltip/tooltip.d.ts.map +1 -1
  298. package/dist/types/core/decorators/subscriber/ancestorAttribute.d.ts +3 -4
  299. package/dist/types/core/decorators/subscriber/ancestorAttribute.d.ts.map +1 -1
  300. package/dist/types/core/decorators/subscriber/derive.d.ts.map +1 -1
  301. package/dist/types/core/mixins/FormCheckable.d.ts +10 -27
  302. package/dist/types/core/mixins/FormCheckable.d.ts.map +1 -1
  303. package/dist/types/core/mixins/FormElement.d.ts +21 -10
  304. package/dist/types/core/mixins/FormElement.d.ts.map +1 -1
  305. package/dist/types/core/mixins/FormInput.d.ts +11 -27
  306. package/dist/types/core/mixins/FormInput.d.ts.map +1 -1
  307. package/dist/types/core/utils/AncestorAttributeObserver.d.ts +17 -9
  308. package/dist/types/core/utils/AncestorAttributeObserver.d.ts.map +1 -1
  309. package/dist/types/core/utils/LocationHandler.d.ts +3 -2
  310. package/dist/types/core/utils/LocationHandler.d.ts.map +1 -1
  311. package/dist/types/core/utils/dismissed.d.ts +3 -0
  312. package/dist/types/core/utils/dismissed.d.ts.map +1 -0
  313. package/dist/types/core/utils/mediaRef.d.ts +15 -0
  314. package/dist/types/core/utils/mediaRef.d.ts.map +1 -1
  315. package/dist/types/core/utils/positioning.d.ts +44 -0
  316. package/dist/types/core/utils/positioning.d.ts.map +1 -0
  317. package/dist/types/directives.d.ts +1 -3
  318. package/dist/types/directives.d.ts.map +1 -1
  319. package/dist/types/mixins.d.ts +22 -55
  320. package/dist/types/mixins.d.ts.map +1 -1
  321. package/docs/assets/{index-FmK4JaIM.js → index-D8MVWqY6.js} +946 -687
  322. package/docs/assets/index-DiD0qYvE.css +1 -0
  323. package/docs/crawl/core/components/ui/form/input-autocomplete/input-autocomplete.html +17 -85
  324. package/docs/crawl/docs/_misc/formelement-subscriber-removal.html +1 -1
  325. package/docs/crawl/hubs/form-components.html +13 -11
  326. package/docs/docs-mock-api-sw.js +5 -1
  327. package/docs/docs-mock-api-sw.js.map +2 -2
  328. package/docs/index.html +2 -2
  329. package/docs/llms-full.txt +12 -38
  330. package/docs/llms.txt +1 -1
  331. package/docs/src/core/components/functional/sdui/sdui.md +0 -0
  332. package/docs/src/core/components/ui/form/checkbox/checkbox.md +0 -0
  333. package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +14 -118
  334. package/docs/src/docs/_getting-started/create-a-component.md +0 -0
  335. package/docs/src/docs/_misc/formelement-subscriber-removal.md +1 -1
  336. package/docs/src/docs/search/docs-search.json +195 -200
  337. package/docs/src/tsconfig.json +324 -0
  338. package/gitlab/job_tests.sh +25 -12
  339. package/index.html +3 -3
  340. package/package.json +217 -9
  341. package/public/docs-mock-api-sw.js +5 -1
  342. package/public/docs-mock-api-sw.js.map +2 -2
  343. package/scripts/build-addons.mjs +2 -2
  344. package/scripts/post-build.mjs +9 -0
  345. package/src/addons/interactive.ts +5 -0
  346. package/src/core/components/functional/3d/3d.md +34 -1
  347. package/src/core/components/functional/3d/3d.spec.ts +42 -0
  348. package/src/core/components/functional/3d/3d.ts +101 -3
  349. package/src/core/components/functional/3d/constants.ts +1 -0
  350. package/src/core/components/functional/3d/ensure.ts +11 -3
  351. package/src/core/components/functional/3d/form-params.ts +2 -0
  352. package/src/core/components/functional/3d/life.ts +4 -1
  353. package/src/core/components/functional/3d/out-publish.ts +4 -3
  354. package/src/core/components/functional/3d/playback.ts +13 -1
  355. package/src/core/components/functional/3d/post-bind.ts +262 -0
  356. package/src/core/components/functional/3d/post-channels.spec.ts +36 -0
  357. package/src/core/components/functional/3d/post-channels.ts +69 -0
  358. package/src/core/components/functional/3d/post-fx.ts +594 -0
  359. package/src/core/components/functional/3d/props.ts +45 -0
  360. package/src/core/components/functional/3d/reload.ts +2 -0
  361. package/src/core/components/functional/3d/runtime.ts +93 -4
  362. package/src/core/components/functional/3d/scene-runtime.ts +3 -0
  363. package/src/core/components/functional/3d/tune.ts +21 -0
  364. package/src/core/components/functional/3d/types.ts +9 -0
  365. package/src/core/components/functional/3d/updated.ts +17 -1
  366. package/src/core/components/functional/if/if.ts +54 -7
  367. package/src/core/components/functional/interactive/action.ts +84 -0
  368. package/src/core/components/functional/interactive/gamepad.ts +197 -0
  369. package/src/core/components/functional/interactive/gesture.ts +136 -0
  370. package/src/core/components/functional/interactive/helpers.spec.ts +50 -0
  371. package/src/core/components/functional/interactive/helpers.ts +97 -0
  372. package/src/core/components/functional/interactive/index.ts +25 -0
  373. package/src/core/components/functional/interactive/interactive.md +33 -0
  374. package/src/core/components/functional/interactive/keyboard.ts +171 -0
  375. package/src/core/components/functional/interactive/matrix.ts +185 -0
  376. package/src/core/components/functional/interactive/registry.ts +46 -0
  377. package/src/core/components/functional/interactive/store.ts +264 -0
  378. package/src/core/components/functional/interactive/ticker.ts +171 -0
  379. package/src/core/components/functional/list/list.ts +0 -0
  380. package/src/core/components/functional/shader/gl-runtime.ts +169 -12
  381. package/src/core/components/functional/shader/shader.md +27 -4
  382. package/src/core/components/functional/shader/shader.spec.ts +267 -0
  383. package/src/core/components/functional/shader/shader.ts +177 -55
  384. package/src/core/components/functional/shader/shadertoy-prelude.ts +49 -5
  385. package/src/core/components/functional/shader/types.ts +89 -12
  386. package/src/core/components/functional/subscriber/subscriber.ts +0 -0
  387. package/src/core/components/functional/value/value.ts +44 -4
  388. package/src/core/components/functional/webgpu/gl-fallback.ts +28 -4
  389. package/src/core/components/functional/webgpu/gpu-runtime.ts +154 -18
  390. package/src/core/components/functional/webgpu/helpers.ts +8 -2
  391. package/src/core/components/functional/webgpu/webgpu.md +13 -2
  392. package/src/core/components/functional/webgpu/webgpu.spec.ts +37 -0
  393. package/src/core/components/functional/webgpu/webgpu.ts +39 -1
  394. package/src/core/components/ui/_css/rounded.ts +36 -0
  395. package/src/core/components/ui/_css/type.ts +49 -0
  396. package/src/core/components/ui/_i18n/ui-aria-labels.ts +104 -0
  397. package/src/core/components/ui/alert/alert.md +128 -72
  398. package/src/core/components/ui/alert/alert.spec.ts +145 -0
  399. package/src/core/components/ui/alert/alert.ts +86 -91
  400. package/src/core/components/ui/alert-messages/alert-messages.ts +1 -1
  401. package/src/core/components/ui/badge/badge.md +126 -78
  402. package/src/core/components/ui/badge/badge.ts +29 -81
  403. package/src/core/components/ui/button/button.md +1 -0
  404. package/src/core/components/ui/button/button.ts +12 -10
  405. package/src/core/components/ui/card/card-header.ts +7 -2
  406. package/src/core/components/ui/card/card.md +120 -65
  407. package/src/core/components/ui/divider/divider.ts +4 -9
  408. package/src/core/components/ui/form/checkbox/checkbox.md +1 -1
  409. package/src/core/components/ui/form/checkbox/checkbox.ts +4 -20
  410. package/src/core/components/ui/form/fieldset/legend-description.ts +1 -1
  411. package/src/core/components/ui/form/fieldset/legend.ts +1 -1
  412. package/src/core/components/ui/form/input/input.md +1 -1
  413. package/src/core/components/ui/form/input/input.ts +25 -27
  414. package/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +14 -118
  415. package/src/core/components/ui/form/input-autocomplete/input-autocomplete.ts +419 -187
  416. package/src/core/components/ui/form/radio/radio.ts +1 -1
  417. package/src/core/components/ui/form/select/select.ts +3 -6
  418. package/src/core/components/ui/form/textarea/textarea.md +1 -1
  419. package/src/core/components/ui/form/textarea/textarea.ts +1 -2
  420. package/src/core/components/ui/image/image.md +147 -53
  421. package/src/core/components/ui/image/image.ts +10 -44
  422. package/src/core/components/ui/link/link.md +2 -2
  423. package/src/core/components/ui/link/link.ts +42 -37
  424. package/src/core/components/ui/modal/modal-close.ts +8 -12
  425. package/src/core/components/ui/modal/modal.ts +18 -18
  426. package/src/core/components/ui/pop/pop.md +105 -1
  427. package/src/core/components/ui/pop/pop.ts +145 -141
  428. package/src/core/components/ui/table/table.ts +2 -8
  429. package/src/core/components/ui/theme/theme.ts +1 -1
  430. package/src/core/components/ui/toast/dismissed.ts +14 -0
  431. package/src/core/components/ui/toast/render-content.ts +13 -0
  432. package/src/core/components/ui/toast/toast-item.ts +179 -103
  433. package/src/core/components/ui/toast/toast.ts +58 -21
  434. package/src/core/components/ui/toast/types.ts +14 -2
  435. package/src/core/components/ui/tooltip/tooltip.ts +176 -154
  436. package/src/core/decorators/subscriber/ancestorAttribute.spec.ts +26 -0
  437. package/src/core/decorators/subscriber/ancestorAttribute.ts +3 -4
  438. package/src/core/decorators/subscriber/derive.ts +3 -3
  439. package/src/core/mixins/Fetcher.ts +1 -1
  440. package/src/core/mixins/FormCheckable.ts +1 -8
  441. package/src/core/mixins/FormElement.ts +74 -76
  442. package/src/core/mixins/Subscriber.ts +0 -0
  443. package/src/core/utils/AncestorAttributeObserver.ts +183 -70
  444. package/src/core/utils/DataBindObserver.ts +0 -0
  445. package/src/core/utils/LocationHandler.ts +12 -5
  446. package/src/core/utils/Objects.ts +0 -0
  447. package/src/core/utils/dismissed.ts +22 -0
  448. package/src/core/utils/mediaRef.spec.ts +25 -0
  449. package/src/core/utils/mediaRef.ts +45 -0
  450. package/src/core/utils/positioning.spec.ts +208 -0
  451. package/src/core/utils/positioning.ts +183 -0
  452. package/src/directives.ts +1 -3
  453. package/src/docs/_core-concept/dataFlow.md +1 -1
  454. package/src/docs/_decorators/ancestor-attribute.md +3 -2
  455. package/src/docs/_getting-started/concorde-outside.md +3 -3
  456. package/src/docs/_misc/formelement-subscriber-removal.md +115 -0
  457. package/src/docs/_misc/html-integration.md +2 -0
  458. package/src/docs/_misc/visual-stack.md +19 -1
  459. package/src/docs/code.ts +3 -1
  460. package/src/docs/components/docs-demo-sources.ts +88 -0
  461. package/src/docs/docs.ts +3 -0
  462. package/src/docs/example/docs-3d-post-depth-demo.ts +68 -0
  463. package/src/docs/example/docs-3d-webgpu-live-demo.ts +83 -0
  464. package/src/docs/example/docs-harris-webgpu-demo.ts +53 -55
  465. package/src/docs/example/docs-input-autocomplete-demos.ts +110 -0
  466. package/src/docs/mock-api/router.ts +17 -1
  467. package/src/docs/navigation/navigation.ts +4 -0
  468. package/src/docs/search/docs-search.json +922 -1762
  469. package/src/docs/tailwind/css/tailwind.css +13 -6
  470. package/src/tsconfig.json +162 -6
  471. package/src/tsconfig.tsbuildinfo +1 -1
  472. package/tailwind.config.js +50 -3
  473. package/vite/config.js +23 -35
  474. package/vite.config.mts +5 -0
  475. package/vitest.setup.ts +49 -13
  476. package/docs/assets/index-BZiZXMU-.css +0 -1
@@ -0,0 +1,185 @@
1
+ import { LitElement, css, html } from "lit";
2
+ import { customElement, property, query } from "lit/decorators.js";
3
+ import { Subscriber } from "@supersoniks/concorde/mixins";
4
+
5
+ const tagName = "sonic-matrix";
6
+
7
+ type Palette = Record<string, string>;
8
+
9
+ function pathGet(obj: unknown, path: string): unknown {
10
+ if (!path) return obj;
11
+ let cur: any = obj;
12
+ for (const p of path.split(".").filter(Boolean)) {
13
+ if (cur == null) return undefined;
14
+ cur = cur[p];
15
+ }
16
+ return cur;
17
+ }
18
+
19
+ /**
20
+ * Rendu canvas d’une grille 2D (number[][] ou flat + cols) depuis dataProvider.
21
+ */
22
+ @customElement(tagName)
23
+ export class SonicMatrix extends Subscriber(LitElement) {
24
+ static styles = css`
25
+ :host {
26
+ display: block;
27
+ width: 100%;
28
+ max-width: 100%;
29
+ line-height: 0;
30
+ }
31
+ canvas {
32
+ display: block;
33
+ width: 100%;
34
+ height: auto;
35
+ image-rendering: pixelated;
36
+ }
37
+ `;
38
+
39
+ /** Clé vers la matrice dans le DP. */
40
+ @property({ type: String })
41
+ key = "grid";
42
+
43
+ @property({ type: Number })
44
+ cols = 0;
45
+
46
+ @property({ type: Object })
47
+ palette: Palette = {
48
+ "0": "transparent",
49
+ "1": "#00f0f0",
50
+ "2": "#0000f0",
51
+ "3": "#f0a000",
52
+ "4": "#f0f000",
53
+ "5": "#00f000",
54
+ "6": "#a000f0",
55
+ "7": "#f00000",
56
+ };
57
+
58
+ /** Taille cellule px, ou `auto`. */
59
+ @property({ type: String })
60
+ cell = "24";
61
+
62
+ @property({ type: Number })
63
+ gap = 1;
64
+
65
+ @property({ type: Number })
66
+ radius = 2;
67
+
68
+ /** Clé couche fantôme optionnelle. */
69
+ @property({ type: String, attribute: "ghost-key" })
70
+ ghostKey = "";
71
+
72
+ @property({ type: String, attribute: "label-key" })
73
+ labelKey = "";
74
+
75
+ @query("canvas") private canvas!: HTMLCanvasElement;
76
+
77
+ private lastSig = "";
78
+
79
+ connectedCallback(): void {
80
+ super.connectedCallback();
81
+ this.setAttribute("role", "img");
82
+ }
83
+
84
+ protected updated(): void {
85
+ this.draw();
86
+ }
87
+
88
+ private readGrid(): number[][] {
89
+ const props = this.props as Record<string, unknown> | undefined;
90
+ const raw = props ? pathGet(props, this.key) : undefined;
91
+ if (Array.isArray(raw) && Array.isArray(raw[0])) {
92
+ return raw as number[][];
93
+ }
94
+ if (Array.isArray(raw) && this.cols > 0) {
95
+ const flat = raw as number[];
96
+ const out: number[][] = [];
97
+ for (let i = 0; i < flat.length; i += this.cols) {
98
+ out.push(flat.slice(i, i + this.cols).map((n) => Number(n) || 0));
99
+ }
100
+ return out;
101
+ }
102
+ return [];
103
+ }
104
+
105
+ private readGhost(): number[][] | null {
106
+ if (!this.ghostKey) return null;
107
+ const props = this.props as Record<string, unknown> | undefined;
108
+ const raw = props ? pathGet(props, this.ghostKey) : undefined;
109
+ if (Array.isArray(raw) && Array.isArray(raw[0])) return raw as number[][];
110
+ return null;
111
+ }
112
+
113
+ private colorFor(v: number, ghost = false): string {
114
+ const c = this.palette?.[String(v)] ?? this.palette?.[v] ?? "#888";
115
+ if (!ghost) return c;
116
+ if (c === "transparent") return c;
117
+ return c.startsWith("var(") ? c : `${c}66`;
118
+ }
119
+
120
+ private draw(): void {
121
+ const grid = this.readGrid();
122
+ const ghost = this.readGhost();
123
+ const h = grid.length;
124
+ const w = h ? grid[0].length : 0;
125
+ if (!w || !h || !this.canvas) return;
126
+
127
+ const sig = JSON.stringify({ grid, ghost, palette: this.palette, cell: this.cell, gap: this.gap });
128
+ if (sig === this.lastSig) return;
129
+ this.lastSig = sig;
130
+
131
+ const hostW = this.clientWidth || w * 24;
132
+ const cellPx =
133
+ this.cell === "auto" ? Math.max(1, Math.floor(hostW / w)) : Math.max(1, Number(this.cell) || 24);
134
+ const gap = Math.max(0, this.gap);
135
+ const dpr = Math.min(2, window.devicePixelRatio || 1);
136
+ const cssW = w * cellPx;
137
+ const cssH = h * cellPx;
138
+ this.canvas.width = Math.floor(cssW * dpr);
139
+ this.canvas.height = Math.floor(cssH * dpr);
140
+ this.canvas.style.width = `${cssW}px`;
141
+ this.canvas.style.height = `${cssH}px`;
142
+ const ctx = this.canvas.getContext("2d");
143
+ if (!ctx) return;
144
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
145
+ ctx.clearRect(0, 0, cssW, cssH);
146
+
147
+ const paint = (mat: number[][], ghostLayer: boolean) => {
148
+ for (let y = 0; y < mat.length; y++) {
149
+ const row = mat[y];
150
+ for (let x = 0; x < row.length; x++) {
151
+ const v = Number(row[x]) || 0;
152
+ if (!v && !ghostLayer) continue;
153
+ if (!v) continue;
154
+ ctx.fillStyle = this.colorFor(v, ghostLayer);
155
+ const px = x * cellPx + gap;
156
+ const py = y * cellPx + gap;
157
+ const s = cellPx - gap * 2;
158
+ if (this.radius > 0) {
159
+ const r = Math.min(this.radius, s / 2);
160
+ ctx.beginPath();
161
+ ctx.roundRect(px, py, s, s, r);
162
+ ctx.fill();
163
+ } else {
164
+ ctx.fillRect(px, py, s, s);
165
+ }
166
+ }
167
+ }
168
+ };
169
+
170
+ if (ghost) paint(ghost, true);
171
+ paint(grid, false);
172
+
173
+ if (this.labelKey) {
174
+ const props = this.props as Record<string, unknown> | undefined;
175
+ const label = props ? pathGet(props, this.labelKey) : undefined;
176
+ if (label != null) this.setAttribute("aria-label", String(label));
177
+ }
178
+ }
179
+
180
+ render() {
181
+ return html`<canvas></canvas>`;
182
+ }
183
+ }
184
+
185
+ export default SonicMatrix;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Registre global des sonic-store + dispatch typé.
3
+ * Utilisé par keyboard / gamepad / gesture / action / ticker.
4
+ */
5
+
6
+ export type SonicActionMessage = {
7
+ type: string;
8
+ payload?: unknown;
9
+ t?: number;
10
+ dt?: number;
11
+ };
12
+
13
+ export type StoreHandle = {
14
+ id: string;
15
+ dispatch: (action: SonicActionMessage) => void;
16
+ getState: () => unknown;
17
+ reset: () => void;
18
+ };
19
+
20
+ const stores = new Map<string, StoreHandle>();
21
+
22
+ export function registerStore(handle: StoreHandle): void {
23
+ stores.set(handle.id, handle);
24
+ }
25
+
26
+ export function unregisterStore(id: string): void {
27
+ stores.delete(id);
28
+ }
29
+
30
+ export function getStore(id: string): StoreHandle | undefined {
31
+ return stores.get(id);
32
+ }
33
+
34
+ /** Dispatch une action vers un store enregistré. No-op si absent. */
35
+ export function dispatch(storeId: string, action: SonicActionMessage): void {
36
+ const store = stores.get(storeId);
37
+ if (!store) return;
38
+ store.dispatch({
39
+ ...action,
40
+ t: action.t ?? performance.now(),
41
+ });
42
+ }
43
+
44
+ export function listStoreIds(): string[] {
45
+ return [...stores.keys()];
46
+ }
@@ -0,0 +1,264 @@
1
+ import { LitElement, css, html } from "lit";
2
+ import { customElement, property } from "lit/decorators.js";
3
+ import jsonata from "jsonata";
4
+ import { set } from "@supersoniks/concorde/core/utils/PublisherProxy";
5
+ import { registerInteractiveHelpers } from "./helpers";
6
+ import {
7
+ dispatch as registryDispatch,
8
+ registerStore,
9
+ unregisterStore,
10
+ type SonicActionMessage,
11
+ type StoreHandle,
12
+ } from "./registry";
13
+
14
+ const tagName = "sonic-store";
15
+
16
+ const DEFAULT_MAX_STATE_BYTES = 256 * 1024;
17
+ const DEFAULT_BUDGET_MS = 8;
18
+
19
+ type HistoryEntry = unknown;
20
+
21
+ /**
22
+ * Store déclaratif : state' = reducer($state, $action, $env) via JSONata.
23
+ * Opt-in : `@supersoniks/concorde/interactive`.
24
+ */
25
+ @customElement(tagName)
26
+ export class SonicStore extends LitElement {
27
+ static styles = css`
28
+ :host {
29
+ display: contents;
30
+ }
31
+ `;
32
+
33
+ /** Identifiant du store (obligatoire pour dispatch). */
34
+ @property({ type: String })
35
+ id = "";
36
+
37
+ /** DataProvider où publier l’état (défaut = id). */
38
+ @property({ type: String })
39
+ dataProvider = "";
40
+
41
+ /** État initial (JSON attribut / objet). */
42
+ @property({ type: Object })
43
+ initial: unknown = null;
44
+
45
+ /** Expression JSONata du reducer. */
46
+ @property({ type: String })
47
+ reducer = "";
48
+
49
+ @property({ type: Number, attribute: "max-state-bytes" })
50
+ maxStateBytes = DEFAULT_MAX_STATE_BYTES;
51
+
52
+ @property({ type: Number, attribute: "budget-ms" })
53
+ budgetMs = DEFAULT_BUDGET_MS;
54
+
55
+ /** Taille max de l’historique undo (0 = off). */
56
+ @property({ type: Number })
57
+ history = 0;
58
+
59
+ private state: unknown = null;
60
+ private queue: SonicActionMessage[] = [];
61
+ private draining = false;
62
+ private compiled: ReturnType<typeof jsonata> | null = null;
63
+ private historyStack: HistoryEntry[] = [];
64
+ private lastError: string | null = null;
65
+
66
+ connectedCallback(): void {
67
+ super.connectedCallback();
68
+ this.bootstrap();
69
+ }
70
+
71
+ disconnectedCallback(): void {
72
+ if (this.id) unregisterStore(this.id);
73
+ super.disconnectedCallback();
74
+ }
75
+
76
+ protected updated(changed: Map<string | number | symbol, unknown>): void {
77
+ if (
78
+ changed.has("id") ||
79
+ changed.has("reducer") ||
80
+ changed.has("initial") ||
81
+ changed.has("dataProvider")
82
+ ) {
83
+ const prevId = changed.get("id");
84
+ if (typeof prevId === "string" && prevId && prevId !== this.id) {
85
+ unregisterStore(prevId);
86
+ }
87
+ this.bootstrap();
88
+ }
89
+ }
90
+
91
+ private dpId(): string {
92
+ return (this.dataProvider || this.id || "").trim();
93
+ }
94
+
95
+ private bootstrap(): void {
96
+ if (!this.id) return;
97
+ this.compileReducer();
98
+ this.state = this.clone(this.initial);
99
+ this.historyStack = [];
100
+ this.lastError = null;
101
+ this.publish();
102
+ const handle: StoreHandle = {
103
+ id: this.id,
104
+ dispatch: (action) => this.enqueue(action),
105
+ getState: () => this.state,
106
+ reset: () => this.reset(),
107
+ };
108
+ registerStore(handle);
109
+ }
110
+
111
+ private compileReducer(): void {
112
+ this.compiled = null;
113
+ const src = (this.reducer || "").trim();
114
+ if (!src) return;
115
+ if (src.length > 32_768) {
116
+ this.fail("reducer trop long (max 32 Ko)");
117
+ return;
118
+ }
119
+ try {
120
+ const expr = jsonata(src);
121
+ registerInteractiveHelpers(expr);
122
+ // Désactiver impureté
123
+ expr.assign("random", () => {
124
+ throw new Error("$random interdit dans un reducer (utiliser $rand)");
125
+ });
126
+ expr.assign("now", () => {
127
+ throw new Error("$now interdit dans un reducer (utiliser $action.t)");
128
+ });
129
+ this.compiled = expr;
130
+ } catch (err) {
131
+ this.fail(err instanceof Error ? err.message : String(err));
132
+ }
133
+ }
134
+
135
+ private enqueue(action: SonicActionMessage): void {
136
+ if (action.type === "@reset") {
137
+ this.reset();
138
+ return;
139
+ }
140
+ if (action.type === "@undo") {
141
+ this.undo();
142
+ return;
143
+ }
144
+ this.queue.push(action);
145
+ void this.drain();
146
+ }
147
+
148
+ private async drain(): Promise<void> {
149
+ if (this.draining) return;
150
+ this.draining = true;
151
+ try {
152
+ while (this.queue.length) {
153
+ const action = this.queue.shift()!;
154
+ this.apply(action);
155
+ }
156
+ } finally {
157
+ this.draining = false;
158
+ }
159
+ }
160
+
161
+ private apply(action: SonicActionMessage): void {
162
+ if (!this.compiled) return;
163
+ const started = performance.now();
164
+ const env = {
165
+ width: typeof window !== "undefined" ? window.innerWidth : 0,
166
+ height: typeof window !== "undefined" ? window.innerHeight : 0,
167
+ now: action.t ?? started,
168
+ };
169
+ const bindings = {
170
+ state: this.state,
171
+ action: {
172
+ type: action.type,
173
+ payload: action.payload ?? null,
174
+ t: action.t ?? started,
175
+ dt: action.dt ?? null,
176
+ },
177
+ env,
178
+ };
179
+ try {
180
+ const expr = this.compiled;
181
+ // Bindings → $state, $action, $env (purs ; pas de $random / $now)
182
+ const result = expr.evaluate(this.state, {
183
+ state: this.state,
184
+ action: bindings.action,
185
+ env,
186
+ });
187
+ const elapsed = performance.now() - started;
188
+ if (elapsed > this.budgetMs) {
189
+ this.fail(`budget ${this.budgetMs}ms dépassé (${elapsed.toFixed(1)}ms)`);
190
+ return;
191
+ }
192
+ if (result === undefined) return;
193
+ const encoded = JSON.stringify(result);
194
+ if (encoded !== undefined && encoded.length > this.maxStateBytes) {
195
+ this.fail(`état trop gros (max ${this.maxStateBytes} octets)`);
196
+ return;
197
+ }
198
+ if (this.history > 0) {
199
+ this.historyStack.push(this.clone(this.state));
200
+ if (this.historyStack.length > this.history) this.historyStack.shift();
201
+ }
202
+ this.state = result;
203
+ this.lastError = null;
204
+ this.publish();
205
+ } catch (err) {
206
+ this.fail(err instanceof Error ? err.message : String(err));
207
+ }
208
+ }
209
+
210
+ private reset(): void {
211
+ this.state = this.clone(this.initial);
212
+ this.historyStack = [];
213
+ this.lastError = null;
214
+ this.publish();
215
+ }
216
+
217
+ private undo(): void {
218
+ if (!this.historyStack.length) return;
219
+ this.state = this.historyStack.pop();
220
+ this.publish();
221
+ }
222
+
223
+ private publish(): void {
224
+ const id = this.dpId();
225
+ if (!id) return;
226
+ const payload =
227
+ this.state && typeof this.state === "object"
228
+ ? { ...(this.state as object), lastError: this.lastError }
229
+ : { value: this.state, lastError: this.lastError };
230
+ set(id, payload as never);
231
+ }
232
+
233
+ private fail(message: string): void {
234
+ this.lastError = message;
235
+ this.dispatchEvent(
236
+ new CustomEvent("error", {
237
+ detail: { message },
238
+ bubbles: true,
239
+ composed: true,
240
+ }),
241
+ );
242
+ this.publish();
243
+ }
244
+
245
+ private clone(v: unknown): unknown {
246
+ if (v === null || typeof v !== "object") return v;
247
+ try {
248
+ return JSON.parse(JSON.stringify(v));
249
+ } catch {
250
+ return v;
251
+ }
252
+ }
253
+
254
+ /** API élément : dispatch manuel. */
255
+ dispatchAction(action: SonicActionMessage): void {
256
+ registryDispatch(this.id, action);
257
+ }
258
+
259
+ render() {
260
+ return html``;
261
+ }
262
+ }
263
+
264
+ export default SonicStore;
@@ -0,0 +1,171 @@
1
+ import { LitElement, css, html } from "lit";
2
+ import { customElement, property } from "lit/decorators.js";
3
+ import { get } from "@supersoniks/concorde/core/utils/PublisherProxy";
4
+ import { dispatch, type SonicActionMessage } from "./registry";
5
+
6
+ const tagName = "sonic-ticker";
7
+
8
+ /**
9
+ * Horloge déclarative : émet `tick` avec `dt` vers un store.
10
+ */
11
+ @customElement(tagName)
12
+ export class SonicTicker extends LitElement {
13
+ static styles = css`
14
+ :host {
15
+ display: contents;
16
+ }
17
+ `;
18
+
19
+ @property({ type: String })
20
+ target = "";
21
+
22
+ @property({ type: Number })
23
+ interval = 500;
24
+
25
+ /** Chemin dans le DP du store pour l’intervalle (ex. `speed`). */
26
+ @property({ type: String, attribute: "interval-key" })
27
+ intervalKey = "";
28
+
29
+ /** Chemin booléen pause (ex. `running`). */
30
+ @property({ type: String, attribute: "running-key" })
31
+ runningKey = "";
32
+
33
+ /** `interval` | `raf` */
34
+ @property({ type: String })
35
+ mode: "interval" | "raf" = "interval";
36
+
37
+ @property({ type: Boolean, attribute: "dispatch-event" })
38
+ dispatchEventFlag = false;
39
+
40
+ private timer: number | null = null;
41
+ private raf = 0;
42
+ private last = 0;
43
+ private acc = 0;
44
+
45
+ connectedCallback(): void {
46
+ super.connectedCallback();
47
+ document.addEventListener("visibilitychange", this.onVis);
48
+ this.restart();
49
+ }
50
+
51
+ disconnectedCallback(): void {
52
+ document.removeEventListener("visibilitychange", this.onVis);
53
+ this.stop();
54
+ super.disconnectedCallback();
55
+ }
56
+
57
+ protected updated(changed: Map<string | number | symbol, unknown>): void {
58
+ if (
59
+ changed.has("interval") ||
60
+ changed.has("mode") ||
61
+ changed.has("target") ||
62
+ changed.has("intervalKey") ||
63
+ changed.has("runningKey")
64
+ ) {
65
+ this.restart();
66
+ }
67
+ }
68
+
69
+ private onVis = () => {
70
+ if (document.hidden) this.stop();
71
+ else this.restart();
72
+ };
73
+
74
+ private stop(): void {
75
+ if (this.timer != null) {
76
+ clearInterval(this.timer);
77
+ this.timer = null;
78
+ }
79
+ if (this.raf) {
80
+ cancelAnimationFrame(this.raf);
81
+ this.raf = 0;
82
+ }
83
+ this.acc = 0;
84
+ }
85
+
86
+ private restart(): void {
87
+ this.stop();
88
+ if (!this.target || document.hidden) return;
89
+ this.last = performance.now();
90
+ if (this.mode === "raf") {
91
+ const loop = (now: number) => {
92
+ this.raf = requestAnimationFrame(loop);
93
+ if (!this.isRunning()) {
94
+ this.last = now;
95
+ return;
96
+ }
97
+ const raw = Math.min(100, now - this.last);
98
+ this.last = now;
99
+ this.acc += raw;
100
+ const ms = this.currentInterval();
101
+ while (this.acc >= ms) {
102
+ this.acc -= ms;
103
+ this.emit(ms);
104
+ }
105
+ };
106
+ this.raf = requestAnimationFrame(loop);
107
+ return;
108
+ }
109
+ this.timer = window.setInterval(() => {
110
+ if (!this.isRunning()) return;
111
+ const now = performance.now();
112
+ const dt = Math.min(1000, now - this.last);
113
+ this.last = now;
114
+ this.emit(dt);
115
+ }, this.currentInterval());
116
+ }
117
+
118
+ private currentInterval(): number {
119
+ let ms = this.interval;
120
+ if (this.intervalKey && this.target) {
121
+ try {
122
+ const state = get(this.target) as Record<string, unknown> | undefined;
123
+ const v = this.path(state, this.intervalKey);
124
+ if (typeof v === "number" && Number.isFinite(v)) ms = v;
125
+ } catch {
126
+ /* keep */
127
+ }
128
+ }
129
+ return Math.max(16, ms);
130
+ }
131
+
132
+ private isRunning(): boolean {
133
+ if (!this.runningKey || !this.target) return true;
134
+ try {
135
+ const state = get(this.target) as Record<string, unknown> | undefined;
136
+ return Boolean(this.path(state, this.runningKey));
137
+ } catch {
138
+ return true;
139
+ }
140
+ }
141
+
142
+ private path(obj: unknown, path: string): unknown {
143
+ if (!obj || typeof obj !== "object") return undefined;
144
+ let cur: any = obj;
145
+ for (const p of path.split(".").filter(Boolean)) {
146
+ if (cur == null) return undefined;
147
+ cur = cur[p];
148
+ }
149
+ return cur;
150
+ }
151
+
152
+ private emit(dt: number): void {
153
+ const action: SonicActionMessage = { type: "tick", payload: { dt }, dt };
154
+ if (this.target) dispatch(this.target, action);
155
+ if (this.dispatchEventFlag) {
156
+ this.dispatchEvent(
157
+ new CustomEvent("sonic-action", {
158
+ detail: action,
159
+ bubbles: true,
160
+ composed: true,
161
+ }),
162
+ );
163
+ }
164
+ }
165
+
166
+ render() {
167
+ return html``;
168
+ }
169
+ }
170
+
171
+ export default SonicTicker;
File without changes