@mittwald/flow-remote-react-renderer 0.2.0-alpha.89 → 0.2.0-alpha.892
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/RemoteRenderer.mjs +11 -11
- package/dist/js/RemoteRenderer.mjs.map +1 -1
- package/dist/js/RemoteRendererBrowser.mjs +149 -0
- package/dist/js/RemoteRendererBrowser.mjs.map +1 -0
- package/dist/js/auto-generated/index.mjs +336 -108
- package/dist/js/auto-generated/index.mjs.map +1 -1
- package/dist/js/components/Form.mjs +24 -14
- package/dist/js/components/Form.mjs.map +1 -1
- package/dist/js/components/NotificationRenderController.mjs +25 -0
- package/dist/js/components/NotificationRenderController.mjs.map +1 -0
- package/dist/js/components/SlotRootWrapper.mjs +10 -0
- package/dist/js/components/SlotRootWrapper.mjs.map +1 -0
- package/dist/js/components.mjs +41 -12
- package/dist/js/components.mjs.map +1 -1
- package/dist/js/hooks/useControllableSuspenseTrigger.mjs +30 -0
- package/dist/js/hooks/useControllableSuspenseTrigger.mjs.map +1 -0
- package/dist/js/hooks/useMergedComponents.mjs +24 -0
- package/dist/js/hooks/useMergedComponents.mjs.map +1 -0
- package/dist/js/hooks/useUpdateHostPathnameOnRemote.mjs +17 -0
- package/dist/js/hooks/useUpdateHostPathnameOnRemote.mjs.map +1 -0
- package/dist/js/index.mjs +2 -4
- package/dist/js/integrations/react-hook-form/Form.mjs +16 -0
- package/dist/js/integrations/react-hook-form/Form.mjs.map +1 -0
- package/dist/js/lib/createFlowRemoteComponentRenderer.mjs +26 -15
- package/dist/js/lib/createFlowRemoteComponentRenderer.mjs.map +1 -1
- package/dist/js/lib/elementFactory.mjs +12 -8
- package/dist/js/lib/elementFactory.mjs.map +1 -1
- package/dist/js/lib/mapAttributeToReactProperty.mjs +4 -4
- package/dist/js/lib/mapAttributeToReactProperty.mjs.map +1 -1
- package/dist/js/lib/propClassifiers.mjs +2 -8
- package/dist/js/lib/propClassifiers.mjs.map +1 -1
- package/dist/types/RemoteRenderer.d.ts +2 -2
- package/dist/types/RemoteRenderer.d.ts.map +1 -1
- package/dist/types/RemoteRendererBrowser.d.ts +17 -0
- package/dist/types/RemoteRendererBrowser.d.ts.map +1 -0
- package/dist/types/auto-generated/index.d.ts +130 -101
- package/dist/types/auto-generated/index.d.ts.map +1 -1
- package/dist/types/components/Form.d.ts +8 -2
- package/dist/types/components/Form.d.ts.map +1 -1
- package/dist/types/components/NotificationRenderController.d.ts +4 -0
- package/dist/types/components/NotificationRenderController.d.ts.map +1 -0
- package/dist/types/components/SlotRootWrapper.d.ts +4 -0
- package/dist/types/components/SlotRootWrapper.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +3 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/components.d.ts +147 -107
- package/dist/types/components.d.ts.map +1 -1
- package/dist/types/hooks/useControllableSuspenseTrigger.d.ts +5 -0
- package/dist/types/hooks/useControllableSuspenseTrigger.d.ts.map +1 -0
- package/dist/types/hooks/useMergedComponents.d.ts +5 -0
- package/dist/types/hooks/useMergedComponents.d.ts.map +1 -0
- package/dist/types/hooks/useUpdateHostPathnameOnRemote.d.ts +4 -0
- package/dist/types/hooks/useUpdateHostPathnameOnRemote.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/Form.d.ts +13 -0
- package/dist/types/integrations/react-hook-form/Form.d.ts.map +1 -0
- package/dist/types/lib/createFlowRemoteComponentRenderer.d.ts +2 -2
- package/dist/types/lib/createFlowRemoteComponentRenderer.d.ts.map +1 -1
- package/dist/types/lib/elementFactory.d.ts +4 -1
- package/dist/types/lib/elementFactory.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/dist/types/lib/types.d.ts +1 -1
- package/dist/types/lib/types.d.ts.map +1 -1
- package/package.json +31 -27
- package/dist/js/RemoteRendererClient.mjs +0 -75
- package/dist/js/RemoteRendererClient.mjs.map +0 -1
- package/dist/js/components/lib/getFormDataObject.mjs +0 -7
- package/dist/js/components/lib/getFormDataObject.mjs.map +0 -1
- package/dist/js/hooks/useIsMounted.mjs +0 -14
- package/dist/js/hooks/useIsMounted.mjs.map +0 -1
- package/dist/types/RemoteRendererClient.d.ts +0 -9
- package/dist/types/RemoteRendererClient.d.ts.map +0 -1
- package/dist/types/components/lib/getFormDataObject.d.ts +0 -2
- package/dist/types/components/lib/getFormDataObject.d.ts.map +0 -1
- package/dist/types/lib/stringChildrenExtractor.d.ts +0 -3
- package/dist/types/lib/stringChildrenExtractor.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.mjs","sources":["../../../src/components/Form.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Form.mjs","sources":["../../../src/components/Form.tsx"],"sourcesContent":["import {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n type Ref,\n} from \"react\";\n\ntype FormProps = {\n action?: (data: FormData) => void | Promise<void>;\n onSubmit?: (data: FormData) => void | Promise<void>;\n ref?: Ref<HTMLFormElement>;\n} & PropsWithChildren;\n\nexport const Form: FC<FormProps> = (props) => {\n const {\n action: onActionFromProps,\n onSubmit: onSubmitFromProps,\n ref,\n ...rest\n } = props;\n\n const onSubmit = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n await onSubmitFromProps?.(new FormData(event.currentTarget));\n };\n\n const onAction = async (formData: FormData) => {\n await onActionFromProps?.(formData);\n };\n\n return (\n <form\n {...rest}\n ref={ref}\n action={onActionFromProps ? onAction : undefined}\n onSubmit={onSubmitFromProps ? onSubmit : undefined}\n />\n );\n};\n"],"names":[],"mappings":";;;AAaO,MAAM,IAAA,GAAsB,CAAC,KAAA,KAAU;AAC5C,EAAA,MAAM;AAAA,IACJ,MAAA,EAAQ,iBAAA;AAAA,IACR,QAAA,EAAU,iBAAA;AAAA,IACV,GAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,QAAA,GAAW,OAAO,KAAA,KAAsC;AAC5D,IAAA,KAAA,CAAM,cAAA,EAAe;AACrB,IAAA,MAAM,iBAAA,GAAoB,IAAI,QAAA,CAAS,KAAA,CAAM,aAAa,CAAC,CAAA;AAAA,EAC7D,CAAA;AAEA,EAAA,MAAM,QAAA,GAAW,OAAO,QAAA,KAAuB;AAC7C,IAAA,MAAM,oBAAoB,QAAQ,CAAA;AAAA,EACpC,CAAA;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA;AAAA,MACA,MAAA,EAAQ,oBAAoB,QAAA,GAAW,MAAA;AAAA,MACvC,QAAA,EAAU,oBAAoB,QAAA,GAAW;AAAA;AAAA,GAC3C;AAEJ;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { useNotificationController, Notification } from '@mittwald/flow-react-components';
|
|
5
|
+
import { useRef, useEffect } from 'react';
|
|
6
|
+
|
|
7
|
+
const NotificationRenderController = (props) => {
|
|
8
|
+
const notifications = useNotificationController();
|
|
9
|
+
const isAdded = useRef(false);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (isAdded.current) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const id = notifications.add(/* @__PURE__ */ jsx(Notification, { ...props }));
|
|
15
|
+
isAdded.current = true;
|
|
16
|
+
return () => {
|
|
17
|
+
notifications.remove(id);
|
|
18
|
+
isAdded.current = false;
|
|
19
|
+
};
|
|
20
|
+
}, [notifications]);
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { NotificationRenderController };
|
|
25
|
+
//# sourceMappingURL=NotificationRenderController.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationRenderController.mjs","sources":["../../../src/components/NotificationRenderController.tsx"],"sourcesContent":["import {\n useNotificationController,\n type NotificationProps,\n Notification,\n} from \"@mittwald/flow-react-components\";\nimport { useEffect, useRef, type FC } from \"react\";\n\nexport const NotificationRenderController: FC<NotificationProps> = (props) => {\n const notifications = useNotificationController();\n const isAdded = useRef(false);\n\n useEffect(() => {\n if (isAdded.current) {\n return;\n }\n\n const id = notifications.add(<Notification {...props} />);\n isAdded.current = true;\n\n return () => {\n notifications.remove(id);\n isAdded.current = false;\n };\n }, [notifications]);\n\n return null;\n};\n"],"names":[],"mappings":";;;;AAOO,MAAM,4BAAA,GAAsD,CAAC,KAAA,KAAU;AAC5E,EAAA,MAAM,gBAAgB,yBAAA,EAA0B;AAChD,EAAA,MAAM,OAAA,GAAU,OAAO,KAAK,CAAA;AAE5B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,QAAQ,OAAA,EAAS;AACnB,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,KAAK,aAAA,CAAc,GAAA,qBAAK,YAAA,EAAA,EAAc,GAAG,OAAO,CAAE,CAAA;AACxD,IAAA,OAAA,CAAQ,OAAA,GAAU,IAAA;AAElB,IAAA,OAAO,MAAM;AACX,MAAA,aAAA,CAAc,OAAO,EAAE,CAAA;AACvB,MAAA,OAAA,CAAQ,OAAA,GAAU,KAAA;AAAA,IACpB,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,aAAa,CAAC,CAAA;AAElB,EAAA,OAAO,IAAA;AACT;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlotRootWrapper.mjs","sources":["../../../src/components/SlotRootWrapper.ts"],"sourcesContent":["import React, { createElement, type FC, type PropsWithChildren } from \"react\";\n\nexport const SlotRootWrapper: FC<PropsWithChildren> = (props) => {\n return createElement(React.Fragment, {}, props.children);\n};\n\nexport default SlotRootWrapper;\n"],"names":[],"mappings":";;AAEO,MAAM,eAAA,GAAyC,CAAC,KAAA,KAAU;AAC/D,EAAA,OAAO,cAAc,KAAA,CAAM,QAAA,EAAU,EAAC,EAAG,MAAM,QAAQ,CAAA;AACzD;;;;"}
|
package/dist/js/components.mjs
CHANGED
|
@@ -1,26 +1,55 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
3
|
+
import { createFlowRemoteComponentRenderer } from './lib/createFlowRemoteComponentRenderer.mjs';
|
|
4
|
+
import { elementFactory } from './lib/elementFactory.mjs';
|
|
5
|
+
import { createRemoteComponentRenderer } from '@mittwald/remote-dom-react/host';
|
|
6
|
+
import flowComponents from './auto-generated/index.mjs';
|
|
7
|
+
import { Form as Form$1 } from './components/Form.mjs';
|
|
8
|
+
import { SlotRootWrapper } from './components/SlotRootWrapper.mjs';
|
|
9
|
+
import { Form } from './integrations/react-hook-form/Form.mjs';
|
|
10
|
+
import { NotificationRenderController } from './components/NotificationRenderController.mjs';
|
|
11
|
+
|
|
8
12
|
const htmlComponentsMap = {
|
|
9
13
|
svg: createRemoteComponentRenderer(elementFactory("svg")),
|
|
10
14
|
circle: createRemoteComponentRenderer(elementFactory("circle")),
|
|
11
15
|
g: createRemoteComponentRenderer(elementFactory("g")),
|
|
12
16
|
path: createRemoteComponentRenderer(elementFactory("path")),
|
|
13
|
-
strong: createRemoteComponentRenderer(elementFactory("strong"))
|
|
17
|
+
strong: createRemoteComponentRenderer(elementFactory("strong")),
|
|
18
|
+
s: createRemoteComponentRenderer(elementFactory("s")),
|
|
19
|
+
ul: createRemoteComponentRenderer(elementFactory("ul")),
|
|
20
|
+
ol: createRemoteComponentRenderer(elementFactory("ol")),
|
|
21
|
+
li: createRemoteComponentRenderer(elementFactory("li")),
|
|
22
|
+
small: createRemoteComponentRenderer(elementFactory("small")),
|
|
23
|
+
i: createRemoteComponentRenderer(elementFactory("i")),
|
|
24
|
+
br: createRemoteComponentRenderer(
|
|
25
|
+
elementFactory("br", { isVoidElement: true })
|
|
26
|
+
)
|
|
27
|
+
};
|
|
28
|
+
const skippedComponentsMap = {
|
|
29
|
+
script: () => null
|
|
14
30
|
};
|
|
15
31
|
const flowComponentsMap = {
|
|
16
|
-
"flr-form": createFlowRemoteComponentRenderer(Form)
|
|
32
|
+
"flr-form": createFlowRemoteComponentRenderer("Form", Form$1),
|
|
33
|
+
"flr-rhf-form": createFlowRemoteComponentRenderer("RhfForm", Form),
|
|
34
|
+
"flr-slot-root-wrapper": createFlowRemoteComponentRenderer(
|
|
35
|
+
"SlotRootWrapper",
|
|
36
|
+
SlotRootWrapper
|
|
37
|
+
),
|
|
38
|
+
"flr-notification": createFlowRemoteComponentRenderer(
|
|
39
|
+
"Notification",
|
|
40
|
+
NotificationRenderController
|
|
41
|
+
),
|
|
42
|
+
"flr-clear-props-context-content": createFlowRemoteComponentRenderer(
|
|
43
|
+
"ClearPropsContextContent",
|
|
44
|
+
SlotRootWrapper
|
|
45
|
+
)
|
|
17
46
|
};
|
|
18
47
|
const components = {
|
|
19
48
|
...htmlComponentsMap,
|
|
20
|
-
...
|
|
21
|
-
...flowComponents
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
components
|
|
49
|
+
...skippedComponentsMap,
|
|
50
|
+
...flowComponents,
|
|
51
|
+
...flowComponentsMap
|
|
25
52
|
};
|
|
53
|
+
|
|
54
|
+
export { components };
|
|
26
55
|
//# sourceMappingURL=components.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.mjs","sources":["../../src/components.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"components.mjs","sources":["../../src/components.ts"],"sourcesContent":["import { createFlowRemoteComponentRenderer } from \"@/lib/createFlowRemoteComponentRenderer\";\nimport { elementFactory } from \"@/lib/elementFactory\";\nimport { createRemoteComponentRenderer } from \"@mittwald/remote-dom-react/host\";\nimport autoGenerated from \"./auto-generated\";\nimport { Form, SlotRootWrapper } from \"@/components/\";\nimport { Form as RhfForm } from \"@/integrations/react-hook-form/Form\";\nimport { NotificationRenderController } from \"@/components/NotificationRenderController\";\n\nconst htmlComponentsMap = {\n svg: createRemoteComponentRenderer(elementFactory(\"svg\")),\n circle: createRemoteComponentRenderer(elementFactory(\"circle\")),\n g: createRemoteComponentRenderer(elementFactory(\"g\")),\n path: createRemoteComponentRenderer(elementFactory(\"path\")),\n strong: createRemoteComponentRenderer(elementFactory(\"strong\")),\n s: createRemoteComponentRenderer(elementFactory(\"s\")),\n ul: createRemoteComponentRenderer(elementFactory(\"ul\")),\n ol: createRemoteComponentRenderer(elementFactory(\"ol\")),\n li: createRemoteComponentRenderer(elementFactory(\"li\")),\n small: createRemoteComponentRenderer(elementFactory(\"small\")),\n i: createRemoteComponentRenderer(elementFactory(\"i\")),\n br: createRemoteComponentRenderer(\n elementFactory(\"br\", { isVoidElement: true }),\n ),\n} as const;\n\n/**\n * Components that are allowed to be used remotely but should not be rendered on\n * the host.\n */\nconst skippedComponentsMap = {\n script: () => null,\n} as const;\n\nconst flowComponentsMap = {\n \"flr-form\": createFlowRemoteComponentRenderer(\"Form\", Form),\n \"flr-rhf-form\": createFlowRemoteComponentRenderer(\"RhfForm\", RhfForm),\n \"flr-slot-root-wrapper\": createFlowRemoteComponentRenderer(\n \"SlotRootWrapper\",\n SlotRootWrapper,\n ),\n \"flr-notification\": createFlowRemoteComponentRenderer(\n \"Notification\",\n NotificationRenderController,\n ),\n \"flr-clear-props-context-content\": createFlowRemoteComponentRenderer(\n \"ClearPropsContextContent\",\n SlotRootWrapper,\n ),\n};\n\nexport const components = {\n ...htmlComponentsMap,\n ...skippedComponentsMap,\n ...autoGenerated,\n ...flowComponentsMap,\n};\n"],"names":["Form","RhfForm","autoGenerated"],"mappings":";;;;;;;;;AAQA,MAAM,iBAAA,GAAoB;AAAA,EACxB,GAAA,EAAK,6BAAA,CAA8B,cAAA,CAAe,KAAK,CAAC,CAAA;AAAA,EACxD,MAAA,EAAQ,6BAAA,CAA8B,cAAA,CAAe,QAAQ,CAAC,CAAA;AAAA,EAC9D,CAAA,EAAG,6BAAA,CAA8B,cAAA,CAAe,GAAG,CAAC,CAAA;AAAA,EACpD,IAAA,EAAM,6BAAA,CAA8B,cAAA,CAAe,MAAM,CAAC,CAAA;AAAA,EAC1D,MAAA,EAAQ,6BAAA,CAA8B,cAAA,CAAe,QAAQ,CAAC,CAAA;AAAA,EAC9D,CAAA,EAAG,6BAAA,CAA8B,cAAA,CAAe,GAAG,CAAC,CAAA;AAAA,EACpD,EAAA,EAAI,6BAAA,CAA8B,cAAA,CAAe,IAAI,CAAC,CAAA;AAAA,EACtD,EAAA,EAAI,6BAAA,CAA8B,cAAA,CAAe,IAAI,CAAC,CAAA;AAAA,EACtD,EAAA,EAAI,6BAAA,CAA8B,cAAA,CAAe,IAAI,CAAC,CAAA;AAAA,EACtD,KAAA,EAAO,6BAAA,CAA8B,cAAA,CAAe,OAAO,CAAC,CAAA;AAAA,EAC5D,CAAA,EAAG,6BAAA,CAA8B,cAAA,CAAe,GAAG,CAAC,CAAA;AAAA,EACpD,EAAA,EAAI,6BAAA;AAAA,IACF,cAAA,CAAe,IAAA,EAAM,EAAE,aAAA,EAAe,MAAM;AAAA;AAEhD,CAAA;AAMA,MAAM,oBAAA,GAAuB;AAAA,EAC3B,QAAQ,MAAM;AAChB,CAAA;AAEA,MAAM,iBAAA,GAAoB;AAAA,EACxB,UAAA,EAAY,iCAAA,CAAkC,MAAA,EAAQA,MAAI,CAAA;AAAA,EAC1D,cAAA,EAAgB,iCAAA,CAAkC,SAAA,EAAWC,IAAO,CAAA;AAAA,EACpE,uBAAA,EAAyB,iCAAA;AAAA,IACvB,iBAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,kBAAA,EAAoB,iCAAA;AAAA,IAClB,cAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,iCAAA,EAAmC,iCAAA;AAAA,IACjC,0BAAA;AAAA,IACA;AAAA;AAEJ,CAAA;AAEO,MAAM,UAAA,GAAa;AAAA,EACxB,GAAG,iBAAA;AAAA,EACH,GAAG,oBAAA;AAAA,EACH,GAAGC,cAAA;AAAA,EACH,GAAG;AACL;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { usePromise } from '@mittwald/react-use-promise';
|
|
4
|
+
import { useId, useRef, useState } from 'react';
|
|
5
|
+
|
|
6
|
+
const useControllableSuspenseTrigger = () => {
|
|
7
|
+
const localId = useId();
|
|
8
|
+
const promise = useRef(null);
|
|
9
|
+
const [startedCount, setStartedCount] = useState(0);
|
|
10
|
+
usePromise(
|
|
11
|
+
(promise2) => promise2,
|
|
12
|
+
promise.current ? [promise.current.promise] : null,
|
|
13
|
+
{
|
|
14
|
+
keepValueWhileLoading: false,
|
|
15
|
+
loaderId: localId + startedCount
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
return {
|
|
19
|
+
start: () => {
|
|
20
|
+
promise.current = Promise.withResolvers();
|
|
21
|
+
setStartedCount((c) => c + 1);
|
|
22
|
+
},
|
|
23
|
+
stop: () => {
|
|
24
|
+
promise.current?.resolve();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { useControllableSuspenseTrigger };
|
|
30
|
+
//# sourceMappingURL=useControllableSuspenseTrigger.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useControllableSuspenseTrigger.mjs","sources":["../../../src/hooks/useControllableSuspenseTrigger.ts"],"sourcesContent":["import { usePromise } from \"@mittwald/react-use-promise\";\nimport { useId, useRef, useState } from \"react\";\n\nexport const useControllableSuspenseTrigger = () => {\n const localId = useId();\n const promise = useRef<PromiseWithResolvers<void>>(null);\n const [startedCount, setStartedCount] = useState(0);\n\n usePromise(\n (promise: Promise<void>) => promise,\n promise.current ? [promise.current.promise] : null,\n {\n keepValueWhileLoading: false,\n loaderId: localId + startedCount,\n },\n );\n\n return {\n start: () => {\n promise.current = Promise.withResolvers<void>();\n setStartedCount((c) => c + 1);\n },\n stop: () => {\n promise.current?.resolve();\n },\n };\n};\n"],"names":["promise"],"mappings":";;;AAGO,MAAM,iCAAiC,MAAM;AAClD,EAAA,MAAM,UAAU,KAAA,EAAM;AACtB,EAAA,MAAM,OAAA,GAAU,OAAmC,IAAI,CAAA;AACvD,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAS,CAAC,CAAA;AAElD,EAAA,UAAA;AAAA,IACE,CAACA,QAAAA,KAA2BA,QAAAA;AAAA,IAC5B,QAAQ,OAAA,GAAU,CAAC,OAAA,CAAQ,OAAA,CAAQ,OAAO,CAAA,GAAI,IAAA;AAAA,IAC9C;AAAA,MACE,qBAAA,EAAuB,KAAA;AAAA,MACvB,UAAU,OAAA,GAAU;AAAA;AACtB,GACF;AAEA,EAAA,OAAO;AAAA,IACL,OAAO,MAAM;AACX,MAAA,OAAA,CAAQ,OAAA,GAAU,QAAQ,aAAA,EAAoB;AAC9C,MAAA,eAAA,CAAgB,CAAC,CAAA,KAAM,CAAA,GAAI,CAAC,CAAA;AAAA,IAC9B,CAAA;AAAA,IACA,MAAM,MAAM;AACV,MAAA,OAAA,CAAQ,SAAS,OAAA,EAAQ;AAAA,IAC3B;AAAA,GACF;AACF;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { components } from '../components.mjs';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { reduce } from 'remeda';
|
|
6
|
+
|
|
7
|
+
const useMergedComponents = (integrations) => useMemo(
|
|
8
|
+
() => new Map(
|
|
9
|
+
Object.entries(
|
|
10
|
+
reduce(
|
|
11
|
+
[...integrations, components],
|
|
12
|
+
(merged, current) => ({
|
|
13
|
+
...merged,
|
|
14
|
+
...current
|
|
15
|
+
}),
|
|
16
|
+
{}
|
|
17
|
+
)
|
|
18
|
+
)
|
|
19
|
+
),
|
|
20
|
+
[...integrations]
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export { useMergedComponents };
|
|
24
|
+
//# sourceMappingURL=useMergedComponents.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMergedComponents.mjs","sources":["../../../src/hooks/useMergedComponents.ts"],"sourcesContent":["import { components } from \"@/components\";\nimport type { RemoteComponentsMap } from \"@/lib/types\";\nimport type { RemoteComponentRendererProps } from \"@mittwald/remote-dom-react/host\";\nimport { type ComponentType, useMemo } from \"react\";\nimport { reduce } from \"remeda\";\n\nexport const useMergedComponents = (\n integrations: RemoteComponentsMap<never>[],\n) =>\n useMemo(\n () =>\n new Map<string, ComponentType<RemoteComponentRendererProps>>(\n Object.entries(\n reduce(\n [...integrations, components],\n (merged, current) => ({\n ...merged,\n ...current,\n }),\n {},\n ),\n ),\n ),\n [...integrations],\n );\n"],"names":[],"mappings":";;;;AAMO,MAAM,mBAAA,GAAsB,CACjC,YAAA,KAEA,OAAA;AAAA,EACE,MACE,IAAI,GAAA;AAAA,IACF,MAAA,CAAO,OAAA;AAAA,MACL,MAAA;AAAA,QACE,CAAC,GAAG,YAAA,EAAc,UAAU,CAAA;AAAA,QAC5B,CAAC,QAAQ,OAAA,MAAa;AAAA,UACpB,GAAG,MAAA;AAAA,UACH,GAAG;AAAA,SACL,CAAA;AAAA,QACA;AAAC;AACH;AACF,GACF;AAAA,EACF,CAAC,GAAG,YAAY;AAClB;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import '@mittwald/flow-remote-core';
|
|
4
|
+
import { useLayoutEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
const useUpdateHostPathnameOnRemote = (hostPathname, connection) => {
|
|
7
|
+
useLayoutEffect(() => {
|
|
8
|
+
if (hostPathname === void 0 || !connection) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const { updateHostPathname } = connection;
|
|
12
|
+
updateHostPathname(hostPathname);
|
|
13
|
+
}, [hostPathname, connection]);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { useUpdateHostPathnameOnRemote };
|
|
17
|
+
//# sourceMappingURL=useUpdateHostPathnameOnRemote.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUpdateHostPathnameOnRemote.mjs","sources":["../../../src/hooks/useUpdateHostPathnameOnRemote.ts"],"sourcesContent":["import { type HostToRemoteConnection } from \"@mittwald/flow-remote-core\";\nimport { useLayoutEffect } from \"react\";\n\n/** Updates the host pathname in the remote connection. */\nexport const useUpdateHostPathnameOnRemote = (\n hostPathname?: string,\n connection?: HostToRemoteConnection,\n) => {\n useLayoutEffect(() => {\n if (hostPathname === undefined || !connection) {\n return;\n }\n\n const { updateHostPathname } = connection;\n updateHostPathname(hostPathname);\n }, [hostPathname, connection]);\n};\n"],"names":[],"mappings":";;;AAIO,MAAM,6BAAA,GAAgC,CAC3C,YAAA,EACA,UAAA,KACG;AACH,EAAA,eAAA,CAAgB,MAAM;AACpB,IAAA,IAAI,YAAA,KAAiB,MAAA,IAAa,CAAC,UAAA,EAAY;AAC7C,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,EAAE,oBAAmB,GAAI,UAAA;AAC/B,IAAA,kBAAA,CAAmB,YAAY,CAAA;AAAA,EACjC,CAAA,EAAG,CAAC,YAAA,EAAc,UAAU,CAAC,CAAA;AAC/B;;;;"}
|
package/dist/js/index.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
RemoteRenderer
|
|
6
|
-
};
|
|
3
|
+
export { RemoteRenderer } from './RemoteRenderer.mjs';
|
|
4
|
+
export { RemoteError } from '@mittwald/flow-remote-core';
|
|
7
5
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import 'react';
|
|
5
|
+
|
|
6
|
+
const Form = (props) => {
|
|
7
|
+
const { onSubmit: onSubmitFromProps, ref, ...rest } = props;
|
|
8
|
+
const onSubmit = async (event) => {
|
|
9
|
+
event.preventDefault();
|
|
10
|
+
await onSubmitFromProps?.();
|
|
11
|
+
};
|
|
12
|
+
return /* @__PURE__ */ jsx("form", { ...rest, ref, onSubmit });
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { Form };
|
|
16
|
+
//# sourceMappingURL=Form.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.mjs","sources":["../../../../src/integrations/react-hook-form/Form.tsx"],"sourcesContent":["import {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n type Ref,\n} from \"react\";\n\ntype FormProps = {\n onSubmit?: () => void | Promise<void>;\n ref?: Ref<HTMLFormElement>;\n} & PropsWithChildren;\n\n/**\n * ReactHookForm won't send the data over onSubmit, the form state is\n * transferred over onChange. To avoid sending unnecessary data, this RemoteForm\n * sends only the onSubmit without any formData.\n */\nexport const Form: FC<FormProps> = (props) => {\n const { onSubmit: onSubmitFromProps, ref, ...rest } = props;\n\n const onSubmit = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n await onSubmitFromProps?.();\n };\n\n return <form {...rest} ref={ref} onSubmit={onSubmit} />;\n};\n"],"names":[],"mappings":";;;AAiBO,MAAM,IAAA,GAAsB,CAAC,KAAA,KAAU;AAC5C,EAAA,MAAM,EAAE,QAAA,EAAU,iBAAA,EAAmB,GAAA,EAAK,GAAG,MAAK,GAAI,KAAA;AAEtD,EAAA,MAAM,QAAA,GAAW,OAAO,KAAA,KAAsC;AAC5D,IAAA,KAAA,CAAM,cAAA,EAAe;AACrB,IAAA,MAAM,iBAAA,IAAoB;AAAA,EAC5B,CAAA;AAEA,EAAA,uBAAO,GAAA,CAAC,MAAA,EAAA,EAAM,GAAG,IAAA,EAAM,KAAU,QAAA,EAAoB,CAAA;AACvD;;;;"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
import { jsx } from
|
|
4
|
-
import {
|
|
5
|
-
import { createRemoteComponentRenderer } from
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { isStyleProp, isReactSuspendedStyle } from './propClassifiers.mjs';
|
|
5
|
+
import { createRemoteComponentRenderer } from '@mittwald/remote-dom-react/host';
|
|
6
|
+
import { FlowRemoteElement } from '@mittwald/flow-remote-elements';
|
|
7
|
+
import { Version } from '@mittwald/flow-remote-core';
|
|
8
|
+
import 'react';
|
|
9
|
+
import { mapValues } from 'remeda';
|
|
10
|
+
|
|
9
11
|
const mapProperty = (val, key) => {
|
|
10
|
-
if (isEventProp(key, val)) {
|
|
11
|
-
return mapEventHandler(val, key);
|
|
12
|
-
}
|
|
13
12
|
if (isStyleProp(key)) {
|
|
14
13
|
if (isReactSuspendedStyle(val)) {
|
|
15
14
|
return {
|
|
@@ -20,17 +19,29 @@ const mapProperty = (val, key) => {
|
|
|
20
19
|
}
|
|
21
20
|
return val;
|
|
22
21
|
};
|
|
23
|
-
const createFlowRemoteComponentRenderer = (Component) => {
|
|
22
|
+
const createFlowRemoteComponentRenderer = (name, Component) => {
|
|
24
23
|
function HostComponent(props) {
|
|
25
24
|
const hostComponentProps = mapValues(
|
|
26
25
|
props,
|
|
27
26
|
(v, k) => mapProperty(v, k)
|
|
28
27
|
);
|
|
29
|
-
|
|
28
|
+
const {
|
|
29
|
+
[FlowRemoteElement.versionPropertyName]: version = Version.v1,
|
|
30
|
+
[FlowRemoteElement.initializationPropertyName]: initialized = false,
|
|
31
|
+
...restProps
|
|
32
|
+
} = hostComponentProps;
|
|
33
|
+
if (version >= Version.v3) {
|
|
34
|
+
if (!initialized) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return /* @__PURE__ */ jsx(Component, { ...restProps });
|
|
30
39
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
HostComponent.displayName = `FlowRemoteRenderer(${name})`;
|
|
41
|
+
return createRemoteComponentRenderer(HostComponent, {
|
|
42
|
+
name: `RemoteRenderer(${name})`
|
|
43
|
+
});
|
|
35
44
|
};
|
|
45
|
+
|
|
46
|
+
export { createFlowRemoteComponentRenderer };
|
|
36
47
|
//# sourceMappingURL=createFlowRemoteComponentRenderer.mjs.map
|
|
@@ -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,WAAA,GAAc,CAAC,GAAA,EAAc,GAAA,KAAgB;AACjD,EAAA,IAAI,WAAA,CAAY,GAAG,CAAA,EAAG;AACpB,IAAA,IAAI,qBAAA,CAAsB,GAAG,CAAA,EAAG;AAC9B,MAAA,OAAO;AAAA,QACL,OAAA,EAAS;AAAA,OACX;AAAA,IACF;AACA,IAAA,OAAO,EAAC;AAAA,EACV;AACA,EAAA,OAAO,GAAA;AACT,CAAA;AAEO,MAAM,iCAAA,GAAoC,CAC/C,IAAA,EACA,SAAA,KACgD;AAChD,EAAA,SAAS,cAAc,KAAA,EAAsC;AAC3D,IAAA,MAAM,kBAAA,GAAqB,SAAA;AAAA,MAAU,KAAA;AAAA,MAAO,CAAC,CAAA,EAAG,CAAA,KAC9C,WAAA,CAAY,GAAG,CAAC;AAAA,KAClB;AAEA,IAAA,MAAM;AAAA,MACJ,CAAC,iBAAA,CAAkB,mBAAmB,GAAG,UAAU,OAAA,CAAQ,EAAA;AAAA,MAC3D,CAAC,iBAAA,CAAkB,0BAA0B,GAAG,WAAA,GAAc,KAAA;AAAA,MAC9D,GAAG;AAAA,KACL,GAAI,kBAAA;AAEJ,IAAA,IAAI,OAAA,IAAW,QAAQ,EAAA,EAAI;AAEzB,MAAA,IAAI,CAAC,WAAA,EAAa;AAChB,QAAA,OAAO,IAAA;AAAA,MACT;AAAA,IACF;AAEA,IAAA,uBAAO,GAAA,CAAC,SAAA,EAAA,EAAW,GAAI,SAAA,EAAiB,CAAA;AAAA,EAC1C;AACA,EAAA,aAAA,CAAc,WAAA,GAAc,sBAAsB,IAAI,CAAA,CAAA,CAAA;AACtD,EAAA,OAAO,8BAA8B,aAAA,EAAe;AAAA,IAClD,IAAA,EAAM,kBAAkB,IAAI,CAAA,CAAA;AAAA,GAC7B,CAAA;AACH;;;;"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
import { mapAttributeToReactProperty } from
|
|
4
|
-
import clsx from
|
|
5
|
-
import { createElement } from
|
|
6
|
-
import { mapKeys } from
|
|
7
|
-
|
|
3
|
+
import { mapAttributeToReactProperty } from './mapAttributeToReactProperty.mjs';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { createElement } from 'react';
|
|
6
|
+
import { mapKeys } from 'remeda';
|
|
7
|
+
|
|
8
|
+
const elementFactory = (element, options = {}) => (props) => {
|
|
8
9
|
const result = { ...props };
|
|
10
|
+
const { isVoidElement = false } = options;
|
|
11
|
+
if (isVoidElement) {
|
|
12
|
+
delete result["children"];
|
|
13
|
+
}
|
|
9
14
|
result["className"] = clsx(
|
|
10
15
|
"className" in result && String(result["className"]),
|
|
11
16
|
"class" in result && String(result["class"])
|
|
@@ -13,7 +18,6 @@ const elementFactory = (element) => (props) => {
|
|
|
13
18
|
delete result["class"];
|
|
14
19
|
return createElement(element, mapKeys(result, mapAttributeToReactProperty));
|
|
15
20
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
21
|
+
|
|
22
|
+
export { elementFactory };
|
|
19
23
|
//# sourceMappingURL=elementFactory.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elementFactory.mjs","sources":["../../../src/lib/elementFactory.ts"],"sourcesContent":["import { mapAttributeToReactProperty } from \"@/lib/mapAttributeToReactProperty\";\nimport clsx from \"clsx\";\nimport { createElement } from \"react\";\nimport { mapKeys } from \"remeda\";\n\ntype ElementTagNameMap = HTMLElementTagNameMap &\n Pick<\n SVGElementTagNameMap,\n Exclude<keyof SVGElementTagNameMap, keyof HTMLElementTagNameMap>\n >;\n\nexport const elementFactory =\n <E extends keyof ElementTagNameMap>(element: E) =>\n (props: Record<string, unknown>) => {\n const result = { ...props };\n\n // merge className and class\n result[\"className\"] = clsx(\n \"className\" in result && String(result[\"className\"]),\n \"class\" in result && String(result[\"class\"]),\n );\n\n delete result[\"class\"];\n\n return createElement(element, mapKeys(result, mapAttributeToReactProperty));\n };\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"elementFactory.mjs","sources":["../../../src/lib/elementFactory.ts"],"sourcesContent":["import { mapAttributeToReactProperty } from \"@/lib/mapAttributeToReactProperty\";\nimport clsx from \"clsx\";\nimport { createElement } from \"react\";\nimport { mapKeys } from \"remeda\";\n\ntype ElementTagNameMap = HTMLElementTagNameMap &\n Pick<\n SVGElementTagNameMap,\n Exclude<keyof SVGElementTagNameMap, keyof HTMLElementTagNameMap>\n >;\n\ninterface Options {\n isVoidElement?: boolean;\n}\n\nexport const elementFactory =\n <E extends keyof ElementTagNameMap>(element: E, options: Options = {}) =>\n (props: Record<string, unknown>) => {\n const result = { ...props };\n const { isVoidElement = false } = options;\n\n if (isVoidElement) {\n delete result[\"children\"];\n }\n\n // merge className and class\n result[\"className\"] = clsx(\n \"className\" in result && String(result[\"className\"]),\n \"class\" in result && String(result[\"class\"]),\n );\n\n delete result[\"class\"];\n\n return createElement(element, mapKeys(result, mapAttributeToReactProperty));\n };\n"],"names":[],"mappings":";;;;;AAeO,MAAM,iBACX,CAAoC,OAAA,EAAY,UAAmB,EAAC,KACpE,CAAC,KAAA,KAAmC;AAClC,EAAA,MAAM,MAAA,GAAS,EAAE,GAAG,KAAA,EAAM;AAC1B,EAAA,MAAM,EAAE,aAAA,GAAgB,KAAA,EAAM,GAAI,OAAA;AAElC,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,OAAO,OAAO,UAAU,CAAA;AAAA,EAC1B;AAGA,EAAA,MAAA,CAAO,WAAW,CAAA,GAAI,IAAA;AAAA,IACpB,WAAA,IAAe,MAAA,IAAU,MAAA,CAAO,MAAA,CAAO,WAAW,CAAC,CAAA;AAAA,IACnD,OAAA,IAAW,MAAA,IAAU,MAAA,CAAO,MAAA,CAAO,OAAO,CAAC;AAAA,GAC7C;AAEA,EAAA,OAAO,OAAO,OAAO,CAAA;AAErB,EAAA,OAAO,aAAA,CAAc,OAAA,EAAS,OAAA,CAAQ,MAAA,EAAQ,2BAA2B,CAAC,CAAA;AAC5E;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
import { toCamelCase } from
|
|
3
|
+
import { toCamelCase } from 'remeda';
|
|
4
|
+
|
|
4
5
|
const keepWhenStartsWith = ["aria-", "data-"];
|
|
5
6
|
const mapAttributeToReactProperty = (key) => {
|
|
6
7
|
if (keepWhenStartsWith.some((prefix) => key.startsWith(prefix))) {
|
|
@@ -8,7 +9,6 @@ const mapAttributeToReactProperty = (key) => {
|
|
|
8
9
|
}
|
|
9
10
|
return toCamelCase(key);
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
12
|
+
|
|
13
|
+
export { mapAttributeToReactProperty };
|
|
14
14
|
//# sourceMappingURL=mapAttributeToReactProperty.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapAttributeToReactProperty.mjs","sources":["../../../src/lib/mapAttributeToReactProperty.ts"],"sourcesContent":["import { toCamelCase } from \"remeda\";\n\nconst keepWhenStartsWith = [\"aria-\", \"data-\"];\n\nexport const mapAttributeToReactProperty = (key: string) => {\n if (keepWhenStartsWith.some((prefix) => key.startsWith(prefix))) {\n return key;\n }\n\n return toCamelCase(key);\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mapAttributeToReactProperty.mjs","sources":["../../../src/lib/mapAttributeToReactProperty.ts"],"sourcesContent":["import { toCamelCase } from \"remeda\";\n\nconst keepWhenStartsWith = [\"aria-\", \"data-\"];\n\nexport const mapAttributeToReactProperty = (key: string) => {\n if (keepWhenStartsWith.some((prefix) => key.startsWith(prefix))) {\n return key;\n }\n\n return toCamelCase(key);\n};\n"],"names":[],"mappings":";;AAEA,MAAM,kBAAA,GAAqB,CAAC,OAAA,EAAS,OAAO,CAAA;AAErC,MAAM,2BAAA,GAA8B,CAAC,GAAA,KAAgB;AAC1D,EAAA,IAAI,kBAAA,CAAmB,KAAK,CAAC,MAAA,KAAW,IAAI,UAAA,CAAW,MAAM,CAAC,CAAA,EAAG;AAC/D,IAAA,OAAO,GAAA;AAAA,EACT;AAEA,EAAA,OAAO,YAAY,GAAG,CAAA;AACxB;;;;"}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
import { isFunction } from "remeda";
|
|
4
|
-
const defaultEventPropMatcher = /on[A-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
|
-
|
|
9
|
-
|
|
10
|
-
isReactSuspendedStyle,
|
|
11
|
-
isStyleProp
|
|
12
|
-
};
|
|
5
|
+
|
|
6
|
+
export { isReactSuspendedStyle, isStyleProp };
|
|
13
7
|
//# sourceMappingURL=propClassifiers.mjs.map
|
|
@@ -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":"AAAO,MAAM,WAAA,GAAc,CAAC,IAAA,KAA0B,IAAA,KAAS;AAExD,MAAM,qBAAA,GAAwB,CAAC,KAAA,KACpC,KAAA,KAAU;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { RemoteRendererBrowserProps } from './RemoteRendererBrowser';
|
|
1
2
|
import { FC } from 'react';
|
|
2
|
-
|
|
3
|
-
export declare const RemoteRenderer: FC<RemoteRendererProps>;
|
|
3
|
+
export declare const RemoteRenderer: FC<RemoteRendererBrowserProps>;
|
|
4
4
|
export default RemoteRenderer;
|
|
5
5
|
//# sourceMappingURL=RemoteRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteRenderer.d.ts","sourceRoot":"","sources":["../../src/RemoteRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"RemoteRenderer.d.ts","sourceRoot":"","sources":["../../src/RemoteRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAMvC,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,0BAA0B,CAMzD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RemoteComponentsMap } from './lib/types';
|
|
2
|
+
import { NavigationState, RemoteExtBridgeConnectionApi } from '@mittwald/flow-remote-core';
|
|
3
|
+
import { RemoteReceiver } from '@mittwald/remote-dom-react/host';
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
export interface RemoteRendererBrowserProps {
|
|
6
|
+
integrations?: RemoteComponentsMap<never>[];
|
|
7
|
+
src?: string;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
onNavigationStateChanged?: (state: NavigationState) => void;
|
|
10
|
+
hostPathname?: string;
|
|
11
|
+
extBridgeImplementation?: RemoteExtBridgeConnectionApi;
|
|
12
|
+
/** Internal use only */
|
|
13
|
+
__remoteReceiver?: RemoteReceiver;
|
|
14
|
+
}
|
|
15
|
+
export declare const RemoteRendererBrowser: FC<RemoteRendererBrowserProps>;
|
|
16
|
+
export default RemoteRendererBrowser;
|
|
17
|
+
//# sourceMappingURL=RemoteRendererBrowser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteRendererBrowser.d.ts","sourceRoot":"","sources":["../../src/RemoteRendererBrowser.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,EAEf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,KAAK,EAAE,EAKR,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,0BAA0B;IACzC,YAAY,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,4BAA4B,CAAC;IACvD,wBAAwB;IACxB,gBAAgB,CAAC,EAAE,cAAc,CAAC;CACnC;AAWD,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAiJhE,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|