@gjsify/example-gtk-adwaita-storybook 0.64.1 → 0.64.2-next.253

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.64.1",
3
+ "version": "0.64.2-next.253",
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": "5.4.0",
55
55
  "@girs/gobject-2.0": "5.4.0",
56
56
  "@girs/gtk-4.0": "5.4.0",
57
- "@gjsify/adwaita-web": "^0.64.1",
58
- "@gjsify/cli": "^0.64.1",
57
+ "@gjsify/adwaita-web": "0.64.2-next.253",
58
+ "@gjsify/cli": "0.64.2-next.253",
59
59
  "@gjsify/node-gi": "file:../../../packages/node-gi/node-gi",
60
- "@gjsify/storybook": "^0.64.1",
61
- "@gjsify/adwaita-storybook": "^0.64.1",
60
+ "@gjsify/storybook": "0.64.2-next.253",
61
+ "@gjsify/adwaita-storybook": "0.64.2-next.253",
62
62
  "@types/node": "^25.9.2",
63
63
  "typescript": "^6.0.3"
64
64
  },
@@ -72,5 +72,6 @@
72
72
  "bugs": {
73
73
  "url": "https://github.com/gjsify/gjsify/issues"
74
74
  },
75
- "homepage": "https://github.com/gjsify/gjsify/tree/main/showcases/gtk/adwaita-storybook#readme"
75
+ "homepage": "https://github.com/gjsify/gjsify/tree/main/showcases/gtk/adwaita-storybook#readme",
76
+ "gitHead": "84c860498d8dd191285353b116e60aa90d71776c"
76
77
  }
@@ -38,10 +38,10 @@ export class AlertDialogWebStory extends StoryElement {
38
38
  /** Build + present a fresh dialog, reading the latest args (as the GTK story does). */
39
39
  private _present(): void {
40
40
  const dialog = document.createElement('adw-alert-dialog') as HTMLElement & {
41
- addResponse(id: string, label: string): void;
42
- setResponseAppearance(id: string, appearance: 'default' | 'suggested' | 'destructive'): void;
43
- setDefaultResponse(id: string | null): void;
44
- setCloseResponse(id: string): void;
41
+ add_response(id: string, label: string): void;
42
+ set_response_appearance(id: string, appearance: 'default' | 'suggested' | 'destructive'): void;
43
+ set_default_response(id: string | null): void;
44
+ set_close_response(id: string): void;
45
45
  present(): void;
46
46
  };
47
47
  dialog.setAttribute('heading', this.args.heading as string);
@@ -51,11 +51,11 @@ export class AlertDialogWebStory extends StoryElement {
51
51
  // it to the document before driving the imperative API.
52
52
  document.body.appendChild(dialog);
53
53
 
54
- dialog.addResponse('cancel', 'Cancel');
55
- dialog.addResponse('delete', 'Delete');
56
- dialog.setResponseAppearance('delete', 'destructive');
57
- dialog.setDefaultResponse('cancel');
58
- dialog.setCloseResponse('cancel');
54
+ dialog.add_response('cancel', 'Cancel');
55
+ dialog.add_response('delete', 'Delete');
56
+ dialog.set_response_appearance('delete', 'destructive');
57
+ dialog.set_default_response('cancel');
58
+ dialog.set_close_response('cancel');
59
59
 
60
60
  // Remove the dialog from the DOM once the user responds — the GTK dialog
61
61
  // is likewise destroyed on response.
@@ -1,16 +1,12 @@
1
1
  // Browser port of the Toast story. Shares metadata with toast.story.ts.
2
2
 
3
3
  import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
4
+ import { Adw } from '@gjsify/adwaita-web';
4
5
  import { toastMeta } from '../../feedback/toast.meta.js';
5
6
 
6
- /** The <adw-toast-overlay> exposes addToast(title, opts) — see @gjsify/adwaita-web. */
7
- interface ToastOverlayElement extends HTMLElement {
8
- addToast(title: string, options?: { timeout?: number; buttonLabel?: string; onAction?: () => void }): void;
9
- }
10
-
11
7
  /** Story: an Adw.Toast presented through an adw-toast-overlay on button press. */
12
8
  export class ToastWebStory extends StoryElement {
13
- private _overlay: ToastOverlayElement | null = null;
9
+ private _overlay: Adw.ToastOverlay | null = null;
14
10
 
15
11
  constructor() {
16
12
  super(ToastWebStory.getMetadata(), 'Default');
@@ -21,7 +17,7 @@ export class ToastWebStory extends StoryElement {
21
17
  }
22
18
 
23
19
  initialize(): void {
24
- this._overlay = document.createElement('adw-toast-overlay') as ToastOverlayElement;
20
+ this._overlay = document.createElement('adw-toast-overlay') as Adw.ToastOverlay;
25
21
  // Match the native story's fixed 360×220 viewport so the toast has a
26
22
  // bounded overlay area to float over.
27
23
  this._overlay.style.width = '360px';
@@ -47,11 +43,17 @@ export class ToastWebStory extends StoryElement {
47
43
 
48
44
  private _showToast(): void {
49
45
  if (!this._overlay) return;
50
- const hasButton = this.args.hasButton as boolean;
51
- this._overlay.addToast(this.args.title as string, {
46
+
47
+ const toast = new Adw.Toast({
48
+ title: this.args.title as string,
52
49
  timeout: this.args.timeout as number,
53
- buttonLabel: hasButton ? (this.args.buttonLabel as string) : undefined,
54
50
  });
51
+
52
+ if (this.args.hasButton as boolean) {
53
+ toast.buttonLabel = this.args.buttonLabel as string;
54
+ }
55
+
56
+ this._overlay.add_toast(toast);
55
57
  }
56
58
 
57
59
  updateArgs(_args: StoryArgs): void {