@pibbl/core 0.0.2 → 0.0.3-alpha.109.1

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 (549) hide show
  1. package/THIRD_PARTY_NOTICES.txt +81 -0
  2. package/dist/features/physics/2d-testing.d.ts +1 -1
  3. package/dist/features/physics/2d-testing.js +2 -2
  4. package/dist/features/physics/2d-testing.js.map +2 -2
  5. package/dist/features/physics/lib/2d/canvas/components.js +25 -21
  6. package/dist/features/physics/lib/2d/canvas/components.js.map +2 -2
  7. package/dist/features/physics/lib/2d/canvas/presentation.js +1 -2
  8. package/dist/features/physics/lib/2d/canvas/presentation.js.map +2 -2
  9. package/dist/features/physics/lib/2d/collision/casts.js +4 -2
  10. package/dist/features/physics/lib/2d/collision/casts.js.map +2 -2
  11. package/dist/features/physics/lib/2d/runtime/controller.js +1 -1
  12. package/dist/features/physics/lib/2d/runtime/controller.js.map +2 -2
  13. package/dist/features/physics/lib/2d/runtime/obstacles.js +9 -11
  14. package/dist/features/physics/lib/2d/runtime/obstacles.js.map +2 -2
  15. package/dist/features/physics/lib/2d/shapes.js +8 -9
  16. package/dist/features/physics/lib/2d/shapes.js.map +2 -2
  17. package/dist/features/physics/lib/2d/world/rapier.js +22 -26
  18. package/dist/features/physics/lib/2d/world/rapier.js.map +2 -2
  19. package/dist/features/sprites/loader.js +6 -3
  20. package/dist/features/sprites/loader.js.map +2 -2
  21. package/dist/features/textures/index.d.ts +12 -2
  22. package/dist/features/textures/index.js +33 -1
  23. package/dist/features/textures/index.js.map +2 -2
  24. package/dist/features/textures/lib/chemical-field.d.ts +56 -0
  25. package/dist/features/textures/lib/chemical-field.js +154 -0
  26. package/dist/features/textures/lib/chemical-field.js.map +7 -0
  27. package/dist/features/textures/lib/chemical-recipes.d.ts +119 -0
  28. package/dist/features/textures/lib/chemical-recipes.js +275 -0
  29. package/dist/features/textures/lib/chemical-recipes.js.map +7 -0
  30. package/dist/features/textures/lib/definitions.d.ts +3 -18
  31. package/dist/features/textures/lib/definitions.js +17 -24
  32. package/dist/features/textures/lib/definitions.js.map +2 -2
  33. package/dist/features/textures/lib/geometric-patterns.d.ts +149 -0
  34. package/dist/features/textures/lib/geometric-patterns.js +305 -0
  35. package/dist/features/textures/lib/geometric-patterns.js.map +7 -0
  36. package/dist/features/textures/lib/gray-scott.d.ts +55 -0
  37. package/dist/features/textures/lib/gray-scott.js +37 -0
  38. package/dist/features/textures/lib/gray-scott.js.map +7 -0
  39. package/dist/features/textures/lib/palette.js +1 -3
  40. package/dist/features/textures/lib/palette.js.map +2 -2
  41. package/dist/features/textures/lib/patterns.d.ts +123 -0
  42. package/dist/features/textures/lib/patterns.js +344 -0
  43. package/dist/features/textures/lib/patterns.js.map +7 -0
  44. package/dist/features/textures/lib/rain-drops.js +2 -1
  45. package/dist/features/textures/lib/rain-drops.js.map +2 -2
  46. package/dist/features/textures/lib/reaction-diffusion.d.ts +3 -2
  47. package/dist/features/textures/lib/reaction-diffusion.js +9 -20
  48. package/dist/features/textures/lib/reaction-diffusion.js.map +2 -2
  49. package/dist/features/textures/lib/simulation.d.ts +10 -4
  50. package/dist/features/textures/lib/simulation.js +23 -13
  51. package/dist/features/textures/lib/simulation.js.map +2 -2
  52. package/dist/features/textures/lib/wasm/electric.js +8 -1
  53. package/dist/features/textures/lib/wasm/electric.js.map +2 -2
  54. package/dist/features/textures/lib/water-surface.js +1 -3
  55. package/dist/features/textures/lib/water-surface.js.map +2 -2
  56. package/dist/features/viz/index.d.ts +68 -6
  57. package/dist/features/viz/index.js +164 -2
  58. package/dist/features/viz/index.js.map +2 -2
  59. package/dist/features/viz/inspection/bar.d.ts +79 -0
  60. package/dist/features/viz/inspection/bar.js +49 -0
  61. package/dist/features/viz/inspection/bar.js.map +7 -0
  62. package/dist/features/viz/inspection/candle.d.ts +156 -0
  63. package/dist/features/viz/inspection/candle.js +120 -0
  64. package/dist/features/viz/inspection/candle.js.map +7 -0
  65. package/dist/features/viz/inspection/capture-types.d.ts +65 -0
  66. package/dist/features/viz/inspection/capture.d.ts +16 -0
  67. package/dist/features/viz/inspection/capture.js +49 -0
  68. package/dist/features/viz/inspection/capture.js.map +7 -0
  69. package/dist/features/viz/inspection/handler.d.ts +36 -0
  70. package/dist/features/viz/inspection/handler.js +91 -0
  71. package/dist/features/viz/inspection/handler.js.map +7 -0
  72. package/dist/features/viz/inspection/ohlc-bar.d.ts +132 -0
  73. package/dist/features/viz/inspection/ohlc-bar.js +118 -0
  74. package/dist/features/viz/inspection/ohlc-bar.js.map +7 -0
  75. package/dist/features/viz/inspection/owned-ref.d.ts +16 -0
  76. package/dist/features/viz/inspection/owned-ref.js +99 -0
  77. package/dist/features/viz/inspection/owned-ref.js.map +7 -0
  78. package/dist/features/viz/inspection/painted-point.d.ts +22 -0
  79. package/dist/features/viz/inspection/painted-point.js +29 -0
  80. package/dist/features/viz/inspection/painted-point.js.map +7 -0
  81. package/dist/features/viz/inspection/queries.d.ts +100 -0
  82. package/dist/features/viz/inspection/queries.js +192 -0
  83. package/dist/features/viz/inspection/queries.js.map +7 -0
  84. package/dist/features/viz/inspection/query-types.d.ts +177 -0
  85. package/dist/features/viz/inspection/volume.d.ts +104 -0
  86. package/dist/features/viz/inspection/volume.js +95 -0
  87. package/dist/features/viz/inspection/volume.js.map +7 -0
  88. package/dist/features/viz/inspection.d.ts +19 -0
  89. package/dist/features/viz/inspection.js +54 -0
  90. package/dist/features/viz/inspection.js.map +7 -0
  91. package/dist/features/viz/inspection.mjs +1 -0
  92. package/dist/features/viz/lib/area-series.d.ts +62 -0
  93. package/dist/features/viz/lib/area-series.js +120 -0
  94. package/dist/features/viz/lib/area-series.js.map +7 -0
  95. package/dist/features/viz/lib/axis-title.js +2 -1
  96. package/dist/features/viz/lib/axis-title.js.map +2 -2
  97. package/dist/features/viz/lib/axis.js +1 -1
  98. package/dist/features/viz/lib/axis.js.map +2 -2
  99. package/dist/features/viz/lib/bar-series.d.ts +3 -1
  100. package/dist/features/viz/lib/bar-series.js +16 -1
  101. package/dist/features/viz/lib/bar-series.js.map +2 -2
  102. package/dist/features/viz/lib/baseline-series.d.ts +55 -0
  103. package/dist/features/viz/lib/baseline-series.js +136 -0
  104. package/dist/features/viz/lib/baseline-series.js.map +7 -0
  105. package/dist/features/viz/lib/candlestick-series.d.ts +62 -0
  106. package/dist/features/viz/lib/candlestick-series.js +150 -0
  107. package/dist/features/viz/lib/candlestick-series.js.map +7 -0
  108. package/dist/features/viz/lib/censored-point-series.d.ts +71 -0
  109. package/dist/features/viz/lib/censored-point-series.js +129 -0
  110. package/dist/features/viz/lib/censored-point-series.js.map +7 -0
  111. package/dist/features/viz/lib/color-context.d.ts +4 -0
  112. package/dist/features/viz/lib/color-context.js +41 -0
  113. package/dist/features/viz/lib/color-context.js.map +7 -0
  114. package/dist/features/viz/lib/color-math.d.ts +4 -0
  115. package/dist/features/viz/lib/color-math.js +31 -0
  116. package/dist/features/viz/lib/color-math.js.map +7 -0
  117. package/dist/features/viz/lib/color-types.d.ts +53 -0
  118. package/dist/features/viz/lib/curve-definition.d.ts +49 -0
  119. package/dist/features/viz/lib/curve-definition.js +142 -0
  120. package/dist/features/viz/lib/curve-definition.js.map +7 -0
  121. package/dist/features/viz/lib/diverging-color-scale.d.ts +11 -0
  122. package/dist/features/viz/lib/diverging-color-scale.js +51 -0
  123. package/dist/features/viz/lib/diverging-color-scale.js.map +7 -0
  124. package/dist/features/viz/lib/domain-navigation.d.ts +40 -0
  125. package/dist/features/viz/lib/domain-navigation.js +77 -0
  126. package/dist/features/viz/lib/domain-navigation.js.map +7 -0
  127. package/dist/features/viz/lib/editable-chart-elements.d.ts +178 -0
  128. package/dist/features/viz/lib/editable-chart-elements.js +733 -0
  129. package/dist/features/viz/lib/editable-chart-elements.js.map +7 -0
  130. package/dist/features/viz/lib/financial-aggregation.d.ts +127 -0
  131. package/dist/features/viz/lib/financial-aggregation.js +116 -0
  132. package/dist/features/viz/lib/financial-aggregation.js.map +7 -0
  133. package/dist/features/viz/lib/financial-autoscale.d.ts +64 -0
  134. package/dist/features/viz/lib/financial-autoscale.js +61 -0
  135. package/dist/features/viz/lib/financial-autoscale.js.map +7 -0
  136. package/dist/features/viz/lib/financial-comparison.d.ts +62 -0
  137. package/dist/features/viz/lib/financial-comparison.js +98 -0
  138. package/dist/features/viz/lib/financial-comparison.js.map +7 -0
  139. package/dist/features/viz/lib/financial-geometry.d.ts +77 -0
  140. package/dist/features/viz/lib/financial-geometry.js +67 -0
  141. package/dist/features/viz/lib/financial-geometry.js.map +7 -0
  142. package/dist/features/viz/lib/financial-indicators.d.ts +114 -0
  143. package/dist/features/viz/lib/financial-indicators.js +135 -0
  144. package/dist/features/viz/lib/financial-indicators.js.map +7 -0
  145. package/dist/features/viz/lib/financial-oscillators.d.ts +171 -0
  146. package/dist/features/viz/lib/financial-oscillators.js +265 -0
  147. package/dist/features/viz/lib/financial-oscillators.js.map +7 -0
  148. package/dist/features/viz/lib/graph/bipartite.d.ts +14 -0
  149. package/dist/features/viz/lib/graph/bipartite.js +250 -0
  150. package/dist/features/viz/lib/graph/bipartite.js.map +7 -0
  151. package/dist/features/viz/lib/graph/chord.d.ts +44 -0
  152. package/dist/features/viz/lib/graph/chord.js +348 -0
  153. package/dist/features/viz/lib/graph/chord.js.map +7 -0
  154. package/dist/features/viz/lib/graph/dependency.d.ts +26 -0
  155. package/dist/features/viz/lib/graph/dependency.js +140 -0
  156. package/dist/features/viz/lib/graph/dependency.js.map +7 -0
  157. package/dist/features/viz/lib/graph/force.d.ts +28 -0
  158. package/dist/features/viz/lib/graph/force.js +580 -0
  159. package/dist/features/viz/lib/graph/force.js.map +7 -0
  160. package/dist/features/viz/lib/graph/hierarchy.d.ts +21 -0
  161. package/dist/features/viz/lib/graph/hierarchy.js +112 -0
  162. package/dist/features/viz/lib/graph/hierarchy.js.map +7 -0
  163. package/dist/features/viz/lib/graph/icicle.d.ts +16 -0
  164. package/dist/features/viz/lib/graph/icicle.js +153 -0
  165. package/dist/features/viz/lib/graph/icicle.js.map +7 -0
  166. package/dist/features/viz/lib/graph/matrix.d.ts +30 -0
  167. package/dist/features/viz/lib/graph/matrix.js +243 -0
  168. package/dist/features/viz/lib/graph/matrix.js.map +7 -0
  169. package/dist/features/viz/lib/graph/neighborhood.d.ts +11 -0
  170. package/dist/features/viz/lib/graph/neighborhood.js +281 -0
  171. package/dist/features/viz/lib/graph/neighborhood.js.map +7 -0
  172. package/dist/features/viz/lib/graph/routes.d.ts +35 -0
  173. package/dist/features/viz/lib/graph/routes.js +101 -0
  174. package/dist/features/viz/lib/graph/routes.js.map +7 -0
  175. package/dist/features/viz/lib/graph/sankey.d.ts +44 -0
  176. package/dist/features/viz/lib/graph/sankey.js +341 -0
  177. package/dist/features/viz/lib/graph/sankey.js.map +7 -0
  178. package/dist/features/viz/lib/graph/shared.d.ts +59 -0
  179. package/dist/features/viz/lib/graph/shared.js +301 -0
  180. package/dist/features/viz/lib/graph/shared.js.map +7 -0
  181. package/dist/features/viz/lib/graph/tree.d.ts +11 -0
  182. package/dist/features/viz/lib/graph/tree.js +232 -0
  183. package/dist/features/viz/lib/graph/tree.js.map +7 -0
  184. package/dist/features/viz/lib/graph/treemap.d.ts +20 -0
  185. package/dist/features/viz/lib/graph/treemap.js +227 -0
  186. package/dist/features/viz/lib/graph/treemap.js.map +7 -0
  187. package/dist/features/viz/lib/graph/types.d.ts +1097 -0
  188. package/dist/features/viz/lib/hover-card.js +8 -9
  189. package/dist/features/viz/lib/hover-card.js.map +2 -2
  190. package/dist/features/viz/lib/hover-data.d.ts +1 -1
  191. package/dist/features/viz/lib/hover-data.js +5 -2
  192. package/dist/features/viz/lib/hover-data.js.map +2 -2
  193. package/dist/features/viz/lib/interval-band-series.d.ts +49 -0
  194. package/dist/features/viz/lib/interval-band-series.js +136 -0
  195. package/dist/features/viz/lib/interval-band-series.js.map +7 -0
  196. package/dist/features/viz/lib/interval-diamond-series.d.ts +43 -0
  197. package/dist/features/viz/lib/interval-diamond-series.js +122 -0
  198. package/dist/features/viz/lib/interval-diamond-series.js.map +7 -0
  199. package/dist/features/viz/lib/interval-series.d.ts +79 -0
  200. package/dist/features/viz/lib/interval-series.js +158 -0
  201. package/dist/features/viz/lib/interval-series.js.map +7 -0
  202. package/dist/features/viz/lib/layout-pie.js +9 -13
  203. package/dist/features/viz/lib/layout-pie.js.map +2 -2
  204. package/dist/features/viz/lib/line-series.d.ts +1 -1
  205. package/dist/features/viz/lib/line-series.js +47 -28
  206. package/dist/features/viz/lib/line-series.js.map +2 -2
  207. package/dist/features/viz/lib/linear-scale.js +1 -1
  208. package/dist/features/viz/lib/linear-scale.js.map +2 -2
  209. package/dist/features/viz/lib/monotone-curve.d.ts +11 -0
  210. package/dist/features/viz/lib/monotone-curve.js +63 -0
  211. package/dist/features/viz/lib/monotone-curve.js.map +7 -0
  212. package/dist/features/viz/lib/numeric-range-interpolation.d.ts +15 -0
  213. package/dist/features/viz/lib/numeric-range-interpolation.js +36 -0
  214. package/dist/features/viz/lib/numeric-range-interpolation.js.map +7 -0
  215. package/dist/features/viz/lib/ohlc-bar-series.d.ts +55 -0
  216. package/dist/features/viz/lib/ohlc-bar-series.js +168 -0
  217. package/dist/features/viz/lib/ohlc-bar-series.js.map +7 -0
  218. package/dist/features/viz/lib/paired-series.d.ts +44 -0
  219. package/dist/features/viz/lib/paired-series.js +93 -0
  220. package/dist/features/viz/lib/paired-series.js.map +7 -0
  221. package/dist/features/viz/lib/pie-layout.js +2 -1
  222. package/dist/features/viz/lib/pie-layout.js.map +2 -2
  223. package/dist/features/viz/lib/plot-series.js +11 -6
  224. package/dist/features/viz/lib/plot-series.js.map +2 -2
  225. package/dist/features/viz/lib/plot-types.d.ts +4 -3
  226. package/dist/features/viz/lib/point-series.d.ts +1 -1
  227. package/dist/features/viz/lib/point-series.js +36 -9
  228. package/dist/features/viz/lib/point-series.js.map +2 -2
  229. package/dist/features/viz/lib/point-types.d.ts +5 -2
  230. package/dist/features/viz/lib/reference-band.js +4 -1
  231. package/dist/features/viz/lib/reference-band.js.map +2 -2
  232. package/dist/features/viz/lib/scale-context.d.ts +1 -1
  233. package/dist/features/viz/lib/scale-ticks.js +21 -6
  234. package/dist/features/viz/lib/scale-ticks.js.map +2 -2
  235. package/dist/features/viz/lib/sequential-color-scale.d.ts +11 -0
  236. package/dist/features/viz/lib/sequential-color-scale.js +49 -0
  237. package/dist/features/viz/lib/sequential-color-scale.js.map +7 -0
  238. package/dist/features/viz/lib/series-position.d.ts +12 -0
  239. package/dist/features/viz/lib/series-position.js +44 -0
  240. package/dist/features/viz/lib/series-position.js.map +7 -0
  241. package/dist/features/viz/lib/step-curves.d.ts +19 -0
  242. package/dist/features/viz/lib/step-curves.js +53 -0
  243. package/dist/features/viz/lib/step-curves.js.map +7 -0
  244. package/dist/features/viz/lib/threshold-color-scale.d.ts +43 -0
  245. package/dist/features/viz/lib/threshold-color-scale.js +59 -0
  246. package/dist/features/viz/lib/threshold-color-scale.js.map +7 -0
  247. package/dist/features/viz/lib/trading-time-mapping.d.ts +32 -0
  248. package/dist/features/viz/lib/trading-time-mapping.js +89 -0
  249. package/dist/features/viz/lib/trading-time-mapping.js.map +7 -0
  250. package/dist/features/viz/lib/trading-time-scale.d.ts +83 -0
  251. package/dist/features/viz/lib/trading-time-scale.js +96 -0
  252. package/dist/features/viz/lib/trading-time-scale.js.map +7 -0
  253. package/dist/features/viz/lib/trajectory-series.d.ts +71 -0
  254. package/dist/features/viz/lib/trajectory-series.js +111 -0
  255. package/dist/features/viz/lib/trajectory-series.js.map +7 -0
  256. package/dist/features/viz/lib/types.d.ts +20 -4
  257. package/dist/features/viz/lib/use-continuous-scale.js +6 -1
  258. package/dist/features/viz/lib/use-continuous-scale.js.map +2 -2
  259. package/dist/features/viz/lib/utc-scale.js +11 -10
  260. package/dist/features/viz/lib/utc-scale.js.map +2 -2
  261. package/dist/features/viz/lib/volume-series.d.ts +59 -0
  262. package/dist/features/viz/lib/volume-series.js +117 -0
  263. package/dist/features/viz/lib/volume-series.js.map +7 -0
  264. package/dist/features/viz/lib/weighted-point-series.d.ts +71 -0
  265. package/dist/features/viz/lib/weighted-point-series.js +169 -0
  266. package/dist/features/viz/lib/weighted-point-series.js.map +7 -0
  267. package/dist/filters/backdrop-contrast-gpu.d.ts +5 -0
  268. package/dist/filters/backdrop-contrast-gpu.js +33 -0
  269. package/dist/filters/backdrop-contrast-gpu.js.map +7 -0
  270. package/dist/filters/backdrop-contrast.d.ts +21 -0
  271. package/dist/filters/backdrop-contrast.js +61 -0
  272. package/dist/filters/backdrop-contrast.js.map +7 -0
  273. package/dist/filters/displacement.js +1 -1
  274. package/dist/filters/displacement.js.map +2 -2
  275. package/dist/filters/emboss-gpu.d.ts +4 -0
  276. package/dist/filters/emboss-gpu.js +39 -0
  277. package/dist/filters/emboss-gpu.js.map +7 -0
  278. package/dist/filters/emboss.d.ts +32 -0
  279. package/dist/filters/emboss.js +104 -0
  280. package/dist/filters/emboss.js.map +7 -0
  281. package/dist/filters/filter-executor.d.ts +11 -4
  282. package/dist/filters/filter-executor.js +104 -49
  283. package/dist/filters/filter-executor.js.map +2 -2
  284. package/dist/filters/reflected-light.js +1 -1
  285. package/dist/filters/reflected-light.js.map +2 -2
  286. package/dist/filters/reflection-gpu.d.ts +3 -1
  287. package/dist/filters/reflection-gpu.js +5 -2
  288. package/dist/filters/reflection-gpu.js.map +2 -2
  289. package/dist/filters/render-backdrop-contrast-boundary.d.ts +31 -0
  290. package/dist/filters/render-backdrop-contrast-boundary.js +116 -0
  291. package/dist/filters/render-backdrop-contrast-boundary.js.map +7 -0
  292. package/dist/filters/render-emboss-boundary.d.ts +13 -0
  293. package/dist/filters/render-emboss-boundary.js +131 -0
  294. package/dist/filters/render-emboss-boundary.js.map +7 -0
  295. package/dist/filters.d.ts +9 -5
  296. package/dist/filters.js +4 -0
  297. package/dist/filters.js.map +2 -2
  298. package/dist/index.d.ts +9 -5
  299. package/dist/index.js +18 -2
  300. package/dist/index.js.map +2 -2
  301. package/dist/internal.d.ts +4 -0
  302. package/dist/internal.js +6 -0
  303. package/dist/internal.js.map +2 -2
  304. package/dist/layout-kernel.d.ts +12 -0
  305. package/dist/layout-kernel.js +11 -0
  306. package/dist/layout-kernel.js.map +7 -0
  307. package/dist/layout-kernel.mjs +1 -0
  308. package/dist/lib/backend/types.d.ts +13 -1
  309. package/dist/lib/backend/types.js.map +2 -2
  310. package/dist/lib/components/arc-geometry.js +2 -1
  311. package/dist/lib/components/arc-geometry.js.map +2 -2
  312. package/dist/lib/components/g.js +2 -0
  313. package/dist/lib/components/g.js.map +2 -2
  314. package/dist/lib/components/html-box.js +2 -1
  315. package/dist/lib/components/html-box.js.map +2 -2
  316. package/dist/lib/components/img.js +3 -3
  317. package/dist/lib/components/img.js.map +2 -2
  318. package/dist/lib/components/layer.js +98 -16
  319. package/dist/lib/components/layer.js.map +3 -3
  320. package/dist/lib/components/text.d.ts +16 -0
  321. package/dist/lib/components/text.js +131 -24
  322. package/dist/lib/components/text.js.map +2 -2
  323. package/dist/lib/define-primitive.d.ts +4 -2
  324. package/dist/lib/define-primitive.js +3 -1
  325. package/dist/lib/define-primitive.js.map +2 -2
  326. package/dist/lib/element/metadata.d.ts +9 -0
  327. package/dist/lib/element/metadata.js +19 -0
  328. package/dist/lib/element/metadata.js.map +2 -2
  329. package/dist/lib/element/resolve-primitive-inputs.d.ts +2 -0
  330. package/dist/lib/element/resolve-primitive-inputs.js +17 -4
  331. package/dist/lib/element/resolve-primitive-inputs.js.map +2 -2
  332. package/dist/lib/events/event-facade.d.ts +18 -0
  333. package/dist/lib/events/event-facade.js +28 -2
  334. package/dist/lib/events/event-facade.js.map +2 -2
  335. package/dist/lib/events/hit-test.js +2 -1
  336. package/dist/lib/events/hit-test.js.map +2 -2
  337. package/dist/lib/events/propagation.d.ts +2 -1
  338. package/dist/lib/events/propagation.js +22 -16
  339. package/dist/lib/events/propagation.js.map +2 -2
  340. package/dist/lib/events/registrations.d.ts +10 -0
  341. package/dist/lib/events/registrations.js +160 -5
  342. package/dist/lib/events/registrations.js.map +2 -2
  343. package/dist/lib/execute-render.js +25 -1
  344. package/dist/lib/execute-render.js.map +2 -2
  345. package/dist/lib/filter/filter-region.js +3 -10
  346. package/dist/lib/filter/filter-region.js.map +2 -2
  347. package/dist/lib/focus/focus-manager.d.ts +8 -1
  348. package/dist/lib/focus/focus-manager.js +87 -43
  349. package/dist/lib/focus/focus-manager.js.map +2 -2
  350. package/dist/lib/focus/geometry.d.ts +2 -0
  351. package/dist/lib/focus/geometry.js +6 -0
  352. package/dist/lib/focus/geometry.js.map +2 -2
  353. package/dist/lib/geometry/path-bend-guide.js +1 -1
  354. package/dist/lib/geometry/path-bend-guide.js.map +2 -2
  355. package/dist/lib/geometry/path-geometry.js +12 -11
  356. package/dist/lib/geometry/path-geometry.js.map +2 -2
  357. package/dist/lib/geometry/path-transforms.js +17 -21
  358. package/dist/lib/geometry/path-transforms.js.map +2 -2
  359. package/dist/lib/geometry/path-warp-bezier.js +3 -1
  360. package/dist/lib/geometry/path-warp-bezier.js.map +2 -2
  361. package/dist/lib/geometry/path-warp.js +1 -1
  362. package/dist/lib/geometry/path-warp.js.map +2 -2
  363. package/dist/lib/global-state.js +2 -0
  364. package/dist/lib/global-state.js.map +2 -2
  365. package/dist/lib/html/html-events.d.ts +32 -0
  366. package/dist/lib/html/html-events.js +179 -0
  367. package/dist/lib/html/html-events.js.map +7 -0
  368. package/dist/lib/html/html-service.d.ts +8 -2
  369. package/dist/lib/html/html-service.js +198 -65
  370. package/dist/lib/html/html-service.js.map +2 -2
  371. package/dist/lib/html/overlay-config.js +7 -6
  372. package/dist/lib/html/overlay-config.js.map +2 -2
  373. package/dist/lib/html/types.d.ts +29 -2
  374. package/dist/lib/layout/absolute.d.ts +11 -5
  375. package/dist/lib/layout/absolute.js +329 -55
  376. package/dist/lib/layout/absolute.js.map +3 -3
  377. package/dist/lib/layout/allocation-checkpoint-owner.d.ts +11 -0
  378. package/dist/lib/layout/allocation-checkpoint-owner.js +86 -0
  379. package/dist/lib/layout/allocation-checkpoint-owner.js.map +7 -0
  380. package/dist/lib/layout/allocation-checkpoint.d.ts +53 -0
  381. package/dist/lib/layout/allocation-checkpoint.js +463 -0
  382. package/dist/lib/layout/allocation-checkpoint.js.map +7 -0
  383. package/dist/lib/layout/allocation-dependencies.d.ts +30 -0
  384. package/dist/lib/layout/allocation-dependencies.js +90 -0
  385. package/dist/lib/layout/allocation-dependencies.js.map +7 -0
  386. package/dist/lib/layout/allocation-revision.d.ts +13 -0
  387. package/dist/lib/layout/allocation-revision.js +67 -0
  388. package/dist/lib/layout/allocation-revision.js.map +7 -0
  389. package/dist/lib/layout/box-insets.d.ts +17 -0
  390. package/dist/lib/layout/box-insets.js +138 -0
  391. package/dist/lib/layout/box-insets.js.map +7 -0
  392. package/dist/lib/layout/box-sizing.d.ts +16 -0
  393. package/dist/lib/layout/box-sizing.js +77 -0
  394. package/dist/lib/layout/box-sizing.js.map +7 -0
  395. package/dist/lib/layout/box.js +42 -12
  396. package/dist/lib/layout/box.js.map +2 -2
  397. package/dist/lib/layout/canvas-measurement.d.ts +13 -0
  398. package/dist/lib/layout/canvas-measurement.js +57 -0
  399. package/dist/lib/layout/canvas-measurement.js.map +7 -0
  400. package/dist/lib/layout/context.d.ts +35 -6
  401. package/dist/lib/layout/context.js +72 -3
  402. package/dist/lib/layout/context.js.map +2 -2
  403. package/dist/lib/layout/define-layout-component.d.ts +23 -0
  404. package/dist/lib/layout/define-layout-component.js +84 -0
  405. package/dist/lib/layout/define-layout-component.js.map +7 -0
  406. package/dist/lib/layout/flex-allocation-cache.d.ts +42 -0
  407. package/dist/lib/layout/flex-baseline-mode.d.ts +2 -0
  408. package/dist/lib/layout/flex-baseline-mode.js +7 -0
  409. package/dist/lib/layout/flex-baseline-mode.js.map +7 -0
  410. package/dist/lib/layout/flex.d.ts +50 -15
  411. package/dist/lib/layout/flex.js +2124 -195
  412. package/dist/lib/layout/flex.js.map +3 -3
  413. package/dist/lib/layout/flow.js +225 -49
  414. package/dist/lib/layout/flow.js.map +2 -2
  415. package/dist/lib/layout/geometry-publication.d.ts +53 -0
  416. package/dist/lib/layout/geometry-publication.js +244 -0
  417. package/dist/lib/layout/geometry-publication.js.map +7 -0
  418. package/dist/lib/layout/grid-kernel.d.ts +63 -0
  419. package/dist/lib/layout/grid-kernel.js +168 -0
  420. package/dist/lib/layout/grid-kernel.js.map +7 -0
  421. package/dist/lib/layout/grid.d.ts +63 -4
  422. package/dist/lib/layout/grid.js +767 -171
  423. package/dist/lib/layout/grid.js.map +3 -3
  424. package/dist/lib/layout/measure.d.ts +55 -3
  425. package/dist/lib/layout/measure.js +448 -15
  426. package/dist/lib/layout/measure.js.map +2 -2
  427. package/dist/lib/layout/overlay.js +81 -23
  428. package/dist/lib/layout/overlay.js.map +2 -2
  429. package/dist/lib/layout/participation.d.ts +27 -0
  430. package/dist/lib/layout/participation.js +188 -0
  431. package/dist/lib/layout/participation.js.map +7 -0
  432. package/dist/lib/layout/place-child.js +1 -1
  433. package/dist/lib/layout/place-child.js.map +2 -2
  434. package/dist/lib/layout/positioning-diagnostics.d.ts +1 -1
  435. package/dist/lib/layout/positioning-diagnostics.js +13 -2
  436. package/dist/lib/layout/positioning-diagnostics.js.map +2 -2
  437. package/dist/lib/layout/prepared-root.d.ts +121 -0
  438. package/dist/lib/layout/prepared-root.js +360 -0
  439. package/dist/lib/layout/prepared-root.js.map +7 -0
  440. package/dist/lib/layout/standalone-kernel.d.ts +60 -0
  441. package/dist/lib/layout/standalone-kernel.js +722 -0
  442. package/dist/lib/layout/standalone-kernel.js.map +7 -0
  443. package/dist/lib/layout/topology.d.ts +21 -0
  444. package/dist/lib/layout/topology.js +113 -0
  445. package/dist/lib/layout/topology.js.map +7 -0
  446. package/dist/lib/layout/types.d.ts +5 -0
  447. package/dist/lib/layout/wasm/artifact.d.ts +1 -0
  448. package/dist/lib/layout/wasm/artifact.js +5 -0
  449. package/dist/lib/layout/wasm/artifact.js.map +7 -0
  450. package/dist/lib/layout/wasm/bytes.d.ts +1 -0
  451. package/dist/lib/layout/wasm/bytes.js +5 -0
  452. package/dist/lib/layout/wasm/bytes.js.map +7 -0
  453. package/dist/lib/layout/wasm/embedded.d.ts +2 -0
  454. package/dist/lib/layout/wasm/embedded.js +12 -0
  455. package/dist/lib/layout/wasm/embedded.js.map +7 -0
  456. package/dist/lib/layout/wasm/layout.wasm +0 -0
  457. package/dist/lib/layout/wasm/module.d.ts +8 -0
  458. package/dist/lib/layout/wasm/module.js +70 -0
  459. package/dist/lib/layout/wasm/module.js.map +7 -0
  460. package/dist/lib/layout/wasm/region.d.ts +267 -0
  461. package/dist/lib/layout/wasm/region.js +1018 -0
  462. package/dist/lib/layout/wasm/region.js.map +7 -0
  463. package/dist/lib/manipulation/controller.js +4 -7
  464. package/dist/lib/manipulation/controller.js.map +2 -2
  465. package/dist/lib/manipulation/frame.js +1 -1
  466. package/dist/lib/manipulation/frame.js.map +2 -2
  467. package/dist/lib/manipulation/handles.js +32 -33
  468. package/dist/lib/manipulation/handles.js.map +2 -2
  469. package/dist/lib/manipulation/solve.js +12 -10
  470. package/dist/lib/manipulation/solve.js.map +2 -2
  471. package/dist/lib/mount-pibbl.js +1 -0
  472. package/dist/lib/mount-pibbl.js.map +2 -2
  473. package/dist/lib/mount-prepared-pibbl.d.ts +5 -0
  474. package/dist/lib/mount-prepared-pibbl.js +29 -0
  475. package/dist/lib/mount-prepared-pibbl.js.map +7 -0
  476. package/dist/lib/mount-request.d.ts +8 -0
  477. package/dist/lib/mount-request.js +41 -0
  478. package/dist/lib/mount-request.js.map +7 -0
  479. package/dist/lib/pibbl.d.ts +21 -13
  480. package/dist/lib/pibbl.js +18 -16
  481. package/dist/lib/pibbl.js.map +2 -2
  482. package/dist/lib/recording/recording.d.ts +43 -0
  483. package/dist/lib/recording/recording.js +555 -0
  484. package/dist/lib/recording/recording.js.map +7 -0
  485. package/dist/lib/recording/types.d.ts +118 -0
  486. package/dist/lib/recording/wasm-bytes.d.ts +1 -0
  487. package/dist/lib/recording/wasm-bytes.js +5 -0
  488. package/dist/lib/recording/wasm-bytes.js.map +7 -0
  489. package/dist/lib/recording/worker-source.d.ts +1 -0
  490. package/dist/lib/recording/worker-source.js +5 -0
  491. package/dist/lib/recording/worker-source.js.map +7 -0
  492. package/dist/lib/render-layer/controller.d.ts +9 -3
  493. package/dist/lib/render-layer/controller.js +259 -110
  494. package/dist/lib/render-layer/controller.js.map +2 -2
  495. package/dist/lib/render-transaction.d.ts +12 -2
  496. package/dist/lib/render-transaction.js +69 -1
  497. package/dist/lib/render-transaction.js.map +2 -2
  498. package/dist/lib/render.js +32 -8
  499. package/dist/lib/render.js.map +2 -2
  500. package/dist/lib/scheduler/realm-scheduler.d.ts +2 -0
  501. package/dist/lib/scheduler/realm-scheduler.js +55 -26
  502. package/dist/lib/scheduler/realm-scheduler.js.map +2 -2
  503. package/dist/lib/scheduler/renderer-participant.js +1 -0
  504. package/dist/lib/scheduler/renderer-participant.js.map +2 -2
  505. package/dist/lib/series-inspection-frame.d.ts +18 -0
  506. package/dist/lib/series-inspection-frame.js +70 -0
  507. package/dist/lib/series-inspection-frame.js.map +7 -0
  508. package/dist/lib/signals/edge.d.ts +7 -4
  509. package/dist/lib/signals/edge.js +25 -3
  510. package/dist/lib/signals/edge.js.map +2 -2
  511. package/dist/lib/signals/graph.d.ts +16 -2
  512. package/dist/lib/signals/graph.js +54 -12
  513. package/dist/lib/signals/graph.js.map +2 -2
  514. package/dist/lib/signals/input-provision.d.ts +15 -0
  515. package/dist/lib/signals/input-provision.js +53 -3
  516. package/dist/lib/signals/input-provision.js.map +2 -2
  517. package/dist/lib/signals/render-consumer.d.ts +3 -0
  518. package/dist/lib/signals/render-consumer.js +22 -14
  519. package/dist/lib/signals/render-consumer.js.map +2 -2
  520. package/dist/lib/style/positioning.d.ts +50 -2
  521. package/dist/lib/style/positioning.js +28 -4
  522. package/dist/lib/style/positioning.js.map +2 -2
  523. package/dist/lib/style/resolve-built-in.d.ts +4 -3
  524. package/dist/lib/style/resolve-built-in.js +17 -3
  525. package/dist/lib/style/resolve-built-in.js.map +2 -2
  526. package/dist/lib/style/resolve-dispatch.d.ts +3 -0
  527. package/dist/lib/style/resolve-dispatch.js +77 -4
  528. package/dist/lib/style/resolve-dispatch.js.map +2 -2
  529. package/dist/lib/style/resolve-length.d.ts +2 -0
  530. package/dist/lib/style/resolve-length.js +13 -9
  531. package/dist/lib/style/resolve-length.js.map +2 -2
  532. package/dist/lib/style/sizing-length.d.ts +51 -0
  533. package/dist/lib/style/sizing-length.js +77 -0
  534. package/dist/lib/style/sizing-length.js.map +7 -0
  535. package/dist/lib/style/types.d.ts +63 -25
  536. package/dist/lib/surface/root-surface.js +10 -6
  537. package/dist/lib/surface/root-surface.js.map +2 -2
  538. package/dist/lib/textures/texture.js +10 -8
  539. package/dist/lib/textures/texture.js.map +2 -2
  540. package/dist/lib/transitions/capture.js +4 -1
  541. package/dist/lib/transitions/capture.js.map +2 -2
  542. package/dist/lib/transitions/embers-physics.js +17 -10
  543. package/dist/lib/transitions/embers-physics.js.map +2 -2
  544. package/dist/lib/types.d.ts +110 -1
  545. package/dist/sync.d.ts +16 -0
  546. package/dist/sync.js +13 -0
  547. package/dist/sync.js.map +7 -0
  548. package/dist/sync.mjs +1 -0
  549. package/package.json +26 -3
