@synnaxlabs/drift 0.53.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/drift.cjs +1 -0
- package/dist/drift.js +501 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +11 -70
- package/dist/selectors-Bs8JhAIN.cjs +1 -0
- package/dist/selectors-CNMpvNhS.js +18 -0
- package/dist/src/react/index.d.ts +0 -1
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/react/selectors.d.ts.map +1 -1
- package/dist/src/react/selectors.spec.d.ts +2 -0
- package/dist/src/react/selectors.spec.d.ts.map +1 -0
- package/dist/src/selectors.d.ts +21 -1
- package/dist/src/selectors.d.ts.map +1 -1
- package/dist/src/selectors.spec.d.ts +2 -0
- package/dist/src/selectors.spec.d.ts.map +1 -0
- package/dist/state-Cqdzy3Ab.cjs +1 -0
- package/dist/state-Ne5iph6p.js +161 -0
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +1163 -2792
- package/dist/window-7qdnLqUa.cjs +45 -0
- package/dist/window-b_pX3pWi.js +13288 -0
- package/package.json +19 -18
- package/dist/index.cjs +0 -1
- package/dist/index.js +0 -536
- package/dist/selectors-DZMH3BUG.js +0 -22
- package/dist/selectors-xTfOgDbG.cjs +0 -1
- package/dist/src/react/hooks.d.ts +0 -15
- package/dist/src/react/hooks.d.ts.map +0 -1
- package/dist/state-CAgVbv4Z.js +0 -14282
- package/dist/state-CIOo9w2K.cjs +0 -45
package/dist/drift.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./window-7qdnLqUa.cjs`),t=require(`./state-Cqdzy3Ab.cjs`),n=require(`./selectors-Bs8JhAIN.cjs`);let r=require(`@reduxjs/toolkit`);var i=Error(`request for lock canceled`),a=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},o=class{constructor(e,t=i){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw Error(`invalid weight ${e}: must be positive`);return new Promise((n,r)=>{let i={resolve:n,reject:r,weight:e,priority:t},a=c(this._queue,e=>t<=e.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return a(this,arguments,void 0,function*(e,t=1,n=0){let[r,i]=yield this.acquire(t,n);try{return yield e(r)}finally{i()}})}waitForUnlock(e=1,t=0){if(e<=0)throw Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),s(this._weightedWaiters[e-1],{resolve:n,priority:t})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw 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){let t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){let t=this._weightedWaiters[e-1];t&&(t.forEach(e=>e.resolve()),this._weightedWaiters[e-1]=[])}else{let e=this._queue[0].priority;for(let t=this._value;t>0;t--){let n=this._weightedWaiters[t-1];if(!n)continue;let r=n.findIndex(t=>t.priority<=e);(r===-1?n:n.splice(0,r)).forEach((e=>e.resolve()))}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}};function s(e,t){let n=c(e,e=>t.priority<=e.priority);e.splice(n+1,0,t)}function c(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}var l=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},u=class{constructor(e){this._semaphore=new o(1,e)}acquire(){return l(this,arguments,void 0,function*(e=0){let[,t]=yield this._semaphore.acquire(1,e);return t})}runExclusive(e,t=0){return this._semaphore.runExclusive(()=>e(),1,t)}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()}},d=`DA@`,f=`://`,p=(e,t)=>d.concat(t,f,e),m=e=>{let[t,n]=e.split(f);if(n==null)return[e,``];let[,r]=t.split(d);return[n,r]},h=(e,t)=>({...e,type:p(e.type,t)}),g=e=>{let[t,n]=m(e.type);return{emitted:n!=null&&n.length>0,emitter:n,action:{...e,type:t}}},_=e=>{let{centerCount:t,processCount:n,focusCount:r,stage:i,key:a,prerenderLabel:o,reserved:s,minimized:c,...l}=e;return l},v=async(n,r,i,a)=>{let o=(await i.listLabels()).filter(t=>t!==e.r),s=Object.keys(n.windows).filter(t=>t!==e.r);t.j(a,`syncInitial`),t.N(a,`existing windows in runtime`,o.sort()),t.N(a,`non-main windows in state`,s.sort()),t.M(a);let c=e.m.unique([...o,...s]);for(let e of c)!o.includes(e)&&i.isMain()?(t.N(a,`state window not in runtime, creating`,e),await S(i,e,n.windows[e],a)):s.includes(e)||(t.N(a,`runtime window not in state, closing`,e),await C(i,e,a));let l=i.label(),u=n.windows[l];u!=null&&(await b({...e.n,key:l},u,i,a),r(t.p({label:i.label(),...await i.getProps()})))},y=async(e,n,r,i)=>{t.N(i,`sync`,e,n),r.isMain()&&await x(e,n,r,i);let a=e.windows[r.label()],o=n.windows[r.label()];a==null||o==null||await b(a,o,r,i)},b=async(n,r,i,a)=>{let o=[];r.title!=null&&r.title!==n.title&&o.push([`title`,{prev:n.title,next:r.title},async()=>i.setTitle(r.title)]);let s=r.visible!=null&&r.visible!==n.visible,c=r.visible===!1,l=()=>o.push([`visible`,{prev:n.visible,next:r.visible},async()=>{if(await i.setVisible(r.visible),r.visible===!1)return;let t=r.position;t??=(await i.getProps()).position,t!=null&&(await i.setPosition(e.f.translate(t,{x:1,y:1})),await i.setPosition(t))}]);if(s&&c&&l(),r.skipTaskbar!=null&&r.skipTaskbar!==n.skipTaskbar&&o.push([`skipTaskbar`,{prev:n.skipTaskbar,next:r.skipTaskbar},async()=>await i.setSkipTaskbar(r.skipTaskbar)]),r.maximized!=null&&r.maximized!==n.maximized&&o.push([`maximized`,{prev:n.maximized,next:r.maximized},async()=>await i.setMaximized(r.maximized)]),r.fullscreen!=null&&r.fullscreen!==n.fullscreen&&o.push([`fullscreen`,{prev:n.fullscreen,next:r.fullscreen},async()=>await i.setFullscreen(r.fullscreen)]),r.centerCount!==n.centerCount&&o.push([`center`,{prev:n.centerCount,next:r.centerCount},async()=>i.center()]),r.minimized!=null&&r.minimized!==n.minimized&&o.push([`minimized`,{prev:n.minimized,next:r.minimized},async()=>await i.setMinimized(r.minimized)]),r.resizable!=null&&r.resizable!==n.resizable&&o.push([`resizable`,{prev:n.resizable,next:r.resizable},async()=>await i.setResizable(r.resizable)]),r.minSize!=null&&!e.u.equals(r.minSize,n.minSize)&&o.push([`minSize`,{prev:n.minSize,next:r.minSize},async()=>await i.setMinSize(r.minSize)]),r.maxSize!=null&&!e.u.equals(r.maxSize,n.maxSize)&&o.push([`maxSize`,{prev:n.maxSize,next:r.maxSize},async()=>await i.setMaxSize(r.maxSize)]),r.size!=null&&!e.u.equals(r.size,n.size)&&o.push([`size`,{prev:n.size,next:r.size},async()=>await i.setSize(r.size)]),r.position!=null&&!e.u.equals(r.position,n.position)&&o.push([`position`,{prev:n.position,next:r.position},async()=>await i.setPosition(r.position)]),r.focusCount!==n.focusCount&&o.push([`setVisible`,{prev:n.visible,next:r.visible},async()=>await i.setVisible(!0)],[`focus`,{prev:n.focusCount,next:r.focusCount},async()=>await i.focus()]),r.decorations!=null&&r.decorations!==n.decorations&&o.push([`decorations`,{prev:n.decorations,next:r.decorations},async()=>await i.setDecorations(r.decorations)]),r.alwaysOnTop!=null&&r.alwaysOnTop!==n.alwaysOnTop&&o.push([`alwaysOnTop`,{prev:n.alwaysOnTop,next:r.alwaysOnTop},async()=>await i.setAlwaysOnTop(r.alwaysOnTop)]),s&&!c&&l(),o.length!==0){t.j(a,`syncCurrent, label: ${i.label()}, key: ${r.key}`);for(let[e,{prev:n,next:r}]of o)t.N(a,e,n,`->`,r);t.M(a);for(let[,,e]of o)await e()}},x=async(n,r,i,a)=>{let o=Object.keys(n.windows).filter(e=>!(e in r.windows)),s=Object.keys(r.windows).filter(e=>!(e in n.windows)),c=i.isMain();if(c&&o.length>0)for(let n of o)t.N(a,`syncMain`,`closing`,n),n===`main`&&await Promise.all(Object.keys(r.windows).filter(t=>t!==e.r).map(async e=>await C(i,e,a))),await C(i,n,a);if(c&&s.length>0)for(let e of s)await S(i,e,r.windows[e],a)},S=async(e,n,r,i)=>(t.N(i,`createWindow`,r),await e.create(n,_(r))),C=async(e,n,r)=>(t.N(r,`closeWindow`,n),await e.close(n)),w=`[drift] - unexpected undefined action`,T=`[drift] - unexpected undefined action type`,E=e=>{if(e.emitted??=!1,e.action==null)throw console.warn(w,e),Error(w);if(e.action.type==null||e.action.type.length===0)throw console.warn(T,e),Error(T)},D=new u,O=[t.p.type,t.f.type],k=(e,n=!1)=>r=>i=>a=>{let{action:o,emitted:s,emitter:c}=g(a),l=e.label();E({action:a,emitted:s,emitter:c});let u=t.l(o.type);if(u&&t.N(n,`[drift] - middleware`,{action:o,emitted:s,emitter:c,host:l}),c===e.label())return;let d=u&&!O.includes(o.type),f=null;u&&(f=r.getState().drift,o=t.r(o,f));let p=i(o),m=d?r.getState().drift:null,h=t.A(s,o.type);return D.runExclusive(async()=>{try{f!==null&&m!==null&&await y(f,m,e,n),h&&await e.emit({action:o})}catch(e){t.N(n,`[drift] - ERROR`,{error:e.message,action:o,emitted:s,emitter:c,host:l}),r.dispatch(t.g({key:l,message:e.message}))}}),p},A=(e,t,n=!1)=>r=>{let i=e==null?r():typeof e==`function`?e(r):e;return[k(t,n),...i]},j=async({runtime:e,preloadedState:n,middleware:i,debug:a=!1,enablePrerender:o=!0,defaultWindowProps:s,...c})=>{await e.configure();let l;l=(0,r.configureStore)({...c,preloadedState:await M(a,e,()=>l,s,n),middleware:A(i,e,a)}),await v(l.getState().drift,l.dispatch,e,a);let u=e.label();return l.dispatch(t.c({enablePrerender:o,defaultWindowProps:s,debug:a,label:u})),l.dispatch(t.D({stage:`created`})),e.onCloseRequested(()=>l?.dispatch(t.i({}))),l},M=async(t,n,r,i,a)=>n.isMain()?(await n.subscribe(({action:e,emitter:t,sendState:i})=>{let a=r();if(a==null)return;if(e!=null){E({action:e,emitter:t}),a.dispatch(h(e,t));return}let o=a.getState();i===!0&&n.emit({state:o},t)}),typeof a==`function`?P(i,t,await a()):P(i,t,a)):await new Promise((t,i)=>{(async()=>{try{await n.subscribe(({action:e,emitter:n,state:i})=>{let a=r();if(a==null)return i==null?void 0:t(i);e!=null&&(E({action:e,emitter:n}),a.dispatch(h(e,n)))}),await n.emit({sendState:!0},e.r)}catch(e){i(e)}})()}),N=j,P=(e,n,r)=>{if(r==null)return r;let i=r[t.t];return i.config.debug=n??i.config.debug,i.windows=Object.fromEntries(Object.entries(i.windows).filter(([,e])=>e.reserved).map(([t,n])=>(e?.visible!=null&&(n.visible=e.visible),n.focusCount=0,n.centerCount=0,n.processCount=0,[t,n]))),r},F=class{async emit(){}async subscribe(){}isMain(){return!0}label(){return e.r}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(){}},I=e.h({MAIN_WINDOW:()=>e.r,NoopRuntime:()=>F,SLICE_NAME:()=>t.t,ZERO_SLICE_STATE:()=>t.n,closeWindow:()=>t.i,completeProcess:()=>t.a,configureStore:()=>N,createWindow:()=>t.o,focusWindow:()=>t.s,reducer:()=>t.u,registerProcess:()=>t.d,reloadWindow:()=>t.f,selectSliceState:()=>n.t,selectWindow:()=>n.n,selectWindowAttribute:()=>n.r,selectWindowKey:()=>n.i,selectWindowLabel:()=>n.a,selectWindows:()=>n.o,setWindowAlwaysOnTop:()=>t.m,setWindowDecorations:()=>t.h,setWindowFullscreen:()=>t._,setWindowMaxSize:()=>t.v,setWindowMaximized:()=>t.y,setWindowMinSize:()=>t.b,setWindowMinimized:()=>t.x,setWindowPosition:()=>t.S,setWindowProps:()=>t.C,setWindowResizable:()=>t.w,setWindowSize:()=>t.T,setWindowSkipTaskbar:()=>t.E,setWindowStage:()=>t.D,setWindowTitle:()=>t.O,setWindowVisible:()=>t.k,windowPropsZ:()=>e.a});Object.defineProperty(exports,`Drift`,{enumerable:!0,get:function(){return I}}),exports.MAIN_WINDOW=e.r,exports.NoopRuntime=F,exports.SLICE_NAME=t.t,exports.ZERO_SLICE_STATE=t.n,exports.closeWindow=t.i,exports.completeProcess=t.a,exports.configureStore=N,exports.createWindow=t.o,exports.focusWindow=t.s,exports.reducer=t.u,exports.registerProcess=t.d,exports.reloadWindow=t.f,exports.selectSliceState=n.t,exports.selectWindow=n.n,exports.selectWindowAttribute=n.r,exports.selectWindowKey=n.i,exports.selectWindowLabel=n.a,exports.selectWindows=n.o,exports.setWindowAlwaysOnTop=t.m,exports.setWindowDecorations=t.h,exports.setWindowFullscreen=t._,exports.setWindowMaxSize=t.v,exports.setWindowMaximized=t.y,exports.setWindowMinSize=t.b,exports.setWindowMinimized=t.x,exports.setWindowPosition=t.S,exports.setWindowProps=t.C,exports.setWindowResizable=t.w,exports.setWindowSize=t.T,exports.setWindowSkipTaskbar=t.E,exports.setWindowStage=t.D,exports.setWindowTitle=t.O,exports.setWindowVisible=t.k,exports.windowPropsZ=e.a;
|
package/dist/drift.js
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import { a as e, f as t, h as n, m as r, n as i, r as a, u as o } from "./window-b_pX3pWi.js";
|
|
2
|
+
import { A as s, C as c, D as l, E as u, M as d, N as f, O as p, S as m, T as h, _ as g, a as _, b as v, c as ee, d as y, f as b, g as te, h as ne, i as x, j as S, k as C, l as re, m as w, n as T, o as E, p as D, r as ie, s as O, t as k, u as A, v as j, w as M, x as N, y as P } from "./state-Ne5iph6p.js";
|
|
3
|
+
import { a as F, i as I, n as L, o as R, r as z, t as B } from "./selectors-CNMpvNhS.js";
|
|
4
|
+
import { configureStore as ae } from "@reduxjs/toolkit";
|
|
5
|
+
//#region ../node_modules/.pnpm/async-mutex@0.5.0/node_modules/async-mutex/index.mjs
|
|
6
|
+
var oe = /* @__PURE__ */ Error("request for lock canceled"), se = function(e, t, n, r) {
|
|
7
|
+
function i(e) {
|
|
8
|
+
return e instanceof n ? e : new n(function(t) {
|
|
9
|
+
t(e);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return new (n ||= Promise)(function(n, a) {
|
|
13
|
+
function o(e) {
|
|
14
|
+
try {
|
|
15
|
+
c(r.next(e));
|
|
16
|
+
} catch (e) {
|
|
17
|
+
a(e);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function s(e) {
|
|
21
|
+
try {
|
|
22
|
+
c(r.throw(e));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
a(e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function c(e) {
|
|
28
|
+
e.done ? n(e.value) : i(e.value).then(o, s);
|
|
29
|
+
}
|
|
30
|
+
c((r = r.apply(e, t || [])).next());
|
|
31
|
+
});
|
|
32
|
+
}, ce = class {
|
|
33
|
+
constructor(e, t = oe) {
|
|
34
|
+
this._value = e, this._cancelError = t, this._queue = [], this._weightedWaiters = [];
|
|
35
|
+
}
|
|
36
|
+
acquire(e = 1, t = 0) {
|
|
37
|
+
if (e <= 0) throw Error(`invalid weight ${e}: must be positive`);
|
|
38
|
+
return new Promise((n, r) => {
|
|
39
|
+
let i = {
|
|
40
|
+
resolve: n,
|
|
41
|
+
reject: r,
|
|
42
|
+
weight: e,
|
|
43
|
+
priority: t
|
|
44
|
+
}, a = V(this._queue, (e) => t <= e.priority);
|
|
45
|
+
a === -1 && e <= this._value ? this._dispatchItem(i) : this._queue.splice(a + 1, 0, i);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
runExclusive(e) {
|
|
49
|
+
return se(this, arguments, void 0, function* (e, t = 1, n = 0) {
|
|
50
|
+
let [r, i] = yield this.acquire(t, n);
|
|
51
|
+
try {
|
|
52
|
+
return yield e(r);
|
|
53
|
+
} finally {
|
|
54
|
+
i();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
waitForUnlock(e = 1, t = 0) {
|
|
59
|
+
if (e <= 0) throw Error(`invalid weight ${e}: must be positive`);
|
|
60
|
+
return this._couldLockImmediately(e, t) ? Promise.resolve() : new Promise((n) => {
|
|
61
|
+
this._weightedWaiters[e - 1] || (this._weightedWaiters[e - 1] = []), le(this._weightedWaiters[e - 1], {
|
|
62
|
+
resolve: n,
|
|
63
|
+
priority: t
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
isLocked() {
|
|
68
|
+
return this._value <= 0;
|
|
69
|
+
}
|
|
70
|
+
getValue() {
|
|
71
|
+
return this._value;
|
|
72
|
+
}
|
|
73
|
+
setValue(e) {
|
|
74
|
+
this._value = e, this._dispatchQueue();
|
|
75
|
+
}
|
|
76
|
+
release(e = 1) {
|
|
77
|
+
if (e <= 0) throw Error(`invalid weight ${e}: must be positive`);
|
|
78
|
+
this._value += e, this._dispatchQueue();
|
|
79
|
+
}
|
|
80
|
+
cancel() {
|
|
81
|
+
this._queue.forEach((e) => e.reject(this._cancelError)), this._queue = [];
|
|
82
|
+
}
|
|
83
|
+
_dispatchQueue() {
|
|
84
|
+
for (this._drainUnlockWaiters(); this._queue.length > 0 && this._queue[0].weight <= this._value;) this._dispatchItem(this._queue.shift()), this._drainUnlockWaiters();
|
|
85
|
+
}
|
|
86
|
+
_dispatchItem(e) {
|
|
87
|
+
let t = this._value;
|
|
88
|
+
this._value -= e.weight, e.resolve([t, this._newReleaser(e.weight)]);
|
|
89
|
+
}
|
|
90
|
+
_newReleaser(e) {
|
|
91
|
+
let t = !1;
|
|
92
|
+
return () => {
|
|
93
|
+
t || (t = !0, this.release(e));
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
_drainUnlockWaiters() {
|
|
97
|
+
if (this._queue.length === 0) for (let e = this._value; e > 0; e--) {
|
|
98
|
+
let t = this._weightedWaiters[e - 1];
|
|
99
|
+
t && (t.forEach((e) => e.resolve()), this._weightedWaiters[e - 1] = []);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
let e = this._queue[0].priority;
|
|
103
|
+
for (let t = this._value; t > 0; t--) {
|
|
104
|
+
let n = this._weightedWaiters[t - 1];
|
|
105
|
+
if (!n) continue;
|
|
106
|
+
let r = n.findIndex((t) => t.priority <= e);
|
|
107
|
+
(r === -1 ? n : n.splice(0, r)).forEach(((e) => e.resolve()));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
_couldLockImmediately(e, t) {
|
|
112
|
+
return (this._queue.length === 0 || this._queue[0].priority < t) && e <= this._value;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
function le(e, t) {
|
|
116
|
+
let n = V(e, (e) => t.priority <= e.priority);
|
|
117
|
+
e.splice(n + 1, 0, t);
|
|
118
|
+
}
|
|
119
|
+
function V(e, t) {
|
|
120
|
+
for (let n = e.length - 1; n >= 0; n--) if (t(e[n])) return n;
|
|
121
|
+
return -1;
|
|
122
|
+
}
|
|
123
|
+
var ue = function(e, t, n, r) {
|
|
124
|
+
function i(e) {
|
|
125
|
+
return e instanceof n ? e : new n(function(t) {
|
|
126
|
+
t(e);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return new (n ||= Promise)(function(n, a) {
|
|
130
|
+
function o(e) {
|
|
131
|
+
try {
|
|
132
|
+
c(r.next(e));
|
|
133
|
+
} catch (e) {
|
|
134
|
+
a(e);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function s(e) {
|
|
138
|
+
try {
|
|
139
|
+
c(r.throw(e));
|
|
140
|
+
} catch (e) {
|
|
141
|
+
a(e);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function c(e) {
|
|
145
|
+
e.done ? n(e.value) : i(e.value).then(o, s);
|
|
146
|
+
}
|
|
147
|
+
c((r = r.apply(e, t || [])).next());
|
|
148
|
+
});
|
|
149
|
+
}, de = class {
|
|
150
|
+
constructor(e) {
|
|
151
|
+
this._semaphore = new ce(1, e);
|
|
152
|
+
}
|
|
153
|
+
acquire() {
|
|
154
|
+
return ue(this, arguments, void 0, function* (e = 0) {
|
|
155
|
+
let [, t] = yield this._semaphore.acquire(1, e);
|
|
156
|
+
return t;
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
runExclusive(e, t = 0) {
|
|
160
|
+
return this._semaphore.runExclusive(() => e(), 1, t);
|
|
161
|
+
}
|
|
162
|
+
isLocked() {
|
|
163
|
+
return this._semaphore.isLocked();
|
|
164
|
+
}
|
|
165
|
+
waitForUnlock(e = 0) {
|
|
166
|
+
return this._semaphore.waitForUnlock(1, e);
|
|
167
|
+
}
|
|
168
|
+
release() {
|
|
169
|
+
this._semaphore.isLocked() && this._semaphore.release();
|
|
170
|
+
}
|
|
171
|
+
cancel() {
|
|
172
|
+
return this._semaphore.cancel();
|
|
173
|
+
}
|
|
174
|
+
}, H = "DA@", U = "://", fe = (e, t) => H.concat(t, U, e), pe = (e) => {
|
|
175
|
+
let [t, n] = e.split(U);
|
|
176
|
+
if (n == null) return [e, ""];
|
|
177
|
+
let [, r] = t.split(H);
|
|
178
|
+
return [n, r];
|
|
179
|
+
}, W = (e, t) => ({
|
|
180
|
+
...e,
|
|
181
|
+
type: fe(e.type, t)
|
|
182
|
+
}), me = (e) => {
|
|
183
|
+
let [t, n] = pe(e.type);
|
|
184
|
+
return {
|
|
185
|
+
emitted: n != null && n.length > 0,
|
|
186
|
+
emitter: n,
|
|
187
|
+
action: {
|
|
188
|
+
...e,
|
|
189
|
+
type: t
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}, he = (e) => {
|
|
193
|
+
let { centerCount: t, processCount: n, focusCount: r, stage: i, key: a, prerenderLabel: o, reserved: s, minimized: c, ...l } = e;
|
|
194
|
+
return l;
|
|
195
|
+
}, ge = async (e, t, n, o) => {
|
|
196
|
+
let s = (await n.listLabels()).filter((e) => e !== a), c = Object.keys(e.windows).filter((e) => e !== a);
|
|
197
|
+
S(o, "syncInitial"), f(o, "existing windows in runtime", s.sort()), f(o, "non-main windows in state", c.sort()), d(o);
|
|
198
|
+
let l = r.unique([...s, ...c]);
|
|
199
|
+
for (let t of l) !s.includes(t) && n.isMain() ? (f(o, "state window not in runtime, creating", t), await K(n, t, e.windows[t], o)) : c.includes(t) || (f(o, "runtime window not in state, closing", t), await q(n, t, o));
|
|
200
|
+
let u = n.label(), p = e.windows[u];
|
|
201
|
+
p != null && (await G({
|
|
202
|
+
...i,
|
|
203
|
+
key: u
|
|
204
|
+
}, p, n, o), t(D({
|
|
205
|
+
label: n.label(),
|
|
206
|
+
...await n.getProps()
|
|
207
|
+
})));
|
|
208
|
+
}, _e = async (e, t, n, r) => {
|
|
209
|
+
f(r, "sync", e, t), n.isMain() && await ve(e, t, n, r);
|
|
210
|
+
let i = e.windows[n.label()], a = t.windows[n.label()];
|
|
211
|
+
i == null || a == null || await G(i, a, n, r);
|
|
212
|
+
}, G = async (e, n, r, i) => {
|
|
213
|
+
let a = [];
|
|
214
|
+
n.title != null && n.title !== e.title && a.push([
|
|
215
|
+
"title",
|
|
216
|
+
{
|
|
217
|
+
prev: e.title,
|
|
218
|
+
next: n.title
|
|
219
|
+
},
|
|
220
|
+
async () => r.setTitle(n.title)
|
|
221
|
+
]);
|
|
222
|
+
let s = n.visible != null && n.visible !== e.visible, c = n.visible === !1, l = () => a.push([
|
|
223
|
+
"visible",
|
|
224
|
+
{
|
|
225
|
+
prev: e.visible,
|
|
226
|
+
next: n.visible
|
|
227
|
+
},
|
|
228
|
+
async () => {
|
|
229
|
+
if (await r.setVisible(n.visible), n.visible === !1) return;
|
|
230
|
+
let e = n.position;
|
|
231
|
+
e ??= (await r.getProps()).position, e != null && (await r.setPosition(t.translate(e, {
|
|
232
|
+
x: 1,
|
|
233
|
+
y: 1
|
|
234
|
+
})), await r.setPosition(e));
|
|
235
|
+
}
|
|
236
|
+
]);
|
|
237
|
+
if (s && c && l(), n.skipTaskbar != null && n.skipTaskbar !== e.skipTaskbar && a.push([
|
|
238
|
+
"skipTaskbar",
|
|
239
|
+
{
|
|
240
|
+
prev: e.skipTaskbar,
|
|
241
|
+
next: n.skipTaskbar
|
|
242
|
+
},
|
|
243
|
+
async () => await r.setSkipTaskbar(n.skipTaskbar)
|
|
244
|
+
]), n.maximized != null && n.maximized !== e.maximized && a.push([
|
|
245
|
+
"maximized",
|
|
246
|
+
{
|
|
247
|
+
prev: e.maximized,
|
|
248
|
+
next: n.maximized
|
|
249
|
+
},
|
|
250
|
+
async () => await r.setMaximized(n.maximized)
|
|
251
|
+
]), n.fullscreen != null && n.fullscreen !== e.fullscreen && a.push([
|
|
252
|
+
"fullscreen",
|
|
253
|
+
{
|
|
254
|
+
prev: e.fullscreen,
|
|
255
|
+
next: n.fullscreen
|
|
256
|
+
},
|
|
257
|
+
async () => await r.setFullscreen(n.fullscreen)
|
|
258
|
+
]), n.centerCount !== e.centerCount && a.push([
|
|
259
|
+
"center",
|
|
260
|
+
{
|
|
261
|
+
prev: e.centerCount,
|
|
262
|
+
next: n.centerCount
|
|
263
|
+
},
|
|
264
|
+
async () => r.center()
|
|
265
|
+
]), n.minimized != null && n.minimized !== e.minimized && a.push([
|
|
266
|
+
"minimized",
|
|
267
|
+
{
|
|
268
|
+
prev: e.minimized,
|
|
269
|
+
next: n.minimized
|
|
270
|
+
},
|
|
271
|
+
async () => await r.setMinimized(n.minimized)
|
|
272
|
+
]), n.resizable != null && n.resizable !== e.resizable && a.push([
|
|
273
|
+
"resizable",
|
|
274
|
+
{
|
|
275
|
+
prev: e.resizable,
|
|
276
|
+
next: n.resizable
|
|
277
|
+
},
|
|
278
|
+
async () => await r.setResizable(n.resizable)
|
|
279
|
+
]), n.minSize != null && !o.equals(n.minSize, e.minSize) && a.push([
|
|
280
|
+
"minSize",
|
|
281
|
+
{
|
|
282
|
+
prev: e.minSize,
|
|
283
|
+
next: n.minSize
|
|
284
|
+
},
|
|
285
|
+
async () => await r.setMinSize(n.minSize)
|
|
286
|
+
]), n.maxSize != null && !o.equals(n.maxSize, e.maxSize) && a.push([
|
|
287
|
+
"maxSize",
|
|
288
|
+
{
|
|
289
|
+
prev: e.maxSize,
|
|
290
|
+
next: n.maxSize
|
|
291
|
+
},
|
|
292
|
+
async () => await r.setMaxSize(n.maxSize)
|
|
293
|
+
]), n.size != null && !o.equals(n.size, e.size) && a.push([
|
|
294
|
+
"size",
|
|
295
|
+
{
|
|
296
|
+
prev: e.size,
|
|
297
|
+
next: n.size
|
|
298
|
+
},
|
|
299
|
+
async () => await r.setSize(n.size)
|
|
300
|
+
]), n.position != null && !o.equals(n.position, e.position) && a.push([
|
|
301
|
+
"position",
|
|
302
|
+
{
|
|
303
|
+
prev: e.position,
|
|
304
|
+
next: n.position
|
|
305
|
+
},
|
|
306
|
+
async () => await r.setPosition(n.position)
|
|
307
|
+
]), n.focusCount !== e.focusCount && a.push([
|
|
308
|
+
"setVisible",
|
|
309
|
+
{
|
|
310
|
+
prev: e.visible,
|
|
311
|
+
next: n.visible
|
|
312
|
+
},
|
|
313
|
+
async () => await r.setVisible(!0)
|
|
314
|
+
], [
|
|
315
|
+
"focus",
|
|
316
|
+
{
|
|
317
|
+
prev: e.focusCount,
|
|
318
|
+
next: n.focusCount
|
|
319
|
+
},
|
|
320
|
+
async () => await r.focus()
|
|
321
|
+
]), n.decorations != null && n.decorations !== e.decorations && a.push([
|
|
322
|
+
"decorations",
|
|
323
|
+
{
|
|
324
|
+
prev: e.decorations,
|
|
325
|
+
next: n.decorations
|
|
326
|
+
},
|
|
327
|
+
async () => await r.setDecorations(n.decorations)
|
|
328
|
+
]), n.alwaysOnTop != null && n.alwaysOnTop !== e.alwaysOnTop && a.push([
|
|
329
|
+
"alwaysOnTop",
|
|
330
|
+
{
|
|
331
|
+
prev: e.alwaysOnTop,
|
|
332
|
+
next: n.alwaysOnTop
|
|
333
|
+
},
|
|
334
|
+
async () => await r.setAlwaysOnTop(n.alwaysOnTop)
|
|
335
|
+
]), s && !c && l(), a.length !== 0) {
|
|
336
|
+
S(i, `syncCurrent, label: ${r.label()}, key: ${n.key}`);
|
|
337
|
+
for (let [e, { prev: t, next: n }] of a) f(i, e, t, "->", n);
|
|
338
|
+
d(i);
|
|
339
|
+
for (let [, , e] of a) await e();
|
|
340
|
+
}
|
|
341
|
+
}, ve = async (e, t, n, r) => {
|
|
342
|
+
let i = Object.keys(e.windows).filter((e) => !(e in t.windows)), o = Object.keys(t.windows).filter((t) => !(t in e.windows)), s = n.isMain();
|
|
343
|
+
if (s && i.length > 0) for (let e of i) f(r, "syncMain", "closing", e), e === "main" && await Promise.all(Object.keys(t.windows).filter((e) => e !== a).map(async (e) => await q(n, e, r))), await q(n, e, r);
|
|
344
|
+
if (s && o.length > 0) for (let e of o) await K(n, e, t.windows[e], r);
|
|
345
|
+
}, K = async (e, t, n, r) => (f(r, "createWindow", n), await e.create(t, he(n))), q = async (e, t, n) => (f(n, "closeWindow", t), await e.close(t)), J = "[drift] - unexpected undefined action", Y = "[drift] - unexpected undefined action type", X = (e) => {
|
|
346
|
+
if (e.emitted ??= !1, e.action == null) throw console.warn(J, e), Error(J);
|
|
347
|
+
if (e.action.type == null || e.action.type.length === 0) throw console.warn(Y, e), Error(Y);
|
|
348
|
+
}, ye = new de(), be = [D.type, b.type], xe = (e, t = !1) => (n) => (r) => (i) => {
|
|
349
|
+
let { action: a, emitted: o, emitter: c } = me(i), l = e.label();
|
|
350
|
+
X({
|
|
351
|
+
action: i,
|
|
352
|
+
emitted: o,
|
|
353
|
+
emitter: c
|
|
354
|
+
});
|
|
355
|
+
let u = re(a.type);
|
|
356
|
+
if (u && f(t, "[drift] - middleware", {
|
|
357
|
+
action: a,
|
|
358
|
+
emitted: o,
|
|
359
|
+
emitter: c,
|
|
360
|
+
host: l
|
|
361
|
+
}), c === e.label()) return;
|
|
362
|
+
let d = u && !be.includes(a.type), p = null;
|
|
363
|
+
u && (p = n.getState().drift, a = ie(a, p));
|
|
364
|
+
let m = r(a), h = d ? n.getState().drift : null, g = s(o, a.type);
|
|
365
|
+
return ye.runExclusive(async () => {
|
|
366
|
+
try {
|
|
367
|
+
p !== null && h !== null && await _e(p, h, e, t), g && await e.emit({ action: a });
|
|
368
|
+
} catch (e) {
|
|
369
|
+
f(t, "[drift] - ERROR", {
|
|
370
|
+
error: e.message,
|
|
371
|
+
action: a,
|
|
372
|
+
emitted: o,
|
|
373
|
+
emitter: c,
|
|
374
|
+
host: l
|
|
375
|
+
}), n.dispatch(te({
|
|
376
|
+
key: l,
|
|
377
|
+
message: e.message
|
|
378
|
+
}));
|
|
379
|
+
}
|
|
380
|
+
}), m;
|
|
381
|
+
}, Se = (e, t, n = !1) => (r) => {
|
|
382
|
+
let i = e == null ? r() : typeof e == "function" ? e(r) : e;
|
|
383
|
+
return [xe(t, n), ...i];
|
|
384
|
+
}, Ce = async ({ runtime: e, preloadedState: t, middleware: n, debug: r = !1, enablePrerender: i = !0, defaultWindowProps: a, ...o }) => {
|
|
385
|
+
await e.configure();
|
|
386
|
+
let s;
|
|
387
|
+
s = ae({
|
|
388
|
+
...o,
|
|
389
|
+
preloadedState: await we(r, e, () => s, a, t),
|
|
390
|
+
middleware: Se(n, e, r)
|
|
391
|
+
}), await ge(s.getState().drift, s.dispatch, e, r);
|
|
392
|
+
let c = e.label();
|
|
393
|
+
return s.dispatch(ee({
|
|
394
|
+
enablePrerender: i,
|
|
395
|
+
defaultWindowProps: a,
|
|
396
|
+
debug: r,
|
|
397
|
+
label: c
|
|
398
|
+
})), s.dispatch(l({ stage: "created" })), e.onCloseRequested(() => s?.dispatch(x({}))), s;
|
|
399
|
+
}, we = async (e, t, n, r, i) => t.isMain() ? (await t.subscribe(({ action: e, emitter: r, sendState: i }) => {
|
|
400
|
+
let a = n();
|
|
401
|
+
if (a == null) return;
|
|
402
|
+
if (e != null) {
|
|
403
|
+
X({
|
|
404
|
+
action: e,
|
|
405
|
+
emitter: r
|
|
406
|
+
}), a.dispatch(W(e, r));
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
let o = a.getState();
|
|
410
|
+
i === !0 && t.emit({ state: o }, r);
|
|
411
|
+
}), typeof i == "function" ? Q(r, e, await i()) : Q(r, e, i)) : await new Promise((e, r) => {
|
|
412
|
+
(async () => {
|
|
413
|
+
try {
|
|
414
|
+
await t.subscribe(({ action: t, emitter: r, state: i }) => {
|
|
415
|
+
let a = n();
|
|
416
|
+
if (a == null) return i == null ? void 0 : e(i);
|
|
417
|
+
t != null && (X({
|
|
418
|
+
action: t,
|
|
419
|
+
emitter: r
|
|
420
|
+
}), a.dispatch(W(t, r)));
|
|
421
|
+
}), await t.emit({ sendState: !0 }, a);
|
|
422
|
+
} catch (e) {
|
|
423
|
+
r(e);
|
|
424
|
+
}
|
|
425
|
+
})();
|
|
426
|
+
}), Z = Ce, Q = (e, t, n) => {
|
|
427
|
+
if (n == null) return n;
|
|
428
|
+
let r = n[k];
|
|
429
|
+
return r.config.debug = t ?? r.config.debug, r.windows = Object.fromEntries(Object.entries(r.windows).filter(([, e]) => e.reserved).map(([t, n]) => (e?.visible != null && (n.visible = e.visible), n.focusCount = 0, n.centerCount = 0, n.processCount = 0, [t, n]))), n;
|
|
430
|
+
}, $ = class {
|
|
431
|
+
async emit() {}
|
|
432
|
+
async subscribe() {}
|
|
433
|
+
isMain() {
|
|
434
|
+
return !0;
|
|
435
|
+
}
|
|
436
|
+
label() {
|
|
437
|
+
return a;
|
|
438
|
+
}
|
|
439
|
+
onCloseRequested() {}
|
|
440
|
+
async listLabels() {
|
|
441
|
+
return [];
|
|
442
|
+
}
|
|
443
|
+
async getProps() {
|
|
444
|
+
return {};
|
|
445
|
+
}
|
|
446
|
+
async create() {}
|
|
447
|
+
async close() {}
|
|
448
|
+
async focus() {}
|
|
449
|
+
async setMinimized() {}
|
|
450
|
+
async setMaximized() {}
|
|
451
|
+
async setVisible() {}
|
|
452
|
+
async setFullscreen() {}
|
|
453
|
+
async center() {}
|
|
454
|
+
async setPosition() {}
|
|
455
|
+
async setSize() {}
|
|
456
|
+
async setMinSize() {}
|
|
457
|
+
async setMaxSize() {}
|
|
458
|
+
async setResizable() {}
|
|
459
|
+
async setSkipTaskbar() {}
|
|
460
|
+
async setAlwaysOnTop() {}
|
|
461
|
+
async setDecorations() {}
|
|
462
|
+
async setTitle() {}
|
|
463
|
+
async configure() {}
|
|
464
|
+
}, Te = /* @__PURE__ */ n({
|
|
465
|
+
MAIN_WINDOW: () => a,
|
|
466
|
+
NoopRuntime: () => $,
|
|
467
|
+
SLICE_NAME: () => k,
|
|
468
|
+
ZERO_SLICE_STATE: () => T,
|
|
469
|
+
closeWindow: () => x,
|
|
470
|
+
completeProcess: () => _,
|
|
471
|
+
configureStore: () => Z,
|
|
472
|
+
createWindow: () => E,
|
|
473
|
+
focusWindow: () => O,
|
|
474
|
+
reducer: () => A,
|
|
475
|
+
registerProcess: () => y,
|
|
476
|
+
reloadWindow: () => b,
|
|
477
|
+
selectSliceState: () => B,
|
|
478
|
+
selectWindow: () => L,
|
|
479
|
+
selectWindowAttribute: () => z,
|
|
480
|
+
selectWindowKey: () => I,
|
|
481
|
+
selectWindowLabel: () => F,
|
|
482
|
+
selectWindows: () => R,
|
|
483
|
+
setWindowAlwaysOnTop: () => w,
|
|
484
|
+
setWindowDecorations: () => ne,
|
|
485
|
+
setWindowFullscreen: () => g,
|
|
486
|
+
setWindowMaxSize: () => j,
|
|
487
|
+
setWindowMaximized: () => P,
|
|
488
|
+
setWindowMinSize: () => v,
|
|
489
|
+
setWindowMinimized: () => N,
|
|
490
|
+
setWindowPosition: () => m,
|
|
491
|
+
setWindowProps: () => c,
|
|
492
|
+
setWindowResizable: () => M,
|
|
493
|
+
setWindowSize: () => h,
|
|
494
|
+
setWindowSkipTaskbar: () => u,
|
|
495
|
+
setWindowStage: () => l,
|
|
496
|
+
setWindowTitle: () => p,
|
|
497
|
+
setWindowVisible: () => C,
|
|
498
|
+
windowPropsZ: () => e
|
|
499
|
+
});
|
|
500
|
+
//#endregion
|
|
501
|
+
export { Te as Drift, a as MAIN_WINDOW, $ as NoopRuntime, k as SLICE_NAME, T as ZERO_SLICE_STATE, x as closeWindow, _ as completeProcess, Z as configureStore, E as createWindow, O as focusWindow, A as reducer, y as registerProcess, b as reloadWindow, B as selectSliceState, L as selectWindow, z as selectWindowAttribute, I as selectWindowKey, F as selectWindowLabel, R as selectWindows, w as setWindowAlwaysOnTop, ne as setWindowDecorations, g as setWindowFullscreen, j as setWindowMaxSize, P as setWindowMaximized, v as setWindowMinSize, N as setWindowMinimized, m as setWindowPosition, c as setWindowProps, M as setWindowResizable, h as setWindowSize, u as setWindowSkipTaskbar, l as setWindowStage, p as setWindowTitle, C as setWindowVisible, e as windowPropsZ };
|
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./selectors-Bs8JhAIN.cjs`);let t=require(`react`),n=require(`react-redux`);var r=({store:e,emptyContent:r=null,children:i})=>{let[a,o]=(0,t.useState)(null),[s,c]=(0,t.useState)(null);if(s!=null)throw c(null),s;return a==null?(e instanceof Promise?e.then(o).catch(c):o(e),r):(0,t.createElement)(n.Provider,{store:a},i)},i=r=>(0,n.useSelector)((0,t.useCallback)(t=>e.n(t,r),[r])),a=()=>(0,n.useSelector)(e.o),o=r=>(0,n.useSelector)((0,t.useCallback)(t=>e.i(t,r),[r])),s=(r,i)=>(0,n.useSelector)((0,t.useCallback)(t=>e.r(t,r,i),[r,i]));exports.Provider=r,exports.useSelectWindow=i,exports.useSelectWindowAttribute=s,exports.useSelectWindowKey=o,exports.useSelectWindows=a;
|
package/dist/react.js
CHANGED
|
@@ -1,70 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
l(
|
|
13
|
-
i((r) => P(r, e)),
|
|
14
|
-
[e]
|
|
15
|
-
)
|
|
16
|
-
), z = (e, r) => u(
|
|
17
|
-
l(
|
|
18
|
-
i((t) => S(t, e, r)),
|
|
19
|
-
[e, r]
|
|
20
|
-
)
|
|
21
|
-
), C = (e, r) => {
|
|
22
|
-
const t = h(r), o = y(), n = f(null);
|
|
23
|
-
m(() => {
|
|
24
|
-
if (t == null) return;
|
|
25
|
-
const { stage: c } = t;
|
|
26
|
-
if (c === "created" && n.current == null) {
|
|
27
|
-
const s = e();
|
|
28
|
-
s != null && (n.current = s), o(w({ key: t.key }));
|
|
29
|
-
} else (c === "closing" || c === "reloading") && n.current != null && (n.current(), n.current = null, o(p({ key: t.key })));
|
|
30
|
-
}, [t]);
|
|
31
|
-
}, L = (e, r) => {
|
|
32
|
-
const t = h(r), o = y(), n = f(null), c = f(!1);
|
|
33
|
-
m(() => {
|
|
34
|
-
if (t == null) return;
|
|
35
|
-
const { stage: s } = t;
|
|
36
|
-
if (s === "created" && n.current == null)
|
|
37
|
-
c.current = !0, e().then((a) => {
|
|
38
|
-
n.current = a ?? (async () => {
|
|
39
|
-
}), o(w({ key: t.key }));
|
|
40
|
-
}).catch(console.error).finally(() => {
|
|
41
|
-
c.current = !1;
|
|
42
|
-
});
|
|
43
|
-
else if ((s === "closing" || s === "reloading") && n.current != null) {
|
|
44
|
-
const a = n.current;
|
|
45
|
-
n.current = null, a().then(() => {
|
|
46
|
-
n.current = null;
|
|
47
|
-
}).catch(console.error).finally(() => {
|
|
48
|
-
o(p({ key: t.key }));
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}, [t]);
|
|
52
|
-
}, R = ({
|
|
53
|
-
store: e,
|
|
54
|
-
emptyContent: r = null,
|
|
55
|
-
children: t
|
|
56
|
-
}) => {
|
|
57
|
-
const [o, n] = d(null), [c, s] = d(null);
|
|
58
|
-
if (c != null)
|
|
59
|
-
throw s(null), c;
|
|
60
|
-
return o == null ? (e instanceof Promise ? e.then(n).catch(s) : n(e), r) : W(k, { store: o }, t);
|
|
61
|
-
};
|
|
62
|
-
export {
|
|
63
|
-
R as Provider,
|
|
64
|
-
L as useAsyncWindowLifecycle,
|
|
65
|
-
h as useSelectWindow,
|
|
66
|
-
z as useSelectWindowAttribute,
|
|
67
|
-
x as useSelectWindowKey,
|
|
68
|
-
q as useSelectWindows,
|
|
69
|
-
C as useWindowLifecycle
|
|
70
|
-
};
|
|
1
|
+
import { i as e, n as t, o as n, r } from "./selectors-CNMpvNhS.js";
|
|
2
|
+
import { createElement as i, useCallback as a, useState as o } from "react";
|
|
3
|
+
import { Provider as s, useSelector as c } from "react-redux";
|
|
4
|
+
//#region src/react/Provider.ts
|
|
5
|
+
var l = ({ store: e, emptyContent: t = null, children: n }) => {
|
|
6
|
+
let [r, a] = o(null), [c, l] = o(null);
|
|
7
|
+
if (c != null) throw l(null), c;
|
|
8
|
+
return r == null ? (e instanceof Promise ? e.then(a).catch(l) : a(e), t) : i(s, { store: r }, n);
|
|
9
|
+
}, u = (e) => c(a((n) => t(n, e), [e])), d = () => c(n), f = (t) => c(a((n) => e(n, t), [t])), p = (e, t) => c(a((n) => r(n, e, t), [e, t]));
|
|
10
|
+
//#endregion
|
|
11
|
+
export { l as Provider, u as useSelectWindow, p as useSelectWindowAttribute, f as useSelectWindowKey, d as useSelectWindows };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./window-7qdnLqUa.cjs`);let t=require(`@reduxjs/toolkit`);var n=e=>e.drift,r=(0,t.createSelector)([e=>n(e).windows],e=>Object.values(e)),i=(e,t)=>{let r=n(e);if(t==null)return r.windows[r.label]??null;let i=r.windows[t];if(i!=null)return i;let a=r.keyLabels[t];return r.windows[a]??null},a=(t,r)=>{let i=n(t);if(r==null)return i.labelKeys[i.label]??null;let a=i.labelKeys[r]??null;return a==null&&r==`main`?e.r:a},o=(e,t,n)=>i(e,t)?.[n]??null,s=(e,t)=>n(e).keyLabels[t]??null;Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { r as e } from "./window-b_pX3pWi.js";
|
|
2
|
+
import { createSelector as t } from "@reduxjs/toolkit";
|
|
3
|
+
//#region src/selectors.ts
|
|
4
|
+
var n = (e) => e.drift, r = t([(e) => n(e).windows], (e) => Object.values(e)), i = (e, t) => {
|
|
5
|
+
let r = n(e);
|
|
6
|
+
if (t == null) return r.windows[r.label] ?? null;
|
|
7
|
+
let i = r.windows[t];
|
|
8
|
+
if (i != null) return i;
|
|
9
|
+
let a = r.keyLabels[t];
|
|
10
|
+
return r.windows[a] ?? null;
|
|
11
|
+
}, a = (t, r) => {
|
|
12
|
+
let i = n(t);
|
|
13
|
+
if (r == null) return i.labelKeys[i.label] ?? null;
|
|
14
|
+
let a = i.labelKeys[r] ?? null;
|
|
15
|
+
return a == null && r == "main" ? e : a;
|
|
16
|
+
}, o = (e, t, n) => i(e, t)?.[n] ?? null, s = (e, t) => n(e).keyLabels[t] ?? null;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { s as a, a as i, i as n, r as o, o as r, n as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings":"AASA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7D,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../src/react/selectors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../src/react/selectors.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,WAAW,GAAG,IACqB,CAAC;AAEnF,eAAO,MAAM,gBAAgB,QAAO,WAAW,EAAgC,CAAC;AAEhF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAG1D,CAAC;AAEJ,eAAO,MAAM,wBAAwB,GAAI,CAAC,SAAS,MAAM,WAAW,EAClE,YAAY,MAAM,EAClB,MAAM,CAAC,KACN,WAAW,CAAC,CAAC,CAAC,GAAG,IAMjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.spec.d.ts","sourceRoot":"","sources":["../../../src/react/selectors.spec.tsx"],"names":[],"mappings":""}
|