@synnaxlabs/drift 0.48.0 → 0.49.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/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-KaNE81VG.cjs"),i=require("./state-BEtTdLcx.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;
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-C-yu1uR2.cjs"),i=require("./state-B6GRS-m8.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 g } from "react-redux";
2
+ import { useSelector as u, useDispatch as y, Provider as k } from "react-redux";
3
3
  import { memoize as i } from "proxy-memoize";
4
- import { a as k, e as S, c as P, b as v } from "./selectors-DyMwTbxE.js";
5
- import { o as w, j as p } from "./state-BI4Gp9I9.js";
4
+ import { a as g, e as S, c as P, b as v } from "./selectors-UsB3Nvlx.js";
5
+ import { p as w, k as p } from "./state-D-AHxNXX.js";
6
6
  const h = (e) => u(
7
7
  l(
8
- i((r) => k(r, e)),
8
+ i((r) => g(r, e)),
9
9
  [e]
10
10
  )
11
- ), j = () => u(l(i(S), [])), x = (e) => u(
11
+ ), x = () => u(l(i(S), [])), z = (e) => u(
12
12
  l(
13
13
  i((r) => P(r, e)),
14
14
  [e]
15
15
  )
16
- ), z = (e, r) => u(
16
+ ), C = (e, r) => u(
17
17
  l(
18
18
  i((t) => v(t, e, r)),
19
19
  [e, r]
20
20
  )
21
- ), C = (e, r) => {
21
+ ), L = (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
- }, L = (e, r) => {
31
+ }, R = (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
- }, R = ({
52
+ }, j = ({
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(g, { store: o }, t);
60
+ return o == null ? (e instanceof Promise ? e.then(n).catch(s) : n(e), r) : W(k, { store: o }, t);
61
61
  };
62
62
  export {
63
- R as Provider,
64
- L as useAsyncWindowLifecycle,
63
+ j as Provider,
64
+ R as useAsyncWindowLifecycle,
65
65
  h as useSelectWindow,
66
- z as useSelectWindowAttribute,
67
- x as useSelectWindowKey,
68
- j as useSelectWindows,
69
- C as useWindowLifecycle
66
+ C as useSelectWindowAttribute,
67
+ z as useSelectWindowKey,
68
+ x as useSelectWindows,
69
+ L as useWindowLifecycle
70
70
  };
@@ -1 +1 @@
1
- "use strict";const i=require("./state-BEtTdLcx.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
+ "use strict";const i=require("./state-B6GRS-m8.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 { M as i } from "./state-BI4Gp9I9.js";
1
+ import { M as i } from "./state-D-AHxNXX.js";
2
2
  const l = (n) => n.drift, a = (n) => Object.values(l(n).windows), r = (n, e) => {
3
3
  const t = l(n);
4
4
  if (e == null) return t.windows[t.label];
@@ -1,4 +1,4 @@
1
- import { AsyncDestructor } from '@synnaxlabs/x';
1
+ import { destructor } from '@synnaxlabs/x';
2
2
  import { EffectCallback } from 'react';
3
3
  /**
4
4
  * A hook that allows a user to tap into the lifecycle of a window.
@@ -11,5 +11,5 @@ import { EffectCallback } from 'react';
11
11
  * If not provided, the current window is used.
12
12
  */
13
13
  export declare const useWindowLifecycle: (cb: EffectCallback, key?: string) => void;
14
- export declare const useAsyncWindowLifecycle: (cb: () => Promise<AsyncDestructor | undefined>, key?: string) => void;
14
+ export declare const useAsyncWindowLifecycle: (cb: () => Promise<destructor.Async | undefined>, key?: string) => void;
15
15
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/react/hooks.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,OAAO,CAAC;AAM/D;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAAI,IAAI,cAAc,EAAE,MAAM,MAAM,KAAG,IAoBrE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,IAAI,MAAM,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,EAC9C,MAAM,MAAM,KACX,IAmCF,CAAC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/react/hooks.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,OAAO,CAAC;AAM/D;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAAI,IAAI,cAAc,EAAE,MAAM,MAAM,KAAG,IAoBrE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,IAAI,MAAM,OAAO,CAAC,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,EAC/C,MAAM,MAAM,KACX,IAmCF,CAAC"}