react-native-gtkx 0.2.0-alpha.1 → 0.3.0-alpha.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 (400) hide show
  1. package/README.md +14 -2
  2. package/dist/adw/widgets.generated.d.ts +4 -4
  3. package/dist/adw/widgets.generated.js +51 -51
  4. package/dist/adw/widgets.generated.js.map +1 -1
  5. package/dist/aliases/index.d.ts +84 -0
  6. package/dist/aliases/index.js +208 -0
  7. package/dist/aliases/index.js.map +1 -0
  8. package/dist/animated/create-animated.d.ts +2 -0
  9. package/dist/animated/create-animated.js +2 -0
  10. package/dist/animated/create-animated.js.map +1 -1
  11. package/dist/animated/index.d.ts +4 -0
  12. package/dist/animated/index.js +6 -0
  13. package/dist/animated/index.js.map +1 -1
  14. package/dist/animated/types.d.ts +1 -0
  15. package/dist/animated/types.js.map +1 -1
  16. package/dist/animated/value-animation.js +17 -4
  17. package/dist/animated/value-animation.js.map +1 -1
  18. package/dist/animated/value-xy.d.ts +41 -0
  19. package/dist/animated/value-xy.js +90 -0
  20. package/dist/animated/value-xy.js.map +1 -0
  21. package/dist/animated/value.d.ts +9 -0
  22. package/dist/animated/value.js +30 -2
  23. package/dist/animated/value.js.map +1 -1
  24. package/dist/apis/host.gtkx.js +9 -12
  25. package/dist/apis/host.gtkx.js.map +1 -1
  26. package/dist/apis/index.d.ts +4 -2
  27. package/dist/apis/index.js +2 -0
  28. package/dist/apis/index.js.map +1 -1
  29. package/dist/apis/keyboard.d.ts +60 -0
  30. package/dist/apis/keyboard.js +63 -0
  31. package/dist/apis/keyboard.js.map +1 -0
  32. package/dist/apis/log-box.d.ts +15 -0
  33. package/dist/apis/log-box.js +46 -0
  34. package/dist/apis/log-box.js.map +1 -0
  35. package/dist/apis/platform.d.ts +18 -1
  36. package/dist/apis/platform.js.map +1 -1
  37. package/dist/common/icon.d.ts +23 -0
  38. package/dist/common/icon.js +14 -0
  39. package/dist/common/icon.js.map +1 -0
  40. package/dist/common/index.d.ts +1 -0
  41. package/dist/common/index.js +25 -0
  42. package/dist/common/index.js.map +1 -1
  43. package/dist/common/widget.d.ts +1 -22
  44. package/dist/common/widget.js +75 -8
  45. package/dist/common/widget.js.map +1 -1
  46. package/dist/components/animated.d.ts +73 -7
  47. package/dist/components/animated.js +560 -45
  48. package/dist/components/animated.js.map +1 -1
  49. package/dist/components/app-registry.d.ts +26 -0
  50. package/dist/components/app-registry.js.map +1 -1
  51. package/dist/components/driven-size.d.ts +27 -0
  52. package/dist/components/driven-size.js +85 -0
  53. package/dist/components/driven-size.js.map +1 -0
  54. package/dist/components/find-node-handle.d.ts +11 -0
  55. package/dist/components/find-node-handle.js +53 -0
  56. package/dist/components/find-node-handle.js.map +1 -0
  57. package/dist/components/flat-list.d.ts +3 -2
  58. package/dist/components/flat-list.js.map +1 -1
  59. package/dist/components/frame-scheduler.d.ts +16 -0
  60. package/dist/components/frame-scheduler.js +37 -0
  61. package/dist/components/frame-scheduler.js.map +1 -0
  62. package/dist/components/host-node.d.ts +7 -0
  63. package/dist/components/host-node.js +26 -1
  64. package/dist/components/host-node.js.map +1 -1
  65. package/dist/components/image.d.ts +6 -1
  66. package/dist/components/image.js +15 -4
  67. package/dist/components/image.js.map +1 -1
  68. package/dist/components/index.d.ts +11 -5
  69. package/dist/components/index.js +7 -4
  70. package/dist/components/index.js.map +1 -1
  71. package/dist/components/measure.d.ts +63 -0
  72. package/dist/components/measure.js +150 -0
  73. package/dist/components/measure.js.map +1 -0
  74. package/dist/components/modal.d.ts +1 -1
  75. package/dist/components/press-event.d.ts +28 -0
  76. package/dist/components/press-event.js +46 -0
  77. package/dist/components/press-event.js.map +1 -0
  78. package/dist/components/pressable.d.ts +63 -7
  79. package/dist/components/pressable.js +165 -12
  80. package/dist/components/pressable.js.map +1 -1
  81. package/dist/components/rect-store.d.ts +58 -0
  82. package/dist/components/rect-store.js +124 -3
  83. package/dist/components/rect-store.js.map +1 -1
  84. package/dist/components/root.js +6 -1
  85. package/dist/components/root.js.map +1 -1
  86. package/dist/components/scroll-phase.d.ts +35 -0
  87. package/dist/components/scroll-phase.js +26 -0
  88. package/dist/components/scroll-phase.js.map +1 -0
  89. package/dist/components/scroll-view.d.ts +43 -3
  90. package/dist/components/scroll-view.js +386 -45
  91. package/dist/components/scroll-view.js.map +1 -1
  92. package/dist/components/text-input.js +9 -25
  93. package/dist/components/text-input.js.map +1 -1
  94. package/dist/components/text.d.ts +6 -2
  95. package/dist/components/text.js +68 -9
  96. package/dist/components/text.js.map +1 -1
  97. package/dist/components/use-focus.d.ts +27 -0
  98. package/dist/components/use-focus.js +116 -0
  99. package/dist/components/use-focus.js.map +1 -0
  100. package/dist/components/use-layout-child.d.ts +13 -1
  101. package/dist/components/use-layout-child.js +205 -19
  102. package/dist/components/use-layout-child.js.map +1 -1
  103. package/dist/components/view.d.ts +12 -4
  104. package/dist/components/view.js +25 -14
  105. package/dist/components/view.js.map +1 -1
  106. package/dist/components/virtualized-list.d.ts +45 -5
  107. package/dist/components/virtualized-list.js +90 -24
  108. package/dist/components/virtualized-list.js.map +1 -1
  109. package/dist/components/wheel-scroll-session.d.ts +7 -0
  110. package/dist/components/wheel-scroll-session.js +53 -0
  111. package/dist/components/wheel-scroll-session.js.map +1 -0
  112. package/dist/components/widget-retention.d.ts +35 -0
  113. package/dist/components/widget-retention.js +169 -0
  114. package/dist/components/widget-retention.js.map +1 -0
  115. package/dist/contracts.d.ts +23 -3
  116. package/dist/contracts.js.map +1 -1
  117. package/dist/dnd/context.d.ts +69 -0
  118. package/dist/dnd/context.js +149 -0
  119. package/dist/dnd/context.js.map +1 -0
  120. package/dist/dnd/draggable.d.ts +59 -0
  121. package/dist/dnd/draggable.js +149 -0
  122. package/dist/dnd/draggable.js.map +1 -0
  123. package/dist/dnd/droppable.d.ts +24 -0
  124. package/dist/dnd/droppable.js +74 -0
  125. package/dist/dnd/droppable.js.map +1 -0
  126. package/dist/dnd/gtk-controllers.d.ts +39 -0
  127. package/dist/dnd/gtk-controllers.js +110 -0
  128. package/dist/dnd/gtk-controllers.js.map +1 -0
  129. package/dist/dnd/index.d.ts +6 -0
  130. package/dist/dnd/index.js +31 -0
  131. package/dist/dnd/index.js.map +1 -0
  132. package/dist/dnd/order.d.ts +7 -0
  133. package/dist/dnd/order.js +20 -0
  134. package/dist/dnd/order.js.map +1 -0
  135. package/dist/dnd/payload.d.ts +14 -0
  136. package/dist/dnd/payload.js +41 -0
  137. package/dist/dnd/payload.js.map +1 -0
  138. package/dist/dnd/sortable.d.ts +49 -0
  139. package/dist/dnd/sortable.js +307 -0
  140. package/dist/dnd/sortable.js.map +1 -0
  141. package/dist/dnd/types.d.ts +290 -0
  142. package/dist/dnd/types.js +25 -0
  143. package/dist/dnd/types.js.map +1 -0
  144. package/dist/gesture-handler-compat/builder.d.ts +251 -0
  145. package/dist/gesture-handler-compat/builder.js +513 -0
  146. package/dist/gesture-handler-compat/builder.js.map +1 -0
  147. package/dist/gesture-handler-compat/composition.d.ts +23 -0
  148. package/dist/gesture-handler-compat/composition.js +111 -0
  149. package/dist/gesture-handler-compat/composition.js.map +1 -0
  150. package/dist/gesture-handler-compat/deciders.d.ts +3 -0
  151. package/dist/gesture-handler-compat/deciders.js +47 -0
  152. package/dist/gesture-handler-compat/deciders.js.map +1 -0
  153. package/dist/gesture-handler-compat/detector-runtime.d.ts +44 -0
  154. package/dist/gesture-handler-compat/detector-runtime.js +374 -0
  155. package/dist/gesture-handler-compat/detector-runtime.js.map +1 -0
  156. package/dist/gesture-handler-compat/detector.d.ts +22 -0
  157. package/dist/gesture-handler-compat/detector.js +104 -0
  158. package/dist/gesture-handler-compat/detector.js.map +1 -0
  159. package/dist/gesture-handler-compat/fling.d.ts +24 -0
  160. package/dist/gesture-handler-compat/fling.js +123 -0
  161. package/dist/gesture-handler-compat/fling.js.map +1 -0
  162. package/dist/gesture-handler-compat/force-touch.d.ts +13 -0
  163. package/dist/gesture-handler-compat/force-touch.js +40 -0
  164. package/dist/gesture-handler-compat/force-touch.js.map +1 -0
  165. package/dist/gesture-handler-compat/hooks.d.ts +157 -0
  166. package/dist/gesture-handler-compat/hooks.js +268 -0
  167. package/dist/gesture-handler-compat/hooks.js.map +1 -0
  168. package/dist/gesture-handler-compat/hover.d.ts +2 -0
  169. package/dist/gesture-handler-compat/hover.js +22 -0
  170. package/dist/gesture-handler-compat/hover.js.map +1 -0
  171. package/dist/gesture-handler-compat/index.d.ts +98 -0
  172. package/dist/gesture-handler-compat/index.js +255 -0
  173. package/dist/gesture-handler-compat/index.js.map +1 -0
  174. package/dist/gesture-handler-compat/long-press.d.ts +6 -0
  175. package/dist/gesture-handler-compat/long-press.js +21 -0
  176. package/dist/gesture-handler-compat/long-press.js.map +1 -0
  177. package/dist/gesture-handler-compat/manual.d.ts +2 -0
  178. package/dist/gesture-handler-compat/manual.js +18 -0
  179. package/dist/gesture-handler-compat/manual.js.map +1 -0
  180. package/dist/gesture-handler-compat/native.d.ts +7 -0
  181. package/dist/gesture-handler-compat/native.js +34 -0
  182. package/dist/gesture-handler-compat/native.js.map +1 -0
  183. package/dist/gesture-handler-compat/orchestrator.d.ts +77 -0
  184. package/dist/gesture-handler-compat/orchestrator.js +284 -0
  185. package/dist/gesture-handler-compat/orchestrator.js.map +1 -0
  186. package/dist/gesture-handler-compat/pan.d.ts +23 -0
  187. package/dist/gesture-handler-compat/pan.js +116 -0
  188. package/dist/gesture-handler-compat/pan.js.map +1 -0
  189. package/dist/gesture-handler-compat/recognizer.d.ts +268 -0
  190. package/dist/gesture-handler-compat/recognizer.js +1056 -0
  191. package/dist/gesture-handler-compat/recognizer.js.map +1 -0
  192. package/dist/gesture-handler-compat/relations.d.ts +43 -0
  193. package/dist/gesture-handler-compat/relations.js +128 -0
  194. package/dist/gesture-handler-compat/relations.js.map +1 -0
  195. package/dist/gesture-handler-compat/tap.d.ts +6 -0
  196. package/dist/gesture-handler-compat/tap.js +29 -0
  197. package/dist/gesture-handler-compat/tap.js.map +1 -0
  198. package/dist/gesture-handler-compat/touchpad.d.ts +41 -0
  199. package/dist/gesture-handler-compat/touchpad.js +64 -0
  200. package/dist/gesture-handler-compat/touchpad.js.map +1 -0
  201. package/dist/gesture-handler-compat/types.d.ts +441 -0
  202. package/dist/gesture-handler-compat/types.js +167 -0
  203. package/dist/gesture-handler-compat/types.js.map +1 -0
  204. package/dist/gtk/controllers.d.ts +39 -0
  205. package/dist/gtk/controllers.js +92 -0
  206. package/dist/gtk/controllers.js.map +1 -0
  207. package/dist/gtk/index.d.ts +3 -1
  208. package/dist/gtk/index.js +14 -1
  209. package/dist/gtk/index.js.map +1 -1
  210. package/dist/gtk/widgets.generated.d.ts +14 -14
  211. package/dist/gtk/widgets.generated.js +101 -102
  212. package/dist/gtk/widgets.generated.js.map +1 -1
  213. package/dist/gtk/window-actions.d.ts +77 -0
  214. package/dist/gtk/window-actions.js +193 -0
  215. package/dist/gtk/window-actions.js.map +1 -0
  216. package/dist/gtkx/bridge/geometry.d.ts +15 -0
  217. package/dist/gtkx/bridge/geometry.js +40 -0
  218. package/dist/gtkx/bridge/geometry.js.map +1 -0
  219. package/dist/gtkx/bridge/index.d.ts +7 -3
  220. package/dist/gtkx/bridge/index.js +12 -4
  221. package/dist/gtkx/bridge/index.js.map +1 -1
  222. package/dist/gtkx/bridge/slot-portal.d.ts +12 -0
  223. package/dist/gtkx/bridge/slot-portal.js +17 -0
  224. package/dist/gtkx/bridge/slot-portal.js.map +1 -0
  225. package/dist/gtkx/bridge/svg-node.js +10 -54
  226. package/dist/gtkx/bridge/svg-node.js.map +1 -1
  227. package/dist/gtkx/bridge/use-signal.js +2 -2
  228. package/dist/gtkx/bridge/use-signal.js.map +1 -1
  229. package/dist/gtkx/bridge/view-box.d.ts +56 -0
  230. package/dist/gtkx/bridge/view-box.js +394 -9
  231. package/dist/gtkx/bridge/view-box.js.map +1 -1
  232. package/dist/gtkx/bridge/widget-css.d.ts +17 -0
  233. package/dist/gtkx/bridge/widget-css.js +72 -0
  234. package/dist/gtkx/bridge/widget-css.js.map +1 -0
  235. package/dist/index.d.ts +3 -3
  236. package/dist/index.js +2 -2
  237. package/dist/index.js.map +1 -1
  238. package/dist/layout/driven-size.d.ts +12 -0
  239. package/dist/layout/driven-size.js +70 -0
  240. package/dist/layout/driven-size.js.map +1 -0
  241. package/dist/layout/engine.d.ts +17 -1
  242. package/dist/layout/engine.js +3 -20
  243. package/dist/layout/engine.js.map +1 -1
  244. package/dist/layout/node.d.ts +13 -0
  245. package/dist/layout/node.js +14 -0
  246. package/dist/layout/node.js.map +1 -1
  247. package/dist/layout/yoga.d.ts +3 -2
  248. package/dist/layout/yoga.js +5 -2
  249. package/dist/layout/yoga.js.map +1 -1
  250. package/dist/mcp/data/generated.d.ts +310 -91
  251. package/dist/mcp/data/generated.js +365 -90
  252. package/dist/mcp/data/generated.js.map +1 -1
  253. package/dist/mcp/server.js +1 -1
  254. package/dist/mcp/server.js.map +1 -1
  255. package/dist/metro/index.d.ts +10 -0
  256. package/dist/metro/index.js +21 -12
  257. package/dist/metro/index.js.map +1 -1
  258. package/dist/navigation/sidebar.d.ts +47 -1
  259. package/dist/navigation/sidebar.js +77 -3
  260. package/dist/navigation/sidebar.js.map +1 -1
  261. package/dist/reanimated-compat/animated-ref.d.ts +32 -0
  262. package/dist/reanimated-compat/animated-ref.js +57 -0
  263. package/dist/reanimated-compat/animated-ref.js.map +1 -0
  264. package/dist/reanimated-compat/animation.d.ts +177 -0
  265. package/dist/reanimated-compat/animation.js +540 -0
  266. package/dist/reanimated-compat/animation.js.map +1 -0
  267. package/dist/reanimated-compat/color.d.ts +28 -0
  268. package/dist/reanimated-compat/color.js +249 -0
  269. package/dist/reanimated-compat/color.js.map +1 -0
  270. package/dist/reanimated-compat/decay.d.ts +39 -0
  271. package/dist/reanimated-compat/decay.js +96 -0
  272. package/dist/reanimated-compat/decay.js.map +1 -0
  273. package/dist/reanimated-compat/easing.d.ts +30 -0
  274. package/dist/reanimated-compat/easing.js +76 -0
  275. package/dist/reanimated-compat/easing.js.map +1 -0
  276. package/dist/reanimated-compat/hooks.d.ts +14 -0
  277. package/dist/reanimated-compat/hooks.js +217 -0
  278. package/dist/reanimated-compat/hooks.js.map +1 -0
  279. package/dist/reanimated-compat/index.d.ts +258 -0
  280. package/dist/reanimated-compat/index.js +464 -0
  281. package/dist/reanimated-compat/index.js.map +1 -0
  282. package/dist/reanimated-compat/interpolation.d.ts +18 -0
  283. package/dist/reanimated-compat/interpolation.js +122 -0
  284. package/dist/reanimated-compat/interpolation.js.map +1 -0
  285. package/dist/reanimated-compat/layout-animation-config.d.ts +43 -0
  286. package/dist/reanimated-compat/layout-animation-config.js +78 -0
  287. package/dist/reanimated-compat/layout-animation-config.js.map +1 -0
  288. package/dist/reanimated-compat/layout-animation-presets.d.ts +117 -0
  289. package/dist/reanimated-compat/layout-animation-presets.js +498 -0
  290. package/dist/reanimated-compat/layout-animation-presets.js.map +1 -0
  291. package/dist/reanimated-compat/layout-animation-runtime.d.ts +21 -0
  292. package/dist/reanimated-compat/layout-animation-runtime.js +311 -0
  293. package/dist/reanimated-compat/layout-animation-runtime.js.map +1 -0
  294. package/dist/reanimated-compat/layout-animation-view.d.ts +27 -0
  295. package/dist/reanimated-compat/layout-animation-view.js +266 -0
  296. package/dist/reanimated-compat/layout-animation-view.js.map +1 -0
  297. package/dist/reanimated-compat/layout-animation.d.ts +171 -0
  298. package/dist/reanimated-compat/layout-animation.js +469 -0
  299. package/dist/reanimated-compat/layout-animation.js.map +1 -0
  300. package/dist/reanimated-compat/layout-transitions.d.ts +83 -0
  301. package/dist/reanimated-compat/layout-transitions.js +350 -0
  302. package/dist/reanimated-compat/layout-transitions.js.map +1 -0
  303. package/dist/reanimated-compat/mutable.d.ts +29 -0
  304. package/dist/reanimated-compat/mutable.js +139 -0
  305. package/dist/reanimated-compat/mutable.js.map +1 -0
  306. package/dist/reanimated-compat/props.d.ts +18 -0
  307. package/dist/reanimated-compat/props.js +111 -0
  308. package/dist/reanimated-compat/props.js.map +1 -0
  309. package/dist/reanimated-compat/scroll-handler.d.ts +119 -0
  310. package/dist/reanimated-compat/scroll-handler.js +274 -0
  311. package/dist/reanimated-compat/scroll-handler.js.map +1 -0
  312. package/dist/reanimated-compat/scroll-offset.d.ts +12 -0
  313. package/dist/reanimated-compat/scroll-offset.js +104 -0
  314. package/dist/reanimated-compat/scroll-offset.js.map +1 -0
  315. package/dist/reanimated-compat/style.d.ts +90 -0
  316. package/dist/reanimated-compat/style.js +452 -0
  317. package/dist/reanimated-compat/style.js.map +1 -0
  318. package/dist/reanimated-compat/test-timers.d.ts +28 -0
  319. package/dist/reanimated-compat/test-timers.js +136 -0
  320. package/dist/reanimated-compat/test-timers.js.map +1 -0
  321. package/dist/reanimated-compat/threads.d.ts +13 -0
  322. package/dist/reanimated-compat/threads.js +41 -0
  323. package/dist/reanimated-compat/threads.js.map +1 -0
  324. package/dist/reanimated-compat/tracking.d.ts +41 -0
  325. package/dist/reanimated-compat/tracking.js +106 -0
  326. package/dist/reanimated-compat/tracking.js.map +1 -0
  327. package/dist/reanimated-compat/updater-animations.d.ts +36 -0
  328. package/dist/reanimated-compat/updater-animations.js +273 -0
  329. package/dist/reanimated-compat/updater-animations.js.map +1 -0
  330. package/dist/responder/system.d.ts +100 -0
  331. package/dist/responder/system.js +304 -0
  332. package/dist/responder/system.js.map +1 -0
  333. package/dist/responder/touch-history.d.ts +10 -0
  334. package/dist/responder/touch-history.js +78 -0
  335. package/dist/responder/touch-history.js.map +1 -0
  336. package/dist/responder/types.d.ts +63 -0
  337. package/dist/responder/types.js +29 -0
  338. package/dist/responder/types.js.map +1 -0
  339. package/dist/responder/use-responder.d.ts +23 -0
  340. package/dist/responder/use-responder.js +317 -0
  341. package/dist/responder/use-responder.js.map +1 -0
  342. package/dist/runner/host-dev.js +4 -2
  343. package/dist/runner/host-dev.js.map +1 -1
  344. package/dist/runner/host.js +6 -2
  345. package/dist/runner/host.js.map +1 -1
  346. package/dist/runner/index.js +3 -3
  347. package/dist/runner/index.js.map +1 -1
  348. package/dist/sea/gtkx-config-module.js +2 -2
  349. package/dist/sea/gtkx-config-module.js.map +1 -1
  350. package/dist/style/absolute-insets.d.ts +26 -0
  351. package/dist/style/absolute-insets.js +113 -0
  352. package/dist/style/absolute-insets.js.map +1 -0
  353. package/dist/style/animated-size.d.ts +25 -0
  354. package/dist/style/animated-size.js +225 -0
  355. package/dist/style/animated-size.js.map +1 -0
  356. package/dist/style/box-shadow.d.ts +7 -0
  357. package/dist/style/box-shadow.js +197 -0
  358. package/dist/style/box-shadow.js.map +1 -0
  359. package/dist/style/colors.d.ts +17 -0
  360. package/dist/style/colors.js +25 -6
  361. package/dist/style/colors.js.map +1 -1
  362. package/dist/style/imperative-css.d.ts +21 -0
  363. package/dist/style/imperative-css.js +63 -0
  364. package/dist/style/imperative-css.js.map +1 -0
  365. package/dist/style/index.d.ts +4 -1
  366. package/dist/style/index.js +4 -1
  367. package/dist/style/index.js.map +1 -1
  368. package/dist/style/split-style.d.ts +5 -2
  369. package/dist/style/split-style.js +36 -3
  370. package/dist/style/split-style.js.map +1 -1
  371. package/dist/style/text-decoration.d.ts +15 -0
  372. package/dist/style/text-decoration.js +26 -0
  373. package/dist/style/text-decoration.js.map +1 -0
  374. package/dist/style/visual-css.js +37 -1
  375. package/dist/style/visual-css.js.map +1 -1
  376. package/dist/svg/gradient-geometry.js +2 -5
  377. package/dist/svg/gradient-geometry.js.map +1 -1
  378. package/dist/testing/index.js.map +1 -1
  379. package/dist/unsupported-export.d.ts +8 -0
  380. package/dist/unsupported-export.js +66 -0
  381. package/dist/unsupported-export.js.map +1 -0
  382. package/dist/vendor/react-native/pan-responder.d.ts +102 -0
  383. package/dist/vendor/react-native/pan-responder.js +196 -0
  384. package/dist/vendor/react-native/pan-responder.js.map +1 -0
  385. package/dist/vendor/react-native/touch-history-math.d.ts +18 -0
  386. package/dist/vendor/react-native/touch-history-math.js +102 -0
  387. package/dist/vendor/react-native/touch-history-math.js.map +1 -0
  388. package/dist/vite/index.d.ts +21 -8
  389. package/dist/vite/index.js +127 -82
  390. package/dist/vite/index.js.map +1 -1
  391. package/dist/vitest/index.d.ts +2 -2
  392. package/dist/vitest/index.js.map +1 -1
  393. package/dist/worklets-compat/index.d.ts +4 -0
  394. package/dist/worklets-compat/index.js +28 -0
  395. package/dist/worklets-compat/index.js.map +1 -0
  396. package/dist/worklets-compat/surface.d.ts +110 -0
  397. package/dist/worklets-compat/surface.js +153 -0
  398. package/dist/worklets-compat/surface.js.map +1 -0
  399. package/package.json +25 -9
  400. package/types.d.ts +9 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animated-size.js","sourceRoot":"","sources":["../../src/style/animated-size.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4BAA4B;AAC5B,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,gDAAgD;AAChD,2EAA2E;AAC3E,2EAA2E;AAC3E,+EAA+E;AAC/E,wEAAwE;AACxE,4EAA4E;AAC5E,YAAY;AACZ,EAAE;AACF,iEAAiE;AACjE,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAC5E,4EAA4E;AAC5E,2EAA2E;AAC3E,kEAAkE;AAClE,EAAE;AACF,oEAAoE;AACpE,8EAA8E;AAC9E,yEAAyE;AACzE,8EAA8E;AAC9E,4EAA4E;AAC5E,yEAAyE;AACzE,+DAA+D;AAC/D,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,0EAA0E;AAC1E,kEAAkE;AAClE,4EAA4E;AAC5E,4EAA4E;AAC5E,sCAAsC;AACtC,yEAAyE;AACzE,qEAAqE;AACrE,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,kEAAkE;AAClE,2EAA2E;AAC3E,+BAA+B;AAC/B,8EAA8E;AAC9E,0CAA0C;AAC1C,EAAE;AACF,8DAA8D;AAO9D,MAAM,CAAC,MAAM,eAAe,GAA4B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;AAI3E,MAAM,OAAO,GAA+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C;QACtB,0EAA0E;QAC1E,2EAA2E;QAC3E,iCAAiC;QACjC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,OAAO,CACL,+CAA+C,UAAU,CAAC,IAAI,CAAC,+BAA+B;gBAC9F,KAAK,QAAQ,CAAC,IAAI,CAAC,2DAA2D,CAC/E,CAAA;QACH,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACjC,IAAI,IAAI,KAAK,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACnC,OAAO,CACL,KAAK,QAAQ,sFAAsF;YACnG,iFAAiF,CAClF,CAAA;IACH,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,QAAQ,CAAC,KAAK,QAAQ,EAAE,CAAC;QAClD,OAAO,CACL,mGAAmG;YACnG,UAAU,CACX,CAAA;IACH,CAAC;IACD,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IAC7C,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAClD,OAAO,CACL,iDAAiD,KAAK,+CAA+C;YACrG,iFAAiF,CAClF,CAAA;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,mEAAmE;AACnE,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,OAA0B,EAC1B,QAAsB,EACb,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,IAAI,CAAA","sourcesContent":["// The second carve-out in the layout refusal: a size change that is CONFINED\n// to the node that owns it.\n//\n// The refusal itself is a cost argument and stays one — a naive `width` write\n// is a Yoga pass over the container plus its commit walk, 52 / 133 / 496 µs at\n// 5 / 60 / 300 children against a transform's 1.5 µs, and it grows with the\n// CONTAINER rather than with the animated value\n// (docs/research/animated-size.md §3). What that measurement also found is\n// that the growth is entirely in work the change does not need: re-running\n// Yoga rooted at the ANIMATED NODE instead of at the root is 6.6 µs for a leaf\n// and 23 µs with wrapped text, IDENTICAL at 5, 60 and 300 siblings, and\n// reproduces a full pass exactly — as long as the change genuinely stops at\n// the node.\n//\n// This module decides that \"as long as\". It is the same shape as\n// ./absolute-insets.ts and exists for the same reason: a rule that drifted\n// away from what Yoga actually does is the bug this design is most likely to\n// ship, so it lives in one place and tests/unit/style/animated-size.test.ts\n// runs it against the real `LayoutEngine` — every configuration is laid out\n// twice, once by a full pass and once by the subtree pass, and the rule is\n// required to say yes exactly where the two agree, on every rect.\n//\n// THE AUTHORITY IS THE LAYOUT TREE, not the updater's style object.\n// `position`, the container's `flexDirection` and its `alignItems` are almost\n// always in a sibling style entry that `useAnimatedStyle` never mentions\n// (`style={[styles.bar, useAnimatedStyle(() => ({ width: w.value }))]}`), and\n// the container's style is not in the animated component's props at all. So\n// the questions are asked of the shadow tree, of the style each node was\n// actually laid out with (layout/node.ts, `LayoutNode.style`).\n//\n// WHAT THE RULE COMES DOWN TO, per driven axis A:\n//\n// 1. the node has no `aspectRatio` (it ties A to the other axis) and no\n// `min`/`max` on A (both clamp the driven value — measured);\n// 2. the node's size on the OTHER axis does not come from its content, or\n// re-laying the subtree out at the new A would change it too and every\n// following sibling would shift;\n// 3. the container's size on A does not depend on its children, or the\n// container grows with the node and everything around it moves;\n// 4. for an in-flow node, A is the container's CROSS axis (a main-axis\n// change shifts every following sibling), the container does not wrap\n// (a cross-size change re-sizes the node's LINE and moves the lines\n// after it), and the node's resolved cross-axis alignment is\n// `flex-start` or `stretch` — `center` and `flex-end` move the node's\n// own origin as it grows;\n// 5. for an out-of-flow node, A's START edge is anchored, so the node grows\n// from an origin that does not move.\n//\n// Everything else keeps the refusal, re-argued on cost alone.\n\nimport type { LayoutNode } from \"../layout/node\"\nimport type { DimensionValue, LayoutStyle } from \"../contracts\"\n\nexport type SizeProperty = \"width\" | \"height\"\n\nexport const SIZE_PROPERTIES: readonly SizeProperty[] = [\"width\", \"height\"]\n\ntype Axis = \"horizontal\" | \"vertical\"\n\nconst AXIS_OF: Record<SizeProperty, Axis> = {\n width: \"horizontal\",\n height: \"vertical\",\n}\n\nconst SIZE_ON: Record<Axis, SizeProperty> = {\n horizontal: \"width\",\n vertical: \"height\",\n}\n\nconst OTHER_AXIS: Record<Axis, Axis> = {\n horizontal: \"vertical\",\n vertical: \"horizontal\",\n}\n\nconst START_EDGE: Record<Axis, \"left\" | \"top\"> = {\n horizontal: \"left\",\n vertical: \"top\",\n}\n\nconst END_EDGE: Record<Axis, \"right\" | \"bottom\"> = {\n horizontal: \"right\",\n vertical: \"bottom\",\n}\n\nconst MIN_ON: Record<Axis, \"minWidth\" | \"minHeight\"> = {\n horizontal: \"minWidth\",\n vertical: \"minHeight\",\n}\n\nconst MAX_ON: Record<Axis, \"maxWidth\" | \"maxHeight\"> = {\n horizontal: \"maxWidth\",\n vertical: \"maxHeight\",\n}\n\n/** Where the driven size is asked about: the node, and the root it lives under. */\nexport type DrivenSizeContext = {\n /** The animated node's own shadow-tree node. */\n node: LayoutNode\n /**\n * Whether the LAYOUT ROOT reports its own Yoga content size to GTK — an\n * `IntrinsicRoot`, i.e. React Native content mounted directly in a GTK\n * chrome slot. That is the one root shape where a size below really does\n * reach the toplevel's size request (docs/research/animated-size.md §4), so\n * under it the climb never ends in a rectangle somebody else decided and\n * nothing qualifies.\n */\n rootIsContentSized: boolean\n}\n\n// --- reading a style --------------------------------------------------------\n\nconst EMPTY: Readonly<LayoutStyle> = {}\n\nconst styleOf = (node: LayoutNode): Readonly<LayoutStyle> => node.style ?? EMPTY\n\n/** Definite in Yoga's sense: a point or a percentage, not `auto` and not absent. */\nconst isDefinite = (value: DimensionValue | undefined): boolean =>\n typeof value === \"number\" ||\n (typeof value === \"string\" && value !== \"auto\" && value.endsWith(\"%\"))\n\nconst mainAxisOf = (style: Readonly<LayoutStyle>): Axis => {\n const direction = style.flexDirection ?? \"column\"\n return direction === \"row\" || direction === \"row-reverse\"\n ? \"horizontal\"\n : \"vertical\"\n}\n\nconst isAbsolute = (style: Readonly<LayoutStyle>): boolean =>\n style.position === \"absolute\"\n\n// `flex: N` is Yoga's shorthand and it resolves flexBasis to zero, which is\n// what makes `flex: 1` a size that comes from the container rather than from\n// the content. A bare `flexGrow` leaves flexBasis `auto`, so the final size is\n// content PLUS a share of the free space — and the content half is exactly\n// what disqualifies it.\nconst growsFromContainer = (style: Readonly<LayoutStyle>): boolean => {\n const flex = style.flex ?? 0\n if (flex > 0) {\n return true\n }\n return (style.flexGrow ?? 0) > 0 && isDefinite(style.flexBasis)\n}\n\n/** The cross-axis alignment this node resolves to inside `container`. */\nconst resolvedAlign = (\n style: Readonly<LayoutStyle>,\n container: Readonly<LayoutStyle>,\n): string => {\n const own = style.alignSelf ?? \"auto\"\n return own === \"auto\" ? (container.alignItems ?? \"stretch\") : own\n}\n\n// --- the question the rule is made of ---------------------------------------\n\n// A climb, so it terminates; nothing in a real tree comes close, and a\n// malformed one must not hang a frame.\nconst MAX_CLIMB = 64\n\n/**\n * Whether `node`'s own size on `axis` can be changed by its CHILDREN.\n *\n * Asked of the container (can the animated node push it around?) and, on the\n * other axis, of the animated node itself (can its own re-laid-out subtree\n * push it around?). The answers are the same list: a definite size from its\n * own style, a size stretched or grown from its container, or an out-of-flow\n * box anchored on both edges — and the climb only continues where the size is\n * inherited from above.\n */\nconst sizeIsIndependentOfContent = (\n node: LayoutNode | null,\n axis: Axis,\n rootIsContentSized: boolean,\n depth = 0,\n): boolean => {\n if (node === null) {\n // Past the engine root. `Root` is laid out against a viewport — a definite\n // rectangle it adopts whole — and an `IntrinsicRoot` measures its content\n // instead, which is the one case where the climb ends in a no.\n return !rootIsContentSized\n }\n if (depth >= MAX_CLIMB) {\n return false\n }\n const style = styleOf(node)\n if (isDefinite(style[SIZE_ON[axis]])) {\n return true\n }\n if (isAbsolute(style)) {\n // Anchored on both edges: the size is the distance between them, which is\n // the container's business and not its children's.\n return (\n isDefinite(style[START_EDGE[axis]]) && isDefinite(style[END_EDGE[axis]])\n )\n }\n const parent = node.parent\n if (parent === null) {\n // The engine root itself: `calculateLayout` is given the viewport as\n // available space, and it fills it — unless the root is the one that\n // measures its content instead.\n return !rootIsContentSized\n }\n const container = styleOf(parent)\n if (axis === mainAxisOf(container)) {\n return (\n growsFromContainer(style) &&\n sizeIsIndependentOfContent(parent, axis, rootIsContentSized, depth + 1)\n )\n }\n // The container's cross axis: `stretch` hands the node the container's own\n // content box, so the question simply moves up one level. A wrapping\n // container stretches to the LINE instead, which its siblings decide, so it\n // stops here.\n if (\n (container.flexWrap ?? \"nowrap\") !== \"nowrap\" ||\n resolvedAlign(style, container) !== \"stretch\"\n ) {\n return false\n }\n return sizeIsIndependentOfContent(parent, axis, rootIsContentSized, depth + 1)\n}\n\n// --- the rule ---------------------------------------------------------------\n\n/**\n * Why `property` cannot be driven on this node — the sentence a warning needs\n * — or null when it CAN be, in which case the driven size goes into the rect\n * store as an override and the node's own subtree is re-laid-out pinned to it.\n */\nexport const drivenSizeRefusal = (\n { node, rootIsContentSized }: DrivenSizeContext,\n property: SizeProperty,\n): string | null => {\n const axis = AXIS_OF[property]\n const other = OTHER_AXIS[axis]\n const style = styleOf(node)\n\n if (style.aspectRatio !== undefined) {\n return (\n \"the node has an `aspectRatio`, which derives its \" +\n `\\`${SIZE_ON[other]}\\` from its \\`${property}\\` — so the change is not confined to one axis`\n )\n }\n if (isDefinite(style[MIN_ON[axis]]) || isDefinite(style[MAX_ON[axis]])) {\n return (\n `the node has a \\`${MIN_ON[axis]}\\`/\\`${MAX_ON[axis]}\\`, which clamps the driven value — what is on ` +\n \"screen would stop following the animation\"\n )\n }\n if (!sizeIsIndependentOfContent(node, other, rootIsContentSized)) {\n return (\n `the node's \\`${SIZE_ON[other]}\\` comes from its own content, so re-laying its subtree out at a new ` +\n `\\`${property}\\` would change the \\`${SIZE_ON[other]}\\` too and move every sibling after it`\n )\n }\n\n const parent = node.parent\n if (parent === null) {\n return \"the node is a layout root, whose size is the rectangle GTK hands it rather than a style\"\n }\n if (!sizeIsIndependentOfContent(parent, axis, rootIsContentSized)) {\n return rootIsContentSized\n ? `the container's \\`${property}\\` is derived from its children, up to an \\`IntrinsicRoot\\` that reports ` +\n \"its content size to GTK — so a size change here really does reach the window's own size request\"\n : `the container's \\`${property}\\` is derived from its children, so the node growing would grow the ` +\n \"container and move everything around it\"\n }\n\n if (isAbsolute(style)) {\n // Out of flow: no sibling can be shifted and the container's content size\n // does not include it, so the only question left is whether the node grows\n // from an origin that stays put.\n if (!isDefinite(style[START_EDGE[axis]])) {\n return (\n `the node is absolutely positioned with no \\`${START_EDGE[axis]}\\`, so it is anchored by its ` +\n `\\`${END_EDGE[axis]}\\` edge or by its static position and growing it MOVES it`\n )\n }\n return null\n }\n\n const container = styleOf(parent)\n if (axis === mainAxisOf(container)) {\n return (\n `\\`${property}\\` is the container's MAIN axis, so growing the node pushes every following sibling ` +\n \"along — that is a layout pass over the container, which is what costs 52–496 µs\"\n )\n }\n if ((container.flexWrap ?? \"nowrap\") !== \"nowrap\") {\n return (\n \"the container wraps, so a change on its cross axis re-sizes the node's LINE and moves every line \" +\n \"after it\"\n )\n }\n const align = resolvedAlign(style, container)\n if (align !== \"flex-start\" && align !== \"stretch\") {\n return (\n `the node's resolved cross-axis alignment is \\`${align}\\`, not \\`flex-start\\` or \\`stretch\\`, so it ` +\n \"grows about its centre or its far edge and its own position moves with its size\"\n )\n }\n return null\n}\n\n/** Whether `property` can be driven at frame rate on this node. */\nexport const canDriveSize = (\n context: DrivenSizeContext,\n property: SizeProperty,\n): boolean => drivenSizeRefusal(context, property) === null\n"]}
