@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.
Files changed (35) hide show
  1. package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +64 -38
  2. package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +26 -9
  3. package/out/ui/packages/checkbox/components/checkboxLook.d.ts +1 -1
  4. package/out/ui/packages/colorPicker/components/ColorPicker.luau +3 -3
  5. package/out/ui/packages/colorPicker/components/ColorPicker.styles.luau +34 -20
  6. package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +23 -20
  7. package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +54 -47
  8. package/out/ui/packages/gradientEditor/components/GradientEditor.luau +45 -27
  9. package/out/ui/packages/gradientEditor/components/GradientEditor.styles.luau +37 -4
  10. package/out/ui/packages/imageList/components/ImageList.luau +1 -1
  11. package/out/ui/packages/imageList/components/ImageList.styles.luau +0 -1
  12. package/out/ui/packages/index.d.ts +1 -0
  13. package/out/ui/packages/init.luau +3 -0
  14. package/out/ui/packages/markdown/components/Markdown.d.ts +6 -0
  15. package/out/ui/packages/markdown/components/Markdown.luau +228 -0
  16. package/out/ui/packages/markdown/components/Markdown.styles.d.ts +2 -0
  17. package/out/ui/packages/markdown/components/Markdown.styles.luau +101 -0
  18. package/out/ui/packages/markdown/components/MarkdownEditor.d.ts +16 -0
  19. package/out/ui/packages/markdown/components/MarkdownEditor.luau +322 -0
  20. package/out/ui/packages/markdown/components/MarkdownEditor.styles.d.ts +6 -0
  21. package/out/ui/packages/markdown/components/MarkdownEditor.styles.luau +132 -0
  22. package/out/ui/packages/markdown/htmlToMarkdown.d.ts +2 -0
  23. package/out/ui/packages/markdown/htmlToMarkdown.luau +350 -0
  24. package/out/ui/packages/markdown/index.d.ts +8 -0
  25. package/out/ui/packages/markdown/init.luau +11 -0
  26. package/out/ui/packages/markdown/parseMarkdown.d.ts +42 -0
  27. package/out/ui/packages/markdown/parseMarkdown.luau +459 -0
  28. package/out/ui/packages/menu/components/Menu.luau +1 -1
  29. package/out/ui/packages/select/components/Select.luau +2 -39
  30. package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
  31. package/out/ui/packages/stateMatrix.luau +78 -31
  32. package/out/ui/packages/switch/components/switchLook.d.ts +1 -1
  33. package/package.json +2 -2
  34. package/out/ui/packages/select/components/selectMotion.d.ts +0 -2
  35. package/out/ui/packages/select/components/selectMotion.luau +0 -12
