react-native-gtkx 0.2.0-alpha.2 → 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 (340) hide show
  1. package/README.md +5 -2
  2. package/dist/aliases/index.d.ts +84 -0
  3. package/dist/aliases/index.js +208 -0
  4. package/dist/aliases/index.js.map +1 -0
  5. package/dist/animated/index.d.ts +2 -0
  6. package/dist/animated/index.js +5 -0
  7. package/dist/animated/index.js.map +1 -1
  8. package/dist/animated/types.d.ts +1 -0
  9. package/dist/animated/types.js.map +1 -1
  10. package/dist/animated/value-animation.js +17 -4
  11. package/dist/animated/value-animation.js.map +1 -1
  12. package/dist/apis/host.gtkx.js +9 -12
  13. package/dist/apis/host.gtkx.js.map +1 -1
  14. package/dist/apis/index.d.ts +4 -2
  15. package/dist/apis/index.js +2 -0
  16. package/dist/apis/index.js.map +1 -1
  17. package/dist/apis/keyboard.d.ts +60 -0
  18. package/dist/apis/keyboard.js +63 -0
  19. package/dist/apis/keyboard.js.map +1 -0
  20. package/dist/apis/log-box.d.ts +15 -0
  21. package/dist/apis/log-box.js +46 -0
  22. package/dist/apis/log-box.js.map +1 -0
  23. package/dist/apis/platform.d.ts +18 -1
  24. package/dist/apis/platform.js.map +1 -1
  25. package/dist/common/index.d.ts +0 -1
  26. package/dist/common/index.js +24 -1
  27. package/dist/common/index.js.map +1 -1
  28. package/dist/components/animated.d.ts +70 -6
  29. package/dist/components/animated.js +559 -46
  30. package/dist/components/animated.js.map +1 -1
  31. package/dist/components/driven-size.d.ts +27 -0
  32. package/dist/components/driven-size.js +85 -0
  33. package/dist/components/driven-size.js.map +1 -0
  34. package/dist/components/find-node-handle.d.ts +11 -0
  35. package/dist/components/find-node-handle.js +53 -0
  36. package/dist/components/find-node-handle.js.map +1 -0
  37. package/dist/components/flat-list.d.ts +3 -2
  38. package/dist/components/flat-list.js.map +1 -1
  39. package/dist/components/frame-scheduler.d.ts +16 -0
  40. package/dist/components/frame-scheduler.js +37 -0
  41. package/dist/components/frame-scheduler.js.map +1 -0
  42. package/dist/components/image.d.ts +6 -1
  43. package/dist/components/image.js +15 -4
  44. package/dist/components/image.js.map +1 -1
  45. package/dist/components/index.d.ts +7 -5
  46. package/dist/components/index.js +5 -3
  47. package/dist/components/index.js.map +1 -1
  48. package/dist/components/measure.d.ts +51 -1
  49. package/dist/components/measure.js +101 -2
  50. package/dist/components/measure.js.map +1 -1
  51. package/dist/components/pressable.d.ts +61 -1
  52. package/dist/components/pressable.js +151 -4
  53. package/dist/components/pressable.js.map +1 -1
  54. package/dist/components/rect-store.d.ts +58 -0
  55. package/dist/components/rect-store.js +124 -3
  56. package/dist/components/rect-store.js.map +1 -1
  57. package/dist/components/root.js +6 -1
  58. package/dist/components/root.js.map +1 -1
  59. package/dist/components/scroll-phase.d.ts +35 -0
  60. package/dist/components/scroll-phase.js +26 -0
  61. package/dist/components/scroll-phase.js.map +1 -0
  62. package/dist/components/scroll-view.d.ts +39 -3
  63. package/dist/components/scroll-view.js +378 -43
  64. package/dist/components/scroll-view.js.map +1 -1
  65. package/dist/components/text-input.js +9 -25
  66. package/dist/components/text-input.js.map +1 -1
  67. package/dist/components/text.d.ts +6 -2
  68. package/dist/components/text.js +43 -8
  69. package/dist/components/text.js.map +1 -1
  70. package/dist/components/use-focus.d.ts +27 -0
  71. package/dist/components/use-focus.js +116 -0
  72. package/dist/components/use-focus.js.map +1 -0
  73. package/dist/components/use-layout-child.d.ts +13 -1
  74. package/dist/components/use-layout-child.js +188 -5
  75. package/dist/components/use-layout-child.js.map +1 -1
  76. package/dist/components/view.d.ts +5 -2
  77. package/dist/components/view.js +18 -13
  78. package/dist/components/view.js.map +1 -1
  79. package/dist/components/virtualized-list.d.ts +45 -5
  80. package/dist/components/virtualized-list.js +90 -24
  81. package/dist/components/virtualized-list.js.map +1 -1
  82. package/dist/components/wheel-scroll-session.d.ts +7 -0
  83. package/dist/components/wheel-scroll-session.js +53 -0
  84. package/dist/components/wheel-scroll-session.js.map +1 -0
  85. package/dist/components/widget-retention.d.ts +35 -0
  86. package/dist/components/widget-retention.js +169 -0
  87. package/dist/components/widget-retention.js.map +1 -0
  88. package/dist/contracts.d.ts +4 -0
  89. package/dist/contracts.js.map +1 -1
  90. package/dist/dnd/context.d.ts +69 -0
  91. package/dist/dnd/context.js +149 -0
  92. package/dist/dnd/context.js.map +1 -0
  93. package/dist/dnd/draggable.d.ts +59 -0
  94. package/dist/dnd/draggable.js +149 -0
  95. package/dist/dnd/draggable.js.map +1 -0
  96. package/dist/dnd/droppable.d.ts +24 -0
  97. package/dist/dnd/droppable.js +74 -0
  98. package/dist/dnd/droppable.js.map +1 -0
  99. package/dist/dnd/gtk-controllers.d.ts +39 -0
  100. package/dist/dnd/gtk-controllers.js +110 -0
  101. package/dist/dnd/gtk-controllers.js.map +1 -0
  102. package/dist/dnd/index.d.ts +6 -0
  103. package/dist/dnd/index.js +31 -0
  104. package/dist/dnd/index.js.map +1 -0
  105. package/dist/dnd/order.d.ts +7 -0
  106. package/dist/dnd/order.js +20 -0
  107. package/dist/dnd/order.js.map +1 -0
  108. package/dist/dnd/payload.d.ts +14 -0
  109. package/dist/dnd/payload.js +41 -0
  110. package/dist/dnd/payload.js.map +1 -0
  111. package/dist/dnd/sortable.d.ts +49 -0
  112. package/dist/dnd/sortable.js +307 -0
  113. package/dist/dnd/sortable.js.map +1 -0
  114. package/dist/dnd/types.d.ts +290 -0
  115. package/dist/dnd/types.js +25 -0
  116. package/dist/dnd/types.js.map +1 -0
  117. package/dist/gesture-handler-compat/builder.d.ts +251 -0
  118. package/dist/gesture-handler-compat/builder.js +513 -0
  119. package/dist/gesture-handler-compat/builder.js.map +1 -0
  120. package/dist/gesture-handler-compat/composition.d.ts +23 -0
  121. package/dist/gesture-handler-compat/composition.js +111 -0
  122. package/dist/gesture-handler-compat/composition.js.map +1 -0
  123. package/dist/gesture-handler-compat/deciders.d.ts +3 -0
  124. package/dist/gesture-handler-compat/deciders.js +47 -0
  125. package/dist/gesture-handler-compat/deciders.js.map +1 -0
  126. package/dist/gesture-handler-compat/detector-runtime.d.ts +44 -0
  127. package/dist/gesture-handler-compat/detector-runtime.js +374 -0
  128. package/dist/gesture-handler-compat/detector-runtime.js.map +1 -0
  129. package/dist/gesture-handler-compat/detector.d.ts +22 -0
  130. package/dist/gesture-handler-compat/detector.js +104 -0
  131. package/dist/gesture-handler-compat/detector.js.map +1 -0
  132. package/dist/gesture-handler-compat/fling.d.ts +24 -0
  133. package/dist/gesture-handler-compat/fling.js +123 -0
  134. package/dist/gesture-handler-compat/fling.js.map +1 -0
  135. package/dist/gesture-handler-compat/force-touch.d.ts +13 -0
  136. package/dist/gesture-handler-compat/force-touch.js +40 -0
  137. package/dist/gesture-handler-compat/force-touch.js.map +1 -0
  138. package/dist/gesture-handler-compat/hooks.d.ts +157 -0
  139. package/dist/gesture-handler-compat/hooks.js +268 -0
  140. package/dist/gesture-handler-compat/hooks.js.map +1 -0
  141. package/dist/gesture-handler-compat/hover.d.ts +2 -0
  142. package/dist/gesture-handler-compat/hover.js +22 -0
  143. package/dist/gesture-handler-compat/hover.js.map +1 -0
  144. package/dist/gesture-handler-compat/index.d.ts +98 -0
  145. package/dist/gesture-handler-compat/index.js +255 -0
  146. package/dist/gesture-handler-compat/index.js.map +1 -0
  147. package/dist/gesture-handler-compat/long-press.d.ts +6 -0
  148. package/dist/gesture-handler-compat/long-press.js +21 -0
  149. package/dist/gesture-handler-compat/long-press.js.map +1 -0
  150. package/dist/gesture-handler-compat/manual.d.ts +2 -0
  151. package/dist/gesture-handler-compat/manual.js +18 -0
  152. package/dist/gesture-handler-compat/manual.js.map +1 -0
  153. package/dist/gesture-handler-compat/native.d.ts +7 -0
  154. package/dist/gesture-handler-compat/native.js +34 -0
  155. package/dist/gesture-handler-compat/native.js.map +1 -0
  156. package/dist/gesture-handler-compat/orchestrator.d.ts +77 -0
  157. package/dist/gesture-handler-compat/orchestrator.js +284 -0
  158. package/dist/gesture-handler-compat/orchestrator.js.map +1 -0
  159. package/dist/gesture-handler-compat/pan.d.ts +23 -0
  160. package/dist/gesture-handler-compat/pan.js +116 -0
  161. package/dist/gesture-handler-compat/pan.js.map +1 -0
  162. package/dist/gesture-handler-compat/recognizer.d.ts +268 -0
  163. package/dist/gesture-handler-compat/recognizer.js +1056 -0
  164. package/dist/gesture-handler-compat/recognizer.js.map +1 -0
  165. package/dist/gesture-handler-compat/relations.d.ts +43 -0
  166. package/dist/gesture-handler-compat/relations.js +128 -0
  167. package/dist/gesture-handler-compat/relations.js.map +1 -0
  168. package/dist/gesture-handler-compat/tap.d.ts +6 -0
  169. package/dist/gesture-handler-compat/tap.js +29 -0
  170. package/dist/gesture-handler-compat/tap.js.map +1 -0
  171. package/dist/gesture-handler-compat/touchpad.d.ts +41 -0
  172. package/dist/gesture-handler-compat/touchpad.js +64 -0
  173. package/dist/gesture-handler-compat/touchpad.js.map +1 -0
  174. package/dist/gesture-handler-compat/types.d.ts +441 -0
  175. package/dist/gesture-handler-compat/types.js +167 -0
  176. package/dist/gesture-handler-compat/types.js.map +1 -0
  177. package/dist/gtk/controllers.d.ts +39 -0
  178. package/dist/gtk/controllers.js +92 -0
  179. package/dist/gtk/controllers.js.map +1 -0
  180. package/dist/gtk/index.d.ts +2 -1
  181. package/dist/gtk/index.js +7 -1
  182. package/dist/gtk/index.js.map +1 -1
  183. package/dist/gtkx/bridge/geometry.js +6 -4
  184. package/dist/gtkx/bridge/geometry.js.map +1 -1
  185. package/dist/gtkx/bridge/index.d.ts +5 -3
  186. package/dist/gtkx/bridge/index.js +6 -3
  187. package/dist/gtkx/bridge/index.js.map +1 -1
  188. package/dist/gtkx/bridge/slot-portal.js.map +1 -1
  189. package/dist/gtkx/bridge/use-signal.js +1 -1
  190. package/dist/gtkx/bridge/use-signal.js.map +1 -1
  191. package/dist/gtkx/bridge/view-box.d.ts +56 -0
  192. package/dist/gtkx/bridge/view-box.js +394 -9
  193. package/dist/gtkx/bridge/view-box.js.map +1 -1
  194. package/dist/gtkx/bridge/widget-css.d.ts +17 -0
  195. package/dist/gtkx/bridge/widget-css.js +72 -0
  196. package/dist/gtkx/bridge/widget-css.js.map +1 -0
  197. package/dist/index.d.ts +3 -3
  198. package/dist/index.js +2 -2
  199. package/dist/index.js.map +1 -1
  200. package/dist/layout/driven-size.d.ts +12 -0
  201. package/dist/layout/driven-size.js +70 -0
  202. package/dist/layout/driven-size.js.map +1 -0
  203. package/dist/layout/engine.d.ts +17 -1
  204. package/dist/layout/engine.js +3 -20
  205. package/dist/layout/engine.js.map +1 -1
  206. package/dist/layout/node.d.ts +13 -0
  207. package/dist/layout/node.js +14 -0
  208. package/dist/layout/node.js.map +1 -1
  209. package/dist/layout/yoga.d.ts +3 -2
  210. package/dist/layout/yoga.js +5 -2
  211. package/dist/layout/yoga.js.map +1 -1
  212. package/dist/mcp/data/generated.d.ts +257 -60
  213. package/dist/mcp/data/generated.js +306 -62
  214. package/dist/mcp/data/generated.js.map +1 -1
  215. package/dist/metro/index.d.ts +10 -0
  216. package/dist/metro/index.js +21 -12
  217. package/dist/metro/index.js.map +1 -1
  218. package/dist/navigation/sidebar.d.ts +16 -0
  219. package/dist/navigation/sidebar.js +65 -1
  220. package/dist/navigation/sidebar.js.map +1 -1
  221. package/dist/reanimated-compat/animated-ref.d.ts +32 -0
  222. package/dist/reanimated-compat/animated-ref.js +57 -0
  223. package/dist/reanimated-compat/animated-ref.js.map +1 -0
  224. package/dist/reanimated-compat/animation.d.ts +177 -0
  225. package/dist/reanimated-compat/animation.js +540 -0
  226. package/dist/reanimated-compat/animation.js.map +1 -0
  227. package/dist/reanimated-compat/color.d.ts +28 -0
  228. package/dist/reanimated-compat/color.js +249 -0
  229. package/dist/reanimated-compat/color.js.map +1 -0
  230. package/dist/reanimated-compat/decay.d.ts +39 -0
  231. package/dist/reanimated-compat/decay.js +96 -0
  232. package/dist/reanimated-compat/decay.js.map +1 -0
  233. package/dist/reanimated-compat/easing.d.ts +30 -0
  234. package/dist/reanimated-compat/easing.js +76 -0
  235. package/dist/reanimated-compat/easing.js.map +1 -0
  236. package/dist/reanimated-compat/hooks.d.ts +14 -0
  237. package/dist/reanimated-compat/hooks.js +217 -0
  238. package/dist/reanimated-compat/hooks.js.map +1 -0
  239. package/dist/reanimated-compat/index.d.ts +258 -0
  240. package/dist/reanimated-compat/index.js +464 -0
  241. package/dist/reanimated-compat/index.js.map +1 -0
  242. package/dist/reanimated-compat/interpolation.d.ts +18 -0
  243. package/dist/reanimated-compat/interpolation.js +122 -0
  244. package/dist/reanimated-compat/interpolation.js.map +1 -0
  245. package/dist/reanimated-compat/layout-animation-config.d.ts +43 -0
  246. package/dist/reanimated-compat/layout-animation-config.js +78 -0
  247. package/dist/reanimated-compat/layout-animation-config.js.map +1 -0
  248. package/dist/reanimated-compat/layout-animation-presets.d.ts +117 -0
  249. package/dist/reanimated-compat/layout-animation-presets.js +498 -0
  250. package/dist/reanimated-compat/layout-animation-presets.js.map +1 -0
  251. package/dist/reanimated-compat/layout-animation-runtime.d.ts +21 -0
  252. package/dist/reanimated-compat/layout-animation-runtime.js +311 -0
  253. package/dist/reanimated-compat/layout-animation-runtime.js.map +1 -0
  254. package/dist/reanimated-compat/layout-animation-view.d.ts +27 -0
  255. package/dist/reanimated-compat/layout-animation-view.js +266 -0
  256. package/dist/reanimated-compat/layout-animation-view.js.map +1 -0
  257. package/dist/reanimated-compat/layout-animation.d.ts +171 -0
  258. package/dist/reanimated-compat/layout-animation.js +469 -0
  259. package/dist/reanimated-compat/layout-animation.js.map +1 -0
  260. package/dist/reanimated-compat/layout-transitions.d.ts +83 -0
  261. package/dist/reanimated-compat/layout-transitions.js +350 -0
  262. package/dist/reanimated-compat/layout-transitions.js.map +1 -0
  263. package/dist/reanimated-compat/mutable.d.ts +29 -0
  264. package/dist/reanimated-compat/mutable.js +139 -0
  265. package/dist/reanimated-compat/mutable.js.map +1 -0
  266. package/dist/reanimated-compat/props.d.ts +18 -0
  267. package/dist/reanimated-compat/props.js +111 -0
  268. package/dist/reanimated-compat/props.js.map +1 -0
  269. package/dist/reanimated-compat/scroll-handler.d.ts +119 -0
  270. package/dist/reanimated-compat/scroll-handler.js +274 -0
  271. package/dist/reanimated-compat/scroll-handler.js.map +1 -0
  272. package/dist/reanimated-compat/scroll-offset.d.ts +12 -0
  273. package/dist/reanimated-compat/scroll-offset.js +104 -0
  274. package/dist/reanimated-compat/scroll-offset.js.map +1 -0
  275. package/dist/reanimated-compat/style.d.ts +90 -0
  276. package/dist/reanimated-compat/style.js +452 -0
  277. package/dist/reanimated-compat/style.js.map +1 -0
  278. package/dist/reanimated-compat/test-timers.d.ts +28 -0
  279. package/dist/reanimated-compat/test-timers.js +136 -0
  280. package/dist/reanimated-compat/test-timers.js.map +1 -0
  281. package/dist/reanimated-compat/threads.d.ts +13 -0
  282. package/dist/reanimated-compat/threads.js +41 -0
  283. package/dist/reanimated-compat/threads.js.map +1 -0
  284. package/dist/reanimated-compat/tracking.d.ts +41 -0
  285. package/dist/reanimated-compat/tracking.js +106 -0
  286. package/dist/reanimated-compat/tracking.js.map +1 -0
  287. package/dist/reanimated-compat/updater-animations.d.ts +36 -0
  288. package/dist/reanimated-compat/updater-animations.js +273 -0
  289. package/dist/reanimated-compat/updater-animations.js.map +1 -0
  290. package/dist/responder/system.d.ts +80 -7
  291. package/dist/responder/system.js +143 -23
  292. package/dist/responder/system.js.map +1 -1
  293. package/dist/responder/use-responder.d.ts +11 -0
  294. package/dist/responder/use-responder.js +225 -6
  295. package/dist/responder/use-responder.js.map +1 -1
  296. package/dist/runner/host-dev.js +1 -1
  297. package/dist/runner/host-dev.js.map +1 -1
  298. package/dist/runner/host.js +1 -1
  299. package/dist/runner/host.js.map +1 -1
  300. package/dist/runner/index.js +3 -3
  301. package/dist/runner/index.js.map +1 -1
  302. package/dist/sea/gtkx-config-module.js +1 -1
  303. package/dist/sea/gtkx-config-module.js.map +1 -1
  304. package/dist/style/absolute-insets.d.ts +26 -0
  305. package/dist/style/absolute-insets.js +113 -0
  306. package/dist/style/absolute-insets.js.map +1 -0
  307. package/dist/style/animated-size.d.ts +25 -0
  308. package/dist/style/animated-size.js +225 -0
  309. package/dist/style/animated-size.js.map +1 -0
  310. package/dist/style/colors.d.ts +17 -0
  311. package/dist/style/colors.js +25 -6
  312. package/dist/style/colors.js.map +1 -1
  313. package/dist/style/imperative-css.d.ts +21 -0
  314. package/dist/style/imperative-css.js +63 -0
  315. package/dist/style/imperative-css.js.map +1 -0
  316. package/dist/style/index.d.ts +2 -1
  317. package/dist/style/index.js +2 -1
  318. package/dist/style/index.js.map +1 -1
  319. package/dist/style/split-style.js +5 -0
  320. package/dist/style/split-style.js.map +1 -1
  321. package/dist/testing/index.js.map +1 -1
  322. package/dist/unsupported-export.d.ts +8 -0
  323. package/dist/unsupported-export.js +66 -0
  324. package/dist/unsupported-export.js.map +1 -0
  325. package/dist/vite/index.d.ts +21 -8
  326. package/dist/vite/index.js +127 -82
  327. package/dist/vite/index.js.map +1 -1
  328. package/dist/vitest/index.d.ts +2 -2
  329. package/dist/vitest/index.js.map +1 -1
  330. package/dist/worklets-compat/index.d.ts +4 -0
  331. package/dist/worklets-compat/index.js +28 -0
  332. package/dist/worklets-compat/index.js.map +1 -0
  333. package/dist/worklets-compat/surface.d.ts +110 -0
  334. package/dist/worklets-compat/surface.js +153 -0
  335. package/dist/worklets-compat/surface.js.map +1 -0
  336. package/package.json +25 -9
  337. package/types.d.ts +9 -0
  338. package/dist/common/list.d.ts +0 -82
  339. package/dist/common/list.js +0 -166
  340. package/dist/common/list.js.map +0 -1