@@ -0,0 +1,7 @@
1
+ import type { BoxShadowValue } from "../contracts";
2
+ /**
3
+ * Renders RN's `boxShadow` as a GTK CSS `box-shadow` value, or null when
4
+ * nothing usable came out of it (the caller then emits no declaration).
5
+ * Both RN forms are accepted; the string is parsed rather than forwarded.
6
+ */
7
+ export declare const boxShadowToCss: (value: string | readonly BoxShadowValue[]) => string | null;
@@ -0,0 +1,197 @@
1
+ // Compiles React Native's `boxShadow` into a GTK4 CSS `box-shadow` value.
2
+ // Pure module — no bridge imports, unit-testable on any OS.
3
+ //
4
+ // WHY this is not a passthrough of the string form. RN accepts both a CSS
5
+ // string and a structured array, and the string is the form apps actually
6
+ // write. Handing that string straight to GTK would work for the easy cases
7
+ // and fail silently for the ones that matter here: a `PlatformColor` becomes
8
+ // `var(--card-shade-color)` only after ./colors.ts has seen it, a named
9
+ // colour like `rebeccapurple` is not in GTK's vocabulary at all, and an
10
+ // unparseable value would poison the whole declaration block with a GTK CSS
11
+ // warning rather than being dropped the way an invalid `backgroundColor`
12
+ // already is. Parsing here means both forms take the same path, colours go
13
+ // through the same normalizer as every other colour prop, and a bad shadow
14
+ // costs one dev warning instead of the rest of the style.
15
+ //
16
+ // What GTK4 CSS supports, and therefore what this emits: offset-x offset-y
17
+ // [blur] [spread] [color], plus the `inset` keyword, comma-separated. That
18
+ // is the same grammar as CSS, so the ordering rule is CSS's — the FIRST
19
+ // shadow paints on top — and RN follows it too.
20
+ import { parseColor } from "./colors";
21
+ import { warnOnce } from "./dev-warning";
22
+ /** RN's own shadow-length grammar, from `processBoxShadow.js`: a bare number
23
+ * or a number with `px`, nothing else. No percentages, no em — matching it
24
+ * exactly means a style that RN rejects is rejected here too, rather than
25
+ * quietly working on one platform. */
26
+ const LENGTH = /^[+-]?(\d*\.?\d+)(px)?$/;
27
+ const length = (value) => {
28
+ if (typeof value === "number") {
29
+ return Number.isFinite(value) ? `${value}px` : null;
30
+ }
31
+ const trimmed = value.trim();
32
+ const match = LENGTH.exec(trimmed);
33
+ return match ? `${match[1]}px` : null;
34
+ };
35
+ /** Blur is the one length CSS (and RN's parser) refuses to take negative. */
36
+ const nonNegativeLength = (value) => {
37
+ const rendered = length(value);
38
+ if (rendered === null || rendered.startsWith("-")) {
39
+ return null;
40
+ }
41
+ return rendered;
42
+ };
43
+ /** Splits on commas that are not inside parentheses, so `rgba(0, 0, 0, .5)`
44
+ * stays one token. */
45
+ const splitShadows = (value) => {
46
+ const parts = [];
47
+ let depth = 0;
48
+ let current = "";
49
+ for (const char of value) {
50
+ if (char === "(") {
51
+ depth += 1;
52
+ }
53
+ else if (char === ")") {
54
+ depth = Math.max(0, depth - 1);
55
+ }
56
+ if (char === "," && depth === 0) {
57
+ parts.push(current);
58
+ current = "";
59
+ continue;
60
+ }
61
+ current += char;
62
+ }
63
+ parts.push(current);
64
+ return parts.map((part) => part.trim()).filter((part) => part !== "");
65
+ };
66
+ /** Same rule as splitShadows, one level down: whitespace outside
67
+ * parentheses separates a shadow's own components. */
68
+ const splitTokens = (shadow) => {
69
+ const tokens = [];
70
+ let depth = 0;
71
+ let current = "";
72
+ for (const char of shadow) {
73
+ if (char === "(") {
74
+ depth += 1;
75
+ }
76
+ else if (char === ")") {
77
+ depth = Math.max(0, depth - 1);
78
+ }
79
+ if (/\s/.test(char) && depth === 0) {
80
+ if (current !== "") {
81
+ tokens.push(current);
82
+ current = "";
83
+ }
84
+ continue;
85
+ }
86
+ current += char;
87
+ }
88
+ if (current !== "") {
89
+ tokens.push(current);
90
+ }
91
+ return tokens;
92
+ };
93
+ /**
94
+ * Parses one CSS shadow into the structured form. Returns null when the
95
+ * shadow is not something CSS (or RN) would accept: too few or too many
96
+ * lengths, two colours, an unparseable token.
97
+ */
98
+ const parseShadow = (shadow) => {
99
+ const tokens = splitTokens(shadow);
100
+ const lengths = [];
101
+ let color;
102
+ let inset = false;
103
+ for (const token of tokens) {
104
+ if (token.toLowerCase() === "inset") {
105
+ if (inset) {
106
+ return null;
107
+ }
108
+ inset = true;
109
+ continue;
110
+ }
111
+ if (length(token) !== null) {
112
+ lengths.push(token);
113
+ continue;
114
+ }
115
+ if (color !== undefined) {
116
+ return null;
117
+ }
118
+ color = token;
119
+ }
120
+ // CSS requires offset-x and offset-y and allows blur and spread after
121
+ // them; anything else is a malformed shadow.
122
+ if (lengths.length < 2 || lengths.length > 4) {
123
+ return null;
124
+ }
125
+ return {
126
+ offsetX: lengths[0],
127
+ offsetY: lengths[1],
128
+ ...(lengths[2] !== undefined ? { blurRadius: lengths[2] } : {}),
129
+ ...(lengths[3] !== undefined ? { spreadDistance: lengths[3] } : {}),
130
+ ...(color !== undefined ? { color } : {}),
131
+ ...(inset ? { inset: true } : {}),
132
+ };
133
+ };
134
+ /** One structured shadow as a GTK CSS value, or null when a part of it is
135
+ * not usable. */
136
+ const shadowToCss = (shadow) => {
137
+ const offsetX = length(shadow.offsetX);
138
+ const offsetY = length(shadow.offsetY);
139
+ if (offsetX === null || offsetY === null) {
140
+ return null;
141
+ }
142
+ const parts = [];
143
+ if (shadow.inset === true) {
144
+ parts.push("inset");
145
+ }
146
+ parts.push(offsetX, offsetY);
147
+ if (shadow.blurRadius !== undefined) {
148
+ const blur = nonNegativeLength(shadow.blurRadius);
149
+ if (blur === null) {
150
+ return null;
151
+ }
152
+ parts.push(blur);
153
+ }
154
+ if (shadow.spreadDistance !== undefined) {
155
+ // CSS positions spread after blur, so a spread with no blur needs an
156
+ // explicit zero blur rather than silently becoming one.
157
+ if (shadow.blurRadius === undefined) {
158
+ parts.push("0px");
159
+ }
160
+ const spread = length(shadow.spreadDistance);
161
+ if (spread === null) {
162
+ return null;
163
+ }
164
+ parts.push(spread);
165
+ }
166
+ // RN's documented deviation from CSS: an omitted shadow colour is BLACK,
167
+ // not the inherited `currentColor`. Emitting it explicitly is what keeps
168
+ // this platform on RN's side of that difference — leaving it out would
169
+ // silently hand the app CSS's behaviour instead.
170
+ const parsed = parseColor(shadow.color ?? "black");
171
+ if (parsed === null) {
172
+ return null;
173
+ }
174
+ parts.push(parsed);
175
+ return parts.join(" ");
176
+ };
177
+ /**
178
+ * Renders RN's `boxShadow` as a GTK CSS `box-shadow` value, or null when
179
+ * nothing usable came out of it (the caller then emits no declaration).
180
+ * Both RN forms are accepted; the string is parsed rather than forwarded.
181
+ */
182
+ export const boxShadowToCss = (value) => {
183
+ const shadows = typeof value === "string"
184
+ ? splitShadows(value).map(parseShadow)
185
+ : value.map((shadow) => shadow);
186
+ const rendered = [];
187
+ for (const shadow of shadows) {
188
+ const css = shadow === null ? null : shadowToCss(shadow);
189
+ if (css === null) {
190
+ warnOnce(`invalid-box-shadow:${JSON.stringify(value)}`, `[react-native-gtkx] Invalid boxShadow ${JSON.stringify(value)} — declaration dropped`);
191
+ return null;
192
+ }
193
+ rendered.push(css);
194
+ }
195
+ return rendered.length > 0 ? rendered.join(", ") : null;
196
+ };
197
+ //# sourceMappingURL=box-shadow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"box-shadow.js","sourceRoot":"","sources":["../../src/style/box-shadow.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,4DAA4D;AAC5D,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,2EAA2E;AAC3E,6EAA6E;AAC7E,wEAAwE;AACxE,wEAAwE;AACxE,4EAA4E;AAC5E,yEAAyE;AACzE,2EAA2E;AAC3E,2EAA2E;AAC3E,0DAA0D;AAC1D,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,wEAAwE;AACxE,gDAAgD;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC;;;uCAGuC;AACvC,MAAM,MAAM,GAAG,yBAAyB,CAAA;AAExC,MAAM,MAAM,GAAG,CAAC,KAAsB,EAAiB,EAAE;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;IACrD,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;IAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,OAA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AAI,OAAO,CAAC,CAAA;IAClD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,IAAI,CAAA;IACb,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAClB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACxB,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAyC,EAC1B,EAAE;IACjB,MAAM,OAAO,GACX,OAAO,KAAK,KAAK,QAAQ;QACvB,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC;QACtC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,CAAA;IACnC,MAAM,QAAQ,GAAa,EAAE,CAAA;IAC7B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,GAAG,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;QACxD,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACjB,QAAQ,CACN,sBAAsB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,EAC7C,yCAAyC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,wBAAwB,CACvF,CAAA;YACD,OAAO,IAAI,CAAA;QACb,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpB,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACzD,CAAC,CAAA","sourcesContent":["// Compiles React Native's `boxShadow` into a GTK4 CSS `box-shadow` value.\n// Pure module — no bridge imports, unit-testable on any OS.\n//\n// WHY this is not a passthrough of the string form. RN accepts both a CSS\n// string and a structured array, and the string is the form apps actually\n// write. Handing that string straight to GTK would work for the easy cases\n// and fail silently for the ones that matter here: a `PlatformColor` becomes\n// `var(--card-shade-color)` only after ./colors.ts has seen it, a named\n// colour like `rebeccapurple` is not in GTK's vocabulary at all, and an\n// unparseable value would poison the whole declaration block with a GTK CSS\n// warning rather than being dropped the way an invalid `backgroundColor`\n// already is. Parsing here means both forms take the same path, colours go\n// through the same normalizer as every other colour prop, and a bad shadow\n// costs one dev warning instead of the rest of the style.\n//\n// What GTK4 CSS supports, and therefore what this emits: offset-x offset-y\n// [blur] [spread] [color], plus the `inset` keyword, comma-separated. That\n// is the same grammar as CSS, so the ordering rule is CSS's — the FIRST\n// shadow paints on top — and RN follows it too.\n\nimport type { BoxShadowValue } from \"../contracts\"\nimport { parseColor } from \"./colors\"\nimport { warnOnce } from \"./dev-warning\"\n\n/** RN's own shadow-length grammar, from `processBoxShadow.js`: a bare number\n * or a number with `px`, nothing else. No percentages, no em — matching it\n * exactly means a style that RN rejects is rejected here too, rather than\n * quietly working on one platform. */\nconst LENGTH = /^[+-]?(\\d*\\.?\\d+)(px)?$/\n\nconst length = (value: number | string): string | null => {\n if (typeof value === \"number\") {\n return Number.isFinite(value) ? `${value}px` : null\n }\n const trimmed = value.trim()\n const match = LENGTH.exec(trimmed)\n return match ? `${match[1]}px` : null\n}\n\n/** Blur is the one length CSS (and RN's parser) refuses to take negative. */\nconst nonNegativeLength = (value: number | string): string | null => {\n const rendered = length(value)\n if (rendered === null || rendered.startsWith(\"-\")) {\n return null\n }\n return rendered\n}\n\n/** Splits on commas that are not inside parentheses, so `rgba(0, 0, 0, .5)`\n * stays one token. */\nconst splitShadows = (value: string): string[] => {\n const parts: string[] = []\n let depth = 0\n let current = \"\"\n for (const char of value) {\n if (char === \"(\") {\n depth += 1\n } else if (char === \")\") {\n depth = Math.max(0, depth - 1)\n }\n if (char === \",\" && depth === 0) {\n parts.push(current)\n current = \"\"\n continue\n }\n current += char\n }\n parts.push(current)\n return parts.map((part) => part.trim()).filter((part) => part !== \"\")\n}\n\n/** Same rule as splitShadows, one level down: whitespace outside\n * parentheses separates a shadow's own components. */\nconst splitTokens = (shadow: string): string[] => {\n const tokens: string[] = []\n let depth = 0\n let current = \"\"\n for (const char of shadow) {\n if (char === \"(\") {\n depth += 1\n } else if (char === \")\") {\n depth = Math.max(0, depth - 1)\n }\n if (/\\s/.test(char) && depth === 0) {\n if (current !== \"\") {\n tokens.push(current)\n current = \"\"\n }\n continue\n }\n current += char\n }\n if (current !== \"\") {\n tokens.push(current)\n }\n return tokens\n}\n\n/**\n * Parses one CSS shadow into the structured form. Returns null when the\n * shadow is not something CSS (or RN) would accept: too few or too many\n * lengths, two colours, an unparseable token.\n */\nconst parseShadow = (shadow: string): BoxShadowValue | null => {\n const tokens = splitTokens(shadow)\n const lengths: (number | string)[] = []\n let color: string | undefined\n let inset = false\n for (const token of tokens) {\n if (token.toLowerCase() === \"inset\") {\n if (inset) {\n return null\n }\n inset = true\n continue\n }\n if (length(token) !== null) {\n lengths.push(token)\n continue\n }\n if (color !== undefined) {\n return null\n }\n color = token\n }\n // CSS requires offset-x and offset-y and allows blur and spread after\n // them; anything else is a malformed shadow.\n if (lengths.length < 2 || lengths.length > 4) {\n return null\n }\n return {\n offsetX: lengths[0]!,\n offsetY: lengths[1]!,\n ...(lengths[2] !== undefined ? { blurRadius: lengths[2] } : {}),\n ...(lengths[3] !== undefined ? { spreadDistance: lengths[3] } : {}),\n ...(color !== undefined ? { color } : {}),\n ...(inset ? { inset: true } : {}),\n }\n}\n\n/** One structured shadow as a GTK CSS value, or null when a part of it is\n * not usable. */\nconst shadowToCss = (shadow: BoxShadowValue): string | null => {\n const offsetX = length(shadow.offsetX)\n const offsetY = length(shadow.offsetY)\n if (offsetX === null || offsetY === null) {\n return null\n }\n const parts: string[] = []\n if (shadow.inset === true) {\n parts.push(\"inset\")\n }\n parts.push(offsetX, offsetY)\n if (shadow.blurRadius !== undefined) {\n const blur = nonNegativeLength(shadow.blurRadius)\n if (blur === null) {\n return null\n }\n parts.push(blur)\n }\n if (shadow.spreadDistance !== undefined) {\n // CSS positions spread after blur, so a spread with no blur needs an\n // explicit zero blur rather than silently becoming one.\n if (shadow.blurRadius === undefined) {\n parts.push(\"0px\")\n }\n const spread = length(shadow.spreadDistance)\n if (spread === null) {\n return null\n }\n parts.push(spread)\n }\n // RN's documented deviation from CSS: an omitted shadow colour is BLACK,\n // not the inherited `currentColor`. Emitting it explicitly is what keeps\n // this platform on RN's side of that difference — leaving it out would\n // silently hand the app CSS's behaviour instead.\n const parsed = parseColor(shadow.color ?? \"black\")\n if (parsed === null) {\n return null\n }\n parts.push(parsed)\n return parts.join(\" \")\n}\n\n/**\n * Renders RN's `boxShadow` as a GTK CSS `box-shadow` value, or null when\n * nothing usable came out of it (the caller then emits no declaration).\n * Both RN forms are accepted; the string is parsed rather than forwarded.\n */\nexport const boxShadowToCss = (\n value: string | readonly BoxShadowValue[],\n): string | null => {\n const shadows =\n typeof value === \"string\"\n ? splitShadows(value).map(parseShadow)\n : value.map((shadow) => shadow)\n const rendered: string[] = []\n for (const shadow of shadows) {\n const css = shadow === null ? null : shadowToCss(shadow)\n if (css === null) {\n warnOnce(\n `invalid-box-shadow:${JSON.stringify(value)}`,\n `[react-native-gtkx] Invalid boxShadow ${JSON.stringify(value)} — declaration dropped`,\n )\n return null\n }\n rendered.push(css)\n }\n return rendered.length > 0 ? rendered.join(\", \") : null\n}\n"]}
@@ -1,3 +1,20 @@
1
+ /** A parsed colour: 0-255 channels, 0-1 alpha. */
2
+ export type Rgba = {
3
+ r: number;
4
+ g: number;
5
+ b: number;
6
+ a: number;
7
+ };
8
+ /**
9
+ * Parses a React Native color string into numeric channels.
10
+ *
11
+ * Returns null for anything that has no fixed value at parse time — the
12
+ * `var(--name)` and `@named` forms {@link parseColor} passes through to GTK,
13
+ * which resolves them against the live theme. Callers that need to compute
14
+ * WITH a colour (interpolation, blending) have to refuse those; callers that
15
+ * only need to hand it to GTK should use {@link parseColor} instead.
16
+ */
17
+ export declare const parseColorToRgba: (value: string) => Rgba | null;
1
18
  /**
2
19
  * Parses a React Native color string into a GTK4 CSS color value.
3
20
  * Returns null for values that cannot be understood.
@@ -313,6 +313,30 @@ const parseColorFunction = (input) => {
313
313
  };
314
314
  const CSS_VARIABLE_PATTERN = /^var\(--[\w-]+.*\)$/i;
315
315
  const GTK_NAMED_COLOR_PATTERN = /^@[A-Za-z_][\w-]*$/;
316
+ /**
317
+ * Parses a React Native color string into numeric channels.
318
+ *
319
+ * Returns null for anything that has no fixed value at parse time — the
320
+ * `var(--name)` and `@named` forms {@link parseColor} passes through to GTK,
321
+ * which resolves them against the live theme. Callers that need to compute
322
+ * WITH a colour (interpolation, blending) have to refuse those; callers that
323
+ * only need to hand it to GTK should use {@link parseColor} instead.
324
+ */
325
+ export const parseColorToRgba = (value) => {
326
+ if (typeof value !== "string") {
327
+ return null;
328
+ }
329
+ const input = value.trim();
330
+ if (input === "") {
331
+ return null;
332
+ }
333
+ const lower = input.toLowerCase();
334
+ if (lower === "transparent") {
335
+ return { r: 0, g: 0, b: 0, a: 0 };
336
+ }
337
+ const named = NAMED_COLORS[lower];
338
+ return parseHex(named ?? input) ?? parseColorFunction(input);
339
+ };
316
340
  /**
317
341
  * Parses a React Native color string into a GTK4 CSS color value.
318
342
  * Returns null for values that cannot be understood.
@@ -333,12 +357,7 @@ export const parseColor = (value) => {
333
357
  if (GTK_NAMED_COLOR_PATTERN.test(input)) {
334
358
  return input;
335
359
  }
336
- const lower = input.toLowerCase();
337
- if (lower === "transparent") {
338
- return "rgba(0, 0, 0, 0)";
339
- }
340
- const named = NAMED_COLORS[lower];
341
- const rgba = parseHex(named ?? input) ?? parseColorFunction(input);
360
+ const rgba = parseColorToRgba(input);
342
361
  return rgba === null ? null : formatRgba(rgba);
343
362
  };
344
363
  const toCssVariableName = (name) => name.startsWith("--") ? name : `--${name}`;
@@ -1 +1 @@
1
- {"version":3,"file":"colors.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AC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAA;IAC9E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;IACnE,CAAC;IACD,IAAI,UAAU,GAAkB,IAAI,CAAA;IACpC,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;QAC7B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,4DAA4D;YAC5D,UAAU,GAAG,IAAI,CAAA;YACjB,SAAQ;QACV,CAAC;QACD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAA;QACxC,UAAU;YACR,UAAU,KAAK,IAAI;gBACjB,CAAC,CAAC,OAAO,QAAQ,GAAG;gBACpB,CAAC,CAAC,OAAO,QAAQ,KAAK,UAAU,GAAG,CAAA;IACzC,CAAC;IACD,OAAO,UAAU,IAAI,EAAE,CAAA;AACzB,CAAC,CAAA","sourcesContent":["// Pure color handling: parses React Native color strings and normalizes them\n// into GTK4 CSS color values. No bridge imports — unit-testable on any OS.\n//\n// Every parseable color is normalized to `rgb(r, g, b)` / `rgba(r, g, b, a)`\n// so the output does not depend on which color syntaxes the GTK CSS parser of\n// a particular version accepts. Two values pass through untouched:\n// - `var(--name[, fallback])` — CSS variables (GTK 4.16+, Adwaita palette)\n// - `@name` — legacy GTK named colors (`@define-color` references)\n\n// CSS Color Module Level 4 named colors (the set React Native supports).\nconst NAMED_COLORS: Record<string, string> = {\n aliceblue: \"#f0f8ff\",\n antiquewhite: \"#faebd7\",\n aqua: \"#00ffff\",\n aquamarine: \"#7fffd4\",\n azure: \"#f0ffff\",\n beige: \"#f5f5dc\",\n bisque: \"#ffe4c4\",\n black: \"#000000\",\n blanchedalmond: \"#ffebcd\",\n blue: \"#0000ff\",\n blueviolet: \"#8a2be2\",\n brown: \"#a52a2a\",\n burlywood: \"#deb887\",\n cadetblue: \"#5f9ea0\",\n chartreuse: \"#7fff00\",\n chocolate: \"#d2691e\",\n coral: \"#ff7f50\",\n cornflowerblue: \"#6495ed\",\n cornsilk: \"#fff8dc\",\n crimson: \"#dc143c\",\n cyan: \"#00ffff\",\n darkblue: \"#00008b\",\n darkcyan: \"#008b8b\",\n darkgoldenrod: \"#b8860b\",\n darkgray: \"#a9a9a9\",\n darkgreen: \"#006400\",\n darkgrey: \"#a9a9a9\",\n darkkhaki: \"#bdb76b\",\n darkmagenta: \"#8b008b\",\n darkolivegreen: \"#556b2f\",\n darkorange: \"#ff8c00\",\n darkorchid: \"#9932cc\",\n darkred: \"#8b0000\",\n darksalmon: \"#e9967a\",\n darkseagreen: \"#8fbc8f\",\n darkslateblue: \"#483d8b\",\n darkslategray: \"#2f4f4f\",\n darkslategrey: \"#2f4f4f\",\n darkturquoise: \"#00ced1\",\n darkviolet: \"#9400d3\",\n deeppink: \"#ff1493\",\n deepskyblue: \"#00bfff\",\n dimgray: \"#696969\",\n dimgrey: \"#696969\",\n dodgerblue: \"#1e90ff\",\n firebrick: \"#b22222\",\n floralwhite: \"#fffaf0\",\n forestgreen: \"#228b22\",\n fuchsia: \"#ff00ff\",\n gainsboro: \"#dcdcdc\",\n ghostwhite: \"#f8f8ff\",\n gold: \"#ffd700\",\n goldenrod: \"#daa520\",\n gray: \"#808080\",\n green: \"#008000\",\n greenyellow: \"#adff2f\",\n grey: \"#808080\",\n honeydew: \"#f0fff0\",\n hotpink: \"#ff69b4\",\n indianred: \"#cd5c5c\",\n indigo: \"#4b0082\",\n ivory: \"#fffff0\",\n khaki: \"#f0e68c\",\n lavender: \"#e6e6fa\",\n lavenderblush: \"#fff0f5\",\n lawngreen: \"#7cfc00\",\n lemonchiffon: \"#fffacd\",\n lightblue: \"#add8e6\",\n lightcoral: \"#f08080\",\n lightcyan: \"#e0ffff\",\n lightgoldenrodyellow: \"#fafad2\",\n lightgray: \"#d3d3d3\",\n lightgreen: \"#90ee90\",\n lightgrey: \"#d3d3d3\",\n lightpink: \"#ffb6c1\",\n lightsalmon: \"#ffa07a\",\n lightseagreen: \"#20b2aa\",\n lightskyblue: \"#87cefa\",\n lightslategray: \"#778899\",\n lightslategrey: \"#778899\",\n lightsteelblue: \"#b0c4de\",\n lightyellow: \"#ffffe0\",\n lime: \"#00ff00\",\n limegreen: \"#32cd32\",\n linen: \"#faf0e6\",\n magenta: \"#ff00ff\",\n maroon: \"#800000\",\n mediumaquamarine: \"#66cdaa\",\n mediumblue: \"#0000cd\",\n mediumorchid: \"#ba55d3\",\n mediumpurple: \"#9370db\",\n mediumseagreen: \"#3cb371\",\n mediumslateblue: \"#7b68ee\",\n mediumspringgreen: \"#00fa9a\",\n mediumturquoise: \"#48d1cc\",\n mediumvioletred: \"#c71585\",\n midnightblue: \"#191970\",\n mintcream: \"#f5fffa\",\n mistyrose: \"#ffe4e1\",\n moccasin: \"#ffe4b5\",\n navajowhite: \"#ffdead\",\n navy: \"#000080\",\n oldlace: \"#fdf5e6\",\n olive: \"#808000\",\n olivedrab: \"#6b8e23\",\n orange: \"#ffa500\",\n orangered: \"#ff4500\",\n orchid: \"#da70d6\",\n palegoldenrod: \"#eee8aa\",\n palegreen: \"#98fb98\",\n paleturquoise: \"#afeeee\",\n palevioletred: \"#db7093\",\n papayawhip: \"#ffefd5\",\n peachpuff: \"#ffdab9\",\n peru: \"#cd853f\",\n pink: \"#ffc0cb\",\n plum: \"#dda0dd\",\n powderblue: \"#b0e0e6\",\n purple: \"#800080\",\n rebeccapurple: \"#663399\",\n red: \"#ff0000\",\n rosybrown: \"#bc8f8f\",\n royalblue: \"#4169e1\",\n saddlebrown: \"#8b4513\",\n salmon: \"#fa8072\",\n sandybrown: \"#f4a460\",\n seagreen: \"#2e8b57\",\n seashell: \"#fff5ee\",\n sienna: \"#a0522d\",\n silver: \"#c0c0c0\",\n skyblue: \"#87ceeb\",\n slateblue: \"#6a5acd\",\n slategray: \"#708090\",\n slategrey: \"#708090\",\n snow: \"#fffafa\",\n springgreen: \"#00ff7f\",\n steelblue: \"#4682b4\",\n tan: \"#d2b48c\",\n teal: \"#008080\",\n thistle: \"#d8bfd8\",\n tomato: \"#ff6347\",\n turquoise: \"#40e0d0\",\n violet: \"#ee82ee\",\n wheat: \"#f5deb3\",\n white: \"#ffffff\",\n whitesmoke: \"#f5f5f5\",\n yellow: \"#ffff00\",\n yellowgreen: \"#9acd32\",\n}\n\ntype Rgba = { r: number; g: number; b: number; a: number }\n\nconst clamp = (value: number, min: number, max: number): number =>\n Math.min(max, Math.max(min, value))\n\nconst formatRgba = ({ r, g, b, a }: Rgba): string => {\n const alpha = Math.round(clamp(a, 0, 1) * 1000) / 1000\n return alpha >= 1\n ? `rgb(${r}, ${g}, ${b})`\n : `rgba(${r}, ${g}, ${b}, ${alpha})`\n}\n\nconst HEX_PATTERN = /^#([0-9a-f]+)$/i\n\nconst hexPair = (digits: string, index: number): number =>\n Number.parseInt(digits.slice(index, index + 2), 16)\n\nconst hexSingle = (digits: string, index: number): number =>\n Number.parseInt(digits.charAt(index).repeat(2), 16)\n\nconst parseHex = (input: string): Rgba | null => {\n const match = HEX_PATTERN.exec(input)\n if (match === null) {\n return null\n }\n const digits = match[1] ?? \"\"\n switch (digits.length) {\n case 3:\n return {\n r: hexSingle(digits, 0),\n g: hexSingle(digits, 1),\n b: hexSingle(digits, 2),\n a: 1,\n }\n case 4:\n return {\n r: hexSingle(digits, 0),\n g: hexSingle(digits, 1),\n b: hexSingle(digits, 2),\n a: hexSingle(digits, 3) / 255,\n }\n case 6:\n return {\n r: hexPair(digits, 0),\n g: hexPair(digits, 2),\n b: hexPair(digits, 4),\n a: 1,\n }\n case 8:\n return {\n r: hexPair(digits, 0),\n g: hexPair(digits, 2),\n b: hexPair(digits, 4),\n a: hexPair(digits, 6) / 255,\n }\n default:\n return null\n }\n}\n\nconst NUMBER_PATTERN = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/\n\nconst parseNumber = (token: string): number | null =>\n NUMBER_PATTERN.test(token) ? Number.parseFloat(token) : null\n\n// 0-255 integer or percentage → 0-255 integer.\nconst parseRgbChannel = (token: string): number | null => {\n if (token.endsWith(\"%\")) {\n const percent = parseNumber(token.slice(0, -1))\n // (percent * 255) / 100 avoids float drift: 50 * 2.55 === 127.4999...\n return percent === null\n ? null\n : Math.round((clamp(percent, 0, 100) * 255) / 100)\n }\n const value = parseNumber(token)\n return value === null ? null : Math.round(clamp(value, 0, 255))\n}\n\n// 0-1 float or percentage → 0-1 float.\nconst parseAlpha = (token: string): number | null => {\n if (token.endsWith(\"%\")) {\n const percent = parseNumber(token.slice(0, -1))\n return percent === null ? null : clamp(percent / 100, 0, 1)\n }\n const value = parseNumber(token)\n return value === null ? null : clamp(value, 0, 1)\n}\n\nconst parsePercentage = (token: string): number | null => {\n if (!token.endsWith(\"%\")) {\n return null\n }\n const percent = parseNumber(token.slice(0, -1))\n return percent === null ? null : clamp(percent / 100, 0, 1)\n}\n\nconst parseHue = (token: string): number | null => {\n const raw = token.toLowerCase().endsWith(\"deg\") ? token.slice(0, -3) : token\n const degrees = parseNumber(raw)\n return degrees === null ? null : ((degrees % 360) + 360) % 360\n}\n\nconst hslToRgb = (\n h: number,\n s: number,\n l: number,\n): [number, number, number] => {\n const chroma = (1 - Math.abs(2 * l - 1)) * s\n const hh = h / 60\n const x = chroma * (1 - Math.abs((hh % 2) - 1))\n // Every branch assigns, so the sextant picks the triple outright — the\n // placeholder initialiser it used to start from was dead.\n let rgb: [number, number, number]\n if (hh < 1) {\n rgb = [chroma, x, 0]\n } else if (hh < 2) {\n rgb = [x, chroma, 0]\n } else if (hh < 3) {\n rgb = [0, chroma, x]\n } else if (hh < 4) {\n rgb = [0, x, chroma]\n } else if (hh < 5) {\n rgb = [x, 0, chroma]\n } else {\n rgb = [chroma, 0, x]\n }\n const m = l - chroma / 2\n return [\n Math.round((rgb[0] + m) * 255),\n Math.round((rgb[1] + m) * 255),\n Math.round((rgb[2] + m) * 255),\n ]\n}\n\nconst FUNCTION_PATTERN = /^(rgba?|hsla?)\\(([^()]*)\\)$/i\n\n// Accepts legacy comma syntax and modern space syntax with optional \"/ alpha\".\nconst splitFunctionBody = (body: string): string[] =>\n body\n .replace(/\\//g, \" \")\n .split(/[,\\s]+/)\n .filter((token) => token.length > 0)\n\nconst parseColorFunction = (input: string): Rgba | null => {\n const match = FUNCTION_PATTERN.exec(input)\n if (match === null) {\n return null\n }\n const name = (match[1] ?? \"\").toLowerCase()\n const tokens = splitFunctionBody(match[2] ?? \"\")\n if (tokens.length < 3 || tokens.length > 4) {\n return null\n }\n const alpha = tokens.length === 4 ? parseAlpha(tokens[3] ?? \"\") : 1\n if (alpha === null) {\n return null\n }\n if (name === \"rgb\" || name === \"rgba\") {\n const r = parseRgbChannel(tokens[0] ?? \"\")\n const g = parseRgbChannel(tokens[1] ?? \"\")\n const b = parseRgbChannel(tokens[2] ?? \"\")\n if (r === null || g === null || b === null) {\n return null\n }\n return { r, g, b, a: alpha }\n }\n const h = parseHue(tokens[0] ?? \"\")\n const s = parsePercentage(tokens[1] ?? \"\")\n const l = parsePercentage(tokens[2] ?? \"\")\n if (h === null || s === null || l === null) {\n return null\n }\n const [r, g, b] = hslToRgb(h, s, l)\n return { r, g, b, a: alpha }\n}\n\nconst CSS_VARIABLE_PATTERN = /^var\\(--[\\w-]+.*\\)$/i\nconst GTK_NAMED_COLOR_PATTERN = /^@[A-Za-z_][\\w-]*$/\n\n/**\n * Parses a React Native color string into a GTK4 CSS color value.\n * Returns null for values that cannot be understood.\n */\nexport const parseColor = (value: string): string | null => {\n if (typeof value !== \"string\") {\n return null\n }\n const input = value.trim()\n if (input === \"\") {\n return null\n }\n // Adwaita/custom CSS variable references pass through untouched. The\n // pattern is permissive on purpose: nested var() fallbacks stay valid.\n if (input.toLowerCase().startsWith(\"var(\")) {\n return CSS_VARIABLE_PATTERN.test(input) ? input : null\n }\n if (GTK_NAMED_COLOR_PATTERN.test(input)) {\n return input\n }\n const lower = input.toLowerCase()\n if (lower === \"transparent\") {\n return \"rgba(0, 0, 0, 0)\"\n }\n const named = NAMED_COLORS[lower]\n const rgba = parseHex(named ?? input) ?? parseColorFunction(input)\n return rgba === null ? null : formatRgba(rgba)\n}\n\nconst toCssVariableName = (name: string): string =>\n name.startsWith(\"--\") ? name : `--${name}`\n\n/**\n * React Native's PlatformColor for GTK: references theme colors by name.\n * Names map onto CSS variables (Adwaita exposes its palette as\n * `--accent-bg-color`, `--window-bg-color`, ... since libadwaita 1.6);\n * extra names become var() fallbacks, tried in order. A name starting with\n * \"@\" is a legacy GTK named color (`@define-color`) and terminates the\n * fallback chain, because var() fallbacks cannot resolve further after it.\n *\n * PlatformColor(\"accent-bg-color\") → \"var(--accent-bg-color)\"\n * PlatformColor(\"accent-bg-color\", \"@blue_3\") → \"var(--accent-bg-color, @blue_3)\"\n */\nexport const PlatformColor = (...names: string[]): string => {\n const cleaned = names.map((name) => name.trim()).filter((name) => name !== \"\")\n if (cleaned.length === 0) {\n throw new Error(\"PlatformColor requires at least one color name\")\n }\n let expression: string | null = null\n for (let i = cleaned.length - 1; i >= 0; i -= 1) {\n const name = cleaned[i] ?? \"\"\n if (name.startsWith(\"@\")) {\n // Terminal value: names after it are unreachable fallbacks.\n expression = name\n continue\n }\n const variable = toCssVariableName(name)\n expression =\n expression === null\n ? `var(${variable})`\n : `var(${variable}, ${expression})`\n }\n return expression ?? \"\"\n}\n"]}
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/style/colors.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,mEAA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S color values. No bridge imports — unit-testable on any OS.\n//\n// Every parseable color is normalized to `rgb(r, g, b)` / `rgba(r, g, b, a)`\n// so the output does not depend on which color syntaxes the GTK CSS parser of\n// a particular version accepts. Two values pass through untouched:\n// - `var(--name[, fallback])` — CSS variables (GTK 4.16+, Adwaita palette)\n// - `@name` — legacy GTK named colors (`@define-color` references)\n\n// CSS Color Module Level 4 named colors (the set React Native supports).\nconst NAMED_COLORS: Record<string, string> = {\n aliceblue: \"#f0f8ff\",\n antiquewhite: \"#faebd7\",\n aqua: \"#00ffff\",\n aquamarine: \"#7fffd4\",\n azure: \"#f0ffff\",\n beige: \"#f5f5dc\",\n bisque: \"#ffe4c4\",\n black: \"#000000\",\n blanchedalmond: \"#ffebcd\",\n blue: \"#0000ff\",\n blueviolet: \"#8a2be2\",\n brown: \"#a52a2a\",\n burlywood: \"#deb887\",\n cadetblue: \"#5f9ea0\",\n chartreuse: \"#7fff00\",\n chocolate: \"#d2691e\",\n coral: \"#ff7f50\",\n cornflowerblue: \"#6495ed\",\n cornsilk: \"#fff8dc\",\n crimson: \"#dc143c\",\n cyan: \"#00ffff\",\n darkblue: \"#00008b\",\n darkcyan: \"#008b8b\",\n darkgoldenrod: \"#b8860b\",\n darkgray: \"#a9a9a9\",\n darkgreen: \"#006400\",\n darkgrey: \"#a9a9a9\",\n darkkhaki: \"#bdb76b\",\n darkmagenta: \"#8b008b\",\n darkolivegreen: \"#556b2f\",\n darkorange: \"#ff8c00\",\n darkorchid: \"#9932cc\",\n darkred: \"#8b0000\",\n darksalmon: \"#e9967a\",\n darkseagreen: \"#8fbc8f\",\n darkslateblue: \"#483d8b\",\n darkslategray: \"#2f4f4f\",\n darkslategrey: \"#2f4f4f\",\n darkturquoise: \"#00ced1\",\n darkviolet: \"#9400d3\",\n deeppink: \"#ff1493\",\n deepskyblue: \"#00bfff\",\n dimgray: \"#696969\",\n dimgrey: \"#696969\",\n dodgerblue: \"#1e90ff\",\n firebrick: \"#b22222\",\n floralwhite: \"#fffaf0\",\n forestgreen: \"#228b22\",\n fuchsia: \"#ff00ff\",\n gainsboro: \"#dcdcdc\",\n ghostwhite: \"#f8f8ff\",\n gold: \"#ffd700\",\n goldenrod: \"#daa520\",\n gray: \"#808080\",\n green: \"#008000\",\n greenyellow: \"#adff2f\",\n grey: \"#808080\",\n honeydew: \"#f0fff0\",\n hotpink: \"#ff69b4\",\n indianred: \"#cd5c5c\",\n indigo: \"#4b0082\",\n ivory: \"#fffff0\",\n khaki: \"#f0e68c\",\n lavender: \"#e6e6fa\",\n lavenderblush: \"#fff0f5\",\n lawngreen: \"#7cfc00\",\n lemonchiffon: \"#fffacd\",\n lightblue: \"#add8e6\",\n lightcoral: \"#f08080\",\n lightcyan: \"#e0ffff\",\n lightgoldenrodyellow: \"#fafad2\",\n lightgray: \"#d3d3d3\",\n lightgreen: \"#90ee90\",\n lightgrey: \"#d3d3d3\",\n lightpink: \"#ffb6c1\",\n lightsalmon: \"#ffa07a\",\n lightseagreen: \"#20b2aa\",\n lightskyblue: \"#87cefa\",\n lightslategray: \"#778899\",\n lightslategrey: \"#778899\",\n lightsteelblue: \"#b0c4de\",\n lightyellow: \"#ffffe0\",\n lime: \"#00ff00\",\n limegreen: \"#32cd32\",\n linen: \"#faf0e6\",\n magenta: \"#ff00ff\",\n maroon: \"#800000\",\n mediumaquamarine: \"#66cdaa\",\n mediumblue: \"#0000cd\",\n mediumorchid: \"#ba55d3\",\n mediumpurple: \"#9370db\",\n mediumseagreen: \"#3cb371\",\n mediumslateblue: \"#7b68ee\",\n mediumspringgreen: \"#00fa9a\",\n mediumturquoise: \"#48d1cc\",\n mediumvioletred: \"#c71585\",\n midnightblue: \"#191970\",\n mintcream: \"#f5fffa\",\n mistyrose: \"#ffe4e1\",\n moccasin: \"#ffe4b5\",\n navajowhite: \"#ffdead\",\n navy: \"#000080\",\n oldlace: \"#fdf5e6\",\n olive: \"#808000\",\n olivedrab: \"#6b8e23\",\n orange: \"#ffa500\",\n orangered: \"#ff4500\",\n orchid: \"#da70d6\",\n palegoldenrod: \"#eee8aa\",\n palegreen: \"#98fb98\",\n paleturquoise: \"#afeeee\",\n palevioletred: \"#db7093\",\n papayawhip: \"#ffefd5\",\n peachpuff: \"#ffdab9\",\n peru: \"#cd853f\",\n pink: \"#ffc0cb\",\n plum: \"#dda0dd\",\n powderblue: \"#b0e0e6\",\n purple: \"#800080\",\n rebeccapurple: \"#663399\",\n red: \"#ff0000\",\n rosybrown: \"#bc8f8f\",\n royalblue: \"#4169e1\",\n saddlebrown: \"#8b4513\",\n salmon: \"#fa8072\",\n sandybrown: \"#f4a460\",\n seagreen: \"#2e8b57\",\n seashell: \"#fff5ee\",\n sienna: \"#a0522d\",\n silver: \"#c0c0c0\",\n skyblue: \"#87ceeb\",\n slateblue: \"#6a5acd\",\n slategray: \"#708090\",\n slategrey: \"#708090\",\n snow: \"#fffafa\",\n springgreen: \"#00ff7f\",\n steelblue: \"#4682b4\",\n tan: \"#d2b48c\",\n teal: \"#008080\",\n thistle: \"#d8bfd8\",\n tomato: \"#ff6347\",\n turquoise: \"#40e0d0\",\n violet: \"#ee82ee\",\n wheat: \"#f5deb3\",\n white: \"#ffffff\",\n whitesmoke: \"#f5f5f5\",\n yellow: \"#ffff00\",\n yellowgreen: \"#9acd32\",\n}\n\n/** A parsed colour: 0-255 channels, 0-1 alpha. */\nexport type Rgba = { r: number; g: number; b: number; a: number }\n\nconst clamp = (value: number, min: number, max: number): number =>\n Math.min(max, Math.max(min, value))\n\nconst formatRgba = ({ r, g, b, a }: Rgba): string => {\n const alpha = Math.round(clamp(a, 0, 1) * 1000) / 1000\n return alpha >= 1\n ? `rgb(${r}, ${g}, ${b})`\n : `rgba(${r}, ${g}, ${b}, ${alpha})`\n}\n\nconst HEX_PATTERN = /^#([0-9a-f]+)$/i\n\nconst hexPair = (digits: string, index: number): number =>\n Number.parseInt(digits.slice(index, index + 2), 16)\n\nconst hexSingle = (digits: string, index: number): number =>\n Number.parseInt(digits.charAt(index).repeat(2), 16)\n\nconst parseHex = (input: string): Rgba | null => {\n const match = HEX_PATTERN.exec(input)\n if (match === null) {\n return null\n }\n const digits = match[1] ?? \"\"\n switch (digits.length) {\n case 3:\n return {\n r: hexSingle(digits, 0),\n g: hexSingle(digits, 1),\n b: hexSingle(digits, 2),\n a: 1,\n }\n case 4:\n return {\n r: hexSingle(digits, 0),\n g: hexSingle(digits, 1),\n b: hexSingle(digits, 2),\n a: hexSingle(digits, 3) / 255,\n }\n case 6:\n return {\n r: hexPair(digits, 0),\n g: hexPair(digits, 2),\n b: hexPair(digits, 4),\n a: 1,\n }\n case 8:\n return {\n r: hexPair(digits, 0),\n g: hexPair(digits, 2),\n b: hexPair(digits, 4),\n a: hexPair(digits, 6) / 255,\n }\n default:\n return null\n }\n}\n\nconst NUMBER_PATTERN = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/\n\nconst parseNumber = (token: string): number | null =>\n NUMBER_PATTERN.test(token) ? Number.parseFloat(token) : null\n\n// 0-255 integer or percentage → 0-255 integer.\nconst parseRgbChannel = (token: string): number | null => {\n if (token.endsWith(\"%\")) {\n const percent = parseNumber(token.slice(0, -1))\n // (percent * 255) / 100 avoids float drift: 50 * 2.55 === 127.4999...\n return percent === null\n ? null\n : Math.round((clamp(percent, 0, 100) * 255) / 100)\n }\n const value = parseNumber(token)\n return value === null ? null : Math.round(clamp(value, 0, 255))\n}\n\n// 0-1 float or percentage → 0-1 float.\nconst parseAlpha = (token: string): number | null => {\n if (token.endsWith(\"%\")) {\n const percent = parseNumber(token.slice(0, -1))\n return percent === null ? null : clamp(percent / 100, 0, 1)\n }\n const value = parseNumber(token)\n return value === null ? null : clamp(value, 0, 1)\n}\n\nconst parsePercentage = (token: string): number | null => {\n if (!token.endsWith(\"%\")) {\n return null\n }\n const percent = parseNumber(token.slice(0, -1))\n return percent === null ? null : clamp(percent / 100, 0, 1)\n}\n\nconst parseHue = (token: string): number | null => {\n const raw = token.toLowerCase().endsWith(\"deg\") ? token.slice(0, -3) : token\n const degrees = parseNumber(raw)\n return degrees === null ? null : ((degrees % 360) + 360) % 360\n}\n\nconst hslToRgb = (\n h: number,\n s: number,\n l: number,\n): [number, number, number] => {\n const chroma = (1 - Math.abs(2 * l - 1)) * s\n const hh = h / 60\n const x = chroma * (1 - Math.abs((hh % 2) - 1))\n // Every branch assigns, so the sextant picks the triple outright — the\n // placeholder initialiser it used to start from was dead.\n let rgb: [number, number, number]\n if (hh < 1) {\n rgb = [chroma, x, 0]\n } else if (hh < 2) {\n rgb = [x, chroma, 0]\n } else if (hh < 3) {\n rgb = [0, chroma, x]\n } else if (hh < 4) {\n rgb = [0, x, chroma]\n } else if (hh < 5) {\n rgb = [x, 0, chroma]\n } else {\n rgb = [chroma, 0, x]\n }\n const m = l - chroma / 2\n return [\n Math.round((rgb[0] + m) * 255),\n Math.round((rgb[1] + m) * 255),\n Math.round((rgb[2] + m) * 255),\n ]\n}\n\nconst FUNCTION_PATTERN = /^(rgba?|hsla?)\\(([^()]*)\\)$/i\n\n// Accepts legacy comma syntax and modern space syntax with optional \"/ alpha\".\nconst splitFunctionBody = (body: string): string[] =>\n body\n .replace(/\\//g, \" \")\n .split(/[,\\s]+/)\n .filter((token) => token.length > 0)\n\nconst parseColorFunction = (input: string): Rgba | null => {\n const match = FUNCTION_PATTERN.exec(input)\n if (match === null) {\n return null\n }\n const name = (match[1] ?? \"\").toLowerCase()\n const tokens = splitFunctionBody(match[2] ?? \"\")\n if (tokens.length < 3 || tokens.length > 4) {\n return null\n }\n const alpha = tokens.length === 4 ? parseAlpha(tokens[3] ?? \"\") : 1\n if (alpha === null) {\n return null\n }\n if (name === \"rgb\" || name === \"rgba\") {\n const r = parseRgbChannel(tokens[0] ?? \"\")\n const g = parseRgbChannel(tokens[1] ?? \"\")\n const b = parseRgbChannel(tokens[2] ?? \"\")\n if (r === null || g === null || b === null) {\n return null\n }\n return { r, g, b, a: alpha }\n }\n const h = parseHue(tokens[0] ?? \"\")\n const s = parsePercentage(tokens[1] ?? \"\")\n const l = parsePercentage(tokens[2] ?? \"\")\n if (h === null || s === null || l === null) {\n return null\n }\n const [r, g, b] = hslToRgb(h, s, l)\n return { r, g, b, a: alpha }\n}\n\nconst CSS_VARIABLE_PATTERN = /^var\\(--[\\w-]+.*\\)$/i\nconst GTK_NAMED_COLOR_PATTERN = /^@[A-Za-z_][\\w-]*$/\n\n/**\n * Parses a React Native color string into numeric channels.\n *\n * Returns null for anything that has no fixed value at parse time — the\n * `var(--name)` and `@named` forms {@link parseColor} passes through to GTK,\n * which resolves them against the live theme. Callers that need to compute\n * WITH a colour (interpolation, blending) have to refuse those; callers that\n * only need to hand it to GTK should use {@link parseColor} instead.\n */\nexport const parseColorToRgba = (value: string): Rgba | null => {\n if (typeof value !== \"string\") {\n return null\n }\n const input = value.trim()\n if (input === \"\") {\n return null\n }\n const lower = input.toLowerCase()\n if (lower === \"transparent\") {\n return { r: 0, g: 0, b: 0, a: 0 }\n }\n const named = NAMED_COLORS[lower]\n return parseHex(named ?? input) ?? parseColorFunction(input)\n}\n\n/**\n * Parses a React Native color string into a GTK4 CSS color value.\n * Returns null for values that cannot be understood.\n */\nexport const parseColor = (value: string): string | null => {\n if (typeof value !== \"string\") {\n return null\n }\n const input = value.trim()\n if (input === \"\") {\n return null\n }\n // Adwaita/custom CSS variable references pass through untouched. The\n // pattern is permissive on purpose: nested var() fallbacks stay valid.\n if (input.toLowerCase().startsWith(\"var(\")) {\n return CSS_VARIABLE_PATTERN.test(input) ? input : null\n }\n if (GTK_NAMED_COLOR_PATTERN.test(input)) {\n return input\n }\n const rgba = parseColorToRgba(input)\n return rgba === null ? null : formatRgba(rgba)\n}\n\nconst toCssVariableName = (name: string): string =>\n name.startsWith(\"--\") ? name : `--${name}`\n\n/**\n * React Native's PlatformColor for GTK: references theme colors by name.\n * Names map onto CSS variables (Adwaita exposes its palette as\n * `--accent-bg-color`, `--window-bg-color`, ... since libadwaita 1.6);\n * extra names become var() fallbacks, tried in order. A name starting with\n * \"@\" is a legacy GTK named color (`@define-color`) and terminates the\n * fallback chain, because var() fallbacks cannot resolve further after it.\n *\n * PlatformColor(\"accent-bg-color\") → \"var(--accent-bg-color)\"\n * PlatformColor(\"accent-bg-color\", \"@blue_3\") → \"var(--accent-bg-color, @blue_3)\"\n */\nexport const PlatformColor = (...names: string[]): string => {\n const cleaned = names.map((name) => name.trim()).filter((name) => name !== \"\")\n if (cleaned.length === 0) {\n throw new Error(\"PlatformColor requires at least one color name\")\n }\n let expression: string | null = null\n for (let i = cleaned.length - 1; i >= 0; i -= 1) {\n const name = cleaned[i] ?? \"\"\n if (name.startsWith(\"@\")) {\n // Terminal value: names after it are unreachable fallbacks.\n expression = name\n continue\n }\n const variable = toCssVariableName(name)\n expression =\n expression === null\n ? `var(${variable})`\n : `var(${variable}, ${expression})`\n }\n return expression ?? \"\"\n}\n"]}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The colour properties an animation may drive imperatively. Every one of
3
+ * them is a plain GTK4 CSS declaration with no layout consequence, which is
4
+ * what makes writing it mid-animation safe.
5
+ */
6
+ export declare const DRIVEABLE_COLOR_PROPERTIES: readonly ["backgroundColor", "borderBottomColor", "borderColor", "borderLeftColor", "borderRightColor", "borderTopColor", "color", "outlineColor"];
7
+ export type DriveableColorProperty = (typeof DRIVEABLE_COLOR_PROPERTIES)[number];
8
+ export declare const isDriveableColorProperty: (property: string) => property is DriveableColorProperty;
9
+ /**
10
+ * Renders driven colour values as a GTK CSS declaration body (no selector,
11
+ * no braces), through the SAME generator the static path uses — so a colour
12
+ * written per frame is normalised, validated and warned about exactly like
13
+ * one written in a stylesheet, instead of growing a second dialect.
14
+ *
15
+ * Values are ordinary React Native colour strings. An unparseable one is
16
+ * dropped with the generator's own one-per-session warning; a property whose
17
+ * value is not a string is skipped, because a driven leaf that has stopped
18
+ * being a colour must not be able to emit `background-color: 12;` into a
19
+ * document GTK then rejects wholesale.
20
+ */
21
+ export declare const driveableColorsToCss: (values: Readonly<Record<string, unknown>>) => string;
@@ -0,0 +1,63 @@
1
+ // Which visual style properties this platform can write to a MOUNTED widget
2
+ // without going through React, and how they are rendered for the per-widget
3
+ // CSS provider that carries them (../gtkx/bridge/widget-css.ts).
4
+ //
5
+ // WHY THIS IS A SEPARATE LIST FROM VisualStyle. The ordinary path compiles a
6
+ // whole VisualStyle into one CSS declaration block and memoises it by that
7
+ // block's text (./registry.ts), which is exactly right for a style that
8
+ // changes when React re-renders and exactly wrong for one that changes sixty
9
+ // times a second: the cache key is the value, so a driven colour mints a new
10
+ // class per frame, appends a rule to the ONE global stylesheet, and makes GTK
11
+ // re-parse the whole document. Measured, that is 0.8 ms for the first frame
12
+ // and 6.8 ms by frame 600 — a cost that grows for as long as the animation
13
+ // runs (docs/research/animated-colors.md).
14
+ //
15
+ // A per-widget provider has no cache and no document: one rule, replaced in
16
+ // place. So the properties listed here are the ones a running animation may
17
+ // write, and they are colours because a colour is the only thing that both
18
+ // changes per frame in real UI and reaches GTK purely through CSS. Radii,
19
+ // borders and shadows would work identically through the same door; layout
20
+ // properties would NOT, because they need a Yoga pass whose cost is
21
+ // proportional to the tree rather than to the number of animated values (the
22
+ // same doc measures that too, and refuses them on the strength of it).
23
+ import { visualStyleToCss } from "./visual-css";
24
+ /**
25
+ * The colour properties an animation may drive imperatively. Every one of
26
+ * them is a plain GTK4 CSS declaration with no layout consequence, which is
27
+ * what makes writing it mid-animation safe.
28
+ */
29
+ export const DRIVEABLE_COLOR_PROPERTIES = [
30
+ "backgroundColor",
31
+ "borderBottomColor",
32
+ "borderColor",
33
+ "borderLeftColor",
34
+ "borderRightColor",
35
+ "borderTopColor",
36
+ "color",
37
+ "outlineColor",
38
+ ];
39
+ const DRIVEABLE = new Set(DRIVEABLE_COLOR_PROPERTIES);
40
+ export const isDriveableColorProperty = (property) => DRIVEABLE.has(property);
41
+ /**
42
+ * Renders driven colour values as a GTK CSS declaration body (no selector,
43
+ * no braces), through the SAME generator the static path uses — so a colour
44
+ * written per frame is normalised, validated and warned about exactly like
45
+ * one written in a stylesheet, instead of growing a second dialect.
46
+ *
47
+ * Values are ordinary React Native colour strings. An unparseable one is
48
+ * dropped with the generator's own one-per-session warning; a property whose
49
+ * value is not a string is skipped, because a driven leaf that has stopped
50
+ * being a colour must not be able to emit `background-color: 12;` into a
51
+ * document GTK then rejects wholesale.
52
+ */
53
+ export const driveableColorsToCss = (values) => {
54
+ const visual = {};
55
+ for (const property of DRIVEABLE_COLOR_PROPERTIES) {
56
+ const value = values[property];
57
+ if (typeof value === "string") {
58
+ visual[property] = value;
59
+ }
60
+ }
61
+ return visualStyleToCss(visual);
62
+ };
63
+ //# sourceMappingURL=imperative-css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imperative-css.js","sourceRoot":"","sources":["../../src/style/imperative-css.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,4EAA4E;AAC5E,iEAAiE;AACjE,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,wEAAwE;AACxE,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,2EAA2E;AAC3E,2CAA2C;AAC3C,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,oEAAoE;AACpE,6EAA6E;AAC7E,uEAAuE;AAGvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,iBAAiB;IACjB,mBAAmB;IACnB,aAAa;IACb,iBAAiB;IACjB,kBAAkB;IAClB,gBAAgB;IAChB,OAAO;IACP,cAAc;CACN,CAAA;AAIV,MAAM,SAAS,GAAG,IAAI,GAAG,CAAS,0BAA0B,CAAC,CAAA;AAE7D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,QAAgB,EACoB,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAEhE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,MAAyC,EACjC,EAAE;IACV,MAAM,MAAM,GAA2B,EAAE,CAAA;IACzC,KAAK,MAAM,QAAQ,IAAI,0BAA0B,EAAE,CAAC;QAClD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAA;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC,MAAqB,CAAC,CAAA;AAChD,CAAC,CAAA","sourcesContent":["// Which visual style properties this platform can write to a MOUNTED widget\n// without going through React, and how they are rendered for the per-widget\n// CSS provider that carries them (../gtkx/bridge/widget-css.ts).\n//\n// WHY THIS IS A SEPARATE LIST FROM VisualStyle. The ordinary path compiles a\n// whole VisualStyle into one CSS declaration block and memoises it by that\n// block's text (./registry.ts), which is exactly right for a style that\n// changes when React re-renders and exactly wrong for one that changes sixty\n// times a second: the cache key is the value, so a driven colour mints a new\n// class per frame, appends a rule to the ONE global stylesheet, and makes GTK\n// re-parse the whole document. Measured, that is 0.8 ms for the first frame\n// and 6.8 ms by frame 600 — a cost that grows for as long as the animation\n// runs (docs/research/animated-colors.md).\n//\n// A per-widget provider has no cache and no document: one rule, replaced in\n// place. So the properties listed here are the ones a running animation may\n// write, and they are colours because a colour is the only thing that both\n// changes per frame in real UI and reaches GTK purely through CSS. Radii,\n// borders and shadows would work identically through the same door; layout\n// properties would NOT, because they need a Yoga pass whose cost is\n// proportional to the tree rather than to the number of animated values (the\n// same doc measures that too, and refuses them on the strength of it).\n\nimport type { VisualStyle } from \"../contracts\"\nimport { visualStyleToCss } from \"./visual-css\"\n\n/**\n * The colour properties an animation may drive imperatively. Every one of\n * them is a plain GTK4 CSS declaration with no layout consequence, which is\n * what makes writing it mid-animation safe.\n */\nexport const DRIVEABLE_COLOR_PROPERTIES = [\n \"backgroundColor\",\n \"borderBottomColor\",\n \"borderColor\",\n \"borderLeftColor\",\n \"borderRightColor\",\n \"borderTopColor\",\n \"color\",\n \"outlineColor\",\n] as const\n\nexport type DriveableColorProperty = (typeof DRIVEABLE_COLOR_PROPERTIES)[number]\n\nconst DRIVEABLE = new Set<string>(DRIVEABLE_COLOR_PROPERTIES)\n\nexport const isDriveableColorProperty = (\n property: string,\n): property is DriveableColorProperty => DRIVEABLE.has(property)\n\n/**\n * Renders driven colour values as a GTK CSS declaration body (no selector,\n * no braces), through the SAME generator the static path uses — so a colour\n * written per frame is normalised, validated and warned about exactly like\n * one written in a stylesheet, instead of growing a second dialect.\n *\n * Values are ordinary React Native colour strings. An unparseable one is\n * dropped with the generator's own one-per-session warning; a property whose\n * value is not a string is skipped, because a driven leaf that has stopped\n * being a colour must not be able to emit `background-color: 12;` into a\n * document GTK then rejects wholesale.\n */\nexport const driveableColorsToCss = (\n values: Readonly<Record<string, unknown>>,\n): string => {\n const visual: Record<string, string> = {}\n for (const property of DRIVEABLE_COLOR_PROPERTIES) {\n const value = values[property]\n if (typeof value === \"string\") {\n visual[property] = value\n }\n }\n return visualStyleToCss(visual as VisualStyle)\n}\n"]}
@@ -1,8 +1,11 @@
1
- export { parseColor, PlatformColor } from "./colors";
1
+ export { boxShadowToCss } from "./box-shadow";
2
+ export { parseColor, parseColorToRgba, PlatformColor, type Rgba, } from "./colors";
2
3
  export { resetDevWarnings } from "./dev-warning";
