@rbxts/uiblox 0.2.0-alpha.21 → 0.2.0-alpha.23
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/out/ui/packages/cframeEditor/components/CFrameEditor.luau +64 -38
- package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +26 -9
- package/out/ui/packages/checkbox/components/checkboxLook.d.ts +1 -1
- package/out/ui/packages/colorPicker/components/ColorPicker.luau +3 -3
- package/out/ui/packages/colorPicker/components/ColorPicker.styles.luau +34 -20
- package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +23 -20
- package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +54 -47
- package/out/ui/packages/gradientEditor/components/GradientEditor.luau +45 -27
- package/out/ui/packages/gradientEditor/components/GradientEditor.styles.luau +37 -4
- package/out/ui/packages/imageList/components/ImageList.luau +1 -1
- package/out/ui/packages/imageList/components/ImageList.styles.luau +0 -1
- package/out/ui/packages/index.d.ts +1 -0
- package/out/ui/packages/init.luau +3 -0
- package/out/ui/packages/markdown/components/Markdown.d.ts +6 -0
- package/out/ui/packages/markdown/components/Markdown.luau +228 -0
- package/out/ui/packages/markdown/components/Markdown.styles.d.ts +2 -0
- package/out/ui/packages/markdown/components/Markdown.styles.luau +101 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.d.ts +16 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.luau +322 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.d.ts +6 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.luau +132 -0
- package/out/ui/packages/markdown/htmlToMarkdown.d.ts +2 -0
- package/out/ui/packages/markdown/htmlToMarkdown.luau +350 -0
- package/out/ui/packages/markdown/index.d.ts +8 -0
- package/out/ui/packages/markdown/init.luau +11 -0
- package/out/ui/packages/markdown/parseMarkdown.d.ts +42 -0
- package/out/ui/packages/markdown/parseMarkdown.luau +459 -0
- package/out/ui/packages/menu/components/Menu.luau +1 -1
- package/out/ui/packages/select/components/Select.luau +2 -39
- package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
- package/out/ui/packages/stateMatrix.luau +78 -31
- package/out/ui/packages/switch/components/switchLook.d.ts +1 -1
- package/package.json +2 -2
- package/out/ui/packages/select/components/selectMotion.d.ts +0 -2
- package/out/ui/packages/select/components/selectMotion.luau +0 -12
|
@@ -47,7 +47,7 @@ local function GradientEditor(props)
|
|
|
47
47
|
local _attributes_2 = {
|
|
48
48
|
key = "Color",
|
|
49
49
|
}
|
|
50
|
-
for _k, _v in styles.
|
|
50
|
+
for _k, _v in styles.block do
|
|
51
51
|
_attributes_2[_k] = _v
|
|
52
52
|
end
|
|
53
53
|
_attributes_2.LayoutOrder = 1
|
|
@@ -57,6 +57,7 @@ local function GradientEditor(props)
|
|
|
57
57
|
local _attributes_4 = table.clone(styles.label)
|
|
58
58
|
setmetatable(_attributes_4, nil)
|
|
59
59
|
_attributes_4.Text = "Color"
|
|
60
|
+
_attributes_4.LayoutOrder = 1
|
|
60
61
|
local _exp_2 = React.createElement("frame", _attributes_2, _exp_1, React.createElement("textlabel", _attributes_4), React.createElement(ColorSequenceEditor, {
|
|
61
62
|
value = value.color,
|
|
62
63
|
disabled = disabled,
|
|
@@ -70,7 +71,7 @@ local function GradientEditor(props)
|
|
|
70
71
|
local _attributes_5 = {
|
|
71
72
|
key = "Transparency",
|
|
72
73
|
}
|
|
73
|
-
for _k, _v in styles.
|
|
74
|
+
for _k, _v in styles.block do
|
|
74
75
|
_attributes_5[_k] = _v
|
|
75
76
|
end
|
|
76
77
|
_attributes_5.LayoutOrder = 2
|
|
@@ -80,6 +81,7 @@ local function GradientEditor(props)
|
|
|
80
81
|
local _attributes_7 = table.clone(styles.label)
|
|
81
82
|
setmetatable(_attributes_7, nil)
|
|
82
83
|
_attributes_7.Text = "Transparency"
|
|
84
|
+
_attributes_7.LayoutOrder = 1
|
|
83
85
|
local _exp_4 = React.createElement("frame", _attributes_5, _exp_3, React.createElement("textlabel", _attributes_7), React.createElement(NumberSequenceEditor, {
|
|
84
86
|
value = value.transparency,
|
|
85
87
|
disabled = disabled,
|
|
@@ -91,40 +93,56 @@ local function GradientEditor(props)
|
|
|
91
93
|
end,
|
|
92
94
|
}))
|
|
93
95
|
local _attributes_8 = {
|
|
94
|
-
key = "
|
|
96
|
+
key = "Metrics",
|
|
95
97
|
}
|
|
96
|
-
for _k, _v in styles.
|
|
98
|
+
for _k, _v in styles.metrics do
|
|
97
99
|
_attributes_8[_k] = _v
|
|
98
100
|
end
|
|
99
101
|
_attributes_8.LayoutOrder = 3
|
|
100
|
-
local _attributes_9 = table.clone(styles.
|
|
102
|
+
local _attributes_9 = table.clone(styles.metricsRow)
|
|
101
103
|
setmetatable(_attributes_9, nil)
|
|
102
104
|
local _exp_5 = React.createElement("uilistlayout", _attributes_9)
|
|
103
|
-
local _attributes_10 =
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
local _attributes_10 = {
|
|
106
|
+
key = "Rotation",
|
|
107
|
+
}
|
|
108
|
+
for _k, _v in styles.metric do
|
|
109
|
+
_attributes_10[_k] = _v
|
|
110
|
+
end
|
|
111
|
+
_attributes_10.LayoutOrder = 1
|
|
112
|
+
local _attributes_11 = table.clone(styles.metricInner)
|
|
113
|
+
setmetatable(_attributes_11, nil)
|
|
114
|
+
local _exp_6 = React.createElement("uilistlayout", _attributes_11)
|
|
115
|
+
local _attributes_12 = table.clone(styles.metricLabel)
|
|
116
|
+
setmetatable(_attributes_12, nil)
|
|
117
|
+
_attributes_12.Text = "Rotation"
|
|
118
|
+
_attributes_12.LayoutOrder = 1
|
|
119
|
+
local _exp_7 = React.createElement("textlabel", _attributes_12)
|
|
120
|
+
local _attributes_13 = table.clone(styles.metricField)
|
|
121
|
+
setmetatable(_attributes_13, nil)
|
|
122
|
+
_attributes_13.LayoutOrder = 2
|
|
123
|
+
local _exp_8 = React.createElement("frame", _attributes_10, _exp_6, _exp_7, React.createElement("frame", _attributes_13, React.createElement(NumberInput, {
|
|
107
124
|
value = value.rotation,
|
|
108
125
|
disabled = disabled,
|
|
109
126
|
width = UDim.new(1, 0),
|
|
110
127
|
onChange = function(rotation)
|
|
111
128
|
return onChange(patchGradientRotation(value, rotation))
|
|
112
129
|
end,
|
|
113
|
-
}))
|
|
114
|
-
local
|
|
130
|
+
})))
|
|
131
|
+
local _attributes_14 = {
|
|
115
132
|
key = "Offset",
|
|
116
133
|
}
|
|
117
|
-
for _k, _v in styles.
|
|
118
|
-
|
|
134
|
+
for _k, _v in styles.metric do
|
|
135
|
+
_attributes_14[_k] = _v
|
|
119
136
|
end
|
|
120
|
-
|
|
121
|
-
local
|
|
122
|
-
setmetatable(
|
|
123
|
-
local
|
|
124
|
-
local
|
|
125
|
-
setmetatable(
|
|
126
|
-
|
|
127
|
-
|
|
137
|
+
_attributes_14.LayoutOrder = 2
|
|
138
|
+
local _attributes_15 = table.clone(styles.column)
|
|
139
|
+
setmetatable(_attributes_15, nil)
|
|
140
|
+
local _exp_9 = React.createElement("uilistlayout", _attributes_15)
|
|
141
|
+
local _attributes_16 = table.clone(styles.metricLabel)
|
|
142
|
+
setmetatable(_attributes_16, nil)
|
|
143
|
+
_attributes_16.Text = "Offset"
|
|
144
|
+
_attributes_16.LayoutOrder = 1
|
|
145
|
+
local _exp_10 = React.createElement("frame", _attributes_8, _exp_5, _exp_8, React.createElement("frame", _attributes_14, _exp_9, React.createElement("textlabel", _attributes_16), React.createElement(VectorEditor, {
|
|
128
146
|
value = value.offset,
|
|
129
147
|
disabled = disabled,
|
|
130
148
|
onChange = function(offset)
|
|
@@ -133,15 +151,15 @@ local function GradientEditor(props)
|
|
|
133
151
|
_object.offset = offset
|
|
134
152
|
return onChange(_object)
|
|
135
153
|
end,
|
|
136
|
-
}))
|
|
137
|
-
local
|
|
154
|
+
})))
|
|
155
|
+
local _attributes_17 = {
|
|
138
156
|
key = "Enabled",
|
|
139
157
|
}
|
|
140
|
-
for _k, _v in styles.
|
|
141
|
-
|
|
158
|
+
for _k, _v in styles.block do
|
|
159
|
+
_attributes_17[_k] = _v
|
|
142
160
|
end
|
|
143
|
-
|
|
144
|
-
return React.createElement("frame", _attributes, _exp, _exp_2, _exp_4,
|
|
161
|
+
_attributes_17.LayoutOrder = 4
|
|
162
|
+
return React.createElement("frame", _attributes, _exp, _exp_2, _exp_4, _exp_10, React.createElement("frame", _attributes_17, React.createElement(Switch, {
|
|
145
163
|
value = value.enabled,
|
|
146
164
|
disabled = disabled,
|
|
147
165
|
label = "Enabled",
|
|
@@ -13,22 +13,55 @@ local useGradientEditorStyles = componentStyles("GradientEditor", function(theme
|
|
|
13
13
|
},
|
|
14
14
|
column = {
|
|
15
15
|
FillDirection = Enum.FillDirection.Vertical,
|
|
16
|
-
Padding = UDim.new(0, theme.padding.calc(
|
|
16
|
+
Padding = UDim.new(0, theme.padding.calc(0.5)),
|
|
17
17
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
block = {
|
|
20
20
|
Size = UDim2.new(1, 0, 0, 0),
|
|
21
21
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
22
22
|
BackgroundTransparency = 1,
|
|
23
23
|
},
|
|
24
24
|
label = {
|
|
25
|
-
Size = UDim2.new(1, 0, 0, theme.spacing.calc(
|
|
25
|
+
Size = UDim2.new(1, 0, 0, theme.spacing.calc(2)),
|
|
26
26
|
BackgroundTransparency = 1,
|
|
27
27
|
Font = theme.typography.fontFamilies.default,
|
|
28
|
-
TextSize = theme.typography.fontSizes.
|
|
28
|
+
TextSize = theme.typography.fontSizes.button,
|
|
29
29
|
TextColor3 = theme.palette.text.secondary,
|
|
30
30
|
TextXAlignment = Enum.TextXAlignment.Left,
|
|
31
31
|
},
|
|
32
|
+
metrics = {
|
|
33
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
34
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
35
|
+
BackgroundTransparency = 1,
|
|
36
|
+
},
|
|
37
|
+
metricsRow = {
|
|
38
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
39
|
+
Padding = UDim.new(0, theme.padding.calc(1)),
|
|
40
|
+
VerticalAlignment = Enum.VerticalAlignment.Top,
|
|
41
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
42
|
+
},
|
|
43
|
+
metric = {
|
|
44
|
+
Size = UDim2.new(0.5, -theme.padding.calc(0.5), 0, 0),
|
|
45
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
46
|
+
BackgroundTransparency = 1,
|
|
47
|
+
},
|
|
48
|
+
metricInner = {
|
|
49
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
50
|
+
Padding = UDim.new(0, theme.padding.calc(0.5)),
|
|
51
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
52
|
+
},
|
|
53
|
+
metricLabel = {
|
|
54
|
+
Size = UDim2.new(1, 0, 0, theme.spacing.calc(2)),
|
|
55
|
+
BackgroundTransparency = 1,
|
|
56
|
+
Font = theme.typography.fontFamilies.default,
|
|
57
|
+
TextSize = theme.typography.fontSizes.button,
|
|
58
|
+
TextColor3 = theme.palette.text.secondary,
|
|
59
|
+
TextXAlignment = Enum.TextXAlignment.Left,
|
|
60
|
+
},
|
|
61
|
+
metricField = {
|
|
62
|
+
Size = UDim2.new(1, 0, 0, theme.spacing.calc(3)),
|
|
63
|
+
BackgroundTransparency = 1,
|
|
64
|
+
},
|
|
32
65
|
})
|
|
33
66
|
end)
|
|
34
67
|
local default = useGradientEditorStyles
|
|
@@ -92,7 +92,7 @@ local function ImageList(props)
|
|
|
92
92
|
_newValue[_k] = _callback(_v, _k - 1, items)
|
|
93
93
|
end
|
|
94
94
|
-- ▲ ReadonlyArray.map ▲
|
|
95
|
-
return React.createElement("frame", _attributes, _exp, _newValue)
|
|
95
|
+
return React.createElement("frame", _attributes, _exp, React.createElement(React.Fragment, nil, _newValue))
|
|
96
96
|
end
|
|
97
97
|
local default = ImageList
|
|
98
98
|
return {
|
|
@@ -57,6 +57,7 @@ export * from "./bottomNavigation/index";
|
|
|
57
57
|
export * from "./alert/index";
|
|
58
58
|
export * from "./toggleButton/index";
|
|
59
59
|
export * from "./link/index";
|
|
60
|
+
export * from "./markdown/index";
|
|
60
61
|
export * from "./rating/index";
|
|
61
62
|
export * from "./listItem/index";
|
|
62
63
|
export * from "./menu/index";
|
|
@@ -178,6 +178,9 @@ end
|
|
|
178
178
|
for _k, _v in TS.import(script, script, "link") or {} do
|
|
179
179
|
exports[_k] = _v
|
|
180
180
|
end
|
|
181
|
+
for _k, _v in TS.import(script, script, "markdown") or {} do
|
|
182
|
+
exports[_k] = _v
|
|
183
|
+
end
|
|
181
184
|
for _k, _v in TS.import(script, script, "rating") or {} do
|
|
182
185
|
exports[_k] = _v
|
|
183
186
|
end
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local Divider = TS.import(script, script.Parent.Parent.Parent, "divider").Divider
|
|
5
|
+
local Orientations = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Orientations
|
|
6
|
+
local _parseMarkdown = TS.import(script, script.Parent.Parent, "parseMarkdown")
|
|
7
|
+
local inlinesToRichText = _parseMarkdown.inlinesToRichText
|
|
8
|
+
local parseMarkdown = _parseMarkdown.parseMarkdown
|
|
9
|
+
local useMarkdownStyles = TS.import(script, script.Parent, "Markdown.styles").default
|
|
10
|
+
local function headingVariant(level)
|
|
11
|
+
if level <= 1 then
|
|
12
|
+
return "h1"
|
|
13
|
+
end
|
|
14
|
+
if level == 2 then
|
|
15
|
+
return "h2"
|
|
16
|
+
end
|
|
17
|
+
if level == 3 then
|
|
18
|
+
return "h3"
|
|
19
|
+
end
|
|
20
|
+
if level == 4 then
|
|
21
|
+
return "h4"
|
|
22
|
+
end
|
|
23
|
+
if level == 5 then
|
|
24
|
+
return "h5"
|
|
25
|
+
end
|
|
26
|
+
return "h6"
|
|
27
|
+
end
|
|
28
|
+
local function textSizeFor(variant)
|
|
29
|
+
if variant == "h1" then
|
|
30
|
+
return 28
|
|
31
|
+
end
|
|
32
|
+
if variant == "h2" then
|
|
33
|
+
return 22
|
|
34
|
+
end
|
|
35
|
+
if variant == "h3" then
|
|
36
|
+
return 18
|
|
37
|
+
end
|
|
38
|
+
if variant == "h4" then
|
|
39
|
+
return 16
|
|
40
|
+
end
|
|
41
|
+
if variant == "h5" or variant == "h6" then
|
|
42
|
+
return 14
|
|
43
|
+
end
|
|
44
|
+
return 14
|
|
45
|
+
end
|
|
46
|
+
local function richLabel(key, styles, inlines, variant, order)
|
|
47
|
+
local text = inlinesToRichText(inlines)
|
|
48
|
+
local _attributes = {
|
|
49
|
+
key = key,
|
|
50
|
+
}
|
|
51
|
+
for _k, _v in styles.text do
|
|
52
|
+
_attributes[_k] = _v
|
|
53
|
+
end
|
|
54
|
+
_attributes.LayoutOrder = order
|
|
55
|
+
_attributes.Text = text
|
|
56
|
+
_attributes.TextSize = textSizeFor(variant)
|
|
57
|
+
_attributes.Font = if variant ~= nil and variant ~= "body" then Enum.Font.SourceSansBold else Enum.Font.SourceSans
|
|
58
|
+
return React.createElement("textlabel", _attributes)
|
|
59
|
+
end
|
|
60
|
+
local function renderBlock(block, index, styles)
|
|
61
|
+
if block.kind == "heading" then
|
|
62
|
+
local _attributes = {
|
|
63
|
+
key = `h-{index}`,
|
|
64
|
+
}
|
|
65
|
+
for _k, _v in styles.block do
|
|
66
|
+
_attributes[_k] = _v
|
|
67
|
+
end
|
|
68
|
+
_attributes.LayoutOrder = index
|
|
69
|
+
return React.createElement("frame", _attributes, richLabel("Text", styles, block.inlines, headingVariant(block.level)))
|
|
70
|
+
end
|
|
71
|
+
if block.kind == "paragraph" then
|
|
72
|
+
local _attributes = {
|
|
73
|
+
key = `p-{index}`,
|
|
74
|
+
}
|
|
75
|
+
for _k, _v in styles.block do
|
|
76
|
+
_attributes[_k] = _v
|
|
77
|
+
end
|
|
78
|
+
_attributes.LayoutOrder = index
|
|
79
|
+
return React.createElement("frame", _attributes, richLabel("Text", styles, block.inlines, "body"))
|
|
80
|
+
end
|
|
81
|
+
if block.kind == "code" then
|
|
82
|
+
local _attributes = {
|
|
83
|
+
key = `c-{index}`,
|
|
84
|
+
}
|
|
85
|
+
for _k, _v in styles.code do
|
|
86
|
+
_attributes[_k] = _v
|
|
87
|
+
end
|
|
88
|
+
_attributes.LayoutOrder = index
|
|
89
|
+
local _exp = React.createElement("uicorner", {
|
|
90
|
+
CornerRadius = UDim.new(0, 4),
|
|
91
|
+
})
|
|
92
|
+
local _attributes_1 = table.clone(styles.codePad)
|
|
93
|
+
setmetatable(_attributes_1, nil)
|
|
94
|
+
local _exp_1 = React.createElement("uipadding", _attributes_1)
|
|
95
|
+
local _attributes_2 = {
|
|
96
|
+
key = "Code",
|
|
97
|
+
}
|
|
98
|
+
for _k, _v in styles.codeText do
|
|
99
|
+
_attributes_2[_k] = _v
|
|
100
|
+
end
|
|
101
|
+
_attributes_2.Text = block.text
|
|
102
|
+
return React.createElement("frame", _attributes, _exp, _exp_1, React.createElement("textlabel", _attributes_2))
|
|
103
|
+
end
|
|
104
|
+
if block.kind == "hr" then
|
|
105
|
+
return React.createElement(Divider, {
|
|
106
|
+
key = `hr-{index}`,
|
|
107
|
+
orientation = Orientations.Horizontal,
|
|
108
|
+
padding = 0,
|
|
109
|
+
className = {
|
|
110
|
+
LayoutOrder = index,
|
|
111
|
+
},
|
|
112
|
+
})
|
|
113
|
+
end
|
|
114
|
+
if block.kind == "blockquote" then
|
|
115
|
+
local _attributes = {
|
|
116
|
+
key = `q-{index}`,
|
|
117
|
+
}
|
|
118
|
+
for _k, _v in styles.quote do
|
|
119
|
+
_attributes[_k] = _v
|
|
120
|
+
end
|
|
121
|
+
_attributes.LayoutOrder = index
|
|
122
|
+
local _exp = React.createElement("uicorner", {
|
|
123
|
+
CornerRadius = UDim.new(0, 4),
|
|
124
|
+
})
|
|
125
|
+
local _attributes_1 = {
|
|
126
|
+
key = "Bar",
|
|
127
|
+
}
|
|
128
|
+
for _k, _v in styles.quoteBar do
|
|
129
|
+
_attributes_1[_k] = _v
|
|
130
|
+
end
|
|
131
|
+
local _exp_1 = React.createElement("frame", _attributes_1)
|
|
132
|
+
local _attributes_2 = table.clone(styles.quotePad)
|
|
133
|
+
setmetatable(_attributes_2, nil)
|
|
134
|
+
return React.createElement("frame", _attributes, _exp, _exp_1, React.createElement("uipadding", _attributes_2), richLabel("Text", styles, block.inlines, "body"))
|
|
135
|
+
end
|
|
136
|
+
if block.kind == "list" then
|
|
137
|
+
local _attributes = {
|
|
138
|
+
key = `l-{index}`,
|
|
139
|
+
}
|
|
140
|
+
for _k, _v in styles.block do
|
|
141
|
+
_attributes[_k] = _v
|
|
142
|
+
end
|
|
143
|
+
_attributes.LayoutOrder = index
|
|
144
|
+
local _exp = React.createElement("uilistlayout", {
|
|
145
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
146
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Left,
|
|
147
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
148
|
+
Padding = UDim.new(0, 2),
|
|
149
|
+
})
|
|
150
|
+
local _exp_1 = block.items
|
|
151
|
+
-- ▼ ReadonlyArray.map ▼
|
|
152
|
+
local _newValue = table.create(#_exp_1)
|
|
153
|
+
local _callback = function(item, itemIndex)
|
|
154
|
+
local prefix = if block.ordered then `{itemIndex + 1}. ` else "• "
|
|
155
|
+
local _array = { {
|
|
156
|
+
kind = "text",
|
|
157
|
+
text = prefix,
|
|
158
|
+
} }
|
|
159
|
+
local _length = #_array
|
|
160
|
+
table.move(item, 1, #item, _length + 1, _array)
|
|
161
|
+
local labeled = _array
|
|
162
|
+
local _attributes_1 = {
|
|
163
|
+
key = `li-{itemIndex}`,
|
|
164
|
+
}
|
|
165
|
+
for _k, _v in styles.listItem do
|
|
166
|
+
_attributes_1[_k] = _v
|
|
167
|
+
end
|
|
168
|
+
_attributes_1.LayoutOrder = itemIndex
|
|
169
|
+
return React.createElement("frame", _attributes_1, richLabel("Text", styles, labeled, "body"))
|
|
170
|
+
end
|
|
171
|
+
for _k, _v in _exp_1 do
|
|
172
|
+
_newValue[_k] = _callback(_v, _k - 1, _exp_1)
|
|
173
|
+
end
|
|
174
|
+
-- ▲ ReadonlyArray.map ▲
|
|
175
|
+
return React.createElement("frame", _attributes, _exp, _newValue)
|
|
176
|
+
end
|
|
177
|
+
return nil
|
|
178
|
+
end
|
|
179
|
+
local function Markdown(props)
|
|
180
|
+
local _binding = props
|
|
181
|
+
local value = _binding.value
|
|
182
|
+
if value == nil then
|
|
183
|
+
value = ""
|
|
184
|
+
end
|
|
185
|
+
local className = _binding.className
|
|
186
|
+
local sx = _binding.sx
|
|
187
|
+
local id = _binding.id
|
|
188
|
+
local ref = _binding.ref
|
|
189
|
+
local styles = useMarkdownStyles()
|
|
190
|
+
local blocks = parseMarkdown(value)
|
|
191
|
+
local _attributes = {}
|
|
192
|
+
local _condition = id
|
|
193
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
194
|
+
_condition = "Markdown"
|
|
195
|
+
end
|
|
196
|
+
_attributes.key = _condition
|
|
197
|
+
_attributes.ref = ref
|
|
198
|
+
for _k, _v in styles.root do
|
|
199
|
+
_attributes[_k] = _v
|
|
200
|
+
end
|
|
201
|
+
if className then
|
|
202
|
+
for _k, _v in className do
|
|
203
|
+
_attributes[_k] = _v
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
if sx then
|
|
207
|
+
for _k, _v in sx do
|
|
208
|
+
_attributes[_k] = _v
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
local _attributes_1 = table.clone(styles.layout)
|
|
212
|
+
setmetatable(_attributes_1, nil)
|
|
213
|
+
local _exp = React.createElement("uilistlayout", _attributes_1)
|
|
214
|
+
-- ▼ ReadonlyArray.map ▼
|
|
215
|
+
local _newValue = table.create(#blocks)
|
|
216
|
+
local _callback = function(block, index)
|
|
217
|
+
return renderBlock(block, index, styles)
|
|
218
|
+
end
|
|
219
|
+
for _k, _v in blocks do
|
|
220
|
+
_newValue[_k] = _callback(_v, _k - 1, blocks)
|
|
221
|
+
end
|
|
222
|
+
-- ▲ ReadonlyArray.map ▲
|
|
223
|
+
return React.createElement("frame", _attributes, _exp, _newValue)
|
|
224
|
+
end
|
|
225
|
+
local default = Markdown
|
|
226
|
+
return {
|
|
227
|
+
default = default,
|
|
228
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
|
+
local componentStyles = _theme.componentStyles
|
|
5
|
+
local createStyles = _theme.createStyles
|
|
6
|
+
local useMarkdownStyles = componentStyles("Markdown", function(theme)
|
|
7
|
+
local gap = if theme.density == "compact" then theme.padding.calc(1) else theme.spacing.calc(1)
|
|
8
|
+
local _object = {
|
|
9
|
+
root = {
|
|
10
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
11
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
12
|
+
BackgroundTransparency = 1,
|
|
13
|
+
BorderSizePixel = 0,
|
|
14
|
+
},
|
|
15
|
+
layout = {
|
|
16
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
17
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Left,
|
|
18
|
+
VerticalAlignment = Enum.VerticalAlignment.Top,
|
|
19
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
20
|
+
Padding = UDim.new(0, gap),
|
|
21
|
+
},
|
|
22
|
+
block = {
|
|
23
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
24
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
25
|
+
BackgroundTransparency = 1,
|
|
26
|
+
BorderSizePixel = 0,
|
|
27
|
+
},
|
|
28
|
+
text = {
|
|
29
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
30
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
31
|
+
BackgroundTransparency = 1,
|
|
32
|
+
BorderSizePixel = 0,
|
|
33
|
+
Font = theme.typography.fontFamilies.default,
|
|
34
|
+
TextSize = theme.typography.fontSizes.body,
|
|
35
|
+
TextColor3 = theme.palette.text.primary,
|
|
36
|
+
TextXAlignment = Enum.TextXAlignment.Left,
|
|
37
|
+
TextYAlignment = Enum.TextYAlignment.Top,
|
|
38
|
+
TextWrapped = true,
|
|
39
|
+
RichText = true,
|
|
40
|
+
},
|
|
41
|
+
code = {
|
|
42
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
43
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
44
|
+
BackgroundColor3 = theme.palette.surface.paper,
|
|
45
|
+
BorderSizePixel = 0,
|
|
46
|
+
},
|
|
47
|
+
codePad = {
|
|
48
|
+
PaddingTop = UDim.new(0, theme.padding.calc(1)),
|
|
49
|
+
PaddingBottom = UDim.new(0, theme.padding.calc(1)),
|
|
50
|
+
PaddingLeft = UDim.new(0, theme.padding.calc(1.5)),
|
|
51
|
+
PaddingRight = UDim.new(0, theme.padding.calc(1.5)),
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
local _left = "codeText"
|
|
55
|
+
local _object_1 = {
|
|
56
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
57
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
58
|
+
BackgroundTransparency = 1,
|
|
59
|
+
BorderSizePixel = 0,
|
|
60
|
+
Font = Enum.Font.RobotoMono,
|
|
61
|
+
}
|
|
62
|
+
local _left_1 = "TextSize"
|
|
63
|
+
local _condition = theme.typography.fontSizes.caption
|
|
64
|
+
if _condition == nil then
|
|
65
|
+
_condition = theme.typography.fontSizes.body
|
|
66
|
+
end
|
|
67
|
+
_object_1[_left_1] = _condition
|
|
68
|
+
_object_1.TextColor3 = theme.palette.text.primary
|
|
69
|
+
_object_1.TextXAlignment = Enum.TextXAlignment.Left
|
|
70
|
+
_object_1.TextYAlignment = Enum.TextYAlignment.Top
|
|
71
|
+
_object_1.TextWrapped = true
|
|
72
|
+
_object[_left] = _object_1
|
|
73
|
+
_object.quote = {
|
|
74
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
75
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
76
|
+
BackgroundColor3 = theme.palette.surface.paper,
|
|
77
|
+
BorderSizePixel = 0,
|
|
78
|
+
}
|
|
79
|
+
_object.quoteBar = {
|
|
80
|
+
Size = UDim2.new(0, 3, 1, 0),
|
|
81
|
+
BackgroundColor3 = theme.palette.primary.main,
|
|
82
|
+
BorderSizePixel = 0,
|
|
83
|
+
}
|
|
84
|
+
_object.quotePad = {
|
|
85
|
+
PaddingTop = UDim.new(0, theme.padding.calc(1)),
|
|
86
|
+
PaddingBottom = UDim.new(0, theme.padding.calc(1)),
|
|
87
|
+
PaddingLeft = UDim.new(0, theme.padding.calc(2)),
|
|
88
|
+
PaddingRight = UDim.new(0, theme.padding.calc(1)),
|
|
89
|
+
}
|
|
90
|
+
_object.listItem = {
|
|
91
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
92
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
93
|
+
BackgroundTransparency = 1,
|
|
94
|
+
BorderSizePixel = 0,
|
|
95
|
+
}
|
|
96
|
+
return createStyles(_object)
|
|
97
|
+
end)
|
|
98
|
+
local default = useMarkdownStyles
|
|
99
|
+
return {
|
|
100
|
+
default = default,
|
|
101
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
3
|
+
import { MarkdownEditorMode } from "./MarkdownEditor.styles";
|
|
4
|
+
export interface MarkdownEditorProps {
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (value: string) => void;
|
|
7
|
+
mode?: MarkdownEditorMode;
|
|
8
|
+
onModeChange?: (mode: MarkdownEditorMode) => void;
|
|
9
|
+
fullscreen?: boolean;
|
|
10
|
+
onFullscreenChange?: (fullscreen: boolean) => void;
|
|
11
|
+
preview?: (value: string) => React.Element;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function MarkdownEditor(props: CustomizedProps<Frame, MarkdownEditorProps>): JSX.Element;
|
|
15
|
+
export default MarkdownEditor;
|
|
16
|
+
export type { MarkdownEditorMode };
|