@threenative/ui 0.1.11 → 0.1.12

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/dist/index.d.ts CHANGED
@@ -1,4 +1,17 @@
1
- export { Bar, Button, Column, Component, ContextMenu, Image, Minimap, Row, Scrollbar, Slider, Stack, Text, TextInput, TouchControl, Ui } from "./components.js";
2
- export { captureUi, type IUiImageMetadataIr, type IUiIr, type IUiLayoutIr, type IUiMinimapMetadataIr, type IUiNodeIr } from "./capture.js";
3
- export type { IUiActionProps, IUiBarProps, IUiCommonProps, IUiComponentInstance, IUiComponentProps, IUiContainerProps, IUiElement, IUiImageProps, IUiMinimapProps, IUiNodeProps, IUiRangeProps, IUiScrollbarProps, IUiTextInputProps, IUiTextProps, UiBinding, UiElementType, UiImageMetadata, UiMinimapMetadata, } from "./jsx-runtime.js";
4
- //# sourceMappingURL=index.d.ts.map
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Game } from '@threenative/core';
3
+
4
+ interface GameCanvasProps<TState extends Record<string, unknown> = Record<string, unknown>, TPhysics = undefined> {
5
+ className?: string;
6
+ game: Game<TState, TPhysics>;
7
+ }
8
+ declare function GameCanvas<TState extends Record<string, unknown>, TPhysics>({ className, game, }: GameCanvasProps<TState, TPhysics>): react_jsx_runtime.JSX.Element;
9
+
10
+ type DebugSnapshot = Record<string, Record<string, unknown>>;
11
+ declare function DebugOverlay(): react_jsx_runtime.JSX.Element | null;
12
+
13
+ type GameSelector<TState, TSelected> = (state: TState) => TSelected;
14
+ declare function useGameState<TState extends Record<string, unknown>, TPhysics, TSelected>(game: Game<TState, TPhysics>, selector: GameSelector<TState, TSelected>): TSelected;
15
+ declare function useGameState<TState extends Record<string, unknown>, TPhysics>(game: Game<TState, TPhysics>): TState;
16
+
17
+ export { DebugOverlay, type DebugSnapshot, GameCanvas, type GameCanvasProps, useGameState };
package/dist/index.js CHANGED
@@ -1,2 +1,116 @@
1
- export { Bar, Button, Column, Component, ContextMenu, Image, Minimap, Row, Scrollbar, Slider, Stack, Text, TextInput, TouchControl, Ui } from "./components.js";
2
- export { captureUi } from "./capture.js";
1
+ import { useRef, useEffect, useState, useSyncExternalStore } from 'react';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+
4
+ // src/GameCanvas.tsx
5
+ function GameCanvas({
6
+ className,
7
+ game
8
+ }) {
9
+ const host = useRef(null);
10
+ useEffect(() => {
11
+ let cancelled = false;
12
+ void game.start().then(() => {
13
+ const canvas = game.ctx?.renderer.domElement;
14
+ if (!cancelled && canvas !== void 0 && host.current !== null) {
15
+ canvas.style.display = "block";
16
+ canvas.style.width = "100%";
17
+ canvas.style.height = "100%";
18
+ canvas.style.touchAction = "none";
19
+ host.current.replaceChildren(canvas);
20
+ }
21
+ }).catch((error) => {
22
+ if (!cancelled) throw error;
23
+ });
24
+ return () => {
25
+ cancelled = true;
26
+ game.stop();
27
+ };
28
+ }, [game]);
29
+ return /* @__PURE__ */ jsx(
30
+ "div",
31
+ {
32
+ ref: host,
33
+ className,
34
+ "data-threenative-canvas": "true",
35
+ style: { height: "100%", width: "100%" }
36
+ }
37
+ );
38
+ }
39
+ var isDev = import.meta.env?.DEV === true;
40
+ var panelStyle = {
41
+ background: "rgb(2 6 23 / 90%)",
42
+ boxShadow: "0 10px 15px -3px rgb(0 0 0 / 30%)",
43
+ color: "#cffafe",
44
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
45
+ fontSize: "12px",
46
+ lineHeight: 1.5,
47
+ maxWidth: "24rem",
48
+ padding: "12px",
49
+ pointerEvents: "none",
50
+ position: "fixed",
51
+ right: "16px",
52
+ top: "16px",
53
+ zIndex: 50
54
+ };
55
+ var tableStyle = { tableLayout: "fixed", width: "100%" };
56
+ var headerCellStyle = { paddingRight: "16px", textAlign: "left" };
57
+ var cellStyle = { paddingRight: "16px" };
58
+ var lastCellStyle = { textAlign: "left" };
59
+ var valueCellStyle = { overflowWrap: "anywhere", wordBreak: "break-all" };
60
+ function readSnapshot() {
61
+ const snapshot = globalThis.window?.__THREENATIVE__?.snapshot;
62
+ return typeof snapshot === "function" ? snapshot() : {};
63
+ }
64
+ function displayValue(value) {
65
+ return typeof value === "string" ? value : JSON.stringify(value) ?? String(value);
66
+ }
67
+ function DebugOverlay() {
68
+ const [open, setOpen] = useState(false);
69
+ const [snapshot, setSnapshot] = useState({});
70
+ useEffect(() => {
71
+ if (!isDev || typeof window === "undefined") return void 0;
72
+ const hostWindow = window;
73
+ const toggle = (event) => {
74
+ if (event.key === "`") setOpen((visible) => !visible);
75
+ };
76
+ hostWindow.addEventListener("keydown", toggle);
77
+ const timer = hostWindow.setInterval(() => setSnapshot(readSnapshot()), 100);
78
+ return () => {
79
+ hostWindow.removeEventListener("keydown", toggle);
80
+ hostWindow.clearInterval(timer);
81
+ };
82
+ }, []);
83
+ if (!isDev || !open) return null;
84
+ const rows = Object.entries(snapshot).flatMap(
85
+ ([entity, fields]) => Object.entries(fields).map(([key, value]) => ({ entity, key, value }))
86
+ );
87
+ return /* @__PURE__ */ jsx(
88
+ "aside",
89
+ {
90
+ "aria-label": "ThreeNative entity debug overlay",
91
+ "data-threenative-debug-overlay": "true",
92
+ style: panelStyle,
93
+ children: /* @__PURE__ */ jsxs("table", { style: tableStyle, children: [
94
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
95
+ /* @__PURE__ */ jsx("th", { style: headerCellStyle, children: "entity" }),
96
+ /* @__PURE__ */ jsx("th", { style: headerCellStyle, children: "key" }),
97
+ /* @__PURE__ */ jsx("th", { style: lastCellStyle, children: "value" })
98
+ ] }) }),
99
+ /* @__PURE__ */ jsx("tbody", { children: rows.map(({ entity, key, value }) => /* @__PURE__ */ jsxs("tr", { children: [
100
+ /* @__PURE__ */ jsx("td", { style: cellStyle, children: entity }),
101
+ /* @__PURE__ */ jsx("td", { style: cellStyle, children: key }),
102
+ /* @__PURE__ */ jsx("td", { style: valueCellStyle, children: displayValue(value) })
103
+ ] }, `${entity}.${key}`)) })
104
+ ] })
105
+ }
106
+ );
107
+ }
108
+ function useGameState(game, selector = (state) => state) {
109
+ return useSyncExternalStore(
110
+ (onStoreChange) => game.state.subscribe(onStoreChange),
111
+ () => selector(game.state.getState()),
112
+ () => selector(game.state.getState())
113
+ );
114
+ }
115
+
116
+ export { DebugOverlay, GameCanvas, useGameState };
package/package.json CHANGED
@@ -1,31 +1,45 @@
1
1
  {
2
2
  "name": "@threenative/ui",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
+ "description": "React bindings for mounting a ThreeNative game and reading throttled state.",
4
5
  "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "main": "./dist/index.js",
10
+ "module": "./dist/index.js",
5
11
  "types": "./dist/index.d.ts",
6
12
  "exports": {
7
13
  ".": {
8
14
  "types": "./dist/index.d.ts",
9
- "default": "./dist/index.js"
15
+ "import": "./dist/index.js"
10
16
  },
11
- "./jsx-runtime": {
12
- "types": "./dist/jsx-runtime.d.ts",
13
- "default": "./dist/jsx-runtime.js"
14
- }
17
+ "./package.json": "./package.json"
15
18
  },
16
- "files": [
17
- "dist"
18
- ],
19
19
  "publishConfig": {
20
20
  "access": "public"
21
21
  },
22
+ "sideEffects": false,
23
+ "peerDependencies": {
24
+ "@threenative/core": ">=0.1.0 <0.2.0",
25
+ "react": ">=19.2.0 <20",
26
+ "react-dom": ">=19.2.0 <20"
27
+ },
22
28
  "devDependencies": {
23
- "@types/node": "^20.19.25"
29
+ "@types/react": "19.2.0",
30
+ "@types/react-dom": "19.2.0",
31
+ "@types/react-test-renderer": "19.1.0",
32
+ "publint": "0.3.22",
33
+ "react": "19.2.0",
34
+ "react-dom": "19.2.0",
35
+ "react-test-renderer": "19.2.0",
36
+ "tsup": "8.5.1",
37
+ "typescript": "5.9.3",
38
+ "@threenative/core": "0.1.0"
24
39
  },
25
40
  "scripts": {
26
- "build": "tsc -p tsconfig.json",
27
- "lint": "tsc -p tsconfig.json --noEmit",
28
- "test": "node scripts/run-tests.mjs",
29
- "typecheck": "tsc -p tsconfig.json --noEmit"
41
+ "build": "tsup --config tsup.config.ts && publint",
42
+ "typecheck": "tsc --noEmit",
43
+ "test": "pnpm run build"
30
44
  }
31
45
  }
