wuira 0.2.8 → 0.3.2

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/CHANGELOG.md CHANGED
@@ -7,6 +7,35 @@ with the release date and highlight breaking changes explicitly.
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.3.2 — 2026-10-19
11
+
12
+ ### Fixed
13
+
14
+ - Older `justify` uses only leftover space. A line wider than its container stays at the start instead of being pulled backward.
15
+
16
+ ## 0.3.1 — 2026-10-19
17
+
18
+ ### Added
19
+
20
+ - `width` and `height` accept `"fill"`. Fill children share the space left after fixed siblings. `"inherit"` still takes the whole parent.
21
+ - Flow and grid accept `ltr`, `rtl`, `ttb`, and `btt`, plus `alignX` and `alignY`. A child's anchor places it inside its slot. Older `horizontal`, `vertical`, and `justify` values still apply.
22
+ - Flow `columnGap` and `rowGap` set horizontal and vertical spacing independently. Older `gap` and `lineGap` still apply when the matching axis is unset.
23
+ - `startOverlayGlow` draws Pixel, button overlay, autocast shine, and proc styles with additive textures. It returns a stop function and does not depend on another addon.
24
+ - Static client catalogs for progress textures, backgrounds, borders, and fonts. A catalog key resolves to a Blizzard path; any other string remains a custom path.
25
+
26
+ ## 0.3.0 — 2026-10-17
27
+
28
+ ### Breaking
29
+
30
+ - The package root exports only the addon shell: `Wuira`, `wuira`, `WuiraApp`, `AddonSettings`, `Encoding`, `Store`, and `StoreRegistry`.
31
+ - Import widgets, including `UI`, `HoverTracker`, and `unitPortrait`, from `wuira/ui`.
32
+ - Import `BlizzardUI` and `ActionBars` from `wuira/platform`.
33
+ - Import `Nameplates` and `MicroBar` from `wuira/skins`. Spell and icon enums stay on `wuira/spells` and `wuira/icons`.
34
+
35
+ ### Added
36
+
37
+ - `unitPortrait` mounts a unit portrait and a protected target/menu button without coupling resource widgets to that button.
38
+
10
39
  ## 0.2.8 — 2026-10-17
11
40
 
12
41
  ### Fixed
package/README.md CHANGED
@@ -7,7 +7,8 @@ Build WoW Forever interfaces with TypeScript and JSX.
7
7
  wuira is a UI framework and addon toolchain for developers who want to describe interfaces in code, compose reusable components, and keep game data separate from presentation. Write TypeScript, arrange native widgets with JSX, and compile your addon to Lua.
8
8
 
9
9
  ```tsx
10
- import { UI, wuira } from "wuira";
10
+ import { wuira } from "wuira";
11
+ import { UI } from "wuira/ui";
11
12
 
12
13
  function ResourceBar({ current }: { current: number }) {
13
14
  return <progress width="inherit" height={24} min={0} max={100} current={current} />;
@@ -79,7 +80,8 @@ Supported action types: `spell`, `item`, `macro`, `action`, and `target`. Action
79
80
  ## Nameplates
80
81
 
81
82
  ```tsx
82
- import { Nameplates, UI } from "wuira";
83
+ import { UI } from "wuira/ui";
84
+ import { Nameplates } from "wuira/skins";
83
85
  import { HP } from "wuira/datasources";
84
86
 
85
87
  const plates = Nameplates
@@ -141,6 +143,8 @@ For global installation, use `npm install -g wuira`. To test unpublished changes
141
143
 
142
144
  wuira is an early framework. It is not a complete UI replacement, an in-game visual editor, or a WeakAuras replacement. JSX describes widgets; there is no React runtime or automatic reactive rendering layer. Combat restrictions and secret-value rules still apply and cannot be bypassed by the framework.
143
145
 
146
+ Import widgets from `wuira/ui` (including `unitPortrait`), native adapters from `wuira/skins`, and `BlizzardUI` / `ActionBars` from `wuira/platform`. The package root is the addon shell.
147
+
144
148
  Current core includes Cells, layouts, progress bars, decorations, unit sources, native nameplate adapters, and project tooling. Not yet implemented: a complete WoW API surface, nameplate click-cast abstractions, and preset management. Nameplate lifecycle tests use a mock Lua runtime; real-client validation is still required.
145
149
 
146
150
  The target client is WoW Forever. Compatibility with Retail or other Classic clients is not promised without verification.
