@plitzi/sdk-shared 0.32.1 → 0.32.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/dataSource/getBindingsDetails.d.ts +10 -0
- package/dist/dataSource/getBindingsDetails.mjs +49 -0
- package/dist/dataSource/hooks/useRegisterSource.mjs +1 -1
- package/dist/dataSource/index.d.ts +2 -0
- package/dist/dataSource/index.mjs +3 -1
- package/dist/dataSource/utility/arrayMap.d.ts +6 -0
- package/dist/dataSource/utility/arrayMap.mjs +28 -0
- package/dist/dataSource/utility/capitalize.d.ts +3 -0
- package/dist/dataSource/utility/capitalize.mjs +11 -0
- package/dist/dataSource/utility/dateConverter.d.ts +3 -0
- package/dist/dataSource/utility/dateConverter.mjs +60 -0
- package/dist/dataSource/utility/index.d.ts +7 -0
- package/dist/dataSource/utility/index.mjs +22 -0
- package/dist/dataSource/utility/staticValue.d.ts +3 -0
- package/dist/dataSource/utility/staticValue.mjs +47 -0
- package/dist/dataSource/utility/stringToArray.d.ts +3 -0
- package/dist/dataSource/utility/stringToArray.mjs +20 -0
- package/dist/dataSource/utility/styleSelector.d.ts +3 -0
- package/dist/dataSource/utility/styleSelector.mjs +42 -0
- package/dist/dataSource/utility/twigTemplate.d.ts +3 -0
- package/dist/dataSource/utility/twigTemplate.mjs +26 -0
- package/dist/devTools/utils/PlitziConsole.mjs +30 -17
- package/dist/elements/index.d.ts +1 -5
- package/dist/elements/index.mjs +1 -3
- package/dist/helpers/security.mjs +2 -1
- package/dist/hooks/useNetwork.d.ts +2 -1
- package/dist/hooks/useNetwork.mjs +21 -23
- package/dist/hooks/usePlitziServiceContext.d.ts +1 -1
- package/dist/index.mjs +23 -24
- package/dist/server/index.d.ts +1 -3
- package/dist/server/index.mjs +2 -3
- package/dist/server/rsc/RscProvider.d.ts +1 -1
- package/dist/server/rsc/RscProvider.mjs +22 -22
- package/dist/store/index.d.ts +193 -0
- package/dist/store/index.mjs +5 -0
- package/dist/store/tracing/index.d.ts +8 -0
- package/dist/store/tracing/index.mjs +6 -0
- package/dist/store/tracing/preview.d.ts +3 -0
- package/dist/store/tracing/preview.mjs +38 -0
- package/dist/store/tracing/tracingCollector.d.ts +17 -0
- package/dist/store/tracing/tracingCollector.mjs +85 -0
- package/dist/store/tracing/tracingMiddleware.d.ts +2 -0
- package/dist/store/tracing/tracingMiddleware.mjs +5 -0
- package/dist/store/tracing/tracingStore.d.ts +6 -0
- package/dist/store/tracing/tracingStore.mjs +10 -0
- package/dist/store/tracing/useTracing.d.ts +6 -0
- package/dist/store/tracing/useTracing.mjs +13 -0
- package/dist/theme/ThemeProvider.d.ts +1 -1
- package/dist/types/CommonTypes.d.ts +1 -0
- package/dist/types/ServerTypes.d.ts +10 -2
- package/dist/types/StoreTypes.d.ts +39 -0
- package/dist/websockets/RTCodec.mjs +1 -1
- package/package.json +103 -38
- package/setupTests.ts +4 -0
- package/dist/elements/ElementContext.d.ts +0 -19
- package/dist/elements/ElementContext.mjs +0 -6
- package/dist/elements/hooks/useElement.d.ts +0 -3
- package/dist/elements/hooks/useElement.mjs +0 -10
- package/dist/server/hooks/useRscData.d.ts +0 -14
- package/dist/server/hooks/useRscData.mjs +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @plitzi/sdk-shared
|
|
2
2
|
|
|
3
|
+
## 0.32.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- v0.32.3
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @plitzi/nexus@0.32.3
|
|
10
|
+
|
|
11
|
+
## 0.32.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- v0.32.2
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @plitzi/nexus@0.32.2
|
|
18
|
+
|
|
3
19
|
## 0.32.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Element } from '../types';
|
|
2
|
+
import { RuleValue } from '@plitzi/plitzi-ui/QueryBuilder';
|
|
3
|
+
declare const getBindingsDetails: (dataSource: Record<string, RuleValue>, element: Element, style?: Record<string, string>) => {
|
|
4
|
+
attributes: Record<string, unknown> & {
|
|
5
|
+
subType?: string;
|
|
6
|
+
};
|
|
7
|
+
style: Record<string, string>;
|
|
8
|
+
definition: import('..').ElementDefinition;
|
|
9
|
+
};
|
|
10
|
+
export default getBindingsDetails;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import e from "./utility/index.mjs";
|
|
2
|
+
import { camelCase as t, get as n, set as r } from "@plitzi/plitzi-ui";
|
|
3
|
+
import { QueryBuilderEvaluator as i } from "@plitzi/plitzi-ui/QueryBuilder";
|
|
4
|
+
import { produce as a } from "immer";
|
|
5
|
+
//#region src/dataSource/getBindingsDetails.ts
|
|
6
|
+
var o = (e, t, r, i, a, o) => {
|
|
7
|
+
let s = r && t ? `${t}.${r}` : void 0, c = a === "initialState" ? `definition.${a}.${o}` : `${a}.${o}`;
|
|
8
|
+
return {
|
|
9
|
+
fromValue: s ? n(e, s, n(i, c)) : void 0,
|
|
10
|
+
toValue: n(i, c, s ? n(e, s) : void 0)
|
|
11
|
+
};
|
|
12
|
+
}, s = (s, c, l = {}) => {
|
|
13
|
+
let { attributes: u, definition: d } = c, { bindings: f } = d;
|
|
14
|
+
return !f || typeof f == "object" && !Object.keys(f).length ? {
|
|
15
|
+
attributes: u,
|
|
16
|
+
style: {},
|
|
17
|
+
definition: d
|
|
18
|
+
} : a({
|
|
19
|
+
attributes: u,
|
|
20
|
+
style: l,
|
|
21
|
+
definition: d
|
|
22
|
+
}, (a) => {
|
|
23
|
+
Object.keys(f).forEach((c) => {
|
|
24
|
+
!f[c] || !Array.isArray(f[c]) || !f[c].length || f[c].forEach((l) => {
|
|
25
|
+
let { source: u, fromPath: d, transformers: f, when: p, enabled: m = !0 } = l, { toPath: h } = l;
|
|
26
|
+
if (!h || p && !i(p, s, !1, !0) || !m) return;
|
|
27
|
+
c === "style" && (h = t(h));
|
|
28
|
+
let { fromValue: g, toValue: _ } = o(s, u, d, a, c, h), v = g;
|
|
29
|
+
f && Array.isArray(f) && f.length > 0 && f.forEach((t) => {
|
|
30
|
+
let { type: r, action: i, params: o } = t;
|
|
31
|
+
switch (r) {
|
|
32
|
+
case "utility": {
|
|
33
|
+
let t = n(e, `${i}.callback`);
|
|
34
|
+
if (typeof t != "function") break;
|
|
35
|
+
v = t(v, o, a, {
|
|
36
|
+
...s,
|
|
37
|
+
sourceTo: _
|
|
38
|
+
});
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
default:
|
|
42
|
+
}
|
|
43
|
+
}), (typeof v == "boolean" || typeof v == "number" || v) && (c === "initialState" ? r(a, `definition.${c}.${h}`, v) : r(a, `${c}.${h}`, v));
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { s as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { makeId as e } from "../../helpers/utils.mjs";
|
|
2
2
|
import { useEffect as t, useMemo as n } from "react";
|
|
3
3
|
import { omit as r } from "@plitzi/plitzi-ui/helpers";
|
|
4
|
-
import { createStoreHook as i } from "@plitzi/nexus/
|
|
4
|
+
import { createStoreHook as i } from "@plitzi/nexus/react";
|
|
5
5
|
//#region src/dataSource/hooks/useRegisterSource.ts
|
|
6
6
|
var a = ({ id: a = "", source: o, name: s, fields: c = [] }) => {
|
|
7
7
|
let { useStoreSetter: l } = i(), u = l(), d = n(() => `${a}_${e(8)}`, [a]);
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import e from "./hooks/useRegisterSource.mjs";
|
|
2
|
-
|
|
2
|
+
import t, { utilityOptions as n } from "./utility/index.mjs";
|
|
3
|
+
import r from "./getBindingsDetails.mjs";
|
|
4
|
+
export { r as getBindingsDetails, e as useRegisterSource, t as utility, n as utilityOptions };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { get as e, set as t } from "@plitzi/plitzi-ui/helpers";
|
|
2
|
+
var n = {
|
|
3
|
+
action: "arrayMap",
|
|
4
|
+
title: "Array Map",
|
|
5
|
+
type: "utility",
|
|
6
|
+
params: { keys: {
|
|
7
|
+
defaultValue: "[{\"from\": \"\", \"to\": \"\"}]",
|
|
8
|
+
type: "textarea"
|
|
9
|
+
} },
|
|
10
|
+
preview: { sourceParsed: "" },
|
|
11
|
+
callback: (n, r) => {
|
|
12
|
+
let { keys: i } = r;
|
|
13
|
+
if (!Array.isArray(n)) return n;
|
|
14
|
+
try {
|
|
15
|
+
typeof i == "string" && (i = JSON.parse(i));
|
|
16
|
+
} catch {
|
|
17
|
+
return n;
|
|
18
|
+
}
|
|
19
|
+
return n.map((n) => {
|
|
20
|
+
let r = {};
|
|
21
|
+
return i.forEach((i) => {
|
|
22
|
+
typeof i == "object" && i.from && i.to && t(r, i.to, e(n, i.from, ""));
|
|
23
|
+
}), r;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { n as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { capitalize as e } from "@plitzi/plitzi-ui/helpers";
|
|
2
|
+
var t = {
|
|
3
|
+
action: "capitalize",
|
|
4
|
+
title: "Capitalize",
|
|
5
|
+
type: "utility",
|
|
6
|
+
params: {},
|
|
7
|
+
preview: { content: "" },
|
|
8
|
+
callback: (t) => typeof t == "string" ? e(t) : t
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as default };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { formatDate as e, formatDateUTC as t, formatFromNow as n, parseDate as r } from "../../helpers/formatDate.mjs";
|
|
2
|
+
var i = {
|
|
3
|
+
action: "dateConverter",
|
|
4
|
+
title: "Date Converter",
|
|
5
|
+
type: "utility",
|
|
6
|
+
params: {
|
|
7
|
+
format: {
|
|
8
|
+
defaultValue: "dd/MM/yyyy",
|
|
9
|
+
type: "text"
|
|
10
|
+
},
|
|
11
|
+
asAge: {
|
|
12
|
+
defaultValue: !1,
|
|
13
|
+
type: "checkbox"
|
|
14
|
+
},
|
|
15
|
+
isUnix: {
|
|
16
|
+
defaultValue: !0,
|
|
17
|
+
type: "checkbox"
|
|
18
|
+
},
|
|
19
|
+
isUtc: {
|
|
20
|
+
defaultValue: !1,
|
|
21
|
+
type: "checkbox"
|
|
22
|
+
},
|
|
23
|
+
locale: {
|
|
24
|
+
defaultValue: "en",
|
|
25
|
+
type: "select",
|
|
26
|
+
options: [
|
|
27
|
+
{
|
|
28
|
+
label: "en",
|
|
29
|
+
value: "en"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "es",
|
|
33
|
+
value: "es"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "pt",
|
|
37
|
+
value: "pt"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
preview: {
|
|
43
|
+
format: "",
|
|
44
|
+
asAge: "",
|
|
45
|
+
isUnix: "",
|
|
46
|
+
isUtc: "",
|
|
47
|
+
locale: ""
|
|
48
|
+
},
|
|
49
|
+
callback: (i, { format: a = "dd/MM/yyyy", asAge: o = !1, isUnix: s = !0, isUtc: c = !1, locale: l = "en" }) => {
|
|
50
|
+
if (typeof i != "string" && typeof i != "number") return i;
|
|
51
|
+
try {
|
|
52
|
+
let u = r(s ? Number(i) : i);
|
|
53
|
+
return isNaN(u.getTime()) ? i : o ? n(u, l, { addSuffix: !0 }) : c ? t(u, a, l) : e(u, a, l);
|
|
54
|
+
} catch {
|
|
55
|
+
return i;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
export { i as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import e from "./arrayMap.mjs";
|
|
2
|
+
import t from "./capitalize.mjs";
|
|
3
|
+
import n from "./dateConverter.mjs";
|
|
4
|
+
import r from "./staticValue.mjs";
|
|
5
|
+
import i from "./stringToArray.mjs";
|
|
6
|
+
import a from "./styleSelector.mjs";
|
|
7
|
+
import o from "./twigTemplate.mjs";
|
|
8
|
+
//#region src/dataSource/utility/index.ts
|
|
9
|
+
var s = {
|
|
10
|
+
twigTemplate: o,
|
|
11
|
+
dateConverter: n,
|
|
12
|
+
staticValue: r,
|
|
13
|
+
capitalize: t,
|
|
14
|
+
arrayMap: e,
|
|
15
|
+
stringToArray: i,
|
|
16
|
+
styleSelector: a
|
|
17
|
+
}, c = Object.values(s).map(({ title: e, action: t }) => ({
|
|
18
|
+
label: e,
|
|
19
|
+
value: t
|
|
20
|
+
}));
|
|
21
|
+
//#endregion
|
|
22
|
+
export { s as default, c as utilityOptions };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var e = {
|
|
2
|
+
action: "staticValue",
|
|
3
|
+
title: "Static Value",
|
|
4
|
+
type: "utility",
|
|
5
|
+
params: {
|
|
6
|
+
valueType: {
|
|
7
|
+
label: "Value Type",
|
|
8
|
+
defaultValue: "text",
|
|
9
|
+
type: "select",
|
|
10
|
+
options: [
|
|
11
|
+
{
|
|
12
|
+
label: "Text",
|
|
13
|
+
value: "text"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: "Long Text",
|
|
17
|
+
value: "textarea"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: "Boolean",
|
|
21
|
+
value: "select"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
value: {
|
|
26
|
+
defaultValue: "",
|
|
27
|
+
type: ({ valueType: e }) => e,
|
|
28
|
+
options: [{
|
|
29
|
+
label: "True",
|
|
30
|
+
value: "true"
|
|
31
|
+
}, {
|
|
32
|
+
label: "False",
|
|
33
|
+
value: "false"
|
|
34
|
+
}]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
preview: {
|
|
38
|
+
valueType: "",
|
|
39
|
+
value: ""
|
|
40
|
+
},
|
|
41
|
+
callback: (e, t) => {
|
|
42
|
+
let { valueType: n, value: r } = t;
|
|
43
|
+
return n === "select" ? r === "true" : r;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { e as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var e = {
|
|
2
|
+
action: "stringToArray",
|
|
3
|
+
title: "Text to List",
|
|
4
|
+
type: "utility",
|
|
5
|
+
params: { separator: {
|
|
6
|
+
label: "Separator",
|
|
7
|
+
defaultValue: ",",
|
|
8
|
+
type: "text"
|
|
9
|
+
} },
|
|
10
|
+
preview: {
|
|
11
|
+
valueType: "",
|
|
12
|
+
value: ""
|
|
13
|
+
},
|
|
14
|
+
callback: (e, t) => {
|
|
15
|
+
let { separator: n } = t;
|
|
16
|
+
return console.log(e, t), typeof e == "string" ? e.split(n).map((e) => e.trim()) : e;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { e as default };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { get as e } from "@plitzi/plitzi-ui/helpers";
|
|
2
|
+
var t = {
|
|
3
|
+
action: "styleSelector",
|
|
4
|
+
title: "Style Selector",
|
|
5
|
+
type: "utility",
|
|
6
|
+
params: {
|
|
7
|
+
originalSelector: {
|
|
8
|
+
label: "Original Selector",
|
|
9
|
+
description: "This will append the original selector (require append option enabled)",
|
|
10
|
+
defaultValue: !1,
|
|
11
|
+
disabled: ({ append: e }) => !e,
|
|
12
|
+
type: "checkbox"
|
|
13
|
+
},
|
|
14
|
+
append: {
|
|
15
|
+
label: "Append Selector",
|
|
16
|
+
defaultValue: !1,
|
|
17
|
+
type: "checkbox"
|
|
18
|
+
},
|
|
19
|
+
selector: {
|
|
20
|
+
label: "Selector",
|
|
21
|
+
defaultValue: "",
|
|
22
|
+
type: "select",
|
|
23
|
+
options: []
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
preview: {
|
|
27
|
+
append: "",
|
|
28
|
+
originalSelector: "",
|
|
29
|
+
selector: ""
|
|
30
|
+
},
|
|
31
|
+
callback: (t, n, r, i = {}) => {
|
|
32
|
+
let { originalSelector: a, append: o, selector: s } = n, c = [];
|
|
33
|
+
if (o && !a && i.sourceTo) c.push(i.sourceTo, s);
|
|
34
|
+
else if (a && o) {
|
|
35
|
+
let t = e(r, "definition.styleSelectors.base", "");
|
|
36
|
+
t ? c.push(t, s) : c.push(s);
|
|
37
|
+
}
|
|
38
|
+
return c.length ? c.length === 1 ? c[0] : c.join(" ") : "";
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { t as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { processTwig as e } from "../../helpers/twigWrapper.mjs";
|
|
2
|
+
var t = {
|
|
3
|
+
action: "twigTemplate",
|
|
4
|
+
title: "Twig Template",
|
|
5
|
+
type: "utility",
|
|
6
|
+
params: { template: {
|
|
7
|
+
label: "Template",
|
|
8
|
+
defaultValue: "Tokens {{source}} from the value selected to bind previously, {{sourceTo}} is your original value, other tokens via autocomplete",
|
|
9
|
+
type: "codemirror-text"
|
|
10
|
+
} },
|
|
11
|
+
preview: { template: "" },
|
|
12
|
+
callback: (t, n, r, i = {}) => {
|
|
13
|
+
let { template: a } = n, o = t;
|
|
14
|
+
try {
|
|
15
|
+
o = e(a, {
|
|
16
|
+
source: t,
|
|
17
|
+
...i
|
|
18
|
+
});
|
|
19
|
+
} catch {
|
|
20
|
+
o = t;
|
|
21
|
+
}
|
|
22
|
+
return o;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { t as default };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { formatDate as e } from "../../helpers/formatDate.mjs";
|
|
2
|
-
import t from "@plitzi/nexus/helpers/getByPath";
|
|
3
2
|
//#region src/devTools/utils/PlitziConsole.ts
|
|
4
|
-
var
|
|
3
|
+
var t = class {
|
|
5
4
|
callbackInternal;
|
|
6
5
|
callbackAddProvider;
|
|
7
6
|
callbackRemoveProvider;
|
|
@@ -12,6 +11,8 @@ var n = class {
|
|
|
12
11
|
listeningCategory;
|
|
13
12
|
logsListened = [];
|
|
14
13
|
listeningParams;
|
|
14
|
+
#e = [];
|
|
15
|
+
#t = !1;
|
|
15
16
|
constructor(e, t = 100) {
|
|
16
17
|
this.callbackInternal = e, this.pendingLimit = t;
|
|
17
18
|
}
|
|
@@ -33,7 +34,7 @@ var n = class {
|
|
|
33
34
|
flush(e = !1) {
|
|
34
35
|
this.logsListened = [], e && (this.pendingLogs = []);
|
|
35
36
|
}
|
|
36
|
-
#
|
|
37
|
+
#n(e, t, n, r) {
|
|
37
38
|
let i = this.getTime(!0);
|
|
38
39
|
if (!this.callbackInternal) {
|
|
39
40
|
this.pendingLogs.push({
|
|
@@ -51,7 +52,20 @@ var n = class {
|
|
|
51
52
|
message: n,
|
|
52
53
|
params: r,
|
|
53
54
|
time: i
|
|
54
|
-
}) : this
|
|
55
|
+
}) : (this.#e.push({
|
|
56
|
+
logType: e,
|
|
57
|
+
category: t,
|
|
58
|
+
message: n,
|
|
59
|
+
params: r,
|
|
60
|
+
time: i
|
|
61
|
+
}), this.#r()), this.logsListened.length > this.logsListenedLimit && this.logsListened.shift();
|
|
62
|
+
}
|
|
63
|
+
#r() {
|
|
64
|
+
this.#t || (this.#t = !0, queueMicrotask(() => {
|
|
65
|
+
this.#t = !1;
|
|
66
|
+
let e = this.callbackInternal, t = this.#e;
|
|
67
|
+
if (this.#e = [], e) for (let n of t) e(n.logType, n.category, n.message, n.params, n.time);
|
|
68
|
+
}));
|
|
55
69
|
}
|
|
56
70
|
addProviderMethod(e, t) {
|
|
57
71
|
this.callbackAddProvider?.(e, t);
|
|
@@ -64,16 +78,16 @@ var n = class {
|
|
|
64
78
|
return t ? e(n, "HH:mm:ss.SSS") : n;
|
|
65
79
|
}
|
|
66
80
|
info(e, t, n) {
|
|
67
|
-
this.#
|
|
81
|
+
this.#n("info", e, t, n);
|
|
68
82
|
}
|
|
69
83
|
warning(e, t, n) {
|
|
70
|
-
this.#
|
|
84
|
+
this.#n("warning", e, t, n);
|
|
71
85
|
}
|
|
72
86
|
danger(e, t, n) {
|
|
73
|
-
this.#
|
|
87
|
+
this.#n("danger", e, t, n);
|
|
74
88
|
}
|
|
75
89
|
success(e, t, n) {
|
|
76
|
-
this.#
|
|
90
|
+
this.#n("success", e, t, n);
|
|
77
91
|
}
|
|
78
92
|
begin(e) {
|
|
79
93
|
this.listening = !0, this.listeningParams = { category: e };
|
|
@@ -81,17 +95,16 @@ var n = class {
|
|
|
81
95
|
end() {
|
|
82
96
|
this.listening = !1, this.listeningCategory && this.logsListened.length > 0 && this.callbackInternal?.("info", this.listeningCategory, `${this.logsListened.length} Log${this.logsListened.length === 1 ? "" : "s"}`, { logs: this.logsListened }), this.logsListened = [], this.listeningCategory = void 0;
|
|
83
97
|
}
|
|
84
|
-
},
|
|
85
|
-
function
|
|
86
|
-
return ({ path:
|
|
87
|
-
|
|
88
|
-
r.info("store", e, {
|
|
98
|
+
}, n = new t();
|
|
99
|
+
function r(e = "store") {
|
|
100
|
+
return ({ path: t, prevValue: r, nextValue: i }) => {
|
|
101
|
+
n.info("store", e, {
|
|
89
102
|
storeName: e,
|
|
90
|
-
path:
|
|
91
|
-
prev:
|
|
92
|
-
next:
|
|
103
|
+
path: t,
|
|
104
|
+
prev: r,
|
|
105
|
+
next: i
|
|
93
106
|
});
|
|
94
107
|
};
|
|
95
108
|
}
|
|
96
109
|
//#endregion
|
|
97
|
-
export {
|
|
110
|
+
export { r as createStoreDevToolsLogger, t as default, n as pConsole };
|
package/dist/elements/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { default as ComponentContext } from './ComponentContext';
|
|
2
|
-
import { default as ElementContext } from './ElementContext';
|
|
3
|
-
import { default as useElement } from './hooks/useElement';
|
|
4
|
-
export * from './ElementContext';
|
|
5
2
|
export * from './ComponentContext';
|
|
6
|
-
export
|
|
7
|
-
export { ComponentContext, ElementContext, useElement };
|
|
3
|
+
export { ComponentContext };
|
package/dist/elements/index.mjs
CHANGED
|
@@ -3,7 +3,8 @@ var e = () => {
|
|
|
3
3
|
if (typeof window > "u") return;
|
|
4
4
|
let e = () => void 0, t = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
5
5
|
typeof t == "object" && Object.keys(t).forEach((n) => {
|
|
6
|
-
|
|
6
|
+
let r = t[n];
|
|
7
|
+
t[n] = typeof r == "function" ? e : null;
|
|
7
8
|
});
|
|
8
9
|
};
|
|
9
10
|
//#endregion
|
|
@@ -4,8 +4,9 @@ export type UseNetworkProps = {
|
|
|
4
4
|
server?: Server;
|
|
5
5
|
webKey?: string;
|
|
6
6
|
internalUsage?: boolean;
|
|
7
|
+
baseUrl?: string;
|
|
7
8
|
};
|
|
8
|
-
declare const useNetwork: ({ initLoading, server, webKey, internalUsage }: UseNetworkProps) => {
|
|
9
|
+
declare const useNetwork: ({ initLoading, server, webKey, internalUsage, baseUrl }: UseNetworkProps) => {
|
|
9
10
|
networkLoading: boolean;
|
|
10
11
|
networkQuery: <T = unknown>(url: string, params?: FormData | Record<string, string | object | number | boolean>, method?: string, accessToken?: string) => Promise<T | undefined>;
|
|
11
12
|
};
|
|
@@ -1,43 +1,41 @@
|
|
|
1
1
|
import { useCallback as e, useState as t } from "react";
|
|
2
2
|
//#region src/hooks/useNetwork.ts
|
|
3
|
-
var n = ({ initLoading: n = !1, server: r, webKey: i, internalUsage: a = !0 }) => {
|
|
4
|
-
let [
|
|
3
|
+
var n = ({ initLoading: n = !1, server: r, webKey: i, internalUsage: a = !0, baseUrl: o }) => {
|
|
4
|
+
let [s, c] = t(n);
|
|
5
5
|
return {
|
|
6
|
-
networkLoading:
|
|
7
|
-
networkQuery: e(async (e, t = {}, n = "get",
|
|
6
|
+
networkLoading: s,
|
|
7
|
+
networkQuery: e(async (e, t = {}, n = "get", s = "") => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
l = e;
|
|
16
|
-
}
|
|
17
|
-
let u = t;
|
|
9
|
+
c(!0), n = n.toLowerCase();
|
|
10
|
+
let l = new Headers();
|
|
11
|
+
l.append("Content-Type", "application/json"), s ? l.append("Authorization", `Bearer ${s}`) : i && l.append("Authorization", `Bearer ${i}`);
|
|
12
|
+
let u = "";
|
|
13
|
+
a && r && (u = o ?? r.nodeServer);
|
|
14
|
+
let d = t;
|
|
18
15
|
(t instanceof FormData ? Array.from(t.values()) : Object.values(t)).forEach((e) => {
|
|
19
|
-
if (e instanceof Blob &&
|
|
20
|
-
|
|
16
|
+
if (e instanceof Blob && l.get("Content-Type") !== "multipart/form-data") {
|
|
17
|
+
l.delete("Content-Type");
|
|
21
18
|
return;
|
|
22
19
|
}
|
|
23
|
-
}),
|
|
24
|
-
|
|
20
|
+
}), d instanceof FormData || (d = new FormData(), Object.entries(t).forEach(([e, t]) => {
|
|
21
|
+
d.append(e, t);
|
|
25
22
|
}));
|
|
26
|
-
let
|
|
23
|
+
let f = {
|
|
27
24
|
method: n,
|
|
28
|
-
headers:
|
|
29
|
-
body:
|
|
25
|
+
headers: l,
|
|
26
|
+
body: d
|
|
30
27
|
};
|
|
31
|
-
return
|
|
28
|
+
return l.get("Content-Type") === "application/json" && (f.body = JSON.stringify(t)), n === "get" && delete f.body, await (await fetch(`${u}${e}`, f)).json();
|
|
32
29
|
} catch (e) {
|
|
33
30
|
console.error(e);
|
|
34
31
|
} finally {
|
|
35
|
-
|
|
32
|
+
c(!1);
|
|
36
33
|
}
|
|
37
34
|
}, [
|
|
38
35
|
i,
|
|
39
36
|
a,
|
|
40
|
-
r
|
|
37
|
+
r,
|
|
38
|
+
o
|
|
41
39
|
])
|
|
42
40
|
};
|
|
43
41
|
};
|
|
@@ -35,6 +35,6 @@ declare const usePlitziServiceContext: <TEventBridge = any, TInteractions = any>
|
|
|
35
35
|
declare const PlitziServiceProvider: (props: {
|
|
36
36
|
children?: ReactNode;
|
|
37
37
|
value: PlitziServiceContextValue;
|
|
38
|
-
}) => import("react
|
|
38
|
+
}) => import("react").JSX.Element;
|
|
39
39
|
export { PlitziServiceProvider, PlitziServiceContext };
|
|
40
40
|
export default usePlitziServiceContext;
|