wuira 0.1.1 → 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.
- package/README.md +2 -0
- package/config/tsconfig.json +3 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.lua +1 -0
- package/lib/ui/Cell.d.ts +4 -1
- package/lib/ui/Cell.lua +1 -0
- package/lib/wuira.d.ts +2 -2
- package/lib/wuira.lua +8 -2
- package/package.json +1 -1
- package/templates/addon/src/index.tsx +1 -3
package/README.md
CHANGED
|
@@ -195,6 +195,8 @@ An empty fragment creates no native frame. Only empty fragments are currently su
|
|
|
195
195
|
|
|
196
196
|
`console.log/info/warn/error` use a global WoW console polyfill. Output goes to the local chat window, never to other players. The addon uses no Node.js runtime or stdin/stdout. `console.error` does not throw. Arguments are formatted with Lua `tostring`; objects are not deeply inspected. The CLI uses its own Node.js terminal console.
|
|
197
197
|
|
|
198
|
+
Importing `wuira` installs the global console polyfill automatically. The shared TypeScript config loads its global declarations and uses Node16 module resolution for package exports; DOM typings are not required. `wuira.Mount` accepts a `Cell`, no value, or a function returning `Cell | void`, so addons without a visual tree can simply log and return.
|
|
199
|
+
|
|
198
200
|
## Build and distribution
|
|
199
201
|
|
|
200
202
|
`wuira build` transpiles through `tsconfig.json`. It writes a standalone addon directory containing individual Lua modules, a loader, a startup file, and `<addonName>.toc`. The default output directory is `dist/`. The addon name lives in `wuira.config.mjs`; Interface version and other metadata live in `addon.toc.in`. The default Interface version, 16001, targets the Forever playground.
|
package/config/tsconfig.json
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/TypeScriptToLua/TypeScriptToLua/master/tsconfig-schema.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"target": "ESNext",
|
|
5
|
+
"module": "Node16",
|
|
6
|
+
"moduleResolution": "Node16",
|
|
5
7
|
"lib": [
|
|
6
8
|
"ESNext"
|
|
7
9
|
],
|
|
8
|
-
"types": [],
|
|
10
|
+
"types": ["wuira/console-polyfill"],
|
|
9
11
|
"jsx": "react",
|
|
10
12
|
"jsxFactory": "UI.createElement",
|
|
11
13
|
"jsxFragmentFactory": "UI.Fragment",
|
package/lib/index.d.ts
CHANGED
package/lib/index.lua
CHANGED
package/lib/ui/Cell.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import type { Decorations } from "./decorations/Decorations";
|
|
|
3
3
|
import type { Position } from "../types/Position";
|
|
4
4
|
import type { Spacing } from "../types/Spacing";
|
|
5
5
|
export type Size = number | "inherit";
|
|
6
|
+
/** Common visual descriptor accepted by the mounting API. */
|
|
7
|
+
export interface Cell extends Element {
|
|
8
|
+
}
|
|
6
9
|
export type CellProps = {
|
|
7
10
|
width: Size;
|
|
8
11
|
height: Size;
|
|
@@ -18,4 +21,4 @@ export interface ICell extends Element {
|
|
|
18
21
|
}
|
|
19
22
|
export declare function Cell(props: Partial<CellProps> & {
|
|
20
23
|
child?: Element;
|
|
21
|
-
}, child?: Element):
|
|
24
|
+
}, child?: Element): Cell;
|
package/lib/ui/Cell.lua
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local ____jsx = require("ui.primitives.jsx")
|
|
4
4
|
local UI = ____jsx.UI
|
|
5
|
+
--- Common visual descriptor accepted by the mounting API.
|
|
5
6
|
function ____exports.Cell(self, props, child)
|
|
6
7
|
return UI:createElement("cell", props, props.child or child or ({}))
|
|
7
8
|
end
|
package/lib/wuira.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Cell } from "./ui/Cell";
|
|
2
2
|
import type { Anchor } from "./types/Position";
|
|
3
3
|
/** Public entry point for mounting JSX UI trees. */
|
|
4
4
|
export declare class wuira {
|
|
5
5
|
private constructor();
|
|
6
|
-
static Mount(frame:
|
|
6
|
+
static Mount(frame: Cell | void | (() => Cell | void), anchor?: Anchor, parent?: wuiraNativeFrame): wuiraNativeFrame | undefined;
|
|
7
7
|
static Unmount(frame: wuiraNativeFrame): void;
|
|
8
8
|
}
|
package/lib/wuira.lua
CHANGED
|
@@ -18,8 +18,14 @@ wuira.name = "wuira"
|
|
|
18
18
|
function wuira.prototype.____constructor(self)
|
|
19
19
|
end
|
|
20
20
|
function wuira.Mount(self, frame, anchor, parent)
|
|
21
|
-
local
|
|
22
|
-
if
|
|
21
|
+
local ____temp_0
|
|
22
|
+
if type(frame) == "function" then
|
|
23
|
+
____temp_0 = frame(nil)
|
|
24
|
+
else
|
|
25
|
+
____temp_0 = frame
|
|
26
|
+
end
|
|
27
|
+
local view = ____temp_0
|
|
28
|
+
if view == nil or view.kind == "empty" then
|
|
23
29
|
return nil
|
|
24
30
|
end
|
|
25
31
|
return mount(nil, view, parent, anchor)
|
package/package.json
CHANGED