package/docs/icons.md CHANGED
@@ -3,7 +3,7 @@
3
3
  `Icons` contains native texture **FileDataIDs** from the same verified Forever build as the spell enums. Icon identity is independent of spell or item actions.
4
4
 
5
5
  ```ts
6
- import { UI } from "wuira";
6
+ import { UI } from "wuira/ui";
7
7
  import { Icons } from "wuira/icons";
8
8
  import { Icon } from "wuira/ui";
9
9
 
@@ -1,6 +1,6 @@
1
1
  # Nameplates
2
2
 
3
- Import `Nameplates` from `wuira` or `wuira/skins`. Wuira owns native access,
3
+ Import `Nameplates` from `wuira/skins`. Wuira owns native access,
4
4
  events, unit bindings and visual cleanup. Preset selection, NPC rules, editor
5
5
  data and component collections belong to the consuming addon (for example LumaUI).
6
6
  No class or mob presets are built into Wuira.
package/lib/index.d.ts CHANGED
@@ -5,20 +5,5 @@ export { WuiraApp } from "./WuiraApp";
5
5
  export type { CommandCallback } from "./platform/SlashCommands";
6
6
  export { AddonSettings } from "./platform/AddonSettings";
7
7
  export { Encoding } from "./platform/Encoding";
8
- export { DruidSpells, GeneralSpells, HunterSpells, MageSpells, PaladinSpells, PetSpells, PriestSpells, ProfessionSpells, RacialSpells, RogueSpells, ShamanSpells, WarlockSpells, WarriorSpells, WorldSpells, BindingActions, } from "./spells/index";
9
- export { Icons } from "./icons/index";
10
- export { BlizzardUI } from "./platform/BlizzardUI";
11
- export { ActionBars } from "./platform/ActionBars";
12
- export type { ActionSlot, EmptyActionBarsOptions } from "./platform/ActionBars";
13
- export type { BlizzardUIOptions } from "./platform/BlizzardUI";
14
- export type { MicroMenuSkinOptions } from "./platform/MicroMenu";
15
- export { UI } from "./ui/primitives/jsx";
16
- export { HoverTracker } from "./ui/HoverTracker";
17
- export type { HoverTrackerOptions, HoverFrame } from "./ui/HoverTracker";
18
- export { MicroBar } from "./skins/MicroBar";
19
- export { Nameplates, NameplateRules, NameplateContext } from "./skins/Nameplates";
20
- export type { NameplateInfo, NameplateSelector, NameplateCustomize, NameplateRender, NativeNameplate, NativeNameplateVisual } from "./skins/Nameplates";
21
- export type { Element, Component } from "./ui/primitives/jsx";
22
- export type { Cell } from "./ui/Cell";
23
8
  export { Store, StoreRegistry } from "./store/index";
24
9
  export type { StoreClass, ReadonlyData, SavedStoreOptions } from "./store/index";
package/lib/index.lua CHANGED
@@ -18,32 +18,6 @@ do
18
18
  local ____Encoding = require("platform.Encoding")
19
19
  ____exports.Encoding = ____Encoding.Encoding
20
20
  end
21
- do
22
- local ____BlizzardUI = require("platform.BlizzardUI")
23
- ____exports.BlizzardUI = ____BlizzardUI.BlizzardUI
24
- end
25
- do
26
- local ____ActionBars = require("platform.ActionBars")
27
- ____exports.ActionBars = ____ActionBars.ActionBars
28
- end
29
- do
30
- local ____jsx = require("ui.primitives.jsx")
31
- ____exports.UI = ____jsx.UI
32
- end
33
- do
34
- local ____HoverTracker = require("ui.HoverTracker")
35
- ____exports.HoverTracker = ____HoverTracker.HoverTracker
36
- end
37
- do
38
- local ____MicroBar = require("skins.MicroBar")
39
- ____exports.MicroBar = ____MicroBar.MicroBar
40
- end
41
- do
42
- local ____Nameplates = require("skins.Nameplates")
43
- ____exports.Nameplates = ____Nameplates.Nameplates
44
- ____exports.NameplateRules = ____Nameplates.NameplateRules
45
- ____exports.NameplateContext = ____Nameplates.NameplateContext
46
- end
47
21
  do
48
22
  local ____index = require("store.index")
49
23
  ____exports.Store = ____index.Store
@@ -7,6 +7,7 @@ interface wuiraNativeTexture {
7
7
  SetAllPoints(frame: wuiraNativeFrame): void;
8
8
  SetColorTexture(red: number, green: number, blue: number, alpha: number): void;
9
9
  SetTexture(path: string | number | undefined): void;
10
+ SetAtlas(atlas: string): void;
10
11
  SetVertexColor(red: number, green: number, blue: number, alpha: number): void;
11
12
  SetBlendMode(mode: import("../types/Texture").BlendMode): void;
12
13
  SetHorizTile(enabled: boolean): void;
@@ -101,7 +102,7 @@ interface wuiraNativeStatusBar extends wuiraNativeFrame {
101
102
  GetStatusBarTexture(): wuiraNativeTexture;
102
103
  SetMinMaxValues(min: number, max: number): void;
103
104
  SetValue(value: number): void;
104
- SetStatusBarTexture(path: string): void;
105
+ SetStatusBarTexture(path: string | number): void;
105
106
  SetStatusBarColor(red: number, green: number, blue: number, alpha: number): void;
106
107
  SetOrientation(orientation: "HORIZONTAL" | "VERTICAL"): void;
107
108
  SetReverseFill(reverse: boolean): void;
@@ -0,0 +1,5 @@
1
+ export { BlizzardUI } from "./BlizzardUI";
2
+ export type { BlizzardUIOptions } from "./BlizzardUI";
3
+ export { ActionBars } from "./ActionBars";
4
+ export type { ActionSlot, EmptyActionBarsOptions } from "./ActionBars";
5
+ export type { MicroMenuSkinOptions } from "./MicroMenu";
@@ -0,0 +1,11 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ do
4
+ local ____BlizzardUI = require("platform.BlizzardUI")
5
+ ____exports.BlizzardUI = ____BlizzardUI.BlizzardUI
6
+ end
7
+ do
8
+ local ____ActionBars = require("platform.ActionBars")
9
+ ____exports.ActionBars = ____ActionBars.ActionBars
10
+ end
11
+ return ____exports
@@ -463,8 +463,8 @@ function ____exports.prepareLayout(self, element, parent, mountedFrames)
463
463
  nil,
464
464
  element,
465
465
  {
466
- width = rootProps.width == "inherit" and parent:GetWidth() or nil,
467
- height = rootProps.height == "inherit" and parent:GetHeight() or nil
466
+ width = (rootProps.width == "inherit" or rootProps.width == "fill") and parent:GetWidth() or nil,
467
+ height = (rootProps.height == "inherit" or rootProps.height == "fill") and parent:GetHeight() or nil
468
468
  }
469
469
  )
470
470
  local ____temp_3 = parent ~= UIParent
@@ -54,16 +54,18 @@ local ____exports = {}
54
54
  local ____Resources = require("datasources.Resources")
55
55
  local HP = ____Resources.HP
56
56
  local ____statusBarTextures = require("ui.decorations.statusBarTextures")
57
+ local applyStatusBarTexture = ____statusBarTextures.applyStatusBarTexture
57
58
  local resolveStatusBarTexture = ____statusBarTextures.resolveStatusBarTexture
58
59
  function ____exports.renderProgress(self, item, tree, onActiveChange)
59
60
  local props = item.cell.props
60
61
  local bar = item.frame
61
62
  local ____opt_0 = props.foreground
62
63
  local color = ____opt_0 and ____opt_0.color or props.color
63
- local ____bar_SetStatusBarTexture_5 = bar.SetStatusBarTexture
64
+ local ____applyStatusBarTexture_5 = applyStatusBarTexture
64
65
  local ____resolveStatusBarTexture_4 = resolveStatusBarTexture
65
66
  local ____opt_2 = props.foreground
66
- ____bar_SetStatusBarTexture_5(
67
+ ____applyStatusBarTexture_5(
68
+ nil,
67
69
  bar,
68
70
  ____resolveStatusBarTexture_4(nil, ____opt_2 and ____opt_2.texture or props.texture or "solid")
69
71
  )
@@ -107,7 +109,11 @@ function ____exports.renderProgress(self, item, tree, onActiveChange)
107
109
  layer:EnableMouse(false)
108
110
  layer:SetFrameLevel(bar:GetFrameLevel())
109
111
  layer:SetSize(item.width, item.height)
110
- layer:SetStatusBarTexture(resolveStatusBarTexture(nil, style.texture or "solid"))
112
+ applyStatusBarTexture(
113
+ nil,
114
+ layer,
115
+ resolveStatusBarTexture(nil, style.texture or "solid")
116
+ )
111
117
  local tint = style.color
112
118
  layer:SetStatusBarColor(tint.r, tint.g, tint.b, tint.a or 0.5)
113
119
  local texture = layer:GetStatusBarTexture()
@@ -6,6 +6,9 @@ local ____secureButton = require("rendering.secureButton")
6
6
  local renderSecureButton = ____secureButton.renderSecureButton
7
7
  local ____progress = require("rendering.progress")
8
8
  local renderProgress = ____progress.renderProgress
9
+ local ____clientMedia = require("ui.media.clientMedia")
10
+ local resolveMediaPath = ____clientMedia.resolveMediaPath
11
+ local clientFonts = ____clientMedia.clientFonts
9
12
  function ____exports.createWidget(self, cell, parent)
10
13
  local frame = cell.kind == "progress" and CreateFrame("StatusBar", nil, parent) or (cell.kind == "secureButton" and createSecureButton(nil, parent, cell.props) or (cell.kind == "button" and CreateFrame("Button", nil, parent) or CreateFrame("Frame", nil, parent)))
11
14
  frame:Hide()
@@ -43,7 +46,11 @@ function ____exports.renderWidget(self, item, tree, updates, onActiveChange)
43
46
  local props = item.cell.props
44
47
  local label = item.frame:CreateFontString(nil, "OVERLAY")
45
48
  label:SetAllPoints(item.frame)
46
- label:SetFont(props.font or "Fonts\\FRIZQT__.TTF", props.fontSize or 12, "OUTLINE")
49
+ label:SetFont(
50
+ resolveMediaPath(nil, clientFonts, props.font or "friz"),
51
+ props.fontSize or 12,
52
+ "OUTLINE"
53
+ )
47
54
  label:SetJustifyH(props.align or "LEFT")
48
55
  label:SetJustifyV("MIDDLE")
49
56
  local color = props.color
package/lib/ui/Cell.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { Element } from "./primitives/jsx";
2
2
  import type { Decorations } from "./decorations/Decorations";
3
3
  import type { Position } from "../types/Position";
4
4
  import type { Spacing } from "../types/Spacing";
5
- export type Size = number | "inherit";
5
+ export type Size = number | "inherit" | "fill";
6
6
  /** Common visual descriptor accepted by the mounting API. */
7
7
  export interface Cell extends Element {
8
8
  }
@@ -1,12 +1,24 @@
1
1
  import type { LayoutProps, ILayout } from "./Layout";
2
2
  import type { Element, Children } from "./primitives/jsx";
3
+ export type FlowDirection = "ltr" | "rtl" | "ttb" | "btt" | "horizontal" | "vertical" | "horizontalReverse" | "verticalReverse";
3
4
  export interface FlowOptions {
4
- direction: "horizontal" | "vertical";
5
- /** Wrap to another row (horizontal) or column (vertical) when full. */
5
+ /** ltr packs left to right. rtl packs right to left. ttb packs top to bottom. btt packs bottom to top. horizontal and vertical remain readable. */
6
+ direction: FlowDirection;
7
+ /** Wrap to another row or column when full. */
6
8
  grow?: boolean;
7
- /** Space between rows/columns; defaults to gap. */
9
+ /** Horizontal space between children. Falls back to gap or lineGap, depending on direction. */
10
+ columnGap?: number;
11
+ /** Vertical space between children. Falls back to gap or lineGap, depending on direction. */
12
+ rowGap?: number;
13
+ /** Older shared spacing, used when columnGap or rowGap is unset. */
14
+ gap?: number;
15
+ /** Older cross-axis spacing, used when the matching axis gap is unset. */
8
16
  lineGap?: number;
9
- /** Align each row/column along the flow direction. Defaults to start. */
17
+ /** Places the arranged lines on the horizontal axis. */
18
+ alignX?: "left" | "center" | "right";
19
+ /** Places the arranged lines on the vertical axis. */
20
+ alignY?: "top" | "center" | "bottom";
21
+ /** Older main-axis alignment, used when the matching axis position is unset. */
10
22
  justify?: "start" | "center" | "end";
11
23
  }
12
24
  export type FlowLayoutProps = LayoutProps & FlowOptions;
@@ -1,9 +1,18 @@
1
1
  import type { LayoutProps, ILayout } from "./Layout";
2
+ import type { FlowDirection } from "./FlowLayout";
2
3
  import type { Element, Children } from "./primitives/jsx";
3
4
  export interface GridOptions {
4
5
  columns: number;
5
- rowGap?: number;
6
+ /** ltr fills rows left to right. ttb fills columns top to bottom. Older horizontal and vertical values remain readable. */
7
+ direction?: FlowDirection;
8
+ /** Places the whole grid on the horizontal axis. */
9
+ alignX?: "left" | "center" | "right";
10
+ /** Places the whole grid on the vertical axis. */
11
+ alignY?: "top" | "center" | "bottom";
12
+ /** Horizontal space between columns. Falls back to gap. */
6
13
  columnGap?: number;
14
+ /** Vertical space between rows. Falls back to gap. */
15
+ rowGap?: number;
7
16
  /** Defaults to the maximum child width/height. Does not resize children. */
8
17
  cellWidth?: number;
9
18
  cellHeight?: number;
@@ -21,7 +21,12 @@ function ScrollHost.prototype.____constructor(self, parent, onScroll)
21
21
  parent:GetHeight()
22
22
  )
23
23
  self.Frame:SetAllPoints(parent)
24
- self.Frame:EnableMouse(true)
24
+ self.Frame:EnableMouse(false)
25
+ local wheel = self.Frame
26
+ local ____opt_0 = wheel.EnableMouseWheel
27
+ if ____opt_0 ~= nil then
28
+ ____opt_0(wheel, true)
29
+ end
25
30
  self.Frame:SetScript(
26
31
  "OnMouseWheel",
27
32
  function(_frame, delta) return self:ScrollBy(-delta * 32) end
@@ -51,9 +56,9 @@ function ScrollHost.prototype.ScrollTo(self, offset)
51
56
  )
52
57
  )
53
58
  self.Frame:SetVerticalScroll(value)
54
- local ____opt_0 = self.onScroll
55
- if ____opt_0 ~= nil then
56
- ____opt_0(self, value)
59
+ local ____opt_2 = self.onScroll
60
+ if ____opt_2 ~= nil then
61
+ ____opt_2(self, value)
57
62
  end
58
63
  end
59
64
  function ScrollHost.prototype.Dispose(self)
@@ -0,0 +1,3 @@
1
+ import type { UnitInput } from "../datasources/UnitSource";
2
+ import type { CellProps } from "./Cell";
3
+ export declare function unitPortrait(props: Partial<CellProps>, input: UnitInput, crop?: readonly number[], preview?: boolean): import("./primitives/jsx").Element;
@@ -0,0 +1,233 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ -- Lua Library inline imports
3
+ local function __TS__StringTrim(self)
4
+ local result = string.gsub(self, "^[%s ]*(.-)[%s ]*$", "%1")
5
+ return result
6
+ end
7
+
8
+ local function __TS__StringIncludes(self, searchString, position)
9
+ if not position then
10
+ position = 1
11
+ else
12
+ position = position + 1
13
+ end
14
+ local index = string.find(self, searchString, position, true)
15
+ return index ~= nil
16
+ end
17
+
18
+ local function __TS__ObjectAssign(target, ...)
19
+ local sources = {...}
20
+ for i = 1, #sources do
21
+ local source = sources[i]
22
+ if type(source) == "table" then
23
+ for key in pairs(source) do
24
+ target[key] = source[key]
25
+ end
26
+ end
27
+ end
28
+ return target
29
+ end
30
+ -- End of Lua Library inline imports
31
+ local ____exports = {}
32
+ local ____UnitSource = require("datasources.UnitSource")
33
+ local resolveUnit = ____UnitSource.resolveUnit
34
+ local ____jsx = require("ui.primitives.jsx")
35
+ local UI = ____jsx.UI
36
+ function ____exports.unitPortrait(self, props, input, crop, preview)
37
+ if preview == nil then
38
+ preview = false
39
+ end
40
+ if issecretvalue(input) or type(input) == "string" and __TS__StringTrim(input) == "" then
41
+ error("Unit portrait requires a public unit token", 0)
42
+ end
43
+ local target = resolveUnit(nil, input)
44
+ return UI:createElement(
45
+ "cell",
46
+ __TS__ObjectAssign(
47
+ {},
48
+ props,
49
+ {
50
+ clickThrough = true,
51
+ onMount = function(____, frame)
52
+ local host = frame
53
+ local ____preview_0
54
+ if preview then
55
+ ____preview_0 = nil
56
+ else
57
+ ____preview_0 = CreateFrame("Button", nil, UIParent, "SecureActionButtonTemplate")
58
+ end
59
+ local button = ____preview_0
60
+ local owner = button or host
61
+ local texture = owner:CreateTexture(nil, "OVERLAY")
62
+ texture:SetAllPoints(owner)
63
+ local buttonUnit = target.Token
64
+ local stopUnit
65
+ local stopped = false
66
+ local stopping = false
67
+ local elapsed = 0
68
+ local lastX
69
+ local lastY
70
+ local lastWidth
71
+ local lastHeight
72
+ local lastStrata
73
+ local lastLevel
74
+ local lastAlpha
75
+ local function draw()
76
+ if stopped or stopping then
77
+ return
78
+ end
79
+ SetPortraitTexture(texture, target.Token, true)
80
+ local uv = crop or ({0, 1, 0, 1})
81
+ texture:SetTexCoord(uv[1], uv[2], uv[3], uv[4])
82
+ end
83
+ local function cleanup()
84
+ if stopped then
85
+ return
86
+ end
87
+ stopped = true
88
+ if stopUnit ~= nil then
89
+ stopUnit(nil)
90
+ end
91
+ stopUnit = nil
92
+ host:SetScript("OnUpdate", nil)
93
+ owner:UnregisterAllEvents()
94
+ owner:SetScript("OnEvent", nil)
95
+ if button ~= nil then
96
+ button:SetAttribute("type1", nil)
97
+ button:SetAttribute("type2", nil)
98
+ button:EnableMouse(false)
99
+ button:Hide()
100
+ end
101
+ end
102
+ local function sync()
103
+ if button == nil or stopped or stopping or InCombatLockdown() then
104
+ return
105
+ end
106
+ if buttonUnit ~= target.Token then
107
+ button:SetAttribute("unit", target.Token)
108
+ buttonUnit = target.Token
109
+ end
110
+ if not host:IsVisible() then
111
+ if button:IsShown() then
112
+ button:Hide()
113
+ end
114
+ return
115
+ end
116
+ local x, y = host:GetCenter()
117
+ if x == nil or y == nil then
118
+ return
119
+ end
120
+ local scale = host:GetEffectiveScale() / UIParent:GetEffectiveScale()
121
+ local width = host:GetWidth() * scale
122
+ local height = host:GetHeight() * scale
123
+ local cx = x * scale
124
+ local cy = y * scale
125
+ if cx ~= lastX or cy ~= lastY or width ~= lastWidth or height ~= lastHeight then
126
+ button:ClearAllPoints()
127
+ button:SetPoint(
128
+ "CENTER",
129
+ UIParent,
130
+ "BOTTOMLEFT",
131
+ cx,
132
+ cy
133
+ )
134
+ button:SetSize(width, height)
135
+ lastX = cx
136
+ lastY = cy
137
+ lastWidth = width
138
+ lastHeight = height
139
+ end
140
+ local strata = host:GetFrameStrata()
141
+ local level = host:GetFrameLevel() + 2
142
+ local alpha = host:GetEffectiveAlpha()
143
+ if strata ~= lastStrata then
144
+ button:SetFrameStrata(strata)
145
+ lastStrata = strata
146
+ end
147
+ if level ~= lastLevel then
148
+ button:SetFrameLevel(level)
149
+ lastLevel = level
150
+ end
151
+ if alpha ~= lastAlpha then
152
+ button:SetAlpha(alpha)
153
+ lastAlpha = alpha
154
+ end
155
+ if not button:IsShown() then
156
+ button:Show()
157
+ end
158
+ end
159
+ do
160
+ local function ____catch(failure)
161
+ cleanup(nil)
162
+ error(failure, 0)
163
+ end
164
+ local ____try, ____hasReturned = pcall(function()
165
+ if button ~= nil then
166
+ button:RegisterForClicks("LeftButtonUp", "RightButtonUp")
167
+ button:SetID(0)
168
+ button:SetAttribute("useOnKeyDown", false)
169
+ button:SetAttribute("unit", target.Token)
170
+ button:SetAttribute("type1", "target")
171
+ button:SetAttribute("type2", "togglemenu")
172
+ button:EnableMouse(true)
173
+ host:SetScript(
174
+ "OnUpdate",
175
+ function(_frame, delta)
176
+ elapsed = elapsed + delta
177
+ if elapsed >= 0.05 then
178
+ elapsed = 0
179
+ sync(nil)
180
+ end
181
+ end
182
+ )
183
+ host:HookScript("OnShow", sync)
184
+ host:HookScript("OnHide", sync)
185
+ owner:RegisterEvent("PLAYER_REGEN_ENABLED")
186
+ end
187
+ for ____, event in ipairs({"UNIT_PORTRAIT_UPDATE", "UNIT_MODEL_CHANGED", "PORTRAITS_UPDATED", "PLAYER_ENTERING_WORLD"}) do
188
+ owner:RegisterEvent(event)
189
+ end
190
+ if __TS__StringIncludes(target.Token, "target") then
191
+ owner:RegisterEvent("PLAYER_TARGET_CHANGED")
192
+ end
193
+ if __TS__StringIncludes(target.Token, "focus") then
194
+ owner:RegisterEvent("PLAYER_FOCUS_CHANGED")
195
+ end
196
+ owner:SetScript(
197
+ "OnEvent",
198
+ function(_frame, event, eventUnit)
199
+ if event == "PLAYER_REGEN_ENABLED" then
200
+ if stopping then
201
+ cleanup(nil)
202
+ else
203
+ sync(nil)
204
+ end
205
+ elseif event ~= "UNIT_PORTRAIT_UPDATE" and event ~= "UNIT_MODEL_CHANGED" or eventUnit == target.Token then
206
+ draw(nil)
207
+ end
208
+ end
209
+ )
210
+ stopUnit = target:onTokenChange(function()
211
+ draw(nil)
212
+ sync(nil)
213
+ end)
214
+ draw(nil)
215
+ sync(nil)
216
+ end)
217
+ if not ____try then
218
+ ____catch(____hasReturned)
219
+ end
220
+ end
221
+ return function()
222
+ stopping = true
223
+ if button ~= nil and InCombatLockdown() then
224
+ return
225
+ end
226
+ cleanup(nil)
227
+ end
228
+ end
229
+ }
230
+ )
231
+ )
232
+ end
233
+ return ____exports
@@ -1,25 +1,5 @@
1
- export declare const backgroundTextures: {
2
- readonly solid: {
3
- readonly label: "Solid";
4
- readonly path: "Interface\\Buttons\\WHITE8X8";
5
- };
6
- readonly tooltip: {
7
- readonly label: "Blizzard Tooltip";
8
- readonly path: "Interface\\Tooltips\\UI-Tooltip-Background";
9
- };
10
- readonly dialog: {
11
- readonly label: "Blizzard Dialog";
12
- readonly path: "Interface\\DialogFrame\\UI-DialogBox-Background";
13
- };
14
- readonly dialogDark: {
15
- readonly label: "Blizzard Dialog Dark";
16
- readonly path: "Interface\\DialogFrame\\UI-DialogBox-Background-Dark";
17
- };
18
- readonly dialogGold: {
19
- readonly label: "Blizzard Dialog Gold";
20
- readonly path: "Interface\\DialogFrame\\UI-DialogBox-Gold-Background";
21
- };
22
- };
1
+ import { backgroundTextures } from "../media/clientMedia";
2
+ export { backgroundTextures };
23
3
  export type BackgroundTexture = keyof typeof backgroundTextures | {
24
4
  path: string;
25
5
  };
@@ -1,10 +1,6 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
- ____exports.backgroundTextures = {
4
- solid = {label = "Solid", path = "Interface\\Buttons\\WHITE8X8"},
5
- tooltip = {label = "Blizzard Tooltip", path = "Interface\\Tooltips\\UI-Tooltip-Background"},
6
- dialog = {label = "Blizzard Dialog", path = "Interface\\DialogFrame\\UI-DialogBox-Background"},
7
- dialogDark = {label = "Blizzard Dialog Dark", path = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark"},
8
- dialogGold = {label = "Blizzard Dialog Gold", path = "Interface\\DialogFrame\\UI-DialogBox-Gold-Background"}
9
- }
3
+ local ____clientMedia = require("ui.media.clientMedia")
4
+ local backgroundTextures = ____clientMedia.backgroundTextures
5
+ ____exports.backgroundTextures = backgroundTextures
10
6
  return ____exports