@rbxts/uiblox 0.2.0-alpha.3 → 0.2.0-alpha.30
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/README.md +27 -109
- package/out/hooks/index.d.ts +1 -0
- package/out/hooks/init.luau +3 -0
- package/out/hooks/useBreakpoints.luau +2 -11
- package/out/hooks/viewportObserver.d.ts +10 -0
- package/out/hooks/viewportObserver.luau +75 -0
- package/out/theme/interfaces/theme/Theme.d.ts +15 -0
- package/out/theme/styles/utilities/componentStyles.luau +45 -3
- package/out/theme/styles/utilities/componentTheme.d.ts +15 -0
- package/out/theme/styles/utilities/index.d.ts +2 -0
- package/out/theme/styles/utilities/init.luau +7 -0
- package/out/theme/styles/utilities/resolveStyle.d.ts +10 -2
- package/out/theme/styles/utilities/resolveStyle.luau +7 -3
- package/out/theme/styles/utilities/resolveSx.d.ts +110 -0
- package/out/theme/styles/utilities/resolveSx.luau +479 -0
- package/out/theme/styles/utilities/styleCache.d.ts +2 -0
- package/out/theme/styles/utilities/styleCache.luau +9 -0
- package/out/ui/packages/accordion/components/Accordion.d.ts +2 -0
- package/out/ui/packages/accordion/components/Accordion.luau +46 -30
- package/out/ui/packages/accordion/components/Accordion.styles.d.ts +1 -0
- package/out/ui/packages/accordion/components/Accordion.styles.luau +16 -4
- package/out/ui/packages/accordion/components/accordionOpen.d.ts +1 -0
- package/out/ui/packages/accordion/components/accordionOpen.luau +4 -0
- package/out/ui/packages/alert/components/Alert.d.ts +2 -0
- package/out/ui/packages/alert/components/Alert.luau +48 -42
- package/out/ui/packages/alert/components/Alert.styles.d.ts +2 -0
- package/out/ui/packages/alert/components/Alert.styles.luau +17 -8
- package/out/ui/packages/appBar/components/AppBar.d.ts +2 -1
- package/out/ui/packages/appBar/components/AppBar.luau +47 -36
- package/out/ui/packages/appBar/components/AppBar.styles.d.ts +2 -0
- package/out/ui/packages/appBar/components/AppBar.styles.luau +16 -5
- package/out/ui/packages/assetField/components/AssetField.luau +12 -16
- package/out/ui/packages/autocomplete/components/Autocomplete.luau +8 -0
- package/out/ui/packages/avatar/components/Avatar.d.ts +2 -0
- package/out/ui/packages/avatar/components/Avatar.luau +27 -26
- package/out/ui/packages/avatar/components/Avatar.styles.d.ts +2 -0
- package/out/ui/packages/avatar/components/Avatar.styles.luau +5 -1
- package/out/ui/packages/backdrop/components/Backdrop.d.ts +10 -0
- package/out/ui/packages/backdrop/components/Backdrop.luau +51 -0
- package/out/ui/packages/backdrop/components/Backdrop.styles.d.ts +4 -0
- package/out/ui/packages/backdrop/components/Backdrop.styles.luau +24 -0
- package/out/ui/packages/backdrop/index.d.ts +2 -0
- package/out/ui/packages/backdrop/init.luau +5 -0
- package/out/ui/packages/badge/components/Badge.d.ts +3 -0
- package/out/ui/packages/badge/components/Badge.luau +32 -24
- package/out/ui/packages/badge/components/Badge.styles.d.ts +5 -1
- package/out/ui/packages/badge/components/Badge.styles.luau +20 -8
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.d.ts +1 -0
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.luau +20 -18
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.d.ts +3 -1
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +6 -2
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.d.ts +1 -0
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +67 -40
- package/out/ui/packages/breadcrumbs/components/breadcrumbItems.d.ts +9 -0
- package/out/ui/packages/breadcrumbs/components/breadcrumbItems.luau +68 -0
- package/out/ui/packages/breadcrumbs/index.d.ts +1 -0
- package/out/ui/packages/breadcrumbs/init.luau +3 -0
- package/out/ui/packages/brickColorPicker/components/BrickColorPicker.luau +12 -16
- package/out/ui/packages/button/components/Button.luau +28 -22
- package/out/ui/packages/card/components/Card.d.ts +3 -1
- package/out/ui/packages/card/components/Card.luau +10 -0
- package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +75 -53
- package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +26 -9
- package/out/ui/packages/checkbox/components/Checkbox.luau +16 -16
- package/out/ui/packages/checkbox/components/checkboxLook.d.ts +1 -1
- package/out/ui/packages/chip/components/Chip.d.ts +6 -1
- package/out/ui/packages/chip/components/Chip.luau +61 -17
- package/out/ui/packages/chip/components/Chip.styles.d.ts +6 -0
- package/out/ui/packages/chip/components/Chip.styles.luau +54 -9
- package/out/ui/packages/circularProgress/components/CircularProgress.luau +29 -18
- package/out/ui/packages/colorPicker/components/ColorPicker.luau +16 -20
- package/out/ui/packages/colorPicker/components/ColorPicker.styles.luau +34 -20
- package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +34 -35
- package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +65 -62
- package/out/ui/packages/dialog/components/Dialog.d.ts +3 -2
- package/out/ui/packages/dialog/components/Dialog.luau +41 -21
- package/out/ui/packages/divider/components/Divider.d.ts +1 -0
- package/out/ui/packages/divider/components/Divider.luau +52 -17
- package/out/ui/packages/divider/components/Divider.styles.luau +32 -0
- package/out/ui/packages/divider/components/dividerLabel.d.ts +1 -0
- package/out/ui/packages/divider/components/dividerLabel.luau +10 -0
- package/out/ui/packages/drawer/components/Drawer.d.ts +3 -1
- package/out/ui/packages/drawer/components/Drawer.luau +71 -37
- package/out/ui/packages/drawer/components/Drawer.styles.d.ts +3 -1
- package/out/ui/packages/drawer/components/Drawer.styles.luau +3 -2
- package/out/ui/packages/fab/components/Fab.d.ts +3 -0
- package/out/ui/packages/fab/components/Fab.luau +79 -37
- package/out/ui/packages/fab/components/Fab.styles.d.ts +3 -0
- package/out/ui/packages/fab/components/Fab.styles.luau +39 -3
- package/out/ui/packages/fab/components/fabSize.d.ts +1 -0
- package/out/ui/packages/fab/components/fabSize.luau +4 -0
- package/out/ui/packages/fab/index.d.ts +1 -1
- package/out/ui/packages/fab/init.luau +1 -0
- package/out/ui/packages/fontEditor/components/FontEditor.luau +12 -16
- package/out/ui/packages/formText/components/FormHelperText.d.ts +8 -0
- package/out/ui/packages/formText/components/FormHelperText.luau +40 -0
- package/out/ui/packages/formText/components/FormLabel.d.ts +9 -0
- package/out/ui/packages/formText/components/FormLabel.luau +42 -0
- package/out/ui/packages/formText/components/FormText.styles.d.ts +5 -0
- package/out/ui/packages/formText/components/FormText.styles.luau +33 -0
- package/out/ui/packages/formText/index.d.ts +4 -0
- package/out/ui/packages/formText/init.luau +6 -0
- package/out/ui/packages/gradientEditor/components/GradientEditor.luau +56 -42
- package/out/ui/packages/gradientEditor/components/GradientEditor.styles.luau +37 -4
- package/out/ui/packages/host/components/SxHost.d.ts +18 -0
- package/out/ui/packages/host/components/SxHost.luau +202 -0
- package/out/ui/packages/host/hostPaint.d.ts +11 -0
- package/out/ui/packages/host/hostPaint.luau +33 -0
- package/out/ui/packages/host/hostRules.d.ts +15 -0
- package/out/ui/packages/host/hostRules.luau +92 -0
- package/out/ui/packages/host/index.d.ts +3 -0
- package/out/ui/packages/host/init.luau +13 -0
- package/out/ui/packages/icon/components/Icon.luau +9 -16
- package/out/ui/packages/iconButton/components/IconButton.luau +22 -17
- package/out/ui/packages/iconButton/components/IconButton.styles.luau +3 -0
- package/out/ui/packages/imageList/components/ImageList.d.ts +14 -0
- package/out/ui/packages/imageList/components/ImageList.luau +93 -0
- package/out/ui/packages/imageList/components/ImageList.styles.d.ts +6 -0
- package/out/ui/packages/imageList/components/ImageList.styles.luau +73 -0
- package/out/ui/packages/imageList/components/imageListLayout.d.ts +4 -0
- package/out/ui/packages/imageList/components/imageListLayout.luau +31 -0
- package/out/ui/packages/imageList/index.d.ts +2 -0
- package/out/ui/packages/imageList/init.luau +5 -0
- package/out/ui/packages/index.d.ts +8 -0
- package/out/ui/packages/init.luau +24 -0
- package/out/ui/packages/input/components/Input.d.ts +1 -0
- package/out/ui/packages/input/components/Input.luau +22 -19
- package/out/ui/packages/layout/components/Box.d.ts +11 -0
- package/out/ui/packages/layout/components/Box.luau +40 -0
- package/out/ui/packages/layout/components/Box.styles.d.ts +7 -0
- package/out/ui/packages/layout/components/Box.styles.luau +34 -0
- package/out/ui/packages/layout/components/Container.d.ts +10 -0
- package/out/ui/packages/layout/components/Container.luau +45 -0
- package/out/ui/packages/layout/components/Container.styles.d.ts +6 -0
- package/out/ui/packages/layout/components/Container.styles.luau +41 -0
- package/out/ui/packages/layout/components/FlexItem.d.ts +12 -0
- package/out/ui/packages/layout/components/FlexItem.luau +40 -0
- package/out/ui/packages/layout/components/FlexItem.styles.d.ts +8 -0
- package/out/ui/packages/layout/components/FlexItem.styles.luau +66 -0
- package/out/ui/packages/layout/components/Grid.d.ts +5 -1
- package/out/ui/packages/layout/components/Grid.luau +41 -19
- package/out/ui/packages/layout/components/List.luau +9 -16
- package/out/ui/packages/layout/components/Stack.d.ts +14 -0
- package/out/ui/packages/layout/components/Stack.luau +44 -0
- package/out/ui/packages/layout/components/Stack.styles.d.ts +10 -0
- package/out/ui/packages/layout/components/Stack.styles.luau +101 -0
- package/out/ui/packages/layout/components/boxPad.d.ts +14 -0
- package/out/ui/packages/layout/components/boxPad.luau +59 -0
- package/out/ui/packages/layout/components/containerWidth.d.ts +2 -0
- package/out/ui/packages/layout/components/containerWidth.luau +17 -0
- package/out/ui/packages/layout/components/flexItemMode.d.ts +6 -0
- package/out/ui/packages/layout/components/flexItemMode.luau +36 -0
- package/out/ui/packages/layout/components/gridProps.d.ts +3 -0
- package/out/ui/packages/layout/components/gridProps.luau +20 -0
- package/out/ui/packages/layout/components/stackAlign.d.ts +10 -0
- package/out/ui/packages/layout/components/stackAlign.luau +43 -0
- package/out/ui/packages/layout/index.d.ts +14 -0
- package/out/ui/packages/layout/init.luau +5 -0
- package/out/ui/packages/link/components/Link.d.ts +11 -0
- package/out/ui/packages/link/components/Link.luau +80 -0
- package/out/ui/packages/link/components/Link.styles.d.ts +8 -0
- package/out/ui/packages/link/components/Link.styles.luau +59 -0
- package/out/ui/packages/link/index.d.ts +3 -0
- package/out/ui/packages/link/init.luau +5 -0
- package/out/ui/packages/listItem/components/ListItem.d.ts +4 -1
- package/out/ui/packages/listItem/components/ListItem.luau +44 -4
- package/out/ui/packages/listItem/components/ListItem.styles.d.ts +1 -0
- package/out/ui/packages/listItem/components/ListItem.styles.luau +16 -5
- package/out/ui/packages/loadingStroke/components/LoadingStroke.d.ts +7 -1
- package/out/ui/packages/loadingStroke/components/LoadingStroke.luau +23 -19
- package/out/ui/packages/loadingStroke/components/loadingStrokeSx.d.ts +11 -0
- package/out/ui/packages/loadingStroke/components/loadingStrokeSx.luau +2 -0
- package/out/ui/packages/markdown/components/Markdown.d.ts +6 -0
- package/out/ui/packages/markdown/components/Markdown.luau +221 -0
- package/out/ui/packages/markdown/components/Markdown.styles.d.ts +2 -0
- package/out/ui/packages/markdown/components/Markdown.styles.luau +101 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.d.ts +16 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.luau +315 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.d.ts +6 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.luau +132 -0
- package/out/ui/packages/markdown/htmlToMarkdown.d.ts +2 -0
- package/out/ui/packages/markdown/htmlToMarkdown.luau +350 -0
- package/out/ui/packages/markdown/index.d.ts +8 -0
- package/out/ui/packages/markdown/init.luau +11 -0
- package/out/ui/packages/markdown/parseMarkdown.d.ts +42 -0
- package/out/ui/packages/markdown/parseMarkdown.luau +459 -0
- package/out/ui/packages/menu/components/Menu.d.ts +7 -1
- package/out/ui/packages/menu/components/Menu.luau +68 -26
- package/out/ui/packages/menu/components/Menu.styles.luau +5 -1
- package/out/ui/packages/modal/components/Modal.d.ts +2 -1
- package/out/ui/packages/modal/components/Modal.luau +79 -37
- package/out/ui/packages/motion/index.d.ts +1 -1
- package/out/ui/packages/motion/init.luau +1 -0
- package/out/ui/packages/motion/unit.d.ts +5 -0
- package/out/ui/packages/motion/unit.luau +23 -0
- package/out/ui/packages/numberInput/components/NumberInput.d.ts +2 -0
- package/out/ui/packages/numberInput/components/NumberInput.luau +16 -3
- package/out/ui/packages/numberInput/components/numberValue.d.ts +1 -0
- package/out/ui/packages/numberInput/components/numberValue.luau +45 -0
- package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.luau +12 -16
- package/out/ui/packages/pagination/components/Pagination.d.ts +6 -1
- package/out/ui/packages/pagination/components/Pagination.luau +62 -38
- package/out/ui/packages/pagination/components/Pagination.styles.d.ts +6 -1
- package/out/ui/packages/pagination/components/Pagination.styles.luau +36 -4
- package/out/ui/packages/pagination/components/pageRange.d.ts +2 -1
- package/out/ui/packages/pagination/components/pageRange.luau +91 -8
- package/out/ui/packages/pagination/index.d.ts +1 -0
- package/out/ui/packages/pagination/init.luau +1 -0
- package/out/ui/packages/paper/components/Paper.d.ts +4 -2
- package/out/ui/packages/paper/components/Paper.luau +31 -9
- package/out/ui/packages/paper/components/Paper.styles.d.ts +1 -1
- package/out/ui/packages/paper/components/Paper.styles.luau +6 -0
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.luau +63 -38
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.styles.luau +21 -7
- package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.d.ts +2 -0
- package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.luau +14 -0
- package/out/ui/packages/popup/components/Popup.d.ts +2 -1
- package/out/ui/packages/popup/components/Popup.luau +35 -18
- package/out/ui/packages/popup/index.d.ts +1 -0
- package/out/ui/packages/popup/init.luau +1 -0
- package/out/ui/packages/preloader/components/Preloader.luau +9 -16
- package/out/ui/packages/progressBar/components/ProgressBar.luau +12 -16
- package/out/ui/packages/radioGroup/components/RadioGroup.d.ts +1 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.luau +16 -18
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.d.ts +1 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.luau +4 -1
- package/out/ui/packages/rating/components/Rating.d.ts +11 -0
- package/out/ui/packages/rating/components/Rating.luau +97 -0
- package/out/ui/packages/rating/components/Rating.styles.d.ts +6 -0
- package/out/ui/packages/rating/components/Rating.styles.luau +44 -0
- package/out/ui/packages/rating/index.d.ts +2 -0
- package/out/ui/packages/rating/init.luau +5 -0
- package/out/ui/packages/rayEditor/components/RayEditor.luau +12 -16
- package/out/ui/packages/rectEditor/components/RectEditor.luau +86 -43
- package/out/ui/packages/rectEditor/components/RectEditor.styles.luau +30 -7
- package/out/ui/packages/select/components/Select.d.ts +5 -0
- package/out/ui/packages/select/components/Select.luau +61 -77
- package/out/ui/packages/select/components/Select.styles.luau +1 -1
- package/out/ui/packages/shadow/components/Shadow.d.ts +2 -1
- package/out/ui/packages/shadow/components/Shadow.luau +39 -17
- package/out/ui/packages/shadow/components/Shadow.styles.luau +7 -2
- package/out/ui/packages/sidebar/components/Sidebar.luau +9 -16
- package/out/ui/packages/skeleton/components/Skeleton.luau +22 -30
- package/out/ui/packages/skeleton/components/Skeleton.styles.luau +7 -2
- package/out/ui/packages/skeleton/components/skeletonMotion.luau +1 -1
- package/out/ui/packages/skeleton/components/skeletonTone.d.ts +20 -0
- package/out/ui/packages/skeleton/components/skeletonTone.luau +14 -0
- package/out/ui/packages/slider/components/Slider.d.ts +3 -0
- package/out/ui/packages/slider/components/Slider.luau +47 -19
- package/out/ui/packages/slider/components/Slider.styles.d.ts +2 -0
- package/out/ui/packages/slider/components/Slider.styles.luau +14 -1
- package/out/ui/packages/slider/components/sliderMarks.d.ts +1 -0
- package/out/ui/packages/slider/components/sliderMarks.luau +37 -0
- package/out/ui/packages/snackbar/components/Snackbar.d.ts +2 -0
- package/out/ui/packages/snackbar/components/Snackbar.luau +5 -0
- package/out/ui/packages/snackbar/components/snackbarAction.d.ts +1 -0
- package/out/ui/packages/snackbar/components/snackbarAction.luau +10 -0
- package/out/ui/packages/speedDial/components/SpeedDial.d.ts +19 -0
- package/out/ui/packages/speedDial/components/SpeedDial.luau +97 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.d.ts +5 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +31 -0
- package/out/ui/packages/speedDial/index.d.ts +3 -0
- package/out/ui/packages/speedDial/init.luau +5 -0
- package/out/ui/packages/splitPane/components/SplitPane.luau +13 -17
- package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
- package/out/ui/packages/stateMatrix.d.ts +2 -0
- package/out/ui/packages/stateMatrix.luau +872 -881
- package/out/ui/packages/stepper/components/Stepper.d.ts +1 -0
- package/out/ui/packages/stepper/components/Stepper.luau +16 -17
- package/out/ui/packages/stepper/components/Stepper.styles.d.ts +3 -1
- package/out/ui/packages/stepper/components/Stepper.styles.luau +6 -2
- package/out/ui/packages/switch/components/Switch.d.ts +2 -0
- package/out/ui/packages/switch/components/Switch.luau +21 -16
- package/out/ui/packages/switch/components/Switch.styles.d.ts +2 -0
- package/out/ui/packages/switch/components/Switch.styles.luau +6 -1
- package/out/ui/packages/switch/components/switchLook.d.ts +1 -1
- package/out/ui/packages/table/components/Table.d.ts +1 -0
- package/out/ui/packages/table/components/Table.luau +15 -19
- package/out/ui/packages/table/components/Table.styles.d.ts +3 -1
- package/out/ui/packages/table/components/Table.styles.luau +10 -6
- package/out/ui/packages/tabs/components/Tabs.d.ts +3 -0
- package/out/ui/packages/tabs/components/Tabs.luau +24 -19
- package/out/ui/packages/tabs/components/Tabs.styles.d.ts +5 -1
- package/out/ui/packages/tabs/components/Tabs.styles.luau +26 -10
- package/out/ui/packages/tabs/components/tabsOrientation.d.ts +2 -0
- package/out/ui/packages/tabs/components/tabsOrientation.luau +7 -0
- package/out/ui/packages/tabs/index.d.ts +1 -0
- package/out/ui/packages/tabs/init.luau +1 -0
- package/out/ui/packages/toast/components/Toast.d.ts +2 -0
- package/out/ui/packages/toast/components/Toast.luau +41 -13
- package/out/ui/packages/toast/components/Toast.styles.luau +23 -5
- package/out/ui/packages/toggleButton/components/ToggleButton.d.ts +21 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +129 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.d.ts +9 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +69 -0
- package/out/ui/packages/toggleButton/index.d.ts +2 -0
- package/out/ui/packages/toggleButton/init.luau +7 -0
- package/out/ui/packages/tooltip/components/Tooltip.luau +9 -16
- package/out/ui/packages/treeView/components/TreeView.luau +9 -16
- package/out/ui/packages/typography/components/Typography.luau +13 -14
- package/out/ui/packages/udimEditor/components/UDimEditor.luau +12 -16
- package/out/ui/packages/vectorEditor/components/VectorEditor.luau +12 -16
- package/out/ui/packages/virtualList/components/EmptyListHint.d.ts +7 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.luau +43 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.styles.d.ts +5 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.styles.luau +26 -0
- package/out/ui/packages/virtualList/components/VirtualList.luau +9 -16
- package/out/ui/packages/virtualList/index.d.ts +2 -0
- package/out/ui/packages/virtualList/init.luau +1 -0
- package/package.json +2 -2
- package/out/ui/packages/select/components/selectMotion.d.ts +0 -2
- package/out/ui/packages/select/components/selectMotion.luau +0 -12
package/README.md
CHANGED
|
@@ -2,13 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
# uiblox-rbxts
|
|
4
4
|
|
|
5
|
+
> This package is a work in progress.
|
|
6
|
+
|
|
5
7
|
UI library and theming for roblox-ts projects.
|
|
6
8
|
|
|
9
|
+
## Background
|
|
10
|
+
|
|
11
|
+
Roblox has their own internal design system, coined "uiblox-web", that it uses for its new
|
|
12
|
+
web-facing products. This system offers reusable components, implemented in
|
|
13
|
+
React Typescript, that are derived from material UI (MUI). As well, it offers a
|
|
14
|
+
common theme/pallete for consistent UI/UX.
|
|
15
|
+
|
|
16
|
+
Anyone is able to view their design system as
|
|
17
|
+
[UIBlox-Web](https://uiblox.roblox.com). You can see that they leverage
|
|
18
|
+
[Storybook](https://storybook.js.org), a UI component explorer for frontend
|
|
19
|
+
developers, to render component previews.
|
|
20
|
+
|
|
21
|
+
Design systems all help engineers cut down on implementation time and ensure
|
|
22
|
+
consitent UX across products.
|
|
23
|
+
|
|
7
24
|
## Overview
|
|
8
25
|
|
|
9
|
-
|
|
26
|
+
So what is uiblox-rbxts? Simply put, its my stab at a design system that mimics
|
|
27
|
+
uiblox-web for games written using roblox-ts.
|
|
10
28
|
|
|
11
|
-
|
|
29
|
+
UIBlox-rbxts aims to provide extensible components that can be reusable by
|
|
30
|
+
anyone who installs this npm package. It also offers a theme and styling system
|
|
31
|
+
that aids UI/UX consistentency.
|
|
32
|
+
|
|
33
|
+
How does it do this? Well, there are two main exports from this package:
|
|
12
34
|
|
|
13
35
|
- @rbxts/uiblox -> theme
|
|
14
36
|
- An extensible Theme type + default Dark (default) and Light themes
|
|
@@ -24,47 +46,11 @@ Main exports from `@rbxts/uiblox`:
|
|
|
24
46
|
|
|
25
47
|
### Installation
|
|
26
48
|
|
|
27
|
-
|
|
28
|
-
npm install @rbxts/uiblox
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Quickstart
|
|
49
|
+
Install the package to get started.
|
|
32
50
|
|
|
33
|
-
|
|
34
|
-
2. Build styles with `makeStyles` / `createStyles` (or `componentStyles`) and spread them onto Instances.
|
|
35
|
-
3. For hover/press/focus/disabled (and list `_first` / `_last`), put `_hover`-style keys on the style table and call `resolveStyle(style, state)` before spreading.
|
|
36
|
-
4. Use packaged components from `@rbxts/uiblox` (`Button`, `Input`, `Select`, …).
|
|
37
|
-
5. Preview components in [Storyblox](https://github.com/bjlarouche/storyblox) with `*.stories` modules.
|
|
51
|
+
`npm install @rbxts/uiblox`
|
|
38
52
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
```tsx
|
|
42
|
-
import React from "@rbxts/react";
|
|
43
|
-
import { Button, DarkTheme, ThemeProvider } from "@rbxts/uiblox";
|
|
44
|
-
|
|
45
|
-
export function App() {
|
|
46
|
-
return (
|
|
47
|
-
<ThemeProvider theme={DarkTheme}>
|
|
48
|
-
<Button text="Continue" onLeftClick={() => {}} />
|
|
49
|
-
</ThemeProvider>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Parity checklist
|
|
55
|
-
|
|
56
|
-
Capability parity, not pixel parity. For each public component, expect:
|
|
57
|
-
|
|
58
|
-
- [ ] Typed controlled props where interaction needs state
|
|
59
|
-
- [ ] Theme tokens (light/dark) via `ThemeProvider`
|
|
60
|
-
- [ ] Style slots / variants through the styling helpers
|
|
61
|
-
- [ ] Disabled / loading / error when the control type warrants it
|
|
62
|
-
- [ ] Mouse, touch, and gamepad-friendly activation where interactive
|
|
63
|
-
- [ ] Cleanup and focused unit checks in-repo
|
|
64
|
-
- [ ] `stateMatrix` rows for visual capture planning
|
|
65
|
-
- [ ] A Storyblox story (dev fixtures OK)
|
|
66
|
-
|
|
67
|
-
Skipped on purpose: browser-only addons (MDX, iframes, hosted visual-review clouds).
|
|
53
|
+
Spacing, density, and sx notes are in [docs/STYLING.md](docs/STYLING.md).
|
|
68
54
|
|
|
69
55
|
## Example
|
|
70
56
|
|
|
@@ -211,74 +197,6 @@ const useMyComponentStyles = makeStyles<MyComponentProps>((theme: Theme, props:
|
|
|
211
197
|
export default useMyComponentStyles;
|
|
212
198
|
```
|
|
213
199
|
|
|
214
|
-
### Style precedence
|
|
215
|
-
|
|
216
|
-
Components spread their own styles first, then `className`, then the props that
|
|
217
|
-
carry state. Later always wins:
|
|
218
|
-
|
|
219
|
-
1. Component styles from the theme
|
|
220
|
-
2. `className` (merge several with `cx(a, condition && b)`; later args win, falsy
|
|
221
|
-
args are skipped)
|
|
222
|
-
3. State props the component owns: `Active`, `Selectable`, `Text`, and the
|
|
223
|
-
value-driven sizes/positions of Slider, SplitPane, and so on
|
|
224
|
-
|
|
225
|
-
So `className` can restyle anything except a control's state. Pass `disabled`
|
|
226
|
-
instead of overriding `Active`.
|
|
227
|
-
|
|
228
|
-
### Controls
|
|
229
|
-
|
|
230
|
-
Inputs are controlled: `{ value, onChange, disabled? }`. They call `onChange`
|
|
231
|
-
only when the value actually changes, and never while disabled.
|
|
232
|
-
|
|
233
|
-
| Component | Value | Notes |
|
|
234
|
-
| --- | --- | --- |
|
|
235
|
-
| Checkbox | `boolean` | `mixed` shows indeterminate; activating commits `true` |
|
|
236
|
-
| Switch | `boolean` | |
|
|
237
|
-
| RadioGroup / Select / Tabs | `T` from `options: { label, value: T, disabled? }[]` | compared by identity; disabled options are skipped |
|
|
238
|
-
| NumberInput | `number` | commits on focus lost or Enter; clamps to `min`/`max`, snaps to `step` |
|
|
239
|
-
| Slider | `number` | `onChange` while dragging, `onCommit` on release |
|
|
240
|
-
| SplitPane | first pane size (px) | display clamps to `min`/`max`; Escape cancels a drag |
|
|
241
|
-
| Input | `text` | `onInput` while typing, `onTextChanged` on commit |
|
|
242
|
-
|
|
243
|
-
Select and Tooltip render through `Popup`, which portals into the nearest
|
|
244
|
-
`LayerCollector` so clipping parents do not cut them off. The popup follows its
|
|
245
|
-
anchor when that anchor moves or resizes, and Select closes if the anchor leaves
|
|
246
|
-
the layer. Select handles Up, Down, Enter, and Escape while it is open or
|
|
247
|
-
selected, including when the pointer is not over it.
|
|
248
|
-
|
|
249
|
-
### Loading
|
|
250
|
-
|
|
251
|
-
`Skeleton` covers a block that is still loading. `variant` is `text`,
|
|
252
|
-
`rectangular`, `rounded`, or `circular`. `width` and `height` are pixels.
|
|
253
|
-
`lines` and `gap` stack text rows. `SkeletonText` is the text variant.
|
|
254
|
-
`animation` is `pulse`, `shimmer`, or `false`. `reducedMotion` holds the block
|
|
255
|
-
still. A later theme preference can set that prop for you.
|
|
256
|
-
|
|
257
|
-
`CircularProgress` spins while `value` is omitted. A `value` from 0 to 1 draws
|
|
258
|
-
an arc and stops the spin. `size`, `thickness`, and `color` restyle the ring.
|
|
259
|
-
`LinearProgress` is the existing `ProgressBar`: pass `value` from 0 to 1 or
|
|
260
|
-
`progress` from 0 to 100. `indeterminate` slides the bar. `disabled` and
|
|
261
|
-
`reducedMotion` stop the motion and fade the fill.
|
|
262
|
-
|
|
263
|
-
`Button` and `IconButton` take `loading`. The control ignores clicks, hover,
|
|
264
|
-
and focus while loading, and its size stays put. `loadingLabel` replaces the
|
|
265
|
-
caption. `loadingPosition` is `start`, `center`, or `end`. `reducedMotion`
|
|
266
|
-
keeps the spinner still.
|
|
267
|
-
|
|
268
|
-
### State captures
|
|
269
|
-
|
|
270
|
-
`stateMatrix` is the gallery list for Storyblox. Each row is one shot: `theme`
|
|
271
|
-
(`Dark` or `Light`), `width`, and `pointer` (`rest`, `hover`, `press`, or
|
|
272
|
-
`focus`). Rows are built in small helper functions and concatenated so the
|
|
273
|
-
compiled Luau chunk stays under the 200-local register limit. `open` means the
|
|
274
|
-
Select list is showing. `options` and `disabledOption` build RadioGroup, Select,
|
|
275
|
-
and Tabs. `selected` and `filter` are TreeView. `value`, `text`, `disabled`,
|
|
276
|
-
`loading`, `mixed`, `hasError`, and `placeholder` are that control's props.
|
|
277
|
-
`variant`, `animation` (`pulse`, `shimmer`, or `false`), `reducedMotion`, and
|
|
278
|
-
`indeterminate` cover skeleton and progress shots. Those shots stay still when
|
|
279
|
-
`animation` is `false` or `reducedMotion` is set. Hover, press, and focus rows
|
|
280
|
-
are only there when the control actually changes.
|
|
281
|
-
|
|
282
200
|
### Client
|
|
283
201
|
|
|
284
202
|
Some sample logic for mounting app when player spawns (on client).
|
package/out/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { breakpointName, orientationName, resolveResponsive } from "./breakpoints";
|
|
2
2
|
export { BreakpointName, OrientationName, Responsive } from "./breakpoints";
|
|
3
3
|
export { useBreakpoints } from "./useBreakpoints";
|
|
4
|
+
export { clearViewportObservers, observeViewport } from "./viewportObserver";
|
|
4
5
|
export { useReducedMotion } from "./useReducedMotion";
|
package/out/hooks/init.luau
CHANGED
|
@@ -6,5 +6,8 @@ exports.breakpointName = _breakpoints.breakpointName
|
|
|
6
6
|
exports.orientationName = _breakpoints.orientationName
|
|
7
7
|
exports.resolveResponsive = _breakpoints.resolveResponsive
|
|
8
8
|
exports.useBreakpoints = TS.import(script, script, "useBreakpoints").useBreakpoints
|
|
9
|
+
local _viewportObserver = TS.import(script, script, "viewportObserver")
|
|
10
|
+
exports.clearViewportObservers = _viewportObserver.clearViewportObservers
|
|
11
|
+
exports.observeViewport = _viewportObserver.observeViewport
|
|
9
12
|
exports.useReducedMotion = TS.import(script, script, "useReducedMotion").useReducedMotion
|
|
10
13
|
return exports
|
|
@@ -6,6 +6,7 @@ local useState = _react.useState
|
|
|
6
6
|
local _breakpoints = TS.import(script, script.Parent, "breakpoints")
|
|
7
7
|
local breakpointName = _breakpoints.breakpointName
|
|
8
8
|
local orientationName = _breakpoints.orientationName
|
|
9
|
+
local observeViewport = TS.import(script, script.Parent, "viewportObserver").observeViewport
|
|
9
10
|
local function useBreakpoints(host)
|
|
10
11
|
local size, setSize = useState({
|
|
11
12
|
width = 0,
|
|
@@ -15,17 +16,7 @@ local function useBreakpoints(host)
|
|
|
15
16
|
if host == nil then
|
|
16
17
|
return nil
|
|
17
18
|
end
|
|
18
|
-
|
|
19
|
-
return setSize({
|
|
20
|
-
width = host.AbsoluteSize.X,
|
|
21
|
-
height = host.AbsoluteSize.Y,
|
|
22
|
-
})
|
|
23
|
-
end
|
|
24
|
-
read()
|
|
25
|
-
local connection = host:GetPropertyChangedSignal("AbsoluteSize"):Connect(read)
|
|
26
|
-
return function()
|
|
27
|
-
return connection:Disconnect()
|
|
28
|
-
end
|
|
19
|
+
return observeViewport(host, setSize)
|
|
29
20
|
end, { host })
|
|
30
21
|
return {
|
|
31
22
|
width = size.width,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Size = {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
};
|
|
5
|
+
type Listener = (size: Size) => void;
|
|
6
|
+
/** One AbsoluteSize connection per host; shared by all subscribers. */
|
|
7
|
+
export declare function observeViewport(host: GuiObject, listener: Listener): () => void;
|
|
8
|
+
/** Test helper — drop all host observers. */
|
|
9
|
+
export declare function clearViewportObservers(): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local hosts = {}
|
|
3
|
+
--* One AbsoluteSize connection per host; shared by all subscribers.
|
|
4
|
+
local function observeViewport(host, listener)
|
|
5
|
+
local _host = host
|
|
6
|
+
local entry = hosts[_host]
|
|
7
|
+
if entry == nil then
|
|
8
|
+
entry = {
|
|
9
|
+
listeners = {},
|
|
10
|
+
size = {
|
|
11
|
+
width = host.AbsoluteSize.X,
|
|
12
|
+
height = host.AbsoluteSize.Y,
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
local _host_1 = host
|
|
16
|
+
local _entry = entry
|
|
17
|
+
hosts[_host_1] = _entry
|
|
18
|
+
local read = function()
|
|
19
|
+
local _host_2 = host
|
|
20
|
+
local current = hosts[_host_2]
|
|
21
|
+
if current == nil then
|
|
22
|
+
return nil
|
|
23
|
+
end
|
|
24
|
+
current.size = {
|
|
25
|
+
width = host.AbsoluteSize.X,
|
|
26
|
+
height = host.AbsoluteSize.Y,
|
|
27
|
+
}
|
|
28
|
+
for _, cb in current.listeners do
|
|
29
|
+
cb(current.size)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
read()
|
|
33
|
+
entry.connection = host:GetPropertyChangedSignal("AbsoluteSize"):Connect(read)
|
|
34
|
+
end
|
|
35
|
+
local _listeners = entry.listeners
|
|
36
|
+
local _listener = listener
|
|
37
|
+
table.insert(_listeners, _listener)
|
|
38
|
+
listener(entry.size)
|
|
39
|
+
return function()
|
|
40
|
+
local _host_1 = host
|
|
41
|
+
local current = hosts[_host_1]
|
|
42
|
+
if current == nil then
|
|
43
|
+
return nil
|
|
44
|
+
end
|
|
45
|
+
local _listeners_1 = current.listeners
|
|
46
|
+
local _listener_1 = listener
|
|
47
|
+
local index = (table.find(_listeners_1, _listener_1) or 0) - 1
|
|
48
|
+
if index >= 0 then
|
|
49
|
+
table.remove(current.listeners, index + 1)
|
|
50
|
+
end
|
|
51
|
+
if #current.listeners == 0 then
|
|
52
|
+
local _result = current.connection
|
|
53
|
+
if _result ~= nil then
|
|
54
|
+
_result:Disconnect()
|
|
55
|
+
end
|
|
56
|
+
local _host_2 = host
|
|
57
|
+
hosts[_host_2] = nil
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
--* Test helper — drop all host observers.
|
|
62
|
+
local function clearViewportObservers()
|
|
63
|
+
for _, entry in hosts do
|
|
64
|
+
local _result = entry.connection
|
|
65
|
+
if _result ~= nil then
|
|
66
|
+
_result:Disconnect()
|
|
67
|
+
end
|
|
68
|
+
table.clear(entry.listeners)
|
|
69
|
+
end
|
|
70
|
+
table.clear(hosts)
|
|
71
|
+
end
|
|
72
|
+
return {
|
|
73
|
+
observeViewport = observeViewport,
|
|
74
|
+
clearViewportObservers = clearViewportObservers,
|
|
75
|
+
}
|
|
@@ -21,6 +21,21 @@ interface Theme {
|
|
|
21
21
|
styleOverrides?: {
|
|
22
22
|
[slot: string]: object;
|
|
23
23
|
};
|
|
24
|
+
variants?: {
|
|
25
|
+
[prop: string]: {
|
|
26
|
+
[value: string]: {
|
|
27
|
+
[slot: string]: object;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
compoundVariants?: Array<{
|
|
32
|
+
when: {
|
|
33
|
+
[prop: string]: unknown;
|
|
34
|
+
};
|
|
35
|
+
styles: {
|
|
36
|
+
[slot: string]: object;
|
|
37
|
+
};
|
|
38
|
+
}>;
|
|
24
39
|
};
|
|
25
40
|
};
|
|
26
41
|
}
|
|
@@ -4,6 +4,7 @@ local _componentTheme = TS.import(script, script.Parent, "componentTheme")
|
|
|
4
4
|
local propsWithDefaults = _componentTheme.propsWithDefaults
|
|
5
5
|
local slotsWithOverrides = _componentTheme.slotsWithOverrides
|
|
6
6
|
local makeStyles = TS.import(script, script.Parent, "makeStyles").default
|
|
7
|
+
local applyVariants = TS.import(script, script.Parent, "variants").applyVariants
|
|
7
8
|
local componentStyles = function(name, factory)
|
|
8
9
|
return makeStyles((function(theme, props)
|
|
9
10
|
local _spec = theme.components
|
|
@@ -17,12 +18,53 @@ local componentStyles = function(name, factory)
|
|
|
17
18
|
end
|
|
18
19
|
local merged = propsWithDefaults(_result, props)
|
|
19
20
|
local paint = factory
|
|
20
|
-
local
|
|
21
|
+
local slots = paint(theme, merged)
|
|
21
22
|
local _result_1 = spec
|
|
22
23
|
if _result_1 ~= nil then
|
|
23
|
-
_result_1 = _result_1.
|
|
24
|
+
_result_1 = _result_1.variants
|
|
24
25
|
end
|
|
25
|
-
|
|
26
|
+
local _condition = _result_1 ~= nil
|
|
27
|
+
if not _condition then
|
|
28
|
+
local _result_2 = spec
|
|
29
|
+
if _result_2 ~= nil then
|
|
30
|
+
_result_2 = _result_2.compoundVariants
|
|
31
|
+
if _result_2 ~= nil then
|
|
32
|
+
_result_2 = #_result_2
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
local _condition_1 = _result_2
|
|
36
|
+
if _condition_1 == nil then
|
|
37
|
+
_condition_1 = 0
|
|
38
|
+
end
|
|
39
|
+
_condition = _condition_1 > 0
|
|
40
|
+
end
|
|
41
|
+
if _condition then
|
|
42
|
+
local _exp = slots
|
|
43
|
+
local _exp_1 = merged
|
|
44
|
+
local _result_2 = spec
|
|
45
|
+
if _result_2 ~= nil then
|
|
46
|
+
_result_2 = _result_2.variants
|
|
47
|
+
end
|
|
48
|
+
local _condition_1 = _result_2
|
|
49
|
+
if _condition_1 == nil then
|
|
50
|
+
_condition_1 = {}
|
|
51
|
+
end
|
|
52
|
+
local _result_3 = spec
|
|
53
|
+
if _result_3 ~= nil then
|
|
54
|
+
_result_3 = _result_3.compoundVariants
|
|
55
|
+
end
|
|
56
|
+
local _condition_2 = _result_3
|
|
57
|
+
if _condition_2 == nil then
|
|
58
|
+
_condition_2 = {}
|
|
59
|
+
end
|
|
60
|
+
slots = applyVariants(_exp, _exp_1, _condition_1, _condition_2)
|
|
61
|
+
end
|
|
62
|
+
local _exp = slots
|
|
63
|
+
local _result_2 = spec
|
|
64
|
+
if _result_2 ~= nil then
|
|
65
|
+
_result_2 = _result_2.styleOverrides
|
|
66
|
+
end
|
|
67
|
+
return slotsWithOverrides(_exp, _result_2)
|
|
26
68
|
end))
|
|
27
69
|
end
|
|
28
70
|
local default = componentStyles
|
|
@@ -5,6 +5,21 @@ export interface ComponentSpec {
|
|
|
5
5
|
styleOverrides?: {
|
|
6
6
|
[slot: string]: object;
|
|
7
7
|
};
|
|
8
|
+
variants?: {
|
|
9
|
+
[prop: string]: {
|
|
10
|
+
[value: string]: {
|
|
11
|
+
[slot: string]: object;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
compoundVariants?: Array<{
|
|
16
|
+
when: {
|
|
17
|
+
[prop: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
styles: {
|
|
20
|
+
[slot: string]: object;
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
8
23
|
}
|
|
9
24
|
export declare function propsWithDefaults(defaults: {
|
|
10
25
|
[key: string]: unknown;
|
|
@@ -4,4 +4,6 @@ export { default as classNames, cx } from "./classNames";
|
|
|
4
4
|
export { applyVariants, CompoundVariant } from "./variants";
|
|
5
5
|
export { default as componentStyles } from "./componentStyles";
|
|
6
6
|
export { resolveResponsive, Responsive } from "../../../hooks/breakpoints";
|
|
7
|
+
export { clearStyleCaches, createStyleCache, styleDepsKey } from "./styleCache";
|
|
8
|
+
export { resolveSx, resolvePaletteToken, PaletteToken, ResolvedSx, SxColor, SxInput } from "./resolveSx";
|
|
7
9
|
export { interactionStyle, InteractionSlots, InteractionState, resolveStyle, StyleSelectorKey, StyleState, StyleWithSelectors, } from "./resolveStyle";
|
|
@@ -9,6 +9,13 @@ exports.cx = _classNames.cx
|
|
|
9
9
|
exports.applyVariants = TS.import(script, script, "variants").applyVariants
|
|
10
10
|
exports.componentStyles = TS.import(script, script, "componentStyles").default
|
|
11
11
|
exports.resolveResponsive = TS.import(script, script.Parent.Parent.Parent, "hooks", "breakpoints").resolveResponsive
|
|
12
|
+
local _styleCache = TS.import(script, script, "styleCache")
|
|
13
|
+
exports.clearStyleCaches = _styleCache.clearStyleCaches
|
|
14
|
+
exports.createStyleCache = _styleCache.createStyleCache
|
|
15
|
+
exports.styleDepsKey = _styleCache.styleDepsKey
|
|
16
|
+
local _resolveSx = TS.import(script, script, "resolveSx")
|
|
17
|
+
exports.resolveSx = _resolveSx.resolveSx
|
|
18
|
+
exports.resolvePaletteToken = _resolveSx.resolvePaletteToken
|
|
12
19
|
local _resolveStyle = TS.import(script, script, "resolveStyle")
|
|
13
20
|
exports.interactionStyle = _resolveStyle.interactionStyle
|
|
14
21
|
exports.resolveStyle = _resolveStyle.resolveStyle
|
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
export type StyleSelectorKey = "_hover" | "_pressed" | "_focus" | "_disabled" | "_selected" | "_checked" | "_first" | "_last";
|
|
1
|
+
export type StyleSelectorKey = "_hover" | "_pressed" | "_focus" | "_focusVisible" | "_disabled" | "_selected" | "_checked" | "_loading" | "_first" | "_last" | "_odd" | "_even";
|
|
2
2
|
export interface StyleState {
|
|
3
3
|
hover?: boolean;
|
|
4
4
|
pressed?: boolean;
|
|
5
5
|
focused?: boolean;
|
|
6
|
+
focusVisible?: boolean;
|
|
6
7
|
disabled?: boolean;
|
|
7
8
|
selected?: boolean;
|
|
8
9
|
checked?: boolean;
|
|
10
|
+
loading?: boolean;
|
|
9
11
|
first?: boolean;
|
|
10
12
|
last?: boolean;
|
|
13
|
+
odd?: boolean;
|
|
14
|
+
even?: boolean;
|
|
11
15
|
}
|
|
12
16
|
export type StyleWithSelectors<T extends object = object> = T & {
|
|
13
17
|
_hover?: Partial<T>;
|
|
14
18
|
_pressed?: Partial<T>;
|
|
15
19
|
_focus?: Partial<T>;
|
|
20
|
+
_focusVisible?: Partial<T>;
|
|
16
21
|
_disabled?: Partial<T>;
|
|
17
22
|
_selected?: Partial<T>;
|
|
18
23
|
_checked?: Partial<T>;
|
|
24
|
+
_loading?: Partial<T>;
|
|
19
25
|
_first?: Partial<T>;
|
|
20
26
|
_last?: Partial<T>;
|
|
27
|
+
_odd?: Partial<T>;
|
|
28
|
+
_even?: Partial<T>;
|
|
21
29
|
};
|
|
22
30
|
export interface InteractionSlots<T extends object = object> {
|
|
23
31
|
hover?: T;
|
|
@@ -26,7 +34,7 @@ export interface InteractionSlots<T extends object = object> {
|
|
|
26
34
|
disabled?: T;
|
|
27
35
|
}
|
|
28
36
|
export type InteractionState = Pick<StyleState, "hover" | "pressed" | "focused" | "disabled">;
|
|
29
|
-
/** Peels
|
|
37
|
+
/** Peels selector keys and merges active ones onto the Instance props. */
|
|
30
38
|
export declare function resolveStyle<T extends object>(style: StyleWithSelectors<T>, state?: StyleState): T;
|
|
31
39
|
/** Prefer `resolveStyle` with `_hover` keys. Kept for existing call sites. */
|
|
32
40
|
export declare function interactionStyle<T extends object>(base: T, slots: InteractionSlots<T>, state: InteractionState): T;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
--* Order matters: later keys win. Structural
|
|
3
|
-
local SELECTORS = { { "_first", "first" }, { "_last", "last" }, { "_selected", "selected" }, { "_checked", "checked" }, { "_hover", "hover" }, { "_pressed", "pressed" }, { "_focus", "focused" }, { "_disabled", "disabled" } }
|
|
2
|
+
--* Order matters: later keys win. Structural → selection → interaction; `_disabled` last.
|
|
3
|
+
local SELECTORS = { { "_first", "first" }, { "_last", "last" }, { "_odd", "odd" }, { "_even", "even" }, { "_selected", "selected" }, { "_checked", "checked" }, { "_loading", "loading" }, { "_hover", "hover" }, { "_pressed", "pressed" }, { "_focus", "focused" }, { "_focusVisible", "focusVisible" }, { "_disabled", "disabled" } }
|
|
4
4
|
local SELECTOR_FLAGS = {
|
|
5
5
|
_hover = true,
|
|
6
6
|
_pressed = true,
|
|
7
7
|
_focus = true,
|
|
8
|
+
_focusVisible = true,
|
|
8
9
|
_selected = true,
|
|
9
10
|
_checked = true,
|
|
11
|
+
_loading = true,
|
|
10
12
|
_first = true,
|
|
11
13
|
_last = true,
|
|
14
|
+
_odd = true,
|
|
15
|
+
_even = true,
|
|
12
16
|
_disabled = true,
|
|
13
17
|
}
|
|
14
|
-
--* Peels
|
|
18
|
+
--* Peels selector keys and merges active ones onto the Instance props.
|
|
15
19
|
local function resolveStyle(style, state)
|
|
16
20
|
if state == nil then
|
|
17
21
|
state = {}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/** Dot-path into `theme.palette` (typed for common roles). */
|
|
2
|
+
export type PaletteToken = "surface.canvas" | "surface.paper" | "surface.elevated" | "surface.overlay" | "surface.input" | "primary.main" | "primary.on" | "primary.hover" | "primary.pressed" | "accent.main" | "accent.on" | "accent.hover" | "accent.pressed" | "text.primary" | "text.secondary" | "text.disabled" | "text.inverse" | "text.link" | "border" | "divider" | "focus" | "action.hover" | "action.pressed" | "action.selected" | "action.disabled" | "status.success.main" | "status.success.on" | "status.success.surface" | "status.success.border" | "status.warning.main" | "status.warning.on" | "status.warning.surface" | "status.warning.border" | "status.error.main" | "status.error.on" | "status.error.surface" | "status.error.border" | "status.info.main" | "status.info.on" | "status.info.surface" | "status.info.border" | "backdrop" | "shadow";
|
|
3
|
+
export declare function resolvePaletteToken(palette: object, token: PaletteToken | Color3): Color3;
|
|
4
|
+
/** Matches `hooks/breakpoints` thresholds. Kept local so Node style checks need no path aliases. */
|
|
5
|
+
type Responsive<T> = T | {
|
|
6
|
+
phone?: T;
|
|
7
|
+
tablet?: T;
|
|
8
|
+
desktop?: T;
|
|
9
|
+
};
|
|
10
|
+
type PadInput = number | {
|
|
11
|
+
x?: number;
|
|
12
|
+
y?: number;
|
|
13
|
+
top?: number;
|
|
14
|
+
right?: number;
|
|
15
|
+
bottom?: number;
|
|
16
|
+
left?: number;
|
|
17
|
+
};
|
|
18
|
+
interface SxTheme {
|
|
19
|
+
spacing: {
|
|
20
|
+
calc: (multiple: number) => number;
|
|
21
|
+
};
|
|
22
|
+
palette: object;
|
|
23
|
+
typography: {
|
|
24
|
+
fontFamilies: {
|
|
25
|
+
[family: string]: Enum.Font;
|
|
26
|
+
};
|
|
27
|
+
variants: {
|
|
28
|
+
[name: string]: {
|
|
29
|
+
size: number;
|
|
30
|
+
family: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export type SxColor = PaletteToken | Color3;
|
|
36
|
+
/** CSS-like shorthands + pass-through Instance props. No CSS string parser. */
|
|
37
|
+
export type SxInput = {
|
|
38
|
+
width?: Responsive<number | UDim | UDim2>;
|
|
39
|
+
height?: Responsive<number | UDim | UDim2>;
|
|
40
|
+
w?: Responsive<number | UDim | UDim2>;
|
|
41
|
+
h?: Responsive<number | UDim | UDim2>;
|
|
42
|
+
size?: Responsive<UDim2 | {
|
|
43
|
+
width?: number | UDim;
|
|
44
|
+
height?: number | UDim;
|
|
45
|
+
}>;
|
|
46
|
+
x?: Responsive<number | UDim>;
|
|
47
|
+
y?: Responsive<number | UDim>;
|
|
48
|
+
position?: Responsive<UDim2>;
|
|
49
|
+
pos?: Responsive<UDim2>;
|
|
50
|
+
anchor?: Responsive<Vector2 | number | [number, number]>;
|
|
51
|
+
p?: Responsive<number>;
|
|
52
|
+
px?: Responsive<number>;
|
|
53
|
+
py?: Responsive<number>;
|
|
54
|
+
pt?: Responsive<number>;
|
|
55
|
+
pr?: Responsive<number>;
|
|
56
|
+
pb?: Responsive<number>;
|
|
57
|
+
pl?: Responsive<number>;
|
|
58
|
+
padding?: Responsive<PadInput>;
|
|
59
|
+
gap?: Responsive<number>;
|
|
60
|
+
bgcolor?: Responsive<SxColor>;
|
|
61
|
+
bg?: Responsive<SxColor>;
|
|
62
|
+
backgroundColor?: Responsive<SxColor>;
|
|
63
|
+
color?: Responsive<SxColor>;
|
|
64
|
+
borderColor?: Responsive<SxColor>;
|
|
65
|
+
opacity?: Responsive<number>;
|
|
66
|
+
transparency?: Responsive<number>;
|
|
67
|
+
border?: Responsive<number>;
|
|
68
|
+
borderWidth?: Responsive<number>;
|
|
69
|
+
radius?: Responsive<number>;
|
|
70
|
+
typography?: Responsive<string>;
|
|
71
|
+
fontSize?: Responsive<number>;
|
|
72
|
+
font?: Responsive<Enum.Font | string>;
|
|
73
|
+
visible?: Responsive<boolean>;
|
|
74
|
+
zIndex?: Responsive<number>;
|
|
75
|
+
z?: Responsive<number>;
|
|
76
|
+
_hover?: SxInput;
|
|
77
|
+
_pressed?: SxInput;
|
|
78
|
+
_focus?: SxInput;
|
|
79
|
+
_focusVisible?: SxInput;
|
|
80
|
+
_disabled?: SxInput;
|
|
81
|
+
_selected?: SxInput;
|
|
82
|
+
_checked?: SxInput;
|
|
83
|
+
_loading?: SxInput;
|
|
84
|
+
_first?: SxInput;
|
|
85
|
+
_last?: SxInput;
|
|
86
|
+
_odd?: SxInput;
|
|
87
|
+
_even?: SxInput;
|
|
88
|
+
[key: string]: unknown;
|
|
89
|
+
};
|
|
90
|
+
export interface ResolvedSx {
|
|
91
|
+
root: {
|
|
92
|
+
[key: string]: unknown;
|
|
93
|
+
};
|
|
94
|
+
padding?: {
|
|
95
|
+
PaddingTop: UDim;
|
|
96
|
+
PaddingRight: UDim;
|
|
97
|
+
PaddingBottom: UDim;
|
|
98
|
+
PaddingLeft: UDim;
|
|
99
|
+
};
|
|
100
|
+
corner?: {
|
|
101
|
+
CornerRadius: UDim;
|
|
102
|
+
};
|
|
103
|
+
gap?: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Maps sx shorthands / tokens → Instance props (+ UIPadding / UICorner / gap helpers).
|
|
107
|
+
* Pass-through keys (BackgroundColor3, _hover, …) stay on `root` for `resolveStyle`.
|
|
108
|
+
*/
|
|
109
|
+
export declare function resolveSx(theme: SxTheme, sx?: SxInput, width?: number): ResolvedSx;
|
|
110
|
+
export {};
|