@mittwald/flow-remote-react-components 0.2.0-alpha.46 → 0.2.0-alpha.48
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/js/RemoteRoot.mjs +1 -2
- package/dist/js/RemoteRoot.mjs.map +1 -1
- package/dist/js/components/Preview.mjs.map +1 -1
- package/dist/js/components/RemoteRootClient.mjs.map +1 -1
- package/dist/js/index.mjs +1 -3
- package/dist/js/index.mjs.map +1 -1
- package/dist/types/components/Preview.d.ts +0 -1
- package/dist/types/components/Preview.d.ts.map +1 -1
- package/dist/types/components/RemoteRoot.d.ts.map +1 -1
- package/dist/types/components/RemoteRootClient.d.ts +0 -1
- package/dist/types/components/RemoteRootClient.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +0 -1
- package/dist/types/components/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/js/components/HostDataContextProvider.mjs +0 -28
- package/dist/js/components/HostDataContextProvider.mjs.map +0 -1
- package/dist/types/components/HostDataContextProvider.d.ts +0 -10
- package/dist/types/components/HostDataContextProvider.d.ts.map +0 -1
package/dist/js/RemoteRoot.mjs
CHANGED
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { useIsMounted } from "./hooks/useIsMounted.mjs";
|
|
6
6
|
import React, { Suspense } from "react";
|
|
7
|
-
import { HostDataProvider } from "./components/HostDataContextProvider.mjs";
|
|
8
7
|
const ClientComponent = React.lazy(() => import("./components/RemoteRootClient.mjs"));
|
|
9
8
|
const RemoteRoot = (props) => {
|
|
10
9
|
const isMounted = useIsMounted();
|
|
11
10
|
if (!isMounted) {
|
|
12
11
|
return null;
|
|
13
12
|
}
|
|
14
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback: props.fallback, children: /* @__PURE__ */ jsx(
|
|
13
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: props.fallback, children: /* @__PURE__ */ jsx(ClientComponent, { ...props }) });
|
|
15
14
|
};
|
|
16
15
|
export {
|
|
17
16
|
RemoteRoot,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteRoot.mjs","sources":["../../src/components/RemoteRoot.tsx"],"sourcesContent":["\"use client\";\nimport type { RootClientProps } from \"@/components/RemoteRootClient\";\nimport { useIsMounted } from \"@/hooks/useIsMounted\";\nimport React, { type FC, Suspense } from \"react\";\
|
|
1
|
+
{"version":3,"file":"RemoteRoot.mjs","sources":["../../src/components/RemoteRoot.tsx"],"sourcesContent":["\"use client\";\nimport type { RootClientProps } from \"@/components/RemoteRootClient\";\nimport { useIsMounted } from \"@/hooks/useIsMounted\";\nimport React, { type FC, Suspense } from \"react\";\n\nconst ClientComponent = React.lazy(() => import(\"./RemoteRootClient\"));\n\nexport const RemoteRoot: FC<RootClientProps> = (props) => {\n const isMounted = useIsMounted();\n\n if (!isMounted) {\n return null;\n }\n\n return (\n <Suspense fallback={props.fallback}>\n <ClientComponent {...props} />\n </Suspense>\n );\n};\n\nexport default RemoteRoot;\n"],"names":[],"mappings":";;;;AAKA,MAAM,kBAAkB,MAAM,KAAK,MAAM,OAAO,mCAAoB,CAAC;AAExD,MAAA,aAAkC,CAAC,UAAU;AACxD,QAAM,YAAY,aAAa;AAE/B,MAAI,CAAC,WAAW;AACP,WAAA;AAAA,EAAA;AAIP,SAAA,oBAAC,YAAS,UAAU,MAAM,UACxB,UAAC,oBAAA,iBAAA,EAAiB,GAAG,MAAA,CAAO,EAC9B,CAAA;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.mjs","sources":["../../../src/components/Preview.tsx"],"sourcesContent":["import React, { type FC, type ReactNode } from \"react\";\n\nconst Fallback: FC = () => null;\n\nconst RemoteRenderer = React.lazy(async () => {\n try {\n return await import(\"@mittwald/flow-remote-react-renderer/RemoteRenderer\");\n } catch {\n return { default: Fallback };\n }\n});\n\ninterface Props {\n
|
|
1
|
+
{"version":3,"file":"Preview.mjs","sources":["../../../src/components/Preview.tsx"],"sourcesContent":["import React, { type FC, type ReactNode } from \"react\";\n\nconst Fallback: FC = () => null;\n\nconst RemoteRenderer = React.lazy(async () => {\n try {\n return await import(\"@mittwald/flow-remote-react-renderer/RemoteRenderer\");\n } catch {\n return { default: Fallback };\n }\n});\n\ninterface Props {\n fallback?: ReactNode;\n}\n\nexport const Preview: FC<Props> = (props) => {\n const previewUrl = new URL(document.location.href);\n previewUrl.searchParams.set(\"preview\", \"\");\n return <RemoteRenderer src={previewUrl.toString()} {...props} />;\n};\n\nexport default Preview;\n"],"names":[],"mappings":";;AAEA,MAAM,WAAe,MAAM;AAE3B,MAAM,iBAAiB,MAAM,KAAK,YAAY;AACxC,MAAA;AACK,WAAA,MAAM,OAAO,qDAAqD;AAAA,EAAA,QACnE;AACC,WAAA,EAAE,SAAS,SAAS;AAAA,EAAA;AAE/B,CAAC;AAMY,MAAA,UAAqB,CAAC,UAAU;AAC3C,QAAM,aAAa,IAAI,IAAI,SAAS,SAAS,IAAI;AACtC,aAAA,aAAa,IAAI,WAAW,EAAE;AACzC,6BAAQ,gBAAe,EAAA,KAAK,WAAW,SAAS,GAAI,GAAG,OAAO;AAChE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteRootClient.mjs","sources":["../../../src/components/RemoteRootClient.tsx"],"sourcesContent":["\"use client\";\nimport * as viewComponents from \"@/auto-generated\";\nimport Preview from \"@/components/Preview\";\nimport { ViewComponentContextProvider } from \"@mittwald/flow-react-components/internal\";\nimport { connectHostRenderRootRef } from \"@mittwald/flow-remote-core\";\nimport { type FC, type PropsWithChildren, type ReactNode } from \"react\";\n\nexport interface RootClientProps extends PropsWithChildren {\n showPreview?: boolean;\n
|
|
1
|
+
{"version":3,"file":"RemoteRootClient.mjs","sources":["../../../src/components/RemoteRootClient.tsx"],"sourcesContent":["\"use client\";\nimport * as viewComponents from \"@/auto-generated\";\nimport Preview from \"@/components/Preview\";\nimport { ViewComponentContextProvider } from \"@mittwald/flow-react-components/internal\";\nimport { connectHostRenderRootRef } from \"@mittwald/flow-remote-core\";\nimport { type FC, type PropsWithChildren, type ReactNode } from \"react\";\n\nexport interface RootClientProps extends PropsWithChildren {\n showPreview?: boolean;\n fallback?: ReactNode;\n}\n\nexport const RemoteRootClient: FC<RootClientProps> = (props) => {\n const { children, showPreview = false, ...previewProps } = props;\n\n const params = new URLSearchParams(document.location.search);\n const isInPreviewFrame = params.has(\"preview\");\n\n const root = (\n <div ref={connectHostRenderRootRef}>\n <ViewComponentContextProvider\n components={viewComponents as FlowViewComponents}\n >\n {children}\n </ViewComponentContextProvider>\n </div>\n );\n\n if (isInPreviewFrame || !showPreview) {\n return root;\n }\n\n return <Preview {...previewProps} />;\n};\n\nexport default RemoteRootClient;\n"],"names":["viewComponents"],"mappings":";;;;;;;AAYa,MAAA,mBAAwC,CAAC,UAAU;AAC9D,QAAM,EAAE,UAAU,cAAc,OAAO,GAAG,aAAiB,IAAA;AAE3D,QAAM,SAAS,IAAI,gBAAgB,SAAS,SAAS,MAAM;AACrD,QAAA,mBAAmB,OAAO,IAAI,SAAS;AAE7C,QAAM,OACJ,oBAAC,OAAI,EAAA,KAAK,0BACR,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,YAAYA;AAAAA,MAEX;AAAA,IAAA;AAAA,EAAA,GAEL;AAGE,MAAA,oBAAoB,CAAC,aAAa;AAC7B,WAAA;AAAA,EAAA;AAGF,SAAA,oBAAC,SAAS,EAAA,GAAG,aAAc,CAAA;AACpC;"}
|
package/dist/js/index.mjs
CHANGED
|
@@ -96,7 +96,6 @@ import { Tooltip } from "./auto-generated/Tooltip.mjs";
|
|
|
96
96
|
import { TooltipTrigger } from "./auto-generated/TooltipTrigger.mjs";
|
|
97
97
|
export * from "@mittwald/flow-react-components/flr-universal";
|
|
98
98
|
import { Form } from "./components/Form.mjs";
|
|
99
|
-
import { useHostData } from "./components/HostDataContextProvider.mjs";
|
|
100
99
|
export {
|
|
101
100
|
Accordion,
|
|
102
101
|
ActionGroup,
|
|
@@ -194,7 +193,6 @@ export {
|
|
|
194
193
|
TextField,
|
|
195
194
|
TimeField,
|
|
196
195
|
Tooltip,
|
|
197
|
-
TooltipTrigger
|
|
198
|
-
useHostData
|
|
196
|
+
TooltipTrigger
|
|
199
197
|
};
|
|
200
198
|
//# sourceMappingURL=index.mjs.map
|
package/dist/js/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../../src/components/Preview.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvD,UAAU,KAAK;IACb,
|
|
1
|
+
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../../src/components/Preview.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvD,UAAU,KAAK;IACb,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,KAAK,CAI7B,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteRoot.d.ts","sourceRoot":"","sources":["../../../src/components/RemoteRoot.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAc,EAAE,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RemoteRoot.d.ts","sourceRoot":"","sources":["../../../src/components/RemoteRoot.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAc,EAAE,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;AAIjD,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAY1C,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteRootClient.d.ts","sourceRoot":"","sources":["../../../src/components/RemoteRootClient.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,
|
|
1
|
+
{"version":3,"file":"RemoteRootClient.d.ts","sourceRoot":"","sources":["../../../src/components/RemoteRootClient.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,eAAe,CAqBhD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,QAAQ,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-remote-react-components",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.48",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React components that can be used in a remote environment",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"test:compile": "tsc --noEmit"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@mittwald/flow-react-components": "0.2.0-alpha.
|
|
36
|
-
"@mittwald/flow-remote-core": "0.2.0-alpha.
|
|
37
|
-
"@mittwald/flow-remote-elements": "0.2.0-alpha.
|
|
35
|
+
"@mittwald/flow-react-components": "0.2.0-alpha.48",
|
|
36
|
+
"@mittwald/flow-remote-core": "0.2.0-alpha.48",
|
|
37
|
+
"@mittwald/flow-remote-elements": "0.2.0-alpha.48",
|
|
38
38
|
"@remote-dom/react": "^1.2.1",
|
|
39
39
|
"@types/react": "^19.0.10"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@mittwald/flow-remote-react-renderer": "0.2.0-alpha.
|
|
42
|
+
"@mittwald/flow-remote-react-renderer": "0.2.0-alpha.48",
|
|
43
43
|
"@mittwald/typescript-config": "",
|
|
44
44
|
"@types/node": "^22.13.4",
|
|
45
45
|
"nx": "^20.4.5",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"optional": true
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "5cf55de4b649798acf26efc228a8bcd5af79e7c3"
|
|
73
73
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
/* */
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { createContext, useContext, useState, useEffect } from "react";
|
|
5
|
-
const hostDataContext = createContext({});
|
|
6
|
-
const useHostData = () => useContext(hostDataContext).data;
|
|
7
|
-
const HostDataProvider = (props) => {
|
|
8
|
-
const { children } = props;
|
|
9
|
-
const [data, setData] = useState(void 0);
|
|
10
|
-
const handleDataRecevied = (event) => {
|
|
11
|
-
if (event instanceof CustomEvent) {
|
|
12
|
-
setData(event.detail);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
window.addEventListener("flr-data-received", handleDataRecevied);
|
|
17
|
-
return () => {
|
|
18
|
-
window.removeEventListener("flr-data-received", handleDataRecevied);
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
return /* @__PURE__ */ jsx(hostDataContext.Provider, { value: { data }, children });
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
HostDataProvider,
|
|
25
|
-
hostDataContext,
|
|
26
|
-
useHostData
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=HostDataContextProvider.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HostDataContextProvider.mjs","sources":["../../../src/components/HostDataContextProvider.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n useEffect,\n useState,\n type FC,\n type PropsWithChildren,\n} from \"react\";\n\ninterface Context {\n data?: unknown;\n}\n\nexport const hostDataContext = createContext<Context>({});\n\ntype Props = PropsWithChildren;\n\nexport const useHostData = () => useContext(hostDataContext).data;\n\nexport const HostDataProvider: FC<Props> = (props) => {\n const { children } = props;\n\n const [data, setData] = useState<unknown>(undefined);\n\n const handleDataRecevied = (event: Event) => {\n if (event instanceof CustomEvent) {\n setData(event.detail);\n }\n };\n\n useEffect(() => {\n window.addEventListener(\"flr-data-received\", handleDataRecevied);\n return () => {\n window.removeEventListener(\"flr-data-received\", handleDataRecevied);\n };\n });\n\n return (\n <hostDataContext.Provider value={{ data }}>\n {children}\n </hostDataContext.Provider>\n );\n};\n"],"names":[],"mappings":";;AAaa,MAAA,kBAAkB,cAAuB,CAAE,CAAA;AAIjD,MAAM,cAAc,MAAM,WAAW,eAAe,EAAE;AAEhD,MAAA,mBAA8B,CAAC,UAAU;AAC9C,QAAA,EAAE,aAAa;AAErB,QAAM,CAAC,MAAM,OAAO,IAAI,SAAkB,MAAS;AAE7C,QAAA,qBAAqB,CAAC,UAAiB;AAC3C,QAAI,iBAAiB,aAAa;AAChC,cAAQ,MAAM,MAAM;AAAA,IAAA;AAAA,EAExB;AAEA,YAAU,MAAM;AACP,WAAA,iBAAiB,qBAAqB,kBAAkB;AAC/D,WAAO,MAAM;AACJ,aAAA,oBAAoB,qBAAqB,kBAAkB;AAAA,IACpE;AAAA,EAAA,CACD;AAGC,SAAA,oBAAC,gBAAgB,UAAhB,EAAyB,OAAO,EAAE,KAAA,GAChC,UACH;AAEJ;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
interface Context {
|
|
3
|
-
data?: unknown;
|
|
4
|
-
}
|
|
5
|
-
export declare const hostDataContext: import('react').Context<Context>;
|
|
6
|
-
type Props = PropsWithChildren;
|
|
7
|
-
export declare const useHostData: () => unknown;
|
|
8
|
-
export declare const HostDataProvider: FC<Props>;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=HostDataContextProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HostDataContextProvider.d.ts","sourceRoot":"","sources":["../../../src/components/HostDataContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,EAAE,EACP,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAEf,UAAU,OAAO;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,eAAe,kCAA6B,CAAC;AAE1D,KAAK,KAAK,GAAG,iBAAiB,CAAC;AAE/B,eAAO,MAAM,WAAW,eAAyC,CAAC;AAElE,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,KAAK,CAuBtC,CAAC"}
|