@flipova/foundation 2.4.4 → 3.0.0-beta.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 (402) hide show
  1. package/CHANGES.md +66 -0
  2. package/COMPONENTS.md +102 -0
  3. package/DOCS.md +261 -0
  4. package/LICENSE +1 -1
  5. package/README.md +169 -118
  6. package/components/contract/index.ts +3 -0
  7. package/components/contract/recipes/accordion.ts +42 -0
  8. package/components/contract/recipes/avatar.ts +41 -0
  9. package/components/contract/recipes/badge.ts +46 -0
  10. package/components/contract/recipes/button.ts +58 -0
  11. package/components/contract/recipes/calendar.ts +118 -0
  12. package/components/contract/recipes/card.ts +21 -0
  13. package/components/contract/recipes/checkbox.ts +33 -0
  14. package/components/contract/recipes/divider.ts +9 -0
  15. package/components/contract/recipes/fab.ts +31 -0
  16. package/components/contract/recipes/feedback.ts +66 -0
  17. package/components/contract/recipes/formcontrol.ts +16 -0
  18. package/components/contract/recipes/heading.ts +16 -0
  19. package/components/contract/recipes/icon.ts +40 -0
  20. package/components/contract/recipes/index.ts +30 -0
  21. package/components/contract/recipes/input.ts +39 -0
  22. package/components/contract/recipes/layout.ts +44 -0
  23. package/components/contract/recipes/link.ts +6 -0
  24. package/components/contract/recipes/modal.ts +40 -0
  25. package/components/contract/recipes/overlay.ts +250 -0
  26. package/components/contract/recipes/progress.ts +27 -0
  27. package/components/contract/recipes/radio.ts +39 -0
  28. package/components/contract/recipes/select.ts +63 -0
  29. package/components/contract/recipes/skeleton.ts +25 -0
  30. package/components/contract/recipes/slider.ts +50 -0
  31. package/components/contract/recipes/spinner.ts +12 -0
  32. package/components/contract/recipes/switch.ts +26 -0
  33. package/components/contract/recipes/table.ts +37 -0
  34. package/components/contract/recipes/tabs.ts +31 -0
  35. package/components/contract/recipes/text.ts +12 -0
  36. package/components/contract/recipes/textarea.ts +37 -0
  37. package/components/contract/recipes/util.ts +15 -0
  38. package/components/contract/theme.ts +116 -0
  39. package/components/contract/types.ts +598 -0
  40. package/components/providers/css-vars.ts +43 -0
  41. package/components/providers/flipova/components/Accordion.tsx +41 -0
  42. package/components/providers/flipova/components/ActionSheet.tsx +34 -0
  43. package/components/providers/flipova/components/Alert.tsx +15 -0
  44. package/components/providers/flipova/components/AlertDialog.tsx +31 -0
  45. package/components/providers/flipova/components/Avatar.tsx +30 -0
  46. package/components/providers/flipova/components/Badge.tsx +14 -0
  47. package/components/providers/flipova/components/BottomSheet.tsx +24 -0
  48. package/components/providers/flipova/components/Box.tsx +1 -0
  49. package/components/providers/flipova/components/Button.tsx +31 -0
  50. package/components/providers/flipova/components/Calendar.tsx +85 -0
  51. package/components/providers/flipova/components/Card.tsx +13 -0
  52. package/components/providers/flipova/components/Center.tsx +11 -0
  53. package/components/providers/flipova/components/Checkbox.tsx +24 -0
  54. package/components/providers/flipova/components/DateTimePicker.tsx +45 -0
  55. package/components/providers/flipova/components/Divider.tsx +9 -0
  56. package/components/providers/flipova/components/Drawer.tsx +18 -0
  57. package/components/providers/flipova/components/Fab.tsx +22 -0
  58. package/components/providers/flipova/components/FlatList.tsx +1 -0
  59. package/components/providers/flipova/components/FormControl.tsx +27 -0
  60. package/components/providers/flipova/components/Grid.tsx +18 -0
  61. package/components/providers/flipova/components/HStack.tsx +13 -0
  62. package/components/providers/flipova/components/Heading.tsx +19 -0
  63. package/components/providers/flipova/components/Icon.tsx +20 -0
  64. package/components/providers/flipova/components/Image.tsx +1 -0
  65. package/components/providers/flipova/components/ImageBackground.tsx +1 -0
  66. package/components/providers/flipova/components/ImageViewer.tsx +25 -0
  67. package/components/providers/flipova/components/Input.tsx +29 -0
  68. package/components/providers/flipova/components/InputAccessoryView.tsx +1 -0
  69. package/components/providers/flipova/components/KeyboardAvoidingView.tsx +1 -0
  70. package/components/providers/flipova/components/Link.tsx +21 -0
  71. package/components/providers/flipova/components/LiquidGlass.tsx +13 -0
  72. package/components/providers/flipova/components/Menu.tsx +43 -0
  73. package/components/providers/flipova/components/Modal.tsx +24 -0
  74. package/components/providers/flipova/components/Popover.tsx +23 -0
  75. package/components/providers/flipova/components/Portal.tsx +42 -0
  76. package/components/providers/flipova/components/Pressable.tsx +1 -0
  77. package/components/providers/flipova/components/Progress.tsx +22 -0
  78. package/components/providers/flipova/components/RadioGroup.tsx +36 -0
  79. package/components/providers/flipova/components/RefreshControl.tsx +1 -0
  80. package/components/providers/flipova/components/SafeAreaView.tsx +1 -0
  81. package/components/providers/flipova/components/ScrollView.tsx +1 -0
  82. package/components/providers/flipova/components/SectionList.tsx +1 -0
  83. package/components/providers/flipova/components/Select.tsx +61 -0
  84. package/components/providers/flipova/components/Skeleton.tsx +25 -0
  85. package/components/providers/flipova/components/Slider.tsx +52 -0
  86. package/components/providers/flipova/components/Spinner.tsx +19 -0
  87. package/components/providers/flipova/components/StatusBar.tsx +1 -0
  88. package/components/providers/flipova/components/Switch.tsx +21 -0
  89. package/components/providers/flipova/components/Table.tsx +33 -0
  90. package/components/providers/flipova/components/Tabs.tsx +39 -0
  91. package/components/providers/flipova/components/Text.tsx +13 -0
  92. package/components/providers/flipova/components/Textarea.tsx +28 -0
  93. package/components/providers/flipova/components/Toast.tsx +28 -0
  94. package/components/providers/flipova/components/Tooltip.tsx +34 -0
  95. package/components/providers/flipova/components/VStack.tsx +13 -0
  96. package/components/providers/flipova/components/View.tsx +1 -0
  97. package/components/providers/flipova/components/VirtualizedList.tsx +1 -0
  98. package/components/providers/flipova/index.tsx +189 -0
  99. package/components/providers/gluestack/index.tsx +226 -0
  100. package/components/providers/gluestack/more.tsx +151 -0
  101. package/components/{ui → providers/gluestack/ui}/accordion/index.tsx +2 -2
  102. package/components/{ui → providers/gluestack/ui}/actionsheet/index.tsx +15 -15
  103. package/components/{ui → providers/gluestack/ui}/alert/index.tsx +1 -1
  104. package/components/{ui → providers/gluestack/ui}/alert-dialog/index.tsx +3 -3
  105. package/components/{ui → providers/gluestack/ui}/badge/index.tsx +2 -2
  106. package/components/{ui → providers/gluestack/ui}/bottomsheet/index.tsx +11 -10
  107. package/components/{ui → providers/gluestack/ui}/box/index.tsx +4 -1
  108. package/components/{ui → providers/gluestack/ui}/button/index.tsx +1 -1
  109. package/components/{ui → providers/gluestack/ui}/calendar/index.tsx +4 -4
  110. package/components/{ui → providers/gluestack/ui}/card/index.tsx +1 -1
  111. package/components/{ui → providers/gluestack/ui}/center/index.tsx +1 -1
  112. package/components/{ui → providers/gluestack/ui}/checkbox/index.tsx +9 -8
  113. package/components/{ui → providers/gluestack/ui}/date-time-picker/index.tsx +4 -4
  114. package/components/providers/gluestack/ui/date-time-picker/index.web.tsx +197 -0
  115. package/components/{ui → providers/gluestack/ui}/divider/index.tsx +1 -1
  116. package/components/{ui → providers/gluestack/ui}/drawer/index.tsx +2 -2
  117. package/components/{ui → providers/gluestack/ui}/fab/index.tsx +1 -1
  118. package/components/{ui → providers/gluestack/ui}/form-control/index.tsx +3 -3
  119. package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/config.ts +1 -62
  120. package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/tokens.js +1 -1
  121. package/components/{ui → providers/gluestack/ui}/grid/index.tsx +3 -3
  122. package/components/{ui → providers/gluestack/ui}/heading/index.tsx +7 -7
  123. package/components/{ui → providers/gluestack/ui}/hstack/index.tsx +1 -1
  124. package/components/{ui → providers/gluestack/ui}/icon/index.tsx +1 -1
  125. package/components/{ui → providers/gluestack/ui}/image/index.tsx +0 -1
  126. package/components/{ui → providers/gluestack/ui}/image-viewer/index.tsx +96 -99
  127. package/components/providers/gluestack/ui/index.ts +58 -0
  128. package/components/{ui → providers/gluestack/ui}/input/index.tsx +1 -1
  129. package/components/{ui → providers/gluestack/ui}/link/index.tsx +2 -2
  130. package/components/{ui → providers/gluestack/ui}/liquid-glass/index.tsx +2 -2
  131. package/components/{ui → providers/gluestack/ui}/menu/index.tsx +5 -4
  132. package/components/{ui → providers/gluestack/ui}/modal/index.tsx +19 -17
  133. package/components/{ui → providers/gluestack/ui}/popover/index.tsx +4 -4
  134. package/components/{ui → providers/gluestack/ui}/portal/index.tsx +1 -1
  135. package/components/{ui → providers/gluestack/ui}/progress/index.tsx +2 -2
  136. package/components/{ui → providers/gluestack/ui}/radio/index.tsx +1 -1
  137. package/components/{ui → providers/gluestack/ui}/select/index.tsx +8 -12
  138. package/components/{ui → providers/gluestack/ui}/select/select-actionsheet.tsx +13 -13
  139. package/components/{ui → providers/gluestack/ui}/skeleton/index.tsx +2 -2
  140. package/components/{ui → providers/gluestack/ui}/slider/index.tsx +1 -1
  141. package/components/{ui → providers/gluestack/ui}/spinner/index.tsx +2 -2
  142. package/components/{ui → providers/gluestack/ui}/table/index.tsx +33 -33
  143. package/components/{ui → providers/gluestack/ui}/tabs/TabsAnimatedIndicator.tsx +1 -1
  144. package/components/{ui → providers/gluestack/ui}/tabs/index.tsx +2 -2
  145. package/components/{ui → providers/gluestack/ui}/text/index.tsx +1 -1
  146. package/components/{ui → providers/gluestack/ui}/toast/index.tsx +4 -4
  147. package/components/{ui → providers/gluestack/ui}/tooltip/index.tsx +1 -1
  148. package/components/{ui → providers/gluestack/ui}/vstack/index.tsx +1 -1
  149. package/components/providers/index.ts +2 -0
  150. package/components/providers/paper/index.tsx +449 -0
  151. package/components/providers/provider.tsx +80 -0
  152. package/components/providers/reusables/classes.ts +163 -0
  153. package/components/providers/reusables/index.tsx +289 -0
  154. package/components/providers/rn-base/Box.tsx +7 -0
  155. package/components/providers/rn-base/FlatList.tsx +16 -0
  156. package/components/providers/rn-base/Image.tsx +18 -0
  157. package/components/providers/rn-base/ImageBackground.tsx +11 -0
  158. package/components/providers/rn-base/InputAccessoryView.tsx +9 -0
  159. package/components/providers/rn-base/KeyboardAvoidingView.tsx +15 -0
  160. package/components/providers/rn-base/Pressable.tsx +19 -0
  161. package/components/providers/rn-base/RefreshControl.tsx +16 -0
  162. package/components/providers/rn-base/SafeAreaView.tsx +11 -0
  163. package/components/providers/rn-base/ScrollView.tsx +11 -0
  164. package/components/providers/rn-base/SectionList.tsx +22 -0
  165. package/components/providers/rn-base/StatusBar.tsx +17 -0
  166. package/components/providers/rn-base/View.tsx +7 -0
  167. package/components/providers/rn-base/VirtualizedList.tsx +18 -0
  168. package/components/providers/rn-base/index.tsx +64 -0
  169. package/components/providers/tamagui/index.tsx +375 -0
  170. package/components/providers/types.ts +17 -0
  171. package/components/theme/design-theme.ts +230 -0
  172. package/components/ui/create.tsx +14 -0
  173. package/components/ui/index.ts +68 -58
  174. package/components/ui/resolve.ts +40 -0
  175. package/design/canonical.index.txt +2 -16
  176. package/design/manifest.xml +4 -3
  177. package/design/schema.xsd +44 -434
  178. package/design/themes.xml +7 -177
  179. package/design/tools/{npm.js → cli.js} +173 -73
  180. package/design/tools/gui/index.html +998 -0
  181. package/design/tools/lib/check.js +533 -0
  182. package/design/tools/lib/contract.js +23 -0
  183. package/design/tools/lib/edit.js +166 -0
  184. package/design/tools/lib/generate.js +465 -0
  185. package/design/tools/lib/gui.js +614 -0
  186. package/design/tools/lib/lint.js +139 -0
  187. package/design/tools/lib/registry.js +135 -0
  188. package/design/tools/lib/util.js +53 -0
  189. package/design/tools/lib/xml.js +257 -0
  190. package/design/tools/lib/xsd.js +408 -0
  191. package/dist/chunk-2QM2ZUDS.mjs +1308 -0
  192. package/dist/chunk-2QM2ZUDS.mjs.map +1 -0
  193. package/dist/chunk-2T2TCUYF.js +1371 -0
  194. package/dist/chunk-2T2TCUYF.js.map +1 -0
  195. package/dist/chunk-6UKTC4KF.js +43 -0
  196. package/dist/chunk-6UKTC4KF.js.map +1 -0
  197. package/dist/chunk-6Z4WRTI4.mjs +37 -0
  198. package/dist/chunk-6Z4WRTI4.mjs.map +1 -0
  199. package/dist/chunk-G3K6J5KY.js +157 -0
  200. package/dist/chunk-G3K6J5KY.js.map +1 -0
  201. package/dist/chunk-GM45RCSI.mjs +96 -0
  202. package/dist/chunk-GM45RCSI.mjs.map +1 -0
  203. package/dist/chunk-GQJLHH2P.mjs +3 -0
  204. package/dist/chunk-GQJLHH2P.mjs.map +1 -0
  205. package/dist/chunk-ICNR56VP.js +1653 -0
  206. package/dist/chunk-ICNR56VP.js.map +1 -0
  207. package/dist/chunk-J5LGTIGS.mjs +9 -0
  208. package/dist/chunk-J5LGTIGS.mjs.map +1 -0
  209. package/dist/chunk-LRPZLF2K.mjs +30 -0
  210. package/dist/chunk-LRPZLF2K.mjs.map +1 -0
  211. package/dist/chunk-OC4MXNXU.js +32 -0
  212. package/dist/chunk-OC4MXNXU.js.map +1 -0
  213. package/dist/chunk-PZ5AY32C.js +11 -0
  214. package/dist/chunk-PZ5AY32C.js.map +1 -0
  215. package/dist/chunk-RWVTZUEG.js +161 -0
  216. package/dist/chunk-RWVTZUEG.js.map +1 -0
  217. package/dist/chunk-V473I5XQ.js +4 -0
  218. package/dist/chunk-V473I5XQ.js.map +1 -0
  219. package/dist/chunk-V4ULAISZ.js +915 -0
  220. package/dist/chunk-V4ULAISZ.js.map +1 -0
  221. package/dist/chunk-WRJERTJS.mjs +145 -0
  222. package/dist/chunk-WRJERTJS.mjs.map +1 -0
  223. package/dist/chunk-YIBPE3KQ.mjs +864 -0
  224. package/dist/chunk-YIBPE3KQ.mjs.map +1 -0
  225. package/dist/chunk-YUAQIZPN.mjs +1556 -0
  226. package/dist/chunk-YUAQIZPN.mjs.map +1 -0
  227. package/dist/contract/index.d.mts +304 -0
  228. package/dist/contract/index.d.ts +304 -0
  229. package/dist/contract/index.js +256 -0
  230. package/dist/contract/index.js.map +1 -0
  231. package/dist/contract/index.mjs +3 -0
  232. package/dist/contract/index.mjs.map +1 -0
  233. package/dist/index.d.mts +4 -40
  234. package/dist/index.d.ts +4 -40
  235. package/dist/index.js +73 -992
  236. package/dist/index.mjs +2 -1
  237. package/dist/providers/flipova/index.d.mts +133 -0
  238. package/dist/providers/flipova/index.d.ts +133 -0
  239. package/dist/providers/flipova/index.js +249 -0
  240. package/dist/providers/flipova/index.js.map +1 -0
  241. package/dist/providers/flipova/index.mjs +4 -0
  242. package/dist/providers/flipova/index.mjs.map +1 -0
  243. package/dist/providers/gluestack/index.d.mts +7 -0
  244. package/dist/providers/gluestack/index.d.ts +7 -0
  245. package/dist/providers/gluestack/index.js +240 -0
  246. package/dist/providers/gluestack/index.js.map +1 -0
  247. package/dist/providers/gluestack/index.mjs +238 -0
  248. package/dist/providers/gluestack/index.mjs.map +1 -0
  249. package/dist/providers/gluestack/ui/index.d.mts +3472 -0
  250. package/dist/providers/gluestack/ui/index.d.ts +3472 -0
  251. package/dist/{chunk-LCTFQJZM.js → providers/gluestack/ui/index.js} +860 -2297
  252. package/dist/providers/gluestack/ui/index.js.map +1 -0
  253. package/dist/{chunk-2R66P5X5.mjs → providers/gluestack/ui/index.mjs} +468 -2062
  254. package/dist/providers/gluestack/ui/index.mjs.map +1 -0
  255. package/dist/providers/index.d.mts +37 -0
  256. package/dist/providers/index.d.ts +37 -0
  257. package/dist/providers/index.js +28 -0
  258. package/dist/providers/index.js.map +1 -0
  259. package/dist/providers/index.mjs +3 -0
  260. package/dist/providers/index.mjs.map +1 -0
  261. package/dist/providers/paper/index.d.mts +30 -0
  262. package/dist/providers/paper/index.d.ts +30 -0
  263. package/dist/providers/paper/index.js +362 -0
  264. package/dist/providers/paper/index.js.map +1 -0
  265. package/dist/providers/paper/index.mjs +353 -0
  266. package/dist/providers/paper/index.mjs.map +1 -0
  267. package/dist/providers/reusables/index.d.mts +60 -0
  268. package/dist/providers/reusables/index.d.ts +60 -0
  269. package/dist/providers/reusables/index.js +348 -0
  270. package/dist/providers/reusables/index.js.map +1 -0
  271. package/dist/providers/reusables/index.mjs +311 -0
  272. package/dist/providers/reusables/index.mjs.map +1 -0
  273. package/dist/providers/tamagui/index.d.mts +15 -0
  274. package/dist/providers/tamagui/index.d.ts +15 -0
  275. package/dist/providers/tamagui/index.js +275 -0
  276. package/dist/providers/tamagui/index.js.map +1 -0
  277. package/dist/providers/tamagui/index.mjs +270 -0
  278. package/dist/providers/tamagui/index.mjs.map +1 -0
  279. package/dist/theme-BznFrVT1.d.mts +566 -0
  280. package/dist/theme-BznFrVT1.d.ts +566 -0
  281. package/dist/types-C7P80VKR.d.ts +22 -0
  282. package/dist/types-Tspvmask.d.mts +22 -0
  283. package/dist/ui/index.d.mts +190 -7017
  284. package/dist/ui/index.d.ts +190 -7017
  285. package/dist/ui/index.js +73 -992
  286. package/dist/ui/index.mjs +2 -1
  287. package/package.json +136 -35
  288. package/components/ui/date-time-picker/index.web.tsx +0 -195
  289. package/design/documentation.xml +0 -607
  290. package/design/tools/design.js +0 -188
  291. package/design/tools/requirements.txt +0 -35
  292. package/design/tools/sources/.checker/__init__.py +0 -81
  293. package/design/tools/sources/.checker/checks.py +0 -198
  294. package/design/tools/sources/.checker/cli.py +0 -154
  295. package/design/tools/sources/.checker/io.py +0 -242
  296. package/design/tools/sources/.checker/model.py +0 -144
  297. package/design/tools/sources/.checker/registry.py +0 -115
  298. package/design/tools/sources/.checker/report.py +0 -21
  299. package/design/tools/sources/.docgen/__init__.py +0 -45
  300. package/design/tools/sources/.docgen/cli.py +0 -101
  301. package/design/tools/sources/.docgen/model.py +0 -147
  302. package/design/tools/sources/.docgen/reference.py +0 -97
  303. package/design/tools/sources/.docgen/site.py +0 -145
  304. package/design/tools/sources/.docgen/xsddoc.py +0 -329
  305. package/design/tools/sources/.generate/__init__.py +0 -35
  306. package/design/tools/sources/.generate/cli.py +0 -76
  307. package/design/tools/sources/.generate/common.py +0 -33
  308. package/design/tools/sources/.generate/config.py +0 -177
  309. package/design/tools/sources/.generate/model.py +0 -51
  310. package/design/tools/sources/.generate/tokens.py +0 -141
  311. package/design/tools/sources/.linter/__init__.py +0 -9
  312. package/design/tools/sources/.linter/cli.py +0 -44
  313. package/design/tools/sources/.linter/discovery.py +0 -30
  314. package/design/tools/sources/.linter/errors.py +0 -45
  315. package/design/tools/sources/.linter/linter.py +0 -68
  316. package/design/tools/sources/.xmleditor/__init__.py +0 -74
  317. package/design/tools/sources/.xmleditor/blocks.py +0 -185
  318. package/design/tools/sources/.xmleditor/cli.py +0 -141
  319. package/design/tools/sources/.xmleditor/editor.py +0 -906
  320. package/design/tools/sources/.xmleditor/model.py +0 -708
  321. package/design/tools/sources/.xmleditor/widgets.py +0 -1832
  322. package/design/tools/sources/.xmleditor/xsdmodel.py +0 -753
  323. package/design/tools/sources/checker.py +0 -55
  324. package/design/tools/sources/docgen.py +0 -66
  325. package/design/tools/sources/generate.py +0 -48
  326. package/design/tools/sources/linter.py +0 -54
  327. package/design/tools/sources/ruff.toml +0 -12
  328. package/design/tools/sources/xmleditor.py +0 -62
  329. package/design/tools/unix/_venv_python.sh +0 -16
  330. package/design/tools/unix/check.sh +0 -13
  331. package/design/tools/unix/doc.sh +0 -14
  332. package/design/tools/unix/gen.sh +0 -14
  333. package/design/tools/unix/lint.sh +0 -10
  334. package/design/tools/unix/run.sh +0 -20
  335. package/design/tools/unix/verify.sh +0 -12
  336. package/design/tools/unix/xmledit.sh +0 -12
  337. package/design/tools/windows/check.cmd +0 -12
  338. package/design/tools/windows/doc.cmd +0 -12
  339. package/design/tools/windows/gen.cmd +0 -11
  340. package/design/tools/windows/lint.cmd +0 -9
  341. package/design/tools/windows/run.cmd +0 -26
  342. package/design/tools/windows/verify.cmd +0 -10
  343. package/design/tools/windows/xmledit.cmd +0 -10
  344. package/dist/chunk-2R66P5X5.mjs.map +0 -1
  345. package/dist/chunk-LCTFQJZM.js.map +0 -1
  346. /package/components/{ui → providers/gluestack/ui}/accordion/ANIMATION_CUSTOMIZATION.md +0 -0
  347. /package/components/{ui → providers/gluestack/ui}/accordion/AccordionAnimatedHeight.tsx +0 -0
  348. /package/components/{ui → providers/gluestack/ui}/accordion/AccordionAnimatedIcon.tsx +0 -0
  349. /package/components/{ui → providers/gluestack/ui}/accordion/AnimatedHeight.tsx +0 -0
  350. /package/components/{ui → providers/gluestack/ui}/accordion/AnimatedIcon.tsx +0 -0
  351. /package/components/{ui → providers/gluestack/ui}/accordion/MIGRATION_SUMMARY.md +0 -0
  352. /package/components/{ui → providers/gluestack/ui}/accordion/USAGE_EXAMPLE.tsx +0 -0
  353. /package/components/{ui → providers/gluestack/ui}/accordion/animation-config.ts +0 -0
  354. /package/components/{ui → providers/gluestack/ui}/avatar/index.tsx +0 -0
  355. /package/components/{ui → providers/gluestack/ui}/box/index.web.tsx +0 -0
  356. /package/components/{ui → providers/gluestack/ui}/box/styles.tsx +0 -0
  357. /package/components/{ui → providers/gluestack/ui}/calendar/creator.tsx +0 -0
  358. /package/components/{ui → providers/gluestack/ui}/calendar/styles.tsx +0 -0
  359. /package/components/{ui → providers/gluestack/ui}/card/index.web.tsx +0 -0
  360. /package/components/{ui → providers/gluestack/ui}/card/styles.tsx +0 -0
  361. /package/components/{ui → providers/gluestack/ui}/center/index.web.tsx +0 -0
  362. /package/components/{ui → providers/gluestack/ui}/center/styles.tsx +0 -0
  363. /package/components/{ui → providers/gluestack/ui}/date-time-picker/creator.tsx +0 -0
  364. /package/components/{ui → providers/gluestack/ui}/date-time-picker/styles.tsx +0 -0
  365. /package/components/{ui → providers/gluestack/ui}/flat-list/index.tsx +0 -0
  366. /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/index.tsx +0 -0
  367. /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/index.web.tsx +0 -0
  368. /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/script.ts +0 -0
  369. /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/theme-context.ts +0 -0
  370. /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/tokens.d.ts +0 -0
  371. /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/useGluestackColors.ts +0 -0
  372. /package/components/{ui → providers/gluestack/ui}/grid/index.web.tsx +0 -0
  373. /package/components/{ui → providers/gluestack/ui}/grid/styles.tsx +0 -0
  374. /package/components/{ui → providers/gluestack/ui}/heading/index.web.tsx +0 -0
  375. /package/components/{ui → providers/gluestack/ui}/heading/styles.tsx +0 -0
  376. /package/components/{ui → providers/gluestack/ui}/hstack/index.web.tsx +0 -0
  377. /package/components/{ui → providers/gluestack/ui}/hstack/styles.tsx +0 -0
  378. /package/components/{ui → providers/gluestack/ui}/icon/index.web.tsx +0 -0
  379. /package/components/{ui → providers/gluestack/ui}/image-background/index.tsx +0 -0
  380. /package/components/{ui → providers/gluestack/ui}/image-viewer/index.web.tsx +0 -0
  381. /package/components/{ui → providers/gluestack/ui}/input-accessory-view/index.tsx +0 -0
  382. /package/components/{ui → providers/gluestack/ui}/keyboard-avoiding-view/index.tsx +0 -0
  383. /package/components/{ui → providers/gluestack/ui}/pressable/index.tsx +0 -0
  384. /package/components/{ui → providers/gluestack/ui}/refresh-control/index.tsx +0 -0
  385. /package/components/{ui → providers/gluestack/ui}/safe-area-view/index.tsx +0 -0
  386. /package/components/{ui → providers/gluestack/ui}/scroll-view/index.tsx +0 -0
  387. /package/components/{ui → providers/gluestack/ui}/section-list/index.tsx +0 -0
  388. /package/components/{ui → providers/gluestack/ui}/skeleton/index.web.tsx +0 -0
  389. /package/components/{ui → providers/gluestack/ui}/skeleton/styles.tsx +0 -0
  390. /package/components/{ui → providers/gluestack/ui}/status-bar/index.tsx +0 -0
  391. /package/components/{ui → providers/gluestack/ui}/switch/index.tsx +0 -0
  392. /package/components/{ui → providers/gluestack/ui}/table/index.web.tsx +0 -0
  393. /package/components/{ui → providers/gluestack/ui}/table/styles.tsx +0 -0
  394. /package/components/{ui → providers/gluestack/ui}/tabs/animation-config.ts +0 -0
  395. /package/components/{ui → providers/gluestack/ui}/tabs/creator.tsx +0 -0
  396. /package/components/{ui → providers/gluestack/ui}/text/index.web.tsx +0 -0
  397. /package/components/{ui → providers/gluestack/ui}/text/styles.tsx +0 -0
  398. /package/components/{ui → providers/gluestack/ui}/textarea/index.tsx +0 -0
  399. /package/components/{ui → providers/gluestack/ui}/view/index.tsx +0 -0
  400. /package/components/{ui → providers/gluestack/ui}/virtualized-list/index.tsx +0 -0
  401. /package/components/{ui → providers/gluestack/ui}/vstack/index.web.tsx +0 -0
  402. /package/components/{ui → providers/gluestack/ui}/vstack/styles.tsx +0 -0