package/dist/capture.d.ts DELETED
@@ -1,191 +0,0 @@
1
- import type { IUiElement } from "./jsx-runtime.js";
2
- export type IUiBinding = {
3
- kind: "resource";
4
- name: string;
5
- field?: string;
6
- } | {
7
- component: string;
8
- entity: string;
9
- field?: string;
10
- kind: "component";
11
- };
12
- export interface IUiIr {
13
- fonts?: IUiFontAssetIr[];
14
- focusOrder?: string[];
15
- inputActions?: {
16
- activate?: string;
17
- cancel?: string;
18
- next?: string;
19
- previous?: string;
20
- };
21
- safeArea?: {
22
- edges?: Array<"bottom" | "left" | "right" | "top">;
23
- mode: "avoid" | "none";
24
- };
25
- schema: "threenative.ui";
26
- version: "0.1.0";
27
- root: IUiNodeIr;
28
- }
29
- export interface IUiNodeIr {
30
- action?: string;
31
- accessibilityLabel?: string;
32
- anchorId?: string;
33
- binding?: IUiBinding;
34
- children?: IUiNodeIr[];
35
- component?: {
36
- props?: Record<string, string | number | boolean>;
37
- ref: string;
38
- slots?: Record<string, IUiNodeIr[]>;
39
- };
40
- disabled?: boolean;
41
- focusable?: boolean;
42
- id: string;
43
- image?: IUiImageMetadataIr;
44
- kind: "bar" | "button" | "column" | "component" | "contextMenu" | "image" | "minimap" | "row" | "scrollbar" | "slider" | "stack" | "text" | "textInput" | "touchControl";
45
- minimap?: IUiMinimapMetadataIr;
46
- label?: string;
47
- layout?: IUiLayoutIr;
48
- max?: number;
49
- min?: number;
50
- navigation?: {
51
- down?: string;
52
- left?: string;
53
- right?: string;
54
- up?: string;
55
- };
56
- orientation?: "horizontal" | "vertical";
57
- role?: "button" | "group" | "image" | "list" | "listitem" | "none" | "progressbar" | "text";
58
- spans?: IUiRichTextSpanIr[];
59
- step?: number;
60
- style?: IUiStyleIr;
61
- src?: string;
62
- text?: string;
63
- value?: number;
64
- valueText?: string;
65
- }
66
- export interface IUiImageMetadataIr {
67
- atlas?: {
68
- x: number;
69
- y: number;
70
- width: number;
71
- height: number;
72
- };
73
- flipX?: boolean;
74
- flipY?: boolean;
75
- nineSlice?: {
76
- left: number;
77
- right: number;
78
- top: number;
79
- bottom: number;
80
- };
81
- scaleMode?: "contain" | "cover" | "stretch";
82
- sourceSize?: {
83
- width: number;
84
- height: number;
85
- };
86
- tileSize?: {
87
- width: number;
88
- height: number;
89
- };
90
- tint?: string;
91
- }
92
- export interface IUiMinimapMetadataIr {
93
- backgroundColor?: string;
94
- bounds: {
95
- minX: number;
96
- maxX: number;
97
- minZ: number;
98
- maxZ: number;
99
- };
100
- markers?: Array<{
101
- color?: string;
102
- label?: string;
103
- radius?: number;
104
- x: number;
105
- z: number;
106
- }>;
107
- paths: Array<{
108
- color?: string;
109
- points: Array<[number, number]>;
110
- width?: number;
111
- }>;
112
- }
113
- export interface IUiFontAssetIr {
114
- asset: string;
115
- fallbackFamily?: string;
116
- family: string;
117
- glyphRanges?: Array<{
118
- from: number;
119
- to: number;
120
- }>;
121
- style?: "italic" | "normal";
122
- weight?: "bold" | "normal" | number;
123
- }
124
- export interface IUiRichTextSpanIr {
125
- accessibilityText?: string;
126
- color?: string;
127
- decoration?: "lineThrough" | "none" | "underline";
128
- fontFamily?: string;
129
- fontSize?: number;
130
- italic?: boolean;
131
- text: string;
132
- weight?: "bold" | "normal" | number;
133
- }
134
- export interface IUiLayoutIr {
135
- align?: "center" | "end" | "start" | "stretch";
136
- columnGap?: number;
137
- direction?: "column" | "row";
138
- grid?: {
139
- autoFlow?: "column" | "row";
140
- columns?: number;
141
- rows?: number;
142
- };
143
- grow?: number;
144
- height?: number;
145
- inset?: {
146
- bottom?: number;
147
- left?: number;
148
- right?: number;
149
- top?: number;
150
- };
151
- justify?: "center" | "end" | "spaceBetween" | "start";
152
- maxHeight?: number;
153
- maxWidth?: number;
154
- minHeight?: number;
155
- minWidth?: number;
156
- overflow?: "hidden" | "scroll" | "visible";
157
- padding?: number;
158
- position?: "absolute" | "relative";
159
- rowGap?: number;
160
- width?: number;
161
- zIndex?: number;
162
- }
163
- export interface IUiStyleIr {
164
- backgroundColor?: string;
165
- borderColor?: string;
166
- borderRadius?: number;
167
- borderWidth?: number;
168
- color?: string;
169
- fontFamily?: string;
170
- fontSize?: number;
171
- fontWeight?: "bold" | "normal";
172
- gradient?: {
173
- angle?: number;
174
- from: string;
175
- kind: "linear";
176
- to: string;
177
- };
178
- opacity?: number;
179
- shadow?: {
180
- blur?: number;
181
- color: string;
182
- offsetX?: number;
183
- offsetY?: number;
184
- spread?: number;
185
- };
186
- textDecoration?: "lineThrough" | "none" | "underline";
187
- textAlign?: "center" | "left" | "right";
188
- wrap?: "character" | "none" | "word";
189
- }
190
- export declare function captureUi(root: IUiElement): IUiIr;
191
- //# sourceMappingURL=capture.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAW,MAAM,kBAAkB,CAAC;AAE5D,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAE7E,MAAM,WAAW,KAAK;IACpB,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ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K,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC/B,QAAQ,CAAC,EAAE;QACT,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,QAAQ,CAAC;QACf,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,cAAc,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,WAAW,CAAC;IACtD,SAAS,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IACxC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;CACtC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,KAAK,CAajD"}
package/dist/capture.js DELETED
@@ -1,77 +0,0 @@
1
- export function captureUi(root) {
2
- if (root.type !== "ui") {
3
- throw new Error(`Portable UI root must be <ui>, got '${root.type}'.`);
4
- }
5
- return {
6
- ...(root.props.fonts === undefined ? {} : { fonts: root.props.fonts }),
7
- ...(root.props.focusOrder === undefined ? {} : { focusOrder: root.props.focusOrder }),
8
- ...(root.props.inputActions === undefined ? {} : { inputActions: root.props.inputActions }),
9
- ...(root.props.safeArea === undefined ? {} : { safeArea: root.props.safeArea }),
10
- schema: "threenative.ui",
11
- version: "0.1.0",
12
- root: captureNode(root, "ui"),
13
- };
14
- }
15
- function captureNode(element, fallback) {
16
- if (element.type === "ui") {
17
- return {
18
- ...(element.props.accessibilityLabel === undefined ? {} : { accessibilityLabel: element.props.accessibilityLabel }),
19
- children: childrenOf(element).map((child, index) => captureNode(child, `${fallback}.${child.type}.${index}`)),
20
- id: element.props.id ?? fallback,
21
- kind: "stack",
22
- ...(element.props.role === undefined ? {} : { role: element.props.role }),
23
- };
24
- }
25
- if (!["bar", "button", "column", "component", "contextMenu", "image", "minimap", "row", "scrollbar", "slider", "stack", "text", "textInput", "touchControl"].includes(element.type)) {
26
- throw new Error(`Unsupported portable UI node '${element.type}'.`);
27
- }
28
- return {
29
- ...(element.props.action === undefined ? {} : { action: element.props.action }),
30
- ...(element.props.accessibilityLabel === undefined ? {} : { accessibilityLabel: element.props.accessibilityLabel }),
31
- ...(element.props.anchorId === undefined ? {} : { anchorId: element.props.anchorId }),
32
- ...(element.props.binding === undefined ? {} : { binding: element.props.binding }),
33
- ...(element.props.component === undefined ? {} : { component: captureComponentInstance(element.props.component) }),
34
- ...(element.props.disabled === undefined ? {} : { disabled: element.props.disabled }),
35
- ...(element.props.focusable === undefined ? {} : { focusable: element.props.focusable }),
36
- ...(element.props.image === undefined ? {} : { image: element.props.image }),
37
- ...(element.props.label === undefined ? {} : { label: element.props.label }),
38
- ...(element.props.layout === undefined ? {} : { layout: element.props.layout }),
39
- ...(element.props.max === undefined ? {} : { max: element.props.max }),
40
- ...(element.props.min === undefined ? {} : { min: element.props.min }),
41
- ...(element.props.minimap === undefined ? {} : { minimap: element.props.minimap }),
42
- ...(element.props.navigation === undefined ? {} : { navigation: element.props.navigation }),
43
- ...(element.props.orientation === undefined ? {} : { orientation: element.props.orientation }),
44
- ...(element.props.role === undefined ? {} : { role: element.props.role }),
45
- ...(element.props.spans === undefined ? {} : { spans: element.props.spans }),
46
- ...(element.props.step === undefined ? {} : { step: element.props.step }),
47
- ...(element.props.style === undefined ? {} : { style: element.props.style }),
48
- ...(element.props.src === undefined ? {} : { src: element.props.src }),
49
- ...(element.props.text === undefined ? {} : { text: element.props.text }),
50
- ...(element.props.value === undefined ? {} : { value: element.props.value }),
51
- ...(element.props.valueText === undefined ? {} : { valueText: element.props.valueText }),
52
- children: childrenOf(element).map((child, index) => captureNode(child, `${fallback}.${child.type}.${index}`)),
53
- id: element.props.id ?? fallback,
54
- kind: element.type,
55
- };
56
- }
57
- function captureComponentInstance(component) {
58
- return {
59
- ref: component.ref,
60
- ...(component.props === undefined ? {} : { props: component.props }),
61
- ...(component.slots === undefined ? {} : {
62
- slots: Object.fromEntries(Object.entries(component.slots).map(([slot, children]) => [
63
- slot,
64
- children.map((child, index) => captureNode(child, `component.${slot}.${index}`)),
65
- ])),
66
- }),
67
- };
68
- }
69
- function childrenOf(element) {
70
- return toArray(element.props.children).filter(isUiElement);
71
- }
72
- function toArray(children) {
73
- return Array.isArray(children) ? children : [children];
74
- }
75
- function isUiElement(value) {
76
- return typeof value === "object" && value !== null && "type" in value && "props" in value;
77
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=capture.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"capture.test.d.ts","sourceRoot":"","sources":["../src/capture.test.tsx"],"names":[],"mappings":""}
@@ -1,25 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@threenative/ui/jsx-runtime";
2
- /** @jsxImportSource @threenative/ui */
3
- import assert from "node:assert/strict";
4
- import test from "node:test";
5
- import { Button, Component, Slider, TextInput, Ui, captureUi } from "./index.js";
6
- test("captureUi should author textInput and component instances from TSX", () => {
7
- const captured = captureUi(_jsxs(Ui, { id: "hud", children: [_jsx(TextInput, { id: "player-name", label: "Player name", action: "SetPlayerName", text: "Hero" }), _jsx(Slider, { id: "volume", accessibilityLabel: "Volume", action: "SetVolume", min: 0, max: 1, value: 0.5, step: 0.05 }), _jsx(Component, { id: "slot.potion", component: { ref: "inventorySlot", props: { label: "Potion" } } }), _jsx(Button, { id: "start", label: "Start", action: "StartGame" })] }));
8
- assert.deepEqual(captured.root.children?.map((node) => node.kind), ["textInput", "slider", "component", "button"]);
9
- assert.equal(captured.root.children?.[0]?.action, "SetPlayerName");
10
- assert.deepEqual(captured.root.children?.[1], {
11
- accessibilityLabel: "Volume",
12
- action: "SetVolume",
13
- children: [],
14
- id: "volume",
15
- kind: "slider",
16
- max: 1,
17
- min: 0,
18
- step: 0.05,
19
- value: 0.5,
20
- });
21
- assert.deepEqual(captured.root.children?.[2]?.component, {
22
- props: { label: "Potion" },
23
- ref: "inventorySlot",
24
- });
25
- });
@@ -1,17 +0,0 @@
1
- import type { IUiActionProps, IUiBarProps, IUiComponentProps, IUiContainerProps, IUiImageProps, IUiMinimapProps, IUiRangeProps, IUiScrollbarProps, IUiTextInputProps, IUiTextProps } from "./jsx-runtime.js";
2
- export declare const Ui: (props: IUiContainerProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
3
- export declare const Text: (props: IUiTextProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
4
- export declare const Button: (props: IUiActionProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
5
- export declare const Bar: (props: IUiBarProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
6
- export declare const Image: (props: IUiImageProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
7
- export declare const Minimap: (props: IUiMinimapProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
8
- export declare const Row: (props: IUiContainerProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
9
- export declare const Column: (props: IUiContainerProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
10
- export declare const Stack: (props: IUiContainerProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
11
- export declare const TouchControl: (props: IUiActionProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
12
- export declare const Slider: (props: IUiRangeProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
13
- export declare const Scrollbar: (props: IUiScrollbarProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
14
- export declare const ContextMenu: (props: IUiContainerProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
15
- export declare const TextInput: (props: IUiTextInputProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
16
- export declare const Component: (props: IUiComponentProps) => import("@threenative/ui/jsx-runtime").IUiElement<import("@threenative/ui/jsx-runtime").IUiNodeProps>;
17
- //# sourceMappingURL=components.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAG7M,eAAO,MAAM,EAAE,GAAI,OAAO,iBAAiB,yGAAqB,CAAC;AACjE,eAAO,MAAM,IAAI,GAAI,OAAO,YAAY,yGAAuB,CAAC;AAChE,eAAO,MAAM,MAAM,GAAI,OAAO,cAAc,yGAAyB,CAAC;AACtE,eAAO,MAAM,GAAG,GAAI,OAAO,WAAW,yGAAsB,CAAC;AAC7D,eAAO,MAAM,KAAK,GAAI,OAAO,aAAa,yGAAwB,CAAC;AACnE,eAAO,MAAM,OAAO,GAAI,OAAO,eAAe,yGAA0B,CAAC;AACzE,eAAO,MAAM,GAAG,GAAI,OAAO,iBAAiB,yGAAsB,CAAC;AACnE,eAAO,MAAM,MAAM,GAAI,OAAO,iBAAiB,yGAAyB,CAAC;AACzE,eAAO,MAAM,KAAK,GAAI,OAAO,iBAAiB,yGAAwB,CAAC;AACvE,eAAO,MAAM,YAAY,GAAI,OAAO,cAAc,yGAA+B,CAAC;AAClF,eAAO,MAAM,MAAM,GAAI,OAAO,aAAa,yGAAyB,CAAC;AACrE,eAAO,MAAM,SAAS,GAAI,OAAO,iBAAiB,yGAA4B,CAAC;AAC/E,eAAO,MAAM,WAAW,GAAI,OAAO,iBAAiB,yGAA8B,CAAC;AACnF,eAAO,MAAM,SAAS,GAAI,OAAO,iBAAiB,yGAA4B,CAAC;AAC/E,eAAO,MAAM,SAAS,GAAI,OAAO,iBAAiB,yGAA4B,CAAC"}
@@ -1,16 +0,0 @@
1
- import { jsx } from "./jsx-runtime.js";
2
- export const Ui = (props) => jsx("ui", props);
3
- export const Text = (props) => jsx("text", props);
4
- export const Button = (props) => jsx("button", props);
5
- export const Bar = (props) => jsx("bar", props);
6
- export const Image = (props) => jsx("image", props);
7
- export const Minimap = (props) => jsx("minimap", props);
8
- export const Row = (props) => jsx("row", props);
9
- export const Column = (props) => jsx("column", props);
10
- export const Stack = (props) => jsx("stack", props);
11
- export const TouchControl = (props) => jsx("touchControl", props);
12
- export const Slider = (props) => jsx("slider", props);
13
- export const Scrollbar = (props) => jsx("scrollbar", props);
14
- export const ContextMenu = (props) => jsx("contextMenu", props);
15
- export const TextInput = (props) => jsx("textInput", props);
16
- export const Component = (props) => jsx("component", props);
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAChK,OAAO,EAAE,SAAS,EAAE,KAAK,kBAAkB,EAAE,KAAK,KAAK,EAAE,KAAK,WAAW,EAAE,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3I,YAAY,EACV,cAAc,EACd,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,eAAe,EACf,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,aAAa,EACb,eAAe,EACf,iBAAiB,GAClB,MAAM,kBAAkB,CAAC"}
@@ -1,258 +0,0 @@
1
- export type UiElementType = "bar" | "button" | "column" | "component" | "contextMenu" | "image" | "minimap" | "row" | "scrollbar" | "slider" | "stack" | "text" | "textInput" | "touchControl" | "ui";
2
- export type UiAccessibilityRole = "button" | "group" | "image" | "list" | "listitem" | "none" | "progressbar" | "text";
3
- export type UiBinding = {
4
- kind: "resource";
5
- name: string;
6
- field?: string;
7
- } | {
8
- component: string;
9
- entity: string;
10
- field?: string;
11
- kind: "component";
12
- };
13
- export interface IUiCommonProps {
14
- action?: string;
15
- accessibilityLabel?: string;
16
- anchorId?: string;
17
- binding?: UiBinding;
18
- children?: UiChild | UiChild[];
19
- component?: IUiComponentInstance;
20
- disabled?: boolean;
21
- focusable?: boolean;
22
- focusOrder?: string[];
23
- fonts?: UiFontAsset[];
24
- id?: string;
25
- inputActions?: {
26
- activate?: string;
27
- cancel?: string;
28
- next?: string;
29
- previous?: string;
30
- };
31
- image?: UiImageMetadata;
32
- label?: string;
33
- max?: number;
34
- min?: number;
35
- minimap?: UiMinimapMetadata;
36
- layout?: {
37
- align?: "center" | "end" | "start" | "stretch";
38
- columnGap?: number;
39
- direction?: "column" | "row";
40
- grid?: {
41
- autoFlow?: "column" | "row";
42
- columns?: number;
43
- rows?: number;
44
- };
45
- grow?: number;
46
- height?: number;
47
- inset?: {
48
- bottom?: number;
49
- left?: number;
50
- right?: number;
51
- top?: number;
52
- };
53
- justify?: "center" | "end" | "spaceBetween" | "start";
54
- maxHeight?: number;
55
- maxWidth?: number;
56
- minHeight?: number;
57
- minWidth?: number;
58
- overflow?: "hidden" | "scroll" | "visible";
59
- padding?: number;
60
- position?: "absolute" | "relative";
61
- rowGap?: number;
62
- width?: number;
63
- zIndex?: number;
64
- };
65
- navigation?: {
66
- down?: string;
67
- left?: string;
68
- right?: string;
69
- up?: string;
70
- };
71
- orientation?: "horizontal" | "vertical";
72
- role?: UiAccessibilityRole;
73
- safeArea?: {
74
- edges?: Array<"bottom" | "left" | "right" | "top">;
75
- mode: "avoid" | "none";
76
- };
77
- spans?: UiRichTextSpan[];
78
- src?: string;
79
- step?: number;
80
- style?: {
81
- backgroundColor?: string;
82
- borderColor?: string;
83
- borderRadius?: number;
84
- borderWidth?: number;
85
- color?: string;
86
- fontFamily?: string;
87
- fontSize?: number;
88
- fontWeight?: "bold" | "normal";
89
- gradient?: {
90
- angle?: number;
91
- from: string;
92
- kind: "linear";
93
- to: string;
94
- };
95
- opacity?: number;
96
- shadow?: {
97
- blur?: number;
98
- color: string;
99
- offsetX?: number;
100
- offsetY?: number;
101
- spread?: number;
102
- };
103
- textDecoration?: "lineThrough" | "none" | "underline";
104
- textAlign?: "center" | "left" | "right";
105
- wrap?: "character" | "none" | "word";
106
- };
107
- text?: string;
108
- value?: number;
109
- valueText?: string;
110
- }
111
- export interface IUiContainerProps extends IUiCommonProps {
112
- }
113
- export interface IUiTextProps extends IUiCommonProps {
114
- spans?: UiRichTextSpan[];
115
- text?: string;
116
- }
117
- export interface IUiActionProps extends IUiCommonProps {
118
- action: string;
119
- }
120
- export interface IUiRangeProps extends IUiActionProps {
121
- max?: number;
122
- min?: number;
123
- orientation?: "horizontal" | "vertical";
124
- step?: number;
125
- value?: number;
126
- valueText?: string;
127
- }
128
- export interface IUiScrollbarProps extends IUiCommonProps {
129
- action?: string;
130
- max?: number;
131
- min?: number;
132
- orientation?: "horizontal" | "vertical";
133
- step?: number;
134
- value?: number;
135
- valueText?: string;
136
- }
137
- export interface IUiTextInputProps extends IUiActionProps {
138
- text?: string;
139
- valueText?: string;
140
- }
141
- export interface IUiBarProps extends IUiCommonProps {
142
- max?: number;
143
- value?: number;
144
- valueText?: string;
145
- }
146
- export interface IUiImageProps extends IUiCommonProps {
147
- image?: UiImageMetadata;
148
- src?: string;
149
- }
150
- export interface IUiMinimapProps extends IUiCommonProps {
151
- minimap: UiMinimapMetadata;
152
- }
153
- export interface IUiComponentInstance {
154
- props?: Record<string, string | number | boolean>;
155
- ref: string;
156
- slots?: Record<string, IUiElement[]>;
157
- }
158
- export interface IUiComponentProps extends IUiCommonProps {
159
- component: IUiComponentInstance;
160
- }
161
- export type IUiNodeProps = IUiActionProps | IUiBarProps | IUiCommonProps | IUiComponentProps | IUiContainerProps | IUiImageProps | IUiMinimapProps | IUiRangeProps | IUiScrollbarProps | IUiTextInputProps | IUiTextProps;
162
- export type UiChild = IUiElement | false | null | undefined;
163
- export interface UiMinimapMetadata {
164
- backgroundColor?: string;
165
- bounds: {
166
- minX: number;
167
- maxX: number;
168
- minZ: number;
169
- maxZ: number;
170
- };
171
- markers?: Array<{
172
- color?: string;
173
- label?: string;
174
- radius?: number;
175
- x: number;
176
- z: number;
177
- }>;
178
- paths: Array<{
179
- color?: string;
180
- points: Array<[number, number]>;
181
- width?: number;
182
- }>;
183
- }
184
- export interface UiFontAsset {
185
- asset: string;
186
- fallbackFamily?: string;
187
- family: string;
188
- glyphRanges?: Array<{
189
- from: number;
190
- to: number;
191
- }>;
192
- style?: "italic" | "normal";
193
- weight?: "bold" | "normal" | number;
194
- }
195
- export interface UiRichTextSpan {
196
- accessibilityText?: string;
197
- color?: string;
198
- decoration?: "lineThrough" | "none" | "underline";
199
- fontFamily?: string;
200
- fontSize?: number;
201
- italic?: boolean;
202
- text: string;
203
- weight?: "bold" | "normal" | number;
204
- }
205
- export interface UiImageMetadata {
206
- atlas?: {
207
- x: number;
208
- y: number;
209
- width: number;
210
- height: number;
211
- };
212
- flipX?: boolean;
213
- flipY?: boolean;
214
- nineSlice?: {
215
- left: number;
216
- right: number;
217
- top: number;
218
- bottom: number;
219
- };
220
- scaleMode?: "contain" | "cover" | "stretch";
221
- sourceSize?: {
222
- width: number;
223
- height: number;
224
- };
225
- tileSize?: {
226
- width: number;
227
- height: number;
228
- };
229
- tint?: string;
230
- }
231
- export interface IUiElement<TProps extends IUiNodeProps = IUiNodeProps> {
232
- props: TProps;
233
- type: UiElementType;
234
- }
235
- export declare function jsx<TProps extends IUiNodeProps>(type: UiElementType | ((props: TProps) => IUiElement), props: TProps): IUiElement;
236
- export declare const jsxs: typeof jsx;
237
- export declare const Fragment = "stack";
238
- export declare namespace JSX {
239
- type Element = IUiElement;
240
- interface IntrinsicElements {
241
- bar: IUiBarProps;
242
- button: IUiActionProps;
243
- column: IUiContainerProps;
244
- component: IUiComponentProps;
245
- contextMenu: IUiContainerProps;
246
- image: IUiImageProps;
247
- minimap: IUiMinimapProps;
248
- row: IUiContainerProps;
249
- scrollbar: IUiScrollbarProps;
250
- slider: IUiRangeProps;
251
- stack: IUiContainerProps;
252
- text: IUiTextProps;
253
- textInput: IUiTextInputProps;
254
- touchControl: IUiActionProps;
255
- ui: IUiContainerProps;
256
- }
257
- }
258
- //# sourceMappingURL=jsx-runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/js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Ae,CAAC;QACzB,GAAG,EAAE,iBAAiB,CAAC;QACvB,SAAS,EAAE,iBAAiB,CAAC;QAC7B,MAAM,EAAE,aAAa,CAAC;QACtB,KAAK,EAAE,iBAAiB,CAAC;QACzB,IAAI,EAAE,YAAY,CAAC;QACnB,SAAS,EAAE,iBAAiB,CAAC;QAC7B,YAAY,EAAE,cAAc,CAAC;QAC7B,EAAE,EAAE,iBAAiB,CAAC;KACvB;CACF"}
@@ -1,8 +0,0 @@
1
- export function jsx(type, props) {
2
- if (typeof type === "function") {
3
- return type(props);
4
- }
5
- return { props: props ?? {}, type };
6
- }
7
- export const jsxs = jsx;
8
- export const Fragment = "stack";