@gjsify/example-gtk-adwaita-storybook 0.31.0 → 0.33.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/example-gtk-adwaita-storybook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.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",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"@girs/glib-2.0": "^4.1.0",
|
|
48
48
|
"@girs/gobject-2.0": "^4.1.0",
|
|
49
49
|
"@girs/gtk-4.0": "^4.1.0",
|
|
50
|
-
"@gjsify/adwaita-web": "^0.
|
|
51
|
-
"@gjsify/cli": "^0.
|
|
50
|
+
"@gjsify/adwaita-web": "^0.33.0",
|
|
51
|
+
"@gjsify/cli": "^0.33.0",
|
|
52
52
|
"@gjsify/node-gi": "file:../../../packages/node-gi/node-gi",
|
|
53
|
-
"@gjsify/storybook": "^0.
|
|
54
|
-
"@gjsify/adwaita-storybook": "^0.
|
|
53
|
+
"@gjsify/storybook": "^0.33.0",
|
|
54
|
+
"@gjsify/adwaita-storybook": "^0.33.0",
|
|
55
55
|
"@types/node": "^25.9.2",
|
|
56
56
|
"typescript": "^6.0.3"
|
|
57
57
|
},
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Browser port of the Split Button stories — adw-split-button, a primary action
|
|
2
2
|
// paired with a dropdown menu. Shares its metadata/controls with the GTK twins
|
|
3
|
-
// (split-button.story.ts)
|
|
3
|
+
// (split-button.story.ts). Their shared BEHAVIOUR is held by the
|
|
4
|
+
// @gjsify/adwaita-core/conformance split-button vectors; that they render
|
|
5
|
+
// identically is not measured anywhere (#1052).
|
|
4
6
|
|
|
5
7
|
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
6
8
|
import { splitButtonFlatMeta, splitButtonMeta } from '../../buttons/split-button.meta.js';
|
|
@@ -49,9 +49,11 @@ export class AboutDialogWebStory extends StoryElement {
|
|
|
49
49
|
if (!this._dialog) return;
|
|
50
50
|
const dialog = this._dialog;
|
|
51
51
|
dialog.setAttribute('application-name', (this.args.applicationName as string) ?? 'Adwaita Storybook');
|
|
52
|
-
// The native story uses `application-x-executable-symbolic`;
|
|
53
|
-
//
|
|
54
|
-
//
|
|
52
|
+
// The native story uses `application-x-executable-symbolic`; the web icon
|
|
53
|
+
// set ships the same glyph under the unsuffixed name. It has to be named
|
|
54
|
+
// here: GTK draws NO icon for an application that set none
|
|
55
|
+
// (adw-about-dialog.c:2313-2314), so the element no longer invents one.
|
|
56
|
+
dialog.setAttribute('application-icon', 'application-x-executable');
|
|
55
57
|
dialog.setAttribute('developer-name', 'A GJSify Project');
|
|
56
58
|
dialog.setAttribute('version', (this.args.version as string) ?? '0.11.0');
|
|
57
59
|
dialog.setAttribute('comments', 'A live catalogue of native GTK and Adwaita widgets, rendered under GJS.');
|
|
@@ -38,6 +38,10 @@ export class ClampWebStory extends StoryElement {
|
|
|
38
38
|
private _syncClamp(): void {
|
|
39
39
|
if (!this._clamp) return;
|
|
40
40
|
this._clamp.setAttribute('maximum-size', String(this.args.maximumSize as number));
|
|
41
|
+
// The story has exposed this control since it was written, but until the
|
|
42
|
+
// clamp curve moved into @gjsify/adwaita-core only the GTK pane responded
|
|
43
|
+
// to it — the storybook was comparing three panes of which two were deaf.
|
|
44
|
+
this._clamp.setAttribute('tightening-threshold', String(this.args.tighteningThreshold as number));
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
|
package/src/browser/main.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Browser entry — mounts the Adwaita storybook as a web app built from
|
|
2
2
|
// @gjsify/adwaita-web custom elements, mirroring the native GTK storybook
|
|
3
3
|
// (launched via `gjsify storybook`). Each *.web.ts story shares its metadata
|
|
4
|
-
// with the GTK *.story.ts twin, so the two targets expose identical controls
|
|
5
|
-
//
|
|
4
|
+
// with the GTK *.story.ts twin, so the two targets expose identical controls.
|
|
5
|
+
// They are NOT compared by screenshot — no such harness exists (#1052); the
|
|
6
|
+
// parity that is held is behavioural, via the @gjsify/adwaita-core/conformance
|
|
7
|
+
// vectors both renderer suites assert against.
|
|
6
8
|
//
|
|
7
9
|
// The story list lives in `./stories.ts` so the standalone entry here and the
|
|
8
10
|
// embeddable `mount(container)` (`./embed.ts`, used by the gjsify website) stay
|
|
@@ -38,6 +38,18 @@ function buildPage(title: string, accent: string): HTMLElement {
|
|
|
38
38
|
return card;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Push the two boolean controls onto the element.
|
|
43
|
+
*
|
|
44
|
+
* `allow-scroll-wheel` defaults to TRUE (adw-carousel.c:1103-1106), so it cannot
|
|
45
|
+
* be a bare presence attribute — REMOVING it would turn the wheel back ON. The
|
|
46
|
+
* element reads the explicit string, which is what a `false` control must write.
|
|
47
|
+
*/
|
|
48
|
+
function syncCarouselArgs(carousel: HTMLElement, args: StoryArgs): void {
|
|
49
|
+
carousel.setAttribute('allow-scroll-wheel', args.allowScrollWheel ? 'true' : 'false');
|
|
50
|
+
carousel.setAttribute('allow-long-swipes', args.allowLongSwipes ? 'true' : 'false');
|
|
51
|
+
}
|
|
52
|
+
|
|
41
53
|
/** Shared body for both indicator variants — only the indicator tag differs. */
|
|
42
54
|
abstract class CarouselWebStoryBase extends StoryElement {
|
|
43
55
|
private _carousel: HTMLElement | null = null;
|
|
@@ -49,8 +61,7 @@ abstract class CarouselWebStoryBase extends StoryElement {
|
|
|
49
61
|
const carousel = document.createElement('adw-carousel');
|
|
50
62
|
carousel.id = `adw-carousel-${nextCarouselId++}`;
|
|
51
63
|
carousel.style.cssText = 'width:480px;height:280px;';
|
|
52
|
-
carousel
|
|
53
|
-
carousel.toggleAttribute('allow-long-swipes', this.args.allowLongSwipes as boolean);
|
|
64
|
+
syncCarouselArgs(carousel, this.args);
|
|
54
65
|
for (const page of PAGES) {
|
|
55
66
|
carousel.appendChild(buildPage(page.title, page.accent));
|
|
56
67
|
}
|
|
@@ -68,8 +79,7 @@ abstract class CarouselWebStoryBase extends StoryElement {
|
|
|
68
79
|
|
|
69
80
|
updateArgs(_args: StoryArgs): void {
|
|
70
81
|
if (!this._carousel) return;
|
|
71
|
-
this._carousel
|
|
72
|
-
this._carousel.toggleAttribute('allow-long-swipes', this.args.allowLongSwipes as boolean);
|
|
82
|
+
syncCarouselArgs(this._carousel, this.args);
|
|
73
83
|
}
|
|
74
84
|
}
|
|
75
85
|
|