@synnaxlabs/drift 0.42.1 → 0.42.3
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/electron.cjs +1 -1
- package/dist/electron.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/noop.cjs +1 -1
- package/dist/noop.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/{selectors--wDYbFAe.js → selectors-B00IQPYW.js} +1 -1
- package/dist/{selectors-jksTA_U1.cjs → selectors-CGCIf0Ac.cjs} +1 -1
- package/dist/{state-BOplmOQD.js → state-BX_5GHgM.js} +1 -1
- package/dist/{state-Cl8us-b9.cjs → state-xseZCh_u.cjs} +1 -1
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +2 -2
- package/dist/{window-DLsE0-fP.cjs → window-Bj8OM9F9.cjs} +7 -7
- package/dist/{window-BIbHrbtA.js → window-DwJfMpbK.js} +1277 -1276
- package/package.json +2 -2
package/dist/electron.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var R=Object.defineProperty;var B=(t,e,o)=>e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var m=(t,e,o)=>B(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./window-
|
|
1
|
+
"use strict";var R=Object.defineProperty;var B=(t,e,o)=>e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var m=(t,e,o)=>B(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./window-Bj8OM9F9.cjs"),q=require("./state-xseZCh_u.cjs"),H=require("./debounce-BUAIXXZt.cjs"),E="drift://action",p="drift://create",w="drift://focus",b="drift://close",I="drift://set-minimized",N="drift://set-maximized",z="drift://set-visible",y="drift://set-fullscreen",M="drift://center",O="drift://set-position",A="drift://set-size",g="drift://set-min-size",V="drift://set-max-size",x="drift://set-resizable",W="drift://set-skip-taskbar",P="drift://set-always-on-top",k="drift://set-title",L="drift://set-decorations",S="drift://get-props",D="drift://get-label",Z=[E,p,w,b,I,N,z,y,M,O,A,g,V,x,W,P,k,L,S],F=t=>{if(!Z.includes(t))throw new Error(`Event ${t} is not on the list of allowed events`)},U=[E],$=t=>{if(!U.includes(t))throw new Error(`Event ${t} is not on the list of allowed events`)},G=[S,D],J=t=>{if(!G.includes(t))throw new Error(`Command ${t} is not on the list of allowed commands`)},K=t=>{var e,o,r,l,u,d,T,f;return{x:(e=t.position)==null?void 0:e.x,y:(o=t.position)==null?void 0:o.y,width:(r=t.size)==null?void 0:r.width,height:(l=t.size)==null?void 0:l.height,center:t.center,minHeight:(u=t.minSize)==null?void 0:u.height,minWidth:(d=t.minSize)==null?void 0:d.width,maxHeight:(T=t.maxSize)==null?void 0:T.height,maxWidth:(f=t.maxSize)==null?void 0:f.width,resizable:t.resizable,fullscreen:t.fullscreen,skipTaskbar:t.skipTaskbar,title:t.title,show:t.visible,transparent:t.transparent,alwaysOnTop:t.alwaysOnTop}},X=t=>{const[e,o]=t.getSize(),[r,l]=t.getPosition();return{size:{width:e,height:o},position:{x:r,y:l},minimized:t.isMinimized(),maximized:t.isMaximized(),fullscreen:t.isFullScreen(),visible:t.isVisible(),resizable:t.isResizable(),skipTaskbar:!1,title:t.getTitle(),alwaysOnTop:t.isAlwaysOnTop(),decorations:!1}},j=({mainWindow:t,createWindow:e})=>{const o=new Map,r=new Map;o.set(_.MAIN_WINDOW,t.id),r.set(t.id,_.MAIN_WINDOW);const{ipcMain:l,BrowserWindow:u}=require("electron"),d=(s,i)=>l.on(s,(n,a)=>{const c=u.fromWebContents(n.sender);c!=null&&i(c,a)});l.on(b,(s,i)=>{const n=o.get(i);if(n==null)return;const a=u.fromId(n);a!=null&&(a.close(),o.delete(i),r.delete(n))}),l.handle(S,s=>{const i=u.fromWebContents(s.sender);return i==null?void 0:{...X(i),label:r.get(i.id)}}),l.handle(D,s=>{const i=u.fromWebContents(s.sender);if(i!=null)return r.get(i.id)});const T=(s,i,n)=>{s.on(i,H.o(n,500))},f=s=>{var i;for(const n of r.keys())(i=u.fromId(n))==null||i.webContents.send(E,s)},C=(s,i)=>{const n=(a,c)=>{T(i,a,()=>{f({action:q.runtimeSetWindowProps({label:s,...c(i)}),emitter:"WHITELIST"})})};n("resize",a=>{const[c,v]=a.getSize();return{size:{width:c,height:v}}}),n("move",()=>{const[a,c]=i.getPosition();return{position:{x:a,y:c}}}),n("minimize",()=>({minimized:!0})),n("restore",()=>({minimized:!1})),n("maximize",()=>({maximized:!0})),n("unmaximize",()=>({maximized:!1})),n("enter-full-screen",a=>(a.setWindowButtonVisibility(!0),{fullscreen:!0})),n("leave-full-screen",()=>(i.setWindowButtonVisibility(!1),{fullscreen:!1}))};C(_.MAIN_WINDOW,t),d(w,s=>s.focus()),d(I,s=>s.minimize()),d(N,s=>s.maximize()),d(z,(s,i)=>i?s.show():s.hide()),d(y,s=>s.setFullScreen(!0)),d(M,s=>s.center()),d(O,(s,{x:i,y:n})=>{s.setPosition(Math.round(i),Math.round(n))}),d(A,(s,{width:i,height:n})=>{s.setSize(Math.round(i),Math.round(n))}),d(g,(s,{width:i,height:n})=>s.setMinimumSize(Math.round(i),Math.round(n))),d(V,(s,{width:i,height:n})=>s.setMaximumSize(Math.round(i),Math.round(n))),d(x,(s,i)=>s.setResizable(i)),d(W,(s,i)=>s.setSkipTaskbar(i)),d(P,(s,i)=>s.setAlwaysOnTop(i)),d(k,(s,i)=>s.setTitle(i)),l.on(p,(s,i,n)=>{const a=e(K(n));o.set(i,a.id),r.set(a.id,i),C(i,a)}),l.on(E,(s,i,n)=>{if(i==null)return;if(n==null)return f(i);const a=o.get(n);if(a==null)return;const c=u.fromId(a);c!=null&&c.webContents.send(E,i)})},h="driftAPI",Y=()=>{const{ipcRenderer:t,contextBridge:e}=require("electron"),o={send:(r,...l)=>{F(r),t.send(r,...l)},invoke:async(r,...l)=>(J(r),await t.invoke(r,...l)),on:(r,l)=>{$(r),t.on(r,l)}};e.exposeInMainWorld(h,o)},Q=async()=>{if(!(h in window))throw new Error("Drift API not found. Make sure to call configurePreload in your preload script.");return await window[h].invoke(D)};class ee{constructor(){m(this,"_label","");m(this,"props",null);m(this,"api");if(!(h in window))throw new Error("Drift API not found. Make sure to call configurePreload in your preload script.");this.api=window[h]}async configure(){const{label:e,...o}=await this.api.invoke(S);this._label=e,this.props=o}label(){return this._label}isMain(){return this._label===_.MAIN_WINDOW}release(){}async emit(e,o){this.api.send(E,{...e,emitter:this.label()},o)}async subscribe(e){this.api.on(E,(o,r)=>e(r))}onCloseRequested(){}async create(e,o){this.api.send(p,e,JSON.parse(JSON.stringify(o)))}async close(e){this.api.send(b,e)}async listLabels(){return[]}async focus(){this.api.send(w)}async setMinimized(e){this.api.send(I,e)}async setMaximized(e){this.api.send(N,e)}async setVisible(e){this.api.send(z,e)}async setFullscreen(e){this.api.send(y,e)}async center(){this.api.send(M)}async setPosition(e){this.api.send(O,e)}async setSize(e){this.api.send(A,e)}async setMinSize(e){this.api.send(g,e)}async setMaxSize(e){this.api.send(V,e)}async setResizable(e){this.api.send(x,e)}async setSkipTaskbar(e){this.api.send(W,e)}async setAlwaysOnTop(e){this.api.send(P,e)}async setTitle(e){this.api.send(k,e)}async setDecorations(e){this.api.send(L,e)}async getProps(){if(this.props!=null)return this.props;throw new Error("Window not found")}}exports.ElectronRuntime=ee;exports.exposeAPI=Y;exports.getWindowLabel=Q;exports.listenOnMain=j;
|
package/dist/electron.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var R = Object.defineProperty;
|
|
2
2
|
var B = (t, e, o) => e in t ? R(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
3
|
var m = (t, e, o) => B(t, typeof e != "symbol" ? e + "" : e, o);
|
|
4
|
-
import { M as _ } from "./window-
|
|
5
|
-
import { r as H } from "./state-
|
|
4
|
+
import { M as _ } from "./window-DwJfMpbK.js";
|
|
5
|
+
import { r as H } from "./state-BX_5GHgM.js";
|
|
6
6
|
import { o as Z } from "./debounce-DOZKRZa9.js";
|
|
7
7
|
const E = "drift://action", S = "drift://create", w = "drift://focus", z = "drift://close", b = "drift://set-minimized", y = "drift://set-maximized", I = "drift://set-visible", N = "drift://set-fullscreen", M = "drift://center", O = "drift://set-position", g = "drift://set-size", A = "drift://set-min-size", V = "drift://set-max-size", x = "drift://set-resizable", k = "drift://set-skip-taskbar", C = "drift://set-always-on-top", P = "drift://set-title", L = "drift://set-decorations", p = "drift://get-props", W = "drift://get-label", F = [
|
|
8
8
|
E,
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("@reduxjs/toolkit"),o=require("./state-Cl8us-b9.cjs"),f=require("./window-DLsE0-fP.cjs"),h=require("./selectors-jksTA_U1.cjs"),C=new Error("request for lock canceled");var L=function(i,e,s,t){function n(a){return a instanceof s?a:new s(function(r){r(a)})}return new(s||(s=Promise))(function(a,r){function l(c){try{u(t.next(c))}catch(w){r(w)}}function d(c){try{u(t.throw(c))}catch(w){r(w)}}function u(c){c.done?a(c.value):n(c.value).then(l,d)}u((t=t.apply(i,e||[])).next())})};class N{constructor(e,s=C){this._value=e,this._cancelError=s,this._queue=[],this._weightedWaiters=[]}acquire(e=1,s=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((t,n)=>{const a={resolve:t,reject:n,weight:e,priority:s},r=T(this._queue,l=>s<=l.priority);r===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(r+1,0,a)})}runExclusive(e){return L(this,arguments,void 0,function*(s,t=1,n=0){const[a,r]=yield this.acquire(t,n);try{return yield s(a)}finally{r()}})}waitForUnlock(e=1,s=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,s)?Promise.resolve():new Promise(t=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),P(this._weightedWaiters[e-1],{resolve:t,priority:s})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const s=this._value;this._value-=e.weight,e.resolve([s,this._newReleaser(e.weight)])}_newReleaser(e){let s=!1;return()=>{s||(s=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const s=this._weightedWaiters[e-1];s&&(s.forEach(t=>t.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let s=this._value;s>0;s--){const t=this._weightedWaiters[s-1];if(!t)continue;const n=t.findIndex(a=>a.priority<=e);(n===-1?t:t.splice(0,n)).forEach(a=>a.resolve())}}}_couldLockImmediately(e,s){return(this._queue.length===0||this._queue[0].priority<s)&&e<=this._value}}function P(i,e){const s=T(i,t=>e.priority<=t.priority);i.splice(s+1,0,e)}function T(i,e){for(let s=i.length-1;s>=0;s--)if(e(i[s]))return s;return-1}var q=function(i,e,s,t){function n(a){return a instanceof s?a:new s(function(r){r(a)})}return new(s||(s=Promise))(function(a,r){function l(c){try{u(t.next(c))}catch(w){r(w)}}function d(c){try{u(t.throw(c))}catch(w){r(w)}}function u(c){c.done?a(c.value):n(c.value).then(l,d)}u((t=t.apply(i,e||[])).next())})};class D{constructor(e){this._semaphore=new N(1,e)}acquire(){return q(this,arguments,void 0,function*(e=0){const[,s]=yield this._semaphore.acquire(1,e);return s})}runExclusive(e,s=0){return this._semaphore.runExclusive(()=>e(),1,s)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const R=i=>[...new Set(i)],F=(i,e,s=!0)=>{const t=new Map;return i.forEach(n=>{const a=e(n);if(t.has(a)){if(s)return;t.delete(a)}t.set(a,n)}),Array.from(t.values())},V=Object.freeze(Object.defineProperty({__proto__:null,by:F,unique:R},Symbol.toStringTag,{value:"Module"})),I="DA@",M="://",j=(i,e)=>I.concat(e,M,i),Z=i=>{const[e,s]=i.split(M);if(s==null)return[i,""];const[,t]=e.split(I);return[s,t]},z=(i,e)=>({...i,type:j(i.type,e)}),U=i=>{const[e,s]=Z(i.type);return{emitted:s!=null&&s.length>0,emitter:s,action:{...i,type:e}}},K=i=>{const{centerCount:e,processCount:s,focusCount:t,stage:n,key:a,prerenderLabel:r,reserved:l,minimized:d,...u}=i;return u},Q=async(i,e,s,t)=>{const n=(await s.listLabels()).filter(c=>c!==f.MAIN_WINDOW),a=Object.keys(i.windows).filter(c=>c!==f.MAIN_WINDOW);o.group(t,"syncInitial"),o.log(t,"existing windows in runtime",n.sort()),o.log(t,"non-main windows in state",a.sort()),o.groupEnd(t);const r=V.unique([...n,...a]);for(const c of r)!n.includes(c)&&s.isMain()?(o.log(t,"state window not in runtime, creating",c),await v(s,c,i.windows[c],t)):a.includes(c)||(o.log(t,"runtime window not in state, closing",c),await y(s,c,t));const l=s.label(),d=i.windows[l];if(d==null)return;const u={...f.INITIAL_WINDOW_STATE};await k(u,d,s,t),e(o.runtimeSetWindowProps({label:s.label(),...await s.getProps()}))},X=async(i,e,s,t)=>{o.log(t,"sync",i,e),s.isMain()&&await $(i,e,s,t);const n=i.windows[s.label()],a=e.windows[s.label()];n==null||a==null||await k(n,a,s,t)},k=async(i,e,s,t)=>{const n=[];e.title!=null&&e.title!==i.title&&n.push(["title",{prev:i.title,next:e.title},async()=>s.setTitle(e.title)]);const a=e.visible!=null&&e.visible!==i.visible,r=e.visible===!1,l=()=>n.push(["visible",{prev:i.visible,next:e.visible},async()=>{if(await s.setVisible(e.visible),e.visible===!1)return;let d=e.position;d??(d=(await s.getProps()).position),await s.setPosition(f.J.translate(d,{x:1,y:1})),await s.setPosition(d)}]);if(a&&r&&l(),e.skipTaskbar!=null&&e.skipTaskbar!==i.skipTaskbar&&n.push(["skipTaskbar",{prev:i.skipTaskbar,next:e.skipTaskbar},async()=>await s.setSkipTaskbar(e.skipTaskbar)]),e.maximized!=null&&e.maximized!==i.maximized&&n.push(["maximized",{prev:i.maximized,next:e.maximized},async()=>await s.setMaximized(e.maximized)]),e.fullscreen!=null&&e.fullscreen!==i.fullscreen&&n.push(["fullscreen",{prev:i.fullscreen,next:e.fullscreen},async()=>await s.setFullscreen(e.fullscreen)]),e.centerCount!==i.centerCount&&n.push(["center",{prev:i.centerCount,next:e.centerCount},async()=>s.center()]),e.minimized!=null&&e.minimized!==i.minimized&&n.push(["minimized",{prev:i.minimized,next:e.minimized},async()=>await s.setMinimized(e.minimized)]),e.resizable!=null&&e.resizable!==i.resizable&&n.push(["resizable",{prev:i.resizable,next:e.resizable},async()=>await s.setResizable(e.resizable)]),e.minSize!=null&&!f._.equals(e.minSize,i.minSize)&&n.push(["minSize",{prev:i.minSize,next:e.minSize},async()=>await s.setMinSize(e.minSize)]),e.maxSize!=null&&!f._.equals(e.maxSize,i.maxSize)&&n.push(["maxSize",{prev:i.maxSize,next:e.maxSize},async()=>await s.setMaxSize(e.maxSize)]),e.size!=null&&!f._.equals(e.size,i.size)&&n.push(["size",{prev:i.size,next:e.size},async()=>await s.setSize(e.size)]),e.position!=null&&!f._.equals(e.position,i.position)&&n.push(["position",{prev:i.position,next:e.position},async()=>await s.setPosition(e.position)]),e.focusCount!==i.focusCount&&n.push(["setVisible",{prev:i.visible,next:e.visible},async()=>await s.setVisible(!0)],["focus",{prev:i.focusCount,next:e.focusCount},async()=>await s.focus()]),e.decorations!=null&&e.decorations!==i.decorations&&n.push(["decorations",{prev:i.decorations,next:e.decorations},async()=>await s.setDecorations(e.decorations)]),e.alwaysOnTop!=null&&e.alwaysOnTop!==i.alwaysOnTop&&n.push(["alwaysOnTop",{prev:i.alwaysOnTop,next:e.alwaysOnTop},async()=>await s.setAlwaysOnTop(e.alwaysOnTop)]),a&&!r&&l(),n.length!==0){o.group(t,`syncCurrent, label: ${s.label()}, key: ${e.key}`);for(const[d,{prev:u,next:c}]of n)o.log(t,d,u,"->",c);o.groupEnd(t);for(const[,,d]of n)await d()}},$=async(i,e,s,t)=>{const n=Object.keys(i.windows).filter(l=>!(l in e.windows)),a=Object.keys(e.windows).filter(l=>!(l in i.windows)),r=s.isMain();if(r&&n.length>0)for(const l of n)o.log(t,"syncMain","closing",l),l===f.MAIN_WINDOW&&await Promise.all(Object.keys(e.windows).filter(d=>d!==f.MAIN_WINDOW).map(async d=>await y(s,d,t))),await y(s,l,t);if(r&&a.length>0)for(const l of a)await v(s,l,e.windows[l],t)},v=async(i,e,s,t)=>(o.log(t,"createWindow",s),await i.create(e,K(s))),y=async(i,e,s)=>(o.log(s,"closeWindow",e),await i.close(e)),m="[drift] - unexpected undefined action",g="[drift] - unexpected undefined action type",_=i=>{if(i.emitted??(i.emitted=!1),i.action==null)throw console.warn(m,i),new Error(m);if(i.action.type==null||i.action.type.length===0)throw console.warn(g,i),new Error(g)},J=new D,Y=[o.runtimeSetWindowProps.type,o.reloadWindow.type],B=(i,e=!1)=>s=>t=>n=>{let{action:a,emitted:r,emitter:l}=U(n);const d=i.label();_({action:n,emitted:r,emitter:l});const u=o.isDriftAction(a.type);if(u&&o.log(e,"[drift] - middleware",{action:a,emitted:r,emitter:l,host:d}),l===i.label())return;const c=u&&!Y.includes(a.type);let w=null;u&&(w=s.getState().drift,a=o.assignLabel(a,w));const p=t(a),S=c?s.getState().drift:null,O=o.shouldEmit(r,a.type);return J.runExclusive(async()=>{try{w!==null&&S!==null&&await X(w,S,i,e),O&&await i.emit({action:a})}catch(b){o.log(e,"[drift] - ERROR",{error:b.message,action:a,emitted:r,emitter:l,host:d}),s.dispatch(o.setWindowError({key:d,message:b.message}))}}),p},G=(i,e,s=!1)=>t=>{const n=i!=null?typeof i=="function"?i(t):i:t();return[B(e,s),...n]},H=async({runtime:i,preloadedState:e,middleware:s,debug:t=!1,enablePrerender:n=!0,defaultWindowProps:a,...r})=>{await i.configure();let l;l=A.configureStore({...r,preloadedState:await x(t,i,()=>l,a,e),middleware:G(s,i,t)}),await Q(l.getState().drift,l.dispatch,i,t);const d=i.label();return l.dispatch(o.internalSetInitial({enablePrerender:n,defaultWindowProps:a,debug:t,label:d})),l.dispatch(o.setWindowStage({stage:"created"})),i.onCloseRequested(()=>l==null?void 0:l.dispatch(o.closeWindow({}))),l},x=async(i,e,s,t,n)=>e.isMain()?(await e.subscribe(({action:r,emitter:l,sendState:d})=>{const u=s();if(u==null)return;if(r!=null){_({action:r,emitter:l}),u.dispatch(z(r,l));return}const c=u.getState();d===!0&&e.emit({state:c},l)}),typeof n=="function"?E(t,i,await n()):E(t,i,n)):await new Promise((r,l)=>{(async()=>{try{await e.subscribe(({action:u,emitter:c,state:w})=>{const p=s();if(p==null)return w!=null?r(w):void 0;u!=null&&(_({action:u,emitter:c}),p.dispatch(z(u,c)))}),await e.emit({sendState:!0},f.MAIN_WINDOW)}catch(u){l(u)}})()}),W=H,E=(i,e,s)=>{if(s==null)return s;const t=s[o.SLICE_NAME];return t.config.debug=e??t.config.debug,t.windows=Object.fromEntries(Object.entries(t.windows).filter(([,n])=>n.reserved).map(([n,a])=>((i==null?void 0:i.visible)!=null&&(a.visible=i.visible),a.focusCount=0,a.centerCount=0,a.processCount=0,[n,a]))),s},ee=Object.freeze(Object.defineProperty({__proto__:null,MAIN_WINDOW:f.MAIN_WINDOW,SLICE_NAME:o.SLICE_NAME,ZERO_SLICE_STATE:o.ZERO_SLICE_STATE,closeWindow:o.closeWindow,completeProcess:o.completeProcess,configureStore:W,createWindow:o.createWindow,focusWindow:o.focusWindow,reducer:o.reducer,registerProcess:o.registerProcess,reloadWindow:o.reloadWindow,selectSliceState:h.selectSliceState,selectWindow:h.selectWindow,selectWindowAttribute:h.selectWindowAttribute,selectWindowKey:h.selectWindowKey,selectWindowLabel:h.selectWindowLabel,selectWindows:h.selectWindows,setWindowAlwaysOnTop:o.setWindowAlwaysOnTop,setWindowDecorations:o.setWindowDecorations,setWindowFullscreen:o.setWindowFullscreen,setWindowMaxSize:o.setWindowMaxSize,setWindowMaximized:o.setWindowMaximized,setWindowMinSize:o.setWindowMinSize,setWindowMinimized:o.setWindowMinimized,setWindowPosition:o.setWindowPosition,setWindowProps:o.setWindowProps,setWindowResizable:o.setWindowResizable,setWindowSize:o.setWindowSize,setWindowSkipTaskbar:o.setWindowSkipTaskbar,setWindowStage:o.setWindowStage,setWindowTitle:o.setWindowTitle,setWindowVisible:o.setWindowVisible,windowPropsZ:f.windowPropsZ},Symbol.toStringTag,{value:"Module"}));exports.SLICE_NAME=o.SLICE_NAME;exports.ZERO_SLICE_STATE=o.ZERO_SLICE_STATE;exports.closeWindow=o.closeWindow;exports.completeProcess=o.completeProcess;exports.createWindow=o.createWindow;exports.focusWindow=o.focusWindow;exports.reducer=o.reducer;exports.registerProcess=o.registerProcess;exports.reloadWindow=o.reloadWindow;exports.setWindowAlwaysOnTop=o.setWindowAlwaysOnTop;exports.setWindowDecorations=o.setWindowDecorations;exports.setWindowFullscreen=o.setWindowFullscreen;exports.setWindowMaxSize=o.setWindowMaxSize;exports.setWindowMaximized=o.setWindowMaximized;exports.setWindowMinSize=o.setWindowMinSize;exports.setWindowMinimized=o.setWindowMinimized;exports.setWindowPosition=o.setWindowPosition;exports.setWindowProps=o.setWindowProps;exports.setWindowResizable=o.setWindowResizable;exports.setWindowSize=o.setWindowSize;exports.setWindowSkipTaskbar=o.setWindowSkipTaskbar;exports.setWindowStage=o.setWindowStage;exports.setWindowTitle=o.setWindowTitle;exports.setWindowVisible=o.setWindowVisible;exports.MAIN_WINDOW=f.MAIN_WINDOW;exports.windowPropsZ=f.windowPropsZ;exports.selectSliceState=h.selectSliceState;exports.selectWindow=h.selectWindow;exports.selectWindowAttribute=h.selectWindowAttribute;exports.selectWindowKey=h.selectWindowKey;exports.selectWindowLabel=h.selectWindowLabel;exports.selectWindows=h.selectWindows;exports.Drift=ee;exports.configureStore=W;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("@reduxjs/toolkit"),o=require("./state-xseZCh_u.cjs"),f=require("./window-Bj8OM9F9.cjs"),h=require("./selectors-CGCIf0Ac.cjs"),C=new Error("request for lock canceled");var L=function(i,e,s,t){function n(a){return a instanceof s?a:new s(function(r){r(a)})}return new(s||(s=Promise))(function(a,r){function l(c){try{u(t.next(c))}catch(w){r(w)}}function d(c){try{u(t.throw(c))}catch(w){r(w)}}function u(c){c.done?a(c.value):n(c.value).then(l,d)}u((t=t.apply(i,e||[])).next())})};class N{constructor(e,s=C){this._value=e,this._cancelError=s,this._queue=[],this._weightedWaiters=[]}acquire(e=1,s=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((t,n)=>{const a={resolve:t,reject:n,weight:e,priority:s},r=T(this._queue,l=>s<=l.priority);r===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(r+1,0,a)})}runExclusive(e){return L(this,arguments,void 0,function*(s,t=1,n=0){const[a,r]=yield this.acquire(t,n);try{return yield s(a)}finally{r()}})}waitForUnlock(e=1,s=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,s)?Promise.resolve():new Promise(t=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),P(this._weightedWaiters[e-1],{resolve:t,priority:s})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const s=this._value;this._value-=e.weight,e.resolve([s,this._newReleaser(e.weight)])}_newReleaser(e){let s=!1;return()=>{s||(s=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const s=this._weightedWaiters[e-1];s&&(s.forEach(t=>t.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let s=this._value;s>0;s--){const t=this._weightedWaiters[s-1];if(!t)continue;const n=t.findIndex(a=>a.priority<=e);(n===-1?t:t.splice(0,n)).forEach(a=>a.resolve())}}}_couldLockImmediately(e,s){return(this._queue.length===0||this._queue[0].priority<s)&&e<=this._value}}function P(i,e){const s=T(i,t=>e.priority<=t.priority);i.splice(s+1,0,e)}function T(i,e){for(let s=i.length-1;s>=0;s--)if(e(i[s]))return s;return-1}var q=function(i,e,s,t){function n(a){return a instanceof s?a:new s(function(r){r(a)})}return new(s||(s=Promise))(function(a,r){function l(c){try{u(t.next(c))}catch(w){r(w)}}function d(c){try{u(t.throw(c))}catch(w){r(w)}}function u(c){c.done?a(c.value):n(c.value).then(l,d)}u((t=t.apply(i,e||[])).next())})};class D{constructor(e){this._semaphore=new N(1,e)}acquire(){return q(this,arguments,void 0,function*(e=0){const[,s]=yield this._semaphore.acquire(1,e);return s})}runExclusive(e,s=0){return this._semaphore.runExclusive(()=>e(),1,s)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const R=i=>[...new Set(i)],F=(i,e,s=!0)=>{const t=new Map;return i.forEach(n=>{const a=e(n);if(t.has(a)){if(s)return;t.delete(a)}t.set(a,n)}),Array.from(t.values())},V=Object.freeze(Object.defineProperty({__proto__:null,by:F,unique:R},Symbol.toStringTag,{value:"Module"})),I="DA@",M="://",j=(i,e)=>I.concat(e,M,i),Z=i=>{const[e,s]=i.split(M);if(s==null)return[i,""];const[,t]=e.split(I);return[s,t]},z=(i,e)=>({...i,type:j(i.type,e)}),U=i=>{const[e,s]=Z(i.type);return{emitted:s!=null&&s.length>0,emitter:s,action:{...i,type:e}}},K=i=>{const{centerCount:e,processCount:s,focusCount:t,stage:n,key:a,prerenderLabel:r,reserved:l,minimized:d,...u}=i;return u},Q=async(i,e,s,t)=>{const n=(await s.listLabels()).filter(c=>c!==f.MAIN_WINDOW),a=Object.keys(i.windows).filter(c=>c!==f.MAIN_WINDOW);o.group(t,"syncInitial"),o.log(t,"existing windows in runtime",n.sort()),o.log(t,"non-main windows in state",a.sort()),o.groupEnd(t);const r=V.unique([...n,...a]);for(const c of r)!n.includes(c)&&s.isMain()?(o.log(t,"state window not in runtime, creating",c),await v(s,c,i.windows[c],t)):a.includes(c)||(o.log(t,"runtime window not in state, closing",c),await y(s,c,t));const l=s.label(),d=i.windows[l];if(d==null)return;const u={...f.INITIAL_WINDOW_STATE};await k(u,d,s,t),e(o.runtimeSetWindowProps({label:s.label(),...await s.getProps()}))},X=async(i,e,s,t)=>{o.log(t,"sync",i,e),s.isMain()&&await $(i,e,s,t);const n=i.windows[s.label()],a=e.windows[s.label()];n==null||a==null||await k(n,a,s,t)},k=async(i,e,s,t)=>{const n=[];e.title!=null&&e.title!==i.title&&n.push(["title",{prev:i.title,next:e.title},async()=>s.setTitle(e.title)]);const a=e.visible!=null&&e.visible!==i.visible,r=e.visible===!1,l=()=>n.push(["visible",{prev:i.visible,next:e.visible},async()=>{if(await s.setVisible(e.visible),e.visible===!1)return;let d=e.position;d??(d=(await s.getProps()).position),await s.setPosition(f.J.translate(d,{x:1,y:1})),await s.setPosition(d)}]);if(a&&r&&l(),e.skipTaskbar!=null&&e.skipTaskbar!==i.skipTaskbar&&n.push(["skipTaskbar",{prev:i.skipTaskbar,next:e.skipTaskbar},async()=>await s.setSkipTaskbar(e.skipTaskbar)]),e.maximized!=null&&e.maximized!==i.maximized&&n.push(["maximized",{prev:i.maximized,next:e.maximized},async()=>await s.setMaximized(e.maximized)]),e.fullscreen!=null&&e.fullscreen!==i.fullscreen&&n.push(["fullscreen",{prev:i.fullscreen,next:e.fullscreen},async()=>await s.setFullscreen(e.fullscreen)]),e.centerCount!==i.centerCount&&n.push(["center",{prev:i.centerCount,next:e.centerCount},async()=>s.center()]),e.minimized!=null&&e.minimized!==i.minimized&&n.push(["minimized",{prev:i.minimized,next:e.minimized},async()=>await s.setMinimized(e.minimized)]),e.resizable!=null&&e.resizable!==i.resizable&&n.push(["resizable",{prev:i.resizable,next:e.resizable},async()=>await s.setResizable(e.resizable)]),e.minSize!=null&&!f._.equals(e.minSize,i.minSize)&&n.push(["minSize",{prev:i.minSize,next:e.minSize},async()=>await s.setMinSize(e.minSize)]),e.maxSize!=null&&!f._.equals(e.maxSize,i.maxSize)&&n.push(["maxSize",{prev:i.maxSize,next:e.maxSize},async()=>await s.setMaxSize(e.maxSize)]),e.size!=null&&!f._.equals(e.size,i.size)&&n.push(["size",{prev:i.size,next:e.size},async()=>await s.setSize(e.size)]),e.position!=null&&!f._.equals(e.position,i.position)&&n.push(["position",{prev:i.position,next:e.position},async()=>await s.setPosition(e.position)]),e.focusCount!==i.focusCount&&n.push(["setVisible",{prev:i.visible,next:e.visible},async()=>await s.setVisible(!0)],["focus",{prev:i.focusCount,next:e.focusCount},async()=>await s.focus()]),e.decorations!=null&&e.decorations!==i.decorations&&n.push(["decorations",{prev:i.decorations,next:e.decorations},async()=>await s.setDecorations(e.decorations)]),e.alwaysOnTop!=null&&e.alwaysOnTop!==i.alwaysOnTop&&n.push(["alwaysOnTop",{prev:i.alwaysOnTop,next:e.alwaysOnTop},async()=>await s.setAlwaysOnTop(e.alwaysOnTop)]),a&&!r&&l(),n.length!==0){o.group(t,`syncCurrent, label: ${s.label()}, key: ${e.key}`);for(const[d,{prev:u,next:c}]of n)o.log(t,d,u,"->",c);o.groupEnd(t);for(const[,,d]of n)await d()}},$=async(i,e,s,t)=>{const n=Object.keys(i.windows).filter(l=>!(l in e.windows)),a=Object.keys(e.windows).filter(l=>!(l in i.windows)),r=s.isMain();if(r&&n.length>0)for(const l of n)o.log(t,"syncMain","closing",l),l===f.MAIN_WINDOW&&await Promise.all(Object.keys(e.windows).filter(d=>d!==f.MAIN_WINDOW).map(async d=>await y(s,d,t))),await y(s,l,t);if(r&&a.length>0)for(const l of a)await v(s,l,e.windows[l],t)},v=async(i,e,s,t)=>(o.log(t,"createWindow",s),await i.create(e,K(s))),y=async(i,e,s)=>(o.log(s,"closeWindow",e),await i.close(e)),m="[drift] - unexpected undefined action",g="[drift] - unexpected undefined action type",_=i=>{if(i.emitted??(i.emitted=!1),i.action==null)throw console.warn(m,i),new Error(m);if(i.action.type==null||i.action.type.length===0)throw console.warn(g,i),new Error(g)},J=new D,Y=[o.runtimeSetWindowProps.type,o.reloadWindow.type],B=(i,e=!1)=>s=>t=>n=>{let{action:a,emitted:r,emitter:l}=U(n);const d=i.label();_({action:n,emitted:r,emitter:l});const u=o.isDriftAction(a.type);if(u&&o.log(e,"[drift] - middleware",{action:a,emitted:r,emitter:l,host:d}),l===i.label())return;const c=u&&!Y.includes(a.type);let w=null;u&&(w=s.getState().drift,a=o.assignLabel(a,w));const p=t(a),S=c?s.getState().drift:null,O=o.shouldEmit(r,a.type);return J.runExclusive(async()=>{try{w!==null&&S!==null&&await X(w,S,i,e),O&&await i.emit({action:a})}catch(b){o.log(e,"[drift] - ERROR",{error:b.message,action:a,emitted:r,emitter:l,host:d}),s.dispatch(o.setWindowError({key:d,message:b.message}))}}),p},G=(i,e,s=!1)=>t=>{const n=i!=null?typeof i=="function"?i(t):i:t();return[B(e,s),...n]},H=async({runtime:i,preloadedState:e,middleware:s,debug:t=!1,enablePrerender:n=!0,defaultWindowProps:a,...r})=>{await i.configure();let l;l=A.configureStore({...r,preloadedState:await x(t,i,()=>l,a,e),middleware:G(s,i,t)}),await Q(l.getState().drift,l.dispatch,i,t);const d=i.label();return l.dispatch(o.internalSetInitial({enablePrerender:n,defaultWindowProps:a,debug:t,label:d})),l.dispatch(o.setWindowStage({stage:"created"})),i.onCloseRequested(()=>l==null?void 0:l.dispatch(o.closeWindow({}))),l},x=async(i,e,s,t,n)=>e.isMain()?(await e.subscribe(({action:r,emitter:l,sendState:d})=>{const u=s();if(u==null)return;if(r!=null){_({action:r,emitter:l}),u.dispatch(z(r,l));return}const c=u.getState();d===!0&&e.emit({state:c},l)}),typeof n=="function"?E(t,i,await n()):E(t,i,n)):await new Promise((r,l)=>{(async()=>{try{await e.subscribe(({action:u,emitter:c,state:w})=>{const p=s();if(p==null)return w!=null?r(w):void 0;u!=null&&(_({action:u,emitter:c}),p.dispatch(z(u,c)))}),await e.emit({sendState:!0},f.MAIN_WINDOW)}catch(u){l(u)}})()}),W=H,E=(i,e,s)=>{if(s==null)return s;const t=s[o.SLICE_NAME];return t.config.debug=e??t.config.debug,t.windows=Object.fromEntries(Object.entries(t.windows).filter(([,n])=>n.reserved).map(([n,a])=>((i==null?void 0:i.visible)!=null&&(a.visible=i.visible),a.focusCount=0,a.centerCount=0,a.processCount=0,[n,a]))),s},ee=Object.freeze(Object.defineProperty({__proto__:null,MAIN_WINDOW:f.MAIN_WINDOW,SLICE_NAME:o.SLICE_NAME,ZERO_SLICE_STATE:o.ZERO_SLICE_STATE,closeWindow:o.closeWindow,completeProcess:o.completeProcess,configureStore:W,createWindow:o.createWindow,focusWindow:o.focusWindow,reducer:o.reducer,registerProcess:o.registerProcess,reloadWindow:o.reloadWindow,selectSliceState:h.selectSliceState,selectWindow:h.selectWindow,selectWindowAttribute:h.selectWindowAttribute,selectWindowKey:h.selectWindowKey,selectWindowLabel:h.selectWindowLabel,selectWindows:h.selectWindows,setWindowAlwaysOnTop:o.setWindowAlwaysOnTop,setWindowDecorations:o.setWindowDecorations,setWindowFullscreen:o.setWindowFullscreen,setWindowMaxSize:o.setWindowMaxSize,setWindowMaximized:o.setWindowMaximized,setWindowMinSize:o.setWindowMinSize,setWindowMinimized:o.setWindowMinimized,setWindowPosition:o.setWindowPosition,setWindowProps:o.setWindowProps,setWindowResizable:o.setWindowResizable,setWindowSize:o.setWindowSize,setWindowSkipTaskbar:o.setWindowSkipTaskbar,setWindowStage:o.setWindowStage,setWindowTitle:o.setWindowTitle,setWindowVisible:o.setWindowVisible,windowPropsZ:f.windowPropsZ},Symbol.toStringTag,{value:"Module"}));exports.SLICE_NAME=o.SLICE_NAME;exports.ZERO_SLICE_STATE=o.ZERO_SLICE_STATE;exports.closeWindow=o.closeWindow;exports.completeProcess=o.completeProcess;exports.createWindow=o.createWindow;exports.focusWindow=o.focusWindow;exports.reducer=o.reducer;exports.registerProcess=o.registerProcess;exports.reloadWindow=o.reloadWindow;exports.setWindowAlwaysOnTop=o.setWindowAlwaysOnTop;exports.setWindowDecorations=o.setWindowDecorations;exports.setWindowFullscreen=o.setWindowFullscreen;exports.setWindowMaxSize=o.setWindowMaxSize;exports.setWindowMaximized=o.setWindowMaximized;exports.setWindowMinSize=o.setWindowMinSize;exports.setWindowMinimized=o.setWindowMinimized;exports.setWindowPosition=o.setWindowPosition;exports.setWindowProps=o.setWindowProps;exports.setWindowResizable=o.setWindowResizable;exports.setWindowSize=o.setWindowSize;exports.setWindowSkipTaskbar=o.setWindowSkipTaskbar;exports.setWindowStage=o.setWindowStage;exports.setWindowTitle=o.setWindowTitle;exports.setWindowVisible=o.setWindowVisible;exports.MAIN_WINDOW=f.MAIN_WINDOW;exports.windowPropsZ=f.windowPropsZ;exports.selectSliceState=h.selectSliceState;exports.selectWindow=h.selectWindow;exports.selectWindowAttribute=h.selectWindowAttribute;exports.selectWindowKey=h.selectWindowKey;exports.selectWindowLabel=h.selectWindowLabel;exports.selectWindows=h.selectWindows;exports.Drift=ee;exports.configureStore=W;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { configureStore as j } from "@reduxjs/toolkit";
|
|
2
|
-
import { g, l as d, a as T, r as E, b as I, i as N, c as F, s as V, d as $, e as U, f as C, h as q, S as M, Z as Q, j as Z, k as K, m as X, n as B, o as J, p as Y, q as G, t as H, u as x, v as W, w as ee, x as se, y as ie, z as te, A as ae, B as oe, C as ne, D as le, E as re } from "./state-
|
|
3
|
-
import { M as w, _ as p, J as ce, I as ue, w as fe } from "./window-
|
|
4
|
-
import { s as de, a as we, b as he, c as pe, d as ye, e as _e } from "./selectors
|
|
2
|
+
import { g, l as d, a as T, r as E, b as I, i as N, c as F, s as V, d as $, e as U, f as C, h as q, S as M, Z as Q, j as Z, k as K, m as X, n as B, o as J, p as Y, q as G, t as H, u as x, v as W, w as ee, x as se, y as ie, z as te, A as ae, B as oe, C as ne, D as le, E as re } from "./state-BX_5GHgM.js";
|
|
3
|
+
import { M as w, _ as p, J as ce, I as ue, w as fe } from "./window-DwJfMpbK.js";
|
|
4
|
+
import { s as de, a as we, b as he, c as pe, d as ye, e as _e } from "./selectors-B00IQPYW.js";
|
|
5
5
|
const be = new Error("request for lock canceled");
|
|
6
6
|
var me = function(i, e, s, t) {
|
|
7
7
|
function a(o) {
|
package/dist/noop.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./window-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./window-Bj8OM9F9.cjs");class s{async configure(){}isMain(){return!0}label(){return e.MAIN_WINDOW}async emit(){}async subscribe(){}onCloseRequested(){}async listLabels(){return[e.MAIN_WINDOW]}async create(){}async close(){}async focus(){}async setMinimized(){}async setMaximized(){}async setVisible(){}async setFullscreen(){}async center(){}async setPosition(){}async setSize(){}async setMinSize(){}async setMaxSize(){}async setResizable(){}async setSkipTaskbar(){}async setAlwaysOnTop(){}async setTitle(){}async setDecorations(){}async getProps(){return{visible:!0,focus:!0,maximized:!1,minimized:!1,fullscreen:!1,position:{x:0,y:0},size:{width:800,height:600}}}}exports.NoopRuntime=s;
|
package/dist/noop.js
CHANGED
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("react-redux"),a=require("proxy-memoize"),d=require("./selectors-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("react-redux"),a=require("proxy-memoize"),d=require("./selectors-CGCIf0Ac.cjs"),i=require("./state-xseZCh_u.cjs"),y=e=>u.useSelector(n.useCallback(a.memoize(s=>d.selectWindow(s,e)),[e])),w=()=>u.useSelector(n.useCallback(a.memoize(d.selectWindows),[])),S=e=>u.useSelector(n.useCallback(a.memoize(s=>d.selectWindowKey(s,e)),[e])),W=(e,s)=>u.useSelector(n.useCallback(a.memoize(t=>d.selectWindowAttribute(t,e,s)),[e,s])),m=(e,s)=>{const t=y(s),o=u.useDispatch(),c=n.useRef(null);n.useEffect(()=>{if(t==null)return;const{stage:r}=t;if(r==="created"&&c.current==null){const l=e();l!=null&&(c.current=l),o(i.registerProcess({key:t.key}))}else(r==="closing"||r==="reloading")&&c.current!=null&&(c.current(),c.current=null,o(i.completeProcess({key:t.key})))},[t])},h=(e,s)=>{const t=y(s),o=u.useDispatch(),c=n.useRef(null),r=n.useRef(!1);n.useEffect(()=>{if(t==null)return;const{stage:l}=t;if(l==="created"&&c.current==null)r.current=!0,e().then(f=>{c.current=f??(async()=>{}),o(i.registerProcess({key:t.key}))}).catch(console.error).finally(()=>{r.current=!1});else if((l==="closing"||l==="reloading")&&c.current!=null){const f=c.current;c.current=null,f().then(()=>{c.current=null}).catch(console.error).finally(()=>{o(i.completeProcess({key:t.key}))})}},[t])},g=({store:e,emptyContent:s=null,children:t})=>{const[o,c]=n.useState(null),[r,l]=n.useState(null);if(r!=null)throw l(null),r;return o==null?(e instanceof Promise?e.then(c).catch(l):c(e),s):n.createElement(u.Provider,{store:o},t)};exports.Provider=g;exports.useAsyncWindowLifecycle=h;exports.useSelectWindow=y;exports.useSelectWindowAttribute=W;exports.useSelectWindowKey=S;exports.useSelectWindows=w;exports.useWindowLifecycle=m;
|
package/dist/react.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useCallback as l, useRef as f, useEffect as m, useState as d, createElement as W } from "react";
|
|
2
2
|
import { useSelector as u, useDispatch as y, Provider as g } from "react-redux";
|
|
3
3
|
import { memoize as i } from "proxy-memoize";
|
|
4
|
-
import { a as k, e as S, c as P, b as v } from "./selectors
|
|
5
|
-
import { o as w, j as p } from "./state-
|
|
4
|
+
import { a as k, e as S, c as P, b as v } from "./selectors-B00IQPYW.js";
|
|
5
|
+
import { o as w, j as p } from "./state-BX_5GHgM.js";
|
|
6
6
|
const h = (e) => u(
|
|
7
7
|
l(
|
|
8
8
|
i((r) => k(r, e)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("./window-
|
|
1
|
+
"use strict";const i=require("./window-Bj8OM9F9.cjs"),s=n=>n.drift,r=n=>Object.values(s(n).windows),c=(n,e)=>{const t=s(n);if(e==null)return t.windows[t.label];let l=t.windows[e];if(l!=null)return l;const o=t.keyLabels[e];return l=t.windows[o],l==null&&e!=null?null:l??t.windows[t.label]},w=(n,e)=>{const t=s(n);if(e==null)return t.labelKeys[t.label];const l=t.labelKeys[e];return l==null&&e==i.MAIN_WINDOW?i.MAIN_WINDOW:l},d=(n,e,t)=>{var l;return((l=c(n,e))==null?void 0:l[t])??null},u=(n,e)=>s(n).keyLabels[e];exports.selectSliceState=s;exports.selectWindow=c;exports.selectWindowAttribute=d;exports.selectWindowKey=w;exports.selectWindowLabel=u;exports.selectWindows=r;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSlice as R } from "@reduxjs/toolkit";
|
|
2
|
-
import { o as W, O as _, M as f, I as v, P as A, a as O, L as S, $ as p, J as k } from "./window-
|
|
2
|
+
import { o as W, O as _, M as f, I as v, P as A, a as O, L as S, $ as p, J as k } from "./window-DwJfMpbK.js";
|
|
3
3
|
const y = (e = !1, ...n) => {
|
|
4
4
|
e && console.log(...n);
|
|
5
5
|
}, D = (e = !1, ...n) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const _=require("@reduxjs/toolkit"),a=require("./window-
|
|
1
|
+
"use strict";const _=require("@reduxjs/toolkit"),a=require("./window-Bj8OM9F9.cjs"),p=(e=!1,...n)=>{e&&console.log(...n)},A=(e=!1,...n)=>{e&&console.group(...n)},y=e=>{e&&console.groupEnd()},v=(e,n,t=".")=>{const o=e.split(t);return o.map((r,s)=>{const i=n(r,s,o);return i==null?null:typeof i=="string"?i:i.join(t)}).filter(r=>r!=null).join(t)},k=(e,n,t={optional:!1,separator:"."})=>{t.separator??(t.separator=".");const{optional:o,getter:r=(d,l)=>d[l]}=t,s=n.split(t.separator);if(s.length===1&&s[0]==="")return e;let i=e;for(const d of s){const l=r(i,d);if(l==null){if(o)return null;throw new Error(`Path ${n} does not exist. ${d} is null`)}i=l}return i},D=(e,n,t)=>{const o=n.split(".");let r=e;for(let s=0;s<o.length-1;s++){const i=o[s];r[i]??(r[i]={}),r=r[i]}try{r[o[o.length-1]]=t}catch(s){throw console.error("failed to set value",t,"at path",n,"on object",e),s}},M=(e,n)=>{const t=n.split(".");let o=e;for(let r=0;r<t.length-1;r++){const s=t[r];if(o[s]==null)return;o=o[s]}if(Array.isArray(o)){const r=parseInt(t[t.length-1]);if(isNaN(r))return;o.splice(r,1);return}delete o[t[t.length-1]]},j=(e,n)=>{const t=e.split(".");return n<0?t[t.length+n]:t[n]},R=(e,n)=>{try{return k(e,n),!0}catch{return!1}},C=(e,n)=>{if(n.length===0)return!0;const t=e.split("."),o=n.split(".");if(o.length>t.length)return!1;for(let r=0;r<o.length;r++){const s=t[r],i=o[r];if(i!=="*"&&s!==i)return!1}return!0},x=e=>JSON.parse(JSON.stringify(e)),$=(e,...n)=>(n.forEach(t=>{let o=e;const r=t.split(".");r.forEach((s,i)=>{i===r.length-1?delete o[s]:s in o&&(o=o[s])})}),e),q=(e,n,t="")=>{const o={},r=(s,i,d)=>{if(typeof s!=typeof i||s===null||i===null){o[d]=[s,i];return}if(typeof s=="object"&&typeof i=="object")if(Array.isArray(s)&&Array.isArray(i)){if(s.length!==i.length){o[d]=[s,i];return}for(let l=0;l<s.length;l++)r(s[l],i[l],`${d}[${l}]`)}else new Set([...Object.keys(s),...Object.keys(i)]).forEach(l=>{r(s[l],i[l],d!==""?`${d}.${l}`:l)});else s!==i&&(o[d]=[s,i])};return r(e,n,t),o},g=(e,n)=>{const t=Array.isArray(e),o=Array.isArray(n);if(t!==o)return!1;if(t&&o){const i=e,d=n;if(i.length!==d.length)return!1;for(let l=0;l<i.length;l++)if(!g(i[l],d[l]))return!1;return!0}if(e==null||n==null||typeof e!="object"||typeof n!="object")return e===n;if("equals"in e)return e.equals(n);const r=Object.keys(e),s=Object.keys(n);if(r.length!==s.length)return!1;for(const i of r){const d=e[i],l=n[i];if(typeof d=="object"&&typeof l=="object"){if(!g(d,l))return!1}else if(d!==l)return!1}return!0},z=(e,n)=>{if(typeof e!="object"||e==null)return e===n;const t=Object.keys(e),o=Object.keys(n);if(o.length>t.length)return!1;for(const r of o){const s=e[r],i=n[r];if(typeof s=="object"&&typeof i=="object"){if(!z(s,i))return!1}else if(s!==i)return!1}return!0},S=(e,...n)=>{if(n.length===0)return e;const t=n.shift();if(a.o(e)&&a.o(t))for(const o in t)try{a.o(t[o])?(o in e||Object.assign(e,{[o]:{}}),S(e[o],t[o])):Object.assign(e,{[o]:t[o]})}catch(r){throw r instanceof TypeError?new TypeError(`.${o}: ${r.message}`):r}return S(e,...n)},K=(e,n,t)=>{const o=(r,s,i)=>{var d,l;if(((d=i.def)==null?void 0:d.type)==="union")return i.def.options.reduce((c,f)=>o(c,s,f),r);if(((l=i.def)==null?void 0:l.type)==="intersection"){const c=o(r,s,i.def.left);return o(c,s,i.def.right)}for(const c in s){const f=s[c],b=i==null?void 0:i.shape;if(b!=null&&b[c]){const m=b[c].safeParse(f);m.success&&(r[c]=m.data)}else typeof f=="object"&&!Array.isArray(f)&&f!==null&&i&&i.shape&&i.shape[c]&&(r[c]||(r[c]={}),o(r[c],f,i.shape[c]))}return r};return o({...e},n,t)},E=Object.freeze(Object.defineProperty({__proto__:null,copy:x,deleteD:$,difference:q,element:j,equal:g,get:k,has:R,override:S,overrideValidItems:K,partialEqual:z,pathsMatch:C,remove:M,set:D,transformPath:v},Symbol.toStringTag,{value:"Module"})),F=a.O.milliseconds(50),O=()=>setTimeout(()=>window.location.reload(),F.milliseconds),P={label:a.MAIN_WINDOW,config:{enablePrerender:!0,debug:!1,defaultWindowProps:{}},windows:{main:{...a.INITIAL_WINDOW_STATE,key:a.MAIN_WINDOW,reserved:!0}},labelKeys:{main:a.MAIN_WINDOW},keyLabels:{main:a.MAIN_WINDOW}},V=(e,n)=>{if(e.type===N.type)return n.label!==a.MAIN_WINDOW||(e.payload.label=a.Lt.create(),e.payload.prerenderLabel=a.Lt.create()),e;if("label"in e.payload)return e;let t=n.label;const o=e.payload;return o.key!=null&&(o.key in n.windows?t=o.key:t=n.keyLabels[o.key]),e.payload={...e.payload,label:t},e},u=e=>(n,t)=>{if(!("label"in t.payload))throw new Error("Missing label");e(n,t)},w=(e,n=!1)=>u((t,o)=>{let r=n;const s=t.windows[o.payload.label];if(s!=null){if(o.payload.value!=null)r=o.payload.value;else{const i=s[e];i!=null&&(r=!i)}t.windows[o.payload.label]={...s,[e]:r}}}),W=(e,n=!1)=>(t,o)=>{const r=t.windows[o.payload.label];r!=null&&(t.windows[o.payload.label]={...r,[e]:r[e]+(n?-1:1)})},J=e=>Object.values(e.windows).some(n=>n.key===a.PRERENDER_WINDOW&&!n.reserved),h="drift",Z=(e,n,t)=>e.position!=null&&e.size!=null&&n==null?a.$t.topLeft(a.$t.positionInCenter(a.$t.construct(a.J.ZERO,t??a.J.ZERO),a.$t.construct(e.position,e.size))):n,B=(e,{payload:n})=>{if(n.key===a.PRERENDER_WINDOW)return;const{key:t,label:o,prerenderLabel:r}=n;if(o==null||r==null)throw new Error("[drift] - bug - missing label and prerender label");console.log(e.config.debug),A(e.config.debug,"reducer create window");const s=e.windows.main;if(n.position=Z(s,n.position,n.size),t in e.keyLabels){p(e.config.debug,"window already exists, un-minimize and focus it");const l=e.keyLabels[n.key];e.windows[l].visible=!0,e.windows[l].focusCount+=1,e.windows[l].minimized=!1,e.windows[l].position=n.position,y(e.config.debug);return}const[i,d]=Object.entries(e.windows).find(([,l])=>!l.reserved)??[null,null];i!=null?(p(e.config.debug,"using available pre-rendered window"),e.windows[i]={...d,visible:!0,reserved:!0,focusCount:1,focus:!0,...n},e.labelKeys[i]=n.key,e.keyLabels[n.key]=i):(p(e.config.debug,"creating new window"),e.windows[o]={...e.config.defaultWindowProps,...a.INITIAL_WINDOW_STATE,...n,reserved:!0},e.labelKeys[o]=t,e.keyLabels[t]=o),e.config.enablePrerender&&!J(e)&&(p(e.config.debug,"creating pre-render window"),e.windows[r]=E.copy({...e.config.defaultWindowProps,...a.INITIAL_PRERENDER_WINDOW_STATE})),y(e.config.debug)},H=u((e,n)=>{const t=e.windows[n.payload.label];t!=null&&(t.stage=n.payload.stage)}),U=u((e,{payload:{label:n}})=>{const t=e.windows[n];t==null||t.processCount>0||(t.stage="closing",delete e.windows[n],delete e.labelKeys[n],delete e.keyLabels[t.key])}),X=u((e,n)=>{const t=e.windows[n.payload.label];t==null||t.processCount>0||(t.stage="reloading",O())}),Y=u(W("processCount")),G=u((e,n)=>{W("processCount",!0)(e,n);const t=e.windows[n.payload.label];t!=null&&t.processCount===0&&(t.stage==="reloading"?O():(e.windows[n.payload.label].visible=!1,delete e.windows[n.payload.label],delete e.labelKeys[n.payload.label],delete e.keyLabels[t.key]))}),Q=(e,n)=>{const t=e.windows[n.payload.key];t!=null&&(t.error=n.payload.message)},ee=u((e,n)=>{const t=e.windows[n.payload.label];t!=null&&(t.visible!==!0&&(t.visible=!0),W("focusCount")(e,n))}),ne=w("minimized"),te=w("maximized"),oe=w("visible",!0),ie=w("fullscreen",!0),re=u(W("centerCount")),se=u((e,n)=>{e.windows[n.payload.label].position=n.payload.position}),le=u((e,n)=>{e.windows[n.payload.label].size=n.payload.size}),ae=u((e,n)=>{e.windows[n.payload.label].minSize=n.payload.size}),de=u((e,n)=>{e.windows[n.payload.label].maxSize=n.payload.size}),ce=w("resizable"),ue=w("skipTaskbar"),we=w("alwaysOnTop"),fe=u((e,n)=>{e.windows[n.payload.label].title=n.payload.title}),pe=w("decorations"),I=(e,n)=>{const t=e.windows[n.payload.label];E.partialEqual(t,n.payload)||(e.windows[n.payload.label]={...t,...n.payload})},We=(e,n)=>{if(e.config={...e.config,...n.payload},e.label=n.payload.label,e.label===a.MAIN_WINDOW&&e.config.enablePrerender){const t=a.Lt.create();e.windows[t]={...e.config.defaultWindowProps,...a.INITIAL_PRERENDER_WINDOW_STATE}}},T=_.createSlice({name:h,initialState:P,reducers:{internalSetInitial:We,createWindow:B,setWindowStage:H,closeWindow:U,registerProcess:Y,completeProcess:G,setWindowError:Q,focusWindow:ee,reloadWindow:X,setWindowMinimized:ne,setWindowMaximized:te,setWindowVisible:oe,setWindowFullscreen:ie,centerWindow:re,setWindowPosition:se,setWindowSize:le,setWindowMinSize:ae,setWindowMaxSize:de,setWindowResizable:ce,setWindowSkipTaskbar:ue,setWindowAlwaysOnTop:we,setWindowTitle:fe,setWindowDecorations:pe,runtimeSetWindowProps:I,setWindowProps:I}}),{actions:{runtimeSetWindowProps:be,setWindowProps:ye,createWindow:N,internalSetInitial:L,setWindowStage:ge,closeWindow:Se,registerProcess:Ee,completeProcess:he,setWindowError:me,focusWindow:Ie,reloadWindow:Ae,setWindowMinimized:ke,setWindowMaximized:ze,setWindowVisible:Oe,setWindowFullscreen:Pe,centerWindow:Ke,setWindowPosition:Te,setWindowSize:Ne,setWindowMinSize:Le,setWindowMaxSize:_e,setWindowResizable:ve,setWindowSkipTaskbar:De,setWindowAlwaysOnTop:Me,setWindowTitle:je,setWindowDecorations:Re}}=T,Ce=T.reducer,xe=e=>e.startsWith(h),$e=[L.type],qe=(e,n)=>!e&&!$e.includes(n);exports.SLICE_NAME=h;exports.ZERO_SLICE_STATE=P;exports.assignLabel=V;exports.closeWindow=Se;exports.completeProcess=he;exports.createWindow=N;exports.focusWindow=Ie;exports.group=A;exports.groupEnd=y;exports.internalSetInitial=L;exports.isDriftAction=xe;exports.log=p;exports.reducer=Ce;exports.registerProcess=Ee;exports.reloadWindow=Ae;exports.runtimeSetWindowProps=be;exports.setWindowAlwaysOnTop=Me;exports.setWindowDecorations=Re;exports.setWindowError=me;exports.setWindowFullscreen=Pe;exports.setWindowMaxSize=_e;exports.setWindowMaximized=ze;exports.setWindowMinSize=Le;exports.setWindowMinimized=ke;exports.setWindowPosition=Te;exports.setWindowProps=ye;exports.setWindowResizable=ve;exports.setWindowSize=Ne;exports.setWindowSkipTaskbar=De;exports.setWindowStage=ge;exports.setWindowTitle=je;exports.setWindowVisible=Oe;exports.shouldEmit=qe;exports.x=E;
|
package/dist/tauri.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ee=Object.defineProperty;var ie=(t,e,i)=>e in t?ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var D=(t,e,i)=>ie(t,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./window-DLsE0-fP.cjs"),y=require("./state-Cl8us-b9.cjs"),te=require("./debounce-BUAIXXZt.cjs");function ne(t,e,i,n){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?n:i==="a"?n.call(t):n?n.value:e.get(t)}function se(t,e,i,n,l){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var S;const c="__TAURI_TO_IPC_KEY__";function le(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},i){return window.__TAURI_INTERNALS__.invoke(t,e,i)}class ae{get rid(){return ne(this,S,"f")}constructor(e){S.set(this,void 0),se(this,S,e)}async close(){return s("plugin:resources|close",{rid:this.rid})}}S=new WeakMap;var o;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(o||(o={}));async function H(t,e){await s("plugin:event|unlisten",{event:t,eventId:e})}async function W(t,e,i){var n;const l=typeof(i==null?void 0:i.target)=="string"?{kind:"AnyLabel",label:i.target}:(n=i==null?void 0:i.target)!==null&&n!==void 0?n:{kind:"Any"};return s("plugin:event|listen",{event:t,target:l,handler:le(e)}).then(r=>async()=>H(t,r))}async function L(t,e,i){return W(t,n=>{H(t,n.id),e(n)},i)}async function N(t,e){await s("plugin:event|emit",{event:t,payload:e})}async function j(t,e,i){await s("plugin:event|emit_to",{target:typeof t=="string"?{kind:"AnyLabel",label:t}:t,event:e,payload:i})}class v{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new d(this.width*e,this.height*e)}[c](){return{width:this.width,height:this.height}}toJSON(){return this[c]()}}class d{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new v(this.width/e,this.height/e)}[c](){return{width:this.width,height:this.height}}toJSON(){return this[c]()}}class h{constructor(e){this.size=e}toLogical(e){return this.size instanceof v?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof d?this.size:this.size.toPhysical(e)}[c](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[c]()}}class T{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new u(this.x*e,this.y*e)}[c](){return{x:this.x,y:this.y}}toJSON(){return this[c]()}}class u{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new T(this.x/e,this.y/e)}[c](){return{x:this.x,y:this.y}}toJSON(){return this[c]()}}class p{constructor(e){this.position=e}toLogical(e){return this.position instanceof T?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof u?this.position:this.position.toPhysical(e)}[c](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[c]()}}class m extends ae{constructor(e){super(e)}static async new(e,i,n){return s("plugin:image|new",{rgba:z(e),width:i,height:n}).then(l=>new m(l))}static async fromBytes(e){return s("plugin:image|from_bytes",{bytes:z(e)}).then(i=>new m(i))}static async fromPath(e){return s("plugin:image|from_path",{path:e}).then(i=>new m(i))}async rgba(){return s("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return s("plugin:image|size",{rid:this.rid})}}function z(t){return t==null?null:typeof t=="string"?t:t instanceof m?t.rid:t}var k;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(k||(k={}));class re{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var M;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(M||(M={}));function q(){return new I(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function R(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new I(e,{skip:!0})))}const x=["tauri://created","tauri://error"];class I{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=null&&i.skip||s("plugin:window|create",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await R()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return q()}static async getAll(){return R()}static async getFocusedWindow(){for(const e of await R())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:W(e,i,{target:{kind:"Window",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:L(e,i,{target:{kind:"Window",label:this.label}})}async emit(e,i){if(x.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return N(e,i)}async emitTo(e,i,n){if(x.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return j(e,i,n)}_handleTauriEvent(e,i){return x.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async scaleFactor(){return s("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return s("plugin:window|inner_position",{label:this.label}).then(e=>new u(e))}async outerPosition(){return s("plugin:window|outer_position",{label:this.label}).then(e=>new u(e))}async innerSize(){return s("plugin:window|inner_size",{label:this.label}).then(e=>new d(e))}async outerSize(){return s("plugin:window|outer_size",{label:this.label}).then(e=>new d(e))}async isFullscreen(){return s("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return s("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return s("plugin:window|is_maximized",{label:this.label})}async isFocused(){return s("plugin:window|is_focused",{label:this.label})}async isDecorated(){return s("plugin:window|is_decorated",{label:this.label})}async isResizable(){return s("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return s("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return s("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return s("plugin:window|is_closable",{label:this.label})}async isVisible(){return s("plugin:window|is_visible",{label:this.label})}async title(){return s("plugin:window|title",{label:this.label})}async theme(){return s("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return s("plugin:window|is_always_on_top",{label:this.label})}async center(){return s("plugin:window|center",{label:this.label})}async requestUserAttention(e){let i=null;return e&&(e===k.Critical?i={type:"Critical"}:i={type:"Informational"}),s("plugin:window|request_user_attention",{label:this.label,value:i})}async setResizable(e){return s("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return s("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return s("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return s("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return s("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return s("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return s("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return s("plugin:window|maximize",{label:this.label})}async unmaximize(){return s("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return s("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return s("plugin:window|minimize",{label:this.label})}async unminimize(){return s("plugin:window|unminimize",{label:this.label})}async show(){return s("plugin:window|show",{label:this.label})}async hide(){return s("plugin:window|hide",{label:this.label})}async close(){return s("plugin:window|close",{label:this.label})}async destroy(){return s("plugin:window|destroy",{label:this.label})}async setDecorations(e){return s("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return s("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return s("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return s("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return s("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return s("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return s("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return s("plugin:window|set_size",{label:this.label,value:e instanceof h?e:new h(e)})}async setMinSize(e){return s("plugin:window|set_min_size",{label:this.label,value:e instanceof h?e:e?new h(e):null})}async setMaxSize(e){return s("plugin:window|set_max_size",{label:this.label,value:e instanceof h?e:e?new h(e):null})}async setSizeConstraints(e){function i(n){return n?{Logical:n}:null}return s("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:i(e==null?void 0:e.minWidth),minHeight:i(e==null?void 0:e.minHeight),maxWidth:i(e==null?void 0:e.maxWidth),maxHeight:i(e==null?void 0:e.maxHeight)}})}async setPosition(e){return s("plugin:window|set_position",{label:this.label,value:e instanceof p?e:new p(e)})}async setFullscreen(e){return s("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return s("plugin:window|set_focus",{label:this.label})}async setIcon(e){return s("plugin:window|set_icon",{label:this.label,value:z(e)})}async setSkipTaskbar(e){return s("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return s("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return s("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return s("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return s("plugin:window|set_cursor_position",{label:this.label,value:e instanceof p?e:new p(e)})}async setIgnoreCursorEvents(e){return s("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return s("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return s("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return s("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return s("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return s("plugin:window|set_overlay_icon",{label:this.label,value:e?z(e):void 0})}async setProgressBar(e){return s("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return s("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return s("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return s("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(o.WINDOW_RESIZED,i=>{i.payload=new d(i.payload),e(i)})}async onMoved(e){return this.listen(o.WINDOW_MOVED,i=>{i.payload=new u(i.payload),e(i)})}async onCloseRequested(e){return this.listen(o.WINDOW_CLOSE_REQUESTED,async i=>{const n=new re(i);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}async onFocusChanged(e){const i=await this.listen(o.WINDOW_FOCUS,l=>{e({...l,payload:!0})}),n=await this.listen(o.WINDOW_BLUR,l=>{e({...l,payload:!1})});return()=>{i(),n()}}async onScaleChanged(e){return this.listen(o.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(o.WINDOW_THEME_CHANGED,e)}}var F;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(F||(F={}));var B;(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(B||(B={}));var V;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(V||(V={}));function oe(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new u(t.position),size:new d(t.size)}}async function ue(){return s("plugin:window|available_monitors").then(t=>t.map(oe))}function J(){return new C(q(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function U(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new C(new I(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const A=["tauri://created","tauri://error"];class C{constructor(e,i,n){this.window=e,this.label=i,this.listeners=Object.create(null),n!=null&&n.skip||s("plugin:webview|create_webview",{windowLabel:e.label,label:i,options:n}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await U()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return J()}static async getAll(){return U()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:W(e,i,{target:{kind:"Webview",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:L(e,i,{target:{kind:"Webview",label:this.label}})}async emit(e,i){if(A.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return N(e,i)}async emitTo(e,i,n){if(A.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return j(e,i,n)}_handleTauriEvent(e,i){return A.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async position(){return s("plugin:webview|webview_position",{label:this.label}).then(e=>new u(e))}async size(){return s("plugin:webview|webview_size",{label:this.label}).then(e=>new d(e))}async close(){return s("plugin:webview|webview_close",{label:this.label})}async setSize(e){return s("plugin:webview|set_webview_size",{label:this.label,value:e instanceof h?e:new h(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof p?e:new p(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}async hide(){return s("plugin:webview|webview_hide",{label:this.label})}async show(){return s("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return s("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return s("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return s("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return s("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}}function Z(){const t=J();return new w(t.label,{skip:!0})}async function P(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new w(e,{skip:!0})))}class w{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=null&&i.skip||s("plugin:webview|create_webview_window",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;const n=(i=(await P()).find(l=>l.label===e))!==null&&i!==void 0?i:null;return n?new w(n.label,{skip:!0}):null}static getCurrent(){return Z()}static async getAll(){return P()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:W(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:L(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e}).then(()=>s("plugin:webview|set_webview_background_color",{color:e}))}}ce(w,[I,C]);function ce(t,e){(Array.isArray(e)?e:[e]).forEach(i=>{Object.getOwnPropertyNames(i.prototype).forEach(n=>{var l;typeof t.prototype=="object"&&t.prototype&&n in t.prototype||Object.defineProperty(t.prototype,n,(l=Object.getOwnPropertyDescriptor(i.prototype,n))!==null&&l!==void 0?l:Object.create(null))})})}const he=t=>JSON.stringify(t),we=t=>JSON.parse(t),O="drift://action",de="tauri://error",be="tauri://created",ye=t=>new Error(`Window not found: ${t}`),g=250,pe=b.O.seconds(1),f=t=>{if(t!=null)return{width:Math.max(t.width,g),height:Math.max(t.height,g)}},ge=t=>{const{size:e,maxSize:i}=t;return{...t,maxSize:f(i),size:f(e)}},_e=async()=>(await ue()).map(e=>{const i=E(e.position,e.scaleFactor),n={width:e.size.width,height:e.size.height};return b.$t.construct(i,n)}),G=async t=>(await _e()).some(i=>b.$t.contains(i,t));class ve{constructor(e){D(this,"win");D(this,"unsubscribe");D(this,"fullscreenPoll",null);this.win=e??Z(),this.unsubscribe={}}async configure(){await this.startFullscreenPoll()}async startFullscreenPoll(){if(b.S.getOS()!=="macOS")return;let e=(await this.getProps()).fullscreen;this.fullscreenPoll=setInterval(()=>{this.win.isFullscreen().then(i=>{i!==e&&(e=i,this.emit({action:y.runtimeSetWindowProps({label:this.win.label,fullscreen:i})},void 0,"WHITELIST").catch(console.error))}).catch(console.error)},pe.milliseconds)}label(){return this.win.label}isMain(){return this.win.label===b.MAIN_WINDOW}release(){Object.values(this.unsubscribe).forEach(e=>e==null?void 0:e()),this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.unsubscribe={}}async emit(e,i,n=this.label()){const l=he({...e,emitter:n});if(i==null)return await N(O,l);const r=await w.getByLabel(i);if(r==null)throw ye(i);await r.emit(O,l)}async subscribe(e){this.release(),await this.startFullscreenPoll(),this.unsubscribe[O]=await W(O,n=>e(we(n.payload)));const i=me();for(const{key:n,handler:l,debounce:r}of i)this.unsubscribe[n]=await this.win.listen(n,te.o(()=>{l(this.win).then(a=>{a!=null&&this.emit({action:a},void 0,"WHITELIST").catch(console.error)}).catch(console.error)},r))}onCloseRequested(e){this.win.onCloseRequested(i=>{i.preventDefault(),e()})}async create(e,i){i=y.x.copy(i);const{size:n,minSize:l,maxSize:r,position:a,...Q}=ge(i);(n==null?void 0:n.width)!=null&&(n.width=Math.max(n.width,g)),(n==null?void 0:n.height)!=null&&(n.height=Math.max(n.height,g)),(r==null?void 0:r.width)!=null&&(r.width=Math.max(r.width,g)),(r==null?void 0:r.height)!=null&&(r.height=Math.max(r.height,g)),a!=null&&(await G(a)||(a.x=0,a.y=0));try{const _=new w(e,{x:a==null?void 0:a.x,y:a==null?void 0:a.y,width:n==null?void 0:n.width,height:n==null?void 0:n.height,minWidth:l==null?void 0:l.width,minHeight:l==null?void 0:l.height,maxWidth:r==null?void 0:r.width,maxHeight:r==null?void 0:r.height,titleBarStyle:"overlay",dragDropEnabled:!1,...Q});return await new Promise((Y,K)=>{_.once(de,X=>K(new Error(JSON.stringify(X.payload)))),_.once(be,()=>Y())})}catch(_){console.error(_)}}async close(e){const i=await w.getByLabel(e);if(i!=null)try{await i.destroy()}catch(n){console.error(n,e)}else{const n=await P();console.error("Window not found",e,n.map(l=>l.label))}}async listLabels(){return(await P()).map(i=>i.label)}async focus(){return await this.win.setFocus()}async setMinimized(e){return e?await this.win.minimize():await this.win.unminimize()}async setMaximized(e){return e?await this.win.maximize():await this.win.unmaximize()}async setVisible(e){return e?await this.win.show():await this.win.hide()}async setFullscreen(e){await this.win.setFullscreen(e)}async center(){return await this.win.center()}async setPosition(e){const i=new T(e.x,e.y);await G(e)||(i.x=0,i.y=0),await this.win.setPosition(i)}async setSize(e){e=f(e),await this.win.setSize(new v(e.width,e.height))}async setMinSize(e){e=f(e),await this.win.setMinSize(new v(e.width,e.height))}async setMaxSize(e){e=f(e),await this.win.setMaxSize(new v(e.width,e.height))}async setResizable(e){var i,n;return o.WINDOW_RESIZED in this.unsubscribe&&!e&&((n=(i=this.unsubscribe)[o.WINDOW_RESIZED])==null||n.call(i),delete this.unsubscribe[o.WINDOW_RESIZED]),await this.win.setResizable(e)}async setSkipTaskbar(e){return await this.win.setSkipTaskbar(e)}async setAlwaysOnTop(e){return await this.win.setAlwaysOnTop(e)}async setTitle(e){return await this.win.setTitle(e)}async setDecorations(e){return await this.win.setDecorations(e)}async getProps(){const e=await this.win.scaleFactor(),i=await this.win.isVisible();return{position:E(await this.win.innerPosition(),e),size:$(await this.win.innerSize(),e),maximized:await this.win.isMaximized(),visible:i,fullscreen:await this.win.isFullscreen()}}}const me=()=>[{key:o.WINDOW_RESIZED,debounce:200,handler:async t=>{const e=await t.scaleFactor(),i=await t.isVisible(),n={label:t.label,maximized:await t.isMaximized(),visible:i,minimized:!i,position:E(await t.innerPosition(),e),size:$(await t.innerSize(),e)};return y.runtimeSetWindowProps(n)}},{key:o.WINDOW_MOVED,debounce:200,handler:async t=>{const e=await(t==null?void 0:t.scaleFactor());if(e==null)return null;const i=E(await t.innerPosition(),e),n=await t.isVisible(),l={label:t.label,visible:n,position:i};return y.runtimeSetWindowProps(l)}},{key:o.WINDOW_BLUR,debounce:0,handler:async t=>y.runtimeSetWindowProps({focus:!1,label:t.label})},{key:o.WINDOW_FOCUS,debounce:0,handler:async t=>y.runtimeSetWindowProps({focus:!0,visible:!0,minimized:!1,label:t.label})}],E=(t,e)=>b.J.scale(t,1/e),$=(t,e)=>b._.scale(t,1/e);exports.TauriRuntime=ve;
|
|
1
|
+
"use strict";var ee=Object.defineProperty;var ie=(t,e,i)=>e in t?ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var D=(t,e,i)=>ie(t,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./window-Bj8OM9F9.cjs"),y=require("./state-xseZCh_u.cjs"),te=require("./debounce-BUAIXXZt.cjs");function ne(t,e,i,n){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?n:i==="a"?n.call(t):n?n.value:e.get(t)}function se(t,e,i,n,l){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var S;const c="__TAURI_TO_IPC_KEY__";function le(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},i){return window.__TAURI_INTERNALS__.invoke(t,e,i)}class ae{get rid(){return ne(this,S,"f")}constructor(e){S.set(this,void 0),se(this,S,e)}async close(){return s("plugin:resources|close",{rid:this.rid})}}S=new WeakMap;var o;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(o||(o={}));async function H(t,e){await s("plugin:event|unlisten",{event:t,eventId:e})}async function W(t,e,i){var n;const l=typeof(i==null?void 0:i.target)=="string"?{kind:"AnyLabel",label:i.target}:(n=i==null?void 0:i.target)!==null&&n!==void 0?n:{kind:"Any"};return s("plugin:event|listen",{event:t,target:l,handler:le(e)}).then(r=>async()=>H(t,r))}async function L(t,e,i){return W(t,n=>{H(t,n.id),e(n)},i)}async function N(t,e){await s("plugin:event|emit",{event:t,payload:e})}async function j(t,e,i){await s("plugin:event|emit_to",{target:typeof t=="string"?{kind:"AnyLabel",label:t}:t,event:e,payload:i})}class v{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new d(this.width*e,this.height*e)}[c](){return{width:this.width,height:this.height}}toJSON(){return this[c]()}}class d{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new v(this.width/e,this.height/e)}[c](){return{width:this.width,height:this.height}}toJSON(){return this[c]()}}class h{constructor(e){this.size=e}toLogical(e){return this.size instanceof v?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof d?this.size:this.size.toPhysical(e)}[c](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[c]()}}class T{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new u(this.x*e,this.y*e)}[c](){return{x:this.x,y:this.y}}toJSON(){return this[c]()}}class u{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new T(this.x/e,this.y/e)}[c](){return{x:this.x,y:this.y}}toJSON(){return this[c]()}}class p{constructor(e){this.position=e}toLogical(e){return this.position instanceof T?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof u?this.position:this.position.toPhysical(e)}[c](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[c]()}}class m extends ae{constructor(e){super(e)}static async new(e,i,n){return s("plugin:image|new",{rgba:z(e),width:i,height:n}).then(l=>new m(l))}static async fromBytes(e){return s("plugin:image|from_bytes",{bytes:z(e)}).then(i=>new m(i))}static async fromPath(e){return s("plugin:image|from_path",{path:e}).then(i=>new m(i))}async rgba(){return s("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return s("plugin:image|size",{rid:this.rid})}}function z(t){return t==null?null:typeof t=="string"?t:t instanceof m?t.rid:t}var k;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(k||(k={}));class re{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var M;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(M||(M={}));function q(){return new I(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function R(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new I(e,{skip:!0})))}const x=["tauri://created","tauri://error"];class I{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=null&&i.skip||s("plugin:window|create",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await R()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return q()}static async getAll(){return R()}static async getFocusedWindow(){for(const e of await R())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:W(e,i,{target:{kind:"Window",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:L(e,i,{target:{kind:"Window",label:this.label}})}async emit(e,i){if(x.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return N(e,i)}async emitTo(e,i,n){if(x.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return j(e,i,n)}_handleTauriEvent(e,i){return x.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async scaleFactor(){return s("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return s("plugin:window|inner_position",{label:this.label}).then(e=>new u(e))}async outerPosition(){return s("plugin:window|outer_position",{label:this.label}).then(e=>new u(e))}async innerSize(){return s("plugin:window|inner_size",{label:this.label}).then(e=>new d(e))}async outerSize(){return s("plugin:window|outer_size",{label:this.label}).then(e=>new d(e))}async isFullscreen(){return s("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return s("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return s("plugin:window|is_maximized",{label:this.label})}async isFocused(){return s("plugin:window|is_focused",{label:this.label})}async isDecorated(){return s("plugin:window|is_decorated",{label:this.label})}async isResizable(){return s("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return s("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return s("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return s("plugin:window|is_closable",{label:this.label})}async isVisible(){return s("plugin:window|is_visible",{label:this.label})}async title(){return s("plugin:window|title",{label:this.label})}async theme(){return s("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return s("plugin:window|is_always_on_top",{label:this.label})}async center(){return s("plugin:window|center",{label:this.label})}async requestUserAttention(e){let i=null;return e&&(e===k.Critical?i={type:"Critical"}:i={type:"Informational"}),s("plugin:window|request_user_attention",{label:this.label,value:i})}async setResizable(e){return s("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return s("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return s("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return s("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return s("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return s("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return s("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return s("plugin:window|maximize",{label:this.label})}async unmaximize(){return s("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return s("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return s("plugin:window|minimize",{label:this.label})}async unminimize(){return s("plugin:window|unminimize",{label:this.label})}async show(){return s("plugin:window|show",{label:this.label})}async hide(){return s("plugin:window|hide",{label:this.label})}async close(){return s("plugin:window|close",{label:this.label})}async destroy(){return s("plugin:window|destroy",{label:this.label})}async setDecorations(e){return s("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return s("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return s("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return s("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return s("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return s("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return s("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return s("plugin:window|set_size",{label:this.label,value:e instanceof h?e:new h(e)})}async setMinSize(e){return s("plugin:window|set_min_size",{label:this.label,value:e instanceof h?e:e?new h(e):null})}async setMaxSize(e){return s("plugin:window|set_max_size",{label:this.label,value:e instanceof h?e:e?new h(e):null})}async setSizeConstraints(e){function i(n){return n?{Logical:n}:null}return s("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:i(e==null?void 0:e.minWidth),minHeight:i(e==null?void 0:e.minHeight),maxWidth:i(e==null?void 0:e.maxWidth),maxHeight:i(e==null?void 0:e.maxHeight)}})}async setPosition(e){return s("plugin:window|set_position",{label:this.label,value:e instanceof p?e:new p(e)})}async setFullscreen(e){return s("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return s("plugin:window|set_focus",{label:this.label})}async setIcon(e){return s("plugin:window|set_icon",{label:this.label,value:z(e)})}async setSkipTaskbar(e){return s("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return s("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return s("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return s("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return s("plugin:window|set_cursor_position",{label:this.label,value:e instanceof p?e:new p(e)})}async setIgnoreCursorEvents(e){return s("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return s("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return s("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return s("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return s("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return s("plugin:window|set_overlay_icon",{label:this.label,value:e?z(e):void 0})}async setProgressBar(e){return s("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return s("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return s("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return s("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(o.WINDOW_RESIZED,i=>{i.payload=new d(i.payload),e(i)})}async onMoved(e){return this.listen(o.WINDOW_MOVED,i=>{i.payload=new u(i.payload),e(i)})}async onCloseRequested(e){return this.listen(o.WINDOW_CLOSE_REQUESTED,async i=>{const n=new re(i);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}async onFocusChanged(e){const i=await this.listen(o.WINDOW_FOCUS,l=>{e({...l,payload:!0})}),n=await this.listen(o.WINDOW_BLUR,l=>{e({...l,payload:!1})});return()=>{i(),n()}}async onScaleChanged(e){return this.listen(o.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(o.WINDOW_THEME_CHANGED,e)}}var F;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(F||(F={}));var B;(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(B||(B={}));var V;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(V||(V={}));function oe(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new u(t.position),size:new d(t.size)}}async function ue(){return s("plugin:window|available_monitors").then(t=>t.map(oe))}function J(){return new C(q(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function U(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new C(new I(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const A=["tauri://created","tauri://error"];class C{constructor(e,i,n){this.window=e,this.label=i,this.listeners=Object.create(null),n!=null&&n.skip||s("plugin:webview|create_webview",{windowLabel:e.label,label:i,options:n}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await U()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return J()}static async getAll(){return U()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:W(e,i,{target:{kind:"Webview",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:L(e,i,{target:{kind:"Webview",label:this.label}})}async emit(e,i){if(A.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return N(e,i)}async emitTo(e,i,n){if(A.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return j(e,i,n)}_handleTauriEvent(e,i){return A.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async position(){return s("plugin:webview|webview_position",{label:this.label}).then(e=>new u(e))}async size(){return s("plugin:webview|webview_size",{label:this.label}).then(e=>new d(e))}async close(){return s("plugin:webview|webview_close",{label:this.label})}async setSize(e){return s("plugin:webview|set_webview_size",{label:this.label,value:e instanceof h?e:new h(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof p?e:new p(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}async hide(){return s("plugin:webview|webview_hide",{label:this.label})}async show(){return s("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return s("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return s("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return s("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return s("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}}function Z(){const t=J();return new w(t.label,{skip:!0})}async function P(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new w(e,{skip:!0})))}class w{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=null&&i.skip||s("plugin:webview|create_webview_window",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;const n=(i=(await P()).find(l=>l.label===e))!==null&&i!==void 0?i:null;return n?new w(n.label,{skip:!0}):null}static getCurrent(){return Z()}static async getAll(){return P()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:W(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:L(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e}).then(()=>s("plugin:webview|set_webview_background_color",{color:e}))}}ce(w,[I,C]);function ce(t,e){(Array.isArray(e)?e:[e]).forEach(i=>{Object.getOwnPropertyNames(i.prototype).forEach(n=>{var l;typeof t.prototype=="object"&&t.prototype&&n in t.prototype||Object.defineProperty(t.prototype,n,(l=Object.getOwnPropertyDescriptor(i.prototype,n))!==null&&l!==void 0?l:Object.create(null))})})}const he=t=>JSON.stringify(t),we=t=>JSON.parse(t),O="drift://action",de="tauri://error",be="tauri://created",ye=t=>new Error(`Window not found: ${t}`),g=250,pe=b.O.seconds(1),f=t=>{if(t!=null)return{width:Math.max(t.width,g),height:Math.max(t.height,g)}},ge=t=>{const{size:e,maxSize:i}=t;return{...t,maxSize:f(i),size:f(e)}},_e=async()=>(await ue()).map(e=>{const i=E(e.position,e.scaleFactor),n={width:e.size.width,height:e.size.height};return b.$t.construct(i,n)}),G=async t=>(await _e()).some(i=>b.$t.contains(i,t));class ve{constructor(e){D(this,"win");D(this,"unsubscribe");D(this,"fullscreenPoll",null);this.win=e??Z(),this.unsubscribe={}}async configure(){await this.startFullscreenPoll()}async startFullscreenPoll(){if(b.S.getOS()!=="macOS")return;let e=(await this.getProps()).fullscreen;this.fullscreenPoll=setInterval(()=>{this.win.isFullscreen().then(i=>{i!==e&&(e=i,this.emit({action:y.runtimeSetWindowProps({label:this.win.label,fullscreen:i})},void 0,"WHITELIST").catch(console.error))}).catch(console.error)},pe.milliseconds)}label(){return this.win.label}isMain(){return this.win.label===b.MAIN_WINDOW}release(){Object.values(this.unsubscribe).forEach(e=>e==null?void 0:e()),this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.unsubscribe={}}async emit(e,i,n=this.label()){const l=he({...e,emitter:n});if(i==null)return await N(O,l);const r=await w.getByLabel(i);if(r==null)throw ye(i);await r.emit(O,l)}async subscribe(e){this.release(),await this.startFullscreenPoll(),this.unsubscribe[O]=await W(O,n=>e(we(n.payload)));const i=me();for(const{key:n,handler:l,debounce:r}of i)this.unsubscribe[n]=await this.win.listen(n,te.o(()=>{l(this.win).then(a=>{a!=null&&this.emit({action:a},void 0,"WHITELIST").catch(console.error)}).catch(console.error)},r))}onCloseRequested(e){this.win.onCloseRequested(i=>{i.preventDefault(),e()})}async create(e,i){i=y.x.copy(i);const{size:n,minSize:l,maxSize:r,position:a,...Q}=ge(i);(n==null?void 0:n.width)!=null&&(n.width=Math.max(n.width,g)),(n==null?void 0:n.height)!=null&&(n.height=Math.max(n.height,g)),(r==null?void 0:r.width)!=null&&(r.width=Math.max(r.width,g)),(r==null?void 0:r.height)!=null&&(r.height=Math.max(r.height,g)),a!=null&&(await G(a)||(a.x=0,a.y=0));try{const _=new w(e,{x:a==null?void 0:a.x,y:a==null?void 0:a.y,width:n==null?void 0:n.width,height:n==null?void 0:n.height,minWidth:l==null?void 0:l.width,minHeight:l==null?void 0:l.height,maxWidth:r==null?void 0:r.width,maxHeight:r==null?void 0:r.height,titleBarStyle:"overlay",dragDropEnabled:!1,...Q});return await new Promise((Y,K)=>{_.once(de,X=>K(new Error(JSON.stringify(X.payload)))),_.once(be,()=>Y())})}catch(_){console.error(_)}}async close(e){const i=await w.getByLabel(e);if(i!=null)try{await i.destroy()}catch(n){console.error(n,e)}else{const n=await P();console.error("Window not found",e,n.map(l=>l.label))}}async listLabels(){return(await P()).map(i=>i.label)}async focus(){return await this.win.setFocus()}async setMinimized(e){return e?await this.win.minimize():await this.win.unminimize()}async setMaximized(e){return e?await this.win.maximize():await this.win.unmaximize()}async setVisible(e){return e?await this.win.show():await this.win.hide()}async setFullscreen(e){await this.win.setFullscreen(e)}async center(){return await this.win.center()}async setPosition(e){const i=new T(e.x,e.y);await G(e)||(i.x=0,i.y=0),await this.win.setPosition(i)}async setSize(e){e=f(e),await this.win.setSize(new v(e.width,e.height))}async setMinSize(e){e=f(e),await this.win.setMinSize(new v(e.width,e.height))}async setMaxSize(e){e=f(e),await this.win.setMaxSize(new v(e.width,e.height))}async setResizable(e){var i,n;return o.WINDOW_RESIZED in this.unsubscribe&&!e&&((n=(i=this.unsubscribe)[o.WINDOW_RESIZED])==null||n.call(i),delete this.unsubscribe[o.WINDOW_RESIZED]),await this.win.setResizable(e)}async setSkipTaskbar(e){return await this.win.setSkipTaskbar(e)}async setAlwaysOnTop(e){return await this.win.setAlwaysOnTop(e)}async setTitle(e){return await this.win.setTitle(e)}async setDecorations(e){return await this.win.setDecorations(e)}async getProps(){const e=await this.win.scaleFactor(),i=await this.win.isVisible();return{position:E(await this.win.innerPosition(),e),size:$(await this.win.innerSize(),e),maximized:await this.win.isMaximized(),visible:i,fullscreen:await this.win.isFullscreen()}}}const me=()=>[{key:o.WINDOW_RESIZED,debounce:200,handler:async t=>{const e=await t.scaleFactor(),i=await t.isVisible(),n={label:t.label,maximized:await t.isMaximized(),visible:i,minimized:!i,position:E(await t.innerPosition(),e),size:$(await t.innerSize(),e)};return y.runtimeSetWindowProps(n)}},{key:o.WINDOW_MOVED,debounce:200,handler:async t=>{const e=await(t==null?void 0:t.scaleFactor());if(e==null)return null;const i=E(await t.innerPosition(),e),n=await t.isVisible(),l={label:t.label,visible:n,position:i};return y.runtimeSetWindowProps(l)}},{key:o.WINDOW_BLUR,debounce:0,handler:async t=>y.runtimeSetWindowProps({focus:!1,label:t.label})},{key:o.WINDOW_FOCUS,debounce:0,handler:async t=>y.runtimeSetWindowProps({focus:!0,visible:!0,minimized:!1,label:t.label})}],E=(t,e)=>b.J.scale(t,1/e),$=(t,e)=>b._.scale(t,1/e);exports.TauriRuntime=ve;
|
package/dist/tauri.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var ee = Object.defineProperty;
|
|
2
2
|
var ie = (t, e, i) => e in t ? ee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
3
|
var D = (t, e, i) => ie(t, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
-
import { O as te, S as ne, M as se, _ as le, J as ae, $ as G } from "./window-
|
|
5
|
-
import { r as g, F as re } from "./state-
|
|
4
|
+
import { O as te, S as ne, M as se, _ as le, J as ae, $ as G } from "./window-DwJfMpbK.js";
|
|
5
|
+
import { r as g, F as re } from "./state-BX_5GHgM.js";
|
|
6
6
|
import { o as oe } from "./debounce-DOZKRZa9.js";
|
|
7
7
|
function ue(t, e, i, n) {
|
|
8
8
|
if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|