4
+ export { driveableColorsToCss, DRIVEABLE_COLOR_PROPERTIES, isDriveableColorProperty, type DriveableColorProperty, } from "./imperative-css";
3
5
  export { createCssRegistry, type CssFn, type CssRegistry } from "./registry";
4
6
  export { splitStyle } from "./split-style";
5
7
  export { absoluteFill, absoluteFillObject, compose, create, flatten, hairlineWidth, StyleSheet, } from "./style-sheet";
8
+ export { textDecorationToAttrs, type TextDecorations } from "./text-decoration";
6
9
  export { textAlignToLabelProps, type LabelAlignProps, type TextAlign, } from "./text-align";
7
10
  export { composeTransform, IDENTITY_TRANSFORM, isIdentityTransform, isTranslationOnly, parseAngle, } from "./transform";
8
11
  export { visualStyleToCss } from "./visual-css";
@@ -4,11 +4,14 @@
4
4
  // Everything exported here is pure (no bridge imports) and unit-testable on
5
5
  // any OS. The production registry that talks to the gtkx `css` helper lives
6
6
  // in ./registry.gtkx.ts and is imported directly by the components.
7
- export { parseColor, PlatformColor } from "./colors";
7
+ export { boxShadowToCss } from "./box-shadow";
8
+ export { parseColor, parseColorToRgba, PlatformColor, } from "./colors";
8
9
  export { resetDevWarnings } from "./dev-warning";