@@ -1,166 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useColorScheme } from "../apis/index";
3
- import { Pressable } from "../components/pressable";
4
- import { Text } from "../components/text";
5
- import { View } from "../components/view";
6
- import { PlatformColor, StyleSheet } from "../style/index";
7
- /** The usual derivation, so no call site has to get the one-row case wrong. */
8
- export const rowPosition = (index, count) => {
9
- const first = index === 0;
10
- const last = index === count - 1;
11
- if (first && last) {
12
- return "only";
13
- }
14
- return first ? "first" : last ? "last" : "middle";
15
- };
16
- // libadwaita 1.9, /org/gnome/Adwaita/styles/gtk.css:
17
- // list.boxed-list { background-color: var(--card-bg-color); border-radius: 12px;
18
- // box-shadow: 0 0 0 1px RGB(0 0 6/3%),
19
- // 0 1px 3px 1px RGB(0 0 6/7%),
20
- // 0 2px 6px 2px RGB(0 0 6/3%); }
21
- const RADIUS = 12;
22
- const styles = StyleSheet.create({
23
- list: {
24
- backgroundColor: PlatformColor("card-bg-color"),
25
- borderRadius: RADIUS,
26
- // The frame is a shadow, not a border, and that distinction is load
27
- // bearing: a border would consume the box and inset every row by a pixel,
28
- // and no border draws the two soft drops underneath.
29
- boxShadow: [
30
- {
31
- offsetX: 0,
32
- offsetY: 0,
33
- spreadDistance: 1,
34
- color: "rgba(0, 0, 6, 0.03)",
35
- },
36
- {
37
- offsetX: 0,
38
- offsetY: 1,
39
- blurRadius: 3,
40
- spreadDistance: 1,
41
- color: "rgba(0, 0, 6, 0.07)",
42
- },
43
- {
44
- offsetX: 0,
45
- offsetY: 2,
46
- blurRadius: 6,
47
- spreadDistance: 2,
48
- color: "rgba(0, 0, 6, 0.03)",
49
- },
50
- ],
51
- },
52
- // `list > row { padding: 2px }` plus
53
- // `row > box.header { margin: 0 12px; border-spacing: 6px; min-height: 50px }`
54
- // — 2 + 50 + 2 + the 1px separator is the 55px row pitch measured off the
55
- // widget's own screenshot.
56
- row: {
57
- flexDirection: "row",
58
- alignItems: "center",
59
- minHeight: 54,
60
- paddingVertical: 2,
61
- paddingHorizontal: 14,
62
- gap: 6,
63
- },
64
- separatorUnder: {
65
- borderBottomWidth: 1,
66
- borderBottomColor: PlatformColor("card-shade-color"),
67
- },
68
- firstRow: { borderTopLeftRadius: RADIUS, borderTopRightRadius: RADIUS },
69
- lastRow: {
70
- borderBottomLeftRadius: RADIUS,
71
- borderBottomRightRadius: RADIUS,
72
- },
73
- // `row > box.header > box.title { margin: 6px 0; border-spacing: 3px }`
74
- titleBox: { flex: 1, marginVertical: 6, gap: 3 },
75
- // The theme font is `Adwaita Sans 11`, i.e. 11pt = 14.67px, and Adwaita sets
76
- // the subtitle to `font-size: smaller` — Pango's one-step-down, 1/1.2. RN's
77
- // fontSize is numeric only (there is no `smaller`, no em, no inherited
78
- // percentage), so the computed value is what an app can write. Documented
79
- // in docs/api.md rather than hidden here.
80
- title: { fontSize: 14.7 },
81
- // `row label.subtitle { opacity: var(--dim-opacity) }`, 55% in the light
82
- // Adwaita palette.
83
- subtitle: { fontSize: 12.2, opacity: 0.55 },
84
- separator: {
85
- height: 1,
86
- backgroundColor: PlatformColor("card-shade-color"),
87
- },
88
- });
89
- // Adwaita tints the hover and press states with a fraction of the FOREGROUND
90
- // colour (`color-mix(in srgb, currentColor 4%, transparent)`), so one literal
91
- // cannot serve both themes and CSS colour functions are not part of RN's
92
- // colour contract. Two literals plus the scheme is what an RN app writes on
93
- // every platform, and it is what this does.
94
- const TINTS = {
95
- light: { hover: "rgba(0, 0, 0, 0.04)", press: "rgba(0, 0, 0, 0.08)" },
96
- dark: {
97
- hover: "rgba(255, 255, 255, 0.04)",
98
- press: "rgba(255, 255, 255, 0.08)",
99
- },
100
- };
101
- /**
102
- * The `.boxed-list` frame: a rounded, shadowed card. Put `ListRow`s in it
103
- * directly, or a `FlatList` whose `renderItem` returns them.
104
- *
105
- * ```tsx
106
- * <List>
107
- * {tasks.map((task, index) => (
108
- * <ListRow
109
- * key={task.id}
110
- * title={task.title}
111
- * position={rowPosition(index, tasks.length)}
112
- * onPress={() => open(task)}
113
- * />
114
- * ))}
115
- * </List>
116
- * ```
117
- */
118
- export const List = ({ children, style, testID }) => (_jsx(View, { testID: testID, style: [styles.list, style], children: children }));
119
- /**
120
- * One row of a {@link List} — `AdwActionRow`'s layout and states, built from
121
- * `Pressable`, `View` and `Text`.
122
- *
123
- * Hover and press come from `Pressable`'s state callback, so they cost what
124
- * they cost anywhere else in this platform: the hover path swaps a CSS class
125
- * on the widget without a React render (see components/pressable.tsx).
126
- *
127
- * **Not yet:** keyboard navigation between rows and a focus ring.
128
- * `GtkListBox` implements those as widget behaviour and RN has no focus model
129
- * for `View` to hang them on — `Pressable`'s state is `{pressed, hovered}`
130
- * with no `focused`. The ring itself is now drawable (`outlineWidth` and
131
- * friends), so what is missing is the state, not the paint.
132
- */
133
- export const ListRow = ({ title, subtitle, prefix, suffix, onPress, position = "middle", separator, style, testID, }) => {
134
- const scheme = useColorScheme() === "dark" ? "dark" : "light";
135
- const tints = TINTS[scheme];
136
- const isFirst = position === "first" || position === "only";
137
- const isLast = position === "last" || position === "only";
138
- const drawSeparator = separator ?? !isLast;
139
- const body = (_jsxs(_Fragment, { children: [prefix, _jsxs(View, { style: styles.titleBox, children: [typeof title === "string" ? (_jsx(Text, { style: styles.title, children: title })) : (title), typeof subtitle === "string" ? (_jsx(Text, { style: styles.subtitle, children: subtitle })) : (subtitle)] }), suffix] }));
140
- const base = [
141
- styles.row,
142
- isFirst && styles.firstRow,
143
- isLast && styles.lastRow,
144
- drawSeparator && styles.separatorUnder,
145
- style,
146
- ];
147
- if (!onPress) {
148
- return (_jsx(View, { testID: testID, style: base, children: body }));
149
- }
150
- return (_jsx(Pressable, { testID: testID, onPress: onPress,
151
- // The tint goes on the ROW, which is why the corner radii above have to
152
- // be on the row too: a hovered first row must round its own top corners
153
- // or the highlight paints square over the card's rounded ones.
154
- style: ({ hovered, pressed }) => [
155
- ...base,
156
- hovered && { backgroundColor: tints.hover },
157
- pressed && { backgroundColor: tints.press },
158
- ], children: body }));
159
- };
160
- /**
161
- * The hairline between two rows, for lists that draw their own separators —
162
- * a `FlatList`'s `ItemSeparatorComponent` is exactly this, and using it means
163
- * the rows themselves stay position-agnostic apart from their corners.
164
- */
165
- export const ListSeparator = () => _jsx(View, { style: styles.separator });
166
- //# sourceMappingURL=list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/common/list.tsx"],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KAAK,QAAQ,CAAC,CAAC,CAAC,CAC9B,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,YAAG,QAAQ,GAAQ,CAChD,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,IACI,EACN,MAAM,IACN,CACJ,CAAA;IAED,MAAM,IAAI,GAAG;QACX,MAAM,CAAC,GAAG;QACV,OAAO,IAAI,MAAM,CAAC,QAAQ;QAC1B,MAAM,IAAI,MAAM,CAAC,OAAO;QACxB,aAAa,IAAI,MAAM,CAAC,cAAc;QACtC,KAAK;KACN,CAAA;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CACL,KAAC,IAAI,IACH,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,IAAI,YAEV,IAAI,GACA,CACR,CAAA;IACH,CAAC;IAED,OAAO,CACL,KAAC,SAAS,IACR,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO;QAChB,wEAAwE;QACxE,wEAAwE;QACxE,+DAA+D;QAC/D,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;YAC/B,GAAG,IAAI;YACP,OAAO,IAAI,EAAE,eAAe,EAAE,KAAK,CAAC,KAAK,EAAE;YAC3C,OAAO,IAAI,EAAE,eAAe,EAAE,KAAK,CAAC,KAAK,EAAE;SAC5C,YAEA,IAAI,GACK,CACb,CAAA;AACH,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAc,EAAE,CAAC,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,GAAI,CAAA","sourcesContent":["// Adwaita's boxed list, for code written in React Native.\n//\n// WHY this is here rather than in an app. `.boxed-list` is the single most\n// recognisable piece of GNOME chrome, and docs/research/react-native-first-showcase.md\n// measured what it actually is: a rounded, shadowed card whose rows carry\n// hairline separators, a hover tint and a press tint. Every one of those is a\n// style — there is no widget BEHAVIOUR in the look at all. So an app can build\n// it from `View` and `Pressable`, and `examples/tasks-nav` proves it.\n//\n// What an app should not have to do is rediscover the numbers. They come from\n// libadwaita's own compiled stylesheet, they are not obvious (the frame is a\n// three-part `box-shadow`, not a border; the first and last rows carry the\n// corner radii, not the container), and they move when libadwaita moves. That\n// is a platform's job, which is what this subpath is.\n//\n// Everything below is portable React Native underneath — no widget is created\n// that an app could not have created itself. Compare `Widget`/`SlotContent`\n// next door, which exist precisely because they CANNOT be written in RN.\nimport { type ReactNode } from \"react\"\nimport { useColorScheme } from \"../apis/index\"\nimport { Pressable } from \"../components/pressable\"\nimport { Text } from \"../components/text\"\nimport { View } from \"../components/view\"\nimport { PlatformColor, StyleSheet } from \"../style/index\"\nimport type { StyleProp } from \"../contracts\"\n\n/**\n * Where a row sits in its list, which is what decides its corner radii and\n * whether it draws a separator under itself.\n *\n * RN has no `:first-child`, so this is explicit. From a `FlatList` it is\n * `rowPosition(index, data.length)`; from a static list it is the same\n * expression over the array.\n */\nexport type ListRowPosition = \"first\" | \"middle\" | \"last\" | \"only\"\n\n/** The usual derivation, so no call site has to get the one-row case wrong. */\nexport const rowPosition = (index: number, count: number): ListRowPosition => {\n const first = index === 0\n const last = index === count - 1\n if (first && last) {\n return \"only\"\n }\n return first ? \"first\" : last ? \"last\" : \"middle\"\n}\n\n// libadwaita 1.9, /org/gnome/Adwaita/styles/gtk.css:\n// list.boxed-list { background-color: var(--card-bg-color); border-radius: 12px;\n// box-shadow: 0 0 0 1px RGB(0 0 6/3%),\n// 0 1px 3px 1px RGB(0 0 6/7%),\n// 0 2px 6px 2px RGB(0 0 6/3%); }\nconst RADIUS = 12\n\nconst styles = StyleSheet.create({\n list: {\n backgroundColor: PlatformColor(\"card-bg-color\"),\n borderRadius: RADIUS,\n // The frame is a shadow, not a border, and that distinction is load\n // bearing: a border would consume the box and inset every row by a pixel,\n // and no border draws the two soft drops underneath.\n boxShadow: [\n {\n offsetX: 0,\n offsetY: 0,\n spreadDistance: 1,\n color: \"rgba(0, 0, 6, 0.03)\",\n },\n {\n offsetX: 0,\n offsetY: 1,\n blurRadius: 3,\n spreadDistance: 1,\n color: \"rgba(0, 0, 6, 0.07)\",\n },\n {\n offsetX: 0,\n offsetY: 2,\n blurRadius: 6,\n spreadDistance: 2,\n color: \"rgba(0, 0, 6, 0.03)\",\n },\n ],\n },\n // `list > row { padding: 2px }` plus\n // `row > box.header { margin: 0 12px; border-spacing: 6px; min-height: 50px }`\n // — 2 + 50 + 2 + the 1px separator is the 55px row pitch measured off the\n // widget's own screenshot.\n row: {\n flexDirection: \"row\",\n alignItems: \"center\",\n minHeight: 54,\n paddingVertical: 2,\n paddingHorizontal: 14,\n gap: 6,\n },\n separatorUnder: {\n borderBottomWidth: 1,\n borderBottomColor: PlatformColor(\"card-shade-color\"),\n },\n firstRow: { borderTopLeftRadius: RADIUS, borderTopRightRadius: RADIUS },\n lastRow: {\n borderBottomLeftRadius: RADIUS,\n borderBottomRightRadius: RADIUS,\n },\n // `row > box.header > box.title { margin: 6px 0; border-spacing: 3px }`\n titleBox: { flex: 1, marginVertical: 6, gap: 3 },\n // The theme font is `Adwaita Sans 11`, i.e. 11pt = 14.67px, and Adwaita sets\n // the subtitle to `font-size: smaller` — Pango's one-step-down, 1/1.2. RN's\n // fontSize is numeric only (there is no `smaller`, no em, no inherited\n // percentage), so the computed value is what an app can write. Documented\n // in docs/api.md rather than hidden here.\n title: { fontSize: 14.7 },\n // `row label.subtitle { opacity: var(--dim-opacity) }`, 55% in the light\n // Adwaita palette.\n subtitle: { fontSize: 12.2, opacity: 0.55 },\n separator: {\n height: 1,\n backgroundColor: PlatformColor(\"card-shade-color\"),\n },\n})\n\n// Adwaita tints the hover and press states with a fraction of the FOREGROUND\n// colour (`color-mix(in srgb, currentColor 4%, transparent)`), so one literal\n// cannot serve both themes and CSS colour functions are not part of RN's\n// colour contract. Two literals plus the scheme is what an RN app writes on\n// every platform, and it is what this does.\nconst TINTS = {\n light: { hover: \"rgba(0, 0, 0, 0.04)\", press: \"rgba(0, 0, 0, 0.08)\" },\n dark: {\n hover: \"rgba(255, 255, 255, 0.04)\",\n press: \"rgba(255, 255, 255, 0.08)\",\n },\n} as const\n\nexport type ListProps = {\n children?: ReactNode\n style?: StyleProp\n testID?: string\n}\n\n/**\n * The `.boxed-list` frame: a rounded, shadowed card. Put `ListRow`s in it\n * directly, or a `FlatList` whose `renderItem` returns them.\n *\n * ```tsx\n * <List>\n * {tasks.map((task, index) => (\n * <ListRow\n * key={task.id}\n * title={task.title}\n * position={rowPosition(index, tasks.length)}\n * onPress={() => open(task)}\n * />\n * ))}\n * </List>\n * ```\n */\nexport const List = ({ children, style, testID }: ListProps): ReactNode => (\n <View\n testID={testID}\n style={[styles.list, style]}\n >\n {children}\n </View>\n)\n\nexport type ListRowProps = {\n /** Primary line. A string renders with the row's own typography; a node is\n * rendered as given, for a title that needs its own styling. */\n title?: ReactNode\n /** Second, dimmed line. Omitted rows are single-line, as `AdwActionRow`'s\n * are. */\n subtitle?: ReactNode\n /** Leading content — a checkbox, an icon, a colour swatch. */\n prefix?: ReactNode\n /** Trailing content — buttons, a value, a chevron. */\n suffix?: ReactNode\n /** Makes the row activatable: it gains the hover and press tints and calls\n * this. Without it the row is inert, like a non-`activatable`\n * `AdwActionRow`. */\n onPress?: () => void\n /** Position in the list, for the corner radii and the separator. Defaults\n * to `\"middle\"`, which is right for a row that is neither. */\n position?: ListRowPosition\n /** Draw the hairline under this row. Default true for every position except\n * the last — set it false when the list supplies its own separators (a\n * `FlatList`'s `ItemSeparatorComponent`, say). */\n separator?: boolean\n style?: StyleProp\n testID?: string\n}\n\n/**\n * One row of a {@link List} — `AdwActionRow`'s layout and states, built from\n * `Pressable`, `View` and `Text`.\n *\n * Hover and press come from `Pressable`'s state callback, so they cost what\n * they cost anywhere else in this platform: the hover path swaps a CSS class\n * on the widget without a React render (see components/pressable.tsx).\n *\n * **Not yet:** keyboard navigation between rows and a focus ring.\n * `GtkListBox` implements those as widget behaviour and RN has no focus model\n * for `View` to hang them on — `Pressable`'s state is `{pressed, hovered}`\n * with no `focused`. The ring itself is now drawable (`outlineWidth` and\n * friends), so what is missing is the state, not the paint.\n */\nexport const ListRow = ({\n title,\n subtitle,\n prefix,\n suffix,\n onPress,\n position = \"middle\",\n separator,\n style,\n testID,\n}: ListRowProps): ReactNode => {\n const scheme = useColorScheme() === \"dark\" ? \"dark\" : \"light\"\n const tints = TINTS[scheme]\n const isFirst = position === \"first\" || position === \"only\"\n const isLast = position === \"last\" || position === \"only\"\n const drawSeparator = separator ?? !isLast\n\n const body = (\n <>\n {prefix}\n <View style={styles.titleBox}>\n {typeof title === \"string\" ? (\n <Text style={styles.title}>{title}</Text>\n ) : (\n title\n )}\n {typeof subtitle === \"string\" ? (\n <Text style={styles.subtitle}>{subtitle}</Text>\n ) : (\n subtitle\n )}\n </View>\n {suffix}\n </>\n )\n\n const base = [\n styles.row,\n isFirst && styles.firstRow,\n isLast && styles.lastRow,\n drawSeparator && styles.separatorUnder,\n style,\n ]\n\n if (!onPress) {\n return (\n <View\n testID={testID}\n style={base}\n >\n {body}\n </View>\n )\n }\n\n return (\n <Pressable\n testID={testID}\n onPress={onPress}\n // The tint goes on the ROW, which is why the corner radii above have to\n // be on the row too: a hovered first row must round its own top corners\n // or the highlight paints square over the card's rounded ones.\n style={({ hovered, pressed }) => [\n ...base,\n hovered && { backgroundColor: tints.hover },\n pressed && { backgroundColor: tints.press },\n ]}\n >\n {body}\n </Pressable>\n )\n}\n\n/**\n * The hairline between two rows, for lists that draw their own separators —\n * a `FlatList`'s `ItemSeparatorComponent` is exactly this, and using it means\n * the rows themselves stay position-agnostic apart from their corners.\n */\nexport const ListSeparator = (): ReactNode => <View style={styles.separator} />\n"]}