wuira 0.1.0 → 0.1.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.
Files changed (109) hide show
  1. package/README.md +204 -18
  2. package/cli/wuira.mjs +67 -0
  3. package/config/tsconfig.json +27 -0
  4. package/lib/Console.d.ts +5 -0
  5. package/lib/Console.lua +20 -0
  6. package/lib/console-polyfill.d.ts +9 -0
  7. package/lib/console-polyfill.lua +39 -0
  8. package/lib/datasources/DataSource.d.ts +17 -0
  9. package/lib/datasources/DataSource.lua +199 -0
  10. package/lib/datasources/NativeNumberSource.d.ts +7 -0
  11. package/lib/datasources/NativeNumberSource.lua +50 -0
  12. package/lib/datasources/ProgressSource.d.ts +23 -0
  13. package/lib/datasources/ProgressSource.lua +79 -0
  14. package/lib/datasources/Resources.d.ts +27 -0
  15. package/lib/datasources/Resources.lua +102 -0
  16. package/lib/datasources/index.d.ts +4 -0
  17. package/lib/datasources/index.lua +18 -0
  18. package/lib/index.d.ts +6 -0
  19. package/lib/index.lua +12 -0
  20. package/{src → lib}/platform/forever.d.ts +17 -17
  21. package/{src/types/Anchor.ts → lib/types/Anchor.d.ts} +6 -7
  22. package/lib/types/Anchor.lua +8 -0
  23. package/lib/types/Color.lua +3 -0
  24. package/lib/types/Position.d.ts +21 -0
  25. package/lib/types/Position.lua +3 -0
  26. package/lib/types/Spacing.d.ts +14 -0
  27. package/lib/types/Spacing.lua +20 -0
  28. package/{src/types/Texture.ts → lib/types/Texture.d.ts} +0 -2
  29. package/lib/types/Texture.lua +3 -0
  30. package/{src/ui/Cell.tsx → lib/ui/Cell.d.ts} +6 -8
  31. package/lib/ui/Cell.lua +9 -0
  32. package/{src/ui/FlowLayout.tsx → lib/ui/FlowLayout.d.ts} +3 -8
  33. package/lib/ui/FlowLayout.lua +8 -0
  34. package/{src/ui/GridLayout.tsx → lib/ui/GridLayout.d.ts} +3 -8
  35. package/lib/ui/GridLayout.lua +8 -0
  36. package/{src/ui/Layout.ts → lib/ui/Layout.d.ts} +4 -3
  37. package/lib/ui/Layout.lua +3 -0
  38. package/{src/ui/ProgressBar.tsx → lib/ui/ProgressBar.d.ts} +4 -7
  39. package/lib/ui/ProgressBar.lua +8 -0
  40. package/lib/ui/decorations/Background.d.ts +10 -0
  41. package/lib/ui/decorations/Background.lua +76 -0
  42. package/lib/ui/decorations/Border.d.ts +18 -0
  43. package/lib/ui/decorations/Border.lua +188 -0
  44. package/lib/ui/decorations/Decoration.d.ts +13 -0
  45. package/lib/ui/decorations/Decoration.lua +81 -0
  46. package/{src/ui/decorations/Decorations.ts → lib/ui/decorations/Decorations.d.ts} +0 -1
  47. package/lib/ui/decorations/Decorations.lua +3 -0
  48. package/lib/ui/decorations/Glow.d.ts +14 -0
  49. package/lib/ui/decorations/Glow.lua +63 -0
  50. package/lib/ui/decorations/backgroundTextures.d.ts +25 -0
  51. package/lib/ui/decorations/backgroundTextures.lua +10 -0
  52. package/lib/ui/decorations/borderTextures.d.ts +41 -0
  53. package/lib/ui/decorations/borderTextures.lua +12 -0
  54. package/lib/ui/decorations/statusBarTextures.d.ts +12 -0
  55. package/lib/ui/decorations/statusBarTextures.lua +9 -0
  56. package/lib/ui/index.d.ts +11 -0
  57. package/lib/ui/index.lua +35 -0
  58. package/lib/ui/layout/calculateFlow.d.ts +12 -0
  59. package/lib/ui/layout/calculateFlow.lua +36 -0
  60. package/lib/ui/layout/calculateGrid.d.ts +9 -0
  61. package/lib/ui/layout/calculateGrid.lua +47 -0
  62. package/lib/ui/layout/measureLayout.d.ts +19 -0
  63. package/lib/ui/layout/measureLayout.lua +215 -0
  64. package/lib/ui/mount.d.ts +5 -0
  65. package/lib/ui/mount.lua +486 -0
  66. package/lib/ui/primitives/jsx.d.ts +38 -0
  67. package/lib/ui/primitives/jsx.lua +66 -0
  68. package/lib/wuira.d.ts +8 -0
  69. package/lib/wuira.lua +36 -0
  70. package/package.json +55 -5
  71. package/templates/addon/README.md +13 -0
  72. package/templates/addon/addon.toc.in +4 -0
  73. package/templates/addon/gitignore +3 -0
  74. package/templates/addon/package.json +11 -0
  75. package/templates/addon/src/index.tsx +7 -0
  76. package/templates/addon/tsconfig.json +8 -0
  77. package/templates/addon/wuira.config.mjs +4 -0
  78. package/tools/build-library.mjs +15 -0
  79. package/tools/module-loader.lua +3 -3
  80. package/tools/{wow-modules.cjs → wow-modules.mjs} +27 -11
  81. package/tsconfig.json +1 -1
  82. package/tsconfig.lib.json +8 -0
  83. package/addon.toc.in +0 -4
  84. package/cli/uira.cjs +0 -55
  85. package/src/Console.ts +0 -10
  86. package/src/UIra.ts +0 -18
  87. package/src/console-polyfill.ts +0 -25
  88. package/src/datasources/DataSource.ts +0 -42
  89. package/src/datasources/NativeNumberSource.ts +0 -7
  90. package/src/datasources/ProgressSource.ts +0 -46
  91. package/src/datasources/Resources.ts +0 -41
  92. package/src/examples/ProgressBars.tsx +0 -24
  93. package/src/index.tsx +0 -3
  94. package/src/playground/PlayerFrame.ts +0 -271
  95. package/src/types/Position.ts +0 -21
  96. package/src/types/Spacing.ts +0 -14
  97. package/src/ui/decorations/Background.ts +0 -29
  98. package/src/ui/decorations/Border.ts +0 -71
  99. package/src/ui/decorations/Decoration.ts +0 -59
  100. package/src/ui/decorations/Glow.ts +0 -25
  101. package/src/ui/decorations/backgroundTextures.ts +0 -10
  102. package/src/ui/decorations/borderTextures.ts +0 -13
  103. package/src/ui/decorations/statusBarTextures.ts +0 -11
  104. package/src/ui/layout/calculateFlow.ts +0 -33
  105. package/src/ui/layout/calculateGrid.ts +0 -22
  106. package/src/ui/layout/measureLayout.ts +0 -87
  107. package/src/ui/mount.ts +0 -138
  108. package/src/ui/primitives/jsx.ts +0 -75
  109. /package/{src/types/Color.ts → lib/types/Color.d.ts} +0 -0
