@synnaxlabs/drift 0.49.0 → 0.52.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/README.md +1 -1
- package/dist/eslint.config.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +30 -30
- package/dist/react.cjs +1 -1
- package/dist/react.js +17 -17
- package/dist/{selectors-UsB3Nvlx.js → selectors-D1g2urZp.js} +1 -1
- package/dist/{selectors-C-yu1uR2.cjs → selectors-bSOXrqbl.cjs} +1 -1
- package/dist/src/configureStore.d.ts +4 -4
- package/dist/src/middleware.d.ts +5 -5
- package/dist/src/mock/runtime.d.ts.map +1 -1
- package/dist/src/noop.d.ts.map +1 -1
- package/dist/src/runtime.d.ts +2 -2
- package/dist/src/runtime.d.ts.map +1 -1
- package/dist/src/sugar.d.ts +3 -3
- package/dist/src/tauri/index.d.ts.map +1 -1
- package/dist/state-BFBdNgbN.cjs +45 -0
- package/dist/state-CGc6dCmt.js +14186 -0
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +12 -12
- package/package.json +19 -16
- package/dist/state-B6GRS-m8.cjs +0 -28
- package/dist/state-D-AHxNXX.js +0 -13485
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.config.d.ts","sourceRoot":"","sources":["../eslint.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"eslint.config.d.ts","sourceRoot":"","sources":["../eslint.config.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;wBAEiB,MAAM,CAAC,MAAM,EAAE;AAArE,wBAAsE"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("@reduxjs/toolkit"),t=require("./state-B6GRS-m8.cjs"),f=require("./selectors-C-yu1uR2.cjs"),N=new Error("request for lock canceled");var P=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(c){c(a)})}return new(s||(s=Promise))(function(a,c){function l(r){try{u(o.next(r))}catch(w){c(w)}}function d(r){try{u(o.throw(r))}catch(w){c(w)}}function u(r){r.done?a(r.value):n(r.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class C{constructor(e,s=N){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((o,n)=>{const a={resolve:o,reject:n,weight:e,priority:s},c=M(this._queue,l=>s<=l.priority);c===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(c+1,0,a)})}runExclusive(e){return P(this,arguments,void 0,function*(s,o=1,n=0){const[a,c]=yield this.acquire(o,n);try{return yield s(a)}finally{c()}})}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(o=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),L(this._weightedWaiters[e-1],{resolve:o,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(o=>o.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let s=this._value;s>0;s--){const o=this._weightedWaiters[s-1];if(!o)continue;const n=o.findIndex(a=>a.priority<=e);(n===-1?o:o.splice(0,n)).forEach((a=>a.resolve()))}}}_couldLockImmediately(e,s){return(this._queue.length===0||this._queue[0].priority<s)&&e<=this._value}}function L(i,e){const s=M(i,o=>e.priority<=o.priority);i.splice(s+1,0,e)}function M(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,o){function n(a){return a instanceof s?a:new s(function(c){c(a)})}return new(s||(s=Promise))(function(a,c){function l(r){try{u(o.next(r))}catch(w){c(w)}}function d(r){try{u(o.throw(r))}catch(w){c(w)}}function u(r){r.done?a(r.value):n(r.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class D{constructor(e){this._semaphore=new C(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 T="DA@",E="://",R=(i,e)=>T.concat(e,E,i),F=i=>{const[e,s]=i.split(E);if(s==null)return[i,""];const[,o]=e.split(T);return[s,o]},b=(i,e)=>({...i,type:R(i.type,e)}),V=i=>{const[e,s]=F(i.type);return{emitted:s!=null&&s.length>0,emitter:s,action:{...i,type:e}}},j=i=>{const{centerCount:e,processCount:s,focusCount:o,stage:n,key:a,prerenderLabel:c,reserved:l,minimized:d,...u}=i;return u},Z=async(i,e,s,o)=>{const n=(await s.listLabels()).filter(r=>r!==t.MAIN_WINDOW),a=Object.keys(i.windows).filter(r=>r!==t.MAIN_WINDOW);t.group(o,"syncInitial"),t.log(o,"existing windows in runtime",n.sort()),t.log(o,"non-main windows in state",a.sort()),t.groupEnd(o);const c=t.yu.unique([...n,...a]);for(const r of c)!n.includes(r)&&s.isMain()?(t.log(o,"state window not in runtime, creating",r),await k(s,r,i.windows[r],o)):a.includes(r)||(t.log(o,"runtime window not in state, closing",r),await y(s,r,o));const l=s.label(),d=i.windows[l];if(d==null)return;const u={...t.INITIAL_WINDOW_STATE};await I(u,d,s,o),e(t.runtimeSetWindowProps({label:s.label(),...await s.getProps()}))},U=async(i,e,s,o)=>{t.log(o,"sync",i,e),s.isMain()&&await K(i,e,s,o);const n=i.windows[s.label()],a=e.windows[s.label()];n==null||a==null||await I(n,a,s,o)},I=async(i,e,s,o)=>{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,c=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??=(await s.getProps()).position,d!=null&&(await s.setPosition(t.Nu.translate(d,{x:1,y:1})),await s.setPosition(d))}]);if(a&&c&&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&&!t.Mu.equals(e.minSize,i.minSize)&&n.push(["minSize",{prev:i.minSize,next:e.minSize},async()=>await s.setMinSize(e.minSize)]),e.maxSize!=null&&!t.Mu.equals(e.maxSize,i.maxSize)&&n.push(["maxSize",{prev:i.maxSize,next:e.maxSize},async()=>await s.setMaxSize(e.maxSize)]),e.size!=null&&!t.Mu.equals(e.size,i.size)&&n.push(["size",{prev:i.size,next:e.size},async()=>await s.setSize(e.size)]),e.position!=null&&!t.Mu.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&&!c&&l(),n.length!==0){t.group(o,`syncCurrent, label: ${s.label()}, key: ${e.key}`);for(const[d,{prev:u,next:r}]of n)t.log(o,d,u,"->",r);t.groupEnd(o);for(const[,,d]of n)await d()}},K=async(i,e,s,o)=>{const n=Object.keys(i.windows).filter(l=>!(l in e.windows)),a=Object.keys(e.windows).filter(l=>!(l in i.windows)),c=s.isMain();if(c&&n.length>0)for(const l of n)t.log(o,"syncMain","closing",l),l===t.MAIN_WINDOW&&await Promise.all(Object.keys(e.windows).filter(d=>d!==t.MAIN_WINDOW).map(async d=>await y(s,d,o))),await y(s,l,o);if(c&&a.length>0)for(const l of a)await k(s,l,e.windows[l],o)},k=async(i,e,s,o)=>(t.log(o,"createWindow",s),await i.create(e,j(s))),y=async(i,e,s)=>(t.log(s,"closeWindow",e),await i.close(e)),z="[drift] - unexpected undefined action",m="[drift] - unexpected undefined action type",p=i=>{if(i.emitted??=!1,i.action==null)throw console.warn(z,i),new Error(z);if(i.action.type==null||i.action.type.length===0)throw console.warn(m,i),new Error(m)},Q=new D,X=[t.runtimeSetWindowProps.type,t.reloadWindow.type],$=(i,e=!1)=>s=>o=>n=>{let{action:a,emitted:c,emitter:l}=V(n);const d=i.label();p({action:n,emitted:c,emitter:l});const u=t.isDriftAction(a.type);if(u&&t.log(e,"[drift] - middleware",{action:a,emitted:c,emitter:l,host:d}),l===i.label())return;const r=u&&!X.includes(a.type);let w=null;u&&(w=s.getState().drift,a=t.assignLabel(a,w));const h=o(a),_=r?s.getState().drift:null,A=t.shouldEmit(c,a.type);return Q.runExclusive(async()=>{try{w!==null&&_!==null&&await U(w,_,i,e),A&&await i.emit({action:a})}catch(S){t.log(e,"[drift] - ERROR",{error:S.message,action:a,emitted:c,emitter:l,host:d}),s.dispatch(t.setWindowError({key:d,message:S.message}))}}),h},Y=(i,e,s=!1)=>o=>{const n=i!=null?typeof i=="function"?i(o):i:o();return[$(e,s),...n]},B=async({runtime:i,preloadedState:e,middleware:s,debug:o=!1,enablePrerender:n=!0,defaultWindowProps:a,...c})=>{await i.configure();let l;l=O.configureStore({...c,preloadedState:await G(o,i,()=>l,a,e),middleware:Y(s,i,o)}),await Z(l.getState().drift,l.dispatch,i,o);const d=i.label();return l.dispatch(t.internalSetInitial({enablePrerender:n,defaultWindowProps:a,debug:o,label:d})),l.dispatch(t.setWindowStage({stage:"created"})),i.onCloseRequested(()=>l?.dispatch(t.closeWindow({}))),l},G=async(i,e,s,o,n)=>e.isMain()?(await e.subscribe(({action:c,emitter:l,sendState:d})=>{const u=s();if(u==null)return;if(c!=null){p({action:c,emitter:l}),u.dispatch(b(c,l));return}const r=u.getState();d===!0&&e.emit({state:r},l)}),typeof n=="function"?g(o,i,await n()):g(o,i,n)):await new Promise((c,l)=>{(async()=>{try{await e.subscribe(({action:u,emitter:r,state:w})=>{const h=s();if(h==null)return w!=null?c(w):void 0;u!=null&&(p({action:u,emitter:r}),h.dispatch(b(u,r)))}),await e.emit({sendState:!0},t.MAIN_WINDOW)}catch(u){l(u)}})()}),W=B,g=(i,e,s)=>{if(s==null)return s;const o=s[t.SLICE_NAME];return o.config.debug=e??o.config.debug,o.windows=Object.fromEntries(Object.entries(o.windows).filter(([,n])=>n.reserved).map(([n,a])=>(i?.visible!=null&&(a.visible=i.visible),a.focusCount=0,a.centerCount=0,a.processCount=0,[n,a]))),s};class v{async emit(){}async subscribe(){}isMain(){return!0}label(){return t.MAIN_WINDOW}onCloseRequested(){}async listLabels(){return[]}async getProps(){return{}}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 setDecorations(){}async setTitle(){}async configure(){}}const H=Object.freeze(Object.defineProperty({__proto__:null,MAIN_WINDOW:t.MAIN_WINDOW,NoopRuntime:v,SLICE_NAME:t.SLICE_NAME,ZERO_SLICE_STATE:t.ZERO_SLICE_STATE,closeWindow:t.closeWindow,completeProcess:t.completeProcess,configureStore:W,createWindow:t.createWindow,focusWindow:t.focusWindow,reducer:t.reducer,registerProcess:t.registerProcess,reloadWindow:t.reloadWindow,selectSliceState:f.selectSliceState,selectWindow:f.selectWindow,selectWindowAttribute:f.selectWindowAttribute,selectWindowKey:f.selectWindowKey,selectWindowLabel:f.selectWindowLabel,selectWindows:f.selectWindows,setWindowAlwaysOnTop:t.setWindowAlwaysOnTop,setWindowDecorations:t.setWindowDecorations,setWindowFullscreen:t.setWindowFullscreen,setWindowMaxSize:t.setWindowMaxSize,setWindowMaximized:t.setWindowMaximized,setWindowMinSize:t.setWindowMinSize,setWindowMinimized:t.setWindowMinimized,setWindowPosition:t.setWindowPosition,setWindowProps:t.setWindowProps,setWindowResizable:t.setWindowResizable,setWindowSize:t.setWindowSize,setWindowSkipTaskbar:t.setWindowSkipTaskbar,setWindowStage:t.setWindowStage,setWindowTitle:t.setWindowTitle,setWindowVisible:t.setWindowVisible,windowPropsZ:t.windowPropsZ},Symbol.toStringTag,{value:"Module"}));exports.MAIN_WINDOW=t.MAIN_WINDOW;exports.SLICE_NAME=t.SLICE_NAME;exports.ZERO_SLICE_STATE=t.ZERO_SLICE_STATE;exports.closeWindow=t.closeWindow;exports.completeProcess=t.completeProcess;exports.createWindow=t.createWindow;exports.focusWindow=t.focusWindow;exports.reducer=t.reducer;exports.registerProcess=t.registerProcess;exports.reloadWindow=t.reloadWindow;exports.setWindowAlwaysOnTop=t.setWindowAlwaysOnTop;exports.setWindowDecorations=t.setWindowDecorations;exports.setWindowFullscreen=t.setWindowFullscreen;exports.setWindowMaxSize=t.setWindowMaxSize;exports.setWindowMaximized=t.setWindowMaximized;exports.setWindowMinSize=t.setWindowMinSize;exports.setWindowMinimized=t.setWindowMinimized;exports.setWindowPosition=t.setWindowPosition;exports.setWindowProps=t.setWindowProps;exports.setWindowResizable=t.setWindowResizable;exports.setWindowSize=t.setWindowSize;exports.setWindowSkipTaskbar=t.setWindowSkipTaskbar;exports.setWindowStage=t.setWindowStage;exports.setWindowTitle=t.setWindowTitle;exports.setWindowVisible=t.setWindowVisible;exports.windowPropsZ=t.windowPropsZ;exports.selectSliceState=f.selectSliceState;exports.selectWindow=f.selectWindow;exports.selectWindowAttribute=f.selectWindowAttribute;exports.selectWindowKey=f.selectWindowKey;exports.selectWindowLabel=f.selectWindowLabel;exports.selectWindows=f.selectWindows;exports.Drift=H;exports.NoopRuntime=v;exports.configureStore=W;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("@reduxjs/toolkit"),t=require("./state-BFBdNgbN.cjs"),f=require("./selectors-bSOXrqbl.cjs"),P=new Error("request for lock canceled");var N=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(c){c(a)})}return new(s||(s=Promise))(function(a,c){function l(r){try{u(o.next(r))}catch(w){c(w)}}function d(r){try{u(o.throw(r))}catch(w){c(w)}}function u(r){r.done?a(r.value):n(r.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class C{constructor(e,s=P){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((o,n)=>{const a={resolve:o,reject:n,weight:e,priority:s},c=T(this._queue,l=>s<=l.priority);c===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(c+1,0,a)})}runExclusive(e){return N(this,arguments,void 0,function*(s,o=1,n=0){const[a,c]=yield this.acquire(o,n);try{return yield s(a)}finally{c()}})}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(o=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),L(this._weightedWaiters[e-1],{resolve:o,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(o=>o.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let s=this._value;s>0;s--){const o=this._weightedWaiters[s-1];if(!o)continue;const n=o.findIndex(a=>a.priority<=e);(n===-1?o:o.splice(0,n)).forEach((a=>a.resolve()))}}}_couldLockImmediately(e,s){return(this._queue.length===0||this._queue[0].priority<s)&&e<=this._value}}function L(i,e){const s=T(i,o=>e.priority<=o.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,o){function n(a){return a instanceof s?a:new s(function(c){c(a)})}return new(s||(s=Promise))(function(a,c){function l(r){try{u(o.next(r))}catch(w){c(w)}}function d(r){try{u(o.throw(r))}catch(w){c(w)}}function u(r){r.done?a(r.value):n(r.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class D{constructor(e){this._semaphore=new C(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 I="DA@",M="://",R=(i,e)=>I.concat(e,M,i),F=i=>{const[e,s]=i.split(M);if(s==null)return[i,""];const[,o]=e.split(I);return[s,o]},b=(i,e)=>({...i,type:R(i.type,e)}),V=i=>{const[e,s]=F(i.type);return{emitted:s!=null&&s.length>0,emitter:s,action:{...i,type:e}}},j=i=>{const{centerCount:e,processCount:s,focusCount:o,stage:n,key:a,prerenderLabel:c,reserved:l,minimized:d,...u}=i;return u},Z=async(i,e,s,o)=>{const n=(await s.listLabels()).filter(r=>r!==t.MAIN_WINDOW),a=Object.keys(i.windows).filter(r=>r!==t.MAIN_WINDOW);t.group(o,"syncInitial"),t.log(o,"existing windows in runtime",n.sort()),t.log(o,"non-main windows in state",a.sort()),t.groupEnd(o);const c=t.gu.unique([...n,...a]);for(const r of c)!n.includes(r)&&s.isMain()?(t.log(o,"state window not in runtime, creating",r),await k(s,r,i.windows[r],o)):a.includes(r)||(t.log(o,"runtime window not in state, closing",r),await p(s,r,o));const l=s.label(),d=i.windows[l];if(d==null)return;const u={...t.INITIAL_WINDOW_STATE};await E(u,d,s,o),e(t.runtimeSetWindowProps({label:s.label(),...await s.getProps()}))},U=async(i,e,s,o)=>{t.log(o,"sync",i,e),s.isMain()&&await K(i,e,s,o);const n=i.windows[s.label()],a=e.windows[s.label()];n==null||a==null||await E(n,a,s,o)},E=async(i,e,s,o)=>{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,c=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??=(await s.getProps()).position,d!=null&&(await s.setPosition(t.Iu.translate(d,{x:1,y:1})),await s.setPosition(d))}]);if(a&&c&&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&&!t.vu.equals(e.minSize,i.minSize)&&n.push(["minSize",{prev:i.minSize,next:e.minSize},async()=>await s.setMinSize(e.minSize)]),e.maxSize!=null&&!t.vu.equals(e.maxSize,i.maxSize)&&n.push(["maxSize",{prev:i.maxSize,next:e.maxSize},async()=>await s.setMaxSize(e.maxSize)]),e.size!=null&&!t.vu.equals(e.size,i.size)&&n.push(["size",{prev:i.size,next:e.size},async()=>await s.setSize(e.size)]),e.position!=null&&!t.vu.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&&!c&&l(),n.length!==0){t.group(o,`syncCurrent, label: ${s.label()}, key: ${e.key}`);for(const[d,{prev:u,next:r}]of n)t.log(o,d,u,"->",r);t.groupEnd(o);for(const[,,d]of n)await d()}},K=async(i,e,s,o)=>{const n=Object.keys(i.windows).filter(l=>!(l in e.windows)),a=Object.keys(e.windows).filter(l=>!(l in i.windows)),c=s.isMain();if(c&&n.length>0)for(const l of n)t.log(o,"syncMain","closing",l),l===t.MAIN_WINDOW&&await Promise.all(Object.keys(e.windows).filter(d=>d!==t.MAIN_WINDOW).map(async d=>await p(s,d,o))),await p(s,l,o);if(c&&a.length>0)for(const l of a)await k(s,l,e.windows[l],o)},k=async(i,e,s,o)=>(t.log(o,"createWindow",s),await i.create(e,j(s))),p=async(i,e,s)=>(t.log(s,"closeWindow",e),await i.close(e)),z="[drift] - unexpected undefined action",m="[drift] - unexpected undefined action type",y=i=>{if(i.emitted??=!1,i.action==null)throw console.warn(z,i),new Error(z);if(i.action.type==null||i.action.type.length===0)throw console.warn(m,i),new Error(m)},Q=new D,X=[t.runtimeSetWindowProps.type,t.reloadWindow.type],$=(i,e=!1)=>s=>o=>n=>{let{action:a,emitted:c,emitter:l}=V(n);const d=i.label();y({action:n,emitted:c,emitter:l});const u=t.isDriftAction(a.type);if(u&&t.log(e,"[drift] - middleware",{action:a,emitted:c,emitter:l,host:d}),l===i.label())return;const r=u&&!X.includes(a.type);let w=null;u&&(w=s.getState().drift,a=t.assignLabel(a,w));const h=o(a),_=r?s.getState().drift:null,A=t.shouldEmit(c,a.type);return Q.runExclusive(async()=>{try{w!==null&&_!==null&&await U(w,_,i,e),A&&await i.emit({action:a})}catch(S){t.log(e,"[drift] - ERROR",{error:S.message,action:a,emitted:c,emitter:l,host:d}),s.dispatch(t.setWindowError({key:d,message:S.message}))}}),h},Y=(i,e,s=!1)=>o=>{const n=i!=null?typeof i=="function"?i(o):i:o();return[$(e,s),...n]},B=async({runtime:i,preloadedState:e,middleware:s,debug:o=!1,enablePrerender:n=!0,defaultWindowProps:a,...c})=>{await i.configure();let l;l=O.configureStore({...c,preloadedState:await G(o,i,()=>l,a,e),middleware:Y(s,i,o)}),await Z(l.getState().drift,l.dispatch,i,o);const d=i.label();return l.dispatch(t.internalSetInitial({enablePrerender:n,defaultWindowProps:a,debug:o,label:d})),l.dispatch(t.setWindowStage({stage:"created"})),i.onCloseRequested(()=>l?.dispatch(t.closeWindow({}))),l},G=async(i,e,s,o,n)=>e.isMain()?(await e.subscribe(({action:c,emitter:l,sendState:d})=>{const u=s();if(u==null)return;if(c!=null){y({action:c,emitter:l}),u.dispatch(b(c,l));return}const r=u.getState();d===!0&&e.emit({state:r},l)}),typeof n=="function"?g(o,i,await n()):g(o,i,n)):await new Promise((c,l)=>{(async()=>{try{await e.subscribe(({action:u,emitter:r,state:w})=>{const h=s();if(h==null)return w!=null?c(w):void 0;u!=null&&(y({action:u,emitter:r}),h.dispatch(b(u,r)))}),await e.emit({sendState:!0},t.MAIN_WINDOW)}catch(u){l(u)}})()}),W=B,g=(i,e,s)=>{if(s==null)return s;const o=s[t.SLICE_NAME];return o.config.debug=e??o.config.debug,o.windows=Object.fromEntries(Object.entries(o.windows).filter(([,n])=>n.reserved).map(([n,a])=>(i?.visible!=null&&(a.visible=i.visible),a.focusCount=0,a.centerCount=0,a.processCount=0,[n,a]))),s};class v{async emit(){}async subscribe(){}isMain(){return!0}label(){return t.MAIN_WINDOW}onCloseRequested(){}async listLabels(){return[]}async getProps(){return{}}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 setDecorations(){}async setTitle(){}async configure(){}}const H=Object.freeze(Object.defineProperty({__proto__:null,MAIN_WINDOW:t.MAIN_WINDOW,NoopRuntime:v,SLICE_NAME:t.SLICE_NAME,ZERO_SLICE_STATE:t.ZERO_SLICE_STATE,closeWindow:t.closeWindow,completeProcess:t.completeProcess,configureStore:W,createWindow:t.createWindow,focusWindow:t.focusWindow,reducer:t.reducer,registerProcess:t.registerProcess,reloadWindow:t.reloadWindow,selectSliceState:f.selectSliceState,selectWindow:f.selectWindow,selectWindowAttribute:f.selectWindowAttribute,selectWindowKey:f.selectWindowKey,selectWindowLabel:f.selectWindowLabel,selectWindows:f.selectWindows,setWindowAlwaysOnTop:t.setWindowAlwaysOnTop,setWindowDecorations:t.setWindowDecorations,setWindowFullscreen:t.setWindowFullscreen,setWindowMaxSize:t.setWindowMaxSize,setWindowMaximized:t.setWindowMaximized,setWindowMinSize:t.setWindowMinSize,setWindowMinimized:t.setWindowMinimized,setWindowPosition:t.setWindowPosition,setWindowProps:t.setWindowProps,setWindowResizable:t.setWindowResizable,setWindowSize:t.setWindowSize,setWindowSkipTaskbar:t.setWindowSkipTaskbar,setWindowStage:t.setWindowStage,setWindowTitle:t.setWindowTitle,setWindowVisible:t.setWindowVisible,windowPropsZ:t.windowPropsZ},Symbol.toStringTag,{value:"Module"}));exports.MAIN_WINDOW=t.MAIN_WINDOW;exports.SLICE_NAME=t.SLICE_NAME;exports.ZERO_SLICE_STATE=t.ZERO_SLICE_STATE;exports.closeWindow=t.closeWindow;exports.completeProcess=t.completeProcess;exports.createWindow=t.createWindow;exports.focusWindow=t.focusWindow;exports.reducer=t.reducer;exports.registerProcess=t.registerProcess;exports.reloadWindow=t.reloadWindow;exports.setWindowAlwaysOnTop=t.setWindowAlwaysOnTop;exports.setWindowDecorations=t.setWindowDecorations;exports.setWindowFullscreen=t.setWindowFullscreen;exports.setWindowMaxSize=t.setWindowMaxSize;exports.setWindowMaximized=t.setWindowMaximized;exports.setWindowMinSize=t.setWindowMinSize;exports.setWindowMinimized=t.setWindowMinimized;exports.setWindowPosition=t.setWindowPosition;exports.setWindowProps=t.setWindowProps;exports.setWindowResizable=t.setWindowResizable;exports.setWindowSize=t.setWindowSize;exports.setWindowSkipTaskbar=t.setWindowSkipTaskbar;exports.setWindowStage=t.setWindowStage;exports.setWindowTitle=t.setWindowTitle;exports.setWindowVisible=t.setWindowVisible;exports.windowPropsZ=t.windowPropsZ;exports.selectSliceState=f.selectSliceState;exports.selectWindow=f.selectWindow;exports.selectWindowAttribute=f.selectWindowAttribute;exports.selectWindowKey=f.selectWindowKey;exports.selectWindowLabel=f.selectWindowLabel;exports.selectWindows=f.selectWindows;exports.Drift=H;exports.NoopRuntime=v;exports.configureStore=W;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { configureStore as
|
|
2
|
-
import { M as w, g
|
|
3
|
-
import { s as we, a as he, b as ye, c as pe, d as _e, e as be } from "./selectors-
|
|
1
|
+
import { configureStore as F } from "@reduxjs/toolkit";
|
|
2
|
+
import { M as w, g, l as f, a as T, b as N, r as E, v as y, I as V, c as j, d as I, i as $, e as U, s as Q, f as Z, h as K, j as M, k as C, S as q, Z as X, m as B, n as G, o as H, p as J, q as Y, t as x, u 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 ce, E as le, F as re, G as ue, H as de, J as fe } from "./state-CGc6dCmt.js";
|
|
3
|
+
import { s as we, a as he, b as ye, c as pe, d as _e, e as be } from "./selectors-D1g2urZp.js";
|
|
4
4
|
const me = new Error("request for lock canceled");
|
|
5
5
|
var ze = function(i, e, s, t) {
|
|
6
6
|
function a(o) {
|
|
@@ -147,7 +147,7 @@ var ve = function(i, e, s, t) {
|
|
|
147
147
|
u((t = t.apply(i, e || [])).next());
|
|
148
148
|
});
|
|
149
149
|
};
|
|
150
|
-
class
|
|
150
|
+
class ge {
|
|
151
151
|
constructor(e) {
|
|
152
152
|
this._semaphore = new Se(1, e);
|
|
153
153
|
}
|
|
@@ -173,22 +173,22 @@ class Te {
|
|
|
173
173
|
return this._semaphore.cancel();
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
const L = "DA@", A = "://",
|
|
176
|
+
const L = "DA@", A = "://", Te = (i, e) => L.concat(e, A, i), Ee = (i) => {
|
|
177
177
|
const [e, s] = i.split(A);
|
|
178
178
|
if (s == null) return [i, ""];
|
|
179
179
|
const [, t] = e.split(L);
|
|
180
180
|
return [s, t];
|
|
181
181
|
}, z = (i, e) => ({
|
|
182
182
|
...i,
|
|
183
|
-
type:
|
|
184
|
-
}),
|
|
183
|
+
type: Te(i.type, e)
|
|
184
|
+
}), Ie = (i) => {
|
|
185
185
|
const [e, s] = Ee(i.type);
|
|
186
186
|
return {
|
|
187
187
|
emitted: s != null && s.length > 0,
|
|
188
188
|
emitter: s,
|
|
189
189
|
action: { ...i, type: e }
|
|
190
190
|
};
|
|
191
|
-
},
|
|
191
|
+
}, Me = (i) => {
|
|
192
192
|
const {
|
|
193
193
|
centerCount: e,
|
|
194
194
|
processCount: s,
|
|
@@ -205,8 +205,8 @@ const L = "DA@", A = "://", ge = (i, e) => L.concat(e, A, i), Ee = (i) => {
|
|
|
205
205
|
const a = (await s.listLabels()).filter(
|
|
206
206
|
(l) => l !== w
|
|
207
207
|
), o = Object.keys(i.windows).filter((l) => l !== w);
|
|
208
|
-
|
|
209
|
-
const c =
|
|
208
|
+
g(t, "syncInitial"), f(t, "existing windows in runtime", a.sort()), f(t, "non-main windows in state", o.sort()), T(t);
|
|
209
|
+
const c = N.unique([...a, ...o]);
|
|
210
210
|
for (const l of c)
|
|
211
211
|
!a.includes(l) && s.isMain() ? (f(t, "state window not in runtime, creating", l), await R(s, l, i.windows[l], t)) : o.includes(l) || (f(t, "runtime window not in state, closing", l), await p(s, l, t));
|
|
212
212
|
const n = s.label(), r = i.windows[n];
|
|
@@ -295,9 +295,9 @@ const L = "DA@", A = "://", ge = (i, e) => L.concat(e, A, i), Ee = (i) => {
|
|
|
295
295
|
{ prev: i.alwaysOnTop, next: e.alwaysOnTop },
|
|
296
296
|
async () => await s.setAlwaysOnTop(e.alwaysOnTop)
|
|
297
297
|
]), o && !c && n(), a.length !== 0) {
|
|
298
|
-
|
|
298
|
+
g(t, `syncCurrent, label: ${s.label()}, key: ${e.key}`);
|
|
299
299
|
for (const [r, { prev: u, next: l }] of a) f(t, r, u, "->", l);
|
|
300
|
-
|
|
300
|
+
T(t);
|
|
301
301
|
for (const [, , r] of a) await r();
|
|
302
302
|
}
|
|
303
303
|
}, Oe = async (i, e, s, t) => {
|
|
@@ -310,13 +310,13 @@ const L = "DA@", A = "://", ge = (i, e) => L.concat(e, A, i), Ee = (i) => {
|
|
|
310
310
|
if (c && o.length > 0)
|
|
311
311
|
for (const n of o)
|
|
312
312
|
await R(s, n, e.windows[n], t);
|
|
313
|
-
}, R = async (i, e, s, t) => (f(t, "createWindow", s), await i.create(e,
|
|
313
|
+
}, R = async (i, e, s, t) => (f(t, "createWindow", s), await i.create(e, Me(s))), p = async (i, e, s) => (f(s, "closeWindow", e), await i.close(e)), S = "[drift] - unexpected undefined action", k = "[drift] - unexpected undefined action type", _ = (i) => {
|
|
314
314
|
if (i.emitted ??= !1, i.action == null)
|
|
315
315
|
throw console.warn(S, i), new Error(S);
|
|
316
316
|
if (i.action.type == null || i.action.type.length === 0)
|
|
317
317
|
throw console.warn(k, i), new Error(k);
|
|
318
|
-
}, Le = new
|
|
319
|
-
let { action: o, emitted: c, emitter: n } =
|
|
318
|
+
}, Le = new ge(), Ae = [E.type, I.type], Pe = (i, e = !1) => (s) => (t) => (a) => {
|
|
319
|
+
let { action: o, emitted: c, emitter: n } = Ie(a);
|
|
320
320
|
const r = i.label();
|
|
321
321
|
_({ action: a, emitted: c, emitter: n });
|
|
322
322
|
const u = $(o.type);
|
|
@@ -360,9 +360,9 @@ const L = "DA@", A = "://", ge = (i, e) => L.concat(e, A, i), Ee = (i) => {
|
|
|
360
360
|
}) => {
|
|
361
361
|
await i.configure();
|
|
362
362
|
let n;
|
|
363
|
-
n =
|
|
363
|
+
n = F({
|
|
364
364
|
...c,
|
|
365
|
-
preloadedState: await
|
|
365
|
+
preloadedState: await Fe(
|
|
366
366
|
t,
|
|
367
367
|
i,
|
|
368
368
|
() => n,
|
|
@@ -374,8 +374,8 @@ const L = "DA@", A = "://", ge = (i, e) => L.concat(e, A, i), Ee = (i) => {
|
|
|
374
374
|
const r = i.label();
|
|
375
375
|
return n.dispatch(
|
|
376
376
|
K({ enablePrerender: a, defaultWindowProps: o, debug: t, label: r })
|
|
377
|
-
), n.dispatch(
|
|
378
|
-
},
|
|
377
|
+
), n.dispatch(M({ stage: "created" })), i.onCloseRequested(() => n?.dispatch(C({}))), n;
|
|
378
|
+
}, Fe = async (i, e, s, t, a) => e.isMain() ? (await e.subscribe(({ action: c, emitter: n, sendState: r }) => {
|
|
379
379
|
const u = s();
|
|
380
380
|
if (u == null) return;
|
|
381
381
|
if (c != null) {
|
|
@@ -397,7 +397,7 @@ const L = "DA@", A = "://", ge = (i, e) => L.concat(e, A, i), Ee = (i) => {
|
|
|
397
397
|
n(u);
|
|
398
398
|
}
|
|
399
399
|
})();
|
|
400
|
-
}),
|
|
400
|
+
}), Ne = De, v = (i, e, s) => {
|
|
401
401
|
if (s == null) return s;
|
|
402
402
|
const t = s[q];
|
|
403
403
|
return t.config.debug = e ?? t.config.debug, t.windows = Object.fromEntries(
|
|
@@ -468,12 +468,12 @@ const Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
468
468
|
ZERO_SLICE_STATE: X,
|
|
469
469
|
closeWindow: C,
|
|
470
470
|
completeProcess: B,
|
|
471
|
-
configureStore:
|
|
471
|
+
configureStore: Ne,
|
|
472
472
|
createWindow: G,
|
|
473
473
|
focusWindow: H,
|
|
474
|
-
reducer:
|
|
475
|
-
registerProcess:
|
|
476
|
-
reloadWindow:
|
|
474
|
+
reducer: J,
|
|
475
|
+
registerProcess: Y,
|
|
476
|
+
reloadWindow: I,
|
|
477
477
|
selectSliceState: we,
|
|
478
478
|
selectWindow: he,
|
|
479
479
|
selectWindowAttribute: ye,
|
|
@@ -492,7 +492,7 @@ const Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
492
492
|
setWindowResizable: ce,
|
|
493
493
|
setWindowSize: le,
|
|
494
494
|
setWindowSkipTaskbar: re,
|
|
495
|
-
setWindowStage:
|
|
495
|
+
setWindowStage: M,
|
|
496
496
|
setWindowTitle: ue,
|
|
497
497
|
setWindowVisible: de,
|
|
498
498
|
windowPropsZ: fe
|
|
@@ -505,12 +505,12 @@ export {
|
|
|
505
505
|
X as ZERO_SLICE_STATE,
|
|
506
506
|
C as closeWindow,
|
|
507
507
|
B as completeProcess,
|
|
508
|
-
|
|
508
|
+
Ne as configureStore,
|
|
509
509
|
G as createWindow,
|
|
510
510
|
H as focusWindow,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
511
|
+
J as reducer,
|
|
512
|
+
Y as registerProcess,
|
|
513
|
+
I as reloadWindow,
|
|
514
514
|
we as selectSliceState,
|
|
515
515
|
he as selectWindow,
|
|
516
516
|
ye as selectWindowAttribute,
|
|
@@ -529,7 +529,7 @@ export {
|
|
|
529
529
|
ce as setWindowResizable,
|
|
530
530
|
le as setWindowSize,
|
|
531
531
|
re as setWindowSkipTaskbar,
|
|
532
|
-
|
|
532
|
+
M as setWindowStage,
|
|
533
533
|
ue as setWindowTitle,
|
|
534
534
|
de as setWindowVisible,
|
|
535
535
|
fe as windowPropsZ
|
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-bSOXrqbl.cjs"),i=require("./state-BFBdNgbN.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,24 +1,24 @@
|
|
|
1
1
|
import { useCallback as l, useRef as f, useEffect as m, useState as d, createElement as W } from "react";
|
|
2
|
-
import { useSelector as u, useDispatch as y, Provider as
|
|
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
|
|
5
|
-
import {
|
|
4
|
+
import { a as k, b as S, c as P, e as v } from "./selectors-D1g2urZp.js";
|
|
5
|
+
import { q as w, m as p } from "./state-CGc6dCmt.js";
|
|
6
6
|
const h = (e) => u(
|
|
7
7
|
l(
|
|
8
|
-
i((r) =>
|
|
8
|
+
i((r) => k(r, e)),
|
|
9
9
|
[e]
|
|
10
10
|
)
|
|
11
|
-
),
|
|
11
|
+
), q = () => u(l(i(v), [])), x = (e) => u(
|
|
12
12
|
l(
|
|
13
13
|
i((r) => P(r, e)),
|
|
14
14
|
[e]
|
|
15
15
|
)
|
|
16
|
-
),
|
|
16
|
+
), z = (e, r) => u(
|
|
17
17
|
l(
|
|
18
|
-
i((t) =>
|
|
18
|
+
i((t) => S(t, e, r)),
|
|
19
19
|
[e, r]
|
|
20
20
|
)
|
|
21
|
-
),
|
|
21
|
+
), C = (e, r) => {
|
|
22
22
|
const t = h(r), o = y(), n = f(null);
|
|
23
23
|
m(() => {
|
|
24
24
|
if (t == null) return;
|
|
@@ -28,7 +28,7 @@ const h = (e) => u(
|
|
|
28
28
|
s != null && (n.current = s), o(w({ key: t.key }));
|
|
29
29
|
} else (c === "closing" || c === "reloading") && n.current != null && (n.current(), n.current = null, o(p({ key: t.key })));
|
|
30
30
|
}, [t]);
|
|
31
|
-
},
|
|
31
|
+
}, L = (e, r) => {
|
|
32
32
|
const t = h(r), o = y(), n = f(null), c = f(!1);
|
|
33
33
|
m(() => {
|
|
34
34
|
if (t == null) return;
|
|
@@ -49,7 +49,7 @@ const h = (e) => u(
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}, [t]);
|
|
52
|
-
},
|
|
52
|
+
}, R = ({
|
|
53
53
|
store: e,
|
|
54
54
|
emptyContent: r = null,
|
|
55
55
|
children: t
|
|
@@ -57,14 +57,14 @@ const h = (e) => u(
|
|
|
57
57
|
const [o, n] = d(null), [c, s] = d(null);
|
|
58
58
|
if (c != null)
|
|
59
59
|
throw s(null), c;
|
|
60
|
-
return o == null ? (e instanceof Promise ? e.then(n).catch(s) : n(e), r) : W(
|
|
60
|
+
return o == null ? (e instanceof Promise ? e.then(n).catch(s) : n(e), r) : W(g, { store: o }, t);
|
|
61
61
|
};
|
|
62
62
|
export {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
R as Provider,
|
|
64
|
+
L as useAsyncWindowLifecycle,
|
|
65
65
|
h as useSelectWindow,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
z as useSelectWindowAttribute,
|
|
67
|
+
x as useSelectWindowKey,
|
|
68
|
+
q as useSelectWindows,
|
|
69
|
+
C as useWindowLifecycle
|
|
70
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("./state-
|
|
1
|
+
"use strict";const i=require("./state-BFBdNgbN.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]},u=(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},w=(n,e,t)=>c(n,e)?.[t]??null,d=(n,e)=>s(n).keyLabels[e];exports.selectSliceState=s;exports.selectWindow=c;exports.selectWindowAttribute=w;exports.selectWindowKey=u;exports.selectWindowLabel=d;exports.selectWindows=r;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Action as
|
|
1
|
+
import { Action as BaseAction, ConfigureStoreOptions as BaseOpts, EnhancedStore, StoreEnhancer, Tuple, UnknownAction } from '@reduxjs/toolkit';
|
|
2
2
|
import { Middlewares } from './middleware';
|
|
3
3
|
import { Runtime } from './runtime';
|
|
4
4
|
import { Action, StoreState } from './state';
|
|
@@ -8,7 +8,7 @@ export type Enhancers = readonly StoreEnhancer[];
|
|
|
8
8
|
* Extends the default configureStore options to add a runtime argument.
|
|
9
9
|
* See configureStore for more details.
|
|
10
10
|
*/
|
|
11
|
-
export interface ConfigureStoreOptions<S extends StoreState, A extends
|
|
11
|
+
export interface ConfigureStoreOptions<S extends StoreState, A extends BaseAction = UnknownAction, M extends Tuple<Middlewares<S>> = Tuple<Middlewares<S>>, E extends Tuple<Enhancers> = Tuple<Enhancers>> extends Omit<BaseOpts<S, A, M, E>, "preloadedState"> {
|
|
12
12
|
runtime: Runtime<S, A | Action>;
|
|
13
13
|
debug?: boolean;
|
|
14
14
|
preloadedState?: S | (() => Promise<S | undefined>);
|
|
@@ -20,7 +20,7 @@ export interface ConfigureStoreOptions<S extends StoreState, A extends CoreActio
|
|
|
20
20
|
* that enables drift to synchronize state between windows. The API is identical to the
|
|
21
21
|
* standard configureStore function, except for two important differences.
|
|
22
22
|
*
|
|
23
|
-
* @param options.runtime - The
|
|
23
|
+
* @param options.runtime - The main runtime of the application. This should be chosen
|
|
24
24
|
* based on the platform you are running on (Tauri, etc.).
|
|
25
25
|
* @param options.debug - If true, drift will log debug information to the console.
|
|
26
26
|
* @default false
|
|
@@ -37,6 +37,6 @@ export interface ConfigureStoreOptions<S extends StoreState, A extends CoreActio
|
|
|
37
37
|
* operation. The promise will resolve when the store is configured and the window is
|
|
38
38
|
* ready for use.
|
|
39
39
|
*/
|
|
40
|
-
export declare const configureStore: <S extends StoreState, A extends
|
|
40
|
+
export declare const configureStore: <S extends StoreState, A extends BaseAction = UnknownAction, M extends Tuple<Middlewares<S>> = Tuple<Middlewares<S>>, E extends Tuple<Enhancers> = Tuple<Enhancers>>(options: ConfigureStoreOptions<S, A, M, E>) => Promise<EnhancedStore<S, A | Action>>;
|
|
41
41
|
export declare const resetInitialState: <S extends StoreState>(defaultWindowProps?: Omit<WindowProps, "key">, debug?: boolean, state?: S) => S | undefined;
|
|
42
42
|
//# sourceMappingURL=configureStore.d.ts.map
|
package/dist/src/middleware.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Action as
|
|
1
|
+
import { Action as BaseAction, configureStore, Dispatch, Middleware, Tuple, UnknownAction } from '@reduxjs/toolkit';
|
|
2
2
|
import { Runtime } from './runtime';
|
|
3
3
|
import { Action, StoreState } from './state';
|
|
4
4
|
export type Middlewares<S> = ReadonlyArray<Middleware<{}, S>>;
|
|
@@ -11,7 +11,7 @@ export type Middlewares<S> = ReadonlyArray<Middleware<{}, S>>;
|
|
|
11
11
|
* @param runtime - The runtime of the current application window.
|
|
12
12
|
* @returns a Redux middleware.
|
|
13
13
|
*/
|
|
14
|
-
export declare const middleware: <S extends StoreState, A extends
|
|
14
|
+
export declare const middleware: <S extends StoreState, A extends BaseAction = UnknownAction>(runtime: Runtime<S, A | Action>, debug?: boolean) => Middleware<Dispatch<A | Action>, S, Dispatch<A | Action>>;
|
|
15
15
|
/**
|
|
16
16
|
* Configures the Redux middleware for the current window's store.
|
|
17
17
|
*
|
|
@@ -19,9 +19,9 @@ export declare const middleware: <S extends StoreState, A extends CoreAction = U
|
|
|
19
19
|
* @param runtime - The runtime of the current window.
|
|
20
20
|
* @returns a middleware function to be passed to `configureStore`.
|
|
21
21
|
*/
|
|
22
|
-
export declare const configureMiddleware: <S extends StoreState, A extends
|
|
23
|
-
type ConfigureStoreOptions<S extends StoreState, A extends
|
|
24
|
-
type MW<S extends StoreState, A extends
|
|
22
|
+
export declare const configureMiddleware: <S extends StoreState, A extends BaseAction = UnknownAction, M extends Middlewares<S> = Middlewares<S>>(mw: M | ((def: GetDefaultMiddleware<S>) => M) | undefined, runtime: Runtime<S, A | Action>, debug?: boolean) => ((def: GetDefaultMiddleware<S>) => M);
|
|
23
|
+
type ConfigureStoreOptions<S extends StoreState, A extends BaseAction = UnknownAction, M extends Tuple<Middlewares<S>> = Tuple<Middlewares<S>>> = Parameters<typeof configureStore<S, A, M>>[0];
|
|
24
|
+
type MW<S extends StoreState, A extends BaseAction = UnknownAction, M extends Tuple<Middlewares<S>> = Tuple<Middlewares<S>>> = NonNullable<ConfigureStoreOptions<S, A, M>["middleware"]>;
|
|
25
25
|
export type GetDefaultMiddleware<S extends StoreState> = Parameters<MW<S>>[0];
|
|
26
26
|
export {};
|
|
27
27
|
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/mock/runtime.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,EAAE,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,qBAAa,WAAW,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/mock/runtime.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,EAAE,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,KA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
|
|
1
|
-
{"version":3,"file":"noop.d.ts","sourceRoot":"","sources":["../../src/noop.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzD;;;GAGG;AACH,qBAAa,WAAW,
|
|
1
|
+
{"version":3,"file":"noop.d.ts","sourceRoot":"","sources":["../../src/noop.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzD;;;GAGG;AACH,qBAAa,WAAW,CACtB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,MAAM,GAAG,aAAa,CAChC,YAAW,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAClB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAErB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC,MAAM,IAAI,OAAO;IAIjB,KAAK,IAAI,MAAM;IAIf,gBAAgB,IAAI,IAAI;IAElB,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAI/B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAI7C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAEvB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAEtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAEtB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAE7B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAE7B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAEvB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAE5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAExB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAE7B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAE/B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAE/B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAE/B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAEzB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CACjC"}
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -91,8 +91,8 @@ export interface Manager {
|
|
|
91
91
|
configure(): Promise<void>;
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
|
-
* An interface that represents the
|
|
95
|
-
*
|
|
94
|
+
* An interface that represents the main runtime of the application. Drift uses this
|
|
95
|
+
* runtime to manage windows and communicate between them.
|
|
96
96
|
*/
|
|
97
97
|
export interface Runtime<S extends StoreState, A extends Action = UnknownAction> extends Communicator<S, A>, Properties, Manager {
|
|
98
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/runtime.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,EAAE,EAAE,MAAM,eAAe,CAAC;AAEzD,OA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CAAC;IAC1C,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,UAAU,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,UAAU,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,MAAM,GAAG,aAAa,CAC7E,SAAQ,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO;CAAG"}
|
package/dist/src/sugar.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Action as
|
|
1
|
+
import { Action as BaseAction, UnknownAction } from '@reduxjs/toolkit';
|
|
2
2
|
import { Action } from './state';
|
|
3
3
|
/**
|
|
4
4
|
* Sugars an action, embedding the window key in the type.
|
|
@@ -6,7 +6,7 @@ import { Action } from './state';
|
|
|
6
6
|
* @param emitter - The window key to embed.
|
|
7
7
|
* @returns - The sugared action.
|
|
8
8
|
*/
|
|
9
|
-
export declare const sugar: <A extends
|
|
9
|
+
export declare const sugar: <A extends BaseAction = UnknownAction>(action: A, emitter: string) => A;
|
|
10
10
|
/**
|
|
11
11
|
* Desugars an action, extracting the window key from the type.
|
|
12
12
|
* @param action - The action to desugar.
|
|
@@ -16,7 +16,7 @@ export declare const sugar: <A extends CoreAction = UnknownAction>(action: A, em
|
|
|
16
16
|
* action: The desugared action.
|
|
17
17
|
* }
|
|
18
18
|
*/
|
|
19
|
-
export declare const desugar: <A extends
|
|
19
|
+
export declare const desugar: <A extends BaseAction = UnknownAction>(action: A | Action) => {
|
|
20
20
|
emitted: boolean;
|
|
21
21
|
emitter: string;
|
|
22
22
|
action: A | Action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tauri/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAIL,UAAU,EAGV,EAAE,EACH,MAAM,eAAe,CAAC;AAQvB,OAAO,EAGL,aAAa,EACd,MAAM,+BAA+B,CAAC;AASvC,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAgDzD;;GAEG;AACH,qBAAa,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tauri/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAIL,UAAU,EAGV,EAAE,EACH,MAAM,eAAe,CAAC;AAQvB,OAAO,EAGL,aAAa,EACd,MAAM,+BAA+B,CAAC;AASvC,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,OAAO,EA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