@gjsify/example-gtk-adwaita-storybook 0.37.0 → 0.38.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.node.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import{createRequire as e}from"node:module";import"@gjsify/node-gi/globals";import t from"@gjsify/node-gi/system";var n=Object.defineProperty,__name=(e,t)=>n(e,`name`,{value:t,configurable:!0}),__exportAll=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(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 r=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,n){let i=t.name,a=t.description;switch(t.type){case r.TEXT:{let r=n.text(controlLabel(t),a),o=e.args[i];return r.set(typeof o==`string`?o:``),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=typeof e[i]==`string`?e[i]:``;r.get()!==t&&r.set(t)}}}case r.COLOR:{let r=n.color(controlLabel(t),a),o=e.args[i];return r.set(typeof o==`string`?o:`#000000`),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=typeof e[i]==`string`?e[i]:`#000000`;r.get()!==t&&r.set(t)}}}case r.BOOLEAN:{let r=n.boolean(controlLabel(t),a);return r.set(!!e.args[i]),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=!!e[i];r.get()!==t&&r.set(t)}}}case r.NUMBER:{let r=n.number(t),a=e.args[i];return r.set(typeof a==`number`?a:t.min??0),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=typeof e[i]==`number`?e[i]:0;r.get()!==t&&r.set(t)}}}case r.RANGE:{let r=n.range(t),a=e.args[i],o=typeof a==`number`?a:t.min??0;return r.set(o),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=typeof e[i]==`number`?e[i]:o;r.get()!==t&&r.set(t)}}}case r.SELECT:{let r=t.options;if(!r?.length)return console.warn(`SELECT control "${i}" has no options`),null;let a=n.select(t),o=e.args[i],s=Math.max(0,r.findIndex(e=>e.value===o));return a.set(s),a.onChange(t=>{t>=0&&t<r.length&&e.setArg(i,r[t].value)}),{view:a.node,refresh:e=>{let t=e[i],n=r.findIndex(e=>e.value===t);n>=0&&a.get()!==n&&a.set(n)}}}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 i={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=[],r={},a={};for(let e of t.methods){let t=i[e.name];t&&n.push(t),r[e.name]=e.handler,a[e.name]=e.kind}return{methodsXml:n,handlers:r,methodKinds:a,contributeStatus:t.contributeStatus}}const a=e(import.meta.url);let o;function load$6(){return o===void 0&&(o=a(`@gjsify/node-gi/gi`).requireGi(`GLib`,`2.0`)),o}__name(load$6,`load`);var s=new Proxy(Object.create(null),{get(e,t){return load$6()[t]},has(e,t){return t in load$6()}});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 s.Variant.new_string(String(t));case`b`:return s.Variant.new_boolean(!!t);case`i`:return s.Variant.new_int32(Number(t));case`u`:return s.Variant.new_uint32(Number(t));case`d`:return s.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 c=e(import.meta.url);let l;function load$5(){return l===void 0&&(l=c(`@gjsify/node-gi/gi`).requireGi(`Gdk`,`4.0`)),l}__name(load$5,`load`);var u=new Proxy(Object.create(null),{get(e,t){return load$5()[t]},has(e,t){return t in load$5()}});const d=e(import.meta.url);let f;function load$4(){return f===void 0&&(f=d(`@gjsify/node-gi/gi`).requireGi(`Gtk`,`4.0`)),f}__name(load$4,`load`);var p=new Proxy(Object.create(null),{get(e,t){return load$4()[t]},has(e,t){return t in load$4()}});const m=new Map;function swapCss(e,t){let n=u.Display.get_default();if(!n)return!1;let r=m.get(e);return r||(r=new p.CssProvider,p.StyleContext.add_provider_for_display(n,r,p.STYLE_PROVIDER_PRIORITY_USER+1),m.set(e,r)),r.load_from_string(t),!0}function dumpCss(){return{providers:[...m.keys()]}}const h=`org.gjsify.Devtools`;function formatDbusErrorMessage(e,t){return`${e}: ${t}`}const g={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`,GetFocused:`read-only`,ActivateWidget:`mutating`,DumpGSettings:`read-only`,DumpCss:`read-only`,SwapCss:`mutating`};function sanitizeInstanceId(e){let t=e.toLowerCase().replace(/[^a-z0-9]/g,``);return/^[a-z]/.test(t)?t:`i${t||`0`}`}function resolveBusAddress(e,t){let n=`/${e.replace(/\./g,`/`)}`,r=t&&t!=="default"?sanitizeInstanceId(t):`default`;return r==="default"?{busName:e,objectPath:`${n}/devtools`,instance:`default`}:{busName:`${e}.${r}`,objectPath:`${n}/${r}/devtools`,instance:r}}const _=`GJSIFY_DEVTOOLS_ADDRESS`;function isDevtoolsEnabledValue(e){if(e==null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}function devtoolsAddressFilePath(e,t,n){let{busName:r}=resolveBusAddress(t,n);return`${e}/gjsify-devtools/${r}.address`}function buildDevtoolsIfaceXml(e=[]){return`<node>
2
- <interface name="${h}">
1
+ import{createRequire as e}from"node:module";import"@gjsify/node-gi/globals";import t from"@gjsify/node-gi/system";var n=Object.defineProperty,__name=(e,t)=>n(e,`name`,{value:t,configurable:!0}),__exportAll=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(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 r=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,n){let i=t.name,a=t.description;switch(t.type){case r.TEXT:{let r=n.text(controlLabel(t),a),o=e.args[i];return r.set(typeof o==`string`?o:``),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=typeof e[i]==`string`?e[i]:``;r.get()!==t&&r.set(t)}}}case r.COLOR:{let r=n.color(controlLabel(t),a),o=e.args[i];return r.set(typeof o==`string`?o:`#000000`),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=typeof e[i]==`string`?e[i]:`#000000`;r.get()!==t&&r.set(t)}}}case r.BOOLEAN:{let r=n.boolean(controlLabel(t),a);return r.set(!!e.args[i]),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=!!e[i];r.get()!==t&&r.set(t)}}}case r.NUMBER:{let r=n.number(t),a=e.args[i];return r.set(typeof a==`number`?a:t.min??0),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=typeof e[i]==`number`?e[i]:0;r.get()!==t&&r.set(t)}}}case r.RANGE:{let r=n.range(t),a=e.args[i],o=typeof a==`number`?a:t.min??0;return r.set(o),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=typeof e[i]==`number`?e[i]:o;r.get()!==t&&r.set(t)}}}case r.SELECT:{let r=t.options;if(!r?.length)return console.warn(`SELECT control "${i}" has no options`),null;let a=n.select(t),o=e.args[i],s=Math.max(0,r.findIndex(e=>e.value===o));return a.set(s),a.onChange(t=>{t>=0&&t<r.length&&e.setArg(i,r[t].value)}),{view:a.node,refresh:e=>{let t=e[i],n=r.findIndex(e=>e.value===t);n>=0&&a.get()!==n&&a.set(n)}}}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 i=[`system`,`light`,`dark`];var StorybookSettings=class{constructor(e=()=>!1){this._colorScheme=`system`,this._accentMode=`system`,this._accent=`blue`,this._listeners=new Set,this._systemDark=e}get colorScheme(){return this._colorScheme}set colorScheme(e){!i.includes(e)||e===this._colorScheme||(this._colorScheme=e,this._notify())}get accentMode(){return this._accentMode}set accentMode(e){e!==this._accentMode&&(this._accentMode=e,this._notify())}get accent(){return this._accent}set accent(e){e!==this._accent&&(this._accent=e,this._notify())}get resolvedAccent(){return this._accentMode===`custom`?this._accent:null}get resolvedDark(){return this._colorScheme===`dark`?!0:this._colorScheme===`light`?!1:this._systemDark()}get state(){return{colorScheme:this._colorScheme,accentMode:this._accentMode,accent:this._accent}}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}systemChanged(){this._colorScheme===`system`&&this._notify()}_notify(){let e=this.state;for(let t of[...this._listeners])try{t(e)}catch{}}};const a={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=[],r={},i={};for(let e of t.methods){let t=a[e.name];t&&n.push(t),r[e.name]=e.handler,i[e.name]=e.kind}return{methodsXml:n,handlers:r,methodKinds:i,contributeStatus:t.contributeStatus}}const o=e(import.meta.url);let s;function load$6(){return s===void 0&&(s=o(`@gjsify/node-gi/gi`).requireGi(`GLib`,`2.0`)),s}__name(load$6,`load`);var c=new Proxy(Object.create(null),{get(e,t){return load$6()[t]},has(e,t){return t in load$6()}});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 c.Variant.new_string(String(t));case`b`:return c.Variant.new_boolean(!!t);case`i`:return c.Variant.new_int32(Number(t));case`u`:return c.Variant.new_uint32(Number(t));case`d`:return c.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 l=e(import.meta.url);let u;function load$5(){return u===void 0&&(u=l(`@gjsify/node-gi/gi`).requireGi(`Gdk`,`4.0`)),u}__name(load$5,`load`);var d=new Proxy(Object.create(null),{get(e,t){return load$5()[t]},has(e,t){return t in load$5()}});const f=e(import.meta.url);let p;function load$4(){return p===void 0&&(p=f(`@gjsify/node-gi/gi`).requireGi(`Gtk`,`4.0`)),p}__name(load$4,`load`);var m=new Proxy(Object.create(null),{get(e,t){return load$4()[t]},has(e,t){return t in load$4()}});const h=new Map;function swapCss(e,t){let n=d.Display.get_default();if(!n)return!1;let r=h.get(e);return r||(r=new m.CssProvider,m.StyleContext.add_provider_for_display(n,r,m.STYLE_PROVIDER_PRIORITY_USER+1),h.set(e,r)),r.load_from_string(t),!0}function dumpCss(){return{providers:[...h.keys()]}}const g=`org.gjsify.Devtools`;function formatDbusErrorMessage(e,t){return`${e}: ${t}`}const ee={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`,GetFocused:`read-only`,ActivateWidget:`mutating`,DumpGSettings:`read-only`,DumpCss:`read-only`,SwapCss:`mutating`};function sanitizeInstanceId(e){let t=e.toLowerCase().replace(/[^a-z0-9]/g,``);return/^[a-z]/.test(t)?t:`i${t||`0`}`}function resolveBusAddress(e,t){let n=`/${e.replace(/\./g,`/`)}`,r=t&&t!=="default"?sanitizeInstanceId(t):`default`;return r==="default"?{busName:e,objectPath:`${n}/devtools`,instance:`default`}:{busName:`${e}.${r}`,objectPath:`${n}/${r}/devtools`,instance:r}}const _=`GJSIFY_DEVTOOLS_ADDRESS`;function isDevtoolsEnabledValue(e){if(e==null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}function devtoolsAddressFilePath(e,t,n){let{busName:r}=resolveBusAddress(t,n);return`${e}/gjsify-devtools/${r}.address`}function buildDevtoolsIfaceXml(e=[]){return`<node>
2
+ <interface name="${g}">
3
3
  <method name="GetStatus">
4
4
  <arg type="s" direction="out" name="status_json"/>
5
5
  </method>
@@ -61,7 +61,78 @@ import{createRequire as e}from"node:module";import"@gjsify/node-gi/globals";impo
61
61
  </method>${e.length>0?`\n${e.join(`
62
62
  `)}`:``}
63
63
  </interface>
64
- </node>`}const v=e(import.meta.url);let y;function load$3(){return y===void 0&&(y=v(`@gjsify/node-gi/gi`).requireGi(`Gio`,`2.0`)),y}__name(load$3,`load`);var b=new Proxy(Object.create(null),{get(e,t){return load$3()[t]},has(e,t){return t in load$3()}});function isWin32(){return s.DIR_SEPARATOR===92}function defaultListenAddress(){return isWin32()?`nonce-tcp:host=127.0.0.1`:`unix:tmpdir=${s.get_tmp_dir()}`}var DevtoolsPeerServerError=class extends Error{constructor(e,t,n,r){super(e),this.address=t,this.reason=n,this.name=`DevtoolsPeerServerError`,this.cause=r}};function isAddressInUse(e){return e instanceof s.Error&&e.matches(b.io_error_quark(),b.IOErrorEnum.ADDRESS_IN_USE)}function unixSocketPath(e){if(!e.startsWith(`unix:`))return null;for(let t of e.slice(5).split(`,`)){let e=t.indexOf(`=`);if(!(e<0||t.slice(0,e)!==`path`))try{return decodeURIComponent(t.slice(e+1))}catch{return null}}return null}function inspectExistingSocket(e){try{if((b.File.new_for_path(e).query_info(`unix::mode`,b.FileQueryInfoFlags.NONE,null).get_attribute_uint32(`unix::mode`)&61440)!=49152)return`not-a-socket`}catch{return`not-a-socket`}let t=new b.SocketClient;t.set_timeout(2);let n;try{n=t.connect(b.UnixSocketAddress.new(e),null)}catch{return`dead`}return n.close(null),`live`}function clearReclaimableSocket(e){let t=unixSocketPath(e);if(!t||!s.file_test(t,s.FileTest.EXISTS))return;let n=inspectExistingSocket(t);if(n===`live`)throw new DevtoolsPeerServerError(`cannot listen on ${e}: another process is already listening there. Stop it, or point ${_} (or options.address) at a different socket — GJSIFY_DEVTOOLS_INSTANCE=<label> lets two devtools-enabled apps run side by side.`,e,`address-in-use`);if(n===`not-a-socket`)throw new DevtoolsPeerServerError(`cannot listen on ${e}: ${t} already exists and is not a socket, so it will NOT be removed. Point ${_} (or options.address) at a free path.`,e,`occupied-by-other-file`);try{b.File.new_for_path(t).delete(null)}catch(n){throw new DevtoolsPeerServerError(`cannot listen on ${e}: ${t} is a socket nothing listens on, but removing it failed (${n}). Delete it by hand, or point ${_} at a free path.`,e,`address-in-use`,n)}console.log(`[gjsify-devtools] reclaimed the stale socket ${t}: nothing was listening on it (an abnormal exit — Ctrl-C, SIGKILL, a crash — leaves the inode behind).`)}function flagsForAddress(e){return e.startsWith(`tcp:`)||e.startsWith(`nonce-tcp:`)?b.DBusServerFlags.NONE:b.DBusServerFlags.AUTHENTICATION_REQUIRE_SAME_USER}function startDevtoolsPeerServer(e,t,n){let r=n&&n!==``?n:defaultListenAddress();clearReclaimableSocket(r);let i;try{i=b.DBusServer.new_sync(r,flagsForAddress(r),b.dbus_generate_guid(),null,null)}catch(e){let t=isAddressInUse(e);throw new DevtoolsPeerServerError(t?`cannot listen on ${r}: the address is already in use (${e}). Stop whatever holds it, or point ${_} (or options.address) at a different address.`:`cannot listen on ${r}: ${e}. Check the address form — \`unix:path=/tmp/app.sock\`, \`unix:tmpdir=/tmp\` or \`nonce-tcp:host=127.0.0.1\`.`,r,t?`address-in-use`:`listen-failed`,e)}let a=new Set;i.connect(`new-connection`,(n,r)=>(a.add(r),r.connect(`closed`,()=>{e.unexport(r),a.delete(r)}),e.export(r,t),!0)),i.start();let o=!1;return{address:i.get_client_address(),objectPath:t,get connectionCount(){return a.size},stop(){if(!o){o=!0,i.stop();for(let t of a)e.unexport(t),!t.is_closed()&&t.close(null,(e,t)=>{try{e.close_finish(t)}catch{}});a.clear()}}}}function writeDevtoolsAddressFile(e,t){try{if(s.mkdir_with_parents(s.path_get_dirname(e),448),!s.file_set_contents(e,`${t}\n`))return null}catch(t){return console.error(`[gjsify-devtools] could not publish the peer address to ${e}: ${t}`),null}try{b.File.new_for_path(e).set_attribute_uint32(`unix::mode`,384,b.FileQueryInfoFlags.NONE,null)}catch(t){console.error(`[gjsify-devtools] could not restrict ${e} to the current user: ${t}`)}return e}function removeDevtoolsAddressFile(e){try{b.File.new_for_path(e).delete(null)}catch{}}const ee=e(import.meta.url);let te;function load$2(){return te===void 0&&(te=ee(`@gjsify/node-gi/gi`).requireGi(`Graphene`,`1.0`)),te}__name(load$2,`load`);var ne=new Proxy(Object.create(null),{get(e,t){return load$2()[t]},has(e,t){return t in load$2()}});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=p.WidgetPaintable.new(e),a=p.Snapshot.new();i.snapshot(a,n,r);let o=a.to_node();if(!o)return null;let s=new ne.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=b.SettingsSchemaSource.get_default()?.lookup(e,!0);if(!t)throw Error(formatDbusErrorMessage(`not-found`,`GSettings schema '${e}' is not installed`));let n=new b.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){let t=e;return typeof t.$typeName==`string`&&t.$typeName.length>0?t.$typeName:t.constructor?.$gtype?.name??`GtkWidget`}function activateWidget(e){let t=e;if(typeof t.activate==`function`&&t.activate()===!0)return!0;let n=typeof t.get_parent==`function`?t.get_parent():null;if(n&&widgetType(n)===`GtkListBox`){let t=n,r=!1;return typeof t.select_row==`function`&&(t.select_row(e),r=!0),typeof t.emit==`function`&&(t.emit(`row-activated`,e),r=!0),r}return!1}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=p.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=p.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=p.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=>{s.timeout_add(s.PRIORITY_DEFAULT,e,()=>(t(),s.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=new Map,this._peer=null,this._addressFile=null,this._kinds=new Map,this._extensions=t.extend??[];for(let[e,t]of Object.entries(g))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.has(e))return;let n=buildDevtoolsIfaceXml(this._extensions.flatMap(e=>e.methodsXml??[])),r=b.DBusExportedObject.wrapJSObject(n,this);r.export(e,t),this._exported.set(e,r)}unexport(e){if(e){this._exported.get(e)?.unexport(),this._exported.delete(e);return}for(let e of this._exported.values())e.unexport();this._exported.clear(),this._peer?.stop(),this._peer=null,this._addressFile&&=(removeDevtoolsAddressFile(this._addressFile),null)}attachPeerServer(e,t){this._peer=e,this._addressFile=t??null}get peerAddress(){return this._peer?.address??null}get addressFile(){return this._addressFile}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:p.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 ScreenshotAsync(e,t){try{let e=await this._captureActiveWindowPng();t.return_value(new s.Variant(`(ay)`,[e]))}catch(e){t.return_dbus_error(`org.gjsify.Devtools.Error.Screenshot`,e instanceof Error?e.message:String(e))}}async _captureActiveWindowPng(){let e=this._app.get_active_window();if(!e)return new Uint8Array;let t=captureWidgetPng(e);return t||=(e.present(),await captureWidgetWhenRenderable(e)),t??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)}ActivateWidget(e){this._guard(`ActivateWidget`);let t=this._resolveRootWidget(e);if(!t)throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e}'`));return activateWidget(t.widget)}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 p.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 x=`DBUS_SESSION_BUS_ADDRESS`,re=new Set;function envEnabled(){return isDevtoolsEnabledValue(s.getenv(`GJSIFY_DEVTOOLS`))}function envValue(e){let t=s.getenv(e);return t&&t!==``?t:null}function sessionBusUsable(){if(!envValue(x))return!1;try{return b.bus_get_sync(b.BusType.SESSION,null),!0}catch{return!1}}function chooseDevtoolsTransport(e){return e.requestedAddress?{kind:`peer`,address:e.requestedAddress,reason:`requested`}:e.hasAppConnection?{kind:`session-bus`}:e.sessionBusUsable?{kind:`unregistered`}:{kind:`peer`,address:null,reason:`no-session-bus`}}function describeMissingConnection(e,t){return e?t?`[gjsify-devtools] the session bus answers but this application is not registered on it yet — call installDevtools() from the GtkApplication "startup" handler (the bus connection and object path exist only after registration).`:`[gjsify-devtools] ${x} is set (${e}) but no bus answers there — using the bus-less peer transport instead. On macOS this is the usual state: Homebrew's dbus listens on launchd, so the advertised address only works while that socket is live.`:`[gjsify-devtools] this machine has no session bus (${x} is unset) — using the bus-less peer transport instead. Point the bridge at the address below, or set ${_} on both the app and \`gjsify debug\` to pin it yourself.`}function installDevtools(e,t={}){if(!(t.enabled??envEnabled()))return null;let n=t.instance??envValue(`GJSIFY_DEVTOOLS_INSTANCE`)??void 0,r=new DevtoolsService(e,{...t,instance:n});try{return exportDevtools(e,r,t,n)}catch(e){return r.unexport(),console.error(`[gjsify-devtools] devtools stayed OFF, the app is unaffected — ${describeInstallFailure(e)}`),null}}function describeInstallFailure(e){return e instanceof DevtoolsPeerServerError||e instanceof Error?e.message:String(e)}function exportDevtools(e,t,n,r){let i=e.get_is_registered(),a=i?e.get_dbus_connection():null,o=i?e.get_dbus_object_path():null,c=envValue(x),l=!!(a&&o),u=l||sessionBusUsable(),d=chooseDevtoolsTransport({requestedAddress:n.address??envValue(_),hasAppConnection:l,sessionBusUsable:u}),f=e.get_application_id()??`unknown`,p=`${o??`/${f.replace(/\./g,`/`)}`}/devtools`;if((d.kind===`unregistered`||d.kind===`peer`&&d.reason===`no-session-bus`)&&console.error(describeMissingConnection(c,u)),d.kind===`session-bus`&&a)t.export(a,p),console.log(`[gjsify-devtools] exported ${h} at ${p} (dest ${f})`);else if(d.kind===`peer`){let n=startDevtoolsPeerServer(t,p,d.address??void 0),i=writeDevtoolsAddressFile(devtoolsAddressFilePath(s.get_user_runtime_dir(),f,r),n.address);t.attachPeerServer(n,i),console.log(`[gjsify-devtools] exported ${h} at ${p} (peer address ${n.address}${i?`, published to ${i}`:``})`),i&&e.connect(`shutdown`,()=>removeDevtoolsAddressFile(i))}return re.add(t),t}const ie=[`AdwNavigationSplitView`,`GtkListBox`,`AdwOverlaySplitView`];function probeEnabled(){let e=s.getenv(`GJSIFY_STORYBOOK_PROBE`);if(e==null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}function collectTypes(e,t){t.add(e.type);for(let n of e.children)collectTypes(n,t)}function installStorybookProbe(e,t,n={}){let r=n.requireChrome??ie,i=n.out??s.getenv(`GJSIFY_STORYBOOK_PROBE_OUT`)??void 0,a=n.timeoutMs??8e3,o=n.storyWidget??s.getenv(`GJSIFY_STORYBOOK_PROBE_STORY_WIDGET`)??void 0,c=t.controller.listStories(),l=[...new Set(c.map(e=>e.category))],u=n.story??s.getenv(`GJSIFY_STORYBOOK_PROBE_STORY`)??c[0]?.title,d=u?t.openStoryByTitle(u):!1,f=t.activeStory,p=new Set;collectTypes(dumpTree(t,60,`toplevel:0`),p);let m=r.filter(e=>!p.has(e)),h=new Set;f&&collectTypes(dumpTree(f,60,`story`),h);let g=h.size,_=o?h.has(o):null,finish=t=>{let n=JSON.stringify(t);if(t.ok)console.log(`STORYBOOK PROBE: PASS ${n}`);else{console.error(`STORYBOOK PROBE: FAIL ${n}`);try{typeof process<`u`&&(process.exitCode=1)}catch{}}if(i)try{s.file_set_contents(i,JSON.stringify(t,null,2))}catch{}e.quit()},v=0;s.timeout_add(s.PRIORITY_DEFAULT,100,()=>{v+=100;let e=captureWidgetPng(t),n=t.get_width()>0&&t.get_height()>0;if(!e&&!(v>=a))return s.SOURCE_CONTINUE;let i=f?captureWidgetPng(f):null,p=c.length>=1&&l.length>=1&&m.length===0&&d&&f!=null&&g>1,y;return c.length<1?y=`no stories registered`:l.length<1?y=`no categories`:m.length>0?y=`chrome missing: ${m.join(`, `)}`:!d||f==null?y=`could not open story: ${u??`(none)`}`:g<=1&&(y=`opened story rendered an empty subtree`),p&&o&&!h.has(o)&&(p=!1,y=`story widget ${o} not found in the opened story subtree`),p&&n&&(!e||e.length===0)&&(p=!1,y=`window realized (${t.get_width()}x${t.get_height()}) but the GSK capture was empty`),finish({ok:p,reason:y,stories:c.length,categories:l,opened:d,activeStory:f?f.meta.title:null,requiredChrome:r,missingChrome:m,storySubtreeWidgets:g,storyWidgetPresent:_,windowRealized:n,windowPngBytes:e?e.length:0,storyPngBytes:i?i.length:0}),s.SOURCE_REMOVE})}const ae=e(import.meta.url);let S;function load$1(){return S===void 0&&(S=ae(`@gjsify/node-gi/gi`).requireGi(`Adw`,`1`)),S}__name(load$1,`load`);var C=new Proxy(Object.create(null),{get(e,t){return load$1()[t]},has(e,t){return t in load$1()}});const oe=e(import.meta.url);let se;function load(){return se===void 0&&(se=oe("@gjsify/node-gi/gi").requireGi(`GObject`,`2.0`)),se}var w=new Proxy(Object.create(null),{get(e,t){return load()[t]},has(e,t){return t in load()}});function adwControlWidgetFactory(){return{text(e,t){let n=new C.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 C.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=C.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 p.Adjustment({lower:t,upper:n,step_increment:r,value:i});o.step_increment=r;let s=new p.ListBoxRow({selectable:!1,activatable:!1});s.add_css_class(`story-range-row`);let c=new p.Box({orientation:p.Orientation.VERTICAL,spacing:6,margin_top:12,margin_bottom:12,margin_start:12,margin_end:12}),l=new p.Box({orientation:p.Orientation.HORIZONTAL,spacing:12}),u=new p.Label({label:e.label||e.name,halign:p.Align.START,hexpand:!0,ellipsize:3});u.add_css_class(`heading`);let formatValue=e=>a?String(Math.round(e)):e.toFixed(2),d=new p.Label({label:formatValue(i),halign:p.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 p.Label({label:e.description,halign:p.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 f=new p.Scale({orientation:p.Orientation.HORIZONTAL,adjustment:o,draw_value:!1,hexpand:!0}),m=null,h=!1;return f.connect(`value-changed`,()=>{if(h)return;let e=f.get_value();if(a){let t=Math.round(e);if(t!==e){f.set_value(t);return}e=t}d.set_label(formatValue(e)),m?.(e)}),c.append(f),s.set_child(c),{node:s,get:()=>f.get_value(),set:e=>{h=!0,f.set_value(e),h=!1,d.set_label(formatValue(e))},onChange:e=>{m=e}}}function buildSelectWidget(e){let t=e.options??[],n=p.StringList.new(t.map(e=>e.label)),r=new C.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 C.ActionRow({title:e,subtitle:t??``}),r=new p.ColorDialogButton({dialog:new p.ColorDialog({title:e}),valign:p.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 u.RGBA;t.parse(e)&&(a=!0,r.set_rgba(t),a=!1)},onChange:e=>{i=e}}}var ce=class StorybookWindow extends C.ApplicationWindow{static{w.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 p.ListBox({selection_mode:p.SelectionMode.SINGLE}),this._sidebar_list.add_css_class(`navigation-sidebar`);let e=new p.ScrolledWindow({hexpand:!0,vexpand:!0,child:this._sidebar_list}),t=new C.HeaderBar({title_widget:new C.WindowTitle({title:`Stories`}),show_end_title_buttons:!1}),n=new C.ToolbarView({content:e,top_bar_style:C.ToolbarStyle.FLAT});n.add_top_bar(t);let r=new C.NavigationPage({title:`Stories`,tag:`stories`,child:n});this._content_area=new C.Bin({hexpand:!0,vexpand:!0});let i=new p.ScrolledWindow({hexpand:!0,vexpand:!0,child:this._content_area});this._control_panel=new C.PreferencesGroup({title:`Controls`});let a=new C.PreferencesPage;a.add(this._control_panel);let o=new p.ScrolledWindow({vexpand:!0,child:a});this._controls_split_view=new C.OverlaySplitView({show_sidebar:!0,sidebar_position:p.PackType.END,min_sidebar_width:280,max_sidebar_width:360,content:i,sidebar:o,css_classes:[`storybook-controls`]}),this._preview_title=new C.WindowTitle({title:`Preview`}),this._show_controls_button=new p.ToggleButton({icon_name:`sidebar-show-right-symbolic`,tooltip_text:`Toggle Controls`,active:!0});let s=new C.HeaderBar({title_widget:this._preview_title});s.pack_end(this._show_controls_button);let c=new C.ToolbarView({content:this._controls_split_view,top_bar_style:C.ToolbarStyle.FLAT});c.add_top_bar(s);let l=new C.NavigationPage({title:`Preview`,tag:`preview`,child:c});this._main_split_view=new C.NavigationSplitView({min_sidebar_width:220,max_sidebar_width:320,sidebar:r,content:l}),this.set_content(this._main_split_view);let u=C.BreakpointCondition.parse(`max-width: 720sp`);if(u){let e=new C.Breakpoint({condition:u});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 p.ListBoxRow({selectable:!1}),n=new p.Label({label:e,halign:p.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 p.ListBoxRow,r=new p.Label({label:t||`Unnamed Story`,halign:p.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)}};w.type_ensure(ce.$gtype);var le=class StorybookApplication extends C.Application{static{w.registerClass({GTypeName:`StorybookApplication`},StorybookApplication)}constructor(e){super({application_id:e.applicationId,flags:b.ApplicationFlags.DEFAULT_FLAGS}),this._window=null,this._options=e,this.connect(`startup`,()=>this._initStyles()),this.connect(`activate`,()=>this._onActivate())}_initStyles(){let e=new p.CssProvider;e.load_from_string(`
64
+ </node>`}const v=e(import.meta.url);let y;function load$3(){return y===void 0&&(y=v(`@gjsify/node-gi/gi`).requireGi(`Gio`,`2.0`)),y}__name(load$3,`load`);var b=new Proxy(Object.create(null),{get(e,t){return load$3()[t]},has(e,t){return t in load$3()}});function isWin32(){return c.DIR_SEPARATOR===92}function defaultListenAddress(){return isWin32()?`nonce-tcp:host=127.0.0.1`:`unix:tmpdir=${c.get_tmp_dir()}`}var DevtoolsPeerServerError=class extends Error{constructor(e,t,n,r){super(e),this.address=t,this.reason=n,this.name=`DevtoolsPeerServerError`,this.cause=r}};function isAddressInUse(e){return e instanceof c.Error&&e.matches(b.io_error_quark(),b.IOErrorEnum.ADDRESS_IN_USE)}function unixSocketPath(e){if(!e.startsWith(`unix:`))return null;for(let t of e.slice(5).split(`,`)){let e=t.indexOf(`=`);if(!(e<0||t.slice(0,e)!==`path`))try{return decodeURIComponent(t.slice(e+1))}catch{return null}}return null}function inspectExistingSocket(e){try{if((b.File.new_for_path(e).query_info(`unix::mode`,b.FileQueryInfoFlags.NONE,null).get_attribute_uint32(`unix::mode`)&61440)!=49152)return`not-a-socket`}catch{return`not-a-socket`}let t=new b.SocketClient;t.set_timeout(2);let n;try{n=t.connect(b.UnixSocketAddress.new(e),null)}catch{return`dead`}return n.close(null),`live`}function clearReclaimableSocket(e){let t=unixSocketPath(e);if(!t||!c.file_test(t,c.FileTest.EXISTS))return;let n=inspectExistingSocket(t);if(n===`live`)throw new DevtoolsPeerServerError(`cannot listen on ${e}: another process is already listening there. Stop it, or point ${_} (or options.address) at a different socket — GJSIFY_DEVTOOLS_INSTANCE=<label> lets two devtools-enabled apps run side by side.`,e,`address-in-use`);if(n===`not-a-socket`)throw new DevtoolsPeerServerError(`cannot listen on ${e}: ${t} already exists and is not a socket, so it will NOT be removed. Point ${_} (or options.address) at a free path.`,e,`occupied-by-other-file`);try{b.File.new_for_path(t).delete(null)}catch(n){throw new DevtoolsPeerServerError(`cannot listen on ${e}: ${t} is a socket nothing listens on, but removing it failed (${n}). Delete it by hand, or point ${_} at a free path.`,e,`address-in-use`,n)}console.log(`[gjsify-devtools] reclaimed the stale socket ${t}: nothing was listening on it (an abnormal exit — Ctrl-C, SIGKILL, a crash — leaves the inode behind).`)}function flagsForAddress(e){return e.startsWith(`tcp:`)||e.startsWith(`nonce-tcp:`)?b.DBusServerFlags.NONE:b.DBusServerFlags.AUTHENTICATION_REQUIRE_SAME_USER}function startDevtoolsPeerServer(e,t,n){let r=n&&n!==``?n:defaultListenAddress();clearReclaimableSocket(r);let i;try{i=b.DBusServer.new_sync(r,flagsForAddress(r),b.dbus_generate_guid(),null,null)}catch(e){let t=isAddressInUse(e);throw new DevtoolsPeerServerError(t?`cannot listen on ${r}: the address is already in use (${e}). Stop whatever holds it, or point ${_} (or options.address) at a different address.`:`cannot listen on ${r}: ${e}. Check the address form — \`unix:path=/tmp/app.sock\`, \`unix:tmpdir=/tmp\` or \`nonce-tcp:host=127.0.0.1\`.`,r,t?`address-in-use`:`listen-failed`,e)}let a=new Set;i.connect(`new-connection`,(n,r)=>(a.add(r),r.connect(`closed`,()=>{e.unexport(r),a.delete(r)}),e.export(r,t),!0)),i.start();let o=!1;return{address:i.get_client_address(),objectPath:t,get connectionCount(){return a.size},stop(){if(!o){o=!0,i.stop();for(let t of a)e.unexport(t),!t.is_closed()&&t.close(null,(e,t)=>{try{e.close_finish(t)}catch{}});a.clear()}}}}function writeDevtoolsAddressFile(e,t){try{if(c.mkdir_with_parents(c.path_get_dirname(e),448),!c.file_set_contents(e,`${t}\n`))return null}catch(t){return console.error(`[gjsify-devtools] could not publish the peer address to ${e}: ${t}`),null}try{b.File.new_for_path(e).set_attribute_uint32(`unix::mode`,384,b.FileQueryInfoFlags.NONE,null)}catch(t){console.error(`[gjsify-devtools] could not restrict ${e} to the current user: ${t}`)}return e}function removeDevtoolsAddressFile(e){try{b.File.new_for_path(e).delete(null)}catch{}}const te=e(import.meta.url);let x;function load$2(){return x===void 0&&(x=te(`@gjsify/node-gi/gi`).requireGi(`Graphene`,`1.0`)),x}__name(load$2,`load`);var ne=new Proxy(Object.create(null),{get(e,t){return load$2()[t]},has(e,t){return t in load$2()}});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=m.WidgetPaintable.new(e),a=m.Snapshot.new();i.snapshot(a,n,r);let o=a.to_node();if(!o)return null;let s=new ne.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=b.SettingsSchemaSource.get_default()?.lookup(e,!0);if(!t)throw Error(formatDbusErrorMessage(`not-found`,`GSettings schema '${e}' is not installed`));let n=new b.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){let t=e;return typeof t.$typeName==`string`&&t.$typeName.length>0?t.$typeName:t.constructor?.$gtype?.name??`GtkWidget`}function activateWidget(e){let t=e;if(typeof t.activate==`function`&&t.activate()===!0)return!0;let n=typeof t.get_parent==`function`?t.get_parent():null;if(n&&widgetType(n)===`GtkListBox`){let t=n,r=!1;return typeof t.select_row==`function`&&(t.select_row(e),r=!0),typeof t.emit==`function`&&(t.emit(`row-activated`,e),r=!0),r}return!1}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=m.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=m.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=m.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=>{c.timeout_add(c.PRIORITY_DEFAULT,e,()=>(t(),c.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=new Map,this._peer=null,this._addressFile=null,this._kinds=new Map,this._extensions=t.extend??[];for(let[e,t]of Object.entries(ee))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.has(e))return;let n=buildDevtoolsIfaceXml(this._extensions.flatMap(e=>e.methodsXml??[])),r=b.DBusExportedObject.wrapJSObject(n,this);r.export(e,t),this._exported.set(e,r)}unexport(e){if(e){this._exported.get(e)?.unexport(),this._exported.delete(e);return}for(let e of this._exported.values())e.unexport();this._exported.clear(),this._peer?.stop(),this._peer=null,this._addressFile&&=(removeDevtoolsAddressFile(this._addressFile),null)}attachPeerServer(e,t){this._peer=e,this._addressFile=t??null}get peerAddress(){return this._peer?.address??null}get addressFile(){return this._addressFile}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:m.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 ScreenshotAsync(e,t){try{let e=await this._captureActiveWindowPng();t.return_value(new c.Variant(`(ay)`,[e]))}catch(e){t.return_dbus_error(`org.gjsify.Devtools.Error.Screenshot`,e instanceof Error?e.message:String(e))}}async _captureActiveWindowPng(){let e=this._app.get_active_window();if(!e)return new Uint8Array;let t=captureWidgetPng(e);return t||=(e.present(),await captureWidgetWhenRenderable(e)),t??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)}ActivateWidget(e){this._guard(`ActivateWidget`);let t=this._resolveRootWidget(e);if(!t)throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e}'`));return activateWidget(t.widget)}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 m.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 S=`DBUS_SESSION_BUS_ADDRESS`,re=new Set;function envEnabled(){return isDevtoolsEnabledValue(c.getenv(`GJSIFY_DEVTOOLS`))}function envValue(e){let t=c.getenv(e);return t&&t!==``?t:null}function sessionBusUsable(){if(!envValue(S))return!1;try{return b.bus_get_sync(b.BusType.SESSION,null),!0}catch{return!1}}function chooseDevtoolsTransport(e){return e.requestedAddress?{kind:`peer`,address:e.requestedAddress,reason:`requested`}:e.hasAppConnection?{kind:`session-bus`}:e.sessionBusUsable?{kind:`unregistered`}:{kind:`peer`,address:null,reason:`no-session-bus`}}function describeMissingConnection(e,t){return e?t?`[gjsify-devtools] the session bus answers but this application is not registered on it yet — call installDevtools() from the GtkApplication "startup" handler (the bus connection and object path exist only after registration).`:`[gjsify-devtools] ${S} is set (${e}) but no bus answers there — using the bus-less peer transport instead. On macOS this is the usual state: Homebrew's dbus listens on launchd, so the advertised address only works while that socket is live.`:`[gjsify-devtools] this machine has no session bus (${S} is unset) — using the bus-less peer transport instead. Point the bridge at the address below, or set ${_} on both the app and \`gjsify debug\` to pin it yourself.`}function installDevtools(e,t={}){if(!(t.enabled??envEnabled()))return null;let n=t.instance??envValue(`GJSIFY_DEVTOOLS_INSTANCE`)??void 0,r=new DevtoolsService(e,{...t,instance:n});try{return exportDevtools(e,r,t,n)}catch(e){return r.unexport(),console.error(`[gjsify-devtools] devtools stayed OFF, the app is unaffected — ${describeInstallFailure(e)}`),null}}function describeInstallFailure(e){return e instanceof DevtoolsPeerServerError||e instanceof Error?e.message:String(e)}function exportDevtools(e,t,n,r){let i=e.get_is_registered(),a=i?e.get_dbus_connection():null,o=i?e.get_dbus_object_path():null,s=envValue(S),l=!!(a&&o),u=l||sessionBusUsable(),d=chooseDevtoolsTransport({requestedAddress:n.address??envValue(_),hasAppConnection:l,sessionBusUsable:u}),f=e.get_application_id()??`unknown`,p=`${o??`/${f.replace(/\./g,`/`)}`}/devtools`;if((d.kind===`unregistered`||d.kind===`peer`&&d.reason===`no-session-bus`)&&console.error(describeMissingConnection(s,u)),d.kind===`session-bus`&&a)t.export(a,p),console.log(`[gjsify-devtools] exported ${g} at ${p} (dest ${f})`);else if(d.kind===`peer`){let n=startDevtoolsPeerServer(t,p,d.address??void 0),i=writeDevtoolsAddressFile(devtoolsAddressFilePath(c.get_user_runtime_dir(),f,r),n.address);t.attachPeerServer(n,i),console.log(`[gjsify-devtools] exported ${g} at ${p} (peer address ${n.address}${i?`, published to ${i}`:``})`),i&&e.connect(`shutdown`,()=>removeDevtoolsAddressFile(i))}return re.add(t),t}const ie=[`AdwNavigationSplitView`,`GtkListBox`,`AdwOverlaySplitView`];function probeEnabled(){let e=c.getenv(`GJSIFY_STORYBOOK_PROBE`);if(e==null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}function collectTypes(e,t){t.add(e.type);for(let n of e.children)collectTypes(n,t)}function installStorybookProbe(e,t,n={}){let r=n.requireChrome??ie,i=n.out??c.getenv(`GJSIFY_STORYBOOK_PROBE_OUT`)??void 0,a=n.timeoutMs??8e3,o=n.storyWidget??c.getenv(`GJSIFY_STORYBOOK_PROBE_STORY_WIDGET`)??void 0,s=t.controller.listStories(),l=[...new Set(s.map(e=>e.category))],u=n.story??c.getenv(`GJSIFY_STORYBOOK_PROBE_STORY`)??s[0]?.title,d=u?t.openStoryByTitle(u):!1,f=t.activeStory,p=new Set;collectTypes(dumpTree(t,60,`toplevel:0`),p);let m=r.filter(e=>!p.has(e)),h=new Set;f&&collectTypes(dumpTree(f,60,`story`),h);let g=h.size,ee=o?h.has(o):null,finish=t=>{let n=JSON.stringify(t);if(t.ok)console.log(`STORYBOOK PROBE: PASS ${n}`);else{console.error(`STORYBOOK PROBE: FAIL ${n}`);try{typeof process<`u`&&(process.exitCode=1)}catch{}}if(i)try{c.file_set_contents(i,JSON.stringify(t,null,2))}catch{}e.quit()},_=0;c.timeout_add(c.PRIORITY_DEFAULT,100,()=>{_+=100;let e=captureWidgetPng(t),n=t.get_width()>0&&t.get_height()>0;if(!e&&!(_>=a))return c.SOURCE_CONTINUE;let i=f?captureWidgetPng(f):null,p=s.length>=1&&l.length>=1&&m.length===0&&d&&f!=null&&g>1,v;return s.length<1?v=`no stories registered`:l.length<1?v=`no categories`:m.length>0?v=`chrome missing: ${m.join(`, `)}`:!d||f==null?v=`could not open story: ${u??`(none)`}`:g<=1&&(v=`opened story rendered an empty subtree`),p&&o&&!h.has(o)&&(p=!1,v=`story widget ${o} not found in the opened story subtree`),p&&n&&(!e||e.length===0)&&(p=!1,v=`window realized (${t.get_width()}x${t.get_height()}) but the GSK capture was empty`),finish({ok:p,reason:v,stories:s.length,categories:l,opened:d,activeStory:f?f.meta.title:null,requiredChrome:r,missingChrome:m,storySubtreeWidgets:g,storyWidgetPresent:ee,windowRealized:n,windowPngBytes:e?e.length:0,storyPngBytes:i?i.length:0}),c.SOURCE_REMOVE})}const ae=e(import.meta.url);let oe;function load$1(){return oe===void 0&&(oe=ae(`@gjsify/node-gi/gi`).requireGi(`Adw`,`1`)),oe}__name(load$1,`load`);var C=new Proxy(Object.create(null),{get(e,t){return load$1()[t]},has(e,t){return t in load$1()}});const w={UNKNOWN:0,CUSTOM:1,GPL_2_0:2,GPL_3_0:3,LGPL_2_1:4,LGPL_3_0:5,BSD:6,MIT_X11:7,ARTISTIC:8,GPL_2_0_ONLY:9,GPL_3_0_ONLY:10,LGPL_2_1_ONLY:11,LGPL_3_0_ONLY:12,AGPL_3_0:13,AGPL_3_0_ONLY:14,BSD_3:15,APACHE_2_0:16,MPL_2_0:17,"0BSD":18};w.GPL_2_0_ONLY,w.GPL_3_0_ONLY,w.UNKNOWN;const se=[`blue`,`teal`,`green`,`yellow`,`orange`,`red`,`pink`,`purple`,`slate`],ce={blue:`#3584e4`,teal:`#2190a4`,green:`#3a944a`,yellow:`#c88800`,orange:`#ed5b00`,red:`#e62d42`,pink:`#d56199`,purple:`#9141ac`,slate:`#6f8396`};function parseHex(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=Number.parseInt(t[1],16);return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255]}function toHex(e,t,n){let channel=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,`0`);return`#${channel(e)}${channel(t)}${channel(n)}`}const toLinear=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,fromLinear=e=>e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;function linearToOklab(e,t,n){let r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),i=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),a=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return[.2104542553*r+.793617785*i-.0040720468*a,1.9779984951*r-2.428592205*i+.4505937099*a,.0259040371*r+.7827717662*i-.808675766*a]}function oklabToLinear(e,t,n){let r=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*i+.2309699292*a,-1.2684380046*r+2.6097574011*i-.3413193965*a,-.0041960863*r-.7034186147*i+1.707614701*a]}function adwaitaStandaloneColor(e,t){let n=parseHex(e);if(!n)return e;let[r,i,a]=linearToOklab(toLinear(n[0]),toLinear(n[1]),toLinear(n[2])),[o,s,c]=oklabToLinear(t?Math.max(r,.85):Math.min(r,.5),i,a);return toHex(fromLinear(o),fromLinear(s),fromLinear(c))}function adwaitaAccentBgColor(e){return ce[e]}function adwaitaAccentColor(e,t){return adwaitaStandaloneColor(ce[e],t)}Math.PI*.35,Math.PI*.015,Math.PI*.9;const le=Math.PI*.9,ue=Math.PI*.7,de=Math.PI*1.1,fe=Math.PI*1.35,pe=le+de+fe-ue;53*Math.PI*2/pe,de-ue/2;const me={system:`Follow system`,light:`Light`,dark:`Dark`},he={blue:`Blue`,teal:`Teal`,green:`Green`,yellow:`Yellow`,orange:`Orange`,red:`Red`,pink:`Pink`,purple:`Purple`,slate:`Slate`};var StorybookAppearance=class{constructor(){this._provider=null,this._applying=!1,this._styleManager=C.StyleManager.get_default(),this.settings=new StorybookSettings(()=>this._styleManager.get_dark()),this.settings.subscribe(e=>this._apply(e)),this._styleManager.connect(`notify::dark`,()=>this.settings.systemChanged()),this._apply(this.settings.state)}_apply(e){if(!this._applying){this._applying=!0;try{this._styleManager.set_color_scheme(e.colorScheme===`light`?C.ColorScheme.FORCE_LIGHT:e.colorScheme===`dark`?C.ColorScheme.FORCE_DARK:C.ColorScheme.DEFAULT),this._applyAccent(this.settings.resolvedAccent)}finally{this._applying=!1}}}_applyAccent(e){let t=d.Display.get_default();if(!t)return;if(!this._provider){if(!e)return;this._provider=new m.CssProvider,m.StyleContext.add_provider_for_display(t,this._provider,m.STYLE_PROVIDER_PRIORITY_APPLICATION)}if(!e){this._provider.load_from_string(``);return}let n=adwaitaAccentBgColor(e),r=adwaitaAccentColor(e,this.settings.resolvedDark);this._provider.load_from_string(`:root { --accent-bg-color: ${n}; --accent-color: ${r}; }`)}};function buildSwatch(e,t,n){let r=new m.CheckButton({tooltip_text:t,halign:m.Align.CENTER,valign:m.Align.CENTER,focus_on_click:!1});for(let t of e)r.add_css_class(t);return r.update_property([m.AccessibleProperty.LABEL],[t]),n&&r.set_group(n),r}function buildSwatchCard(e=!1){let t=new C.WrapBox({align:.5,child_spacing:8,line_spacing:8,margin_top:12,margin_bottom:12,margin_start:12,margin_end:12}),n=new C.Bin({child:t,hexpand:!0});return n.add_css_class(`card`),e&&n.add_css_class(`storybook-card-attached`),{card:n,row:t}}function buildAppearanceDialog(e){let t=e.settings,n=new C.PreferencesPage,r=new C.PreferencesGroup({title:`Style`}),{card:a,row:o}=buildSwatchCard(),s=null,c=new Map;for(let e of i){let n=buildSwatch([`storybook-swatch`,`storybook-scheme-swatch`,`storybook-scheme-${e}`],me[e],s);s??=n,n.set_active(t.colorScheme===e),n.connect(`toggled`,()=>{n.get_active()&&(t.colorScheme=e)}),c.set(e,n),o.append(n)}r.add(a),n.add(r);let l=new C.PreferencesGroup({title:`Accent colour`});l.add_css_class(`storybook-attached-group`);let u=new C.SwitchRow({title:`Use a custom accent colour`,subtitle:`Off follows the desktop, which owns the accent`,active:t.accentMode===`custom`});l.add(u);let{card:d,row:f}=buildSwatchCard(!0),p=null,h=new Map;for(let e of se){let n=buildSwatch([`storybook-swatch`],he[e],p);p??=n,n.set_active(t.accent===e);let r=new m.CssProvider;r.load_from_string(`checkbutton { background-color: ${adwaitaAccentBgColor(e)}; }`),n.get_style_context().add_provider(r,m.STYLE_PROVIDER_PRIORITY_APPLICATION),n.connect(`toggled`,()=>{n.get_active()&&(t.accent=e)}),h.set(e,n),f.append(n)}f.set_sensitive(t.accentMode===`custom`),u.connect(`notify::active`,()=>{t.accentMode=u.get_active()?`custom`:`system`}),l.add(d),n.add(l),t.subscribe(e=>{let t=c.get(e.colorScheme);t&&!t.get_active()&&t.set_active(!0);let n=h.get(e.accent);n&&!n.get_active()&&n.set_active(!0);let r=e.accentMode===`custom`;u.get_active()!==r&&u.set_active(r),f.set_sensitive(r)});let g=new C.PreferencesDialog({title:`Appearance`});return g.add(n),g}const ge=e(import.meta.url);let T;function load(){return T===void 0&&(T=ge("@gjsify/node-gi/gi").requireGi(`GObject`,`2.0`)),T}var E=new Proxy(Object.create(null),{get(e,t){return load()[t]},has(e,t){return t in load()}});function adwControlWidgetFactory(){return{text(e,t){let n=new C.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 C.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=C.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 m.Adjustment({lower:t,upper:n,step_increment:r,value:i});o.step_increment=r;let s=new m.ListBoxRow({selectable:!1,activatable:!1});s.add_css_class(`story-range-row`);let c=new m.Box({orientation:m.Orientation.VERTICAL,spacing:6,margin_top:12,margin_bottom:12,margin_start:12,margin_end:12}),l=new m.Box({orientation:m.Orientation.HORIZONTAL,spacing:12}),u=new m.Label({label:e.label||e.name,halign:m.Align.START,hexpand:!0,ellipsize:3});u.add_css_class(`heading`);let formatValue=e=>a?String(Math.round(e)):e.toFixed(2),d=new m.Label({label:formatValue(i),halign:m.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 m.Label({label:e.description,halign:m.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 f=new m.Scale({orientation:m.Orientation.HORIZONTAL,adjustment:o,draw_value:!1,hexpand:!0}),p=null,h=!1;return f.connect(`value-changed`,()=>{if(h)return;let e=f.get_value();if(a){let t=Math.round(e);if(t!==e){f.set_value(t);return}e=t}d.set_label(formatValue(e)),p?.(e)}),c.append(f),s.set_child(c),{node:s,get:()=>f.get_value(),set:e=>{h=!0,f.set_value(e),h=!1,d.set_label(formatValue(e))},onChange:e=>{p=e}}}function buildSelectWidget(e){let t=e.options??[],n=m.StringList.new(t.map(e=>e.label)),r=new C.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 C.ActionRow({title:e,subtitle:t??``}),r=new m.ColorDialogButton({dialog:new m.ColorDialog({title:e}),valign:m.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 d.RGBA;t.parse(e)&&(a=!0,r.set_rgba(t),a=!1)},onChange:e=>{i=e}}}var _e=class StorybookWindow extends C.ApplicationWindow{static{E.registerClass({GTypeName:`StorybookWindow`},StorybookWindow)}constructor(e){super(e),this._appearance=new StorybookAppearance,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 m.ListBox({selection_mode:m.SelectionMode.SINGLE}),this._sidebar_list.add_css_class(`navigation-sidebar`);let e=new m.ScrolledWindow({hexpand:!0,vexpand:!0,child:this._sidebar_list}),t=new C.HeaderBar({title_widget:new C.WindowTitle({title:`Stories`}),show_end_title_buttons:!1}),n=new C.ToolbarView({content:e,top_bar_style:C.ToolbarStyle.FLAT});n.add_top_bar(t);let r=new C.NavigationPage({title:`Stories`,tag:`stories`,child:n});this._content_area=new C.Bin({hexpand:!0,vexpand:!0});let i=new m.ScrolledWindow({hexpand:!0,vexpand:!0,child:this._content_area});this._control_panel=new C.PreferencesGroup({title:`Controls`});let a=new C.PreferencesPage;a.add(this._control_panel);let o=new m.ScrolledWindow({vexpand:!0,child:a});this._controls_split_view=new C.OverlaySplitView({show_sidebar:!0,sidebar_position:m.PackType.END,min_sidebar_width:280,max_sidebar_width:360,content:i,sidebar:o,css_classes:[`storybook-controls`]}),this._preview_title=new C.WindowTitle({title:`Preview`}),this._show_controls_button=new m.ToggleButton({icon_name:`sidebar-show-right-symbolic`,tooltip_text:`Toggle Controls`,active:!0});let s=new C.HeaderBar({title_widget:this._preview_title});s.pack_end(this._show_controls_button);let c=new m.Button({icon_name:`applications-graphics-symbolic`,tooltip_text:`Appearance`});c.connect(`clicked`,()=>buildAppearanceDialog(this._appearance).present(this)),s.pack_end(c);let l=new C.ToolbarView({content:this._controls_split_view,top_bar_style:C.ToolbarStyle.FLAT});l.add_top_bar(s);let u=new C.NavigationPage({title:`Preview`,tag:`preview`,child:l});this._main_split_view=new C.NavigationSplitView({min_sidebar_width:220,max_sidebar_width:320,sidebar:r,content:u}),this.set_content(this._main_split_view);let d=C.BreakpointCondition.parse(`max-width: 720sp`);if(d){let e=new C.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;e instanceof C.PreferencesRow&&e.set_use_markup(!1),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 m.ListBoxRow({selectable:!1}),n=new m.Label({label:e,halign:m.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 m.ListBoxRow,r=new m.Label({label:t||`Unnamed Story`,halign:m.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)}};E.type_ensure(_e.$gtype);var ve=class StorybookApplication extends C.Application{static{E.registerClass({GTypeName:`StorybookApplication`},StorybookApplication)}constructor(e){super({application_id:e.applicationId,flags:b.ApplicationFlags.DEFAULT_FLAGS}),this._window=null,this._options=e,this.connect(`startup`,()=>this._initStyles()),this.connect(`activate`,()=>this._onActivate())}_initStyles(){let e=new m.CssProvider;e.load_from_string(`
65
+ /* Appearance dialog — round swatches with a selection ring, the shape GNOME's own
66
+ appearance switcher uses. Adapted from Learn6502's theme-mode-selector.css and
67
+ accent-color-selector.css (JumpLink/easy6502, MIT).
68
+
69
+ The inner \`radio\` indicator is switched off because the swatch IS the
70
+ indicator: a check mark drawn on top of a colour reads as two competing
71
+ signals, and the ring already says which one is selected.
72
+ \`background-clip: content-box\` is what keeps the ring outside the fill rather
73
+ than tinting it. */
74
+ .storybook-swatch {
75
+ min-width: 24px;
76
+ min-height: 24px;
77
+ padding: 6px;
78
+ border-radius: 9999px;
79
+ background-clip: content-box;
80
+ background-image: none;
81
+ box-shadow: inset 0 0 0 3px transparent;
82
+ }
83
+ .storybook-swatch:checked {
84
+ box-shadow: inset 0 0 0 3px var(--accent-bg-color);
85
+ }
86
+ .storybook-swatch radio {
87
+ -gtk-icon-source: none;
88
+ border: none;
89
+ background: none;
90
+ box-shadow: none;
91
+ min-width: 12px;
92
+ min-height: 12px;
93
+ padding: 0;
94
+ transform: none;
95
+ }
96
+ /* Desaturated rather than merely dimmed: while the accent follows the desktop the
97
+ palette has to read as unavailable, not as nine slightly faded choices. */
98
+ .storybook-swatch:disabled {
99
+ filter: saturate(0.4) brightness(1.05);
100
+ opacity: 0.7;
101
+ }
102
+ /* The scheme swatches are larger — they are the dialog's primary choice. */
103
+ .storybook-swatch.storybook-scheme-swatch {
104
+ min-width: 44px;
105
+ min-height: 44px;
106
+ }
107
+ /* "Follow system" is drawn as the two schemes meeting on a diagonal, so the option
108
+ looks like what it does instead of needing a word for it. */
109
+ .storybook-swatch.storybook-scheme-system {
110
+ background-image: linear-gradient(to bottom right, #f6f5f4 49.99%, #241f31 50.01%);
111
+ }
112
+ .storybook-swatch.storybook-scheme-light {
113
+ background-color: #f6f5f4;
114
+ }
115
+ .storybook-swatch.storybook-scheme-dark {
116
+ background-color: #241f31;
117
+ }
118
+ /* Squares the top corners so a swatch card sits flush under the row it belongs to,
119
+ instead of the two reading as separate cards with a seam between them. */
120
+ .storybook-card-attached {
121
+ border-top-left-radius: 0;
122
+ border-top-right-radius: 0;
123
+ }
124
+ /* …and the OTHER half, which squaring only the card cannot do: the row above lives
125
+ in the group's .boxed-list, whose own bottom corners are still round, so the two
126
+ met with a notch at each end. Both sides have to be squared for the join to read
127
+ as one list. The transparent bottom border keeps the boxed-list's height where it
128
+ was, so squaring it does not shift the card up by a pixel.
129
+ Adapted from Learn6502's views/preferences.dialog.css (JumpLink/easy6502, MIT). */
130
+ .storybook-attached-group .boxed-list {
131
+ border-bottom-left-radius: 0;
132
+ border-bottom-right-radius: 0;
133
+ border-bottom: 1px solid transparent;
134
+ }
135
+
65
136
  /* Range-control card in the controls sidebar — keeps the label + description
66
137
  from being squashed into a single column when the sidebar is narrow. */
67
138
  .story-range-row {
@@ -88,4 +159,4 @@ import{createRequire as e}from"node:module";import"@gjsify/node-gi/globals";impo
88
159
  border-radius: 12px;
89
160
  padding: 18px;
90
161
  }
91
- \n${this._options.css??``}`);let t=u.Display.get_default();if(!t){console.error(`No display found`);return}p.StyleContext.add_provider_for_display(t,e,p.STYLE_PROVIDER_PRIORITY_APPLICATION)}_onActivate(){if(!this._window){this._window=new ce({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)]}),probeEnabled()&&installStorybookProbe(this,this._window,this._options.probe)}this._window.present()}};w.type_ensure(le.$gtype);function collectStoryModules(e){return collectStoryModules$1(e)}function buildGtkChrome(e){let t=new C.PreferencesPage,n=new C.PreferencesGroup,r=new p.Box({orientation:p.Orientation.VERTICAL,halign:p.Align.CENTER,valign:p.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`)}},T=class StoryWidget extends C.Bin{static{w.registerClass({GTypeName:`StoryWidget`,Properties:{meta:w.ParamSpec.object(`meta`,`Meta`,`Story metadata`,w.ParamFlags.READWRITE,w.Object),story:w.ParamSpec.string(`story`,`Story Name`,`Story name`,w.ParamFlags.READWRITE,``),args:w.ParamSpec.object(`args`,`Args`,`Story arguments`,w.ParamFlags.READWRITE,w.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)}};w.type_ensure(T.$gtype);async function runStorybook(e){return new le(e).runAsync([t.programInvocationName,...t.programArgs])}const ue={title:`Buttons/Button Content`,description:`Adw.ButtonContent — pairs a symbolic icon with a label inside a Gtk.Button.`,controls:[{name:`label`,label:`Label`,type:r.TEXT,defaultValue:`Download`},{name:`iconName`,label:`Icon`,type:r.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:r.BOOLEAN,defaultValue:!1}]};var de=__exportAll({ButtonContentStories:()=>fe,ButtonContentStory:()=>E}),E=class ButtonContentStory extends T{_content=null;_button=null;static{w.registerClass({GTypeName:`AdwStorybookButtonContent`},ButtonContentStory)}constructor(){super(T.fromMeta(ButtonContentStory.getMetadata(),`Default`))}static getMetadata(){return{...ue,component:C.ButtonContent.$gtype}}initialize(){this._content=new C.ButtonContent({label:this.args.label,iconName:this.args.iconName,canShrink:this.args.canShrink}),this._button=new p.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)}};w.type_ensure(E.$gtype);const fe={stories:[E]},pe={title:`Buttons/Button Styles`,description:`Buttons with Adwaita style classes: .pill, .circular, .suggested-action, .destructive-action, .flat.`,controls:[{name:`label`,label:`Demo label`,type:r.TEXT,defaultValue:`Click me`},{name:`style`,label:`Demo style`,type:r.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 me=__exportAll({ButtonStylesStories:()=>ge,ButtonStylesStory:()=>D});const he=[`pill`,`circular`,`suggested-action`,`destructive-action`,`flat`];var D=class ButtonStylesStory extends T{_demo=null;static{w.registerClass({GTypeName:`AdwStorybookButtonStyles`},ButtonStylesStory)}constructor(){super(T.fromMeta(ButtonStylesStory.getMetadata(),`Default`))}static getMetadata(){return{...pe,component:p.Button.$gtype}}initialize(){let e=new C.WrapBox({childSpacing:12,lineSpacing:12,halign:p.Align.CENTER}),t=new p.Button({label:`Pill`});t.add_css_class(`pill`),e.append(t);let n=new p.Button({iconName:`list-add-symbolic`});n.add_css_class(`circular`),e.append(n);let r=new p.Button({label:`Suggested`});r.add_css_class(`suggested-action`),e.append(r);let i=new p.Button({label:`Delete`});i.add_css_class(`destructive-action`),e.append(i);let a=new p.Button({label:`Flat`});a.add_css_class(`flat`),e.append(a),this._demo=new p.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 he)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))}};w.type_ensure(D.$gtype);const ge={stories:[D]},_e={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:r.TEXT,defaultValue:`Save`},{name:`iconName`,label:`Icon`,type:r.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`}]},ve={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:r.TEXT,defaultValue:`Reply`},{name:`iconName`,label:`Icon`,type:r.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 ye=__exportAll({SplitButtonFlatStory:()=>k,SplitButtonStories:()=>be,SplitButtonStory:()=>O});function buildMenu(){let e=new b.Menu;return e.append(`Save as…`,`app.save-as`),e.append(`Export`,`app.export`),e.append(`Print`,`app.print`),e}var O=class SplitButtonStory extends T{_widget=null;static{w.registerClass({GTypeName:`AdwStorybookSplitButton`},SplitButtonStory)}constructor(){super(T.fromMeta(SplitButtonStory.getMetadata(),`Default`))}static getMetadata(){return{..._e,component:C.SplitButton.$gtype}}initialize(){this._widget=new C.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}};w.type_ensure(O.$gtype);var k=class SplitButtonFlatStory extends T{_widget=null;static{w.registerClass({GTypeName:`AdwStorybookSplitButtonFlat`},SplitButtonFlatStory)}constructor(){super(T.fromMeta(SplitButtonFlatStory.getMetadata(),`Default`))}static getMetadata(){return{...ve,component:C.SplitButton.$gtype}}initialize(){this._widget=new C.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}};w.type_ensure(k.$gtype);const be={stories:[O,k]},xe={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:r.SELECT,options:[{label:`List`,value:0},{label:`Grid`,value:1},{label:`Columns`,value:2}],defaultValue:0},{name:`style`,label:`Style`,type:r.SELECT,options:[{label:`Default`,value:`default`},{label:`Flat`,value:`flat`},{label:`Round`,value:`round`}],defaultValue:`default`}]};var Se=__exportAll({ToggleGroupStories:()=>we,ToggleGroupStory:()=>A});const Ce=[`flat`,`round`];var A=class ToggleGroupStory extends T{_toggleGroup=null;static{w.registerClass({GTypeName:`AdwStorybookToggleGroup`},ToggleGroupStory)}constructor(){super(T.fromMeta(ToggleGroupStory.getMetadata(),`Default`))}static getMetadata(){return{...xe,component:C.ToggleGroup.$gtype}}initialize(){this._toggleGroup=new C.ToggleGroup,this._toggleGroup.add(new C.Toggle({label:`List`,iconName:`view-list-symbolic`})),this._toggleGroup.add(new C.Toggle({label:`Grid`,iconName:`view-grid-symbolic`})),this._toggleGroup.add(new C.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 Ce)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))}};w.type_ensure(A.$gtype);const we={stories:[A]},Te={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:r.TEXT,defaultValue:`Adwaita Storybook`},{name:`version`,label:`Version`,type:r.TEXT,defaultValue:`0.11.0`}]};var Ee=__exportAll({AboutDialogStories:()=>De,AboutDialogStory:()=>j}),j=class AboutDialogStory extends T{_button=null;static{w.registerClass({GTypeName:`AdwStorybookAboutDialog`},AboutDialogStory)}constructor(){super(T.fromMeta(AboutDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...Te,component:C.AboutDialog.$gtype}}initialize(){this._button=new p.Button({label:`Show dialog`,halign:p.Align.CENTER,valign:p.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 C.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:p.License.MIT_X11,developers:[`Ada Lovelace`,`Grace Hopper`],designers:[`Margaret Hamilton`],copyright:`© 2026 The GJSify Project`}).present(this)}updateArgs(e){}};w.type_ensure(j.$gtype);const De={stories:[j]},Oe={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:r.TEXT,defaultValue:`Delete Project?`},{name:`body`,label:`Body`,type:r.TEXT,defaultValue:`This will permanently remove the project and all of its files. This action cannot be undone.`}]};var ke=__exportAll({AlertDialogStories:()=>Ae,AlertDialogStory:()=>M}),M=class AlertDialogStory extends T{_button=null;static{w.registerClass({GTypeName:`AdwStorybookAlertDialog`},AlertDialogStory)}constructor(){super(T.fromMeta(AlertDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...Oe,component:C.AlertDialog.$gtype}}initialize(){this._button=new p.Button({label:`Show dialog`,halign:p.Align.CENTER,valign:p.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 C.AlertDialog({heading:this.args.heading,body:this.args.body});e.add_response(`cancel`,`Cancel`),e.add_response(`delete`,`Delete`),e.set_response_appearance(`delete`,C.ResponseAppearance.DESTRUCTIVE),e.set_default_response(`cancel`),e.set_close_response(`cancel`),e.present(this)}updateArgs(e){}};w.type_ensure(M.$gtype);const Ae={stories:[M]},je={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:r.TEXT,defaultValue:`General`},{name:`groupTitle`,label:`Group title`,type:r.TEXT,defaultValue:`Appearance`}]};var Me=__exportAll({PreferencesDialogStories:()=>Ne,PreferencesDialogStory:()=>N}),N=class PreferencesDialogStory extends T{_button=null;static{w.registerClass({GTypeName:`AdwStorybookPreferencesDialog`},PreferencesDialogStory)}constructor(){super(T.fromMeta(PreferencesDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...je,component:C.PreferencesDialog.$gtype}}initialize(){this._button=new p.Button({label:`Show dialog`,halign:p.Align.CENTER,valign:p.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 C.PreferencesDialog,t=new C.PreferencesPage({title:this.args.pageTitle,iconName:`preferences-system-symbolic`}),n=new C.PreferencesGroup({title:this.args.groupTitle,description:`Control how the application looks and behaves.`});n.add(new C.SwitchRow({title:`Dark style`,subtitle:`Use a dark colour scheme`,active:!0})),n.add(new C.ComboRow({title:`Accent colour`,model:new p.StringList({strings:[`Blue`,`Teal`,`Green`,`Orange`,`Purple`]}),selected:0})),n.add(new C.SpinRow({title:`Font size`,adjustment:new p.Adjustment({lower:8,upper:24,value:12,stepIncrement:1,pageIncrement:4})})),t.add(n),e.add(t),e.present(this)}updateArgs(e){}};w.type_ensure(N.$gtype);const Ne={stories:[N]},Pe={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:r.TEXT,defaultValue:`File moved to Trash`},{name:`timeout`,label:`Timeout (s)`,type:r.NUMBER,min:0,max:10,step:1,defaultValue:3},{name:`hasButton`,label:`Action button`,type:r.BOOLEAN,defaultValue:!0},{name:`buttonLabel`,label:`Button label`,type:r.TEXT,defaultValue:`Undo`}]};var Fe=__exportAll({ToastStories:()=>Ie,ToastStory:()=>P}),P=class ToastStory extends T{_overlay=null;static{w.registerClass({GTypeName:`AdwStorybookToast`},ToastStory)}constructor(){super(T.fromMeta(ToastStory.getMetadata(),`Default`))}static getMetadata(){return{...Pe,component:C.Toast.$gtype}}initialize(){let e=new p.Button({label:`Show toast`,halign:p.Align.CENTER,valign:p.Align.CENTER});e.add_css_class(`pill`),e.add_css_class(`suggested-action`),e.connect(`clicked`,()=>this._showToast()),this._overlay=new C.ToastOverlay({child:e,widthRequest:360,heightRequest:220}),this.addContent(this._overlay)}_showToast(){if(!this._overlay)return;let e=new C.Toast({title:this.args.title,timeout:this.args.timeout});this.args.hasButton&&(e.buttonLabel=this.args.buttonLabel),this._overlay.add_toast(e)}updateArgs(e){}};w.type_ensure(P.$gtype);const Ie={stories:[P]},Le={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:r.RANGE,min:200,max:600,step:10,defaultValue:400},{name:`tighteningThreshold`,label:`Tightening threshold`,type:r.RANGE,min:100,max:600,step:10,defaultValue:300}]};var Re=__exportAll({ClampStories:()=>ze,ClampStory:()=>F}),F=class ClampStory extends T{_clamp=null;static{w.registerClass({GTypeName:`AdwStorybookClamp`},ClampStory)}constructor(){super(T.fromMeta(ClampStory.getMetadata(),`Default`))}static getMetadata(){return{...Le,component:C.Clamp.$gtype}}initialize(){let e=new p.Box({orientation:p.Orientation.HORIZONTAL,widthRequest:520});e.add_css_class(`card`);let t=new p.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 C.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)}};w.type_ensure(F.$gtype);const ze={stories:[F]},Be={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:r.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`notes.md`},{name:`showTitle`,label:`Show title`,type:r.BOOLEAN,defaultValue:!0}]};var Ve=__exportAll({HeaderBarStories:()=>He,HeaderBarStory:()=>I}),I=class HeaderBarStory extends T{_headerBar=null;_title=null;static{w.registerClass({GTypeName:`AdwStorybookHeaderBar`},HeaderBarStory)}constructor(){super(T.fromMeta(HeaderBarStory.getMetadata(),`Default`))}static getMetadata(){return{...Be,component:C.HeaderBar.$gtype}}initialize(){this._title=new C.WindowTitle({title:this.args.title,subtitle:this.args.subtitle}),this._headerBar=new C.HeaderBar({titleWidget:this._title,showTitle:this.args.showTitle,widthRequest:460});let e=new p.Button({iconName:`go-previous-symbolic`});e.add_css_class(`flat`),this._headerBar.pack_start(e);let t=new b.Menu;t.append(`New Window`,`app.new-window`),t.append(`Preferences`,`app.preferences`),t.append(`About`,`app.about`);let n=new p.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)}};w.type_ensure(I.$gtype);const He={stories:[I]},Ue={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:r.BOOLEAN,defaultValue:!0},{name:`revealBottomBars`,label:`Reveal bottom bars`,type:r.BOOLEAN,defaultValue:!0}]};var We=__exportAll({ToolbarViewStories:()=>Ge,ToolbarViewStory:()=>L}),L=class ToolbarViewStory extends T{_view=null;static{w.registerClass({GTypeName:`AdwStorybookToolbarView`},ToolbarViewStory)}constructor(){super(T.fromMeta(ToolbarViewStory.getMetadata(),`Default`))}static getMetadata(){return{...Ue,component:C.ToolbarView.$gtype}}initialize(){this._view=new C.ToolbarView({widthRequest:460,heightRequest:320,revealTopBars:this.args.revealTopBars,revealBottomBars:this.args.revealBottomBars});let e=new C.HeaderBar({titleWidget:new C.WindowTitle({title:`Documents`,subtitle:`12 items`})});this._view.add_top_bar(e);let t=new C.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 p.ActionBar,r=new p.Button({iconName:`list-add-symbolic`});r.add_css_class(`flat`);let i=new p.Button({iconName:`list-remove-symbolic`});i.add_css_class(`flat`),n.pack_start(r),n.pack_start(i),n.set_center_widget(new p.Label({label:`Selection: none`}));let a=new p.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)}};w.type_ensure(L.$gtype);const Ge={stories:[L]},Ke={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:r.RANGE,min:0,max:36,step:1,defaultValue:8},{name:`lineSpacing`,label:`Line spacing`,type:r.RANGE,min:0,max:36,step:1,defaultValue:8}]};var qe=__exportAll({WrapBoxStories:()=>Je,WrapBoxStory:()=>R}),R=class WrapBoxStory extends T{_wrap=null;static{w.registerClass({GTypeName:`AdwStorybookWrapBox`},WrapBoxStory)}constructor(){super(T.fromMeta(WrapBoxStory.getMetadata(),`Default`))}static getMetadata(){return{...Ke,component:C.WrapBox.$gtype}}initialize(){this._wrap=new C.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 p.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)}};w.type_ensure(R.$gtype);const Je={stories:[R]},Ye={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:r.BOOLEAN,defaultValue:!0},{name:`modal`,label:`Modal`,type:r.BOOLEAN,defaultValue:!0},{name:`canClose`,label:`Can close`,type:r.BOOLEAN,defaultValue:!0}]};var Xe=__exportAll({BottomSheetStories:()=>Ze,BottomSheetStory:()=>z}),z=class BottomSheetStory extends T{_sheet=null;static{w.registerClass({GTypeName:`AdwStorybookBottomSheet`},BottomSheetStory)}constructor(){super(T.fromMeta(BottomSheetStory.getMetadata(),`Default`))}static getMetadata(){return{...Ye,component:C.BottomSheet.$gtype}}buildContent(){let e=new p.Button({label:`Toggle sheet`,halign:p.Align.CENTER,valign:p.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 p.Box({orientation:p.Orientation.VERTICAL,spacing:12,marginTop:18,marginBottom:24,marginStart:18,marginEnd:18});e.append(new p.Label({label:`Share track`,halign:p.Align.START,cssClasses:[`title-2`]}));let t=new C.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 C.ActionRow({title:e});r.add_prefix(new p.Image({iconName:n})),r.activatable=!0,t.add(r)}return e.append(t),e}initialize(){this._sheet=new C.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)}};w.type_ensure(z.$gtype);const Ze={stories:[z]},Qe={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:r.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:r.BOOLEAN,defaultValue:!1}]};var $e=__exportAll({NavigationSplitViewStories:()=>et,NavigationSplitViewStory:()=>B}),B=class NavigationSplitViewStory extends T{_view=null;static{w.registerClass({GTypeName:`AdwStorybookNavigationSplitView`},NavigationSplitViewStory)}constructor(){super(T.fromMeta(NavigationSplitViewStory.getMetadata(),`Default`))}static getMetadata(){return{...Qe,component:C.NavigationSplitView.$gtype}}buildSidebar(){let e=new C.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 C.ActionRow({title:t,subtitle:n});i.add_prefix(new p.Image({iconName:r})),i.activatable=!0,e.add(i)}let t=new C.ToolbarView;return t.add_top_bar(new C.HeaderBar),t.content=e,new C.NavigationPage({title:`Mailboxes`,child:t})}buildContent(){let e=new C.StatusPage({iconName:`mail-unread-symbolic`,title:`All Mail`,description:`Select a conversation from the list to read it here.`,vexpand:!0}),t=new C.ToolbarView;return t.add_top_bar(new C.HeaderBar),t.content=e,new C.NavigationPage({title:`All Mail`,child:t})}initialize(){this._view=new C.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)}};w.type_ensure(B.$gtype);const et={stories:[B]},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:r.TEXT,defaultValue:`Contacts`},{name:`detailTitle`,label:`Detail title`,type:r.TEXT,defaultValue:`Ada Lovelace`},{name:`animateTransitions`,label:`Animate transitions`,type:r.BOOLEAN,defaultValue:!0}]};var nt=__exportAll({NavigationViewStories:()=>rt,NavigationViewStory:()=>V}),V=class NavigationViewStory extends T{_view=null;static{w.registerClass({GTypeName:`AdwStorybookNavigationView`},NavigationViewStory)}constructor(){super(T.fromMeta(NavigationViewStory.getMetadata(),`Default`))}static getMetadata(){return{...tt,component:C.NavigationView.$gtype}}buildPage(e,t){let n=new C.ToolbarView;return n.add_top_bar(new C.HeaderBar),n.content=t,new C.NavigationPage({title:e,child:n})}initialize(){this._view=new C.NavigationView({animateTransitions:this.args.animateTransitions,widthRequest:480,heightRequest:340});let e=this.buildPage(this.args.detailTitle,new C.StatusPage({iconName:`avatar-default-symbolic`,title:this.args.detailTitle,description:`Mathematician and writer, the first computer programmer.`,vexpand:!0})),t=new p.Button({label:`Open contact`,halign:p.Align.CENTER,valign:p.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)}};w.type_ensure(V.$gtype);const rt={stories:[V]},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:r.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:r.BOOLEAN,defaultValue:!1}]};var at=__exportAll({OverlaySplitViewStories:()=>st,OverlaySplitViewStory:()=>ot}),ot=class OverlaySplitViewStory extends T{_view=null;static{w.registerClass({GTypeName:`AdwStorybookOverlaySplitView`},OverlaySplitViewStory)}constructor(){super(T.fromMeta(OverlaySplitViewStory.getMetadata(),`Default`))}static getMetadata(){return{...it,component:C.OverlaySplitView.$gtype}}buildSidebar(){let e=new C.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 C.ActionRow({title:t});r.add_prefix(new p.Image({iconName:n})),r.activatable=!0,e.add(r)}let t=new C.ToolbarView;return t.add_top_bar(new C.HeaderBar({showTitle:!1})),t.content=e,t.add_css_class(`sidebar`),t}buildContent(){let e=new C.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 C.ToolbarView;return t.add_top_bar(new C.HeaderBar),t.content=e,t}initialize(){this._view=new C.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)}};w.type_ensure(ot.$gtype);const st={stories:[ot]},ct={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:r.SELECT,options:[{label:`Sidebar`,value:`sidebar`},{label:`Page`,value:`page`}],defaultValue:`sidebar`},{name:`selected`,label:`Selected index`,type:r.NUMBER,min:0,max:3,step:1,defaultValue:0}]};var lt=__exportAll({SidebarStories:()=>ut,SidebarStory:()=>H}),H=class SidebarStory extends T{_sidebar=null;_status=null;static{w.registerClass({GTypeName:`AdwStorybookSidebar`},SidebarStory)}constructor(){super(T.fromMeta(SidebarStory.getMetadata(),`Default`))}static getMetadata(){return{...ct,component:C.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`?C.SidebarMode.PAGE:C.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 C.SidebarSection({title:`Mailboxes`});for(let t of this.items)e.append(new C.SidebarItem({title:t.title,subtitle:t.subtitle,iconName:t.icon}));this._sidebar=new C.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 C.StatusPage({hexpand:!0,vexpand:!0});let t=new p.Box({orientation:p.Orientation.HORIZONTAL,widthRequest:480,heightRequest:340});t.append(this._sidebar),t.append(new p.Separator({orientation:p.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())}};w.type_ensure(H.$gtype);const ut={stories:[H]},dt={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:r.TEXT,defaultValue:`Ada Lovelace`},{name:`size`,label:`Size`,type:r.RANGE,min:24,max:160,step:8,defaultValue:96},{name:`showInitials`,label:`Show initials`,type:r.BOOLEAN,defaultValue:!0},{name:`iconName`,label:`Fallback icon`,type:r.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 ft=__exportAll({AvatarStories:()=>pt,AvatarStory:()=>U}),U=class AvatarStory extends T{_avatar=null;static{w.registerClass({GTypeName:`AdwStorybookAvatar`},AvatarStory)}constructor(){super(T.fromMeta(AvatarStory.getMetadata(),`Default`))}static getMetadata(){return{...dt,component:C.Avatar.$gtype}}initialize(){this._avatar=new C.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)}};w.type_ensure(U.$gtype);const pt={stories:[U]},mt={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:r.TEXT,defaultValue:`Metered connection — updates paused`},{name:`buttonLabel`,label:`Button label`,type:r.TEXT,defaultValue:`Resume`},{name:`revealed`,label:`Revealed`,type:r.BOOLEAN,defaultValue:!0},{name:`useMarkup`,label:`Use markup`,type:r.BOOLEAN,defaultValue:!1}]};var ht=__exportAll({BannerStories:()=>gt,BannerStory:()=>W}),W=class BannerStory extends T{_banner=null;static{w.registerClass({GTypeName:`AdwStorybookBanner`},BannerStory)}constructor(){super(T.fromMeta(BannerStory.getMetadata(),`Default`))}static getMetadata(){return{...mt,component:C.Banner.$gtype}}initialize(){this._banner=new C.Banner({title:this.args.title,buttonLabel:this.args.buttonLabel,revealed:this.args.revealed,useMarkup:this.args.useMarkup});let e=new p.Box({orientation:p.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)}};w.type_ensure(W.$gtype);const gt={stories:[W]},_t={title:`Presentation/Spinner`,description:`Adw.Spinner — a lightweight loading indicator that spins continuously while visible.`,controls:[{name:`size`,label:`Size`,type:r.RANGE,min:16,max:64,step:4,defaultValue:48}]};var vt=__exportAll({SpinnerStories:()=>yt,SpinnerStory:()=>G}),G=class SpinnerStory extends T{_spinner=null;static{w.registerClass({GTypeName:`AdwStorybookSpinner`},SpinnerStory)}constructor(){super(T.fromMeta(SpinnerStory.getMetadata(),`Default`))}static getMetadata(){return{..._t,component:C.Spinner.$gtype}}initialize(){let e=this.args.size;this._spinner=new C.Spinner({widthRequest:e,heightRequest:e,halign:p.Align.CENTER,valign:p.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}};w.type_ensure(G.$gtype);const yt={stories:[G]},bt={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:r.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:r.TEXT,defaultValue:`No Documents`},{name:`description`,label:`Description`,type:r.TEXT,defaultValue:`Documents you create or open will appear here.`}]};var xt=__exportAll({StatusPageStories:()=>St,StatusPageStory:()=>K}),K=class StatusPageStory extends T{_statusPage=null;static{w.registerClass({GTypeName:`AdwStorybookStatusPage`},StatusPageStory)}constructor(){super(T.fromMeta(StatusPageStory.getMetadata(),`Default`))}static getMetadata(){return{...bt,component:C.StatusPage.$gtype}}initialize(){let e=new p.Button({label:`New Document`,halign:p.Align.CENTER,cssClasses:[`pill`,`suggested-action`]});this._statusPage=new C.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)}};w.type_ensure(K.$gtype);const St={stories:[K]},Ct={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:r.TEXT,defaultValue:`Inbox`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`3 unread messages`}]};var wt=__exportAll({WindowTitleStories:()=>Tt,WindowTitleStory:()=>q}),q=class WindowTitleStory extends T{_windowTitle=null;static{w.registerClass({GTypeName:`AdwStorybookWindowTitle`},WindowTitleStory)}constructor(){super(T.fromMeta(WindowTitleStory.getMetadata(),`Default`))}static getMetadata(){return{...Ct,component:C.WindowTitle.$gtype}}initialize(){this._windowTitle=new C.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)}};w.type_ensure(q.$gtype);const Tt={stories:[q]},Et={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:r.TEXT,defaultValue:`Wi-Fi`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`Connected to Highgarden 5GHz`},{name:`iconName`,label:`Prefix icon`,type:r.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:r.BOOLEAN,defaultValue:!0}]};var Dt=__exportAll({ActionRowStories:()=>Ot,ActionRowStory:()=>J}),J=class ActionRowStory extends T{_row=null;_icon=null;_button=null;static{w.registerClass({GTypeName:`AdwStorybookActionRow`},ActionRowStory)}constructor(){super(T.fromMeta(ActionRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Et,component:C.ActionRow.$gtype}}initialize(){this._row=new C.ActionRow({title:this.args.title,subtitle:this.args.subtitle}),this._icon=new p.Image({iconName:this.args.iconName}),this._row.add_prefix(this._icon),this._button=new p.Button({iconName:`go-next-symbolic`,valign:p.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 C.PreferencesGroup;e.add(this._row);let t=new C.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)}};w.type_ensure(J.$gtype);const Ot={stories:[J]},kt={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:r.TEXT,defaultValue:`Add account`},{name:`startIconName`,label:`Start icon`,type:r.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:r.SELECT,options:[{label:`None`,value:`none`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`}],defaultValue:`suggested-action`}]};var At=__exportAll({ButtonRowStories:()=>Mt,ButtonRowStory:()=>Y});const jt=[`suggested-action`,`destructive-action`];var Y=class ButtonRowStory extends T{_row=null;static{w.registerClass({GTypeName:`AdwStorybookButtonRow`},ButtonRowStory)}constructor(){super(T.fromMeta(ButtonRowStory.getMetadata(),`Default`))}static getMetadata(){return{...kt,component:C.ButtonRow.$gtype}}initialize(){this._row=new C.ButtonRow({title:this.args.title,startIconName:this.args.startIconName}),this._applyStyle(this.args.style);let e=new C.PreferencesGroup;e.add(this._row);let t=new C.Clamp({maximumSize:400,child:e});this.addContent(t)}_applyStyle(e){if(this._row){for(let e of jt)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))}};w.type_ensure(Y.$gtype);const Mt={stories:[Y]},Nt=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],Pt={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:r.TEXT,defaultValue:`Accent colour`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`Used to highlight selected items`},{name:`selected`,label:`Selected`,type:r.NUMBER,min:0,max:4,step:1,defaultValue:1}]};var Ft=__exportAll({ComboRowStories:()=>It,ComboRowStory:()=>X}),X=class ComboRowStory extends T{_row=null;static{w.registerClass({GTypeName:`AdwStorybookComboRow`},ComboRowStory)}constructor(){super(T.fromMeta(ComboRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Pt,component:C.ComboRow.$gtype}}initialize(){this._row=new C.ComboRow({title:this.args.title,subtitle:this.args.subtitle,model:new p.StringList({strings:[...Nt]}),selected:this.args.selected});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.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)}};w.type_ensure(X.$gtype);const It={stories:[X]},Lt={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:r.TEXT,defaultValue:`Display name`},{name:`text`,label:`Text`,type:r.TEXT,defaultValue:`Ada Lovelace`},{name:`showApplyButton`,label:`Show apply button`,type:r.BOOLEAN,defaultValue:!0}]};var Rt=__exportAll({EntryRowStories:()=>zt,EntryRowStory:()=>Z}),Z=class EntryRowStory extends T{_row=null;static{w.registerClass({GTypeName:`AdwStorybookEntryRow`},EntryRowStory)}constructor(){super(T.fromMeta(EntryRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Lt,component:C.EntryRow.$gtype}}initialize(){this._row=new C.EntryRow({title:this.args.title,text:this.args.text,showApplyButton:this.args.showApplyButton});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.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)}};w.type_ensure(Z.$gtype);const zt={stories:[Z]},Bt={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:r.TEXT,defaultValue:`Proxy settings`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`Route traffic through a custom proxy`},{name:`expanded`,label:`Expanded`,type:r.BOOLEAN,defaultValue:!0},{name:`showEnableSwitch`,label:`Show enable switch`,type:r.BOOLEAN,defaultValue:!1}]};var Vt=__exportAll({ExpanderRowStories:()=>Ht,ExpanderRowStory:()=>Q}),Q=class ExpanderRowStory extends T{_row=null;static{w.registerClass({GTypeName:`AdwStorybookExpanderRow`},ExpanderRowStory)}constructor(){super(T.fromMeta(ExpanderRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Bt,component:C.ExpanderRow.$gtype}}initialize(){this._row=new C.ExpanderRow({title:this.args.title,subtitle:this.args.subtitle,expanded:this.args.expanded,showEnableSwitch:this.args.showEnableSwitch}),this._row.add_row(new C.EntryRow({title:`Host`,text:`proxy.example.com`})),this._row.add_row(new C.SwitchRow({title:`Use authentication`,active:!1}));let e=new C.PreferencesGroup;e.add(this._row);let t=new C.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)}};w.type_ensure(Q.$gtype);const Ht={stories:[Q]},Ut={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:r.TEXT,defaultValue:`Password`},{name:`text`,label:`Text`,type:r.TEXT,defaultValue:`correct-horse-battery`}]};var Wt=__exportAll({PasswordEntryRowStories:()=>Kt,PasswordEntryRowStory:()=>Gt}),Gt=class PasswordEntryRowStory extends T{_row=null;static{w.registerClass({GTypeName:`AdwStorybookPasswordEntryRow`},PasswordEntryRowStory)}constructor(){super(T.fromMeta(PasswordEntryRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Ut,component:C.PasswordEntryRow.$gtype}}initialize(){this._row=new C.PasswordEntryRow({title:this.args.title,text:this.args.text});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.text=this.args.text)}};w.type_ensure(Gt.$gtype);const Kt={stories:[Gt]},qt={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:r.TEXT,defaultValue:`Account`},{name:`description`,label:`Description`,type:r.TEXT,defaultValue:`Manage how this device signs in and syncs.`}]};var Jt=__exportAll({PreferencesGroupStories:()=>Xt,PreferencesGroupStory:()=>Yt}),Yt=class PreferencesGroupStory extends T{_prefsGroup=null;static{w.registerClass({GTypeName:`AdwStorybookPreferencesGroup`},PreferencesGroupStory)}constructor(){super(T.fromMeta(PreferencesGroupStory.getMetadata(),`Default`))}static getMetadata(){return{...qt,component:C.PreferencesGroup.$gtype}}initialize(){let e=new p.Button({label:`Sign out`,valign:p.Align.CENTER});e.add_css_class(`flat`),this._prefsGroup=new C.PreferencesGroup({title:this.args.title,description:this.args.description,headerSuffix:e});let t=new C.EntryRow({title:`Display name`,text:`Grace Hopper`});this._prefsGroup.add(t);let n=new C.SwitchRow({title:`Sync over Wi-Fi only`,subtitle:`Avoid using mobile data for backups`,active:!0});this._prefsGroup.add(n);let r=new C.ComboRow({title:`Region`,model:new p.StringList({strings:[`Europe`,`Americas`,`Asia`,`Oceania`]}),selected:0});this._prefsGroup.add(r);let i=new C.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)}};w.type_ensure(Yt.$gtype);const Xt={stories:[Yt]},Zt={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:r.TEXT,defaultValue:`Font size`},{name:`value`,label:`Value`,type:r.NUMBER,min:0,max:100,step:1,defaultValue:16},{name:`digits`,label:`Digits`,type:r.NUMBER,min:0,max:4,step:1,defaultValue:0}]};var Qt=__exportAll({SpinRowStories:()=>en,SpinRowStory:()=>$t}),$t=class SpinRowStory extends T{_row=null;static{w.registerClass({GTypeName:`AdwStorybookSpinRow`},SpinRowStory)}constructor(){super(T.fromMeta(SpinRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Zt,component:C.SpinRow.$gtype}}initialize(){this._row=new C.SpinRow({title:this.args.title,adjustment:new p.Adjustment({lower:0,upper:100,value:this.args.value,stepIncrement:1,pageIncrement:10}),digits:this.args.digits});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.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)}};w.type_ensure($t.$gtype);const en={stories:[$t]},tn={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:r.TEXT,defaultValue:`Automatic updates`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`Download and install updates without asking`},{name:`active`,label:`Active`,type:r.BOOLEAN,defaultValue:!0}]};var nn=__exportAll({SwitchRowStories:()=>an,SwitchRowStory:()=>rn}),rn=class SwitchRowStory extends T{_row=null;static{w.registerClass({GTypeName:`AdwStorybookSwitchRow`},SwitchRowStory)}constructor(){super(T.fromMeta(SwitchRowStory.getMetadata(),`Default`))}static getMetadata(){return{...tn,component:C.SwitchRow.$gtype}}initialize(){this._row=new C.SwitchRow({title:this.args.title,subtitle:this.args.subtitle,active:this.args.active});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.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)}};w.type_ensure(rn.$gtype);const an={stories:[rn]},on=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:r.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:r.BOOLEAN,defaultValue:!1}],sn={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:on},cn={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:on};var ln=__exportAll({CarouselDotsStory:()=>dn,CarouselLinesStory:()=>fn,CarouselStories:()=>pn});const un=[{title:`Welcome`,css:`accent`},{title:`Discover`,css:`success`},{title:`Get started`,css:`warning`}];function buildPage(e,t){let n=new p.Box({orientation:p.Orientation.VERTICAL,halign:p.Align.CENTER,valign:p.Align.CENTER,widthRequest:440,heightRequest:260});n.add_css_class(`card`),n.add_css_class(t);let r=new p.Label({label:e,vexpand:!0,valign:p.Align.CENTER});return r.add_css_class(`title-1`),n.append(r),n}var dn=class CarouselDotsStory extends T{_carousel=null;static{w.registerClass({GTypeName:`AdwStorybookCarouselDots`},CarouselDotsStory)}constructor(){super(T.fromMeta(CarouselDotsStory.getMetadata(),`Default`))}static getMetadata(){return{...sn,component:C.Carousel.$gtype}}initialize(){this._carousel=new C.Carousel({allowScrollWheel:this.args.allowScrollWheel,allowLongSwipes:this.args.allowLongSwipes,vexpand:!0});for(let e of un)this._carousel.append(buildPage(e.title,e.css));let e=new C.CarouselIndicatorDots({carousel:this._carousel}),t=new p.Box({orientation:p.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)}};w.type_ensure(dn.$gtype);var fn=class CarouselLinesStory extends T{_carousel=null;static{w.registerClass({GTypeName:`AdwStorybookCarouselLines`},CarouselLinesStory)}constructor(){super(T.fromMeta(CarouselLinesStory.getMetadata(),`Default`))}static getMetadata(){return{...cn,component:C.Carousel.$gtype}}initialize(){this._carousel=new C.Carousel({allowScrollWheel:this.args.allowScrollWheel,allowLongSwipes:this.args.allowLongSwipes,vexpand:!0});for(let e of un)this._carousel.append(buildPage(e.title,e.css));let e=new C.CarouselIndicatorLines({carousel:this._carousel}),t=new p.Box({orientation:p.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)}};w.type_ensure(fn.$gtype);const pn={stories:[dn,fn]},mn={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:r.SELECT,options:[{label:`Labels`,value:`labels`},{label:`Icons`,value:`icons`},{label:`Both`,value:`both`}],defaultValue:`both`}]};var hn=__exportAll({InlineViewSwitcherStories:()=>_n,InlineViewSwitcherStory:()=>gn}),gn=class InlineViewSwitcherStory extends T{_switcher=null;static{w.registerClass({GTypeName:`AdwStorybookInlineViewSwitcher`},InlineViewSwitcherStory)}constructor(){super(T.fromMeta(InlineViewSwitcherStory.getMetadata(),`Default`))}static getMetadata(){return{...mn,component:C.InlineViewSwitcher.$gtype}}buildPage(e,t,n){return new C.StatusPage({iconName:t,title:e,description:n,vexpand:!0})}initialize(){let e=new C.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 C.InlineViewSwitcher({stack:e,displayMode:this.modeFromArg(this.args.displayMode),halign:p.Align.CENTER});let t=new p.Box({orientation:p.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._switcher),t.append(e),this.addContent(t)}modeFromArg(e){return e===`labels`?C.InlineViewSwitcherDisplayMode.LABELS:e===`icons`?C.InlineViewSwitcherDisplayMode.ICONS:C.InlineViewSwitcherDisplayMode.BOTH}updateArgs(e){this._switcher&&(this._switcher.displayMode=this.modeFromArg(this.args.displayMode))}};w.type_ensure(gn.$gtype);const _n={stories:[gn]},vn={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:r.BOOLEAN,defaultValue:!1}]};var yn=__exportAll({TabViewStories:()=>Sn,TabViewStory:()=>xn});const bn=[{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 xn=class TabViewStory extends T{_tabBar=null;static{w.registerClass({GTypeName:`AdwStorybookTabView`},TabViewStory)}constructor(){super(T.fromMeta(TabViewStory.getMetadata(),`Default`))}static getMetadata(){return{...vn,component:C.TabView.$gtype}}buildPageBody(e,t){return new C.StatusPage({iconName:`view-paged-symbolic`,title:e,description:t,vexpand:!0})}initialize(){let e=new C.TabView({vexpand:!0});for(let t of bn){let n=e.append(this.buildPageBody(t.title,t.body));n.title=t.title}this._tabBar=new C.TabBar({view:e,autohide:this.args.autohide});let t=new p.Box({orientation:p.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)}};w.type_ensure(xn.$gtype);const Sn={stories:[xn]},Cn={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:r.SELECT,options:[{label:`Wide`,value:`wide`},{label:`Narrow`,value:`narrow`}],defaultValue:`wide`}]};var wn=__exportAll({ViewSwitcherStories:()=>Tn,ViewSwitcherStory:()=>$}),$=class ViewSwitcherStory extends T{_switcher=null;static{w.registerClass({GTypeName:`AdwStorybookViewSwitcher`},ViewSwitcherStory)}constructor(){super(T.fromMeta(ViewSwitcherStory.getMetadata(),`Default`))}static getMetadata(){return{...Cn,component:C.ViewSwitcher.$gtype}}buildPage(e,t,n){return new C.StatusPage({iconName:t,title:e,description:n,vexpand:!0})}initialize(){let e=new C.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 C.ViewSwitcher({stack:e,policy:this.policyFromArg(this.args.policy),halign:p.Align.CENTER});let t=new p.Box({orientation:p.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._switcher),t.append(e),this.addContent(t)}policyFromArg(e){return e===`narrow`?C.ViewSwitcherPolicy.NARROW:C.ViewSwitcherPolicy.WIDE}updateArgs(e){this._switcher&&(this._switcher.policy=this.policyFromArg(this.args.policy))}};w.type_ensure($.$gtype);const Tn={stories:[$]};await runStorybook({applicationId:`org.gjsify.AdwaitaStorybook`,title:`Adwaita Storybook`,stories:collectStoryModules([de,me,ye,Se,Ee,ke,Me,Fe,Re,Ve,We,qe,Xe,$e,nt,at,lt,ft,ht,vt,xt,wt,Dt,At,Ft,Rt,Vt,Wt,Jt,Qt,nn,ln,hn,yn,wn])});export{};
162
+ \n${this._options.css??``}`);let t=d.Display.get_default();if(!t){console.error(`No display found`);return}m.StyleContext.add_provider_for_display(t,e,m.STYLE_PROVIDER_PRIORITY_APPLICATION)}_onActivate(){if(!this._window){this._window=new _e({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)]}),probeEnabled()&&installStorybookProbe(this,this._window,this._options.probe)}this._window.present()}};E.type_ensure(ve.$gtype);function collectStoryModules(e){return collectStoryModules$1(e)}function buildGtkChrome(e){let t=new C.PreferencesPage,n=new C.PreferencesGroup,r=new m.Box({orientation:m.Orientation.VERTICAL,halign:m.Align.CENTER,valign:m.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(c.markup_escape_text(e,-1)),n.set_description(c.markup_escape_text(t,-1))}}}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`)}},D=class StoryWidget extends C.Bin{static{E.registerClass({GTypeName:`StoryWidget`,Properties:{meta:E.ParamSpec.object(`meta`,`Meta`,`Story metadata`,E.ParamFlags.READWRITE,E.Object),story:E.ParamSpec.string(`story`,`Story Name`,`Story name`,E.ParamFlags.READWRITE,``),args:E.ParamSpec.object(`args`,`Args`,`Story arguments`,E.ParamFlags.READWRITE,E.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)}};E.type_ensure(D.$gtype);var ye=class AdwaitaApp extends C.Application{static{E.registerClass({GTypeName:`GjsifyAdwaitaApp`},AdwaitaApp)}constructor(e){super({application_id:e.applicationId,flags:e.flags??b.ApplicationFlags.DEFAULT_FLAGS}),this._window=null,this._options=e,this._initActions(),this.connect(`startup`,()=>this._onStartup()),this.connect(`activate`,()=>this._onActivate())}_initActions(){if(this._options.quitAction!==!1){let e=new b.SimpleAction({name:`quit`});e.connect(`activate`,()=>this.quit()),this.add_action(e),this.set_accels_for_action(`app.quit`,[`<primary>q`])}if(this._options.about){let e=new b.SimpleAction({name:`about`});e.connect(`activate`,()=>this._showAbout()),this.add_action(e)}}_onStartup(){this._options.css&&this._loadCss(this._options.css),this._installDevtools(),this._options.onStartup?.(this)}_loadCss(e){let t=d.Display.get_default();if(!t){console.error(`@gjsify/adwaita-app: no default display; CSS not applied`);return}let n=new m.CssProvider;n.load_from_string(e),m.StyleContext.add_provider_for_display(t,n,m.STYLE_PROVIDER_PRIORITY_APPLICATION)}_installDevtools(){let e=this._options.devtools;if(e===!1)return;let t=typeof e==`object`?e:{enabled:e||void 0};installDevtools(this,t)}_onActivate(){this._window||=this._options.createWindow(this),this._window.present()}_showAbout(){let e=this._options.about;if(!e)return;let t=new C.AboutDialog({application_name:e.applicationName,application_icon:e.applicationIcon??this._options.applicationId});e.version&&(t.version=e.version),e.developerName&&(t.developer_name=e.developerName),e.website&&(t.website=e.website),e.issueUrl&&(t.issue_url=e.issueUrl),e.license&&(t.license=e.license),e.comments&&(t.comments=e.comments),e.copyright&&(t.copyright=e.copyright),e.developers?.length&&t.set_developers(e.developers),t.present(this.get_active_window())}};async function runApplication(e,t){let n=!1;try{e.register(null),n=e.get_is_remote()}catch{n=!1}let r=await e.runAsync(t);return n&&console.error(`${e.applicationId??`This application`} is already running — brought the existing instance to the front instead of opening a second window.`),r}E.type_ensure(ye.$gtype);var be=class LoadingStack extends m.Stack{static{E.registerClass({GTypeName:`GjsifyLoadingStack`},LoadingStack)}constructor(e={}){super(e);let t=new m.Box({orientation:m.Orientation.VERTICAL,halign:m.Align.CENTER,valign:m.Align.CENTER,hexpand:!0,vexpand:!0});t.append(new C.Spinner),this.add_named(t,`loading`),this._content=new C.Bin({hexpand:!0,vexpand:!0}),this.add_named(this._content,`content`),this._error=new C.StatusPage({iconName:`dialog-error-symbolic`,title:`Something went wrong`}),this.add_named(this._error,`error`),this.set_visible_child_name(`loading`)}setContent(e){this._content.set_child(e)}setError(e,t){this._error.set_title(e),this._error.set_description(t??``)}showLoading(){this.set_visible_child_name(`loading`)}showContent(){this.set_visible_child_name(`content`)}showError(){this.set_visible_child_name(`error`)}};E.type_ensure(be.$gtype);async function runStorybook(e){return runApplication(new ve(e),[t.programInvocationName,...t.programArgs])}const xe={title:`Buttons/Button Content`,description:`Adw.ButtonContent — pairs a symbolic icon with a label inside a Gtk.Button.`,controls:[{name:`label`,label:`Label`,type:r.TEXT,defaultValue:`Download`},{name:`iconName`,label:`Icon`,type:r.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:r.BOOLEAN,defaultValue:!1}]};var Se=__exportAll({ButtonContentStories:()=>Ce,ButtonContentStory:()=>O}),O=class ButtonContentStory extends D{_content=null;_button=null;static{E.registerClass({GTypeName:`AdwStorybookButtonContent`},ButtonContentStory)}constructor(){super(D.fromMeta(ButtonContentStory.getMetadata(),`Default`))}static getMetadata(){return{...xe,component:C.ButtonContent.$gtype}}initialize(){this._content=new C.ButtonContent({label:this.args.label,iconName:this.args.iconName,canShrink:this.args.canShrink}),this._button=new m.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)}};E.type_ensure(O.$gtype);const Ce={stories:[O]},we={title:`Buttons/Button Styles`,description:`Buttons with Adwaita style classes: .pill, .circular, .suggested-action, .destructive-action, .flat.`,controls:[{name:`label`,label:`Demo label`,type:r.TEXT,defaultValue:`Click me`},{name:`style`,label:`Demo style`,type:r.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 Te=__exportAll({ButtonStylesStories:()=>De,ButtonStylesStory:()=>k});const Ee=[`pill`,`circular`,`suggested-action`,`destructive-action`,`flat`];var k=class ButtonStylesStory extends D{_demo=null;static{E.registerClass({GTypeName:`AdwStorybookButtonStyles`},ButtonStylesStory)}constructor(){super(D.fromMeta(ButtonStylesStory.getMetadata(),`Default`))}static getMetadata(){return{...we,component:m.Button.$gtype}}initialize(){let e=new C.WrapBox({childSpacing:12,lineSpacing:12,halign:m.Align.CENTER}),t=new m.Button({label:`Pill`});t.add_css_class(`pill`),e.append(t);let n=new m.Button({iconName:`list-add-symbolic`});n.add_css_class(`circular`),e.append(n);let r=new m.Button({label:`Suggested`});r.add_css_class(`suggested-action`),e.append(r);let i=new m.Button({label:`Delete`});i.add_css_class(`destructive-action`),e.append(i);let a=new m.Button({label:`Flat`});a.add_css_class(`flat`),e.append(a),this._demo=new m.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 Ee)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))}};E.type_ensure(k.$gtype);const De={stories:[k]},Oe={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:r.TEXT,defaultValue:`Save`},{name:`iconName`,label:`Icon`,type:r.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`}]},ke={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:r.TEXT,defaultValue:`Reply`},{name:`iconName`,label:`Icon`,type:r.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 Ae=__exportAll({SplitButtonFlatStory:()=>j,SplitButtonStories:()=>je,SplitButtonStory:()=>A});function buildMenu(){let e=new b.Menu;return e.append(`Save as…`,`app.save-as`),e.append(`Export`,`app.export`),e.append(`Print`,`app.print`),e}var A=class SplitButtonStory extends D{_widget=null;static{E.registerClass({GTypeName:`AdwStorybookSplitButton`},SplitButtonStory)}constructor(){super(D.fromMeta(SplitButtonStory.getMetadata(),`Default`))}static getMetadata(){return{...Oe,component:C.SplitButton.$gtype}}initialize(){this._widget=new C.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}};E.type_ensure(A.$gtype);var j=class SplitButtonFlatStory extends D{_widget=null;static{E.registerClass({GTypeName:`AdwStorybookSplitButtonFlat`},SplitButtonFlatStory)}constructor(){super(D.fromMeta(SplitButtonFlatStory.getMetadata(),`Default`))}static getMetadata(){return{...ke,component:C.SplitButton.$gtype}}initialize(){this._widget=new C.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}};E.type_ensure(j.$gtype);const je={stories:[A,j]},Me={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:r.SELECT,options:[{label:`List`,value:0},{label:`Grid`,value:1},{label:`Columns`,value:2}],defaultValue:0},{name:`style`,label:`Style`,type:r.SELECT,options:[{label:`Default`,value:`default`},{label:`Flat`,value:`flat`},{label:`Round`,value:`round`}],defaultValue:`default`}]};var Ne=__exportAll({ToggleGroupStories:()=>Fe,ToggleGroupStory:()=>M});const Pe=[`flat`,`round`];var M=class ToggleGroupStory extends D{_toggleGroup=null;static{E.registerClass({GTypeName:`AdwStorybookToggleGroup`},ToggleGroupStory)}constructor(){super(D.fromMeta(ToggleGroupStory.getMetadata(),`Default`))}static getMetadata(){return{...Me,component:C.ToggleGroup.$gtype}}initialize(){this._toggleGroup=new C.ToggleGroup,this._toggleGroup.add(new C.Toggle({label:`List`,iconName:`view-list-symbolic`})),this._toggleGroup.add(new C.Toggle({label:`Grid`,iconName:`view-grid-symbolic`})),this._toggleGroup.add(new C.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 Pe)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))}};E.type_ensure(M.$gtype);const Fe={stories:[M]},Ie={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:r.TEXT,defaultValue:`Adwaita Storybook`},{name:`version`,label:`Version`,type:r.TEXT,defaultValue:`0.11.0`}]};var Le=__exportAll({AboutDialogStories:()=>Re,AboutDialogStory:()=>N}),N=class AboutDialogStory extends D{_button=null;static{E.registerClass({GTypeName:`AdwStorybookAboutDialog`},AboutDialogStory)}constructor(){super(D.fromMeta(AboutDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...Ie,component:C.AboutDialog.$gtype}}initialize(){this._button=new m.Button({label:`Show dialog`,halign:m.Align.CENTER,valign:m.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 C.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:m.License.MIT_X11,developers:[`Ada Lovelace`,`Grace Hopper`],designers:[`Margaret Hamilton`],copyright:`© 2026 The GJSify Project`}).present(this)}updateArgs(e){}};E.type_ensure(N.$gtype);const Re={stories:[N]},ze={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:r.TEXT,defaultValue:`Delete Project?`},{name:`body`,label:`Body`,type:r.TEXT,defaultValue:`This will permanently remove the project and all of its files. This action cannot be undone.`}]};var Be=__exportAll({AlertDialogStories:()=>Ve,AlertDialogStory:()=>P}),P=class AlertDialogStory extends D{_button=null;static{E.registerClass({GTypeName:`AdwStorybookAlertDialog`},AlertDialogStory)}constructor(){super(D.fromMeta(AlertDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...ze,component:C.AlertDialog.$gtype}}initialize(){this._button=new m.Button({label:`Show dialog`,halign:m.Align.CENTER,valign:m.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 C.AlertDialog({heading:this.args.heading,body:this.args.body});e.add_response(`cancel`,`Cancel`),e.add_response(`delete`,`Delete`),e.set_response_appearance(`delete`,C.ResponseAppearance.DESTRUCTIVE),e.set_default_response(`cancel`),e.set_close_response(`cancel`),e.present(this)}updateArgs(e){}};E.type_ensure(P.$gtype);const Ve={stories:[P]},He={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:r.TEXT,defaultValue:`General`},{name:`groupTitle`,label:`Group title`,type:r.TEXT,defaultValue:`Appearance`}]};var Ue=__exportAll({PreferencesDialogStories:()=>We,PreferencesDialogStory:()=>F}),F=class PreferencesDialogStory extends D{_button=null;static{E.registerClass({GTypeName:`AdwStorybookPreferencesDialog`},PreferencesDialogStory)}constructor(){super(D.fromMeta(PreferencesDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...He,component:C.PreferencesDialog.$gtype}}initialize(){this._button=new m.Button({label:`Show dialog`,halign:m.Align.CENTER,valign:m.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 C.PreferencesDialog,t=new C.PreferencesPage({title:this.args.pageTitle,iconName:`preferences-system-symbolic`}),n=new C.PreferencesGroup({title:this.args.groupTitle,description:`Control how the application looks and behaves.`});n.add(new C.SwitchRow({title:`Dark style`,subtitle:`Use a dark colour scheme`,active:!0})),n.add(new C.ComboRow({title:`Accent colour`,model:new m.StringList({strings:[`Blue`,`Teal`,`Green`,`Orange`,`Purple`]}),selected:0})),n.add(new C.SpinRow({title:`Font size`,adjustment:new m.Adjustment({lower:8,upper:24,value:12,stepIncrement:1,pageIncrement:4})})),t.add(n),e.add(t),e.present(this)}updateArgs(e){}};E.type_ensure(F.$gtype);const We={stories:[F]},Ge={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:r.TEXT,defaultValue:`File moved to Trash`},{name:`timeout`,label:`Timeout (s)`,type:r.NUMBER,min:0,max:10,step:1,defaultValue:3},{name:`hasButton`,label:`Action button`,type:r.BOOLEAN,defaultValue:!0},{name:`buttonLabel`,label:`Button label`,type:r.TEXT,defaultValue:`Undo`}]};var Ke=__exportAll({ToastStories:()=>qe,ToastStory:()=>I}),I=class ToastStory extends D{_overlay=null;static{E.registerClass({GTypeName:`AdwStorybookToast`},ToastStory)}constructor(){super(D.fromMeta(ToastStory.getMetadata(),`Default`))}static getMetadata(){return{...Ge,component:C.Toast.$gtype}}initialize(){let e=new m.Button({label:`Show toast`,halign:m.Align.CENTER,valign:m.Align.CENTER});e.add_css_class(`pill`),e.add_css_class(`suggested-action`),e.connect(`clicked`,()=>this._showToast()),this._overlay=new C.ToastOverlay({child:e,widthRequest:360,heightRequest:220}),this.addContent(this._overlay)}_showToast(){if(!this._overlay)return;let e=new C.Toast({title:this.args.title,timeout:this.args.timeout});this.args.hasButton&&(e.buttonLabel=this.args.buttonLabel),this._overlay.add_toast(e)}updateArgs(e){}};E.type_ensure(I.$gtype);const qe={stories:[I]},Je={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:r.RANGE,min:200,max:600,step:10,defaultValue:400},{name:`tighteningThreshold`,label:`Tightening threshold`,type:r.RANGE,min:100,max:600,step:10,defaultValue:300}]};var Ye=__exportAll({ClampStories:()=>Xe,ClampStory:()=>L}),L=class ClampStory extends D{_clamp=null;static{E.registerClass({GTypeName:`AdwStorybookClamp`},ClampStory)}constructor(){super(D.fromMeta(ClampStory.getMetadata(),`Default`))}static getMetadata(){return{...Je,component:C.Clamp.$gtype}}initialize(){let e=new m.Box({orientation:m.Orientation.HORIZONTAL,widthRequest:520});e.add_css_class(`card`);let t=new m.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 C.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)}};E.type_ensure(L.$gtype);const Xe={stories:[L]},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:r.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`notes.md`},{name:`showTitle`,label:`Show title`,type:r.BOOLEAN,defaultValue:!0}]};var Qe=__exportAll({HeaderBarStories:()=>$e,HeaderBarStory:()=>R}),R=class HeaderBarStory extends D{_headerBar=null;_title=null;static{E.registerClass({GTypeName:`AdwStorybookHeaderBar`},HeaderBarStory)}constructor(){super(D.fromMeta(HeaderBarStory.getMetadata(),`Default`))}static getMetadata(){return{...Ze,component:C.HeaderBar.$gtype}}initialize(){this._title=new C.WindowTitle({title:this.args.title,subtitle:this.args.subtitle}),this._headerBar=new C.HeaderBar({titleWidget:this._title,showTitle:this.args.showTitle,widthRequest:460});let e=new m.Button({iconName:`go-previous-symbolic`});e.add_css_class(`flat`),this._headerBar.pack_start(e);let t=new b.Menu;t.append(`New Window`,`app.new-window`),t.append(`Preferences`,`app.preferences`),t.append(`About`,`app.about`);let n=new m.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)}};E.type_ensure(R.$gtype);const $e={stories:[R]},et={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:r.BOOLEAN,defaultValue:!0},{name:`revealBottomBars`,label:`Reveal bottom bars`,type:r.BOOLEAN,defaultValue:!0}]};var tt=__exportAll({ToolbarViewStories:()=>nt,ToolbarViewStory:()=>z}),z=class ToolbarViewStory extends D{_view=null;static{E.registerClass({GTypeName:`AdwStorybookToolbarView`},ToolbarViewStory)}constructor(){super(D.fromMeta(ToolbarViewStory.getMetadata(),`Default`))}static getMetadata(){return{...et,component:C.ToolbarView.$gtype}}initialize(){this._view=new C.ToolbarView({widthRequest:460,heightRequest:320,revealTopBars:this.args.revealTopBars,revealBottomBars:this.args.revealBottomBars});let e=new C.HeaderBar({titleWidget:new C.WindowTitle({title:`Documents`,subtitle:`12 items`})});this._view.add_top_bar(e);let t=new C.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 m.ActionBar,r=new m.Button({iconName:`list-add-symbolic`});r.add_css_class(`flat`);let i=new m.Button({iconName:`list-remove-symbolic`});i.add_css_class(`flat`),n.pack_start(r),n.pack_start(i),n.set_center_widget(new m.Label({label:`Selection: none`}));let a=new m.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)}};E.type_ensure(z.$gtype);const nt={stories:[z]},rt={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:r.RANGE,min:0,max:36,step:1,defaultValue:8},{name:`lineSpacing`,label:`Line spacing`,type:r.RANGE,min:0,max:36,step:1,defaultValue:8}]};var it=__exportAll({WrapBoxStories:()=>at,WrapBoxStory:()=>B}),B=class WrapBoxStory extends D{_wrap=null;static{E.registerClass({GTypeName:`AdwStorybookWrapBox`},WrapBoxStory)}constructor(){super(D.fromMeta(WrapBoxStory.getMetadata(),`Default`))}static getMetadata(){return{...rt,component:C.WrapBox.$gtype}}initialize(){this._wrap=new C.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 m.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)}};E.type_ensure(B.$gtype);const at={stories:[B]},ot={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:r.BOOLEAN,defaultValue:!0},{name:`modal`,label:`Modal`,type:r.BOOLEAN,defaultValue:!0},{name:`canClose`,label:`Can close`,type:r.BOOLEAN,defaultValue:!0}]};var st=__exportAll({BottomSheetStories:()=>ct,BottomSheetStory:()=>V}),V=class BottomSheetStory extends D{_sheet=null;static{E.registerClass({GTypeName:`AdwStorybookBottomSheet`},BottomSheetStory)}constructor(){super(D.fromMeta(BottomSheetStory.getMetadata(),`Default`))}static getMetadata(){return{...ot,component:C.BottomSheet.$gtype}}buildContent(){let e=new m.Button({label:`Toggle sheet`,halign:m.Align.CENTER,valign:m.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 m.Box({orientation:m.Orientation.VERTICAL,spacing:12,marginTop:18,marginBottom:24,marginStart:18,marginEnd:18});e.append(new m.Label({label:`Share track`,halign:m.Align.START,cssClasses:[`title-2`]}));let t=new C.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 C.ActionRow({title:e});r.add_prefix(new m.Image({iconName:n})),r.activatable=!0,t.add(r)}return e.append(t),e}initialize(){this._sheet=new C.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)}};E.type_ensure(V.$gtype);const ct={stories:[V]},lt={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:r.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:r.BOOLEAN,defaultValue:!1}]};var ut=__exportAll({NavigationSplitViewStories:()=>dt,NavigationSplitViewStory:()=>H}),H=class NavigationSplitViewStory extends D{_view=null;static{E.registerClass({GTypeName:`AdwStorybookNavigationSplitView`},NavigationSplitViewStory)}constructor(){super(D.fromMeta(NavigationSplitViewStory.getMetadata(),`Default`))}static getMetadata(){return{...lt,component:C.NavigationSplitView.$gtype}}buildSidebar(){let e=new C.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 C.ActionRow({title:t,subtitle:n});i.add_prefix(new m.Image({iconName:r})),i.activatable=!0,e.add(i)}let t=new C.ToolbarView;return t.add_top_bar(new C.HeaderBar),t.content=e,new C.NavigationPage({title:`Mailboxes`,child:t})}buildContent(){let e=new C.StatusPage({iconName:`mail-unread-symbolic`,title:`All Mail`,description:`Select a conversation from the list to read it here.`,vexpand:!0}),t=new C.ToolbarView;return t.add_top_bar(new C.HeaderBar),t.content=e,new C.NavigationPage({title:`All Mail`,child:t})}initialize(){this._view=new C.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)}};E.type_ensure(H.$gtype);const dt={stories:[H]},ft={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:r.TEXT,defaultValue:`Contacts`},{name:`detailTitle`,label:`Detail title`,type:r.TEXT,defaultValue:`Ada Lovelace`},{name:`animateTransitions`,label:`Animate transitions`,type:r.BOOLEAN,defaultValue:!0}]};var pt=__exportAll({NavigationViewStories:()=>ht,NavigationViewStory:()=>mt}),mt=class NavigationViewStory extends D{_view=null;static{E.registerClass({GTypeName:`AdwStorybookNavigationView`},NavigationViewStory)}constructor(){super(D.fromMeta(NavigationViewStory.getMetadata(),`Default`))}static getMetadata(){return{...ft,component:C.NavigationView.$gtype}}buildPage(e,t){let n=new C.ToolbarView;return n.add_top_bar(new C.HeaderBar),n.content=t,new C.NavigationPage({title:e,child:n})}initialize(){this._view=new C.NavigationView({animateTransitions:this.args.animateTransitions,widthRequest:480,heightRequest:340});let e=this.buildPage(this.args.detailTitle,new C.StatusPage({iconName:`avatar-default-symbolic`,title:this.args.detailTitle,description:`Mathematician and writer, the first computer programmer.`,vexpand:!0})),t=new m.Button({label:`Open contact`,halign:m.Align.CENTER,valign:m.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)}};E.type_ensure(mt.$gtype);const ht={stories:[mt]},gt={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:r.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:r.BOOLEAN,defaultValue:!1}]};var _t=__exportAll({OverlaySplitViewStories:()=>vt,OverlaySplitViewStory:()=>U}),U=class OverlaySplitViewStory extends D{_view=null;static{E.registerClass({GTypeName:`AdwStorybookOverlaySplitView`},OverlaySplitViewStory)}constructor(){super(D.fromMeta(OverlaySplitViewStory.getMetadata(),`Default`))}static getMetadata(){return{...gt,component:C.OverlaySplitView.$gtype}}buildSidebar(){let e=new C.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 C.ActionRow({title:t});r.add_prefix(new m.Image({iconName:n})),r.activatable=!0,e.add(r)}let t=new C.ToolbarView;return t.add_top_bar(new C.HeaderBar({showTitle:!1})),t.content=e,t.add_css_class(`sidebar`),t}buildContent(){let e=new C.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 C.ToolbarView;return t.add_top_bar(new C.HeaderBar),t.content=e,t}initialize(){this._view=new C.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)}};E.type_ensure(U.$gtype);const vt={stories:[U]},yt={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:r.SELECT,options:[{label:`Sidebar`,value:`sidebar`},{label:`Page`,value:`page`}],defaultValue:`sidebar`},{name:`selected`,label:`Selected index`,type:r.NUMBER,min:0,max:3,step:1,defaultValue:0}]};var bt=__exportAll({SidebarStories:()=>xt,SidebarStory:()=>W}),W=class SidebarStory extends D{_sidebar=null;_status=null;static{E.registerClass({GTypeName:`AdwStorybookSidebar`},SidebarStory)}constructor(){super(D.fromMeta(SidebarStory.getMetadata(),`Default`))}static getMetadata(){return{...yt,component:C.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`?C.SidebarMode.PAGE:C.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 C.SidebarSection({title:`Mailboxes`});for(let t of this.items)e.append(new C.SidebarItem({title:t.title,subtitle:t.subtitle,iconName:t.icon}));this._sidebar=new C.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 C.StatusPage({hexpand:!0,vexpand:!0});let t=new m.Box({orientation:m.Orientation.HORIZONTAL,widthRequest:480,heightRequest:340});t.append(this._sidebar),t.append(new m.Separator({orientation:m.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())}};E.type_ensure(W.$gtype);const xt={stories:[W]},St=[{title:`Sync`,kind:`switch`,active:!0},{title:`Export`,kind:`action`}],Ct=[`Blue`,`Teal`,`Green`,`Orange`],wt=[{title:`Copy`,accelerator:`<Control>C`},{title:`Select all`,accelerator:`<Shift><Control>a`},{title:`Switch tab`,accelerator:`<Alt>1...9`}],Tt={title:`Overview/Widgets`,description:`Many widgets at once, the way an app composes them: a banner, preference groups of rows, an expander, buttons and shortcut labels. Use it to judge spacing, alignment and the theme as a whole rather than one widget in isolation.`,controls:[{name:`revealed`,label:`Show banner`,type:r.BOOLEAN,description:`Adw.Banner:revealed — animates in and out`,defaultValue:!0}]};var Et=__exportAll({OverviewWidgetsStories:()=>Dt,OverviewWidgetsStory:()=>G}),G=class OverviewWidgetsStory extends D{_banner=null;static{E.registerClass({GTypeName:`AdwStorybookOverviewWidgets`},OverviewWidgetsStory)}constructor(){super(D.fromMeta(OverviewWidgetsStory.getMetadata(),`Default`))}static getMetadata(){return Tt}initialize(){let e=new m.Box({orientation:m.Orientation.VERTICAL,hexpand:!0});this._banner=new C.Banner({title:`You have unsaved changes`,button_label:`Save`,revealed:this.args.revealed}),e.append(this._banner);let t=new C.PreferencesPage({hexpand:!0}),n=new C.PreferencesGroup({title:`Appearance`});n.add(new C.SwitchRow({title:`Dark mode`,subtitle:`Use the dark Adwaita palette`,active:!1})),n.add(new C.SwitchRow({title:`Notifications`,subtitle:`Show toasts for events`,active:!0})),n.add(new C.ComboRow({title:`Accent color`,model:m.StringList.new([...Ct]),selected:0})),t.add(n);let r=new C.PreferencesGroup({title:`Account`}),i=new C.EntryRow({title:`Name`});i.set_text(`Ada Lovelace`),r.add(i);let a=new C.EntryRow({title:`Email`});a.set_text(`ada@example.com`),r.add(a);let o=new C.SpinRow({title:`Devices`,adjustment:new m.Adjustment({value:3,lower:1,upper:10,step_increment:1,page_increment:1})});o.set_value(3),r.add(o);let s=new C.ExpanderRow({title:`Advanced`,subtitle:`More options`,expanded:!0});for(let e of St)s.add_row(e.kind===`switch`?new C.SwitchRow({title:e.title,active:e.active??!1}):new C.ActionRow({title:e.title}));r.add(s),t.add(r);let c=new C.PreferencesGroup({title:`Shortcuts`});for(let e of wt){let t=new C.ActionRow({title:e.title});t.add_suffix(new C.ShortcutLabel({accelerator:e.accelerator,valign:m.Align.CENTER})),c.add(t)}t.add(c);let l=new C.PreferencesGroup({title:`Actions`}),u=new m.Box({orientation:m.Orientation.HORIZONTAL,spacing:12,homogeneous:!0,margin_top:6,margin_bottom:6}),d=new m.Button({label:`Save changes`});d.add_css_class(`suggested-action`),u.append(d);let f=new m.Button({label:`Delete account`});f.add_css_class(`destructive-action`),u.append(f),l.add(u),t.add(l),e.append(t),this.addContent(e)}updateArgs(e){this._banner?.set_revealed(this.args.revealed)}};E.type_ensure(G.$gtype);const Dt={stories:[G]},Ot={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:r.TEXT,defaultValue:`Ada Lovelace`},{name:`size`,label:`Size`,type:r.RANGE,min:24,max:160,step:8,defaultValue:96},{name:`showInitials`,label:`Show initials`,type:r.BOOLEAN,defaultValue:!0},{name:`iconName`,label:`Fallback icon`,type:r.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 kt=__exportAll({AvatarStories:()=>At,AvatarStory:()=>K}),K=class AvatarStory extends D{_avatar=null;static{E.registerClass({GTypeName:`AdwStorybookAvatar`},AvatarStory)}constructor(){super(D.fromMeta(AvatarStory.getMetadata(),`Default`))}static getMetadata(){return{...Ot,component:C.Avatar.$gtype}}initialize(){this._avatar=new C.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)}};E.type_ensure(K.$gtype);const At={stories:[K]},jt={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:r.TEXT,defaultValue:`Metered connection — updates paused`},{name:`buttonLabel`,label:`Button label`,type:r.TEXT,defaultValue:`Resume`},{name:`revealed`,label:`Revealed`,type:r.BOOLEAN,defaultValue:!0},{name:`useMarkup`,label:`Use markup`,type:r.BOOLEAN,defaultValue:!1}]};var Mt=__exportAll({BannerStories:()=>Nt,BannerStory:()=>q}),q=class BannerStory extends D{_banner=null;static{E.registerClass({GTypeName:`AdwStorybookBanner`},BannerStory)}constructor(){super(D.fromMeta(BannerStory.getMetadata(),`Default`))}static getMetadata(){return{...jt,component:C.Banner.$gtype}}initialize(){this._banner=new C.Banner({title:this.args.title,buttonLabel:this.args.buttonLabel,revealed:this.args.revealed,useMarkup:this.args.useMarkup});let e=new m.Box({orientation:m.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)}};E.type_ensure(q.$gtype);const Nt={stories:[q]},Pt=[{label:`Single`,accelerator:`<Control>C`},{label:`Modifier order`,accelerator:`<Shift><Control>a`},{label:`Alternatives`,accelerator:`<Shift>A Home`},{label:`Range`,accelerator:`<Alt>1...9`},{label:`In sequence`,accelerator:`<Control>C+<Control>X`},{label:`Together`,accelerator:`Control_L&Control_R`},{label:`Nested`,accelerator:`<Alt>1...9 <Alt>0`},{label:`Unset`,accelerator:``}],Ft={title:`Presentation/Shortcut Label`,description:`Adw.ShortcutLabel — an accelerator drawn as keycaps. The four grammar levels: alternatives (space), a range (...), pressed in sequence (+), and pressed together (&).`,controls:[{name:`accelerator`,label:`Accelerator`,type:r.SELECT,options:[{label:`Ctrl+C`,value:`<Control>C`},{label:`Modifier order (Shift+Ctrl+A)`,value:`<Shift><Control>a`},{label:`Alternatives (Shift+A / Home)`,value:`<Shift>A Home`},{label:`Range (Alt+1…9)`,value:`<Alt>1...9`},{label:`In sequence (Ctrl+C → Ctrl+X)`,value:`<Control>C+<Control>X`},{label:`Together (Ctrl L + Ctrl R)`,value:`Control_L&Control_R`},{label:`Nested (Alt+1…9 / Alt+0)`,value:`<Alt>1...9 <Alt>0`},{label:`Glyph key (Ctrl+Space)`,value:`<Control>space`},{label:`Arrow key (Left)`,value:`Left`},{label:`Unset — shows the placeholder`,value:``}],defaultValue:`<Control>C`},{name:`disabledText`,label:`Placeholder`,type:r.TEXT,defaultValue:`Disabled`}]},It={title:`Presentation/Shortcut Label (All Levels)`,description:`Every Adw.ShortcutLabel grammar level at once: alternatives (space), a range (...), pressed in sequence (+), pressed together (&) — plus GTK's fixed keycap order and the disabled placeholder.`,controls:[{name:`disabledText`,label:`Placeholder`,type:r.TEXT,defaultValue:`Disabled`}]};var Lt=__exportAll({ShortcutLabelLevelsStory:()=>Y,ShortcutLabelStories:()=>Rt,ShortcutLabelStory:()=>J}),J=class ShortcutLabelStory extends D{_widget=null;static{E.registerClass({GTypeName:`AdwStorybookShortcutLabel`},ShortcutLabelStory)}constructor(){super(D.fromMeta(ShortcutLabelStory.getMetadata(),`Default`))}static getMetadata(){return{...Ft,component:C.ShortcutLabel.$gtype}}initialize(){this._widget=new C.ShortcutLabel({accelerator:this.args.accelerator,disabledText:this.args.disabledText,halign:m.Align.CENTER,valign:m.Align.CENTER}),this.addContent(this._widget)}updateArgs(e){this._widget&&(this._widget.disabledText=this.args.disabledText,this._widget.accelerator=this.args.accelerator)}};E.type_ensure(J.$gtype);var Y=class ShortcutLabelLevelsStory extends D{_widgets=[];static{E.registerClass({GTypeName:`AdwStorybookShortcutLabelLevels`},ShortcutLabelLevelsStory)}constructor(){super(D.fromMeta(ShortcutLabelLevelsStory.getMetadata(),`Default`))}static getMetadata(){return{...It,component:C.ShortcutLabel.$gtype}}initialize(){let e=new m.Grid({row_spacing:12,column_spacing:24});for(let[t,n]of Pt.entries()){let r=new m.Label({label:n.label,halign:m.Align.START});r.add_css_class(`dimmed`),e.attach(r,0,t,1,1);let i=new C.ShortcutLabel({accelerator:n.accelerator,disabledText:this.args.disabledText,halign:m.Align.END,hexpand:!0});e.attach(i,1,t,1,1),this._widgets.push(i)}this.addContent(e)}updateArgs(e){for(let e of this._widgets)e.disabledText=this.args.disabledText}};E.type_ensure(Y.$gtype);const Rt={stories:[J,Y]},zt={title:`Presentation/Spinner`,description:`Adw.Spinner — a lightweight loading indicator that spins continuously while visible.`,controls:[{name:`size`,label:`Size`,type:r.RANGE,min:16,max:64,step:4,defaultValue:48}]};var Bt=__exportAll({SpinnerStories:()=>Vt,SpinnerStory:()=>X}),X=class SpinnerStory extends D{_spinner=null;static{E.registerClass({GTypeName:`AdwStorybookSpinner`},SpinnerStory)}constructor(){super(D.fromMeta(SpinnerStory.getMetadata(),`Default`))}static getMetadata(){return{...zt,component:C.Spinner.$gtype}}initialize(){let e=this.args.size;this._spinner=new C.Spinner({widthRequest:e,heightRequest:e,halign:m.Align.CENTER,valign:m.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}};E.type_ensure(X.$gtype);const Vt={stories:[X]},Ht={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:r.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:r.TEXT,defaultValue:`No Documents`},{name:`description`,label:`Description`,type:r.TEXT,defaultValue:`Documents you create or open will appear here.`}]};var Ut=__exportAll({StatusPageStories:()=>Wt,StatusPageStory:()=>Z}),Z=class StatusPageStory extends D{_statusPage=null;static{E.registerClass({GTypeName:`AdwStorybookStatusPage`},StatusPageStory)}constructor(){super(D.fromMeta(StatusPageStory.getMetadata(),`Default`))}static getMetadata(){return{...Ht,component:C.StatusPage.$gtype}}initialize(){let e=new m.Button({label:`New Document`,halign:m.Align.CENTER,cssClasses:[`pill`,`suggested-action`]});this._statusPage=new C.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)}};E.type_ensure(Z.$gtype);const Wt={stories:[Z]},Gt={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:r.TEXT,defaultValue:`Inbox`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`3 unread messages`}]};var Kt=__exportAll({WindowTitleStories:()=>Jt,WindowTitleStory:()=>qt}),qt=class WindowTitleStory extends D{_windowTitle=null;static{E.registerClass({GTypeName:`AdwStorybookWindowTitle`},WindowTitleStory)}constructor(){super(D.fromMeta(WindowTitleStory.getMetadata(),`Default`))}static getMetadata(){return{...Gt,component:C.WindowTitle.$gtype}}initialize(){this._windowTitle=new C.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)}};E.type_ensure(qt.$gtype);const Jt={stories:[qt]},Yt={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:r.TEXT,defaultValue:`Wi-Fi`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`Connected to Highgarden 5GHz`},{name:`iconName`,label:`Prefix icon`,type:r.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:r.BOOLEAN,defaultValue:!0}]};var Xt=__exportAll({ActionRowStories:()=>Qt,ActionRowStory:()=>Zt}),Zt=class ActionRowStory extends D{_row=null;_icon=null;_button=null;static{E.registerClass({GTypeName:`AdwStorybookActionRow`},ActionRowStory)}constructor(){super(D.fromMeta(ActionRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Yt,component:C.ActionRow.$gtype}}initialize(){this._row=new C.ActionRow({title:this.args.title,subtitle:this.args.subtitle}),this._icon=new m.Image({iconName:this.args.iconName}),this._row.add_prefix(this._icon),this._button=new m.Button({iconName:`go-next-symbolic`,valign:m.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 C.PreferencesGroup;e.add(this._row);let t=new C.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)}};E.type_ensure(Zt.$gtype);const Qt={stories:[Zt]},$t={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:r.TEXT,defaultValue:`Add account`},{name:`startIconName`,label:`Start icon`,type:r.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:r.SELECT,options:[{label:`None`,value:`none`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`}],defaultValue:`suggested-action`}]};var en=__exportAll({ButtonRowStories:()=>rn,ButtonRowStory:()=>nn});const tn=[`suggested-action`,`destructive-action`];var nn=class ButtonRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookButtonRow`},ButtonRowStory)}constructor(){super(D.fromMeta(ButtonRowStory.getMetadata(),`Default`))}static getMetadata(){return{...$t,component:C.ButtonRow.$gtype}}initialize(){this._row=new C.ButtonRow({title:this.args.title,startIconName:this.args.startIconName}),this._applyStyle(this.args.style);let e=new C.PreferencesGroup;e.add(this._row);let t=new C.Clamp({maximumSize:400,child:e});this.addContent(t)}_applyStyle(e){if(this._row){for(let e of tn)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))}};E.type_ensure(nn.$gtype);const rn={stories:[nn]},an=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],on={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:r.TEXT,defaultValue:`Accent colour`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`Used to highlight selected items`},{name:`selected`,label:`Selected`,type:r.NUMBER,min:0,max:4,step:1,defaultValue:1}]};var sn=__exportAll({ComboRowStories:()=>ln,ComboRowStory:()=>cn}),cn=class ComboRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookComboRow`},ComboRowStory)}constructor(){super(D.fromMeta(ComboRowStory.getMetadata(),`Default`))}static getMetadata(){return{...on,component:C.ComboRow.$gtype}}initialize(){this._row=new C.ComboRow({title:this.args.title,subtitle:this.args.subtitle,model:new m.StringList({strings:[...an]}),selected:this.args.selected});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.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)}};E.type_ensure(cn.$gtype);const ln={stories:[cn]},un={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:r.TEXT,defaultValue:`Display name`},{name:`text`,label:`Text`,type:r.TEXT,defaultValue:`Ada Lovelace`},{name:`showApplyButton`,label:`Show apply button`,type:r.BOOLEAN,defaultValue:!0}]};var dn=__exportAll({EntryRowStories:()=>pn,EntryRowStory:()=>fn}),fn=class EntryRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookEntryRow`},EntryRowStory)}constructor(){super(D.fromMeta(EntryRowStory.getMetadata(),`Default`))}static getMetadata(){return{...un,component:C.EntryRow.$gtype}}initialize(){this._row=new C.EntryRow({title:this.args.title,text:this.args.text,showApplyButton:this.args.showApplyButton});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.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)}};E.type_ensure(fn.$gtype);const pn={stories:[fn]},mn={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:r.TEXT,defaultValue:`Proxy settings`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`Route traffic through a custom proxy`},{name:`expanded`,label:`Expanded`,type:r.BOOLEAN,defaultValue:!0},{name:`showEnableSwitch`,label:`Show enable switch`,type:r.BOOLEAN,defaultValue:!1}]};var hn=__exportAll({ExpanderRowStories:()=>_n,ExpanderRowStory:()=>gn}),gn=class ExpanderRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookExpanderRow`},ExpanderRowStory)}constructor(){super(D.fromMeta(ExpanderRowStory.getMetadata(),`Default`))}static getMetadata(){return{...mn,component:C.ExpanderRow.$gtype}}initialize(){this._row=new C.ExpanderRow({title:this.args.title,subtitle:this.args.subtitle,expanded:this.args.expanded,showEnableSwitch:this.args.showEnableSwitch}),this._row.add_row(new C.EntryRow({title:`Host`,text:`proxy.example.com`})),this._row.add_row(new C.SwitchRow({title:`Use authentication`,active:!1}));let e=new C.PreferencesGroup;e.add(this._row);let t=new C.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)}};E.type_ensure(gn.$gtype);const _n={stories:[gn]},vn={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:r.TEXT,defaultValue:`Password`},{name:`text`,label:`Text`,type:r.TEXT,defaultValue:`correct-horse-battery`}]};var yn=__exportAll({PasswordEntryRowStories:()=>xn,PasswordEntryRowStory:()=>bn}),bn=class PasswordEntryRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookPasswordEntryRow`},PasswordEntryRowStory)}constructor(){super(D.fromMeta(PasswordEntryRowStory.getMetadata(),`Default`))}static getMetadata(){return{...vn,component:C.PasswordEntryRow.$gtype}}initialize(){this._row=new C.PasswordEntryRow({title:this.args.title,text:this.args.text});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.text=this.args.text)}};E.type_ensure(bn.$gtype);const xn={stories:[bn]},Sn={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:r.TEXT,defaultValue:`Account`},{name:`description`,label:`Description`,type:r.TEXT,defaultValue:`Manage how this device signs in and syncs.`}]};var Cn=__exportAll({PreferencesGroupStories:()=>Tn,PreferencesGroupStory:()=>wn}),wn=class PreferencesGroupStory extends D{_prefsGroup=null;static{E.registerClass({GTypeName:`AdwStorybookPreferencesGroup`},PreferencesGroupStory)}constructor(){super(D.fromMeta(PreferencesGroupStory.getMetadata(),`Default`))}static getMetadata(){return{...Sn,component:C.PreferencesGroup.$gtype}}initialize(){let e=new m.Button({label:`Sign out`,valign:m.Align.CENTER});e.add_css_class(`flat`),this._prefsGroup=new C.PreferencesGroup({title:this.args.title,description:this.args.description,headerSuffix:e});let t=new C.EntryRow({title:`Display name`,text:`Grace Hopper`});this._prefsGroup.add(t);let n=new C.SwitchRow({title:`Sync over Wi-Fi only`,subtitle:`Avoid using mobile data for backups`,active:!0});this._prefsGroup.add(n);let r=new C.ComboRow({title:`Region`,model:new m.StringList({strings:[`Europe`,`Americas`,`Asia`,`Oceania`]}),selected:0});this._prefsGroup.add(r);let i=new C.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)}};E.type_ensure(wn.$gtype);const Tn={stories:[wn]},En={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:r.TEXT,defaultValue:`Font size`},{name:`value`,label:`Value`,type:r.NUMBER,min:0,max:100,step:1,defaultValue:16},{name:`digits`,label:`Digits`,type:r.NUMBER,min:0,max:4,step:1,defaultValue:0}]};var Dn=__exportAll({SpinRowStories:()=>On,SpinRowStory:()=>Q}),Q=class SpinRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookSpinRow`},SpinRowStory)}constructor(){super(D.fromMeta(SpinRowStory.getMetadata(),`Default`))}static getMetadata(){return{...En,component:C.SpinRow.$gtype}}initialize(){this._row=new C.SpinRow({title:this.args.title,adjustment:new m.Adjustment({lower:0,upper:100,value:this.args.value,stepIncrement:1,pageIncrement:10}),digits:this.args.digits});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.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)}};E.type_ensure(Q.$gtype);const On={stories:[Q]},kn={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:r.TEXT,defaultValue:`Automatic updates`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`Download and install updates without asking`},{name:`active`,label:`Active`,type:r.BOOLEAN,defaultValue:!0}]};var An=__exportAll({SwitchRowStories:()=>Mn,SwitchRowStory:()=>jn}),jn=class SwitchRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookSwitchRow`},SwitchRowStory)}constructor(){super(D.fromMeta(SwitchRowStory.getMetadata(),`Default`))}static getMetadata(){return{...kn,component:C.SwitchRow.$gtype}}initialize(){this._row=new C.SwitchRow({title:this.args.title,subtitle:this.args.subtitle,active:this.args.active});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.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)}};E.type_ensure(jn.$gtype);const Mn={stories:[jn]},Nn=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:r.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:r.BOOLEAN,defaultValue:!1}],Pn={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:Nn},Fn={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:Nn};var In=__exportAll({CarouselDotsStory:()=>Rn,CarouselLinesStory:()=>zn,CarouselStories:()=>Bn});const Ln=[{title:`Welcome`,css:`accent`},{title:`Discover`,css:`success`},{title:`Get started`,css:`warning`}];function buildPage(e,t){let n=new m.Box({orientation:m.Orientation.VERTICAL,halign:m.Align.CENTER,valign:m.Align.CENTER,widthRequest:440,heightRequest:260});n.add_css_class(`card`),n.add_css_class(t);let r=new m.Label({label:e,vexpand:!0,valign:m.Align.CENTER});return r.add_css_class(`title-1`),n.append(r),n}var Rn=class CarouselDotsStory extends D{_carousel=null;static{E.registerClass({GTypeName:`AdwStorybookCarouselDots`},CarouselDotsStory)}constructor(){super(D.fromMeta(CarouselDotsStory.getMetadata(),`Default`))}static getMetadata(){return{...Pn,component:C.Carousel.$gtype}}initialize(){this._carousel=new C.Carousel({allowScrollWheel:this.args.allowScrollWheel,allowLongSwipes:this.args.allowLongSwipes,vexpand:!0});for(let e of Ln)this._carousel.append(buildPage(e.title,e.css));let e=new C.CarouselIndicatorDots({carousel:this._carousel}),t=new m.Box({orientation:m.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)}};E.type_ensure(Rn.$gtype);var zn=class CarouselLinesStory extends D{_carousel=null;static{E.registerClass({GTypeName:`AdwStorybookCarouselLines`},CarouselLinesStory)}constructor(){super(D.fromMeta(CarouselLinesStory.getMetadata(),`Default`))}static getMetadata(){return{...Fn,component:C.Carousel.$gtype}}initialize(){this._carousel=new C.Carousel({allowScrollWheel:this.args.allowScrollWheel,allowLongSwipes:this.args.allowLongSwipes,vexpand:!0});for(let e of Ln)this._carousel.append(buildPage(e.title,e.css));let e=new C.CarouselIndicatorLines({carousel:this._carousel}),t=new m.Box({orientation:m.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)}};E.type_ensure(zn.$gtype);const Bn={stories:[Rn,zn]},Vn={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:r.SELECT,options:[{label:`Labels`,value:`labels`},{label:`Icons`,value:`icons`},{label:`Both`,value:`both`}],defaultValue:`both`}]};var Hn=__exportAll({InlineViewSwitcherStories:()=>Wn,InlineViewSwitcherStory:()=>Un}),Un=class InlineViewSwitcherStory extends D{_switcher=null;static{E.registerClass({GTypeName:`AdwStorybookInlineViewSwitcher`},InlineViewSwitcherStory)}constructor(){super(D.fromMeta(InlineViewSwitcherStory.getMetadata(),`Default`))}static getMetadata(){return{...Vn,component:C.InlineViewSwitcher.$gtype}}buildPage(e,t,n){return new C.StatusPage({iconName:t,title:e,description:n,vexpand:!0})}initialize(){let e=new C.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 C.InlineViewSwitcher({stack:e,displayMode:this.modeFromArg(this.args.displayMode),halign:m.Align.CENTER});let t=new m.Box({orientation:m.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._switcher),t.append(e),this.addContent(t)}modeFromArg(e){return e===`labels`?C.InlineViewSwitcherDisplayMode.LABELS:e===`icons`?C.InlineViewSwitcherDisplayMode.ICONS:C.InlineViewSwitcherDisplayMode.BOTH}updateArgs(e){this._switcher&&(this._switcher.displayMode=this.modeFromArg(this.args.displayMode))}};E.type_ensure(Un.$gtype);const Wn={stories:[Un]},Gn={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:r.BOOLEAN,defaultValue:!1}]};var Kn=__exportAll({TabViewStories:()=>Yn,TabViewStory:()=>Jn});const qn=[{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 Jn=class TabViewStory extends D{_tabBar=null;static{E.registerClass({GTypeName:`AdwStorybookTabView`},TabViewStory)}constructor(){super(D.fromMeta(TabViewStory.getMetadata(),`Default`))}static getMetadata(){return{...Gn,component:C.TabView.$gtype}}buildPageBody(e,t){return new C.StatusPage({iconName:`view-paged-symbolic`,title:e,description:t,vexpand:!0})}initialize(){let e=new C.TabView({vexpand:!0});for(let t of qn){let n=e.append(this.buildPageBody(t.title,t.body));n.title=t.title}this._tabBar=new C.TabBar({view:e,autohide:this.args.autohide});let t=new m.Box({orientation:m.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)}};E.type_ensure(Jn.$gtype);const Yn={stories:[Jn]},Xn={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:r.SELECT,options:[{label:`Wide`,value:`wide`},{label:`Narrow`,value:`narrow`}],defaultValue:`wide`}]};var Zn=__exportAll({ViewSwitcherStories:()=>Qn,ViewSwitcherStory:()=>$}),$=class ViewSwitcherStory extends D{_switcher=null;static{E.registerClass({GTypeName:`AdwStorybookViewSwitcher`},ViewSwitcherStory)}constructor(){super(D.fromMeta(ViewSwitcherStory.getMetadata(),`Default`))}static getMetadata(){return{...Xn,component:C.ViewSwitcher.$gtype}}buildPage(e,t,n){return new C.StatusPage({iconName:t,title:e,description:n,vexpand:!0})}initialize(){let e=new C.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 C.ViewSwitcher({stack:e,policy:this.policyFromArg(this.args.policy),halign:m.Align.CENTER});let t=new m.Box({orientation:m.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._switcher),t.append(e),this.addContent(t)}policyFromArg(e){return e===`narrow`?C.ViewSwitcherPolicy.NARROW:C.ViewSwitcherPolicy.WIDE}updateArgs(e){this._switcher&&(this._switcher.policy=this.policyFromArg(this.args.policy))}};E.type_ensure($.$gtype);const Qn={stories:[$]};await runStorybook({applicationId:`org.gjsify.AdwaitaStorybook`,title:`Adwaita Storybook`,stories:collectStoryModules([Se,Te,Ae,Ne,Le,Be,Ue,Ke,Ye,Qe,tt,it,st,ut,pt,_t,bt,Et,kt,Mt,Lt,Bt,Ut,Kt,Xt,en,sn,dn,hn,yn,Cn,Dn,An,In,Hn,Kn,Zn])});export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/example-gtk-adwaita-storybook",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "description": "Interactive component browser for Libadwaita widgets — a native Adwaita storybook built on @gjsify/storybook, debuggable over DBus/MCP via @gjsify/devtools",
5
5
  "type": "module",
6
6
  "main": "dist/gjs.js",
@@ -21,7 +21,7 @@
21
21
  "start:watch": "gjsify storybook --watch",
22
22
  "start:browser": "http-server dist -o -c-1",
23
23
  "build": "gjsify run build:gjs && gjsify run build:node && gjsify run build:web",
24
- "build:gjs": "gjsify storybook --build-only --out dist/gjs.js",
24
+ "build:gjs": "gjsify storybook --build-only --runtime gjs --out dist/gjs.js",
25
25
  "build:node": "gjsify storybook --build-only --runtime node --out dist/gjs.node.mjs",
26
26
  "build:browser": "gjsify build src/browser/main.ts --app browser --outfile dist/browser-main.js",
27
27
  "build:assets": "gjsify copy src/browser/index.html dist/",
@@ -54,11 +54,11 @@
54
54
  "@girs/glib-2.0": "^4.1.0",
55
55
  "@girs/gobject-2.0": "^4.1.0",
56
56
  "@girs/gtk-4.0": "^4.1.0",
57
- "@gjsify/adwaita-web": "^0.37.0",
58
- "@gjsify/cli": "^0.37.0",
57
+ "@gjsify/adwaita-web": "^0.38.0",
58
+ "@gjsify/cli": "^0.38.0",
59
59
  "@gjsify/node-gi": "file:../../../packages/node-gi/node-gi",
60
- "@gjsify/storybook": "^0.37.0",
61
- "@gjsify/adwaita-storybook": "^0.37.0",
60
+ "@gjsify/storybook": "^0.38.0",
61
+ "@gjsify/adwaita-storybook": "^0.38.0",
62
62
  "@types/node": "^25.9.2",
63
63
  "typescript": "^6.0.3"
64
64
  },