10
+ export { driveableColorsToCss, DRIVEABLE_COLOR_PROPERTIES, isDriveableColorProperty, } from "./imperative-css";
9
11
  export { createCssRegistry } from "./registry";
10
12
  export { splitStyle } from "./split-style";
11
13
  export { absoluteFill, absoluteFillObject, compose, create, flatten, hairlineWidth, StyleSheet, } from "./style-sheet";
14
+ export { textDecorationToAttrs } from "./text-decoration";
12
15
  export { textAlignToLabelProps, } from "./text-align";
13
16
  export { composeTransform, IDENTITY_TRANSFORM, isIdentityTransform, isTranslationOnly, parseAngle, } from "./transform";
14
17
  export { visualStyleToCss } from "./visual-css";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/style/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,8CAA8C;AAC9C,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,oEAAoE;AAEpE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAgC,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,OAAO,EACP,aAAa,EACb,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,qBAAqB,GAGtB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,GACX,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA","sourcesContent":["// Style pipeline: StyleSheet → flatten → splitStyle →\n// visualStyleToCss → memoized class registry.\n//\n// Everything exported here is pure (no bridge imports) and unit-testable on\n// any OS. The production registry that talks to the gtkx `css` helper lives\n// in ./registry.gtkx.ts and is imported directly by the components.\n\nexport { parseColor, PlatformColor } from \"./colors\"\nexport { resetDevWarnings } from \"./dev-warning\"\nexport { createCssRegistry, type CssFn, type CssRegistry } from \"./registry\"\nexport { splitStyle } from \"./split-style\"\nexport {\n absoluteFill,\n absoluteFillObject,\n compose,\n create,\n flatten,\n hairlineWidth,\n StyleSheet,\n} from \"./style-sheet\"\nexport {\n textAlignToLabelProps,\n type LabelAlignProps,\n type TextAlign,\n} from \"./text-align\"\nexport {\n composeTransform,\n IDENTITY_TRANSFORM,\n isIdentityTransform,\n isTranslationOnly,\n parseAngle,\n} from \"./transform\"\nexport { visualStyleToCss } from \"./visual-css\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/style/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,8CAA8C;AAC9C,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,oEAAoE;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,aAAa,GAEd,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,wBAAwB,GAEzB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,iBAAiB,EAAgC,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,OAAO,EACP,aAAa,EACb,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,qBAAqB,EAAwB,MAAM,mBAAmB,CAAA;AAC/E,OAAO,EACL,qBAAqB,GAGtB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,GACX,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA","sourcesContent":["// Style pipeline: StyleSheet → flatten → splitStyle →\n// visualStyleToCss → memoized class registry.\n//\n// Everything exported here is pure (no bridge imports) and unit-testable on\n// any OS. The production registry that talks to the gtkx `css` helper lives\n// in ./registry.gtkx.ts and is imported directly by the components.\n\nexport { boxShadowToCss } from \"./box-shadow\"\nexport {\n parseColor,\n parseColorToRgba,\n PlatformColor,\n type Rgba,\n} from \"./colors\"\nexport { resetDevWarnings } from \"./dev-warning\"\nexport {\n driveableColorsToCss,\n DRIVEABLE_COLOR_PROPERTIES,\n isDriveableColorProperty,\n type DriveableColorProperty,\n} from \"./imperative-css\"\nexport { createCssRegistry, type CssFn, type CssRegistry } from \"./registry\"\nexport { splitStyle } from \"./split-style\"\nexport {\n absoluteFill,\n absoluteFillObject,\n compose,\n create,\n flatten,\n hairlineWidth,\n StyleSheet,\n} from \"./style-sheet\"\nexport { textDecorationToAttrs, type TextDecorations } from \"./text-decoration\"\nexport {\n textAlignToLabelProps,\n type LabelAlignProps,\n type TextAlign,\n} from \"./text-align\"\nexport {\n composeTransform,\n IDENTITY_TRANSFORM,\n isIdentityTransform,\n isTranslationOnly,\n parseAngle,\n} from \"./transform\"\nexport { visualStyleToCss } from \"./visual-css\"\n"]}