@mittwald/flow-remote-elements 0.2.0-alpha.237 → 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/FlowRemoteElement.mjs +3 -14
- package/dist/js/lib/FlowRemoteElement.mjs.map +1 -1
- package/dist/types/lib/FlowRemoteElement.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/js/lib/getObjectKeysIncludingProtoTypes.mjs +0 -10
- package/dist/js/lib/getObjectKeysIncludingProtoTypes.mjs.map +0 -1
- package/dist/types/lib/getObjectKeysIncludingProtoTypes.d.ts +0 -2
- package/dist/types/lib/getObjectKeysIncludingProtoTypes.d.ts.map +0 -1
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { getObjectKeysIncludingProtoTypes } from './getObjectKeysIncludingProtoTypes.mjs';
|
|
2
1
|
import { RemoteElement, RemoteEvent } from '@mittwald/flow-remote-core';
|
|
3
|
-
import { isArray, isObjectType, omit } from 'remeda';
|
|
4
2
|
|
|
5
3
|
class FlowRemoteElement extends RemoteElement {
|
|
6
4
|
eventListenerMap = /* @__PURE__ */ new Map();
|
|
@@ -21,19 +19,10 @@ class FlowRemoteElement extends RemoteElement {
|
|
|
21
19
|
addEventListener(type, listener, options) {
|
|
22
20
|
const finalListener = listener ? "handleEvent" in listener ? listener.handleEvent : listener : null;
|
|
23
21
|
const wrappedEventListener = (event) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (!isArray(event.detail) && isObjectType(event.detail)) {
|
|
27
|
-
const propsToLiftUpFromDetails = omit(
|
|
28
|
-
event.detail,
|
|
29
|
-
getObjectKeysIncludingProtoTypes(event)
|
|
30
|
-
);
|
|
31
|
-
Object.assign(event, propsToLiftUpFromDetails);
|
|
32
|
-
} else {
|
|
33
|
-
finalEvent = event.detail;
|
|
34
|
-
}
|
|
22
|
+
if (!finalListener) {
|
|
23
|
+
return;
|
|
35
24
|
}
|
|
36
|
-
return finalListener
|
|
25
|
+
return finalListener(event instanceof RemoteEvent ? event.detail : event);
|
|
37
26
|
};
|
|
38
27
|
this.eventListenerMap.set(listener, wrappedEventListener);
|
|
39
28
|
return super.addEventListener(type, wrappedEventListener, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowRemoteElement.mjs","sources":["../../../src/lib/FlowRemoteElement.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"FlowRemoteElement.mjs","sources":["../../../src/lib/FlowRemoteElement.ts"],"sourcesContent":["import {\n RemoteElement,\n RemoteEvent,\n type Version,\n} from \"@mittwald/flow-remote-core\";\nimport type { EmptyObject } from \"type-fest\";\n\n// eslint-disable-next-line\ntype ExplicitAny = any;\n\nexport class FlowRemoteElement<\n Properties extends Record<string, ExplicitAny> = EmptyObject,\n Methods extends Record<\n string,\n (...args: ExplicitAny[]) => void\n > = EmptyObject,\n Slots extends Record<string, ExplicitAny> = EmptyObject,\n EventListeners extends Record<string, ExplicitAny> = EmptyObject,\n> extends RemoteElement<Properties, Methods, Slots, EventListeners> {\n private eventListenerMap = new Map<\n EventListenerOrEventListenerObject,\n EventListenerOrEventListenerObject\n >();\n\n /**\n * This property is used to check if the host component has received its\n * remote props. If not, rendering the underlying component is skipped.\n */\n public static initializationPropertyName = \"data-flr-initialized\" as const;\n\n public static versionPropertyName = \"data-flr-version\" as const;\n\n static override get remoteProperties() {\n return {\n ...super.remoteAttributes,\n \"data-testid\": {},\n [FlowRemoteElement.initializationPropertyName]: {},\n [FlowRemoteElement.versionPropertyName]: {},\n };\n }\n\n public override addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void {\n const finalListener = listener\n ? \"handleEvent\" in listener\n ? listener.handleEvent\n : listener\n : null;\n\n const wrappedEventListener: EventListener = (event) => {\n if (!finalListener) {\n return;\n }\n return finalListener(event instanceof RemoteEvent ? event.detail : event);\n };\n\n this.eventListenerMap.set(listener, wrappedEventListener);\n\n return super.addEventListener(type, wrappedEventListener, options);\n }\n\n public override removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ) {\n const wrappedEventListener = this.eventListenerMap.get(listener);\n this.eventListenerMap.delete(listener);\n super.removeEventListener(type, wrappedEventListener ?? listener, options);\n }\n}\n\nexport interface FlowRemoteElementMetaData {\n [FlowRemoteElement.initializationPropertyName]?: boolean;\n [FlowRemoteElement.versionPropertyName]?: Version;\n}\n"],"names":[],"mappings":";;AAUO,MAAM,0BAQH,aAA0D,CAAA;AAAA,EAC1D,gBAAA,uBAAuB,GAG7B,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMF,OAAc,0BAA6B,GAAA,sBAAA;AAAA,EAE3C,OAAc,mBAAsB,GAAA,kBAAA;AAAA,EAEpC,WAAoB,gBAAmB,GAAA;AACrC,IAAO,OAAA;AAAA,MACL,GAAG,KAAM,CAAA,gBAAA;AAAA,MACT,eAAe,EAAC;AAAA,MAChB,CAAC,iBAAA,CAAkB,0BAA0B,GAAG,EAAC;AAAA,MACjD,CAAC,iBAAA,CAAkB,mBAAmB,GAAG;AAAC,KAC5C;AAAA;AACF,EAEgB,gBAAA,CACd,IACA,EAAA,QAAA,EACA,OACM,EAAA;AACN,IAAA,MAAM,gBAAgB,QAClB,GAAA,aAAA,IAAiB,QACf,GAAA,QAAA,CAAS,cACT,QACF,GAAA,IAAA;AAEJ,IAAM,MAAA,oBAAA,GAAsC,CAAC,KAAU,KAAA;AACrD,MAAA,IAAI,CAAC,aAAe,EAAA;AAClB,QAAA;AAAA;AAEF,MAAA,OAAO,aAAc,CAAA,KAAA,YAAiB,WAAc,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AAAA,KAC1E;AAEA,IAAK,IAAA,CAAA,gBAAA,CAAiB,GAAI,CAAA,QAAA,EAAU,oBAAoB,CAAA;AAExD,IAAA,OAAO,KAAM,CAAA,gBAAA,CAAiB,IAAM,EAAA,oBAAA,EAAsB,OAAO,CAAA;AAAA;AACnE,EAEgB,mBAAA,CACd,IACA,EAAA,QAAA,EACA,OACA,EAAA;AACA,IAAA,MAAM,oBAAuB,GAAA,IAAA,CAAK,gBAAiB,CAAA,GAAA,CAAI,QAAQ,CAAA;AAC/D,IAAK,IAAA,CAAA,gBAAA,CAAiB,OAAO,QAAQ,CAAA;AACrC,IAAA,KAAA,CAAM,mBAAoB,CAAA,IAAA,EAAM,oBAAwB,IAAA,QAAA,EAAU,OAAO,CAAA;AAAA;AAE7E;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowRemoteElement.d.ts","sourceRoot":"","sources":["../../../src/lib/FlowRemoteElement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FlowRemoteElement.d.ts","sourceRoot":"","sources":["../../../src/lib/FlowRemoteElement.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,KAAK,OAAO,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C,KAAK,WAAW,GAAG,GAAG,CAAC;AAEvB,qBAAa,iBAAiB,CAC5B,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,WAAW,EAC5D,OAAO,SAAS,MAAM,CACpB,MAAM,EACN,CAAC,GAAG,IAAI,EAAE,WAAW,EAAE,KAAK,IAAI,CACjC,GAAG,WAAW,EACf,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,WAAW,EACvD,cAAc,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,WAAW,CAChE,SAAQ,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,CAAC;IACjE,OAAO,CAAC,gBAAgB,CAGpB;IAEJ;;;OAGG;IACH,OAAc,0BAA0B,EAAG,sBAAsB,CAAU;IAE3E,OAAc,mBAAmB,EAAG,kBAAkB,CAAU;IAEhE,WAAoB,gBAAgB,QAOnC;IAEe,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI;IAmBS,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB;CAM3C;AAED,MAAM,WAAW,yBAAyB;IACxC,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAAC,EAAE,OAAO,CAAC;IACzD,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC,EAAE,OAAO,CAAC;CACnD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-remote-elements",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.238",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Flow compatible remote elements that can be used in a remote environment",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"test:compile": "tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@mittwald/flow-remote-core": "0.2.0-alpha.
|
|
27
|
+
"@mittwald/flow-remote-core": "0.2.0-alpha.238",
|
|
28
28
|
"remeda": "^2.22.3",
|
|
29
29
|
"type-fest": "^4.41.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@mittwald/flow-react-components": "0.2.0-alpha.
|
|
32
|
+
"@mittwald/flow-react-components": "0.2.0-alpha.238",
|
|
33
33
|
"@mittwald/typescript-config": "",
|
|
34
34
|
"@types/node": "^22.15.23",
|
|
35
35
|
"nx": "^20.8.2",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@mittwald/flow-react-components": "*"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "c7e6ccf29058d3b39ca5cc018bb98b01a75a9b24"
|
|
49
49
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const getObjectKeysIncludingProtoTypes = (something) => {
|
|
2
|
-
const result = [];
|
|
3
|
-
for (const key in something) {
|
|
4
|
-
result.push(key);
|
|
5
|
-
}
|
|
6
|
-
return result;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export { getObjectKeysIncludingProtoTypes };
|
|
10
|
-
//# sourceMappingURL=getObjectKeysIncludingProtoTypes.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getObjectKeysIncludingProtoTypes.mjs","sources":["../../../src/lib/getObjectKeysIncludingProtoTypes.ts"],"sourcesContent":["export const getObjectKeysIncludingProtoTypes = (something: object) => {\n const result: string[] = [];\n\n for (const key in something) {\n result.push(key);\n }\n\n return result;\n};\n"],"names":[],"mappings":"AAAa,MAAA,gCAAA,GAAmC,CAAC,SAAsB,KAAA;AACrE,EAAA,MAAM,SAAmB,EAAC;AAE1B,EAAA,KAAA,MAAW,OAAO,SAAW,EAAA;AAC3B,IAAA,MAAA,CAAO,KAAK,GAAG,CAAA;AAAA;AAGjB,EAAO,OAAA,MAAA;AACT;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getObjectKeysIncludingProtoTypes.d.ts","sourceRoot":"","sources":["../../../src/lib/getObjectKeysIncludingProtoTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,GAAI,WAAW,MAAM,aAQjE,CAAC"}
|