@@ -0,0 +1,71 @@
1
+ import type { FillStyle, PibblEventHandlers, PibblEventParticipationOptions, SignalValue, StrokeStyle } from "@pibbl/core";
2
+ import type { SignalStyle } from "@pibbl/core/internal";
3
+ import type { LineAccessor, ScaleId, SeriesAccessor } from "./types.js";
4
+ /**
5
+ * A data property or callback extracting a nonnegative research weight.
6
+ *
7
+ * @see {@link WeightedPointSeriesProps}
8
+ */
9
+ export type WeightAccessor<D> = LineAccessor<D>;
10
+ /** Shared presentation for {@link WeightedPointSeries}. */
11
+ export interface WeightedPointSeriesStyle {
12
+ /** Paint used for point interiors. Defaults to `#087f8c`. */
13
+ readonly fill?: FillStyle;
14
+ /** Paint used for point outlines. Defaults to no outline. */
15
+ readonly stroke?: StrokeStyle;
16
+ /** Outline width in local coordinate units. Defaults to 1. */
17
+ readonly strokeWidth?: number;
18
+ /** Opacity in the inclusive range [0, 1]. Defaults to 1. */
19
+ readonly opacity?: number;
20
+ /** Pointer cursor while the series owns a target. */
21
+ readonly cursor?: string;
22
+ }
23
+ /**
24
+ * Authored inputs for {@link WeightedPointSeries}.
25
+ *
26
+ * Weights are supplied data, not calculated precision, sample size, or evidence.
27
+ * The zero baseline and squared-radius interpolation make displayed area linear in
28
+ * the supplied weight.
29
+ */
30
+ export interface WeightedPointSeriesProps<D> extends PibblEventHandlers, PibblEventParticipationOptions {
31
+ /** Readonly data or a signal containing it. */
32
+ readonly data: SignalValue<readonly D[]>;
33
+ /** Horizontal coordinate property or synchronous accessor. */
34
+ readonly x: SeriesAccessor<D>;
35
+ /** Vertical coordinate property or synchronous accessor. */
36
+ readonly y: SeriesAccessor<D>;
37
+ /** Nonnegative supplied weight property or synchronous accessor. */
38
+ readonly weight: WeightAccessor<D>;
39
+ /** Scale used to map x coordinates. */
40
+ readonly xScale: ScaleId;
41
+ /** Scale used to map y coordinates. */
42
+ readonly yScale: ScaleId;
43
+ /** Supplied inclusive weight extent. The lower bound must be zero. */
44
+ readonly weightDomain: readonly [0, number];
45
+ /** Radius extent `[0, maximumRadius]`; defaults to `[0, 6]`. */
46
+ readonly radiusRange?: readonly [0, number];
47
+ /**
48
+ * Excludes a datum before coordinate and weight accessors run.
49
+ * @param datum - Candidate source datum.
50
+ * @param index - Zero-based source index.
51
+ * @param data - Complete source data array.
52
+ * @returns Whether this datum contributes a mark.
53
+ */
54
+ readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;
55
+ /** Shared presentation. Whole-object and shallow field signals are supported. */
56
+ readonly style?: SignalValue<SignalStyle<WeightedPointSeriesStyle>>;
57
+ }
58
+ /**
59
+ * Draws batched circles whose visible area is proportional to supplied weights.
60
+ *
61
+ * Nullish weights and zero weights omit their marks. Finite positive weights must
62
+ * fall inside `weightDomain`; the component never clamps or infers weights.
63
+ * `data` and shared style signals schedule ordinary Pibbl updates. The component
64
+ * owns no retained resources and returns one ordinary Pibbl pointer target.
65
+ *
66
+ * @param props - Supplied observations, coordinate and weight accessors, scales, and paint.
67
+ * See {@link WeightedPointSeriesProps}.
68
+ * @returns One batched Pibbl Path whose mark area is proportional to each supplied weight.
69
+ * @see {@link WeightedPointSeriesProps}
70
+ */
71
+ export declare function WeightedPointSeries<D>({ data: input, x: xInput, y: yInput, weight: weightInput, xScale: xId, yScale: yId, weightDomain, radiusRange, defined, style: styleInput, ...events }: WeightedPointSeriesProps<D>): import("../../../jsx-runtime.js").JSX.Element;
@@ -0,0 +1,169 @@
1
+ import { jsx } from "@pibbl/core/jsx-runtime";
2
+ import { resolveTexturePaint } from "@pibbl/core/internal";
3
+ import { Path, resolveSignalValue, useCanvasContext } from "@pibbl/core";
4
+ import { validateTexturePaint, withHooksForbidden } from "@pibbl/core/internal";
5
+ import { pointAccessor, pointData } from "./point-data.js";
6
+ import { appendPointTarget, pointPath } from "./point-geometry.js";
7
+ import { opacity, width } from "./paint.js";
8
+ import {
9
+ mapSeriesPosition,
10
+ seriesAccessor,
11
+ useSeriesPosition
12
+ } from "./series-position.js";
13
+ const fields = ["fill", "stroke", "strokeWidth", "opacity", "cursor"];
14
+ function paint(value, name) {
15
+ if (value === void 0 || typeof value === "string" || value instanceof CanvasGradient || value instanceof CanvasPattern)
16
+ return value;
17
+ try {
18
+ validateTexturePaint(value);
19
+ return value;
20
+ } catch {
21
+ }
22
+ throw new TypeError(`WeightedPointSeries: invalid ${name}.`);
23
+ }
24
+ function styleObject(input) {
25
+ if (input === null || typeof input !== "object" || Array.isArray(input))
26
+ throw new TypeError("WeightedPointSeries: style must be an object.");
27
+ const result = {};
28
+ for (const key of Object.keys(input)) {
29
+ if (!fields.includes(key))
30
+ throw new TypeError(
31
+ `WeightedPointSeries: unsupported style field ${key}.`
32
+ );
33
+ result[key] = resolveSignalValue(input[key]);
34
+ }
35
+ return result;
36
+ }
37
+ function normalized(style) {
38
+ if (style.cursor !== void 0 && typeof style.cursor !== "string")
39
+ throw new TypeError("WeightedPointSeries: cursor must be a string.");
40
+ return {
41
+ fill: paint(style.fill ?? "#087f8c", "fill"),
42
+ stroke: paint(style.stroke, "stroke"),
43
+ strokeWidth: width(
44
+ style.strokeWidth ?? 1,
45
+ "WeightedPointSeries strokeWidth"
46
+ ),
47
+ opacity: opacity(style.opacity ?? 1, "WeightedPointSeries opacity"),
48
+ cursor: style.cursor
49
+ };
50
+ }
51
+ function range(value) {
52
+ const actual = value ?? [0, 6];
53
+ if (!Array.isArray(actual) || actual.length !== 2 || actual[0] !== 0 || !Number.isFinite(actual[1]) || actual[1] < 0)
54
+ throw new RangeError(
55
+ "WeightedPointSeries: radiusRange must be [0, a finite nonnegative maximum]."
56
+ );
57
+ return actual;
58
+ }
59
+ function domain(value) {
60
+ if (!Array.isArray(value) || value.length !== 2 || value[0] !== 0 || !Number.isFinite(value[1]) || value[1] <= 0)
61
+ throw new RangeError(
62
+ "WeightedPointSeries: weightDomain must be [0, a finite positive maximum]."
63
+ );
64
+ return value;
65
+ }
66
+ function WeightedPointSeries({
67
+ data: input,
68
+ x: xInput,
69
+ y: yInput,
70
+ weight: weightInput,
71
+ xScale: xId,
72
+ yScale: yId,
73
+ weightDomain,
74
+ radiusRange,
75
+ defined,
76
+ style: styleInput,
77
+ ...events
78
+ }) {
79
+ const xs = useSeriesPosition(xId);
80
+ const ys = useSeriesPosition(yId);
81
+ const data = pointData(resolveSignalValue(input), "WeightedPointSeries");
82
+ const x = seriesAccessor(xInput);
83
+ const y = seriesAccessor(yInput);
84
+ const weight = pointAccessor(weightInput);
85
+ const [, maximumWeight] = domain(weightDomain);
86
+ const [, maximumRadius] = range(radiusRange);
87
+ const style = normalized(styleObject(resolveSignalValue(styleInput) ?? {}));
88
+ const ctx = useCanvasContext();
89
+ const target = new Path2D();
90
+ const marks = [];
91
+ for (let i = 0; i < data.length; i++) {
92
+ const datum = data[i];
93
+ const values = withHooksForbidden(
94
+ "WeightedPointSeries: accessors cannot call hooks.",
95
+ () => {
96
+ if (defined && !defined(datum, i, data)) return void 0;
97
+ return {
98
+ x: x(datum, i, data),
99
+ y: y(datum, i, data),
100
+ weight: weight(datum, i, data)
101
+ };
102
+ }
103
+ );
104
+ if (!values) continue;
105
+ const mappedX = mapSeriesPosition(xs, values.x);
106
+ const mappedY = mapSeriesPosition(ys, values.y);
107
+ if (mappedX === void 0 || mappedY === void 0) continue;
108
+ const supplied = values.weight;
109
+ if (supplied == null) continue;
110
+ if (typeof supplied !== "number" || !Number.isFinite(supplied))
111
+ throw new TypeError(
112
+ "WeightedPointSeries: weight must be a finite number."
113
+ );
114
+ if (supplied < 0)
115
+ throw new RangeError("WeightedPointSeries: weight must be nonnegative.");
116
+ if (supplied > maximumWeight)
117
+ throw new RangeError("WeightedPointSeries: weight exceeds weightDomain.");
118
+ if (supplied === 0 || maximumRadius === 0) continue;
119
+ const radius = maximumRadius * Math.sqrt(supplied / maximumWeight);
120
+ marks.push({ x: mappedX, y: mappedY, radius });
121
+ }
122
+ for (const { x: x2, y: y2, radius } of marks) {
123
+ appendPointTarget(
124
+ target,
125
+ x2,
126
+ y2,
127
+ radius,
128
+ !!style.fill,
129
+ style.stroke ? style.strokeWidth : 0
130
+ );
131
+ const path = pointPath(x2, y2, radius);
132
+ ctx.save();
133
+ try {
134
+ ctx.globalAlpha *= style.opacity;
135
+ if (style.fill) {
136
+ ctx.fillStyle = resolveTexturePaint(style.fill, ctx, {
137
+ x: x2 - radius,
138
+ y: y2 - radius,
139
+ width: radius * 2,
140
+ height: radius * 2
141
+ });
142
+ ctx.fill(path);
143
+ }
144
+ if (style.stroke && style.strokeWidth > 0) {
145
+ ctx.strokeStyle = resolveTexturePaint(style.stroke, ctx, {
146
+ x: x2 - radius,
147
+ y: y2 - radius,
148
+ width: radius * 2,
149
+ height: radius * 2
150
+ });
151
+ ctx.lineWidth = style.strokeWidth;
152
+ ctx.stroke(path);
153
+ }
154
+ } finally {
155
+ ctx.restore();
156
+ }
157
+ }
158
+ return /* @__PURE__ */ jsx(
159
+ Path,
160
+ {
161
+ ...events,
162
+ style: { d: target, fill: "transparent", cursor: style.cursor }
163
+ }
164
+ );
165
+ }
166
+ export {
167
+ WeightedPointSeries
168
+ };
169
+ //# sourceMappingURL=weighted-point-series.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/features/viz/lib/weighted-point-series.tsx"],
4
+ "sourcesContent": ["import { resolveTexturePaint } from \"@pibbl/core/internal\";\nimport { Path, resolveSignalValue, useCanvasContext } from \"@pibbl/core\";\nimport type {\n FillStyle,\n PibblEventHandlers,\n PibblEventParticipationOptions,\n SignalValue,\n StrokeStyle,\n} from \"@pibbl/core\";\nimport type { SignalStyle } from \"@pibbl/core/internal\";\nimport { validateTexturePaint, withHooksForbidden } from \"@pibbl/core/internal\";\nimport type { LineAccessor, ScaleId, SeriesAccessor } from \"./types.js\";\nimport { pointAccessor, pointData } from \"./point-data.js\";\nimport { appendPointTarget, pointPath } from \"./point-geometry.js\";\nimport { opacity, width } from \"./paint.js\";\nimport {\n mapSeriesPosition,\n seriesAccessor,\n useSeriesPosition,\n} from \"./series-position.js\";\n\nconst fields = [\"fill\", \"stroke\", \"strokeWidth\", \"opacity\", \"cursor\"];\n\n/**\n * A data property or callback extracting a nonnegative research weight.\n *\n * @see {@link WeightedPointSeriesProps}\n */\nexport type WeightAccessor<D> = LineAccessor<D>;\n\n/** Shared presentation for {@link WeightedPointSeries}. */\nexport interface WeightedPointSeriesStyle {\n /** Paint used for point interiors. Defaults to `#087f8c`. */\n readonly fill?: FillStyle;\n /** Paint used for point outlines. Defaults to no outline. */\n readonly stroke?: StrokeStyle;\n /** Outline width in local coordinate units. Defaults to 1. */\n readonly strokeWidth?: number;\n /** Opacity in the inclusive range [0, 1]. Defaults to 1. */\n readonly opacity?: number;\n /** Pointer cursor while the series owns a target. */\n readonly cursor?: string;\n}\n\n/**\n * Authored inputs for {@link WeightedPointSeries}.\n *\n * Weights are supplied data, not calculated precision, sample size, or evidence.\n * The zero baseline and squared-radius interpolation make displayed area linear in\n * the supplied weight.\n */\nexport interface WeightedPointSeriesProps<D>\n extends PibblEventHandlers, PibblEventParticipationOptions {\n /** Readonly data or a signal containing it. */\n readonly data: SignalValue<readonly D[]>;\n /** Horizontal coordinate property or synchronous accessor. */\n readonly x: SeriesAccessor<D>;\n /** Vertical coordinate property or synchronous accessor. */\n readonly y: SeriesAccessor<D>;\n /** Nonnegative supplied weight property or synchronous accessor. */\n readonly weight: WeightAccessor<D>;\n /** Scale used to map x coordinates. */\n readonly xScale: ScaleId;\n /** Scale used to map y coordinates. */\n readonly yScale: ScaleId;\n /** Supplied inclusive weight extent. The lower bound must be zero. */\n readonly weightDomain: readonly [0, number];\n /** Radius extent `[0, maximumRadius]`; defaults to `[0, 6]`. */\n readonly radiusRange?: readonly [0, number];\n /**\n * Excludes a datum before coordinate and weight accessors run.\n * @param datum - Candidate source datum.\n * @param index - Zero-based source index.\n * @param data - Complete source data array.\n * @returns Whether this datum contributes a mark.\n */\n readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;\n /** Shared presentation. Whole-object and shallow field signals are supported. */\n readonly style?: SignalValue<SignalStyle<WeightedPointSeriesStyle>>;\n}\n\nfunction paint(\n value: unknown,\n name: string,\n): FillStyle | StrokeStyle | undefined {\n if (\n value === undefined ||\n typeof value === \"string\" ||\n value instanceof CanvasGradient ||\n value instanceof CanvasPattern\n )\n return value;\n try {\n validateTexturePaint(value as never);\n return value as FillStyle | StrokeStyle;\n } catch {\n // Normalize all unsupported public paint values to the series error.\n }\n throw new TypeError(`WeightedPointSeries: invalid ${name}.`);\n}\n\nfunction styleObject(input: unknown): WeightedPointSeriesStyle {\n if (input === null || typeof input !== \"object\" || Array.isArray(input))\n throw new TypeError(\"WeightedPointSeries: style must be an object.\");\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(input)) {\n if (!fields.includes(key))\n throw new TypeError(\n `WeightedPointSeries: unsupported style field ${key}.`,\n );\n result[key] = resolveSignalValue((input as Record<string, unknown>)[key]);\n }\n return result as WeightedPointSeriesStyle;\n}\n\nfunction normalized(style: WeightedPointSeriesStyle) {\n if (style.cursor !== undefined && typeof style.cursor !== \"string\")\n throw new TypeError(\"WeightedPointSeries: cursor must be a string.\");\n return {\n fill: paint(style.fill ?? \"#087f8c\", \"fill\"),\n stroke: paint(style.stroke, \"stroke\"),\n strokeWidth: width(\n style.strokeWidth ?? 1,\n \"WeightedPointSeries strokeWidth\",\n ),\n opacity: opacity(style.opacity ?? 1, \"WeightedPointSeries opacity\"),\n cursor: style.cursor,\n };\n}\n\nfunction range(\n value: readonly [number, number] | undefined,\n): readonly [number, number] {\n const actual: readonly [number, number] = value ?? [0, 6];\n if (\n !Array.isArray(actual) ||\n actual.length !== 2 ||\n actual[0] !== 0 ||\n !Number.isFinite(actual[1]) ||\n actual[1] < 0\n )\n throw new RangeError(\n \"WeightedPointSeries: radiusRange must be [0, a finite nonnegative maximum].\",\n );\n return actual;\n}\n\nfunction domain(value: readonly [0, number]): readonly [number, number] {\n if (\n !Array.isArray(value) ||\n value.length !== 2 ||\n value[0] !== 0 ||\n !Number.isFinite(value[1]) ||\n value[1] <= 0\n )\n throw new RangeError(\n \"WeightedPointSeries: weightDomain must be [0, a finite positive maximum].\",\n );\n return value;\n}\n\n/**\n * Draws batched circles whose visible area is proportional to supplied weights.\n *\n * Nullish weights and zero weights omit their marks. Finite positive weights must\n * fall inside `weightDomain`; the component never clamps or infers weights.\n * `data` and shared style signals schedule ordinary Pibbl updates. The component\n * owns no retained resources and returns one ordinary Pibbl pointer target.\n *\n * @param props - Supplied observations, coordinate and weight accessors, scales, and paint.\n * See {@link WeightedPointSeriesProps}.\n * @returns One batched Pibbl Path whose mark area is proportional to each supplied weight.\n * @see {@link WeightedPointSeriesProps}\n */\nexport function WeightedPointSeries<D>({\n data: input,\n x: xInput,\n y: yInput,\n weight: weightInput,\n xScale: xId,\n yScale: yId,\n weightDomain,\n radiusRange,\n defined,\n style: styleInput,\n ...events\n}: WeightedPointSeriesProps<D>) {\n const xs = useSeriesPosition(xId);\n const ys = useSeriesPosition(yId);\n const data = pointData(resolveSignalValue(input), \"WeightedPointSeries\");\n const x = seriesAccessor(xInput);\n const y = seriesAccessor(yInput);\n const weight = pointAccessor(weightInput);\n const [, maximumWeight] = domain(weightDomain);\n const [, maximumRadius] = range(radiusRange);\n const style = normalized(styleObject(resolveSignalValue(styleInput) ?? {}));\n const ctx = useCanvasContext();\n const target = new Path2D();\n const marks: {\n readonly x: number;\n readonly y: number;\n readonly radius: number;\n }[] = [];\n for (let i = 0; i < data.length; i++) {\n const datum = data[i];\n const values = withHooksForbidden(\n \"WeightedPointSeries: accessors cannot call hooks.\",\n () => {\n if (defined && !defined(datum, i, data)) return undefined;\n return {\n x: x(datum, i, data),\n y: y(datum, i, data),\n weight: weight(datum, i, data),\n };\n },\n );\n if (!values) continue;\n const mappedX = mapSeriesPosition(xs, values.x);\n const mappedY = mapSeriesPosition(ys, values.y);\n if (mappedX === undefined || mappedY === undefined) continue;\n const supplied = values.weight;\n if (supplied == null) continue;\n if (typeof supplied !== \"number\" || !Number.isFinite(supplied))\n throw new TypeError(\n \"WeightedPointSeries: weight must be a finite number.\",\n );\n if (supplied < 0)\n throw new RangeError(\"WeightedPointSeries: weight must be nonnegative.\");\n if (supplied > maximumWeight)\n throw new RangeError(\"WeightedPointSeries: weight exceeds weightDomain.\");\n if (supplied === 0 || maximumRadius === 0) continue;\n const radius = maximumRadius * Math.sqrt(supplied / maximumWeight);\n marks.push({ x: mappedX, y: mappedY, radius });\n }\n for (const { x, y, radius } of marks) {\n appendPointTarget(\n target,\n x,\n y,\n radius,\n !!style.fill,\n style.stroke ? style.strokeWidth : 0,\n );\n const path = pointPath(x, y, radius);\n ctx.save();\n try {\n ctx.globalAlpha *= style.opacity;\n if (style.fill) {\n ctx.fillStyle = resolveTexturePaint(style.fill, ctx, {\n x: x - radius,\n y: y - radius,\n width: radius * 2,\n height: radius * 2,\n });\n ctx.fill(path);\n }\n if (style.stroke && style.strokeWidth > 0) {\n ctx.strokeStyle = resolveTexturePaint(style.stroke, ctx, {\n x: x - radius,\n y: y - radius,\n width: radius * 2,\n height: radius * 2,\n });\n ctx.lineWidth = style.strokeWidth;\n ctx.stroke(path);\n }\n } finally {\n ctx.restore();\n }\n }\n return (\n <Path\n {...events}\n style={{ d: target, fill: \"transparent\", cursor: style.cursor }}\n />\n );\n}\n"],
5
+ "mappings": "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",
6
+ "names": ["x", "y"]
7
+ }
@@ -0,0 +1,5 @@
1
+ import { ReflectionGpu, type ReflectionGpuCallbacks } from "./reflection-gpu.js";
2
+ /** Shares the existing private GPU resource/context-loss implementation. */
3
+ export declare class BackdropContrastGpu extends ReflectionGpu {
4
+ constructor(callbacks?: Readonly<ReflectionGpuCallbacks>);
5
+ }
@@ -0,0 +1,33 @@
1
+ import {
2
+ ReflectionGpu
3
+ } from "./reflection-gpu.js";
4
+ const fragment = `#version 300 es
5
+ precision highp float;
6
+ uniform sampler2D scene, map, lightMap;
7
+ in vec2 uv;
8
+ out vec4 outputColor;
9
+ vec3 linearRgb(vec3 c) {
10
+ return mix(c/12.92,pow((c+.055)/1.055,vec3(2.4)),step(vec3(.04045),c));
11
+ }
12
+ void main() {
13
+ float coverage=texture(scene,uv).a;
14
+ vec4 backdrop=texture(map,uv);
15
+ // A transparent current target is evaluated over white; DOM pixels are unavailable.
16
+ vec3 background=mix(vec3(1),backdrop.rgb,backdrop.a);
17
+ float luminance=dot(linearRgb(background),vec3(.2126,.7152,.0722));
18
+ // Equal black/white contrast occurs at sqrt(.05*1.05)-.05.
19
+ int choice=luminance<.179128784747792?0:1;
20
+ vec4 color=texelFetch(lightMap,ivec2(choice,0),0);
21
+ float alpha=coverage*color.a;
22
+ outputColor=vec4(color.rgb*alpha,alpha);
23
+ }
24
+ `;
25
+ class BackdropContrastGpu extends ReflectionGpu {
26
+ constructor(callbacks = {}) {
27
+ super(callbacks, fragment);
28
+ }
29
+ }
30
+ export {
31
+ BackdropContrastGpu
32
+ };
33
+ //# sourceMappingURL=backdrop-contrast-gpu.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/filters/backdrop-contrast-gpu.ts"],
4
+ "sourcesContent": ["import {\n ReflectionGpu,\n type ReflectionGpuCallbacks,\n} from \"./reflection-gpu.js\";\n\nconst fragment = `#version 300 es\nprecision highp float;\nuniform sampler2D scene, map, lightMap;\nin vec2 uv;\nout vec4 outputColor;\nvec3 linearRgb(vec3 c) {\n return mix(c/12.92,pow((c+.055)/1.055,vec3(2.4)),step(vec3(.04045),c));\n}\nvoid main() {\n float coverage=texture(scene,uv).a;\n vec4 backdrop=texture(map,uv);\n // A transparent current target is evaluated over white; DOM pixels are unavailable.\n vec3 background=mix(vec3(1),backdrop.rgb,backdrop.a);\n float luminance=dot(linearRgb(background),vec3(.2126,.7152,.0722));\n // Equal black/white contrast occurs at sqrt(.05*1.05)-.05.\n int choice=luminance<.179128784747792?0:1;\n vec4 color=texelFetch(lightMap,ivec2(choice,0),0);\n float alpha=coverage*color.a;\n outputColor=vec4(color.rgb*alpha,alpha);\n}\n`;\n/** Shares the existing private GPU resource/context-loss implementation. */\nexport class BackdropContrastGpu extends ReflectionGpu {\n constructor(callbacks: Readonly<ReflectionGpuCallbacks> = {}) {\n super(callbacks, fragment);\n }\n}\n"],
5
+ "mappings": "AAAA;AAAA,EACE;AAAA,OAEK;AAEP,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBV,MAAM,4BAA4B,cAAc;AAAA,EACrD,YAAY,YAA8C,CAAC,GAAG;AAC5D,UAAM,WAAW,QAAQ;AAAA,EAC3B;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,21 @@
1
+ import type { SignalValue } from "../lib/signals/types.js";
2
+ import { type PibblFilter } from "../lib/style/filter-types.js";
3
+ /** Two foreground colors selected per backdrop pixel. See {@link backdropContrast}. */
4
+ export interface PibblBackdropContrastFilterOptions {
5
+ /** Color drawn over dark backdrop pixels; defaults to white. See {@link SignalValue}. */
6
+ readonly light?: SignalValue<string>;
7
+ /** Color drawn over light backdrop pixels; defaults to black. See {@link SignalValue}. */
8
+ readonly dark?: SignalValue<string>;
9
+ }
10
+ /**
11
+ * Recolors a receiving primitive and its descendants per pixel, using their combined alpha
12
+ * as a mask. Chooses light below relative backdrop luminance 0.179129 and dark otherwise.
13
+ * Samples already-painted content in the current Canvas target; transparent backdrop is
14
+ * evaluated over white. Isolated/cached layers see their own local backdrop, not outer paint.
15
+ * Requires OffscreenCanvas and WebGL2; performs no scene pixel readback. Geometry is unchanged.
16
+ *
17
+ * @param options - Optional signal-capable foreground colors; white and black by default.
18
+ * See {@link PibblBackdropContrastFilterOptions}.
19
+ * @returns An immutable descriptor for style.filter. See {@link PibblFilter}.
20
+ */
21
+ export declare function backdropContrast(options?: PibblBackdropContrastFilterOptions): PibblFilter;
@@ -0,0 +1,61 @@
1
+ import { isSignal } from "../lib/signals/graph.js";
2
+ import { layoutDiagnostic } from "../lib/style/diagnostics.js";
3
+ import {
4
+ PIBBL_FILTER_EXECUTOR
5
+ } from "../lib/style/filter-types.js";
6
+ import { concreteColor } from "./native-color.js";
7
+ import {
8
+ filterBoundaryExecutor
9
+ } from "./filter-executor.js";
10
+ import { processBackdropContrast } from "./render-backdrop-contrast-boundary.js";
11
+ const definitions = /* @__PURE__ */ new WeakMap();
12
+ const executor = {
13
+ prepare(value, property, context) {
14
+ const options = definitions.get(value);
15
+ if (!options)
16
+ throw new Error(
17
+ "A backdropContrast filter was created by an incompatible Pibbl runtime."
18
+ );
19
+ const color = (key, fallback) => {
20
+ const input = options[key];
21
+ const value2 = input === void 0 ? fallback : isSignal(input) ? input.get() : input;
22
+ const result = concreteColor(value2, `${property}.${key}`, context);
23
+ if (typeof CSS === "undefined" || !CSS.supports("color", result))
24
+ throw layoutDiagnostic({
25
+ component: context.component,
26
+ property: `${property}.${key}`,
27
+ value: value2,
28
+ algorithm: context.algorithm,
29
+ constraints: context.constraints,
30
+ reason: "must be a supported concrete CSS color"
31
+ });
32
+ return result;
33
+ };
34
+ const light = color("light", "white"), dark = color("dark", "black");
35
+ return Object.freeze({
36
+ executor: filterBoundaryExecutor,
37
+ needsBackdrop: true,
38
+ reverseInfluence: (output) => ({ ...output }),
39
+ process: (source, windows, backdrop) => {
40
+ if (!backdrop)
41
+ throw new Error(
42
+ "backdropContrast requires the current Canvas backdrop."
43
+ );
44
+ return processBackdropContrast(source, windows, backdrop, {
45
+ light,
46
+ dark
47
+ });
48
+ }
49
+ });
50
+ },
51
+ render: filterBoundaryExecutor.render
52
+ };
53
+ function backdropContrast(options = {}) {
54
+ const value = Object.freeze({ [PIBBL_FILTER_EXECUTOR]: executor });
55
+ definitions.set(value, Object.freeze({ ...options }));
56
+ return value;
57
+ }
58
+ export {
59
+ backdropContrast
60
+ };
61
+ //# sourceMappingURL=backdrop-contrast.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/filters/backdrop-contrast.ts"],
4
+ "sourcesContent": ["import { isSignal } from \"../lib/signals/graph.js\";\nimport type { SignalValue } from \"../lib/signals/types.js\";\nimport { layoutDiagnostic } from \"../lib/style/diagnostics.js\";\nimport {\n PIBBL_FILTER_EXECUTOR,\n type PibblFilter,\n type PibblFilterExecutor,\n} from \"../lib/style/filter-types.js\";\nimport { concreteColor } from \"./native-color.js\";\nimport {\n filterBoundaryExecutor,\n type CustomPreparedFilter,\n} from \"./filter-executor.js\";\nimport { processBackdropContrast } from \"./render-backdrop-contrast-boundary.js\";\n\n/** Two foreground colors selected per backdrop pixel. See {@link backdropContrast}. */\nexport interface PibblBackdropContrastFilterOptions {\n /** Color drawn over dark backdrop pixels; defaults to white. See {@link SignalValue}. */\n readonly light?: SignalValue<string>;\n /** Color drawn over light backdrop pixels; defaults to black. See {@link SignalValue}. */\n readonly dark?: SignalValue<string>;\n}\nconst definitions = new WeakMap<\n PibblFilter,\n Readonly<PibblBackdropContrastFilterOptions>\n>();\nconst executor: PibblFilterExecutor = {\n prepare(value, property, context) {\n const options = definitions.get(value);\n if (!options)\n throw new Error(\n \"A backdropContrast filter was created by an incompatible Pibbl runtime.\",\n );\n const color = (key: \"light\" | \"dark\", fallback: string) => {\n const input = options[key];\n const value =\n input === undefined ? fallback : isSignal(input) ? input.get() : input;\n const result = concreteColor(value, `${property}.${key}`, context);\n if (typeof CSS === \"undefined\" || !CSS.supports(\"color\", result))\n throw layoutDiagnostic({\n component: context.component,\n property: `${property}.${key}`,\n value,\n algorithm: context.algorithm,\n constraints: context.constraints,\n reason: \"must be a supported concrete CSS color\",\n });\n return result;\n };\n const light = color(\"light\", \"white\"),\n dark = color(\"dark\", \"black\");\n return Object.freeze({\n executor: filterBoundaryExecutor,\n needsBackdrop: true,\n reverseInfluence: (output) => ({ ...output }),\n process: (source, windows, backdrop) => {\n if (!backdrop)\n throw new Error(\n \"backdropContrast requires the current Canvas backdrop.\",\n );\n return processBackdropContrast(source, windows, backdrop, {\n light,\n dark,\n });\n },\n } satisfies CustomPreparedFilter);\n },\n render: filterBoundaryExecutor.render,\n};\n/**\n * Recolors a receiving primitive and its descendants per pixel, using their combined alpha\n * as a mask. Chooses light below relative backdrop luminance 0.179129 and dark otherwise.\n * Samples already-painted content in the current Canvas target; transparent backdrop is\n * evaluated over white. Isolated/cached layers see their own local backdrop, not outer paint.\n * Requires OffscreenCanvas and WebGL2; performs no scene pixel readback. Geometry is unchanged.\n *\n * @param options - Optional signal-capable foreground colors; white and black by default.\n * See {@link PibblBackdropContrastFilterOptions}.\n * @returns An immutable descriptor for style.filter. See {@link PibblFilter}.\n */\nexport function backdropContrast(\n options: PibblBackdropContrastFilterOptions = {},\n): PibblFilter {\n const value = Object.freeze({ [PIBBL_FILTER_EXECUTOR]: executor });\n definitions.set(value, Object.freeze({ ...options }));\n return value;\n}\n"],
5
+ "mappings": "AAAA,SAAS,gBAAgB;AAEzB,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,OAGK;AACP,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,OAEK;AACP,SAAS,+BAA+B;AASxC,MAAM,cAAc,oBAAI,QAGtB;AACF,MAAM,WAAgC;AAAA,EACpC,QAAQ,OAAO,UAAU,SAAS;AAChC,UAAM,UAAU,YAAY,IAAI,KAAK;AACrC,QAAI,CAAC;AACH,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AACF,UAAM,QAAQ,CAAC,KAAuB,aAAqB;AACzD,YAAM,QAAQ,QAAQ,GAAG;AACzB,YAAMA,SACJ,UAAU,SAAY,WAAW,SAAS,KAAK,IAAI,MAAM,IAAI,IAAI;AACnE,YAAM,SAAS,cAAcA,QAAO,GAAG,QAAQ,IAAI,GAAG,IAAI,OAAO;AACjE,UAAI,OAAO,QAAQ,eAAe,CAAC,IAAI,SAAS,SAAS,MAAM;AAC7D,cAAM,iBAAiB;AAAA,UACrB,WAAW,QAAQ;AAAA,UACnB,UAAU,GAAG,QAAQ,IAAI,GAAG;AAAA,UAC5B,OAAAA;AAAA,UACA,WAAW,QAAQ;AAAA,UACnB,aAAa,QAAQ;AAAA,UACrB,QAAQ;AAAA,QACV,CAAC;AACH,aAAO;AAAA,IACT;AACA,UAAM,QAAQ,MAAM,SAAS,OAAO,GAClC,OAAO,MAAM,QAAQ,OAAO;AAC9B,WAAO,OAAO,OAAO;AAAA,MACnB,UAAU;AAAA,MACV,eAAe;AAAA,MACf,kBAAkB,CAAC,YAAY,EAAE,GAAG,OAAO;AAAA,MAC3C,SAAS,CAAC,QAAQ,SAAS,aAAa;AACtC,YAAI,CAAC;AACH,gBAAM,IAAI;AAAA,YACR;AAAA,UACF;AACF,eAAO,wBAAwB,QAAQ,SAAS,UAAU;AAAA,UACxD;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,CAAgC;AAAA,EAClC;AAAA,EACA,QAAQ,uBAAuB;AACjC;AAYO,SAAS,iBACd,UAA8C,CAAC,GAClC;AACb,QAAM,QAAQ,OAAO,OAAO,EAAE,CAAC,qBAAqB,GAAG,SAAS,CAAC;AACjE,cAAY,IAAI,OAAO,OAAO,OAAO,EAAE,GAAG,QAAQ,CAAC,CAAC;AACpD,SAAO;AACT;",
6
+ "names": ["value"]
7
+ }
@@ -22,7 +22,7 @@ const displacementExecutor = {
22
22
  }
