@rbxts/uiblox 0.2.0-alpha.37 → 0.2.0-alpha.38
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 +1 -18
- package/out/theme/constants/NumberConstants.d.ts +10 -0
- package/out/theme/constants/NumberConstants.luau +12 -0
- package/out/theme/interfaces/density/controlMetrics.luau +2 -2
- package/out/theme/interfaces/palette/Palette.d.ts +7 -0
- package/out/theme/interfaces/spacing/Shape.d.ts +6 -0
- package/out/theme/interfaces/theme/Theme.d.ts +6 -0
- package/out/theme/interfaces/typography/FontFamilies.luau +1 -0
- package/out/theme/interfaces/typography/FontFamilyOptions.d.ts +1 -1
- package/out/theme/interfaces/typography/FontSizeOptions.d.ts +1 -1
- package/out/theme/interfaces/typography/FontSizes.luau +2 -0
- package/out/theme/interfaces/typography/Variants.d.ts +3 -1
- package/out/theme/interfaces/typography/Variants.luau +25 -1
- package/out/theme/styles/utilities/focusRing.d.ts +2 -0
- package/out/theme/styles/utilities/focusRing.luau +3 -0
- package/out/theme/styles/utilities/index.d.ts +1 -1
- package/out/theme/styles/utilities/init.luau +3 -1
- package/out/theme/themes/DarkTheme.luau +4 -0
- package/out/theme/themes/LightTheme.luau +4 -0
- package/out/theme/themes/createPalette.luau +15 -0
- package/out/ui/packages/accordion/components/Accordion.luau +84 -40
- package/out/ui/packages/accordion/components/Accordion.styles.luau +35 -17
- package/out/ui/packages/alert/components/Alert.luau +15 -11
- package/out/ui/packages/alert/components/Alert.styles.luau +37 -26
- package/out/ui/packages/appBar/components/AppBar.luau +35 -13
- package/out/ui/packages/appBar/components/AppBar.styles.luau +41 -35
- package/out/ui/packages/autocomplete/components/Autocomplete.luau +4 -0
- package/out/ui/packages/avatar/components/Avatar.d.ts +2 -0
- package/out/ui/packages/avatar/components/Avatar.luau +9 -2
- package/out/ui/packages/avatar/components/Avatar.styles.luau +7 -0
- package/out/ui/packages/avatarGroup/components/AvatarGroup.luau +9 -4
- package/out/ui/packages/avatarGroup/components/AvatarGroup.styles.luau +6 -1
- package/out/ui/packages/badge/components/Badge.luau +14 -11
- package/out/ui/packages/badge/components/Badge.styles.luau +5 -1
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +4 -3
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +6 -2
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.styles.luau +4 -0
- package/out/ui/packages/brickColorPicker/components/BrickColorPicker.luau +20 -2
- package/out/ui/packages/brickColorPicker/components/BrickColorPicker.styles.luau +72 -66
- package/out/ui/packages/button/components/Button.luau +61 -34
- package/out/ui/packages/button/components/buttonPaint.d.ts +16 -0
- package/out/ui/packages/button/components/buttonPaint.luau +70 -0
- package/out/ui/packages/buttonGroup/components/ButtonGroup.d.ts +1 -0
- package/out/ui/packages/buttonGroup/components/ButtonGroup.luau +17 -2
- package/out/ui/packages/card/components/Card.styles.luau +4 -2
- package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +9 -1
- package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +50 -41
- package/out/ui/packages/checkbox/components/Checkbox.luau +5 -4
- package/out/ui/packages/checkbox/components/checkboxLook.d.ts +2 -2
- package/out/ui/packages/checkbox/components/checkboxLook.luau +2 -2
- package/out/ui/packages/chip/components/Chip.luau +16 -14
- package/out/ui/packages/chip/components/Chip.styles.luau +7 -4
- package/out/ui/packages/circularProgress/components/CircularProgress.luau +10 -3
- package/out/ui/packages/codeEditor/components/CodeEditor.d.ts +12 -0
- package/out/ui/packages/codeEditor/components/CodeEditor.luau +262 -0
- package/out/ui/packages/codeEditor/components/CodeEditor.styles.d.ts +6 -0
- package/out/ui/packages/codeEditor/components/CodeEditor.styles.luau +124 -0
- package/out/ui/packages/codeEditor/highlightCode.d.ts +11 -0
- package/out/ui/packages/codeEditor/highlightCode.luau +503 -0
- package/out/ui/packages/codeEditor/index.d.ts +2 -0
- package/out/ui/packages/codeEditor/init.luau +5 -0
- package/out/ui/packages/colorPicker/components/ColorPicker.luau +9 -1
- package/out/ui/packages/colorPicker/components/ColorPicker.styles.luau +74 -67
- package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +12 -4
- package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +12 -4
- package/out/ui/packages/dateRange/components/DateRangePicker.luau +31 -19
- package/out/ui/packages/dialog/components/Dialog.styles.luau +4 -2
- package/out/ui/packages/divider/components/Divider.luau +3 -1
- package/out/ui/packages/divider/components/Divider.styles.luau +1 -0
- package/out/ui/packages/drawer/components/Drawer.d.ts +1 -0
- package/out/ui/packages/drawer/components/Drawer.luau +43 -14
- package/out/ui/packages/drawer/components/Drawer.styles.luau +13 -5
- package/out/ui/packages/drawer/components/drawerPlacement.d.ts +2 -0
- package/out/ui/packages/drawer/components/drawerPlacement.luau +18 -0
- package/out/ui/packages/editorFace.d.ts +22 -0
- package/out/ui/packages/editorFace.luau +49 -0
- package/out/ui/packages/fab/components/Fab.luau +19 -6
- package/out/ui/packages/fab/components/Fab.styles.luau +4 -3
- package/out/ui/packages/fab/components/fabSize.d.ts +1 -1
- package/out/ui/packages/fontEditor/components/FontEditor.luau +13 -3
- package/out/ui/packages/fontEditor/components/FontEditor.styles.luau +36 -27
- package/out/ui/packages/gradientEditor/components/GradientEditor.luau +21 -13
- package/out/ui/packages/gradientEditor/components/GradientEditor.styles.luau +52 -44
- package/out/ui/packages/icon/components/DrawnGlyph.d.ts +11 -0
- package/out/ui/packages/icon/components/DrawnGlyph.luau +87 -0
- package/out/ui/packages/icon/components/Icon.d.ts +6 -2
- package/out/ui/packages/icon/components/Icon.luau +23 -3
- package/out/ui/packages/icon/components/Icon.styles.luau +3 -0
- package/out/ui/packages/icon/components/glyphs.d.ts +28 -0
- package/out/ui/packages/icon/components/glyphs.luau +64 -0
- package/out/ui/packages/icon/index.d.ts +1 -0
- package/out/ui/packages/iconButton/components/IconButton.d.ts +5 -2
- package/out/ui/packages/iconButton/components/IconButton.luau +83 -16
- package/out/ui/packages/iconButton/components/IconButton.styles.luau +4 -27
- package/out/ui/packages/iconButton/components/iconButtonBox.d.ts +11 -0
- package/out/ui/packages/iconButton/components/iconButtonBox.luau +48 -0
- package/out/ui/packages/iconButton/components/transportGlyph.d.ts +1 -0
- package/out/ui/packages/iconButton/components/transportGlyph.luau +4 -0
- package/out/ui/packages/imageList/components/ImageList.luau +11 -36
- package/out/ui/packages/imageList/components/ImageList.styles.luau +1 -0
- package/out/ui/packages/imageList/components/imageListLayout.d.ts +0 -2
- package/out/ui/packages/imageList/components/imageListLayout.luau +0 -8
- package/out/ui/packages/index.d.ts +1 -0
- package/out/ui/packages/init.luau +3 -0
- package/out/ui/packages/input/components/Input.luau +46 -29
- package/out/ui/packages/input/components/Input.styles.luau +8 -11
- package/out/ui/packages/input/components/fieldChrome.d.ts +5 -0
- package/out/ui/packages/input/components/fieldChrome.luau +11 -0
- package/out/ui/packages/layout/components/Box.luau +92 -13
- package/out/ui/packages/layout/components/Box.styles.d.ts +0 -2
- package/out/ui/packages/layout/components/Box.styles.luau +0 -9
- package/out/ui/packages/layout/components/Grid.luau +81 -16
- package/out/ui/packages/layout/components/Pad.d.ts +24 -0
- package/out/ui/packages/layout/components/Pad.luau +88 -0
- package/out/ui/packages/layout/components/Stack.luau +79 -13
- package/out/ui/packages/link/components/Link.luau +19 -13
- package/out/ui/packages/link/components/Link.styles.luau +10 -1
- package/out/ui/packages/listItem/components/ListItem.luau +61 -4
- package/out/ui/packages/listItem/components/ListItem.styles.d.ts +1 -0
- package/out/ui/packages/listItem/components/ListItem.styles.luau +28 -11
- package/out/ui/packages/listItem/components/listItemInk.d.ts +1 -1
- package/out/ui/packages/listItem/components/listItemLayout.d.ts +12 -2
- package/out/ui/packages/listItem/components/listItemLayout.luau +29 -2
- package/out/ui/packages/markdown/components/Markdown.luau +163 -50
- package/out/ui/packages/markdown/components/Markdown.styles.luau +125 -76
- package/out/ui/packages/markdown/components/MarkdownEditor.luau +215 -146
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.d.ts +1 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.luau +153 -83
- package/out/ui/packages/markdown/index.d.ts +1 -1
- package/out/ui/packages/markdown/parseMarkdown.d.ts +9 -1
- package/out/ui/packages/markdown/parseMarkdown.luau +350 -29
- package/out/ui/packages/menu/components/Menu.d.ts +1 -1
- package/out/ui/packages/menu/components/Menu.luau +12 -11
- package/out/ui/packages/menu/components/Menu.styles.luau +6 -1
- package/out/ui/packages/menu/components/menuIcon.d.ts +1 -1
- package/out/ui/packages/numberInput/components/NumberInput.luau +19 -4
- package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.luau +9 -1
- package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.styles.luau +23 -16
- package/out/ui/packages/pager/components/Pager.luau +15 -13
- package/out/ui/packages/pager/components/Pager.styles.luau +5 -0
- package/out/ui/packages/pagination/components/Pagination.styles.luau +4 -1
- package/out/ui/packages/paper/components/Paper.luau +17 -11
- package/out/ui/packages/paper/components/Paper.styles.luau +12 -5
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.luau +9 -1
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.styles.luau +24 -19
- package/out/ui/packages/popover/components/Popover.d.ts +1 -1
- package/out/ui/packages/popover/components/Popover.luau +6 -4
- package/out/ui/packages/popover/components/Popover.styles.luau +6 -0
- package/out/ui/packages/popup/components/Popup.d.ts +2 -0
- package/out/ui/packages/popup/components/Popup.luau +64 -2
- package/out/ui/packages/popup/components/placement.luau +6 -4
- package/out/ui/packages/progressBar/components/ProgressBar.luau +1 -1
- package/out/ui/packages/progressBar/components/ProgressBar.styles.luau +3 -2
- package/out/ui/packages/radioGroup/components/RadioGroup.luau +2 -1
- package/out/ui/packages/rating/components/Rating.luau +45 -3
- package/out/ui/packages/rating/components/Rating.styles.luau +1 -1
- package/out/ui/packages/rayEditor/components/RayEditor.luau +9 -1
- package/out/ui/packages/rayEditor/components/RayEditor.styles.luau +17 -11
- package/out/ui/packages/rectEditor/components/RectEditor.luau +9 -1
- package/out/ui/packages/rectEditor/components/RectEditor.styles.luau +49 -42
- package/out/ui/packages/select/components/Select.d.ts +2 -0
- package/out/ui/packages/select/components/Select.luau +148 -106
- package/out/ui/packages/select/components/Select.styles.d.ts +2 -0
- package/out/ui/packages/select/components/Select.styles.luau +29 -5
- package/out/ui/packages/shadow/components/Shadow.luau +188 -19
- package/out/ui/packages/sidebar/components/Sidebar.styles.luau +1 -0
- package/out/ui/packages/skeleton/components/Skeleton.luau +4 -0
- package/out/ui/packages/slider/components/RangeSlider.luau +6 -5
- package/out/ui/packages/slider/components/Slider.luau +11 -16
- package/out/ui/packages/sparkline/components/Sparkline.luau +7 -5
- package/out/ui/packages/speedDial/components/SpeedDial.luau +4 -1
- package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +5 -0
- package/out/ui/packages/speedDial/components/speedDialLabel.d.ts +1 -1
- package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
- package/out/ui/packages/stepper/components/Stepper.styles.luau +9 -6
- package/out/ui/packages/switch/components/Switch.luau +2 -2
- package/out/ui/packages/switch/components/switchLook.d.ts +3 -3
- package/out/ui/packages/switch/components/switchLook.luau +4 -10
- package/out/ui/packages/table/components/Table.d.ts +1 -0
- package/out/ui/packages/table/components/Table.luau +92 -53
- package/out/ui/packages/table/components/Table.styles.luau +23 -6
- package/out/ui/packages/table/components/tableColumns.d.ts +2 -0
- package/out/ui/packages/table/components/tableColumns.luau +2 -0
- package/out/ui/packages/tabs/components/Tabs.luau +7 -4
- package/out/ui/packages/tabs/components/Tabs.styles.luau +12 -11
- package/out/ui/packages/tabs/components/tabIndicator.d.ts +7 -0
- package/out/ui/packages/tabs/components/tabIndicator.luau +21 -0
- package/out/ui/packages/text/components/Text.d.ts +2 -0
- package/out/ui/packages/text/components/Text.luau +12 -2
- package/out/ui/packages/timeField/components/TimeField.luau +11 -7
- package/out/ui/packages/timeline/components/Timeline.luau +35 -32
- package/out/ui/packages/timeline/components/Timeline.styles.luau +19 -10
- package/out/ui/packages/toast/components/Toast.luau +168 -72
- package/out/ui/packages/toast/components/Toast.styles.luau +36 -19
- package/out/ui/packages/toast/components/toastPlace.d.ts +4 -0
- package/out/ui/packages/toast/components/toastPlace.luau +13 -0
- package/out/ui/packages/toast/enums/ToastVariants.d.ts +2 -1
- package/out/ui/packages/toast/enums/ToastVariants.luau +1 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +43 -4
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +1 -1
- package/out/ui/packages/tooltip/components/Tooltip.styles.luau +2 -2
- package/out/ui/packages/treeView/components/TreeView.luau +12 -13
- package/out/ui/packages/treeView/components/TreeView.styles.luau +6 -0
- package/out/ui/packages/typography/components/Typography.d.ts +2 -0
- package/out/ui/packages/typography/components/Typography.luau +8 -0
- package/out/ui/packages/typography/components/Typography.styles.luau +3 -1
- package/out/ui/packages/udimEditor/components/UDimEditor.luau +9 -1
- package/out/ui/packages/udimEditor/components/UDimEditor.styles.luau +25 -18
- package/out/ui/packages/vectorEditor/components/VectorEditor.luau +17 -3
- package/out/ui/packages/vectorEditor/components/VectorEditor.styles.luau +30 -16
- package/out/ui/packages/virtualList/components/VirtualList.styles.luau +1 -0
- package/package.json +69 -67
|
@@ -9,7 +9,7 @@ local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "t
|
|
|
9
9
|
local Button = TS.import(script, script.Parent.Parent.Parent, "button").Button
|
|
10
10
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
11
11
|
local IconButton = TS.import(script, script.Parent.Parent.Parent, "iconButton").IconButton
|
|
12
|
-
local
|
|
12
|
+
local Input = TS.import(script, script.Parent.Parent.Parent, "input").Input
|
|
13
13
|
local ToggleButtonGroup = TS.import(script, script.Parent.Parent.Parent, "toggleButton").ToggleButtonGroup
|
|
14
14
|
local htmlToMarkdown = TS.import(script, script.Parent.Parent, "htmlToMarkdown").htmlToMarkdown
|
|
15
15
|
local Markdown = TS.import(script, script.Parent, "Markdown").default
|
|
@@ -25,6 +25,18 @@ local MODE_OPTIONS = { {
|
|
|
25
25
|
label = "Preview",
|
|
26
26
|
value = "preview",
|
|
27
27
|
} }
|
|
28
|
+
local function isBlank(value)
|
|
29
|
+
for i = 1, #value do
|
|
30
|
+
local _value = value
|
|
31
|
+
local _i = i
|
|
32
|
+
local _i_1 = i
|
|
33
|
+
local ch = string.sub(_value, _i, _i_1)
|
|
34
|
+
if ch ~= " " and ch ~= "\t" and ch ~= "\n" and ch ~= "\r" then
|
|
35
|
+
return false
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
return true
|
|
39
|
+
end
|
|
28
40
|
local function looksLikeHtml(text)
|
|
29
41
|
local lower = string.lower(text)
|
|
30
42
|
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
|
|
@@ -70,6 +82,8 @@ local function MarkdownEditor(props)
|
|
|
70
82
|
local fullscreenState, setFullscreenState = useState(false)
|
|
71
83
|
local draft, setDraft = useState(value)
|
|
72
84
|
local htmlDraft, setHtmlDraft = useState(nil)
|
|
85
|
+
local htmlError, setHtmlError = useState(nil)
|
|
86
|
+
local panelHeight, setPanelHeight = useState(0)
|
|
73
87
|
local heightState, setHeightState = useState(defaultHeight)
|
|
74
88
|
local dragging, setDragging = useState(false)
|
|
75
89
|
local focused = useRef(false)
|
|
@@ -87,15 +101,23 @@ local function MarkdownEditor(props)
|
|
|
87
101
|
end
|
|
88
102
|
local height = clampEditorHeight(_condition_1, minHeight, maxHeight)
|
|
89
103
|
local compact = theme.density == "compact"
|
|
104
|
+
local toolbarHeight = if compact then 32 else 36
|
|
105
|
+
local gripped = resizable == true and fullscreen ~= true
|
|
90
106
|
local styles = useMarkdownEditorStyles({
|
|
91
107
|
fullscreen = fullscreen,
|
|
92
108
|
compact = compact,
|
|
109
|
+
gripped = gripped,
|
|
93
110
|
})
|
|
94
111
|
useEffect(function()
|
|
95
112
|
if not focused.current then
|
|
96
113
|
setDraft(value)
|
|
97
114
|
end
|
|
98
115
|
end, { value })
|
|
116
|
+
useEffect(function()
|
|
117
|
+
if htmlDraft == nil then
|
|
118
|
+
setPanelHeight(0)
|
|
119
|
+
end
|
|
120
|
+
end, { htmlDraft })
|
|
99
121
|
local setMode = function(modeNext)
|
|
100
122
|
if modeProp == nil then
|
|
101
123
|
setModeState(modeNext)
|
|
@@ -172,7 +194,8 @@ local function MarkdownEditor(props)
|
|
|
172
194
|
local _exp_3 = React.createElement("uipadding", _attributes_6)
|
|
173
195
|
local _attributes_7 = table.clone(styles.toolbarRow)
|
|
174
196
|
setmetatable(_attributes_7, nil)
|
|
175
|
-
local _exp_4 = React.createElement("
|
|
197
|
+
local _exp_4 = React.createElement("uilistlayout", _attributes_7)
|
|
198
|
+
local _exp_5 = React.createElement(ToggleButtonGroup, {
|
|
176
199
|
value = mode,
|
|
177
200
|
options = MODE_OPTIONS,
|
|
178
201
|
size = if compact then "small" else "medium",
|
|
@@ -182,7 +205,8 @@ local function MarkdownEditor(props)
|
|
|
182
205
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
183
206
|
Size = UDim2.fromScale(0, 0),
|
|
184
207
|
},
|
|
185
|
-
})
|
|
208
|
+
})
|
|
209
|
+
local _exp_6 = React.createElement(Button, {
|
|
186
210
|
text = "Paste HTML",
|
|
187
211
|
variant = "text",
|
|
188
212
|
size = if compact then "small" else "medium",
|
|
@@ -195,122 +219,167 @@ local function MarkdownEditor(props)
|
|
|
195
219
|
if looksLikeHtml(value) then
|
|
196
220
|
onChange(htmlToMarkdown(value))
|
|
197
221
|
else
|
|
222
|
+
setHtmlError(nil)
|
|
198
223
|
setHtmlDraft("")
|
|
199
224
|
end
|
|
200
225
|
end,
|
|
201
|
-
})
|
|
202
|
-
icon = Icons.Expanded,
|
|
203
|
-
size = "sm",
|
|
204
|
-
tint = theme.palette.text.secondary,
|
|
205
|
-
selected = fullscreen,
|
|
206
|
-
onClick = function()
|
|
207
|
-
return setFullscreen(not fullscreen)
|
|
208
|
-
end,
|
|
209
|
-
className = {
|
|
210
|
-
LayoutOrder = 99,
|
|
211
|
-
},
|
|
212
|
-
}))
|
|
213
|
-
local _exp_5 = htmlDraft ~= nil and (React.createElement("frame", {
|
|
214
|
-
key = "HtmlPaste",
|
|
215
|
-
Size = UDim2.new(1, 0, 0, 96),
|
|
216
|
-
BackgroundColor3 = theme.palette.surface.elevated,
|
|
217
|
-
BorderSizePixel = 0,
|
|
218
|
-
LayoutOrder = 1,
|
|
219
|
-
}, React.createElement("uipadding", {
|
|
220
|
-
PaddingTop = UDim.new(0, theme.padding.calc(1)),
|
|
221
|
-
PaddingBottom = UDim.new(0, theme.padding.calc(1)),
|
|
222
|
-
PaddingLeft = UDim.new(0, theme.padding.calc(1)),
|
|
223
|
-
PaddingRight = UDim.new(0, theme.padding.calc(1)),
|
|
224
|
-
}), React.createElement("uilistlayout", {
|
|
225
|
-
FillDirection = Enum.FillDirection.Vertical,
|
|
226
|
-
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
227
|
-
Padding = UDim.new(0, theme.padding.calc(1)),
|
|
228
|
-
}), React.createElement("textbox", {
|
|
229
|
-
key = "HtmlField",
|
|
230
|
-
Size = UDim2.new(1, 0, 0, 48),
|
|
231
|
-
BackgroundColor3 = theme.palette.surface.input,
|
|
232
|
-
BorderSizePixel = 0,
|
|
233
|
-
ClearTextOnFocus = false,
|
|
234
|
-
MultiLine = true,
|
|
235
|
-
Text = htmlDraft,
|
|
236
|
-
PlaceholderText = "Paste HTML here",
|
|
237
|
-
TextXAlignment = Enum.TextXAlignment.Left,
|
|
238
|
-
TextYAlignment = Enum.TextYAlignment.Top,
|
|
239
|
-
TextSize = theme.typography.fontSizes.caption,
|
|
240
|
-
TextColor3 = theme.palette.text.primary,
|
|
241
|
-
Font = Enum.Font.RobotoMono,
|
|
242
|
-
Change = {
|
|
243
|
-
Text = function(rbx)
|
|
244
|
-
return setHtmlDraft(rbx.Text)
|
|
245
|
-
end,
|
|
246
|
-
},
|
|
247
|
-
LayoutOrder = 1,
|
|
248
|
-
}), React.createElement("frame", {
|
|
249
|
-
key = "HtmlActions",
|
|
250
|
-
Size = UDim2.new(1, 0, 0, 28),
|
|
251
|
-
BackgroundTransparency = 1,
|
|
252
|
-
LayoutOrder = 2,
|
|
253
|
-
}, React.createElement("uilistlayout", {
|
|
254
|
-
FillDirection = Enum.FillDirection.Horizontal,
|
|
255
|
-
Padding = UDim.new(0, theme.padding.calc(1)),
|
|
256
|
-
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
257
|
-
}), React.createElement(Button, {
|
|
258
|
-
text = "Convert",
|
|
259
|
-
size = "small",
|
|
260
|
-
className = {
|
|
261
|
-
LayoutOrder = 1,
|
|
262
|
-
AutomaticSize = Enum.AutomaticSize.XY,
|
|
263
|
-
Size = UDim2.fromScale(0, 0),
|
|
264
|
-
},
|
|
265
|
-
onLeftClick = function()
|
|
266
|
-
onChange(htmlToMarkdown(htmlDraft))
|
|
267
|
-
setHtmlDraft(nil)
|
|
268
|
-
setMode("preview")
|
|
269
|
-
end,
|
|
270
|
-
}), React.createElement(Button, {
|
|
271
|
-
text = "Cancel",
|
|
272
|
-
variant = "text",
|
|
273
|
-
size = "small",
|
|
274
|
-
className = {
|
|
275
|
-
LayoutOrder = 2,
|
|
276
|
-
AutomaticSize = Enum.AutomaticSize.XY,
|
|
277
|
-
Size = UDim2.fromScale(0, 0),
|
|
278
|
-
},
|
|
279
|
-
onLeftClick = function()
|
|
280
|
-
return setHtmlDraft(nil)
|
|
281
|
-
end,
|
|
282
|
-
}))))
|
|
226
|
+
})
|
|
283
227
|
local _attributes_8 = {
|
|
284
|
-
|
|
228
|
+
id = "Fullscreen",
|
|
229
|
+
glyph = "expand",
|
|
285
230
|
}
|
|
286
|
-
|
|
287
|
-
|
|
231
|
+
local _result = (styles.toolbarGlyph).Size
|
|
232
|
+
if _result ~= nil then
|
|
233
|
+
_result = _result.X.Offset
|
|
288
234
|
end
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
local _attributes_9 = table.clone(styles.split)
|
|
293
|
-
setmetatable(_attributes_9, nil)
|
|
294
|
-
_condition_3 = React.createElement("uilistlayout", _attributes_9)
|
|
235
|
+
local _condition_3 = _result
|
|
236
|
+
if _condition_3 == nil then
|
|
237
|
+
_condition_3 = 16
|
|
295
238
|
end
|
|
296
|
-
|
|
239
|
+
_attributes_8.iconSize = _condition_3
|
|
240
|
+
_attributes_8.tint = (styles.toolbarGlyph).ImageColor3
|
|
241
|
+
_attributes_8.className = styles.toolbarIcon
|
|
242
|
+
_attributes_8.onClick = function()
|
|
243
|
+
return setFullscreen(not fullscreen)
|
|
244
|
+
end
|
|
245
|
+
local _exp_7 = React.createElement("frame", _attributes_5, _exp_3, _exp_4, _exp_5, _exp_6, React.createElement(IconButton, _attributes_8))
|
|
246
|
+
local _condition_4 = htmlDraft ~= nil
|
|
297
247
|
if _condition_4 then
|
|
298
248
|
local _attributes_9 = {
|
|
299
|
-
key = "
|
|
249
|
+
key = "HtmlPaste",
|
|
300
250
|
}
|
|
301
|
-
for _k, _v in
|
|
251
|
+
for _k, _v in styles.htmlWrap do
|
|
302
252
|
_attributes_9[_k] = _v
|
|
303
253
|
end
|
|
304
|
-
_attributes_9.
|
|
254
|
+
_attributes_9.Change = {
|
|
255
|
+
AbsoluteSize = function(rbx)
|
|
256
|
+
return setPanelHeight(rbx.AbsoluteSize.Y)
|
|
257
|
+
end,
|
|
258
|
+
}
|
|
259
|
+
local _attributes_10 = table.clone(styles.htmlGap)
|
|
260
|
+
setmetatable(_attributes_10, nil)
|
|
261
|
+
local _exp_8 = React.createElement("uipadding", _attributes_10)
|
|
262
|
+
local _attributes_11 = {
|
|
263
|
+
key = "Surface",
|
|
264
|
+
}
|
|
265
|
+
for _k, _v in styles.htmlSurface do
|
|
266
|
+
_attributes_11[_k] = _v
|
|
267
|
+
end
|
|
268
|
+
local _attributes_12 = table.clone(styles.htmlStroke)
|
|
269
|
+
setmetatable(_attributes_12, nil)
|
|
270
|
+
local _exp_9 = React.createElement("uistroke", _attributes_12)
|
|
271
|
+
local _attributes_13 = table.clone(styles.htmlCorner)
|
|
272
|
+
setmetatable(_attributes_13, nil)
|
|
273
|
+
local _exp_10 = React.createElement("uicorner", _attributes_13)
|
|
274
|
+
local _attributes_14 = table.clone(styles.htmlPad)
|
|
275
|
+
setmetatable(_attributes_14, nil)
|
|
276
|
+
local _exp_11 = React.createElement("uipadding", _attributes_14)
|
|
277
|
+
local _attributes_15 = table.clone(styles.htmlStack)
|
|
278
|
+
setmetatable(_attributes_15, nil)
|
|
279
|
+
local _exp_12 = React.createElement("uilistlayout", _attributes_15)
|
|
280
|
+
local _attributes_16 = {
|
|
281
|
+
key = "Hint",
|
|
282
|
+
}
|
|
283
|
+
for _k, _v in styles.htmlHint do
|
|
284
|
+
_attributes_16[_k] = _v
|
|
285
|
+
end
|
|
286
|
+
_attributes_16.Text = "Paste HTML to convert to markdown"
|
|
287
|
+
local _exp_13 = React.createElement("textlabel", _attributes_16)
|
|
288
|
+
local _exp_14 = React.createElement(Input, {
|
|
289
|
+
text = htmlDraft,
|
|
290
|
+
placeholder = "Paste HTML here",
|
|
291
|
+
multiline = true,
|
|
292
|
+
minRows = 4,
|
|
293
|
+
variant = "outlined",
|
|
294
|
+
width = UDim.new(1, 0),
|
|
295
|
+
hasError = htmlError ~= nil,
|
|
296
|
+
helperText = htmlError,
|
|
297
|
+
className = {
|
|
298
|
+
LayoutOrder = 2,
|
|
299
|
+
},
|
|
300
|
+
onInput = function(text)
|
|
301
|
+
setHtmlDraft(text)
|
|
302
|
+
setHtmlError(nil)
|
|
303
|
+
end,
|
|
304
|
+
onTextChanged = function(text)
|
|
305
|
+
return setHtmlDraft(text)
|
|
306
|
+
end,
|
|
307
|
+
})
|
|
308
|
+
local _attributes_17 = {
|
|
309
|
+
key = "HtmlActions",
|
|
310
|
+
}
|
|
311
|
+
for _k, _v in styles.htmlActions do
|
|
312
|
+
_attributes_17[_k] = _v
|
|
313
|
+
end
|
|
314
|
+
local _attributes_18 = table.clone(styles.htmlActionsRow)
|
|
315
|
+
setmetatable(_attributes_18, nil)
|
|
316
|
+
_condition_4 = (React.createElement("frame", _attributes_9, _exp_8, React.createElement("frame", _attributes_11, _exp_9, _exp_10, _exp_11, _exp_12, _exp_13, _exp_14, React.createElement("frame", _attributes_17, React.createElement("uilistlayout", _attributes_18), React.createElement(Button, {
|
|
317
|
+
text = "Convert",
|
|
318
|
+
size = if compact then "small" else "medium",
|
|
319
|
+
disabled = isBlank(htmlDraft),
|
|
320
|
+
className = {
|
|
321
|
+
LayoutOrder = 1,
|
|
322
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
323
|
+
Size = UDim2.fromScale(0, 0),
|
|
324
|
+
},
|
|
325
|
+
onLeftClick = function()
|
|
326
|
+
local converted = htmlToMarkdown(htmlDraft)
|
|
327
|
+
if isBlank(converted) then
|
|
328
|
+
setHtmlError("Couldn't convert that HTML")
|
|
329
|
+
return nil
|
|
330
|
+
end
|
|
331
|
+
onChange(converted)
|
|
332
|
+
setHtmlError(nil)
|
|
333
|
+
setHtmlDraft(nil)
|
|
334
|
+
setMode("preview")
|
|
335
|
+
end,
|
|
336
|
+
}), React.createElement(Button, {
|
|
337
|
+
text = "Cancel",
|
|
338
|
+
variant = "text",
|
|
339
|
+
size = if compact then "small" else "medium",
|
|
340
|
+
className = {
|
|
341
|
+
LayoutOrder = 2,
|
|
342
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
343
|
+
Size = UDim2.fromScale(0, 0),
|
|
344
|
+
},
|
|
345
|
+
onLeftClick = function()
|
|
346
|
+
setHtmlError(nil)
|
|
347
|
+
setHtmlDraft(nil)
|
|
348
|
+
end,
|
|
349
|
+
})))))
|
|
350
|
+
end
|
|
351
|
+
local _attributes_9 = {
|
|
352
|
+
key = "Body",
|
|
353
|
+
}
|
|
354
|
+
for _k, _v in styles.body do
|
|
355
|
+
_attributes_9[_k] = _v
|
|
356
|
+
end
|
|
357
|
+
_attributes_9.Size = UDim2.new(1, 0, 1, -(toolbarHeight + panelHeight))
|
|
358
|
+
_attributes_9.LayoutOrder = 3
|
|
359
|
+
local _condition_5 = mode == "split"
|
|
360
|
+
if _condition_5 then
|
|
361
|
+
local _attributes_10 = table.clone(styles.split)
|
|
362
|
+
setmetatable(_attributes_10, nil)
|
|
363
|
+
_condition_5 = React.createElement("uilistlayout", _attributes_10)
|
|
364
|
+
end
|
|
365
|
+
local _condition_6 = showEdit
|
|
366
|
+
if _condition_6 then
|
|
305
367
|
local _attributes_10 = {
|
|
368
|
+
key = "EditPane",
|
|
369
|
+
}
|
|
370
|
+
for _k, _v in (if mode == "split" then styles.pane else styles.paneFull) do
|
|
371
|
+
_attributes_10[_k] = _v
|
|
372
|
+
end
|
|
373
|
+
_attributes_10.LayoutOrder = 1
|
|
374
|
+
local _attributes_11 = {
|
|
306
375
|
key = "Editor",
|
|
307
376
|
}
|
|
308
377
|
for _k, _v in styles.editor do
|
|
309
|
-
|
|
378
|
+
_attributes_11[_k] = _v
|
|
310
379
|
end
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
380
|
+
_attributes_11.Text = draft
|
|
381
|
+
_attributes_11.PlaceholderText = placeholder
|
|
382
|
+
_attributes_11.Change = {
|
|
314
383
|
Text = function(rbx)
|
|
315
384
|
setDraft(rbx.Text)
|
|
316
385
|
if focused.current and rbx.Text ~= value then
|
|
@@ -318,7 +387,7 @@ local function MarkdownEditor(props)
|
|
|
318
387
|
end
|
|
319
388
|
end,
|
|
320
389
|
}
|
|
321
|
-
|
|
390
|
+
_attributes_11.Event = {
|
|
322
391
|
Focused = function()
|
|
323
392
|
focused.current = true
|
|
324
393
|
end,
|
|
@@ -328,47 +397,47 @@ local function MarkdownEditor(props)
|
|
|
328
397
|
onChange(rbx.Text)
|
|
329
398
|
end,
|
|
330
399
|
}
|
|
331
|
-
local
|
|
332
|
-
setmetatable(
|
|
333
|
-
|
|
400
|
+
local _attributes_12 = table.clone(styles.editorPad)
|
|
401
|
+
setmetatable(_attributes_12, nil)
|
|
402
|
+
_condition_6 = (React.createElement("frame", _attributes_10, React.createElement("textbox", _attributes_11, React.createElement("uipadding", _attributes_12))))
|
|
334
403
|
end
|
|
335
|
-
local
|
|
336
|
-
if
|
|
337
|
-
local
|
|
404
|
+
local _condition_7 = mode == "split"
|
|
405
|
+
if _condition_7 then
|
|
406
|
+
local _attributes_10 = {
|
|
338
407
|
key = "SplitRule",
|
|
339
408
|
}
|
|
340
409
|
for _k, _v in styles.divider do
|
|
341
|
-
|
|
410
|
+
_attributes_10[_k] = _v
|
|
342
411
|
end
|
|
343
|
-
|
|
412
|
+
_condition_7 = React.createElement("frame", _attributes_10)
|
|
344
413
|
end
|
|
345
|
-
local
|
|
346
|
-
if
|
|
347
|
-
local
|
|
414
|
+
local _condition_8 = showPreview
|
|
415
|
+
if _condition_8 then
|
|
416
|
+
local _attributes_10 = {
|
|
348
417
|
key = "PreviewPane",
|
|
349
418
|
}
|
|
350
419
|
for _k, _v in styles.previewScroll do
|
|
351
|
-
|
|
420
|
+
_attributes_10[_k] = _v
|
|
352
421
|
end
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
local
|
|
356
|
-
setmetatable(
|
|
357
|
-
|
|
422
|
+
_attributes_10.Size = if mode == "split" then UDim2.fromScale(0.5, 1) else UDim2.fromScale(1, 1)
|
|
423
|
+
_attributes_10.LayoutOrder = 3
|
|
424
|
+
local _attributes_11 = table.clone(styles.previewPad)
|
|
425
|
+
setmetatable(_attributes_11, nil)
|
|
426
|
+
_condition_8 = (React.createElement("scrollingframe", _attributes_10, React.createElement("uipadding", _attributes_11), previewNode))
|
|
358
427
|
end
|
|
359
|
-
local
|
|
360
|
-
local
|
|
361
|
-
if
|
|
362
|
-
local
|
|
428
|
+
local _exp_8 = React.createElement("frame", _attributes_3, _exp_2, _exp_7, _condition_4, React.createElement("frame", _attributes_9, _condition_5, _condition_6, _condition_7, _condition_8))
|
|
429
|
+
local _condition_9 = resizable and not fullscreen
|
|
430
|
+
if _condition_9 then
|
|
431
|
+
local _attributes_10 = {
|
|
363
432
|
key = "ResizeGrip",
|
|
364
433
|
}
|
|
365
434
|
for _k, _v in styles.resizeGrip do
|
|
366
|
-
|
|
435
|
+
_attributes_10[_k] = _v
|
|
367
436
|
end
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
437
|
+
_attributes_10.Text = ""
|
|
438
|
+
_attributes_10.Active = true
|
|
439
|
+
_attributes_10.Selectable = true
|
|
440
|
+
_attributes_10.Event = {
|
|
372
441
|
InputBegan = function(_, input)
|
|
373
442
|
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
|
|
374
443
|
dragStart.current = input.Position.Y
|
|
@@ -381,34 +450,34 @@ local function MarkdownEditor(props)
|
|
|
381
450
|
end
|
|
382
451
|
end,
|
|
383
452
|
}
|
|
384
|
-
local
|
|
453
|
+
local _attributes_11 = {
|
|
385
454
|
key = "Long",
|
|
386
455
|
}
|
|
387
456
|
for _k, _v in styles.resizeMark do
|
|
388
|
-
|
|
457
|
+
_attributes_11[_k] = _v
|
|
389
458
|
end
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
local
|
|
393
|
-
local
|
|
459
|
+
_attributes_11.Position = UDim2.fromOffset(4, 14)
|
|
460
|
+
_attributes_11.Size = UDim2.fromOffset(12, 2)
|
|
461
|
+
local _exp_9 = React.createElement("frame", _attributes_11)
|
|
462
|
+
local _attributes_12 = {
|
|
394
463
|
key = "Short",
|
|
395
464
|
}
|
|
396
465
|
for _k, _v in styles.resizeMark do
|
|
397
|
-
|
|
466
|
+
_attributes_12[_k] = _v
|
|
398
467
|
end
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
468
|
+
_attributes_12.Position = UDim2.fromOffset(10, 10)
|
|
469
|
+
_attributes_12.Size = UDim2.fromOffset(6, 2)
|
|
470
|
+
_condition_9 = (React.createElement("textbutton", _attributes_10, _exp_9, React.createElement("frame", _attributes_12)))
|
|
402
471
|
end
|
|
403
|
-
local
|
|
404
|
-
if
|
|
405
|
-
local
|
|
472
|
+
local _condition_10 = dragging
|
|
473
|
+
if _condition_10 then
|
|
474
|
+
local _attributes_10 = {
|
|
406
475
|
key = "ResizeOverlay",
|
|
407
476
|
}
|
|
408
477
|
for _k, _v in styles.resizeOverlay do
|
|
409
|
-
|
|
478
|
+
_attributes_10[_k] = _v
|
|
410
479
|
end
|
|
411
|
-
|
|
480
|
+
_attributes_10.Event = {
|
|
412
481
|
InputChanged = function(_, input)
|
|
413
482
|
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
|
|
414
483
|
setHeight(heightStart.current + input.Position.Y - dragStart.current)
|
|
@@ -423,9 +492,9 @@ local function MarkdownEditor(props)
|
|
|
423
492
|
return setDragging(false)
|
|
424
493
|
end,
|
|
425
494
|
}
|
|
426
|
-
|
|
495
|
+
_condition_10 = (React.createElement("frame", _attributes_10))
|
|
427
496
|
end
|
|
428
|
-
return React.createElement(SxHost, _attributes, _exp, _exp_1,
|
|
497
|
+
return React.createElement(SxHost, _attributes, _exp, _exp_1, _exp_8, _condition_9, _condition_10)
|
|
429
498
|
end
|
|
430
499
|
local default = MarkdownEditor
|
|
431
500
|
return {
|
|
@@ -2,5 +2,6 @@ export type MarkdownEditorMode = "split" | "edit" | "preview";
|
|
|
2
2
|
declare const useMarkdownEditorStyles: (props: {
|
|
3
3
|
fullscreen?: boolean;
|
|
4
4
|
compact?: boolean;
|
|
5
|
+
gripped?: boolean;
|
|
5
6
|
}) => import("../../../../theme/index").ClassNameMap<string>;
|
|
6
7
|
export default useMarkdownEditorStyles;
|