@gjsify/storybook 0.54.0 → 0.56.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.
Files changed (2) hide show
  1. package/lib/esm/probe.js +1 -1
  2. package/package.json +9 -9
package/lib/esm/probe.js CHANGED
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{captureWidgetPng as e,dumpTree as t}from"@gjsify/devtools";import n from"gi://GLib?version=2.0";const r=[`AdwNavigationSplitView`,`GtkListBox`,`AdwOverlaySplitView`];function probeEnabled(){let e=n.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(i,a,o={}){let s=o.requireChrome??r,c=o.out??n.getenv(`GJSIFY_STORYBOOK_PROBE_OUT`)??void 0,l=o.timeoutMs??8e3,u=o.storyWidget??n.getenv(`GJSIFY_STORYBOOK_PROBE_STORY_WIDGET`)??void 0,d=a.controller.listStories(),f=[...new Set(d.map(e=>e.category))],p=o.story??n.getenv(`GJSIFY_STORYBOOK_PROBE_STORY`)??d[0]?.title,m=p?a.openStoryByTitle(p):!1,h=a.activeStory,g=new Set;collectTypes(t(a,60,`toplevel:0`),g);let _=s.filter(e=>!g.has(e)),v=new Set;h&&collectTypes(t(h,60,`story`),v);let y=v.size,b=u?v.has(u):null,finish=e=>{let t=JSON.stringify(e);if(e.ok)console.log(`STORYBOOK PROBE: PASS ${t}`);else{console.error(`STORYBOOK PROBE: FAIL ${t}`);try{typeof process<`u`&&(process.exitCode=1)}catch{}}if(c)try{n.file_set_contents(c,JSON.stringify(e,null,2))}catch{}i.quit()},x=0;n.timeout_add(n.PRIORITY_DEFAULT,100,()=>{x+=100;let t=e(a),r=a.get_width()>0&&a.get_height()>0;if(!t&&!(x>=l))return n.SOURCE_CONTINUE;let i=h?e(h):null,o=d.length>=1&&f.length>=1&&_.length===0&&m&&h!=null&&y>1,c;return d.length<1?c=`no stories registered`:f.length<1?c=`no categories`:_.length>0?c=`chrome missing: ${_.join(`, `)}`:!m||h==null?c=`could not open story: ${p??`(none)`}`:y<=1&&(c=`opened story rendered an empty subtree`),o&&u&&!v.has(u)&&(o=!1,c=`story widget ${u} not found in the opened story subtree`),o&&r&&(!t||t.length===0)&&(o=!1,c=`window realized (${a.get_width()}x${a.get_height()}) but the GSK capture was empty`),finish({ok:o,reason:c,stories:d.length,categories:f,opened:m,activeStory:h?h.meta.title:null,requiredChrome:s,missingChrome:_,storySubtreeWidgets:y,storyWidgetPresent:b,windowRealized:r,windowPngBytes:t?t.length:0,storyPngBytes:i?i.length:0}),n.SOURCE_REMOVE})}export{installStorybookProbe,probeEnabled};
1
+ import"./_virtual/_rolldown/runtime.js";import{captureWidgetPng as e,dumpTree as t}from"@gjsify/devtools";import n from"gi://GLib?version=2.0";const r=[`AdwNavigationSplitView`,`GtkListBox`,`AdwOverlaySplitView`];function probeEnabled(){let e=n.getenv(`GJSIFY_STORYBOOK_PROBE`);if(e==null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}const i=5e3;function exitIfNotDrained(){if(typeof process>`u`||typeof process.exit!=`function`)return;let e=setTimeout(()=>{console.error(`STORYBOOK PROBE: host still alive ${i}ms after quit(), exiting`),process.exit(process.exitCode??0)},i);typeof e==`object`&&typeof e.unref==`function`&&e.unref()}function collectTypes(e,t){t.add(e.type);for(let n of e.children)collectTypes(n,t)}function installStorybookProbe(i,a,o={}){let s=o.requireChrome??r,c=o.out??n.getenv(`GJSIFY_STORYBOOK_PROBE_OUT`)??void 0,l=o.timeoutMs??8e3,u=o.storyWidget??n.getenv(`GJSIFY_STORYBOOK_PROBE_STORY_WIDGET`)??void 0,d=a.controller.listStories(),f=[...new Set(d.map(e=>e.category))],p=o.story??n.getenv(`GJSIFY_STORYBOOK_PROBE_STORY`)??d[0]?.title,m=p?a.openStoryByTitle(p):!1,h=a.activeStory,g=new Set;collectTypes(t(a,60,`toplevel:0`),g);let _=s.filter(e=>!g.has(e)),v=new Set;h&&collectTypes(t(h,60,`story`),v);let y=v.size,b=u?v.has(u):null,finish=e=>{let t=JSON.stringify(e);if(e.ok)console.log(`STORYBOOK PROBE: PASS ${t}`);else{console.error(`STORYBOOK PROBE: FAIL ${t}`);try{typeof process<`u`&&(process.exitCode=1)}catch{}}if(c)try{n.file_set_contents(c,JSON.stringify(e,null,2))}catch{}i.quit(),exitIfNotDrained()},x=0;n.timeout_add(n.PRIORITY_DEFAULT,100,()=>{x+=100;let t=e(a),r=a.get_width()>0&&a.get_height()>0;if(!t&&!(x>=l))return n.SOURCE_CONTINUE;let i=h?e(h):null,o=d.length>=1&&f.length>=1&&_.length===0&&m&&h!=null&&y>1,c;return d.length<1?c=`no stories registered`:f.length<1?c=`no categories`:_.length>0?c=`chrome missing: ${_.join(`, `)}`:!m||h==null?c=`could not open story: ${p??`(none)`}`:y<=1&&(c=`opened story rendered an empty subtree`),o&&u&&!v.has(u)&&(o=!1,c=`story widget ${u} not found in the opened story subtree`),o&&r&&(!t||t.length===0)&&(o=!1,c=`window realized (${a.get_width()}x${a.get_height()}) but the GSK capture was empty`),finish({ok:o,reason:c,stories:d.length,categories:f,opened:m,activeStory:h?h.meta.title:null,requiredChrome:s,missingChrome:_,storySubtreeWidgets:y,storyWidgetPresent:b,windowRealized:r,windowPngBytes:t?t.length:0,storyPngBytes:i?i.length:0}),n.SOURCE_REMOVE})}export{installStorybookProbe,probeEnabled};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/storybook",
3
- "version": "0.54.0",
3
+ "version": "0.56.0",
4
4
  "description": "Reusable GTK/Adwaita storybook for GJS — author *.story.ts and browse them in a generic component explorer",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -41,16 +41,16 @@
41
41
  "@girs/glib-2.0": "5.4.0",
42
42
  "@girs/gobject-2.0": "5.4.0",
43
43
  "@girs/gtk-4.0": "5.4.0",
44
- "@gjsify/adwaita-app": "^0.54.0",
45
- "@gjsify/adwaita-core": "^0.54.0",
46
- "@gjsify/devtools": "^0.54.0",
47
- "@gjsify/stories": "^0.54.0",
48
- "@gjsify/storybook-core": "^0.54.0"
44
+ "@gjsify/adwaita-app": "^0.56.0",
45
+ "@gjsify/adwaita-core": "^0.56.0",
46
+ "@gjsify/devtools": "^0.56.0",
47
+ "@gjsify/stories": "^0.56.0",
48
+ "@gjsify/storybook-core": "^0.56.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@gjsify/cli": "^0.54.0",
52
- "@gjsify/unit": "^0.54.0",
53
- "@gjsify/vite-plugin-blueprint": "^0.54.0",
51
+ "@gjsify/cli": "^0.56.0",
52
+ "@gjsify/unit": "^0.56.0",
53
+ "@gjsify/vite-plugin-blueprint": "^0.56.0",
54
54
  "@types/node": "^25.9.2",
55
55
  "typescript": "^6.0.3"
56
56
  },