@@ -0,0 +1,166 @@
1
+ 'use strict';
2
+ /**
3
+ * Text-level edits of the registries, used by the GUI. They change only what is asked and leave every comment, blank
4
+ * line and indentation of the file alone, so a visual edit produces the diff a careful hand edit would.
5
+ * Every function takes the XML text and returns the new text, or throws an Error with a message fit for the user.
6
+ */
7
+ const ID = /^[A-Za-z][A-Za-z0-9-]*$/; // theme ids, role ids (the manifest's ids.stable-slug rule)
8
+ const VALUE_ID = /^[A-Za-z0-9][A-Za-z0-9._-]*$/; // token value ids: 50, primary.600, 2xl, hard-1
9
+ const HEX = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
10
+ const REF = /^\$ref\.[a-z][a-z0-9]*\.[A-Za-z0-9_.-]+$/;
11
+ const NUMBER = /^-?\d+(?:\.\d+)?$/;
12
+ const MODES = ['light', 'dark'];
13
+
14
+ const esc = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
15
+ const xmlEsc = (s) => s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
16
+
17
+ /** [start, end) of the element `<tag ... id="id" ...>...</tag>` (these registries never nest the same tag) */
18
+ function block(xml, tag, id) {
19
+ const open = new RegExp(`<${tag}\\s[^>]*\\bid="${esc(id)}"[^>]*>`).exec(xml);
20
+ if (!open) throw new Error(`${tag} "${id}" not found`);
21
+ const close = xml.indexOf(`</${tag}>`, open.index);
22
+ if (close < 0) throw new Error(`${tag} "${id}" is not closed`);
23
+ return { start: open.index, end: close + tag.length + 3, open: open[0], openEnd: open.index + open[0].length, close };
24
+ }
25
+
26
+ const lineStart = (xml, i) => xml.lastIndexOf('\n', i - 1) + 1;
27
+ const indentOf = (xml, i) => /^[ \t]*/.exec(xml.slice(lineStart(xml, i)))[0];
28
+
29
+ // --- tokens.xml -------------------------------------------------------------------------------------------------------
30
+
31
+ function checkValue(kind, value) {
32
+ const v = String(value).trim();
33
+ if (kind === 'color' && !HEX.test(v)) throw new Error(`"${value}" is not a colour (#RGB or #RRGGBB)`);
34
+ if (kind !== 'color' && !NUMBER.test(v)) throw new Error(`"${value}" is not a number`);
35
+ return v;
36
+ }
37
+
38
+ function valueRe(id) {
39
+ return new RegExp(`(<value\\s[^>]*\\bid="${esc(id)}"[^>]*>)([^<]*)(</value>)`);
40
+ }
41
+
42
+ function setValue(xml, token, id, value, kind) {
43
+ const v = checkValue(kind, value);
44
+ const b = block(xml, 'token', token);
45
+ const body = xml.slice(b.start, b.end);
46
+ const m = valueRe(id).exec(body);
47
+ if (!m) throw new Error(`${token}.${id} not found`);
48
+ return xml.slice(0, b.start) + body.replace(valueRe(id), (_, a, _t, c) => `${a}${xmlEsc(v)}${c}`) + xml.slice(b.end);
49
+ }
50
+
51
+ function addValue(xml, token, id, value, kind) {
52
+ if (!VALUE_ID.test(id)) throw new Error(`"${id}" is not a valid id (letters, digits, . - _)`);
53
+ const v = checkValue(kind, value);
54
+ const b = block(xml, 'token', token);
55
+ const body = xml.slice(b.start, b.end);
56
+ if (valueRe(id).test(body)) throw new Error(`${token}.${id} already exists`);
57
+ const closeValues = xml.indexOf('</values>', b.start);
58
+ if (closeValues < 0 || closeValues > b.end) throw new Error(`${token} has no <values>`);
59
+ const ind = indentOf(xml, closeValues) + ' ';
60
+ const at = lineStart(xml, closeValues);
61
+ return xml.slice(0, at) + `${ind}<value id="${id}">${xmlEsc(v)}</value>\n` + xml.slice(at);
62
+ }
63
+
64
+ function removeValue(xml, token, id) {
65
+ const b = block(xml, 'token', token);
66
+ const body = xml.slice(b.start, b.end);
67
+ const m = new RegExp(`[ \\t]*<value\\s[^>]*\\bid="${esc(id)}"[^>]*>[^<]*</value>[ \\t]*\\r?\\n?`).exec(body);
68
+ if (!m) throw new Error(`${token}.${id} not found`);
69
+ return xml.slice(0, b.start + m.index) + xml.slice(b.start + m.index + m[0].length);
70
+ }
71
+
72
+ // --- themes.xml -------------------------------------------------------------------------------------------------------
73
+
74
+ function setRole(xml, theme, role, { ref, value }) {
75
+ if (ref != null && !REF.test(ref)) throw new Error(`"${ref}" is not a $ref.<register>.<id> reference`);
76
+ if (value != null && !HEX.test(value)) throw new Error(`"${value}" is not a colour (#RGB or #RRGGBB)`);
77
+ if ((ref == null) === (value == null)) throw new Error('a role takes a reference or a colour, not both');
78
+ const b = block(xml, 'theme', theme);
79
+ const body = xml.slice(b.start, b.end);
80
+ const re = new RegExp(`(<role\\s[^>]*\\bid="${esc(role)}"[^>]*>)([\\s\\S]*?)(</role>)`);
81
+ const m = re.exec(body);
82
+ if (!m) throw new Error(`role "${role}" not found in theme "${theme}"`);
83
+ const inner = ref != null ? `<ref>${xmlEsc(ref)}</ref>` : `<value>${xmlEsc(value)}</value>`;
84
+ const ind = /\n([ \t]*)</.exec(m[2])?.[1] ?? indentOf(xml, b.start) + ' ';
85
+ return (
86
+ xml.slice(0, b.start) +
87
+ body.replace(re, (_, a, _i, c) => `${a}\n${ind}${inner}\n${ind.slice(4)}${c}`) +
88
+ xml.slice(b.end)
89
+ );
90
+ }
91
+
92
+ function checkTheme({ id, mode, variant }) {
93
+ if (!ID.test(id)) throw new Error(`"${id}" is not a valid theme id (letters, digits and -, starting with a letter)`);
94
+ if (!MODES.includes(mode)) throw new Error(`mode must be ${MODES.join(' or ')}`);
95
+ if (!ID.test(variant)) throw new Error(`"${variant}" is not a valid variant name`);
96
+ }
97
+
98
+ const themeIds = (xml) => [...xml.matchAll(/<theme\s[^>]*\bid="([^"]+)"/g)].map((m) => m[1]);
99
+
100
+ /** The `default` attribute of <themes> must name a theme that exists. */
101
+ function fixDefault(xml, was) {
102
+ const ids = themeIds(xml);
103
+ const m = /(<themes\b[^>]*\bdefault=")([^"]*)(")/.exec(xml);
104
+ if (!m || !ids.length) return xml;
105
+ const next = ids.includes(m[2]) ? m[2] : was && ids.includes(was) ? was : ids[0];
106
+ return next === m[2] ? xml : xml.replace(m[0], `${m[1]}${next}${m[3]}`);
107
+ }
108
+
109
+ function addTheme(xml, { id, mode, variant, from }) {
110
+ checkTheme({ id, mode, variant });
111
+ if (themeIds(xml).includes(id)) throw new Error(`theme "${id}" already exists`);
112
+ const b = block(xml, 'theme', from);
113
+ const copy = xml.slice(b.start, b.end).replace(
114
+ b.open,
115
+ b.open
116
+ .replace(/\bid="[^"]*"/, `id="${id}"`)
117
+ .replace(/\bmode="[^"]*"/, `mode="${mode}"`)
118
+ .replace(/\bvariant="[^"]*"/, `variant="${variant}"`),
119
+ );
120
+ const ind = indentOf(xml, b.start);
121
+ return xml.slice(0, b.end) + `\n${ind}${copy}` + xml.slice(b.end);
122
+ }
123
+
124
+ function removeTheme(xml, id) {
125
+ if (themeIds(xml).length <= 1) throw new Error('a registry needs at least one theme');
126
+ const b = block(xml, 'theme', id);
127
+ const was = /\bdefault="([^"]*)"/.exec(xml)?.[1];
128
+ const from = lineStart(xml, b.start);
129
+ const to = xml[b.end] === '\n' ? b.end + 1 : b.end;
130
+ return fixDefault(xml.slice(0, from) + xml.slice(to), was === id ? null : was);
131
+ }
132
+
133
+ function setThemeAttrs(xml, id, { newId, mode, variant }) {
134
+ const b = block(xml, 'theme', id);
135
+ const cur = {
136
+ id,
137
+ mode: /\bmode="([^"]*)"/.exec(b.open)?.[1],
138
+ variant: /\bvariant="([^"]*)"/.exec(b.open)?.[1] ?? 'default',
139
+ };
140
+ const next = { id: newId ?? cur.id, mode: mode ?? cur.mode, variant: variant ?? cur.variant };
141
+ checkTheme(next);
142
+ if (next.id !== id && themeIds(xml).includes(next.id)) throw new Error(`theme "${next.id}" already exists`);
143
+ let open = b.open.replace(/\bid="[^"]*"/, `id="${next.id}"`).replace(/\bmode="[^"]*"/, `mode="${next.mode}"`);
144
+ open = /\bvariant="/.test(open)
145
+ ? open.replace(/\bvariant="[^"]*"/, `variant="${next.variant}"`)
146
+ : open.replace(/>$/, ` variant="${next.variant}">`);
147
+ const was = /\bdefault="([^"]*)"/.exec(xml)?.[1];
148
+ let out = xml.slice(0, b.start) + open + xml.slice(b.openEnd);
149
+ if (was === id && next.id !== id) out = out.replace(/(<themes\b[^>]*\bdefault=")[^"]*(")/, `$1${next.id}$2`);
150
+ return out;
151
+ }
152
+
153
+ module.exports = {
154
+ setValue,
155
+ addValue,
156
+ removeValue,
157
+ setRole,
158
+ addTheme,
159
+ removeTheme,
160
+ setThemeAttrs,
161
+ themeIds,
162
+ ID,
163
+ HEX,
164
+ REF,
165
+ NUMBER,
166
+ };
@@ -0,0 +1,465 @@
1
+ 'use strict';
2
+ /**
3
+ * Compiles design/tokens.xml + design/themes.xml into the gluestack / nativewind theme:
4
+ * - config.ts : one `colors.<theme>` record per theme, role ids as `'--<role>'` CSS variables, 'r g b' triplets;
5
+ * - tokens.js : the Tailwind `theme.extend` fragment (semantic colours + spacing, radii, breakpoints, type, shadow, motion).
6
+ * Output is byte-for-byte what the former Python generator emitted (tests compare against its recorded output).
7
+ */
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const { parseFile, XmlError } = require('./xml');
11
+ const { NS, at, buildModel, SystemExit } = require('./registry');
12
+
13
+ const fail = (m) => {
14
+ throw new SystemExit(m);
15
+ };
16
+
17
+ const CONFIG_HEADER = [
18
+ '// Generated by flipova-design gen -- do not edit by hand.',
19
+ '// Source of truth: design/tokens.xml + design/themes.xml',
20
+ '// Regenerate with: npm run design:gen',
21
+ "import { vars } from 'nativewind';",
22
+ '',
23
+ ];
24
+ const TOKENS_HEADER = [
25
+ '// Generated by flipova-design gen -- do not edit by hand.',
26
+ '// Source of truth: design/tokens.xml + design/themes.xml',
27
+ '// Tailwind/nativewind theme, consumed by tailwind.config.js.',
28
+ '// Regenerate with: npm run design:gen',
29
+ ];
30
+
31
+ function toRgbTriplet(literal) {
32
+ const text = literal.trim();
33
+ if (text.startsWith('#')) {
34
+ let d = text.slice(1);
35
+ if (d.length === 3) d = [...d].map((c) => c + c).join('');
36
+ if (d.length !== 6 || !/^[0-9a-fA-F]{6}$/.test(d))
37
+ fail(`unsupported colour '${literal}' (expected #RGB or #RRGGBB)`);
38
+ return [0, 2, 4].map((i) => parseInt(d.slice(i, i + 2), 16)).join(' ');
39
+ }
40
+ return text.split(/\s+/).filter(Boolean).join(' ');
41
+ }
42
+
43
+ function resolveColour(ctx, ref) {
44
+ const raw = ref.trim();
45
+ let parts = raw.startsWith('$ref.') ? raw.slice(5).split('.') : raw.split('.');
46
+ if (parts.length && ctx.registers.includes(parts[0])) parts = parts.slice(1);
47
+ if (parts.length < 2) fail(`dangling reference '${ref}' (expected $ref.<register>.<id>.<path>)`);
48
+ const values = ctx.tokenValues.get(parts[0]);
49
+ const key = parts.slice(1).join('.');
50
+ if (!values || !values.has(key)) fail(`dangling reference '${ref}': no token value matches`);
51
+ return values.get(key);
52
+ }
53
+
54
+ function catalog(man, name) {
55
+ const file = man.ctx.catalogFiles.get(name);
56
+ if (!file || !fs.existsSync(file)) fail(`manifest: no ${name} catalog file found`);
57
+ return parseFile(file);
58
+ }
59
+
60
+ /** [[themeId, [[roleId, 'r g b'], ...]], ...] in themes.xml order. */
61
+ function themeRoleColours(man) {
62
+ const root = catalog(man, 'themes');
63
+ return at(root, 'items', 'theme').map((theme) => {
64
+ const tid = (theme.get('id') || '').trim();
65
+ const roles = at(theme, 'roleMap', 'role').map((role) => {
66
+ const rid = (role.get('id') || '').trim();
67
+ const ref = role.find('ref', NS);
68
+ const val = role.find('value', NS);
69
+ let literal;
70
+ if (ref) literal = resolveColour(man.ctx, ref.text || '');
71
+ else if (val) literal = val.text || '';
72
+ else fail(`theme '${tid}': role '${rid}' needs a <ref> or a <value>`);
73
+ return [rid, toRgbTriplet(literal)];
74
+ });
75
+ return [tid, roles];
76
+ });
77
+ }
78
+
79
+ function themeRoleIds(man, warn = console.log) {
80
+ const themes = themeRoleColours(man);
81
+ if (!themes.length) return [];
82
+ const reference = themes[0][1].map(([r]) => r);
83
+ for (const [tid, roles] of themes.slice(1)) {
84
+ const others = roles.map(([r]) => r);
85
+ if (others.length !== reference.length || others.some((r, i) => r !== reference[i])) {
86
+ warn(
87
+ `warning: theme '${tid}' declares a different role set than '${themes[0][0]}' (Tailwind colours are generated from '${themes[0][0]}')`,
88
+ );
89
+ }
90
+ }
91
+ return reference;
92
+ }
93
+
94
+ const JS_IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
95
+ const jsKey = (name) => (JS_IDENT.test(name) ? name : `'${name.replace(/'/g, "\\'")}'`);
96
+
97
+ function themeVariants(man) {
98
+ return at(catalog(man, 'themes'), 'items', 'theme').map((t) => [
99
+ (t.get('variant') || 'default').trim() || 'default',
100
+ (t.get('mode') || '').trim(),
101
+ (t.get('id') || '').trim(),
102
+ ]);
103
+ }
104
+
105
+ const cmp = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
106
+
107
+ function renderVariantTable(variants) {
108
+ const ordered = new Map();
109
+ for (const [variant, mode, tid] of variants) {
110
+ if (!ordered.has(variant)) ordered.set(variant, []);
111
+ const entries = ordered.get(variant);
112
+ if (entries.some(([m]) => m === mode)) {
113
+ fail(
114
+ `theme variant '${variant}' declares the mode '${mode}' twice: a variant is a light/dark pair, so it has exactly one theme per mode`,
115
+ );
116
+ }
117
+ entries.push([mode, tid]);
118
+ }
119
+ const lines = ['export const variants = {'];
120
+ for (const variant of [...ordered.keys()].sort(cmp)) {
121
+ const pairs = [...ordered.get(variant)]
122
+ .sort((a, b) => cmp(a[0], b[0]) || cmp(a[1], b[1]))
123
+ .map(([m, t]) => `${jsKey(m)}: '${t}'`)
124
+ .join(', ');
125
+ lines.push(` ${jsKey(variant)}: { ${pairs} },`);
126
+ }
127
+ lines.push('};');
128
+ return lines;
129
+ }
130
+
131
+ function renderGluestackConfig(man) {
132
+ const themes = themeRoleColours(man);
133
+ const lines = [...CONFIG_HEADER];
134
+ lines.push('// Raw color values (space-separated RGB) - edit design/themes.xml and regenerate');
135
+ lines.push('export const colors = {');
136
+ for (const [tid, roles] of themes) {
137
+ lines.push(` ${jsKey(tid)}: {`);
138
+ for (const [rid, triplet] of roles) lines.push(` '--${rid}': '${triplet}',`);
139
+ lines.push(' },');
140
+ }
141
+ lines.push('};', '', '// Config for nativewind vars() - used by the provider', 'export const config = {');
142
+ for (const [tid] of themes) lines.push(` ${jsKey(tid)}: vars(colors['${tid}']),`);
143
+ lines.push('};', '');
144
+ lines.push('// Theme variants: variant -> mode -> theme id, from the `variant` attribute in');
145
+ lines.push('// design/themes.xml. `default` holds the base light/dark pair.');
146
+ lines.push(...renderVariantTable(themeVariants(man)));
147
+ return `${lines.join('\n')}\n`;
148
+ }
149
+
150
+ // --- tokens.js -------------------------------------------------------------------------------------------------
151
+
152
+ const jsStr = (v) => `'${String(v).replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`;
153
+ const text = (el) => (el ? (el.text || '').trim() : '');
154
+ const valuesOf = (token) => at(token, 'values', 'value');
155
+ const scaled = (values, unit, def = 'px') => values.map((v) => [v.get('id') || '', jsStr(`${text(v)}${unit || def}`)]);
156
+ const plain = (values) => values.map((v) => [v.get('id') || '', jsStr(text(v))]);
157
+
158
+ /** Python's float() accepts these forms; anything else is a plain string. */
159
+ function asFloat(raw) {
160
+ const s = raw.trim();
161
+ if (!/^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/.test(s)) return null;
162
+ return Number(s);
163
+ }
164
+
165
+ function shadowEntries(ctx, values) {
166
+ return values.map((v) => {
167
+ const ref = at(v, 'color', 'ref')[0];
168
+ const hex = ref ? resolveColour(ctx, text(ref)) : '#000000';
169
+ const rgb = toRgbTriplet(hex);
170
+ const x = text(at(v, 'offset', 'x')[0]) || '0';
171
+ const y = text(at(v, 'offset', 'y')[0]) || '0';
172
+ const radius = text(v.find('radius', NS)) || '0';
173
+ const opacity = text(v.find('opacity', NS)) || '1';
174
+ return [v.get('id') || '', jsStr(`${x}px ${y}px ${radius}px rgb(${rgb} / ${opacity})`)];
175
+ });
176
+ }
177
+
178
+ function entry(ctx, token) {
179
+ const tid = (token.get('id') || '').trim();
180
+ const unit = (token.get('unit') || '').trim();
181
+ const values = valuesOf(token);
182
+ switch (tid) {
183
+ case 'spacing':
184
+ return ['spacing', scaled(values, unit)];
185
+ case 'radii':
186
+ return ['borderRadius', scaled(values, unit)];
187
+ case 'breakpoints':
188
+ return ['screens', scaled(values, unit)];
189
+ case 'family':
190
+ return [
191
+ 'fontFamily',
192
+ values.map((v) => {
193
+ const fams = text(v.find('web', NS))
194
+ .split(',')
195
+ .map((p) => p.trim())
196
+ .filter(Boolean);
197
+ return [v.get('id') || '', `[${fams.map(jsStr).join(', ')}]`];
198
+ }),
199
+ ];
200
+ case 'fontSizes':
201
+ return ['fontSize', scaled(values, unit)];
202
+ case 'fontWeights':
203
+ return ['fontWeight', plain(values)];
204
+ case 'lineHeights':
205
+ return [
206
+ 'lineHeight',
207
+ values.map((v) => {
208
+ const raw = text(v);
209
+ const n = asFloat(raw);
210
+ const expr = n === null ? jsStr(raw) : jsStr(n <= 2 ? raw : `${raw}${unit || 'px'}`);
211
+ return [v.get('id') || '', expr];
212
+ }),
213
+ ];
214
+ case 'letterSpacings':
215
+ return ['letterSpacing', scaled(values, unit, 'em')];
216
+ case 'shadow':
217
+ return ['boxShadow', shadowEntries(ctx, values)];
218
+ case 'zIndex':
219
+ return ['zIndex', plain(values)];
220
+ case 'opacity':
221
+ return ['opacity', plain(values)];
222
+ case 'duration':
223
+ return ['transitionDuration', scaled(values, unit || 'ms', 'ms')];
224
+ case 'easing':
225
+ return [
226
+ 'transitionTimingFunction',
227
+ values.flatMap((v) => {
228
+ const web = text(v.find('web', NS));
229
+ return !web || web === 'spring' ? [] : [[v.get('id') || '', jsStr(web)]];
230
+ }),
231
+ ];
232
+ default:
233
+ return null; // `color` (palette) is internal: semantic colours live in config.ts
234
+ }
235
+ }
236
+
237
+ function renderTokensTheme(man) {
238
+ const root = catalog(man, 'tokens');
239
+ const groups = [];
240
+ const roles = themeRoleIds(man, man.warn);
241
+ if (roles.length) groups.push(['colors', roles.map((rid) => [rid, jsStr(`rgb(var(--${rid})/<alpha-value>)`)])]);
242
+ for (const token of at(root, 'items', 'token')) {
243
+ const e = entry(man.ctx, token);
244
+ if (e) groups.push(e);
245
+ }
246
+ const lines = [...TOKENS_HEADER, 'module.exports = {', ' theme: {'];
247
+ for (const [key, items] of groups) {
248
+ lines.push(` ${key}: {`);
249
+ for (const [ident, expr] of items) lines.push(` ${jsStr(ident)}: ${expr},`);
250
+ lines.push(' },');
251
+ }
252
+ lines.push(' },', '};');
253
+ return `${lines.join('\n')}\n`;
254
+ }
255
+
256
+ // --- design-theme.ts: the provider-neutral theme ------------------------------------------------------------------
257
+
258
+ const camel = (s) => s.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
259
+ const hex = (triplet) =>
260
+ `#${triplet
261
+ .split(' ')
262
+ .map((n) => Number(n).toString(16).padStart(2, '0'))
263
+ .join('')}`;
264
+ const num = (raw) => {
265
+ const n = asFloat(raw);
266
+ return n === null ? raw.trim() : n;
267
+ };
268
+ const q = (s) => JSON.stringify(s);
269
+
270
+ /**
271
+ * Every value a provider adapter needs, resolved: colours as '#rrggbb' per theme (keys camelCased from the roles),
272
+ * scales as numbers. Adapters (Paper, Tamagui, Reusables, gluestack) map this one object, which is what keeps their
273
+ * design identical. Deterministic output.
274
+ */
275
+ function renderDesignTheme(man) {
276
+ const themesRoot = catalog(man, 'themes');
277
+ const tokensRoot = catalog(man, 'tokens');
278
+ const themes = at(themesRoot, 'items', 'theme');
279
+ const lines = [
280
+ '// Generated by flipova-design gen -- do not edit by hand.',
281
+ '// Source of truth: design/tokens.xml + design/themes.xml',
282
+ '// Provider-neutral theme: every provider adapter reads this one object.',
283
+ '// Regenerate with: npm run design:gen',
284
+ '',
285
+ 'export const designTheme = {',
286
+ ' themes: {',
287
+ ];
288
+ const colours = new Map(themeRoleColours(man));
289
+ for (const t of themes) {
290
+ const id = (t.get('id') || '').trim();
291
+ lines.push(` ${q(id)}: {`);
292
+ lines.push(` mode: ${q((t.get('mode') || '').trim())},`);
293
+ lines.push(` variant: ${q((t.get('variant') || 'default').trim() || 'default')},`);
294
+ lines.push(' colors: {');
295
+ for (const [rid, triplet] of colours.get(id)) lines.push(` ${q(camel(rid))}: ${q(hex(triplet))},`);
296
+ lines.push(' },', ' },');
297
+ }
298
+ lines.push(' },', ' variants: {');
299
+ const variants = new Map();
300
+ for (const [v, mode, tid] of themeVariants(man)) {
301
+ if (!variants.has(v)) variants.set(v, []);
302
+ variants.get(v).push([mode, tid]);
303
+ }
304
+ for (const v of [...variants.keys()].sort(cmp)) {
305
+ lines.push(
306
+ ` ${q(v)}: { ${variants
307
+ .get(v)
308
+ .sort((a, b) => cmp(a[0], b[0]))
309
+ .map(([m, t]) => `${q(m)}: ${q(t)}`)
310
+ .join(', ')} },`,
311
+ );
312
+ }
313
+ lines.push(' },', ' scale: {');
314
+ const scales = {
315
+ spacing: 'spacing',
316
+ radii: 'radii',
317
+ fontSizes: 'fontSizes',
318
+ fontWeights: 'fontWeights',
319
+ lineHeights: 'lineHeights',
320
+ letterSpacings: 'letterSpacings',
321
+ opacity: 'opacity',
322
+ duration: 'duration',
323
+ zIndex: 'zIndex',
324
+ breakpoints: 'breakpoints',
325
+ };
326
+ const tokens = new Map(at(tokensRoot, 'items', 'token').map((t) => [t.get('id'), t]));
327
+ for (const [key, id] of Object.entries(scales)) {
328
+ const token = tokens.get(id);
329
+ if (!token) continue;
330
+ lines.push(` ${key}: {`);
331
+ for (const v of valuesOf(token))
332
+ lines.push(` ${q(v.get('id'))}: ${typeof num(text(v)) === 'number' ? num(text(v)) : q(text(v))},`);
333
+ lines.push(' },');
334
+ }
335
+ const fam = tokens.get('family');
336
+ if (fam) {
337
+ lines.push(' fontFamilies: {');
338
+ for (const v of valuesOf(fam))
339
+ lines.push(
340
+ ` ${q(v.get('id'))}: { native: ${q(text(v.find('native', NS)))}, web: ${q(text(v.find('web', NS)))} },`,
341
+ );
342
+ lines.push(' },');
343
+ }
344
+ const shadow = tokens.get('shadow');
345
+ if (shadow) {
346
+ lines.push(' shadows: {');
347
+ for (const v of valuesOf(shadow)) {
348
+ const ref = at(v, 'color', 'ref')[0];
349
+ const colour = hex(toRgbTriplet(ref ? resolveColour(man.ctx, text(ref)) : '#000000'));
350
+ lines.push(
351
+ ` ${q(v.get('id'))}: { color: ${q(colour)}, offsetX: ${num(text(at(v, 'offset', 'x')[0]) || '0')}, offsetY: ${num(text(at(v, 'offset', 'y')[0]) || '0')}, radius: ${num(text(v.find('radius', NS)) || '0')}, opacity: ${num(text(v.find('opacity', NS)) || '1')}, elevation: ${num(text(v.find('elevation', NS)) || '0')} },`,
352
+ );
353
+ }
354
+ lines.push(' },');
355
+ }
356
+ lines.push(
357
+ ' },',
358
+ '} as const;',
359
+ '',
360
+ 'export type DesignTheme = typeof designTheme;',
361
+ 'export type ThemeId = keyof typeof designTheme.themes;',
362
+ "export type ColorRole = keyof (typeof designTheme.themes)[ThemeId]['colors'];",
363
+ '',
364
+ );
365
+ return lines.join('\n');
366
+ }
367
+
368
+ // --- manifest ----------------------------------------------------------------------------------------------------
369
+
370
+ function loadManifest(root, manifestPath) {
371
+ const mroot = parseFile(manifestPath);
372
+ const pipeline = at(mroot, 'meta', 'pipeline')[0];
373
+ if (!pipeline) fail('manifest: missing meta/pipeline');
374
+ const outputsEl = pipeline.find('outputs', NS);
375
+ if (!outputsEl) fail('manifest: missing meta/pipeline/outputs');
376
+ const outputs = {};
377
+ for (const c of outputsEl.children) outputs[c.name] = (c.text || '').trim();
378
+ const schemaPath = path.join(path.dirname(path.resolve(manifestPath)), 'schema.xsd');
379
+ if (!fs.existsSync(schemaPath)) fail('schema.xsd not found next to the manifest');
380
+ return {
381
+ root: path.resolve(root),
382
+ manifestPath: path.resolve(manifestPath),
383
+ schemaPath,
384
+ outputs,
385
+ ctx: buildModel(root, manifestPath),
386
+ };
387
+ }
388
+
389
+ const RENDERERS = {
390
+ gluestackConfig: renderGluestackConfig,
391
+ gluestackTokens: renderTokensTheme,
392
+ designTheme: renderDesignTheme,
393
+ };
394
+
395
+ function targets(man) {
396
+ const list = [];
397
+ for (const [kind, rel] of Object.entries(man.outputs)) {
398
+ const render = RENDERERS[kind];
399
+ if (!render) throw Object.assign(new Error(`manifest output '${kind}' has no generator`), { exit: 2 });
400
+ if (!rel) throw Object.assign(new Error(`manifest output '${kind}' has an empty path`), { exit: 2 });
401
+ list.push([path.resolve(man.root, rel), render(man)]);
402
+ }
403
+ if (!list.length) throw Object.assign(new Error('manifest declares no outputs'), { exit: 2 });
404
+ return list;
405
+ }
406
+
407
+ /** CLI: `gen [--check] [--list]`. Returns the exit code. */
408
+ function run({ root, manifest, check = false, list = false, out = console.log, err = console.error }) {
409
+ let man;
410
+ try {
411
+ man = loadManifest(root, manifest);
412
+ man.warn = out;
413
+ if (list) {
414
+ for (const [tid, roles] of themeRoleColours(man)) {
415
+ out(`${tid} (${roles.length} role(s))`);
416
+ for (const [rid, triplet] of roles) out(` --${rid}: ${triplet}`);
417
+ }
418
+ return 0;
419
+ }
420
+ let drift = 0;
421
+ for (const [target, content] of targets(man)) {
422
+ if (check) {
423
+ const exists = fs.existsSync(target);
424
+ if (!exists || fs.readFileSync(target, 'utf8') !== content) {
425
+ out(exists ? `changed ${target}` : `missing ${target}`);
426
+ drift++;
427
+ }
428
+ } else {
429
+ fs.mkdirSync(path.dirname(target), { recursive: true });
430
+ fs.writeFileSync(target, content, 'utf8');
431
+ out(`written ${target}`);
432
+ }
433
+ }
434
+ if (check) {
435
+ if (drift) return 1;
436
+ out('up to date');
437
+ }
438
+ return 0;
439
+ } catch (e) {
440
+ if (e instanceof XmlError) {
441
+ err(`error: ${e.file ? `${e.file}:${e.line}: ` : ''}malformed XML: ${e.message}`);
442
+ return 1;
443
+ }
444
+ if (e instanceof SystemExit) {
445
+ err(e.message);
446
+ return 1;
447
+ }
448
+ if (e.exit) {
449
+ err(`error: ${e.message}`);
450
+ return e.exit;
451
+ }
452
+ throw e;
453
+ }
454
+ }
455
+
456
+ module.exports = {
457
+ renderGluestackConfig,
458
+ renderTokensTheme,
459
+ renderDesignTheme,
460
+ themeRoleColours,
461
+ themeRoleIds,
462
+ loadManifest,
463
+ toRgbTriplet,
464
+ run,
465
+ };