@mittwald/flow-remote-react-components 0.2.0-alpha.45 → 0.2.0-alpha.47
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 +5 -3
- package/dist/js/RemoteRoot.mjs.map +1 -1
- package/dist/js/components/Preview.mjs +2 -2
- package/dist/js/components/Preview.mjs.map +1 -1
- package/dist/js/components/RemoteRootClient.mjs +10 -22
- package/dist/js/components/RemoteRootClient.mjs.map +1 -1
- package/dist/js/index.mjs +1 -1
- package/dist/types/components/Preview.d.ts +5 -2
- package/dist/types/components/Preview.d.ts.map +1 -1
- package/dist/types/components/RemoteRoot.d.ts +1 -1
- package/dist/types/components/RemoteRoot.d.ts.map +1 -1
- package/dist/types/components/RemoteRootClient.d.ts +2 -1
- package/dist/types/components/RemoteRootClient.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/index.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/js/RemoteRoot.mjs
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
"use client";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import React, { Suspense } from "react";
|
|
6
5
|
import { useIsMounted } from "./hooks/useIsMounted.mjs";
|
|
6
|
+
import React, { Suspense } from "react";
|
|
7
7
|
const ClientComponent = React.lazy(() => import("./components/RemoteRootClient.mjs"));
|
|
8
8
|
const RemoteRoot = (props) => {
|
|
9
|
-
const { children, ...rest } = props;
|
|
10
9
|
const isMounted = useIsMounted();
|
|
11
|
-
|
|
10
|
+
if (!isMounted) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: props.fallback, children: /* @__PURE__ */ jsx(ClientComponent, { ...props }) });
|
|
12
14
|
};
|
|
13
15
|
export {
|
|
14
16
|
RemoteRoot,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteRoot.mjs","sources":["../../src/components/RemoteRoot.tsx"],"sourcesContent":["\"use client\";\nimport
|
|
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;"}
|
|
@@ -10,10 +10,10 @@ const RemoteRenderer = React.lazy(async () => {
|
|
|
10
10
|
return { default: Fallback };
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
const Preview = () => {
|
|
13
|
+
const Preview = (props) => {
|
|
14
14
|
const previewUrl = new URL(document.location.href);
|
|
15
15
|
previewUrl.searchParams.set("preview", "");
|
|
16
|
-
return /* @__PURE__ */ jsx(RemoteRenderer, { src: previewUrl.toString() });
|
|
16
|
+
return /* @__PURE__ */ jsx(RemoteRenderer, { src: previewUrl.toString(), ...props });
|
|
17
17
|
};
|
|
18
18
|
export {
|
|
19
19
|
Preview,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.mjs","sources":["../../../src/components/Preview.tsx"],"sourcesContent":["import React, { type FC } 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\nexport const Preview: FC = () => {\n const previewUrl = new URL(document.location.href);\n previewUrl.searchParams.set(\"preview\", \"\");\n return <RemoteRenderer src={previewUrl.toString()} />;\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;
|
|
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;"}
|
|
@@ -2,38 +2,26 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
"use client";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import "react";
|
|
6
|
-
import { connectHostIframeRef } from "@mittwald/flow-remote-core";
|
|
7
|
-
import { ViewComponentContextProvider } from "@mittwald/flow-react-components/internal";
|
|
8
5
|
import * as index from "../auto-generated/index.mjs";
|
|
9
6
|
import { Preview } from "./Preview.mjs";
|
|
7
|
+
import { ViewComponentContextProvider } from "@mittwald/flow-react-components/internal";
|
|
8
|
+
import { connectHostRenderRootRef } from "@mittwald/flow-remote-core";
|
|
9
|
+
import "react";
|
|
10
10
|
const RemoteRootClient = (props) => {
|
|
11
|
-
const { children, showPreview = false } = props;
|
|
11
|
+
const { children, showPreview = false, ...previewProps } = props;
|
|
12
12
|
const params = new URLSearchParams(document.location.search);
|
|
13
13
|
const isInPreviewFrame = params.has("preview");
|
|
14
|
-
const root = /* @__PURE__ */ jsx(
|
|
15
|
-
|
|
14
|
+
const root = /* @__PURE__ */ jsx("div", { ref: connectHostRenderRootRef, children: /* @__PURE__ */ jsx(
|
|
15
|
+
ViewComponentContextProvider,
|
|
16
16
|
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
height: 0,
|
|
20
|
-
width: 0,
|
|
21
|
-
left: -9999,
|
|
22
|
-
position: "absolute"
|
|
23
|
-
},
|
|
24
|
-
children: /* @__PURE__ */ jsx(
|
|
25
|
-
ViewComponentContextProvider,
|
|
26
|
-
{
|
|
27
|
-
components: index,
|
|
28
|
-
children
|
|
29
|
-
}
|
|
30
|
-
)
|
|
17
|
+
components: index,
|
|
18
|
+
children
|
|
31
19
|
}
|
|
32
|
-
);
|
|
20
|
+
) });
|
|
33
21
|
if (isInPreviewFrame || !showPreview) {
|
|
34
22
|
return root;
|
|
35
23
|
}
|
|
36
|
-
return /* @__PURE__ */ jsx(Preview, {});
|
|
24
|
+
return /* @__PURE__ */ jsx(Preview, { ...previewProps });
|
|
37
25
|
};
|
|
38
26
|
export {
|
|
39
27
|
RemoteRootClient,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteRootClient.mjs","sources":["../../../src/components/RemoteRootClient.tsx"],"sourcesContent":["\"use client\";\nimport
|
|
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
|
@@ -94,8 +94,8 @@ import { TextField } from "./auto-generated/TextField.mjs";
|
|
|
94
94
|
import { TimeField } from "./auto-generated/TimeField.mjs";
|
|
95
95
|
import { Tooltip } from "./auto-generated/Tooltip.mjs";
|
|
96
96
|
import { TooltipTrigger } from "./auto-generated/TooltipTrigger.mjs";
|
|
97
|
-
import { Form } from "./components/Form.mjs";
|
|
98
97
|
export * from "@mittwald/flow-react-components/flr-universal";
|
|
98
|
+
import { Form } from "./components/Form.mjs";
|
|
99
99
|
export {
|
|
100
100
|
Accordion,
|
|
101
101
|
ActionGroup,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../../src/components/Preview.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
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,EAAE,
|
|
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,6 +1,7 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
1
|
+
import { FC, PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
export interface RootClientProps extends PropsWithChildren {
|
|
3
3
|
showPreview?: boolean;
|
|
4
|
+
fallback?: ReactNode;
|
|
4
5
|
}
|
|
5
6
|
export declare const RemoteRootClient: FC<RootClientProps>;
|
|
6
7
|
export default RemoteRootClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteRootClient.d.ts","sourceRoot":"","sources":["../../../src/components/RemoteRootClient.tsx"],"names":[],"mappings":"
|
|
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,
|
|
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.47",
|
|
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,17 +32,17 @@
|
|
|
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.47",
|
|
36
|
+
"@mittwald/flow-remote-core": "0.2.0-alpha.47",
|
|
37
|
+
"@mittwald/flow-remote-elements": "0.2.0-alpha.47",
|
|
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.47",
|
|
43
43
|
"@mittwald/typescript-config": "",
|
|
44
44
|
"@types/node": "^22.13.4",
|
|
45
|
-
"nx": "^20.4.
|
|
45
|
+
"nx": "^20.4.5",
|
|
46
46
|
"prettier": "^3.5.1",
|
|
47
47
|
"react": "^19.0.0",
|
|
48
48
|
"react-hook-form": "^7.54.2",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"rollup-plugin-auto-named-exports": "1.0.0-beta.3",
|
|
51
51
|
"rollup-preserve-directives": "^1.1.3",
|
|
52
52
|
"typescript": "^5.7.3",
|
|
53
|
-
"vite": "^6.1.
|
|
53
|
+
"vite": "^6.1.1",
|
|
54
54
|
"vite-plugin-banner": "^0.8.0",
|
|
55
55
|
"vite-plugin-checker": "^0.8.0",
|
|
56
56
|
"vite-plugin-dts": "^4.5.0",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"optional": true
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "dfd43a192d6b3755906d3632a93a2725ed898ea0"
|
|
73
73
|
}
|