@vue/devtools-kit 9.0.0-rc.1 → 9.0.0-rc.2

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.
@@ -1 +0,0 @@
1
- import{connectPanelChannel as e}from"devframe/in-page-channel";import{createRpcClient as t}from"devframe/rpc/client";const n=`devtools:query`,r=`devtools:command`,i=`devtools:event`,a=`vue-devtools`,o=`devtools:iframe-rpc-connect`,s=`vue-devtools`;function c(e){let t=/* @__PURE__ */ new WeakMap;return e.start(),{post(t){e.postMessage(t)},on(n){let r=e=>n(e.data);t.set(n,r),e.addEventListener(`message`,r)},off(n){let r=t.get(n);r&&(e.removeEventListener(`message`,r),t.delete(n))}}}function l(e,t={}){let n=e.attachInPage({name:t.channelId??`vue-devtools`,window:t.window??p()??!1,allowedOrigins:t.allowedOrigins});return()=>n.dispose()}function u(t={}){let a=t.window??p();if(!a)throw Error(`Devtools iframe RPC requires a browser window`);let o=e({name:t.channelId??`vue-devtools`,window:a,targets:t.targetWindow?[t.targetWindow]:void 0,allowedOrigins:t.targetOrigin?[t.targetOrigin]:void 0,functions:{}}),s=e=>o.call(n,e);return{query:s,queryCustom:s,command:e=>o.call(r,e),commandCustom:e=>o.call(r,e),onEvent:e=>o.on(i,e),onConnectionChanged:e=>o.events.on(`status:updated`,e),dispose:()=>o.close()}}function d(e={}){return{kind:`iframe`,available(){return f(e)},connect(){return u(e)}}}function f(e={}){let t=e.window??p();if(!t)return!1;let n=e.targetWindow??t.parent;return!!n&&n!==t}function p(){return typeof window>`u`?void 0:window}function m(e){let a=/* @__PURE__ */ new Set,o=t({[i](e){a.forEach(t=>t(e))}},{channel:e.channel}),s=e=>o.$call(n,e),c=e=>o.$call(r,e);return{query:s,command:c,queryCustom:s,commandCustom:c,onEvent(e){return a.add(e),()=>{a.delete(e)}},dispose(){a.clear(),o.$close(),e.disposeChannel?.()}}}const h=`vue-devtools`,g=1;function _(e,t){let n={source:h,version:1,role:e};return typeof t==`number`&&(n.tabId=t),JSON.stringify(n)}function v(e){try{let t=JSON.parse(e);return t.source!==`vue-devtools`||t.version!==1||t.role!==`page`&&t.role!==`panel`||t.tabId!=null&&!Number.isInteger(t.tabId)?void 0:t}catch{return}}const y=`vue-devtools:frame-control`;function b(e){return typeof e==`object`&&!!e&&e.source===`vue-devtools:frame-control`&&typeof e.type==`string`}function x(e){let t=/* @__PURE__ */ new WeakMap;return{post(t){e.postMessage(t)},on(n){let r=e=>{b(e)||n(e)};t.set(n,r),e.onMessage.addListener(r)},off(n){let r=t.get(n);r&&(e.onMessage.removeListener(r),t.delete(n))}}}function S(e={}){let t=e.chrome??E(),n=t?.runtime;if(!n)throw Error(`Vue Devtools extension RPC requires chrome.runtime`);let r=e.tabId??t?.devtools?.inspectedWindow?.tabId;if(!Number.isInteger(r))throw Error(`Vue Devtools extension RPC requires chrome.devtools.inspectedWindow.tabId`);let i=n.connect({name:e.name??_(`panel`,r)}),a=C(i),o=!1,s;return s=Object.assign(m({channel:x(i),disposeChannel:()=>{o||(o=!0,a.dispose(),i.disconnect())}}),{frames:a.controller}),i.onDisconnect.addListener(()=>{o||(o=!0,a.dispose(),s.dispose())}),s}function C(e){let t=[],n,r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set,a=e=>{if(b(e)){if(e.type===`frames:changed`){t=e.frames,n=e.activeFrameId,r.forEach(e=>e(t,n));return}e.type===`frames:activated`&&(n=e.frame.frameId,i.forEach(t=>t(e.frame,e.reason)))}};return e.onMessage.addListener(a),{controller:{getFrames(){return t},getActiveFrameId(){return n},selectFrame(t){let n={source:y,type:`frames:select`,frameId:t};try{e.postMessage(n)}catch{}},onFramesChanged(e){return r.add(e),()=>{r.delete(e)}},onFrameActivated(e){return i.add(e),()=>{i.delete(e)}}},dispose(){e.onMessage.removeListener(a),r.clear(),i.clear()}}}function w(e={}){return{kind:`extension`,available(){return T(e)},connect(){return S(e)}}}function T(e={}){let t=e.chrome??E(),n=e.tabId??t?.devtools?.inspectedWindow?.tabId;return!!t?.runtime?.connect&&Number.isInteger(n)}function E(){return globalThis.chrome}function D(e={}){let t=e.hosts??O(e),n=[];for(let e of t){if(!e.available()){n.push(e.kind);continue}return e.connect()}throw Error(`No available Vue Devtools client host${n.length?`: ${n.join(`, `)}`:``}`)}function O(e={}){return[w(e.extension),d(e.iframe)]}export{i as C,r as S,l as _,g as a,o as b,_ as c,T as d,v as f,f as g,d as h,h as i,w as l,u as m,O as n,S as o,m as p,y as r,x as s,D as t,b as u,c as v,n as w,a as x,s as y};