@gjsify/devtools-browser 0.21.0 → 0.23.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/lib/esm/browser-core.js +2 -2
- package/package.json +6 -6
package/lib/esm/browser-core.js
CHANGED
|
@@ -69,7 +69,7 @@ ${n}
|
|
|
69
69
|
variants: native Adw widgets in the GJS variant, and <code>@gjsify/adwaita-web</code>
|
|
70
70
|
custom-elements in the browser variant. The iframe content area is
|
|
71
71
|
deliberately unstyled — pages bring their own styling.</p>
|
|
72
|
-
`)}};var BrowserCore=class{constructor(e){this._iframe=e,this._history=[],this._historyIndex=-1,this._stateCbs=[],this._loadedCbs=[],queueMicrotask(()=>this._attachListener())}_attachListener(){let e=this._iframe.contentWindow;e&&e.addEventListener(`message`,e=>{let t=e.data;if(t&&t.type===`page-loaded`&&typeof t.title==`string`&&typeof t.url==`string`)for(let e of this._loadedCbs)e({title:t.title,url:t.url})})}navigate(e){this._history=this._history.slice(0,this._historyIndex+1),this._history.push(e),this._historyIndex=this._history.length-1,this._loadInto(e),this._emitState()}back(){this.canGoBack&&(this._historyIndex--,this._loadInto(this._history[this._historyIndex]),this._emitState())}forward(){this.canGoForward&&(this._historyIndex++,this._loadInto(this._history[this._historyIndex]),this._emitState())}reload(){this._historyIndex<0||(this._loadInto(this._history[this._historyIndex]),this._emitState())}get currentUrl(){return this._historyIndex>=0?this._history[this._historyIndex]:``}get canGoBack(){return this._historyIndex>0}get canGoForward(){return this._historyIndex<this._history.length-1}onStateChange(e){this._stateCbs.push(e)}onPageLoaded(e){this._loadedCbs.push(e)}reattachListener(){this._attachListener()}_loadInto(t){if(t.startsWith(`page:`)){let n=
|
|
72
|
+
`)}};var BrowserCore=class{constructor(e){this._iframe=e,this._history=[],this._historyIndex=-1,this._stateCbs=[],this._loadedCbs=[],queueMicrotask(()=>this._attachListener())}_attachListener(){let e=this._iframe.contentWindow;e&&e.addEventListener(`message`,e=>{let t=e.data;if(t&&t.type===`page-loaded`&&typeof t.title==`string`&&typeof t.url==`string`)for(let e of this._loadedCbs)e({title:t.title,url:t.url})})}navigate(e){this._history=this._history.slice(0,this._historyIndex+1),this._history.push(e),this._historyIndex=this._history.length-1,this._loadInto(e),this._emitState()}back(){this.canGoBack&&(this._historyIndex--,this._loadInto(this._history[this._historyIndex]),this._emitState())}forward(){this.canGoForward&&(this._historyIndex++,this._loadInto(this._history[this._historyIndex]),this._emitState())}reload(){this._historyIndex<0||(this._loadInto(this._history[this._historyIndex]),this._emitState())}get currentUrl(){return this._historyIndex>=0?this._history[this._historyIndex]:``}get canGoBack(){return this._historyIndex>0}get canGoForward(){return this._historyIndex<this._history.length-1}onStateChange(e){this._stateCbs.push(e)}onPageLoaded(e){this._loadedCbs.push(e)}reattachListener(){this._attachListener()}_loadInto(t){if(t.startsWith(`page:`)){let n=t.slice(5),r=e[n];if(this._iframe.src=``,!r){this._iframe.srcdoc=pageTemplate(`Not found`,t,`
|
|
73
73
|
<h1>Page not found</h1>
|
|
74
74
|
<p>The URL <code>${t}</code> is not a built-in page.
|
|
75
|
-
Try <code>page:welcome</code>.</p>`);return}this._iframe.srcdoc=
|
|
75
|
+
Try <code>page:welcome</code>.</p>`);return}this._iframe.srcdoc=r.html;return}this._iframe.srcdoc=``,this._iframe.src=t}_emitState(){let e={url:this.currentUrl,canGoBack:this.canGoBack,canGoForward:this.canGoForward};for(let t of this._stateCbs)t(e)}};const t=Object.keys(e).map(e=>`page:${e}`),n=`page:welcome`;export{t as BUILTIN_PAGE_URLS,BrowserCore,n as DEFAULT_HOME_URL};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/devtools-browser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Minimalist Adwaita web browser for GJS — shared BrowserCore + native Adw shell + a devtools extension so an agent can drive and inspect web apps over MCP",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"@girs/gobject-2.0": "^4.1.0",
|
|
42
42
|
"@girs/gtk-4.0": "^4.1.0",
|
|
43
43
|
"@girs/webkit-6.0": "^4.1.0",
|
|
44
|
-
"@gjsify/devtools": "^0.
|
|
45
|
-
"@gjsify/devtools-cdp": "^0.
|
|
46
|
-
"@gjsify/iframe": "^0.
|
|
44
|
+
"@gjsify/devtools": "^0.23.0",
|
|
45
|
+
"@gjsify/devtools-cdp": "^0.23.0",
|
|
46
|
+
"@gjsify/iframe": "^0.23.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@gjsify/cli": "^0.
|
|
50
|
-
"@gjsify/unit": "^0.
|
|
49
|
+
"@gjsify/cli": "^0.23.0",
|
|
50
|
+
"@gjsify/unit": "^0.23.0",
|
|
51
51
|
"@types/node": "^25.9.2",
|
|
52
52
|
"typescript": "^6.0.3"
|
|
53
53
|
},
|