@@ -1,11 +1,10 @@
1
1
  import type { CellProps, ICell } from "./Cell";
2
2
  import type { Color } from "../types/Color";
3
3
  import type { ProgressSource } from "../datasources/ProgressSource";
4
- import { UI, Element } from "./primitives/jsx";
4
+ import { Element } from "./primitives/jsx";
5
5
  import type { TextureOptions } from "../types/Texture";
6
6
  import type { BackgroundProps } from "./decorations/Background";
7
7
  import type { BorderProps } from "./decorations/Border";
8
-
9
8
  export type ProgressBarProps = CellProps & {
10
9
  value?: number;
11
10
  current?: number;
@@ -24,12 +23,10 @@ export type ProgressBarProps = CellProps & {
24
23
  orientation?: "horizontal" | "vertical";
25
24
  reverse?: boolean;
26
25
  };
27
-
28
26
  export interface IProgressBar extends ICell {
29
27
  kind: "progress";
30
28
  props: ProgressBarProps;
31
29
  }
32
-
33
- export function ProgressBar(props: Partial<ProgressBarProps> & { child?: Element }, child?: Element): Element {
34
- return UI.createElement("progress", props, props.child ?? child ?? []);
35
- }
30
+ export declare function ProgressBar(props: Partial<ProgressBarProps> & {
31
+ child?: Element;
32
+ }, child?: Element): Element;
@@ -0,0 +1,8 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local ____jsx = require("ui.primitives.jsx")
4
+ local UI = ____jsx.UI
5
+ function ____exports.ProgressBar(self, props, child)
6
+ return UI:createElement("progress", props, props.child or child or ({}))
7
+ end
8
+ return ____exports
@@ -0,0 +1,10 @@
1
+ import type { TextureOptions } from "../../types/Texture";
2
+ import { Decoration } from "./Decoration";
3
+ import type { BackgroundTexture } from "./backgroundTextures";
4
+ export interface BackgroundProps extends TextureOptions<BackgroundTexture> {
5
+ }
6
+ export declare class Background extends Decoration {
7
+ readonly props: BackgroundProps;
8
+ constructor(props: BackgroundProps);
9
+ protected draw(frame: wuiraNativeFrame): void;
10
+ }
@@ -0,0 +1,76 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ -- Lua Library inline imports
3
+ local function __TS__Class(self)
4
+ local c = {prototype = {}}
5
+ c.prototype.__index = c.prototype
6
+ c.prototype.constructor = c
7
+ return c
8
+ end
9
+
10
+ local function __TS__ClassExtends(target, base)
11
+ target.____super = base
12
+ local staticMetatable = setmetatable({__index = base}, base)
13
+ setmetatable(target, staticMetatable)
14
+ local baseMetatable = getmetatable(base)
15
+ if baseMetatable then
16
+ if type(baseMetatable.__index) == "function" then
17
+ staticMetatable.__index = baseMetatable.__index
18
+ end
19
+ if type(baseMetatable.__newindex) == "function" then
20
+ staticMetatable.__newindex = baseMetatable.__newindex
21
+ end
22
+ end
23
+ setmetatable(target.prototype, base.prototype)
24
+ if type(base.prototype.__index) == "function" then
25
+ target.prototype.__index = base.prototype.__index
26
+ end
27
+ if type(base.prototype.__newindex) == "function" then
28
+ target.prototype.__newindex = base.prototype.__newindex
29
+ end
30
+ if type(base.prototype.__tostring) == "function" then
31
+ target.prototype.__tostring = base.prototype.__tostring
32
+ end
33
+ end
34
+ -- End of Lua Library inline imports
35
+ local ____exports = {}
36
+ local ____Decoration = require("ui.decorations.Decoration")
37
+ local Decoration = ____Decoration.Decoration
38
+ local ____backgroundTextures = require("ui.decorations.backgroundTextures")
39
+ local backgroundTextures = ____backgroundTextures.backgroundTextures
40
+ ____exports.Background = __TS__Class()
41
+ local Background = ____exports.Background
42
+ Background.name = "Background"
43
+ __TS__ClassExtends(Background, Decoration)
44
+ function Background.prototype.____constructor(self, props)
45
+ Decoration.prototype.____constructor(self)
46
+ self.props = props
47
+ end
48
+ function Background.prototype.draw(self, frame)
49
+ local texture = self:texture(frame, "BACKGROUND")
50
+ local color = self.props.color or ({r = 1, g = 1, b = 1})
51
+ texture:SetAllPoints(frame)
52
+ if self.props.texture ~= nil then
53
+ local selected = self.props.texture
54
+ local path = type(selected) == "string" and backgroundTextures[selected].path or selected.path
55
+ texture:SetTexture(path)
56
+ texture:SetVertexColor(color.r, color.g, color.b, color.a or 1)
57
+ else
58
+ texture:SetColorTexture(color.r, color.g, color.b, color.a or 1)
59
+ end
60
+ local ____texture_SetHorizTile_1 = texture.SetHorizTile
61
+ local ____self_props_tileX_0 = self.props.tileX
62
+ if ____self_props_tileX_0 == nil then
63
+ ____self_props_tileX_0 = false
64
+ end
65
+ ____texture_SetHorizTile_1(texture, ____self_props_tileX_0)
66
+ local ____texture_SetVertTile_3 = texture.SetVertTile
67
+ local ____self_props_tileY_2 = self.props.tileY
68
+ if ____self_props_tileY_2 == nil then
69
+ ____self_props_tileY_2 = false
70
+ end
71
+ ____texture_SetVertTile_3(texture, ____self_props_tileY_2)
72
+ texture:SetBlendMode(self.props.blendMode or "BLEND")
73
+ local uv = self.props.texCoords or ({0, 1, 0, 1})
74
+ texture:SetTexCoord(uv[1], uv[2], uv[3], uv[4])
75
+ end
76
+ return ____exports
@@ -0,0 +1,18 @@
1
+ import type { Color } from "../../types/Color";
2
+ import { Decoration } from "./Decoration";
3
+ import { BorderTexture } from "./borderTextures";
4
+ export interface BorderProps {
5
+ thickness?: number;
6
+ color: Color;
7
+ texture?: BorderTexture;
8
+ /** Rounded solid borders only. Native textures supply their own corner shape. */
9
+ radius?: number;
10
+ }
11
+ export declare class Border extends Decoration {
12
+ readonly props: BorderProps;
13
+ constructor(props: BorderProps);
14
+ protected draw(frame: wuiraNativeFrame, width: number, height: number): void;
15
+ /** Bounded scanline approximation, without masks or external image assets. */
16
+ private rounded;
17
+ private strip;
18
+ }
@@ -0,0 +1,188 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ -- Lua Library inline imports
3
+ local function __TS__Class(self)
4
+ local c = {prototype = {}}
5
+ c.prototype.__index = c.prototype
6
+ c.prototype.constructor = c
7
+ return c
8
+ end
9
+
10
+ local function __TS__ClassExtends(target, base)
11
+ target.____super = base
12
+ local staticMetatable = setmetatable({__index = base}, base)
13
+ setmetatable(target, staticMetatable)
14
+ local baseMetatable = getmetatable(base)
15
+ if baseMetatable then
16
+ if type(baseMetatable.__index) == "function" then
17
+ staticMetatable.__index = baseMetatable.__index
18
+ end
19
+ if type(baseMetatable.__newindex) == "function" then
20
+ staticMetatable.__newindex = baseMetatable.__newindex
21
+ end
22
+ end
23
+ setmetatable(target.prototype, base.prototype)
24
+ if type(base.prototype.__index) == "function" then
25
+ target.prototype.__index = base.prototype.__index
26
+ end
27
+ if type(base.prototype.__newindex) == "function" then
28
+ target.prototype.__newindex = base.prototype.__newindex
29
+ end
30
+ if type(base.prototype.__tostring) == "function" then
31
+ target.prototype.__tostring = base.prototype.__tostring
32
+ end
33
+ end
34
+ -- End of Lua Library inline imports
35
+ local ____exports = {}
36
+ local ____Decoration = require("ui.decorations.Decoration")
37
+ local Decoration = ____Decoration.Decoration
38
+ local ____borderTextures = require("ui.decorations.borderTextures")
39
+ local borderTextures = ____borderTextures.borderTextures
40
+ ____exports.Border = __TS__Class()
41
+ local Border = ____exports.Border
42
+ Border.name = "Border"
43
+ __TS__ClassExtends(Border, Decoration)
44
+ function Border.prototype.____constructor(self, props)
45
+ Decoration.prototype.____constructor(self)
46
+ self.props = props
47
+ end
48
+ function Border.prototype.draw(self, frame, width, height)
49
+ local selected = self.props.texture or "solid"
50
+ local style = type(selected) == "string" and borderTextures[selected] or selected
51
+ local color = self.props.color
52
+ local thickness = self.props.thickness or style.edgeSize
53
+ if thickness <= 0 then
54
+ return
55
+ end
56
+ if style.path ~= "" then
57
+ if (self.props.radius or 0) > 0 then
58
+ error("Native border textures define their own corners; radius requires solid")
59
+ end
60
+ local border = self:backdrop(frame)
61
+ border:SetBackdrop({edgeFile = style.path, edgeSize = thickness})
62
+ border:SetBackdropBorderColor(color.r, color.g, color.b, color.a or 1)
63
+ return
64
+ end
65
+ local t = math.min(thickness, width / 2, height / 2)
66
+ local radius = math.min(
67
+ math.max(0, self.props.radius or 0),
68
+ width / 2,
69
+ height / 2
70
+ )
71
+ if radius > 0 then
72
+ self:rounded(
73
+ frame,
74
+ width,
75
+ height,
76
+ t,
77
+ radius
78
+ )
79
+ return
80
+ end
81
+ self:strip(
82
+ frame,
83
+ 0,
84
+ 0,
85
+ width,
86
+ t
87
+ )
88
+ self:strip(
89
+ frame,
90
+ 0,
91
+ height - t,
92
+ width,
93
+ t
94
+ )
95
+ self:strip(
96
+ frame,
97
+ 0,
98
+ t,
99
+ t,
100
+ height - 2 * t
101
+ )
102
+ self:strip(
103
+ frame,
104
+ width - t,
105
+ t,
106
+ t,
107
+ height - 2 * t
108
+ )
109
+ end
110
+ function Border.prototype.rounded(self, frame, width, height, t, radius)
111
+ local extent = math.max(radius, t)
112
+ local rows = math.min(
113
+ 32,
114
+ math.ceil(extent)
115
+ )
116
+ local step = extent / rows
117
+ local innerRadius = math.max(0, radius - t)
118
+ do
119
+ local row = 0
120
+ while row < rows do
121
+ local y = (row + 0.5) * step
122
+ local distance = math.max(0, radius - y)
123
+ local outer = y < radius and radius - math.sqrt(math.max(0, radius * radius - distance * distance)) or 0
124
+ local inner = y < t and width / 2 or (y < radius and t + innerRadius - math.sqrt(math.max(0, innerRadius * innerRadius - distance * distance)) or t)
125
+ local span = math.max(0, inner - outer)
126
+ self:strip(
127
+ frame,
128
+ outer,
129
+ row * step,
130
+ span,
131
+ step
132
+ )
133
+ self:strip(
134
+ frame,
135
+ width - inner,
136
+ row * step,
137
+ span,
138
+ step
139
+ )
140
+ self:strip(
141
+ frame,
142
+ outer,
143
+ height - (row + 1) * step,
144
+ span,
145
+ step
146
+ )
147
+ self:strip(
148
+ frame,
149
+ width - inner,
150
+ height - (row + 1) * step,
151
+ span,
152
+ step
153
+ )
154
+ row = row + 1
155
+ end
156
+ end
157
+ self:strip(
158
+ frame,
159
+ 0,
160
+ extent,
161
+ t,
162
+ height - 2 * extent
163
+ )
164
+ self:strip(
165
+ frame,
166
+ width - t,
167
+ extent,
168
+ t,
169
+ height - 2 * extent
170
+ )
171
+ end
172
+ function Border.prototype.strip(self, frame, x, y, width, height)
173
+ if width <= 0 or height <= 0 then
174
+ return
175
+ end
176
+ local texture = self:texture(frame, "OVERLAY")
177
+ local color = self.props.color
178
+ texture:SetSize(width, height)
179
+ texture:SetPoint(
180
+ "TOPLEFT",
181
+ frame,
182
+ "TOPLEFT",
183
+ x,
184
+ -y
185
+ )
186
+ texture:SetColorTexture(color.r, color.g, color.b, color.a or 1)
187
+ end
188
+ return ____exports
@@ -0,0 +1,13 @@
1
+ /** Owns reusable native regions. One instance belongs to one mounted Cell. */
2
+ export declare abstract class Decoration {
3
+ private active;
4
+ private textures;
5
+ private frames;
6
+ private textureIndex;
7
+ private frameIndex;
8
+ mount(frame: wuiraNativeFrame, width: number, height: number): void;
9
+ dispose(): void;
10
+ protected texture(parent: wuiraNativeFrame, layer: wuiraDrawLayer): wuiraNativeTexture;
11
+ protected backdrop(parent: wuiraNativeFrame): wuiraNativeFrame;
12
+ protected abstract draw(frame: wuiraNativeFrame, width: number, height: number): void;
13
+ }
@@ -0,0 +1,81 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ -- Lua Library inline imports
3
+ local function __TS__Class(self)
4
+ local c = {prototype = {}}
5
+ c.prototype.__index = c.prototype
6
+ c.prototype.constructor = c
7
+ return c
8
+ end
9
+ -- End of Lua Library inline imports
10
+ local ____exports = {}
11
+ --- Owns reusable native regions. One instance belongs to one mounted Cell.
12
+ ____exports.Decoration = __TS__Class()
13
+ local Decoration = ____exports.Decoration
14
+ Decoration.name = "Decoration"
15
+ function Decoration.prototype.____constructor(self)
16
+ self.active = false
17
+ self.textures = {}
18
+ self.frames = {}
19
+ self.textureIndex = 0
20
+ self.frameIndex = 0
21
+ end
22
+ function Decoration.prototype.mount(self, frame, width, height)
23
+ if self.active then
24
+ error("Decoration is already mounted; create a separate instance per Cell")
25
+ end
26
+ self.active = true
27
+ self.textureIndex = 0
28
+ self.frameIndex = 0
29
+ do
30
+ local function ____catch(failure)
31
+ self:dispose()
32
+ error(failure, 0)
33
+ end
34
+ local ____try, ____hasReturned = pcall(function()
35
+ self:draw(frame, width, height)
36
+ end)
37
+ if not ____try then
38
+ ____catch(____hasReturned)
39
+ end
40
+ end
41
+ end
42
+ function Decoration.prototype.dispose(self)
43
+ for ____, texture in ipairs(self.textures) do
44
+ texture:Hide()
45
+ end
46
+ for ____, frame in ipairs(self.frames) do
47
+ frame:Hide()
48
+ end
49
+ self.active = false
50
+ end
51
+ function Decoration.prototype.texture(self, parent, layer)
52
+ local texture = self.textures[self.textureIndex + 1]
53
+ if texture == nil then
54
+ texture = parent:CreateTexture(nil, layer)
55
+ local ____self_textures_0 = self.textures
56
+ ____self_textures_0[#____self_textures_0 + 1] = texture
57
+ else
58
+ texture:SetParent(parent)
59
+ texture:ClearAllPoints()
60
+ end
61
+ self.textureIndex = self.textureIndex + 1
62
+ texture:Show()
63
+ return texture
64
+ end
65
+ function Decoration.prototype.backdrop(self, parent)
66
+ local frame = self.frames[self.frameIndex + 1]
67
+ if frame == nil then
68
+ frame = CreateFrame("Frame", nil, parent, "BackdropTemplate")
69
+ local ____self_frames_1 = self.frames
70
+ ____self_frames_1[#____self_frames_1 + 1] = frame
71
+ else
72
+ frame:SetParent(parent)
73
+ frame:ClearAllPoints()
74
+ end
75
+ self.frameIndex = self.frameIndex + 1
76
+ frame:EnableMouse(false)
77
+ frame:SetAllPoints(parent)
78
+ frame:Show()
79
+ return frame
80
+ end
81
+ return ____exports
@@ -1,7 +1,6 @@
1
1
  import type { Background } from "./Background";
2
2
  import type { Border } from "./Border";
3
3
  import type { Glow } from "./Glow";
4
-
5
4
  export interface Decorations {
6
5
  background?: Background;
7
6
  border?: Border;
@@ -0,0 +1,3 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ return ____exports
@@ -0,0 +1,14 @@
1
+ import type { Color } from "../../types/Color";
2
+ import { Decoration } from "./Decoration";
3
+ export interface GlowProps {
4
+ /** A glow sprite with transparent center; not an arbitrary filled image. */
5
+ texture: string;
6
+ color: Color;
7
+ spread?: number;
8
+ }
9
+ /** Static additive glow; no per-frame update or animation. */
10
+ export declare class Glow extends Decoration {
11
+ readonly props: GlowProps;
12
+ constructor(props: GlowProps);
13
+ protected draw(frame: wuiraNativeFrame, width: number, height: number): void;
14
+ }
@@ -0,0 +1,63 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ -- Lua Library inline imports
3
+ local function __TS__Class(self)
4
+ local c = {prototype = {}}
5
+ c.prototype.__index = c.prototype
6
+ c.prototype.constructor = c
7
+ return c
8
+ end
9
+
10
+ local function __TS__ClassExtends(target, base)
11
+ target.____super = base
12
+ local staticMetatable = setmetatable({__index = base}, base)
13
+ setmetatable(target, staticMetatable)
14
+ local baseMetatable = getmetatable(base)
15
+ if baseMetatable then
16
+ if type(baseMetatable.__index) == "function" then
17
+ staticMetatable.__index = baseMetatable.__index
18
+ end
19
+ if type(baseMetatable.__newindex) == "function" then
20
+ staticMetatable.__newindex = baseMetatable.__newindex
21
+ end
22
+ end
23
+ setmetatable(target.prototype, base.prototype)
24
+ if type(base.prototype.__index) == "function" then
25
+ target.prototype.__index = base.prototype.__index
26
+ end
27
+ if type(base.prototype.__newindex) == "function" then
28
+ target.prototype.__newindex = base.prototype.__newindex
29
+ end
30
+ if type(base.prototype.__tostring) == "function" then
31
+ target.prototype.__tostring = base.prototype.__tostring
32
+ end
33
+ end
34
+ -- End of Lua Library inline imports
35
+ local ____exports = {}
36
+ local ____Decoration = require("ui.decorations.Decoration")
37
+ local Decoration = ____Decoration.Decoration
38
+ --- Static additive glow; no per-frame update or animation.
39
+ ____exports.Glow = __TS__Class()
40
+ local Glow = ____exports.Glow
41
+ Glow.name = "Glow"
42
+ __TS__ClassExtends(Glow, Decoration)
43
+ function Glow.prototype.____constructor(self, props)
44
+ Decoration.prototype.____constructor(self)
45
+ self.props = props
46
+ end
47
+ function Glow.prototype.draw(self, frame, width, height)
48
+ local texture = self:texture(frame, "OVERLAY")
49
+ local spread = math.max(0, self.props.spread or 8)
50
+ local color = self.props.color
51
+ texture:SetPoint(
52
+ "TOPLEFT",
53
+ frame,
54
+ "TOPLEFT",
55
+ -spread,
56
+ spread
57
+ )
58
+ texture:SetSize(width + 2 * spread, height + 2 * spread)
59
+ texture:SetTexture(self.props.texture)
60
+ texture:SetVertexColor(color.r, color.g, color.b, color.a or 1)
61
+ texture:SetBlendMode("ADD")
62
+ end
63
+ return ____exports
@@ -0,0 +1,25 @@
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
+ };
23
+ export type BackgroundTexture = keyof typeof backgroundTextures | {
24
+ path: string;
25
+ };
@@ -0,0 +1,10 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
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
+ }
10
+ return ____exports
@@ -0,0 +1,41 @@
1
+ export declare const borderTextures: {
2
+ readonly solid: {
3
+ readonly label: "Solid";
4
+ readonly path: "";
5
+ readonly edgeSize: 1;
6
+ };
7
+ readonly tooltip: {
8
+ readonly label: "Blizzard Tooltip";
9
+ readonly path: "Interface\\Tooltips\\UI-Tooltip-Border";
10
+ readonly edgeSize: 16;
11
+ };
12
+ readonly dialog: {
13
+ readonly label: "Blizzard Dialog";
14
+ readonly path: "Interface\\DialogFrame\\UI-DialogBox-Border";
15
+ readonly edgeSize: 32;
16
+ };
17
+ readonly dialogGold: {
18
+ readonly label: "Blizzard Dialog Gold";
19
+ readonly path: "Interface\\DialogFrame\\UI-DialogBox-Gold-Border";
20
+ readonly edgeSize: 32;
21
+ };
22
+ readonly achievementWood: {
23
+ readonly label: "Blizzard Achievement Wood";
24
+ readonly path: "Interface\\AchievementFrame\\UI-Achievement-WoodBorder";
25
+ readonly edgeSize: 16;
26
+ };
27
+ readonly chatBubble: {
28
+ readonly label: "Blizzard Chat Bubble";
29
+ readonly path: "Interface\\Tooltips\\ChatBubble-Backdrop";
30
+ readonly edgeSize: 16;
31
+ };
32
+ readonly party: {
33
+ readonly label: "Blizzard Party";
34
+ readonly path: "Interface\\CHARACTERFRAME\\UI-Party-Border";
35
+ readonly edgeSize: 16;
36
+ };
37
+ };
38
+ export type BorderTexture = keyof typeof borderTextures | {
39
+ path: string;
40
+ edgeSize: number;
41
+ };
@@ -0,0 +1,12 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ ____exports.borderTextures = {
4
+ solid = {label = "Solid", path = "", edgeSize = 1},
5
+ tooltip = {label = "Blizzard Tooltip", path = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16},
6
+ dialog = {label = "Blizzard Dialog", path = "Interface\\DialogFrame\\UI-DialogBox-Border", edgeSize = 32},
7
+ dialogGold = {label = "Blizzard Dialog Gold", path = "Interface\\DialogFrame\\UI-DialogBox-Gold-Border", edgeSize = 32},
8
+ achievementWood = {label = "Blizzard Achievement Wood", path = "Interface\\AchievementFrame\\UI-Achievement-WoodBorder", edgeSize = 16},
9
+ chatBubble = {label = "Blizzard Chat Bubble", path = "Interface\\Tooltips\\ChatBubble-Backdrop", edgeSize = 16},
10
+ party = {label = "Blizzard Party", path = "Interface\\CHARACTERFRAME\\UI-Party-Border", edgeSize = 16}
11
+ }
12
+ return ____exports
@@ -0,0 +1,12 @@
1
+ export declare const statusBarTextures: {
2
+ readonly solid: {
3
+ readonly label: "Solid";
4
+ readonly path: "Interface\\Buttons\\WHITE8X8";
5
+ };
6
+ readonly blizzard: {
7
+ readonly label: "Blizzard Status Bar";
8
+ readonly path: "Interface\\TargetingFrame\\UI-StatusBar";
9
+ };
10
+ };
11
+ /** Accepts catalog names or a native/custom texture path. */
12
+ export declare function resolveStatusBarTexture(texture: string): string;
@@ -0,0 +1,9 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ ____exports.statusBarTextures = {solid = {label = "Solid", path = "Interface\\Buttons\\WHITE8X8"}, blizzard = {label = "Blizzard Status Bar", path = "Interface\\TargetingFrame\\UI-StatusBar"}}
4
+ --- Accepts catalog names or a native/custom texture path.
5
+ function ____exports.resolveStatusBarTexture(self, texture)
6
+ local preset = ____exports.statusBarTextures[texture]
7
+ return preset == nil and texture or preset.path
8
+ end
9
+ return ____exports
@@ -0,0 +1,11 @@
1
+ /// <reference path="../platform/forever.d.ts" />
2
+ export { UI } from "./primitives/jsx";
3
+ export type { Element, Component } from "./primitives/jsx";
4
+ export { Cell } from "./Cell";
5
+ export type { CellProps } from "./Cell";
6
+ export { FlowLayout } from "./FlowLayout";
7
+ export { GridLayout } from "./GridLayout";
8
+ export { ProgressBar } from "./ProgressBar";
9
+ export { Background } from "./decorations/Background";
10
+ export { Border } from "./decorations/Border";
11
+ export { Glow } from "./decorations/Glow";