@mittwald/flow-remote-react-components 0.2.0-alpha.151 → 0.2.0-alpha.153
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/components/RemoteRootClient.mjs +2 -9
- package/dist/js/components/RemoteRootClient.mjs.map +1 -1
- package/dist/types/components/RemoteRootClient.d.ts +0 -1
- package/dist/types/components/RemoteRootClient.d.ts.map +1 -1
- package/package.json +6 -11
- package/dist/js/components/Preview.mjs +0 -22
- package/dist/js/components/Preview.mjs.map +0 -1
- package/dist/types/components/Preview.d.ts +0 -8
- package/dist/types/components/Preview.d.ts.map +0 -1
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import * as index from "../auto-generated/index.mjs";
|
|
6
|
-
import { Preview } from "./Preview.mjs";
|
|
7
6
|
import { stringifyError } from "../lib/stringifyError.mjs";
|
|
8
7
|
import { ViewComponentContextProvider } from "@mittwald/flow-react-components/internal";
|
|
9
8
|
import { connectHostRenderRootRef } from "@mittwald/flow-remote-core";
|
|
10
9
|
import { useRef, Suspense } from "react";
|
|
11
10
|
import { ErrorBoundary } from "react-error-boundary";
|
|
12
11
|
const RemoteRootClient = (props) => {
|
|
13
|
-
const { children
|
|
14
|
-
const params = new URLSearchParams(document.location.search);
|
|
15
|
-
const isInPreviewFrame = params.has("preview");
|
|
12
|
+
const { children } = props;
|
|
16
13
|
const connectionRef = useRef(void 0);
|
|
17
14
|
const errorRef = useRef(void 0);
|
|
18
15
|
const handleRenderError = (error) => {
|
|
@@ -20,7 +17,7 @@ const RemoteRootClient = (props) => {
|
|
|
20
17
|
errorRef.current = error;
|
|
21
18
|
(_a = connectionRef.current) == null ? void 0 : _a.imports.setError(stringifyError(error));
|
|
22
19
|
};
|
|
23
|
-
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
24
21
|
"div",
|
|
25
22
|
{
|
|
26
23
|
ref: (div) => {
|
|
@@ -47,10 +44,6 @@ const RemoteRootClient = (props) => {
|
|
|
47
44
|
)
|
|
48
45
|
}
|
|
49
46
|
);
|
|
50
|
-
if (isInPreviewFrame || !showPreview) {
|
|
51
|
-
return root;
|
|
52
|
-
}
|
|
53
|
-
return /* @__PURE__ */ jsx(Preview, { ...previewProps });
|
|
54
47
|
};
|
|
55
48
|
export {
|
|
56
49
|
RemoteRootClient,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteRootClient.mjs","sources":["../../../src/components/RemoteRootClient.tsx"],"sourcesContent":["\"use client\";\nimport * as viewComponents from \"@/auto-generated\";\nimport
|
|
1
|
+
{"version":3,"file":"RemoteRootClient.mjs","sources":["../../../src/components/RemoteRootClient.tsx"],"sourcesContent":["\"use client\";\nimport * as viewComponents from \"@/auto-generated\";\nimport { stringifyError } from \"@/lib/stringifyError\";\nimport type { ExtBridgeRemoteApi } from \"@mittwald/ext-bridge\";\nimport { ViewComponentContextProvider } from \"@mittwald/flow-react-components/internal\";\nimport {\n connectHostRenderRootRef,\n type RemoteToHostConnection,\n} from \"@mittwald/flow-remote-core\";\nimport { Suspense, useRef, type FC, type PropsWithChildren } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nexport interface RootClientProps extends PropsWithChildren {\n extBridgeImplementation?: ExtBridgeRemoteApi;\n}\n\nexport const RemoteRootClient: FC<RootClientProps> = (props) => {\n const { children } = props;\n\n const connectionRef = useRef<RemoteToHostConnection>(undefined);\n const errorRef = useRef<unknown>(undefined);\n\n const handleRenderError = (error: unknown) => {\n errorRef.current = error;\n connectionRef.current?.imports.setError(stringifyError(error));\n };\n\n return (\n <div\n ref={(div) => {\n connectionRef.current = connectHostRenderRootRef(div);\n if (errorRef.current) {\n handleRenderError(errorRef.current);\n }\n }}\n >\n <ErrorBoundary\n fallbackRender={({ error }) => {\n handleRenderError(error);\n return null;\n }}\n >\n <Suspense>\n <ViewComponentContextProvider\n components={viewComponents as FlowViewComponents}\n >\n {children}\n </ViewComponentContextProvider>\n </Suspense>\n </ErrorBoundary>\n </div>\n );\n};\n\nexport default RemoteRootClient;\n"],"names":["viewComponents"],"mappings":";;;;;;;;AAgBa,MAAA,mBAAwC,CAAC,UAAU;AACxD,QAAA,EAAE,aAAa;AAEf,QAAA,gBAAgB,OAA+B,MAAS;AACxD,QAAA,WAAW,OAAgB,MAAS;AAEpC,QAAA,oBAAoB,CAAC,UAAmB;;AAC5C,aAAS,UAAU;AACnB,wBAAc,YAAd,mBAAuB,QAAQ,SAAS,eAAe,KAAK;AAAA,EAC9D;AAGE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK,CAAC,QAAQ;AACE,sBAAA,UAAU,yBAAyB,GAAG;AACpD,YAAI,SAAS,SAAS;AACpB,4BAAkB,SAAS,OAAO;AAAA,QAAA;AAAA,MAEtC;AAAA,MAEA,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,gBAAgB,CAAC,EAAE,YAAY;AAC7B,8BAAkB,KAAK;AAChB,mBAAA;AAAA,UACT;AAAA,UAEA,8BAAC,UACC,EAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,YAAYA;AAAAA,cAEX;AAAA,YAAA;AAAA,UAAA,EAEL,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExtBridgeRemoteApi } from '@mittwald/ext-bridge';
|
|
2
2
|
import { FC, PropsWithChildren } from 'react';
|
|
3
3
|
export interface RootClientProps extends PropsWithChildren {
|
|
4
|
-
showPreview?: boolean;
|
|
5
4
|
extBridgeImplementation?: ExtBridgeRemoteApi;
|
|
6
5
|
}
|
|
7
6
|
export declare const RemoteRootClient: FC<RootClientProps>;
|
|
@@ -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":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAM/D,OAAO,EAAoB,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG1E,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,uBAAuB,CAAC,EAAE,kBAAkB,CAAC;CAC9C;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,eAAe,CAoChD,CAAC;AAEF,eAAe,gBAAgB,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.153",
|
|
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,16 +32,15 @@
|
|
|
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.153",
|
|
36
|
+
"@mittwald/flow-remote-core": "0.2.0-alpha.153",
|
|
37
|
+
"@mittwald/flow-remote-elements": "0.2.0-alpha.153",
|
|
38
38
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.3",
|
|
39
39
|
"@types/react": "^19",
|
|
40
40
|
"react-error-boundary": "^5.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@mittwald/ext-bridge": "0.2.0-alpha.
|
|
44
|
-
"@mittwald/flow-remote-react-renderer": "0.2.0-alpha.151",
|
|
43
|
+
"@mittwald/ext-bridge": "0.2.0-alpha.153",
|
|
45
44
|
"@mittwald/typescript-config": "",
|
|
46
45
|
"@types/node": "^22.13.10",
|
|
47
46
|
"nx": "^20.5.0",
|
|
@@ -60,7 +59,6 @@
|
|
|
60
59
|
},
|
|
61
60
|
"peerDependencies": {
|
|
62
61
|
"@mittwald/ext-bridge": "*",
|
|
63
|
-
"@mittwald/flow-remote-react-renderer": "*",
|
|
64
62
|
"react": "^19",
|
|
65
63
|
"react-hook-form": "*"
|
|
66
64
|
},
|
|
@@ -68,12 +66,9 @@
|
|
|
68
66
|
"@mittwald/ext-bridge": {
|
|
69
67
|
"optional": true
|
|
70
68
|
},
|
|
71
|
-
"@mittwald/flow-remote-react-renderer": {
|
|
72
|
-
"optional": true
|
|
73
|
-
},
|
|
74
69
|
"react-hook-form": {
|
|
75
70
|
"optional": true
|
|
76
71
|
}
|
|
77
72
|
},
|
|
78
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "6249eaf1059736228b5754edd281b0cae9e979a1"
|
|
79
74
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
/* */
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { useIsMounted } from "@mittwald/flow-react-components";
|
|
5
|
-
import React from "react";
|
|
6
|
-
const LazyRemoteRenderer = React.lazy(
|
|
7
|
-
() => import("@mittwald/flow-remote-react-renderer/RemoteRenderer")
|
|
8
|
-
);
|
|
9
|
-
const Preview = (props) => {
|
|
10
|
-
const isMounted = useIsMounted();
|
|
11
|
-
if (!isMounted) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
const previewUrl = new URL(document.location.href);
|
|
15
|
-
previewUrl.searchParams.set("preview", "");
|
|
16
|
-
return /* @__PURE__ */ jsx(LazyRemoteRenderer, { src: previewUrl.toString(), ...props });
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
Preview,
|
|
20
|
-
Preview as default
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=Preview.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.mjs","sources":["../../../src/components/Preview.tsx"],"sourcesContent":["import type { ExtBridgeRemoteApi } from \"@mittwald/ext-bridge\";\nimport { useIsMounted } from \"@mittwald/flow-react-components\";\nimport React, { type FC } from \"react\";\n\nconst LazyRemoteRenderer = React.lazy(\n () => import(\"@mittwald/flow-remote-react-renderer/RemoteRenderer\"),\n);\n\ninterface Props {\n extBridgeImplementation?: ExtBridgeRemoteApi;\n}\n\nexport const Preview: FC<Props> = (props) => {\n const isMounted = useIsMounted();\n if (!isMounted) {\n return null;\n }\n\n const previewUrl = new URL(document.location.href);\n previewUrl.searchParams.set(\"preview\", \"\");\n return <LazyRemoteRenderer src={previewUrl.toString()} {...props} />;\n};\n\nexport default Preview;\n"],"names":[],"mappings":";;;AAIA,MAAM,qBAAqB,MAAM;AAAA,EAC/B,MAAM,OAAO,qDAAqD;AACpE;AAMa,MAAA,UAAqB,CAAC,UAAU;AAC3C,QAAM,YAAY,aAAa;AAC/B,MAAI,CAAC,WAAW;AACP,WAAA;AAAA,EAAA;AAGT,QAAM,aAAa,IAAI,IAAI,SAAS,SAAS,IAAI;AACtC,aAAA,aAAa,IAAI,WAAW,EAAE;AACzC,6BAAQ,oBAAmB,EAAA,KAAK,WAAW,SAAS,GAAI,GAAG,OAAO;AACpE;"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ExtBridgeRemoteApi } from '@mittwald/ext-bridge';
|
|
2
|
-
import { FC } from 'react';
|
|
3
|
-
interface Props {
|
|
4
|
-
extBridgeImplementation?: ExtBridgeRemoteApi;
|
|
5
|
-
}
|
|
6
|
-
export declare const Preview: FC<Props>;
|
|
7
|
-
export default Preview;
|
|
8
|
-
//# sourceMappingURL=Preview.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../../src/components/Preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAMvC,UAAU,KAAK;IACb,uBAAuB,CAAC,EAAE,kBAAkB,CAAC;CAC9C;AAED,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,KAAK,CAS7B,CAAC;AAEF,eAAe,OAAO,CAAC"}
|