@gjsify/example-gtk-adwaita-storybook 0.34.0 → 0.36.0
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 +71 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @gjsify/example-gtk-adwaita-storybook
|
|
2
2
|
|
|
3
3
|
An interactive **component browser for [Libadwaita](https://gnome.pages.gitlab.gnome.org/libadwaita/)**
|
|
4
4
|
widgets — the GNOME equivalent of a web "storybook". Each widget is rendered live, in
|
|
5
5
|
isolation, with a two-way-bound **Controls** panel so you can poke at its properties and
|
|
6
|
-
watch it update.
|
|
6
|
+
watch it update. 35 stories across 7 categories.
|
|
7
|
+
|
|
8
|
+
Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
|
|
7
9
|
|
|
8
10
|
It is a showcase for three pieces of gjsify tooling working together:
|
|
9
11
|
|
|
@@ -15,12 +17,33 @@ It is a showcase for three pieces of gjsify tooling working together:
|
|
|
15
17
|
|
|
16
18
|

|
|
17
19
|
|
|
20
|
+
## Targets
|
|
21
|
+
|
|
22
|
+
| Target | Bundle | Renderer |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| GJS / GTK 4 | `dist/gjs.js` (`--app gjs`) | `@gjsify/storybook` — native `Adw.*` widgets |
|
|
25
|
+
| Node · Bun · Deno | `dist/gjs.node.mjs` (`--app node`) | the same GTK renderer through the `@gjsify/node-gi` reverse bridge |
|
|
26
|
+
| Browser | `dist/browser-main.js` (`--app browser`) | `@gjsify/adwaita-storybook` — `@gjsify/adwaita-web` components |
|
|
27
|
+
| Android (NativeScript) | [`adwaita-storybook-nativescript`](../../dom/adwaita-storybook-nativescript) | `@gjsify/storybook-nativescript` — real native NS views |
|
|
28
|
+
|
|
29
|
+
Every target renders the SAME stories: the renderer-free `*.meta.ts` metadata is exported from
|
|
30
|
+
this package's `./metas` barrel and the shared logic lives in
|
|
31
|
+
[`@gjsify/storybook-core`](../../../packages/framework/storybook-core), so each renderer is a
|
|
32
|
+
thin adapter and the four renderings are comparable 1:1 by screenshot.
|
|
33
|
+
|
|
34
|
+
## Prerequisites
|
|
35
|
+
|
|
36
|
+
GJS ≥ 1.86 with GTK 4 and Libadwaita 1.x. `gjsify system-check` reports what is missing.
|
|
37
|
+
|
|
18
38
|
## Run it
|
|
19
39
|
|
|
20
40
|
```bash
|
|
21
41
|
# from this directory
|
|
22
42
|
gjsify storybook # discover every *.story.ts, build (--app gjs), launch the browser
|
|
23
43
|
gjsify storybook --watch # rebuild + relaunch on change
|
|
44
|
+
|
|
45
|
+
# without a checkout
|
|
46
|
+
gjsify showcase adwaita-storybook
|
|
24
47
|
```
|
|
25
48
|
|
|
26
49
|
`gjsify storybook` reads the `gjsify.storybook` block in [`package.json`](package.json)
|
|
@@ -47,6 +70,17 @@ holds. All three open the window and claim `org.gjsify.AdwaitaStorybook` on the
|
|
|
47
70
|
which is exactly what the DBus harness below drives — so "it works there" is a checkable
|
|
48
71
|
claim, not a build that merely completed.
|
|
49
72
|
|
|
73
|
+
### In the browser
|
|
74
|
+
|
|
75
|
+
The web renderer builds the same stories as `@gjsify/adwaita-web` components:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
gjsify run build:web # build:browser + build:assets
|
|
79
|
+
gjsify run start:browser # http-server dist; open localhost:8080
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The `./browser` export is the embeddable entry the project website uses.
|
|
83
|
+
|
|
50
84
|
## Debug / drive it over DBus + MCP
|
|
51
85
|
|
|
52
86
|
Launch with the devtools control plane enabled, then drive it from `gdbus`, an MCP client,
|
|
@@ -78,6 +112,32 @@ GJSIFY_DEVTOOLS=1 gjsify storybook & # launch
|
|
|
78
112
|
gjs -m tools/shoot-stories.js org.gjsify.AdwaitaStorybook ./shots # capture all stories
|
|
79
113
|
```
|
|
80
114
|
|
|
115
|
+
## What it demonstrates
|
|
116
|
+
|
|
117
|
+
- A real Libadwaita component browser built from `*.story.ts` files alone — no per-project
|
|
118
|
+
storybook application, the renderer and the CLI command are the shared parts
|
|
119
|
+
- Two-way-bound live controls over native GObject properties: editing a control writes the
|
|
120
|
+
widget property, and a `notify::` on the widget updates the control
|
|
121
|
+
- ONE renderer-free story contract driving four renderings (GTK, Node/Bun/Deno over node-gi,
|
|
122
|
+
browser, NativeScript) — the same `*.meta.ts` metadata, shared across package boundaries
|
|
123
|
+
- The `@gjsify/devtools` DBus + MCP control plane: an agent can list and open stories, set
|
|
124
|
+
story args, dump the widget tree and screenshot the window headlessly
|
|
125
|
+
- Breadth of the Libadwaita widget set working under gjsify — rows, navigation, view
|
|
126
|
+
switching, dialogs and toasts (see the table below)
|
|
127
|
+
- `gjsify storybook` as a first-class workflow: discovery, build, launch, `--watch`, `--runtime`
|
|
128
|
+
|
|
129
|
+
## Layout
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
src/
|
|
133
|
+
<category>/<name>.meta.ts renderer-free story metadata (title + controls) — shared by ALL targets
|
|
134
|
+
<category>/<name>.story.ts the GTK story (StoryWidget subclass)
|
|
135
|
+
metas.ts the ./metas barrel the other renderers import
|
|
136
|
+
browser/<category>/<name>.web.ts the adwaita-web story for the same meta
|
|
137
|
+
browser/{main,embed,stories}.ts + index.html the browser shell and ./browser export
|
|
138
|
+
tools/shoot-stories.js open + screenshot every story over the devtools DBus surface
|
|
139
|
+
```
|
|
140
|
+
|
|
81
141
|
## Stories
|
|
82
142
|
|
|
83
143
|
Stories live under [`src/`](src), grouped into category folders. The sidebar group comes
|
|
@@ -135,6 +195,15 @@ Rules of thumb: globally-unique `GTypeName` (prefix `AdwStorybook…`), wrap `Ad
|
|
|
135
195
|
`Adw.PreferencesGroup`, give space-filling widgets a `widthRequest`/`heightRequest`, and
|
|
136
196
|
present dialogs from a button rather than embedding them.
|
|
137
197
|
|
|
198
|
+
## Related
|
|
199
|
+
|
|
200
|
+
- [`@gjsify/storybook`](../../../packages/framework/storybook) — the GTK story renderer
|
|
201
|
+
- [`@gjsify/storybook-core`](../../../packages/framework/storybook-core) — the renderer-free logic all targets share
|
|
202
|
+
- [`@gjsify/adwaita-storybook`](../../../packages/web/adwaita-storybook) — the browser renderer
|
|
203
|
+
- [`@gjsify/devtools`](../../../packages/framework/devtools) — the DBus + MCP control plane
|
|
204
|
+
- [`@gjsify/node-gi`](../../../packages/node-gi/node-gi) — the reverse bridge behind the Node/Bun/Deno target
|
|
205
|
+
- [`adwaita-storybook-nativescript`](../../dom/adwaita-storybook-nativescript) — the same stories as a native Android app
|
|
206
|
+
|
|
138
207
|
## License
|
|
139
208
|
|
|
140
209
|
MIT © Pascal Garber. Libadwaita is LGPL-2.1+ © GNOME contributors.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/example-gtk-adwaita-storybook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "Interactive component browser for Libadwaita widgets — a native Adwaita storybook built on @gjsify/storybook, debuggable over DBus/MCP via @gjsify/devtools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/gjs.js",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"@girs/glib-2.0": "^4.1.0",
|
|
55
55
|
"@girs/gobject-2.0": "^4.1.0",
|
|
56
56
|
"@girs/gtk-4.0": "^4.1.0",
|
|
57
|
-
"@gjsify/adwaita-web": "^0.
|
|
58
|
-
"@gjsify/cli": "^0.
|
|
57
|
+
"@gjsify/adwaita-web": "^0.36.0",
|
|
58
|
+
"@gjsify/cli": "^0.36.0",
|
|
59
59
|
"@gjsify/node-gi": "file:../../../packages/node-gi/node-gi",
|
|
60
|
-
"@gjsify/storybook": "^0.
|
|
61
|
-
"@gjsify/adwaita-storybook": "^0.
|
|
60
|
+
"@gjsify/storybook": "^0.36.0",
|
|
61
|
+
"@gjsify/adwaita-storybook": "^0.36.0",
|
|
62
62
|
"@types/node": "^25.9.2",
|
|
63
63
|
"typescript": "^6.0.3"
|
|
64
64
|
},
|