@gtkx/testing 0.2.6 → 0.2.7
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 +18 -16
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -64,20 +64,12 @@ npm install -D @types/react typescript
|
|
|
64
64
|
Create your first app:
|
|
65
65
|
|
|
66
66
|
```tsx
|
|
67
|
-
//
|
|
68
|
-
import { render } from "@gtkx/react";
|
|
69
|
-
import { App } from "./app.js";
|
|
70
|
-
|
|
71
|
-
render(<App />, "org.example.MyApp");
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
```tsx
|
|
75
|
-
// app.tsx
|
|
76
|
-
import { ApplicationWindow, Box, Button, Label, quit } from "@gtkx/react";
|
|
77
|
-
import { Orientation } from "@gtkx/ffi/gtk";
|
|
67
|
+
// src/app.tsx
|
|
78
68
|
import { useState } from "react";
|
|
69
|
+
import * as Gtk from "@gtkx/ffi/gtk";
|
|
70
|
+
import { ApplicationWindow, Box, Button, Label, quit } from "@gtkx/react";
|
|
79
71
|
|
|
80
|
-
export
|
|
72
|
+
export default function App() {
|
|
81
73
|
const [count, setCount] = useState(0);
|
|
82
74
|
|
|
83
75
|
return (
|
|
@@ -88,7 +80,7 @@ export const App = () => {
|
|
|
88
80
|
onCloseRequest={quit}
|
|
89
81
|
>
|
|
90
82
|
<Box
|
|
91
|
-
orientation={Orientation.VERTICAL}
|
|
83
|
+
orientation={Gtk.Orientation.VERTICAL}
|
|
92
84
|
spacing={12}
|
|
93
85
|
marginStart={20}
|
|
94
86
|
marginEnd={20}
|
|
@@ -100,7 +92,17 @@ export const App = () => {
|
|
|
100
92
|
</Box>
|
|
101
93
|
</ApplicationWindow>
|
|
102
94
|
);
|
|
103
|
-
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const appId = "org.example.MyApp";
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
// src/index.tsx
|
|
102
|
+
import { render } from "@gtkx/react";
|
|
103
|
+
import App, { appId } from "./app.js";
|
|
104
|
+
|
|
105
|
+
render(<App />, appId);
|
|
104
106
|
```
|
|
105
107
|
|
|
106
108
|
Run with HMR:
|
|
@@ -109,10 +111,10 @@ Run with HMR:
|
|
|
109
111
|
npx gtkx dev src/app.tsx
|
|
110
112
|
```
|
|
111
113
|
|
|
112
|
-
Or without HMR:
|
|
114
|
+
Or without HMR (production):
|
|
113
115
|
|
|
114
116
|
```bash
|
|
115
|
-
npx
|
|
117
|
+
npx tsc -b && node dist/index.js
|
|
116
118
|
```
|
|
117
119
|
|
|
118
120
|
## Styling
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/testing",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Testing utilities for GTKX applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtk",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@gtkx/ffi": "0.2.
|
|
36
|
-
"@gtkx/react": "0.2.
|
|
37
|
-
"@gtkx/native": "0.2.
|
|
35
|
+
"@gtkx/ffi": "0.2.7",
|
|
36
|
+
"@gtkx/react": "0.2.7",
|
|
37
|
+
"@gtkx/native": "0.2.7"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsc -b && cp ../../README.md .",
|