@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.
- package/CHANGES.md +66 -0
- package/COMPONENTS.md +102 -0
- package/DOCS.md +261 -0
- package/LICENSE +1 -1
- package/README.md +169 -118
- package/components/contract/index.ts +3 -0
- package/components/contract/recipes/accordion.ts +42 -0
- package/components/contract/recipes/avatar.ts +41 -0
- package/components/contract/recipes/badge.ts +46 -0
- package/components/contract/recipes/button.ts +58 -0
- package/components/contract/recipes/calendar.ts +118 -0
- package/components/contract/recipes/card.ts +21 -0
- package/components/contract/recipes/checkbox.ts +33 -0
- package/components/contract/recipes/divider.ts +9 -0
- package/components/contract/recipes/fab.ts +31 -0
- package/components/contract/recipes/feedback.ts +66 -0
- package/components/contract/recipes/formcontrol.ts +16 -0
- package/components/contract/recipes/heading.ts +16 -0
- package/components/contract/recipes/icon.ts +40 -0
- package/components/contract/recipes/index.ts +30 -0
- package/components/contract/recipes/input.ts +39 -0
- package/components/contract/recipes/layout.ts +44 -0
- package/components/contract/recipes/link.ts +6 -0
- package/components/contract/recipes/modal.ts +40 -0
- package/components/contract/recipes/overlay.ts +250 -0
- package/components/contract/recipes/progress.ts +27 -0
- package/components/contract/recipes/radio.ts +39 -0
- package/components/contract/recipes/select.ts +63 -0
- package/components/contract/recipes/skeleton.ts +25 -0
- package/components/contract/recipes/slider.ts +50 -0
- package/components/contract/recipes/spinner.ts +12 -0
- package/components/contract/recipes/switch.ts +26 -0
- package/components/contract/recipes/table.ts +37 -0
- package/components/contract/recipes/tabs.ts +31 -0
- package/components/contract/recipes/text.ts +12 -0
- package/components/contract/recipes/textarea.ts +37 -0
- package/components/contract/recipes/util.ts +15 -0
- package/components/contract/theme.ts +116 -0
- package/components/contract/types.ts +598 -0
- package/components/providers/css-vars.ts +43 -0
- package/components/providers/flipova/components/Accordion.tsx +41 -0
- package/components/providers/flipova/components/ActionSheet.tsx +34 -0
- package/components/providers/flipova/components/Alert.tsx +15 -0
- package/components/providers/flipova/components/AlertDialog.tsx +31 -0
- package/components/providers/flipova/components/Avatar.tsx +30 -0
- package/components/providers/flipova/components/Badge.tsx +14 -0
- package/components/providers/flipova/components/BottomSheet.tsx +24 -0
- package/components/providers/flipova/components/Box.tsx +1 -0
- package/components/providers/flipova/components/Button.tsx +31 -0
- package/components/providers/flipova/components/Calendar.tsx +85 -0
- package/components/providers/flipova/components/Card.tsx +13 -0
- package/components/providers/flipova/components/Center.tsx +11 -0
- package/components/providers/flipova/components/Checkbox.tsx +24 -0
- package/components/providers/flipova/components/DateTimePicker.tsx +45 -0
- package/components/providers/flipova/components/Divider.tsx +9 -0
- package/components/providers/flipova/components/Drawer.tsx +18 -0
- package/components/providers/flipova/components/Fab.tsx +22 -0
- package/components/providers/flipova/components/FlatList.tsx +1 -0
- package/components/providers/flipova/components/FormControl.tsx +27 -0
- package/components/providers/flipova/components/Grid.tsx +18 -0
- package/components/providers/flipova/components/HStack.tsx +13 -0
- package/components/providers/flipova/components/Heading.tsx +19 -0
- package/components/providers/flipova/components/Icon.tsx +20 -0
- package/components/providers/flipova/components/Image.tsx +1 -0
- package/components/providers/flipova/components/ImageBackground.tsx +1 -0
- package/components/providers/flipova/components/ImageViewer.tsx +25 -0
- package/components/providers/flipova/components/Input.tsx +29 -0
- package/components/providers/flipova/components/InputAccessoryView.tsx +1 -0
- package/components/providers/flipova/components/KeyboardAvoidingView.tsx +1 -0
- package/components/providers/flipova/components/Link.tsx +21 -0
- package/components/providers/flipova/components/LiquidGlass.tsx +13 -0
- package/components/providers/flipova/components/Menu.tsx +43 -0
- package/components/providers/flipova/components/Modal.tsx +24 -0
- package/components/providers/flipova/components/Popover.tsx +23 -0
- package/components/providers/flipova/components/Portal.tsx +42 -0
- package/components/providers/flipova/components/Pressable.tsx +1 -0
- package/components/providers/flipova/components/Progress.tsx +22 -0
- package/components/providers/flipova/components/RadioGroup.tsx +36 -0
- package/components/providers/flipova/components/RefreshControl.tsx +1 -0
- package/components/providers/flipova/components/SafeAreaView.tsx +1 -0
- package/components/providers/flipova/components/ScrollView.tsx +1 -0
- package/components/providers/flipova/components/SectionList.tsx +1 -0
- package/components/providers/flipova/components/Select.tsx +61 -0
- package/components/providers/flipova/components/Skeleton.tsx +25 -0
- package/components/providers/flipova/components/Slider.tsx +52 -0
- package/components/providers/flipova/components/Spinner.tsx +19 -0
- package/components/providers/flipova/components/StatusBar.tsx +1 -0
- package/components/providers/flipova/components/Switch.tsx +21 -0
- package/components/providers/flipova/components/Table.tsx +33 -0
- package/components/providers/flipova/components/Tabs.tsx +39 -0
- package/components/providers/flipova/components/Text.tsx +13 -0
- package/components/providers/flipova/components/Textarea.tsx +28 -0
- package/components/providers/flipova/components/Toast.tsx +28 -0
- package/components/providers/flipova/components/Tooltip.tsx +34 -0
- package/components/providers/flipova/components/VStack.tsx +13 -0
- package/components/providers/flipova/components/View.tsx +1 -0
- package/components/providers/flipova/components/VirtualizedList.tsx +1 -0
- package/components/providers/flipova/index.tsx +189 -0
- package/components/providers/gluestack/index.tsx +226 -0
- package/components/providers/gluestack/more.tsx +151 -0
- package/components/{ui → providers/gluestack/ui}/accordion/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/actionsheet/index.tsx +15 -15
- package/components/{ui → providers/gluestack/ui}/alert/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/alert-dialog/index.tsx +3 -3
- package/components/{ui → providers/gluestack/ui}/badge/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/bottomsheet/index.tsx +11 -10
- package/components/{ui → providers/gluestack/ui}/box/index.tsx +4 -1
- package/components/{ui → providers/gluestack/ui}/button/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/calendar/index.tsx +4 -4
- package/components/{ui → providers/gluestack/ui}/card/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/center/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/checkbox/index.tsx +9 -8
- package/components/{ui → providers/gluestack/ui}/date-time-picker/index.tsx +4 -4
- package/components/providers/gluestack/ui/date-time-picker/index.web.tsx +197 -0
- package/components/{ui → providers/gluestack/ui}/divider/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/drawer/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/fab/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/form-control/index.tsx +3 -3
- package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/config.ts +1 -62
- package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/tokens.js +1 -1
- package/components/{ui → providers/gluestack/ui}/grid/index.tsx +3 -3
- package/components/{ui → providers/gluestack/ui}/heading/index.tsx +7 -7
- package/components/{ui → providers/gluestack/ui}/hstack/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/icon/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/image/index.tsx +0 -1
- package/components/{ui → providers/gluestack/ui}/image-viewer/index.tsx +96 -99
- package/components/providers/gluestack/ui/index.ts +58 -0
- package/components/{ui → providers/gluestack/ui}/input/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/link/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/liquid-glass/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/menu/index.tsx +5 -4
- package/components/{ui → providers/gluestack/ui}/modal/index.tsx +19 -17
- package/components/{ui → providers/gluestack/ui}/popover/index.tsx +4 -4
- package/components/{ui → providers/gluestack/ui}/portal/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/progress/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/radio/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/select/index.tsx +8 -12
- package/components/{ui → providers/gluestack/ui}/select/select-actionsheet.tsx +13 -13
- package/components/{ui → providers/gluestack/ui}/skeleton/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/slider/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/spinner/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/table/index.tsx +33 -33
- package/components/{ui → providers/gluestack/ui}/tabs/TabsAnimatedIndicator.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/tabs/index.tsx +2 -2
- package/components/{ui → providers/gluestack/ui}/text/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/toast/index.tsx +4 -4
- package/components/{ui → providers/gluestack/ui}/tooltip/index.tsx +1 -1
- package/components/{ui → providers/gluestack/ui}/vstack/index.tsx +1 -1
- package/components/providers/index.ts +2 -0
- package/components/providers/paper/index.tsx +449 -0
- package/components/providers/provider.tsx +80 -0
- package/components/providers/reusables/classes.ts +163 -0
- package/components/providers/reusables/index.tsx +289 -0
- package/components/providers/rn-base/Box.tsx +7 -0
- package/components/providers/rn-base/FlatList.tsx +16 -0
- package/components/providers/rn-base/Image.tsx +18 -0
- package/components/providers/rn-base/ImageBackground.tsx +11 -0
- package/components/providers/rn-base/InputAccessoryView.tsx +9 -0
- package/components/providers/rn-base/KeyboardAvoidingView.tsx +15 -0
- package/components/providers/rn-base/Pressable.tsx +19 -0
- package/components/providers/rn-base/RefreshControl.tsx +16 -0
- package/components/providers/rn-base/SafeAreaView.tsx +11 -0
- package/components/providers/rn-base/ScrollView.tsx +11 -0
- package/components/providers/rn-base/SectionList.tsx +22 -0
- package/components/providers/rn-base/StatusBar.tsx +17 -0
- package/components/providers/rn-base/View.tsx +7 -0
- package/components/providers/rn-base/VirtualizedList.tsx +18 -0
- package/components/providers/rn-base/index.tsx +64 -0
- package/components/providers/tamagui/index.tsx +375 -0
- package/components/providers/types.ts +17 -0
- package/components/theme/design-theme.ts +230 -0
- package/components/ui/create.tsx +14 -0
- package/components/ui/index.ts +68 -58
- package/components/ui/resolve.ts +40 -0
- package/design/canonical.index.txt +2 -16
- package/design/manifest.xml +4 -3
- package/design/schema.xsd +44 -434
- package/design/themes.xml +7 -177
- package/design/tools/{npm.js → cli.js} +173 -73
- package/design/tools/gui/index.html +998 -0
- package/design/tools/lib/check.js +533 -0
- package/design/tools/lib/contract.js +23 -0
- package/design/tools/lib/edit.js +166 -0
- package/design/tools/lib/generate.js +465 -0
- package/design/tools/lib/gui.js +614 -0
- package/design/tools/lib/lint.js +139 -0
- package/design/tools/lib/registry.js +135 -0
- package/design/tools/lib/util.js +53 -0
- package/design/tools/lib/xml.js +257 -0
- package/design/tools/lib/xsd.js +408 -0
- package/dist/chunk-2QM2ZUDS.mjs +1308 -0
- package/dist/chunk-2QM2ZUDS.mjs.map +1 -0
- package/dist/chunk-2T2TCUYF.js +1371 -0
- package/dist/chunk-2T2TCUYF.js.map +1 -0
- package/dist/chunk-6UKTC4KF.js +43 -0
- package/dist/chunk-6UKTC4KF.js.map +1 -0
- package/dist/chunk-6Z4WRTI4.mjs +37 -0
- package/dist/chunk-6Z4WRTI4.mjs.map +1 -0
- package/dist/chunk-G3K6J5KY.js +157 -0
- package/dist/chunk-G3K6J5KY.js.map +1 -0
- package/dist/chunk-GM45RCSI.mjs +96 -0
- package/dist/chunk-GM45RCSI.mjs.map +1 -0
- package/dist/chunk-GQJLHH2P.mjs +3 -0
- package/dist/chunk-GQJLHH2P.mjs.map +1 -0
- package/dist/chunk-ICNR56VP.js +1653 -0
- package/dist/chunk-ICNR56VP.js.map +1 -0
- package/dist/chunk-J5LGTIGS.mjs +9 -0
- package/dist/chunk-J5LGTIGS.mjs.map +1 -0
- package/dist/chunk-LRPZLF2K.mjs +30 -0
- package/dist/chunk-LRPZLF2K.mjs.map +1 -0
- package/dist/chunk-OC4MXNXU.js +32 -0
- package/dist/chunk-OC4MXNXU.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +11 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-RWVTZUEG.js +161 -0
- package/dist/chunk-RWVTZUEG.js.map +1 -0
- package/dist/chunk-V473I5XQ.js +4 -0
- package/dist/chunk-V473I5XQ.js.map +1 -0
- package/dist/chunk-V4ULAISZ.js +915 -0
- package/dist/chunk-V4ULAISZ.js.map +1 -0
- package/dist/chunk-WRJERTJS.mjs +145 -0
- package/dist/chunk-WRJERTJS.mjs.map +1 -0
- package/dist/chunk-YIBPE3KQ.mjs +864 -0
- package/dist/chunk-YIBPE3KQ.mjs.map +1 -0
- package/dist/chunk-YUAQIZPN.mjs +1556 -0
- package/dist/chunk-YUAQIZPN.mjs.map +1 -0
- package/dist/contract/index.d.mts +304 -0
- package/dist/contract/index.d.ts +304 -0
- package/dist/contract/index.js +256 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/contract/index.mjs +3 -0
- package/dist/contract/index.mjs.map +1 -0
- package/dist/index.d.mts +4 -40
- package/dist/index.d.ts +4 -40
- package/dist/index.js +73 -992
- package/dist/index.mjs +2 -1
- package/dist/providers/flipova/index.d.mts +133 -0
- package/dist/providers/flipova/index.d.ts +133 -0
- package/dist/providers/flipova/index.js +249 -0
- package/dist/providers/flipova/index.js.map +1 -0
- package/dist/providers/flipova/index.mjs +4 -0
- package/dist/providers/flipova/index.mjs.map +1 -0
- package/dist/providers/gluestack/index.d.mts +7 -0
- package/dist/providers/gluestack/index.d.ts +7 -0
- package/dist/providers/gluestack/index.js +240 -0
- package/dist/providers/gluestack/index.js.map +1 -0
- package/dist/providers/gluestack/index.mjs +238 -0
- package/dist/providers/gluestack/index.mjs.map +1 -0
- package/dist/providers/gluestack/ui/index.d.mts +3472 -0
- package/dist/providers/gluestack/ui/index.d.ts +3472 -0
- package/dist/{chunk-LCTFQJZM.js → providers/gluestack/ui/index.js} +860 -2297
- package/dist/providers/gluestack/ui/index.js.map +1 -0
- package/dist/{chunk-2R66P5X5.mjs → providers/gluestack/ui/index.mjs} +468 -2062
- package/dist/providers/gluestack/ui/index.mjs.map +1 -0
- package/dist/providers/index.d.mts +37 -0
- package/dist/providers/index.d.ts +37 -0
- package/dist/providers/index.js +28 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/index.mjs +3 -0
- package/dist/providers/index.mjs.map +1 -0
- package/dist/providers/paper/index.d.mts +30 -0
- package/dist/providers/paper/index.d.ts +30 -0
- package/dist/providers/paper/index.js +362 -0
- package/dist/providers/paper/index.js.map +1 -0
- package/dist/providers/paper/index.mjs +353 -0
- package/dist/providers/paper/index.mjs.map +1 -0
- package/dist/providers/reusables/index.d.mts +60 -0
- package/dist/providers/reusables/index.d.ts +60 -0
- package/dist/providers/reusables/index.js +348 -0
- package/dist/providers/reusables/index.js.map +1 -0
- package/dist/providers/reusables/index.mjs +311 -0
- package/dist/providers/reusables/index.mjs.map +1 -0
- package/dist/providers/tamagui/index.d.mts +15 -0
- package/dist/providers/tamagui/index.d.ts +15 -0
- package/dist/providers/tamagui/index.js +275 -0
- package/dist/providers/tamagui/index.js.map +1 -0
- package/dist/providers/tamagui/index.mjs +270 -0
- package/dist/providers/tamagui/index.mjs.map +1 -0
- package/dist/theme-BznFrVT1.d.mts +566 -0
- package/dist/theme-BznFrVT1.d.ts +566 -0
- package/dist/types-C7P80VKR.d.ts +22 -0
- package/dist/types-Tspvmask.d.mts +22 -0
- package/dist/ui/index.d.mts +190 -7017
- package/dist/ui/index.d.ts +190 -7017
- package/dist/ui/index.js +73 -992
- package/dist/ui/index.mjs +2 -1
- package/package.json +136 -35
- package/components/ui/date-time-picker/index.web.tsx +0 -195
- package/design/documentation.xml +0 -607
- package/design/tools/design.js +0 -188
- package/design/tools/requirements.txt +0 -35
- package/design/tools/sources/.checker/__init__.py +0 -81
- package/design/tools/sources/.checker/checks.py +0 -198
- package/design/tools/sources/.checker/cli.py +0 -154
- package/design/tools/sources/.checker/io.py +0 -242
- package/design/tools/sources/.checker/model.py +0 -144
- package/design/tools/sources/.checker/registry.py +0 -115
- package/design/tools/sources/.checker/report.py +0 -21
- package/design/tools/sources/.docgen/__init__.py +0 -45
- package/design/tools/sources/.docgen/cli.py +0 -101
- package/design/tools/sources/.docgen/model.py +0 -147
- package/design/tools/sources/.docgen/reference.py +0 -97
- package/design/tools/sources/.docgen/site.py +0 -145
- package/design/tools/sources/.docgen/xsddoc.py +0 -329
- package/design/tools/sources/.generate/__init__.py +0 -35
- package/design/tools/sources/.generate/cli.py +0 -76
- package/design/tools/sources/.generate/common.py +0 -33
- package/design/tools/sources/.generate/config.py +0 -177
- package/design/tools/sources/.generate/model.py +0 -51
- package/design/tools/sources/.generate/tokens.py +0 -141
- package/design/tools/sources/.linter/__init__.py +0 -9
- package/design/tools/sources/.linter/cli.py +0 -44
- package/design/tools/sources/.linter/discovery.py +0 -30
- package/design/tools/sources/.linter/errors.py +0 -45
- package/design/tools/sources/.linter/linter.py +0 -68
- package/design/tools/sources/.xmleditor/__init__.py +0 -74
- package/design/tools/sources/.xmleditor/blocks.py +0 -185
- package/design/tools/sources/.xmleditor/cli.py +0 -141
- package/design/tools/sources/.xmleditor/editor.py +0 -906
- package/design/tools/sources/.xmleditor/model.py +0 -708
- package/design/tools/sources/.xmleditor/widgets.py +0 -1832
- package/design/tools/sources/.xmleditor/xsdmodel.py +0 -753
- package/design/tools/sources/checker.py +0 -55
- package/design/tools/sources/docgen.py +0 -66
- package/design/tools/sources/generate.py +0 -48
- package/design/tools/sources/linter.py +0 -54
- package/design/tools/sources/ruff.toml +0 -12
- package/design/tools/sources/xmleditor.py +0 -62
- package/design/tools/unix/_venv_python.sh +0 -16
- package/design/tools/unix/check.sh +0 -13
- package/design/tools/unix/doc.sh +0 -14
- package/design/tools/unix/gen.sh +0 -14
- package/design/tools/unix/lint.sh +0 -10
- package/design/tools/unix/run.sh +0 -20
- package/design/tools/unix/verify.sh +0 -12
- package/design/tools/unix/xmledit.sh +0 -12
- package/design/tools/windows/check.cmd +0 -12
- package/design/tools/windows/doc.cmd +0 -12
- package/design/tools/windows/gen.cmd +0 -11
- package/design/tools/windows/lint.cmd +0 -9
- package/design/tools/windows/run.cmd +0 -26
- package/design/tools/windows/verify.cmd +0 -10
- package/design/tools/windows/xmledit.cmd +0 -10
- package/dist/chunk-2R66P5X5.mjs.map +0 -1
- package/dist/chunk-LCTFQJZM.js.map +0 -1
- /package/components/{ui → providers/gluestack/ui}/accordion/ANIMATION_CUSTOMIZATION.md +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/AccordionAnimatedHeight.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/AccordionAnimatedIcon.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/AnimatedHeight.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/AnimatedIcon.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/MIGRATION_SUMMARY.md +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/USAGE_EXAMPLE.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/accordion/animation-config.ts +0 -0
- /package/components/{ui → providers/gluestack/ui}/avatar/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/box/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/box/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/calendar/creator.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/calendar/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/card/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/card/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/center/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/center/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/date-time-picker/creator.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/date-time-picker/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/flat-list/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/script.ts +0 -0
- /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/theme-context.ts +0 -0
- /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/tokens.d.ts +0 -0
- /package/components/{ui → providers/gluestack/ui}/gluestack-ui-provider/useGluestackColors.ts +0 -0
- /package/components/{ui → providers/gluestack/ui}/grid/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/grid/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/heading/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/heading/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/hstack/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/hstack/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/icon/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/image-background/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/image-viewer/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/input-accessory-view/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/keyboard-avoiding-view/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/pressable/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/refresh-control/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/safe-area-view/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/scroll-view/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/section-list/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/skeleton/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/skeleton/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/status-bar/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/switch/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/table/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/table/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/tabs/animation-config.ts +0 -0
- /package/components/{ui → providers/gluestack/ui}/tabs/creator.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/text/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/text/styles.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/textarea/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/view/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/virtualized-list/index.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/vstack/index.web.tsx +0 -0
- /package/components/{ui → providers/gluestack/ui}/vstack/styles.tsx +0 -0
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
"""xsd2md walker — generic XSD -> Markdown renderer driven by <xs:documentation>.
|
|
2
|
-
|
|
3
|
-
Split out of the historical docgen.py monolith: collects complexTypes /
|
|
4
|
-
simpleTypes / groups / key constraints from a schema and renders the
|
|
5
|
-
Schema Reference pages (see .docgen/reference.py::render_schema_reference).
|
|
6
|
-
"""
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
|
|
9
|
-
from dataclasses import dataclass, field
|
|
10
|
-
|
|
11
|
-
from lxml import etree
|
|
12
|
-
|
|
13
|
-
# ---------------------------------------------------------------------------
|
|
14
|
-
# Schema Reference renderer (inlined from the former xsd2doc.py; generic
|
|
15
|
-
# XSD -> Markdown walker driven by <xs:documentation> annotations).
|
|
16
|
-
# ---------------------------------------------------------------------------
|
|
17
|
-
XS = "http://www.w3.org/2001/XMLSchema"
|
|
18
|
-
NS = {"xs": XS}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def qn(tag: str) -> str:
|
|
22
|
-
return f"{{{XS}}}{tag}"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def local(tag: str) -> str:
|
|
26
|
-
return etree.QName(tag).localname if "{" in tag else tag
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def doc_text(node) -> str:
|
|
30
|
-
"""Extrait et nettoie le texte de la première xs:annotation/xs:documentation d'un noeud."""
|
|
31
|
-
ann = node.find(qn("annotation"))
|
|
32
|
-
if ann is None:
|
|
33
|
-
return ""
|
|
34
|
-
parts = []
|
|
35
|
-
for d in ann.findall(qn("documentation")):
|
|
36
|
-
if d.text:
|
|
37
|
-
parts.append(d.text)
|
|
38
|
-
text = " ".join(p.strip() for p in parts if p and p.strip())
|
|
39
|
-
# Normalise les espaces multiples issus de l'indentation XML
|
|
40
|
-
return " ".join(text.split())
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def summary_of(text: str) -> str:
|
|
44
|
-
"""Première phrase d'un bloc de documentation, utilisée comme résumé court."""
|
|
45
|
-
if not text:
|
|
46
|
-
return ""
|
|
47
|
-
for sep in (". ", " — ", " - "):
|
|
48
|
-
if sep in text:
|
|
49
|
-
return text.split(sep, 1)[0].strip().rstrip(".") + "."
|
|
50
|
-
return text
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@dataclass
|
|
54
|
-
class AttrInfo:
|
|
55
|
-
name: str
|
|
56
|
-
type: str
|
|
57
|
-
use: str
|
|
58
|
-
fixed: str | None
|
|
59
|
-
default: str | None
|
|
60
|
-
doc: str
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
@dataclass
|
|
64
|
-
class ChildInfo:
|
|
65
|
-
name: str
|
|
66
|
-
type_ref: str
|
|
67
|
-
min_occurs: str
|
|
68
|
-
max_occurs: str
|
|
69
|
-
doc: str
|
|
70
|
-
inline: bool = False # True si le type est déclaré en ligne (anonyme)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
@dataclass
|
|
74
|
-
class TypeInfo:
|
|
75
|
-
name: str
|
|
76
|
-
kind: str # 'complexType' | 'simpleType' | 'element' | 'group'
|
|
77
|
-
doc: str
|
|
78
|
-
attrs: list = field(default_factory=list)
|
|
79
|
-
children: list = field(default_factory=list)
|
|
80
|
-
enum_values: list = field(default_factory=list)
|
|
81
|
-
base: str | None = None
|
|
82
|
-
constraints: list = field(default_factory=list) # (kind, name, xpath_info)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def describe_particle(parent_el, container: TypeInfo, prefix=""):
|
|
86
|
-
"""Parcourt un sequence/choice/group ref et remplit container.children."""
|
|
87
|
-
for node in parent_el:
|
|
88
|
-
if not isinstance(node.tag, str):
|
|
89
|
-
continue # comments / processing instructions have callable tags
|
|
90
|
-
tag = local(node.tag)
|
|
91
|
-
if tag in ("sequence", "choice", "all"):
|
|
92
|
-
marker = " (choix)" if tag == "choice" else ""
|
|
93
|
-
describe_particle(node, container, prefix=prefix + marker)
|
|
94
|
-
elif tag == "group":
|
|
95
|
-
ref = node.get("ref", "").split(":")[-1]
|
|
96
|
-
container.children.append(
|
|
97
|
-
ChildInfo(name=f"« groupe: {ref} »", type_ref=ref,
|
|
98
|
-
min_occurs="1", max_occurs="1",
|
|
99
|
-
doc=f"Inclusion du groupe réutilisable `{ref}`.{prefix}")
|
|
100
|
-
)
|
|
101
|
-
elif tag == "element":
|
|
102
|
-
name = node.get("name", node.get("ref", "?"))
|
|
103
|
-
min_o = node.get("minOccurs", "1")
|
|
104
|
-
max_o = node.get("maxOccurs", "1")
|
|
105
|
-
d = doc_text(node)
|
|
106
|
-
type_attr = node.get("type")
|
|
107
|
-
inline_ct = node.find(qn("complexType"))
|
|
108
|
-
inline_st = node.find(qn("simpleType"))
|
|
109
|
-
if type_attr:
|
|
110
|
-
type_ref = type_attr.split(":")[-1]
|
|
111
|
-
inline = False
|
|
112
|
-
elif inline_ct is not None or inline_st is not None:
|
|
113
|
-
type_ref = f"{container.name}.{name}"
|
|
114
|
-
inline = True
|
|
115
|
-
else:
|
|
116
|
-
type_ref = "xs:string"
|
|
117
|
-
inline = False
|
|
118
|
-
container.children.append(
|
|
119
|
-
ChildInfo(name=name, type_ref=type_ref, min_occurs=min_o,
|
|
120
|
-
max_occurs=max_o, doc=d + prefix, inline=inline)
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
def parse_attributes(el) -> list:
|
|
125
|
-
out = []
|
|
126
|
-
for a in el.findall(qn("attribute")):
|
|
127
|
-
out.append(AttrInfo(
|
|
128
|
-
name=a.get("name", a.get("ref", "?")),
|
|
129
|
-
type=(a.get("type", "").split(":")[-1] or "inline"),
|
|
130
|
-
use=a.get("use", "optional"),
|
|
131
|
-
fixed=a.get("fixed"),
|
|
132
|
-
default=a.get("default"),
|
|
133
|
-
doc=doc_text(a),
|
|
134
|
-
))
|
|
135
|
-
return out
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
def parse_constraints(el) -> list:
|
|
139
|
-
out = []
|
|
140
|
-
for kind in ("key", "keyref", "unique"):
|
|
141
|
-
for c in el.findall(qn(kind)):
|
|
142
|
-
sel = c.find(qn("selector"))
|
|
143
|
-
fields = c.findall(qn("field"))
|
|
144
|
-
info = {
|
|
145
|
-
"name": c.get("name"),
|
|
146
|
-
"refer": c.get("refer", "").split(":")[-1] if kind == "keyref" else None,
|
|
147
|
-
"selector": sel.get("xpath") if sel is not None else "",
|
|
148
|
-
"fields": [f.get("xpath") for f in fields],
|
|
149
|
-
}
|
|
150
|
-
out.append((kind, info))
|
|
151
|
-
return out
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def collect_types(schema_root) -> dict[str, TypeInfo]:
|
|
155
|
-
types: dict[str, TypeInfo] = {}
|
|
156
|
-
|
|
157
|
-
# complexTypes et simpleTypes nommés au niveau racine
|
|
158
|
-
for ct in schema_root.findall(qn("complexType")):
|
|
159
|
-
name = ct.get("name")
|
|
160
|
-
if not name:
|
|
161
|
-
continue
|
|
162
|
-
info = TypeInfo(name=name, kind="complexType", doc=doc_text(ct))
|
|
163
|
-
info.attrs = parse_attributes(ct)
|
|
164
|
-
# contenu simple (extension de xs:string, etc.)
|
|
165
|
-
simple = ct.find(qn("simpleContent"))
|
|
166
|
-
if simple is not None:
|
|
167
|
-
ext = simple.find(qn("extension"))
|
|
168
|
-
if ext is not None:
|
|
169
|
-
info.base = ext.get("base", "").split(":")[-1]
|
|
170
|
-
info.attrs += parse_attributes(ext)
|
|
171
|
-
else:
|
|
172
|
-
describe_particle(ct, info)
|
|
173
|
-
types[name] = info
|
|
174
|
-
|
|
175
|
-
for st in schema_root.findall(qn("simpleType")):
|
|
176
|
-
name = st.get("name")
|
|
177
|
-
if not name:
|
|
178
|
-
continue
|
|
179
|
-
info = TypeInfo(name=name, kind="simpleType", doc=doc_text(st))
|
|
180
|
-
restr = st.find(qn("restriction"))
|
|
181
|
-
if restr is not None:
|
|
182
|
-
info.base = restr.get("base", "").split(":")[-1]
|
|
183
|
-
info.enum_values = [e.get("value") for e in restr.findall(qn("enumeration"))]
|
|
184
|
-
types[name] = info
|
|
185
|
-
|
|
186
|
-
# groupes réutilisables
|
|
187
|
-
for gr in schema_root.findall(qn("group")):
|
|
188
|
-
name = gr.get("name")
|
|
189
|
-
if not name:
|
|
190
|
-
continue
|
|
191
|
-
info = TypeInfo(name=name, kind="group", doc=doc_text(gr))
|
|
192
|
-
describe_particle(gr, info)
|
|
193
|
-
types[name] = info
|
|
194
|
-
|
|
195
|
-
# éléments racine (avec complexType éventuellement en ligne)
|
|
196
|
-
for el in schema_root.findall(qn("element")):
|
|
197
|
-
name = el.get("name")
|
|
198
|
-
if not name:
|
|
199
|
-
continue
|
|
200
|
-
info = TypeInfo(name=name, kind="element (racine)", doc=doc_text(el))
|
|
201
|
-
ct = el.find(qn("complexType"))
|
|
202
|
-
if ct is not None:
|
|
203
|
-
info.attrs = parse_attributes(ct)
|
|
204
|
-
describe_particle(ct, info)
|
|
205
|
-
info.constraints = parse_constraints(el)
|
|
206
|
-
types[f"@{name}"] = info # préfixe pour distinguer des types portant le même nom
|
|
207
|
-
|
|
208
|
-
return types
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
def render_markdown(types: dict, title: str) -> str:
|
|
212
|
-
lines = [f"# {title}", ""]
|
|
213
|
-
lines.append(
|
|
214
|
-
"> Documentation générée automatiquement depuis le schéma XSD "
|
|
215
|
-
"par `xsd2doc.py`. Ne pas éditer à la main : modifier le `.xsd` "
|
|
216
|
-
"puis régénérer.\n"
|
|
217
|
-
)
|
|
218
|
-
|
|
219
|
-
roots = {k: v for k, v in types.items() if k.startswith("@")}
|
|
220
|
-
groups = {k: v for k, v in types.items() if v.kind == "group"}
|
|
221
|
-
simples = {k: v for k, v in types.items() if v.kind == "simpleType"}
|
|
222
|
-
complexes = {k: v for k, v in types.items()
|
|
223
|
-
if v.kind == "complexType"}
|
|
224
|
-
|
|
225
|
-
# Sommaire
|
|
226
|
-
lines.append("## Sommaire\n")
|
|
227
|
-
if roots:
|
|
228
|
-
lines.append("- **Fichiers racine** : " +
|
|
229
|
-
", ".join(f"[{v.name}](#{v.name.lower()})" for v in roots.values()))
|
|
230
|
-
if complexes:
|
|
231
|
-
lines.append("- **Types complexes** : " +
|
|
232
|
-
", ".join(f"[{n}](#{n.lower()})" for n in sorted(complexes)))
|
|
233
|
-
if groups:
|
|
234
|
-
lines.append("- **Groupes réutilisables** : " +
|
|
235
|
-
", ".join(f"[{n}](#{n.lower()})" for n in sorted(groups)))
|
|
236
|
-
if simples:
|
|
237
|
-
lines.append("- **Types simples / énumérations** : " +
|
|
238
|
-
", ".join(f"[{n}](#{n.lower()})" for n in sorted(simples)))
|
|
239
|
-
lines.append("")
|
|
240
|
-
|
|
241
|
-
def render_children_table(info: TypeInfo):
|
|
242
|
-
if not info.children:
|
|
243
|
-
return []
|
|
244
|
-
out = ["| Élément | Occurrences | Type | Description |",
|
|
245
|
-
"|---|---|---|---|"]
|
|
246
|
-
for c in info.children:
|
|
247
|
-
occ = f"{c.min_occurs}..{'∞' if c.max_occurs == 'unbounded' else c.max_occurs}"
|
|
248
|
-
type_link = (
|
|
249
|
-
f"[`{c.type_ref}`](#{c.type_ref.lower().split('.')[0]})"
|
|
250
|
-
if not c.inline and c.type_ref in types
|
|
251
|
-
else f"`{c.type_ref}` (en ligne)" if c.inline
|
|
252
|
-
else f"`{c.type_ref}`"
|
|
253
|
-
)
|
|
254
|
-
out.append(f"| `{c.name}` | {occ} | {type_link} | {c.doc or '—'} |")
|
|
255
|
-
out.append("")
|
|
256
|
-
return out
|
|
257
|
-
|
|
258
|
-
def render_attrs_table(info: TypeInfo):
|
|
259
|
-
if not info.attrs:
|
|
260
|
-
return []
|
|
261
|
-
out = ["| Attribut | Type | Contrainte | Description |",
|
|
262
|
-
"|---|---|---|---|"]
|
|
263
|
-
for a in info.attrs:
|
|
264
|
-
constraint = a.use
|
|
265
|
-
if a.fixed:
|
|
266
|
-
constraint += f", figé à `{a.fixed}`"
|
|
267
|
-
if a.default:
|
|
268
|
-
constraint += f", défaut `{a.default}`"
|
|
269
|
-
out.append(f"| `{a.name}` | `{a.type}` | {constraint} | {a.doc or '—'} |")
|
|
270
|
-
out.append("")
|
|
271
|
-
return out
|
|
272
|
-
|
|
273
|
-
def render_type_block(info: TypeInfo, heading_level="##"):
|
|
274
|
-
block = [f"{heading_level} {info.name}", ""]
|
|
275
|
-
if info.doc:
|
|
276
|
-
block.append(f"*{info.doc}*\n")
|
|
277
|
-
if info.kind == "simpleType":
|
|
278
|
-
block.append(f"Type de base : `{info.base}`\n")
|
|
279
|
-
if info.enum_values:
|
|
280
|
-
block.append("Valeurs autorisées : " +
|
|
281
|
-
", ".join(f"`{v}`" for v in info.enum_values) + "\n")
|
|
282
|
-
else:
|
|
283
|
-
if info.base:
|
|
284
|
-
block.append(f"Contenu textuel simple, extension de `{info.base}`.\n")
|
|
285
|
-
block += render_attrs_table(info)
|
|
286
|
-
block += render_children_table(info)
|
|
287
|
-
if info.constraints:
|
|
288
|
-
block.append("**Contraintes d'intégrité :**\n")
|
|
289
|
-
for kind, c in info.constraints:
|
|
290
|
-
if kind == "keyref":
|
|
291
|
-
block.append(
|
|
292
|
-
f"- `{c['name']}` (*keyref* → `{c['refer']}`) : "
|
|
293
|
-
f"chaque `{c['selector']}` doit référencer un `{c['fields'][0]}` "
|
|
294
|
-
f"existant dans la clé correspondante."
|
|
295
|
-
)
|
|
296
|
-
elif kind == "key":
|
|
297
|
-
block.append(
|
|
298
|
-
f"- `{c['name']}` (*key*) : `{c['selector']}` est une clé "
|
|
299
|
-
f"faisant foi sur `{c['fields'][0]}`."
|
|
300
|
-
)
|
|
301
|
-
else:
|
|
302
|
-
block.append(
|
|
303
|
-
f"- `{c['name']}` (*unique*) : `{c['fields'][0]}` doit être "
|
|
304
|
-
f"unique parmi `{c['selector']}`."
|
|
305
|
-
)
|
|
306
|
-
block.append("")
|
|
307
|
-
return block
|
|
308
|
-
|
|
309
|
-
if roots:
|
|
310
|
-
lines.append("## Fichiers racine\n")
|
|
311
|
-
for info in roots.values():
|
|
312
|
-
lines += render_type_block(info, heading_level="###")
|
|
313
|
-
|
|
314
|
-
if complexes:
|
|
315
|
-
lines.append("## Types complexes\n")
|
|
316
|
-
for name in sorted(complexes):
|
|
317
|
-
lines += render_type_block(complexes[name], heading_level="###")
|
|
318
|
-
|
|
319
|
-
if groups:
|
|
320
|
-
lines.append("## Groupes réutilisables\n")
|
|
321
|
-
for name in sorted(groups):
|
|
322
|
-
lines += render_type_block(groups[name], heading_level="###")
|
|
323
|
-
|
|
324
|
-
if simples:
|
|
325
|
-
lines.append("## Types simples / énumérations\n")
|
|
326
|
-
for name in sorted(simples):
|
|
327
|
-
lines += render_type_block(simples[name], heading_level="###")
|
|
328
|
-
|
|
329
|
-
return "\n".join(lines) + "\n"
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"""Flipova Foundation gluestack config generator (implementation package).
|
|
2
|
-
|
|
3
|
-
The design pipeline has a single function: turn the registries
|
|
4
|
-
(design/tokens.xml + design/themes.xml) into the gluestack-ui/nativewind theme
|
|
5
|
-
configuration (components/ui/gluestack-ui-provider/config.ts).
|
|
6
|
-
|
|
7
|
-
Modules:
|
|
8
|
-
|
|
9
|
-
- ``common.py`` : shared imports, XML namespace, ``q()`` helper
|
|
10
|
-
- ``model.py`` : ManifestModel + load_manifest (manifest.xml)
|
|
11
|
-
- ``config.py`` : tokens/themes -> gluestack config.ts renderer (colours)
|
|
12
|
-
- ``tokens.py`` : tokens -> Tailwind/nativewind theme fragment (tokens.js)
|
|
13
|
-
- ``cli.py`` : argument parsing & dispatch (``main``)
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
from __future__ import annotations
|
|
17
|
-
|
|
18
|
-
from .cli import main
|
|
19
|
-
from .common import GENERATOR_NOTE, NS, q
|
|
20
|
-
from .config import render_gluestack_config, theme_role_colours, theme_role_ids
|
|
21
|
-
from .model import ManifestModel, load_manifest
|
|
22
|
-
from .tokens import render_tokens_theme
|
|
23
|
-
|
|
24
|
-
__all__ = [
|
|
25
|
-
"GENERATOR_NOTE",
|
|
26
|
-
"NS",
|
|
27
|
-
"ManifestModel",
|
|
28
|
-
"load_manifest",
|
|
29
|
-
"main",
|
|
30
|
-
"q",
|
|
31
|
-
"render_gluestack_config",
|
|
32
|
-
"render_tokens_theme",
|
|
33
|
-
"theme_role_colours",
|
|
34
|
-
"theme_role_ids",
|
|
35
|
-
]
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"""CLI (main) for the gluestack config + tokens generator."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from .common import *
|
|
6
|
-
from .config import render_gluestack_config, theme_role_colours
|
|
7
|
-
from .model import load_manifest
|
|
8
|
-
from .tokens import render_tokens_theme
|
|
9
|
-
|
|
10
|
-
RENDERERS = {
|
|
11
|
-
"gluestackConfig": render_gluestack_config,
|
|
12
|
-
"gluestackTokens": render_tokens_theme,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def _list(man: ManifestModel) -> None:
|
|
17
|
-
for tid, roles in theme_role_colours(man):
|
|
18
|
-
print(f"{tid} ({len(roles)} role(s))")
|
|
19
|
-
for rid, triplet in roles:
|
|
20
|
-
print(f" --{rid}: {triplet}")
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def _targets(man: ManifestModel) -> list[tuple[Path, str]]:
|
|
24
|
-
targets: list[tuple[Path, str]] = []
|
|
25
|
-
for kind, rel in man.outputs.items():
|
|
26
|
-
render = RENDERERS.get(kind)
|
|
27
|
-
if render is None:
|
|
28
|
-
print(f"error: manifest output {kind!r} has no generator", file=sys.stderr)
|
|
29
|
-
raise SystemExit(2)
|
|
30
|
-
if not rel:
|
|
31
|
-
print(f"error: manifest output {kind!r} has an empty path", file=sys.stderr)
|
|
32
|
-
raise SystemExit(2)
|
|
33
|
-
targets.append(((man.root / rel).resolve(), render(man)))
|
|
34
|
-
if not targets:
|
|
35
|
-
print("error: manifest declares no outputs", file=sys.stderr)
|
|
36
|
-
raise SystemExit(2)
|
|
37
|
-
return targets
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def main() -> int:
|
|
41
|
-
repo_root = Path(__file__).resolve().parents[4]
|
|
42
|
-
default_manifest = repo_root / "design" / "manifest.xml"
|
|
43
|
-
parser = argparse.ArgumentParser(
|
|
44
|
-
description="Compile design/tokens.xml + design/themes.xml into the gluestack-ui theme config")
|
|
45
|
-
parser.add_argument("--manifest", "-m", default=str(default_manifest))
|
|
46
|
-
parser.add_argument("--root", "-r", default=str(repo_root),
|
|
47
|
-
help="repo root (output paths resolve against it)")
|
|
48
|
-
parser.add_argument("--check", action="store_true",
|
|
49
|
-
help="verify the generated files match (regeneration drift)")
|
|
50
|
-
parser.add_argument("--list", action="store_true", help="list themes and their roles")
|
|
51
|
-
args = parser.parse_args()
|
|
52
|
-
|
|
53
|
-
man = load_manifest(Path(args.root), Path(args.manifest))
|
|
54
|
-
|
|
55
|
-
if args.list:
|
|
56
|
-
_list(man)
|
|
57
|
-
return 0
|
|
58
|
-
|
|
59
|
-
drift = 0
|
|
60
|
-
for target, text in _targets(man):
|
|
61
|
-
if args.check:
|
|
62
|
-
if not target.exists() or target.read_text(encoding="utf-8") != text:
|
|
63
|
-
print(f"changed {target}" if target.exists() else f"missing {target}")
|
|
64
|
-
drift += 1
|
|
65
|
-
else:
|
|
66
|
-
target.parent.mkdir(parents=True, exist_ok=True)
|
|
67
|
-
with open(target, "w", encoding="utf-8", newline="\n") as fh:
|
|
68
|
-
fh.write(text)
|
|
69
|
-
print(f"written {target}")
|
|
70
|
-
|
|
71
|
-
if args.check:
|
|
72
|
-
if drift:
|
|
73
|
-
return 1
|
|
74
|
-
print("up to date")
|
|
75
|
-
return 0
|
|
76
|
-
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"""Shared imports, namespace and helpers for the .generate package.
|
|
2
|
-
|
|
3
|
-
This package has exactly one responsibility: turn the design registries
|
|
4
|
-
(design/tokens.xml + design/themes.xml) into the gluestack-ui/nativewind theme
|
|
5
|
-
configuration consumed by components/ui/gluestack-ui-provider/config.ts.
|
|
6
|
-
|
|
7
|
-
The sibling modules (config.py, model.py, cli.py) rely on
|
|
8
|
-
`from .common import *` to see these names, so the "unused" imports below are
|
|
9
|
-
deliberate re-exports (hence the noqa: F401 markers).
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
from __future__ import annotations
|
|
13
|
-
|
|
14
|
-
import argparse # noqa: F401 (re-exported via `from .common import *`)
|
|
15
|
-
import re # noqa: F401 (re-exported via `from .common import *`)
|
|
16
|
-
import sys
|
|
17
|
-
from dataclasses import ( # noqa: F401 (re-exported via `from .common import *`)
|
|
18
|
-
dataclass,
|
|
19
|
-
field,
|
|
20
|
-
)
|
|
21
|
-
from pathlib import Path
|
|
22
|
-
|
|
23
|
-
from lxml import etree # noqa: F401 (re-exported via `from .common import *`)
|
|
24
|
-
|
|
25
|
-
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
|
26
|
-
import checker # noqa: F401 (registry model; re-exported via `from .common import *`)
|
|
27
|
-
|
|
28
|
-
NS = "urn:flipova:foundation:registry"
|
|
29
|
-
GENERATOR_NOTE = "generated by design/tools/sources/generate.py -- do not edit by hand"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def q(tag: str) -> str:
|
|
33
|
-
return f"{{{NS}}}{tag}"
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
"""gluestack / nativewind config emitter.
|
|
2
|
-
|
|
3
|
-
Compiles design/tokens.xml + design/themes.xml into
|
|
4
|
-
components/ui/gluestack-ui-provider/config.ts:
|
|
5
|
-
|
|
6
|
-
- each theme (themes.xml) becomes a `colors.<theme-id>` record;
|
|
7
|
-
- each role id (the gluestack CSS variable name without the leading "--")
|
|
8
|
-
becomes a `'--<role>'` entry;
|
|
9
|
-
- each role value is resolved against the tokens registry and normalised to a
|
|
10
|
-
space-separated RGB triplet (the nativewind/gluestack colour format).
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
from __future__ import annotations
|
|
14
|
-
|
|
15
|
-
from .common import *
|
|
16
|
-
from .model import ManifestModel
|
|
17
|
-
|
|
18
|
-
_HEADER = [
|
|
19
|
-
"// Generated by design/tools/sources/generate.py -- do not edit by hand.",
|
|
20
|
-
"// Source of truth: design/tokens.xml + design/themes.xml",
|
|
21
|
-
"// Regenerate with: npm run design:gen",
|
|
22
|
-
"import { vars } from 'nativewind';",
|
|
23
|
-
"",
|
|
24
|
-
]
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def _to_rgb_triplet(literal: str) -> str:
|
|
28
|
-
"""Normalise a resolved colour to the gluestack format ('r g b')."""
|
|
29
|
-
text = literal.strip()
|
|
30
|
-
if text.startswith("#"):
|
|
31
|
-
digits = text[1:]
|
|
32
|
-
if len(digits) == 3:
|
|
33
|
-
digits = "".join(ch * 2 for ch in digits)
|
|
34
|
-
if len(digits) != 6:
|
|
35
|
-
raise SystemExit(f"unsupported colour {literal!r} (expected #RGB or #RRGGBB)")
|
|
36
|
-
r, g, b = (int(digits[i:i + 2], 16) for i in (0, 2, 4))
|
|
37
|
-
return f"{r} {g} {b}"
|
|
38
|
-
# Already a literal gluestack value (space-separated RGB triplet).
|
|
39
|
-
return " ".join(text.split())
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def _resolve_colour(ctx: checker.RegistryModel, ref: str) -> str:
|
|
43
|
-
"""Resolve `$ref.<register>.<id>.<path>` against the tokens registry."""
|
|
44
|
-
raw = ref.strip()
|
|
45
|
-
parts = raw[len("$ref."):].split(".") if raw.startswith("$ref.") else raw.split(".")
|
|
46
|
-
if parts and parts[0] in ctx.registers:
|
|
47
|
-
parts = parts[1:]
|
|
48
|
-
if len(parts) < 2:
|
|
49
|
-
raise SystemExit(f"dangling reference {ref!r} (expected $ref.<register>.<id>.<path>)")
|
|
50
|
-
item_id, key = parts[0], ".".join(parts[1:])
|
|
51
|
-
values = ctx.token_values.get(item_id)
|
|
52
|
-
if values is None or key not in values:
|
|
53
|
-
raise SystemExit(f"dangling reference {ref!r}: no token value matches")
|
|
54
|
-
return values[key]
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def theme_role_colours(man: ManifestModel) -> list[tuple[str, list[tuple[str, str]]]]:
|
|
58
|
-
"""[(theme_id, [(role_id, 'r g b'), ...]), ...] in themes.xml order."""
|
|
59
|
-
themes_path = man.ctx.catalog_files.get("themes")
|
|
60
|
-
if themes_path is None or not themes_path.exists():
|
|
61
|
-
raise SystemExit("manifest: no themes catalog file found")
|
|
62
|
-
root = etree.parse(str(themes_path)).getroot()
|
|
63
|
-
themes: list[tuple[str, list[tuple[str, str]]]] = []
|
|
64
|
-
for theme in root.findall(q("items") + "/" + q("theme")):
|
|
65
|
-
tid = (theme.get("id") or "").strip()
|
|
66
|
-
roles: list[tuple[str, str]] = []
|
|
67
|
-
for role in theme.findall(q("roleMap") + "/" + q("role")):
|
|
68
|
-
rid = (role.get("id") or "").strip()
|
|
69
|
-
ref_el = role.find(q("ref"))
|
|
70
|
-
val_el = role.find(q("value"))
|
|
71
|
-
if ref_el is not None:
|
|
72
|
-
literal = _resolve_colour(man.ctx, ref_el.text or "")
|
|
73
|
-
elif val_el is not None:
|
|
74
|
-
literal = val_el.text or ""
|
|
75
|
-
else:
|
|
76
|
-
raise SystemExit(f"theme {tid!r}: role {rid!r} needs a <ref> or a <value>")
|
|
77
|
-
roles.append((rid, _to_rgb_triplet(literal)))
|
|
78
|
-
themes.append((tid, roles))
|
|
79
|
-
return themes
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
def theme_role_ids(man: ManifestModel) -> list[str]:
|
|
83
|
-
"""Ordered semantic role ids (the gluestack CSS variable names), from themes.xml.
|
|
84
|
-
|
|
85
|
-
A role id defines the semantic colour surface of the design system, so it is
|
|
86
|
-
emitted twice: as a `'--<role>'` variable in config.ts, and as a
|
|
87
|
-
`rgb(var(--<role>)/<alpha-value>)` colour in the Tailwind theme (tokens.js).
|
|
88
|
-
Every theme must therefore declare the same roles.
|
|
89
|
-
"""
|
|
90
|
-
themes = theme_role_colours(man)
|
|
91
|
-
if not themes:
|
|
92
|
-
return []
|
|
93
|
-
reference = [rid for rid, _ in themes[0][1]]
|
|
94
|
-
for tid, roles in themes[1:]:
|
|
95
|
-
others = [rid for rid, _ in roles]
|
|
96
|
-
if others != reference:
|
|
97
|
-
print(f"warning: theme {tid!r} declares a different role set than "
|
|
98
|
-
f"{themes[0][0]!r} (Tailwind colours are generated from {themes[0][0]!r})")
|
|
99
|
-
return reference
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
_JS_IDENT = re.compile(r"^[A-Za-z_$][A-Za-z0-9_$]*$")
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def _js_key(name: str) -> str:
|
|
106
|
-
"""Quote an object key unless it is a bare JS identifier.
|
|
107
|
-
|
|
108
|
-
A theme id is free-form ("spring-light", "high-contrast"), but `spring-light`
|
|
109
|
-
is not a valid unquoted object key: emitting it bare produces a syntax error.
|
|
110
|
-
"""
|
|
111
|
-
return name if _JS_IDENT.match(name) else "'" + name.replace("'", "\\'") + "'"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def theme_variants(man: ManifestModel) -> list[tuple[str, str, str]]:
|
|
115
|
-
"""[(variant, mode, theme_id), ...] in themes.xml order.
|
|
116
|
-
|
|
117
|
-
A variant is a light/dark PAIR, so the runtime can resolve a (variant, mode)
|
|
118
|
-
request to a theme id. The table is emitted rather than rebuilt at runtime so
|
|
119
|
-
a theme id never has to follow a naming convention: a variant may be spelled
|
|
120
|
-
`spring` with themes `spring-light`/`spring-dark`, or anything else at all.
|
|
121
|
-
"""
|
|
122
|
-
themes_path = man.ctx.catalog_files.get("themes")
|
|
123
|
-
if themes_path is None or not themes_path.exists():
|
|
124
|
-
raise SystemExit("manifest: no themes catalog file found")
|
|
125
|
-
root = etree.parse(str(themes_path)).getroot()
|
|
126
|
-
out: list[tuple[str, str, str]] = []
|
|
127
|
-
for theme in root.findall(q("items") + "/" + q("theme")):
|
|
128
|
-
tid = (theme.get("id") or "").strip()
|
|
129
|
-
mode = (theme.get("mode") or "").strip()
|
|
130
|
-
variant = (theme.get("variant") or "default").strip() or "default"
|
|
131
|
-
out.append((variant, mode, tid))
|
|
132
|
-
return out
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
def _render_variant_table(variants: list[tuple[str, str, str]]) -> list[str]:
|
|
136
|
-
"""`export const variants = { spring: { light: 'spring-light', ... } }`."""
|
|
137
|
-
ordered: dict[str, list[tuple[str, str]]] = {}
|
|
138
|
-
for variant, mode, tid in variants:
|
|
139
|
-
entries = ordered.setdefault(variant, [])
|
|
140
|
-
if any(m == mode for m, _ in entries):
|
|
141
|
-
raise SystemExit(
|
|
142
|
-
f"theme variant {variant!r} declares the mode {mode!r} twice: "
|
|
143
|
-
"a variant is a light/dark pair, so it has exactly one theme per mode"
|
|
144
|
-
)
|
|
145
|
-
entries.append((mode, tid))
|
|
146
|
-
lines = ["export const variants = {"]
|
|
147
|
-
for variant in sorted(ordered):
|
|
148
|
-
pairs = ", ".join(f"{_js_key(mode)}: '{tid}'" for mode, tid in sorted(ordered[variant]))
|
|
149
|
-
lines.append(f" {_js_key(variant)}: {{ {pairs} }},")
|
|
150
|
-
lines.append("};")
|
|
151
|
-
return lines
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def render_gluestack_config(man: ManifestModel) -> str:
|
|
155
|
-
themes = theme_role_colours(man)
|
|
156
|
-
lines = list(_HEADER)
|
|
157
|
-
lines.append("// Raw color values (space-separated RGB) - edit design/themes.xml and regenerate")
|
|
158
|
-
lines.append("export const colors = {")
|
|
159
|
-
for tid, roles in themes:
|
|
160
|
-
lines.append(f" {_js_key(tid)}: {{")
|
|
161
|
-
for rid, triplet in roles:
|
|
162
|
-
lines.append(f" '--{rid}': '{triplet}',")
|
|
163
|
-
lines.append(" },")
|
|
164
|
-
lines.append("};")
|
|
165
|
-
lines.append("")
|
|
166
|
-
lines.append("// Config for nativewind vars() - used by the provider")
|
|
167
|
-
lines.append("export const config = {")
|
|
168
|
-
for tid, _ in themes:
|
|
169
|
-
# Bracket access, always: a quoted key ("spring-light") is not valid
|
|
170
|
-
# after a dot, so `colors.something` would only work by luck.
|
|
171
|
-
lines.append(f" {_js_key(tid)}: vars(colors['{tid}']),")
|
|
172
|
-
lines.append("};")
|
|
173
|
-
lines.append("")
|
|
174
|
-
lines.append("// Theme variants: variant -> mode -> theme id, from the `variant` attribute in")
|
|
175
|
-
lines.append("// design/themes.xml. `default` holds the base light/dark pair.")
|
|
176
|
-
lines.extend(_render_variant_table(theme_variants(man)))
|
|
177
|
-
return "\n".join(lines) + "\n"
|