wuira 0.1.0 → 0.1.1
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 +202 -18
- package/cli/wuira.mjs +67 -0
- package/config/tsconfig.json +25 -0
- package/lib/Console.d.ts +5 -0
- package/lib/Console.lua +20 -0
- package/lib/console-polyfill.d.ts +9 -0
- package/lib/console-polyfill.lua +39 -0
- package/lib/datasources/DataSource.d.ts +17 -0
- package/lib/datasources/DataSource.lua +199 -0
- package/lib/datasources/NativeNumberSource.d.ts +7 -0
- package/lib/datasources/NativeNumberSource.lua +50 -0
- package/lib/datasources/ProgressSource.d.ts +23 -0
- package/lib/datasources/ProgressSource.lua +79 -0
- package/lib/datasources/Resources.d.ts +27 -0
- package/lib/datasources/Resources.lua +102 -0
- package/lib/datasources/index.d.ts +4 -0
- package/lib/datasources/index.lua +18 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.lua +11 -0
- package/{src → lib}/platform/forever.d.ts +17 -17
- package/{src/types/Anchor.ts → lib/types/Anchor.d.ts} +6 -7
- package/lib/types/Anchor.lua +8 -0
- package/lib/types/Color.lua +3 -0
- package/lib/types/Position.d.ts +21 -0
- package/lib/types/Position.lua +3 -0
- package/lib/types/Spacing.d.ts +14 -0
- package/lib/types/Spacing.lua +20 -0
- package/{src/types/Texture.ts → lib/types/Texture.d.ts} +0 -2
- package/lib/types/Texture.lua +3 -0
- package/{src/ui/Cell.tsx → lib/ui/Cell.d.ts} +3 -8
- package/lib/ui/Cell.lua +8 -0
- package/{src/ui/FlowLayout.tsx → lib/ui/FlowLayout.d.ts} +3 -8
- package/lib/ui/FlowLayout.lua +8 -0
- package/{src/ui/GridLayout.tsx → lib/ui/GridLayout.d.ts} +3 -8
- package/lib/ui/GridLayout.lua +8 -0
- package/{src/ui/Layout.ts → lib/ui/Layout.d.ts} +4 -3
- package/lib/ui/Layout.lua +3 -0
- package/{src/ui/ProgressBar.tsx → lib/ui/ProgressBar.d.ts} +4 -7
- package/lib/ui/ProgressBar.lua +8 -0
- package/lib/ui/decorations/Background.d.ts +10 -0
- package/lib/ui/decorations/Background.lua +76 -0
- package/lib/ui/decorations/Border.d.ts +18 -0
- package/lib/ui/decorations/Border.lua +188 -0
- package/lib/ui/decorations/Decoration.d.ts +13 -0
- package/lib/ui/decorations/Decoration.lua +81 -0
- package/{src/ui/decorations/Decorations.ts → lib/ui/decorations/Decorations.d.ts} +0 -1
- package/lib/ui/decorations/Decorations.lua +3 -0
- package/lib/ui/decorations/Glow.d.ts +14 -0
- package/lib/ui/decorations/Glow.lua +63 -0
- package/lib/ui/decorations/backgroundTextures.d.ts +25 -0
- package/lib/ui/decorations/backgroundTextures.lua +10 -0
- package/lib/ui/decorations/borderTextures.d.ts +41 -0
- package/lib/ui/decorations/borderTextures.lua +12 -0
- package/lib/ui/decorations/statusBarTextures.d.ts +12 -0
- package/lib/ui/decorations/statusBarTextures.lua +9 -0
- package/lib/ui/index.d.ts +11 -0
- package/lib/ui/index.lua +35 -0
- package/lib/ui/layout/calculateFlow.d.ts +12 -0
- package/lib/ui/layout/calculateFlow.lua +36 -0
- package/lib/ui/layout/calculateGrid.d.ts +9 -0
- package/lib/ui/layout/calculateGrid.lua +47 -0
- package/lib/ui/layout/measureLayout.d.ts +19 -0
- package/lib/ui/layout/measureLayout.lua +215 -0
- package/lib/ui/mount.d.ts +5 -0
- package/lib/ui/mount.lua +486 -0
- package/lib/ui/primitives/jsx.d.ts +38 -0
- package/lib/ui/primitives/jsx.lua +66 -0
- package/lib/wuira.d.ts +8 -0
- package/lib/wuira.lua +30 -0
- package/package.json +55 -5
- package/templates/addon/README.md +13 -0
- package/templates/addon/addon.toc.in +4 -0
- package/templates/addon/gitignore +3 -0
- package/templates/addon/package.json +11 -0
- package/templates/addon/src/index.tsx +9 -0
- package/templates/addon/tsconfig.json +8 -0
- package/templates/addon/wuira.config.mjs +4 -0
- package/tools/build-library.mjs +15 -0
- package/tools/module-loader.lua +3 -3
- package/tools/{wow-modules.cjs → wow-modules.mjs} +27 -11
- package/tsconfig.json +1 -1
- package/tsconfig.lib.json +8 -0
- package/addon.toc.in +0 -4
- package/cli/uira.cjs +0 -55
- package/src/Console.ts +0 -10
- package/src/UIra.ts +0 -18
- package/src/console-polyfill.ts +0 -25
- package/src/datasources/DataSource.ts +0 -42
- package/src/datasources/NativeNumberSource.ts +0 -7
- package/src/datasources/ProgressSource.ts +0 -46
- package/src/datasources/Resources.ts +0 -41
- package/src/examples/ProgressBars.tsx +0 -24
- package/src/index.tsx +0 -3
- package/src/playground/PlayerFrame.ts +0 -271
- package/src/types/Position.ts +0 -21
- package/src/types/Spacing.ts +0 -14
- package/src/ui/decorations/Background.ts +0 -29
- package/src/ui/decorations/Border.ts +0 -71
- package/src/ui/decorations/Decoration.ts +0 -59
- package/src/ui/decorations/Glow.ts +0 -25
- package/src/ui/decorations/backgroundTextures.ts +0 -10
- package/src/ui/decorations/borderTextures.ts +0 -13
- package/src/ui/decorations/statusBarTextures.ts +0 -11
- package/src/ui/layout/calculateFlow.ts +0 -33
- package/src/ui/layout/calculateGrid.ts +0 -22
- package/src/ui/layout/measureLayout.ts +0 -87
- package/src/ui/mount.ts +0 -138
- package/src/ui/primitives/jsx.ts +0 -75
- /package/{src/types/Color.ts → lib/types/Color.d.ts} +0 -0
package/lib/ui/index.lua
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
do
|
|
4
|
+
local ____jsx = require("ui.primitives.jsx")
|
|
5
|
+
____exports.UI = ____jsx.UI
|
|
6
|
+
end
|
|
7
|
+
do
|
|
8
|
+
local ____Cell = require("ui.Cell")
|
|
9
|
+
____exports.Cell = ____Cell.Cell
|
|
10
|
+
end
|
|
11
|
+
do
|
|
12
|
+
local ____FlowLayout = require("ui.FlowLayout")
|
|
13
|
+
____exports.FlowLayout = ____FlowLayout.FlowLayout
|
|
14
|
+
end
|
|
15
|
+
do
|
|
16
|
+
local ____GridLayout = require("ui.GridLayout")
|
|
17
|
+
____exports.GridLayout = ____GridLayout.GridLayout
|
|
18
|
+
end
|
|
19
|
+
do
|
|
20
|
+
local ____ProgressBar = require("ui.ProgressBar")
|
|
21
|
+
____exports.ProgressBar = ____ProgressBar.ProgressBar
|
|
22
|
+
end
|
|
23
|
+
do
|
|
24
|
+
local ____Background = require("ui.decorations.Background")
|
|
25
|
+
____exports.Background = ____Background.Background
|
|
26
|
+
end
|
|
27
|
+
do
|
|
28
|
+
local ____Border = require("ui.decorations.Border")
|
|
29
|
+
____exports.Border = ____Border.Border
|
|
30
|
+
end
|
|
31
|
+
do
|
|
32
|
+
local ____Glow = require("ui.decorations.Glow")
|
|
33
|
+
____exports.Glow = ____Glow.Glow
|
|
34
|
+
end
|
|
35
|
+
return ____exports
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FlowLayoutProps } from "../FlowLayout";
|
|
2
|
+
/** Pure layout calculation in top-left UI coordinates. */
|
|
3
|
+
export declare function calculateFlow(props: FlowLayoutProps & {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}, children: readonly {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}[]): {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
}[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
--- Pure layout calculation in top-left UI coordinates.
|
|
4
|
+
function ____exports.calculateFlow(self, props, children)
|
|
5
|
+
local horizontal = props.direction == "horizontal"
|
|
6
|
+
local requestedLimit = horizontal and props.width or props.height
|
|
7
|
+
local limit = props.sizing == "content" and requestedLimit == 0 and math.huge or requestedLimit
|
|
8
|
+
local gap = props.gap or 0
|
|
9
|
+
local lineGap = props.lineGap or gap
|
|
10
|
+
if gap < 0 or lineGap < 0 then
|
|
11
|
+
error("FlowLayout gaps must be non-negative")
|
|
12
|
+
end
|
|
13
|
+
local result = {}
|
|
14
|
+
local cursor = 0
|
|
15
|
+
local cross = 0
|
|
16
|
+
local lineSize = 0
|
|
17
|
+
local count = 0
|
|
18
|
+
for ____, child in ipairs(children) do
|
|
19
|
+
local size = horizontal and child.width or child.height
|
|
20
|
+
local crossSize = horizontal and child.height or child.width
|
|
21
|
+
local next = count == 0 and 0 or cursor + gap
|
|
22
|
+
if props.grow and count > 0 and next + size > limit then
|
|
23
|
+
cross = cross + (lineSize + lineGap)
|
|
24
|
+
cursor = 0
|
|
25
|
+
lineSize = 0
|
|
26
|
+
count = 0
|
|
27
|
+
end
|
|
28
|
+
local position = count == 0 and 0 or cursor + gap
|
|
29
|
+
result[#result + 1] = horizontal and ({x = position, y = cross}) or ({x = cross, y = position})
|
|
30
|
+
cursor = position + size
|
|
31
|
+
lineSize = math.max(lineSize, crossSize)
|
|
32
|
+
count = count + 1
|
|
33
|
+
end
|
|
34
|
+
return result
|
|
35
|
+
end
|
|
36
|
+
return ____exports
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GridLayoutProps } from "../GridLayout";
|
|
2
|
+
/** Row-major placement into uniform slots; children keep their own sizes. */
|
|
3
|
+
export declare function calculateGrid(props: GridLayoutProps, children: readonly {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}[]): {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
-- Lua Library inline imports
|
|
3
|
+
local function __TS__NumberIsFinite(value)
|
|
4
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
local function __TS__ArrayMap(self, callbackfn, thisArg)
|
|
8
|
+
local result = {}
|
|
9
|
+
for i = 1, #self do
|
|
10
|
+
result[i] = callbackfn(thisArg, self[i], i - 1, self)
|
|
11
|
+
end
|
|
12
|
+
return result
|
|
13
|
+
end
|
|
14
|
+
-- End of Lua Library inline imports
|
|
15
|
+
local ____exports = {}
|
|
16
|
+
--- Row-major placement into uniform slots; children keep their own sizes.
|
|
17
|
+
function ____exports.calculateGrid(self, props, children)
|
|
18
|
+
if not __TS__NumberIsFinite(props.columns) or props.columns < 1 or math.floor(props.columns) ~= props.columns then
|
|
19
|
+
error("GridLayout columns must be a positive integer")
|
|
20
|
+
end
|
|
21
|
+
local rowGap = props.rowGap or props.gap or 0
|
|
22
|
+
local columnGap = props.columnGap or props.gap or 0
|
|
23
|
+
if rowGap < 0 or columnGap < 0 then
|
|
24
|
+
error("GridLayout gaps must be non-negative")
|
|
25
|
+
end
|
|
26
|
+
local width = props.cellWidth or 0
|
|
27
|
+
local height = props.cellHeight or 0
|
|
28
|
+
for ____, child in ipairs(children) do
|
|
29
|
+
if props.cellWidth == nil then
|
|
30
|
+
width = math.max(width, child.width)
|
|
31
|
+
end
|
|
32
|
+
if props.cellHeight == nil then
|
|
33
|
+
height = math.max(height, child.height)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
if width < 0 or height < 0 then
|
|
37
|
+
error("GridLayout cell sizes must be non-negative")
|
|
38
|
+
end
|
|
39
|
+
return __TS__ArrayMap(
|
|
40
|
+
children,
|
|
41
|
+
function(____, _, index) return {
|
|
42
|
+
x = index % props.columns * (width + columnGap),
|
|
43
|
+
y = math.floor(index / props.columns) * (height + rowGap)
|
|
44
|
+
} end
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
return ____exports
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ICell } from "../Cell";
|
|
2
|
+
import type { Element } from "../primitives/jsx";
|
|
3
|
+
import { Insets } from "../../types/Spacing";
|
|
4
|
+
export interface MeasuredCell {
|
|
5
|
+
cell: ICell;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
margin: Insets;
|
|
9
|
+
children: MeasuredCell[];
|
|
10
|
+
placements?: ({
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
} | undefined)[];
|
|
14
|
+
}
|
|
15
|
+
/** Resolve available space top-down and content bounds bottom-up. */
|
|
16
|
+
export declare function measureLayout(element: Element, available?: {
|
|
17
|
+
width?: number;
|
|
18
|
+
height?: number;
|
|
19
|
+
}, ancestors?: Element[]): MeasuredCell;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
-- Lua Library inline imports
|
|
3
|
+
local function __TS__NumberIsFinite(value)
|
|
4
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
local function __TS__ArrayIncludes(self, searchElement, fromIndex)
|
|
8
|
+
if fromIndex == nil then
|
|
9
|
+
fromIndex = 0
|
|
10
|
+
end
|
|
11
|
+
local len = #self
|
|
12
|
+
local k = fromIndex
|
|
13
|
+
if fromIndex < 0 then
|
|
14
|
+
k = len + fromIndex
|
|
15
|
+
end
|
|
16
|
+
if k < 0 then
|
|
17
|
+
k = 0
|
|
18
|
+
end
|
|
19
|
+
for i = k + 1, len do
|
|
20
|
+
if self[i] == searchElement then
|
|
21
|
+
return true
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
return false
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
local __TS__Unpack = table.unpack or unpack
|
|
28
|
+
|
|
29
|
+
local function __TS__CountVarargs(...)
|
|
30
|
+
return select("#", ...)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
local function __TS__SparseArrayNew(...)
|
|
34
|
+
local sparseArray = {...}
|
|
35
|
+
sparseArray.sparseLength = __TS__CountVarargs(...)
|
|
36
|
+
return sparseArray
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
local function __TS__SparseArrayPush(sparseArray, ...)
|
|
40
|
+
local args = {...}
|
|
41
|
+
local argsLen = __TS__CountVarargs(...)
|
|
42
|
+
local listLen = sparseArray.sparseLength
|
|
43
|
+
for i = 1, argsLen do
|
|
44
|
+
sparseArray[listLen + i] = args[i]
|
|
45
|
+
end
|
|
46
|
+
sparseArray.sparseLength = listLen + argsLen
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
local function __TS__SparseArraySpread(sparseArray)
|
|
50
|
+
local _unpack = unpack or table.unpack
|
|
51
|
+
return _unpack(sparseArray, 1, sparseArray.sparseLength)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
local function __TS__ArrayMap(self, callbackfn, thisArg)
|
|
55
|
+
local result = {}
|
|
56
|
+
for i = 1, #self do
|
|
57
|
+
result[i] = callbackfn(thisArg, self[i], i - 1, self)
|
|
58
|
+
end
|
|
59
|
+
return result
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
local function __TS__ObjectAssign(target, ...)
|
|
63
|
+
local sources = {...}
|
|
64
|
+
for i = 1, #sources do
|
|
65
|
+
local source = sources[i]
|
|
66
|
+
if type(source) == "table" then
|
|
67
|
+
for key in pairs(source) do
|
|
68
|
+
target[key] = source[key]
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
return target
|
|
73
|
+
end
|
|
74
|
+
-- End of Lua Library inline imports
|
|
75
|
+
local ____exports = {}
|
|
76
|
+
local ____Spacing = require("types.Spacing")
|
|
77
|
+
local resolveSpacing = ____Spacing.resolveSpacing
|
|
78
|
+
local ____calculateFlow = require("ui.layout.calculateFlow")
|
|
79
|
+
local calculateFlow = ____calculateFlow.calculateFlow
|
|
80
|
+
local ____calculateGrid = require("ui.layout.calculateGrid")
|
|
81
|
+
local calculateGrid = ____calculateGrid.calculateGrid
|
|
82
|
+
local function resolveSize(self, value, available, margin)
|
|
83
|
+
if value == "inherit" then
|
|
84
|
+
if available == nil then
|
|
85
|
+
error("Cannot inherit a size from an unconstrained content-sized parent")
|
|
86
|
+
end
|
|
87
|
+
return math.max(0, available - margin)
|
|
88
|
+
end
|
|
89
|
+
if not __TS__NumberIsFinite(value) or value < 0 then
|
|
90
|
+
error("Cell sizes must be finite and non-negative")
|
|
91
|
+
end
|
|
92
|
+
return value
|
|
93
|
+
end
|
|
94
|
+
--- Resolve available space top-down and content bounds bottom-up.
|
|
95
|
+
function ____exports.measureLayout(self, element, available, ancestors)
|
|
96
|
+
if available == nil then
|
|
97
|
+
available = {}
|
|
98
|
+
end
|
|
99
|
+
if ancestors == nil then
|
|
100
|
+
ancestors = {}
|
|
101
|
+
end
|
|
102
|
+
if __TS__ArrayIncludes(ancestors, element) then
|
|
103
|
+
error("Layout children contain a cycle")
|
|
104
|
+
end
|
|
105
|
+
if element.kind ~= "cell" and element.kind ~= "flow" and element.kind ~= "grid" and element.kind ~= "progress" then
|
|
106
|
+
error("Unsupported UI element: " .. element.kind)
|
|
107
|
+
end
|
|
108
|
+
local cell = element
|
|
109
|
+
local props = cell.props
|
|
110
|
+
local margin = resolveSpacing(nil, props.margin)
|
|
111
|
+
local padding = resolveSpacing(nil, props.padding)
|
|
112
|
+
local width = resolveSize(nil, props.width, available.width, margin.left + margin.right)
|
|
113
|
+
local height = resolveSize(nil, props.height, available.height, margin.top + margin.bottom)
|
|
114
|
+
local isLayout = element.kind == "flow" or element.kind == "grid"
|
|
115
|
+
local layout = isLayout and element or nil
|
|
116
|
+
local contentSizing = (layout and layout.props.sizing) == "content"
|
|
117
|
+
local ____temp_2
|
|
118
|
+
if contentSizing and props.width == 0 then
|
|
119
|
+
____temp_2 = nil
|
|
120
|
+
else
|
|
121
|
+
____temp_2 = math.max(0, width - padding.left - padding.right)
|
|
122
|
+
end
|
|
123
|
+
local contentWidth = ____temp_2
|
|
124
|
+
local ____temp_3
|
|
125
|
+
if contentSizing and props.height == 0 then
|
|
126
|
+
____temp_3 = nil
|
|
127
|
+
else
|
|
128
|
+
____temp_3 = math.max(0, height - padding.top - padding.bottom)
|
|
129
|
+
end
|
|
130
|
+
local contentHeight = ____temp_3
|
|
131
|
+
local sourceChildren = layout ~= nil and layout.children or (cell.child == nil and ({}) or ({cell.child}))
|
|
132
|
+
local childWidth = contentWidth
|
|
133
|
+
local childHeight = contentHeight
|
|
134
|
+
if (layout and layout.kind) == "grid" then
|
|
135
|
+
local grid = layout.props
|
|
136
|
+
if not __TS__NumberIsFinite(grid.columns) or grid.columns < 1 or math.floor(grid.columns) ~= grid.columns then
|
|
137
|
+
error("GridLayout columns must be a positive integer")
|
|
138
|
+
end
|
|
139
|
+
local rows = math.max(
|
|
140
|
+
1,
|
|
141
|
+
math.ceil(#sourceChildren / grid.columns)
|
|
142
|
+
)
|
|
143
|
+
local ____grid_cellWidth_7 = grid.cellWidth
|
|
144
|
+
if ____grid_cellWidth_7 == nil then
|
|
145
|
+
local ____temp_6
|
|
146
|
+
if contentWidth == nil then
|
|
147
|
+
____temp_6 = nil
|
|
148
|
+
else
|
|
149
|
+
____temp_6 = math.max(0, (contentWidth - (grid.columnGap or grid.gap or 0) * (grid.columns - 1)) / grid.columns)
|
|
150
|
+
end
|
|
151
|
+
____grid_cellWidth_7 = ____temp_6
|
|
152
|
+
end
|
|
153
|
+
childWidth = ____grid_cellWidth_7
|
|
154
|
+
local ____grid_cellHeight_9 = grid.cellHeight
|
|
155
|
+
if ____grid_cellHeight_9 == nil then
|
|
156
|
+
local ____temp_8
|
|
157
|
+
if contentHeight == nil then
|
|
158
|
+
____temp_8 = nil
|
|
159
|
+
else
|
|
160
|
+
____temp_8 = math.max(0, (contentHeight - (grid.rowGap or grid.gap or 0) * (rows - 1)) / rows)
|
|
161
|
+
end
|
|
162
|
+
____grid_cellHeight_9 = ____temp_8
|
|
163
|
+
end
|
|
164
|
+
childHeight = ____grid_cellHeight_9
|
|
165
|
+
end
|
|
166
|
+
local ____array_10 = __TS__SparseArrayNew(__TS__Unpack(ancestors))
|
|
167
|
+
__TS__SparseArrayPush(____array_10, element)
|
|
168
|
+
local path = {__TS__SparseArraySpread(____array_10)}
|
|
169
|
+
local children = __TS__ArrayMap(
|
|
170
|
+
sourceChildren,
|
|
171
|
+
function(____, child) return ____exports.measureLayout(nil, child, {width = childWidth, height = childHeight}, path) end
|
|
172
|
+
)
|
|
173
|
+
local placements
|
|
174
|
+
if layout ~= nil then
|
|
175
|
+
local sizes = __TS__ArrayMap(
|
|
176
|
+
children,
|
|
177
|
+
function(____, child) return {width = child.width + child.margin.left + child.margin.right, height = child.height + child.margin.top + child.margin.bottom} end
|
|
178
|
+
)
|
|
179
|
+
local positions = layout.kind == "flow" and calculateFlow(
|
|
180
|
+
nil,
|
|
181
|
+
__TS__ObjectAssign({}, layout.props, {width = contentWidth or 0, height = contentHeight or 0}),
|
|
182
|
+
sizes
|
|
183
|
+
) or calculateGrid(nil, layout.props, sizes)
|
|
184
|
+
placements = __TS__ArrayMap(
|
|
185
|
+
positions,
|
|
186
|
+
function(____, point) return {x = point.x + padding.left, y = point.y + padding.top} end
|
|
187
|
+
)
|
|
188
|
+
if contentSizing then
|
|
189
|
+
width = padding.left + padding.right
|
|
190
|
+
height = padding.top + padding.bottom
|
|
191
|
+
do
|
|
192
|
+
local i = 0
|
|
193
|
+
while i < #children do
|
|
194
|
+
width = math.max(width, positions[i + 1].x + sizes[i + 1].width + padding.left + padding.right)
|
|
195
|
+
height = math.max(height, positions[i + 1].y + sizes[i + 1].height + padding.top + padding.bottom)
|
|
196
|
+
i = i + 1
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
elseif #children > 0 then
|
|
201
|
+
local position = children[1].cell.props
|
|
202
|
+
if position.mode == "relative" and position.relativeTo == nil then
|
|
203
|
+
placements = {{x = padding.left + position.offset.x, y = padding.top + position.offset.y}}
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
return {
|
|
207
|
+
cell = cell,
|
|
208
|
+
width = width,
|
|
209
|
+
height = height,
|
|
210
|
+
margin = margin,
|
|
211
|
+
children = children,
|
|
212
|
+
placements = placements
|
|
213
|
+
}
|
|
214
|
+
end
|
|
215
|
+
return ____exports
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Element } from "./primitives/jsx";
|
|
2
|
+
import type { Anchor } from "../types/Position";
|
|
3
|
+
export declare function unmount(frame: wuiraNativeFrame): void;
|
|
4
|
+
/** Creates the tree before resolving anchors. Positive y moves down. */
|
|
5
|
+
export declare function mount(element: Element, parent?: wuiraNativeFrame, rootAnchor?: Anchor): wuiraNativeFrame;
|