23
23
  const identity = strengthValue === 0 && blurRadius === 0;
24
24
  const { x, y, width, height } = options.region;
25
- if (![x, y, width, height].every(Number.isFinite) || width <= 0 || height <= 0) {
25
+ if (!(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(width) && Number.isFinite(height)) || width <= 0 || height <= 0) {
26
26
  throw diagnostic(`${property}.region`, options.region, "must have finite coordinates and positive finite dimensions", context);
27
27
  }
28
28
  const map = isSignal(options.map) ? options.map.get() : options.map;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/filters/displacement.ts"],
4
- "sourcesContent": ["import { isSignal } from '../lib/signals/graph.js';\nimport { layoutDiagnostic } from '../lib/style/diagnostics.js';\nimport {\n PIBBL_FILTER_EXECUTOR,\n type PibblDisplacementFilterOptions,\n type PibblFilter,\n type PibblFilterExecutor,\n type PreparedPibblFilter,\n} from '../lib/style/filter-types.js';\nimport type { StyleResolutionContext } from '../lib/types.js';\nimport { borrowTextureRaster, validateTexturePaint } from '../lib/textures/texture-protocol.js';\nimport { processDisplacement } from './render-displacement-boundary.js';\nimport { filterBoundaryExecutor, type CustomPreparedFilter } from './filter-executor.js';\nimport { expandDisplacementInput } from './displacement-math.js';\n\nconst definitions = new WeakMap<PibblFilter, Readonly<PibblDisplacementFilterOptions>>();\nconst displacementExecutor: PibblFilterExecutor = {\n prepare(value, property, context): PreparedPibblFilter {\n const options = definitions.get(value);\n if (!options) throw new Error('A displacement filter value was created by an incompatible Pibbl runtime.');\n const strengthValue = isSignal(options.strength) ? options.strength.get() : options.strength;\n if (typeof strengthValue !== 'number' || !Number.isFinite(strengthValue) || strengthValue < 0) {\n throw diagnostic(`${property}.strength`, strengthValue, 'must be a finite nonnegative number', context);\n }\n const blurRadius = isSignal(options.blurRadius) ? options.blurRadius.get() : options.blurRadius ?? 0;\n if (typeof blurRadius !== 'number' || !Number.isFinite(blurRadius) || blurRadius < 0) {\n throw diagnostic(`${property}.blurRadius`, blurRadius, 'must be a finite nonnegative number', context);\n }\n const identity = strengthValue === 0 && blurRadius === 0;\n const { x, y, width, height } = options.region;\n if (![x, y, width, height].every(Number.isFinite) || width <= 0 || height <= 0) {\n throw diagnostic(`${property}.region`, options.region, 'must have finite coordinates and positive finite dimensions', context);\n }\n const map = isSignal(options.map) ? options.map.get() : options.map;\n try {\n validateTexturePaint(map);\n // Receiver preparation owns revision dependencies, before subtree execution\n // changes signal tracking to descendant consumers.\n if (!identity) borrowTextureRaster(map, () => undefined);\n }\n catch (error) {\n throw diagnostic(`${property}.map`, map, error instanceof Error ? error.message : String(error), context);\n }\n const region = Object.freeze({ x, y, width, height });\n return Object.freeze({\n executor: filterBoundaryExecutor,\n textureWarp: blurRadius === 0 ? Object.freeze({ map, strength: strengthValue, region }) : undefined,\n reverseInfluence: (output, density) => expandDisplacementInput(output, strengthValue + blurRadius, density),\n process: identity ? undefined : (source, windows) => {\n try { return processDisplacement(source, windows, map, strengthValue, region, blurRadius); }\n catch (error) {\n const failure = diagnostic(property, { strength: strengthValue, region }, `displacement processing failed: ${error instanceof Error ? error.message : String(error)}`, context);\n Object.defineProperty(failure, 'cause', { value: error });\n throw failure;\n }\n },\n } satisfies CustomPreparedFilter);\n },\n render: filterBoundaryExecutor.render,\n};\n\n/**\n * Creates a displacement filter descriptor for a primitive's style.filter list. Filtering changes\n * pixels without changing layout or hit geometry.\n *\n * @param options - Displacement texture, channel selection, and displacement scale. See\n * {@link PibblDisplacementFilterOptions} .\n * @returns A displacement filter descriptor for style.filter. See {@link PibblFilter}.\n *\n * @see {@link PibblDisplacementFilterOptions}\n * @see {@link PibblFilter}\n */\nexport function displacement(options: PibblDisplacementFilterOptions): PibblFilter {\n const definition = Object.freeze({ map: options.map, strength: options.strength, blurRadius: options.blurRadius, region: Object.freeze({ ...options.region }) });\n const value = Object.freeze({ [PIBBL_FILTER_EXECUTOR]: displacementExecutor });\n definitions.set(value, definition);\n return value;\n}\n\nfunction diagnostic(property: string, value: unknown, reason: string, context: Readonly<StyleResolutionContext>): Error {\n return layoutDiagnostic({ component: context.component, property, value, algorithm: context.algorithm, constraints: context.constraints, reason });\n}\n"],
5
- "mappings": "AAAA,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,OAKK;AAEP,SAAS,qBAAqB,4BAA4B;AAC1D,SAAS,2BAA2B;AACpC,SAAS,8BAAyD;AAClE,SAAS,+BAA+B;AAExC,MAAM,cAAc,oBAAI,QAA+D;AACvF,MAAM,uBAA4C;AAAA,EAChD,QAAQ,OAAO,UAAU,SAA8B;AACrD,UAAM,UAAU,YAAY,IAAI,KAAK;AACrC,QAAI,CAAC,QAAS,OAAM,IAAI,MAAM,2EAA2E;AACzG,UAAM,gBAAgB,SAAS,QAAQ,QAAQ,IAAI,QAAQ,SAAS,IAAI,IAAI,QAAQ;AACpF,QAAI,OAAO,kBAAkB,YAAY,CAAC,OAAO,SAAS,aAAa,KAAK,gBAAgB,GAAG;AAC7F,YAAM,WAAW,GAAG,QAAQ,aAAa,eAAe,uCAAuC,OAAO;AAAA,IACxG;AACA,UAAM,aAAa,SAAS,QAAQ,UAAU,IAAI,QAAQ,WAAW,IAAI,IAAI,QAAQ,cAAc;AACnG,QAAI,OAAO,eAAe,YAAY,CAAC,OAAO,SAAS,UAAU,KAAK,aAAa,GAAG;AACpF,YAAM,WAAW,GAAG,QAAQ,eAAe,YAAY,uCAAuC,OAAO;AAAA,IACvG;AACA,UAAM,WAAW,kBAAkB,KAAK,eAAe;AACvD,UAAM,EAAE,GAAG,GAAG,OAAO,OAAO,IAAI,QAAQ;AACxC,QAAI,CAAC,CAAC,GAAG,GAAG,OAAO,MAAM,EAAE,MAAM,OAAO,QAAQ,KAAK,SAAS,KAAK,UAAU,GAAG;AAC9E,YAAM,WAAW,GAAG,QAAQ,WAAW,QAAQ,QAAQ,+DAA+D,OAAO;AAAA,IAC/H;AACA,UAAM,MAAM,SAAS,QAAQ,GAAG,IAAI,QAAQ,IAAI,IAAI,IAAI,QAAQ;AAChE,QAAI;AACF,2BAAqB,GAAG;AAGxB,UAAI,CAAC,SAAU,qBAAoB,KAAK,MAAM,MAAS;AAAA,IACzD,SACO,OAAO;AACZ,YAAM,WAAW,GAAG,QAAQ,QAAQ,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,OAAO;AAAA,IAC1G;AACA,UAAM,SAAS,OAAO,OAAO,EAAE,GAAG,GAAG,OAAO,OAAO,CAAC;AACpD,WAAO,OAAO,OAAO;AAAA,MACnB,UAAU;AAAA,MACV,aAAa,eAAe,IAAI,OAAO,OAAO,EAAE,KAAK,UAAU,eAAe,OAAO,CAAC,IAAI;AAAA,MAC1F,kBAAkB,CAAC,QAAQ,YAAY,wBAAwB,QAAQ,gBAAgB,YAAY,OAAO;AAAA,MAC1G,SAAS,WAAW,SAAY,CAAC,QAAQ,YAAY;AACnD,YAAI;AAAE,iBAAO,oBAAoB,QAAQ,SAAS,KAAK,eAAe,QAAQ,UAAU;AAAA,QAAG,SACpF,OAAO;AACZ,gBAAM,UAAU,WAAW,UAAU,EAAE,UAAU,eAAe,OAAO,GAAG,mCAAmC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,IAAI,OAAO;AAC9K,iBAAO,eAAe,SAAS,SAAS,EAAE,OAAO,MAAM,CAAC;AACxD,gBAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF,CAAgC;AAAA,EAClC;AAAA,EACA,QAAQ,uBAAuB;AACjC;AAaO,SAAS,aAAa,SAAsD;AACjF,QAAM,aAAa,OAAO,OAAO,EAAE,KAAK,QAAQ,KAAK,UAAU,QAAQ,UAAU,YAAY,QAAQ,YAAY,QAAQ,OAAO,OAAO,EAAE,GAAG,QAAQ,OAAO,CAAC,EAAE,CAAC;AAC/J,QAAM,QAAQ,OAAO,OAAO,EAAE,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;AAC7E,cAAY,IAAI,OAAO,UAAU;AACjC,SAAO;AACT;AAEA,SAAS,WAAW,UAAkB,OAAgB,QAAgB,SAAkD;AACtH,SAAO,iBAAiB,EAAE,WAAW,QAAQ,WAAW,UAAU,OAAO,WAAW,QAAQ,WAAW,aAAa,QAAQ,aAAa,OAAO,CAAC;AACnJ;",
4
+ "sourcesContent": ["import { isSignal } from '../lib/signals/graph.js';\nimport { layoutDiagnostic } from '../lib/style/diagnostics.js';\nimport {\n PIBBL_FILTER_EXECUTOR,\n type PibblDisplacementFilterOptions,\n type PibblFilter,\n type PibblFilterExecutor,\n type PreparedPibblFilter,\n} from '../lib/style/filter-types.js';\nimport type { StyleResolutionContext } from '../lib/types.js';\nimport { borrowTextureRaster, validateTexturePaint } from '../lib/textures/texture-protocol.js';\nimport { processDisplacement } from './render-displacement-boundary.js';\nimport { filterBoundaryExecutor, type CustomPreparedFilter } from './filter-executor.js';\nimport { expandDisplacementInput } from './displacement-math.js';\n\nconst definitions = new WeakMap<PibblFilter, Readonly<PibblDisplacementFilterOptions>>();\nconst displacementExecutor: PibblFilterExecutor = {\n prepare(value, property, context): PreparedPibblFilter {\n const options = definitions.get(value);\n if (!options) throw new Error('A displacement filter value was created by an incompatible Pibbl runtime.');\n const strengthValue = isSignal(options.strength) ? options.strength.get() : options.strength;\n if (typeof strengthValue !== 'number' || !Number.isFinite(strengthValue) || strengthValue < 0) {\n throw diagnostic(`${property}.strength`, strengthValue, 'must be a finite nonnegative number', context);\n }\n const blurRadius = isSignal(options.blurRadius) ? options.blurRadius.get() : options.blurRadius ?? 0;\n if (typeof blurRadius !== 'number' || !Number.isFinite(blurRadius) || blurRadius < 0) {\n throw diagnostic(`${property}.blurRadius`, blurRadius, 'must be a finite nonnegative number', context);\n }\n const identity = strengthValue === 0 && blurRadius === 0;\n const { x, y, width, height } = options.region;\n if (\n !(\n Number.isFinite(x) &&\n Number.isFinite(y) &&\n Number.isFinite(width) &&\n Number.isFinite(height)\n ) ||\n width <= 0 ||\n height <= 0\n ) {\n throw diagnostic(`${property}.region`, options.region, 'must have finite coordinates and positive finite dimensions', context);\n }\n const map = isSignal(options.map) ? options.map.get() : options.map;\n try {\n validateTexturePaint(map);\n // Receiver preparation owns revision dependencies, before subtree execution\n // changes signal tracking to descendant consumers.\n if (!identity) borrowTextureRaster(map, () => undefined);\n }\n catch (error) {\n throw diagnostic(`${property}.map`, map, error instanceof Error ? error.message : String(error), context);\n }\n const region = Object.freeze({ x, y, width, height });\n return Object.freeze({\n executor: filterBoundaryExecutor,\n textureWarp: blurRadius === 0 ? Object.freeze({ map, strength: strengthValue, region }) : undefined,\n reverseInfluence: (output, density) => expandDisplacementInput(output, strengthValue + blurRadius, density),\n process: identity ? undefined : (source, windows) => {\n try { return processDisplacement(source, windows, map, strengthValue, region, blurRadius); }\n catch (error) {\n const failure = diagnostic(property, { strength: strengthValue, region }, `displacement processing failed: ${error instanceof Error ? error.message : String(error)}`, context);\n Object.defineProperty(failure, 'cause', { value: error });\n throw failure;\n }\n },\n } satisfies CustomPreparedFilter);\n },\n render: filterBoundaryExecutor.render,\n};\n\n/**\n * Creates a displacement filter descriptor for a primitive's style.filter list. Filtering changes\n * pixels without changing layout or hit geometry.\n *\n * @param options - Displacement texture, channel selection, and displacement scale. See\n * {@link PibblDisplacementFilterOptions} .\n * @returns A displacement filter descriptor for style.filter. See {@link PibblFilter}.\n *\n * @see {@link PibblDisplacementFilterOptions}\n * @see {@link PibblFilter}\n */\nexport function displacement(options: PibblDisplacementFilterOptions): PibblFilter {\n const definition = Object.freeze({ map: options.map, strength: options.strength, blurRadius: options.blurRadius, region: Object.freeze({ ...options.region }) });\n const value = Object.freeze({ [PIBBL_FILTER_EXECUTOR]: displacementExecutor });\n definitions.set(value, definition);\n return value;\n}\n\nfunction diagnostic(property: string, value: unknown, reason: string, context: Readonly<StyleResolutionContext>): Error {\n return layoutDiagnostic({ component: context.component, property, value, algorithm: context.algorithm, constraints: context.constraints, reason });\n}\n"],
5
+ "mappings": "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",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,4 @@
1
+ import { ReflectionGpu, type ReflectionGpuCallbacks } from "./reflection-gpu.js";
2
+ export declare class EmbossGpu extends ReflectionGpu {
3
+ constructor(callbacks?: Readonly<ReflectionGpuCallbacks>);
4
+ }
@@ -0,0 +1,39 @@
1
+ import {
2
+ ReflectionGpu
3
+ } from "./reflection-gpu.js";
4
+ const fragment = `#version 300 es
5
+ precision highp float;
6
+ uniform sampler2D scene, map;
7
+ uniform vec2 logicalOrigin, logicalSize, mapOrigin, tileSize, direction;
8
+ uniform float rotation, opacity, depth;
9
+ in vec2 uv;
10
+ out vec4 outputColor;
11
+ vec2 coordinates(vec2 logical) {
12
+ vec2 p=logical-mapOrigin;
13
+ float c=cos(rotation),s=sin(rotation);
14
+ return vec2(c*p.x+s*p.y,-s*p.x+c*p.y)/tileSize;
15
+ }
16
+ float height(vec2 p) {
17
+ vec4 field=texture(map,coordinates(p));
18
+ return dot(field.rgb,vec3(.2126,.7152,.0722))*field.a;
19
+ }
20
+ void main() {
21
+ vec4 base=texture(scene,uv);
22
+ vec2 p=logicalOrigin+uv*logicalSize;
23
+ vec2 gradient=.5*vec2(height(p+vec2(1,0))-height(p-vec2(1,0)),height(p+vec2(0,1))-height(p-vec2(0,1)));
24
+ vec3 normal=normalize(vec3(-depth*gradient,1.));
25
+ vec3 light=normalize(vec3(direction*.8,1.));
26
+ float shade=max(0.,dot(normal,light))/light.z;
27
+ // A flat map is exactly neutral. Multiply premultiplied color, preserve alpha.
28
+ outputColor=vec4(clamp(base.rgb*mix(1.,shade,opacity),vec3(0),vec3(base.a)),base.a);
29
+ }
30
+ `;
31
+ class EmbossGpu extends ReflectionGpu {
32
+ constructor(callbacks = {}) {
33
+ super(callbacks, fragment);
34
+ }
35
+ }
36
+ export {
37
+ EmbossGpu
38
+ };
39
+ //# sourceMappingURL=emboss-gpu.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/filters/emboss-gpu.ts"],
4
+ "sourcesContent": ["import {\n ReflectionGpu,\n type ReflectionGpuCallbacks,\n} from \"./reflection-gpu.js\";\n\n// Reuses the existing GPU surface/cache ownership; this shader consumes scalar\n// height instead of the reflected-light operation's pre-encoded RG slopes.\nconst fragment = `#version 300 es\nprecision highp float;\nuniform sampler2D scene, map;\nuniform vec2 logicalOrigin, logicalSize, mapOrigin, tileSize, direction;\nuniform float rotation, opacity, depth;\nin vec2 uv;\nout vec4 outputColor;\nvec2 coordinates(vec2 logical) {\n vec2 p=logical-mapOrigin;\n float c=cos(rotation),s=sin(rotation);\n return vec2(c*p.x+s*p.y,-s*p.x+c*p.y)/tileSize;\n}\nfloat height(vec2 p) {\n vec4 field=texture(map,coordinates(p));\n return dot(field.rgb,vec3(.2126,.7152,.0722))*field.a;\n}\nvoid main() {\n vec4 base=texture(scene,uv);\n vec2 p=logicalOrigin+uv*logicalSize;\n vec2 gradient=.5*vec2(height(p+vec2(1,0))-height(p-vec2(1,0)),height(p+vec2(0,1))-height(p-vec2(0,1)));\n vec3 normal=normalize(vec3(-depth*gradient,1.));\n vec3 light=normalize(vec3(direction*.8,1.));\n float shade=max(0.,dot(normal,light))/light.z;\n // A flat map is exactly neutral. Multiply premultiplied color, preserve alpha.\n outputColor=vec4(clamp(base.rgb*mix(1.,shade,opacity),vec3(0),vec3(base.a)),base.a);\n}\n`;\nexport class EmbossGpu extends ReflectionGpu {\n constructor(callbacks: Readonly<ReflectionGpuCallbacks> = {}) {\n super(callbacks, fragment);\n }\n}\n"],
5
+ "mappings": "AAAA;AAAA,EACE;AAAA,OAEK;AAIP,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BV,MAAM,kBAAkB,cAAc;AAAA,EAC3C,YAAY,YAA8C,CAAC,GAAG;AAC5D,UAAM,WAAW,QAAQ;AAAA,EAC3B;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,32 @@
1
+ import type { SignalValue } from "../lib/signals/types.js";
2
+ import { type PibblFilter } from "../lib/style/filter-types.js";
3
+ import { type TexturePaint } from "../lib/textures/texture-protocol.js";
4
+ /** Directional lighting of grayscale texture height. See {@link emboss}. */
5
+ export interface PibblEmbossFilterOptions {
6
+ /** Local texture placement region with finite coordinates and positive dimensions. See {@link TexturePaint}. */
7
+ readonly region: Readonly<{
8
+ /** Horizontal origin in local logical coordinates. See {@link PibblEmbossFilterOptions}. */
9
+ x: number;
10
+ /** Vertical origin in local logical coordinates. See {@link PibblEmbossFilterOptions}. */
11
+ y: number;
12
+ /** Positive logical region width. See {@link PibblEmbossFilterOptions}. */
13
+ width: number;
14
+ /** Positive logical region height. See {@link PibblEmbossFilterOptions}. */
15
+ height: number;
16
+ }>;
17
+ /** Height range in logical pixels, finite 0–32; default 3. See {@link emboss}. */
18
+ readonly depth?: SignalValue<number>;
19
+ /** Lighting strength, finite 0–1; default 1. Zero bypasses processing. See {@link emboss}. */
20
+ readonly strength?: SignalValue<number>;
21
+ /** Nonzero finite direction toward the light in local coordinates; default [-0.6, -0.8]. See {@link emboss}. */
22
+ readonly direction?: readonly [number, number];
23
+ }
24
+ /**
25
+ * Lights captured pixels using normals derived from a grayscale texture height map.
26
+ * Flat heights are neutral; opposing slopes brighten and darken without changing alpha or geometry.
27
+ * @param map - Mounted height texture, luminance times alpha; white is high. See {@link TexturePaint}.
28
+ * @param options - Local placement, height depth, strength, and light direction. See {@link PibblEmbossFilterOptions}.
29
+ * @returns A filter descriptor for style.filter. See {@link PibblFilter}.
30
+ * @see {@link PibblEmbossFilterOptions}
31
+ */
32
+ export declare function emboss(map: SignalValue<TexturePaint>, options: PibblEmbossFilterOptions): PibblFilter;