@e1011/es-kit 1.0.192 → 1.0.196
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/hooks/_virtual/_rollupPluginBabelHelpers.js +2 -0
- package/dist/hooks/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/hooks/esm/_virtual/_rollupPluginBabelHelpers.js +2 -0
- package/dist/hooks/esm/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/hooks/esm/index.css +19 -19
- package/dist/hooks/esm/src/core/hooks/useApi.js +1 -1
- package/dist/hooks/esm/src/core/hooks/useApi.js.map +1 -1
- package/dist/hooks/index.css +19 -19
- package/dist/hooks/src/core/hooks/useApi.js +1 -1
- package/dist/hooks/src/core/hooks/useApi.js.map +1 -1
- package/dist/lib/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/dist/lib/cjs/src/core/hooks/useApi.js +1 -1
- package/dist/lib/cjs/src/core/hooks/useApi.js.map +1 -1
- package/dist/lib/cjs/src/core/ui/components/icon/IconWC.js +1 -1
- package/dist/lib/cjs/src/core/ui/components/icon/IconWC.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/appState/store/store.vanillajs.js +1 -1
- package/dist/lib/cjs/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/appState/store/store.vanillajs.templates.js +1 -1
- package/dist/lib/cjs/src/core/utils/appState/store/store.vanillajs.templates.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/helpers/deviceInfo.js +1 -1
- package/dist/lib/cjs/src/core/utils/helpers/deviceInfo.js.map +1 -1
- package/dist/lib/esm/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/dist/lib/esm/src/core/hooks/useApi.js +1 -1
- package/dist/lib/esm/src/core/hooks/useApi.js.map +1 -1
- package/dist/lib/esm/src/core/ui/components/icon/IconWC.js +1 -1
- package/dist/lib/esm/src/core/ui/components/icon/IconWC.js.map +1 -1
- package/dist/lib/esm/src/core/utils/appState/store/store.vanillajs.js +1 -1
- package/dist/lib/esm/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/lib/esm/src/core/utils/appState/store/store.vanillajs.templates.js +1 -1
- package/dist/lib/esm/src/core/utils/appState/store/store.vanillajs.templates.js.map +1 -1
- package/dist/lib/esm/src/core/utils/helpers/deviceInfo.js +1 -1
- package/dist/lib/esm/src/core/utils/helpers/deviceInfo.js.map +1 -1
- package/dist/ui/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/dist/ui/esm/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/dist/ui/esm/src/core/ui/components/icon/IconWC.js +1 -1
- package/dist/ui/esm/src/core/ui/components/icon/IconWC.js.map +1 -1
- package/dist/ui/src/core/ui/components/icon/IconWC.js +1 -1
- package/dist/ui/src/core/ui/components/icon/IconWC.js.map +1 -1
- package/dist/utils/_virtual/_rollupPluginBabelHelpers.js +2 -0
- package/dist/utils/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/utils/esm/_virtual/_rollupPluginBabelHelpers.js +2 -0
- package/dist/utils/esm/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/utils/esm/index.css +19 -19
- package/dist/utils/esm/src/core/utils/appState/store/store.vanillajs.js +1 -1
- package/dist/utils/esm/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/utils/esm/src/core/utils/appState/store/store.vanillajs.templates.js +1 -1
- package/dist/utils/esm/src/core/utils/appState/store/store.vanillajs.templates.js.map +1 -1
- package/dist/utils/esm/src/core/utils/helpers/deviceInfo.js +1 -1
- package/dist/utils/esm/src/core/utils/helpers/deviceInfo.js.map +1 -1
- package/dist/utils/index.css +19 -19
- package/dist/utils/src/core/utils/appState/store/store.vanillajs.js +1 -1
- package/dist/utils/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/utils/src/core/utils/appState/store/store.vanillajs.templates.js +1 -1
- package/dist/utils/src/core/utils/appState/store/store.vanillajs.templates.js.map +1 -1
- package/dist/utils/src/core/utils/helpers/deviceInfo.js +1 -1
- package/dist/utils/src/core/utils/helpers/deviceInfo.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function n(n,t,r,e,o,i,u){try{var c=n[i](u),a=c.value}catch(n){return void r(n)}c.done?t(a):Promise.resolve(a).then(e,o)}exports.asyncToGenerator=function(t){return function(){var r=this,e=arguments;return new Promise((function(o,i){var u=t.apply(r,e);function c(t){n(u,o,i,c,a,"next",t)}function a(t){n(u,o,i,c,a,"throw",t)}c(void 0)}))}};
|
|
2
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function n(n,r,t,o,e,i,u){try{var a=n[i](u),c=a.value}catch(n){return void t(n)}a.done?r(c):Promise.resolve(c).then(o,e)}function r(r){return function(){var t=this,o=arguments;return new Promise((function(e,i){var u=r.apply(t,o);function a(r){n(u,e,i,a,c,"next",r)}function c(r){n(u,e,i,a,c,"throw",r)}a(void 0)}))}}export{r as asyncToGenerator};
|
|
2
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/hooks/esm/index.css
CHANGED
|
@@ -28,6 +28,25 @@
|
|
|
28
28
|
width: var(--height);
|
|
29
29
|
height: var(--width);
|
|
30
30
|
}
|
|
31
|
+
.divider-module_divider-line__6CesR {
|
|
32
|
+
position: relative;
|
|
33
|
+
display: block;
|
|
34
|
+
transition: opacity, width, height 250ms ease-in-out;
|
|
35
|
+
background-color: var(--color);
|
|
36
|
+
opacity: var(--opacity);
|
|
37
|
+
}
|
|
38
|
+
.divider-module_divider-line__6CesR.divider-module_vertical__qSVWD {
|
|
39
|
+
height: var(--length);
|
|
40
|
+
left: var(--left);
|
|
41
|
+
width: var(--width);
|
|
42
|
+
margin: var(--margin);
|
|
43
|
+
}
|
|
44
|
+
.divider-module_divider-line__6CesR.divider-module_horizontal__Gz-Oj {
|
|
45
|
+
width: var(--length);
|
|
46
|
+
left: var(--left);
|
|
47
|
+
height: var(--height);
|
|
48
|
+
margin: var(--margin);
|
|
49
|
+
}
|
|
31
50
|
.CollapsibleContainer-module_collapsible-container__u0Jmm {
|
|
32
51
|
transform-origin: 0% 0%;
|
|
33
52
|
opacity: 0;
|
|
@@ -61,25 +80,6 @@
|
|
|
61
80
|
max-width: var(--prop-value);
|
|
62
81
|
opacity: 1;
|
|
63
82
|
}
|
|
64
|
-
.divider-module_divider-line__6CesR {
|
|
65
|
-
position: relative;
|
|
66
|
-
display: block;
|
|
67
|
-
transition: opacity, width, height 250ms ease-in-out;
|
|
68
|
-
background-color: var(--color);
|
|
69
|
-
opacity: var(--opacity);
|
|
70
|
-
}
|
|
71
|
-
.divider-module_divider-line__6CesR.divider-module_vertical__qSVWD {
|
|
72
|
-
height: var(--length);
|
|
73
|
-
left: var(--left);
|
|
74
|
-
width: var(--width);
|
|
75
|
-
margin: var(--margin);
|
|
76
|
-
}
|
|
77
|
-
.divider-module_divider-line__6CesR.divider-module_horizontal__Gz-Oj {
|
|
78
|
-
width: var(--length);
|
|
79
|
-
left: var(--left);
|
|
80
|
-
height: var(--height);
|
|
81
|
-
margin: var(--margin);
|
|
82
|
-
}
|
|
83
83
|
.layoutBox-module_layout-box__faPND {
|
|
84
84
|
display: flex;
|
|
85
85
|
position: relative;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../../node_modules/core-js/modules/web.dom-collections.iterator.js";import{useState as
|
|
1
|
+
import{asyncToGenerator as r}from"../../../_virtual/_rollupPluginBabelHelpers.js";import"../../../node_modules/core-js/modules/web.dom-collections.iterator.js";import{useState as o,useCallback as a}from"react";const e={},l={loading:!1,error:null,data:null},t=(t,n,d,c,s)=>{const[i,u]=o(l);e[t]||(e[t]={id:t,caller:n,decorator:d,successHandler:c,errorHandler:s});const{caller:m,decorator:g,successHandler:p,errorHandler:H}=e[t];return[a(r((function*(){try{u((r=>({...r,loading:!0})));const r=yield m(...arguments),o=g?g(r):r;return p&&p({data:o,originalData:r.data}),u((a=>({...a,loading:!1,error:null,data:o,originalData:r.data}))),o}catch(r){throw H&&H(r),u((o=>({...o,loading:!1,error:r}))),r}})),[m,g,p,H]),i]};export{t as useApi};
|
|
2
2
|
//# sourceMappingURL=useApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useApi.js","sources":["../../../../../../src/core/hooks/useApi.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport type Data = any | any[] | null\n\nexport type DataFetching = { data?: Data; error?: string | null; loading: boolean; originalData?: Data }\n\ntype Caller = (...args: any[]) => Promise<any>\n\ntype Decorator = (RequestOrResponse: Record<string, any> | any) => Record<string, any>\n\ntype UseApiItem = {\n id: string\n caller: Caller\n decorator?: Decorator\n successHandler?: (data: any) => void\n errorHandler?: (data: any) => void\n}\n\nconst map: Record<string, UseApiItem> = {}\n\nconst defaultDataFetching = { loading: false, error: null, data: null }\n\nexport const useApi = (\n id: string,\n callerInitial: Caller,\n decoratorIntitial?: Decorator,\n successHandler?: (data: any) => void,\n errorHandler?: (data: any) => void,\n// eslint-disable-next-line function-paren-newline\n): [(...args: any[]) => Promise<any>, DataFetching] => {\n const [dataFetching, setDataFetching] = useState<DataFetching>(defaultDataFetching)\n\n // TODO should work the same with useMemo...\n if (!map[id]) {\n map[id] = { id, caller: callerInitial, decorator: decoratorIntitial, successHandler, errorHandler }\n }\n\n const { caller, decorator, successHandler: onSuccess, errorHandler: onError } = map[id]\n\n const doCall: () => Promise<any> = useCallback(async(...args: any[]) => {\n try {\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: true }))\n const data: Data = await caller(...args)\n const returnData = decorator ? decorator(data) : data\n\n onSuccess && onSuccess({ data: returnData, originalData: data.data })\n\n setDataFetching((prevState: DataFetching) => {\n const newState = { ...prevState, loading: false, error: null, data: returnData, originalData: data.data }\n\n return newState\n })\n\n return returnData\n } catch (error: any) {\n onError && onError(error)\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: false, error }))\n throw error\n }\n }, [caller, decorator, onSuccess, onError])\n\n return [doCall, dataFetching]\n}\n"],"names":["map","defaultDataFetching","loading","error","data","useApi","id","callerInitial","decoratorIntitial","successHandler","errorHandler","dataFetching","setDataFetching","useState","caller","decorator","onSuccess","onError","useCallback","
|
|
1
|
+
{"version":3,"file":"useApi.js","sources":["../../../../../../src/core/hooks/useApi.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport type Data = any | any[] | null\n\nexport type DataFetching = { data?: Data; error?: string | null; loading: boolean; originalData?: Data }\n\ntype Caller = (...args: any[]) => Promise<any>\n\ntype Decorator = (RequestOrResponse: Record<string, any> | any) => Record<string, any>\n\ntype UseApiItem = {\n id: string\n caller: Caller\n decorator?: Decorator\n successHandler?: (data: any) => void\n errorHandler?: (data: any) => void\n}\n\nconst map: Record<string, UseApiItem> = {}\n\nconst defaultDataFetching = { loading: false, error: null, data: null }\n\nexport const useApi = (\n id: string,\n callerInitial: Caller,\n decoratorIntitial?: Decorator,\n successHandler?: (data: any) => void,\n errorHandler?: (data: any) => void,\n// eslint-disable-next-line function-paren-newline\n): [(...args: any[]) => Promise<any>, DataFetching] => {\n const [dataFetching, setDataFetching] = useState<DataFetching>(defaultDataFetching)\n\n // TODO should work the same with useMemo...\n if (!map[id]) {\n map[id] = { id, caller: callerInitial, decorator: decoratorIntitial, successHandler, errorHandler }\n }\n\n const { caller, decorator, successHandler: onSuccess, errorHandler: onError } = map[id]\n\n const doCall: () => Promise<any> = useCallback(async(...args: any[]) => {\n try {\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: true }))\n const data: Data = await caller(...args)\n const returnData = decorator ? decorator(data) : data\n\n onSuccess && onSuccess({ data: returnData, originalData: data.data })\n\n setDataFetching((prevState: DataFetching) => {\n const newState = { ...prevState, loading: false, error: null, data: returnData, originalData: data.data }\n\n return newState\n })\n\n return returnData\n } catch (error: any) {\n onError && onError(error)\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: false, error }))\n throw error\n }\n }, [caller, decorator, onSuccess, onError])\n\n return [doCall, dataFetching]\n}\n"],"names":["map","defaultDataFetching","loading","error","data","useApi","id","callerInitial","decoratorIntitial","successHandler","errorHandler","dataFetching","setDataFetching","useState","caller","decorator","onSuccess","onError","useCallback","_asyncToGenerator","prevState","arguments","returnData","originalData"],"mappings":"kNAkBA,MAAMA,EAAkC,CAAA,EAElCC,EAAsB,CAAEC,SAAS,EAAOC,MAAO,KAAMC,KAAM,MAEpDC,EAASA,CACpBC,EACAC,EACAC,EACAC,EACAC,KAGA,MAAOC,EAAcC,GAAmBC,EAAuBZ,GAG1DD,EAAIM,KACPN,EAAIM,GAAM,CAAEA,KAAIQ,OAAQP,EAAeQ,UAAWP,EAAmBC,iBAAgBC,iBAGvF,MAAMI,OAAEA,EAAMC,UAAEA,EAAWN,eAAgBO,EAAWN,aAAcO,GAAYjB,EAAIM,GAwBpF,MAAO,CAtB4BY,EAAWC,GAAC,YAC7C,IACEP,GAAiBQ,IAA6B,IAAKA,EAAWlB,SAAS,MACvE,MAAME,QAAmBU,KAAOO,WAC1BC,EAAaP,EAAYA,EAAUX,GAAQA,EAUjD,OARAY,GAAaA,EAAU,CAAEZ,KAAMkB,EAAYC,aAAcnB,EAAKA,OAE9DQ,GAAiBQ,IACE,IAAKA,EAAWlB,SAAS,EAAOC,MAAO,KAAMC,KAAMkB,EAAYC,aAAcnB,EAAKA,SAK9FkB,CACR,CAAC,MAAOnB,GAGP,MAFAc,GAAWA,EAAQd,GACnBS,GAAiBQ,IAA6B,IAAKA,EAAWlB,SAAS,EAAOC,YACxEA,CACR,KACC,CAACW,EAAQC,EAAWC,EAAWC,IAElBN,EAAa"}
|
package/dist/hooks/index.css
CHANGED
|
@@ -28,6 +28,25 @@
|
|
|
28
28
|
width: var(--height);
|
|
29
29
|
height: var(--width);
|
|
30
30
|
}
|
|
31
|
+
.divider-module_divider-line__6CesR {
|
|
32
|
+
position: relative;
|
|
33
|
+
display: block;
|
|
34
|
+
transition: opacity, width, height 250ms ease-in-out;
|
|
35
|
+
background-color: var(--color);
|
|
36
|
+
opacity: var(--opacity);
|
|
37
|
+
}
|
|
38
|
+
.divider-module_divider-line__6CesR.divider-module_vertical__qSVWD {
|
|
39
|
+
height: var(--length);
|
|
40
|
+
left: var(--left);
|
|
41
|
+
width: var(--width);
|
|
42
|
+
margin: var(--margin);
|
|
43
|
+
}
|
|
44
|
+
.divider-module_divider-line__6CesR.divider-module_horizontal__Gz-Oj {
|
|
45
|
+
width: var(--length);
|
|
46
|
+
left: var(--left);
|
|
47
|
+
height: var(--height);
|
|
48
|
+
margin: var(--margin);
|
|
49
|
+
}
|
|
31
50
|
.CollapsibleContainer-module_collapsible-container__u0Jmm {
|
|
32
51
|
transform-origin: 0% 0%;
|
|
33
52
|
opacity: 0;
|
|
@@ -61,25 +80,6 @@
|
|
|
61
80
|
max-width: var(--prop-value);
|
|
62
81
|
opacity: 1;
|
|
63
82
|
}
|
|
64
|
-
.divider-module_divider-line__6CesR {
|
|
65
|
-
position: relative;
|
|
66
|
-
display: block;
|
|
67
|
-
transition: opacity, width, height 250ms ease-in-out;
|
|
68
|
-
background-color: var(--color);
|
|
69
|
-
opacity: var(--opacity);
|
|
70
|
-
}
|
|
71
|
-
.divider-module_divider-line__6CesR.divider-module_vertical__qSVWD {
|
|
72
|
-
height: var(--length);
|
|
73
|
-
left: var(--left);
|
|
74
|
-
width: var(--width);
|
|
75
|
-
margin: var(--margin);
|
|
76
|
-
}
|
|
77
|
-
.divider-module_divider-line__6CesR.divider-module_horizontal__Gz-Oj {
|
|
78
|
-
width: var(--length);
|
|
79
|
-
left: var(--left);
|
|
80
|
-
height: var(--height);
|
|
81
|
-
margin: var(--margin);
|
|
82
|
-
}
|
|
83
83
|
.layoutBox-module_layout-box__faPND {
|
|
84
84
|
display: flex;
|
|
85
85
|
position: relative;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("../../../node_modules/core-js/modules/web.dom-collections.iterator.js");var
|
|
1
|
+
"use strict";var r=require("../../../_virtual/_rollupPluginBabelHelpers.js");require("../../../node_modules/core-js/modules/web.dom-collections.iterator.js");var e=require("react");const a={},l={loading:!1,error:null,data:null};exports.useApi=(o,t,n,s,c)=>{const[d,i]=e.useState(l);a[o]||(a[o]={id:o,caller:t,decorator:n,successHandler:s,errorHandler:c});const{caller:u,decorator:g,successHandler:H,errorHandler:p}=a[o];return[e.useCallback(r.asyncToGenerator((function*(){try{i((r=>({...r,loading:!0})));const r=yield u(...arguments),e=g?g(r):r;return H&&H({data:e,originalData:r.data}),i((a=>({...a,loading:!1,error:null,data:e,originalData:r.data}))),e}catch(r){throw p&&p(r),i((e=>({...e,loading:!1,error:r}))),r}})),[u,g,H,p]),d]};
|
|
2
2
|
//# sourceMappingURL=useApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useApi.js","sources":["../../../../../src/core/hooks/useApi.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport type Data = any | any[] | null\n\nexport type DataFetching = { data?: Data; error?: string | null; loading: boolean; originalData?: Data }\n\ntype Caller = (...args: any[]) => Promise<any>\n\ntype Decorator = (RequestOrResponse: Record<string, any> | any) => Record<string, any>\n\ntype UseApiItem = {\n id: string\n caller: Caller\n decorator?: Decorator\n successHandler?: (data: any) => void\n errorHandler?: (data: any) => void\n}\n\nconst map: Record<string, UseApiItem> = {}\n\nconst defaultDataFetching = { loading: false, error: null, data: null }\n\nexport const useApi = (\n id: string,\n callerInitial: Caller,\n decoratorIntitial?: Decorator,\n successHandler?: (data: any) => void,\n errorHandler?: (data: any) => void,\n// eslint-disable-next-line function-paren-newline\n): [(...args: any[]) => Promise<any>, DataFetching] => {\n const [dataFetching, setDataFetching] = useState<DataFetching>(defaultDataFetching)\n\n // TODO should work the same with useMemo...\n if (!map[id]) {\n map[id] = { id, caller: callerInitial, decorator: decoratorIntitial, successHandler, errorHandler }\n }\n\n const { caller, decorator, successHandler: onSuccess, errorHandler: onError } = map[id]\n\n const doCall: () => Promise<any> = useCallback(async(...args: any[]) => {\n try {\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: true }))\n const data: Data = await caller(...args)\n const returnData = decorator ? decorator(data) : data\n\n onSuccess && onSuccess({ data: returnData, originalData: data.data })\n\n setDataFetching((prevState: DataFetching) => {\n const newState = { ...prevState, loading: false, error: null, data: returnData, originalData: data.data }\n\n return newState\n })\n\n return returnData\n } catch (error: any) {\n onError && onError(error)\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: false, error }))\n throw error\n }\n }, [caller, decorator, onSuccess, onError])\n\n return [doCall, dataFetching]\n}\n"],"names":["map","defaultDataFetching","loading","error","data","useApi","id","callerInitial","decoratorIntitial","successHandler","errorHandler","dataFetching","setDataFetching","useState","caller","decorator","onSuccess","onError","useCallback","
|
|
1
|
+
{"version":3,"file":"useApi.js","sources":["../../../../../src/core/hooks/useApi.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport type Data = any | any[] | null\n\nexport type DataFetching = { data?: Data; error?: string | null; loading: boolean; originalData?: Data }\n\ntype Caller = (...args: any[]) => Promise<any>\n\ntype Decorator = (RequestOrResponse: Record<string, any> | any) => Record<string, any>\n\ntype UseApiItem = {\n id: string\n caller: Caller\n decorator?: Decorator\n successHandler?: (data: any) => void\n errorHandler?: (data: any) => void\n}\n\nconst map: Record<string, UseApiItem> = {}\n\nconst defaultDataFetching = { loading: false, error: null, data: null }\n\nexport const useApi = (\n id: string,\n callerInitial: Caller,\n decoratorIntitial?: Decorator,\n successHandler?: (data: any) => void,\n errorHandler?: (data: any) => void,\n// eslint-disable-next-line function-paren-newline\n): [(...args: any[]) => Promise<any>, DataFetching] => {\n const [dataFetching, setDataFetching] = useState<DataFetching>(defaultDataFetching)\n\n // TODO should work the same with useMemo...\n if (!map[id]) {\n map[id] = { id, caller: callerInitial, decorator: decoratorIntitial, successHandler, errorHandler }\n }\n\n const { caller, decorator, successHandler: onSuccess, errorHandler: onError } = map[id]\n\n const doCall: () => Promise<any> = useCallback(async(...args: any[]) => {\n try {\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: true }))\n const data: Data = await caller(...args)\n const returnData = decorator ? decorator(data) : data\n\n onSuccess && onSuccess({ data: returnData, originalData: data.data })\n\n setDataFetching((prevState: DataFetching) => {\n const newState = { ...prevState, loading: false, error: null, data: returnData, originalData: data.data }\n\n return newState\n })\n\n return returnData\n } catch (error: any) {\n onError && onError(error)\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: false, error }))\n throw error\n }\n }, [caller, decorator, onSuccess, onError])\n\n return [doCall, dataFetching]\n}\n"],"names":["map","defaultDataFetching","loading","error","data","useApi","id","callerInitial","decoratorIntitial","successHandler","errorHandler","dataFetching","setDataFetching","useState","caller","decorator","onSuccess","onError","useCallback","_asyncToGenerator","prevState","arguments","returnData","originalData"],"mappings":"qLAkBA,MAAMA,EAAkC,CAAA,EAElCC,EAAsB,CAAEC,SAAS,EAAOC,MAAO,KAAMC,KAAM,qBAE3CC,CACpBC,EACAC,EACAC,EACAC,EACAC,KAGA,MAAOC,EAAcC,GAAmBC,EAAQA,SAAeZ,GAG1DD,EAAIM,KACPN,EAAIM,GAAM,CAAEA,KAAIQ,OAAQP,EAAeQ,UAAWP,EAAmBC,iBAAgBC,iBAGvF,MAAMI,OAAEA,EAAMC,UAAEA,EAAWN,eAAgBO,EAAWN,aAAcO,GAAYjB,EAAIM,GAwBpF,MAAO,CAtB4BY,cAAWC,EAAAA,kBAAC,YAC7C,IACEP,GAAiBQ,IAA6B,IAAKA,EAAWlB,SAAS,MACvE,MAAME,QAAmBU,KAAOO,WAC1BC,EAAaP,EAAYA,EAAUX,GAAQA,EAUjD,OARAY,GAAaA,EAAU,CAAEZ,KAAMkB,EAAYC,aAAcnB,EAAKA,OAE9DQ,GAAiBQ,IACE,IAAKA,EAAWlB,SAAS,EAAOC,MAAO,KAAMC,KAAMkB,EAAYC,aAAcnB,EAAKA,SAK9FkB,CACR,CAAC,MAAOnB,GAGP,MAFAc,GAAWA,EAAQd,GACnBS,GAAiBQ,IAA6B,IAAKA,EAAWlB,SAAS,EAAOC,YACxEA,CACR,KACC,CAACW,EAAQC,EAAWC,EAAWC,IAElBN,EAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function
|
|
1
|
+
"use strict";function n(n,t,r,e,o,i,a){try{var c=n[i](a),s=c.value}catch(n){return void r(n)}c.done?t(s):Promise.resolve(s).then(e,o)}function t(){return t=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=r[e])}return n},t.apply(this,arguments)}exports.asyncToGenerator=function(t){return function(){var r=this,e=arguments;return new Promise((function(o,i){var a=t.apply(r,e);function c(t){n(a,o,i,c,s,"next",t)}function s(t){n(a,o,i,c,s,"throw",t)}c(void 0)}))}},exports.extends=t;
|
|
2
2
|
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("../../../node_modules/core-js/modules/web.dom-collections.iterator.js");var
|
|
1
|
+
"use strict";var r=require("../../../_virtual/_rollupPluginBabelHelpers.js");require("../../../node_modules/core-js/modules/web.dom-collections.iterator.js");var e=require("react");const a={},l={loading:!1,error:null,data:null};exports.useApi=(o,t,n,s,c)=>{const[d,i]=e.useState(l);a[o]||(a[o]={id:o,caller:t,decorator:n,successHandler:s,errorHandler:c});const{caller:u,decorator:g,successHandler:H,errorHandler:p}=a[o];return[e.useCallback(r.asyncToGenerator((function*(){try{i((r=>({...r,loading:!0})));const r=yield u(...arguments),e=g?g(r):r;return H&&H({data:e,originalData:r.data}),i((a=>({...a,loading:!1,error:null,data:e,originalData:r.data}))),e}catch(r){throw p&&p(r),i((e=>({...e,loading:!1,error:r}))),r}})),[u,g,H,p]),d]};
|
|
2
2
|
//# sourceMappingURL=useApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useApi.js","sources":["../../../../../../src/core/hooks/useApi.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport type Data = any | any[] | null\n\nexport type DataFetching = { data?: Data; error?: string | null; loading: boolean; originalData?: Data }\n\ntype Caller = (...args: any[]) => Promise<any>\n\ntype Decorator = (RequestOrResponse: Record<string, any> | any) => Record<string, any>\n\ntype UseApiItem = {\n id: string\n caller: Caller\n decorator?: Decorator\n successHandler?: (data: any) => void\n errorHandler?: (data: any) => void\n}\n\nconst map: Record<string, UseApiItem> = {}\n\nconst defaultDataFetching = { loading: false, error: null, data: null }\n\nexport const useApi = (\n id: string,\n callerInitial: Caller,\n decoratorIntitial?: Decorator,\n successHandler?: (data: any) => void,\n errorHandler?: (data: any) => void,\n// eslint-disable-next-line function-paren-newline\n): [(...args: any[]) => Promise<any>, DataFetching] => {\n const [dataFetching, setDataFetching] = useState<DataFetching>(defaultDataFetching)\n\n // TODO should work the same with useMemo...\n if (!map[id]) {\n map[id] = { id, caller: callerInitial, decorator: decoratorIntitial, successHandler, errorHandler }\n }\n\n const { caller, decorator, successHandler: onSuccess, errorHandler: onError } = map[id]\n\n const doCall: () => Promise<any> = useCallback(async(...args: any[]) => {\n try {\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: true }))\n const data: Data = await caller(...args)\n const returnData = decorator ? decorator(data) : data\n\n onSuccess && onSuccess({ data: returnData, originalData: data.data })\n\n setDataFetching((prevState: DataFetching) => {\n const newState = { ...prevState, loading: false, error: null, data: returnData, originalData: data.data }\n\n return newState\n })\n\n return returnData\n } catch (error: any) {\n onError && onError(error)\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: false, error }))\n throw error\n }\n }, [caller, decorator, onSuccess, onError])\n\n return [doCall, dataFetching]\n}\n"],"names":["map","defaultDataFetching","loading","error","data","useApi","id","callerInitial","decoratorIntitial","successHandler","errorHandler","dataFetching","setDataFetching","useState","caller","decorator","onSuccess","onError","useCallback","
|
|
1
|
+
{"version":3,"file":"useApi.js","sources":["../../../../../../src/core/hooks/useApi.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport type Data = any | any[] | null\n\nexport type DataFetching = { data?: Data; error?: string | null; loading: boolean; originalData?: Data }\n\ntype Caller = (...args: any[]) => Promise<any>\n\ntype Decorator = (RequestOrResponse: Record<string, any> | any) => Record<string, any>\n\ntype UseApiItem = {\n id: string\n caller: Caller\n decorator?: Decorator\n successHandler?: (data: any) => void\n errorHandler?: (data: any) => void\n}\n\nconst map: Record<string, UseApiItem> = {}\n\nconst defaultDataFetching = { loading: false, error: null, data: null }\n\nexport const useApi = (\n id: string,\n callerInitial: Caller,\n decoratorIntitial?: Decorator,\n successHandler?: (data: any) => void,\n errorHandler?: (data: any) => void,\n// eslint-disable-next-line function-paren-newline\n): [(...args: any[]) => Promise<any>, DataFetching] => {\n const [dataFetching, setDataFetching] = useState<DataFetching>(defaultDataFetching)\n\n // TODO should work the same with useMemo...\n if (!map[id]) {\n map[id] = { id, caller: callerInitial, decorator: decoratorIntitial, successHandler, errorHandler }\n }\n\n const { caller, decorator, successHandler: onSuccess, errorHandler: onError } = map[id]\n\n const doCall: () => Promise<any> = useCallback(async(...args: any[]) => {\n try {\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: true }))\n const data: Data = await caller(...args)\n const returnData = decorator ? decorator(data) : data\n\n onSuccess && onSuccess({ data: returnData, originalData: data.data })\n\n setDataFetching((prevState: DataFetching) => {\n const newState = { ...prevState, loading: false, error: null, data: returnData, originalData: data.data }\n\n return newState\n })\n\n return returnData\n } catch (error: any) {\n onError && onError(error)\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: false, error }))\n throw error\n }\n }, [caller, decorator, onSuccess, onError])\n\n return [doCall, dataFetching]\n}\n"],"names":["map","defaultDataFetching","loading","error","data","useApi","id","callerInitial","decoratorIntitial","successHandler","errorHandler","dataFetching","setDataFetching","useState","caller","decorator","onSuccess","onError","useCallback","_asyncToGenerator","prevState","arguments","returnData","originalData"],"mappings":"qLAkBA,MAAMA,EAAkC,CAAA,EAElCC,EAAsB,CAAEC,SAAS,EAAOC,MAAO,KAAMC,KAAM,qBAE3CC,CACpBC,EACAC,EACAC,EACAC,EACAC,KAGA,MAAOC,EAAcC,GAAmBC,EAAQA,SAAeZ,GAG1DD,EAAIM,KACPN,EAAIM,GAAM,CAAEA,KAAIQ,OAAQP,EAAeQ,UAAWP,EAAmBC,iBAAgBC,iBAGvF,MAAMI,OAAEA,EAAMC,UAAEA,EAAWN,eAAgBO,EAAWN,aAAcO,GAAYjB,EAAIM,GAwBpF,MAAO,CAtB4BY,cAAWC,EAAAA,kBAAC,YAC7C,IACEP,GAAiBQ,IAA6B,IAAKA,EAAWlB,SAAS,MACvE,MAAME,QAAmBU,KAAOO,WAC1BC,EAAaP,EAAYA,EAAUX,GAAQA,EAUjD,OARAY,GAAaA,EAAU,CAAEZ,KAAMkB,EAAYC,aAAcnB,EAAKA,OAE9DQ,GAAiBQ,IACE,IAAKA,EAAWlB,SAAS,EAAOC,MAAO,KAAMC,KAAMkB,EAAYC,aAAcnB,EAAKA,SAK9FkB,CACR,CAAC,MAAOnB,GAGP,MAFAc,GAAWA,EAAQd,GACnBS,GAAiBQ,IAA6B,IAAKA,EAAWlB,SAAS,EAAOC,YACxEA,CACR,KACC,CAACW,EAAQC,EAAWC,EAAWC,IAElBN,EAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";require("../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");var t,i=require("../../../utils/webComponents/webComponent.utils.js"),e=require("./icon.module.scss.js");const s=document.createElement("template");s.innerHTML='<span class="icon-base"></span>';let n=i.ced("icon-base")(t=class t extends HTMLElement{constructor(){super(...arguments),this.content=void 0,this.mainElement=void 0,this.iconUrl=void 0,this.minWidth=void 0,this.minHeight=void 0,this.width=void 0,this.height=void 0,this.size=void 0,this.fontSize=void 0,this.color=void 0,this.render=()=>{if(this.mainElement=this.mainElement||this.querySelector(".icon-base"),!this.mainElement)return;this.classList.add(e.default["icon-base-parent"]),this.mainElement.classList.add(e.default["icon-base"]);const t={"--min-width":this.minWidth||this.size||this.width||"auto","--min-height":this.minHeight||this.size||this.height||"auto","--width":this.size||this.width||"1rem","--height":this.size||this.height||"1rem",...this.fontSize?{"font-size":this.fontSize||"unset"}:{},...this.iconUrl?{"--icon-url":"url(".concat(this.iconUrl,")")}:{},...this.iconUrl?{"--icon-color":this.color}:{"--icon-content-color":this.color}};this.mainElement.innerHTML=this.iconUrl?"":this.content||"",this.mainElement.setAttribute("style",Object.entries(t).map((t=>{let[i,e]=t;return"".concat(i,": ").concat(e,";")})).join(" "))}}static get observedAttributes(){return["iconUrl","minWidth","minHeight","width","height","size","fontSize","color","className"]}connectedCallback(){(this.content||this.innerHTML)&&(this.content=this.content||this.innerHTML||this.getAttribute("content")),this.innerHTML=s.innerHTML,i.resolveAttributes(this,t.observedAttributes),this.render()}attributeChangedCallback(t,i,e){"className"!==t&&"classname"!==t&&"class"!==t||"string"==typeof e&&(this.classList.remove(e),this.classList.add(e)),this.color||(this.color="currentColor"),this[t]=e||"",this.render()}})||t;const o={ESIconBase:n};exports.ESIcon=n,exports.ESIconBase=o;
|
|
2
2
|
//# sourceMappingURL=IconWC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconWC.js","sources":["../../../../../../../../src/core/ui/components/icon/IconWC.ts"],"sourcesContent":["import { ced, resolveAttributes } from '../../../utils/webComponents/webComponent.utils'\n\nimport classes from './icon.module.scss'\n\n\nconst template = document.createElement('template')\n\ntemplate.innerHTML = '<span class=\"icon-base\"></span>'\n\nexport type IconBaseWCType = {\n iconUrl?: string\n minWidth?: string\n minHeight?: string\n width?: string\n height?: string\n size?: string\n fontSize?: string\n color?: string\n className?: string\n}\n\n@ced('icon-base')\nexport class ESIcon extends HTMLElement {\n content: string | null\n\n mainElement: HTMLElement\n\n iconUrl?: string | null\n\n minWidth?: string | null\n\n minHeight?: string | null\n\n width?: string | null\n\n height?: string | null\n\n size?: string | null\n\n fontSize?: string | null\n\n color?: string | null\n\n static get observedAttributes() {\n return ['iconUrl', 'minWidth', 'minHeight', 'width', 'height', 'size', 'fontSize', 'color', 'className']\n }\n\n connectedCallback() {\n if (this.content || this.innerHTML) {\n this.content = this.content || this.innerHTML || this.getAttribute('content')\n }\n\n this.innerHTML = template.innerHTML\n\n resolveAttributes(this, ESIcon.observedAttributes)\n\n this.render()\n }\n\n attributeChangedCallback(attrName: string, oldVal: string | number | null, newVal: string | number | null) {\n if (attrName === 'className' || attrName === 'classname' || attrName === 'class') {\n if (typeof newVal === 'string') {\n this.classList.remove(newVal as string)\n this.classList.add(newVal as string)\n }\n }\n if (!this.color) {\n this.color = 'currentColor'\n }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[attrName] = (newVal as string) || ''\n this.render()\n }\n\n render = () => {\n this.mainElement = this.mainElement || this.querySelector('.icon-base') as HTMLElement\n if (!this.mainElement) {\n return\n }\n this.classList.add(classes['icon-base-parent'])\n this.mainElement.classList.add(classes['icon-base'])\n\n const styles = {\n '--min-width': this.minWidth || this.size || this.width || 'auto',\n '--min-height': this.minHeight || this.size || this.height || 'auto',\n '--width': this.size || this.width || '1rem',\n '--height': this.size || this.height || '1rem',\n ...(this.fontSize ? { 'font-size': this.fontSize || 'unset' } : {}),\n ...(this.iconUrl ? { '--icon-url': `url(${this.iconUrl})` } : {}),\n ...(this.iconUrl ? { '--icon-color': this.color } : { '--icon-content-color': this.color }),\n }\n\n this.mainElement.innerHTML = this.iconUrl ? '' : (this.content || '')\n\n this.mainElement.setAttribute('style', Object.entries(styles).map(([key, value]) => `${key}: ${value};`).join(' '))\n }\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'icon-base': any\n }\n }\n}\n\nexport const ESIconBase = {\n ESIconBase: ESIcon,\n}\n"],"names":["template","document","createElement","innerHTML","ESIcon","ced","_dec","_class","HTMLElement","constructor","super","arguments","
|
|
1
|
+
{"version":3,"file":"IconWC.js","sources":["../../../../../../../../src/core/ui/components/icon/IconWC.ts"],"sourcesContent":["import { ced, resolveAttributes } from '../../../utils/webComponents/webComponent.utils'\n\nimport classes from './icon.module.scss'\n\n\nconst template = document.createElement('template')\n\ntemplate.innerHTML = '<span class=\"icon-base\"></span>'\n\nexport type IconBaseWCType = {\n iconUrl?: string\n minWidth?: string\n minHeight?: string\n width?: string\n height?: string\n size?: string\n fontSize?: string\n color?: string\n className?: string\n}\n\n@ced('icon-base')\nexport class ESIcon extends HTMLElement {\n content: string | null\n\n mainElement: HTMLElement\n\n iconUrl?: string | null\n\n minWidth?: string | null\n\n minHeight?: string | null\n\n width?: string | null\n\n height?: string | null\n\n size?: string | null\n\n fontSize?: string | null\n\n color?: string | null\n\n static get observedAttributes() {\n return ['iconUrl', 'minWidth', 'minHeight', 'width', 'height', 'size', 'fontSize', 'color', 'className']\n }\n\n connectedCallback() {\n if (this.content || this.innerHTML) {\n this.content = this.content || this.innerHTML || this.getAttribute('content')\n }\n\n this.innerHTML = template.innerHTML\n\n resolveAttributes(this, ESIcon.observedAttributes)\n\n this.render()\n }\n\n attributeChangedCallback(attrName: string, oldVal: string | number | null, newVal: string | number | null) {\n if (attrName === 'className' || attrName === 'classname' || attrName === 'class') {\n if (typeof newVal === 'string') {\n this.classList.remove(newVal as string)\n this.classList.add(newVal as string)\n }\n }\n if (!this.color) {\n this.color = 'currentColor'\n }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[attrName] = (newVal as string) || ''\n this.render()\n }\n\n render = () => {\n this.mainElement = this.mainElement || this.querySelector('.icon-base') as HTMLElement\n if (!this.mainElement) {\n return\n }\n this.classList.add(classes['icon-base-parent'])\n this.mainElement.classList.add(classes['icon-base'])\n\n const styles = {\n '--min-width': this.minWidth || this.size || this.width || 'auto',\n '--min-height': this.minHeight || this.size || this.height || 'auto',\n '--width': this.size || this.width || '1rem',\n '--height': this.size || this.height || '1rem',\n ...(this.fontSize ? { 'font-size': this.fontSize || 'unset' } : {}),\n ...(this.iconUrl ? { '--icon-url': `url(${this.iconUrl})` } : {}),\n ...(this.iconUrl ? { '--icon-color': this.color } : { '--icon-content-color': this.color }),\n }\n\n this.mainElement.innerHTML = this.iconUrl ? '' : (this.content || '')\n\n this.mainElement.setAttribute('style', Object.entries(styles).map(([key, value]) => `${key}: ${value};`).join(' '))\n }\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'icon-base': any\n }\n }\n}\n\nexport const ESIconBase = {\n ESIconBase: ESIcon,\n}\n"],"names":["template","document","createElement","innerHTML","ESIcon","ced","_dec","_class","HTMLElement","constructor","super","arguments","this","content","mainElement","iconUrl","minWidth","minHeight","width","height","size","fontSize","color","render","querySelector","classList","add","classes","default","styles","concat","setAttribute","Object","entries","map","_ref","key","value","join","observedAttributes","connectedCallback","getAttribute","resolveAttributes","attributeChangedCallback","attrName","oldVal","newVal","remove","ESIconBase"],"mappings":"6MAKA,MAAMA,EAAWC,SAASC,cAAc,YAExCF,EAASG,UAAY,kCAcrB,IACaC,EADZC,EAAAA,IAAI,YAAYC,CAAAC,EAAjB,MACaH,UAAeI,YAAYC,WAAAA,GAAAC,SAAAC,WAAAC,KACtCC,aAAO,EAAAD,KAEPE,iBAAW,EAAAF,KAEXG,aAAO,EAAAH,KAEPI,cAAQ,EAAAJ,KAERK,eAAS,EAAAL,KAETM,WAAK,EAAAN,KAELO,YAAM,EAAAP,KAENQ,UAAI,EAAAR,KAEJS,cAAQ,EAAAT,KAERU,WAAK,EAAAV,KAkCLW,OAAS,KAEP,GADAX,KAAKE,YAAcF,KAAKE,aAAeF,KAAKY,cAAc,eACrDZ,KAAKE,YACR,OAEFF,KAAKa,UAAUC,IAAIC,EAAAA,QAAQ,qBAC3Bf,KAAKE,YAAYW,UAAUC,IAAIC,EAAOC,QAAC,cAEvC,MAAMC,EAAS,CACb,cAAejB,KAAKI,UAAYJ,KAAKQ,MAAQR,KAAKM,OAAS,OAC3D,eAAgBN,KAAKK,WAAaL,KAAKQ,MAAQR,KAAKO,QAAU,OAC9D,UAAWP,KAAKQ,MAAQR,KAAKM,OAAS,OACtC,WAAYN,KAAKQ,MAAQR,KAAKO,QAAU,UACpCP,KAAKS,SAAW,CAAE,YAAaT,KAAKS,UAAY,SAAY,CAAE,KAC9DT,KAAKG,QAAU,CAAE,aAAYe,OAAAA,OAASlB,KAAKG,QAAO,MAAQ,CAAE,KAC5DH,KAAKG,QAAU,CAAE,eAAgBH,KAAKU,OAAU,CAAE,uBAAwBV,KAAKU,QAGrFV,KAAKE,YAAYX,UAAYS,KAAKG,QAAU,GAAMH,KAAKC,SAAW,GAElED,KAAKE,YAAYiB,aAAa,QAASC,OAAOC,QAAQJ,GAAQK,KAAIC,IAAA,IAAEC,EAAKC,GAAMF,EAAA,MAAA,GAAAL,OAAQM,EAAGN,MAAAA,OAAKO,EAAK,IAAA,IAAKC,KAAK,KAAK,CACpH,CArDD,6BAAWC,GACT,MAAO,CAAC,UAAW,WAAY,YAAa,QAAS,SAAU,OAAQ,WAAY,QAAS,YAC9F,CAEAC,iBAAAA,IACM5B,KAAKC,SAAWD,KAAKT,aACvBS,KAAKC,QAAUD,KAAKC,SAAWD,KAAKT,WAAaS,KAAK6B,aAAa,YAGrE7B,KAAKT,UAAYH,EAASG,UAE1BuC,EAAAA,kBAAkB9B,KAAMR,EAAOmC,oBAE/B3B,KAAKW,QACP,CAEAoB,wBAAAA,CAAyBC,EAAkBC,EAAgCC,GACxD,cAAbF,GAAyC,cAAbA,GAAyC,UAAbA,GACpC,iBAAXE,IACTlC,KAAKa,UAAUsB,OAAOD,GACtBlC,KAAKa,UAAUC,IAAIoB,IAGlBlC,KAAKU,QACRV,KAAKU,MAAQ,gBAIfV,KAAKgC,GAAaE,GAAqB,GACvClC,KAAKW,QACP,KAwBDhB,EAWM,MAAMyC,EAAa,CACxBA,WAAY5C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");exports.createStore=(
|
|
1
|
+
"use strict";var e=require("../../../../../_virtual/_rollupPluginBabelHelpers.js");require("../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");exports.createStore=(r,t,o)=>{var n;let s=r;const l=new Set,u=()=>s,c=function(){var r=e.asyncToGenerator((function*(e){s=e;for(const e of l){const r=null==e?void 0:e.selector,t=r?r(s):s;void 0!==e.previousValue&&e.previousValue===t||(e.previousValue=t,yield e(t))}return s}));return function(e){return r.apply(this,arguments)}}(),i={getState:u,setState:c,subscribe:(e,r)=>{if(r&&e.selector&&e.selector!==r)throw new Error("Error, mismatchm selector, listener.selector !== selector.");return r&&!e.selector&&(e.selector=r),l.add(e),()=>l.delete(e)},unsubscribe:e=>{l.delete(e)}},a=t?null===(n=Object.entries(t))||void 0===n?void 0:n.reduce(((r,t)=>{let[n,s]=t;return{...r,[n]:e.asyncToGenerator((function*(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];const l=yield s(u,c,...r);return o&&c(o(u(),n,...r)),l}))}}),{}):null,d={...i,...a?{actions:{...a}}:{}};return d};
|
|
2
2
|
//# sourceMappingURL=store.vanillajs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\n// export type Selector<T> = (state: Partial<T>) => Partial<T>;\nexport type SelectedValueType<T> = Partial<T> | Partial<keyof T>\n| string | number | boolean | undefined | string[] | number[] | boolean[] | undefined[];\nexport type Selector<T> = (state: Partial<T>) => SelectedValueType<T>;\n\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: SelectedValueType<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @param selector - Optional selector function to transform the store state.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller<T> } }\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller<T> = (...args: unknown[]) => void | Partial<T> | Promise<void | Partial<T>>\n\n\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Record<string, ActionHandler<T>>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = () => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>) => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n const newValue: SelectedValueType<T> = selector ? selector(currentState) : currentState\n\n // TODO plugin equality\n if (listener.previousValue === undefined || listener.previousValue !== newValue) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue as Partial<T>)\n }\n }\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => {\n if (selector && listener.selector && listener.selector !== selector) {\n throw new Error('Error, mismatchm selector, listener.selector !== selector.')\n }\n if (selector && !listener.selector) {\n // eslint-disable-next-line no-param-reassign\n listener.selector = selector\n }\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Record<string, ActionHandlerCaller<T>> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller<T>>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: async(...rest: unknown[]) => {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n return resultOfAction\n },\n }),\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["createStore","initialState","actions","reducer","_Object$entries","currentState","listeners","Set","getState","setState","
|
|
1
|
+
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\n// export type Selector<T> = (state: Partial<T>) => Partial<T>;\nexport type SelectedValueType<T> = Partial<T> | Partial<keyof T>\n| string | number | boolean | undefined | string[] | number[] | boolean[] | undefined[];\nexport type Selector<T> = (state: Partial<T>) => SelectedValueType<T>;\n\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: SelectedValueType<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @param selector - Optional selector function to transform the store state.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller<T> } }\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller<T> = (...args: unknown[]) => void | Partial<T> | Promise<void | Partial<T>>\n\n\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Record<string, ActionHandler<T>>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = () => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>) => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n const newValue: SelectedValueType<T> = selector ? selector(currentState) : currentState\n\n // TODO plugin equality\n if (listener.previousValue === undefined || listener.previousValue !== newValue) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue as Partial<T>)\n }\n }\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => {\n if (selector && listener.selector && listener.selector !== selector) {\n throw new Error('Error, mismatchm selector, listener.selector !== selector.')\n }\n if (selector && !listener.selector) {\n // eslint-disable-next-line no-param-reassign\n listener.selector = selector\n }\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Record<string, ActionHandlerCaller<T>> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller<T>>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: async(...rest: unknown[]) => {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n return resultOfAction\n },\n }),\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["createStore","initialState","actions","reducer","_Object$entries","currentState","listeners","Set","getState","setState","_ref","_asyncToGenerator","newState","listener","selector","newValue","undefined","previousValue","_x","apply","this","arguments","storeBaseicApi","subscribe","Error","add","delete","unsubscribe","resolvedActions","Object","entries","reduce","aggregator","_ref2","actionName","actionHandler","_len","length","rest","Array","_key","resultOfAction","storeCombinedWithActions"],"mappings":"8LA2F2BA,CACzBC,EACAC,EACAC,KACmC,IAAAC,EACnC,IAAIC,EAA2BJ,EAC/B,MAAMK,EAAY,IAAIC,IAMhBC,EAAWA,IAAMH,EAQjBI,EAAQ,WAAA,IAAAC,EAAAC,oBAAG,UAAOC,GACtBP,EAAeO,EAGf,IAAK,MAAMC,KAAYP,EAAW,CAEhC,MAAMQ,EAAoCD,aAAAA,EAAAA,EAAUC,SAM9CC,EAAiCD,EAAWA,EAAST,GAAgBA,OAG5CW,IAA3BH,EAASI,eAA+BJ,EAASI,gBAAkBF,IACrEF,EAASI,cAAgBF,QAEnBF,EAASE,GAEnB,CACA,OAAOV,KACR,OAtBKI,SAAQS,GAAA,OAAAR,EAAAS,MAAAC,KAAAC,UAAA,EAAA,GA2BRC,EAA2B,CAK/Bd,WAMAC,WAMAc,UAAWA,CAACV,EAAuBC,KACjC,GAAIA,GAAYD,EAASC,UAAYD,EAASC,WAAaA,EACzD,MAAM,IAAIU,MAAM,8DAOlB,OALIV,IAAaD,EAASC,WAExBD,EAASC,SAAWA,GAEtBR,EAAUmB,IAAIZ,GACP,IAAMP,EAAUoB,OAAOb,EAAS,EAMzCc,YAAcd,IACZP,EAAUoB,OAAOb,EAAS,GAOxBe,EACF1B,EAAiCE,QAA1BA,EAAGyB,OAAOC,QAAQ5B,cAAQE,SAAvBA,EAAyB2B,QACnC,CACEC,EAAkDC,KAAA,IACjDC,EAAYC,GAA0CF,EAAA,MACnD,IACDD,EACHE,CAACA,GAAUvB,EAAAA,kBAAG,YAA6B,IAAA,IAAAyB,EAAAf,UAAAgB,OAApBC,EAAIC,IAAAA,MAAAH,GAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAAJF,EAAIE,GAAAnB,UAAAmB,GACzB,MAAMC,QAAuBN,EAAc3B,EAAUC,KAAa6B,GAKlE,OAHInC,GACFM,EAASN,EAAQK,IAAY0B,KAAeI,IAEvCG,KAEV,GACD,CAAA,GACE,KAKAC,EAA2B,IAC5BpB,KACCM,EAAkB,CAAE1B,QAAS,IAAK0B,IAAsB,CAAE,GAGhE,OACIc,CACoC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var r=require("../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("./store.vanillajs.js");exports.createDataStore=(a,e,n,o)=>{const i={...n,load:(s=r.asyncToGenerator((function*(r,t,a){const e=r();t({...e,isLoading:!0});try{const r=yield a;e.data=(null==r?void 0:r.data)||r}catch(r){e.error=r}return t({...e,isLoading:!1})})),function(r,t,a){return s.apply(this,arguments)})};var s;return t.createStore({...e,dataId:a,isLoading:!1},i,o)};
|
|
2
2
|
//# sourceMappingURL=store.vanillajs.templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.templates.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.templates.ts"],"sourcesContent":["import { ActionHandler, Reducer, Store, StoreWithActions, createStore } from './store.vanillajs'\n\n\ntype DefaultES = { [key: string]: any }\n\n\nexport type DataState<T, ES = DefaultES> = {\n dataId: string\n isLoading: boolean\n error?: unknown\n data?: T\n} & ES\n\n\ntype Load<T, ES = DefaultES> = (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n\ntype LoadHandler<T, ES = DefaultES> = (\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n/**\n * Creates a data store with actions.\n * @param dataId - The ID of the data.\n * @param actions - Optional actions for the data store.\n * @returns The created data store with actions.\n */\nexport const createDataStore\n= <T, ES = DefaultES>(\n dataId: string,\n initialState?: Partial<ES>,\n actions?: Record<string, ActionHandler<DataState<T, ES>>>,\n reducer?: Reducer<DataState<T, ES>>,\n): StoreWithActions<DataState<T, ES>>\n& { actions: { load: LoadHandler<T, ES> } } => {\n const loadActions: { load: Load<T, ES> } = {\n ...actions,\n /**\n * Loads data into the data store.\n * @param getState - Function to get the current state of the data store.\n * @param setState - Function to set the state of the data store.\n * @param dataPromise - The data promise to be loaded.\n * @returns A promise that resolves to the updated state of the data store.\n */\n load: async (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n ) => {\n const dataState: Partial<DataState<T, ES>> = getState()\n\n setState({ ...dataState, isLoading: true })\n\n try {\n const response: unknown = await dataPromise\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.data = response?.data || response\n } catch (error: unknown) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.error = error\n }\n return setState({ ...dataState, isLoading: false })\n },\n }\n\n return (createStore<DataState<T, ES>>({\n ...initialState,\n dataId,\n isLoading: false,\n } as Partial<DataState<T, ES>>, loadActions, reducer)) as StoreWithActions<DataState<T, ES>>\n & { actions: { load: LoadHandler<T, ES> } }\n}\n"],"names":["createDataStore","dataId","initialState","actions","reducer","loadActions","load","
|
|
1
|
+
{"version":3,"file":"store.vanillajs.templates.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.templates.ts"],"sourcesContent":["import { ActionHandler, Reducer, Store, StoreWithActions, createStore } from './store.vanillajs'\n\n\ntype DefaultES = { [key: string]: any }\n\n\nexport type DataState<T, ES = DefaultES> = {\n dataId: string\n isLoading: boolean\n error?: unknown\n data?: T\n} & ES\n\n\ntype Load<T, ES = DefaultES> = (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n\ntype LoadHandler<T, ES = DefaultES> = (\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n/**\n * Creates a data store with actions.\n * @param dataId - The ID of the data.\n * @param actions - Optional actions for the data store.\n * @returns The created data store with actions.\n */\nexport const createDataStore\n= <T, ES = DefaultES>(\n dataId: string,\n initialState?: Partial<ES>,\n actions?: Record<string, ActionHandler<DataState<T, ES>>>,\n reducer?: Reducer<DataState<T, ES>>,\n): StoreWithActions<DataState<T, ES>>\n& { actions: { load: LoadHandler<T, ES> } } => {\n const loadActions: { load: Load<T, ES> } = {\n ...actions,\n /**\n * Loads data into the data store.\n * @param getState - Function to get the current state of the data store.\n * @param setState - Function to set the state of the data store.\n * @param dataPromise - The data promise to be loaded.\n * @returns A promise that resolves to the updated state of the data store.\n */\n load: async (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n ) => {\n const dataState: Partial<DataState<T, ES>> = getState()\n\n setState({ ...dataState, isLoading: true })\n\n try {\n const response: unknown = await dataPromise\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.data = response?.data || response\n } catch (error: unknown) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.error = error\n }\n return setState({ ...dataState, isLoading: false })\n },\n }\n\n return (createStore<DataState<T, ES>>({\n ...initialState,\n dataId,\n isLoading: false,\n } as Partial<DataState<T, ES>>, loadActions, reducer)) as StoreWithActions<DataState<T, ES>>\n & { actions: { load: LoadHandler<T, ES> } }\n}\n"],"names":["createDataStore","dataId","initialState","actions","reducer","loadActions","load","_ref","_asyncToGenerator","asyncToGenerator","getState","setState","dataPromise","dataState","isLoading","response","data","error","_x","_x2","_x3","apply","this","arguments","createStore"],"mappings":"6IAgCEA,CACAC,EACAC,EACAC,EACAC,KAGA,MAAMC,EAAqC,IACtCF,EAQHG,MAAIC,EAAAC,EAAAC,kBAAE,UACJC,EACAC,EACAC,GAEA,MAAMC,EAAuCH,IAE7CC,EAAS,IAAKE,EAAWC,WAAW,IAEpC,IACE,MAAMC,QAA0BH,EAIhCC,EAAUG,MAAOD,aAAQ,EAARA,EAAUC,OAAQD,CACpC,CAAC,MAAOE,GAGPJ,EAAUI,MAAQA,CACpB,CACA,OAAON,EAAS,IAAKE,EAAWC,WAAW,OAC5C,SAAAI,EAAAC,EAAAC,GAAA,OAAAb,EAAAc,MAAAC,KAAAC,UAAA,IArBG,IAAAhB,EAwBN,OAAQiB,cAA8B,IACjCtB,EACHD,SACAa,WAAW,GACmBT,EAAaD,EAAQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js");const n=function(){var n=e.asyncToGenerator((function*(){try{var e,n;const i=(yield null===(e=navigator)||void 0===e||null===(e=e.mediaDevices)||void 0===e||null===(n=e.enumerateDevices)||void 0===n?void 0:n.call(e)).find((e=>"videoinput"===e.kind));return(null==i?void 0:i.deviceId)||(null==i?void 0:i.groupId)}catch(e){return null}}));return function(){return n.apply(this,arguments)}}();exports.getDeviceId=n;
|
|
2
2
|
//# sourceMappingURL=deviceInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfo.js","sources":["../../../../../../../src/core/utils/helpers/deviceInfo.ts"],"sourcesContent":["export const getDeviceId = async (): Promise<string | null | undefined> => {\n try {\n const devices = await navigator?.mediaDevices?.enumerateDevices?.()\n const device = devices.find((device) => device.kind === 'videoinput')\n\n return device?.deviceId || device?.groupId\n } catch (error: any) {\n return null\n }\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"deviceInfo.js","sources":["../../../../../../../src/core/utils/helpers/deviceInfo.ts"],"sourcesContent":["export const getDeviceId = async (): Promise<string | null | undefined> => {\n try {\n const devices = await navigator?.mediaDevices?.enumerateDevices?.()\n const device = devices.find((device) => device.kind === 'videoinput')\n\n return device?.deviceId || device?.groupId\n } catch (error: any) {\n return null\n }\n}\n"],"names":["getDeviceId","_ref","_asyncToGenerator","_navigator","_navigator$enumerateD","device","navigator","mediaDevices","enumerateDevices","call","find","kind","deviceId","groupId","error","apply","this","arguments"],"mappings":"sFAAaA,EAAW,WAAA,IAAAC,EAAAC,EAAAA,kBAAG,YACzB,IAAI,IAAAC,EAAAC,EACF,MACMC,SADyB,QAAlBF,EAASG,iBAAS,IAAAH,GAAc,QAAdA,EAATA,EAAWI,oBAAY,IAAAJ,GAAkB,QAAlBC,EAAvBD,EAAyBK,wBAAgB,IAAAJ,OAAA,EAAzCA,EAAAK,KAAAN,IACCO,MAAML,GAA2B,eAAhBA,EAAOM,OAE/C,OAAON,eAAAA,EAAQO,YAAYP,aAAAA,EAAAA,EAAQQ,QACpC,CAAC,MAAOC,GACP,OAAO,IACT,KACD,OAAA,WATuB,OAAAb,EAAAc,MAAAC,KAAAC,UAAA,CAAA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function n(n,t,r,e,o,a,i){try{var c=n[a](i),s=c.value}catch(n){return void r(n)}c.done?t(s):Promise.resolve(s).then(e,o)}function t(t){return function(){var r=this,e=arguments;return new Promise((function(o,a){var i=t.apply(r,e);function c(t){n(i,o,a,c,s,"next",t)}function s(t){n(i,o,a,c,s,"throw",t)}c(void 0)}))}}function r(){return r=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=r[e])}return n},r.apply(this,arguments)}export{t as asyncToGenerator,r as extends};
|
|
2
2
|
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../../node_modules/core-js/modules/web.dom-collections.iterator.js";import{useState as
|
|
1
|
+
import{asyncToGenerator as r}from"../../../_virtual/_rollupPluginBabelHelpers.js";import"../../../node_modules/core-js/modules/web.dom-collections.iterator.js";import{useState as o,useCallback as a}from"react";const e={},l={loading:!1,error:null,data:null},t=(t,n,d,c,s)=>{const[i,u]=o(l);e[t]||(e[t]={id:t,caller:n,decorator:d,successHandler:c,errorHandler:s});const{caller:m,decorator:g,successHandler:p,errorHandler:H}=e[t];return[a(r((function*(){try{u((r=>({...r,loading:!0})));const r=yield m(...arguments),o=g?g(r):r;return p&&p({data:o,originalData:r.data}),u((a=>({...a,loading:!1,error:null,data:o,originalData:r.data}))),o}catch(r){throw H&&H(r),u((o=>({...o,loading:!1,error:r}))),r}})),[m,g,p,H]),i]};export{t as useApi};
|
|
2
2
|
//# sourceMappingURL=useApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useApi.js","sources":["../../../../../../src/core/hooks/useApi.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport type Data = any | any[] | null\n\nexport type DataFetching = { data?: Data; error?: string | null; loading: boolean; originalData?: Data }\n\ntype Caller = (...args: any[]) => Promise<any>\n\ntype Decorator = (RequestOrResponse: Record<string, any> | any) => Record<string, any>\n\ntype UseApiItem = {\n id: string\n caller: Caller\n decorator?: Decorator\n successHandler?: (data: any) => void\n errorHandler?: (data: any) => void\n}\n\nconst map: Record<string, UseApiItem> = {}\n\nconst defaultDataFetching = { loading: false, error: null, data: null }\n\nexport const useApi = (\n id: string,\n callerInitial: Caller,\n decoratorIntitial?: Decorator,\n successHandler?: (data: any) => void,\n errorHandler?: (data: any) => void,\n// eslint-disable-next-line function-paren-newline\n): [(...args: any[]) => Promise<any>, DataFetching] => {\n const [dataFetching, setDataFetching] = useState<DataFetching>(defaultDataFetching)\n\n // TODO should work the same with useMemo...\n if (!map[id]) {\n map[id] = { id, caller: callerInitial, decorator: decoratorIntitial, successHandler, errorHandler }\n }\n\n const { caller, decorator, successHandler: onSuccess, errorHandler: onError } = map[id]\n\n const doCall: () => Promise<any> = useCallback(async(...args: any[]) => {\n try {\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: true }))\n const data: Data = await caller(...args)\n const returnData = decorator ? decorator(data) : data\n\n onSuccess && onSuccess({ data: returnData, originalData: data.data })\n\n setDataFetching((prevState: DataFetching) => {\n const newState = { ...prevState, loading: false, error: null, data: returnData, originalData: data.data }\n\n return newState\n })\n\n return returnData\n } catch (error: any) {\n onError && onError(error)\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: false, error }))\n throw error\n }\n }, [caller, decorator, onSuccess, onError])\n\n return [doCall, dataFetching]\n}\n"],"names":["map","defaultDataFetching","loading","error","data","useApi","id","callerInitial","decoratorIntitial","successHandler","errorHandler","dataFetching","setDataFetching","useState","caller","decorator","onSuccess","onError","useCallback","
|
|
1
|
+
{"version":3,"file":"useApi.js","sources":["../../../../../../src/core/hooks/useApi.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport type Data = any | any[] | null\n\nexport type DataFetching = { data?: Data; error?: string | null; loading: boolean; originalData?: Data }\n\ntype Caller = (...args: any[]) => Promise<any>\n\ntype Decorator = (RequestOrResponse: Record<string, any> | any) => Record<string, any>\n\ntype UseApiItem = {\n id: string\n caller: Caller\n decorator?: Decorator\n successHandler?: (data: any) => void\n errorHandler?: (data: any) => void\n}\n\nconst map: Record<string, UseApiItem> = {}\n\nconst defaultDataFetching = { loading: false, error: null, data: null }\n\nexport const useApi = (\n id: string,\n callerInitial: Caller,\n decoratorIntitial?: Decorator,\n successHandler?: (data: any) => void,\n errorHandler?: (data: any) => void,\n// eslint-disable-next-line function-paren-newline\n): [(...args: any[]) => Promise<any>, DataFetching] => {\n const [dataFetching, setDataFetching] = useState<DataFetching>(defaultDataFetching)\n\n // TODO should work the same with useMemo...\n if (!map[id]) {\n map[id] = { id, caller: callerInitial, decorator: decoratorIntitial, successHandler, errorHandler }\n }\n\n const { caller, decorator, successHandler: onSuccess, errorHandler: onError } = map[id]\n\n const doCall: () => Promise<any> = useCallback(async(...args: any[]) => {\n try {\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: true }))\n const data: Data = await caller(...args)\n const returnData = decorator ? decorator(data) : data\n\n onSuccess && onSuccess({ data: returnData, originalData: data.data })\n\n setDataFetching((prevState: DataFetching) => {\n const newState = { ...prevState, loading: false, error: null, data: returnData, originalData: data.data }\n\n return newState\n })\n\n return returnData\n } catch (error: any) {\n onError && onError(error)\n setDataFetching((prevState: DataFetching) => ({ ...prevState, loading: false, error }))\n throw error\n }\n }, [caller, decorator, onSuccess, onError])\n\n return [doCall, dataFetching]\n}\n"],"names":["map","defaultDataFetching","loading","error","data","useApi","id","callerInitial","decoratorIntitial","successHandler","errorHandler","dataFetching","setDataFetching","useState","caller","decorator","onSuccess","onError","useCallback","_asyncToGenerator","prevState","arguments","returnData","originalData"],"mappings":"kNAkBA,MAAMA,EAAkC,CAAA,EAElCC,EAAsB,CAAEC,SAAS,EAAOC,MAAO,KAAMC,KAAM,MAEpDC,EAASA,CACpBC,EACAC,EACAC,EACAC,EACAC,KAGA,MAAOC,EAAcC,GAAmBC,EAAuBZ,GAG1DD,EAAIM,KACPN,EAAIM,GAAM,CAAEA,KAAIQ,OAAQP,EAAeQ,UAAWP,EAAmBC,iBAAgBC,iBAGvF,MAAMI,OAAEA,EAAMC,UAAEA,EAAWN,eAAgBO,EAAWN,aAAcO,GAAYjB,EAAIM,GAwBpF,MAAO,CAtB4BY,EAAWC,GAAC,YAC7C,IACEP,GAAiBQ,IAA6B,IAAKA,EAAWlB,SAAS,MACvE,MAAME,QAAmBU,KAAOO,WAC1BC,EAAaP,EAAYA,EAAUX,GAAQA,EAUjD,OARAY,GAAaA,EAAU,CAAEZ,KAAMkB,EAAYC,aAAcnB,EAAKA,OAE9DQ,GAAiBQ,IACE,IAAKA,EAAWlB,SAAS,EAAOC,MAAO,KAAMC,KAAMkB,EAAYC,aAAcnB,EAAKA,SAK9FkB,CACR,CAAC,MAAOnB,GAGP,MAFAc,GAAWA,EAAQd,GACnBS,GAAiBQ,IAA6B,IAAKA,EAAWlB,SAAS,EAAOC,YACxEA,CACR,KACC,CAACW,EAAQC,EAAWC,EAAWC,IAElBN,EAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js";import{resolveAttributes as t,ced as i}from"../../../utils/webComponents/webComponent.utils.js";import e from"./icon.module.scss.js";var s;const n=document.createElement("template");n.innerHTML='<span class="icon-base"></span>';let o=i("icon-base")(s=class i extends HTMLElement{constructor(){super(...arguments),this.content=void 0,this.mainElement=void 0,this.iconUrl=void 0,this.minWidth=void 0,this.minHeight=void 0,this.width=void 0,this.height=void 0,this.size=void 0,this.fontSize=void 0,this.color=void 0,this.render=()=>{if(this.mainElement=this.mainElement||this.querySelector(".icon-base"),!this.mainElement)return;this.classList.add(e["icon-base-parent"]),this.mainElement.classList.add(e["icon-base"]);const t={"--min-width":this.minWidth||this.size||this.width||"auto","--min-height":this.minHeight||this.size||this.height||"auto","--width":this.size||this.width||"1rem","--height":this.size||this.height||"1rem",...this.fontSize?{"font-size":this.fontSize||"unset"}:{},...this.iconUrl?{"--icon-url":"url(".concat(this.iconUrl,")")}:{},...this.iconUrl?{"--icon-color":this.color}:{"--icon-content-color":this.color}};this.mainElement.innerHTML=this.iconUrl?"":this.content||"",this.mainElement.setAttribute("style",Object.entries(t).map((t=>{let[i,e]=t;return"".concat(i,": ").concat(e,";")})).join(" "))}}static get observedAttributes(){return["iconUrl","minWidth","minHeight","width","height","size","fontSize","color","className"]}connectedCallback(){(this.content||this.innerHTML)&&(this.content=this.content||this.innerHTML||this.getAttribute("content")),this.innerHTML=n.innerHTML,t(this,i.observedAttributes),this.render()}attributeChangedCallback(t,i,e){"className"!==t&&"classname"!==t&&"class"!==t||"string"==typeof e&&(this.classList.remove(e),this.classList.add(e)),this.color||(this.color="currentColor"),this[t]=e||"",this.render()}})||s;const h={ESIconBase:o};export{o as ESIcon,h as ESIconBase};
|
|
2
2
|
//# sourceMappingURL=IconWC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconWC.js","sources":["../../../../../../../../src/core/ui/components/icon/IconWC.ts"],"sourcesContent":["import { ced, resolveAttributes } from '../../../utils/webComponents/webComponent.utils'\n\nimport classes from './icon.module.scss'\n\n\nconst template = document.createElement('template')\n\ntemplate.innerHTML = '<span class=\"icon-base\"></span>'\n\nexport type IconBaseWCType = {\n iconUrl?: string\n minWidth?: string\n minHeight?: string\n width?: string\n height?: string\n size?: string\n fontSize?: string\n color?: string\n className?: string\n}\n\n@ced('icon-base')\nexport class ESIcon extends HTMLElement {\n content: string | null\n\n mainElement: HTMLElement\n\n iconUrl?: string | null\n\n minWidth?: string | null\n\n minHeight?: string | null\n\n width?: string | null\n\n height?: string | null\n\n size?: string | null\n\n fontSize?: string | null\n\n color?: string | null\n\n static get observedAttributes() {\n return ['iconUrl', 'minWidth', 'minHeight', 'width', 'height', 'size', 'fontSize', 'color', 'className']\n }\n\n connectedCallback() {\n if (this.content || this.innerHTML) {\n this.content = this.content || this.innerHTML || this.getAttribute('content')\n }\n\n this.innerHTML = template.innerHTML\n\n resolveAttributes(this, ESIcon.observedAttributes)\n\n this.render()\n }\n\n attributeChangedCallback(attrName: string, oldVal: string | number | null, newVal: string | number | null) {\n if (attrName === 'className' || attrName === 'classname' || attrName === 'class') {\n if (typeof newVal === 'string') {\n this.classList.remove(newVal as string)\n this.classList.add(newVal as string)\n }\n }\n if (!this.color) {\n this.color = 'currentColor'\n }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[attrName] = (newVal as string) || ''\n this.render()\n }\n\n render = () => {\n this.mainElement = this.mainElement || this.querySelector('.icon-base') as HTMLElement\n if (!this.mainElement) {\n return\n }\n this.classList.add(classes['icon-base-parent'])\n this.mainElement.classList.add(classes['icon-base'])\n\n const styles = {\n '--min-width': this.minWidth || this.size || this.width || 'auto',\n '--min-height': this.minHeight || this.size || this.height || 'auto',\n '--width': this.size || this.width || '1rem',\n '--height': this.size || this.height || '1rem',\n ...(this.fontSize ? { 'font-size': this.fontSize || 'unset' } : {}),\n ...(this.iconUrl ? { '--icon-url': `url(${this.iconUrl})` } : {}),\n ...(this.iconUrl ? { '--icon-color': this.color } : { '--icon-content-color': this.color }),\n }\n\n this.mainElement.innerHTML = this.iconUrl ? '' : (this.content || '')\n\n this.mainElement.setAttribute('style', Object.entries(styles).map(([key, value]) => `${key}: ${value};`).join(' '))\n }\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'icon-base': any\n }\n }\n}\n\nexport const ESIconBase = {\n ESIconBase: ESIcon,\n}\n"],"names":["template","document","createElement","innerHTML","ESIcon","ced","_dec","_class","HTMLElement","constructor","super","arguments","
|
|
1
|
+
{"version":3,"file":"IconWC.js","sources":["../../../../../../../../src/core/ui/components/icon/IconWC.ts"],"sourcesContent":["import { ced, resolveAttributes } from '../../../utils/webComponents/webComponent.utils'\n\nimport classes from './icon.module.scss'\n\n\nconst template = document.createElement('template')\n\ntemplate.innerHTML = '<span class=\"icon-base\"></span>'\n\nexport type IconBaseWCType = {\n iconUrl?: string\n minWidth?: string\n minHeight?: string\n width?: string\n height?: string\n size?: string\n fontSize?: string\n color?: string\n className?: string\n}\n\n@ced('icon-base')\nexport class ESIcon extends HTMLElement {\n content: string | null\n\n mainElement: HTMLElement\n\n iconUrl?: string | null\n\n minWidth?: string | null\n\n minHeight?: string | null\n\n width?: string | null\n\n height?: string | null\n\n size?: string | null\n\n fontSize?: string | null\n\n color?: string | null\n\n static get observedAttributes() {\n return ['iconUrl', 'minWidth', 'minHeight', 'width', 'height', 'size', 'fontSize', 'color', 'className']\n }\n\n connectedCallback() {\n if (this.content || this.innerHTML) {\n this.content = this.content || this.innerHTML || this.getAttribute('content')\n }\n\n this.innerHTML = template.innerHTML\n\n resolveAttributes(this, ESIcon.observedAttributes)\n\n this.render()\n }\n\n attributeChangedCallback(attrName: string, oldVal: string | number | null, newVal: string | number | null) {\n if (attrName === 'className' || attrName === 'classname' || attrName === 'class') {\n if (typeof newVal === 'string') {\n this.classList.remove(newVal as string)\n this.classList.add(newVal as string)\n }\n }\n if (!this.color) {\n this.color = 'currentColor'\n }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[attrName] = (newVal as string) || ''\n this.render()\n }\n\n render = () => {\n this.mainElement = this.mainElement || this.querySelector('.icon-base') as HTMLElement\n if (!this.mainElement) {\n return\n }\n this.classList.add(classes['icon-base-parent'])\n this.mainElement.classList.add(classes['icon-base'])\n\n const styles = {\n '--min-width': this.minWidth || this.size || this.width || 'auto',\n '--min-height': this.minHeight || this.size || this.height || 'auto',\n '--width': this.size || this.width || '1rem',\n '--height': this.size || this.height || '1rem',\n ...(this.fontSize ? { 'font-size': this.fontSize || 'unset' } : {}),\n ...(this.iconUrl ? { '--icon-url': `url(${this.iconUrl})` } : {}),\n ...(this.iconUrl ? { '--icon-color': this.color } : { '--icon-content-color': this.color }),\n }\n\n this.mainElement.innerHTML = this.iconUrl ? '' : (this.content || '')\n\n this.mainElement.setAttribute('style', Object.entries(styles).map(([key, value]) => `${key}: ${value};`).join(' '))\n }\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'icon-base': any\n }\n }\n}\n\nexport const ESIconBase = {\n ESIconBase: ESIcon,\n}\n"],"names":["template","document","createElement","innerHTML","ESIcon","ced","_dec","_class","HTMLElement","constructor","super","arguments","this","content","mainElement","iconUrl","minWidth","minHeight","width","height","size","fontSize","color","render","querySelector","classList","add","classes","styles","concat","setAttribute","Object","entries","map","_ref","key","value","join","observedAttributes","connectedCallback","getAttribute","resolveAttributes","attributeChangedCallback","attrName","oldVal","newVal","remove","ESIconBase"],"mappings":"+NAKA,MAAMA,EAAWC,SAASC,cAAc,YAExCF,EAASG,UAAY,kCAcrB,IACaC,EADZC,EAAI,YAAYC,CAAAC,EAAjB,MACaH,UAAeI,YAAYC,WAAAA,GAAAC,SAAAC,WAAAC,KACtCC,aAAO,EAAAD,KAEPE,iBAAW,EAAAF,KAEXG,aAAO,EAAAH,KAEPI,cAAQ,EAAAJ,KAERK,eAAS,EAAAL,KAETM,WAAK,EAAAN,KAELO,YAAM,EAAAP,KAENQ,UAAI,EAAAR,KAEJS,cAAQ,EAAAT,KAERU,WAAK,EAAAV,KAkCLW,OAAS,KAEP,GADAX,KAAKE,YAAcF,KAAKE,aAAeF,KAAKY,cAAc,eACrDZ,KAAKE,YACR,OAEFF,KAAKa,UAAUC,IAAIC,EAAQ,qBAC3Bf,KAAKE,YAAYW,UAAUC,IAAIC,EAAQ,cAEvC,MAAMC,EAAS,CACb,cAAehB,KAAKI,UAAYJ,KAAKQ,MAAQR,KAAKM,OAAS,OAC3D,eAAgBN,KAAKK,WAAaL,KAAKQ,MAAQR,KAAKO,QAAU,OAC9D,UAAWP,KAAKQ,MAAQR,KAAKM,OAAS,OACtC,WAAYN,KAAKQ,MAAQR,KAAKO,QAAU,UACpCP,KAAKS,SAAW,CAAE,YAAaT,KAAKS,UAAY,SAAY,CAAE,KAC9DT,KAAKG,QAAU,CAAE,aAAYc,OAAAA,OAASjB,KAAKG,QAAO,MAAQ,CAAE,KAC5DH,KAAKG,QAAU,CAAE,eAAgBH,KAAKU,OAAU,CAAE,uBAAwBV,KAAKU,QAGrFV,KAAKE,YAAYX,UAAYS,KAAKG,QAAU,GAAMH,KAAKC,SAAW,GAElED,KAAKE,YAAYgB,aAAa,QAASC,OAAOC,QAAQJ,GAAQK,KAAIC,IAAA,IAAEC,EAAKC,GAAMF,EAAA,MAAA,GAAAL,OAAQM,EAAGN,MAAAA,OAAKO,EAAK,IAAA,IAAKC,KAAK,KAAK,CACpH,CArDD,6BAAWC,GACT,MAAO,CAAC,UAAW,WAAY,YAAa,QAAS,SAAU,OAAQ,WAAY,QAAS,YAC9F,CAEAC,iBAAAA,IACM3B,KAAKC,SAAWD,KAAKT,aACvBS,KAAKC,QAAUD,KAAKC,SAAWD,KAAKT,WAAaS,KAAK4B,aAAa,YAGrE5B,KAAKT,UAAYH,EAASG,UAE1BsC,EAAkB7B,KAAMR,EAAOkC,oBAE/B1B,KAAKW,QACP,CAEAmB,wBAAAA,CAAyBC,EAAkBC,EAAgCC,GACxD,cAAbF,GAAyC,cAAbA,GAAyC,UAAbA,GACpC,iBAAXE,IACTjC,KAAKa,UAAUqB,OAAOD,GACtBjC,KAAKa,UAAUC,IAAImB,IAGlBjC,KAAKU,QACRV,KAAKU,MAAQ,gBAIfV,KAAK+B,GAAaE,GAAqB,GACvCjC,KAAKW,QACP,KAwBDhB,EAWM,MAAMwC,EAAa,CACxBA,WAAY3C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js";const
|
|
1
|
+
import{asyncToGenerator as e}from"../../../../../_virtual/_rollupPluginBabelHelpers.js";import"../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js";const r=(r,t,o)=>{var l;let n=r;const s=new Set,u=()=>n,c=function(){var r=e((function*(e){n=e;for(const e of s){const r=null==e?void 0:e.selector,t=r?r(n):n;void 0!==e.previousValue&&e.previousValue===t||(e.previousValue=t,yield e(t))}return n}));return function(e){return r.apply(this,arguments)}}(),i={getState:u,setState:c,subscribe:(e,r)=>{if(r&&e.selector&&e.selector!==r)throw new Error("Error, mismatchm selector, listener.selector !== selector.");return r&&!e.selector&&(e.selector=r),s.add(e),()=>s.delete(e)},unsubscribe:e=>{s.delete(e)}},a=t?null===(l=Object.entries(t))||void 0===l?void 0:l.reduce(((r,t)=>{let[l,n]=t;return{...r,[l]:e((function*(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];const s=yield n(u,c,...r);return o&&c(o(u(),l,...r)),s}))}}),{}):null,d={...i,...a?{actions:{...a}}:{}};return d};export{r as createStore};
|
|
2
2
|
//# sourceMappingURL=store.vanillajs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\n// export type Selector<T> = (state: Partial<T>) => Partial<T>;\nexport type SelectedValueType<T> = Partial<T> | Partial<keyof T>\n| string | number | boolean | undefined | string[] | number[] | boolean[] | undefined[];\nexport type Selector<T> = (state: Partial<T>) => SelectedValueType<T>;\n\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: SelectedValueType<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @param selector - Optional selector function to transform the store state.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller<T> } }\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller<T> = (...args: unknown[]) => void | Partial<T> | Promise<void | Partial<T>>\n\n\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Record<string, ActionHandler<T>>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = () => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>) => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n const newValue: SelectedValueType<T> = selector ? selector(currentState) : currentState\n\n // TODO plugin equality\n if (listener.previousValue === undefined || listener.previousValue !== newValue) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue as Partial<T>)\n }\n }\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => {\n if (selector && listener.selector && listener.selector !== selector) {\n throw new Error('Error, mismatchm selector, listener.selector !== selector.')\n }\n if (selector && !listener.selector) {\n // eslint-disable-next-line no-param-reassign\n listener.selector = selector\n }\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Record<string, ActionHandlerCaller<T>> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller<T>>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: async(...rest: unknown[]) => {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n return resultOfAction\n },\n }),\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["createStore","initialState","actions","reducer","_Object$entries","currentState","listeners","Set","getState","setState","
|
|
1
|
+
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\n// export type Selector<T> = (state: Partial<T>) => Partial<T>;\nexport type SelectedValueType<T> = Partial<T> | Partial<keyof T>\n| string | number | boolean | undefined | string[] | number[] | boolean[] | undefined[];\nexport type Selector<T> = (state: Partial<T>) => SelectedValueType<T>;\n\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: SelectedValueType<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @param selector - Optional selector function to transform the store state.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller<T> } }\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller<T> = (...args: unknown[]) => void | Partial<T> | Promise<void | Partial<T>>\n\n\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Record<string, ActionHandler<T>>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = () => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>) => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n const newValue: SelectedValueType<T> = selector ? selector(currentState) : currentState\n\n // TODO plugin equality\n if (listener.previousValue === undefined || listener.previousValue !== newValue) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue as Partial<T>)\n }\n }\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => {\n if (selector && listener.selector && listener.selector !== selector) {\n throw new Error('Error, mismatchm selector, listener.selector !== selector.')\n }\n if (selector && !listener.selector) {\n // eslint-disable-next-line no-param-reassign\n listener.selector = selector\n }\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Record<string, ActionHandlerCaller<T>> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller<T>>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: async(...rest: unknown[]) => {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n return resultOfAction\n },\n }),\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["createStore","initialState","actions","reducer","_Object$entries","currentState","listeners","Set","getState","setState","_ref","_asyncToGenerator","newState","listener","selector","newValue","undefined","previousValue","_x","apply","this","arguments","storeBaseicApi","subscribe","Error","add","delete","unsubscribe","resolvedActions","Object","entries","reduce","aggregator","_ref2","actionName","actionHandler","_len","length","rest","Array","_key","resultOfAction","storeCombinedWithActions"],"mappings":"4KA2FO,MAAMA,EAAcA,CACzBC,EACAC,EACAC,KACmC,IAAAC,EACnC,IAAIC,EAA2BJ,EAC/B,MAAMK,EAAY,IAAIC,IAMhBC,EAAWA,IAAMH,EAQjBI,EAAQ,WAAA,IAAAC,EAAAC,GAAG,UAAOC,GACtBP,EAAeO,EAGf,IAAK,MAAMC,KAAYP,EAAW,CAEhC,MAAMQ,EAAoCD,aAAAA,EAAAA,EAAUC,SAM9CC,EAAiCD,EAAWA,EAAST,GAAgBA,OAG5CW,IAA3BH,EAASI,eAA+BJ,EAASI,gBAAkBF,IACrEF,EAASI,cAAgBF,QAEnBF,EAASE,GAEnB,CACA,OAAOV,KACR,OAtBKI,SAAQS,GAAA,OAAAR,EAAAS,MAAAC,KAAAC,UAAA,EAAA,GA2BRC,EAA2B,CAK/Bd,WAMAC,WAMAc,UAAWA,CAACV,EAAuBC,KACjC,GAAIA,GAAYD,EAASC,UAAYD,EAASC,WAAaA,EACzD,MAAM,IAAIU,MAAM,8DAOlB,OALIV,IAAaD,EAASC,WAExBD,EAASC,SAAWA,GAEtBR,EAAUmB,IAAIZ,GACP,IAAMP,EAAUoB,OAAOb,EAAS,EAMzCc,YAAcd,IACZP,EAAUoB,OAAOb,EAAS,GAOxBe,EACF1B,EAAiCE,QAA1BA,EAAGyB,OAAOC,QAAQ5B,cAAQE,SAAvBA,EAAyB2B,QACnC,CACEC,EAAkDC,KAAA,IACjDC,EAAYC,GAA0CF,EAAA,MACnD,IACDD,EACHE,CAACA,GAAUvB,GAAG,YAA6B,IAAA,IAAAyB,EAAAf,UAAAgB,OAApBC,EAAIC,IAAAA,MAAAH,GAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAAJF,EAAIE,GAAAnB,UAAAmB,GACzB,MAAMC,QAAuBN,EAAc3B,EAAUC,KAAa6B,GAKlE,OAHInC,GACFM,EAASN,EAAQK,IAAY0B,KAAeI,IAEvCG,KAEV,GACD,CAAA,GACE,KAKAC,EAA2B,IAC5BpB,KACCM,EAAkB,CAAE1B,QAAS,IAAK0B,IAAsB,CAAE,GAGhE,OACIc,CACoC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createStore as
|
|
1
|
+
import{asyncToGenerator as r}from"../../../../../_virtual/_rollupPluginBabelHelpers.js";import{createStore as o}from"./store.vanillajs.js";const t=(t,a,n,i)=>{const s={...n,load:(l=r((function*(r,o,t){const a=r();o({...a,isLoading:!0});try{const r=yield t;a.data=(null==r?void 0:r.data)||r}catch(r){a.error=r}return o({...a,isLoading:!1})})),function(r,o,t){return l.apply(this,arguments)})};var l;return o({...a,dataId:t,isLoading:!1},s,i)};export{t as createDataStore};
|
|
2
2
|
//# sourceMappingURL=store.vanillajs.templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.templates.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.templates.ts"],"sourcesContent":["import { ActionHandler, Reducer, Store, StoreWithActions, createStore } from './store.vanillajs'\n\n\ntype DefaultES = { [key: string]: any }\n\n\nexport type DataState<T, ES = DefaultES> = {\n dataId: string\n isLoading: boolean\n error?: unknown\n data?: T\n} & ES\n\n\ntype Load<T, ES = DefaultES> = (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n\ntype LoadHandler<T, ES = DefaultES> = (\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n/**\n * Creates a data store with actions.\n * @param dataId - The ID of the data.\n * @param actions - Optional actions for the data store.\n * @returns The created data store with actions.\n */\nexport const createDataStore\n= <T, ES = DefaultES>(\n dataId: string,\n initialState?: Partial<ES>,\n actions?: Record<string, ActionHandler<DataState<T, ES>>>,\n reducer?: Reducer<DataState<T, ES>>,\n): StoreWithActions<DataState<T, ES>>\n& { actions: { load: LoadHandler<T, ES> } } => {\n const loadActions: { load: Load<T, ES> } = {\n ...actions,\n /**\n * Loads data into the data store.\n * @param getState - Function to get the current state of the data store.\n * @param setState - Function to set the state of the data store.\n * @param dataPromise - The data promise to be loaded.\n * @returns A promise that resolves to the updated state of the data store.\n */\n load: async (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n ) => {\n const dataState: Partial<DataState<T, ES>> = getState()\n\n setState({ ...dataState, isLoading: true })\n\n try {\n const response: unknown = await dataPromise\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.data = response?.data || response\n } catch (error: unknown) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.error = error\n }\n return setState({ ...dataState, isLoading: false })\n },\n }\n\n return (createStore<DataState<T, ES>>({\n ...initialState,\n dataId,\n isLoading: false,\n } as Partial<DataState<T, ES>>, loadActions, reducer)) as StoreWithActions<DataState<T, ES>>\n & { actions: { load: LoadHandler<T, ES> } }\n}\n"],"names":["createDataStore","dataId","initialState","actions","reducer","loadActions","load","
|
|
1
|
+
{"version":3,"file":"store.vanillajs.templates.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.templates.ts"],"sourcesContent":["import { ActionHandler, Reducer, Store, StoreWithActions, createStore } from './store.vanillajs'\n\n\ntype DefaultES = { [key: string]: any }\n\n\nexport type DataState<T, ES = DefaultES> = {\n dataId: string\n isLoading: boolean\n error?: unknown\n data?: T\n} & ES\n\n\ntype Load<T, ES = DefaultES> = (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n\ntype LoadHandler<T, ES = DefaultES> = (\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n/**\n * Creates a data store with actions.\n * @param dataId - The ID of the data.\n * @param actions - Optional actions for the data store.\n * @returns The created data store with actions.\n */\nexport const createDataStore\n= <T, ES = DefaultES>(\n dataId: string,\n initialState?: Partial<ES>,\n actions?: Record<string, ActionHandler<DataState<T, ES>>>,\n reducer?: Reducer<DataState<T, ES>>,\n): StoreWithActions<DataState<T, ES>>\n& { actions: { load: LoadHandler<T, ES> } } => {\n const loadActions: { load: Load<T, ES> } = {\n ...actions,\n /**\n * Loads data into the data store.\n * @param getState - Function to get the current state of the data store.\n * @param setState - Function to set the state of the data store.\n * @param dataPromise - The data promise to be loaded.\n * @returns A promise that resolves to the updated state of the data store.\n */\n load: async (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n ) => {\n const dataState: Partial<DataState<T, ES>> = getState()\n\n setState({ ...dataState, isLoading: true })\n\n try {\n const response: unknown = await dataPromise\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.data = response?.data || response\n } catch (error: unknown) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.error = error\n }\n return setState({ ...dataState, isLoading: false })\n },\n }\n\n return (createStore<DataState<T, ES>>({\n ...initialState,\n dataId,\n isLoading: false,\n } as Partial<DataState<T, ES>>, loadActions, reducer)) as StoreWithActions<DataState<T, ES>>\n & { actions: { load: LoadHandler<T, ES> } }\n}\n"],"names":["createDataStore","dataId","initialState","actions","reducer","loadActions","load","_ref","_asyncToGenerator","getState","setState","dataPromise","dataState","isLoading","response","data","error","_x","_x2","_x3","apply","this","arguments","createStore"],"mappings":"2IA+BO,MAAMA,EACXA,CACAC,EACAC,EACAC,EACAC,KAGA,MAAMC,EAAqC,IACtCF,EAQHG,MAAIC,EAAAC,GAAE,UACJC,EACAC,EACAC,GAEA,MAAMC,EAAuCH,IAE7CC,EAAS,IAAKE,EAAWC,WAAW,IAEpC,IACE,MAAMC,QAA0BH,EAIhCC,EAAUG,MAAOD,aAAQ,EAARA,EAAUC,OAAQD,CACpC,CAAC,MAAOE,GAGPJ,EAAUI,MAAQA,CACpB,CACA,OAAON,EAAS,IAAKE,EAAWC,WAAW,OAC5C,SAAAI,EAAAC,EAAAC,GAAA,OAAAZ,EAAAa,MAAAC,KAAAC,UAAA,IArBG,IAAAf,EAwBN,OAAQgB,EAA8B,IACjCrB,EACHD,SACAY,WAAW,GACmBR,EAAaD,EAAQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const i=
|
|
1
|
+
import{asyncToGenerator as n}from"../../../../_virtual/_rollupPluginBabelHelpers.js";const i=function(){var i=n((function*(){try{var n,i;const e=(yield null===(n=navigator)||void 0===n||null===(n=n.mediaDevices)||void 0===n||null===(i=n.enumerateDevices)||void 0===i?void 0:i.call(n)).find((n=>"videoinput"===n.kind));return(null==e?void 0:e.deviceId)||(null==e?void 0:e.groupId)}catch(n){return null}}));return function(){return i.apply(this,arguments)}}();export{i as getDeviceId};
|
|
2
2
|
//# sourceMappingURL=deviceInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfo.js","sources":["../../../../../../../src/core/utils/helpers/deviceInfo.ts"],"sourcesContent":["export const getDeviceId = async (): Promise<string | null | undefined> => {\n try {\n const devices = await navigator?.mediaDevices?.enumerateDevices?.()\n const device = devices.find((device) => device.kind === 'videoinput')\n\n return device?.deviceId || device?.groupId\n } catch (error: any) {\n return null\n }\n}\n"],"names":["getDeviceId","
|
|
1
|
+
{"version":3,"file":"deviceInfo.js","sources":["../../../../../../../src/core/utils/helpers/deviceInfo.ts"],"sourcesContent":["export const getDeviceId = async (): Promise<string | null | undefined> => {\n try {\n const devices = await navigator?.mediaDevices?.enumerateDevices?.()\n const device = devices.find((device) => device.kind === 'videoinput')\n\n return device?.deviceId || device?.groupId\n } catch (error: any) {\n return null\n }\n}\n"],"names":["getDeviceId","_ref","_asyncToGenerator","_navigator","_navigator$enumerateD","device","navigator","mediaDevices","enumerateDevices","call","find","kind","deviceId","groupId","error","apply","this","arguments"],"mappings":"2FAAaA,EAAW,WAAA,IAAAC,EAAAC,GAAG,YACzB,IAAI,IAAAC,EAAAC,EACF,MACMC,SADyB,QAAlBF,EAASG,iBAAS,IAAAH,GAAc,QAAdA,EAATA,EAAWI,oBAAY,IAAAJ,GAAkB,QAAlBC,EAAvBD,EAAyBK,wBAAgB,IAAAJ,OAAA,EAAzCA,EAAAK,KAAAN,IACCO,MAAML,GAA2B,eAAhBA,EAAOM,OAE/C,OAAON,eAAAA,EAAQO,YAAYP,aAAAA,EAAAA,EAAQQ,QACpC,CAAC,MAAOC,GACP,OAAO,IACT,KACD,OAAA,WATuB,OAAAb,EAAAc,MAAAC,KAAAC,UAAA,CAAA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function
|
|
1
|
+
"use strict";function t(){return t=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t},t.apply(this,arguments)}exports.extends=t;
|
|
2
2
|
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},t.apply(this,arguments)}export{t as extends};
|
|
2
2
|
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js";import{resolveAttributes as t,ced as i}from"../../../utils/webComponents/webComponent.utils.js";import e from"./icon.module.scss.js";var s;const n=document.createElement("template");n.innerHTML='<span class="icon-base"></span>';let o=i("icon-base")(s=class i extends HTMLElement{constructor(){super(...arguments),this.content=void 0,this.mainElement=void 0,this.iconUrl=void 0,this.minWidth=void 0,this.minHeight=void 0,this.width=void 0,this.height=void 0,this.size=void 0,this.fontSize=void 0,this.color=void 0,this.render=()=>{if(this.mainElement=this.mainElement||this.querySelector(".icon-base"),!this.mainElement)return;this.classList.add(e["icon-base-parent"]),this.mainElement.classList.add(e["icon-base"]);const t={"--min-width":this.minWidth||this.size||this.width||"auto","--min-height":this.minHeight||this.size||this.height||"auto","--width":this.size||this.width||"1rem","--height":this.size||this.height||"1rem",...this.fontSize?{"font-size":this.fontSize||"unset"}:{},...this.iconUrl?{"--icon-url":"url(".concat(this.iconUrl,")")}:{},...this.iconUrl?{"--icon-color":this.color}:{"--icon-content-color":this.color}};this.mainElement.innerHTML=this.iconUrl?"":this.content||"",this.mainElement.setAttribute("style",Object.entries(t).map((t=>{let[i,e]=t;return"".concat(i,": ").concat(e,";")})).join(" "))}}static get observedAttributes(){return["iconUrl","minWidth","minHeight","width","height","size","fontSize","color","className"]}connectedCallback(){(this.content||this.innerHTML)&&(this.content=this.content||this.innerHTML||this.getAttribute("content")),this.innerHTML=n.innerHTML,t(this,i.observedAttributes),this.render()}attributeChangedCallback(t,i,e){"className"!==t&&"classname"!==t&&"class"!==t||"string"==typeof e&&(this.classList.remove(e),this.classList.add(e)),this.color||(this.color="currentColor"),this[t]=e||"",this.render()}})||s;const h={ESIconBase:o};export{o as ESIcon,h as ESIconBase};
|
|
2
2
|
//# sourceMappingURL=IconWC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconWC.js","sources":["../../../../../../../../src/core/ui/components/icon/IconWC.ts"],"sourcesContent":["import { ced, resolveAttributes } from '../../../utils/webComponents/webComponent.utils'\n\nimport classes from './icon.module.scss'\n\n\nconst template = document.createElement('template')\n\ntemplate.innerHTML = '<span class=\"icon-base\"></span>'\n\nexport type IconBaseWCType = {\n iconUrl?: string\n minWidth?: string\n minHeight?: string\n width?: string\n height?: string\n size?: string\n fontSize?: string\n color?: string\n className?: string\n}\n\n@ced('icon-base')\nexport class ESIcon extends HTMLElement {\n content: string | null\n\n mainElement: HTMLElement\n\n iconUrl?: string | null\n\n minWidth?: string | null\n\n minHeight?: string | null\n\n width?: string | null\n\n height?: string | null\n\n size?: string | null\n\n fontSize?: string | null\n\n color?: string | null\n\n static get observedAttributes() {\n return ['iconUrl', 'minWidth', 'minHeight', 'width', 'height', 'size', 'fontSize', 'color', 'className']\n }\n\n connectedCallback() {\n if (this.content || this.innerHTML) {\n this.content = this.content || this.innerHTML || this.getAttribute('content')\n }\n\n this.innerHTML = template.innerHTML\n\n resolveAttributes(this, ESIcon.observedAttributes)\n\n this.render()\n }\n\n attributeChangedCallback(attrName: string, oldVal: string | number | null, newVal: string | number | null) {\n if (attrName === 'className' || attrName === 'classname' || attrName === 'class') {\n if (typeof newVal === 'string') {\n this.classList.remove(newVal as string)\n this.classList.add(newVal as string)\n }\n }\n if (!this.color) {\n this.color = 'currentColor'\n }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[attrName] = (newVal as string) || ''\n this.render()\n }\n\n render = () => {\n this.mainElement = this.mainElement || this.querySelector('.icon-base') as HTMLElement\n if (!this.mainElement) {\n return\n }\n this.classList.add(classes['icon-base-parent'])\n this.mainElement.classList.add(classes['icon-base'])\n\n const styles = {\n '--min-width': this.minWidth || this.size || this.width || 'auto',\n '--min-height': this.minHeight || this.size || this.height || 'auto',\n '--width': this.size || this.width || '1rem',\n '--height': this.size || this.height || '1rem',\n ...(this.fontSize ? { 'font-size': this.fontSize || 'unset' } : {}),\n ...(this.iconUrl ? { '--icon-url': `url(${this.iconUrl})` } : {}),\n ...(this.iconUrl ? { '--icon-color': this.color } : { '--icon-content-color': this.color }),\n }\n\n this.mainElement.innerHTML = this.iconUrl ? '' : (this.content || '')\n\n this.mainElement.setAttribute('style', Object.entries(styles).map(([key, value]) => `${key}: ${value};`).join(' '))\n }\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'icon-base': any\n }\n }\n}\n\nexport const ESIconBase = {\n ESIconBase: ESIcon,\n}\n"],"names":["template","document","createElement","innerHTML","ESIcon","ced","_dec","_class","HTMLElement","constructor","super","arguments","
|
|
1
|
+
{"version":3,"file":"IconWC.js","sources":["../../../../../../../../src/core/ui/components/icon/IconWC.ts"],"sourcesContent":["import { ced, resolveAttributes } from '../../../utils/webComponents/webComponent.utils'\n\nimport classes from './icon.module.scss'\n\n\nconst template = document.createElement('template')\n\ntemplate.innerHTML = '<span class=\"icon-base\"></span>'\n\nexport type IconBaseWCType = {\n iconUrl?: string\n minWidth?: string\n minHeight?: string\n width?: string\n height?: string\n size?: string\n fontSize?: string\n color?: string\n className?: string\n}\n\n@ced('icon-base')\nexport class ESIcon extends HTMLElement {\n content: string | null\n\n mainElement: HTMLElement\n\n iconUrl?: string | null\n\n minWidth?: string | null\n\n minHeight?: string | null\n\n width?: string | null\n\n height?: string | null\n\n size?: string | null\n\n fontSize?: string | null\n\n color?: string | null\n\n static get observedAttributes() {\n return ['iconUrl', 'minWidth', 'minHeight', 'width', 'height', 'size', 'fontSize', 'color', 'className']\n }\n\n connectedCallback() {\n if (this.content || this.innerHTML) {\n this.content = this.content || this.innerHTML || this.getAttribute('content')\n }\n\n this.innerHTML = template.innerHTML\n\n resolveAttributes(this, ESIcon.observedAttributes)\n\n this.render()\n }\n\n attributeChangedCallback(attrName: string, oldVal: string | number | null, newVal: string | number | null) {\n if (attrName === 'className' || attrName === 'classname' || attrName === 'class') {\n if (typeof newVal === 'string') {\n this.classList.remove(newVal as string)\n this.classList.add(newVal as string)\n }\n }\n if (!this.color) {\n this.color = 'currentColor'\n }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[attrName] = (newVal as string) || ''\n this.render()\n }\n\n render = () => {\n this.mainElement = this.mainElement || this.querySelector('.icon-base') as HTMLElement\n if (!this.mainElement) {\n return\n }\n this.classList.add(classes['icon-base-parent'])\n this.mainElement.classList.add(classes['icon-base'])\n\n const styles = {\n '--min-width': this.minWidth || this.size || this.width || 'auto',\n '--min-height': this.minHeight || this.size || this.height || 'auto',\n '--width': this.size || this.width || '1rem',\n '--height': this.size || this.height || '1rem',\n ...(this.fontSize ? { 'font-size': this.fontSize || 'unset' } : {}),\n ...(this.iconUrl ? { '--icon-url': `url(${this.iconUrl})` } : {}),\n ...(this.iconUrl ? { '--icon-color': this.color } : { '--icon-content-color': this.color }),\n }\n\n this.mainElement.innerHTML = this.iconUrl ? '' : (this.content || '')\n\n this.mainElement.setAttribute('style', Object.entries(styles).map(([key, value]) => `${key}: ${value};`).join(' '))\n }\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'icon-base': any\n }\n }\n}\n\nexport const ESIconBase = {\n ESIconBase: ESIcon,\n}\n"],"names":["template","document","createElement","innerHTML","ESIcon","ced","_dec","_class","HTMLElement","constructor","super","arguments","this","content","mainElement","iconUrl","minWidth","minHeight","width","height","size","fontSize","color","render","querySelector","classList","add","classes","styles","concat","setAttribute","Object","entries","map","_ref","key","value","join","observedAttributes","connectedCallback","getAttribute","resolveAttributes","attributeChangedCallback","attrName","oldVal","newVal","remove","ESIconBase"],"mappings":"+NAKA,MAAMA,EAAWC,SAASC,cAAc,YAExCF,EAASG,UAAY,kCAcrB,IACaC,EADZC,EAAI,YAAYC,CAAAC,EAAjB,MACaH,UAAeI,YAAYC,WAAAA,GAAAC,SAAAC,WAAAC,KACtCC,aAAO,EAAAD,KAEPE,iBAAW,EAAAF,KAEXG,aAAO,EAAAH,KAEPI,cAAQ,EAAAJ,KAERK,eAAS,EAAAL,KAETM,WAAK,EAAAN,KAELO,YAAM,EAAAP,KAENQ,UAAI,EAAAR,KAEJS,cAAQ,EAAAT,KAERU,WAAK,EAAAV,KAkCLW,OAAS,KAEP,GADAX,KAAKE,YAAcF,KAAKE,aAAeF,KAAKY,cAAc,eACrDZ,KAAKE,YACR,OAEFF,KAAKa,UAAUC,IAAIC,EAAQ,qBAC3Bf,KAAKE,YAAYW,UAAUC,IAAIC,EAAQ,cAEvC,MAAMC,EAAS,CACb,cAAehB,KAAKI,UAAYJ,KAAKQ,MAAQR,KAAKM,OAAS,OAC3D,eAAgBN,KAAKK,WAAaL,KAAKQ,MAAQR,KAAKO,QAAU,OAC9D,UAAWP,KAAKQ,MAAQR,KAAKM,OAAS,OACtC,WAAYN,KAAKQ,MAAQR,KAAKO,QAAU,UACpCP,KAAKS,SAAW,CAAE,YAAaT,KAAKS,UAAY,SAAY,CAAE,KAC9DT,KAAKG,QAAU,CAAE,aAAYc,OAAAA,OAASjB,KAAKG,QAAO,MAAQ,CAAE,KAC5DH,KAAKG,QAAU,CAAE,eAAgBH,KAAKU,OAAU,CAAE,uBAAwBV,KAAKU,QAGrFV,KAAKE,YAAYX,UAAYS,KAAKG,QAAU,GAAMH,KAAKC,SAAW,GAElED,KAAKE,YAAYgB,aAAa,QAASC,OAAOC,QAAQJ,GAAQK,KAAIC,IAAA,IAAEC,EAAKC,GAAMF,EAAA,MAAA,GAAAL,OAAQM,EAAGN,MAAAA,OAAKO,EAAK,IAAA,IAAKC,KAAK,KAAK,CACpH,CArDD,6BAAWC,GACT,MAAO,CAAC,UAAW,WAAY,YAAa,QAAS,SAAU,OAAQ,WAAY,QAAS,YAC9F,CAEAC,iBAAAA,IACM3B,KAAKC,SAAWD,KAAKT,aACvBS,KAAKC,QAAUD,KAAKC,SAAWD,KAAKT,WAAaS,KAAK4B,aAAa,YAGrE5B,KAAKT,UAAYH,EAASG,UAE1BsC,EAAkB7B,KAAMR,EAAOkC,oBAE/B1B,KAAKW,QACP,CAEAmB,wBAAAA,CAAyBC,EAAkBC,EAAgCC,GACxD,cAAbF,GAAyC,cAAbA,GAAyC,UAAbA,GACpC,iBAAXE,IACTjC,KAAKa,UAAUqB,OAAOD,GACtBjC,KAAKa,UAAUC,IAAImB,IAGlBjC,KAAKU,QACRV,KAAKU,MAAQ,gBAIfV,KAAK+B,GAAaE,GAAqB,GACvCjC,KAAKW,QACP,KAwBDhB,EAWM,MAAMwC,EAAa,CACxBA,WAAY3C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";require("../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");var t,i=require("../../../utils/webComponents/webComponent.utils.js"),e=require("./icon.module.scss.js");const s=document.createElement("template");s.innerHTML='<span class="icon-base"></span>';let n=i.ced("icon-base")(t=class t extends HTMLElement{constructor(){super(...arguments),this.content=void 0,this.mainElement=void 0,this.iconUrl=void 0,this.minWidth=void 0,this.minHeight=void 0,this.width=void 0,this.height=void 0,this.size=void 0,this.fontSize=void 0,this.color=void 0,this.render=()=>{if(this.mainElement=this.mainElement||this.querySelector(".icon-base"),!this.mainElement)return;this.classList.add(e.default["icon-base-parent"]),this.mainElement.classList.add(e.default["icon-base"]);const t={"--min-width":this.minWidth||this.size||this.width||"auto","--min-height":this.minHeight||this.size||this.height||"auto","--width":this.size||this.width||"1rem","--height":this.size||this.height||"1rem",...this.fontSize?{"font-size":this.fontSize||"unset"}:{},...this.iconUrl?{"--icon-url":"url(".concat(this.iconUrl,")")}:{},...this.iconUrl?{"--icon-color":this.color}:{"--icon-content-color":this.color}};this.mainElement.innerHTML=this.iconUrl?"":this.content||"",this.mainElement.setAttribute("style",Object.entries(t).map((t=>{let[i,e]=t;return"".concat(i,": ").concat(e,";")})).join(" "))}}static get observedAttributes(){return["iconUrl","minWidth","minHeight","width","height","size","fontSize","color","className"]}connectedCallback(){(this.content||this.innerHTML)&&(this.content=this.content||this.innerHTML||this.getAttribute("content")),this.innerHTML=s.innerHTML,i.resolveAttributes(this,t.observedAttributes),this.render()}attributeChangedCallback(t,i,e){"className"!==t&&"classname"!==t&&"class"!==t||"string"==typeof e&&(this.classList.remove(e),this.classList.add(e)),this.color||(this.color="currentColor"),this[t]=e||"",this.render()}})||t;const o={ESIconBase:n};exports.ESIcon=n,exports.ESIconBase=o;
|
|
2
2
|
//# sourceMappingURL=IconWC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconWC.js","sources":["../../../../../../../src/core/ui/components/icon/IconWC.ts"],"sourcesContent":["import { ced, resolveAttributes } from '../../../utils/webComponents/webComponent.utils'\n\nimport classes from './icon.module.scss'\n\n\nconst template = document.createElement('template')\n\ntemplate.innerHTML = '<span class=\"icon-base\"></span>'\n\nexport type IconBaseWCType = {\n iconUrl?: string\n minWidth?: string\n minHeight?: string\n width?: string\n height?: string\n size?: string\n fontSize?: string\n color?: string\n className?: string\n}\n\n@ced('icon-base')\nexport class ESIcon extends HTMLElement {\n content: string | null\n\n mainElement: HTMLElement\n\n iconUrl?: string | null\n\n minWidth?: string | null\n\n minHeight?: string | null\n\n width?: string | null\n\n height?: string | null\n\n size?: string | null\n\n fontSize?: string | null\n\n color?: string | null\n\n static get observedAttributes() {\n return ['iconUrl', 'minWidth', 'minHeight', 'width', 'height', 'size', 'fontSize', 'color', 'className']\n }\n\n connectedCallback() {\n if (this.content || this.innerHTML) {\n this.content = this.content || this.innerHTML || this.getAttribute('content')\n }\n\n this.innerHTML = template.innerHTML\n\n resolveAttributes(this, ESIcon.observedAttributes)\n\n this.render()\n }\n\n attributeChangedCallback(attrName: string, oldVal: string | number | null, newVal: string | number | null) {\n if (attrName === 'className' || attrName === 'classname' || attrName === 'class') {\n if (typeof newVal === 'string') {\n this.classList.remove(newVal as string)\n this.classList.add(newVal as string)\n }\n }\n if (!this.color) {\n this.color = 'currentColor'\n }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[attrName] = (newVal as string) || ''\n this.render()\n }\n\n render = () => {\n this.mainElement = this.mainElement || this.querySelector('.icon-base') as HTMLElement\n if (!this.mainElement) {\n return\n }\n this.classList.add(classes['icon-base-parent'])\n this.mainElement.classList.add(classes['icon-base'])\n\n const styles = {\n '--min-width': this.minWidth || this.size || this.width || 'auto',\n '--min-height': this.minHeight || this.size || this.height || 'auto',\n '--width': this.size || this.width || '1rem',\n '--height': this.size || this.height || '1rem',\n ...(this.fontSize ? { 'font-size': this.fontSize || 'unset' } : {}),\n ...(this.iconUrl ? { '--icon-url': `url(${this.iconUrl})` } : {}),\n ...(this.iconUrl ? { '--icon-color': this.color } : { '--icon-content-color': this.color }),\n }\n\n this.mainElement.innerHTML = this.iconUrl ? '' : (this.content || '')\n\n this.mainElement.setAttribute('style', Object.entries(styles).map(([key, value]) => `${key}: ${value};`).join(' '))\n }\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'icon-base': any\n }\n }\n}\n\nexport const ESIconBase = {\n ESIconBase: ESIcon,\n}\n"],"names":["template","document","createElement","innerHTML","ESIcon","ced","_dec","_class","HTMLElement","constructor","super","arguments","
|
|
1
|
+
{"version":3,"file":"IconWC.js","sources":["../../../../../../../src/core/ui/components/icon/IconWC.ts"],"sourcesContent":["import { ced, resolveAttributes } from '../../../utils/webComponents/webComponent.utils'\n\nimport classes from './icon.module.scss'\n\n\nconst template = document.createElement('template')\n\ntemplate.innerHTML = '<span class=\"icon-base\"></span>'\n\nexport type IconBaseWCType = {\n iconUrl?: string\n minWidth?: string\n minHeight?: string\n width?: string\n height?: string\n size?: string\n fontSize?: string\n color?: string\n className?: string\n}\n\n@ced('icon-base')\nexport class ESIcon extends HTMLElement {\n content: string | null\n\n mainElement: HTMLElement\n\n iconUrl?: string | null\n\n minWidth?: string | null\n\n minHeight?: string | null\n\n width?: string | null\n\n height?: string | null\n\n size?: string | null\n\n fontSize?: string | null\n\n color?: string | null\n\n static get observedAttributes() {\n return ['iconUrl', 'minWidth', 'minHeight', 'width', 'height', 'size', 'fontSize', 'color', 'className']\n }\n\n connectedCallback() {\n if (this.content || this.innerHTML) {\n this.content = this.content || this.innerHTML || this.getAttribute('content')\n }\n\n this.innerHTML = template.innerHTML\n\n resolveAttributes(this, ESIcon.observedAttributes)\n\n this.render()\n }\n\n attributeChangedCallback(attrName: string, oldVal: string | number | null, newVal: string | number | null) {\n if (attrName === 'className' || attrName === 'classname' || attrName === 'class') {\n if (typeof newVal === 'string') {\n this.classList.remove(newVal as string)\n this.classList.add(newVal as string)\n }\n }\n if (!this.color) {\n this.color = 'currentColor'\n }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[attrName] = (newVal as string) || ''\n this.render()\n }\n\n render = () => {\n this.mainElement = this.mainElement || this.querySelector('.icon-base') as HTMLElement\n if (!this.mainElement) {\n return\n }\n this.classList.add(classes['icon-base-parent'])\n this.mainElement.classList.add(classes['icon-base'])\n\n const styles = {\n '--min-width': this.minWidth || this.size || this.width || 'auto',\n '--min-height': this.minHeight || this.size || this.height || 'auto',\n '--width': this.size || this.width || '1rem',\n '--height': this.size || this.height || '1rem',\n ...(this.fontSize ? { 'font-size': this.fontSize || 'unset' } : {}),\n ...(this.iconUrl ? { '--icon-url': `url(${this.iconUrl})` } : {}),\n ...(this.iconUrl ? { '--icon-color': this.color } : { '--icon-content-color': this.color }),\n }\n\n this.mainElement.innerHTML = this.iconUrl ? '' : (this.content || '')\n\n this.mainElement.setAttribute('style', Object.entries(styles).map(([key, value]) => `${key}: ${value};`).join(' '))\n }\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'icon-base': any\n }\n }\n}\n\nexport const ESIconBase = {\n ESIconBase: ESIcon,\n}\n"],"names":["template","document","createElement","innerHTML","ESIcon","ced","_dec","_class","HTMLElement","constructor","super","arguments","this","content","mainElement","iconUrl","minWidth","minHeight","width","height","size","fontSize","color","render","querySelector","classList","add","classes","default","styles","concat","setAttribute","Object","entries","map","_ref","key","value","join","observedAttributes","connectedCallback","getAttribute","resolveAttributes","attributeChangedCallback","attrName","oldVal","newVal","remove","ESIconBase"],"mappings":"6MAKA,MAAMA,EAAWC,SAASC,cAAc,YAExCF,EAASG,UAAY,kCAcrB,IACaC,EADZC,EAAAA,IAAI,YAAYC,CAAAC,EAAjB,MACaH,UAAeI,YAAYC,WAAAA,GAAAC,SAAAC,WAAAC,KACtCC,aAAO,EAAAD,KAEPE,iBAAW,EAAAF,KAEXG,aAAO,EAAAH,KAEPI,cAAQ,EAAAJ,KAERK,eAAS,EAAAL,KAETM,WAAK,EAAAN,KAELO,YAAM,EAAAP,KAENQ,UAAI,EAAAR,KAEJS,cAAQ,EAAAT,KAERU,WAAK,EAAAV,KAkCLW,OAAS,KAEP,GADAX,KAAKE,YAAcF,KAAKE,aAAeF,KAAKY,cAAc,eACrDZ,KAAKE,YACR,OAEFF,KAAKa,UAAUC,IAAIC,EAAAA,QAAQ,qBAC3Bf,KAAKE,YAAYW,UAAUC,IAAIC,EAAOC,QAAC,cAEvC,MAAMC,EAAS,CACb,cAAejB,KAAKI,UAAYJ,KAAKQ,MAAQR,KAAKM,OAAS,OAC3D,eAAgBN,KAAKK,WAAaL,KAAKQ,MAAQR,KAAKO,QAAU,OAC9D,UAAWP,KAAKQ,MAAQR,KAAKM,OAAS,OACtC,WAAYN,KAAKQ,MAAQR,KAAKO,QAAU,UACpCP,KAAKS,SAAW,CAAE,YAAaT,KAAKS,UAAY,SAAY,CAAE,KAC9DT,KAAKG,QAAU,CAAE,aAAYe,OAAAA,OAASlB,KAAKG,QAAO,MAAQ,CAAE,KAC5DH,KAAKG,QAAU,CAAE,eAAgBH,KAAKU,OAAU,CAAE,uBAAwBV,KAAKU,QAGrFV,KAAKE,YAAYX,UAAYS,KAAKG,QAAU,GAAMH,KAAKC,SAAW,GAElED,KAAKE,YAAYiB,aAAa,QAASC,OAAOC,QAAQJ,GAAQK,KAAIC,IAAA,IAAEC,EAAKC,GAAMF,EAAA,MAAA,GAAAL,OAAQM,EAAGN,MAAAA,OAAKO,EAAK,IAAA,IAAKC,KAAK,KAAK,CACpH,CArDD,6BAAWC,GACT,MAAO,CAAC,UAAW,WAAY,YAAa,QAAS,SAAU,OAAQ,WAAY,QAAS,YAC9F,CAEAC,iBAAAA,IACM5B,KAAKC,SAAWD,KAAKT,aACvBS,KAAKC,QAAUD,KAAKC,SAAWD,KAAKT,WAAaS,KAAK6B,aAAa,YAGrE7B,KAAKT,UAAYH,EAASG,UAE1BuC,EAAAA,kBAAkB9B,KAAMR,EAAOmC,oBAE/B3B,KAAKW,QACP,CAEAoB,wBAAAA,CAAyBC,EAAkBC,EAAgCC,GACxD,cAAbF,GAAyC,cAAbA,GAAyC,UAAbA,GACpC,iBAAXE,IACTlC,KAAKa,UAAUsB,OAAOD,GACtBlC,KAAKa,UAAUC,IAAIoB,IAGlBlC,KAAKU,QACRV,KAAKU,MAAQ,gBAIfV,KAAKgC,GAAaE,GAAqB,GACvClC,KAAKW,QACP,KAwBDhB,EAWM,MAAMyC,EAAa,CACxBA,WAAY5C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function n(n,t,r,e,o,i,u){try{var c=n[i](u),a=c.value}catch(n){return void r(n)}c.done?t(a):Promise.resolve(a).then(e,o)}exports.asyncToGenerator=function(t){return function(){var r=this,e=arguments;return new Promise((function(o,i){var u=t.apply(r,e);function c(t){n(u,o,i,c,a,"next",t)}function a(t){n(u,o,i,c,a,"throw",t)}c(void 0)}))}};
|
|
2
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function n(n,r,t,o,e,i,u){try{var a=n[i](u),c=a.value}catch(n){return void t(n)}a.done?r(c):Promise.resolve(c).then(o,e)}function r(r){return function(){var t=this,o=arguments;return new Promise((function(e,i){var u=r.apply(t,o);function a(r){n(u,e,i,a,c,"next",r)}function c(r){n(u,e,i,a,c,"throw",r)}a(void 0)}))}}export{r as asyncToGenerator};
|
|
2
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/utils/esm/index.css
CHANGED
|
@@ -28,6 +28,25 @@
|
|
|
28
28
|
width: var(--height);
|
|
29
29
|
height: var(--width);
|
|
30
30
|
}
|
|
31
|
+
.divider-module_divider-line__6CesR {
|
|
32
|
+
position: relative;
|
|
33
|
+
display: block;
|
|
34
|
+
transition: opacity, width, height 250ms ease-in-out;
|
|
35
|
+
background-color: var(--color);
|
|
36
|
+
opacity: var(--opacity);
|
|
37
|
+
}
|
|
38
|
+
.divider-module_divider-line__6CesR.divider-module_vertical__qSVWD {
|
|
39
|
+
height: var(--length);
|
|
40
|
+
left: var(--left);
|
|
41
|
+
width: var(--width);
|
|
42
|
+
margin: var(--margin);
|
|
43
|
+
}
|
|
44
|
+
.divider-module_divider-line__6CesR.divider-module_horizontal__Gz-Oj {
|
|
45
|
+
width: var(--length);
|
|
46
|
+
left: var(--left);
|
|
47
|
+
height: var(--height);
|
|
48
|
+
margin: var(--margin);
|
|
49
|
+
}
|
|
31
50
|
.CollapsibleContainer-module_collapsible-container__u0Jmm {
|
|
32
51
|
transform-origin: 0% 0%;
|
|
33
52
|
opacity: 0;
|
|
@@ -61,25 +80,6 @@
|
|
|
61
80
|
max-width: var(--prop-value);
|
|
62
81
|
opacity: 1;
|
|
63
82
|
}
|
|
64
|
-
.divider-module_divider-line__6CesR {
|
|
65
|
-
position: relative;
|
|
66
|
-
display: block;
|
|
67
|
-
transition: opacity, width, height 250ms ease-in-out;
|
|
68
|
-
background-color: var(--color);
|
|
69
|
-
opacity: var(--opacity);
|
|
70
|
-
}
|
|
71
|
-
.divider-module_divider-line__6CesR.divider-module_vertical__qSVWD {
|
|
72
|
-
height: var(--length);
|
|
73
|
-
left: var(--left);
|
|
74
|
-
width: var(--width);
|
|
75
|
-
margin: var(--margin);
|
|
76
|
-
}
|
|
77
|
-
.divider-module_divider-line__6CesR.divider-module_horizontal__Gz-Oj {
|
|
78
|
-
width: var(--length);
|
|
79
|
-
left: var(--left);
|
|
80
|
-
height: var(--height);
|
|
81
|
-
margin: var(--margin);
|
|
82
|
-
}
|
|
83
83
|
.layoutBox-module_layout-box__faPND {
|
|
84
84
|
display: flex;
|
|
85
85
|
position: relative;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js";const
|
|
1
|
+
import{asyncToGenerator as e}from"../../../../../_virtual/_rollupPluginBabelHelpers.js";import"../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js";const r=(r,t,o)=>{var l;let n=r;const s=new Set,u=()=>n,c=function(){var r=e((function*(e){n=e;for(const e of s){const r=null==e?void 0:e.selector,t=r?r(n):n;void 0!==e.previousValue&&e.previousValue===t||(e.previousValue=t,yield e(t))}return n}));return function(e){return r.apply(this,arguments)}}(),i={getState:u,setState:c,subscribe:(e,r)=>{if(r&&e.selector&&e.selector!==r)throw new Error("Error, mismatchm selector, listener.selector !== selector.");return r&&!e.selector&&(e.selector=r),s.add(e),()=>s.delete(e)},unsubscribe:e=>{s.delete(e)}},a=t?null===(l=Object.entries(t))||void 0===l?void 0:l.reduce(((r,t)=>{let[l,n]=t;return{...r,[l]:e((function*(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];const s=yield n(u,c,...r);return o&&c(o(u(),l,...r)),s}))}}),{}):null,d={...i,...a?{actions:{...a}}:{}};return d};export{r as createStore};
|
|
2
2
|
//# sourceMappingURL=store.vanillajs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\n// export type Selector<T> = (state: Partial<T>) => Partial<T>;\nexport type SelectedValueType<T> = Partial<T> | Partial<keyof T>\n| string | number | boolean | undefined | string[] | number[] | boolean[] | undefined[];\nexport type Selector<T> = (state: Partial<T>) => SelectedValueType<T>;\n\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: SelectedValueType<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @param selector - Optional selector function to transform the store state.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller<T> } }\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller<T> = (...args: unknown[]) => void | Partial<T> | Promise<void | Partial<T>>\n\n\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Record<string, ActionHandler<T>>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = () => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>) => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n const newValue: SelectedValueType<T> = selector ? selector(currentState) : currentState\n\n // TODO plugin equality\n if (listener.previousValue === undefined || listener.previousValue !== newValue) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue as Partial<T>)\n }\n }\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => {\n if (selector && listener.selector && listener.selector !== selector) {\n throw new Error('Error, mismatchm selector, listener.selector !== selector.')\n }\n if (selector && !listener.selector) {\n // eslint-disable-next-line no-param-reassign\n listener.selector = selector\n }\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Record<string, ActionHandlerCaller<T>> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller<T>>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: async(...rest: unknown[]) => {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n return resultOfAction\n },\n }),\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["createStore","initialState","actions","reducer","_Object$entries","currentState","listeners","Set","getState","setState","
|
|
1
|
+
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\n// export type Selector<T> = (state: Partial<T>) => Partial<T>;\nexport type SelectedValueType<T> = Partial<T> | Partial<keyof T>\n| string | number | boolean | undefined | string[] | number[] | boolean[] | undefined[];\nexport type Selector<T> = (state: Partial<T>) => SelectedValueType<T>;\n\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: SelectedValueType<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @param selector - Optional selector function to transform the store state.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller<T> } }\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller<T> = (...args: unknown[]) => void | Partial<T> | Promise<void | Partial<T>>\n\n\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Record<string, ActionHandler<T>>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = () => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>) => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n const newValue: SelectedValueType<T> = selector ? selector(currentState) : currentState\n\n // TODO plugin equality\n if (listener.previousValue === undefined || listener.previousValue !== newValue) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue as Partial<T>)\n }\n }\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => {\n if (selector && listener.selector && listener.selector !== selector) {\n throw new Error('Error, mismatchm selector, listener.selector !== selector.')\n }\n if (selector && !listener.selector) {\n // eslint-disable-next-line no-param-reassign\n listener.selector = selector\n }\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Record<string, ActionHandlerCaller<T>> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller<T>>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: async(...rest: unknown[]) => {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n return resultOfAction\n },\n }),\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["createStore","initialState","actions","reducer","_Object$entries","currentState","listeners","Set","getState","setState","_ref","_asyncToGenerator","newState","listener","selector","newValue","undefined","previousValue","_x","apply","this","arguments","storeBaseicApi","subscribe","Error","add","delete","unsubscribe","resolvedActions","Object","entries","reduce","aggregator","_ref2","actionName","actionHandler","_len","length","rest","Array","_key","resultOfAction","storeCombinedWithActions"],"mappings":"4KA2FO,MAAMA,EAAcA,CACzBC,EACAC,EACAC,KACmC,IAAAC,EACnC,IAAIC,EAA2BJ,EAC/B,MAAMK,EAAY,IAAIC,IAMhBC,EAAWA,IAAMH,EAQjBI,EAAQ,WAAA,IAAAC,EAAAC,GAAG,UAAOC,GACtBP,EAAeO,EAGf,IAAK,MAAMC,KAAYP,EAAW,CAEhC,MAAMQ,EAAoCD,aAAAA,EAAAA,EAAUC,SAM9CC,EAAiCD,EAAWA,EAAST,GAAgBA,OAG5CW,IAA3BH,EAASI,eAA+BJ,EAASI,gBAAkBF,IACrEF,EAASI,cAAgBF,QAEnBF,EAASE,GAEnB,CACA,OAAOV,KACR,OAtBKI,SAAQS,GAAA,OAAAR,EAAAS,MAAAC,KAAAC,UAAA,EAAA,GA2BRC,EAA2B,CAK/Bd,WAMAC,WAMAc,UAAWA,CAACV,EAAuBC,KACjC,GAAIA,GAAYD,EAASC,UAAYD,EAASC,WAAaA,EACzD,MAAM,IAAIU,MAAM,8DAOlB,OALIV,IAAaD,EAASC,WAExBD,EAASC,SAAWA,GAEtBR,EAAUmB,IAAIZ,GACP,IAAMP,EAAUoB,OAAOb,EAAS,EAMzCc,YAAcd,IACZP,EAAUoB,OAAOb,EAAS,GAOxBe,EACF1B,EAAiCE,QAA1BA,EAAGyB,OAAOC,QAAQ5B,cAAQE,SAAvBA,EAAyB2B,QACnC,CACEC,EAAkDC,KAAA,IACjDC,EAAYC,GAA0CF,EAAA,MACnD,IACDD,EACHE,CAACA,GAAUvB,GAAG,YAA6B,IAAA,IAAAyB,EAAAf,UAAAgB,OAApBC,EAAIC,IAAAA,MAAAH,GAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAAJF,EAAIE,GAAAnB,UAAAmB,GACzB,MAAMC,QAAuBN,EAAc3B,EAAUC,KAAa6B,GAKlE,OAHInC,GACFM,EAASN,EAAQK,IAAY0B,KAAeI,IAEvCG,KAEV,GACD,CAAA,GACE,KAKAC,EAA2B,IAC5BpB,KACCM,EAAkB,CAAE1B,QAAS,IAAK0B,IAAsB,CAAE,GAGhE,OACIc,CACoC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createStore as
|
|
1
|
+
import{asyncToGenerator as r}from"../../../../../_virtual/_rollupPluginBabelHelpers.js";import{createStore as o}from"./store.vanillajs.js";const t=(t,a,n,i)=>{const s={...n,load:(l=r((function*(r,o,t){const a=r();o({...a,isLoading:!0});try{const r=yield t;a.data=(null==r?void 0:r.data)||r}catch(r){a.error=r}return o({...a,isLoading:!1})})),function(r,o,t){return l.apply(this,arguments)})};var l;return o({...a,dataId:t,isLoading:!1},s,i)};export{t as createDataStore};
|
|
2
2
|
//# sourceMappingURL=store.vanillajs.templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.templates.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.templates.ts"],"sourcesContent":["import { ActionHandler, Reducer, Store, StoreWithActions, createStore } from './store.vanillajs'\n\n\ntype DefaultES = { [key: string]: any }\n\n\nexport type DataState<T, ES = DefaultES> = {\n dataId: string\n isLoading: boolean\n error?: unknown\n data?: T\n} & ES\n\n\ntype Load<T, ES = DefaultES> = (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n\ntype LoadHandler<T, ES = DefaultES> = (\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n/**\n * Creates a data store with actions.\n * @param dataId - The ID of the data.\n * @param actions - Optional actions for the data store.\n * @returns The created data store with actions.\n */\nexport const createDataStore\n= <T, ES = DefaultES>(\n dataId: string,\n initialState?: Partial<ES>,\n actions?: Record<string, ActionHandler<DataState<T, ES>>>,\n reducer?: Reducer<DataState<T, ES>>,\n): StoreWithActions<DataState<T, ES>>\n& { actions: { load: LoadHandler<T, ES> } } => {\n const loadActions: { load: Load<T, ES> } = {\n ...actions,\n /**\n * Loads data into the data store.\n * @param getState - Function to get the current state of the data store.\n * @param setState - Function to set the state of the data store.\n * @param dataPromise - The data promise to be loaded.\n * @returns A promise that resolves to the updated state of the data store.\n */\n load: async (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n ) => {\n const dataState: Partial<DataState<T, ES>> = getState()\n\n setState({ ...dataState, isLoading: true })\n\n try {\n const response: unknown = await dataPromise\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.data = response?.data || response\n } catch (error: unknown) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.error = error\n }\n return setState({ ...dataState, isLoading: false })\n },\n }\n\n return (createStore<DataState<T, ES>>({\n ...initialState,\n dataId,\n isLoading: false,\n } as Partial<DataState<T, ES>>, loadActions, reducer)) as StoreWithActions<DataState<T, ES>>\n & { actions: { load: LoadHandler<T, ES> } }\n}\n"],"names":["createDataStore","dataId","initialState","actions","reducer","loadActions","load","
|
|
1
|
+
{"version":3,"file":"store.vanillajs.templates.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.templates.ts"],"sourcesContent":["import { ActionHandler, Reducer, Store, StoreWithActions, createStore } from './store.vanillajs'\n\n\ntype DefaultES = { [key: string]: any }\n\n\nexport type DataState<T, ES = DefaultES> = {\n dataId: string\n isLoading: boolean\n error?: unknown\n data?: T\n} & ES\n\n\ntype Load<T, ES = DefaultES> = (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n\ntype LoadHandler<T, ES = DefaultES> = (\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n/**\n * Creates a data store with actions.\n * @param dataId - The ID of the data.\n * @param actions - Optional actions for the data store.\n * @returns The created data store with actions.\n */\nexport const createDataStore\n= <T, ES = DefaultES>(\n dataId: string,\n initialState?: Partial<ES>,\n actions?: Record<string, ActionHandler<DataState<T, ES>>>,\n reducer?: Reducer<DataState<T, ES>>,\n): StoreWithActions<DataState<T, ES>>\n& { actions: { load: LoadHandler<T, ES> } } => {\n const loadActions: { load: Load<T, ES> } = {\n ...actions,\n /**\n * Loads data into the data store.\n * @param getState - Function to get the current state of the data store.\n * @param setState - Function to set the state of the data store.\n * @param dataPromise - The data promise to be loaded.\n * @returns A promise that resolves to the updated state of the data store.\n */\n load: async (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n ) => {\n const dataState: Partial<DataState<T, ES>> = getState()\n\n setState({ ...dataState, isLoading: true })\n\n try {\n const response: unknown = await dataPromise\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.data = response?.data || response\n } catch (error: unknown) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.error = error\n }\n return setState({ ...dataState, isLoading: false })\n },\n }\n\n return (createStore<DataState<T, ES>>({\n ...initialState,\n dataId,\n isLoading: false,\n } as Partial<DataState<T, ES>>, loadActions, reducer)) as StoreWithActions<DataState<T, ES>>\n & { actions: { load: LoadHandler<T, ES> } }\n}\n"],"names":["createDataStore","dataId","initialState","actions","reducer","loadActions","load","_ref","_asyncToGenerator","getState","setState","dataPromise","dataState","isLoading","response","data","error","_x","_x2","_x3","apply","this","arguments","createStore"],"mappings":"2IA+BO,MAAMA,EACXA,CACAC,EACAC,EACAC,EACAC,KAGA,MAAMC,EAAqC,IACtCF,EAQHG,MAAIC,EAAAC,GAAE,UACJC,EACAC,EACAC,GAEA,MAAMC,EAAuCH,IAE7CC,EAAS,IAAKE,EAAWC,WAAW,IAEpC,IACE,MAAMC,QAA0BH,EAIhCC,EAAUG,MAAOD,aAAQ,EAARA,EAAUC,OAAQD,CACpC,CAAC,MAAOE,GAGPJ,EAAUI,MAAQA,CACpB,CACA,OAAON,EAAS,IAAKE,EAAWC,WAAW,OAC5C,SAAAI,EAAAC,EAAAC,GAAA,OAAAZ,EAAAa,MAAAC,KAAAC,UAAA,IArBG,IAAAf,EAwBN,OAAQgB,EAA8B,IACjCrB,EACHD,SACAY,WAAW,GACmBR,EAAaD,EAAQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const i=
|
|
1
|
+
import{asyncToGenerator as n}from"../../../../_virtual/_rollupPluginBabelHelpers.js";const i=function(){var i=n((function*(){try{var n,i;const e=(yield null===(n=navigator)||void 0===n||null===(n=n.mediaDevices)||void 0===n||null===(i=n.enumerateDevices)||void 0===i?void 0:i.call(n)).find((n=>"videoinput"===n.kind));return(null==e?void 0:e.deviceId)||(null==e?void 0:e.groupId)}catch(n){return null}}));return function(){return i.apply(this,arguments)}}();export{i as getDeviceId};
|
|
2
2
|
//# sourceMappingURL=deviceInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfo.js","sources":["../../../../../../../src/core/utils/helpers/deviceInfo.ts"],"sourcesContent":["export const getDeviceId = async (): Promise<string | null | undefined> => {\n try {\n const devices = await navigator?.mediaDevices?.enumerateDevices?.()\n const device = devices.find((device) => device.kind === 'videoinput')\n\n return device?.deviceId || device?.groupId\n } catch (error: any) {\n return null\n }\n}\n"],"names":["getDeviceId","
|
|
1
|
+
{"version":3,"file":"deviceInfo.js","sources":["../../../../../../../src/core/utils/helpers/deviceInfo.ts"],"sourcesContent":["export const getDeviceId = async (): Promise<string | null | undefined> => {\n try {\n const devices = await navigator?.mediaDevices?.enumerateDevices?.()\n const device = devices.find((device) => device.kind === 'videoinput')\n\n return device?.deviceId || device?.groupId\n } catch (error: any) {\n return null\n }\n}\n"],"names":["getDeviceId","_ref","_asyncToGenerator","_navigator","_navigator$enumerateD","device","navigator","mediaDevices","enumerateDevices","call","find","kind","deviceId","groupId","error","apply","this","arguments"],"mappings":"2FAAaA,EAAW,WAAA,IAAAC,EAAAC,GAAG,YACzB,IAAI,IAAAC,EAAAC,EACF,MACMC,SADyB,QAAlBF,EAASG,iBAAS,IAAAH,GAAc,QAAdA,EAATA,EAAWI,oBAAY,IAAAJ,GAAkB,QAAlBC,EAAvBD,EAAyBK,wBAAgB,IAAAJ,OAAA,EAAzCA,EAAAK,KAAAN,IACCO,MAAML,GAA2B,eAAhBA,EAAOM,OAE/C,OAAON,eAAAA,EAAQO,YAAYP,aAAAA,EAAAA,EAAQQ,QACpC,CAAC,MAAOC,GACP,OAAO,IACT,KACD,OAAA,WATuB,OAAAb,EAAAc,MAAAC,KAAAC,UAAA,CAAA,CAAA"}
|
package/dist/utils/index.css
CHANGED
|
@@ -28,6 +28,25 @@
|
|
|
28
28
|
width: var(--height);
|
|
29
29
|
height: var(--width);
|
|
30
30
|
}
|
|
31
|
+
.divider-module_divider-line__6CesR {
|
|
32
|
+
position: relative;
|
|
33
|
+
display: block;
|
|
34
|
+
transition: opacity, width, height 250ms ease-in-out;
|
|
35
|
+
background-color: var(--color);
|
|
36
|
+
opacity: var(--opacity);
|
|
37
|
+
}
|
|
38
|
+
.divider-module_divider-line__6CesR.divider-module_vertical__qSVWD {
|
|
39
|
+
height: var(--length);
|
|
40
|
+
left: var(--left);
|
|
41
|
+
width: var(--width);
|
|
42
|
+
margin: var(--margin);
|
|
43
|
+
}
|
|
44
|
+
.divider-module_divider-line__6CesR.divider-module_horizontal__Gz-Oj {
|
|
45
|
+
width: var(--length);
|
|
46
|
+
left: var(--left);
|
|
47
|
+
height: var(--height);
|
|
48
|
+
margin: var(--margin);
|
|
49
|
+
}
|
|
31
50
|
.CollapsibleContainer-module_collapsible-container__u0Jmm {
|
|
32
51
|
transform-origin: 0% 0%;
|
|
33
52
|
opacity: 0;
|
|
@@ -61,25 +80,6 @@
|
|
|
61
80
|
max-width: var(--prop-value);
|
|
62
81
|
opacity: 1;
|
|
63
82
|
}
|
|
64
|
-
.divider-module_divider-line__6CesR {
|
|
65
|
-
position: relative;
|
|
66
|
-
display: block;
|
|
67
|
-
transition: opacity, width, height 250ms ease-in-out;
|
|
68
|
-
background-color: var(--color);
|
|
69
|
-
opacity: var(--opacity);
|
|
70
|
-
}
|
|
71
|
-
.divider-module_divider-line__6CesR.divider-module_vertical__qSVWD {
|
|
72
|
-
height: var(--length);
|
|
73
|
-
left: var(--left);
|
|
74
|
-
width: var(--width);
|
|
75
|
-
margin: var(--margin);
|
|
76
|
-
}
|
|
77
|
-
.divider-module_divider-line__6CesR.divider-module_horizontal__Gz-Oj {
|
|
78
|
-
width: var(--length);
|
|
79
|
-
left: var(--left);
|
|
80
|
-
height: var(--height);
|
|
81
|
-
margin: var(--margin);
|
|
82
|
-
}
|
|
83
83
|
.layoutBox-module_layout-box__faPND {
|
|
84
84
|
display: flex;
|
|
85
85
|
position: relative;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");exports.createStore=(
|
|
1
|
+
"use strict";var e=require("../../../../../_virtual/_rollupPluginBabelHelpers.js");require("../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");exports.createStore=(r,t,o)=>{var n;let s=r;const l=new Set,u=()=>s,c=function(){var r=e.asyncToGenerator((function*(e){s=e;for(const e of l){const r=null==e?void 0:e.selector,t=r?r(s):s;void 0!==e.previousValue&&e.previousValue===t||(e.previousValue=t,yield e(t))}return s}));return function(e){return r.apply(this,arguments)}}(),i={getState:u,setState:c,subscribe:(e,r)=>{if(r&&e.selector&&e.selector!==r)throw new Error("Error, mismatchm selector, listener.selector !== selector.");return r&&!e.selector&&(e.selector=r),l.add(e),()=>l.delete(e)},unsubscribe:e=>{l.delete(e)}},a=t?null===(n=Object.entries(t))||void 0===n?void 0:n.reduce(((r,t)=>{let[n,s]=t;return{...r,[n]:e.asyncToGenerator((function*(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];const l=yield s(u,c,...r);return o&&c(o(u(),n,...r)),l}))}}),{}):null,d={...i,...a?{actions:{...a}}:{}};return d};
|
|
2
2
|
//# sourceMappingURL=store.vanillajs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\n// export type Selector<T> = (state: Partial<T>) => Partial<T>;\nexport type SelectedValueType<T> = Partial<T> | Partial<keyof T>\n| string | number | boolean | undefined | string[] | number[] | boolean[] | undefined[];\nexport type Selector<T> = (state: Partial<T>) => SelectedValueType<T>;\n\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: SelectedValueType<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @param selector - Optional selector function to transform the store state.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller<T> } }\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller<T> = (...args: unknown[]) => void | Partial<T> | Promise<void | Partial<T>>\n\n\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Record<string, ActionHandler<T>>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = () => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>) => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n const newValue: SelectedValueType<T> = selector ? selector(currentState) : currentState\n\n // TODO plugin equality\n if (listener.previousValue === undefined || listener.previousValue !== newValue) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue as Partial<T>)\n }\n }\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => {\n if (selector && listener.selector && listener.selector !== selector) {\n throw new Error('Error, mismatchm selector, listener.selector !== selector.')\n }\n if (selector && !listener.selector) {\n // eslint-disable-next-line no-param-reassign\n listener.selector = selector\n }\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Record<string, ActionHandlerCaller<T>> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller<T>>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: async(...rest: unknown[]) => {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n return resultOfAction\n },\n }),\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["createStore","initialState","actions","reducer","_Object$entries","currentState","listeners","Set","getState","setState","
|
|
1
|
+
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\n// export type Selector<T> = (state: Partial<T>) => Partial<T>;\nexport type SelectedValueType<T> = Partial<T> | Partial<keyof T>\n| string | number | boolean | undefined | string[] | number[] | boolean[] | undefined[];\nexport type Selector<T> = (state: Partial<T>) => SelectedValueType<T>;\n\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: SelectedValueType<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @param selector - Optional selector function to transform the store state.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller<T> } }\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller<T> = (...args: unknown[]) => void | Partial<T> | Promise<void | Partial<T>>\n\n\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Record<string, ActionHandler<T>>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = () => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>) => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n const newValue: SelectedValueType<T> = selector ? selector(currentState) : currentState\n\n // TODO plugin equality\n if (listener.previousValue === undefined || listener.previousValue !== newValue) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue as Partial<T>)\n }\n }\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => {\n if (selector && listener.selector && listener.selector !== selector) {\n throw new Error('Error, mismatchm selector, listener.selector !== selector.')\n }\n if (selector && !listener.selector) {\n // eslint-disable-next-line no-param-reassign\n listener.selector = selector\n }\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Record<string, ActionHandlerCaller<T>> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller<T>>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: async(...rest: unknown[]) => {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n return resultOfAction\n },\n }),\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["createStore","initialState","actions","reducer","_Object$entries","currentState","listeners","Set","getState","setState","_ref","_asyncToGenerator","newState","listener","selector","newValue","undefined","previousValue","_x","apply","this","arguments","storeBaseicApi","subscribe","Error","add","delete","unsubscribe","resolvedActions","Object","entries","reduce","aggregator","_ref2","actionName","actionHandler","_len","length","rest","Array","_key","resultOfAction","storeCombinedWithActions"],"mappings":"8LA2F2BA,CACzBC,EACAC,EACAC,KACmC,IAAAC,EACnC,IAAIC,EAA2BJ,EAC/B,MAAMK,EAAY,IAAIC,IAMhBC,EAAWA,IAAMH,EAQjBI,EAAQ,WAAA,IAAAC,EAAAC,oBAAG,UAAOC,GACtBP,EAAeO,EAGf,IAAK,MAAMC,KAAYP,EAAW,CAEhC,MAAMQ,EAAoCD,aAAAA,EAAAA,EAAUC,SAM9CC,EAAiCD,EAAWA,EAAST,GAAgBA,OAG5CW,IAA3BH,EAASI,eAA+BJ,EAASI,gBAAkBF,IACrEF,EAASI,cAAgBF,QAEnBF,EAASE,GAEnB,CACA,OAAOV,KACR,OAtBKI,SAAQS,GAAA,OAAAR,EAAAS,MAAAC,KAAAC,UAAA,EAAA,GA2BRC,EAA2B,CAK/Bd,WAMAC,WAMAc,UAAWA,CAACV,EAAuBC,KACjC,GAAIA,GAAYD,EAASC,UAAYD,EAASC,WAAaA,EACzD,MAAM,IAAIU,MAAM,8DAOlB,OALIV,IAAaD,EAASC,WAExBD,EAASC,SAAWA,GAEtBR,EAAUmB,IAAIZ,GACP,IAAMP,EAAUoB,OAAOb,EAAS,EAMzCc,YAAcd,IACZP,EAAUoB,OAAOb,EAAS,GAOxBe,EACF1B,EAAiCE,QAA1BA,EAAGyB,OAAOC,QAAQ5B,cAAQE,SAAvBA,EAAyB2B,QACnC,CACEC,EAAkDC,KAAA,IACjDC,EAAYC,GAA0CF,EAAA,MACnD,IACDD,EACHE,CAACA,GAAUvB,EAAAA,kBAAG,YAA6B,IAAA,IAAAyB,EAAAf,UAAAgB,OAApBC,EAAIC,IAAAA,MAAAH,GAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAAJF,EAAIE,GAAAnB,UAAAmB,GACzB,MAAMC,QAAuBN,EAAc3B,EAAUC,KAAa6B,GAKlE,OAHInC,GACFM,EAASN,EAAQK,IAAY0B,KAAeI,IAEvCG,KAEV,GACD,CAAA,GACE,KAKAC,EAA2B,IAC5BpB,KACCM,EAAkB,CAAE1B,QAAS,IAAK0B,IAAsB,CAAE,GAGhE,OACIc,CACoC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var r=require("../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("./store.vanillajs.js");exports.createDataStore=(a,e,n,o)=>{const i={...n,load:(s=r.asyncToGenerator((function*(r,t,a){const e=r();t({...e,isLoading:!0});try{const r=yield a;e.data=(null==r?void 0:r.data)||r}catch(r){e.error=r}return t({...e,isLoading:!1})})),function(r,t,a){return s.apply(this,arguments)})};var s;return t.createStore({...e,dataId:a,isLoading:!1},i,o)};
|
|
2
2
|
//# sourceMappingURL=store.vanillajs.templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.templates.js","sources":["../../../../../../../src/core/utils/appState/store/store.vanillajs.templates.ts"],"sourcesContent":["import { ActionHandler, Reducer, Store, StoreWithActions, createStore } from './store.vanillajs'\n\n\ntype DefaultES = { [key: string]: any }\n\n\nexport type DataState<T, ES = DefaultES> = {\n dataId: string\n isLoading: boolean\n error?: unknown\n data?: T\n} & ES\n\n\ntype Load<T, ES = DefaultES> = (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n\ntype LoadHandler<T, ES = DefaultES> = (\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n/**\n * Creates a data store with actions.\n * @param dataId - The ID of the data.\n * @param actions - Optional actions for the data store.\n * @returns The created data store with actions.\n */\nexport const createDataStore\n= <T, ES = DefaultES>(\n dataId: string,\n initialState?: Partial<ES>,\n actions?: Record<string, ActionHandler<DataState<T, ES>>>,\n reducer?: Reducer<DataState<T, ES>>,\n): StoreWithActions<DataState<T, ES>>\n& { actions: { load: LoadHandler<T, ES> } } => {\n const loadActions: { load: Load<T, ES> } = {\n ...actions,\n /**\n * Loads data into the data store.\n * @param getState - Function to get the current state of the data store.\n * @param setState - Function to set the state of the data store.\n * @param dataPromise - The data promise to be loaded.\n * @returns A promise that resolves to the updated state of the data store.\n */\n load: async (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n ) => {\n const dataState: Partial<DataState<T, ES>> = getState()\n\n setState({ ...dataState, isLoading: true })\n\n try {\n const response: unknown = await dataPromise\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.data = response?.data || response\n } catch (error: unknown) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.error = error\n }\n return setState({ ...dataState, isLoading: false })\n },\n }\n\n return (createStore<DataState<T, ES>>({\n ...initialState,\n dataId,\n isLoading: false,\n } as Partial<DataState<T, ES>>, loadActions, reducer)) as StoreWithActions<DataState<T, ES>>\n & { actions: { load: LoadHandler<T, ES> } }\n}\n"],"names":["createDataStore","dataId","initialState","actions","reducer","loadActions","load","
|
|
1
|
+
{"version":3,"file":"store.vanillajs.templates.js","sources":["../../../../../../../src/core/utils/appState/store/store.vanillajs.templates.ts"],"sourcesContent":["import { ActionHandler, Reducer, Store, StoreWithActions, createStore } from './store.vanillajs'\n\n\ntype DefaultES = { [key: string]: any }\n\n\nexport type DataState<T, ES = DefaultES> = {\n dataId: string\n isLoading: boolean\n error?: unknown\n data?: T\n} & ES\n\n\ntype Load<T, ES = DefaultES> = (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n\ntype LoadHandler<T, ES = DefaultES> = (\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n/**\n * Creates a data store with actions.\n * @param dataId - The ID of the data.\n * @param actions - Optional actions for the data store.\n * @returns The created data store with actions.\n */\nexport const createDataStore\n= <T, ES = DefaultES>(\n dataId: string,\n initialState?: Partial<ES>,\n actions?: Record<string, ActionHandler<DataState<T, ES>>>,\n reducer?: Reducer<DataState<T, ES>>,\n): StoreWithActions<DataState<T, ES>>\n& { actions: { load: LoadHandler<T, ES> } } => {\n const loadActions: { load: Load<T, ES> } = {\n ...actions,\n /**\n * Loads data into the data store.\n * @param getState - Function to get the current state of the data store.\n * @param setState - Function to set the state of the data store.\n * @param dataPromise - The data promise to be loaded.\n * @returns A promise that resolves to the updated state of the data store.\n */\n load: async (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n ) => {\n const dataState: Partial<DataState<T, ES>> = getState()\n\n setState({ ...dataState, isLoading: true })\n\n try {\n const response: unknown = await dataPromise\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.data = response?.data || response\n } catch (error: unknown) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.error = error\n }\n return setState({ ...dataState, isLoading: false })\n },\n }\n\n return (createStore<DataState<T, ES>>({\n ...initialState,\n dataId,\n isLoading: false,\n } as Partial<DataState<T, ES>>, loadActions, reducer)) as StoreWithActions<DataState<T, ES>>\n & { actions: { load: LoadHandler<T, ES> } }\n}\n"],"names":["createDataStore","dataId","initialState","actions","reducer","loadActions","load","_ref","_asyncToGenerator","asyncToGenerator","getState","setState","dataPromise","dataState","isLoading","response","data","error","_x","_x2","_x3","apply","this","arguments","createStore"],"mappings":"6IAgCEA,CACAC,EACAC,EACAC,EACAC,KAGA,MAAMC,EAAqC,IACtCF,EAQHG,MAAIC,EAAAC,EAAAC,kBAAE,UACJC,EACAC,EACAC,GAEA,MAAMC,EAAuCH,IAE7CC,EAAS,IAAKE,EAAWC,WAAW,IAEpC,IACE,MAAMC,QAA0BH,EAIhCC,EAAUG,MAAOD,aAAQ,EAARA,EAAUC,OAAQD,CACpC,CAAC,MAAOE,GAGPJ,EAAUI,MAAQA,CACpB,CACA,OAAON,EAAS,IAAKE,EAAWC,WAAW,OAC5C,SAAAI,EAAAC,EAAAC,GAAA,OAAAb,EAAAc,MAAAC,KAAAC,UAAA,IArBG,IAAAhB,EAwBN,OAAQiB,cAA8B,IACjCtB,EACHD,SACAa,WAAW,GACmBT,EAAaD,EAAQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js");const n=function(){var n=e.asyncToGenerator((function*(){try{var e,n;const i=(yield null===(e=navigator)||void 0===e||null===(e=e.mediaDevices)||void 0===e||null===(n=e.enumerateDevices)||void 0===n?void 0:n.call(e)).find((e=>"videoinput"===e.kind));return(null==i?void 0:i.deviceId)||(null==i?void 0:i.groupId)}catch(e){return null}}));return function(){return n.apply(this,arguments)}}();exports.getDeviceId=n;
|
|
2
2
|
//# sourceMappingURL=deviceInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfo.js","sources":["../../../../../../src/core/utils/helpers/deviceInfo.ts"],"sourcesContent":["export const getDeviceId = async (): Promise<string | null | undefined> => {\n try {\n const devices = await navigator?.mediaDevices?.enumerateDevices?.()\n const device = devices.find((device) => device.kind === 'videoinput')\n\n return device?.deviceId || device?.groupId\n } catch (error: any) {\n return null\n }\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"deviceInfo.js","sources":["../../../../../../src/core/utils/helpers/deviceInfo.ts"],"sourcesContent":["export const getDeviceId = async (): Promise<string | null | undefined> => {\n try {\n const devices = await navigator?.mediaDevices?.enumerateDevices?.()\n const device = devices.find((device) => device.kind === 'videoinput')\n\n return device?.deviceId || device?.groupId\n } catch (error: any) {\n return null\n }\n}\n"],"names":["getDeviceId","_ref","_asyncToGenerator","_navigator","_navigator$enumerateD","device","navigator","mediaDevices","enumerateDevices","call","find","kind","deviceId","groupId","error","apply","this","arguments"],"mappings":"sFAAaA,EAAW,WAAA,IAAAC,EAAAC,EAAAA,kBAAG,YACzB,IAAI,IAAAC,EAAAC,EACF,MACMC,SADyB,QAAlBF,EAASG,iBAAS,IAAAH,GAAc,QAAdA,EAATA,EAAWI,oBAAY,IAAAJ,GAAkB,QAAlBC,EAAvBD,EAAyBK,wBAAgB,IAAAJ,OAAA,EAAzCA,EAAAK,KAAAN,IACCO,MAAML,GAA2B,eAAhBA,EAAOM,OAE/C,OAAON,eAAAA,EAAQO,YAAYP,aAAAA,EAAAA,EAAQQ,QACpC,CAAC,MAAOC,GACP,OAAO,IACT,KACD,OAAA,WATuB,OAAAb,EAAAc,MAAAC,KAAAC,UAAA,CAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e1011/es-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.196",
|
|
4
4
|
"main": "dist/lib/cjs/src/index.js",
|
|
5
5
|
"module": "dist/lib/esm/src/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -104,6 +104,7 @@
|
|
|
104
104
|
"babel-plugin-react-html-attrs": "^3.0.5",
|
|
105
105
|
"babel-plugin-styled-components": "^2.1.4",
|
|
106
106
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
107
|
+
"babel-plugin-transform-typescript-metadata": "^0.3.2",
|
|
107
108
|
"husky": "^7.0.4",
|
|
108
109
|
"identity-obj-proxy": "^3.0.0",
|
|
109
110
|
"jest": "^29.3.1",
|