@cripty2001/utils 0.0.148 → 0.0.149

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.
@@ -3,6 +3,8 @@ import type { AppserverData } from "../Appserver/client";
3
3
  import type { Dispatcher } from "../Dispatcher";
4
4
  export type LoaderProps<T extends AppserverData> = {
5
5
  data: Dispatcher<unknown, T>;
6
- children: (data: T) => React.ReactNode;
6
+ children: React.ComponentType<{
7
+ data: T;
8
+ }>;
7
9
  };
8
10
  export default function Loader<T extends AppserverData>(props: LoaderProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -19,9 +19,10 @@ if (typeof document !== 'undefined') {
19
19
  }
20
20
  function Loader(props) {
21
21
  const data = (0, react_whispr_1.useWhisprValue)(props.data.data);
22
- return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(Content, { data: data, children: (data) => props.children(data) }) }));
22
+ return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(Content, { data: data, children: props.children }) }));
23
23
  }
24
24
  function Content({ data, children }) {
25
+ const ChildComponent = children;
25
26
  if (data.loading)
26
27
  return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100vh' }, children: (0, jsx_runtime_1.jsx)("div", { style: {
27
28
  animation: 'spin 1s linear infinite',
@@ -33,5 +34,5 @@ function Content({ data, children }) {
33
34
  } }) }));
34
35
  if (!data.ok)
35
36
  return (0, jsx_runtime_1.jsx)("div", { style: { color: '#ef4444' }, children: data.error.message });
36
- return children(data.data);
37
+ return (0, jsx_runtime_1.jsx)(ChildComponent, { data: data.data });
37
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cripty2001/utils",
3
- "version": "0.0.148",
3
+ "version": "0.0.149",
4
4
  "description": "Internal Set of utils. If you need them use them, otherwise go to the next package ;)",
5
5
  "homepage": "https://github.com/cripty2001/utils#readme",
6
6
  "bugs": {