@nrbx/topbar-components 1.0.2 → 1.0.4

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.
@@ -8,6 +8,7 @@ local LocationContext = _context.LocationContext
8
8
  local useStylesheet = _context.useStylesheet
9
9
  local useGuiInset = TS.import(script, script.Parent.Parent, "hooks", "use-gui-inset").useGuiInset
10
10
  local useVoicechatEnabled = TS.import(script, script.Parent.Parent, "hooks", "use-voicechat-enabled").useVoicechatEnabled
11
+ local debugLog = TS.import(script, script.Parent.Parent, "utilities", "debug").debugLog
11
12
  local function sortByDock(children)
12
13
  local left = {}
13
14
  local center = {}
@@ -19,16 +20,18 @@ local function sortByDock(children)
19
20
  if child == nil then
20
21
  return nil
21
22
  end
22
- local props = child.props
23
- local _dock = props
24
- if _dock ~= nil then
25
- _dock = _dock.dock
23
+ local childObj = child
24
+ local props = childObj.props
25
+ local _dockValue = props
26
+ if _dockValue ~= nil then
27
+ _dockValue = _dockValue.dock
26
28
  end
27
- local dock = _dock
28
- if dock == "Center" then
29
+ local dockValue = _dockValue
30
+ debugLog(`sortByDock child: hasProps={props ~= nil}`, `dock="{dockValue}"`, `→ {if dockValue == "Center" then "Center" elseif dockValue == "Right" then "Right" else "Left"}`)
31
+ if dockValue == "Center" then
29
32
  center[ci + 1] = child
30
33
  ci += 1
31
- elseif dock == "Right" then
34
+ elseif dockValue == "Right" then
32
35
  right[ri + 1] = child
33
36
  ri += 1
34
37
  else
@@ -36,6 +39,7 @@ local function sortByDock(children)
36
39
  li += 1
37
40
  end
38
41
  end)
42
+ debugLog(`sortByDock totals: left={#left} center={#center} right={#right}`)
39
43
  return { left, center, right }
40
44
  end
41
45
  local function TopbarProvider(_param)
@@ -51,7 +55,9 @@ local function TopbarProvider(_param)
51
55
  local stylesheet = useStylesheet().provider
52
56
  local hasBetaLabel = gameVoiceChatEnabled and voiceChatEnabled
53
57
  local leftPadding = if hasBetaLabel then stylesheet.paddingLeft + 16 else stylesheet.paddingLeft
54
- local frameHeight = inset.Height - stylesheet.insetHeightOffset
58
+ local rawHeight = inset.Height - stylesheet.insetHeightOffset
59
+ local frameHeight = if stylesheet.forceFrameHeight ~= nil then stylesheet.forceFrameHeight else rawHeight
60
+ 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})`)
55
61
  local _binding = sortByDock(children)
56
62
  local leftChildren = _binding[1]
57
63
  local centerChildren = _binding[2]
@@ -127,6 +133,7 @@ local function TopbarProvider(_param)
127
133
  FillDirection = Enum.FillDirection.Horizontal,
128
134
  SortOrder = Enum.SortOrder.LayoutOrder,
129
135
  Padding = UDim.new(0, stylesheet.iconSpacing),
136
+ VerticalAlignment = Enum.VerticalAlignment.Center,
130
137
  }), leftChildren), hasCenter and (React.createElement("frame", {
131
138
  key = "CenterDock",
132
139
  BackgroundTransparency = 1,
@@ -141,6 +148,7 @@ local function TopbarProvider(_param)
141
148
  FillDirection = Enum.FillDirection.Horizontal,
142
149
  SortOrder = Enum.SortOrder.LayoutOrder,
143
150
  Padding = UDim.new(0, stylesheet.iconSpacing),
151
+ VerticalAlignment = Enum.VerticalAlignment.Center,
144
152
  }), centerChildren)), hasRight and (React.createElement("frame", {
145
153
  key = "RightDock",
146
154
  BackgroundTransparency = 1,
@@ -154,6 +162,7 @@ local function TopbarProvider(_param)
154
162
  FillDirection = Enum.FillDirection.Horizontal,
155
163
  SortOrder = Enum.SortOrder.LayoutOrder,
156
164
  Padding = UDim.new(0, stylesheet.iconSpacing),
165
+ VerticalAlignment = Enum.VerticalAlignment.Center,
157
166
  }), rightChildren))))
158
167
  end
159
168
  return {
package/out/style.d.ts CHANGED
@@ -23,6 +23,11 @@ export interface Stylesheet {
23
23
  insetHeightOffset: number;
24
24
  /** Extra gap between left, center, and right icon groups (default 0) */
25
25
  iconGroupSpacing: number;
26
+ /**
27
+ * Explicit override for the provider frame Y size (in pixels).
28
+ * When set, this replaces the automatic `(inset.Height - insetHeightOffset) * sizeScale.Y` calculation.
29
+ */
30
+ forceFrameHeight: number | undefined;
26
31
  };
27
32
  /**
28
33
  * Fine-grained sizing & layout overrides for icon internals.
package/out/style.luau CHANGED
@@ -89,6 +89,7 @@ local DefaultStylesheet = {
89
89
  sizeScale = Vector2.new(1, 1),
90
90
  insetHeightOffset = 0,
91
91
  iconGroupSpacing = 0,
92
+ forceFrameHeight = nil,
92
93
  },
93
94
  sizing = {
94
95
  iconHeight = nil,
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Logs a debug message to the console only when `_G.__DEBUG__` is truthy.
3
+ * No-op in production — stripped at the call site when debug is off.
4
+ */
5
+ export declare function debugLog(...messages: unknown[]): void;
@@ -0,0 +1,17 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ --[[
3
+ *
4
+ * Logs a debug message to the console only when `_G.__DEBUG__` is truthy.
5
+ * No-op in production — stripped at the call site when debug is off.
6
+
7
+ ]]
8
+ local function debugLog(...)
9
+ local messages = { ... }
10
+ local _value = _G.__DEBUG__
11
+ if _value ~= 0 and _value == _value and _value ~= "" and _value then
12
+ print(`[DEBUG]`, unpack(messages))
13
+ end
14
+ end
15
+ return {
16
+ debugLog = debugLog,
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrbx/topbar-components",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "main": "out/init.lua",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",