@rbxts/uiblox 0.2.0-alpha.36 → 0.2.0-alpha.5
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 +109 -27
- package/out/hooks/index.d.ts +0 -1
- package/out/hooks/init.luau +0 -3
- package/out/hooks/useBreakpoints.luau +11 -2
- package/out/theme/interfaces/theme/Theme.d.ts +0 -15
- package/out/theme/styles/utilities/componentStyles.luau +3 -45
- package/out/theme/styles/utilities/componentTheme.d.ts +0 -15
- package/out/theme/styles/utilities/index.d.ts +0 -2
- package/out/theme/styles/utilities/init.luau +0 -7
- package/out/theme/styles/utilities/resolveStyle.d.ts +2 -10
- package/out/theme/styles/utilities/resolveStyle.luau +3 -7
- package/out/theme/styles/utilities/styleCache.d.ts +0 -2
- package/out/theme/styles/utilities/styleCache.luau +0 -9
- package/out/theme/types/types.d.ts +1 -2
- package/out/ui/packages/accordion/components/Accordion.d.ts +0 -2
- package/out/ui/packages/accordion/components/Accordion.luau +30 -46
- package/out/ui/packages/accordion/components/Accordion.styles.d.ts +0 -1
- package/out/ui/packages/accordion/components/Accordion.styles.luau +4 -16
- package/out/ui/packages/accordion/components/accordionOpen.d.ts +0 -1
- package/out/ui/packages/accordion/components/accordionOpen.luau +0 -4
- package/out/ui/packages/alert/components/Alert.d.ts +0 -2
- package/out/ui/packages/alert/components/Alert.luau +42 -48
- package/out/ui/packages/alert/components/Alert.styles.d.ts +0 -2
- package/out/ui/packages/alert/components/Alert.styles.luau +8 -17
- package/out/ui/packages/appBar/components/AppBar.d.ts +1 -2
- package/out/ui/packages/appBar/components/AppBar.luau +36 -47
- package/out/ui/packages/appBar/components/AppBar.styles.d.ts +0 -2
- package/out/ui/packages/appBar/components/AppBar.styles.luau +5 -16
- package/out/ui/packages/assetField/components/AssetField.luau +16 -12
- package/out/ui/packages/avatar/components/Avatar.d.ts +0 -2
- package/out/ui/packages/avatar/components/Avatar.luau +26 -27
- package/out/ui/packages/avatar/components/Avatar.styles.d.ts +0 -2
- package/out/ui/packages/avatar/components/Avatar.styles.luau +1 -5
- package/out/ui/packages/badge/components/Badge.d.ts +0 -3
- package/out/ui/packages/badge/components/Badge.luau +24 -32
- package/out/ui/packages/badge/components/Badge.styles.d.ts +1 -5
- package/out/ui/packages/badge/components/Badge.styles.luau +8 -20
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.d.ts +0 -1
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.luau +18 -20
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.d.ts +1 -3
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +2 -6
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.d.ts +0 -1
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +40 -67
- package/out/ui/packages/breadcrumbs/components/breadcrumbItems.d.ts +0 -9
- package/out/ui/packages/breadcrumbs/components/breadcrumbItems.luau +0 -68
- package/out/ui/packages/breadcrumbs/index.d.ts +0 -1
- package/out/ui/packages/breadcrumbs/init.luau +0 -3
- package/out/ui/packages/brickColorPicker/components/BrickColorPicker.luau +16 -12
- package/out/ui/packages/button/components/Button.luau +18 -20
- package/out/ui/packages/card/components/Card.d.ts +1 -3
- package/out/ui/packages/card/components/Card.luau +0 -10
- package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +53 -75
- package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +9 -26
- 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 +1 -5
- package/out/ui/packages/chip/components/Chip.luau +16 -25
- package/out/ui/packages/chip/components/Chip.styles.d.ts +0 -5
- package/out/ui/packages/chip/components/Chip.styles.luau +13 -30
- package/out/ui/packages/circularProgress/components/CircularProgress.luau +18 -29
- package/out/ui/packages/colorPicker/components/ColorPicker.luau +20 -16
- package/out/ui/packages/colorPicker/components/ColorPicker.styles.luau +20 -34
- package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +35 -34
- package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +62 -65
- package/out/ui/packages/dialog/components/Dialog.d.ts +2 -3
- package/out/ui/packages/dialog/components/Dialog.luau +21 -41
- package/out/ui/packages/divider/components/Divider.d.ts +0 -1
- package/out/ui/packages/divider/components/Divider.luau +17 -52
- package/out/ui/packages/divider/components/Divider.styles.luau +0 -32
- package/out/ui/packages/drawer/components/Drawer.d.ts +1 -3
- package/out/ui/packages/drawer/components/Drawer.luau +37 -71
- package/out/ui/packages/drawer/components/Drawer.styles.d.ts +1 -3
- package/out/ui/packages/drawer/components/Drawer.styles.luau +2 -3
- package/out/ui/packages/fab/components/Fab.d.ts +0 -3
- package/out/ui/packages/fab/components/Fab.luau +37 -79
- package/out/ui/packages/fab/components/Fab.styles.d.ts +0 -3
- package/out/ui/packages/fab/components/Fab.styles.luau +3 -39
- package/out/ui/packages/fab/components/fabSize.d.ts +0 -1
- package/out/ui/packages/fab/components/fabSize.luau +0 -4
- package/out/ui/packages/fab/index.d.ts +1 -1
- package/out/ui/packages/fab/init.luau +0 -1
- package/out/ui/packages/fontEditor/components/FontEditor.luau +16 -12
- package/out/ui/packages/formText/components/FormHelperText.luau +16 -12
- package/out/ui/packages/formText/components/FormLabel.luau +16 -12
- package/out/ui/packages/gradientEditor/components/GradientEditor.luau +42 -56
- package/out/ui/packages/gradientEditor/components/GradientEditor.styles.luau +4 -37
- package/out/ui/packages/icon/components/Icon.luau +16 -9
- package/out/ui/packages/iconButton/components/IconButton.luau +16 -16
- package/out/ui/packages/index.d.ts +0 -6
- package/out/ui/packages/init.luau +0 -18
- package/out/ui/packages/input/components/Input.d.ts +0 -1
- package/out/ui/packages/input/components/Input.luau +18 -21
- package/out/ui/packages/layout/components/Grid.d.ts +1 -5
- package/out/ui/packages/layout/components/Grid.luau +19 -41
- package/out/ui/packages/layout/components/List.luau +16 -9
- package/out/ui/packages/layout/components/Stack.d.ts +0 -2
- package/out/ui/packages/layout/components/Stack.luau +15 -10
- package/out/ui/packages/layout/components/Stack.styles.d.ts +0 -2
- package/out/ui/packages/layout/components/Stack.styles.luau +5 -34
- package/out/ui/packages/layout/components/stackAlign.d.ts +2 -4
- package/out/ui/packages/layout/components/stackAlign.luau +2 -16
- package/out/ui/packages/layout/index.d.ts +0 -11
- package/out/ui/packages/layout/init.luau +0 -4
- package/out/ui/packages/link/components/Link.luau +16 -13
- package/out/ui/packages/listItem/components/ListItem.d.ts +1 -4
- package/out/ui/packages/listItem/components/ListItem.luau +4 -44
- package/out/ui/packages/listItem/components/ListItem.styles.d.ts +0 -1
- package/out/ui/packages/listItem/components/ListItem.styles.luau +5 -16
- package/out/ui/packages/loadingStroke/components/LoadingStroke.d.ts +1 -5
- package/out/ui/packages/menu/components/Menu.d.ts +1 -4
- package/out/ui/packages/menu/components/Menu.luau +15 -32
- package/out/ui/packages/modal/components/Modal.d.ts +1 -2
- package/out/ui/packages/modal/components/Modal.luau +37 -79
- package/out/ui/packages/motion/index.d.ts +1 -1
- package/out/ui/packages/motion/init.luau +0 -1
- package/out/ui/packages/motion/unit.d.ts +0 -5
- package/out/ui/packages/motion/unit.luau +0 -23
- package/out/ui/packages/numberInput/components/NumberInput.d.ts +0 -2
- package/out/ui/packages/numberInput/components/NumberInput.luau +3 -16
- package/out/ui/packages/numberInput/components/numberValue.d.ts +0 -1
- package/out/ui/packages/numberInput/components/numberValue.luau +0 -45
- package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.luau +16 -12
- package/out/ui/packages/pagination/components/Pagination.d.ts +1 -6
- package/out/ui/packages/pagination/components/Pagination.luau +38 -62
- package/out/ui/packages/pagination/components/Pagination.styles.d.ts +1 -6
- package/out/ui/packages/pagination/components/Pagination.styles.luau +4 -36
- package/out/ui/packages/pagination/components/pageRange.d.ts +1 -2
- package/out/ui/packages/pagination/components/pageRange.luau +8 -91
- package/out/ui/packages/pagination/index.d.ts +0 -1
- package/out/ui/packages/pagination/init.luau +0 -1
- package/out/ui/packages/paper/components/Paper.d.ts +2 -4
- package/out/ui/packages/paper/components/Paper.luau +9 -31
- package/out/ui/packages/paper/components/Paper.styles.d.ts +1 -1
- package/out/ui/packages/paper/components/Paper.styles.luau +0 -6
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.luau +38 -63
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.styles.luau +7 -21
- package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.d.ts +0 -2
- package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.luau +0 -14
- package/out/ui/packages/popup/components/Popup.d.ts +1 -2
- package/out/ui/packages/popup/components/Popup.luau +18 -35
- package/out/ui/packages/popup/index.d.ts +0 -1
- package/out/ui/packages/popup/init.luau +0 -1
- package/out/ui/packages/preloader/components/Preloader.luau +16 -9
- package/out/ui/packages/progressBar/components/ProgressBar.luau +16 -12
- package/out/ui/packages/radioGroup/components/RadioGroup.d.ts +0 -1
- package/out/ui/packages/radioGroup/components/RadioGroup.luau +18 -16
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.d.ts +0 -1
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.luau +1 -4
- package/out/ui/packages/rating/components/Rating.d.ts +1 -3
- package/out/ui/packages/rating/components/Rating.luau +17 -19
- package/out/ui/packages/rating/components/Rating.styles.d.ts +0 -2
- package/out/ui/packages/rating/components/Rating.styles.luau +2 -7
- package/out/ui/packages/rayEditor/components/RayEditor.luau +16 -12
- package/out/ui/packages/rectEditor/components/RectEditor.luau +43 -86
- package/out/ui/packages/rectEditor/components/RectEditor.styles.luau +7 -30
- package/out/ui/packages/scroll/index.d.ts +0 -2
- package/out/ui/packages/scroll/init.luau +0 -1
- package/out/ui/packages/select/components/Select.luau +55 -15
- package/out/ui/packages/select/components/selectMotion.d.ts +2 -0
- package/out/ui/packages/select/components/selectMotion.luau +12 -0
- package/out/ui/packages/shadow/components/Shadow.d.ts +1 -2
- package/out/ui/packages/shadow/components/Shadow.luau +17 -39
- package/out/ui/packages/shadow/components/Shadow.styles.luau +2 -7
- package/out/ui/packages/sidebar/components/Sidebar.luau +16 -9
- package/out/ui/packages/skeleton/components/Skeleton.luau +28 -19
- package/out/ui/packages/skeleton/components/Skeleton.styles.luau +3 -7
- package/out/ui/packages/slider/components/Slider.d.ts +0 -3
- package/out/ui/packages/slider/components/Slider.luau +19 -47
- package/out/ui/packages/slider/components/Slider.styles.d.ts +0 -2
- package/out/ui/packages/slider/components/Slider.styles.luau +1 -14
- package/out/ui/packages/snackbar/components/Snackbar.d.ts +0 -2
- package/out/ui/packages/snackbar/components/Snackbar.luau +0 -5
- package/out/ui/packages/speedDial/components/SpeedDial.d.ts +0 -2
- package/out/ui/packages/speedDial/components/SpeedDial.luau +20 -25
- package/out/ui/packages/speedDial/components/SpeedDial.styles.d.ts +1 -4
- package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +4 -9
- package/out/ui/packages/speedDial/index.d.ts +0 -1
- package/out/ui/packages/splitPane/components/SplitPane.luau +17 -13
- package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
- package/out/ui/packages/stateMatrix.d.ts +0 -2
- package/out/ui/packages/stateMatrix.luau +997 -793
- package/out/ui/packages/stepper/components/Stepper.d.ts +0 -1
- package/out/ui/packages/stepper/components/Stepper.luau +17 -16
- package/out/ui/packages/stepper/components/Stepper.styles.d.ts +1 -3
- package/out/ui/packages/stepper/components/Stepper.styles.luau +2 -6
- package/out/ui/packages/switch/components/Switch.d.ts +0 -2
- package/out/ui/packages/switch/components/Switch.luau +16 -21
- package/out/ui/packages/switch/components/Switch.styles.d.ts +0 -2
- package/out/ui/packages/switch/components/Switch.styles.luau +1 -6
- package/out/ui/packages/switch/components/switchLook.d.ts +1 -1
- package/out/ui/packages/table/components/Table.d.ts +2 -16
- package/out/ui/packages/table/components/Table.luau +53 -136
- package/out/ui/packages/table/components/Table.styles.d.ts +1 -3
- package/out/ui/packages/table/components/Table.styles.luau +6 -10
- package/out/ui/packages/table/index.d.ts +1 -2
- package/out/ui/packages/tabs/components/Tabs.d.ts +0 -3
- package/out/ui/packages/tabs/components/Tabs.luau +19 -24
- package/out/ui/packages/tabs/components/Tabs.styles.d.ts +1 -5
- package/out/ui/packages/tabs/components/Tabs.styles.luau +10 -26
- package/out/ui/packages/tabs/index.d.ts +0 -1
- package/out/ui/packages/tabs/init.luau +0 -1
- package/out/ui/packages/toast/components/Toast.d.ts +0 -2
- package/out/ui/packages/toast/components/Toast.luau +13 -41
- package/out/ui/packages/toast/components/Toast.styles.luau +5 -23
- package/out/ui/packages/toggleButton/components/ToggleButton.d.ts +1 -5
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +33 -36
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.d.ts +0 -4
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +5 -16
- package/out/ui/packages/tooltip/components/Tooltip.luau +16 -9
- package/out/ui/packages/treeView/components/TreeView.luau +16 -9
- package/out/ui/packages/typography/components/Typography.luau +14 -13
- package/out/ui/packages/udimEditor/components/UDimEditor.luau +16 -12
- package/out/ui/packages/vectorEditor/components/VectorEditor.luau +16 -12
- package/out/ui/packages/virtualList/components/EmptyListHint.d.ts +1 -2
- package/out/ui/packages/virtualList/components/EmptyListHint.luau +4 -15
- package/out/ui/packages/virtualList/components/VirtualList.luau +16 -9
- package/package.json +2 -2
- package/out/hooks/viewportObserver.d.ts +0 -10
- package/out/hooks/viewportObserver.luau +0 -75
- package/out/theme/styles/utilities/resolveSx.d.ts +0 -120
- package/out/theme/styles/utilities/resolveSx.luau +0 -524
- package/out/ui/packages/backdrop/components/Backdrop.d.ts +0 -10
- package/out/ui/packages/backdrop/components/Backdrop.luau +0 -51
- package/out/ui/packages/backdrop/components/Backdrop.styles.d.ts +0 -4
- package/out/ui/packages/backdrop/components/Backdrop.styles.luau +0 -24
- package/out/ui/packages/backdrop/index.d.ts +0 -2
- package/out/ui/packages/backdrop/init.luau +0 -5
- package/out/ui/packages/dateRange/components/DateRangePicker.d.ts +0 -11
- package/out/ui/packages/dateRange/components/DateRangePicker.luau +0 -253
- package/out/ui/packages/dateRange/dateRangeValue.d.ts +0 -18
- package/out/ui/packages/dateRange/dateRangeValue.luau +0 -121
- package/out/ui/packages/dateRange/index.d.ts +0 -3
- package/out/ui/packages/dateRange/init.luau +0 -16
- package/out/ui/packages/divider/components/dividerLabel.d.ts +0 -1
- package/out/ui/packages/divider/components/dividerLabel.luau +0 -10
- package/out/ui/packages/host/components/SxHost.d.ts +0 -18
- package/out/ui/packages/host/components/SxHost.luau +0 -210
- package/out/ui/packages/host/hostPaint.d.ts +0 -12
- package/out/ui/packages/host/hostPaint.luau +0 -34
- package/out/ui/packages/host/hostRules.d.ts +0 -15
- package/out/ui/packages/host/hostRules.luau +0 -92
- package/out/ui/packages/host/index.d.ts +0 -3
- package/out/ui/packages/host/init.luau +0 -13
- package/out/ui/packages/imageList/components/ImageList.d.ts +0 -14
- package/out/ui/packages/imageList/components/ImageList.luau +0 -93
- package/out/ui/packages/imageList/components/ImageList.styles.d.ts +0 -6
- package/out/ui/packages/imageList/components/ImageList.styles.luau +0 -73
- package/out/ui/packages/imageList/components/imageListLayout.d.ts +0 -4
- package/out/ui/packages/imageList/components/imageListLayout.luau +0 -31
- package/out/ui/packages/imageList/index.d.ts +0 -2
- package/out/ui/packages/imageList/init.luau +0 -5
- package/out/ui/packages/layout/components/Box.d.ts +0 -11
- package/out/ui/packages/layout/components/Box.luau +0 -40
- package/out/ui/packages/layout/components/Box.styles.d.ts +0 -7
- package/out/ui/packages/layout/components/Box.styles.luau +0 -34
- package/out/ui/packages/layout/components/Container.d.ts +0 -10
- package/out/ui/packages/layout/components/Container.luau +0 -45
- package/out/ui/packages/layout/components/Container.styles.d.ts +0 -6
- package/out/ui/packages/layout/components/Container.styles.luau +0 -41
- package/out/ui/packages/layout/components/FlexItem.d.ts +0 -12
- package/out/ui/packages/layout/components/FlexItem.luau +0 -40
- package/out/ui/packages/layout/components/FlexItem.styles.d.ts +0 -8
- package/out/ui/packages/layout/components/FlexItem.styles.luau +0 -66
- package/out/ui/packages/layout/components/boxPad.d.ts +0 -14
- package/out/ui/packages/layout/components/boxPad.luau +0 -59
- package/out/ui/packages/layout/components/containerWidth.d.ts +0 -2
- package/out/ui/packages/layout/components/containerWidth.luau +0 -17
- package/out/ui/packages/layout/components/flexItemMode.d.ts +0 -6
- package/out/ui/packages/layout/components/flexItemMode.luau +0 -36
- package/out/ui/packages/layout/components/gridProps.d.ts +0 -3
- package/out/ui/packages/layout/components/gridProps.luau +0 -20
- package/out/ui/packages/loadingStroke/components/loadingStrokeSx.d.ts +0 -11
- package/out/ui/packages/loadingStroke/components/loadingStrokeSx.luau +0 -2
- package/out/ui/packages/markdown/components/Markdown.d.ts +0 -6
- package/out/ui/packages/markdown/components/Markdown.luau +0 -221
- package/out/ui/packages/markdown/components/Markdown.styles.d.ts +0 -2
- package/out/ui/packages/markdown/components/Markdown.styles.luau +0 -101
- package/out/ui/packages/markdown/components/MarkdownEditor.d.ts +0 -22
- package/out/ui/packages/markdown/components/MarkdownEditor.luau +0 -433
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.d.ts +0 -6
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.luau +0 -161
- package/out/ui/packages/markdown/components/markdownEditorHeight.d.ts +0 -1
- package/out/ui/packages/markdown/components/markdownEditorHeight.luau +0 -13
- package/out/ui/packages/markdown/htmlToMarkdown.d.ts +0 -2
- package/out/ui/packages/markdown/htmlToMarkdown.luau +0 -350
- package/out/ui/packages/markdown/index.d.ts +0 -8
- package/out/ui/packages/markdown/init.luau +0 -11
- package/out/ui/packages/markdown/parseMarkdown.d.ts +0 -42
- package/out/ui/packages/markdown/parseMarkdown.luau +0 -459
- package/out/ui/packages/reorder/index.d.ts +0 -2
- package/out/ui/packages/reorder/init.luau +0 -14
- package/out/ui/packages/reorder/reorder.d.ts +0 -24
- package/out/ui/packages/reorder/reorder.luau +0 -178
- package/out/ui/packages/reorder/useReorderDrag.d.ts +0 -15
- package/out/ui/packages/reorder/useReorderDrag.luau +0 -129
- package/out/ui/packages/scroll/components/ScrollView.d.ts +0 -7
- package/out/ui/packages/scroll/components/ScrollView.luau +0 -42
- package/out/ui/packages/skeleton/components/skeletonTone.d.ts +0 -20
- package/out/ui/packages/skeleton/components/skeletonTone.luau +0 -14
- package/out/ui/packages/slider/components/sliderMarks.d.ts +0 -1
- package/out/ui/packages/slider/components/sliderMarks.luau +0 -37
- package/out/ui/packages/snackbar/components/snackbarAction.d.ts +0 -1
- package/out/ui/packages/snackbar/components/snackbarAction.luau +0 -10
- package/out/ui/packages/sparkline/components/Sparkline.d.ts +0 -9
- package/out/ui/packages/sparkline/components/Sparkline.luau +0 -66
- package/out/ui/packages/sparkline/index.d.ts +0 -3
- package/out/ui/packages/sparkline/init.luau +0 -6
- package/out/ui/packages/sparkline/sparklineLayout.d.ts +0 -8
- package/out/ui/packages/sparkline/sparklineLayout.luau +0 -75
- package/out/ui/packages/table/components/tableColumns.d.ts +0 -26
- package/out/ui/packages/table/components/tableColumns.luau +0 -92
- package/out/ui/packages/tabs/components/tabsOrientation.d.ts +0 -2
- package/out/ui/packages/tabs/components/tabsOrientation.luau +0 -7
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local function trimEnd(value)
|
|
3
|
-
local stop = #value
|
|
4
|
-
while stop > 0 do
|
|
5
|
-
local _value = value
|
|
6
|
-
local _stop = stop
|
|
7
|
-
local _stop_1 = stop
|
|
8
|
-
local ch = string.sub(_value, _stop, _stop_1)
|
|
9
|
-
if ch ~= " " and ch ~= "\t" and ch ~= "\r" then
|
|
10
|
-
break
|
|
11
|
-
end
|
|
12
|
-
stop -= 1
|
|
13
|
-
end
|
|
14
|
-
local _value = value
|
|
15
|
-
local _stop = stop
|
|
16
|
-
return string.sub(_value, 1, _stop)
|
|
17
|
-
end
|
|
18
|
-
local function trim(value)
|
|
19
|
-
local start = 1
|
|
20
|
-
local stop = #value
|
|
21
|
-
while start <= stop do
|
|
22
|
-
local _value = value
|
|
23
|
-
local _start = start
|
|
24
|
-
local _start_1 = start
|
|
25
|
-
local ch = string.sub(_value, _start, _start_1)
|
|
26
|
-
if ch ~= " " and ch ~= "\t" and ch ~= "\r" then
|
|
27
|
-
break
|
|
28
|
-
end
|
|
29
|
-
start += 1
|
|
30
|
-
end
|
|
31
|
-
while stop >= start do
|
|
32
|
-
local _value = value
|
|
33
|
-
local _stop = stop
|
|
34
|
-
local _stop_1 = stop
|
|
35
|
-
local ch = string.sub(_value, _stop, _stop_1)
|
|
36
|
-
if ch ~= " " and ch ~= "\t" and ch ~= "\r" then
|
|
37
|
-
break
|
|
38
|
-
end
|
|
39
|
-
stop -= 1
|
|
40
|
-
end
|
|
41
|
-
if start > stop then
|
|
42
|
-
return ""
|
|
43
|
-
end
|
|
44
|
-
local _value = value
|
|
45
|
-
local _start = start
|
|
46
|
-
local _stop = stop
|
|
47
|
-
return string.sub(_value, _start, _stop)
|
|
48
|
-
end
|
|
49
|
-
local function headingLevel(line)
|
|
50
|
-
local n = 0
|
|
51
|
-
while true do
|
|
52
|
-
local _condition = n < #line and n < 6
|
|
53
|
-
if _condition then
|
|
54
|
-
local _line = line
|
|
55
|
-
local _arg0 = n + 1
|
|
56
|
-
local _arg1 = n + 1
|
|
57
|
-
_condition = string.sub(_line, _arg0, _arg1) == "#"
|
|
58
|
-
end
|
|
59
|
-
if not _condition then
|
|
60
|
-
break
|
|
61
|
-
end
|
|
62
|
-
n += 1
|
|
63
|
-
end
|
|
64
|
-
if n == 0 then
|
|
65
|
-
return nil
|
|
66
|
-
end
|
|
67
|
-
local _condition = n < #line
|
|
68
|
-
if _condition then
|
|
69
|
-
local _line = line
|
|
70
|
-
local _arg0 = n + 1
|
|
71
|
-
local _arg1 = n + 1
|
|
72
|
-
_condition = string.sub(_line, _arg0, _arg1) ~= " "
|
|
73
|
-
end
|
|
74
|
-
if _condition then
|
|
75
|
-
return nil
|
|
76
|
-
end
|
|
77
|
-
return n
|
|
78
|
-
end
|
|
79
|
-
local function parseInlines(source)
|
|
80
|
-
local out = {}
|
|
81
|
-
local i = 1
|
|
82
|
-
local n = #source
|
|
83
|
-
local buf = ""
|
|
84
|
-
local flush = function()
|
|
85
|
-
if #buf > 0 then
|
|
86
|
-
local _arg0 = {
|
|
87
|
-
kind = "text",
|
|
88
|
-
text = buf,
|
|
89
|
-
}
|
|
90
|
-
table.insert(out, _arg0)
|
|
91
|
-
buf = ""
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
while i <= n do
|
|
95
|
-
local _source = source
|
|
96
|
-
local _i = i
|
|
97
|
-
local _i_1 = i
|
|
98
|
-
local ch = string.sub(_source, _i, _i_1)
|
|
99
|
-
if ch == "`" then
|
|
100
|
-
local _source_1 = source
|
|
101
|
-
local _arg1 = i + 1
|
|
102
|
-
local close = { string.find(_source_1, "`", _arg1, true) }
|
|
103
|
-
local endAt = close[1]
|
|
104
|
-
if endAt ~= nil then
|
|
105
|
-
flush()
|
|
106
|
-
local _object = {
|
|
107
|
-
kind = "code",
|
|
108
|
-
}
|
|
109
|
-
local _left = "text"
|
|
110
|
-
local _source_2 = source
|
|
111
|
-
local _arg0 = i + 1
|
|
112
|
-
local _arg1_1 = endAt - 1
|
|
113
|
-
_object[_left] = string.sub(_source_2, _arg0, _arg1_1)
|
|
114
|
-
table.insert(out, _object)
|
|
115
|
-
i = endAt + 1
|
|
116
|
-
continue
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
if ch == "[" then
|
|
120
|
-
local _source_1 = source
|
|
121
|
-
local _arg1 = i + 1
|
|
122
|
-
local mid = { string.find(_source_1, "](", _arg1, true) }
|
|
123
|
-
local midAt = mid[1]
|
|
124
|
-
if midAt ~= nil then
|
|
125
|
-
local _source_2 = source
|
|
126
|
-
local _arg1_1 = midAt + 2
|
|
127
|
-
local closeParen = { string.find(_source_2, ")", _arg1_1, true) }
|
|
128
|
-
local endAt = closeParen[1]
|
|
129
|
-
if endAt ~= nil then
|
|
130
|
-
flush()
|
|
131
|
-
local _object = {
|
|
132
|
-
kind = "link",
|
|
133
|
-
}
|
|
134
|
-
local _left = "text"
|
|
135
|
-
local _source_3 = source
|
|
136
|
-
local _arg0 = i + 1
|
|
137
|
-
local _arg1_2 = midAt - 1
|
|
138
|
-
_object[_left] = string.sub(_source_3, _arg0, _arg1_2)
|
|
139
|
-
local _left_1 = "href"
|
|
140
|
-
local _source_4 = source
|
|
141
|
-
local _arg0_1 = midAt + 2
|
|
142
|
-
local _arg1_3 = endAt - 1
|
|
143
|
-
_object[_left_1] = string.sub(_source_4, _arg0_1, _arg1_3)
|
|
144
|
-
table.insert(out, _object)
|
|
145
|
-
i = endAt + 1
|
|
146
|
-
continue
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
end
|
|
150
|
-
local _condition = ch == "*" and i + 1 <= n
|
|
151
|
-
if _condition then
|
|
152
|
-
local _source_1 = source
|
|
153
|
-
local _arg0 = i + 1
|
|
154
|
-
local _arg1 = i + 1
|
|
155
|
-
_condition = string.sub(_source_1, _arg0, _arg1) == "*"
|
|
156
|
-
end
|
|
157
|
-
if _condition then
|
|
158
|
-
local _source_1 = source
|
|
159
|
-
local _arg1 = i + 2
|
|
160
|
-
local close = { string.find(_source_1, "**", _arg1, true) }
|
|
161
|
-
local endAt = close[1]
|
|
162
|
-
if endAt ~= nil then
|
|
163
|
-
flush()
|
|
164
|
-
local _object = {
|
|
165
|
-
kind = "bold",
|
|
166
|
-
}
|
|
167
|
-
local _left = "text"
|
|
168
|
-
local _source_2 = source
|
|
169
|
-
local _arg0 = i + 2
|
|
170
|
-
local _arg1_1 = endAt - 1
|
|
171
|
-
_object[_left] = string.sub(_source_2, _arg0, _arg1_1)
|
|
172
|
-
table.insert(out, _object)
|
|
173
|
-
i = endAt + 2
|
|
174
|
-
continue
|
|
175
|
-
end
|
|
176
|
-
end
|
|
177
|
-
local _condition_1 = ch == "*"
|
|
178
|
-
if _condition_1 then
|
|
179
|
-
local _condition_2 = i == 1
|
|
180
|
-
if not _condition_2 then
|
|
181
|
-
local _source_1 = source
|
|
182
|
-
local _arg0 = i - 1
|
|
183
|
-
local _arg1 = i - 1
|
|
184
|
-
_condition_2 = string.sub(_source_1, _arg0, _arg1) ~= "*"
|
|
185
|
-
end
|
|
186
|
-
_condition_1 = _condition_2
|
|
187
|
-
end
|
|
188
|
-
if _condition_1 then
|
|
189
|
-
local _source_1 = source
|
|
190
|
-
local _arg1 = i + 1
|
|
191
|
-
local close = { string.find(_source_1, "*", _arg1, true) }
|
|
192
|
-
local endAt = close[1]
|
|
193
|
-
local _condition_2 = endAt ~= nil
|
|
194
|
-
if _condition_2 then
|
|
195
|
-
local _source_2 = source
|
|
196
|
-
local _arg0 = endAt + 1
|
|
197
|
-
local _arg1_1 = endAt + 1
|
|
198
|
-
_condition_2 = string.sub(_source_2, _arg0, _arg1_1) ~= "*"
|
|
199
|
-
end
|
|
200
|
-
if _condition_2 then
|
|
201
|
-
flush()
|
|
202
|
-
local _object = {
|
|
203
|
-
kind = "italic",
|
|
204
|
-
}
|
|
205
|
-
local _left = "text"
|
|
206
|
-
local _source_2 = source
|
|
207
|
-
local _arg0 = i + 1
|
|
208
|
-
local _arg1_1 = endAt - 1
|
|
209
|
-
_object[_left] = string.sub(_source_2, _arg0, _arg1_1)
|
|
210
|
-
table.insert(out, _object)
|
|
211
|
-
i = endAt + 1
|
|
212
|
-
continue
|
|
213
|
-
end
|
|
214
|
-
end
|
|
215
|
-
buf = `{buf}{ch}`
|
|
216
|
-
i += 1
|
|
217
|
-
end
|
|
218
|
-
flush()
|
|
219
|
-
return if #out > 0 then out else { {
|
|
220
|
-
kind = "text",
|
|
221
|
-
text = "",
|
|
222
|
-
} }
|
|
223
|
-
end
|
|
224
|
-
local function isHr(line)
|
|
225
|
-
local t = trim(line)
|
|
226
|
-
if #t < 3 then
|
|
227
|
-
return false
|
|
228
|
-
end
|
|
229
|
-
local ch = string.sub(t, 1, 1)
|
|
230
|
-
if ch ~= "-" and ch ~= "*" and ch ~= "_" then
|
|
231
|
-
return false
|
|
232
|
-
end
|
|
233
|
-
for i = 1, #t do
|
|
234
|
-
local _i = i
|
|
235
|
-
local _i_1 = i
|
|
236
|
-
local c = string.sub(t, _i, _i_1)
|
|
237
|
-
if c ~= ch and c ~= " " then
|
|
238
|
-
return false
|
|
239
|
-
end
|
|
240
|
-
end
|
|
241
|
-
return true
|
|
242
|
-
end
|
|
243
|
-
local function listMarker(line)
|
|
244
|
-
local t = trim(line)
|
|
245
|
-
if #t >= 2 and (string.sub(t, 1, 2) == "- " or string.sub(t, 1, 2) == "* ") then
|
|
246
|
-
return {
|
|
247
|
-
ordered = false,
|
|
248
|
-
rest = string.sub(t, 3),
|
|
249
|
-
}
|
|
250
|
-
end
|
|
251
|
-
local i = 1
|
|
252
|
-
while i <= #t do
|
|
253
|
-
local _i = i
|
|
254
|
-
local _i_1 = i
|
|
255
|
-
local c = string.sub(t, _i, _i_1)
|
|
256
|
-
if c < "0" or c > "9" then
|
|
257
|
-
break
|
|
258
|
-
end
|
|
259
|
-
i += 1
|
|
260
|
-
end
|
|
261
|
-
local _condition = i > 1 and i + 1 <= #t
|
|
262
|
-
if _condition then
|
|
263
|
-
local _i = i
|
|
264
|
-
local _arg1 = i + 1
|
|
265
|
-
_condition = string.sub(t, _i, _arg1) == ". "
|
|
266
|
-
end
|
|
267
|
-
if _condition then
|
|
268
|
-
local _object = {
|
|
269
|
-
ordered = true,
|
|
270
|
-
}
|
|
271
|
-
local _left = "rest"
|
|
272
|
-
local _arg0 = i + 2
|
|
273
|
-
_object[_left] = string.sub(t, _arg0)
|
|
274
|
-
return _object
|
|
275
|
-
end
|
|
276
|
-
return nil
|
|
277
|
-
end
|
|
278
|
-
--* Small markdown subset → blocks. Unsupported syntax stays plain text.
|
|
279
|
-
local function parseMarkdown(source)
|
|
280
|
-
local lines = string.split(source, "\n")
|
|
281
|
-
local blocks = {}
|
|
282
|
-
local i = 0
|
|
283
|
-
while i < #lines do
|
|
284
|
-
local raw = lines[i + 1]
|
|
285
|
-
local line = trimEnd(raw)
|
|
286
|
-
if trim(line) == "" then
|
|
287
|
-
i += 1
|
|
288
|
-
continue
|
|
289
|
-
end
|
|
290
|
-
if #line >= 3 and string.sub(line, 1, 3) == "```" then
|
|
291
|
-
local body = {}
|
|
292
|
-
i += 1
|
|
293
|
-
while i < #lines and not (#lines[i + 1] >= 3 and string.sub(trim(lines[i + 1]), 1, 3) == "```") do
|
|
294
|
-
local _arg0 = lines[i + 1]
|
|
295
|
-
table.insert(body, _arg0)
|
|
296
|
-
i += 1
|
|
297
|
-
end
|
|
298
|
-
if i < #lines then
|
|
299
|
-
i += 1
|
|
300
|
-
end
|
|
301
|
-
local _arg0 = {
|
|
302
|
-
kind = "code",
|
|
303
|
-
text = table.concat(body, "\n"),
|
|
304
|
-
}
|
|
305
|
-
table.insert(blocks, _arg0)
|
|
306
|
-
continue
|
|
307
|
-
end
|
|
308
|
-
if isHr(line) then
|
|
309
|
-
table.insert(blocks, {
|
|
310
|
-
kind = "hr",
|
|
311
|
-
})
|
|
312
|
-
i += 1
|
|
313
|
-
continue
|
|
314
|
-
end
|
|
315
|
-
local level = headingLevel(line)
|
|
316
|
-
if level ~= nil then
|
|
317
|
-
local _object = {
|
|
318
|
-
kind = "heading",
|
|
319
|
-
level = level,
|
|
320
|
-
}
|
|
321
|
-
local _left = "inlines"
|
|
322
|
-
local _arg0 = level + 1
|
|
323
|
-
_object[_left] = parseInlines(trim(string.sub(line, _arg0)))
|
|
324
|
-
table.insert(blocks, _object)
|
|
325
|
-
i += 1
|
|
326
|
-
continue
|
|
327
|
-
end
|
|
328
|
-
if string.sub(line, 1, 1) == ">" and (#line == 1 or string.sub(line, 2, 2) == " ") then
|
|
329
|
-
local parts = {}
|
|
330
|
-
while i < #lines do
|
|
331
|
-
local cur = trimEnd(lines[i + 1])
|
|
332
|
-
if not (string.sub(cur, 1, 1) == ">" and (#cur == 1 or string.sub(cur, 2, 2) == " ")) then
|
|
333
|
-
break
|
|
334
|
-
end
|
|
335
|
-
local _arg0 = if #cur >= 2 then string.sub(cur, 3) else ""
|
|
336
|
-
table.insert(parts, _arg0)
|
|
337
|
-
i += 1
|
|
338
|
-
end
|
|
339
|
-
local _arg0 = {
|
|
340
|
-
kind = "blockquote",
|
|
341
|
-
inlines = parseInlines(table.concat(parts, " ")),
|
|
342
|
-
}
|
|
343
|
-
table.insert(blocks, _arg0)
|
|
344
|
-
continue
|
|
345
|
-
end
|
|
346
|
-
local marker = listMarker(line)
|
|
347
|
-
if marker ~= nil then
|
|
348
|
-
local ordered = marker.ordered
|
|
349
|
-
local items = { parseInlines(marker.rest) }
|
|
350
|
-
i += 1
|
|
351
|
-
while i < #lines do
|
|
352
|
-
local following = listMarker(trimEnd(lines[i + 1]))
|
|
353
|
-
if following == nil or following.ordered ~= ordered then
|
|
354
|
-
break
|
|
355
|
-
end
|
|
356
|
-
local _arg0 = parseInlines(following.rest)
|
|
357
|
-
table.insert(items, _arg0)
|
|
358
|
-
i += 1
|
|
359
|
-
end
|
|
360
|
-
local _arg0 = {
|
|
361
|
-
kind = "list",
|
|
362
|
-
ordered = ordered,
|
|
363
|
-
items = items,
|
|
364
|
-
}
|
|
365
|
-
table.insert(blocks, _arg0)
|
|
366
|
-
continue
|
|
367
|
-
end
|
|
368
|
-
local para = { line }
|
|
369
|
-
i += 1
|
|
370
|
-
while i < #lines do
|
|
371
|
-
local cur = trimEnd(lines[i + 1])
|
|
372
|
-
if trim(cur) == "" then
|
|
373
|
-
break
|
|
374
|
-
end
|
|
375
|
-
if #cur >= 3 and string.sub(cur, 1, 3) == "```" then
|
|
376
|
-
break
|
|
377
|
-
end
|
|
378
|
-
if isHr(cur) then
|
|
379
|
-
break
|
|
380
|
-
end
|
|
381
|
-
if headingLevel(cur) ~= nil then
|
|
382
|
-
break
|
|
383
|
-
end
|
|
384
|
-
if string.sub(cur, 1, 1) == ">" and (#cur == 1 or string.sub(cur, 2, 2) == " ") then
|
|
385
|
-
break
|
|
386
|
-
end
|
|
387
|
-
if listMarker(cur) ~= nil then
|
|
388
|
-
break
|
|
389
|
-
end
|
|
390
|
-
-- two trailing spaces = hard break
|
|
391
|
-
local prev = para[#para]
|
|
392
|
-
local _condition = #prev >= 2
|
|
393
|
-
if _condition then
|
|
394
|
-
local _arg0 = #prev - 1
|
|
395
|
-
_condition = string.sub(prev, _arg0) == " "
|
|
396
|
-
end
|
|
397
|
-
if _condition then
|
|
398
|
-
local _arg1 = #prev - 2
|
|
399
|
-
para[#para] = trimEnd(string.sub(prev, 1, _arg1))
|
|
400
|
-
table.insert(para, cur)
|
|
401
|
-
else
|
|
402
|
-
para[#para] = `{prev} {cur}`
|
|
403
|
-
end
|
|
404
|
-
i += 1
|
|
405
|
-
end
|
|
406
|
-
local _arg0 = {
|
|
407
|
-
kind = "paragraph",
|
|
408
|
-
inlines = parseInlines(table.concat(para, "\n")),
|
|
409
|
-
}
|
|
410
|
-
table.insert(blocks, _arg0)
|
|
411
|
-
end
|
|
412
|
-
return blocks
|
|
413
|
-
end
|
|
414
|
-
local function inlinesToPlain(inlines)
|
|
415
|
-
local out = ""
|
|
416
|
-
for _, part in inlines do
|
|
417
|
-
if part.kind == "link" then
|
|
418
|
-
out = `{out}{part.text}`
|
|
419
|
-
else
|
|
420
|
-
out = `{out}{part.text}`
|
|
421
|
-
end
|
|
422
|
-
end
|
|
423
|
-
return out
|
|
424
|
-
end
|
|
425
|
-
local function escapeRich(text)
|
|
426
|
-
local out = text
|
|
427
|
-
for _, _binding in { { "&", "&" }, { "<", "<" }, { ">", ">" } } do
|
|
428
|
-
local from = _binding[1]
|
|
429
|
-
local to = _binding[2]
|
|
430
|
-
local replaced = string.gsub(out, from, to)
|
|
431
|
-
out = replaced
|
|
432
|
-
end
|
|
433
|
-
return out
|
|
434
|
-
end
|
|
435
|
-
--* Turn inline nodes into Roblox RichText. Links become colored label + (url).
|
|
436
|
-
local function inlinesToRichText(inlines)
|
|
437
|
-
local out = ""
|
|
438
|
-
for _, part in inlines do
|
|
439
|
-
if part.kind == "text" then
|
|
440
|
-
local chunk = escapeRich(part.text)
|
|
441
|
-
local withBreaks = string.gsub(chunk, "\n", "<br/>")
|
|
442
|
-
out = `{out}{withBreaks}`
|
|
443
|
-
elseif part.kind == "bold" then
|
|
444
|
-
out = `{out}<b>{escapeRich(part.text)}</b>`
|
|
445
|
-
elseif part.kind == "italic" then
|
|
446
|
-
out = `{out}<i>{escapeRich(part.text)}</i>`
|
|
447
|
-
elseif part.kind == "code" then
|
|
448
|
-
out = `{out}<font face="RobotoMono">{escapeRich(part.text)}</font>`
|
|
449
|
-
elseif part.kind == "link" then
|
|
450
|
-
out = `{out}<font color="#4C9AFF">{escapeRich(part.text)}</font> ({escapeRich(part.href)})`
|
|
451
|
-
end
|
|
452
|
-
end
|
|
453
|
-
return out
|
|
454
|
-
end
|
|
455
|
-
return {
|
|
456
|
-
parseMarkdown = parseMarkdown,
|
|
457
|
-
inlinesToPlain = inlinesToPlain,
|
|
458
|
-
inlinesToRichText = inlinesToRichText,
|
|
459
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local exports = {}
|
|
4
|
-
local _reorder = TS.import(script, script, "reorder")
|
|
5
|
-
exports.hitRect = _reorder.hitRect
|
|
6
|
-
exports.isReorderMove = _reorder.isReorderMove
|
|
7
|
-
exports.isReorderPress = _reorder.isReorderPress
|
|
8
|
-
exports.isReorderRelease = _reorder.isReorderRelease
|
|
9
|
-
exports.passedDragThreshold = _reorder.passedDragThreshold
|
|
10
|
-
exports.placeItem = _reorder.placeItem
|
|
11
|
-
exports.REORDER_THRESHOLD = _reorder.REORDER_THRESHOLD
|
|
12
|
-
exports.transferId = _reorder.transferId
|
|
13
|
-
exports.useReorderDrag = TS.import(script, script, "useReorderDrag").useReorderDrag
|
|
14
|
-
return exports
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare const REORDER_THRESHOLD = 6;
|
|
2
|
-
export interface DragRect {
|
|
3
|
-
id: string;
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
}
|
|
9
|
-
export declare function isReorderPress(kind: Enum.UserInputType): boolean;
|
|
10
|
-
export declare function isReorderMove(kind: Enum.UserInputType): boolean;
|
|
11
|
-
export declare function isReorderRelease(kind: Enum.UserInputType): boolean;
|
|
12
|
-
export declare function passedDragThreshold(startX: number, startY: number, x: number, y: number, threshold?: number): boolean;
|
|
13
|
-
/** Smallest rect containing the point wins, so a card beats the column behind it. */
|
|
14
|
-
export declare function hitRect(rects: readonly DragRect[], x: number, y: number): string | undefined;
|
|
15
|
-
/** Final index after the move. Out-of-range or a no-op returns a copy. */
|
|
16
|
-
export declare function placeItem<T extends defined>(items: readonly T[], from: number, to: number): T[];
|
|
17
|
-
/**
|
|
18
|
-
* Insert `id` at `index` in `dest` and remove it from `source`.
|
|
19
|
-
* The same list uses placeItem, where index is the final index.
|
|
20
|
-
*/
|
|
21
|
-
export declare function transferId(source: readonly string[], dest: readonly string[], id: string, index: number): {
|
|
22
|
-
source: string[];
|
|
23
|
-
dest: string[];
|
|
24
|
-
};
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local REORDER_THRESHOLD = 6
|
|
3
|
-
local function isReorderPress(kind)
|
|
4
|
-
return kind == Enum.UserInputType.MouseButton1 or kind == Enum.UserInputType.Touch
|
|
5
|
-
end
|
|
6
|
-
local function isReorderMove(kind)
|
|
7
|
-
return kind == Enum.UserInputType.MouseMovement or kind == Enum.UserInputType.Touch
|
|
8
|
-
end
|
|
9
|
-
local function isReorderRelease(kind)
|
|
10
|
-
return kind == Enum.UserInputType.MouseButton1 or kind == Enum.UserInputType.Touch
|
|
11
|
-
end
|
|
12
|
-
local function passedDragThreshold(startX, startY, x, y, threshold)
|
|
13
|
-
if threshold == nil then
|
|
14
|
-
threshold = REORDER_THRESHOLD
|
|
15
|
-
end
|
|
16
|
-
local dx = x - startX
|
|
17
|
-
local dy = y - startY
|
|
18
|
-
return dx * dx + dy * dy >= threshold * threshold
|
|
19
|
-
end
|
|
20
|
-
--* Smallest rect containing the point wins, so a card beats the column behind it.
|
|
21
|
-
local function hitRect(rects, x, y)
|
|
22
|
-
local best
|
|
23
|
-
local bestArea = math.huge
|
|
24
|
-
for _, rect in rects do
|
|
25
|
-
if x < rect.x or y < rect.y or x > rect.x + rect.width or y > rect.y + rect.height then
|
|
26
|
-
continue
|
|
27
|
-
end
|
|
28
|
-
local area = rect.width * rect.height
|
|
29
|
-
if area < bestArea then
|
|
30
|
-
best = rect
|
|
31
|
-
bestArea = area
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
local _result = best
|
|
35
|
-
if _result ~= nil then
|
|
36
|
-
_result = _result.id
|
|
37
|
-
end
|
|
38
|
-
return _result
|
|
39
|
-
end
|
|
40
|
-
--* Final index after the move. Out-of-range or a no-op returns a copy.
|
|
41
|
-
local function placeItem(items, from, to)
|
|
42
|
-
local listed = {}
|
|
43
|
-
for _, item in items do
|
|
44
|
-
table.insert(listed, item)
|
|
45
|
-
end
|
|
46
|
-
local count = #listed
|
|
47
|
-
if from < 0 or to < 0 or from >= count or to >= count or from == to then
|
|
48
|
-
return listed
|
|
49
|
-
end
|
|
50
|
-
local moved = listed[from + 1]
|
|
51
|
-
if from < to then
|
|
52
|
-
do
|
|
53
|
-
local index = from
|
|
54
|
-
local _shouldIncrement = false
|
|
55
|
-
while true do
|
|
56
|
-
if _shouldIncrement then
|
|
57
|
-
index += 1
|
|
58
|
-
else
|
|
59
|
-
_shouldIncrement = true
|
|
60
|
-
end
|
|
61
|
-
if not (index < to) then
|
|
62
|
-
break
|
|
63
|
-
end
|
|
64
|
-
listed[index + 1] = listed[index + 2]
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
else
|
|
68
|
-
do
|
|
69
|
-
local index = from
|
|
70
|
-
local _shouldIncrement = false
|
|
71
|
-
while true do
|
|
72
|
-
if _shouldIncrement then
|
|
73
|
-
index -= 1
|
|
74
|
-
else
|
|
75
|
-
_shouldIncrement = true
|
|
76
|
-
end
|
|
77
|
-
if not (index > to) then
|
|
78
|
-
break
|
|
79
|
-
end
|
|
80
|
-
listed[index + 1] = listed[index]
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
listed[to + 1] = moved
|
|
85
|
-
return listed
|
|
86
|
-
end
|
|
87
|
-
local function indexOfId(ids, id)
|
|
88
|
-
for index = 0, #ids - 1 do
|
|
89
|
-
if ids[index + 1] == id then
|
|
90
|
-
return index
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
return -1
|
|
94
|
-
end
|
|
95
|
-
--[[
|
|
96
|
-
*
|
|
97
|
-
* Insert `id` at `index` in `dest` and remove it from `source`.
|
|
98
|
-
* The same list uses placeItem, where index is the final index.
|
|
99
|
-
|
|
100
|
-
]]
|
|
101
|
-
local function transferId(source, dest, id, index)
|
|
102
|
-
if source == dest then
|
|
103
|
-
local placed = placeItem(source, indexOfId(source, id), math.clamp(index, 0, math.max(0, #source - 1)))
|
|
104
|
-
return {
|
|
105
|
-
source = placed,
|
|
106
|
-
dest = placed,
|
|
107
|
-
}
|
|
108
|
-
end
|
|
109
|
-
local nextSource = {}
|
|
110
|
-
local found = false
|
|
111
|
-
for _, item in source do
|
|
112
|
-
if item == id then
|
|
113
|
-
found = true
|
|
114
|
-
else
|
|
115
|
-
table.insert(nextSource, item)
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
local nextDest = {}
|
|
119
|
-
for _, item in dest do
|
|
120
|
-
table.insert(nextDest, item)
|
|
121
|
-
end
|
|
122
|
-
if not found then
|
|
123
|
-
return {
|
|
124
|
-
source = nextSource,
|
|
125
|
-
dest = nextDest,
|
|
126
|
-
}
|
|
127
|
-
end
|
|
128
|
-
local at = math.clamp(math.floor(index), 0, #nextDest)
|
|
129
|
-
local inserted = {}
|
|
130
|
-
do
|
|
131
|
-
local cursor = 0
|
|
132
|
-
local _shouldIncrement = false
|
|
133
|
-
while true do
|
|
134
|
-
if _shouldIncrement then
|
|
135
|
-
cursor += 1
|
|
136
|
-
else
|
|
137
|
-
_shouldIncrement = true
|
|
138
|
-
end
|
|
139
|
-
if not (cursor < at) then
|
|
140
|
-
break
|
|
141
|
-
end
|
|
142
|
-
local _arg0 = nextDest[cursor + 1]
|
|
143
|
-
table.insert(inserted, _arg0)
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
local _id = id
|
|
147
|
-
table.insert(inserted, _id)
|
|
148
|
-
do
|
|
149
|
-
local cursor = at
|
|
150
|
-
local _shouldIncrement = false
|
|
151
|
-
while true do
|
|
152
|
-
if _shouldIncrement then
|
|
153
|
-
cursor += 1
|
|
154
|
-
else
|
|
155
|
-
_shouldIncrement = true
|
|
156
|
-
end
|
|
157
|
-
if not (cursor < #nextDest) then
|
|
158
|
-
break
|
|
159
|
-
end
|
|
160
|
-
local _arg0 = nextDest[cursor + 1]
|
|
161
|
-
table.insert(inserted, _arg0)
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
return {
|
|
165
|
-
source = nextSource,
|
|
166
|
-
dest = inserted,
|
|
167
|
-
}
|
|
168
|
-
end
|
|
169
|
-
return {
|
|
170
|
-
isReorderPress = isReorderPress,
|
|
171
|
-
isReorderMove = isReorderMove,
|
|
172
|
-
isReorderRelease = isReorderRelease,
|
|
173
|
-
passedDragThreshold = passedDragThreshold,
|
|
174
|
-
hitRect = hitRect,
|
|
175
|
-
placeItem = placeItem,
|
|
176
|
-
transferId = transferId,
|
|
177
|
-
REORDER_THRESHOLD = REORDER_THRESHOLD,
|
|
178
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DragRect } from "./reorder";
|
|
2
|
-
export interface ReorderDragState {
|
|
3
|
-
active: boolean;
|
|
4
|
-
id?: string;
|
|
5
|
-
overId?: string;
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
}
|
|
9
|
-
export interface ReorderDragHandle {
|
|
10
|
-
drag: ReorderDragState;
|
|
11
|
-
begin: (id: string, input: InputObject) => boolean;
|
|
12
|
-
cancel: () => void;
|
|
13
|
-
suppressClick: () => boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare function useReorderDrag(onDrop: (fromId: string, overId?: string) => void, getRects: () => readonly DragRect[]): ReorderDragHandle;
|