@rbxts/uiblox 0.2.0-alpha.3 → 0.2.0-alpha.31
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 +120 -0
- package/out/theme/styles/utilities/resolveSx.luau +524 -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 +210 -0
- package/out/ui/packages/host/hostPaint.d.ts +12 -0
- package/out/ui/packages/host/hostPaint.luau +34 -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
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local Divider = TS.import(script, script.Parent.Parent.Parent, "divider").Divider
|
|
5
|
+
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
6
|
+
local Orientations = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Orientations
|
|
7
|
+
local _parseMarkdown = TS.import(script, script.Parent.Parent, "parseMarkdown")
|
|
8
|
+
local inlinesToRichText = _parseMarkdown.inlinesToRichText
|
|
9
|
+
local parseMarkdown = _parseMarkdown.parseMarkdown
|
|
10
|
+
local useMarkdownStyles = TS.import(script, script.Parent, "Markdown.styles").default
|
|
11
|
+
local function headingVariant(level)
|
|
12
|
+
if level <= 1 then
|
|
13
|
+
return "h1"
|
|
14
|
+
end
|
|
15
|
+
if level == 2 then
|
|
16
|
+
return "h2"
|
|
17
|
+
end
|
|
18
|
+
if level == 3 then
|
|
19
|
+
return "h3"
|
|
20
|
+
end
|
|
21
|
+
if level == 4 then
|
|
22
|
+
return "h4"
|
|
23
|
+
end
|
|
24
|
+
if level == 5 then
|
|
25
|
+
return "h5"
|
|
26
|
+
end
|
|
27
|
+
return "h6"
|
|
28
|
+
end
|
|
29
|
+
local function textSizeFor(variant)
|
|
30
|
+
if variant == "h1" then
|
|
31
|
+
return 28
|
|
32
|
+
end
|
|
33
|
+
if variant == "h2" then
|
|
34
|
+
return 22
|
|
35
|
+
end
|
|
36
|
+
if variant == "h3" then
|
|
37
|
+
return 18
|
|
38
|
+
end
|
|
39
|
+
if variant == "h4" then
|
|
40
|
+
return 16
|
|
41
|
+
end
|
|
42
|
+
if variant == "h5" or variant == "h6" then
|
|
43
|
+
return 14
|
|
44
|
+
end
|
|
45
|
+
return 14
|
|
46
|
+
end
|
|
47
|
+
local function richLabel(key, styles, inlines, variant, order)
|
|
48
|
+
local text = inlinesToRichText(inlines)
|
|
49
|
+
local _attributes = {
|
|
50
|
+
key = key,
|
|
51
|
+
}
|
|
52
|
+
for _k, _v in styles.text do
|
|
53
|
+
_attributes[_k] = _v
|
|
54
|
+
end
|
|
55
|
+
_attributes.LayoutOrder = order
|
|
56
|
+
_attributes.Text = text
|
|
57
|
+
_attributes.TextSize = textSizeFor(variant)
|
|
58
|
+
_attributes.Font = if variant ~= nil and variant ~= "body" then Enum.Font.SourceSansBold else Enum.Font.SourceSans
|
|
59
|
+
return React.createElement("textlabel", _attributes)
|
|
60
|
+
end
|
|
61
|
+
local function renderBlock(block, index, styles)
|
|
62
|
+
if block.kind == "heading" then
|
|
63
|
+
local _attributes = {
|
|
64
|
+
key = `h-{index}`,
|
|
65
|
+
}
|
|
66
|
+
for _k, _v in styles.block do
|
|
67
|
+
_attributes[_k] = _v
|
|
68
|
+
end
|
|
69
|
+
_attributes.LayoutOrder = index
|
|
70
|
+
return React.createElement("frame", _attributes, richLabel("Text", styles, block.inlines, headingVariant(block.level)))
|
|
71
|
+
end
|
|
72
|
+
if block.kind == "paragraph" then
|
|
73
|
+
local _attributes = {
|
|
74
|
+
key = `p-{index}`,
|
|
75
|
+
}
|
|
76
|
+
for _k, _v in styles.block do
|
|
77
|
+
_attributes[_k] = _v
|
|
78
|
+
end
|
|
79
|
+
_attributes.LayoutOrder = index
|
|
80
|
+
return React.createElement("frame", _attributes, richLabel("Text", styles, block.inlines, "body"))
|
|
81
|
+
end
|
|
82
|
+
if block.kind == "code" then
|
|
83
|
+
local _attributes = {
|
|
84
|
+
key = `c-{index}`,
|
|
85
|
+
}
|
|
86
|
+
for _k, _v in styles.code do
|
|
87
|
+
_attributes[_k] = _v
|
|
88
|
+
end
|
|
89
|
+
_attributes.LayoutOrder = index
|
|
90
|
+
local _exp = React.createElement("uicorner", {
|
|
91
|
+
CornerRadius = UDim.new(0, 4),
|
|
92
|
+
})
|
|
93
|
+
local _attributes_1 = table.clone(styles.codePad)
|
|
94
|
+
setmetatable(_attributes_1, nil)
|
|
95
|
+
local _exp_1 = React.createElement("uipadding", _attributes_1)
|
|
96
|
+
local _attributes_2 = {
|
|
97
|
+
key = "Code",
|
|
98
|
+
}
|
|
99
|
+
for _k, _v in styles.codeText do
|
|
100
|
+
_attributes_2[_k] = _v
|
|
101
|
+
end
|
|
102
|
+
_attributes_2.Text = block.text
|
|
103
|
+
return React.createElement("frame", _attributes, _exp, _exp_1, React.createElement("textlabel", _attributes_2))
|
|
104
|
+
end
|
|
105
|
+
if block.kind == "hr" then
|
|
106
|
+
return React.createElement(Divider, {
|
|
107
|
+
key = `hr-{index}`,
|
|
108
|
+
orientation = Orientations.Horizontal,
|
|
109
|
+
padding = 0,
|
|
110
|
+
className = {
|
|
111
|
+
LayoutOrder = index,
|
|
112
|
+
},
|
|
113
|
+
})
|
|
114
|
+
end
|
|
115
|
+
if block.kind == "blockquote" then
|
|
116
|
+
local _attributes = {
|
|
117
|
+
key = `q-{index}`,
|
|
118
|
+
}
|
|
119
|
+
for _k, _v in styles.quote do
|
|
120
|
+
_attributes[_k] = _v
|
|
121
|
+
end
|
|
122
|
+
_attributes.LayoutOrder = index
|
|
123
|
+
local _exp = React.createElement("uicorner", {
|
|
124
|
+
CornerRadius = UDim.new(0, 4),
|
|
125
|
+
})
|
|
126
|
+
local _attributes_1 = {
|
|
127
|
+
key = "Bar",
|
|
128
|
+
}
|
|
129
|
+
for _k, _v in styles.quoteBar do
|
|
130
|
+
_attributes_1[_k] = _v
|
|
131
|
+
end
|
|
132
|
+
local _exp_1 = React.createElement("frame", _attributes_1)
|
|
133
|
+
local _attributes_2 = table.clone(styles.quotePad)
|
|
134
|
+
setmetatable(_attributes_2, nil)
|
|
135
|
+
return React.createElement("frame", _attributes, _exp, _exp_1, React.createElement("uipadding", _attributes_2), richLabel("Text", styles, block.inlines, "body"))
|
|
136
|
+
end
|
|
137
|
+
if block.kind == "list" then
|
|
138
|
+
local _attributes = {
|
|
139
|
+
key = `l-{index}`,
|
|
140
|
+
}
|
|
141
|
+
for _k, _v in styles.block do
|
|
142
|
+
_attributes[_k] = _v
|
|
143
|
+
end
|
|
144
|
+
_attributes.LayoutOrder = index
|
|
145
|
+
local _exp = React.createElement("uilistlayout", {
|
|
146
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
147
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Left,
|
|
148
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
149
|
+
Padding = UDim.new(0, 2),
|
|
150
|
+
})
|
|
151
|
+
local _exp_1 = block.items
|
|
152
|
+
-- ▼ ReadonlyArray.map ▼
|
|
153
|
+
local _newValue = table.create(#_exp_1)
|
|
154
|
+
local _callback = function(item, itemIndex)
|
|
155
|
+
local prefix = if block.ordered then `{itemIndex + 1}. ` else "• "
|
|
156
|
+
local _array = { {
|
|
157
|
+
kind = "text",
|
|
158
|
+
text = prefix,
|
|
159
|
+
} }
|
|
160
|
+
local _length = #_array
|
|
161
|
+
table.move(item, 1, #item, _length + 1, _array)
|
|
162
|
+
local labeled = _array
|
|
163
|
+
local _attributes_1 = {
|
|
164
|
+
key = `li-{itemIndex}`,
|
|
165
|
+
}
|
|
166
|
+
for _k, _v in styles.listItem do
|
|
167
|
+
_attributes_1[_k] = _v
|
|
168
|
+
end
|
|
169
|
+
_attributes_1.LayoutOrder = itemIndex
|
|
170
|
+
return React.createElement("frame", _attributes_1, richLabel("Text", styles, labeled, "body"))
|
|
171
|
+
end
|
|
172
|
+
for _k, _v in _exp_1 do
|
|
173
|
+
_newValue[_k] = _callback(_v, _k - 1, _exp_1)
|
|
174
|
+
end
|
|
175
|
+
-- ▲ ReadonlyArray.map ▲
|
|
176
|
+
return React.createElement("frame", _attributes, _exp, _newValue)
|
|
177
|
+
end
|
|
178
|
+
return nil
|
|
179
|
+
end
|
|
180
|
+
local function Markdown(props)
|
|
181
|
+
local _binding = props
|
|
182
|
+
local value = _binding.value
|
|
183
|
+
if value == nil then
|
|
184
|
+
value = ""
|
|
185
|
+
end
|
|
186
|
+
local className = _binding.className
|
|
187
|
+
local sx = _binding.sx
|
|
188
|
+
local id = _binding.id
|
|
189
|
+
local ref = _binding.ref
|
|
190
|
+
local styles = useMarkdownStyles()
|
|
191
|
+
local blocks = parseMarkdown(value)
|
|
192
|
+
local _attributes = {
|
|
193
|
+
tag = "frame",
|
|
194
|
+
}
|
|
195
|
+
local _condition = id
|
|
196
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
197
|
+
_condition = "Markdown"
|
|
198
|
+
end
|
|
199
|
+
_attributes.key = _condition
|
|
200
|
+
_attributes.hostRef = ref
|
|
201
|
+
_attributes.base = styles.root
|
|
202
|
+
_attributes.className = className
|
|
203
|
+
_attributes.sx = sx
|
|
204
|
+
local _attributes_1 = table.clone(styles.layout)
|
|
205
|
+
setmetatable(_attributes_1, nil)
|
|
206
|
+
local _exp = React.createElement("uilistlayout", _attributes_1)
|
|
207
|
+
-- ▼ ReadonlyArray.map ▼
|
|
208
|
+
local _newValue = table.create(#blocks)
|
|
209
|
+
local _callback = function(block, index)
|
|
210
|
+
return renderBlock(block, index, styles)
|
|
211
|
+
end
|
|
212
|
+
for _k, _v in blocks do
|
|
213
|
+
_newValue[_k] = _callback(_v, _k - 1, blocks)
|
|
214
|
+
end
|
|
215
|
+
-- ▲ ReadonlyArray.map ▲
|
|
216
|
+
return React.createElement(SxHost, _attributes, _exp, _newValue)
|
|
217
|
+
end
|
|
218
|
+
local default = Markdown
|
|
219
|
+
return {
|
|
220
|
+
default = default,
|
|
221
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
|
+
local componentStyles = _theme.componentStyles
|
|
5
|
+
local createStyles = _theme.createStyles
|
|
6
|
+
local useMarkdownStyles = componentStyles("Markdown", function(theme)
|
|
7
|
+
local gap = if theme.density == "compact" then theme.padding.calc(1) else theme.spacing.calc(1)
|
|
8
|
+
local _object = {
|
|
9
|
+
root = {
|
|
10
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
11
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
12
|
+
BackgroundTransparency = 1,
|
|
13
|
+
BorderSizePixel = 0,
|
|
14
|
+
},
|
|
15
|
+
layout = {
|
|
16
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
17
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Left,
|
|
18
|
+
VerticalAlignment = Enum.VerticalAlignment.Top,
|
|
19
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
20
|
+
Padding = UDim.new(0, gap),
|
|
21
|
+
},
|
|
22
|
+
block = {
|
|
23
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
24
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
25
|
+
BackgroundTransparency = 1,
|
|
26
|
+
BorderSizePixel = 0,
|
|
27
|
+
},
|
|
28
|
+
text = {
|
|
29
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
30
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
31
|
+
BackgroundTransparency = 1,
|
|
32
|
+
BorderSizePixel = 0,
|
|
33
|
+
Font = theme.typography.fontFamilies.default,
|
|
34
|
+
TextSize = theme.typography.fontSizes.body,
|
|
35
|
+
TextColor3 = theme.palette.text.primary,
|
|
36
|
+
TextXAlignment = Enum.TextXAlignment.Left,
|
|
37
|
+
TextYAlignment = Enum.TextYAlignment.Top,
|
|
38
|
+
TextWrapped = true,
|
|
39
|
+
RichText = true,
|
|
40
|
+
},
|
|
41
|
+
code = {
|
|
42
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
43
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
44
|
+
BackgroundColor3 = theme.palette.surface.paper,
|
|
45
|
+
BorderSizePixel = 0,
|
|
46
|
+
},
|
|
47
|
+
codePad = {
|
|
48
|
+
PaddingTop = UDim.new(0, theme.padding.calc(1)),
|
|
49
|
+
PaddingBottom = UDim.new(0, theme.padding.calc(1)),
|
|
50
|
+
PaddingLeft = UDim.new(0, theme.padding.calc(1.5)),
|
|
51
|
+
PaddingRight = UDim.new(0, theme.padding.calc(1.5)),
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
local _left = "codeText"
|
|
55
|
+
local _object_1 = {
|
|
56
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
57
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
58
|
+
BackgroundTransparency = 1,
|
|
59
|
+
BorderSizePixel = 0,
|
|
60
|
+
Font = Enum.Font.RobotoMono,
|
|
61
|
+
}
|
|
62
|
+
local _left_1 = "TextSize"
|
|
63
|
+
local _condition = theme.typography.fontSizes.caption
|
|
64
|
+
if _condition == nil then
|
|
65
|
+
_condition = theme.typography.fontSizes.body
|
|
66
|
+
end
|
|
67
|
+
_object_1[_left_1] = _condition
|
|
68
|
+
_object_1.TextColor3 = theme.palette.text.primary
|
|
69
|
+
_object_1.TextXAlignment = Enum.TextXAlignment.Left
|
|
70
|
+
_object_1.TextYAlignment = Enum.TextYAlignment.Top
|
|
71
|
+
_object_1.TextWrapped = true
|
|
72
|
+
_object[_left] = _object_1
|
|
73
|
+
_object.quote = {
|
|
74
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
75
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
76
|
+
BackgroundColor3 = theme.palette.surface.paper,
|
|
77
|
+
BorderSizePixel = 0,
|
|
78
|
+
}
|
|
79
|
+
_object.quoteBar = {
|
|
80
|
+
Size = UDim2.new(0, 3, 1, 0),
|
|
81
|
+
BackgroundColor3 = theme.palette.primary.main,
|
|
82
|
+
BorderSizePixel = 0,
|
|
83
|
+
}
|
|
84
|
+
_object.quotePad = {
|
|
85
|
+
PaddingTop = UDim.new(0, theme.padding.calc(1)),
|
|
86
|
+
PaddingBottom = UDim.new(0, theme.padding.calc(1)),
|
|
87
|
+
PaddingLeft = UDim.new(0, theme.padding.calc(2)),
|
|
88
|
+
PaddingRight = UDim.new(0, theme.padding.calc(1)),
|
|
89
|
+
}
|
|
90
|
+
_object.listItem = {
|
|
91
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
92
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
93
|
+
BackgroundTransparency = 1,
|
|
94
|
+
BorderSizePixel = 0,
|
|
95
|
+
}
|
|
96
|
+
return createStyles(_object)
|
|
97
|
+
end)
|
|
98
|
+
local default = useMarkdownStyles
|
|
99
|
+
return {
|
|
100
|
+
default = default,
|
|
101
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
3
|
+
import { MarkdownEditorMode } from "./MarkdownEditor.styles";
|
|
4
|
+
export interface MarkdownEditorProps {
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (value: string) => void;
|
|
7
|
+
mode?: MarkdownEditorMode;
|
|
8
|
+
onModeChange?: (mode: MarkdownEditorMode) => void;
|
|
9
|
+
fullscreen?: boolean;
|
|
10
|
+
onFullscreenChange?: (fullscreen: boolean) => void;
|
|
11
|
+
preview?: (value: string) => React.Element;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function MarkdownEditor(props: CustomizedProps<Frame, MarkdownEditorProps>): JSX.Element;
|
|
15
|
+
export default MarkdownEditor;
|
|
16
|
+
export type { MarkdownEditorMode };
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local React = _react
|
|
5
|
+
local useEffect = _react.useEffect
|
|
6
|
+
local useRef = _react.useRef
|
|
7
|
+
local useState = _react.useState
|
|
8
|
+
local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
|
|
9
|
+
local Button = TS.import(script, script.Parent.Parent.Parent, "button").Button
|
|
10
|
+
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
11
|
+
local IconButton = TS.import(script, script.Parent.Parent.Parent, "iconButton").IconButton
|
|
12
|
+
local Icons = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Icons
|
|
13
|
+
local ToggleButtonGroup = TS.import(script, script.Parent.Parent.Parent, "toggleButton").ToggleButtonGroup
|
|
14
|
+
local htmlToMarkdown = TS.import(script, script.Parent.Parent, "htmlToMarkdown").htmlToMarkdown
|
|
15
|
+
local Markdown = TS.import(script, script.Parent, "Markdown").default
|
|
16
|
+
local useMarkdownEditorStyles = TS.import(script, script.Parent, "MarkdownEditor.styles").default
|
|
17
|
+
local MODE_OPTIONS = { {
|
|
18
|
+
label = "Split",
|
|
19
|
+
value = "split",
|
|
20
|
+
}, {
|
|
21
|
+
label = "Edit",
|
|
22
|
+
value = "edit",
|
|
23
|
+
}, {
|
|
24
|
+
label = "Preview",
|
|
25
|
+
value = "preview",
|
|
26
|
+
} }
|
|
27
|
+
local function looksLikeHtml(text)
|
|
28
|
+
local lower = string.lower(text)
|
|
29
|
+
return (string.find(lower, "<p", 1, true)) ~= nil or (string.find(lower, "<h1", 1, true)) ~= nil or (string.find(lower, "<h2", 1, true)) ~= nil or (string.find(lower, "<div", 1, true)) ~= nil or (string.find(lower, "<ul", 1, true)) ~= nil or (string.find(lower, "<ol", 1, true)) ~= nil or (string.find(lower, "<pre", 1, true)) ~= nil or (string.find(lower, "<blockquote", 1, true)) ~= nil or (string.find(lower, "<strong", 1, true)) ~= nil
|
|
30
|
+
end
|
|
31
|
+
local function MarkdownEditor(props)
|
|
32
|
+
local _binding = props
|
|
33
|
+
local value = _binding.value
|
|
34
|
+
local onChange = _binding.onChange
|
|
35
|
+
local modeProp = _binding.mode
|
|
36
|
+
local onModeChange = _binding.onModeChange
|
|
37
|
+
local fullscreenProp = _binding.fullscreen
|
|
38
|
+
local onFullscreenChange = _binding.onFullscreenChange
|
|
39
|
+
local preview = _binding.preview
|
|
40
|
+
local placeholder = _binding.placeholder
|
|
41
|
+
if placeholder == nil then
|
|
42
|
+
placeholder = "Write markdown…"
|
|
43
|
+
end
|
|
44
|
+
local className = _binding.className
|
|
45
|
+
local sx = _binding.sx
|
|
46
|
+
local id = _binding.id
|
|
47
|
+
local ref = _binding.ref
|
|
48
|
+
local _binding_1 = useTheme()
|
|
49
|
+
local theme = _binding_1.theme
|
|
50
|
+
local modeState, setModeState = useState("split")
|
|
51
|
+
local fullscreenState, setFullscreenState = useState(false)
|
|
52
|
+
local draft, setDraft = useState(value)
|
|
53
|
+
local htmlDraft, setHtmlDraft = useState(nil)
|
|
54
|
+
local focused = useRef(false)
|
|
55
|
+
local mode = modeProp or modeState
|
|
56
|
+
local _condition = fullscreenProp
|
|
57
|
+
if _condition == nil then
|
|
58
|
+
_condition = fullscreenState
|
|
59
|
+
end
|
|
60
|
+
local fullscreen = _condition
|
|
61
|
+
local compact = theme.density == "compact"
|
|
62
|
+
local styles = useMarkdownEditorStyles({
|
|
63
|
+
fullscreen = fullscreen,
|
|
64
|
+
compact = compact,
|
|
65
|
+
})
|
|
66
|
+
useEffect(function()
|
|
67
|
+
if not focused.current then
|
|
68
|
+
setDraft(value)
|
|
69
|
+
end
|
|
70
|
+
end, { value })
|
|
71
|
+
local setMode = function(modeNext)
|
|
72
|
+
if modeProp == nil then
|
|
73
|
+
setModeState(modeNext)
|
|
74
|
+
end
|
|
75
|
+
local _result = onModeChange
|
|
76
|
+
if _result ~= nil then
|
|
77
|
+
_result(modeNext)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
local setFullscreen = function(fullNext)
|
|
81
|
+
if fullscreenProp == nil then
|
|
82
|
+
setFullscreenState(fullNext)
|
|
83
|
+
end
|
|
84
|
+
local _result = onFullscreenChange
|
|
85
|
+
if _result ~= nil then
|
|
86
|
+
_result(fullNext)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
local showEdit = mode == "split" or mode == "edit"
|
|
90
|
+
local showPreview = mode == "split" or mode == "preview"
|
|
91
|
+
local previewNode = if preview ~= nil then preview(value) else React.createElement(Markdown, {
|
|
92
|
+
value = value,
|
|
93
|
+
})
|
|
94
|
+
local _attributes = {
|
|
95
|
+
tag = "frame",
|
|
96
|
+
}
|
|
97
|
+
local _condition_1 = id
|
|
98
|
+
if not (_condition_1 ~= 0 and _condition_1 == _condition_1 and _condition_1 ~= "" and _condition_1) then
|
|
99
|
+
_condition_1 = "MarkdownEditor"
|
|
100
|
+
end
|
|
101
|
+
_attributes.key = _condition_1
|
|
102
|
+
_attributes.hostRef = ref
|
|
103
|
+
_attributes.base = styles.root
|
|
104
|
+
_attributes.className = className
|
|
105
|
+
_attributes.sx = sx
|
|
106
|
+
local _attributes_1 = table.clone(styles.corner)
|
|
107
|
+
setmetatable(_attributes_1, nil)
|
|
108
|
+
local _exp = React.createElement("uicorner", _attributes_1)
|
|
109
|
+
local _attributes_2 = table.clone(styles.stroke)
|
|
110
|
+
setmetatable(_attributes_2, nil)
|
|
111
|
+
local _exp_1 = React.createElement("uistroke", _attributes_2)
|
|
112
|
+
local _attributes_3 = table.clone(styles.layout)
|
|
113
|
+
setmetatable(_attributes_3, nil)
|
|
114
|
+
local _exp_2 = React.createElement("uilistlayout", _attributes_3)
|
|
115
|
+
local _attributes_4 = {
|
|
116
|
+
key = "Toolbar",
|
|
117
|
+
}
|
|
118
|
+
for _k, _v in styles.toolbar do
|
|
119
|
+
_attributes_4[_k] = _v
|
|
120
|
+
end
|
|
121
|
+
local _attributes_5 = table.clone(styles.toolbarPad)
|
|
122
|
+
setmetatable(_attributes_5, nil)
|
|
123
|
+
local _exp_3 = React.createElement("uipadding", _attributes_5)
|
|
124
|
+
local _attributes_6 = table.clone(styles.toolbarRow)
|
|
125
|
+
setmetatable(_attributes_6, nil)
|
|
126
|
+
local _exp_4 = React.createElement("frame", _attributes_4, _exp_3, React.createElement("uilistlayout", _attributes_6), React.createElement(ToggleButtonGroup, {
|
|
127
|
+
value = mode,
|
|
128
|
+
options = MODE_OPTIONS,
|
|
129
|
+
size = if compact then "small" else "medium",
|
|
130
|
+
onChange = setMode,
|
|
131
|
+
className = {
|
|
132
|
+
LayoutOrder = 1,
|
|
133
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
134
|
+
Size = UDim2.fromScale(0, 0),
|
|
135
|
+
},
|
|
136
|
+
}), React.createElement(Button, {
|
|
137
|
+
text = "Paste HTML",
|
|
138
|
+
variant = "text",
|
|
139
|
+
size = if compact then "small" else "medium",
|
|
140
|
+
className = {
|
|
141
|
+
LayoutOrder = 2,
|
|
142
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
143
|
+
Size = UDim2.fromScale(0, 0),
|
|
144
|
+
},
|
|
145
|
+
onLeftClick = function()
|
|
146
|
+
if looksLikeHtml(value) then
|
|
147
|
+
onChange(htmlToMarkdown(value))
|
|
148
|
+
else
|
|
149
|
+
setHtmlDraft("")
|
|
150
|
+
end
|
|
151
|
+
end,
|
|
152
|
+
}), React.createElement(IconButton, {
|
|
153
|
+
icon = Icons.Expanded,
|
|
154
|
+
size = "sm",
|
|
155
|
+
tint = theme.palette.text.secondary,
|
|
156
|
+
selected = fullscreen,
|
|
157
|
+
onClick = function()
|
|
158
|
+
return setFullscreen(not fullscreen)
|
|
159
|
+
end,
|
|
160
|
+
className = {
|
|
161
|
+
LayoutOrder = 99,
|
|
162
|
+
},
|
|
163
|
+
}))
|
|
164
|
+
local _exp_5 = htmlDraft ~= nil and (React.createElement("frame", {
|
|
165
|
+
key = "HtmlPaste",
|
|
166
|
+
Size = UDim2.new(1, 0, 0, 96),
|
|
167
|
+
BackgroundColor3 = theme.palette.surface.elevated,
|
|
168
|
+
BorderSizePixel = 0,
|
|
169
|
+
LayoutOrder = 1,
|
|
170
|
+
}, React.createElement("uipadding", {
|
|
171
|
+
PaddingTop = UDim.new(0, theme.padding.calc(1)),
|
|
172
|
+
PaddingBottom = UDim.new(0, theme.padding.calc(1)),
|
|
173
|
+
PaddingLeft = UDim.new(0, theme.padding.calc(1)),
|
|
174
|
+
PaddingRight = UDim.new(0, theme.padding.calc(1)),
|
|
175
|
+
}), React.createElement("uilistlayout", {
|
|
176
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
177
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
178
|
+
Padding = UDim.new(0, theme.padding.calc(1)),
|
|
179
|
+
}), React.createElement("textbox", {
|
|
180
|
+
key = "HtmlField",
|
|
181
|
+
Size = UDim2.new(1, 0, 0, 48),
|
|
182
|
+
BackgroundColor3 = theme.palette.surface.input,
|
|
183
|
+
BorderSizePixel = 0,
|
|
184
|
+
ClearTextOnFocus = false,
|
|
185
|
+
MultiLine = true,
|
|
186
|
+
Text = htmlDraft,
|
|
187
|
+
PlaceholderText = "Paste HTML here",
|
|
188
|
+
TextXAlignment = Enum.TextXAlignment.Left,
|
|
189
|
+
TextYAlignment = Enum.TextYAlignment.Top,
|
|
190
|
+
TextSize = theme.typography.fontSizes.caption,
|
|
191
|
+
TextColor3 = theme.palette.text.primary,
|
|
192
|
+
Font = Enum.Font.RobotoMono,
|
|
193
|
+
Change = {
|
|
194
|
+
Text = function(rbx)
|
|
195
|
+
return setHtmlDraft(rbx.Text)
|
|
196
|
+
end,
|
|
197
|
+
},
|
|
198
|
+
LayoutOrder = 1,
|
|
199
|
+
}), React.createElement("frame", {
|
|
200
|
+
key = "HtmlActions",
|
|
201
|
+
Size = UDim2.new(1, 0, 0, 28),
|
|
202
|
+
BackgroundTransparency = 1,
|
|
203
|
+
LayoutOrder = 2,
|
|
204
|
+
}, React.createElement("uilistlayout", {
|
|
205
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
206
|
+
Padding = UDim.new(0, theme.padding.calc(1)),
|
|
207
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
208
|
+
}), React.createElement(Button, {
|
|
209
|
+
text = "Convert",
|
|
210
|
+
size = "small",
|
|
211
|
+
className = {
|
|
212
|
+
LayoutOrder = 1,
|
|
213
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
214
|
+
Size = UDim2.fromScale(0, 0),
|
|
215
|
+
},
|
|
216
|
+
onLeftClick = function()
|
|
217
|
+
onChange(htmlToMarkdown(htmlDraft))
|
|
218
|
+
setHtmlDraft(nil)
|
|
219
|
+
setMode("preview")
|
|
220
|
+
end,
|
|
221
|
+
}), React.createElement(Button, {
|
|
222
|
+
text = "Cancel",
|
|
223
|
+
variant = "text",
|
|
224
|
+
size = "small",
|
|
225
|
+
className = {
|
|
226
|
+
LayoutOrder = 2,
|
|
227
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
228
|
+
Size = UDim2.fromScale(0, 0),
|
|
229
|
+
},
|
|
230
|
+
onLeftClick = function()
|
|
231
|
+
return setHtmlDraft(nil)
|
|
232
|
+
end,
|
|
233
|
+
}))))
|
|
234
|
+
local _attributes_7 = {
|
|
235
|
+
key = "Body",
|
|
236
|
+
}
|
|
237
|
+
for _k, _v in styles.body do
|
|
238
|
+
_attributes_7[_k] = _v
|
|
239
|
+
end
|
|
240
|
+
_attributes_7.LayoutOrder = 3
|
|
241
|
+
local _condition_2 = mode == "split"
|
|
242
|
+
if _condition_2 then
|
|
243
|
+
local _attributes_8 = table.clone(styles.split)
|
|
244
|
+
setmetatable(_attributes_8, nil)
|
|
245
|
+
_condition_2 = React.createElement("uilistlayout", _attributes_8)
|
|
246
|
+
end
|
|
247
|
+
local _condition_3 = showEdit
|
|
248
|
+
if _condition_3 then
|
|
249
|
+
local _attributes_8 = {
|
|
250
|
+
key = "EditPane",
|
|
251
|
+
}
|
|
252
|
+
for _k, _v in (if mode == "split" then styles.pane else styles.paneFull) do
|
|
253
|
+
_attributes_8[_k] = _v
|
|
254
|
+
end
|
|
255
|
+
_attributes_8.LayoutOrder = 1
|
|
256
|
+
local _attributes_9 = {
|
|
257
|
+
key = "Editor",
|
|
258
|
+
}
|
|
259
|
+
for _k, _v in styles.editor do
|
|
260
|
+
_attributes_9[_k] = _v
|
|
261
|
+
end
|
|
262
|
+
_attributes_9.Text = draft
|
|
263
|
+
_attributes_9.PlaceholderText = placeholder
|
|
264
|
+
_attributes_9.Change = {
|
|
265
|
+
Text = function(rbx)
|
|
266
|
+
setDraft(rbx.Text)
|
|
267
|
+
if focused.current and rbx.Text ~= value then
|
|
268
|
+
onChange(rbx.Text)
|
|
269
|
+
end
|
|
270
|
+
end,
|
|
271
|
+
}
|
|
272
|
+
_attributes_9.Event = {
|
|
273
|
+
Focused = function()
|
|
274
|
+
focused.current = true
|
|
275
|
+
end,
|
|
276
|
+
FocusLost = function(rbx)
|
|
277
|
+
focused.current = false
|
|
278
|
+
setDraft(rbx.Text)
|
|
279
|
+
onChange(rbx.Text)
|
|
280
|
+
end,
|
|
281
|
+
}
|
|
282
|
+
local _attributes_10 = table.clone(styles.editorPad)
|
|
283
|
+
setmetatable(_attributes_10, nil)
|
|
284
|
+
_condition_3 = (React.createElement("frame", _attributes_8, React.createElement("textbox", _attributes_9, React.createElement("uipadding", _attributes_10))))
|
|
285
|
+
end
|
|
286
|
+
local _condition_4 = mode == "split"
|
|
287
|
+
if _condition_4 then
|
|
288
|
+
local _attributes_8 = {
|
|
289
|
+
key = "SplitRule",
|
|
290
|
+
}
|
|
291
|
+
for _k, _v in styles.divider do
|
|
292
|
+
_attributes_8[_k] = _v
|
|
293
|
+
end
|
|
294
|
+
_condition_4 = React.createElement("frame", _attributes_8)
|
|
295
|
+
end
|
|
296
|
+
local _condition_5 = showPreview
|
|
297
|
+
if _condition_5 then
|
|
298
|
+
local _attributes_8 = {
|
|
299
|
+
key = "PreviewPane",
|
|
300
|
+
}
|
|
301
|
+
for _k, _v in styles.previewScroll do
|
|
302
|
+
_attributes_8[_k] = _v
|
|
303
|
+
end
|
|
304
|
+
_attributes_8.Size = if mode == "split" then UDim2.fromScale(0.5, 1) else UDim2.fromScale(1, 1)
|
|
305
|
+
_attributes_8.LayoutOrder = 3
|
|
306
|
+
local _attributes_9 = table.clone(styles.previewPad)
|
|
307
|
+
setmetatable(_attributes_9, nil)
|
|
308
|
+
_condition_5 = (React.createElement("scrollingframe", _attributes_8, React.createElement("uipadding", _attributes_9), previewNode))
|
|
309
|
+
end
|
|
310
|
+
return React.createElement(SxHost, _attributes, _exp, _exp_1, _exp_2, _exp_4, _exp_5, React.createElement("frame", _attributes_7, _condition_2, _condition_3, _condition_4, _condition_5))
|
|
311
|
+
end
|
|
312
|
+
local default = MarkdownEditor
|
|
313
|
+
return {
|
|
314
|
+
default = default,
|
|
315
|
+
}
|