@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
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
|
|
5
|
+
local CodeEditor = TS.import(script, script.Parent.Parent.Parent, "codeEditor").CodeEditor
|
|
4
6
|
local Divider = TS.import(script, script.Parent.Parent.Parent, "divider").Divider
|
|
5
7
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
6
8
|
local Link = TS.import(script, script.Parent.Parent.Parent, "link").Link
|
|
@@ -29,25 +31,28 @@ local function headingVariant(level)
|
|
|
29
31
|
end
|
|
30
32
|
return "h6"
|
|
31
33
|
end
|
|
32
|
-
local function textSizeFor(variant)
|
|
34
|
+
local function textSizeFor(sizes, variant)
|
|
33
35
|
if variant == "h1" then
|
|
34
|
-
return
|
|
36
|
+
return sizes.h1
|
|
35
37
|
end
|
|
36
38
|
if variant == "h2" then
|
|
37
|
-
return
|
|
39
|
+
return sizes.h2
|
|
38
40
|
end
|
|
39
41
|
if variant == "h3" then
|
|
40
|
-
return
|
|
42
|
+
return sizes.h3
|
|
41
43
|
end
|
|
42
44
|
if variant == "h4" then
|
|
43
|
-
return
|
|
45
|
+
return sizes.h4
|
|
44
46
|
end
|
|
45
|
-
if variant == "h5"
|
|
46
|
-
return
|
|
47
|
+
if variant == "h5" then
|
|
48
|
+
return sizes.h5
|
|
47
49
|
end
|
|
48
|
-
|
|
50
|
+
if variant == "h6" then
|
|
51
|
+
return sizes.h6
|
|
52
|
+
end
|
|
53
|
+
return sizes.body
|
|
49
54
|
end
|
|
50
|
-
local function richLabel(key, styles, inlines, variant, order)
|
|
55
|
+
local function richLabel(key, styles, inlines, variant, order, size, sizes)
|
|
51
56
|
local text = inlinesToRichText(inlines)
|
|
52
57
|
local _attributes = {
|
|
53
58
|
key = key,
|
|
@@ -55,9 +60,14 @@ local function richLabel(key, styles, inlines, variant, order)
|
|
|
55
60
|
for _k, _v in styles.text do
|
|
56
61
|
_attributes[_k] = _v
|
|
57
62
|
end
|
|
63
|
+
for _k, _v in (if size ~= nil then {
|
|
64
|
+
Size = size,
|
|
65
|
+
} else {}) do
|
|
66
|
+
_attributes[_k] = _v
|
|
67
|
+
end
|
|
58
68
|
_attributes.LayoutOrder = order
|
|
59
69
|
_attributes.Text = text
|
|
60
|
-
_attributes.TextSize = textSizeFor(variant)
|
|
70
|
+
_attributes.TextSize = textSizeFor(sizes or {}, variant)
|
|
61
71
|
_attributes.Font = if variant ~= nil and variant ~= "body" then Enum.Font.SourceSansBold else Enum.Font.SourceSans
|
|
62
72
|
return React.createElement("textlabel", _attributes)
|
|
63
73
|
end
|
|
@@ -69,17 +79,21 @@ local function inlineHasLink(inlines)
|
|
|
69
79
|
end
|
|
70
80
|
return false
|
|
71
81
|
end
|
|
72
|
-
local function inlineFlow(key, styles, inlines, variant, order, onLink)
|
|
82
|
+
local function inlineFlow(key, styles, inlines, variant, order, onLink, sizes, flow)
|
|
83
|
+
if flow == nil then
|
|
84
|
+
flow = styles.flow
|
|
85
|
+
end
|
|
73
86
|
if not inlineHasLink(inlines) then
|
|
74
|
-
|
|
87
|
+
local span = if flow ~= styles.flow then flow.Size else nil
|
|
88
|
+
return richLabel(key, styles, inlines, variant, order, span, sizes)
|
|
75
89
|
end
|
|
76
90
|
local pieces = inlinePieces(inlines)
|
|
77
|
-
local textSize = textSizeFor(variant)
|
|
91
|
+
local textSize = textSizeFor(sizes or {}, variant)
|
|
78
92
|
local font = if variant ~= nil and variant ~= "body" then Enum.Font.SourceSansBold else Enum.Font.SourceSans
|
|
79
93
|
local _attributes = {
|
|
80
94
|
key = key,
|
|
81
95
|
}
|
|
82
|
-
for _k, _v in
|
|
96
|
+
for _k, _v in flow do
|
|
83
97
|
_attributes[_k] = _v
|
|
84
98
|
end
|
|
85
99
|
_attributes.LayoutOrder = order
|
|
@@ -110,6 +124,7 @@ local function inlineFlow(key, styles, inlines, variant, order, onLink)
|
|
|
110
124
|
return React.createElement(Link, {
|
|
111
125
|
key = `ln-{index}`,
|
|
112
126
|
text = payload.text,
|
|
127
|
+
color = "primary",
|
|
113
128
|
sx = {
|
|
114
129
|
TextSize = textSize,
|
|
115
130
|
Font = font,
|
|
@@ -142,7 +157,7 @@ local function inlineFlow(key, styles, inlines, variant, order, onLink)
|
|
|
142
157
|
-- ▲ ReadonlyArray.map ▲
|
|
143
158
|
return React.createElement("frame", _attributes, _exp, _newValue)
|
|
144
159
|
end
|
|
145
|
-
local function renderBlock(block, index, styles, onLink)
|
|
160
|
+
local function renderBlock(block, index, styles, sizes, onLink)
|
|
146
161
|
if block.kind == "heading" then
|
|
147
162
|
local _attributes = {
|
|
148
163
|
key = `h-{index}`,
|
|
@@ -151,7 +166,7 @@ local function renderBlock(block, index, styles, onLink)
|
|
|
151
166
|
_attributes[_k] = _v
|
|
152
167
|
end
|
|
153
168
|
_attributes.LayoutOrder = index
|
|
154
|
-
return React.createElement("frame", _attributes, inlineFlow("Text", styles, block.inlines, headingVariant(block.level), nil, onLink))
|
|
169
|
+
return React.createElement("frame", _attributes, inlineFlow("Text", styles, block.inlines, headingVariant(block.level), nil, onLink, sizes))
|
|
155
170
|
end
|
|
156
171
|
if block.kind == "paragraph" then
|
|
157
172
|
local _attributes = {
|
|
@@ -161,30 +176,19 @@ local function renderBlock(block, index, styles, onLink)
|
|
|
161
176
|
_attributes[_k] = _v
|
|
162
177
|
end
|
|
163
178
|
_attributes.LayoutOrder = index
|
|
164
|
-
return React.createElement("frame", _attributes, inlineFlow("Text", styles, block.inlines, "body", nil, onLink))
|
|
179
|
+
return React.createElement("frame", _attributes, inlineFlow("Text", styles, block.inlines, "body", nil, onLink, sizes))
|
|
165
180
|
end
|
|
166
181
|
if block.kind == "code" then
|
|
167
|
-
|
|
182
|
+
return React.createElement(CodeEditor, {
|
|
168
183
|
key = `c-{index}`,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
184
|
+
value = block.text,
|
|
185
|
+
language = block.language,
|
|
186
|
+
readOnly = true,
|
|
187
|
+
className = {
|
|
188
|
+
LayoutOrder = index,
|
|
189
|
+
Size = (styles.block).Size,
|
|
190
|
+
},
|
|
176
191
|
})
|
|
177
|
-
local _attributes_1 = table.clone(styles.codePad)
|
|
178
|
-
setmetatable(_attributes_1, nil)
|
|
179
|
-
local _exp_1 = React.createElement("uipadding", _attributes_1)
|
|
180
|
-
local _attributes_2 = {
|
|
181
|
-
key = "Code",
|
|
182
|
-
}
|
|
183
|
-
for _k, _v in styles.codeText do
|
|
184
|
-
_attributes_2[_k] = _v
|
|
185
|
-
end
|
|
186
|
-
_attributes_2.Text = block.text
|
|
187
|
-
return React.createElement("frame", _attributes, _exp, _exp_1, React.createElement("textlabel", _attributes_2))
|
|
188
192
|
end
|
|
189
193
|
if block.kind == "hr" then
|
|
190
194
|
return React.createElement(Divider, {
|
|
@@ -193,6 +197,7 @@ local function renderBlock(block, index, styles, onLink)
|
|
|
193
197
|
padding = 0,
|
|
194
198
|
className = {
|
|
195
199
|
LayoutOrder = index,
|
|
200
|
+
Size = (styles.block).Size,
|
|
196
201
|
},
|
|
197
202
|
})
|
|
198
203
|
end
|
|
@@ -204,19 +209,122 @@ local function renderBlock(block, index, styles, onLink)
|
|
|
204
209
|
_attributes[_k] = _v
|
|
205
210
|
end
|
|
206
211
|
_attributes.LayoutOrder = index
|
|
207
|
-
local
|
|
208
|
-
|
|
209
|
-
|
|
212
|
+
local _attributes_1 = table.clone(styles.quoteCorner)
|
|
213
|
+
setmetatable(_attributes_1, nil)
|
|
214
|
+
local _exp = React.createElement("uicorner", _attributes_1)
|
|
215
|
+
local _attributes_2 = table.clone(styles.quoteBarPad)
|
|
216
|
+
setmetatable(_attributes_2, nil)
|
|
217
|
+
local _exp_1 = React.createElement("uipadding", _attributes_2)
|
|
218
|
+
local _attributes_3 = {
|
|
219
|
+
key = "Face",
|
|
220
|
+
}
|
|
221
|
+
for _k, _v in styles.quoteFace do
|
|
222
|
+
_attributes_3[_k] = _v
|
|
223
|
+
end
|
|
224
|
+
local _attributes_4 = table.clone(styles.quoteFaceCorner)
|
|
225
|
+
setmetatable(_attributes_4, nil)
|
|
226
|
+
local _exp_2 = React.createElement("uicorner", _attributes_4)
|
|
227
|
+
local _attributes_5 = table.clone(styles.quotePad)
|
|
228
|
+
setmetatable(_attributes_5, nil)
|
|
229
|
+
local _exp_3 = React.createElement("uipadding", _attributes_5)
|
|
230
|
+
local _attributes_6 = table.clone(styles.quoteStack)
|
|
231
|
+
setmetatable(_attributes_6, nil)
|
|
232
|
+
local _exp_4 = React.createElement("uilistlayout", _attributes_6)
|
|
233
|
+
local _exp_5 = block.paragraphs
|
|
234
|
+
-- ▼ ReadonlyArray.map ▼
|
|
235
|
+
local _newValue = table.create(#_exp_5)
|
|
236
|
+
local _callback = function(inlines, para)
|
|
237
|
+
return inlineFlow(`p-{para}`, styles, inlines, "body", para, onLink, sizes, styles.quoteFlow)
|
|
238
|
+
end
|
|
239
|
+
for _k, _v in _exp_5 do
|
|
240
|
+
_newValue[_k] = _callback(_v, _k - 1, _exp_5)
|
|
241
|
+
end
|
|
242
|
+
-- ▲ ReadonlyArray.map ▲
|
|
243
|
+
return React.createElement("frame", _attributes, _exp, _exp_1, React.createElement("frame", _attributes_3, _exp_2, _exp_3, _exp_4, _newValue))
|
|
244
|
+
end
|
|
245
|
+
if block.kind == "table" then
|
|
246
|
+
local alignOf = function(align)
|
|
247
|
+
if align == "center" then
|
|
248
|
+
return Enum.TextXAlignment.Center
|
|
249
|
+
end
|
|
250
|
+
if align == "right" then
|
|
251
|
+
return Enum.TextXAlignment.Right
|
|
252
|
+
end
|
|
253
|
+
return Enum.TextXAlignment.Left
|
|
254
|
+
end
|
|
255
|
+
local _array = { block.header }
|
|
256
|
+
local _length = #_array
|
|
257
|
+
local _array_1 = block.rows
|
|
258
|
+
table.move(_array_1, 1, #_array_1, _length + 1, _array)
|
|
259
|
+
local lines = _array
|
|
260
|
+
local _attributes = {
|
|
261
|
+
key = `t-{index}`,
|
|
262
|
+
}
|
|
263
|
+
for _k, _v in styles.tableScroll do
|
|
264
|
+
_attributes[_k] = _v
|
|
265
|
+
end
|
|
266
|
+
_attributes.LayoutOrder = index
|
|
210
267
|
local _attributes_1 = {
|
|
211
|
-
key = "
|
|
268
|
+
key = "Grid",
|
|
212
269
|
}
|
|
213
|
-
for _k, _v in styles.
|
|
270
|
+
for _k, _v in styles.tableGrid do
|
|
214
271
|
_attributes_1[_k] = _v
|
|
215
272
|
end
|
|
216
|
-
local
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
273
|
+
local _exp = React.createElement("uilistlayout", {
|
|
274
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
275
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
276
|
+
})
|
|
277
|
+
-- ▼ ReadonlyArray.map ▼
|
|
278
|
+
local _newValue = table.create(#lines)
|
|
279
|
+
local _callback = function(row, rowIndex)
|
|
280
|
+
local _attributes_2 = {
|
|
281
|
+
key = `tr-{rowIndex}`,
|
|
282
|
+
}
|
|
283
|
+
for _k, _v in styles.tableRow do
|
|
284
|
+
_attributes_2[_k] = _v
|
|
285
|
+
end
|
|
286
|
+
for _k, _v in (if rowIndex == 0 then styles.tableHead else {}) do
|
|
287
|
+
_attributes_2[_k] = _v
|
|
288
|
+
end
|
|
289
|
+
_attributes_2.LayoutOrder = rowIndex
|
|
290
|
+
local _attributes_3 = table.clone(styles.tableStroke)
|
|
291
|
+
setmetatable(_attributes_3, nil)
|
|
292
|
+
local _exp_1 = React.createElement("uistroke", _attributes_3)
|
|
293
|
+
local _exp_2 = React.createElement("uilistlayout", {
|
|
294
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
295
|
+
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
296
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
297
|
+
})
|
|
298
|
+
-- ▼ ReadonlyArray.map ▼
|
|
299
|
+
local _newValue_1 = table.create(#row)
|
|
300
|
+
local _callback_1 = function(cell, col)
|
|
301
|
+
local _attributes_4 = {
|
|
302
|
+
key = `td-{col}`,
|
|
303
|
+
}
|
|
304
|
+
for _k, _v in styles.tableCell do
|
|
305
|
+
_attributes_4[_k] = _v
|
|
306
|
+
end
|
|
307
|
+
for _k, _v in (if rowIndex == 0 then styles.tableHeadText else {}) do
|
|
308
|
+
_attributes_4[_k] = _v
|
|
309
|
+
end
|
|
310
|
+
_attributes_4.LayoutOrder = col
|
|
311
|
+
_attributes_4.Text = inlinesToRichText(cell)
|
|
312
|
+
_attributes_4.TextXAlignment = alignOf(block.align[col + 1] or "left")
|
|
313
|
+
local _attributes_5 = table.clone(styles.tableCellPad)
|
|
314
|
+
setmetatable(_attributes_5, nil)
|
|
315
|
+
return React.createElement("textlabel", _attributes_4, React.createElement("uipadding", _attributes_5))
|
|
316
|
+
end
|
|
317
|
+
for _k, _v in row do
|
|
318
|
+
_newValue_1[_k] = _callback_1(_v, _k - 1, row)
|
|
319
|
+
end
|
|
320
|
+
-- ▲ ReadonlyArray.map ▲
|
|
321
|
+
return React.createElement("frame", _attributes_2, _exp_1, _exp_2, _newValue_1)
|
|
322
|
+
end
|
|
323
|
+
for _k, _v in lines do
|
|
324
|
+
_newValue[_k] = _callback(_v, _k - 1, lines)
|
|
325
|
+
end
|
|
326
|
+
-- ▲ ReadonlyArray.map ▲
|
|
327
|
+
return React.createElement("frame", _attributes, React.createElement("frame", _attributes_1, _exp, _newValue))
|
|
220
328
|
end
|
|
221
329
|
if block.kind == "list" then
|
|
222
330
|
local _attributes = {
|
|
@@ -251,7 +359,7 @@ local function renderBlock(block, index, styles, onLink)
|
|
|
251
359
|
_attributes_1[_k] = _v
|
|
252
360
|
end
|
|
253
361
|
_attributes_1.LayoutOrder = itemIndex
|
|
254
|
-
return React.createElement("frame", _attributes_1, inlineFlow("Text", styles, labeled, "body", nil, onLink))
|
|
362
|
+
return React.createElement("frame", _attributes_1, inlineFlow("Text", styles, labeled, "body", nil, onLink, sizes))
|
|
255
363
|
end
|
|
256
364
|
for _k, _v in _exp_1 do
|
|
257
365
|
_newValue[_k] = _callback(_v, _k - 1, _exp_1)
|
|
@@ -273,6 +381,8 @@ local function Markdown(props)
|
|
|
273
381
|
local id = _binding.id
|
|
274
382
|
local ref = _binding.ref
|
|
275
383
|
local styles = useMarkdownStyles()
|
|
384
|
+
local _binding_1 = useTheme()
|
|
385
|
+
local theme = _binding_1.theme
|
|
276
386
|
local blocks = parseMarkdown(value)
|
|
277
387
|
local _attributes = {
|
|
278
388
|
tag = "frame",
|
|
@@ -286,19 +396,22 @@ local function Markdown(props)
|
|
|
286
396
|
_attributes.base = styles.root
|
|
287
397
|
_attributes.className = className
|
|
288
398
|
_attributes.sx = sx
|
|
289
|
-
local _attributes_1 = table.clone(styles.
|
|
399
|
+
local _attributes_1 = table.clone(styles.inset)
|
|
290
400
|
setmetatable(_attributes_1, nil)
|
|
291
|
-
local _exp = React.createElement("
|
|
401
|
+
local _exp = React.createElement("uipadding", _attributes_1)
|
|
402
|
+
local _attributes_2 = table.clone(styles.layout)
|
|
403
|
+
setmetatable(_attributes_2, nil)
|
|
404
|
+
local _exp_1 = React.createElement("uilistlayout", _attributes_2)
|
|
292
405
|
-- ▼ ReadonlyArray.map ▼
|
|
293
406
|
local _newValue = table.create(#blocks)
|
|
294
407
|
local _callback = function(block, index)
|
|
295
|
-
return renderBlock(block, index, styles, onLink)
|
|
408
|
+
return renderBlock(block, index, styles, theme.typography.fontSizes, onLink)
|
|
296
409
|
end
|
|
297
410
|
for _k, _v in blocks do
|
|
298
411
|
_newValue[_k] = _callback(_v, _k - 1, blocks)
|
|
299
412
|
end
|
|
300
413
|
-- ▲ ReadonlyArray.map ▲
|
|
301
|
-
return React.createElement(SxHost, _attributes, _exp, _newValue)
|
|
414
|
+
return React.createElement(SxHost, _attributes, _exp, _exp_1, _newValue)
|
|
302
415
|
end
|
|
303
416
|
local default = Markdown
|
|
304
417
|
return {
|
|
@@ -5,7 +5,16 @@ local componentStyles = _theme.componentStyles
|
|
|
5
5
|
local createStyles = _theme.createStyles
|
|
6
6
|
local useMarkdownStyles = componentStyles("Markdown", function(theme)
|
|
7
7
|
local gap = if theme.density == "compact" then theme.padding.calc(1) else theme.spacing.calc(1)
|
|
8
|
-
local
|
|
8
|
+
local pad = theme.padding.calc(2)
|
|
9
|
+
local span = UDim2.new(1, -pad * 2, 0, 0)
|
|
10
|
+
local cellWidth = theme.spacing.calc(14)
|
|
11
|
+
return createStyles({
|
|
12
|
+
inset = {
|
|
13
|
+
PaddingTop = UDim.new(0, pad),
|
|
14
|
+
PaddingBottom = UDim.new(0, pad),
|
|
15
|
+
PaddingLeft = UDim.new(0, pad),
|
|
16
|
+
PaddingRight = UDim.new(0, pad),
|
|
17
|
+
},
|
|
9
18
|
root = {
|
|
10
19
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
11
20
|
Size = UDim2.new(1, 0, 0, 0),
|
|
@@ -21,7 +30,7 @@ local useMarkdownStyles = componentStyles("Markdown", function(theme)
|
|
|
21
30
|
},
|
|
22
31
|
block = {
|
|
23
32
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
24
|
-
Size =
|
|
33
|
+
Size = span,
|
|
25
34
|
BackgroundTransparency = 1,
|
|
26
35
|
BorderSizePixel = 0,
|
|
27
36
|
},
|
|
@@ -38,87 +47,127 @@ local useMarkdownStyles = componentStyles("Markdown", function(theme)
|
|
|
38
47
|
TextWrapped = true,
|
|
39
48
|
RichText = true,
|
|
40
49
|
},
|
|
41
|
-
|
|
50
|
+
quote = {
|
|
51
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
52
|
+
Size = span,
|
|
53
|
+
BackgroundColor3 = theme.palette.primary.main,
|
|
54
|
+
BorderSizePixel = 0,
|
|
55
|
+
},
|
|
56
|
+
quoteCorner = {
|
|
57
|
+
CornerRadius = UDim.new(0, theme.shape.borderRadius),
|
|
58
|
+
},
|
|
59
|
+
quoteFaceCorner = {
|
|
60
|
+
CornerRadius = UDim.new(0, theme.shape.radius.small),
|
|
61
|
+
},
|
|
62
|
+
quoteBarPad = {
|
|
63
|
+
PaddingLeft = UDim.new(0, 3),
|
|
64
|
+
},
|
|
65
|
+
quoteFace = {
|
|
42
66
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
43
67
|
Size = UDim2.new(1, 0, 0, 0),
|
|
44
68
|
BackgroundColor3 = theme.palette.surface.paper,
|
|
45
69
|
BorderSizePixel = 0,
|
|
46
70
|
},
|
|
47
|
-
|
|
71
|
+
quotePad = {
|
|
72
|
+
PaddingTop = UDim.new(0, theme.padding.calc(1)),
|
|
73
|
+
PaddingBottom = UDim.new(0, theme.padding.calc(1)),
|
|
74
|
+
PaddingLeft = UDim.new(0, theme.padding.calc(1)),
|
|
75
|
+
PaddingRight = UDim.new(0, theme.padding.calc(1)),
|
|
76
|
+
},
|
|
77
|
+
quoteStack = {
|
|
78
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
79
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Left,
|
|
80
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
81
|
+
Padding = UDim.new(0, theme.padding.calc(1)),
|
|
82
|
+
},
|
|
83
|
+
tableScroll = {
|
|
84
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
85
|
+
Size = span,
|
|
86
|
+
BackgroundTransparency = 1,
|
|
87
|
+
BorderSizePixel = 0,
|
|
88
|
+
},
|
|
89
|
+
tableGrid = {
|
|
90
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
91
|
+
Size = UDim2.fromScale(0, 0),
|
|
92
|
+
BackgroundColor3 = theme.palette.surface.paper,
|
|
93
|
+
BorderSizePixel = 0,
|
|
94
|
+
},
|
|
95
|
+
tableRow = {
|
|
96
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
97
|
+
Size = UDim2.fromScale(0, 0),
|
|
98
|
+
BackgroundTransparency = 1,
|
|
99
|
+
BorderSizePixel = 0,
|
|
100
|
+
},
|
|
101
|
+
tableHead = {
|
|
102
|
+
BackgroundColor3 = theme.palette.surface.elevated,
|
|
103
|
+
BackgroundTransparency = 0,
|
|
104
|
+
},
|
|
105
|
+
tableStroke = {
|
|
106
|
+
Color = theme.palette.divider,
|
|
107
|
+
Thickness = 1,
|
|
108
|
+
Transparency = 0,
|
|
109
|
+
ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
|
|
110
|
+
},
|
|
111
|
+
tableCell = {
|
|
112
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
113
|
+
Size = UDim2.new(0, cellWidth, 0, 0),
|
|
114
|
+
BackgroundTransparency = 1,
|
|
115
|
+
BorderSizePixel = 0,
|
|
116
|
+
Font = theme.typography.fontFamilies.default,
|
|
117
|
+
TextSize = theme.typography.fontSizes.body,
|
|
118
|
+
TextColor3 = theme.palette.text.primary,
|
|
119
|
+
TextYAlignment = Enum.TextYAlignment.Top,
|
|
120
|
+
TextWrapped = true,
|
|
121
|
+
RichText = true,
|
|
122
|
+
},
|
|
123
|
+
tableHeadText = {
|
|
124
|
+
Font = theme.typography.fontFamilies.bold,
|
|
125
|
+
TextColor3 = theme.palette.text.primary,
|
|
126
|
+
},
|
|
127
|
+
tableCellPad = {
|
|
48
128
|
PaddingTop = UDim.new(0, theme.padding.calc(1)),
|
|
49
129
|
PaddingBottom = UDim.new(0, theme.padding.calc(1)),
|
|
50
|
-
PaddingLeft = UDim.new(0, theme.padding.calc(1
|
|
51
|
-
PaddingRight = UDim.new(0, theme.padding.calc(1
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
AutomaticSize = Enum.AutomaticSize.Y,
|
|
92
|
-
Size = UDim2.new(1, 0, 0, 0),
|
|
93
|
-
BackgroundTransparency = 1,
|
|
94
|
-
BorderSizePixel = 0,
|
|
95
|
-
}
|
|
96
|
-
_object.flow = {
|
|
97
|
-
AutomaticSize = Enum.AutomaticSize.Y,
|
|
98
|
-
Size = UDim2.new(1, 0, 0, 0),
|
|
99
|
-
BackgroundTransparency = 1,
|
|
100
|
-
BorderSizePixel = 0,
|
|
101
|
-
}
|
|
102
|
-
_object.flowLayout = {
|
|
103
|
-
FillDirection = Enum.FillDirection.Horizontal,
|
|
104
|
-
HorizontalAlignment = Enum.HorizontalAlignment.Left,
|
|
105
|
-
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
106
|
-
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
107
|
-
Wraps = true,
|
|
108
|
-
Padding = UDim.new(0, 4),
|
|
109
|
-
}
|
|
110
|
-
_object.word = {
|
|
111
|
-
AutomaticSize = Enum.AutomaticSize.XY,
|
|
112
|
-
Size = UDim2.fromScale(0, 0),
|
|
113
|
-
BackgroundTransparency = 1,
|
|
114
|
-
BorderSizePixel = 0,
|
|
115
|
-
Font = theme.typography.fontFamilies.default,
|
|
116
|
-
TextSize = theme.typography.fontSizes.body,
|
|
117
|
-
TextColor3 = theme.palette.text.primary,
|
|
118
|
-
TextXAlignment = Enum.TextXAlignment.Left,
|
|
119
|
-
RichText = true,
|
|
120
|
-
}
|
|
121
|
-
return createStyles(_object)
|
|
130
|
+
PaddingLeft = UDim.new(0, theme.padding.calc(1)),
|
|
131
|
+
PaddingRight = UDim.new(0, theme.padding.calc(1)),
|
|
132
|
+
},
|
|
133
|
+
listItem = {
|
|
134
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
135
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
136
|
+
BackgroundTransparency = 1,
|
|
137
|
+
BorderSizePixel = 0,
|
|
138
|
+
},
|
|
139
|
+
flow = {
|
|
140
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
141
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
142
|
+
BackgroundTransparency = 1,
|
|
143
|
+
BorderSizePixel = 0,
|
|
144
|
+
},
|
|
145
|
+
quoteFlow = {
|
|
146
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
147
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
148
|
+
BackgroundTransparency = 1,
|
|
149
|
+
BorderSizePixel = 0,
|
|
150
|
+
},
|
|
151
|
+
flowLayout = {
|
|
152
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
153
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Left,
|
|
154
|
+
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
155
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
156
|
+
Wraps = true,
|
|
157
|
+
Padding = UDim.new(0, 4),
|
|
158
|
+
},
|
|
159
|
+
word = {
|
|
160
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
161
|
+
Size = UDim2.fromScale(0, 0),
|
|
162
|
+
BackgroundTransparency = 1,
|
|
163
|
+
BorderSizePixel = 0,
|
|
164
|
+
Font = theme.typography.fontFamilies.default,
|
|
165
|
+
TextSize = theme.typography.fontSizes.body,
|
|
166
|
+
TextColor3 = theme.palette.text.primary,
|
|
167
|
+
TextXAlignment = Enum.TextXAlignment.Left,
|
|
168
|
+
RichText = true,
|
|
169
|
+
},
|
|
170
|
+
})
|
|
122
171
|
end)
|
|
123
172
|
local default = useMarkdownStyles
|
|
124
173
|
return {
|