@gjsify/example-gtk-adwaita-storybook 0.47.0 → 0.49.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.
@@ -16,7 +16,7 @@ export class MenuButtonWebStory extends StoryElement {
16
16
 
17
17
  initialize(): void {
18
18
  this._widget = document.createElement('gtk-menu-button');
19
- this._widget.setAttribute('menu', JSON.stringify(MENU_BUTTON_ITEMS.map((label) => ({ label }))));
19
+ this._widget.setAttribute('menu-model', JSON.stringify(MENU_BUTTON_ITEMS.map((label) => ({ label }))));
20
20
  this._apply();
21
21
  this.addContent(this._widget);
22
22
  }
@@ -23,7 +23,7 @@ function iconBaseName(symbolic: string): string {
23
23
  /** Build an <adw-split-button> from the current story args. */
24
24
  function splitButton(args: StoryArgs, opts: { flat?: boolean } = {}): HTMLElement {
25
25
  const el = document.createElement('adw-split-button');
26
- el.setAttribute('menu', MENU);
26
+ el.setAttribute('menu-model', MENU);
27
27
  el.setAttribute('label', args.label as string);
28
28
  const iconName = args.iconName as string;
29
29
  if (iconName) el.setAttribute('icon-name', iconBaseName(iconName));
@@ -16,7 +16,7 @@ export class DropDownWebStory extends StoryElement {
16
16
 
17
17
  initialize(): void {
18
18
  this._dropDown = document.createElement('gtk-drop-down');
19
- this._dropDown.setAttribute('options', JSON.stringify(DROP_DOWN_OPTIONS));
19
+ this._dropDown.setAttribute('model', JSON.stringify(DROP_DOWN_OPTIONS));
20
20
  this._apply();
21
21
  this.addContent(this._dropDown);
22
22
  }
@@ -39,7 +39,7 @@ export class PreferencesDialogWebStory extends StoryElement {
39
39
  // Accent colour — a combo row over the same five options.
40
40
  const accent = document.createElement('adw-combo-row');
41
41
  accent.setAttribute('title', 'Accent colour');
42
- accent.setAttribute('items', JSON.stringify(['Blue', 'Teal', 'Green', 'Orange', 'Purple']));
42
+ accent.setAttribute('model', JSON.stringify(['Blue', 'Teal', 'Green', 'Orange', 'Purple']));
43
43
  accent.setAttribute('selected', '0');
44
44
  group.append(accent);
45
45
 
@@ -3,7 +3,7 @@
3
3
  import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
4
4
  import { wrapBoxMeta } from '../../layout/wrap-box.meta.js';
5
5
 
6
- const TAGS = ['Design', 'Adwaita', 'GNOME', 'GTK', 'Typescript', 'Storybook', 'Wrapping', 'Layout'];
6
+ const TAGS = ['Design', 'Adwaita', 'GNOME', 'GTK', 'TypeScript', 'Storybook', 'Wrapping', 'Layout'];
7
7
 
8
8
  export class WrapBoxWebStory extends StoryElement {
9
9
  private _wrap: HTMLElement | null = null;
@@ -58,8 +58,8 @@ export class OverviewWidgetsWebStory extends StoryElement {
58
58
  }),
59
59
  el('adw-combo-row', {
60
60
  title: OVERVIEW_TEXT.accentColor,
61
- // `items` is JSON, not a comma list — the element parses it.
62
- items: JSON.stringify([...OVERVIEW_ACCENT_OPTIONS]),
61
+ // `model` is JSON, not a comma list — the element parses it.
62
+ model: JSON.stringify([...OVERVIEW_ACCENT_OPTIONS]),
63
63
  selected: '0',
64
64
  }),
65
65
  );
@@ -16,7 +16,7 @@ export class ComboRowWebStory extends StoryElement {
16
16
 
17
17
  initialize(): void {
18
18
  this._row = document.createElement('adw-combo-row');
19
- this._row.setAttribute('items', JSON.stringify([...COMBO_ROW_OPTIONS]));
19
+ this._row.setAttribute('model', JSON.stringify([...COMBO_ROW_OPTIONS]));
20
20
  this._syncRow();
21
21
 
22
22
  const group = document.createElement('adw-preferences-group');
@@ -41,7 +41,7 @@ export class PreferencesGroupWebStory extends StoryElement {
41
41
 
42
42
  const regionRow = document.createElement('adw-combo-row');
43
43
  regionRow.setAttribute('title', 'Region');
44
- regionRow.setAttribute('items', JSON.stringify(REGION_OPTIONS));
44
+ regionRow.setAttribute('model', JSON.stringify(REGION_OPTIONS));
45
45
  regionRow.setAttribute('selected', '0');
46
46
  this._group.append(regionRow);
47
47
 
@@ -16,8 +16,6 @@ export class SpinRowWebStory extends StoryElement {
16
16
 
17
17
  initialize(): void {
18
18
  this._row = document.createElement('adw-spin-row');
19
- this._row.setAttribute('min', '0');
20
- this._row.setAttribute('max', '100');
21
19
  this._syncRow();
22
20
 
23
21
  const group = document.createElement('adw-preferences-group');
@@ -37,9 +35,16 @@ export class SpinRowWebStory extends StoryElement {
37
35
  private _syncRow(): void {
38
36
  if (!this._row) return;
39
37
  this._row.setAttribute('title', this.args.title as string);
40
- // Mirror Adw.SpinRow.digits via the step's decimal precision.
38
+ // The WHOLE adjustment every time, so the reflected attribute stays true to the
39
+ // state rather than naming the one field that last moved. It is the same value the
40
+ // GTK story hands `new Gtk.Adjustment` (ADR 0047), written the same way on all
41
+ // three renderers — except `digits`, which this element does not have and mirrors
42
+ // through the step's decimal precision instead.
41
43
  const digits = this.args.digits as number;
42
- this._row.setAttribute('step', String(10 ** -digits));
44
+ this._row.setAttribute(
45
+ 'adjustment',
46
+ JSON.stringify({ lower: 0, upper: 100, pageIncrement: 10, stepIncrement: 10 ** -digits }),
47
+ );
43
48
  this._row.setAttribute('value', String(this.args.value as number));
44
49
  }
45
50
  }
@@ -30,7 +30,7 @@ export class WrapBoxStory extends StoryWidget {
30
30
  widthRequest: 460,
31
31
  });
32
32
 
33
- const tags = ['Design', 'Adwaita', 'GNOME', 'GTK', 'Typescript', 'Storybook', 'Wrapping', 'Layout'];
33
+ const tags = ['Design', 'Adwaita', 'GNOME', 'GTK', 'TypeScript', 'Storybook', 'Wrapping', 'Layout'];
34
34
  for (const tag of tags) {
35
35
  const chip = new Gtk.Button({ label: tag });
36
36
  chip.add_css_class('pill');