@nrbx/topbar-components 1.0.1 → 1.0.3

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,10 +20,16 @@ local function sortByDock(children)
19
20
  if child == nil then
20
21
  return nil
21
22
  end
22
- if React.isValidElement(child) and (child.props).dock == "Center" then
23
+ local props = child.props
24
+ local _dock = props
25
+ if _dock ~= nil then
26
+ _dock = _dock.dock
27
+ end
28
+ local dock = _dock
29
+ if dock == "Center" then
23
30
  center[ci + 1] = child
24
31
  ci += 1
25
- elseif React.isValidElement(child) and (child.props).dock == "Right" then
32
+ elseif dock == "Right" then
26
33
  right[ri + 1] = child
27
34
  ri += 1
28
35
  else
@@ -45,7 +52,9 @@ local function TopbarProvider(_param)
45
52
  local stylesheet = useStylesheet().provider
46
53
  local hasBetaLabel = gameVoiceChatEnabled and voiceChatEnabled
47
54
  local leftPadding = if hasBetaLabel then stylesheet.paddingLeft + 16 else stylesheet.paddingLeft
48
- local frameHeight = inset.Height - stylesheet.insetHeightOffset
55
+ local rawHeight = inset.Height - stylesheet.insetHeightOffset
56
+ local frameHeight = if stylesheet.forceFrameHeight ~= nil then stylesheet.forceFrameHeight else rawHeight
57
+ 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})`)
49
58
  local _binding = sortByDock(children)
50
59
  local leftChildren = _binding[1]
51
60
  local centerChildren = _binding[2]
@@ -121,6 +130,7 @@ local function TopbarProvider(_param)
121
130
  FillDirection = Enum.FillDirection.Horizontal,
122
131
  SortOrder = Enum.SortOrder.LayoutOrder,
123
132
  Padding = UDim.new(0, stylesheet.iconSpacing),
133
+ VerticalAlignment = Enum.VerticalAlignment.Center,
124
134
  }), leftChildren), hasCenter and (React.createElement("frame", {
125
135
  key = "CenterDock",
126
136
  BackgroundTransparency = 1,
@@ -135,6 +145,7 @@ local function TopbarProvider(_param)
135
145
  FillDirection = Enum.FillDirection.Horizontal,
136
146
  SortOrder = Enum.SortOrder.LayoutOrder,
137
147
  Padding = UDim.new(0, stylesheet.iconSpacing),
148
+ VerticalAlignment = Enum.VerticalAlignment.Center,
138
149
  }), centerChildren)), hasRight and (React.createElement("frame", {
139
150
  key = "RightDock",
140
151
  BackgroundTransparency = 1,
@@ -148,6 +159,7 @@ local function TopbarProvider(_param)
148
159
  FillDirection = Enum.FillDirection.Horizontal,
149
160
  SortOrder = Enum.SortOrder.LayoutOrder,
150
161
  Padding = UDim.new(0, stylesheet.iconSpacing),
162
+ VerticalAlignment = Enum.VerticalAlignment.Center,
151
163
  }), rightChildren))))
152
164
  end
153
165
  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.1",
3
+ "version": "1.0.3",
4
4
  "main": "out/init.lua",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",