@@ -0,0 +1,459 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local function trimEnd(value)
3
+ local stop = #value
4
+ while stop > 0 do
5
+ local _value = value
6
+ local _stop = stop
7
+ local _stop_1 = stop
8
+ local ch = string.sub(_value, _stop, _stop_1)
9
+ if ch ~= " " and ch ~= "\t" and ch ~= "\r" then
10
+ break
11
+ end
12
+ stop -= 1
13
+ end
14
+ local _value = value
15
+ local _stop = stop
16
+ return string.sub(_value, 1, _stop)
17
+ end
18
+ local function trim(value)
19
+ local start = 1
20
+ local stop = #value
21
+ while start <= stop do
22
+ local _value = value
23
+ local _start = start
24
+ local _start_1 = start
25
+ local ch = string.sub(_value, _start, _start_1)
26
+ if ch ~= " " and ch ~= "\t" and ch ~= "\r" then
27
+ break
28
+ end
29
+ start += 1
30
+ end
31
+ while stop >= start do
32
+ local _value = value
33
+ local _stop = stop
34
+ local _stop_1 = stop
35
+ local ch = string.sub(_value, _stop, _stop_1)
36
+ if ch ~= " " and ch ~= "\t" and ch ~= "\r" then
37
+ break
38
+ end
39
+ stop -= 1
40
+ end
41
+ if start > stop then
42
+ return ""
43
+ end
44
+ local _value = value
45
+ local _start = start
46
+ local _stop = stop
47
+ return string.sub(_value, _start, _stop)
48
+ end
49
+ local function headingLevel(line)
50
+ local n = 0
51
+ while true do
52
+ local _condition = n < #line and n < 6
53
+ if _condition then
54
+ local _line = line
55
+ local _arg0 = n + 1
56
+ local _arg1 = n + 1
57
+ _condition = string.sub(_line, _arg0, _arg1) == "#"
58
+ end
59
+ if not _condition then
60
+ break
61
+ end
62
+ n += 1
63
+ end
64
+ if n == 0 then
65
+ return nil
66
+ end
67
+ local _condition = n < #line
68
+ if _condition then
69
+ local _line = line
70
+ local _arg0 = n + 1
71
+ local _arg1 = n + 1
72
+ _condition = string.sub(_line, _arg0, _arg1) ~= " "
73
+ end
74
+ if _condition then
75
+ return nil
76
+ end
77
+ return n
78
+ end
79
+ local function parseInlines(source)
80
+ local out = {}
81
+ local i = 1
82
+ local n = #source
83
+ local buf = ""
84
+ local flush = function()
85
+ if #buf > 0 then
86
+ local _arg0 = {
87
+ kind = "text",
88
+ text = buf,
89
+ }
90
+ table.insert(out, _arg0)
91
+ buf = ""
92
+ end
93
+ end
94
+ while i <= n do
95
+ local _source = source
96
+ local _i = i
97
+ local _i_1 = i
98
+ local ch = string.sub(_source, _i, _i_1)
99
+ if ch == "`" then
100
+ local _source_1 = source
101
+ local _arg1 = i + 1
102
+ local close = { string.find(_source_1, "`", _arg1, true) }
103
+ local endAt = close[1]
104
+ if endAt ~= nil then
105
+ flush()
106
+ local _object = {
107
+ kind = "code",
108
+ }
109
+ local _left = "text"
110
+ local _source_2 = source
111
+ local _arg0 = i + 1
112
+ local _arg1_1 = endAt - 1
113
+ _object[_left] = string.sub(_source_2, _arg0, _arg1_1)
114
+ table.insert(out, _object)
115
+ i = endAt + 1
116
+ continue
117
+ end
118
+ end
119
+ if ch == "[" then
120
+ local _source_1 = source
121
+ local _arg1 = i + 1
122
+ local mid = { string.find(_source_1, "](", _arg1, true) }
123
+ local midAt = mid[1]
124
+ if midAt ~= nil then
125
+ local _source_2 = source
126
+ local _arg1_1 = midAt + 2
127
+ local closeParen = { string.find(_source_2, ")", _arg1_1, true) }
128
+ local endAt = closeParen[1]
129
+ if endAt ~= nil then
130
+ flush()
131
+ local _object = {
132
+ kind = "link",
133
+ }
134
+ local _left = "text"
135
+ local _source_3 = source
136
+ local _arg0 = i + 1
137
+ local _arg1_2 = midAt - 1
138
+ _object[_left] = string.sub(_source_3, _arg0, _arg1_2)
139
+ local _left_1 = "href"
140
+ local _source_4 = source
141
+ local _arg0_1 = midAt + 2
142
+ local _arg1_3 = endAt - 1
143
+ _object[_left_1] = string.sub(_source_4, _arg0_1, _arg1_3)
144
+ table.insert(out, _object)
145
+ i = endAt + 1
146
+ continue
147
+ end
148
+ end
149
+ end
150
+ local _condition = ch == "*" and i + 1 <= n
151
+ if _condition then
152
+ local _source_1 = source
153
+ local _arg0 = i + 1
154
+ local _arg1 = i + 1
155
+ _condition = string.sub(_source_1, _arg0, _arg1) == "*"
156
+ end
157
+ if _condition then
158
+ local _source_1 = source
159
+ local _arg1 = i + 2
160
+ local close = { string.find(_source_1, "**", _arg1, true) }
161
+ local endAt = close[1]
162
+ if endAt ~= nil then
163
+ flush()
164
+ local _object = {
165
+ kind = "bold",
166
+ }
167
+ local _left = "text"
168
+ local _source_2 = source
169
+ local _arg0 = i + 2
170
+ local _arg1_1 = endAt - 1
171
+ _object[_left] = string.sub(_source_2, _arg0, _arg1_1)
172
+ table.insert(out, _object)
173
+ i = endAt + 2
174
+ continue
175
+ end
176
+ end
177
+ local _condition_1 = ch == "*"
178
+ if _condition_1 then
179
+ local _condition_2 = i == 1
180
+ if not _condition_2 then
181
+ local _source_1 = source
182
+ local _arg0 = i - 1
183
+ local _arg1 = i - 1
184
+ _condition_2 = string.sub(_source_1, _arg0, _arg1) ~= "*"
185
+ end
186
+ _condition_1 = _condition_2
187
+ end
188
+ if _condition_1 then
189
+ local _source_1 = source
190
+ local _arg1 = i + 1
191
+ local close = { string.find(_source_1, "*", _arg1, true) }
192
+ local endAt = close[1]
193
+ local _condition_2 = endAt ~= nil
194
+ if _condition_2 then
195
+ local _source_2 = source
196
+ local _arg0 = endAt + 1
197
+ local _arg1_1 = endAt + 1
198
+ _condition_2 = string.sub(_source_2, _arg0, _arg1_1) ~= "*"
199
+ end
200
+ if _condition_2 then
201
+ flush()
202
+ local _object = {
203
+ kind = "italic",
204
+ }
205
+ local _left = "text"
206
+ local _source_2 = source
207
+ local _arg0 = i + 1
208
+ local _arg1_1 = endAt - 1
209
+ _object[_left] = string.sub(_source_2, _arg0, _arg1_1)
210
+ table.insert(out, _object)
211
+ i = endAt + 1
212
+ continue
213
+ end
214
+ end
215
+ buf = `{buf}{ch}`
216
+ i += 1
217
+ end
218
+ flush()
219
+ return if #out > 0 then out else { {
220
+ kind = "text",
221
+ text = "",
222
+ } }
223
+ end
224
+ local function isHr(line)
225
+ local t = trim(line)
226
+ if #t < 3 then
227
+ return false
228
+ end
229
+ local ch = string.sub(t, 1, 1)
230
+ if ch ~= "-" and ch ~= "*" and ch ~= "_" then
231
+ return false
232
+ end
233
+ for i = 1, #t do
234
+ local _i = i
235
+ local _i_1 = i
236
+ local c = string.sub(t, _i, _i_1)
237
+ if c ~= ch and c ~= " " then
238
+ return false
239
+ end
240
+ end
241
+ return true
242
+ end
243
+ local function listMarker(line)
244
+ local t = trim(line)
245
+ if #t >= 2 and (string.sub(t, 1, 2) == "- " or string.sub(t, 1, 2) == "* ") then
246
+ return {
247
+ ordered = false,
248
+ rest = string.sub(t, 3),
249
+ }
250
+ end
251
+ local i = 1
252
+ while i <= #t do
253
+ local _i = i
254
+ local _i_1 = i
255
+ local c = string.sub(t, _i, _i_1)
256
+ if c < "0" or c > "9" then
257
+ break
258
+ end
259
+ i += 1
260
+ end
261
+ local _condition = i > 1 and i + 1 <= #t
262
+ if _condition then
263
+ local _i = i
264
+ local _arg1 = i + 1
265
+ _condition = string.sub(t, _i, _arg1) == ". "
266
+ end
267
+ if _condition then
268
+ local _object = {
269
+ ordered = true,
270
+ }
271
+ local _left = "rest"
272
+ local _arg0 = i + 2
273
+ _object[_left] = string.sub(t, _arg0)
274
+ return _object
275
+ end
276
+ return nil
277
+ end
278
+ --* Small markdown subset → blocks. Unsupported syntax stays plain text.
279
+ local function parseMarkdown(source)
280
+ local lines = string.split(source, "\n")
281
+ local blocks = {}
282
+ local i = 0
283
+ while i < #lines do
284
+ local raw = lines[i + 1]
285
+ local line = trimEnd(raw)
286
+ if trim(line) == "" then
287
+ i += 1
288
+ continue
289
+ end
290
+ if #line >= 3 and string.sub(line, 1, 3) == "```" then
291
+ local body = {}
292
+ i += 1
293
+ while i < #lines and not (#lines[i + 1] >= 3 and string.sub(trim(lines[i + 1]), 1, 3) == "```") do
294
+ local _arg0 = lines[i + 1]
295
+ table.insert(body, _arg0)
296
+ i += 1
297
+ end
298
+ if i < #lines then
299
+ i += 1
300
+ end
301
+ local _arg0 = {
302
+ kind = "code",
303
+ text = table.concat(body, "\n"),
304
+ }
305
+ table.insert(blocks, _arg0)
306
+ continue
307
+ end
308
+ if isHr(line) then
309
+ table.insert(blocks, {
310
+ kind = "hr",
311
+ })
312
+ i += 1
313
+ continue
314
+ end
315
+ local level = headingLevel(line)
316
+ if level ~= nil then
317
+ local _object = {
318
+ kind = "heading",
319
+ level = level,
320
+ }
321
+ local _left = "inlines"
322
+ local _arg0 = level + 1
323
+ _object[_left] = parseInlines(trim(string.sub(line, _arg0)))
324
+ table.insert(blocks, _object)
325
+ i += 1
326
+ continue
327
+ end
328
+ if string.sub(line, 1, 1) == ">" and (#line == 1 or string.sub(line, 2, 2) == " ") then
329
+ local parts = {}
330
+ while i < #lines do
331
+ local cur = trimEnd(lines[i + 1])
332
+ if not (string.sub(cur, 1, 1) == ">" and (#cur == 1 or string.sub(cur, 2, 2) == " ")) then
333
+ break
334
+ end
335
+ local _arg0 = if #cur >= 2 then string.sub(cur, 3) else ""
336
+ table.insert(parts, _arg0)
337
+ i += 1
338
+ end
339
+ local _arg0 = {
340
+ kind = "blockquote",
341
+ inlines = parseInlines(table.concat(parts, " ")),
342
+ }
343
+ table.insert(blocks, _arg0)
344
+ continue
345
+ end
346
+ local marker = listMarker(line)
347
+ if marker ~= nil then
348
+ local ordered = marker.ordered
349
+ local items = { parseInlines(marker.rest) }
350
+ i += 1
351
+ while i < #lines do
352
+ local following = listMarker(trimEnd(lines[i + 1]))
353
+ if following == nil or following.ordered ~= ordered then
354
+ break
355
+ end
356
+ local _arg0 = parseInlines(following.rest)
357
+ table.insert(items, _arg0)
358
+ i += 1
359
+ end
360
+ local _arg0 = {
361
+ kind = "list",
362
+ ordered = ordered,
363
+ items = items,
364
+ }
365
+ table.insert(blocks, _arg0)
366
+ continue
367
+ end
368
+ local para = { line }
369
+ i += 1
370
+ while i < #lines do
371
+ local cur = trimEnd(lines[i + 1])
372
+ if trim(cur) == "" then
373
+ break
374
+ end
375
+ if #cur >= 3 and string.sub(cur, 1, 3) == "```" then
376
+ break
377
+ end
378
+ if isHr(cur) then
379
+ break
380
+ end
381
+ if headingLevel(cur) ~= nil then
382
+ break
383
+ end
384
+ if string.sub(cur, 1, 1) == ">" and (#cur == 1 or string.sub(cur, 2, 2) == " ") then
385
+ break
386
+ end
387
+ if listMarker(cur) ~= nil then
388
+ break
389
+ end
390
+ -- two trailing spaces = hard break
391
+ local prev = para[#para]
392
+ local _condition = #prev >= 2
393
+ if _condition then
394
+ local _arg0 = #prev - 1
395
+ _condition = string.sub(prev, _arg0) == " "
396
+ end
397
+ if _condition then
398
+ local _arg1 = #prev - 2
399
+ para[#para] = trimEnd(string.sub(prev, 1, _arg1))
400
+ table.insert(para, cur)
401
+ else
402
+ para[#para] = `{prev} {cur}`
403
+ end
404
+ i += 1
405
+ end
406
+ local _arg0 = {
407
+ kind = "paragraph",
408
+ inlines = parseInlines(table.concat(para, "\n")),
409
+ }
410
+ table.insert(blocks, _arg0)
411
+ end
412
+ return blocks
413
+ end
414
+ local function inlinesToPlain(inlines)
415
+ local out = ""
416
+ for _, part in inlines do
417
+ if part.kind == "link" then
418
+ out = `{out}{part.text}`
419
+ else
420
+ out = `{out}{part.text}`
421
+ end
422
+ end
423
+ return out
424
+ end
425
+ local function escapeRich(text)
426
+ local out = text
427
+ for _, _binding in { { "&", "&amp;" }, { "<", "&lt;" }, { ">", "&gt;" } } do
428
+ local from = _binding[1]
429
+ local to = _binding[2]
430
+ local replaced = string.gsub(out, from, to)
431
+ out = replaced
432
+ end
433
+ return out
434
+ end
435
+ --* Turn inline nodes into Roblox RichText. Links become colored label + (url).
436
+ local function inlinesToRichText(inlines)
437
+ local out = ""
438
+ for _, part in inlines do
439
+ if part.kind == "text" then
440
+ local chunk = escapeRich(part.text)
441
+ local withBreaks = string.gsub(chunk, "\n", "<br/>")
442
+ out = `{out}{withBreaks}`
443
+ elseif part.kind == "bold" then
444
+ out = `{out}<b>{escapeRich(part.text)}</b>`
445
+ elseif part.kind == "italic" then
446
+ out = `{out}<i>{escapeRich(part.text)}</i>`
447
+ elseif part.kind == "code" then
448
+ out = `{out}<font face="RobotoMono">{escapeRich(part.text)}</font>`
449
+ elseif part.kind == "link" then
450
+ out = `{out}<font color="#4C9AFF">{escapeRich(part.text)}</font> ({escapeRich(part.href)})`
451
+ end
452
+ end
453
+ return out
454
+ end
455
+ return {
456
+ parseMarkdown = parseMarkdown,
457
+ inlinesToPlain = inlinesToPlain,
458
+ inlinesToRichText = inlinesToRichText,
459
+ }
@@ -77,7 +77,7 @@ local function Menu(props)
77
77
  _newValue[_k] = _callback(_v, _k - 1, items)
78
78
  end
79
79
  -- ▲ ReadonlyArray.map ▲
80
- _result = _newValue
80
+ _result = (React.createElement(React.Fragment, nil, _newValue))
81
81
  end
82
82
  return React.createElement(Popup, {
83
83
  anchor = anchor,
@@ -17,7 +17,6 @@ local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "co
17
17
  local spinnerPixels = TS.import(script, script.Parent.Parent.Parent, "button", "components", "buttonLook").spinnerPixels
18
18
  local CircularProgress = TS.import(script, script.Parent.Parent.Parent, "circularProgress").CircularProgress
19
19
  local Input = TS.import(script, script.Parent.Parent.Parent, "input").Input
20
- local playProperty = TS.import(script, script.Parent.Parent.Parent, "motion").playProperty
21
20
  local Popup = TS.import(script, script.Parent.Parent.Parent, "popup").Popup
22
21
  local Shadow = TS.import(script, script.Parent.Parent.Parent, "shadow").Shadow
23
22
  local _virtualList = TS.import(script, script.Parent.Parent.Parent, "virtualList")
@@ -33,7 +32,6 @@ local _selectGroups = TS.import(script, script.Parent, "selectGroups")
33
32
  local groupRows = _selectGroups.groupRows
34
33
  local rowForOption = _selectGroups.rowForOption
35
34
  local shouldHandleSelectKey = TS.import(script, script.Parent, "selectKey").shouldHandleSelectKey
36
- local menuHold = TS.import(script, script.Parent, "selectMotion").menuHold
37
35
  local _selectMulti = TS.import(script, script.Parent, "selectMulti")
38
36
  local includesChoice = _selectMulti.includesChoice
39
37
  local selectionLabel = _selectMulti.selectionLabel
@@ -75,7 +73,6 @@ local function Select(props)
75
73
  local active = canActivate(disabled, loading)
76
74
  local anchor, setAnchor = useState()
77
75
  local open, setOpen = useState(defaultOpen == true and not loading)
78
- local held, setHeld = useState(false)
79
76
  local focused, setFocused = useState(false)
80
77
  local highlight, setHighlight = useState(-1)
81
78
  local _condition = defaultQuery
@@ -87,7 +84,6 @@ local function Select(props)
87
84
  local typed = useRef()
88
85
  local onKeyRef = useRef()
89
86
  local listRef = useRef()
90
- local menuRef = useRef()
91
87
  -- ▼ ReadonlyArray.find ▼
92
88
  local _callback = function(option)
93
89
  return option.value == value
@@ -242,40 +238,12 @@ local function Select(props)
242
238
  _result_1.ensureVisible(rowForOption(rows, highlight))
243
239
  end
244
240
  end, { shown, highlight })
245
- useEffect(function()
246
- if shown then
247
- setHeld(true)
248
- end
249
- end, { shown })
250
241
  useEffect(function()
251
242
  if loading and open then
252
243
  setOpen(false)
253
244
  setQuery("")
254
245
  end
255
246
  end, { loading, open })
256
- useEffect(function()
257
- local menu = menuRef.current
258
- if not menu or not held then
259
- return nil
260
- end
261
- local stop = playProperty(menu, {
262
- GroupTransparency = if shown then 0 else 1,
263
- }, 0.12, reducedMotion)
264
- local seconds = menuHold(shown, reducedMotion)
265
- if seconds == 0 then
266
- if not shown then
267
- setHeld(false)
268
- end
269
- return stop
270
- end
271
- local wait = task.delay(seconds, function()
272
- return setHeld(false)
273
- end)
274
- return function()
275
- stop()
276
- task.cancel(wait)
277
- end
278
- end, { shown, held, reducedMotion })
279
247
  local _attributes = {}
280
248
  local _condition_2 = id
281
249
  if not (_condition_2 ~= 0 and _condition_2 == _condition_2 and _condition_2 ~= "" and _condition_2) then
@@ -360,7 +328,7 @@ local function Select(props)
360
328
  Position = UDim2.new(1, -theme.padding.calc(1), 0.5, 0),
361
329
  },
362
330
  })))
363
- local _condition_3 = (shown or held)
331
+ local _condition_3 = shown
364
332
  if _condition_3 then
365
333
  local _attributes_5 = {
366
334
  key = "Menu",
@@ -405,11 +373,6 @@ local function Select(props)
405
373
  onInput = function(input)
406
374
  return onKey(input, true)
407
375
  end,
408
- }, React.createElement("canvasgroup", {
409
- ref = menuRef,
410
- Size = UDim2.fromScale(1, 1),
411
- BackgroundTransparency = 1,
412
- GroupTransparency = 1,
413
376
  }, React.createElement("frame", _attributes_5, _exp_3, _exp_4, _exp_5, _exp_6, _condition_4, React.createElement("frame", {
414
377
  key = "ListHost",
415
378
  Size = UDim2.new(1, 0, 1, if search then -row else 0),
@@ -469,7 +432,7 @@ local function Select(props)
469
432
  setmetatable(_attributes_9, nil)
470
433
  return React.createElement("textbutton", _attributes_8, React.createElement("uipadding", _attributes_9))
471
434
  end,
472
- }))))))
435
+ })))))
473
436
  end
474
437
  return React.createElement("frame", _attributes, _exp_2, _condition_3)
475
438
  end
@@ -1,5 +1,5 @@
1
1
  export type SplitPointer = "rest" | "hover" | "press";
2
2
  export declare function splitPointer(hovering: boolean, pressed: boolean): SplitPointer;
3
- export declare function splitRuleTransparency(pointer: SplitPointer, disabled?: boolean): 0.25 | 0.35 | 0.7 | 0.55;
3
+ export declare function splitRuleTransparency(pointer: SplitPointer, disabled?: boolean): 0.25 | 0.7 | 0.55 | 0.35;
4
4
  export declare function splitMarkTransparency(pointer: SplitPointer, disabled?: boolean): 0 | 0.55 | 0.1;
5
5
  export declare function splitHitTransparency(pointer: SplitPointer, disabled?: boolean): 1 | 0.9 | 0.94;