@gjsify/example-gtk-adwaita-storybook 0.19.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 +120 -0
- package/dist/adw-runasync.mjs +1 -0
- package/dist/gjs.js +91 -0
- package/dist/interact-probe.node.mjs +87 -0
- package/dist/probe.node.mjs +87 -0
- package/dist/render-probe.node.mjs +87 -0
- package/dist/runasync-probe.mjs +1 -0
- package/dist/storybook.node.mjs +87 -0
- package/package.json +64 -0
- package/src/browser/buttons/button-content.web.ts +55 -0
- package/src/browser/buttons/button-styles.web.ts +79 -0
- package/src/browser/buttons/split-button.web.ts +86 -0
- package/src/browser/buttons/toggle-group.web.ts +56 -0
- package/src/browser/embed.ts +46 -0
- package/src/browser/feedback/about-dialog.web.ts +82 -0
- package/src/browser/feedback/alert-dialog.web.ts +72 -0
- package/src/browser/feedback/preferences-dialog.web.ts +106 -0
- package/src/browser/feedback/toast.web.ts +62 -0
- package/src/browser/index.html +23 -0
- package/src/browser/layout/clamp.web.ts +45 -0
- package/src/browser/layout/header-bar.web.ts +56 -0
- package/src/browser/layout/toolbar-view.web.ts +95 -0
- package/src/browser/layout/wrap-box.web.ts +45 -0
- package/src/browser/main.ts +14 -0
- package/src/browser/navigation/bottom-sheet.web.ts +119 -0
- package/src/browser/navigation/navigation-split-view.web.ts +99 -0
- package/src/browser/navigation/navigation-view.web.ts +104 -0
- package/src/browser/navigation/overlay-split-view.web.ts +106 -0
- package/src/browser/navigation/sidebar.web.ts +84 -0
- package/src/browser/presentation/avatar.web.ts +36 -0
- package/src/browser/presentation/banner.web.ts +41 -0
- package/src/browser/presentation/spinner.web.ts +28 -0
- package/src/browser/presentation/status-page.web.ts +43 -0
- package/src/browser/presentation/window-title.web.ts +34 -0
- package/src/browser/rows/action-row.web.ts +61 -0
- package/src/browser/rows/button-row.web.ts +64 -0
- package/src/browser/rows/combo-row.web.ts +44 -0
- package/src/browser/rows/entry-row.web.ts +42 -0
- package/src/browser/rows/expander-row.web.ts +53 -0
- package/src/browser/rows/password-entry-row.web.ts +43 -0
- package/src/browser/rows/preferences-group.web.ts +68 -0
- package/src/browser/rows/spin-row.web.ts +47 -0
- package/src/browser/rows/switch-row.web.ts +43 -0
- package/src/browser/stories.ts +82 -0
- package/src/browser/view-switching/carousel.web.ts +106 -0
- package/src/browser/view-switching/inline-view-switcher.web.ts +55 -0
- package/src/browser/view-switching/tab-view.web.ts +64 -0
- package/src/browser/view-switching/view-switcher.web.ts +55 -0
- package/src/buttons/button-content.meta.ts +26 -0
- package/src/buttons/button-content.story.ts +49 -0
- package/src/buttons/button-styles.meta.ts +26 -0
- package/src/buttons/button-styles.story.ts +77 -0
- package/src/buttons/split-button.meta.ts +45 -0
- package/src/buttons/split-button.story.ts +102 -0
- package/src/buttons/toggle-group.meta.ts +34 -0
- package/src/buttons/toggle-group.story.ts +56 -0
- package/src/feedback/about-dialog.meta.ts +13 -0
- package/src/feedback/about-dialog.story.ts +64 -0
- package/src/feedback/alert-dialog.meta.ts +19 -0
- package/src/feedback/alert-dialog.story.ts +61 -0
- package/src/feedback/preferences-dialog.meta.ts +13 -0
- package/src/feedback/preferences-dialog.story.ts +92 -0
- package/src/feedback/toast.meta.ts +23 -0
- package/src/feedback/toast.story.ts +66 -0
- package/src/layout/clamp.meta.ts +29 -0
- package/src/layout/clamp.story.ts +59 -0
- package/src/layout/header-bar.meta.ts +14 -0
- package/src/layout/header-bar.story.ts +66 -0
- package/src/layout/toolbar-view.meta.ts +18 -0
- package/src/layout/toolbar-view.story.ts +71 -0
- package/src/layout/wrap-box.meta.ts +29 -0
- package/src/layout/wrap-box.story.ts +52 -0
- package/src/metas.ts +41 -0
- package/src/navigation/bottom-sheet.meta.ts +13 -0
- package/src/navigation/bottom-sheet.story.ts +90 -0
- package/src/navigation/navigation-split-view.meta.ts +13 -0
- package/src/navigation/navigation-split-view.story.ts +83 -0
- package/src/navigation/navigation-view.meta.ts +19 -0
- package/src/navigation/navigation-view.story.ts +77 -0
- package/src/navigation/overlay-split-view.meta.ts +13 -0
- package/src/navigation/overlay-split-view.story.ts +82 -0
- package/src/navigation/sidebar.meta.ts +30 -0
- package/src/navigation/sidebar.story.ts +85 -0
- package/src/presentation/avatar.meta.ts +24 -0
- package/src/presentation/avatar.story.ts +46 -0
- package/src/presentation/banner.meta.ts +19 -0
- package/src/presentation/banner.story.ts +53 -0
- package/src/presentation/spinner.meta.ts +9 -0
- package/src/presentation/spinner.story.ts +47 -0
- package/src/presentation/status-page.meta.ts +29 -0
- package/src/presentation/status-page.story.ts +55 -0
- package/src/presentation/window-title.meta.ts +12 -0
- package/src/presentation/window-title.story.ts +42 -0
- package/src/rows/action-row.meta.ts +30 -0
- package/src/rows/action-row.story.ts +62 -0
- package/src/rows/button-row.meta.ts +34 -0
- package/src/rows/button-row.story.ts +61 -0
- package/src/rows/combo-row.meta.ts +29 -0
- package/src/rows/combo-row.story.ts +51 -0
- package/src/rows/entry-row.meta.ts +13 -0
- package/src/rows/entry-row.story.ts +49 -0
- package/src/rows/expander-row.meta.ts +25 -0
- package/src/rows/expander-row.story.ts +54 -0
- package/src/rows/password-entry-row.meta.ts +12 -0
- package/src/rows/password-entry-row.story.ts +47 -0
- package/src/rows/preferences-group.meta.ts +18 -0
- package/src/rows/preferences-group.story.ts +67 -0
- package/src/rows/spin-row.meta.ts +29 -0
- package/src/rows/spin-row.story.ts +56 -0
- package/src/rows/switch-row.meta.ts +18 -0
- package/src/rows/switch-row.story.ts +49 -0
- package/src/view-switching/carousel.meta.ts +35 -0
- package/src/view-switching/carousel.story.ts +131 -0
- package/src/view-switching/inline-view-switcher.meta.ts +25 -0
- package/src/view-switching/inline-view-switcher.story.ts +88 -0
- package/src/view-switching/tab-view.meta.ts +12 -0
- package/src/view-switching/tab-view.story.ts +72 -0
- package/src/view-switching/view-switcher.meta.ts +23 -0
- package/src/view-switching/view-switcher.story.ts +87 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Browser port of the Overlay Split View story. Shares metadata with
|
|
2
|
+
// overlay-split-view.story.ts.
|
|
3
|
+
|
|
4
|
+
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
5
|
+
import { overlaySplitViewMeta } from '../../navigation/overlay-split-view.meta.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Sidebar rows — title plus the symbolic icon shown as the row prefix. Icon
|
|
9
|
+
* names mirror the native story's GTK names 1:1 (the `-symbolic` suffix is
|
|
10
|
+
* dropped to form the adwaita-web mask class, as elsewhere in the browser port).
|
|
11
|
+
*/
|
|
12
|
+
const SIDEBAR_ROWS: ReadonlyArray<readonly [string, string]> = [
|
|
13
|
+
['Home', 'go-home'],
|
|
14
|
+
['Discover', 'system-search'],
|
|
15
|
+
['Library', 'folder-music'],
|
|
16
|
+
['Settings', 'emblem-system'],
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export class OverlaySplitViewWebStory extends StoryElement {
|
|
20
|
+
private _view: HTMLElement | null = null;
|
|
21
|
+
|
|
22
|
+
constructor() {
|
|
23
|
+
super(OverlaySplitViewWebStory.getMetadata(), 'Default');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static getMetadata(): StoryMeta {
|
|
27
|
+
return overlaySplitViewMeta;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private buildSidebar(): HTMLElement {
|
|
31
|
+
// A boxed list of activatable rows, each with a leading symbolic icon —
|
|
32
|
+
// the equivalent of the native story's Adw.PreferencesGroup of ActionRows.
|
|
33
|
+
const group = document.createElement('adw-preferences-group');
|
|
34
|
+
for (const [title, icon] of SIDEBAR_ROWS) {
|
|
35
|
+
const row = document.createElement('adw-action-row');
|
|
36
|
+
row.setAttribute('title', title);
|
|
37
|
+
row.setAttribute('activatable', '');
|
|
38
|
+
|
|
39
|
+
const iconEl = document.createElement('span');
|
|
40
|
+
iconEl.setAttribute('slot', 'prefix');
|
|
41
|
+
iconEl.className = `adw-icon adw-icon--${icon}`;
|
|
42
|
+
row.appendChild(iconEl);
|
|
43
|
+
|
|
44
|
+
group.appendChild(row);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Toolbar view with a title-less header bar, framing the boxed list.
|
|
48
|
+
// `sidebar` styling mirrors the native add_css_class('sidebar').
|
|
49
|
+
const toolbarView = document.createElement('adw-toolbar-view');
|
|
50
|
+
toolbarView.classList.add('sidebar');
|
|
51
|
+
|
|
52
|
+
const header = document.createElement('adw-header-bar');
|
|
53
|
+
header.setAttribute('slot', 'top');
|
|
54
|
+
toolbarView.appendChild(header);
|
|
55
|
+
toolbarView.appendChild(group);
|
|
56
|
+
|
|
57
|
+
return toolbarView;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private buildContent(): HTMLElement {
|
|
61
|
+
const status = document.createElement('adw-status-page');
|
|
62
|
+
status.setAttribute('icon', 'folder-music');
|
|
63
|
+
status.setAttribute('title', 'Your Library');
|
|
64
|
+
status.setAttribute(
|
|
65
|
+
'description',
|
|
66
|
+
'Toggle the sidebar to browse sections. Collapse it to overlay the content.',
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const toolbarView = document.createElement('adw-toolbar-view');
|
|
70
|
+
const header = document.createElement('adw-header-bar');
|
|
71
|
+
header.setAttribute('slot', 'top');
|
|
72
|
+
toolbarView.appendChild(header);
|
|
73
|
+
toolbarView.appendChild(status);
|
|
74
|
+
|
|
75
|
+
return toolbarView;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
initialize(): void {
|
|
79
|
+
this._view = document.createElement('adw-overlay-split-view');
|
|
80
|
+
this._view.style.width = '480px';
|
|
81
|
+
this._view.style.height = '340px';
|
|
82
|
+
|
|
83
|
+
const sidebar = this.buildSidebar();
|
|
84
|
+
sidebar.setAttribute('slot', 'sidebar');
|
|
85
|
+
|
|
86
|
+
const content = this.buildContent();
|
|
87
|
+
content.setAttribute('slot', 'content');
|
|
88
|
+
|
|
89
|
+
this._view.append(sidebar, content);
|
|
90
|
+
|
|
91
|
+
this._sync();
|
|
92
|
+
this.addContent(this._view);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
updateArgs(_args: StoryArgs): void {
|
|
96
|
+
this._sync();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private _sync(): void {
|
|
100
|
+
if (!this._view) return;
|
|
101
|
+
this._view.toggleAttribute('show-sidebar', this.args.showSidebar as boolean);
|
|
102
|
+
this._view.toggleAttribute('collapsed', this.args.collapsed as boolean);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const OverlaySplitViewWebStories: WebStoryModule = { stories: [OverlaySplitViewWebStory] };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Browser port of the Sidebar story. Shares metadata with sidebar.story.ts.
|
|
2
|
+
|
|
3
|
+
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
4
|
+
import { sidebarMeta } from '../../navigation/sidebar.meta.js';
|
|
5
|
+
|
|
6
|
+
export class SidebarWebStory extends StoryElement {
|
|
7
|
+
private _sidebar: HTMLElement | null = null;
|
|
8
|
+
private _status: HTMLElement | null = null;
|
|
9
|
+
|
|
10
|
+
private readonly items: readonly { title: string; subtitle: string; icon: string }[] = [
|
|
11
|
+
{ title: 'Inbox', subtitle: '3 unread', icon: 'mail-unread-symbolic' },
|
|
12
|
+
{ title: 'Starred', subtitle: 'Favourites', icon: 'starred-symbolic' },
|
|
13
|
+
{ title: 'Sent', subtitle: 'Outgoing mail', icon: 'mail-send-symbolic' },
|
|
14
|
+
{ title: 'Archive', subtitle: 'Older mail', icon: 'folder-symbolic' },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
constructor() {
|
|
18
|
+
super(SidebarWebStory.getMetadata(), 'Default');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static getMetadata(): StoryMeta {
|
|
22
|
+
return sidebarMeta;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
initialize(): void {
|
|
26
|
+
const section = document.createElement('adw-sidebar-section');
|
|
27
|
+
section.setAttribute('title', 'Mailboxes');
|
|
28
|
+
for (const entry of this.items) {
|
|
29
|
+
const item = document.createElement('adw-sidebar-item');
|
|
30
|
+
item.setAttribute('title', entry.title);
|
|
31
|
+
item.setAttribute('subtitle', entry.subtitle);
|
|
32
|
+
item.setAttribute('icon-name', entry.icon);
|
|
33
|
+
section.append(item);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
this._sidebar = document.createElement('adw-sidebar');
|
|
37
|
+
this._sidebar.setAttribute('mode', this.args.mode as string);
|
|
38
|
+
this._sidebar.setAttribute('selected', String(this.args.selected as number));
|
|
39
|
+
this._sidebar.style.width = '220px';
|
|
40
|
+
this._sidebar.append(section);
|
|
41
|
+
this._sidebar.addEventListener('notify::selected', () => this._syncContent());
|
|
42
|
+
|
|
43
|
+
this._status = document.createElement('adw-status-page');
|
|
44
|
+
this._status.style.flex = '1 1 auto';
|
|
45
|
+
|
|
46
|
+
const box = document.createElement('div');
|
|
47
|
+
box.style.display = 'flex';
|
|
48
|
+
box.style.width = '480px';
|
|
49
|
+
box.style.height = '340px';
|
|
50
|
+
box.style.border = '1px solid var(--card-shade-color)';
|
|
51
|
+
box.style.borderRadius = 'var(--card-radius, 12px)';
|
|
52
|
+
box.style.overflow = 'hidden';
|
|
53
|
+
|
|
54
|
+
const separator = document.createElement('div');
|
|
55
|
+
separator.style.width = '1px';
|
|
56
|
+
separator.style.alignSelf = 'stretch';
|
|
57
|
+
separator.style.backgroundColor = 'var(--separator-color, var(--card-shade-color))';
|
|
58
|
+
|
|
59
|
+
box.append(this._sidebar, separator, this._status);
|
|
60
|
+
|
|
61
|
+
this._syncContent();
|
|
62
|
+
this.addContent(box);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
updateArgs(_args: StoryArgs): void {
|
|
66
|
+
if (!this._sidebar) return;
|
|
67
|
+
this._sidebar.setAttribute('mode', this.args.mode as string);
|
|
68
|
+
this._sidebar.setAttribute('selected', String(this.args.selected as number));
|
|
69
|
+
this._syncContent();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private _syncContent(): void {
|
|
73
|
+
if (!this._sidebar || !this._status) return;
|
|
74
|
+
const selected = Number((this._sidebar as unknown as { selected: number }).selected);
|
|
75
|
+
const item = this.items[selected] ?? this.items[0];
|
|
76
|
+
this._status.setAttribute('title', item.title);
|
|
77
|
+
// adw-status-page's `icon` attribute is a plain symbolic name (it strips
|
|
78
|
+
// -symbolic and builds the adw-icon class itself).
|
|
79
|
+
this._status.setAttribute('icon', item.icon.replace(/-symbolic$/, ''));
|
|
80
|
+
this._status.setAttribute('description', item.subtitle);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const SidebarWebStories: WebStoryModule = { stories: [SidebarWebStory] };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Browser port of the Avatar story. Shares metadata with avatar.story.ts.
|
|
2
|
+
|
|
3
|
+
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
4
|
+
import { avatarMeta } from '../../presentation/avatar.meta.js';
|
|
5
|
+
|
|
6
|
+
export class AvatarWebStory extends StoryElement {
|
|
7
|
+
private _avatar: HTMLElement | null = null;
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
super(AvatarWebStory.getMetadata(), 'Default');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static getMetadata(): StoryMeta {
|
|
14
|
+
return avatarMeta;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
initialize(): void {
|
|
18
|
+
this._avatar = document.createElement('adw-avatar');
|
|
19
|
+
this._sync();
|
|
20
|
+
this.addContent(this._avatar);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
updateArgs(_args: StoryArgs): void {
|
|
24
|
+
this._sync();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private _sync(): void {
|
|
28
|
+
if (!this._avatar) return;
|
|
29
|
+
this._avatar.setAttribute('text', this.args.text as string);
|
|
30
|
+
this._avatar.setAttribute('size', String(this.args.size as number));
|
|
31
|
+
this._avatar.toggleAttribute('show-initials', this.args.showInitials as boolean);
|
|
32
|
+
this._avatar.setAttribute('icon', (this.args.iconName as string).replace(/-symbolic$/, ''));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const AvatarWebStories: WebStoryModule = { stories: [AvatarWebStory] };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Browser port of the Banner story. Shares metadata with banner.story.ts.
|
|
2
|
+
|
|
3
|
+
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
4
|
+
import { bannerMeta } from '../../presentation/banner.meta.js';
|
|
5
|
+
|
|
6
|
+
export class BannerWebStory extends StoryElement {
|
|
7
|
+
private _banner: HTMLElement | null = null;
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
super(BannerWebStory.getMetadata(), 'Default');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static getMetadata(): StoryMeta {
|
|
14
|
+
return bannerMeta;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
initialize(): void {
|
|
18
|
+
this._banner = document.createElement('adw-banner');
|
|
19
|
+
this._sync();
|
|
20
|
+
|
|
21
|
+
// The native story shows the banner full-width inside a sized container.
|
|
22
|
+
const container = document.createElement('div');
|
|
23
|
+
container.style.cssText = 'width:460px;max-width:100%;';
|
|
24
|
+
container.append(this._banner);
|
|
25
|
+
this.addContent(container);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
updateArgs(_args: StoryArgs): void {
|
|
29
|
+
this._sync();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private _sync(): void {
|
|
33
|
+
if (!this._banner) return;
|
|
34
|
+
this._banner.setAttribute('title', this.args.title as string);
|
|
35
|
+
this._banner.setAttribute('button-label', this.args.buttonLabel as string);
|
|
36
|
+
this._banner.toggleAttribute('revealed', this.args.revealed as boolean);
|
|
37
|
+
this._banner.toggleAttribute('use-markup', this.args.useMarkup as boolean);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const BannerWebStories: WebStoryModule = { stories: [BannerWebStory] };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Browser port of the Spinner story. Shares metadata with spinner.story.ts.
|
|
2
|
+
|
|
3
|
+
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
4
|
+
import { spinnerMeta } from '../../presentation/spinner.meta.js';
|
|
5
|
+
|
|
6
|
+
export class SpinnerWebStory extends StoryElement {
|
|
7
|
+
private _spinner: HTMLElement | null = null;
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
super(SpinnerWebStory.getMetadata(), 'Default');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static getMetadata(): StoryMeta {
|
|
14
|
+
return spinnerMeta;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
initialize(): void {
|
|
18
|
+
this._spinner = document.createElement('adw-spinner');
|
|
19
|
+
this._spinner.setAttribute('size', String(this.args.size as number));
|
|
20
|
+
this.addContent(this._spinner);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
updateArgs(_args: StoryArgs): void {
|
|
24
|
+
if (this._spinner) this._spinner.setAttribute('size', String(this.args.size as number));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const SpinnerWebStories: WebStoryModule = { stories: [SpinnerWebStory] };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Browser port of the Status Page story. Shares metadata with status-page.story.ts.
|
|
2
|
+
|
|
3
|
+
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
4
|
+
import { statusPageMeta } from '../../presentation/status-page.meta.js';
|
|
5
|
+
|
|
6
|
+
export class StatusPageWebStory extends StoryElement {
|
|
7
|
+
private _page: HTMLElement | null = null;
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
super(StatusPageWebStory.getMetadata(), 'Default');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static getMetadata(): StoryMeta {
|
|
14
|
+
return statusPageMeta;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
initialize(): void {
|
|
18
|
+
this._page = document.createElement('adw-status-page');
|
|
19
|
+
|
|
20
|
+
// Suggested-action pill button, matching the native story's child.
|
|
21
|
+
const button = document.createElement('adw-button');
|
|
22
|
+
button.setAttribute('label', 'New Document');
|
|
23
|
+
button.setAttribute('pill', '');
|
|
24
|
+
button.setAttribute('suggested', '');
|
|
25
|
+
this._page.appendChild(button);
|
|
26
|
+
|
|
27
|
+
this._sync();
|
|
28
|
+
this.addContent(this._page);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
updateArgs(_args: StoryArgs): void {
|
|
32
|
+
this._sync();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private _sync(): void {
|
|
36
|
+
if (!this._page) return;
|
|
37
|
+
this._page.setAttribute('icon', (this.args.iconName as string).replace(/-symbolic$/, ''));
|
|
38
|
+
this._page.setAttribute('title', this.args.title as string);
|
|
39
|
+
this._page.setAttribute('description', this.args.description as string);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const StatusPageWebStories: WebStoryModule = { stories: [StatusPageWebStory] };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Browser port of the Window Title story. Shares metadata with window-title.story.ts.
|
|
2
|
+
|
|
3
|
+
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
4
|
+
import { windowTitleMeta } from '../../presentation/window-title.meta.js';
|
|
5
|
+
|
|
6
|
+
export class WindowTitleWebStory extends StoryElement {
|
|
7
|
+
private _windowTitle: HTMLElement | null = null;
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
super(WindowTitleWebStory.getMetadata(), 'Default');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static getMetadata(): StoryMeta {
|
|
14
|
+
return windowTitleMeta;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
initialize(): void {
|
|
18
|
+
this._windowTitle = document.createElement('adw-window-title');
|
|
19
|
+
this._sync();
|
|
20
|
+
this.addContent(this._windowTitle);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
updateArgs(_args: StoryArgs): void {
|
|
24
|
+
this._sync();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private _sync(): void {
|
|
28
|
+
if (!this._windowTitle) return;
|
|
29
|
+
this._windowTitle.setAttribute('title', this.args.title as string);
|
|
30
|
+
this._windowTitle.setAttribute('subtitle', this.args.subtitle as string);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const WindowTitleWebStories: WebStoryModule = { stories: [WindowTitleWebStory] };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Browser port of the Action Row story. Shares metadata with action-row.story.ts.
|
|
2
|
+
|
|
3
|
+
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
4
|
+
import { actionRowMeta } from '../../rows/action-row.meta.js';
|
|
5
|
+
|
|
6
|
+
/** GTK symbolic name (e.g. "folder-symbolic") → adwaita-web icon class. */
|
|
7
|
+
function iconClass(gtkName: string): string {
|
|
8
|
+
return `adw-icon adw-icon--${gtkName.replace(/-symbolic$/, '')}`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class ActionRowWebStory extends StoryElement {
|
|
12
|
+
private _row: HTMLElement | null = null;
|
|
13
|
+
private _icon: HTMLElement | null = null;
|
|
14
|
+
|
|
15
|
+
constructor() {
|
|
16
|
+
super(ActionRowWebStory.getMetadata(), 'Default');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static getMetadata(): StoryMeta {
|
|
20
|
+
return actionRowMeta;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
initialize(): void {
|
|
24
|
+
this._row = document.createElement('adw-action-row');
|
|
25
|
+
|
|
26
|
+
this._icon = document.createElement('span');
|
|
27
|
+
this._icon.setAttribute('slot', 'prefix');
|
|
28
|
+
this._icon.className = iconClass(this.args.iconName as string);
|
|
29
|
+
|
|
30
|
+
const button = document.createElement('adw-button');
|
|
31
|
+
button.setAttribute('slot', 'suffix');
|
|
32
|
+
button.setAttribute('icon', 'go-next');
|
|
33
|
+
button.setAttribute('flat', '');
|
|
34
|
+
|
|
35
|
+
this._row.append(this._icon, button);
|
|
36
|
+
this._syncRow();
|
|
37
|
+
|
|
38
|
+
const group = document.createElement('adw-preferences-group');
|
|
39
|
+
group.append(this._row);
|
|
40
|
+
|
|
41
|
+
const clamp = document.createElement('adw-clamp');
|
|
42
|
+
clamp.setAttribute('maximum-size', '400');
|
|
43
|
+
clamp.append(group);
|
|
44
|
+
|
|
45
|
+
this.addContent(clamp);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
updateArgs(_args: StoryArgs): void {
|
|
49
|
+
this._syncRow();
|
|
50
|
+
if (this._icon) this._icon.className = iconClass(this.args.iconName as string);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private _syncRow(): void {
|
|
54
|
+
if (!this._row) return;
|
|
55
|
+
this._row.setAttribute('title', this.args.title as string);
|
|
56
|
+
this._row.setAttribute('subtitle', this.args.subtitle as string);
|
|
57
|
+
this._row.toggleAttribute('activatable', this.args.activatable as boolean);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const ActionRowWebStories: WebStoryModule = { stories: [ActionRowWebStory] };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Browser port of the Button Row story. Shares metadata with button-row.story.ts.
|
|
2
|
+
|
|
3
|
+
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
4
|
+
import { buttonRowMeta } from '../../rows/button-row.meta.js';
|
|
5
|
+
|
|
6
|
+
const STYLE_CLASSES = ['suggested-action', 'destructive-action'];
|
|
7
|
+
|
|
8
|
+
/** GTK symbolic name (e.g. "list-add-symbolic") → adwaita-web start-icon-name. */
|
|
9
|
+
function iconName(gtkName: string): string {
|
|
10
|
+
return gtkName.replace(/-symbolic$/, '');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class ButtonRowWebStory extends StoryElement {
|
|
14
|
+
private _row: HTMLElement | null = null;
|
|
15
|
+
|
|
16
|
+
constructor() {
|
|
17
|
+
super(ButtonRowWebStory.getMetadata(), 'Default');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static getMetadata(): StoryMeta {
|
|
21
|
+
return buttonRowMeta;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
initialize(): void {
|
|
25
|
+
this._row = document.createElement('adw-button-row');
|
|
26
|
+
this._syncRow();
|
|
27
|
+
|
|
28
|
+
const group = document.createElement('adw-preferences-group');
|
|
29
|
+
group.append(this._row);
|
|
30
|
+
|
|
31
|
+
const clamp = document.createElement('adw-clamp');
|
|
32
|
+
clamp.setAttribute('maximum-size', '400');
|
|
33
|
+
clamp.append(group);
|
|
34
|
+
|
|
35
|
+
this.addContent(clamp);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
updateArgs(_args: StoryArgs): void {
|
|
39
|
+
this._syncRow();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private _syncRow(): void {
|
|
43
|
+
if (!this._row) return;
|
|
44
|
+
this._row.setAttribute('title', this.args.title as string);
|
|
45
|
+
|
|
46
|
+
const icon = iconName(this.args.startIconName as string);
|
|
47
|
+
if (icon) this._row.setAttribute('start-icon-name', icon);
|
|
48
|
+
else this._row.removeAttribute('start-icon-name');
|
|
49
|
+
|
|
50
|
+
this._applyStyle(this.args.style as string);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private _applyStyle(style: string): void {
|
|
54
|
+
if (!this._row) return;
|
|
55
|
+
for (const cls of STYLE_CLASSES) {
|
|
56
|
+
this._row.classList.remove(cls);
|
|
57
|
+
}
|
|
58
|
+
if (style !== 'none') {
|
|
59
|
+
this._row.classList.add(style);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const ButtonRowWebStories: WebStoryModule = { stories: [ButtonRowWebStory] };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Browser port of the Combo Row story. Shares metadata with combo-row.story.ts.
|
|
2
|
+
|
|
3
|
+
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
4
|
+
import { COMBO_ROW_OPTIONS, comboRowMeta } from '../../rows/combo-row.meta.js';
|
|
5
|
+
|
|
6
|
+
export class ComboRowWebStory extends StoryElement {
|
|
7
|
+
private _row: HTMLElement | null = null;
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
super(ComboRowWebStory.getMetadata(), 'Default');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static getMetadata(): StoryMeta {
|
|
14
|
+
return comboRowMeta;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
initialize(): void {
|
|
18
|
+
this._row = document.createElement('adw-combo-row');
|
|
19
|
+
this._row.setAttribute('items', JSON.stringify([...COMBO_ROW_OPTIONS]));
|
|
20
|
+
this._syncRow();
|
|
21
|
+
|
|
22
|
+
const group = document.createElement('adw-preferences-group');
|
|
23
|
+
group.append(this._row);
|
|
24
|
+
|
|
25
|
+
const clamp = document.createElement('adw-clamp');
|
|
26
|
+
clamp.setAttribute('maximum-size', '400');
|
|
27
|
+
clamp.append(group);
|
|
28
|
+
|
|
29
|
+
this.addContent(clamp);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
updateArgs(_args: StoryArgs): void {
|
|
33
|
+
this._syncRow();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private _syncRow(): void {
|
|
37
|
+
if (!this._row) return;
|
|
38
|
+
this._row.setAttribute('title', this.args.title as string);
|
|
39
|
+
this._row.setAttribute('subtitle', this.args.subtitle as string);
|
|
40
|
+
this._row.setAttribute('selected', String(this.args.selected as number));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const ComboRowWebStories: WebStoryModule = { stories: [ComboRowWebStory] };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Browser port of the Entry Row story. Shares metadata with entry-row.story.ts.
|
|
2
|
+
|
|
3
|
+
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
4
|
+
import { entryRowMeta } from '../../rows/entry-row.meta.js';
|
|
5
|
+
|
|
6
|
+
export class EntryRowWebStory extends StoryElement {
|
|
7
|
+
private _row: HTMLElement | null = null;
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
super(EntryRowWebStory.getMetadata(), 'Default');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static getMetadata(): StoryMeta {
|
|
14
|
+
return entryRowMeta;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
initialize(): void {
|
|
18
|
+
this._row = document.createElement('adw-entry-row');
|
|
19
|
+
this._syncRow();
|
|
20
|
+
|
|
21
|
+
const group = document.createElement('adw-preferences-group');
|
|
22
|
+
group.append(this._row);
|
|
23
|
+
|
|
24
|
+
const clamp = document.createElement('adw-clamp');
|
|
25
|
+
clamp.setAttribute('maximum-size', '400');
|
|
26
|
+
clamp.append(group);
|
|
27
|
+
|
|
28
|
+
this.addContent(clamp);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
updateArgs(_args: StoryArgs): void {
|
|
32
|
+
this._syncRow();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private _syncRow(): void {
|
|
36
|
+
if (!this._row) return;
|
|
37
|
+
this._row.setAttribute('title', this.args.title as string);
|
|
38
|
+
this._row.setAttribute('text', this.args.text as string);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const EntryRowWebStories: WebStoryModule = { stories: [EntryRowWebStory] };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Browser port of the Expander Row story. Shares metadata with expander-row.story.ts.
|
|
2
|
+
|
|
3
|
+
import { StoryElement, type StoryArgs, type StoryMeta, type WebStoryModule } from '@gjsify/adwaita-storybook';
|
|
4
|
+
import { expanderRowMeta } from '../../rows/expander-row.meta.js';
|
|
5
|
+
|
|
6
|
+
export class ExpanderRowWebStory extends StoryElement {
|
|
7
|
+
private _row: HTMLElement | null = null;
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
super(ExpanderRowWebStory.getMetadata(), 'Default');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static getMetadata(): StoryMeta {
|
|
14
|
+
return expanderRowMeta;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
initialize(): void {
|
|
18
|
+
this._row = document.createElement('adw-expander-row');
|
|
19
|
+
|
|
20
|
+
const hostRow = document.createElement('adw-entry-row');
|
|
21
|
+
hostRow.setAttribute('title', 'Host');
|
|
22
|
+
hostRow.setAttribute('text', 'proxy.example.com');
|
|
23
|
+
|
|
24
|
+
const authRow = document.createElement('adw-switch-row');
|
|
25
|
+
authRow.setAttribute('title', 'Use authentication');
|
|
26
|
+
|
|
27
|
+
this._row.append(hostRow, authRow);
|
|
28
|
+
this._syncRow();
|
|
29
|
+
|
|
30
|
+
const group = document.createElement('adw-preferences-group');
|
|
31
|
+
group.append(this._row);
|
|
32
|
+
|
|
33
|
+
const clamp = document.createElement('adw-clamp');
|
|
34
|
+
clamp.setAttribute('maximum-size', '400');
|
|
35
|
+
clamp.append(group);
|
|
36
|
+
|
|
37
|
+
this.addContent(clamp);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
updateArgs(_args: StoryArgs): void {
|
|
41
|
+
this._syncRow();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private _syncRow(): void {
|
|
45
|
+
if (!this._row) return;
|
|
46
|
+
this._row.setAttribute('title', this.args.title as string);
|
|
47
|
+
this._row.setAttribute('subtitle', this.args.subtitle as string);
|
|
48
|
+
this._row.toggleAttribute('expanded', this.args.expanded as boolean);
|
|
49
|
+
this._row.toggleAttribute('show-enable-switch', this.args.showEnableSwitch as boolean);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const ExpanderRowWebStories: WebStoryModule = { stories: [ExpanderRowWebStory] };
|