@navyk/opentui-react 0.1.5
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/LICENSE +21 -0
- package/README.md +50 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +25 -0
- package/package.json +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 navyk contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# @navyk/opentui-react
|
|
2
|
+
|
|
3
|
+
`@opentui/react` bindings for the `@navyk/opentui-core` package.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @navyk/opentui-core @navyk/opentui-react @opentui/react @opentui/core react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
Import the package once during app bootstrap. This registers `grid`, `cell`, `scope`, and `target` as OpenTUI components for React.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import "@navyk/opentui-react";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Minimal usage
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import "@navyk/opentui-react";
|
|
23
|
+
|
|
24
|
+
const movement = {
|
|
25
|
+
overflowBehavior: "stop",
|
|
26
|
+
left: { name: "left" },
|
|
27
|
+
right: { name: "right" },
|
|
28
|
+
up: { name: "up" },
|
|
29
|
+
down: { name: "down" },
|
|
30
|
+
} as const;
|
|
31
|
+
|
|
32
|
+
export function App() {
|
|
33
|
+
return (
|
|
34
|
+
<scope id="app" defaultFocus="menu-grid">
|
|
35
|
+
<grid
|
|
36
|
+
id="menu-grid"
|
|
37
|
+
size={[2, 2]}
|
|
38
|
+
movement={movement}
|
|
39
|
+
focusCurrentFocusLocal
|
|
40
|
+
style={{ width: "100%", height: "100%" }}
|
|
41
|
+
>
|
|
42
|
+
<cell id="a" style={{ width: "50%", height: "50%" }} />
|
|
43
|
+
<cell id="b" style={{ width: "50%", height: "50%" }} />
|
|
44
|
+
<cell id="c" style={{ width: "50%", height: "50%" }} />
|
|
45
|
+
<cell id="d" style={{ width: "50%", height: "50%" }} />
|
|
46
|
+
</grid>
|
|
47
|
+
</scope>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CellRenderable, GridRenderable, ScopeRenderable, TargetRenderable } from "@navyk/opentui-core";
|
|
2
|
+
declare module "@opentui/react" {
|
|
3
|
+
interface OpenTUIComponents {
|
|
4
|
+
grid: typeof GridRenderable;
|
|
5
|
+
cell: typeof CellRenderable;
|
|
6
|
+
scope: typeof ScopeRenderable;
|
|
7
|
+
target: typeof TargetRenderable;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** Register navyk renderables in OpenTUI React. Safe to call multiple times. */
|
|
11
|
+
export declare const registerNavykReactComponents: () => void;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { extend } from "@opentui/react";
|
|
3
|
+
import {
|
|
4
|
+
CellRenderable,
|
|
5
|
+
GridRenderable,
|
|
6
|
+
ScopeRenderable,
|
|
7
|
+
TargetRenderable
|
|
8
|
+
} from "@navyk/opentui-core";
|
|
9
|
+
var areNavykReactComponentsRegistered = false;
|
|
10
|
+
var registerNavykReactComponents = () => {
|
|
11
|
+
if (areNavykReactComponentsRegistered) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
extend({
|
|
15
|
+
grid: GridRenderable,
|
|
16
|
+
cell: CellRenderable,
|
|
17
|
+
scope: ScopeRenderable,
|
|
18
|
+
target: TargetRenderable
|
|
19
|
+
});
|
|
20
|
+
areNavykReactComponentsRegistered = true;
|
|
21
|
+
};
|
|
22
|
+
registerNavykReactComponents();
|
|
23
|
+
export {
|
|
24
|
+
registerNavykReactComponents
|
|
25
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@navyk/opentui-react",
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "@opentui/react bindings for the @navyk/opentui-core package.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"package.json"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"clean": "rm -rf ./dist",
|
|
21
|
+
"build": "bun run clean && bun build ./src/index.ts --outdir ./dist --root ./src --target node --format esm --external @opentui/react --external @navyk/opentui-core",
|
|
22
|
+
"types": "tsc -p ./tsconfig.build.json",
|
|
23
|
+
"prepack": "bun run build && bun run types",
|
|
24
|
+
"prepublishOnly": "bun run build && bun run types",
|
|
25
|
+
"sandbox": "bun ./sandbox/index.tsx",
|
|
26
|
+
"test": "bun test"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@navyk/opentui-core": "^0.1.1",
|
|
30
|
+
"@opentui/core": "^0.1.77",
|
|
31
|
+
"@opentui/react": "^0.1.77",
|
|
32
|
+
"react": ">=19.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@navyk/opentui-core": "^0.1.1",
|
|
36
|
+
"@opentui/core": "^0.1.77",
|
|
37
|
+
"@opentui/react": "^0.1.77",
|
|
38
|
+
"@types/bun": "latest",
|
|
39
|
+
"@types/react": "^19.0.0",
|
|
40
|
+
"react": "^19.0.0",
|
|
41
|
+
"typescript": "^5.9.3"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"license": "MIT"
|
|
47
|
+
}
|