@nrbx/topbar-components 1.0.6 → 1.0.8
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 +134 -20
- package/out/components/icon.d.ts +0 -2
- package/out/components/provider.d.ts +3 -5
- package/out/components/provider.luau +65 -247
- package/out/style.luau +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,28 +49,60 @@ And this to your `tsconfig.json`
|
|
|
49
49
|
|
|
50
50
|
Instantiate `<TopbarProvider />` to be a root of your topbar component tree.
|
|
51
51
|
|
|
52
|
-
```
|
|
52
|
+
```tsx
|
|
53
53
|
<TopbarProvider>
|
|
54
54
|
<Icon text="Hello, World!" />
|
|
55
55
|
</TopbarProvider>
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
You can conditionally apply properties based on icon's current state, by providing a state markup object:
|
|
58
|
+
#### 📍 Positioning icons with dock containers
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
Icons placed directly inside `<TopbarProvider>` default to the left side. Use the dock container components to position icons at the center or right of the bar:
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
<TopbarProvider>
|
|
64
|
+
<LeftDock>
|
|
65
|
+
<Icon text="Home" />
|
|
66
|
+
<Icon text="Settings" />
|
|
67
|
+
</LeftDock>
|
|
68
|
+
<CenterDock>
|
|
69
|
+
<Icon text="Server Time" static />
|
|
70
|
+
</CenterDock>
|
|
71
|
+
<RightDock>
|
|
72
|
+
<Icon text="Profile" imageId="rbxassetid://..." />
|
|
73
|
+
</RightDock>
|
|
74
|
+
</TopbarProvider>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
| Container | Anchor | Purpose |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| `<LeftDock>` | left edge | Default — icons flow left-to-right from the left |
|
|
80
|
+
| `<CenterDock>` | center (50%) | Centers icons in the bar |
|
|
81
|
+
| `<RightDock>` | right edge | Right-aligns icons |
|
|
82
|
+
|
|
83
|
+
Each dock container renders its own horizontal list with the configured `iconSpacing` and vertical centering. Center and right docks automatically apply `iconGroupSpacing` for visual separation.
|
|
84
|
+
|
|
85
|
+
#### 🏷️ Icon props: `static` and `disabled`
|
|
86
|
+
|
|
87
|
+
- **`static`** — turns the icon into a non-interactive label (no clicks, no hovers, no state toggling, no sounds)
|
|
88
|
+
- **`disabled`** — dims the icon with a configurable semi-transparent overlay
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
<Icon text="Read Only" static /> {/* label, not clickable */}
|
|
92
|
+
<Icon text="Locked" disabled /> {/* dimmed */}
|
|
93
|
+
<Icon text="Both" static disabled /> {/* dimmed label */}
|
|
66
94
|
```
|
|
67
95
|
|
|
68
|
-
|
|
96
|
+
The disabled overlay transparency and color are configurable via the stylesheet `sizing` section.
|
|
97
|
+
|
|
98
|
+
#### 🔽 Dropdowns
|
|
99
|
+
|
|
100
|
+
You can add a dropdown to an icon by mounting `<Dropdown />` component as it's child.
|
|
69
101
|
Dropdowns & TopbarProvider have a property called `selectionMode`, which lets you specify how many icons can be selected at once.
|
|
70
102
|
|
|
71
|
-
```
|
|
103
|
+
```tsx
|
|
72
104
|
<Icon text="Skins">
|
|
73
|
-
<Dropdown selectionMode="
|
|
105
|
+
<Dropdown selectionMode="Single">
|
|
74
106
|
<Icon text="yellow" selected={() => chooseSkin("yellow")} />
|
|
75
107
|
<Icon text="red" selected={() => chooseSkin("red")} />
|
|
76
108
|
</Dropdown>
|
|
@@ -81,22 +113,104 @@ Dropdowns **can be nested.**
|
|
|
81
113
|
|
|
82
114
|
### 🎨 Stylesheets
|
|
83
115
|
|
|
84
|
-
You can use stylesheets to override default properties of all components within
|
|
116
|
+
You can use stylesheets to override default properties of all components within.
|
|
85
117
|
Stylesheets are partial, and work like patches to already established default properties within the package:
|
|
86
118
|
|
|
87
|
-
```
|
|
119
|
+
```tsx
|
|
120
|
+
import { Stylesheet } from "@nrbx/topbar-components";
|
|
121
|
+
|
|
88
122
|
<Stylesheet stylesheet={{
|
|
89
123
|
icon: {
|
|
90
124
|
textSize: 25,
|
|
91
125
|
cornerRadius: new UDim(0.5, 0),
|
|
92
|
-
}
|
|
126
|
+
},
|
|
127
|
+
}}>
|
|
128
|
+
<TopbarProvider>
|
|
129
|
+
<LeftDock>
|
|
130
|
+
<Icon text="Skins">
|
|
131
|
+
<Dropdown selectionMode="Single">
|
|
132
|
+
<Icon text="yellow" selected={() => chooseSkin("yellow")} />
|
|
133
|
+
<Icon text="red" selected={() => chooseSkin("red")} />
|
|
134
|
+
</Dropdown>
|
|
135
|
+
</Icon>
|
|
136
|
+
</LeftDock>
|
|
137
|
+
</TopbarProvider>
|
|
138
|
+
</Stylesheet>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### Complete stylesheet shape
|
|
142
|
+
|
|
143
|
+
The stylesheet exposes the following sections for full control:
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
<Stylesheet stylesheet={{
|
|
147
|
+
// ── Icon defaults (all IconProps) ──
|
|
148
|
+
icon: {
|
|
149
|
+
textSize: 20,
|
|
150
|
+
textColor: { selected: Color3.fromRGB(57, 60, 65), deselected: Color3.fromRGB(255, 255, 255) },
|
|
151
|
+
backgroundColor: { selected: Color3.fromRGB(245, 245, 245), deselected: Color3.fromRGB(0, 0, 0) },
|
|
152
|
+
backgroundTransparency: 0.3,
|
|
153
|
+
cornerRadius: new UDim(1, 0),
|
|
154
|
+
fontFace: new Font("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Medium, Enum.FontStyle.Normal),
|
|
155
|
+
static: false,
|
|
156
|
+
disabled: false,
|
|
157
|
+
// ... all other IconProps
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
// ── Dropdown defaults (all DropdownProps) ──
|
|
161
|
+
dropdown: {
|
|
162
|
+
maxWidth: 300,
|
|
163
|
+
minWidth: 200,
|
|
164
|
+
maxHeight: 200,
|
|
165
|
+
forceHeight: 32,
|
|
166
|
+
padding: new UDim(0, 2.5),
|
|
167
|
+
selectionMode: "Multiple",
|
|
168
|
+
// ... all other DropdownProps
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
// ── Provider frame ──
|
|
172
|
+
provider: {
|
|
173
|
+
paddingLeft: 8, paddingRight: 12,
|
|
174
|
+
paddingTop: 11, paddingBottom: 0,
|
|
175
|
+
iconSpacing: 12, iconGroupSpacing: 0,
|
|
176
|
+
backgroundTransparency: 1,
|
|
177
|
+
anchorPoint: new Vector2(1, 0),
|
|
178
|
+
position: UDim2.fromScale(1, 0),
|
|
179
|
+
sizeScale: new Vector2(1, 1),
|
|
180
|
+
insetHeightOffset: 0,
|
|
181
|
+
forceFrameHeight: undefined, // override auto height (e.g. 55)
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
// ── Icon internal sizing ──
|
|
185
|
+
sizing: {
|
|
186
|
+
iconHeight: undefined, // explicit override
|
|
187
|
+
imagePadding: 6,
|
|
188
|
+
labelPadding: 6,
|
|
189
|
+
imageToTextSpacing: 6,
|
|
190
|
+
textMeasurementWidth: 99999,
|
|
191
|
+
minLabelWidthPadding: 12,
|
|
192
|
+
buttonLabelHeightFraction: 0.8,
|
|
193
|
+
disabledOverlayTransparency: 0.55,
|
|
194
|
+
disabledOverlayColor: new Color3(0, 0, 0),
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
// ── Dropdown surface theme ──
|
|
198
|
+
dropdownTheme: {
|
|
199
|
+
backgroundColor: new Color3(1, 1, 1),
|
|
200
|
+
backgroundTransparency: 0,
|
|
201
|
+
cornerRadius: new UDim(0, 0),
|
|
202
|
+
borderSize: 0, borderColor: new Color3(0, 0, 0),
|
|
203
|
+
borderTransparency: 1,
|
|
204
|
+
position: UDim2.fromScale(0, 1),
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
// ── Animation ──
|
|
208
|
+
animation: {
|
|
209
|
+
dropdownTransitionSpeed: 10,
|
|
210
|
+
stateSpring: { tension: 400 },
|
|
211
|
+
},
|
|
93
212
|
}}>
|
|
94
|
-
|
|
95
|
-
<Dropdown selectionMode="single">
|
|
96
|
-
<Icon text="yellow" selected={() => chooseSkin("yellow")} />
|
|
97
|
-
<Icon text="red" selected={() => chooseSkin("red")} />
|
|
98
|
-
</Dropdown>
|
|
99
|
-
</Icon>
|
|
213
|
+
{/* children */}
|
|
100
214
|
</Stylesheet>
|
|
101
215
|
```
|
|
102
216
|
|
package/out/components/icon.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from '@rbxts/react';
|
|
2
|
-
export type Dock = 'Left' | 'Center' | 'Right';
|
|
3
2
|
export interface IconProps extends React.PropsWithChildren {
|
|
4
3
|
backgroundTransparency?: StateDependent<number>;
|
|
5
4
|
backgroundColor?: StateDependent<Color3>;
|
|
@@ -25,7 +24,6 @@ export interface IconProps extends React.PropsWithChildren {
|
|
|
25
24
|
textAlignment?: StateDependent<Enum.TextXAlignment>;
|
|
26
25
|
richText?: StateDependent<boolean>;
|
|
27
26
|
toggleStateOnClick?: boolean;
|
|
28
|
-
dock?: Dock;
|
|
29
27
|
/** When true, renders as a non-interactive label (no clicks, no hovers, no state changes) */
|
|
30
28
|
static?: boolean;
|
|
31
29
|
/** When true, dulls the text and icon with a dimming overlay */
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from '@rbxts/react';
|
|
2
|
-
import type { Dock } from './icon';
|
|
3
2
|
export type SelectionMode = 'Single' | 'Multiple';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export declare function TopBarContainer({ dock, children }: ContainerProps): React.JSX.Element;
|
|
3
|
+
export declare function LeftDock({ children }: React.PropsWithChildren): React.JSX.Element;
|
|
4
|
+
export declare function CenterDock({ children }: React.PropsWithChildren): React.JSX.Element;
|
|
5
|
+
export declare function RightDock({ children }: React.PropsWithChildren): React.JSX.Element;
|
|
8
6
|
interface ProviderProps extends React.PropsWithChildren {
|
|
9
7
|
selectionMode?: SelectionMode;
|
|
10
8
|
gameVoiceChatEnabled?: boolean;
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
4
|
local React = _react
|
|
5
|
-
local createContext = _react.createContext
|
|
6
|
-
local useContext = _react.useContext
|
|
7
|
-
local useEffect = _react.useEffect
|
|
8
|
-
local useMemo = _react.useMemo
|
|
9
5
|
local useState = _react.useState
|
|
10
6
|
local _context = TS.import(script, script.Parent.Parent, "context")
|
|
11
7
|
local LocationContext = _context.LocationContext
|
|
@@ -13,136 +9,55 @@ local useStylesheet = _context.useStylesheet
|
|
|
13
9
|
local useGuiInset = TS.import(script, script.Parent.Parent, "hooks", "use-gui-inset").useGuiInset
|
|
14
10
|
local useVoicechatEnabled = TS.import(script, script.Parent.Parent, "hooks", "use-voicechat-enabled").useVoicechatEnabled
|
|
15
11
|
local debugLog = TS.import(script, script.Parent.Parent, "utilities", "debug").debugLog
|
|
16
|
-
-- ── Dock
|
|
17
|
-
local
|
|
18
|
-
local
|
|
19
|
-
return
|
|
12
|
+
-- ── Dock container components ───────────────────────────────────────────────
|
|
13
|
+
local function DockFrame(props)
|
|
14
|
+
local stylesheet = useStylesheet().provider
|
|
15
|
+
return React.createElement("frame", {
|
|
16
|
+
BackgroundTransparency = 1,
|
|
17
|
+
AnchorPoint = props.anchor,
|
|
18
|
+
Position = props.position,
|
|
19
|
+
Size = UDim2.fromScale(0, 1),
|
|
20
|
+
AutomaticSize = Enum.AutomaticSize.X,
|
|
21
|
+
}, (props.paddingLeft ~= nil or props.paddingRight ~= nil) and (React.createElement("uipadding", {
|
|
22
|
+
PaddingLeft = props.paddingLeft or UDim.new(0, 0),
|
|
23
|
+
PaddingRight = props.paddingRight or UDim.new(0, 0),
|
|
24
|
+
})), React.createElement("uilistlayout", {
|
|
25
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
26
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
27
|
+
Padding = UDim.new(0, stylesheet.iconSpacing),
|
|
28
|
+
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
29
|
+
}), props.children)
|
|
20
30
|
end
|
|
21
|
-
|
|
22
|
-
local function TopBarContainer(_param)
|
|
23
|
-
local dock = _param.dock
|
|
31
|
+
local function LeftDock(_param)
|
|
24
32
|
local children = _param.children
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
registry:register(dock, id, children)
|
|
31
|
-
return function()
|
|
32
|
-
return registry:unregister(dock, id)
|
|
33
|
-
end
|
|
34
|
-
end, {})
|
|
35
|
-
return React.createElement(React.Fragment)
|
|
33
|
+
return React.createElement(DockFrame, {
|
|
34
|
+
anchor = Vector2.new(0, 0.5),
|
|
35
|
+
position = UDim2.new(0, 0, 0.5, 0),
|
|
36
|
+
children = children,
|
|
37
|
+
})
|
|
36
38
|
end
|
|
37
|
-
|
|
38
|
-
local
|
|
39
|
-
local
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
element = element,
|
|
48
|
-
}
|
|
49
|
-
debugLog(`DockRegistry: register id={id} dock="{dock}"`)
|
|
50
|
-
if dock == "Center" then
|
|
51
|
-
setCenterNodes(function(prev)
|
|
52
|
-
local _array = {}
|
|
53
|
-
local _length = #_array
|
|
54
|
-
local _prevLength = #prev
|
|
55
|
-
table.move(prev, 1, _prevLength, _length + 1, _array)
|
|
56
|
-
_length += _prevLength
|
|
57
|
-
_array[_length + 1] = entry
|
|
58
|
-
return _array
|
|
59
|
-
end)
|
|
60
|
-
elseif dock == "Right" then
|
|
61
|
-
setRightNodes(function(prev)
|
|
62
|
-
local _array = {}
|
|
63
|
-
local _length = #_array
|
|
64
|
-
local _prevLength = #prev
|
|
65
|
-
table.move(prev, 1, _prevLength, _length + 1, _array)
|
|
66
|
-
_length += _prevLength
|
|
67
|
-
_array[_length + 1] = entry
|
|
68
|
-
return _array
|
|
69
|
-
end)
|
|
70
|
-
else
|
|
71
|
-
setLeftNodes(function(prev)
|
|
72
|
-
local _array = {}
|
|
73
|
-
local _length = #_array
|
|
74
|
-
local _prevLength = #prev
|
|
75
|
-
table.move(prev, 1, _prevLength, _length + 1, _array)
|
|
76
|
-
_length += _prevLength
|
|
77
|
-
_array[_length + 1] = entry
|
|
78
|
-
return _array
|
|
79
|
-
end)
|
|
80
|
-
end
|
|
81
|
-
end,
|
|
82
|
-
unregister = function(dock, id)
|
|
83
|
-
debugLog(`DockRegistry: unregister id={id} dock="{dock}"`)
|
|
84
|
-
if dock == "Center" then
|
|
85
|
-
setCenterNodes(function(prev)
|
|
86
|
-
-- ▼ ReadonlyArray.filter ▼
|
|
87
|
-
local _newValue = {}
|
|
88
|
-
local _callback = function(e)
|
|
89
|
-
return e.id ~= id
|
|
90
|
-
end
|
|
91
|
-
local _length = 0
|
|
92
|
-
for _k, _v in prev do
|
|
93
|
-
if _callback(_v, _k - 1, prev) == true then
|
|
94
|
-
_length += 1
|
|
95
|
-
_newValue[_length] = _v
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
-- ▲ ReadonlyArray.filter ▲
|
|
99
|
-
return _newValue
|
|
100
|
-
end)
|
|
101
|
-
elseif dock == "Right" then
|
|
102
|
-
setRightNodes(function(prev)
|
|
103
|
-
-- ▼ ReadonlyArray.filter ▼
|
|
104
|
-
local _newValue = {}
|
|
105
|
-
local _callback = function(e)
|
|
106
|
-
return e.id ~= id
|
|
107
|
-
end
|
|
108
|
-
local _length = 0
|
|
109
|
-
for _k, _v in prev do
|
|
110
|
-
if _callback(_v, _k - 1, prev) == true then
|
|
111
|
-
_length += 1
|
|
112
|
-
_newValue[_length] = _v
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
-- ▲ ReadonlyArray.filter ▲
|
|
116
|
-
return _newValue
|
|
117
|
-
end)
|
|
118
|
-
else
|
|
119
|
-
setLeftNodes(function(prev)
|
|
120
|
-
-- ▼ ReadonlyArray.filter ▼
|
|
121
|
-
local _newValue = {}
|
|
122
|
-
local _callback = function(e)
|
|
123
|
-
return e.id ~= id
|
|
124
|
-
end
|
|
125
|
-
local _length = 0
|
|
126
|
-
for _k, _v in prev do
|
|
127
|
-
if _callback(_v, _k - 1, prev) == true then
|
|
128
|
-
_length += 1
|
|
129
|
-
_newValue[_length] = _v
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
-- ▲ ReadonlyArray.filter ▲
|
|
133
|
-
return _newValue
|
|
134
|
-
end)
|
|
135
|
-
end
|
|
136
|
-
end,
|
|
137
|
-
}
|
|
138
|
-
end, {})
|
|
139
|
-
return {
|
|
140
|
-
registry = registry,
|
|
141
|
-
leftNodes = leftNodes,
|
|
142
|
-
centerNodes = centerNodes,
|
|
143
|
-
rightNodes = rightNodes,
|
|
144
|
-
}
|
|
39
|
+
local function CenterDock(_param)
|
|
40
|
+
local children = _param.children
|
|
41
|
+
local stylesheet = useStylesheet().provider
|
|
42
|
+
return React.createElement(DockFrame, {
|
|
43
|
+
anchor = Vector2.new(0.5, 0.5),
|
|
44
|
+
position = UDim2.new(0.5, 0, 0.5, 0),
|
|
45
|
+
paddingLeft = UDim.new(0, stylesheet.iconGroupSpacing),
|
|
46
|
+
paddingRight = UDim.new(0, stylesheet.iconGroupSpacing),
|
|
47
|
+
children = children,
|
|
48
|
+
})
|
|
145
49
|
end
|
|
50
|
+
local function RightDock(_param)
|
|
51
|
+
local children = _param.children
|
|
52
|
+
local stylesheet = useStylesheet().provider
|
|
53
|
+
return React.createElement(DockFrame, {
|
|
54
|
+
anchor = Vector2.new(1, 0.5),
|
|
55
|
+
position = UDim2.new(1, 0, 0.5, 0),
|
|
56
|
+
paddingLeft = UDim.new(0, stylesheet.iconGroupSpacing),
|
|
57
|
+
children = children,
|
|
58
|
+
})
|
|
59
|
+
end
|
|
60
|
+
-- ── Provider ────────────────────────────────────────────────────────────────
|
|
146
61
|
local function TopbarProvider(_param)
|
|
147
62
|
local selectionMode = _param.selectionMode
|
|
148
63
|
if selectionMode == nil then
|
|
@@ -154,117 +69,12 @@ local function TopbarProvider(_param)
|
|
|
154
69
|
local inset = useGuiInset()
|
|
155
70
|
local voiceChatEnabled = useVoicechatEnabled()
|
|
156
71
|
local stylesheet = useStylesheet().provider
|
|
157
|
-
local _binding = useDockNodes()
|
|
158
|
-
local registry = _binding.registry
|
|
159
|
-
local leftNodes = _binding.leftNodes
|
|
160
|
-
local centerNodes = _binding.centerNodes
|
|
161
|
-
local rightNodes = _binding.rightNodes
|
|
162
72
|
local hasBetaLabel = gameVoiceChatEnabled and voiceChatEnabled
|
|
163
73
|
local leftPadding = if hasBetaLabel then stylesheet.paddingLeft + 16 else stylesheet.paddingLeft
|
|
164
74
|
local rawHeight = inset.Height - stylesheet.insetHeightOffset
|
|
165
75
|
local frameHeight = if stylesheet.forceFrameHeight ~= nil then stylesheet.forceFrameHeight else rawHeight
|
|
166
76
|
debugLog(`TopbarProvider frame: inset.Height={inset.Height}, inset.Width={inset.Width}`, `insetHeightOffset={stylesheet.insetHeightOffset}`, `rawHeight={rawHeight}`, `forceFrameHeight={stylesheet.forceFrameHeight}`, `finalHeight={frameHeight}`, `sizeScale=({stylesheet.sizeScale.X}, {stylesheet.sizeScale.Y})`)
|
|
167
|
-
|
|
168
|
-
local hasRight = #rightNodes > 0
|
|
169
|
-
local _exp = React.createElement("uipadding", {
|
|
170
|
-
key = "UIPadding",
|
|
171
|
-
PaddingLeft = UDim.new(0, leftPadding),
|
|
172
|
-
PaddingRight = UDim.new(0, stylesheet.paddingRight),
|
|
173
|
-
PaddingTop = UDim.new(0, stylesheet.paddingTop),
|
|
174
|
-
PaddingBottom = UDim.new(0, stylesheet.paddingBottom),
|
|
175
|
-
})
|
|
176
|
-
local _exp_1 = React.createElement("uilistlayout", {
|
|
177
|
-
FillDirection = Enum.FillDirection.Horizontal,
|
|
178
|
-
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
179
|
-
Padding = UDim.new(0, stylesheet.iconSpacing),
|
|
180
|
-
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
181
|
-
})
|
|
182
|
-
local _exp_2 = children
|
|
183
|
-
-- ▼ ReadonlyArray.map ▼
|
|
184
|
-
local _newValue = table.create(#leftNodes)
|
|
185
|
-
local _callback = function(entry)
|
|
186
|
-
return React.createElement(React.Fragment, {
|
|
187
|
-
key = entry.id,
|
|
188
|
-
}, entry.element)
|
|
189
|
-
end
|
|
190
|
-
for _k, _v in leftNodes do
|
|
191
|
-
_newValue[_k] = _callback(_v, _k - 1, leftNodes)
|
|
192
|
-
end
|
|
193
|
-
-- ▲ ReadonlyArray.map ▲
|
|
194
|
-
local _exp_3 = React.createElement("frame", {
|
|
195
|
-
key = "LeftDock",
|
|
196
|
-
BackgroundTransparency = 1,
|
|
197
|
-
AnchorPoint = Vector2.new(0, 0.5),
|
|
198
|
-
Position = UDim2.new(0, 0, 0.5, 0),
|
|
199
|
-
Size = UDim2.fromScale(0, 1),
|
|
200
|
-
AutomaticSize = Enum.AutomaticSize.X,
|
|
201
|
-
}, _exp_1, _exp_2, _newValue)
|
|
202
|
-
local _condition = hasCenter
|
|
203
|
-
if _condition then
|
|
204
|
-
local _exp_4 = React.createElement("uipadding", {
|
|
205
|
-
PaddingLeft = UDim.new(0, stylesheet.iconGroupSpacing),
|
|
206
|
-
PaddingRight = UDim.new(0, stylesheet.iconGroupSpacing),
|
|
207
|
-
})
|
|
208
|
-
local _exp_5 = React.createElement("uilistlayout", {
|
|
209
|
-
FillDirection = Enum.FillDirection.Horizontal,
|
|
210
|
-
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
211
|
-
Padding = UDim.new(0, stylesheet.iconSpacing),
|
|
212
|
-
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
213
|
-
})
|
|
214
|
-
-- ▼ ReadonlyArray.map ▼
|
|
215
|
-
local _newValue_1 = table.create(#centerNodes)
|
|
216
|
-
local _callback_1 = function(entry)
|
|
217
|
-
return React.createElement(React.Fragment, {
|
|
218
|
-
key = entry.id,
|
|
219
|
-
}, entry.element)
|
|
220
|
-
end
|
|
221
|
-
for _k, _v in centerNodes do
|
|
222
|
-
_newValue_1[_k] = _callback_1(_v, _k - 1, centerNodes)
|
|
223
|
-
end
|
|
224
|
-
-- ▲ ReadonlyArray.map ▲
|
|
225
|
-
_condition = (React.createElement("frame", {
|
|
226
|
-
key = "CenterDock",
|
|
227
|
-
BackgroundTransparency = 1,
|
|
228
|
-
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
229
|
-
Position = UDim2.new(0.5, 0, 0.5, 0),
|
|
230
|
-
Size = UDim2.fromScale(0, 1),
|
|
231
|
-
AutomaticSize = Enum.AutomaticSize.X,
|
|
232
|
-
}, _exp_4, _exp_5, _newValue_1))
|
|
233
|
-
end
|
|
234
|
-
local _condition_1 = hasRight
|
|
235
|
-
if _condition_1 then
|
|
236
|
-
local _exp_4 = React.createElement("uipadding", {
|
|
237
|
-
PaddingLeft = UDim.new(0, stylesheet.iconGroupSpacing),
|
|
238
|
-
})
|
|
239
|
-
local _exp_5 = React.createElement("uilistlayout", {
|
|
240
|
-
FillDirection = Enum.FillDirection.Horizontal,
|
|
241
|
-
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
242
|
-
Padding = UDim.new(0, stylesheet.iconSpacing),
|
|
243
|
-
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
244
|
-
})
|
|
245
|
-
-- ▼ ReadonlyArray.map ▼
|
|
246
|
-
local _newValue_1 = table.create(#rightNodes)
|
|
247
|
-
local _callback_1 = function(entry)
|
|
248
|
-
return React.createElement(React.Fragment, {
|
|
249
|
-
key = entry.id,
|
|
250
|
-
}, entry.element)
|
|
251
|
-
end
|
|
252
|
-
for _k, _v in rightNodes do
|
|
253
|
-
_newValue_1[_k] = _callback_1(_v, _k - 1, rightNodes)
|
|
254
|
-
end
|
|
255
|
-
-- ▲ ReadonlyArray.map ▲
|
|
256
|
-
_condition_1 = (React.createElement("frame", {
|
|
257
|
-
key = "RightDock",
|
|
258
|
-
BackgroundTransparency = 1,
|
|
259
|
-
AnchorPoint = Vector2.new(1, 0.5),
|
|
260
|
-
Position = UDim2.new(1, 0, 0.5, 0),
|
|
261
|
-
Size = UDim2.fromScale(0, 1),
|
|
262
|
-
AutomaticSize = Enum.AutomaticSize.X,
|
|
263
|
-
}, _exp_4, _exp_5, _newValue_1))
|
|
264
|
-
end
|
|
265
|
-
return React.createElement(DockRegistryContext.Provider, {
|
|
266
|
-
value = registry,
|
|
267
|
-
}, React.createElement(LocationContext.Provider, {
|
|
77
|
+
return React.createElement(LocationContext.Provider, {
|
|
268
78
|
value = {
|
|
269
79
|
type = "provider",
|
|
270
80
|
selectedIcons = selectedIcons,
|
|
@@ -283,29 +93,29 @@ local function TopbarProvider(_param)
|
|
|
283
93
|
end)
|
|
284
94
|
end,
|
|
285
95
|
iconDeselected = function(iconId)
|
|
286
|
-
local
|
|
287
|
-
if
|
|
96
|
+
local _condition = selectionMode == "Single"
|
|
97
|
+
if _condition then
|
|
288
98
|
local _iconId = iconId
|
|
289
|
-
|
|
99
|
+
_condition = table.find(selectedIcons, _iconId) ~= nil
|
|
290
100
|
end
|
|
291
|
-
if
|
|
101
|
+
if _condition then
|
|
292
102
|
return setSelectedIcons({})
|
|
293
103
|
end
|
|
294
104
|
return setSelectedIcons(function(icons)
|
|
295
105
|
-- ▼ ReadonlyArray.filter ▼
|
|
296
|
-
local
|
|
297
|
-
local
|
|
106
|
+
local _newValue = {}
|
|
107
|
+
local _callback = function(T)
|
|
298
108
|
return T ~= iconId
|
|
299
109
|
end
|
|
300
110
|
local _length = 0
|
|
301
111
|
for _k, _v in icons do
|
|
302
|
-
if
|
|
112
|
+
if _callback(_v, _k - 1, icons) == true then
|
|
303
113
|
_length += 1
|
|
304
|
-
|
|
114
|
+
_newValue[_length] = _v
|
|
305
115
|
end
|
|
306
116
|
end
|
|
307
117
|
-- ▲ ReadonlyArray.filter ▲
|
|
308
|
-
return
|
|
118
|
+
return _newValue
|
|
309
119
|
end)
|
|
310
120
|
end,
|
|
311
121
|
},
|
|
@@ -316,9 +126,17 @@ local function TopbarProvider(_param)
|
|
|
316
126
|
Size = UDim2.fromOffset(inset.Width * stylesheet.sizeScale.X, frameHeight * stylesheet.sizeScale.Y),
|
|
317
127
|
AnchorPoint = stylesheet.anchorPoint,
|
|
318
128
|
Position = stylesheet.position,
|
|
319
|
-
},
|
|
129
|
+
}, React.createElement("uipadding", {
|
|
130
|
+
key = "UIPadding",
|
|
131
|
+
PaddingLeft = UDim.new(0, leftPadding),
|
|
132
|
+
PaddingRight = UDim.new(0, stylesheet.paddingRight),
|
|
133
|
+
PaddingTop = UDim.new(0, stylesheet.paddingTop),
|
|
134
|
+
PaddingBottom = UDim.new(0, stylesheet.paddingBottom),
|
|
135
|
+
}), children))
|
|
320
136
|
end
|
|
321
137
|
return {
|
|
322
|
-
|
|
138
|
+
LeftDock = LeftDock,
|
|
139
|
+
CenterDock = CenterDock,
|
|
140
|
+
RightDock = RightDock,
|
|
323
141
|
TopbarProvider = TopbarProvider,
|
|
324
142
|
}
|
package/out/style.luau
CHANGED