@mittwald/flow-remote-react-renderer 0.2.0-alpha.236 → 0.2.0-alpha.238
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/lib/createFlowRemoteComponentRenderer.mjs +2 -16
- package/dist/js/lib/createFlowRemoteComponentRenderer.mjs.map +1 -1
- package/dist/js/lib/propClassifiers.mjs +0 -4
- package/dist/js/lib/propClassifiers.mjs.map +1 -1
- package/dist/types/lib/createFlowRemoteComponentRenderer.d.ts.map +1 -1
- package/dist/types/lib/propClassifiers.d.ts +0 -2
- package/dist/types/lib/propClassifiers.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -1,27 +1,13 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { isStyleProp, isReactSuspendedStyle } from "./propClassifiers.mjs";
|
|
5
5
|
import { createRemoteComponentRenderer } from "@mittwald/remote-dom-react/host";
|
|
6
6
|
import { FlowRemoteElement } from "@mittwald/flow-remote-elements";
|
|
7
|
-
import { Version
|
|
7
|
+
import { Version } from "@mittwald/flow-remote-core";
|
|
8
8
|
import "react";
|
|
9
9
|
import { mapValues } from "remeda";
|
|
10
|
-
const customEventMappings = {
|
|
11
|
-
onPaste: (event) => {
|
|
12
|
-
var _a;
|
|
13
|
-
const clipEvent = event;
|
|
14
|
-
const pastedData = ((_a = clipEvent.clipboardData) == null ? void 0 : _a.getData("text")) ?? "";
|
|
15
|
-
return {
|
|
16
|
-
...standard(event),
|
|
17
|
-
content: pastedData
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
10
|
const mapProperty = (val, key) => {
|
|
22
|
-
if (isEventProp(key, val)) {
|
|
23
|
-
return mapEventHandler(val, key, customEventMappings);
|
|
24
|
-
}
|
|
25
11
|
if (isStyleProp(key)) {
|
|
26
12
|
if (isReactSuspendedStyle(val)) {
|
|
27
13
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFlowRemoteComponentRenderer.mjs","sources":["../../../src/lib/createFlowRemoteComponentRenderer.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"createFlowRemoteComponentRenderer.mjs","sources":["../../../src/lib/createFlowRemoteComponentRenderer.tsx"],"sourcesContent":["import { isReactSuspendedStyle, isStyleProp } from \"@/lib/propClassifiers\";\nimport type { RemoteComponentRendererProps } from \"@mittwald/remote-dom-react/host\";\nimport { createRemoteComponentRenderer } from \"@mittwald/remote-dom-react/host\";\nimport { FlowRemoteElement } from \"@mittwald/flow-remote-elements\";\nimport type { FlowRemoteElementMetaData } from \"@mittwald/flow-remote-elements\";\nimport { Version } from \"@mittwald/flow-remote-core\";\nimport { type ComponentType } from \"react\";\nimport { mapValues } from \"remeda\";\n\nconst mapProperty = (val: unknown, key: string) => {\n if (isStyleProp(key)) {\n if (isReactSuspendedStyle(val)) {\n return {\n display: \"none\",\n };\n }\n return {};\n }\n return val;\n};\n\nexport const createFlowRemoteComponentRenderer = <P extends object>(\n name: string,\n Component: ComponentType<P>,\n): ComponentType<RemoteComponentRendererProps> => {\n function HostComponent(props: P & FlowRemoteElementMetaData) {\n const hostComponentProps = mapValues(props, (v, k) =>\n mapProperty(v, k),\n ) as P & FlowRemoteElementMetaData;\n\n const {\n [FlowRemoteElement.versionPropertyName]: version = Version.v1,\n [FlowRemoteElement.initializationPropertyName]: initialized = false,\n ...restProps\n } = hostComponentProps;\n\n if (version >= Version.v3) {\n // \"initialized\" handling introduced in version 3\n if (!initialized) {\n return null;\n }\n }\n\n return <Component {...(restProps as P)} />;\n }\n HostComponent.displayName = `FlowRemoteRenderer(${name})`;\n return createRemoteComponentRenderer(HostComponent, {\n name: `RemoteRenderer(${name})`,\n });\n};\n"],"names":[],"mappings":";;;;;;;AASA,MAAM,cAAc,CAAC,KAAc,QAAgB;AAC7C,MAAA,YAAY,GAAG,GAAG;AAChB,QAAA,sBAAsB,GAAG,GAAG;AACvB,aAAA;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IAAA;AAEF,WAAO,CAAC;AAAA,EAAA;AAEH,SAAA;AACT;AAEa,MAAA,oCAAoC,CAC/C,MACA,cACgD;AAChD,WAAS,cAAc,OAAsC;AAC3D,UAAM,qBAAqB;AAAA,MAAU;AAAA,MAAO,CAAC,GAAG,MAC9C,YAAY,GAAG,CAAC;AAAA,IAClB;AAEM,UAAA;AAAA,MACJ,CAAC,kBAAkB,mBAAmB,GAAG,UAAU,QAAQ;AAAA,MAC3D,CAAC,kBAAkB,0BAA0B,GAAG,cAAc;AAAA,MAC9D,GAAG;AAAA,IAAA,IACD;AAEA,QAAA,WAAW,QAAQ,IAAI;AAEzB,UAAI,CAAC,aAAa;AACT,eAAA;AAAA,MAAA;AAAA,IACT;AAGK,WAAA,oBAAC,WAAW,EAAA,GAAI,UAAiB,CAAA;AAAA,EAAA;AAE5B,gBAAA,cAAc,sBAAsB,IAAI;AACtD,SAAO,8BAA8B,eAAe;AAAA,IAClD,MAAM,kBAAkB,IAAI;AAAA,EAAA,CAC7B;AACH;"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
import { isFunction } from "remeda";
|
|
4
|
-
const defaultEventPropMatcher = /^on[A-Z][A-Za-z]+$/;
|
|
5
|
-
const isEventProp = (name, value) => !!name.match(defaultEventPropMatcher) && isFunction(value);
|
|
6
3
|
const isStyleProp = (name) => name === "style";
|
|
7
4
|
const isReactSuspendedStyle = (value) => value === "display: none !important;";
|
|
8
5
|
export {
|
|
9
|
-
isEventProp,
|
|
10
6
|
isReactSuspendedStyle,
|
|
11
7
|
isStyleProp
|
|
12
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propClassifiers.mjs","sources":["../../../src/lib/propClassifiers.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"propClassifiers.mjs","sources":["../../../src/lib/propClassifiers.ts"],"sourcesContent":["export const isStyleProp = (name: string): boolean => name === \"style\";\n\nexport const isReactSuspendedStyle = (value: unknown): boolean =>\n value === \"display: none !important;\";\n"],"names":[],"mappings":"AAAa,MAAA,cAAc,CAAC,SAA0B,SAAS;AAElD,MAAA,wBAAwB,CAAC,UACpC,UAAU;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFlowRemoteComponentRenderer.d.ts","sourceRoot":"","sources":["../../../src/lib/createFlowRemoteComponentRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createFlowRemoteComponentRenderer.d.ts","sourceRoot":"","sources":["../../../src/lib/createFlowRemoteComponentRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAKpF,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAe3C,eAAO,MAAM,iCAAiC,GAAI,CAAC,SAAS,MAAM,EAChE,MAAM,MAAM,EACZ,WAAW,aAAa,CAAC,CAAC,CAAC,KAC1B,aAAa,CAAC,4BAA4B,CAyB5C,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { EventHandler } from '@mittwald/flow-remote-core';
|
|
2
|
-
export declare const isEventProp: (name: string, value: unknown) => value is EventHandler;
|
|
3
1
|
export declare const isStyleProp: (name: string) => boolean;
|
|
4
2
|
export declare const isReactSuspendedStyle: (value: unknown) => boolean;
|
|
5
3
|
//# sourceMappingURL=propClassifiers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propClassifiers.d.ts","sourceRoot":"","sources":["../../../src/lib/propClassifiers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"propClassifiers.d.ts","sourceRoot":"","sources":["../../../src/lib/propClassifiers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,OAA2B,CAAC;AAEvE,eAAO,MAAM,qBAAqB,GAAI,OAAO,OAAO,KAAG,OAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-remote-react-renderer",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.238",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React rendering for Flow Remote Elements",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"test:compile": "tsc --noEmit"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@mittwald/ext-bridge": "0.2.0-alpha.
|
|
32
|
-
"@mittwald/flow-remote-core": "0.2.0-alpha.
|
|
33
|
-
"@mittwald/flow-remote-elements": "0.2.0-alpha.
|
|
31
|
+
"@mittwald/ext-bridge": "0.2.0-alpha.238",
|
|
32
|
+
"@mittwald/flow-remote-core": "0.2.0-alpha.238",
|
|
33
|
+
"@mittwald/flow-remote-elements": "0.2.0-alpha.238",
|
|
34
34
|
"@mittwald/react-use-promise": "^3.0.4",
|
|
35
35
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.3",
|
|
36
36
|
"@types/react": "^19.1.6",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"remeda": "^2.22.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@mittwald/flow-react-components": "0.2.0-alpha.
|
|
42
|
+
"@mittwald/flow-react-components": "0.2.0-alpha.238",
|
|
43
43
|
"@mittwald/typescript-config": "",
|
|
44
44
|
"@types/node": "^22.15.23",
|
|
45
45
|
"nx": "^20.8.2",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"optional": true
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "c7e6ccf29058d3b39ca5cc018bb98b01a75a9b24"
|
|
71
71
|
}
|