@gjsify/example-gtk-adwaita-storybook 0.19.0 → 0.20.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/dist/gjs.js +4 -4
- package/package.json +5 -5
- package/dist/adw-runasync.mjs +0 -1
- package/dist/interact-probe.node.mjs +0 -87
- package/dist/probe.node.mjs +0 -87
- package/dist/render-probe.node.mjs +0 -87
- package/dist/runasync-probe.mjs +0 -1
- package/dist/storybook.node.mjs +0 -87
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";import"@gjsify/node-gi/globals";var t=Object.defineProperty,__name=(e,n)=>t(e,`name`,{value:n,configurable:!0}),__exportAll=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},StoryRegistry=class{constructor(){this.modules=[]}registerStory(e){if(!e||!Array.isArray(e.stories)){console.warn(`Invalid story module provided to registerStory`);return}this.modules.push(e)}registerStories(e){if(!Array.isArray(e)){console.warn(`Invalid story modules array provided to registerStories`);return}let t=e.filter(e=>e&&Array.isArray(e.stories));this.modules.push(...t)}getStories(){return[...this.modules]}createStoryInstances(){for(let e of this.modules)this.instantiateStoriesForModule(e);return[...this.modules]}instantiateStoriesForModule(e){e.instances||=[];let t=e.decorators??[];for(let n of e.stories)try{let r=new n,build=()=>{typeof r.initialize==`function`&&r.initialize()};t.reduceRight((e,t)=>()=>t(e,r),build)(),e.instances.push(r)}catch(e){console.error(`Failed to instantiate story: ${n.name||`Unknown`}`,e)}}},StorybookController=class{constructor(e,t){this._registry=new StoryRegistry,this._activeStory=null,this._unsubArgs=null,this._view=e,this._buildControls=t}mount(e,t=!0){this._registry.registerStories(e);let n=this._registry.createStoryInstances();if(this._view.renderSidebar(this._groupByCategory(n),e=>this.select(e)),t){let e=this._firstStory();e&&this.select(e)}}select(e){this._view.setPreviewTitle(`${e.meta.title} — ${e.story}`),this._view.showPreview(e),this._view.markSelected(e.meta.title),this._wireControls(e),this._activeStory=e}_wireControls(e){this._unsubArgs&&=(this._unsubArgs(),null);let t=this._buildControls(e),n=t.map(e=>e.refresh);this._view.renderControls(t),this._unsubArgs=e.onArgsChanged(e=>{for(let t of n)t(e)})}_groupByCategory(e){let t=new Map;for(let n of e)for(let e of n.instances??[]){let n=e.meta.title.split(`/`),r=n[0],i=n.length>1?n[1]:e.meta.title;t.has(r)||t.set(r,[]),t.get(r).push({instance:e,name:i||`Unnamed`})}return[...t].map(([e,t])=>({category:e,stories:t}))}get activeStory(){return this._activeStory}listStories(){return this._registry.getStories().flatMap(e=>(e.instances??[]).map(e=>({title:e.meta.title,story:e.story,category:e.meta.title.split(`/`)[0],controls:e.meta.controls??[]})))}openStoryByTitle(e){let t=this._findByTitle(e);return t?(this.select(t),!0):!1}getCurrentStory(){let e=this._activeStory;return e?{title:e.meta.title,story:e.story,args:e.args}:null}setActiveArg(e,t){let n=this._activeStory;return n?(n.setArg(e,t),!0):!1}_findByTitle(e){for(let t of this._registry.getStories())for(let n of t.instances??[])if(n.meta.title===e)return n;return null}_firstStory(){for(let e of this._registry.getStories()){let t=(e.instances??[])[0];if(t)return t}return null}};let n=function(e){return e.TEXT=`text`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e.SELECT=`select`,e.RANGE=`range`,e.COLOR=`color`,e}({});function isStoryModule(e){return typeof e==`object`&&!!e&&Array.isArray(e.stories)}function argsFromControls(e=[]){let t={};for(let n of e)t[n.name]=defaultFor(n);return t}function defaultFor(e){if(e.defaultValue!==void 0)return e.defaultValue;switch(e.type){case`text`:return``;case`color`:return`#000000`;case`boolean`:return!1;case`number`:case`range`:return e.min??0;case`select`:return e.options[0]?.value??null;default:return null}}function controlLabel(e){return e.label||e.name}function bindControl(e,t,r){let i=t.name,a=t.description;switch(t.type){case n.TEXT:{let n=r.text(controlLabel(t),a),o=e.args[i];return n.set(typeof o==`string`?o:``),n.onChange(t=>e.setArg(i,t)),{view:n.node,refresh:e=>{let t=typeof e[i]==`string`?e[i]:``;n.get()!==t&&n.set(t)}}}case n.COLOR:{let n=r.color(controlLabel(t),a),o=e.args[i];return n.set(typeof o==`string`?o:`#000000`),n.onChange(t=>e.setArg(i,t)),{view:n.node,refresh:e=>{let t=typeof e[i]==`string`?e[i]:`#000000`;n.get()!==t&&n.set(t)}}}case n.BOOLEAN:{let n=r.boolean(controlLabel(t),a);return n.set(!!e.args[i]),n.onChange(t=>e.setArg(i,t)),{view:n.node,refresh:e=>{let t=!!e[i];n.get()!==t&&n.set(t)}}}case n.NUMBER:{let n=r.number(t),a=e.args[i];return n.set(typeof a==`number`?a:t.min??0),n.onChange(t=>e.setArg(i,t)),{view:n.node,refresh:e=>{let t=typeof e[i]==`number`?e[i]:0;n.get()!==t&&n.set(t)}}}case n.RANGE:{let n=r.range(t),a=e.args[i],o=typeof a==`number`?a:t.min??0;return n.set(o),n.onChange(t=>e.setArg(i,t)),{view:n.node,refresh:e=>{let t=typeof e[i]==`number`?e[i]:o;n.get()!==t&&n.set(t)}}}case n.SELECT:{let n=t.options;if(!n?.length)return console.warn(`SELECT control "${i}" has no options`),null;let a=r.select(t),o=e.args[i],s=Math.max(0,n.findIndex(e=>e.value===o));return a.set(s),a.onChange(t=>{t>=0&&t<n.length&&e.setArg(i,n[t].value)}),{view:a.node,refresh:e=>{let t=e[i],r=n.findIndex(e=>e.value===t);r>=0&&a.get()!==r&&a.set(r)}}}default:return console.warn(`Unsupported control type: ${t.type}`),null}}function buildStorybookDevtoolsExtension(e){let currentStory=()=>e.getCurrentStory();return{methods:[{name:`ListStories`,kind:`read-only`,handler:(()=>JSON.stringify(e.listStories(),null,2))},{name:`GetCurrentStory`,kind:`read-only`,handler:(()=>JSON.stringify(currentStory(),null,2))},{name:`OpenStory`,kind:`mutating`,handler:(t=>e.openStoryByTitle(t))},{name:`SetStoryArg`,kind:`mutating`,handler:((t,n)=>e.setActiveArg(t,n?JSON.parse(n):null))},{name:`GetStoryArgs`,kind:`read-only`,handler:(()=>JSON.stringify(currentStory()?.args??{},null,2))}],contributeStatus:()=>{let t=currentStory(),n=e.listStories();return{storybook:{currentStory:t?{title:t.title,story:t.story}:null,storyCount:n.length}}}}}function collectStoryModules$1(e){let t=[];for(let n of e)if(!(!n||typeof n!=`object`))for(let e of Object.values(n))isStoryModule(e)&&t.push(e);return t}__name(collectStoryModules$1,`collectStoryModules`);var StoryViewBase=class{constructor(){this._listeners=new Set}initBase(e,t,n){this._meta=e,this._story=t,this._args=argsFromControls(e.controls),this._chrome=this.createChrome(e,n),this.refreshChromeText()}get meta(){return this._meta}get story(){return this._story}get args(){return this._args}get root(){return this._chrome.root}set args(e){this._args!==e&&(this._args=e,this.updateArgs(e),this.emitArgs(e))}emitArgs(e){for(let t of this._listeners)t(e)}onArgsChanged(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}setArg(e,t){this.args={...this._args,[e]:t}}initialize(){}updateArgs(e){}teardown(){}addContent(e){this._chrome.hasStage&&this._chrome.setStageContent(e)}refreshChromeText(){let e=this._story?`${this._meta.title} — ${this._story}`:this._meta.title;this._chrome.setChromeText(e,this._meta.description??``)}};const r={ListStories:`<method name="ListStories"><arg type="s" direction="out" name="stories_json"/></method>`,GetCurrentStory:`<method name="GetCurrentStory"><arg type="s" direction="out" name="story_json"/></method>`,OpenStory:`<method name="OpenStory"><arg type="s" direction="in" name="title"/><arg type="b" direction="out" name="opened"/></method>`,SetStoryArg:`<method name="SetStoryArg"><arg type="s" direction="in" name="name"/><arg type="s" direction="in" name="value_json"/><arg type="b" direction="out" name="applied"/></method>`,GetStoryArgs:`<method name="GetStoryArgs"><arg type="s" direction="out" name="args_json"/></method>`};function storybookDevtoolsExtension(e){let t=buildStorybookDevtoolsExtension(e.controller),n=[],i={},a={};for(let e of t.methods){let t=r[e.name];t&&n.push(t),i[e.name]=e.handler,a[e.name]=e.kind}return{methodsXml:n,handlers:i,methodKinds:a,contributeStatus:t.contributeStatus}}const i=e(import.meta.url);let a;function load$6(){return a===void 0&&(a=i(`@gjsify/node-gi/gi`).requireGi(`Adw`,`1`)),a}__name(load$6,`load`);var o=new Proxy(Object.create(null),{get(e,t){return load$6()[t]},has(e,t){return t in load$6()}});const s=e(import.meta.url);let c;function load$5(){return c===void 0&&(c=s(`@gjsify/node-gi/gi`).requireGi(`GObject`,`2.0`)),c}__name(load$5,`load`);var l=new Proxy(Object.create(null),{get(e,t){return load$5()[t]},has(e,t){return t in load$5()}});const u=e(import.meta.url);let d;function load$4(){return d===void 0&&(d=u(`@gjsify/node-gi/gi`).requireGi(`Gtk`,`4.0`)),d}__name(load$4,`load`);var f=new Proxy(Object.create(null),{get(e,t){return load$4()[t]},has(e,t){return t in load$4()}});function buildGtkChrome(e){let t=new o.PreferencesPage,n=new o.PreferencesGroup,r=new f.Box({orientation:f.Orientation.VERTICAL,halign:f.Align.CENTER,valign:f.Align.CENTER,margin_top:12,margin_bottom:12,spacing:12,hexpand:!0});return r.add_css_class(`story-stage`),n.add(r),t.add(n),e.set_child(t),{root:e,hasStage:!0,setStageContent(e){let t=r.get_first_child();for(;t;)t.unparent(),t=r.get_first_child();r.append(e)},setChromeText(e,t){n.set_title(e),n.set_description(t)}}}var StoryCore=class extends StoryViewBase{constructor(e,t,n){super(),this._widget=e,this.initBase(t,n)}createChrome(e){return buildGtkChrome(this._widget)}initialize(){this._widget.initialize()}updateArgs(e){this._widget.updateArgs(e)}teardown(){this._widget.teardown()}emitArgs(e){super.emitArgs(e),this._widget.notify(`args`)}},p=class StoryWidget extends o.Bin{static{l.registerClass({GTypeName:`StoryWidget`,Properties:{meta:l.ParamSpec.object(`meta`,`Meta`,`Story metadata`,l.ParamFlags.READWRITE,l.Object),story:l.ParamSpec.string(`story`,`Story Name`,`Story name`,l.ParamFlags.READWRITE,``),args:l.ParamSpec.object(`args`,`Args`,`Story arguments`,l.ParamFlags.READWRITE,l.Object)}},StoryWidget)}constructor(e,t={}){super(t),this._core=new StoryCore(this,e.meta,e.story)}static fromMeta(e,t){return{meta:e,story:t,args:argsFromControls(e.controls)}}get meta(){return this._core.meta}get story(){return this._core.story}get args(){return this._core.args}set args(e){this._core.args=e}onArgsChanged(e){return this._core.onArgsChanged(e)}setArg(e,t){this._core.setArg(e,t)}initialize(){}updateArgs(e){}teardown(){}addContent(e){this._core.addContent(e)}};l.type_ensure(p.$gtype);const m=e(import.meta.url);let h;function load$3(){return h===void 0&&(h=m(`@gjsify/node-gi/gi`).requireGi(`Gio`,`2.0`)),h}__name(load$3,`load`);var g=new Proxy(Object.create(null),{get(e,t){return load$3()[t]},has(e,t){return t in load$3()}}),_=g;const ee=e(import.meta.url);let te;function load$2(){return te===void 0&&(te=ee(`@gjsify/node-gi/gi`).requireGi(`GLib`,`2.0`)),te}__name(load$2,`load`);var v=new Proxy(Object.create(null),{get(e,t){return load$2()[t]},has(e,t){return t in load$2()}}),y=v;const ne=e(import.meta.url);let b;function load$1(){return b===void 0&&(b=ne(`@gjsify/node-gi/gi`).requireGi(`Gdk`,`4.0`)),b}__name(load$1,`load`);var x=new Proxy(Object.create(null),{get(e,t){return load$1()[t]},has(e,t){return t in load$1()}});function adwControlWidgetFactory(){return{text(e,t){let n=new o.EntryRow({title:e});t&&n.set_tooltip_text(t);let r=null;return n.connect(`changed`,()=>r?.(n.get_text())),{node:n,get:()=>n.get_text(),set:e=>n.set_text(e),onChange:e=>{r=e}}},boolean(e,t){let n=new o.SwitchRow({title:e,subtitle:t??``}),r=null;return n.connect(`notify::active`,()=>r?.(n.get_active())),{node:n,get:()=>n.get_active(),set:e=>n.set_active(e),onChange:e=>{r=e}}},number(e){let t=o.SpinRow.new_with_range(e.min??0,e.max??100,e.step??1);t.set_title(e.label||e.name),e.description&&t.set_subtitle(e.description);let n=null;return t.connect(`changed`,()=>n?.(t.get_value())),{node:t,get:()=>t.get_value(),set:e=>t.set_value(e),onChange:e=>{n=e}}},range(e){return buildRangeWidget(e)},select(e){return buildSelectWidget(e)},color(e,t){return buildColorWidget(e,t)}}}function buildRangeWidget(e){let t=e.min??0,n=e.max??100,r=e.step??1,i=typeof e.min==`number`?e.min:0,a=Number.isInteger(r)&&Number.isInteger(i),o=new f.Adjustment({lower:t,upper:n,step_increment:r,value:i});o.step_increment=r;let s=new f.ListBoxRow({selectable:!1,activatable:!1});s.add_css_class(`story-range-row`);let c=new f.Box({orientation:f.Orientation.VERTICAL,spacing:6,margin_top:12,margin_bottom:12,margin_start:12,margin_end:12}),l=new f.Box({orientation:f.Orientation.HORIZONTAL,spacing:12}),u=new f.Label({label:e.label||e.name,halign:f.Align.START,hexpand:!0,ellipsize:3});u.add_css_class(`heading`);let formatValue=e=>a?String(Math.round(e)):e.toFixed(2),d=new f.Label({label:formatValue(i),halign:f.Align.END});if(d.add_css_class(`numeric`),d.add_css_class(`dim-label`),l.append(u),l.append(d),c.append(l),e.description){let t=new f.Label({label:e.description,halign:f.Align.START,xalign:0,wrap:!0,max_width_chars:32});t.add_css_class(`caption`),t.add_css_class(`dim-label`),c.append(t)}let p=new f.Scale({orientation:f.Orientation.HORIZONTAL,adjustment:o,draw_value:!1,hexpand:!0}),m=null,h=!1;return p.connect(`value-changed`,()=>{if(h)return;let e=p.get_value();if(a){let t=Math.round(e);if(t!==e){p.set_value(t);return}e=t}d.set_label(formatValue(e)),m?.(e)}),c.append(p),s.set_child(c),{node:s,get:()=>p.get_value(),set:e=>{h=!0,p.set_value(e),h=!1,d.set_label(formatValue(e))},onChange:e=>{m=e}}}function buildSelectWidget(e){let t=e.options??[],n=f.StringList.new(t.map(e=>e.label)),r=new o.ComboRow({title:e.label||e.name,subtitle:e.description??``,model:n}),i=null;return r.connect(`notify::selected`,()=>i?.(r.get_selected())),{node:r,get:()=>r.get_selected(),set:e=>r.set_selected(e),onChange:e=>{i=e}}}function buildColorWidget(e,t){let n=new o.ActionRow({title:e,subtitle:t??``}),r=new f.ColorDialogButton({dialog:new f.ColorDialog({title:e}),valign:f.Align.CENTER});n.add_suffix(r),n.set_activatable_widget(r);let channel=e=>Math.round(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,`0`),rgbaToHex=e=>`#${channel(e.red)}${channel(e.green)}${channel(e.blue)}`,i=null,a=!1;return r.connect(`notify::rgba`,()=>{a||i?.(rgbaToHex(r.get_rgba()))}),{node:n,get:()=>rgbaToHex(r.get_rgba()),set:e=>{let t=new x.RGBA;t.parse(e)&&(a=!0,r.set_rgba(t),a=!1)},onChange:e=>{i=e}}}var re=class StorybookWindow extends o.ApplicationWindow{static{l.registerClass({GTypeName:`StorybookWindow`},StorybookWindow)}constructor(e){super(e),this._controlRows=[],this._rowByTitle=new Map,this._onSelect=null,this._suppressSelect=!1,this.set_default_size(1200,800),this.set_size_request(360,320),this.set_title(`Storybook`),this._buildUI(),this._controller=new StorybookController(this,e=>this._buildControls(e)),this._sidebar_list.connect(`row-selected`,this._onRowSelected.bind(this)),this._show_controls_button.connect(`toggled`,this._onToggleControls.bind(this)),this._controls_split_view.set_show_sidebar(!0)}_onRowSelected(e,t){if(this._suppressSelect||!t)return;let n=t;n.storyWidget&&this._onSelect?.(n.storyWidget)}get controller(){return this._controller}_buildControls(e){let t=e.meta.controls;if(!Array.isArray(t))return[];let n=adwControlWidgetFactory(),r=[];for(let i of t){if(!i?.name||!i?.type){console.warn(`Invalid control configuration:`,i);continue}let t=bindControl(e,i,n);t&&r.push(t)}return r}_buildUI(){this._sidebar_list=new f.ListBox({selection_mode:f.SelectionMode.SINGLE}),this._sidebar_list.add_css_class(`navigation-sidebar`);let e=new f.ScrolledWindow({hexpand:!0,vexpand:!0,child:this._sidebar_list}),t=new o.HeaderBar({title_widget:new o.WindowTitle({title:`Stories`}),show_end_title_buttons:!1}),n=new o.ToolbarView({content:e,top_bar_style:o.ToolbarStyle.FLAT});n.add_top_bar(t);let r=new o.NavigationPage({title:`Stories`,tag:`stories`,child:n});this._content_area=new o.Bin({hexpand:!0,vexpand:!0});let i=new f.ScrolledWindow({hexpand:!0,vexpand:!0,child:this._content_area});this._control_panel=new o.PreferencesGroup({title:`Controls`});let a=new o.PreferencesPage;a.add(this._control_panel);let s=new f.ScrolledWindow({vexpand:!0,child:a});this._controls_split_view=new o.OverlaySplitView({show_sidebar:!0,sidebar_position:f.PackType.END,min_sidebar_width:280,max_sidebar_width:360,content:i,sidebar:s,css_classes:[`storybook-controls`]}),this._preview_title=new o.WindowTitle({title:`Preview`}),this._show_controls_button=new f.ToggleButton({icon_name:`sidebar-show-right-symbolic`,tooltip_text:`Toggle Controls`,active:!0});let c=new o.HeaderBar({title_widget:this._preview_title});c.pack_end(this._show_controls_button);let l=new o.ToolbarView({content:this._controls_split_view,top_bar_style:o.ToolbarStyle.FLAT});l.add_top_bar(c);let u=new o.NavigationPage({title:`Preview`,tag:`preview`,child:l});this._main_split_view=new o.NavigationSplitView({min_sidebar_width:220,max_sidebar_width:320,sidebar:r,content:u}),this.set_content(this._main_split_view);let d=o.BreakpointCondition.parse(`max-width: 720sp`);if(d){let e=new o.Breakpoint({condition:d});e.connect(`apply`,()=>{this._main_split_view.collapsed=!0,this._controls_split_view.collapsed=!0}),e.connect(`unapply`,()=>{this._main_split_view.collapsed=!1,this._controls_split_view.collapsed=!1}),this.add_breakpoint(e)}}_onToggleControls(e){this._controls_split_view.set_show_sidebar(e.get_active())}populateSidebar(e){this._controller.mount(e,!0)}renderSidebar(e,t){this._onSelect=t,this._suppressSelect=!0,this._clearSidebar(),this._rowByTitle.clear();for(let t of e){this._addCategoryToSidebar(t.category);for(let{instance:e,name:n}of t.stories)this._addStoryToSidebar(e,n)}this._suppressSelect=!1}markSelected(e){let t=this._rowByTitle.get(e);t&&this._sidebar_list.get_selected_row()!==t&&(this._suppressSelect=!0,this._sidebar_list.select_row(t),this._suppressSelect=!1)}setPreviewTitle(e){this._preview_title.set_title(e)}showPreview(e){this._content_area.set_child(e),this._main_split_view.get_collapsed()&&this._main_split_view.set_show_content(!0)}renderControls(e){this._clearControlPanel();for(let t of e){let e=t.view;this._control_panel.add(e),this._controlRows.push(e)}this._show_controls_button.set_active(!0)}_clearSidebar(){let e=this._sidebar_list.get_first_child();for(;e;){let t=e.get_next_sibling();e.unparent(),e=t}}_addCategoryToSidebar(e){let t=new f.ListBoxRow({selectable:!1}),n=new f.Label({label:e,halign:f.Align.START,margin_top:10,margin_bottom:4,margin_start:12,margin_end:12});n.add_css_class(`heading`),n.add_css_class(`dim-label`),t.set_child(n),this._sidebar_list.append(t)}_addStoryToSidebar(e,t){let n=new f.ListBoxRow,r=new f.Label({label:t||`Unnamed Story`,halign:f.Align.START,margin_start:20,margin_top:6,margin_bottom:6});n.set_child(r),this._sidebar_list.append(n),n.storyWidget=e,this._rowByTitle.set(e.meta.title,n)}_clearControlPanel(){for(let e of this._controlRows)this._control_panel.remove(e);this._controlRows=[]}get activeStory(){return this._controller.activeStory}openStoryByTitle(e){return this._controller.openStoryByTitle(e)}setActiveArg(e,t){return this._controller.setActiveArg(e,t)}};l.type_ensure(re.$gtype);function variantKindFor(e,t){switch(e){case`s`:case`b`:case`i`:case`u`:case`d`:return e}if(typeof t==`string`)return`s`;if(typeof t==`boolean`)return`b`;if(typeof t==`number`)return Number.isInteger(t)?`i`:`d`;throw Error(`Cannot build a GLib.Variant from ${typeof t}`)}function buildVariant(e,t){switch(variantKindFor(e?.dup_string()??null,t)){case`s`:return y.Variant.new_string(String(t));case`b`:return y.Variant.new_boolean(!!t);case`i`:return y.Variant.new_int32(Number(t));case`u`:return y.Variant.new_uint32(Number(t));case`d`:return y.Variant.new_double(Number(t))}}function describeActions(e){return e?e.list_actions().sort((e,t)=>e.localeCompare(t)).map(t=>({name:t,enabled:e.get_action_enabled(t),parameterType:e.get_action_parameter_type(t)?.dup_string()??null,stateType:e.get_action_state_type(t)?.dup_string()??null})):[]}function activateAction(e,t,n){let r=e.get_action_parameter_type(t),i=n==null?null:buildVariant(r,n);e.activate_action(t,i)}function changeActionState(e,t,n){e.change_action_state(t,buildVariant(e.get_action_state_type(t),n))}const S=new Map;function swapCss(e,t){let n=x.Display.get_default();if(!n)return!1;let r=S.get(e);return r||(r=new f.CssProvider,f.StyleContext.add_provider_for_display(n,r,f.STYLE_PROVIDER_PRIORITY_USER+1),S.set(e,r)),r.load_from_string(t),!0}function dumpCss(){return{providers:[...S.keys()]}}function formatDbusErrorMessage(e,t){return`${e}: ${t}`}const ie={GetStatus:`read-only`,Screenshot:`read-only`,ListActions:`read-only`,ActivateAction:`mutating`,ChangeActionState:`mutating`,PresentWindow:`read-only`,ResizeWindow:`mutating`,ListToplevels:`read-only`,DumpTree:`read-only`,GetProperty:`read-only`,SetProperty:`mutating`,GetFocused:`read-only`,EmitSignal:`mutating`,DumpGSettings:`read-only`,DumpCss:`read-only`,SwapCss:`mutating`};function buildDevtoolsIfaceXml(e=[]){return`<node>
|
|
2
|
-
<interface name="org.gjsify.Devtools">
|
|
3
|
-
<method name="GetStatus">
|
|
4
|
-
<arg type="s" direction="out" name="status_json"/>
|
|
5
|
-
</method>
|
|
6
|
-
<method name="Screenshot">
|
|
7
|
-
<arg type="s" direction="in" name="scope"/>
|
|
8
|
-
<arg type="ay" direction="out" name="png_bytes"/>
|
|
9
|
-
</method>
|
|
10
|
-
<method name="ListActions">
|
|
11
|
-
<arg type="s" direction="out" name="actions_json"/>
|
|
12
|
-
</method>
|
|
13
|
-
<method name="ActivateAction">
|
|
14
|
-
<arg type="s" direction="in" name="scope"/>
|
|
15
|
-
<arg type="s" direction="in" name="name"/>
|
|
16
|
-
<arg type="s" direction="in" name="value_json"/>
|
|
17
|
-
</method>
|
|
18
|
-
<method name="ChangeActionState">
|
|
19
|
-
<arg type="s" direction="in" name="scope"/>
|
|
20
|
-
<arg type="s" direction="in" name="name"/>
|
|
21
|
-
<arg type="s" direction="in" name="value_json"/>
|
|
22
|
-
</method>
|
|
23
|
-
<method name="PresentWindow"/>
|
|
24
|
-
<method name="ResizeWindow">
|
|
25
|
-
<arg type="i" direction="in" name="width"/>
|
|
26
|
-
<arg type="i" direction="in" name="height"/>
|
|
27
|
-
<arg type="i" direction="out" name="result_width"/>
|
|
28
|
-
<arg type="i" direction="out" name="result_height"/>
|
|
29
|
-
</method>
|
|
30
|
-
<method name="ListToplevels">
|
|
31
|
-
<arg type="s" direction="out" name="toplevels_json"/>
|
|
32
|
-
</method>
|
|
33
|
-
<method name="DumpTree">
|
|
34
|
-
<arg type="s" direction="in" name="root"/>
|
|
35
|
-
<arg type="i" direction="in" name="depth"/>
|
|
36
|
-
<arg type="s" direction="out" name="tree_json"/>
|
|
37
|
-
</method>
|
|
38
|
-
<method name="GetProperty">
|
|
39
|
-
<arg type="s" direction="in" name="path"/>
|
|
40
|
-
<arg type="s" direction="in" name="prop"/>
|
|
41
|
-
<arg type="s" direction="out" name="value_json"/>
|
|
42
|
-
</method>
|
|
43
|
-
<method name="GetFocused">
|
|
44
|
-
<arg type="s" direction="out" name="focused_json"/>
|
|
45
|
-
</method>
|
|
46
|
-
<method name="DumpGSettings">
|
|
47
|
-
<arg type="s" direction="in" name="schema_id"/>
|
|
48
|
-
<arg type="s" direction="out" name="settings_json"/>
|
|
49
|
-
</method>
|
|
50
|
-
<method name="DumpCss">
|
|
51
|
-
<arg type="s" direction="out" name="css_json"/>
|
|
52
|
-
</method>
|
|
53
|
-
<method name="SwapCss">
|
|
54
|
-
<arg type="s" direction="in" name="name"/>
|
|
55
|
-
<arg type="s" direction="in" name="css"/>
|
|
56
|
-
<arg type="b" direction="out" name="applied"/>
|
|
57
|
-
</method>${e.length>0?`\n${e.join(`
|
|
58
|
-
`)}`:``}
|
|
59
|
-
</interface>
|
|
60
|
-
</node>`}const ae=e(import.meta.url);let C;function load(){return C===void 0&&(C=ae("@gjsify/node-gi/gi").requireGi(`Graphene`,`1.0`)),C}var oe=new Proxy(Object.create(null),{get(e,t){return load()[t]},has(e,t){return t in load()}});function captureWidgetPng(e){let t=e.get_native()?.get_renderer();if(!t)return null;let n=e.get_width(),r=e.get_height();if(n<=0||r<=0)return null;let i=f.WidgetPaintable.new(e),a=f.Snapshot.new();i.snapshot(a,n,r);let o=a.to_node();if(!o)return null;let s=new oe.Rect;s.init(0,0,n,r);let c=t.render_texture(o,s).save_to_png_bytes().get_data();return c?new Uint8Array(c):null}function dumpGSettings(e){let t=_.SettingsSchemaSource.get_default()?.lookup(e,!0);if(!t)throw Error(formatDbusErrorMessage(`not-found`,`GSettings schema '${e}' is not installed`));let n=new _.Settings({settings_schema:t}),r={};for(let e of t.list_keys())r[e]=n.get_value(e).recursiveUnpack();return r}function parseWidgetPath(e){let t=e.split(`/`).filter(e=>e.length>0);if(t.length===0)return null;let n=t[0].match(/^toplevel:(\d+)$/);if(!n)return null;let r=[];for(let e of t.slice(1)){let t=e.match(/^child:(\d+)$/);if(!t)return null;r.push(Number(t[1]))}return{toplevel:Number(n[1]),children:r}}function buildWidgetPath(e,t){return[`toplevel:${e}`,...t.map(e=>`child:${e}`)].join(`/`)}function widgetType(e){return e.constructor?.$gtype?.name??`GtkWidget`}function nthChild(e,t){let n=e.get_first_child(),r=0;for(;n&&r<t;)n=n.get_next_sibling(),r++;return r===t?n:null}function listToplevels(){let e=f.Window.get_toplevels(),t=e.get_n_items(),n=[];for(let r=0;r<t;r++){let t=e.get_item(r);t&&n.push({path:`toplevel:${r}`,type:widgetType(t),title:t.get_title?.()??null,mapped:t.get_mapped(),focused:t.is_active??!1})}return n}function resolveWidgetPath(e){let t=parseWidgetPath(e);if(!t)return null;let n=f.Window.get_toplevels().get_item(t.toplevel);if(!n)return null;for(let e of t.children)if(n=nthChild(n,e),!n)return null;return n}function dumpTree(e,t,n){let r={path:n,type:widgetType(e),name:e.get_name()||null,cssClasses:e.get_css_classes(),mapped:e.get_mapped(),visible:e.get_visible(),children:[]};if(t<=0)return r;let i=e.get_first_child(),a=0;for(;i;)r.children.push(dumpTree(i,t-1,`${n}/child:${a}`)),i=i.get_next_sibling(),a++;return r}function jsonSafe(e){let t=typeof e;return e==null||t===`string`||t===`number`||t===`boolean`?e??null:`[${t}]`}function getWidgetProperty(e,t){let n=e,r=t.replace(/-/g,`_`),i=t.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase());for(let e of[t,r,i])if(e in n)return jsonSafe(n[e])}function childIndex(e,t){let n=e.get_first_child(),r=0;for(;n;){if(n===t)return r;n=n.get_next_sibling(),r++}return-1}function pathOfWidget(e){let t=[],n=e,r=n.get_parent();for(;r;){let e=childIndex(r,n);if(e<0)return null;t.unshift(e),n=r,r=n.get_parent()}let i=f.Window.get_toplevels(),a=i.get_n_items();for(let e=0;e<a;e++)if(i.get_item(e)===n)return buildWidgetPath(e,t);return null}function frameDelay(e){return new Promise(t=>{y.timeout_add(y.PRIORITY_DEFAULT,e,()=>(t(),y.SOURCE_REMOVE))})}async function captureWidgetWhenRenderable(e,t=12,n=50){for(let r=0;r<t;r++){let t=captureWidgetPng(e);if(t)return t;await frameDelay(n)}return captureWidgetPng(e)}var DevtoolsService=class{constructor(e,t){this._app=e,this._options=t,this._exported=null,this._kinds=new Map,this._extensions=t.extend??[];for(let[e,t]of Object.entries(ie))this._kinds.set(e,t);for(let e of this._extensions){for(let[t,n]of Object.entries(e.methodKinds))this._kinds.set(t,n);for(let[t,n]of Object.entries(e.handlers)){let e=n;this[t]=(...n)=>(this._guard(t),e(...n))}}}export(e,t){if(this._exported)return;let n=buildDevtoolsIfaceXml(this._extensions.flatMap(e=>e.methodsXml??[])),r=_.DBusExportedObject.wrapJSObject(n,this);r.export(e,t),this._exported=r}unexport(){this._exported?.unexport(),this._exported=null}GetStatus(){let e=this._app.get_active_window(),t={appId:this._app.get_application_id()??`unknown`,instance:this._options.instance??`default`,activeWindow:e?{id:e.get_name()||`window`,title:e.get_title()??``,mapped:e.get_mapped()}:null,toplevelCount:f.Window.get_toplevels().get_n_items(),focusedWidget:null,paused:this._isPaused()};for(let e of this._extensions){let n=e.contributeStatus?.();n&&Object.assign(t,n)}return JSON.stringify(t)}async Screenshot(e){let t=this._app.get_active_window();if(!t)return new Uint8Array;let n=captureWidgetPng(t);return n||=(t.present(),await captureWidgetWhenRenderable(t)),n??new Uint8Array}ListActions(){let e={app:describeActions(this._actionGroup(`app`)),win:describeActions(this._actionGroup(`win`))};return JSON.stringify(e)}ActivateAction(e,t,n){this._guard(`ActivateAction`);let r=this._scope(e);activateAction(this._requireGroup(r,t),t,this._parseValue(n))}ChangeActionState(e,t,n){this._guard(`ChangeActionState`);let r=this._scope(e);changeActionState(this._requireGroup(r,t),t,this._parseValue(n))}PresentWindow(){this._app.get_active_window()?.present()}ResizeWindow(e,t){this._guard(`ResizeWindow`);let n=this._app.get_active_window();if(!n)throw Error(formatDbusErrorMessage(`unavailable`,`no active window to resize`));let r=Math.max(1,Math.round(e)),i=Math.max(1,Math.round(t));return n.is_maximized()&&n.unmaximize(),n.is_fullscreen()&&n.unfullscreen(),n.set_default_size(r,i),[r,i]}ListToplevels(){return JSON.stringify(listToplevels())}DumpTree(e,t){let n=this._resolveRootWidget(e);if(!n)throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e||`active window`}'`));return JSON.stringify(dumpTree(n.widget,t>0?t:8,n.path))}GetProperty(e,t){let n=this._resolveRootWidget(e);if(!n)throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e}'`));let r=getWidgetProperty(n.widget,t);if(r===void 0)throw Error(formatDbusErrorMessage(`not-found`,`widget has no property '${t}'`));return JSON.stringify(r)}GetFocused(){let e=this._app.get_active_window(),t=e?e.get_focus():null;return JSON.stringify(t?{path:pathOfWidget(t),name:t.get_name()||null,type:widgetType(t)}:null)}DumpGSettings(e){return JSON.stringify(dumpGSettings(e))}DumpCss(){return JSON.stringify(dumpCss())}SwapCss(e,t){return this._guard(`SwapCss`),swapCss(e,t)}_resolveRootWidget(e){if(!e||e===`window`||e===`active`){let e=this._app.get_active_window();return e?{widget:e,path:pathOfWidget(e)??`toplevel:0`}:null}let t=resolveWidgetPath(e);return t?{widget:t,path:e}:null}_isPaused(){return this._options.paused?.()??!1}_guard(e){let t=this._kinds.get(e);if(!t)throw Error(formatDbusErrorMessage(`internal`,`unclassified devtools method '${e}'`));if(t===`mutating`&&this._isPaused())throw Error(formatDbusErrorMessage(`paused`,`${e} rejected — external control is paused. Read-only methods keep working.`))}_scope(e){return e===`app`?`app`:`win`}_actionGroup(e){if(e===`app`)return this._app;if(this._options.winActionGroup)return this._options.winActionGroup;let t=this._app.get_active_window();return t instanceof f.ApplicationWindow?t:null}_requireGroup(e,t){let n=this._actionGroup(e);if(!n)throw Error(formatDbusErrorMessage(`unavailable`,`no '${e}' action group`));if(!n.has_action(t))throw Error(formatDbusErrorMessage(`not-found`,`unknown action ${e}.${t}`));return n}_parseValue(e){if(!e||e===`null`)return null;try{return JSON.parse(e)}catch{throw Error(formatDbusErrorMessage(`invalid-params`,`value_json is not valid JSON: ${e}`))}}};const se=new Set;function envEnabled(){let e=y.getenv(`GJSIFY_DEVTOOLS`);if(e==null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}function envInstance(){let e=y.getenv(`GJSIFY_DEVTOOLS_INSTANCE`);return e&&e!==``?e:void 0}function installDevtools(e,t={}){if(!(t.enabled??envEnabled()))return null;let n=new DevtoolsService(e,{...t,instance:t.instance??envInstance()}),r=e.get_dbus_connection(),i=e.get_dbus_object_path();return r&&i?n.export(r,`${i}/devtools`):console.error(`[gjsify-devtools] no session-bus connection yet — call installDevtools() from the GtkApplication "startup" handler`),se.add(n),n}var ce=class StorybookApplication extends o.Application{static{l.registerClass({GTypeName:`StorybookApplication`},StorybookApplication)}constructor(e){super({application_id:e.applicationId,flags:_.ApplicationFlags.DEFAULT_FLAGS}),this._window=null,this._options=e,this.connect(`startup`,()=>this._initStyles()),this.connect(`activate`,()=>this._onActivate())}_initStyles(){let e=new f.CssProvider;e.load_from_string(`
|
|
61
|
-
/* Range-control card in the controls sidebar — keeps the label + description
|
|
62
|
-
from being squashed into a single column when the sidebar is narrow. */
|
|
63
|
-
.story-range-row {
|
|
64
|
-
padding: 0;
|
|
65
|
-
}
|
|
66
|
-
.story-range-row > box {
|
|
67
|
-
border-radius: 12px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/* Controls panel shares the window (story) background; only the left
|
|
71
|
-
navigation sidebar keeps a distinct shade. The overlay-split-view sidebar is
|
|
72
|
-
otherwise drawn on the sidebar shade — flatten it onto the window colour. */
|
|
73
|
-
.storybook-controls > .sidebar,
|
|
74
|
-
.storybook-controls > .sidebar > * {
|
|
75
|
-
background-color: @window_bg_color;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/* Subtle dashed frame around the live preview so the widget's bounds stay
|
|
79
|
-
locatable even when it is transparent or in an empty state (e.g. a collapsed
|
|
80
|
-
bottom sheet, a status page, a bare button). @window_fg_color flips with the
|
|
81
|
-
theme (alpha(currentColor, …) does not resolve in a Gtk.CssProvider). */
|
|
82
|
-
.story-stage {
|
|
83
|
-
border: 1px dashed alpha(@window_fg_color, 0.28);
|
|
84
|
-
border-radius: 12px;
|
|
85
|
-
padding: 18px;
|
|
86
|
-
}
|
|
87
|
-
\n${this._options.css??``}`);let t=x.Display.get_default();if(!t){console.error(`No display found`);return}f.StyleContext.add_provider_for_display(t,e,f.STYLE_PROVIDER_PRIORITY_APPLICATION)}_onActivate(){if(!this._window){this._window=new re({application:this}),this._options.title&&this._window.set_title(this._options.title);try{this._window.populateSidebar(this._options.stories)}catch(e){console.error(`Failed to create story instances:`,e)}installDevtools(this,{enabled:this._options.devtools||void 0,extend:[storybookDevtoolsExtension(this._window)]})}this._window.present()}};l.type_ensure(ce.$gtype);async function runStorybook(e){return new ce(e).runAsync([imports.system.programInvocationName,...ARGV])}function collectStoryModules(e){return collectStoryModules$1(e)}const le={title:`Buttons/Button Content`,description:`Adw.ButtonContent — pairs a symbolic icon with a label inside a Gtk.Button.`,controls:[{name:`label`,label:`Label`,type:n.TEXT,defaultValue:`Download`},{name:`iconName`,label:`Icon`,type:n.SELECT,options:[{label:`Download`,value:`folder-download-symbolic`},{label:`Add`,value:`list-add-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-download-symbolic`},{name:`canShrink`,label:`Can shrink`,type:n.BOOLEAN,defaultValue:!1}]};var ue=__exportAll({ButtonContentStories:()=>de,ButtonContentStory:()=>w}),w=class ButtonContentStory extends p{_content=null;_button=null;static{l.registerClass({GTypeName:`AdwStorybookButtonContent`},ButtonContentStory)}constructor(){super(p.fromMeta(ButtonContentStory.getMetadata(),`Default`))}static getMetadata(){return{...le,component:o.ButtonContent.$gtype}}initialize(){this._content=new o.ButtonContent({label:this.args.label,iconName:this.args.iconName,canShrink:this.args.canShrink}),this._button=new f.Button({child:this._content}),this._button.add_css_class(`suggested-action`),this._button.add_css_class(`pill`),this.addContent(this._button)}updateArgs(e){this._content&&(this._content.label=this.args.label,this._content.iconName=this.args.iconName,this._content.canShrink=this.args.canShrink)}};l.type_ensure(w.$gtype);const de={stories:[w]},fe={title:`Buttons/Button Styles`,description:`Buttons with Adwaita style classes: .pill, .circular, .suggested-action, .destructive-action, .flat.`,controls:[{name:`label`,label:`Demo label`,type:n.TEXT,defaultValue:`Click me`},{name:`style`,label:`Demo style`,type:n.SELECT,options:[{label:`Pill`,value:`pill`},{label:`Circular (icon)`,value:`circular`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`},{label:`Flat`,value:`flat`}],defaultValue:`suggested-action`}]};var pe=__exportAll({ButtonStylesStories:()=>he,ButtonStylesStory:()=>T});const me=[`pill`,`circular`,`suggested-action`,`destructive-action`,`flat`];var T=class ButtonStylesStory extends p{_demo=null;static{l.registerClass({GTypeName:`AdwStorybookButtonStyles`},ButtonStylesStory)}constructor(){super(p.fromMeta(ButtonStylesStory.getMetadata(),`Default`))}static getMetadata(){return{...fe,component:f.Button.$gtype}}initialize(){let e=new o.WrapBox({childSpacing:12,lineSpacing:12,halign:f.Align.CENTER}),t=new f.Button({label:`Pill`});t.add_css_class(`pill`),e.append(t);let n=new f.Button({iconName:`list-add-symbolic`});n.add_css_class(`circular`),e.append(n);let r=new f.Button({label:`Suggested`});r.add_css_class(`suggested-action`),e.append(r);let i=new f.Button({label:`Delete`});i.add_css_class(`destructive-action`),e.append(i);let a=new f.Button({label:`Flat`});a.add_css_class(`flat`),e.append(a),this._demo=new f.Button({label:this.args.label}),this._applyStyle(this.args.style),e.append(this._demo),this.addContent(e)}_applyStyle(e){if(this._demo){for(let e of me)this._demo.remove_css_class(e);this._demo.add_css_class(e)}}updateArgs(e){this._demo&&(this._demo.label=this.args.label,this._applyStyle(this.args.style))}};l.type_ensure(T.$gtype);const he={stories:[T]},ge={title:`Buttons/Split Button`,description:`Adw.SplitButton — a primary action button paired with a dropdown menu of related actions.`,controls:[{name:`label`,label:`Label`,type:n.TEXT,defaultValue:`Save`},{name:`iconName`,label:`Icon`,type:n.SELECT,options:[{label:`None`,value:``},{label:`Save`,value:`document-save-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Add`,value:`list-add-symbolic`}],defaultValue:`document-save-symbolic`}]},_e={title:`Buttons/Split Button Flat`,description:`Adw.SplitButton with the .flat style class, as used inside header bars and toolbars.`,controls:[{name:`label`,label:`Label`,type:n.TEXT,defaultValue:`Reply`},{name:`iconName`,label:`Icon`,type:n.SELECT,options:[{label:`None`,value:``},{label:`Reply`,value:`mail-reply-sender-symbolic`},{label:`Edit`,value:`document-edit-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`mail-reply-sender-symbolic`}]};var ve=__exportAll({SplitButtonFlatStory:()=>D,SplitButtonStories:()=>ye,SplitButtonStory:()=>E});function buildMenu(){let e=new _.Menu;return e.append(`Save as…`,`app.save-as`),e.append(`Export`,`app.export`),e.append(`Print`,`app.print`),e}var E=class SplitButtonStory extends p{_widget=null;static{l.registerClass({GTypeName:`AdwStorybookSplitButton`},SplitButtonStory)}constructor(){super(p.fromMeta(SplitButtonStory.getMetadata(),`Default`))}static getMetadata(){return{...ge,component:o.SplitButton.$gtype}}initialize(){this._widget=new o.SplitButton({label:this.args.label,menuModel:buildMenu()});let e=this.args.iconName;e&&(this._widget.iconName=e),this.addContent(this._widget)}updateArgs(e){if(!this._widget)return;let t=this.args.iconName;t?this._widget.iconName=t:this._widget.label=this.args.label}};l.type_ensure(E.$gtype);var D=class SplitButtonFlatStory extends p{_widget=null;static{l.registerClass({GTypeName:`AdwStorybookSplitButtonFlat`},SplitButtonFlatStory)}constructor(){super(p.fromMeta(SplitButtonFlatStory.getMetadata(),`Default`))}static getMetadata(){return{..._e,component:o.SplitButton.$gtype}}initialize(){this._widget=new o.SplitButton({label:this.args.label,menuModel:buildMenu()}),this._widget.add_css_class(`flat`);let e=this.args.iconName;e&&(this._widget.iconName=e),this.addContent(this._widget)}updateArgs(e){if(!this._widget)return;let t=this.args.iconName;t?this._widget.iconName=t:this._widget.label=this.args.label}};l.type_ensure(D.$gtype);const ye={stories:[E,D]},be={title:`Buttons/Toggle Group`,description:`Adw.ToggleGroup — a linked group of Adw.Toggle buttons where exactly one is active.`,controls:[{name:`active`,label:`Active toggle`,type:n.SELECT,options:[{label:`List`,value:0},{label:`Grid`,value:1},{label:`Columns`,value:2}],defaultValue:0},{name:`style`,label:`Style`,type:n.SELECT,options:[{label:`Default`,value:`default`},{label:`Flat`,value:`flat`},{label:`Round`,value:`round`}],defaultValue:`default`}]};var xe=__exportAll({ToggleGroupStories:()=>Ce,ToggleGroupStory:()=>O});const Se=[`flat`,`round`];var O=class ToggleGroupStory extends p{_toggleGroup=null;static{l.registerClass({GTypeName:`AdwStorybookToggleGroup`},ToggleGroupStory)}constructor(){super(p.fromMeta(ToggleGroupStory.getMetadata(),`Default`))}static getMetadata(){return{...be,component:o.ToggleGroup.$gtype}}initialize(){this._toggleGroup=new o.ToggleGroup,this._toggleGroup.add(new o.Toggle({label:`List`,iconName:`view-list-symbolic`})),this._toggleGroup.add(new o.Toggle({label:`Grid`,iconName:`view-grid-symbolic`})),this._toggleGroup.add(new o.Toggle({label:`Columns`,iconName:`view-columns-symbolic`})),this._toggleGroup.active=this.args.active,this._applyStyle(this.args.style),this.addContent(this._toggleGroup)}_applyStyle(e){if(this._toggleGroup){for(let e of Se)this._toggleGroup.remove_css_class(e);e!=="default"&&this._toggleGroup.add_css_class(e)}}updateArgs(e){this._toggleGroup&&(this._toggleGroup.active=this.args.active,this._applyStyle(this.args.style))}};l.type_ensure(O.$gtype);const Ce={stories:[O]},we={title:`Feedback/About Dialog`,description:`Adw.AboutDialog — the standard Adwaita about window with application name, version, credits and license.`,controls:[{name:`applicationName`,label:`Application name`,type:n.TEXT,defaultValue:`Adwaita Storybook`},{name:`version`,label:`Version`,type:n.TEXT,defaultValue:`0.11.0`}]};var Te=__exportAll({AboutDialogStories:()=>Ee,AboutDialogStory:()=>k}),k=class AboutDialogStory extends p{_button=null;static{l.registerClass({GTypeName:`AdwStorybookAboutDialog`},AboutDialogStory)}constructor(){super(p.fromMeta(AboutDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...we,component:o.AboutDialog.$gtype}}initialize(){this._button=new f.Button({label:`Show dialog`,halign:f.Align.CENTER,valign:f.Align.CENTER}),this._button.add_css_class(`pill`),this._button.add_css_class(`suggested-action`),this._button.connect(`clicked`,()=>this._present()),this.addContent(this._button)}_present(){new o.AboutDialog({applicationName:this.args.applicationName,applicationIcon:`application-x-executable-symbolic`,developerName:`A GJSify Project`,version:this.args.version,comments:`A live catalogue of native GTK and Adwaita widgets, rendered under GJS.`,website:`https://github.com/gjsify/gjsify`,issueUrl:`https://github.com/gjsify/gjsify/issues`,licenseType:f.License.MIT_X11,developers:[`Ada Lovelace`,`Grace Hopper`],designers:[`Margaret Hamilton`],copyright:`© 2026 The GJSify Project`}).present(this)}updateArgs(e){}};l.type_ensure(k.$gtype);const Ee={stories:[k]},De={title:`Feedback/Alert Dialog`,description:`Adw.AlertDialog — a modal dialog with a heading, body text and responses, including a destructive action.`,controls:[{name:`heading`,label:`Heading`,type:n.TEXT,defaultValue:`Delete Project?`},{name:`body`,label:`Body`,type:n.TEXT,defaultValue:`This will permanently remove the project and all of its files. This action cannot be undone.`}]};var Oe=__exportAll({AlertDialogStories:()=>ke,AlertDialogStory:()=>A}),A=class AlertDialogStory extends p{_button=null;static{l.registerClass({GTypeName:`AdwStorybookAlertDialog`},AlertDialogStory)}constructor(){super(p.fromMeta(AlertDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...De,component:o.AlertDialog.$gtype}}initialize(){this._button=new f.Button({label:`Show dialog`,halign:f.Align.CENTER,valign:f.Align.CENTER}),this._button.add_css_class(`pill`),this._button.add_css_class(`suggested-action`),this._button.connect(`clicked`,()=>this._present()),this.addContent(this._button)}_present(){let e=new o.AlertDialog({heading:this.args.heading,body:this.args.body});e.add_response(`cancel`,`Cancel`),e.add_response(`delete`,`Delete`),e.set_response_appearance(`delete`,o.ResponseAppearance.DESTRUCTIVE),e.set_default_response(`cancel`),e.set_close_response(`cancel`),e.present(this)}updateArgs(e){}};l.type_ensure(A.$gtype);const ke={stories:[A]},Ae={title:`Feedback/Preferences Dialog`,description:`Adw.PreferencesDialog — a preferences window with a page, a group and a handful of boxed-list rows.`,controls:[{name:`pageTitle`,label:`Page title`,type:n.TEXT,defaultValue:`General`},{name:`groupTitle`,label:`Group title`,type:n.TEXT,defaultValue:`Appearance`}]};var je=__exportAll({PreferencesDialogStories:()=>Me,PreferencesDialogStory:()=>j}),j=class PreferencesDialogStory extends p{_button=null;static{l.registerClass({GTypeName:`AdwStorybookPreferencesDialog`},PreferencesDialogStory)}constructor(){super(p.fromMeta(PreferencesDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...Ae,component:o.PreferencesDialog.$gtype}}initialize(){this._button=new f.Button({label:`Show dialog`,halign:f.Align.CENTER,valign:f.Align.CENTER}),this._button.add_css_class(`pill`),this._button.add_css_class(`suggested-action`),this._button.connect(`clicked`,()=>this._present()),this.addContent(this._button)}_present(){let e=new o.PreferencesDialog,t=new o.PreferencesPage({title:this.args.pageTitle,iconName:`preferences-system-symbolic`}),n=new o.PreferencesGroup({title:this.args.groupTitle,description:`Control how the application looks and behaves.`});n.add(new o.SwitchRow({title:`Dark style`,subtitle:`Use a dark colour scheme`,active:!0})),n.add(new o.ComboRow({title:`Accent colour`,model:new f.StringList({strings:[`Blue`,`Teal`,`Green`,`Orange`,`Purple`]}),selected:0})),n.add(new o.SpinRow({title:`Font size`,adjustment:new f.Adjustment({lower:8,upper:24,value:12,stepIncrement:1,pageIncrement:4})})),t.add(n),e.add(t),e.present(this)}updateArgs(e){}};l.type_ensure(j.$gtype);const Me={stories:[j]},Ne={title:`Feedback/Toast`,description:`Adw.Toast — a transient notification, with an optional action button, shown over an Adw.ToastOverlay.`,controls:[{name:`title`,label:`Toast text`,type:n.TEXT,defaultValue:`File moved to Trash`},{name:`timeout`,label:`Timeout (s)`,type:n.NUMBER,min:0,max:10,step:1,defaultValue:3},{name:`hasButton`,label:`Action button`,type:n.BOOLEAN,defaultValue:!0},{name:`buttonLabel`,label:`Button label`,type:n.TEXT,defaultValue:`Undo`}]};var Pe=__exportAll({ToastStories:()=>Fe,ToastStory:()=>M}),M=class ToastStory extends p{_overlay=null;static{l.registerClass({GTypeName:`AdwStorybookToast`},ToastStory)}constructor(){super(p.fromMeta(ToastStory.getMetadata(),`Default`))}static getMetadata(){return{...Ne,component:o.Toast.$gtype}}initialize(){let e=new f.Button({label:`Show toast`,halign:f.Align.CENTER,valign:f.Align.CENTER});e.add_css_class(`pill`),e.add_css_class(`suggested-action`),e.connect(`clicked`,()=>this._showToast()),this._overlay=new o.ToastOverlay({child:e,widthRequest:360,heightRequest:220}),this.addContent(this._overlay)}_showToast(){if(!this._overlay)return;let e=new o.Toast({title:this.args.title,timeout:this.args.timeout});this.args.hasButton&&(e.buttonLabel=this.args.buttonLabel),this._overlay.add_toast(e)}updateArgs(e){}};l.type_ensure(M.$gtype);const Fe={stories:[M]},Ie={title:`Layout/Clamp`,description:`Adw.Clamp limits its child to a maximum width and centres it, tightening the layout as space shrinks.`,controls:[{name:`maximumSize`,label:`Maximum size`,type:n.RANGE,min:200,max:600,step:10,defaultValue:400},{name:`tighteningThreshold`,label:`Tightening threshold`,type:n.RANGE,min:100,max:600,step:10,defaultValue:300}]};var Le=__exportAll({ClampStories:()=>Re,ClampStory:()=>N}),N=class ClampStory extends p{_clamp=null;static{l.registerClass({GTypeName:`AdwStorybookClamp`},ClampStory)}constructor(){super(p.fromMeta(ClampStory.getMetadata(),`Default`))}static getMetadata(){return{...Ie,component:o.Clamp.$gtype}}initialize(){let e=new f.Box({orientation:f.Orientation.HORIZONTAL,widthRequest:520});e.add_css_class(`card`);let t=new f.Label({label:`This content is clamped — it stops growing past the maximum size and stays centred.`,wrap:!0,xalign:0,hexpand:!0,marginTop:18,marginBottom:18,marginStart:18,marginEnd:18});e.append(t),this._clamp=new o.Clamp({maximumSize:this.args.maximumSize,tighteningThreshold:this.args.tighteningThreshold,child:e}),this.addContent(this._clamp)}updateArgs(e){this._clamp&&(this._clamp.maximumSize=this.args.maximumSize,this._clamp.tighteningThreshold=this.args.tighteningThreshold)}};l.type_ensure(N.$gtype);const Re={stories:[N]},ze={title:`Layout/Header Bar`,description:`Adw.HeaderBar hosts a custom title widget with start and end controls — the standard top chrome of an Adwaita window.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:n.TEXT,defaultValue:`notes.md`},{name:`showTitle`,label:`Show title`,type:n.BOOLEAN,defaultValue:!0}]};var Be=__exportAll({HeaderBarStories:()=>Ve,HeaderBarStory:()=>P}),P=class HeaderBarStory extends p{_headerBar=null;_title=null;static{l.registerClass({GTypeName:`AdwStorybookHeaderBar`},HeaderBarStory)}constructor(){super(p.fromMeta(HeaderBarStory.getMetadata(),`Default`))}static getMetadata(){return{...ze,component:o.HeaderBar.$gtype}}initialize(){this._title=new o.WindowTitle({title:this.args.title,subtitle:this.args.subtitle}),this._headerBar=new o.HeaderBar({titleWidget:this._title,showTitle:this.args.showTitle,widthRequest:460});let e=new f.Button({iconName:`go-previous-symbolic`});e.add_css_class(`flat`),this._headerBar.pack_start(e);let t=new _.Menu;t.append(`New Window`,`app.new-window`),t.append(`Preferences`,`app.preferences`),t.append(`About`,`app.about`);let n=new f.MenuButton({iconName:`open-menu-symbolic`,menuModel:t});n.add_css_class(`flat`),this._headerBar.pack_end(n),this.addContent(this._headerBar)}updateArgs(e){!this._headerBar||!this._title||(this._title.title=this.args.title,this._title.subtitle=this.args.subtitle,this._headerBar.showTitle=this.args.showTitle)}};l.type_ensure(P.$gtype);const Ve={stories:[P]},He={title:`Layout/Toolbar View`,description:`Adw.ToolbarView pins a top header bar and a bottom toolbar around its content, each independently revealable.`,controls:[{name:`revealTopBars`,label:`Reveal top bars`,type:n.BOOLEAN,defaultValue:!0},{name:`revealBottomBars`,label:`Reveal bottom bars`,type:n.BOOLEAN,defaultValue:!0}]};var Ue=__exportAll({ToolbarViewStories:()=>We,ToolbarViewStory:()=>F}),F=class ToolbarViewStory extends p{_view=null;static{l.registerClass({GTypeName:`AdwStorybookToolbarView`},ToolbarViewStory)}constructor(){super(p.fromMeta(ToolbarViewStory.getMetadata(),`Default`))}static getMetadata(){return{...He,component:o.ToolbarView.$gtype}}initialize(){this._view=new o.ToolbarView({widthRequest:460,heightRequest:320,revealTopBars:this.args.revealTopBars,revealBottomBars:this.args.revealBottomBars});let e=new o.HeaderBar({titleWidget:new o.WindowTitle({title:`Documents`,subtitle:`12 items`})});this._view.add_top_bar(e);let t=new o.StatusPage({iconName:`folder-documents-symbolic`,title:`Your library`,description:`Content sits between the toolbars and scrolls independently of them.`});this._view.content=t;let n=new f.ActionBar,r=new f.Button({iconName:`list-add-symbolic`});r.add_css_class(`flat`);let i=new f.Button({iconName:`list-remove-symbolic`});i.add_css_class(`flat`),n.pack_start(r),n.pack_start(i),n.set_center_widget(new f.Label({label:`Selection: none`}));let a=new f.Button({iconName:`send-to-symbolic`});a.add_css_class(`flat`),n.pack_end(a),this._view.add_bottom_bar(n),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.revealTopBars=this.args.revealTopBars,this._view.revealBottomBars=this.args.revealBottomBars)}};l.type_ensure(F.$gtype);const We={stories:[F]},Ge={title:`Layout/Wrap Box`,description:`Adw.WrapBox flows its children horizontally and wraps them onto new lines when they run out of room.`,controls:[{name:`childSpacing`,label:`Child spacing`,type:n.RANGE,min:0,max:36,step:1,defaultValue:8},{name:`lineSpacing`,label:`Line spacing`,type:n.RANGE,min:0,max:36,step:1,defaultValue:8}]};var Ke=__exportAll({WrapBoxStories:()=>qe,WrapBoxStory:()=>I}),I=class WrapBoxStory extends p{_wrap=null;static{l.registerClass({GTypeName:`AdwStorybookWrapBox`},WrapBoxStory)}constructor(){super(p.fromMeta(WrapBoxStory.getMetadata(),`Default`))}static getMetadata(){return{...Ge,component:o.WrapBox.$gtype}}initialize(){this._wrap=new o.WrapBox({childSpacing:this.args.childSpacing,lineSpacing:this.args.lineSpacing,widthRequest:460});for(let e of[`Design`,`Adwaita`,`GNOME`,`GTK`,`Typescript`,`Storybook`,`Wrapping`,`Layout`]){let t=new f.Button({label:e});t.add_css_class(`pill`),this._wrap.append(t)}this.addContent(this._wrap)}updateArgs(e){this._wrap&&(this._wrap.childSpacing=this.args.childSpacing,this._wrap.lineSpacing=this.args.lineSpacing)}};l.type_ensure(I.$gtype);const qe={stories:[I]},Je={title:`Navigation/Bottom Sheet`,description:`Adw.BottomSheet — a sheet that slides up over the content. Toggle "Open" to reveal it.`,controls:[{name:`open`,label:`Open`,type:n.BOOLEAN,defaultValue:!0},{name:`modal`,label:`Modal`,type:n.BOOLEAN,defaultValue:!0},{name:`canClose`,label:`Can close`,type:n.BOOLEAN,defaultValue:!0}]};var Ye=__exportAll({BottomSheetStories:()=>Xe,BottomSheetStory:()=>L}),L=class BottomSheetStory extends p{_sheet=null;static{l.registerClass({GTypeName:`AdwStorybookBottomSheet`},BottomSheetStory)}constructor(){super(p.fromMeta(BottomSheetStory.getMetadata(),`Default`))}static getMetadata(){return{...Je,component:o.BottomSheet.$gtype}}buildContent(){let e=new f.Button({label:`Toggle sheet`,halign:f.Align.CENTER,valign:f.Align.CENTER,vexpand:!0});return e.add_css_class(`pill`),e.add_css_class(`suggested-action`),e.connect(`clicked`,()=>{this._sheet&&(this._sheet.open=!this._sheet.open)}),e}buildSheet(){let e=new f.Box({orientation:f.Orientation.VERTICAL,spacing:12,marginTop:18,marginBottom:24,marginStart:18,marginEnd:18});e.append(new f.Label({label:`Share track`,halign:f.Align.START,cssClasses:[`title-2`]}));let t=new o.PreferencesGroup;for(let[e,n]of[[`Copy link`,`edit-copy-symbolic`],[`Send to a friend`,`mail-send-symbolic`],[`Add to playlist`,`list-add-symbolic`]]){let r=new o.ActionRow({title:e});r.add_prefix(new f.Image({iconName:n})),r.activatable=!0,t.add(r)}return e.append(t),e}initialize(){this._sheet=new o.BottomSheet({content:this.buildContent(),sheet:this.buildSheet(),open:this.args.open,modal:this.args.modal,canClose:this.args.canClose,widthRequest:480,heightRequest:340}),this.addContent(this._sheet)}updateArgs(e){this._sheet&&(this._sheet.open=this.args.open,this._sheet.modal=this.args.modal,this._sheet.canClose=this.args.canClose)}};l.type_ensure(L.$gtype);const Xe={stories:[L]},Ze={title:`Navigation/Navigation Split View`,description:`Adw.NavigationSplitView — a resizable sidebar beside a content pane. When collapsed it folds into a navigation stack.`,controls:[{name:`showContent`,label:`Show content`,type:n.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:n.BOOLEAN,defaultValue:!1}]};var Qe=__exportAll({NavigationSplitViewStories:()=>et,NavigationSplitViewStory:()=>$e}),$e=class NavigationSplitViewStory extends p{_view=null;static{l.registerClass({GTypeName:`AdwStorybookNavigationSplitView`},NavigationSplitViewStory)}constructor(){super(p.fromMeta(NavigationSplitViewStory.getMetadata(),`Default`))}static getMetadata(){return{...Ze,component:o.NavigationSplitView.$gtype}}buildSidebar(){let e=new o.PreferencesGroup;for(let[t,n,r]of[[`All Mail`,`128 messages`,`mail-unread-symbolic`],[`Starred`,`6 messages`,`starred-symbolic`],[`Drafts`,`2 messages`,`document-edit-symbolic`],[`Archive`,`512 messages`,`folder-symbolic`]]){let i=new o.ActionRow({title:t,subtitle:n});i.add_prefix(new f.Image({iconName:r})),i.activatable=!0,e.add(i)}let t=new o.ToolbarView;return t.add_top_bar(new o.HeaderBar),t.content=e,new o.NavigationPage({title:`Mailboxes`,child:t})}buildContent(){let e=new o.StatusPage({iconName:`mail-unread-symbolic`,title:`All Mail`,description:`Select a conversation from the list to read it here.`,vexpand:!0}),t=new o.ToolbarView;return t.add_top_bar(new o.HeaderBar),t.content=e,new o.NavigationPage({title:`All Mail`,child:t})}initialize(){this._view=new o.NavigationSplitView({sidebar:this.buildSidebar(),content:this.buildContent(),showContent:this.args.showContent,collapsed:this.args.collapsed,widthRequest:480,heightRequest:340}),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.showContent=this.args.showContent,this._view.collapsed=this.args.collapsed)}};l.type_ensure($e.$gtype);const et={stories:[$e]},tt={title:`Navigation/Navigation View`,description:`Adw.NavigationView — a navigation stack. The root page pushes a detail page, which gets an automatic back button.`,controls:[{name:`rootTitle`,label:`Root title`,type:n.TEXT,defaultValue:`Contacts`},{name:`detailTitle`,label:`Detail title`,type:n.TEXT,defaultValue:`Ada Lovelace`},{name:`animateTransitions`,label:`Animate transitions`,type:n.BOOLEAN,defaultValue:!0}]};var nt=__exportAll({NavigationViewStories:()=>rt,NavigationViewStory:()=>R}),R=class NavigationViewStory extends p{_view=null;static{l.registerClass({GTypeName:`AdwStorybookNavigationView`},NavigationViewStory)}constructor(){super(p.fromMeta(NavigationViewStory.getMetadata(),`Default`))}static getMetadata(){return{...tt,component:o.NavigationView.$gtype}}buildPage(e,t){let n=new o.ToolbarView;return n.add_top_bar(new o.HeaderBar),n.content=t,new o.NavigationPage({title:e,child:n})}initialize(){this._view=new o.NavigationView({animateTransitions:this.args.animateTransitions,widthRequest:480,heightRequest:340});let e=this.buildPage(this.args.detailTitle,new o.StatusPage({iconName:`avatar-default-symbolic`,title:this.args.detailTitle,description:`Mathematician and writer, the first computer programmer.`,vexpand:!0})),t=new f.Button({label:`Open contact`,halign:f.Align.CENTER,valign:f.Align.CENTER,vexpand:!0});t.add_css_class(`pill`),t.add_css_class(`suggested-action`),t.connect(`clicked`,()=>{this._view?.push(e)});let n=this.buildPage(this.args.rootTitle,t);this._view.add(n),this._view.add(e),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.animateTransitions=this.args.animateTransitions)}};l.type_ensure(R.$gtype);const rt={stories:[R]},it={title:`Navigation/Overlay Split View`,description:`Adw.OverlaySplitView — a sidebar shown beside the content, or overlaid on top of it when collapsed.`,controls:[{name:`showSidebar`,label:`Show sidebar`,type:n.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:n.BOOLEAN,defaultValue:!1}]};var at=__exportAll({OverlaySplitViewStories:()=>ot,OverlaySplitViewStory:()=>z}),z=class OverlaySplitViewStory extends p{_view=null;static{l.registerClass({GTypeName:`AdwStorybookOverlaySplitView`},OverlaySplitViewStory)}constructor(){super(p.fromMeta(OverlaySplitViewStory.getMetadata(),`Default`))}static getMetadata(){return{...it,component:o.OverlaySplitView.$gtype}}buildSidebar(){let e=new o.PreferencesGroup;for(let[t,n]of[[`Home`,`go-home-symbolic`],[`Discover`,`system-search-symbolic`],[`Library`,`folder-music-symbolic`],[`Settings`,`emblem-system-symbolic`]]){let r=new o.ActionRow({title:t});r.add_prefix(new f.Image({iconName:n})),r.activatable=!0,e.add(r)}let t=new o.ToolbarView;return t.add_top_bar(new o.HeaderBar({showTitle:!1})),t.content=e,t.add_css_class(`sidebar`),t}buildContent(){let e=new o.StatusPage({iconName:`folder-music-symbolic`,title:`Your Library`,description:`Toggle the sidebar to browse sections. Collapse it to overlay the content.`,vexpand:!0}),t=new o.ToolbarView;return t.add_top_bar(new o.HeaderBar),t.content=e,t}initialize(){this._view=new o.OverlaySplitView({sidebar:this.buildSidebar(),content:this.buildContent(),showSidebar:this.args.showSidebar,collapsed:this.args.collapsed,widthRequest:480,heightRequest:340}),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.showSidebar=this.args.showSidebar,this._view.collapsed=this.args.collapsed)}};l.type_ensure(z.$gtype);const ot={stories:[z]},st={title:`Navigation/Sidebar`,description:`Adw.Sidebar — a selectable list of Adw.SidebarItem grouped into sections. Selecting an item updates the content.`,controls:[{name:`mode`,label:`Mode`,type:n.SELECT,options:[{label:`Sidebar`,value:`sidebar`},{label:`Page`,value:`page`}],defaultValue:`sidebar`},{name:`selected`,label:`Selected index`,type:n.NUMBER,min:0,max:3,step:1,defaultValue:0}]};var ct=__exportAll({SidebarStories:()=>lt,SidebarStory:()=>B}),B=class SidebarStory extends p{_sidebar=null;_status=null;static{l.registerClass({GTypeName:`AdwStorybookSidebar`},SidebarStory)}constructor(){super(p.fromMeta(SidebarStory.getMetadata(),`Default`))}static getMetadata(){return{...st,component:o.Sidebar.$gtype}}items=[{title:`Inbox`,subtitle:`3 unread`,icon:`mail-unread-symbolic`},{title:`Starred`,subtitle:`Favourites`,icon:`starred-symbolic`},{title:`Sent`,subtitle:`Outgoing mail`,icon:`mail-send-symbolic`},{title:`Archive`,subtitle:`Older mail`,icon:`folder-symbolic`}];modeFromArg(e){return e===`page`?o.SidebarMode.PAGE:o.SidebarMode.SIDEBAR}syncContent(){if(!this._sidebar||!this._status)return;let e=this.items[this._sidebar.selected]??this.items[0];this._status.title=e.title,this._status.iconName=e.icon,this._status.description=e.subtitle}initialize(){let e=new o.SidebarSection({title:`Mailboxes`});for(let t of this.items)e.append(new o.SidebarItem({title:t.title,subtitle:t.subtitle,iconName:t.icon}));this._sidebar=new o.Sidebar({mode:this.modeFromArg(this.args.mode),selected:this.args.selected,widthRequest:220}),this._sidebar.append(e),this._sidebar.connect(`notify::selected`,()=>this.syncContent()),this._status=new o.StatusPage({hexpand:!0,vexpand:!0});let t=new f.Box({orientation:f.Orientation.HORIZONTAL,widthRequest:480,heightRequest:340});t.append(this._sidebar),t.append(new f.Separator({orientation:f.Orientation.VERTICAL})),t.append(this._status),this.syncContent(),this.addContent(t)}updateArgs(e){this._sidebar&&(this._sidebar.mode=this.modeFromArg(this.args.mode),this._sidebar.selected=this.args.selected,this.syncContent())}};l.type_ensure(B.$gtype);const lt={stories:[B]},ut={title:`Presentation/Avatar`,description:`A circular avatar that derives initials (and a colour) from a name, or shows a symbolic icon.`,controls:[{name:`text`,label:`Name`,type:n.TEXT,defaultValue:`Ada Lovelace`},{name:`size`,label:`Size`,type:n.RANGE,min:24,max:160,step:8,defaultValue:96},{name:`showInitials`,label:`Show initials`,type:n.BOOLEAN,defaultValue:!0},{name:`iconName`,label:`Fallback icon`,type:n.SELECT,options:[{label:`Person`,value:`avatar-default-symbolic`},{label:`Contact`,value:`contact-new-symbolic`},{label:`Camera`,value:`camera-photo-symbolic`}],defaultValue:`avatar-default-symbolic`}]};var dt=__exportAll({AvatarStories:()=>ft,AvatarStory:()=>V}),V=class AvatarStory extends p{_avatar=null;static{l.registerClass({GTypeName:`AdwStorybookAvatar`},AvatarStory)}constructor(){super(p.fromMeta(AvatarStory.getMetadata(),`Default`))}static getMetadata(){return{...ut,component:o.Avatar.$gtype}}initialize(){this._avatar=new o.Avatar({size:this.args.size,text:this.args.text,showInitials:this.args.showInitials,iconName:this.args.iconName}),this.addContent(this._avatar)}updateArgs(e){this._avatar&&(this._avatar.size=this.args.size,this._avatar.text=this.args.text,this._avatar.showInitials=this.args.showInitials,this._avatar.iconName=this.args.iconName)}};l.type_ensure(V.$gtype);const ft={stories:[V]},pt={title:`Presentation/Banner`,description:`Adw.Banner — a full-width strip carrying a status message and an optional action button.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Metered connection — updates paused`},{name:`buttonLabel`,label:`Button label`,type:n.TEXT,defaultValue:`Resume`},{name:`revealed`,label:`Revealed`,type:n.BOOLEAN,defaultValue:!0},{name:`useMarkup`,label:`Use markup`,type:n.BOOLEAN,defaultValue:!1}]};var mt=__exportAll({BannerStories:()=>ht,BannerStory:()=>H}),H=class BannerStory extends p{_banner=null;static{l.registerClass({GTypeName:`AdwStorybookBanner`},BannerStory)}constructor(){super(p.fromMeta(BannerStory.getMetadata(),`Default`))}static getMetadata(){return{...pt,component:o.Banner.$gtype}}initialize(){this._banner=new o.Banner({title:this.args.title,buttonLabel:this.args.buttonLabel,revealed:this.args.revealed,useMarkup:this.args.useMarkup});let e=new f.Box({orientation:f.Orientation.VERTICAL,widthRequest:460});e.append(this._banner),this.addContent(e)}updateArgs(e){this._banner&&(this._banner.title=this.args.title,this._banner.buttonLabel=this.args.buttonLabel,this._banner.revealed=this.args.revealed,this._banner.useMarkup=this.args.useMarkup)}};l.type_ensure(H.$gtype);const ht={stories:[H]},gt={title:`Presentation/Spinner`,description:`Adw.Spinner — a lightweight loading indicator that spins continuously while visible.`,controls:[{name:`size`,label:`Size`,type:n.RANGE,min:16,max:64,step:4,defaultValue:48}]};var _t=__exportAll({SpinnerStories:()=>vt,SpinnerStory:()=>U}),U=class SpinnerStory extends p{_spinner=null;static{l.registerClass({GTypeName:`AdwStorybookSpinner`},SpinnerStory)}constructor(){super(p.fromMeta(SpinnerStory.getMetadata(),`Default`))}static getMetadata(){return{...gt,component:o.Spinner.$gtype}}initialize(){let e=this.args.size;this._spinner=new o.Spinner({widthRequest:e,heightRequest:e,halign:f.Align.CENTER,valign:f.Align.CENTER}),this.addContent(this._spinner)}updateArgs(e){if(!this._spinner)return;let t=this.args.size;this._spinner.widthRequest=t,this._spinner.heightRequest=t}};l.type_ensure(U.$gtype);const vt={stories:[U]},yt={title:`Presentation/Status Page`,description:`Adw.StatusPage — a full-page empty state with an icon, title, description and optional action.`,controls:[{name:`iconName`,label:`Icon`,type:n.SELECT,options:[{label:`Folder`,value:`folder-symbolic`},{label:`Mail`,value:`mail-unread-symbolic`},{label:`Search`,value:`system-search-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-symbolic`},{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`No Documents`},{name:`description`,label:`Description`,type:n.TEXT,defaultValue:`Documents you create or open will appear here.`}]};var bt=__exportAll({StatusPageStories:()=>xt,StatusPageStory:()=>W}),W=class StatusPageStory extends p{_statusPage=null;static{l.registerClass({GTypeName:`AdwStorybookStatusPage`},StatusPageStory)}constructor(){super(p.fromMeta(StatusPageStory.getMetadata(),`Default`))}static getMetadata(){return{...yt,component:o.StatusPage.$gtype}}initialize(){let e=new f.Button({label:`New Document`,halign:f.Align.CENTER,cssClasses:[`pill`,`suggested-action`]});this._statusPage=new o.StatusPage({iconName:this.args.iconName,title:this.args.title,description:this.args.description,child:e,widthRequest:460,heightRequest:320}),this.addContent(this._statusPage)}updateArgs(e){this._statusPage&&(this._statusPage.iconName=this.args.iconName,this._statusPage.title=this.args.title,this._statusPage.description=this.args.description)}};l.type_ensure(W.$gtype);const xt={stories:[W]},St={title:`Presentation/Window Title`,description:`Adw.WindowTitle — a compact title/subtitle widget intended for a window or header bar.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Inbox`},{name:`subtitle`,label:`Subtitle`,type:n.TEXT,defaultValue:`3 unread messages`}]};var Ct=__exportAll({WindowTitleStories:()=>wt,WindowTitleStory:()=>G}),G=class WindowTitleStory extends p{_windowTitle=null;static{l.registerClass({GTypeName:`AdwStorybookWindowTitle`},WindowTitleStory)}constructor(){super(p.fromMeta(WindowTitleStory.getMetadata(),`Default`))}static getMetadata(){return{...St,component:o.WindowTitle.$gtype}}initialize(){this._windowTitle=new o.WindowTitle({title:this.args.title,subtitle:this.args.subtitle}),this.addContent(this._windowTitle)}updateArgs(e){this._windowTitle&&(this._windowTitle.title=this.args.title,this._windowTitle.subtitle=this.args.subtitle)}};l.type_ensure(G.$gtype);const wt={stories:[G]},Tt={title:`Boxed Lists/Action Row`,description:`Adw.ActionRow — a preferences row with a title/subtitle, a prefix icon and a suffix button, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Wi-Fi`},{name:`subtitle`,label:`Subtitle`,type:n.TEXT,defaultValue:`Connected to Highgarden 5GHz`},{name:`iconName`,label:`Prefix icon`,type:n.SELECT,options:[{label:`Network`,value:`network-wireless-symbolic`},{label:`Folder`,value:`folder-symbolic`},{label:`Starred`,value:`starred-symbolic`}],defaultValue:`network-wireless-symbolic`},{name:`activatable`,label:`Activatable`,type:n.BOOLEAN,defaultValue:!0}]};var Et=__exportAll({ActionRowStories:()=>Dt,ActionRowStory:()=>K}),K=class ActionRowStory extends p{_row=null;_icon=null;_button=null;static{l.registerClass({GTypeName:`AdwStorybookActionRow`},ActionRowStory)}constructor(){super(p.fromMeta(ActionRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Tt,component:o.ActionRow.$gtype}}initialize(){this._row=new o.ActionRow({title:this.args.title,subtitle:this.args.subtitle}),this._icon=new f.Image({iconName:this.args.iconName}),this._row.add_prefix(this._icon),this._button=new f.Button({iconName:`go-next-symbolic`,valign:f.Align.CENTER}),this._button.add_css_class(`flat`),this._row.add_suffix(this._button),this._row.activatableWidget=this._button,this._row.activatable=this.args.activatable;let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){!this._row||!this._icon||(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._icon.iconName=this.args.iconName,this._row.activatable=this.args.activatable)}};l.type_ensure(K.$gtype);const Dt={stories:[K]},Ot={title:`Boxed Lists/Button Row`,description:`Adw.ButtonRow — a full-width row that acts as a button, with an optional icon and style class.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Add account`},{name:`startIconName`,label:`Start icon`,type:n.SELECT,options:[{label:`Add`,value:`list-add-symbolic`},{label:`Trash`,value:`user-trash-symbolic`},{label:`None`,value:``}],defaultValue:`list-add-symbolic`},{name:`style`,label:`Style`,type:n.SELECT,options:[{label:`None`,value:`none`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`}],defaultValue:`suggested-action`}]};var kt=__exportAll({ButtonRowStories:()=>jt,ButtonRowStory:()=>q});const At=[`suggested-action`,`destructive-action`];var q=class ButtonRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookButtonRow`},ButtonRowStory)}constructor(){super(p.fromMeta(ButtonRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Ot,component:o.ButtonRow.$gtype}}initialize(){this._row=new o.ButtonRow({title:this.args.title,startIconName:this.args.startIconName}),this._applyStyle(this.args.style);let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}_applyStyle(e){if(this._row){for(let e of At)this._row.remove_css_class(e);e!==`none`&&this._row.add_css_class(e)}}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.startIconName=this.args.startIconName,this._applyStyle(this.args.style))}};l.type_ensure(q.$gtype);const jt={stories:[q]},Mt=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],Nt={title:`Boxed Lists/Combo Row`,description:`Adw.ComboRow — a preferences row with an inline drop-down backed by a Gtk.StringList.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Accent colour`},{name:`subtitle`,label:`Subtitle`,type:n.TEXT,defaultValue:`Used to highlight selected items`},{name:`selected`,label:`Selected`,type:n.NUMBER,min:0,max:4,step:1,defaultValue:1}]};var Pt=__exportAll({ComboRowStories:()=>Ft,ComboRowStory:()=>J}),J=class ComboRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookComboRow`},ComboRowStory)}constructor(){super(p.fromMeta(ComboRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Nt,component:o.ComboRow.$gtype}}initialize(){this._row=new o.ComboRow({title:this.args.title,subtitle:this.args.subtitle,model:new f.StringList({strings:[...Mt]}),selected:this.args.selected});let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._row.selected=this.args.selected)}};l.type_ensure(J.$gtype);const Ft={stories:[J]},It={title:`Boxed Lists/Entry Row`,description:`Adw.EntryRow — a preferences row whose title doubles as placeholder text for an inline entry.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Display name`},{name:`text`,label:`Text`,type:n.TEXT,defaultValue:`Ada Lovelace`},{name:`showApplyButton`,label:`Show apply button`,type:n.BOOLEAN,defaultValue:!0}]};var Lt=__exportAll({EntryRowStories:()=>Rt,EntryRowStory:()=>Y}),Y=class EntryRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookEntryRow`},EntryRowStory)}constructor(){super(p.fromMeta(EntryRowStory.getMetadata(),`Default`))}static getMetadata(){return{...It,component:o.EntryRow.$gtype}}initialize(){this._row=new o.EntryRow({title:this.args.title,text:this.args.text,showApplyButton:this.args.showApplyButton});let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.text=this.args.text,this._row.showApplyButton=this.args.showApplyButton)}};l.type_ensure(Y.$gtype);const Rt={stories:[Y]},zt={title:`Boxed Lists/Expander Row`,description:`Adw.ExpanderRow — a preferences row that discloses nested rows and can carry an enable switch.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Proxy settings`},{name:`subtitle`,label:`Subtitle`,type:n.TEXT,defaultValue:`Route traffic through a custom proxy`},{name:`expanded`,label:`Expanded`,type:n.BOOLEAN,defaultValue:!0},{name:`showEnableSwitch`,label:`Show enable switch`,type:n.BOOLEAN,defaultValue:!1}]};var Bt=__exportAll({ExpanderRowStories:()=>Vt,ExpanderRowStory:()=>X}),X=class ExpanderRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookExpanderRow`},ExpanderRowStory)}constructor(){super(p.fromMeta(ExpanderRowStory.getMetadata(),`Default`))}static getMetadata(){return{...zt,component:o.ExpanderRow.$gtype}}initialize(){this._row=new o.ExpanderRow({title:this.args.title,subtitle:this.args.subtitle,expanded:this.args.expanded,showEnableSwitch:this.args.showEnableSwitch}),this._row.add_row(new o.EntryRow({title:`Host`,text:`proxy.example.com`})),this._row.add_row(new o.SwitchRow({title:`Use authentication`,active:!1}));let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._row.expanded=this.args.expanded,this._row.showEnableSwitch=this.args.showEnableSwitch)}};l.type_ensure(X.$gtype);const Vt={stories:[X]},Ht={title:`Boxed Lists/Password Entry Row`,description:`Adw.PasswordEntryRow — an entry row that masks its contents and shows a peek toggle.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Password`},{name:`text`,label:`Text`,type:n.TEXT,defaultValue:`correct-horse-battery`}]};var Ut=__exportAll({PasswordEntryRowStories:()=>Wt,PasswordEntryRowStory:()=>Z}),Z=class PasswordEntryRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookPasswordEntryRow`},PasswordEntryRowStory)}constructor(){super(p.fromMeta(PasswordEntryRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Ht,component:o.PasswordEntryRow.$gtype}}initialize(){this._row=new o.PasswordEntryRow({title:this.args.title,text:this.args.text});let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.text=this.args.text)}};l.type_ensure(Z.$gtype);const Wt={stories:[Z]},Gt={title:`Boxed Lists/Preferences Group`,description:`Adw.PreferencesGroup — the boxed-list container that gathers a title, description, header-suffix widget and rows.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Account`},{name:`description`,label:`Description`,type:n.TEXT,defaultValue:`Manage how this device signs in and syncs.`}]};var Kt=__exportAll({PreferencesGroupStories:()=>qt,PreferencesGroupStory:()=>Q}),Q=class PreferencesGroupStory extends p{_prefsGroup=null;static{l.registerClass({GTypeName:`AdwStorybookPreferencesGroup`},PreferencesGroupStory)}constructor(){super(p.fromMeta(PreferencesGroupStory.getMetadata(),`Default`))}static getMetadata(){return{...Gt,component:o.PreferencesGroup.$gtype}}initialize(){let e=new f.Button({label:`Sign out`,valign:f.Align.CENTER});e.add_css_class(`flat`),this._prefsGroup=new o.PreferencesGroup({title:this.args.title,description:this.args.description,headerSuffix:e});let t=new o.EntryRow({title:`Display name`,text:`Grace Hopper`});this._prefsGroup.add(t);let n=new o.SwitchRow({title:`Sync over Wi-Fi only`,subtitle:`Avoid using mobile data for backups`,active:!0});this._prefsGroup.add(n);let r=new o.ComboRow({title:`Region`,model:new f.StringList({strings:[`Europe`,`Americas`,`Asia`,`Oceania`]}),selected:0});this._prefsGroup.add(r);let i=new o.Clamp({maximumSize:400,child:this._prefsGroup});this.addContent(i)}updateArgs(e){this._prefsGroup&&(this._prefsGroup.title=this.args.title,this._prefsGroup.description=this.args.description)}};l.type_ensure(Q.$gtype);const qt={stories:[Q]},Jt={title:`Boxed Lists/Spin Row`,description:`Adw.SpinRow — a preferences row with an inline spin button over a numeric adjustment.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Font size`},{name:`value`,label:`Value`,type:n.NUMBER,min:0,max:100,step:1,defaultValue:16},{name:`digits`,label:`Digits`,type:n.NUMBER,min:0,max:4,step:1,defaultValue:0}]};var Yt=__exportAll({SpinRowStories:()=>Zt,SpinRowStory:()=>Xt}),Xt=class SpinRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookSpinRow`},SpinRowStory)}constructor(){super(p.fromMeta(SpinRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Jt,component:o.SpinRow.$gtype}}initialize(){this._row=new o.SpinRow({title:this.args.title,adjustment:new f.Adjustment({lower:0,upper:100,value:this.args.value,stepIncrement:1,pageIncrement:10}),digits:this.args.digits});let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.value=this.args.value,this._row.digits=this.args.digits)}};l.type_ensure(Xt.$gtype);const Zt={stories:[Xt]},Qt={title:`Boxed Lists/Switch Row`,description:`Adw.SwitchRow — a preferences row with a trailing switch, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Automatic updates`},{name:`subtitle`,label:`Subtitle`,type:n.TEXT,defaultValue:`Download and install updates without asking`},{name:`active`,label:`Active`,type:n.BOOLEAN,defaultValue:!0}]};var $t=__exportAll({SwitchRowStories:()=>en,SwitchRowStory:()=>$}),$=class SwitchRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookSwitchRow`},SwitchRowStory)}constructor(){super(p.fromMeta(SwitchRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Qt,component:o.SwitchRow.$gtype}}initialize(){this._row=new o.SwitchRow({title:this.args.title,subtitle:this.args.subtitle,active:this.args.active});let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._row.active=this.args.active)}};l.type_ensure($.$gtype);const en={stories:[$]},tn=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:n.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:n.BOOLEAN,defaultValue:!1}],nn={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:tn},rn={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:tn};var an=__exportAll({CarouselDotsStory:()=>sn,CarouselLinesStory:()=>cn,CarouselStories:()=>ln});const on=[{title:`Welcome`,css:`accent`},{title:`Discover`,css:`success`},{title:`Get started`,css:`warning`}];function buildPage(e,t){let n=new f.Box({orientation:f.Orientation.VERTICAL,halign:f.Align.CENTER,valign:f.Align.CENTER,widthRequest:440,heightRequest:260});n.add_css_class(`card`),n.add_css_class(t);let r=new f.Label({label:e,vexpand:!0,valign:f.Align.CENTER});return r.add_css_class(`title-1`),n.append(r),n}var sn=class CarouselDotsStory extends p{_carousel=null;static{l.registerClass({GTypeName:`AdwStorybookCarouselDots`},CarouselDotsStory)}constructor(){super(p.fromMeta(CarouselDotsStory.getMetadata(),`Default`))}static getMetadata(){return{...nn,component:o.Carousel.$gtype}}initialize(){this._carousel=new o.Carousel({allowScrollWheel:this.args.allowScrollWheel,allowLongSwipes:this.args.allowLongSwipes,vexpand:!0});for(let e of on)this._carousel.append(buildPage(e.title,e.css));let e=new o.CarouselIndicatorDots({carousel:this._carousel}),t=new f.Box({orientation:f.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._carousel),t.append(e),this.addContent(t)}updateArgs(e){this._carousel&&(this._carousel.allowScrollWheel=this.args.allowScrollWheel,this._carousel.allowLongSwipes=this.args.allowLongSwipes)}};l.type_ensure(sn.$gtype);var cn=class CarouselLinesStory extends p{_carousel=null;static{l.registerClass({GTypeName:`AdwStorybookCarouselLines`},CarouselLinesStory)}constructor(){super(p.fromMeta(CarouselLinesStory.getMetadata(),`Default`))}static getMetadata(){return{...rn,component:o.Carousel.$gtype}}initialize(){this._carousel=new o.Carousel({allowScrollWheel:this.args.allowScrollWheel,allowLongSwipes:this.args.allowLongSwipes,vexpand:!0});for(let e of on)this._carousel.append(buildPage(e.title,e.css));let e=new o.CarouselIndicatorLines({carousel:this._carousel}),t=new f.Box({orientation:f.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._carousel),t.append(e),this.addContent(t)}updateArgs(e){this._carousel&&(this._carousel.allowScrollWheel=this.args.allowScrollWheel,this._carousel.allowLongSwipes=this.args.allowLongSwipes)}};l.type_ensure(cn.$gtype);const ln={stories:[sn,cn]},un={title:`View Switching/Inline View Switcher`,description:`Adw.InlineViewSwitcher — a compact inline switcher that can show labels, icons, or both for an Adw.ViewStack.`,controls:[{name:`displayMode`,label:`Display mode`,type:n.SELECT,options:[{label:`Labels`,value:`labels`},{label:`Icons`,value:`icons`},{label:`Both`,value:`both`}],defaultValue:`both`}]};var dn=__exportAll({InlineViewSwitcherStories:()=>pn,InlineViewSwitcherStory:()=>fn}),fn=class InlineViewSwitcherStory extends p{_switcher=null;static{l.registerClass({GTypeName:`AdwStorybookInlineViewSwitcher`},InlineViewSwitcherStory)}constructor(){super(p.fromMeta(InlineViewSwitcherStory.getMetadata(),`Default`))}static getMetadata(){return{...un,component:o.InlineViewSwitcher.$gtype}}buildPage(e,t,n){return new o.StatusPage({iconName:t,title:e,description:n,vexpand:!0})}initialize(){let e=new o.ViewStack({vexpand:!0});e.add_titled_with_icon(this.buildPage(`Overview`,`view-grid-symbolic`,`A quick summary of your project.`),`overview`,`Overview`,`view-grid-symbolic`),e.add_titled_with_icon(this.buildPage(`Activity`,`document-edit-symbolic`,`Recent edits and changes.`),`activity`,`Activity`,`document-edit-symbolic`),e.add_titled_with_icon(this.buildPage(`Settings`,`emblem-system-symbolic`,`Configure how things behave.`),`settings`,`Settings`,`emblem-system-symbolic`),this._switcher=new o.InlineViewSwitcher({stack:e,displayMode:this.modeFromArg(this.args.displayMode),halign:f.Align.CENTER});let t=new f.Box({orientation:f.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._switcher),t.append(e),this.addContent(t)}modeFromArg(e){return e===`labels`?o.InlineViewSwitcherDisplayMode.LABELS:e===`icons`?o.InlineViewSwitcherDisplayMode.ICONS:o.InlineViewSwitcherDisplayMode.BOTH}updateArgs(e){this._switcher&&(this._switcher.displayMode=this.modeFromArg(this.args.displayMode))}};l.type_ensure(fn.$gtype);const pn={stories:[fn]},mn={title:`View Switching/Tab View`,description:`Adw.TabView with an Adw.TabBar header — three tabbed pages; the tab bar can auto-hide when only one tab remains.`,controls:[{name:`autohide`,label:`Autohide tab bar`,type:n.BOOLEAN,defaultValue:!1}]};var hn=__exportAll({TabViewStories:()=>vn,TabViewStory:()=>_n});const gn=[{title:`Overview`,body:`A summary of everything at a glance.`},{title:`Details`,body:`The specifics, broken down line by line.`},{title:`History`,body:`A log of every change made so far.`}];var _n=class TabViewStory extends p{_tabBar=null;static{l.registerClass({GTypeName:`AdwStorybookTabView`},TabViewStory)}constructor(){super(p.fromMeta(TabViewStory.getMetadata(),`Default`))}static getMetadata(){return{...mn,component:o.TabView.$gtype}}buildPageBody(e,t){return new o.StatusPage({iconName:`view-paged-symbolic`,title:e,description:t,vexpand:!0})}initialize(){let e=new o.TabView({vexpand:!0});for(let t of gn){let n=e.append(this.buildPageBody(t.title,t.body));n.title=t.title}this._tabBar=new o.TabBar({view:e,autohide:this.args.autohide});let t=new f.Box({orientation:f.Orientation.VERTICAL,widthRequest:480,heightRequest:340});t.append(this._tabBar),t.append(e),this.addContent(t)}updateArgs(e){this._tabBar&&(this._tabBar.autohide=this.args.autohide)}};l.type_ensure(_n.$gtype);const vn={stories:[_n]},yn={title:`View Switching/View Switcher`,description:`Adw.ViewSwitcher — a segmented switcher whose buttons select pages in a paired Adw.ViewStack.`,controls:[{name:`policy`,label:`Policy`,type:n.SELECT,options:[{label:`Wide`,value:`wide`},{label:`Narrow`,value:`narrow`}],defaultValue:`wide`}]};var bn=__exportAll({ViewSwitcherStories:()=>Sn,ViewSwitcherStory:()=>xn}),xn=class ViewSwitcherStory extends p{_switcher=null;static{l.registerClass({GTypeName:`AdwStorybookViewSwitcher`},ViewSwitcherStory)}constructor(){super(p.fromMeta(ViewSwitcherStory.getMetadata(),`Default`))}static getMetadata(){return{...yn,component:o.ViewSwitcher.$gtype}}buildPage(e,t,n){return new o.StatusPage({iconName:t,title:e,description:n,vexpand:!0})}initialize(){let e=new o.ViewStack({vexpand:!0});e.add_titled_with_icon(this.buildPage(`Inbox`,`mail-unread-symbolic`,`You have three unread conversations.`),`inbox`,`Inbox`,`mail-unread-symbolic`),e.add_titled_with_icon(this.buildPage(`Starred`,`starred-symbolic`,`Messages you have marked as important.`),`starred`,`Starred`,`starred-symbolic`),e.add_titled_with_icon(this.buildPage(`Archive`,`folder-symbolic`,`Older conversations kept for reference.`),`archive`,`Archive`,`folder-symbolic`),this._switcher=new o.ViewSwitcher({stack:e,policy:this.policyFromArg(this.args.policy),halign:f.Align.CENTER});let t=new f.Box({orientation:f.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._switcher),t.append(e),this.addContent(t)}policyFromArg(e){return e===`narrow`?o.ViewSwitcherPolicy.NARROW:o.ViewSwitcherPolicy.WIDE}updateArgs(e){this._switcher&&(this._switcher.policy=this.policyFromArg(this.args.policy))}};l.type_ensure(xn.$gtype);const Sn={stories:[xn]};v.timeout_add(v.PRIORITY_DEFAULT,3e3,()=>{try{let e=g.Application.get_default(),t=e?e.get_windows():null;print(`RENDER windows=`+(t?t.length:0))}catch(e){print(`RENDER probe-error `+e)}try{g.Application.get_default()?.quit()}catch{}return v.SOURCE_REMOVE}),await runStorybook({applicationId:`org.gjsify.AdwaitaStorybook`,title:`Adwaita Storybook`,stories:collectStoryModules([ue,pe,ve,xe,Te,Oe,je,Pe,Le,Be,Ue,Ke,Ye,Qe,nt,at,ct,dt,mt,_t,bt,Ct,Et,kt,Pt,Lt,Bt,Ut,Kt,Yt,$t,an,dn,hn,bn])});export{};
|
package/dist/runasync-probe.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";import"@gjsify/node-gi/globals";var t=Object.defineProperty,__name=(e,n)=>t(e,`name`,{value:n,configurable:!0});const n=e(import.meta.url);let r;function load$1(){return r===void 0&&(r=n(`@gjsify/node-gi/gi`).requireGi(`Gio`,`2.0`)),r}__name(load$1,`load`);var i=new Proxy(Object.create(null),{get(e,t){return load$1()[t]},has(e,t){return t in load$1()}});const a=e(import.meta.url);let o;function load(){return o===void 0&&(o=a("@gjsify/node-gi/gi").requireGi(`GLib`,`2.0`)),o}var s=new Proxy(Object.create(null),{get(e,t){return load()[t]},has(e,t){return t in load()}});print(`A: before app`);const c=new i.Application({application_id:`org.gjsify.RunAsyncProbe`,flags:i.ApplicationFlags.NON_UNIQUE});c.connect(`activate`,()=>{print(`C: ACTIVATE fired`),c.hold(),s.timeout_add(s.PRIORITY_DEFAULT,500,()=>(print(`D: GLib timeout fired in loop — quitting`),c.release(),c.quit(),s.SOURCE_REMOVE))}),print(`B: calling runAsync (top-level await)`);const l=await c.runAsync([]);print(`E: runAsync resolved, status=`+l);export{};
|
package/dist/storybook.node.mjs
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";import"@gjsify/node-gi/globals";var t=Object.defineProperty,__name=(e,n)=>t(e,`name`,{value:n,configurable:!0}),__exportAll=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},StoryRegistry=class{constructor(){this.modules=[]}registerStory(e){if(!e||!Array.isArray(e.stories)){console.warn(`Invalid story module provided to registerStory`);return}this.modules.push(e)}registerStories(e){if(!Array.isArray(e)){console.warn(`Invalid story modules array provided to registerStories`);return}let t=e.filter(e=>e&&Array.isArray(e.stories));this.modules.push(...t)}getStories(){return[...this.modules]}createStoryInstances(){for(let e of this.modules)this.instantiateStoriesForModule(e);return[...this.modules]}instantiateStoriesForModule(e){e.instances||=[];let t=e.decorators??[];for(let n of e.stories)try{let r=new n,build=()=>{typeof r.initialize==`function`&&r.initialize()};t.reduceRight((e,t)=>()=>t(e,r),build)(),e.instances.push(r)}catch(e){console.error(`Failed to instantiate story: ${n.name||`Unknown`}`,e)}}},StorybookController=class{constructor(e,t){this._registry=new StoryRegistry,this._activeStory=null,this._unsubArgs=null,this._view=e,this._buildControls=t}mount(e,t=!0){this._registry.registerStories(e);let n=this._registry.createStoryInstances();if(this._view.renderSidebar(this._groupByCategory(n),e=>this.select(e)),t){let e=this._firstStory();e&&this.select(e)}}select(e){this._view.setPreviewTitle(`${e.meta.title} — ${e.story}`),this._view.showPreview(e),this._view.markSelected(e.meta.title),this._wireControls(e),this._activeStory=e}_wireControls(e){this._unsubArgs&&=(this._unsubArgs(),null);let t=this._buildControls(e),n=t.map(e=>e.refresh);this._view.renderControls(t),this._unsubArgs=e.onArgsChanged(e=>{for(let t of n)t(e)})}_groupByCategory(e){let t=new Map;for(let n of e)for(let e of n.instances??[]){let n=e.meta.title.split(`/`),r=n[0],i=n.length>1?n[1]:e.meta.title;t.has(r)||t.set(r,[]),t.get(r).push({instance:e,name:i||`Unnamed`})}return[...t].map(([e,t])=>({category:e,stories:t}))}get activeStory(){return this._activeStory}listStories(){return this._registry.getStories().flatMap(e=>(e.instances??[]).map(e=>({title:e.meta.title,story:e.story,category:e.meta.title.split(`/`)[0],controls:e.meta.controls??[]})))}openStoryByTitle(e){let t=this._findByTitle(e);return t?(this.select(t),!0):!1}getCurrentStory(){let e=this._activeStory;return e?{title:e.meta.title,story:e.story,args:e.args}:null}setActiveArg(e,t){let n=this._activeStory;return n?(n.setArg(e,t),!0):!1}_findByTitle(e){for(let t of this._registry.getStories())for(let n of t.instances??[])if(n.meta.title===e)return n;return null}_firstStory(){for(let e of this._registry.getStories()){let t=(e.instances??[])[0];if(t)return t}return null}};let n=function(e){return e.TEXT=`text`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e.SELECT=`select`,e.RANGE=`range`,e.COLOR=`color`,e}({});function isStoryModule(e){return typeof e==`object`&&!!e&&Array.isArray(e.stories)}function argsFromControls(e=[]){let t={};for(let n of e)t[n.name]=defaultFor(n);return t}function defaultFor(e){if(e.defaultValue!==void 0)return e.defaultValue;switch(e.type){case`text`:return``;case`color`:return`#000000`;case`boolean`:return!1;case`number`:case`range`:return e.min??0;case`select`:return e.options[0]?.value??null;default:return null}}function controlLabel(e){return e.label||e.name}function bindControl(e,t,r){let i=t.name,a=t.description;switch(t.type){case n.TEXT:{let n=r.text(controlLabel(t),a),o=e.args[i];return n.set(typeof o==`string`?o:``),n.onChange(t=>e.setArg(i,t)),{view:n.node,refresh:e=>{let t=typeof e[i]==`string`?e[i]:``;n.get()!==t&&n.set(t)}}}case n.COLOR:{let n=r.color(controlLabel(t),a),o=e.args[i];return n.set(typeof o==`string`?o:`#000000`),n.onChange(t=>e.setArg(i,t)),{view:n.node,refresh:e=>{let t=typeof e[i]==`string`?e[i]:`#000000`;n.get()!==t&&n.set(t)}}}case n.BOOLEAN:{let n=r.boolean(controlLabel(t),a);return n.set(!!e.args[i]),n.onChange(t=>e.setArg(i,t)),{view:n.node,refresh:e=>{let t=!!e[i];n.get()!==t&&n.set(t)}}}case n.NUMBER:{let n=r.number(t),a=e.args[i];return n.set(typeof a==`number`?a:t.min??0),n.onChange(t=>e.setArg(i,t)),{view:n.node,refresh:e=>{let t=typeof e[i]==`number`?e[i]:0;n.get()!==t&&n.set(t)}}}case n.RANGE:{let n=r.range(t),a=e.args[i],o=typeof a==`number`?a:t.min??0;return n.set(o),n.onChange(t=>e.setArg(i,t)),{view:n.node,refresh:e=>{let t=typeof e[i]==`number`?e[i]:o;n.get()!==t&&n.set(t)}}}case n.SELECT:{let n=t.options;if(!n?.length)return console.warn(`SELECT control "${i}" has no options`),null;let a=r.select(t),o=e.args[i],s=Math.max(0,n.findIndex(e=>e.value===o));return a.set(s),a.onChange(t=>{t>=0&&t<n.length&&e.setArg(i,n[t].value)}),{view:a.node,refresh:e=>{let t=e[i],r=n.findIndex(e=>e.value===t);r>=0&&a.get()!==r&&a.set(r)}}}default:return console.warn(`Unsupported control type: ${t.type}`),null}}function buildStorybookDevtoolsExtension(e){let currentStory=()=>e.getCurrentStory();return{methods:[{name:`ListStories`,kind:`read-only`,handler:(()=>JSON.stringify(e.listStories(),null,2))},{name:`GetCurrentStory`,kind:`read-only`,handler:(()=>JSON.stringify(currentStory(),null,2))},{name:`OpenStory`,kind:`mutating`,handler:(t=>e.openStoryByTitle(t))},{name:`SetStoryArg`,kind:`mutating`,handler:((t,n)=>e.setActiveArg(t,n?JSON.parse(n):null))},{name:`GetStoryArgs`,kind:`read-only`,handler:(()=>JSON.stringify(currentStory()?.args??{},null,2))}],contributeStatus:()=>{let t=currentStory(),n=e.listStories();return{storybook:{currentStory:t?{title:t.title,story:t.story}:null,storyCount:n.length}}}}}function collectStoryModules$1(e){let t=[];for(let n of e)if(!(!n||typeof n!=`object`))for(let e of Object.values(n))isStoryModule(e)&&t.push(e);return t}__name(collectStoryModules$1,`collectStoryModules`);var StoryViewBase=class{constructor(){this._listeners=new Set}initBase(e,t,n){this._meta=e,this._story=t,this._args=argsFromControls(e.controls),this._chrome=this.createChrome(e,n),this.refreshChromeText()}get meta(){return this._meta}get story(){return this._story}get args(){return this._args}get root(){return this._chrome.root}set args(e){this._args!==e&&(this._args=e,this.updateArgs(e),this.emitArgs(e))}emitArgs(e){for(let t of this._listeners)t(e)}onArgsChanged(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}setArg(e,t){this.args={...this._args,[e]:t}}initialize(){}updateArgs(e){}teardown(){}addContent(e){this._chrome.hasStage&&this._chrome.setStageContent(e)}refreshChromeText(){let e=this._story?`${this._meta.title} — ${this._story}`:this._meta.title;this._chrome.setChromeText(e,this._meta.description??``)}};const r={ListStories:`<method name="ListStories"><arg type="s" direction="out" name="stories_json"/></method>`,GetCurrentStory:`<method name="GetCurrentStory"><arg type="s" direction="out" name="story_json"/></method>`,OpenStory:`<method name="OpenStory"><arg type="s" direction="in" name="title"/><arg type="b" direction="out" name="opened"/></method>`,SetStoryArg:`<method name="SetStoryArg"><arg type="s" direction="in" name="name"/><arg type="s" direction="in" name="value_json"/><arg type="b" direction="out" name="applied"/></method>`,GetStoryArgs:`<method name="GetStoryArgs"><arg type="s" direction="out" name="args_json"/></method>`};function storybookDevtoolsExtension(e){let t=buildStorybookDevtoolsExtension(e.controller),n=[],i={},a={};for(let e of t.methods){let t=r[e.name];t&&n.push(t),i[e.name]=e.handler,a[e.name]=e.kind}return{methodsXml:n,handlers:i,methodKinds:a,contributeStatus:t.contributeStatus}}const i=e(import.meta.url);let a;function load$6(){return a===void 0&&(a=i(`@gjsify/node-gi/gi`).requireGi(`Adw`,`1`)),a}__name(load$6,`load`);var o=new Proxy(Object.create(null),{get(e,t){return load$6()[t]},has(e,t){return t in load$6()}});const s=e(import.meta.url);let c;function load$5(){return c===void 0&&(c=s(`@gjsify/node-gi/gi`).requireGi(`GObject`,`2.0`)),c}__name(load$5,`load`);var l=new Proxy(Object.create(null),{get(e,t){return load$5()[t]},has(e,t){return t in load$5()}});const u=e(import.meta.url);let d;function load$4(){return d===void 0&&(d=u(`@gjsify/node-gi/gi`).requireGi(`Gtk`,`4.0`)),d}__name(load$4,`load`);var f=new Proxy(Object.create(null),{get(e,t){return load$4()[t]},has(e,t){return t in load$4()}});function buildGtkChrome(e){let t=new o.PreferencesPage,n=new o.PreferencesGroup,r=new f.Box({orientation:f.Orientation.VERTICAL,halign:f.Align.CENTER,valign:f.Align.CENTER,margin_top:12,margin_bottom:12,spacing:12,hexpand:!0});return r.add_css_class(`story-stage`),n.add(r),t.add(n),e.set_child(t),{root:e,hasStage:!0,setStageContent(e){let t=r.get_first_child();for(;t;)t.unparent(),t=r.get_first_child();r.append(e)},setChromeText(e,t){n.set_title(e),n.set_description(t)}}}var StoryCore=class extends StoryViewBase{constructor(e,t,n){super(),this._widget=e,this.initBase(t,n)}createChrome(e){return buildGtkChrome(this._widget)}initialize(){this._widget.initialize()}updateArgs(e){this._widget.updateArgs(e)}teardown(){this._widget.teardown()}emitArgs(e){super.emitArgs(e),this._widget.notify(`args`)}},p=class StoryWidget extends o.Bin{static{l.registerClass({GTypeName:`StoryWidget`,Properties:{meta:l.ParamSpec.object(`meta`,`Meta`,`Story metadata`,l.ParamFlags.READWRITE,l.Object),story:l.ParamSpec.string(`story`,`Story Name`,`Story name`,l.ParamFlags.READWRITE,``),args:l.ParamSpec.object(`args`,`Args`,`Story arguments`,l.ParamFlags.READWRITE,l.Object)}},StoryWidget)}constructor(e,t={}){super(t),this._core=new StoryCore(this,e.meta,e.story)}static fromMeta(e,t){return{meta:e,story:t,args:argsFromControls(e.controls)}}get meta(){return this._core.meta}get story(){return this._core.story}get args(){return this._core.args}set args(e){this._core.args=e}onArgsChanged(e){return this._core.onArgsChanged(e)}setArg(e,t){this._core.setArg(e,t)}initialize(){}updateArgs(e){}teardown(){}addContent(e){this._core.addContent(e)}};l.type_ensure(p.$gtype);const ee=e(import.meta.url);let m;function load$3(){return m===void 0&&(m=ee(`@gjsify/node-gi/gi`).requireGi(`Gio`,`2.0`)),m}__name(load$3,`load`);var h=new Proxy(Object.create(null),{get(e,t){return load$3()[t]},has(e,t){return t in load$3()}});const te=e(import.meta.url);let g;function load$2(){return g===void 0&&(g=te(`@gjsify/node-gi/gi`).requireGi(`GLib`,`2.0`)),g}__name(load$2,`load`);var _=new Proxy(Object.create(null),{get(e,t){return load$2()[t]},has(e,t){return t in load$2()}});const ne=e(import.meta.url);let v;function load$1(){return v===void 0&&(v=ne(`@gjsify/node-gi/gi`).requireGi(`Gdk`,`4.0`)),v}__name(load$1,`load`);var y=new Proxy(Object.create(null),{get(e,t){return load$1()[t]},has(e,t){return t in load$1()}});function adwControlWidgetFactory(){return{text(e,t){let n=new o.EntryRow({title:e});t&&n.set_tooltip_text(t);let r=null;return n.connect(`changed`,()=>r?.(n.get_text())),{node:n,get:()=>n.get_text(),set:e=>n.set_text(e),onChange:e=>{r=e}}},boolean(e,t){let n=new o.SwitchRow({title:e,subtitle:t??``}),r=null;return n.connect(`notify::active`,()=>r?.(n.get_active())),{node:n,get:()=>n.get_active(),set:e=>n.set_active(e),onChange:e=>{r=e}}},number(e){let t=o.SpinRow.new_with_range(e.min??0,e.max??100,e.step??1);t.set_title(e.label||e.name),e.description&&t.set_subtitle(e.description);let n=null;return t.connect(`changed`,()=>n?.(t.get_value())),{node:t,get:()=>t.get_value(),set:e=>t.set_value(e),onChange:e=>{n=e}}},range(e){return buildRangeWidget(e)},select(e){return buildSelectWidget(e)},color(e,t){return buildColorWidget(e,t)}}}function buildRangeWidget(e){let t=e.min??0,n=e.max??100,r=e.step??1,i=typeof e.min==`number`?e.min:0,a=Number.isInteger(r)&&Number.isInteger(i),o=new f.Adjustment({lower:t,upper:n,step_increment:r,value:i});o.step_increment=r;let s=new f.ListBoxRow({selectable:!1,activatable:!1});s.add_css_class(`story-range-row`);let c=new f.Box({orientation:f.Orientation.VERTICAL,spacing:6,margin_top:12,margin_bottom:12,margin_start:12,margin_end:12}),l=new f.Box({orientation:f.Orientation.HORIZONTAL,spacing:12}),u=new f.Label({label:e.label||e.name,halign:f.Align.START,hexpand:!0,ellipsize:3});u.add_css_class(`heading`);let formatValue=e=>a?String(Math.round(e)):e.toFixed(2),d=new f.Label({label:formatValue(i),halign:f.Align.END});if(d.add_css_class(`numeric`),d.add_css_class(`dim-label`),l.append(u),l.append(d),c.append(l),e.description){let t=new f.Label({label:e.description,halign:f.Align.START,xalign:0,wrap:!0,max_width_chars:32});t.add_css_class(`caption`),t.add_css_class(`dim-label`),c.append(t)}let p=new f.Scale({orientation:f.Orientation.HORIZONTAL,adjustment:o,draw_value:!1,hexpand:!0}),ee=null,m=!1;return p.connect(`value-changed`,()=>{if(m)return;let e=p.get_value();if(a){let t=Math.round(e);if(t!==e){p.set_value(t);return}e=t}d.set_label(formatValue(e)),ee?.(e)}),c.append(p),s.set_child(c),{node:s,get:()=>p.get_value(),set:e=>{m=!0,p.set_value(e),m=!1,d.set_label(formatValue(e))},onChange:e=>{ee=e}}}function buildSelectWidget(e){let t=e.options??[],n=f.StringList.new(t.map(e=>e.label)),r=new o.ComboRow({title:e.label||e.name,subtitle:e.description??``,model:n}),i=null;return r.connect(`notify::selected`,()=>i?.(r.get_selected())),{node:r,get:()=>r.get_selected(),set:e=>r.set_selected(e),onChange:e=>{i=e}}}function buildColorWidget(e,t){let n=new o.ActionRow({title:e,subtitle:t??``}),r=new f.ColorDialogButton({dialog:new f.ColorDialog({title:e}),valign:f.Align.CENTER});n.add_suffix(r),n.set_activatable_widget(r);let channel=e=>Math.round(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,`0`),rgbaToHex=e=>`#${channel(e.red)}${channel(e.green)}${channel(e.blue)}`,i=null,a=!1;return r.connect(`notify::rgba`,()=>{a||i?.(rgbaToHex(r.get_rgba()))}),{node:n,get:()=>rgbaToHex(r.get_rgba()),set:e=>{let t=new y.RGBA;t.parse(e)&&(a=!0,r.set_rgba(t),a=!1)},onChange:e=>{i=e}}}var re=class StorybookWindow extends o.ApplicationWindow{static{l.registerClass({GTypeName:`StorybookWindow`},StorybookWindow)}constructor(e){super(e),this._controlRows=[],this._rowByTitle=new Map,this._onSelect=null,this._suppressSelect=!1,this.set_default_size(1200,800),this.set_size_request(360,320),this.set_title(`Storybook`),this._buildUI(),this._controller=new StorybookController(this,e=>this._buildControls(e)),this._sidebar_list.connect(`row-selected`,this._onRowSelected.bind(this)),this._show_controls_button.connect(`toggled`,this._onToggleControls.bind(this)),this._controls_split_view.set_show_sidebar(!0)}_onRowSelected(e,t){if(this._suppressSelect||!t)return;let n=t;n.storyWidget&&this._onSelect?.(n.storyWidget)}get controller(){return this._controller}_buildControls(e){let t=e.meta.controls;if(!Array.isArray(t))return[];let n=adwControlWidgetFactory(),r=[];for(let i of t){if(!i?.name||!i?.type){console.warn(`Invalid control configuration:`,i);continue}let t=bindControl(e,i,n);t&&r.push(t)}return r}_buildUI(){this._sidebar_list=new f.ListBox({selection_mode:f.SelectionMode.SINGLE}),this._sidebar_list.add_css_class(`navigation-sidebar`);let e=new f.ScrolledWindow({hexpand:!0,vexpand:!0,child:this._sidebar_list}),t=new o.HeaderBar({title_widget:new o.WindowTitle({title:`Stories`}),show_end_title_buttons:!1}),n=new o.ToolbarView({content:e,top_bar_style:o.ToolbarStyle.FLAT});n.add_top_bar(t);let r=new o.NavigationPage({title:`Stories`,tag:`stories`,child:n});this._content_area=new o.Bin({hexpand:!0,vexpand:!0});let i=new f.ScrolledWindow({hexpand:!0,vexpand:!0,child:this._content_area});this._control_panel=new o.PreferencesGroup({title:`Controls`});let a=new o.PreferencesPage;a.add(this._control_panel);let s=new f.ScrolledWindow({vexpand:!0,child:a});this._controls_split_view=new o.OverlaySplitView({show_sidebar:!0,sidebar_position:f.PackType.END,min_sidebar_width:280,max_sidebar_width:360,content:i,sidebar:s,css_classes:[`storybook-controls`]}),this._preview_title=new o.WindowTitle({title:`Preview`}),this._show_controls_button=new f.ToggleButton({icon_name:`sidebar-show-right-symbolic`,tooltip_text:`Toggle Controls`,active:!0});let c=new o.HeaderBar({title_widget:this._preview_title});c.pack_end(this._show_controls_button);let l=new o.ToolbarView({content:this._controls_split_view,top_bar_style:o.ToolbarStyle.FLAT});l.add_top_bar(c);let u=new o.NavigationPage({title:`Preview`,tag:`preview`,child:l});this._main_split_view=new o.NavigationSplitView({min_sidebar_width:220,max_sidebar_width:320,sidebar:r,content:u}),this.set_content(this._main_split_view);let d=o.BreakpointCondition.parse(`max-width: 720sp`);if(d){let e=new o.Breakpoint({condition:d});e.connect(`apply`,()=>{this._main_split_view.collapsed=!0,this._controls_split_view.collapsed=!0}),e.connect(`unapply`,()=>{this._main_split_view.collapsed=!1,this._controls_split_view.collapsed=!1}),this.add_breakpoint(e)}}_onToggleControls(e){this._controls_split_view.set_show_sidebar(e.get_active())}populateSidebar(e){this._controller.mount(e,!0)}renderSidebar(e,t){this._onSelect=t,this._suppressSelect=!0,this._clearSidebar(),this._rowByTitle.clear();for(let t of e){this._addCategoryToSidebar(t.category);for(let{instance:e,name:n}of t.stories)this._addStoryToSidebar(e,n)}this._suppressSelect=!1}markSelected(e){let t=this._rowByTitle.get(e);t&&this._sidebar_list.get_selected_row()!==t&&(this._suppressSelect=!0,this._sidebar_list.select_row(t),this._suppressSelect=!1)}setPreviewTitle(e){this._preview_title.set_title(e)}showPreview(e){this._content_area.set_child(e),this._main_split_view.get_collapsed()&&this._main_split_view.set_show_content(!0)}renderControls(e){this._clearControlPanel();for(let t of e){let e=t.view;this._control_panel.add(e),this._controlRows.push(e)}this._show_controls_button.set_active(!0)}_clearSidebar(){let e=this._sidebar_list.get_first_child();for(;e;){let t=e.get_next_sibling();e.unparent(),e=t}}_addCategoryToSidebar(e){let t=new f.ListBoxRow({selectable:!1}),n=new f.Label({label:e,halign:f.Align.START,margin_top:10,margin_bottom:4,margin_start:12,margin_end:12});n.add_css_class(`heading`),n.add_css_class(`dim-label`),t.set_child(n),this._sidebar_list.append(t)}_addStoryToSidebar(e,t){let n=new f.ListBoxRow,r=new f.Label({label:t||`Unnamed Story`,halign:f.Align.START,margin_start:20,margin_top:6,margin_bottom:6});n.set_child(r),this._sidebar_list.append(n),n.storyWidget=e,this._rowByTitle.set(e.meta.title,n)}_clearControlPanel(){for(let e of this._controlRows)this._control_panel.remove(e);this._controlRows=[]}get activeStory(){return this._controller.activeStory}openStoryByTitle(e){return this._controller.openStoryByTitle(e)}setActiveArg(e,t){return this._controller.setActiveArg(e,t)}};l.type_ensure(re.$gtype);function variantKindFor(e,t){switch(e){case`s`:case`b`:case`i`:case`u`:case`d`:return e}if(typeof t==`string`)return`s`;if(typeof t==`boolean`)return`b`;if(typeof t==`number`)return Number.isInteger(t)?`i`:`d`;throw Error(`Cannot build a GLib.Variant from ${typeof t}`)}function buildVariant(e,t){switch(variantKindFor(e?.dup_string()??null,t)){case`s`:return _.Variant.new_string(String(t));case`b`:return _.Variant.new_boolean(!!t);case`i`:return _.Variant.new_int32(Number(t));case`u`:return _.Variant.new_uint32(Number(t));case`d`:return _.Variant.new_double(Number(t))}}function describeActions(e){return e?e.list_actions().sort((e,t)=>e.localeCompare(t)).map(t=>({name:t,enabled:e.get_action_enabled(t),parameterType:e.get_action_parameter_type(t)?.dup_string()??null,stateType:e.get_action_state_type(t)?.dup_string()??null})):[]}function activateAction(e,t,n){let r=e.get_action_parameter_type(t),i=n==null?null:buildVariant(r,n);e.activate_action(t,i)}function changeActionState(e,t,n){e.change_action_state(t,buildVariant(e.get_action_state_type(t),n))}const b=new Map;function swapCss(e,t){let n=y.Display.get_default();if(!n)return!1;let r=b.get(e);return r||(r=new f.CssProvider,f.StyleContext.add_provider_for_display(n,r,f.STYLE_PROVIDER_PRIORITY_USER+1),b.set(e,r)),r.load_from_string(t),!0}function dumpCss(){return{providers:[...b.keys()]}}function formatDbusErrorMessage(e,t){return`${e}: ${t}`}const ie={GetStatus:`read-only`,Screenshot:`read-only`,ListActions:`read-only`,ActivateAction:`mutating`,ChangeActionState:`mutating`,PresentWindow:`read-only`,ResizeWindow:`mutating`,ListToplevels:`read-only`,DumpTree:`read-only`,GetProperty:`read-only`,SetProperty:`mutating`,GetFocused:`read-only`,EmitSignal:`mutating`,DumpGSettings:`read-only`,DumpCss:`read-only`,SwapCss:`mutating`};function buildDevtoolsIfaceXml(e=[]){return`<node>
|
|
2
|
-
<interface name="org.gjsify.Devtools">
|
|
3
|
-
<method name="GetStatus">
|
|
4
|
-
<arg type="s" direction="out" name="status_json"/>
|
|
5
|
-
</method>
|
|
6
|
-
<method name="Screenshot">
|
|
7
|
-
<arg type="s" direction="in" name="scope"/>
|
|
8
|
-
<arg type="ay" direction="out" name="png_bytes"/>
|
|
9
|
-
</method>
|
|
10
|
-
<method name="ListActions">
|
|
11
|
-
<arg type="s" direction="out" name="actions_json"/>
|
|
12
|
-
</method>
|
|
13
|
-
<method name="ActivateAction">
|
|
14
|
-
<arg type="s" direction="in" name="scope"/>
|
|
15
|
-
<arg type="s" direction="in" name="name"/>
|
|
16
|
-
<arg type="s" direction="in" name="value_json"/>
|
|
17
|
-
</method>
|
|
18
|
-
<method name="ChangeActionState">
|
|
19
|
-
<arg type="s" direction="in" name="scope"/>
|
|
20
|
-
<arg type="s" direction="in" name="name"/>
|
|
21
|
-
<arg type="s" direction="in" name="value_json"/>
|
|
22
|
-
</method>
|
|
23
|
-
<method name="PresentWindow"/>
|
|
24
|
-
<method name="ResizeWindow">
|
|
25
|
-
<arg type="i" direction="in" name="width"/>
|
|
26
|
-
<arg type="i" direction="in" name="height"/>
|
|
27
|
-
<arg type="i" direction="out" name="result_width"/>
|
|
28
|
-
<arg type="i" direction="out" name="result_height"/>
|
|
29
|
-
</method>
|
|
30
|
-
<method name="ListToplevels">
|
|
31
|
-
<arg type="s" direction="out" name="toplevels_json"/>
|
|
32
|
-
</method>
|
|
33
|
-
<method name="DumpTree">
|
|
34
|
-
<arg type="s" direction="in" name="root"/>
|
|
35
|
-
<arg type="i" direction="in" name="depth"/>
|
|
36
|
-
<arg type="s" direction="out" name="tree_json"/>
|
|
37
|
-
</method>
|
|
38
|
-
<method name="GetProperty">
|
|
39
|
-
<arg type="s" direction="in" name="path"/>
|
|
40
|
-
<arg type="s" direction="in" name="prop"/>
|
|
41
|
-
<arg type="s" direction="out" name="value_json"/>
|
|
42
|
-
</method>
|
|
43
|
-
<method name="GetFocused">
|
|
44
|
-
<arg type="s" direction="out" name="focused_json"/>
|
|
45
|
-
</method>
|
|
46
|
-
<method name="DumpGSettings">
|
|
47
|
-
<arg type="s" direction="in" name="schema_id"/>
|
|
48
|
-
<arg type="s" direction="out" name="settings_json"/>
|
|
49
|
-
</method>
|
|
50
|
-
<method name="DumpCss">
|
|
51
|
-
<arg type="s" direction="out" name="css_json"/>
|
|
52
|
-
</method>
|
|
53
|
-
<method name="SwapCss">
|
|
54
|
-
<arg type="s" direction="in" name="name"/>
|
|
55
|
-
<arg type="s" direction="in" name="css"/>
|
|
56
|
-
<arg type="b" direction="out" name="applied"/>
|
|
57
|
-
</method>${e.length>0?`\n${e.join(`
|
|
58
|
-
`)}`:``}
|
|
59
|
-
</interface>
|
|
60
|
-
</node>`}const ae=e(import.meta.url);let x;function load(){return x===void 0&&(x=ae("@gjsify/node-gi/gi").requireGi(`Graphene`,`1.0`)),x}var oe=new Proxy(Object.create(null),{get(e,t){return load()[t]},has(e,t){return t in load()}});function captureWidgetPng(e){let t=e.get_native()?.get_renderer();if(!t)return null;let n=e.get_width(),r=e.get_height();if(n<=0||r<=0)return null;let i=f.WidgetPaintable.new(e),a=f.Snapshot.new();i.snapshot(a,n,r);let o=a.to_node();if(!o)return null;let s=new oe.Rect;s.init(0,0,n,r);let c=t.render_texture(o,s).save_to_png_bytes().get_data();return c?new Uint8Array(c):null}function dumpGSettings(e){let t=h.SettingsSchemaSource.get_default()?.lookup(e,!0);if(!t)throw Error(formatDbusErrorMessage(`not-found`,`GSettings schema '${e}' is not installed`));let n=new h.Settings({settings_schema:t}),r={};for(let e of t.list_keys())r[e]=n.get_value(e).recursiveUnpack();return r}function parseWidgetPath(e){let t=e.split(`/`).filter(e=>e.length>0);if(t.length===0)return null;let n=t[0].match(/^toplevel:(\d+)$/);if(!n)return null;let r=[];for(let e of t.slice(1)){let t=e.match(/^child:(\d+)$/);if(!t)return null;r.push(Number(t[1]))}return{toplevel:Number(n[1]),children:r}}function buildWidgetPath(e,t){return[`toplevel:${e}`,...t.map(e=>`child:${e}`)].join(`/`)}function widgetType(e){return e.constructor?.$gtype?.name??`GtkWidget`}function nthChild(e,t){let n=e.get_first_child(),r=0;for(;n&&r<t;)n=n.get_next_sibling(),r++;return r===t?n:null}function listToplevels(){let e=f.Window.get_toplevels(),t=e.get_n_items(),n=[];for(let r=0;r<t;r++){let t=e.get_item(r);t&&n.push({path:`toplevel:${r}`,type:widgetType(t),title:t.get_title?.()??null,mapped:t.get_mapped(),focused:t.is_active??!1})}return n}function resolveWidgetPath(e){let t=parseWidgetPath(e);if(!t)return null;let n=f.Window.get_toplevels().get_item(t.toplevel);if(!n)return null;for(let e of t.children)if(n=nthChild(n,e),!n)return null;return n}function dumpTree(e,t,n){let r={path:n,type:widgetType(e),name:e.get_name()||null,cssClasses:e.get_css_classes(),mapped:e.get_mapped(),visible:e.get_visible(),children:[]};if(t<=0)return r;let i=e.get_first_child(),a=0;for(;i;)r.children.push(dumpTree(i,t-1,`${n}/child:${a}`)),i=i.get_next_sibling(),a++;return r}function jsonSafe(e){let t=typeof e;return e==null||t===`string`||t===`number`||t===`boolean`?e??null:`[${t}]`}function getWidgetProperty(e,t){let n=e,r=t.replace(/-/g,`_`),i=t.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase());for(let e of[t,r,i])if(e in n)return jsonSafe(n[e])}function childIndex(e,t){let n=e.get_first_child(),r=0;for(;n;){if(n===t)return r;n=n.get_next_sibling(),r++}return-1}function pathOfWidget(e){let t=[],n=e,r=n.get_parent();for(;r;){let e=childIndex(r,n);if(e<0)return null;t.unshift(e),n=r,r=n.get_parent()}let i=f.Window.get_toplevels(),a=i.get_n_items();for(let e=0;e<a;e++)if(i.get_item(e)===n)return buildWidgetPath(e,t);return null}function frameDelay(e){return new Promise(t=>{_.timeout_add(_.PRIORITY_DEFAULT,e,()=>(t(),_.SOURCE_REMOVE))})}async function captureWidgetWhenRenderable(e,t=12,n=50){for(let r=0;r<t;r++){let t=captureWidgetPng(e);if(t)return t;await frameDelay(n)}return captureWidgetPng(e)}var DevtoolsService=class{constructor(e,t){this._app=e,this._options=t,this._exported=null,this._kinds=new Map,this._extensions=t.extend??[];for(let[e,t]of Object.entries(ie))this._kinds.set(e,t);for(let e of this._extensions){for(let[t,n]of Object.entries(e.methodKinds))this._kinds.set(t,n);for(let[t,n]of Object.entries(e.handlers)){let e=n;this[t]=(...n)=>(this._guard(t),e(...n))}}}export(e,t){if(this._exported)return;let n=buildDevtoolsIfaceXml(this._extensions.flatMap(e=>e.methodsXml??[])),r=h.DBusExportedObject.wrapJSObject(n,this);r.export(e,t),this._exported=r}unexport(){this._exported?.unexport(),this._exported=null}GetStatus(){let e=this._app.get_active_window(),t={appId:this._app.get_application_id()??`unknown`,instance:this._options.instance??`default`,activeWindow:e?{id:e.get_name()||`window`,title:e.get_title()??``,mapped:e.get_mapped()}:null,toplevelCount:f.Window.get_toplevels().get_n_items(),focusedWidget:null,paused:this._isPaused()};for(let e of this._extensions){let n=e.contributeStatus?.();n&&Object.assign(t,n)}return JSON.stringify(t)}async Screenshot(e){let t=this._app.get_active_window();if(!t)return new Uint8Array;let n=captureWidgetPng(t);return n||=(t.present(),await captureWidgetWhenRenderable(t)),n??new Uint8Array}ListActions(){let e={app:describeActions(this._actionGroup(`app`)),win:describeActions(this._actionGroup(`win`))};return JSON.stringify(e)}ActivateAction(e,t,n){this._guard(`ActivateAction`);let r=this._scope(e);activateAction(this._requireGroup(r,t),t,this._parseValue(n))}ChangeActionState(e,t,n){this._guard(`ChangeActionState`);let r=this._scope(e);changeActionState(this._requireGroup(r,t),t,this._parseValue(n))}PresentWindow(){this._app.get_active_window()?.present()}ResizeWindow(e,t){this._guard(`ResizeWindow`);let n=this._app.get_active_window();if(!n)throw Error(formatDbusErrorMessage(`unavailable`,`no active window to resize`));let r=Math.max(1,Math.round(e)),i=Math.max(1,Math.round(t));return n.is_maximized()&&n.unmaximize(),n.is_fullscreen()&&n.unfullscreen(),n.set_default_size(r,i),[r,i]}ListToplevels(){return JSON.stringify(listToplevels())}DumpTree(e,t){let n=this._resolveRootWidget(e);if(!n)throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e||`active window`}'`));return JSON.stringify(dumpTree(n.widget,t>0?t:8,n.path))}GetProperty(e,t){let n=this._resolveRootWidget(e);if(!n)throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e}'`));let r=getWidgetProperty(n.widget,t);if(r===void 0)throw Error(formatDbusErrorMessage(`not-found`,`widget has no property '${t}'`));return JSON.stringify(r)}GetFocused(){let e=this._app.get_active_window(),t=e?e.get_focus():null;return JSON.stringify(t?{path:pathOfWidget(t),name:t.get_name()||null,type:widgetType(t)}:null)}DumpGSettings(e){return JSON.stringify(dumpGSettings(e))}DumpCss(){return JSON.stringify(dumpCss())}SwapCss(e,t){return this._guard(`SwapCss`),swapCss(e,t)}_resolveRootWidget(e){if(!e||e===`window`||e===`active`){let e=this._app.get_active_window();return e?{widget:e,path:pathOfWidget(e)??`toplevel:0`}:null}let t=resolveWidgetPath(e);return t?{widget:t,path:e}:null}_isPaused(){return this._options.paused?.()??!1}_guard(e){let t=this._kinds.get(e);if(!t)throw Error(formatDbusErrorMessage(`internal`,`unclassified devtools method '${e}'`));if(t===`mutating`&&this._isPaused())throw Error(formatDbusErrorMessage(`paused`,`${e} rejected — external control is paused. Read-only methods keep working.`))}_scope(e){return e===`app`?`app`:`win`}_actionGroup(e){if(e===`app`)return this._app;if(this._options.winActionGroup)return this._options.winActionGroup;let t=this._app.get_active_window();return t instanceof f.ApplicationWindow?t:null}_requireGroup(e,t){let n=this._actionGroup(e);if(!n)throw Error(formatDbusErrorMessage(`unavailable`,`no '${e}' action group`));if(!n.has_action(t))throw Error(formatDbusErrorMessage(`not-found`,`unknown action ${e}.${t}`));return n}_parseValue(e){if(!e||e===`null`)return null;try{return JSON.parse(e)}catch{throw Error(formatDbusErrorMessage(`invalid-params`,`value_json is not valid JSON: ${e}`))}}};const se=new Set;function envEnabled(){let e=_.getenv(`GJSIFY_DEVTOOLS`);if(e==null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}function envInstance(){let e=_.getenv(`GJSIFY_DEVTOOLS_INSTANCE`);return e&&e!==``?e:void 0}function installDevtools(e,t={}){if(!(t.enabled??envEnabled()))return null;let n=new DevtoolsService(e,{...t,instance:t.instance??envInstance()}),r=e.get_dbus_connection(),i=e.get_dbus_object_path();return r&&i?n.export(r,`${i}/devtools`):console.error(`[gjsify-devtools] no session-bus connection yet — call installDevtools() from the GtkApplication "startup" handler`),se.add(n),n}var ce=class StorybookApplication extends o.Application{static{l.registerClass({GTypeName:`StorybookApplication`},StorybookApplication)}constructor(e){super({application_id:e.applicationId,flags:h.ApplicationFlags.DEFAULT_FLAGS}),this._window=null,this._options=e,this.connect(`startup`,()=>this._initStyles()),this.connect(`activate`,()=>this._onActivate())}_initStyles(){let e=new f.CssProvider;e.load_from_string(`
|
|
61
|
-
/* Range-control card in the controls sidebar — keeps the label + description
|
|
62
|
-
from being squashed into a single column when the sidebar is narrow. */
|
|
63
|
-
.story-range-row {
|
|
64
|
-
padding: 0;
|
|
65
|
-
}
|
|
66
|
-
.story-range-row > box {
|
|
67
|
-
border-radius: 12px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/* Controls panel shares the window (story) background; only the left
|
|
71
|
-
navigation sidebar keeps a distinct shade. The overlay-split-view sidebar is
|
|
72
|
-
otherwise drawn on the sidebar shade — flatten it onto the window colour. */
|
|
73
|
-
.storybook-controls > .sidebar,
|
|
74
|
-
.storybook-controls > .sidebar > * {
|
|
75
|
-
background-color: @window_bg_color;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/* Subtle dashed frame around the live preview so the widget's bounds stay
|
|
79
|
-
locatable even when it is transparent or in an empty state (e.g. a collapsed
|
|
80
|
-
bottom sheet, a status page, a bare button). @window_fg_color flips with the
|
|
81
|
-
theme (alpha(currentColor, …) does not resolve in a Gtk.CssProvider). */
|
|
82
|
-
.story-stage {
|
|
83
|
-
border: 1px dashed alpha(@window_fg_color, 0.28);
|
|
84
|
-
border-radius: 12px;
|
|
85
|
-
padding: 18px;
|
|
86
|
-
}
|
|
87
|
-
\n${this._options.css??``}`);let t=y.Display.get_default();if(!t){console.error(`No display found`);return}f.StyleContext.add_provider_for_display(t,e,f.STYLE_PROVIDER_PRIORITY_APPLICATION)}_onActivate(){if(!this._window){this._window=new re({application:this}),this._options.title&&this._window.set_title(this._options.title);try{this._window.populateSidebar(this._options.stories)}catch(e){console.error(`Failed to create story instances:`,e)}installDevtools(this,{enabled:this._options.devtools||void 0,extend:[storybookDevtoolsExtension(this._window)]})}this._window.present()}};l.type_ensure(ce.$gtype);async function runStorybook(e){return new ce(e).runAsync([imports.system.programInvocationName,...ARGV])}function collectStoryModules(e){return collectStoryModules$1(e)}const le={title:`Buttons/Button Content`,description:`Adw.ButtonContent — pairs a symbolic icon with a label inside a Gtk.Button.`,controls:[{name:`label`,label:`Label`,type:n.TEXT,defaultValue:`Download`},{name:`iconName`,label:`Icon`,type:n.SELECT,options:[{label:`Download`,value:`folder-download-symbolic`},{label:`Add`,value:`list-add-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-download-symbolic`},{name:`canShrink`,label:`Can shrink`,type:n.BOOLEAN,defaultValue:!1}]};var ue=__exportAll({ButtonContentStories:()=>de,ButtonContentStory:()=>S}),S=class ButtonContentStory extends p{_content=null;_button=null;static{l.registerClass({GTypeName:`AdwStorybookButtonContent`},ButtonContentStory)}constructor(){super(p.fromMeta(ButtonContentStory.getMetadata(),`Default`))}static getMetadata(){return{...le,component:o.ButtonContent.$gtype}}initialize(){this._content=new o.ButtonContent({label:this.args.label,iconName:this.args.iconName,canShrink:this.args.canShrink}),this._button=new f.Button({child:this._content}),this._button.add_css_class(`suggested-action`),this._button.add_css_class(`pill`),this.addContent(this._button)}updateArgs(e){this._content&&(this._content.label=this.args.label,this._content.iconName=this.args.iconName,this._content.canShrink=this.args.canShrink)}};l.type_ensure(S.$gtype);const de={stories:[S]},fe={title:`Buttons/Button Styles`,description:`Buttons with Adwaita style classes: .pill, .circular, .suggested-action, .destructive-action, .flat.`,controls:[{name:`label`,label:`Demo label`,type:n.TEXT,defaultValue:`Click me`},{name:`style`,label:`Demo style`,type:n.SELECT,options:[{label:`Pill`,value:`pill`},{label:`Circular (icon)`,value:`circular`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`},{label:`Flat`,value:`flat`}],defaultValue:`suggested-action`}]};var pe=__exportAll({ButtonStylesStories:()=>he,ButtonStylesStory:()=>C});const me=[`pill`,`circular`,`suggested-action`,`destructive-action`,`flat`];var C=class ButtonStylesStory extends p{_demo=null;static{l.registerClass({GTypeName:`AdwStorybookButtonStyles`},ButtonStylesStory)}constructor(){super(p.fromMeta(ButtonStylesStory.getMetadata(),`Default`))}static getMetadata(){return{...fe,component:f.Button.$gtype}}initialize(){let e=new o.WrapBox({childSpacing:12,lineSpacing:12,halign:f.Align.CENTER}),t=new f.Button({label:`Pill`});t.add_css_class(`pill`),e.append(t);let n=new f.Button({iconName:`list-add-symbolic`});n.add_css_class(`circular`),e.append(n);let r=new f.Button({label:`Suggested`});r.add_css_class(`suggested-action`),e.append(r);let i=new f.Button({label:`Delete`});i.add_css_class(`destructive-action`),e.append(i);let a=new f.Button({label:`Flat`});a.add_css_class(`flat`),e.append(a),this._demo=new f.Button({label:this.args.label}),this._applyStyle(this.args.style),e.append(this._demo),this.addContent(e)}_applyStyle(e){if(this._demo){for(let e of me)this._demo.remove_css_class(e);this._demo.add_css_class(e)}}updateArgs(e){this._demo&&(this._demo.label=this.args.label,this._applyStyle(this.args.style))}};l.type_ensure(C.$gtype);const he={stories:[C]},ge={title:`Buttons/Split Button`,description:`Adw.SplitButton — a primary action button paired with a dropdown menu of related actions.`,controls:[{name:`label`,label:`Label`,type:n.TEXT,defaultValue:`Save`},{name:`iconName`,label:`Icon`,type:n.SELECT,options:[{label:`None`,value:``},{label:`Save`,value:`document-save-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Add`,value:`list-add-symbolic`}],defaultValue:`document-save-symbolic`}]},_e={title:`Buttons/Split Button Flat`,description:`Adw.SplitButton with the .flat style class, as used inside header bars and toolbars.`,controls:[{name:`label`,label:`Label`,type:n.TEXT,defaultValue:`Reply`},{name:`iconName`,label:`Icon`,type:n.SELECT,options:[{label:`None`,value:``},{label:`Reply`,value:`mail-reply-sender-symbolic`},{label:`Edit`,value:`document-edit-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`mail-reply-sender-symbolic`}]};var ve=__exportAll({SplitButtonFlatStory:()=>T,SplitButtonStories:()=>ye,SplitButtonStory:()=>w});function buildMenu(){let e=new h.Menu;return e.append(`Save as…`,`app.save-as`),e.append(`Export`,`app.export`),e.append(`Print`,`app.print`),e}var w=class SplitButtonStory extends p{_widget=null;static{l.registerClass({GTypeName:`AdwStorybookSplitButton`},SplitButtonStory)}constructor(){super(p.fromMeta(SplitButtonStory.getMetadata(),`Default`))}static getMetadata(){return{...ge,component:o.SplitButton.$gtype}}initialize(){this._widget=new o.SplitButton({label:this.args.label,menuModel:buildMenu()});let e=this.args.iconName;e&&(this._widget.iconName=e),this.addContent(this._widget)}updateArgs(e){if(!this._widget)return;let t=this.args.iconName;t?this._widget.iconName=t:this._widget.label=this.args.label}};l.type_ensure(w.$gtype);var T=class SplitButtonFlatStory extends p{_widget=null;static{l.registerClass({GTypeName:`AdwStorybookSplitButtonFlat`},SplitButtonFlatStory)}constructor(){super(p.fromMeta(SplitButtonFlatStory.getMetadata(),`Default`))}static getMetadata(){return{..._e,component:o.SplitButton.$gtype}}initialize(){this._widget=new o.SplitButton({label:this.args.label,menuModel:buildMenu()}),this._widget.add_css_class(`flat`);let e=this.args.iconName;e&&(this._widget.iconName=e),this.addContent(this._widget)}updateArgs(e){if(!this._widget)return;let t=this.args.iconName;t?this._widget.iconName=t:this._widget.label=this.args.label}};l.type_ensure(T.$gtype);const ye={stories:[w,T]},be={title:`Buttons/Toggle Group`,description:`Adw.ToggleGroup — a linked group of Adw.Toggle buttons where exactly one is active.`,controls:[{name:`active`,label:`Active toggle`,type:n.SELECT,options:[{label:`List`,value:0},{label:`Grid`,value:1},{label:`Columns`,value:2}],defaultValue:0},{name:`style`,label:`Style`,type:n.SELECT,options:[{label:`Default`,value:`default`},{label:`Flat`,value:`flat`},{label:`Round`,value:`round`}],defaultValue:`default`}]};var xe=__exportAll({ToggleGroupStories:()=>Ce,ToggleGroupStory:()=>E});const Se=[`flat`,`round`];var E=class ToggleGroupStory extends p{_toggleGroup=null;static{l.registerClass({GTypeName:`AdwStorybookToggleGroup`},ToggleGroupStory)}constructor(){super(p.fromMeta(ToggleGroupStory.getMetadata(),`Default`))}static getMetadata(){return{...be,component:o.ToggleGroup.$gtype}}initialize(){this._toggleGroup=new o.ToggleGroup,this._toggleGroup.add(new o.Toggle({label:`List`,iconName:`view-list-symbolic`})),this._toggleGroup.add(new o.Toggle({label:`Grid`,iconName:`view-grid-symbolic`})),this._toggleGroup.add(new o.Toggle({label:`Columns`,iconName:`view-columns-symbolic`})),this._toggleGroup.active=this.args.active,this._applyStyle(this.args.style),this.addContent(this._toggleGroup)}_applyStyle(e){if(this._toggleGroup){for(let e of Se)this._toggleGroup.remove_css_class(e);e!=="default"&&this._toggleGroup.add_css_class(e)}}updateArgs(e){this._toggleGroup&&(this._toggleGroup.active=this.args.active,this._applyStyle(this.args.style))}};l.type_ensure(E.$gtype);const Ce={stories:[E]},we={title:`Feedback/About Dialog`,description:`Adw.AboutDialog — the standard Adwaita about window with application name, version, credits and license.`,controls:[{name:`applicationName`,label:`Application name`,type:n.TEXT,defaultValue:`Adwaita Storybook`},{name:`version`,label:`Version`,type:n.TEXT,defaultValue:`0.11.0`}]};var Te=__exportAll({AboutDialogStories:()=>Ee,AboutDialogStory:()=>D}),D=class AboutDialogStory extends p{_button=null;static{l.registerClass({GTypeName:`AdwStorybookAboutDialog`},AboutDialogStory)}constructor(){super(p.fromMeta(AboutDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...we,component:o.AboutDialog.$gtype}}initialize(){this._button=new f.Button({label:`Show dialog`,halign:f.Align.CENTER,valign:f.Align.CENTER}),this._button.add_css_class(`pill`),this._button.add_css_class(`suggested-action`),this._button.connect(`clicked`,()=>this._present()),this.addContent(this._button)}_present(){new o.AboutDialog({applicationName:this.args.applicationName,applicationIcon:`application-x-executable-symbolic`,developerName:`A GJSify Project`,version:this.args.version,comments:`A live catalogue of native GTK and Adwaita widgets, rendered under GJS.`,website:`https://github.com/gjsify/gjsify`,issueUrl:`https://github.com/gjsify/gjsify/issues`,licenseType:f.License.MIT_X11,developers:[`Ada Lovelace`,`Grace Hopper`],designers:[`Margaret Hamilton`],copyright:`© 2026 The GJSify Project`}).present(this)}updateArgs(e){}};l.type_ensure(D.$gtype);const Ee={stories:[D]},De={title:`Feedback/Alert Dialog`,description:`Adw.AlertDialog — a modal dialog with a heading, body text and responses, including a destructive action.`,controls:[{name:`heading`,label:`Heading`,type:n.TEXT,defaultValue:`Delete Project?`},{name:`body`,label:`Body`,type:n.TEXT,defaultValue:`This will permanently remove the project and all of its files. This action cannot be undone.`}]};var Oe=__exportAll({AlertDialogStories:()=>ke,AlertDialogStory:()=>O}),O=class AlertDialogStory extends p{_button=null;static{l.registerClass({GTypeName:`AdwStorybookAlertDialog`},AlertDialogStory)}constructor(){super(p.fromMeta(AlertDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...De,component:o.AlertDialog.$gtype}}initialize(){this._button=new f.Button({label:`Show dialog`,halign:f.Align.CENTER,valign:f.Align.CENTER}),this._button.add_css_class(`pill`),this._button.add_css_class(`suggested-action`),this._button.connect(`clicked`,()=>this._present()),this.addContent(this._button)}_present(){let e=new o.AlertDialog({heading:this.args.heading,body:this.args.body});e.add_response(`cancel`,`Cancel`),e.add_response(`delete`,`Delete`),e.set_response_appearance(`delete`,o.ResponseAppearance.DESTRUCTIVE),e.set_default_response(`cancel`),e.set_close_response(`cancel`),e.present(this)}updateArgs(e){}};l.type_ensure(O.$gtype);const ke={stories:[O]},Ae={title:`Feedback/Preferences Dialog`,description:`Adw.PreferencesDialog — a preferences window with a page, a group and a handful of boxed-list rows.`,controls:[{name:`pageTitle`,label:`Page title`,type:n.TEXT,defaultValue:`General`},{name:`groupTitle`,label:`Group title`,type:n.TEXT,defaultValue:`Appearance`}]};var je=__exportAll({PreferencesDialogStories:()=>Me,PreferencesDialogStory:()=>k}),k=class PreferencesDialogStory extends p{_button=null;static{l.registerClass({GTypeName:`AdwStorybookPreferencesDialog`},PreferencesDialogStory)}constructor(){super(p.fromMeta(PreferencesDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...Ae,component:o.PreferencesDialog.$gtype}}initialize(){this._button=new f.Button({label:`Show dialog`,halign:f.Align.CENTER,valign:f.Align.CENTER}),this._button.add_css_class(`pill`),this._button.add_css_class(`suggested-action`),this._button.connect(`clicked`,()=>this._present()),this.addContent(this._button)}_present(){let e=new o.PreferencesDialog,t=new o.PreferencesPage({title:this.args.pageTitle,iconName:`preferences-system-symbolic`}),n=new o.PreferencesGroup({title:this.args.groupTitle,description:`Control how the application looks and behaves.`});n.add(new o.SwitchRow({title:`Dark style`,subtitle:`Use a dark colour scheme`,active:!0})),n.add(new o.ComboRow({title:`Accent colour`,model:new f.StringList({strings:[`Blue`,`Teal`,`Green`,`Orange`,`Purple`]}),selected:0})),n.add(new o.SpinRow({title:`Font size`,adjustment:new f.Adjustment({lower:8,upper:24,value:12,stepIncrement:1,pageIncrement:4})})),t.add(n),e.add(t),e.present(this)}updateArgs(e){}};l.type_ensure(k.$gtype);const Me={stories:[k]},Ne={title:`Feedback/Toast`,description:`Adw.Toast — a transient notification, with an optional action button, shown over an Adw.ToastOverlay.`,controls:[{name:`title`,label:`Toast text`,type:n.TEXT,defaultValue:`File moved to Trash`},{name:`timeout`,label:`Timeout (s)`,type:n.NUMBER,min:0,max:10,step:1,defaultValue:3},{name:`hasButton`,label:`Action button`,type:n.BOOLEAN,defaultValue:!0},{name:`buttonLabel`,label:`Button label`,type:n.TEXT,defaultValue:`Undo`}]};var Pe=__exportAll({ToastStories:()=>Fe,ToastStory:()=>A}),A=class ToastStory extends p{_overlay=null;static{l.registerClass({GTypeName:`AdwStorybookToast`},ToastStory)}constructor(){super(p.fromMeta(ToastStory.getMetadata(),`Default`))}static getMetadata(){return{...Ne,component:o.Toast.$gtype}}initialize(){let e=new f.Button({label:`Show toast`,halign:f.Align.CENTER,valign:f.Align.CENTER});e.add_css_class(`pill`),e.add_css_class(`suggested-action`),e.connect(`clicked`,()=>this._showToast()),this._overlay=new o.ToastOverlay({child:e,widthRequest:360,heightRequest:220}),this.addContent(this._overlay)}_showToast(){if(!this._overlay)return;let e=new o.Toast({title:this.args.title,timeout:this.args.timeout});this.args.hasButton&&(e.buttonLabel=this.args.buttonLabel),this._overlay.add_toast(e)}updateArgs(e){}};l.type_ensure(A.$gtype);const Fe={stories:[A]},Ie={title:`Layout/Clamp`,description:`Adw.Clamp limits its child to a maximum width and centres it, tightening the layout as space shrinks.`,controls:[{name:`maximumSize`,label:`Maximum size`,type:n.RANGE,min:200,max:600,step:10,defaultValue:400},{name:`tighteningThreshold`,label:`Tightening threshold`,type:n.RANGE,min:100,max:600,step:10,defaultValue:300}]};var Le=__exportAll({ClampStories:()=>Re,ClampStory:()=>j}),j=class ClampStory extends p{_clamp=null;static{l.registerClass({GTypeName:`AdwStorybookClamp`},ClampStory)}constructor(){super(p.fromMeta(ClampStory.getMetadata(),`Default`))}static getMetadata(){return{...Ie,component:o.Clamp.$gtype}}initialize(){let e=new f.Box({orientation:f.Orientation.HORIZONTAL,widthRequest:520});e.add_css_class(`card`);let t=new f.Label({label:`This content is clamped — it stops growing past the maximum size and stays centred.`,wrap:!0,xalign:0,hexpand:!0,marginTop:18,marginBottom:18,marginStart:18,marginEnd:18});e.append(t),this._clamp=new o.Clamp({maximumSize:this.args.maximumSize,tighteningThreshold:this.args.tighteningThreshold,child:e}),this.addContent(this._clamp)}updateArgs(e){this._clamp&&(this._clamp.maximumSize=this.args.maximumSize,this._clamp.tighteningThreshold=this.args.tighteningThreshold)}};l.type_ensure(j.$gtype);const Re={stories:[j]},ze={title:`Layout/Header Bar`,description:`Adw.HeaderBar hosts a custom title widget with start and end controls — the standard top chrome of an Adwaita window.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:n.TEXT,defaultValue:`notes.md`},{name:`showTitle`,label:`Show title`,type:n.BOOLEAN,defaultValue:!0}]};var Be=__exportAll({HeaderBarStories:()=>Ve,HeaderBarStory:()=>M}),M=class HeaderBarStory extends p{_headerBar=null;_title=null;static{l.registerClass({GTypeName:`AdwStorybookHeaderBar`},HeaderBarStory)}constructor(){super(p.fromMeta(HeaderBarStory.getMetadata(),`Default`))}static getMetadata(){return{...ze,component:o.HeaderBar.$gtype}}initialize(){this._title=new o.WindowTitle({title:this.args.title,subtitle:this.args.subtitle}),this._headerBar=new o.HeaderBar({titleWidget:this._title,showTitle:this.args.showTitle,widthRequest:460});let e=new f.Button({iconName:`go-previous-symbolic`});e.add_css_class(`flat`),this._headerBar.pack_start(e);let t=new h.Menu;t.append(`New Window`,`app.new-window`),t.append(`Preferences`,`app.preferences`),t.append(`About`,`app.about`);let n=new f.MenuButton({iconName:`open-menu-symbolic`,menuModel:t});n.add_css_class(`flat`),this._headerBar.pack_end(n),this.addContent(this._headerBar)}updateArgs(e){!this._headerBar||!this._title||(this._title.title=this.args.title,this._title.subtitle=this.args.subtitle,this._headerBar.showTitle=this.args.showTitle)}};l.type_ensure(M.$gtype);const Ve={stories:[M]},He={title:`Layout/Toolbar View`,description:`Adw.ToolbarView pins a top header bar and a bottom toolbar around its content, each independently revealable.`,controls:[{name:`revealTopBars`,label:`Reveal top bars`,type:n.BOOLEAN,defaultValue:!0},{name:`revealBottomBars`,label:`Reveal bottom bars`,type:n.BOOLEAN,defaultValue:!0}]};var Ue=__exportAll({ToolbarViewStories:()=>We,ToolbarViewStory:()=>N}),N=class ToolbarViewStory extends p{_view=null;static{l.registerClass({GTypeName:`AdwStorybookToolbarView`},ToolbarViewStory)}constructor(){super(p.fromMeta(ToolbarViewStory.getMetadata(),`Default`))}static getMetadata(){return{...He,component:o.ToolbarView.$gtype}}initialize(){this._view=new o.ToolbarView({widthRequest:460,heightRequest:320,revealTopBars:this.args.revealTopBars,revealBottomBars:this.args.revealBottomBars});let e=new o.HeaderBar({titleWidget:new o.WindowTitle({title:`Documents`,subtitle:`12 items`})});this._view.add_top_bar(e);let t=new o.StatusPage({iconName:`folder-documents-symbolic`,title:`Your library`,description:`Content sits between the toolbars and scrolls independently of them.`});this._view.content=t;let n=new f.ActionBar,r=new f.Button({iconName:`list-add-symbolic`});r.add_css_class(`flat`);let i=new f.Button({iconName:`list-remove-symbolic`});i.add_css_class(`flat`),n.pack_start(r),n.pack_start(i),n.set_center_widget(new f.Label({label:`Selection: none`}));let a=new f.Button({iconName:`send-to-symbolic`});a.add_css_class(`flat`),n.pack_end(a),this._view.add_bottom_bar(n),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.revealTopBars=this.args.revealTopBars,this._view.revealBottomBars=this.args.revealBottomBars)}};l.type_ensure(N.$gtype);const We={stories:[N]},Ge={title:`Layout/Wrap Box`,description:`Adw.WrapBox flows its children horizontally and wraps them onto new lines when they run out of room.`,controls:[{name:`childSpacing`,label:`Child spacing`,type:n.RANGE,min:0,max:36,step:1,defaultValue:8},{name:`lineSpacing`,label:`Line spacing`,type:n.RANGE,min:0,max:36,step:1,defaultValue:8}]};var Ke=__exportAll({WrapBoxStories:()=>qe,WrapBoxStory:()=>P}),P=class WrapBoxStory extends p{_wrap=null;static{l.registerClass({GTypeName:`AdwStorybookWrapBox`},WrapBoxStory)}constructor(){super(p.fromMeta(WrapBoxStory.getMetadata(),`Default`))}static getMetadata(){return{...Ge,component:o.WrapBox.$gtype}}initialize(){this._wrap=new o.WrapBox({childSpacing:this.args.childSpacing,lineSpacing:this.args.lineSpacing,widthRequest:460});for(let e of[`Design`,`Adwaita`,`GNOME`,`GTK`,`Typescript`,`Storybook`,`Wrapping`,`Layout`]){let t=new f.Button({label:e});t.add_css_class(`pill`),this._wrap.append(t)}this.addContent(this._wrap)}updateArgs(e){this._wrap&&(this._wrap.childSpacing=this.args.childSpacing,this._wrap.lineSpacing=this.args.lineSpacing)}};l.type_ensure(P.$gtype);const qe={stories:[P]},Je={title:`Navigation/Bottom Sheet`,description:`Adw.BottomSheet — a sheet that slides up over the content. Toggle "Open" to reveal it.`,controls:[{name:`open`,label:`Open`,type:n.BOOLEAN,defaultValue:!0},{name:`modal`,label:`Modal`,type:n.BOOLEAN,defaultValue:!0},{name:`canClose`,label:`Can close`,type:n.BOOLEAN,defaultValue:!0}]};var Ye=__exportAll({BottomSheetStories:()=>Xe,BottomSheetStory:()=>F}),F=class BottomSheetStory extends p{_sheet=null;static{l.registerClass({GTypeName:`AdwStorybookBottomSheet`},BottomSheetStory)}constructor(){super(p.fromMeta(BottomSheetStory.getMetadata(),`Default`))}static getMetadata(){return{...Je,component:o.BottomSheet.$gtype}}buildContent(){let e=new f.Button({label:`Toggle sheet`,halign:f.Align.CENTER,valign:f.Align.CENTER,vexpand:!0});return e.add_css_class(`pill`),e.add_css_class(`suggested-action`),e.connect(`clicked`,()=>{this._sheet&&(this._sheet.open=!this._sheet.open)}),e}buildSheet(){let e=new f.Box({orientation:f.Orientation.VERTICAL,spacing:12,marginTop:18,marginBottom:24,marginStart:18,marginEnd:18});e.append(new f.Label({label:`Share track`,halign:f.Align.START,cssClasses:[`title-2`]}));let t=new o.PreferencesGroup;for(let[e,n]of[[`Copy link`,`edit-copy-symbolic`],[`Send to a friend`,`mail-send-symbolic`],[`Add to playlist`,`list-add-symbolic`]]){let r=new o.ActionRow({title:e});r.add_prefix(new f.Image({iconName:n})),r.activatable=!0,t.add(r)}return e.append(t),e}initialize(){this._sheet=new o.BottomSheet({content:this.buildContent(),sheet:this.buildSheet(),open:this.args.open,modal:this.args.modal,canClose:this.args.canClose,widthRequest:480,heightRequest:340}),this.addContent(this._sheet)}updateArgs(e){this._sheet&&(this._sheet.open=this.args.open,this._sheet.modal=this.args.modal,this._sheet.canClose=this.args.canClose)}};l.type_ensure(F.$gtype);const Xe={stories:[F]},Ze={title:`Navigation/Navigation Split View`,description:`Adw.NavigationSplitView — a resizable sidebar beside a content pane. When collapsed it folds into a navigation stack.`,controls:[{name:`showContent`,label:`Show content`,type:n.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:n.BOOLEAN,defaultValue:!1}]};var Qe=__exportAll({NavigationSplitViewStories:()=>et,NavigationSplitViewStory:()=>$e}),$e=class NavigationSplitViewStory extends p{_view=null;static{l.registerClass({GTypeName:`AdwStorybookNavigationSplitView`},NavigationSplitViewStory)}constructor(){super(p.fromMeta(NavigationSplitViewStory.getMetadata(),`Default`))}static getMetadata(){return{...Ze,component:o.NavigationSplitView.$gtype}}buildSidebar(){let e=new o.PreferencesGroup;for(let[t,n,r]of[[`All Mail`,`128 messages`,`mail-unread-symbolic`],[`Starred`,`6 messages`,`starred-symbolic`],[`Drafts`,`2 messages`,`document-edit-symbolic`],[`Archive`,`512 messages`,`folder-symbolic`]]){let i=new o.ActionRow({title:t,subtitle:n});i.add_prefix(new f.Image({iconName:r})),i.activatable=!0,e.add(i)}let t=new o.ToolbarView;return t.add_top_bar(new o.HeaderBar),t.content=e,new o.NavigationPage({title:`Mailboxes`,child:t})}buildContent(){let e=new o.StatusPage({iconName:`mail-unread-symbolic`,title:`All Mail`,description:`Select a conversation from the list to read it here.`,vexpand:!0}),t=new o.ToolbarView;return t.add_top_bar(new o.HeaderBar),t.content=e,new o.NavigationPage({title:`All Mail`,child:t})}initialize(){this._view=new o.NavigationSplitView({sidebar:this.buildSidebar(),content:this.buildContent(),showContent:this.args.showContent,collapsed:this.args.collapsed,widthRequest:480,heightRequest:340}),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.showContent=this.args.showContent,this._view.collapsed=this.args.collapsed)}};l.type_ensure($e.$gtype);const et={stories:[$e]},tt={title:`Navigation/Navigation View`,description:`Adw.NavigationView — a navigation stack. The root page pushes a detail page, which gets an automatic back button.`,controls:[{name:`rootTitle`,label:`Root title`,type:n.TEXT,defaultValue:`Contacts`},{name:`detailTitle`,label:`Detail title`,type:n.TEXT,defaultValue:`Ada Lovelace`},{name:`animateTransitions`,label:`Animate transitions`,type:n.BOOLEAN,defaultValue:!0}]};var nt=__exportAll({NavigationViewStories:()=>rt,NavigationViewStory:()=>I}),I=class NavigationViewStory extends p{_view=null;static{l.registerClass({GTypeName:`AdwStorybookNavigationView`},NavigationViewStory)}constructor(){super(p.fromMeta(NavigationViewStory.getMetadata(),`Default`))}static getMetadata(){return{...tt,component:o.NavigationView.$gtype}}buildPage(e,t){let n=new o.ToolbarView;return n.add_top_bar(new o.HeaderBar),n.content=t,new o.NavigationPage({title:e,child:n})}initialize(){this._view=new o.NavigationView({animateTransitions:this.args.animateTransitions,widthRequest:480,heightRequest:340});let e=this.buildPage(this.args.detailTitle,new o.StatusPage({iconName:`avatar-default-symbolic`,title:this.args.detailTitle,description:`Mathematician and writer, the first computer programmer.`,vexpand:!0})),t=new f.Button({label:`Open contact`,halign:f.Align.CENTER,valign:f.Align.CENTER,vexpand:!0});t.add_css_class(`pill`),t.add_css_class(`suggested-action`),t.connect(`clicked`,()=>{this._view?.push(e)});let n=this.buildPage(this.args.rootTitle,t);this._view.add(n),this._view.add(e),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.animateTransitions=this.args.animateTransitions)}};l.type_ensure(I.$gtype);const rt={stories:[I]},it={title:`Navigation/Overlay Split View`,description:`Adw.OverlaySplitView — a sidebar shown beside the content, or overlaid on top of it when collapsed.`,controls:[{name:`showSidebar`,label:`Show sidebar`,type:n.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:n.BOOLEAN,defaultValue:!1}]};var at=__exportAll({OverlaySplitViewStories:()=>ot,OverlaySplitViewStory:()=>L}),L=class OverlaySplitViewStory extends p{_view=null;static{l.registerClass({GTypeName:`AdwStorybookOverlaySplitView`},OverlaySplitViewStory)}constructor(){super(p.fromMeta(OverlaySplitViewStory.getMetadata(),`Default`))}static getMetadata(){return{...it,component:o.OverlaySplitView.$gtype}}buildSidebar(){let e=new o.PreferencesGroup;for(let[t,n]of[[`Home`,`go-home-symbolic`],[`Discover`,`system-search-symbolic`],[`Library`,`folder-music-symbolic`],[`Settings`,`emblem-system-symbolic`]]){let r=new o.ActionRow({title:t});r.add_prefix(new f.Image({iconName:n})),r.activatable=!0,e.add(r)}let t=new o.ToolbarView;return t.add_top_bar(new o.HeaderBar({showTitle:!1})),t.content=e,t.add_css_class(`sidebar`),t}buildContent(){let e=new o.StatusPage({iconName:`folder-music-symbolic`,title:`Your Library`,description:`Toggle the sidebar to browse sections. Collapse it to overlay the content.`,vexpand:!0}),t=new o.ToolbarView;return t.add_top_bar(new o.HeaderBar),t.content=e,t}initialize(){this._view=new o.OverlaySplitView({sidebar:this.buildSidebar(),content:this.buildContent(),showSidebar:this.args.showSidebar,collapsed:this.args.collapsed,widthRequest:480,heightRequest:340}),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.showSidebar=this.args.showSidebar,this._view.collapsed=this.args.collapsed)}};l.type_ensure(L.$gtype);const ot={stories:[L]},st={title:`Navigation/Sidebar`,description:`Adw.Sidebar — a selectable list of Adw.SidebarItem grouped into sections. Selecting an item updates the content.`,controls:[{name:`mode`,label:`Mode`,type:n.SELECT,options:[{label:`Sidebar`,value:`sidebar`},{label:`Page`,value:`page`}],defaultValue:`sidebar`},{name:`selected`,label:`Selected index`,type:n.NUMBER,min:0,max:3,step:1,defaultValue:0}]};var ct=__exportAll({SidebarStories:()=>lt,SidebarStory:()=>R}),R=class SidebarStory extends p{_sidebar=null;_status=null;static{l.registerClass({GTypeName:`AdwStorybookSidebar`},SidebarStory)}constructor(){super(p.fromMeta(SidebarStory.getMetadata(),`Default`))}static getMetadata(){return{...st,component:o.Sidebar.$gtype}}items=[{title:`Inbox`,subtitle:`3 unread`,icon:`mail-unread-symbolic`},{title:`Starred`,subtitle:`Favourites`,icon:`starred-symbolic`},{title:`Sent`,subtitle:`Outgoing mail`,icon:`mail-send-symbolic`},{title:`Archive`,subtitle:`Older mail`,icon:`folder-symbolic`}];modeFromArg(e){return e===`page`?o.SidebarMode.PAGE:o.SidebarMode.SIDEBAR}syncContent(){if(!this._sidebar||!this._status)return;let e=this.items[this._sidebar.selected]??this.items[0];this._status.title=e.title,this._status.iconName=e.icon,this._status.description=e.subtitle}initialize(){let e=new o.SidebarSection({title:`Mailboxes`});for(let t of this.items)e.append(new o.SidebarItem({title:t.title,subtitle:t.subtitle,iconName:t.icon}));this._sidebar=new o.Sidebar({mode:this.modeFromArg(this.args.mode),selected:this.args.selected,widthRequest:220}),this._sidebar.append(e),this._sidebar.connect(`notify::selected`,()=>this.syncContent()),this._status=new o.StatusPage({hexpand:!0,vexpand:!0});let t=new f.Box({orientation:f.Orientation.HORIZONTAL,widthRequest:480,heightRequest:340});t.append(this._sidebar),t.append(new f.Separator({orientation:f.Orientation.VERTICAL})),t.append(this._status),this.syncContent(),this.addContent(t)}updateArgs(e){this._sidebar&&(this._sidebar.mode=this.modeFromArg(this.args.mode),this._sidebar.selected=this.args.selected,this.syncContent())}};l.type_ensure(R.$gtype);const lt={stories:[R]},ut={title:`Presentation/Avatar`,description:`A circular avatar that derives initials (and a colour) from a name, or shows a symbolic icon.`,controls:[{name:`text`,label:`Name`,type:n.TEXT,defaultValue:`Ada Lovelace`},{name:`size`,label:`Size`,type:n.RANGE,min:24,max:160,step:8,defaultValue:96},{name:`showInitials`,label:`Show initials`,type:n.BOOLEAN,defaultValue:!0},{name:`iconName`,label:`Fallback icon`,type:n.SELECT,options:[{label:`Person`,value:`avatar-default-symbolic`},{label:`Contact`,value:`contact-new-symbolic`},{label:`Camera`,value:`camera-photo-symbolic`}],defaultValue:`avatar-default-symbolic`}]};var dt=__exportAll({AvatarStories:()=>ft,AvatarStory:()=>z}),z=class AvatarStory extends p{_avatar=null;static{l.registerClass({GTypeName:`AdwStorybookAvatar`},AvatarStory)}constructor(){super(p.fromMeta(AvatarStory.getMetadata(),`Default`))}static getMetadata(){return{...ut,component:o.Avatar.$gtype}}initialize(){this._avatar=new o.Avatar({size:this.args.size,text:this.args.text,showInitials:this.args.showInitials,iconName:this.args.iconName}),this.addContent(this._avatar)}updateArgs(e){this._avatar&&(this._avatar.size=this.args.size,this._avatar.text=this.args.text,this._avatar.showInitials=this.args.showInitials,this._avatar.iconName=this.args.iconName)}};l.type_ensure(z.$gtype);const ft={stories:[z]},pt={title:`Presentation/Banner`,description:`Adw.Banner — a full-width strip carrying a status message and an optional action button.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Metered connection — updates paused`},{name:`buttonLabel`,label:`Button label`,type:n.TEXT,defaultValue:`Resume`},{name:`revealed`,label:`Revealed`,type:n.BOOLEAN,defaultValue:!0},{name:`useMarkup`,label:`Use markup`,type:n.BOOLEAN,defaultValue:!1}]};var mt=__exportAll({BannerStories:()=>ht,BannerStory:()=>B}),B=class BannerStory extends p{_banner=null;static{l.registerClass({GTypeName:`AdwStorybookBanner`},BannerStory)}constructor(){super(p.fromMeta(BannerStory.getMetadata(),`Default`))}static getMetadata(){return{...pt,component:o.Banner.$gtype}}initialize(){this._banner=new o.Banner({title:this.args.title,buttonLabel:this.args.buttonLabel,revealed:this.args.revealed,useMarkup:this.args.useMarkup});let e=new f.Box({orientation:f.Orientation.VERTICAL,widthRequest:460});e.append(this._banner),this.addContent(e)}updateArgs(e){this._banner&&(this._banner.title=this.args.title,this._banner.buttonLabel=this.args.buttonLabel,this._banner.revealed=this.args.revealed,this._banner.useMarkup=this.args.useMarkup)}};l.type_ensure(B.$gtype);const ht={stories:[B]},gt={title:`Presentation/Spinner`,description:`Adw.Spinner — a lightweight loading indicator that spins continuously while visible.`,controls:[{name:`size`,label:`Size`,type:n.RANGE,min:16,max:64,step:4,defaultValue:48}]};var _t=__exportAll({SpinnerStories:()=>vt,SpinnerStory:()=>V}),V=class SpinnerStory extends p{_spinner=null;static{l.registerClass({GTypeName:`AdwStorybookSpinner`},SpinnerStory)}constructor(){super(p.fromMeta(SpinnerStory.getMetadata(),`Default`))}static getMetadata(){return{...gt,component:o.Spinner.$gtype}}initialize(){let e=this.args.size;this._spinner=new o.Spinner({widthRequest:e,heightRequest:e,halign:f.Align.CENTER,valign:f.Align.CENTER}),this.addContent(this._spinner)}updateArgs(e){if(!this._spinner)return;let t=this.args.size;this._spinner.widthRequest=t,this._spinner.heightRequest=t}};l.type_ensure(V.$gtype);const vt={stories:[V]},yt={title:`Presentation/Status Page`,description:`Adw.StatusPage — a full-page empty state with an icon, title, description and optional action.`,controls:[{name:`iconName`,label:`Icon`,type:n.SELECT,options:[{label:`Folder`,value:`folder-symbolic`},{label:`Mail`,value:`mail-unread-symbolic`},{label:`Search`,value:`system-search-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-symbolic`},{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`No Documents`},{name:`description`,label:`Description`,type:n.TEXT,defaultValue:`Documents you create or open will appear here.`}]};var bt=__exportAll({StatusPageStories:()=>xt,StatusPageStory:()=>H}),H=class StatusPageStory extends p{_statusPage=null;static{l.registerClass({GTypeName:`AdwStorybookStatusPage`},StatusPageStory)}constructor(){super(p.fromMeta(StatusPageStory.getMetadata(),`Default`))}static getMetadata(){return{...yt,component:o.StatusPage.$gtype}}initialize(){let e=new f.Button({label:`New Document`,halign:f.Align.CENTER,cssClasses:[`pill`,`suggested-action`]});this._statusPage=new o.StatusPage({iconName:this.args.iconName,title:this.args.title,description:this.args.description,child:e,widthRequest:460,heightRequest:320}),this.addContent(this._statusPage)}updateArgs(e){this._statusPage&&(this._statusPage.iconName=this.args.iconName,this._statusPage.title=this.args.title,this._statusPage.description=this.args.description)}};l.type_ensure(H.$gtype);const xt={stories:[H]},St={title:`Presentation/Window Title`,description:`Adw.WindowTitle — a compact title/subtitle widget intended for a window or header bar.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Inbox`},{name:`subtitle`,label:`Subtitle`,type:n.TEXT,defaultValue:`3 unread messages`}]};var Ct=__exportAll({WindowTitleStories:()=>wt,WindowTitleStory:()=>U}),U=class WindowTitleStory extends p{_windowTitle=null;static{l.registerClass({GTypeName:`AdwStorybookWindowTitle`},WindowTitleStory)}constructor(){super(p.fromMeta(WindowTitleStory.getMetadata(),`Default`))}static getMetadata(){return{...St,component:o.WindowTitle.$gtype}}initialize(){this._windowTitle=new o.WindowTitle({title:this.args.title,subtitle:this.args.subtitle}),this.addContent(this._windowTitle)}updateArgs(e){this._windowTitle&&(this._windowTitle.title=this.args.title,this._windowTitle.subtitle=this.args.subtitle)}};l.type_ensure(U.$gtype);const wt={stories:[U]},Tt={title:`Boxed Lists/Action Row`,description:`Adw.ActionRow — a preferences row with a title/subtitle, a prefix icon and a suffix button, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Wi-Fi`},{name:`subtitle`,label:`Subtitle`,type:n.TEXT,defaultValue:`Connected to Highgarden 5GHz`},{name:`iconName`,label:`Prefix icon`,type:n.SELECT,options:[{label:`Network`,value:`network-wireless-symbolic`},{label:`Folder`,value:`folder-symbolic`},{label:`Starred`,value:`starred-symbolic`}],defaultValue:`network-wireless-symbolic`},{name:`activatable`,label:`Activatable`,type:n.BOOLEAN,defaultValue:!0}]};var Et=__exportAll({ActionRowStories:()=>Dt,ActionRowStory:()=>W}),W=class ActionRowStory extends p{_row=null;_icon=null;_button=null;static{l.registerClass({GTypeName:`AdwStorybookActionRow`},ActionRowStory)}constructor(){super(p.fromMeta(ActionRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Tt,component:o.ActionRow.$gtype}}initialize(){this._row=new o.ActionRow({title:this.args.title,subtitle:this.args.subtitle}),this._icon=new f.Image({iconName:this.args.iconName}),this._row.add_prefix(this._icon),this._button=new f.Button({iconName:`go-next-symbolic`,valign:f.Align.CENTER}),this._button.add_css_class(`flat`),this._row.add_suffix(this._button),this._row.activatableWidget=this._button,this._row.activatable=this.args.activatable;let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){!this._row||!this._icon||(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._icon.iconName=this.args.iconName,this._row.activatable=this.args.activatable)}};l.type_ensure(W.$gtype);const Dt={stories:[W]},Ot={title:`Boxed Lists/Button Row`,description:`Adw.ButtonRow — a full-width row that acts as a button, with an optional icon and style class.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Add account`},{name:`startIconName`,label:`Start icon`,type:n.SELECT,options:[{label:`Add`,value:`list-add-symbolic`},{label:`Trash`,value:`user-trash-symbolic`},{label:`None`,value:``}],defaultValue:`list-add-symbolic`},{name:`style`,label:`Style`,type:n.SELECT,options:[{label:`None`,value:`none`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`}],defaultValue:`suggested-action`}]};var kt=__exportAll({ButtonRowStories:()=>jt,ButtonRowStory:()=>G});const At=[`suggested-action`,`destructive-action`];var G=class ButtonRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookButtonRow`},ButtonRowStory)}constructor(){super(p.fromMeta(ButtonRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Ot,component:o.ButtonRow.$gtype}}initialize(){this._row=new o.ButtonRow({title:this.args.title,startIconName:this.args.startIconName}),this._applyStyle(this.args.style);let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}_applyStyle(e){if(this._row){for(let e of At)this._row.remove_css_class(e);e!==`none`&&this._row.add_css_class(e)}}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.startIconName=this.args.startIconName,this._applyStyle(this.args.style))}};l.type_ensure(G.$gtype);const jt={stories:[G]},Mt=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],Nt={title:`Boxed Lists/Combo Row`,description:`Adw.ComboRow — a preferences row with an inline drop-down backed by a Gtk.StringList.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Accent colour`},{name:`subtitle`,label:`Subtitle`,type:n.TEXT,defaultValue:`Used to highlight selected items`},{name:`selected`,label:`Selected`,type:n.NUMBER,min:0,max:4,step:1,defaultValue:1}]};var Pt=__exportAll({ComboRowStories:()=>Ft,ComboRowStory:()=>K}),K=class ComboRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookComboRow`},ComboRowStory)}constructor(){super(p.fromMeta(ComboRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Nt,component:o.ComboRow.$gtype}}initialize(){this._row=new o.ComboRow({title:this.args.title,subtitle:this.args.subtitle,model:new f.StringList({strings:[...Mt]}),selected:this.args.selected});let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._row.selected=this.args.selected)}};l.type_ensure(K.$gtype);const Ft={stories:[K]},It={title:`Boxed Lists/Entry Row`,description:`Adw.EntryRow — a preferences row whose title doubles as placeholder text for an inline entry.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Display name`},{name:`text`,label:`Text`,type:n.TEXT,defaultValue:`Ada Lovelace`},{name:`showApplyButton`,label:`Show apply button`,type:n.BOOLEAN,defaultValue:!0}]};var Lt=__exportAll({EntryRowStories:()=>Rt,EntryRowStory:()=>q}),q=class EntryRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookEntryRow`},EntryRowStory)}constructor(){super(p.fromMeta(EntryRowStory.getMetadata(),`Default`))}static getMetadata(){return{...It,component:o.EntryRow.$gtype}}initialize(){this._row=new o.EntryRow({title:this.args.title,text:this.args.text,showApplyButton:this.args.showApplyButton});let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.text=this.args.text,this._row.showApplyButton=this.args.showApplyButton)}};l.type_ensure(q.$gtype);const Rt={stories:[q]},zt={title:`Boxed Lists/Expander Row`,description:`Adw.ExpanderRow — a preferences row that discloses nested rows and can carry an enable switch.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Proxy settings`},{name:`subtitle`,label:`Subtitle`,type:n.TEXT,defaultValue:`Route traffic through a custom proxy`},{name:`expanded`,label:`Expanded`,type:n.BOOLEAN,defaultValue:!0},{name:`showEnableSwitch`,label:`Show enable switch`,type:n.BOOLEAN,defaultValue:!1}]};var Bt=__exportAll({ExpanderRowStories:()=>Vt,ExpanderRowStory:()=>J}),J=class ExpanderRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookExpanderRow`},ExpanderRowStory)}constructor(){super(p.fromMeta(ExpanderRowStory.getMetadata(),`Default`))}static getMetadata(){return{...zt,component:o.ExpanderRow.$gtype}}initialize(){this._row=new o.ExpanderRow({title:this.args.title,subtitle:this.args.subtitle,expanded:this.args.expanded,showEnableSwitch:this.args.showEnableSwitch}),this._row.add_row(new o.EntryRow({title:`Host`,text:`proxy.example.com`})),this._row.add_row(new o.SwitchRow({title:`Use authentication`,active:!1}));let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._row.expanded=this.args.expanded,this._row.showEnableSwitch=this.args.showEnableSwitch)}};l.type_ensure(J.$gtype);const Vt={stories:[J]},Ht={title:`Boxed Lists/Password Entry Row`,description:`Adw.PasswordEntryRow — an entry row that masks its contents and shows a peek toggle.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Password`},{name:`text`,label:`Text`,type:n.TEXT,defaultValue:`correct-horse-battery`}]};var Ut=__exportAll({PasswordEntryRowStories:()=>Wt,PasswordEntryRowStory:()=>Y}),Y=class PasswordEntryRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookPasswordEntryRow`},PasswordEntryRowStory)}constructor(){super(p.fromMeta(PasswordEntryRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Ht,component:o.PasswordEntryRow.$gtype}}initialize(){this._row=new o.PasswordEntryRow({title:this.args.title,text:this.args.text});let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.text=this.args.text)}};l.type_ensure(Y.$gtype);const Wt={stories:[Y]},Gt={title:`Boxed Lists/Preferences Group`,description:`Adw.PreferencesGroup — the boxed-list container that gathers a title, description, header-suffix widget and rows.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Account`},{name:`description`,label:`Description`,type:n.TEXT,defaultValue:`Manage how this device signs in and syncs.`}]};var Kt=__exportAll({PreferencesGroupStories:()=>qt,PreferencesGroupStory:()=>X}),X=class PreferencesGroupStory extends p{_prefsGroup=null;static{l.registerClass({GTypeName:`AdwStorybookPreferencesGroup`},PreferencesGroupStory)}constructor(){super(p.fromMeta(PreferencesGroupStory.getMetadata(),`Default`))}static getMetadata(){return{...Gt,component:o.PreferencesGroup.$gtype}}initialize(){let e=new f.Button({label:`Sign out`,valign:f.Align.CENTER});e.add_css_class(`flat`),this._prefsGroup=new o.PreferencesGroup({title:this.args.title,description:this.args.description,headerSuffix:e});let t=new o.EntryRow({title:`Display name`,text:`Grace Hopper`});this._prefsGroup.add(t);let n=new o.SwitchRow({title:`Sync over Wi-Fi only`,subtitle:`Avoid using mobile data for backups`,active:!0});this._prefsGroup.add(n);let r=new o.ComboRow({title:`Region`,model:new f.StringList({strings:[`Europe`,`Americas`,`Asia`,`Oceania`]}),selected:0});this._prefsGroup.add(r);let i=new o.Clamp({maximumSize:400,child:this._prefsGroup});this.addContent(i)}updateArgs(e){this._prefsGroup&&(this._prefsGroup.title=this.args.title,this._prefsGroup.description=this.args.description)}};l.type_ensure(X.$gtype);const qt={stories:[X]},Jt={title:`Boxed Lists/Spin Row`,description:`Adw.SpinRow — a preferences row with an inline spin button over a numeric adjustment.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Font size`},{name:`value`,label:`Value`,type:n.NUMBER,min:0,max:100,step:1,defaultValue:16},{name:`digits`,label:`Digits`,type:n.NUMBER,min:0,max:4,step:1,defaultValue:0}]};var Yt=__exportAll({SpinRowStories:()=>Xt,SpinRowStory:()=>Z}),Z=class SpinRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookSpinRow`},SpinRowStory)}constructor(){super(p.fromMeta(SpinRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Jt,component:o.SpinRow.$gtype}}initialize(){this._row=new o.SpinRow({title:this.args.title,adjustment:new f.Adjustment({lower:0,upper:100,value:this.args.value,stepIncrement:1,pageIncrement:10}),digits:this.args.digits});let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.value=this.args.value,this._row.digits=this.args.digits)}};l.type_ensure(Z.$gtype);const Xt={stories:[Z]},Zt={title:`Boxed Lists/Switch Row`,description:`Adw.SwitchRow — a preferences row with a trailing switch, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:n.TEXT,defaultValue:`Automatic updates`},{name:`subtitle`,label:`Subtitle`,type:n.TEXT,defaultValue:`Download and install updates without asking`},{name:`active`,label:`Active`,type:n.BOOLEAN,defaultValue:!0}]};var Qt=__exportAll({SwitchRowStories:()=>$t,SwitchRowStory:()=>Q}),Q=class SwitchRowStory extends p{_row=null;static{l.registerClass({GTypeName:`AdwStorybookSwitchRow`},SwitchRowStory)}constructor(){super(p.fromMeta(SwitchRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Zt,component:o.SwitchRow.$gtype}}initialize(){this._row=new o.SwitchRow({title:this.args.title,subtitle:this.args.subtitle,active:this.args.active});let e=new o.PreferencesGroup;e.add(this._row);let t=new o.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._row.active=this.args.active)}};l.type_ensure(Q.$gtype);const $t={stories:[Q]},en=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:n.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:n.BOOLEAN,defaultValue:!1}],tn={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:en},nn={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:en};var rn=__exportAll({CarouselDotsStory:()=>on,CarouselLinesStory:()=>$,CarouselStories:()=>sn});const an=[{title:`Welcome`,css:`accent`},{title:`Discover`,css:`success`},{title:`Get started`,css:`warning`}];function buildPage(e,t){let n=new f.Box({orientation:f.Orientation.VERTICAL,halign:f.Align.CENTER,valign:f.Align.CENTER,widthRequest:440,heightRequest:260});n.add_css_class(`card`),n.add_css_class(t);let r=new f.Label({label:e,vexpand:!0,valign:f.Align.CENTER});return r.add_css_class(`title-1`),n.append(r),n}var on=class CarouselDotsStory extends p{_carousel=null;static{l.registerClass({GTypeName:`AdwStorybookCarouselDots`},CarouselDotsStory)}constructor(){super(p.fromMeta(CarouselDotsStory.getMetadata(),`Default`))}static getMetadata(){return{...tn,component:o.Carousel.$gtype}}initialize(){this._carousel=new o.Carousel({allowScrollWheel:this.args.allowScrollWheel,allowLongSwipes:this.args.allowLongSwipes,vexpand:!0});for(let e of an)this._carousel.append(buildPage(e.title,e.css));let e=new o.CarouselIndicatorDots({carousel:this._carousel}),t=new f.Box({orientation:f.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._carousel),t.append(e),this.addContent(t)}updateArgs(e){this._carousel&&(this._carousel.allowScrollWheel=this.args.allowScrollWheel,this._carousel.allowLongSwipes=this.args.allowLongSwipes)}};l.type_ensure(on.$gtype);var $=class CarouselLinesStory extends p{_carousel=null;static{l.registerClass({GTypeName:`AdwStorybookCarouselLines`},CarouselLinesStory)}constructor(){super(p.fromMeta(CarouselLinesStory.getMetadata(),`Default`))}static getMetadata(){return{...nn,component:o.Carousel.$gtype}}initialize(){this._carousel=new o.Carousel({allowScrollWheel:this.args.allowScrollWheel,allowLongSwipes:this.args.allowLongSwipes,vexpand:!0});for(let e of an)this._carousel.append(buildPage(e.title,e.css));let e=new o.CarouselIndicatorLines({carousel:this._carousel}),t=new f.Box({orientation:f.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._carousel),t.append(e),this.addContent(t)}updateArgs(e){this._carousel&&(this._carousel.allowScrollWheel=this.args.allowScrollWheel,this._carousel.allowLongSwipes=this.args.allowLongSwipes)}};l.type_ensure($.$gtype);const sn={stories:[on,$]},cn={title:`View Switching/Inline View Switcher`,description:`Adw.InlineViewSwitcher — a compact inline switcher that can show labels, icons, or both for an Adw.ViewStack.`,controls:[{name:`displayMode`,label:`Display mode`,type:n.SELECT,options:[{label:`Labels`,value:`labels`},{label:`Icons`,value:`icons`},{label:`Both`,value:`both`}],defaultValue:`both`}]};var ln=__exportAll({InlineViewSwitcherStories:()=>dn,InlineViewSwitcherStory:()=>un}),un=class InlineViewSwitcherStory extends p{_switcher=null;static{l.registerClass({GTypeName:`AdwStorybookInlineViewSwitcher`},InlineViewSwitcherStory)}constructor(){super(p.fromMeta(InlineViewSwitcherStory.getMetadata(),`Default`))}static getMetadata(){return{...cn,component:o.InlineViewSwitcher.$gtype}}buildPage(e,t,n){return new o.StatusPage({iconName:t,title:e,description:n,vexpand:!0})}initialize(){let e=new o.ViewStack({vexpand:!0});e.add_titled_with_icon(this.buildPage(`Overview`,`view-grid-symbolic`,`A quick summary of your project.`),`overview`,`Overview`,`view-grid-symbolic`),e.add_titled_with_icon(this.buildPage(`Activity`,`document-edit-symbolic`,`Recent edits and changes.`),`activity`,`Activity`,`document-edit-symbolic`),e.add_titled_with_icon(this.buildPage(`Settings`,`emblem-system-symbolic`,`Configure how things behave.`),`settings`,`Settings`,`emblem-system-symbolic`),this._switcher=new o.InlineViewSwitcher({stack:e,displayMode:this.modeFromArg(this.args.displayMode),halign:f.Align.CENTER});let t=new f.Box({orientation:f.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._switcher),t.append(e),this.addContent(t)}modeFromArg(e){return e===`labels`?o.InlineViewSwitcherDisplayMode.LABELS:e===`icons`?o.InlineViewSwitcherDisplayMode.ICONS:o.InlineViewSwitcherDisplayMode.BOTH}updateArgs(e){this._switcher&&(this._switcher.displayMode=this.modeFromArg(this.args.displayMode))}};l.type_ensure(un.$gtype);const dn={stories:[un]},fn={title:`View Switching/Tab View`,description:`Adw.TabView with an Adw.TabBar header — three tabbed pages; the tab bar can auto-hide when only one tab remains.`,controls:[{name:`autohide`,label:`Autohide tab bar`,type:n.BOOLEAN,defaultValue:!1}]};var pn=__exportAll({TabViewStories:()=>gn,TabViewStory:()=>hn});const mn=[{title:`Overview`,body:`A summary of everything at a glance.`},{title:`Details`,body:`The specifics, broken down line by line.`},{title:`History`,body:`A log of every change made so far.`}];var hn=class TabViewStory extends p{_tabBar=null;static{l.registerClass({GTypeName:`AdwStorybookTabView`},TabViewStory)}constructor(){super(p.fromMeta(TabViewStory.getMetadata(),`Default`))}static getMetadata(){return{...fn,component:o.TabView.$gtype}}buildPageBody(e,t){return new o.StatusPage({iconName:`view-paged-symbolic`,title:e,description:t,vexpand:!0})}initialize(){let e=new o.TabView({vexpand:!0});for(let t of mn){let n=e.append(this.buildPageBody(t.title,t.body));n.title=t.title}this._tabBar=new o.TabBar({view:e,autohide:this.args.autohide});let t=new f.Box({orientation:f.Orientation.VERTICAL,widthRequest:480,heightRequest:340});t.append(this._tabBar),t.append(e),this.addContent(t)}updateArgs(e){this._tabBar&&(this._tabBar.autohide=this.args.autohide)}};l.type_ensure(hn.$gtype);const gn={stories:[hn]},_n={title:`View Switching/View Switcher`,description:`Adw.ViewSwitcher — a segmented switcher whose buttons select pages in a paired Adw.ViewStack.`,controls:[{name:`policy`,label:`Policy`,type:n.SELECT,options:[{label:`Wide`,value:`wide`},{label:`Narrow`,value:`narrow`}],defaultValue:`wide`}]};var vn=__exportAll({ViewSwitcherStories:()=>bn,ViewSwitcherStory:()=>yn}),yn=class ViewSwitcherStory extends p{_switcher=null;static{l.registerClass({GTypeName:`AdwStorybookViewSwitcher`},ViewSwitcherStory)}constructor(){super(p.fromMeta(ViewSwitcherStory.getMetadata(),`Default`))}static getMetadata(){return{..._n,component:o.ViewSwitcher.$gtype}}buildPage(e,t,n){return new o.StatusPage({iconName:t,title:e,description:n,vexpand:!0})}initialize(){let e=new o.ViewStack({vexpand:!0});e.add_titled_with_icon(this.buildPage(`Inbox`,`mail-unread-symbolic`,`You have three unread conversations.`),`inbox`,`Inbox`,`mail-unread-symbolic`),e.add_titled_with_icon(this.buildPage(`Starred`,`starred-symbolic`,`Messages you have marked as important.`),`starred`,`Starred`,`starred-symbolic`),e.add_titled_with_icon(this.buildPage(`Archive`,`folder-symbolic`,`Older conversations kept for reference.`),`archive`,`Archive`,`folder-symbolic`),this._switcher=new o.ViewSwitcher({stack:e,policy:this.policyFromArg(this.args.policy),halign:f.Align.CENTER});let t=new f.Box({orientation:f.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._switcher),t.append(e),this.addContent(t)}policyFromArg(e){return e===`narrow`?o.ViewSwitcherPolicy.NARROW:o.ViewSwitcherPolicy.WIDE}updateArgs(e){this._switcher&&(this._switcher.policy=this.policyFromArg(this.args.policy))}};l.type_ensure(yn.$gtype);const bn={stories:[yn]};await runStorybook({applicationId:`org.gjsify.AdwaitaStorybook`,title:`Adwaita Storybook`,stories:collectStoryModules([ue,pe,ve,xe,Te,Oe,je,Pe,Le,Be,Ue,Ke,Ye,Qe,nt,at,ct,dt,mt,_t,bt,Ct,Et,kt,Pt,Lt,Bt,Ut,Kt,Yt,Qt,rn,ln,pn,vn])});export{};
|