@makeswift/runtime 0.28.4-canary.0 → 0.28.4-canary.2
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/cjs/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/builder/serialization.js +78 -0
- package/dist/cjs/builder/serialization.js.map +1 -0
- package/dist/cjs/client/index.js +3 -3
- package/dist/cjs/controls/serialization/base/index.js +76 -0
- package/dist/cjs/controls/serialization/base/index.js.map +1 -0
- package/dist/cjs/controls/{visitors/message-port-serializer/client-message-port-serialization-visitor.js → serialization/base/visitor.js} +9 -22
- package/dist/cjs/controls/serialization/base/visitor.js.map +1 -0
- package/dist/cjs/controls/serialization/index.js +55 -0
- package/dist/cjs/controls/serialization/index.js.map +1 -0
- package/dist/cjs/controls/serialization/message-port/function-serialization.js.map +1 -0
- package/dist/cjs/{builder/serialization → controls/serialization/message-port}/index.js +6 -6
- package/dist/cjs/controls/serialization/message-port/index.js.map +1 -0
- package/dist/cjs/controls/{visitors/message-port-serializer/index.js → serialization/message-port/visitor.js} +25 -13
- package/dist/cjs/controls/serialization/message-port/visitor.js.map +1 -0
- package/dist/cjs/{builder/serialization/control-serialization.js → prop-controllers/serialization.js} +41 -144
- package/dist/cjs/prop-controllers/serialization.js.map +1 -0
- package/dist/cjs/state/modules/element-trees.js +45 -19
- package/dist/cjs/state/modules/element-trees.js.map +1 -1
- package/dist/esm/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/builder/serialization.js +59 -0
- package/dist/esm/builder/serialization.js.map +1 -0
- package/dist/esm/client/index.js +3 -3
- package/dist/esm/controls/serialization/base/index.js +74 -0
- package/dist/esm/controls/serialization/base/index.js.map +1 -0
- package/dist/esm/controls/{visitors/message-port-serializer/client-message-port-serialization-visitor.js → serialization/base/visitor.js} +6 -20
- package/dist/esm/controls/serialization/base/visitor.js.map +1 -0
- package/dist/esm/controls/serialization/index.js +30 -0
- package/dist/esm/controls/serialization/index.js.map +1 -0
- package/dist/esm/controls/serialization/message-port/function-serialization.js.map +1 -0
- package/dist/esm/controls/serialization/message-port/index.js +3 -0
- package/dist/esm/controls/serialization/message-port/index.js.map +1 -0
- package/dist/esm/controls/serialization/message-port/visitor.js +24 -0
- package/dist/esm/controls/serialization/message-port/visitor.js.map +1 -0
- package/dist/esm/{builder/serialization/control-serialization.js → prop-controllers/serialization.js} +11 -136
- package/dist/esm/prop-controllers/serialization.js.map +1 -0
- package/dist/esm/state/modules/element-trees.js +46 -20
- package/dist/esm/state/modules/element-trees.js.map +1 -1
- package/dist/types/api-handler/handlers/webhook/types.d.ts +4 -4
- package/dist/types/builder/serialization.d.ts +23 -0
- package/dist/types/builder/serialization.d.ts.map +1 -0
- package/dist/types/builder/serialization.test.d.ts +2 -0
- package/dist/types/builder/serialization.test.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +4 -4
- package/dist/types/controls/serialization/base/index.d.ts +10 -0
- package/dist/types/controls/serialization/base/index.d.ts.map +1 -0
- package/dist/types/controls/serialization/base/visitor.d.ts +7 -0
- package/dist/types/controls/serialization/base/visitor.d.ts.map +1 -0
- package/dist/types/controls/serialization/index.d.ts +10 -0
- package/dist/types/controls/serialization/index.d.ts.map +1 -0
- package/dist/types/controls/{visitors/message-port-serializer → serialization/message-port}/function-serialization.d.ts +1 -1
- package/dist/types/controls/serialization/message-port/function-serialization.d.ts.map +1 -0
- package/dist/types/controls/serialization/message-port/function-serialization.test.d.ts.map +1 -0
- package/dist/types/controls/serialization/message-port/index.d.ts +3 -0
- package/dist/types/controls/serialization/message-port/index.d.ts.map +1 -0
- package/dist/types/controls/serialization/message-port/visitor.d.ts +7 -0
- package/dist/types/controls/serialization/message-port/visitor.d.ts.map +1 -0
- package/dist/types/{builder/serialization/control-serialization.d.ts → prop-controllers/serialization.d.ts} +11 -29
- package/dist/types/prop-controllers/serialization.d.ts.map +1 -0
- package/dist/types/slate/BlockPlugin/index.d.ts +3 -3
- package/dist/types/state/modules/__tests__/fixtures/element-trees-demo-component.d.ts +4 -0
- package/dist/types/state/modules/__tests__/fixtures/element-trees-demo-component.d.ts.map +1 -1
- package/dist/types/state/modules/__tests__/fixtures/element-trees.d.ts +7 -0
- package/dist/types/state/modules/__tests__/fixtures/element-trees.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/builder/serialization/control-serialization.js.map +0 -1
- package/dist/cjs/builder/serialization/controls/types.js +0 -17
- package/dist/cjs/builder/serialization/controls/types.js.map +0 -1
- package/dist/cjs/builder/serialization/function-serialization.js +0 -57
- package/dist/cjs/builder/serialization/function-serialization.js.map +0 -1
- package/dist/cjs/builder/serialization/index.js.map +0 -1
- package/dist/cjs/controls/visitors/message-port-serializer/client-message-port-serialization-visitor.js.map +0 -1
- package/dist/cjs/controls/visitors/message-port-serializer/function-serialization.js.map +0 -1
- package/dist/cjs/controls/visitors/message-port-serializer/index.js.map +0 -1
- package/dist/esm/builder/serialization/control-serialization.js.map +0 -1
- package/dist/esm/builder/serialization/controls/types.js +0 -1
- package/dist/esm/builder/serialization/controls/types.js.map +0 -1
- package/dist/esm/builder/serialization/function-serialization.js +0 -31
- package/dist/esm/builder/serialization/function-serialization.js.map +0 -1
- package/dist/esm/builder/serialization/index.js +0 -3
- package/dist/esm/builder/serialization/index.js.map +0 -1
- package/dist/esm/controls/visitors/message-port-serializer/client-message-port-serialization-visitor.js.map +0 -1
- package/dist/esm/controls/visitors/message-port-serializer/function-serialization.js.map +0 -1
- package/dist/esm/controls/visitors/message-port-serializer/index.js +0 -13
- package/dist/esm/controls/visitors/message-port-serializer/index.js.map +0 -1
- package/dist/types/builder/serialization/control-serialization.d.ts.map +0 -1
- package/dist/types/builder/serialization/control-serialization.test.d.ts +0 -2
- package/dist/types/builder/serialization/control-serialization.test.d.ts.map +0 -1
- package/dist/types/builder/serialization/controls/types.d.ts +0 -10
- package/dist/types/builder/serialization/controls/types.d.ts.map +0 -1
- package/dist/types/builder/serialization/function-serialization.d.ts +0 -12
- package/dist/types/builder/serialization/function-serialization.d.ts.map +0 -1
- package/dist/types/builder/serialization/function-serialization.test.d.ts.map +0 -1
- package/dist/types/builder/serialization/index.d.ts +0 -4
- package/dist/types/builder/serialization/index.d.ts.map +0 -1
- package/dist/types/controls/visitors/message-port-serializer/client-message-port-serialization-visitor.d.ts +0 -9
- package/dist/types/controls/visitors/message-port-serializer/client-message-port-serialization-visitor.d.ts.map +0 -1
- package/dist/types/controls/visitors/message-port-serializer/function-serialization.d.ts.map +0 -1
- package/dist/types/controls/visitors/message-port-serializer/function-serialization.test.d.ts +0 -2
- package/dist/types/controls/visitors/message-port-serializer/function-serialization.test.d.ts.map +0 -1
- package/dist/types/controls/visitors/message-port-serializer/index.d.ts +0 -3
- package/dist/types/controls/visitors/message-port-serializer/index.d.ts.map +0 -1
- /package/dist/cjs/controls/{visitors/message-port-serializer → serialization/message-port}/function-serialization.js +0 -0
- /package/dist/esm/controls/{visitors/message-port-serializer → serialization/message-port}/function-serialization.js +0 -0
- /package/dist/types/{builder/serialization → controls/serialization/message-port}/function-serialization.test.d.ts +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deserializeObject
|
|
3
|
+
} from "@makeswift/controls";
|
|
4
|
+
import {
|
|
5
|
+
serializeLegacyControl,
|
|
6
|
+
deserializeLegacyControl
|
|
7
|
+
} from "../prop-controllers/serialization";
|
|
8
|
+
import { isLegacyDescriptor } from "../prop-controllers/descriptors";
|
|
9
|
+
import { deserializeControl as deserializeUnifiedControl } from "../controls/serialization/base";
|
|
10
|
+
import {
|
|
11
|
+
ClientMessagePortSerializationVisitor,
|
|
12
|
+
functionDeserializationPlugin
|
|
13
|
+
} from "../controls/serialization/message-port";
|
|
14
|
+
import {
|
|
15
|
+
deserializeControlRecords
|
|
16
|
+
} from "../controls/serialization";
|
|
17
|
+
export * from "../prop-controllers/serialization";
|
|
18
|
+
function serializeControl(control) {
|
|
19
|
+
if (isLegacyDescriptor(control)) {
|
|
20
|
+
return serializeLegacyControl(control);
|
|
21
|
+
}
|
|
22
|
+
const messagePortVisitor = new ClientMessagePortSerializationVisitor();
|
|
23
|
+
const serializedControl = control.accept(messagePortVisitor);
|
|
24
|
+
return [serializedControl, messagePortVisitor.getTransferables()];
|
|
25
|
+
}
|
|
26
|
+
function isSerializedLegacyControl(control) {
|
|
27
|
+
return "options" in control;
|
|
28
|
+
}
|
|
29
|
+
function deserializeControl(serializedControl, options) {
|
|
30
|
+
if (isSerializedLegacyControl(serializedControl)) {
|
|
31
|
+
const record = options?.plugins ? deserializeObject(serializedControl, options?.plugins) : serializedControl;
|
|
32
|
+
return deserializeLegacyControl(record);
|
|
33
|
+
}
|
|
34
|
+
const plugins = [functionDeserializationPlugin, ...options?.plugins ?? []];
|
|
35
|
+
return deserializeUnifiedControl(serializedControl, { plugins });
|
|
36
|
+
}
|
|
37
|
+
function serializeControls(controls) {
|
|
38
|
+
return Object.entries(controls).reduce(
|
|
39
|
+
([accControls, accTransferables], [key, control]) => {
|
|
40
|
+
const [serializedControl, transferables] = serializeControl(control);
|
|
41
|
+
return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]];
|
|
42
|
+
},
|
|
43
|
+
[{}, []]
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function deserializeControls(serializedControls, { onError, plugins } = {}) {
|
|
47
|
+
return deserializeControlRecords(
|
|
48
|
+
serializedControls,
|
|
49
|
+
(serializedControl, options) => deserializeControl(serializedControl, options),
|
|
50
|
+
{ onError, plugins }
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
deserializeControl,
|
|
55
|
+
deserializeControls,
|
|
56
|
+
serializeControl,
|
|
57
|
+
serializeControls
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=serialization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/builder/serialization.ts"],"sourcesContent":["import {\n type Data,\n ControlDefinition as UnifiedControlDefinition,\n type SerializedRecord,\n DeserializationPlugin,\n deserializeObject,\n} from '@makeswift/controls'\n\nimport {\n type SerializedLegacyControl,\n type DeserializedLegacyControl,\n serializeLegacyControl,\n deserializeLegacyControl,\n} from '../prop-controllers/serialization'\n\nimport { type Descriptor, isLegacyDescriptor } from '../prop-controllers/descriptors'\n\nimport { deserializeControl as deserializeUnifiedControl } from '../controls/serialization/base'\nimport {\n type DeserializedFunction,\n type SerializedFunction,\n ClientMessagePortSerializationVisitor,\n functionDeserializationPlugin,\n} from '../controls/serialization/message-port'\n\nimport {\n type DeserializeControlRecordsOptions,\n deserializeControlRecords,\n} from '../controls/serialization'\n\nexport * from '../prop-controllers/serialization'\n\nexport type SerializedControl<T extends Data = Data> = SerializedLegacyControl<T> | SerializedRecord\n\nexport type DeserializedControl<T extends Data = Data> =\n | DeserializedLegacyControl<T>\n | UnifiedControlDefinition\n\nexport function serializeControl<T extends Data>(\n control: Descriptor<T>,\n): [SerializedControl<T>, Transferable[]] {\n if (isLegacyDescriptor(control)) {\n return serializeLegacyControl(control)\n }\n\n const messagePortVisitor = new ClientMessagePortSerializationVisitor()\n const serializedControl = control.accept(messagePortVisitor)\n return [serializedControl, messagePortVisitor.getTransferables()]\n}\n\nfunction isSerializedLegacyControl<T extends Data>(\n control: SerializedControl<T>,\n): control is SerializedLegacyControl<T> {\n return 'options' in control\n}\n\nexport type DeserializeControlOptions = {\n plugins?: DeserializationPlugin<any>[]\n}\n\nexport function deserializeControl<T extends Data>(\n serializedControl: SerializedControl<T>,\n options?: DeserializeControlOptions,\n): DeserializedControl<T> {\n if (isSerializedLegacyControl(serializedControl)) {\n // Parity with controls deserialization logic below: \"preprocess\" serialized\n // legacy controls if the caller provided custom deserialization plugins\n const record = options?.plugins\n ? deserializeObject(serializedControl, options?.plugins)\n : serializedControl\n return deserializeLegacyControl(record as SerializedLegacyControl<T>)\n }\n\n const plugins = [functionDeserializationPlugin, ...(options?.plugins ?? [])]\n return deserializeUnifiedControl(serializedControl, { plugins })\n}\n\nexport function serializeControls(\n controls: Record<string, Descriptor>,\n): [Record<string, SerializedControl>, Transferable[]] {\n return Object.entries(controls).reduce(\n ([accControls, accTransferables], [key, control]) => {\n const [serializedControl, transferables] = serializeControl(control)\n\n return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]]\n },\n [{}, []] as [Record<string, SerializedControl>, Transferable[]],\n )\n}\n\nexport function deserializeControls(\n serializedControls: Record<string, unknown>,\n { onError, plugins }: DeserializeControlRecordsOptions = {},\n): Record<string, DeserializedControl> {\n return deserializeControlRecords<DeserializedControl>(\n serializedControls,\n (serializedControl, options) => deserializeControl(serializedControl, options),\n { onError, plugins },\n )\n}\n\ntype AnyFunction = (...args: any[]) => any\n\nexport type Serialize<T> = T extends AnyFunction\n ? SerializedFunction<T>\n : T extends Record<string, unknown>\n ? { [K in keyof T]: Serialize<T[K]> }\n : T\n\nexport type Deserialize<T> =\n T extends SerializedFunction<infer U>\n ? DeserializedFunction<U>\n : T extends Record<string, unknown>\n ? { [K in keyof T]: Deserialize<T[K]> }\n : T\n"],"mappings":"AAAA;AAAA,EAKE;AAAA,OACK;AAEP;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAEP,SAA0B,0BAA0B;AAEpD,SAAS,sBAAsB,iCAAiC;AAChE;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EAEE;AAAA,OACK;AAEP,cAAc;AAQP,SAAS,iBACd,SACwC;AACxC,MAAI,mBAAmB,OAAO,GAAG;AAC/B,WAAO,uBAAuB,OAAO;AAAA,EACvC;AAEA,QAAM,qBAAqB,IAAI,sCAAsC;AACrE,QAAM,oBAAoB,QAAQ,OAAO,kBAAkB;AAC3D,SAAO,CAAC,mBAAmB,mBAAmB,iBAAiB,CAAC;AAClE;AAEA,SAAS,0BACP,SACuC;AACvC,SAAO,aAAa;AACtB;AAMO,SAAS,mBACd,mBACA,SACwB;AACxB,MAAI,0BAA0B,iBAAiB,GAAG;AAGhD,UAAM,SAAS,SAAS,UACpB,kBAAkB,mBAAmB,SAAS,OAAO,IACrD;AACJ,WAAO,yBAAyB,MAAoC;AAAA,EACtE;AAEA,QAAM,UAAU,CAAC,+BAA+B,GAAI,SAAS,WAAW,CAAC,CAAE;AAC3E,SAAO,0BAA0B,mBAAmB,EAAE,QAAQ,CAAC;AACjE;AAEO,SAAS,kBACd,UACqD;AACrD,SAAO,OAAO,QAAQ,QAAQ,EAAE;AAAA,IAC9B,CAAC,CAAC,aAAa,gBAAgB,GAAG,CAAC,KAAK,OAAO,MAAM;AACnD,YAAM,CAAC,mBAAmB,aAAa,IAAI,iBAAiB,OAAO;AAEnE,aAAO,CAAC,EAAE,GAAG,aAAa,CAAC,GAAG,GAAG,kBAAkB,GAAG,CAAC,GAAG,kBAAkB,GAAG,aAAa,CAAC;AAAA,IAC/F;AAAA,IACA,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,EACT;AACF;AAEO,SAAS,oBACd,oBACA,EAAE,SAAS,QAAQ,IAAsC,CAAC,GACrB;AACrC,SAAO;AAAA,IACL;AAAA,IACA,CAAC,mBAAmB,YAAY,mBAAmB,mBAAmB,OAAO;AAAA,IAC7E,EAAE,SAAS,QAAQ;AAAA,EACrB;AACF;","names":[]}
|
package/dist/esm/client/index.js
CHANGED
|
@@ -198,7 +198,7 @@ Received "${apiKey}" instead.`
|
|
|
198
198
|
}
|
|
199
199
|
this.apiKey = apiKey;
|
|
200
200
|
this.graphqlClient = new GraphQLClient(new URL("graphql", runtime.apiOrigin).href, {
|
|
201
|
-
"makeswift-runtime-version": "0.28.4-canary.
|
|
201
|
+
"makeswift-runtime-version": "0.28.4-canary.2"
|
|
202
202
|
});
|
|
203
203
|
this.runtime = runtime;
|
|
204
204
|
}
|
|
@@ -210,7 +210,7 @@ Received "${apiKey}" instead.`
|
|
|
210
210
|
const requestHeaders = new Headers({
|
|
211
211
|
"x-api-key": this.apiKey,
|
|
212
212
|
"makeswift-site-api-key": this.apiKey,
|
|
213
|
-
"makeswift-runtime-version": "0.28.4-canary.
|
|
213
|
+
"makeswift-runtime-version": "0.28.4-canary.2"
|
|
214
214
|
});
|
|
215
215
|
if (siteVersion?.token) {
|
|
216
216
|
requestUrl.searchParams.set("version", siteVersion.version);
|
|
@@ -935,7 +935,7 @@ Received "${apiKey}" instead.`
|
|
|
935
935
|
headers: {
|
|
936
936
|
"x-api-key": this.apiKey,
|
|
937
937
|
"makeswift-site-api-key": this.apiKey,
|
|
938
|
-
"makeswift-runtime-version": "0.28.4-canary.
|
|
938
|
+
"makeswift-runtime-version": "0.28.4-canary.2",
|
|
939
939
|
"content-type": "application/json"
|
|
940
940
|
},
|
|
941
941
|
body: JSON.stringify({ token }),
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShapeV2Definition,
|
|
3
|
+
deserializeRecord
|
|
4
|
+
} from "@makeswift/controls";
|
|
5
|
+
import {
|
|
6
|
+
CheckboxDefinition,
|
|
7
|
+
ColorDefinition,
|
|
8
|
+
ComboboxDefinition,
|
|
9
|
+
FontDefinition,
|
|
10
|
+
GroupDefinition,
|
|
11
|
+
IconRadioGroupDefinition,
|
|
12
|
+
ImageDefinition,
|
|
13
|
+
LinkDefinition,
|
|
14
|
+
ListDefinition,
|
|
15
|
+
NumberDefinition,
|
|
16
|
+
RichTextV1Definition,
|
|
17
|
+
RichTextV2Definition,
|
|
18
|
+
SelectDefinition,
|
|
19
|
+
ShapeDefinition,
|
|
20
|
+
SlotDefinition,
|
|
21
|
+
StyleDefinition,
|
|
22
|
+
StyleV2Definition,
|
|
23
|
+
TextAreaDefinition,
|
|
24
|
+
TextInputDefinition,
|
|
25
|
+
unstable_TypographyDefinition
|
|
26
|
+
} from "../../index";
|
|
27
|
+
function serializeControls(controls, visitor) {
|
|
28
|
+
return Object.entries(controls).reduce(
|
|
29
|
+
(acc, [key, control]) => {
|
|
30
|
+
return { ...acc, [key]: control.accept(visitor) };
|
|
31
|
+
},
|
|
32
|
+
{}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function deserializeControl(serializedControl, options) {
|
|
36
|
+
const plugins = options?.plugins ?? [];
|
|
37
|
+
return deserializeUnifiedControlDef(deserializeRecord(serializedControl, plugins));
|
|
38
|
+
}
|
|
39
|
+
function deserializeUnifiedControlDef(record) {
|
|
40
|
+
const deserializeMethod = {
|
|
41
|
+
[CheckboxDefinition.type]: CheckboxDefinition.deserialize,
|
|
42
|
+
[ColorDefinition.type]: ColorDefinition.deserialize,
|
|
43
|
+
[ComboboxDefinition.type]: ComboboxDefinition.deserialize,
|
|
44
|
+
[FontDefinition.type]: FontDefinition.deserialize,
|
|
45
|
+
[GroupDefinition.type]: (record2) => GroupDefinition.deserialize(record2, deserializeUnifiedControlDef),
|
|
46
|
+
[IconRadioGroupDefinition.type]: IconRadioGroupDefinition.deserialize,
|
|
47
|
+
[ImageDefinition.type]: ImageDefinition.deserialize,
|
|
48
|
+
[LinkDefinition.type]: LinkDefinition.deserialize,
|
|
49
|
+
[ListDefinition.type]: (record2) => ListDefinition.deserialize(record2, deserializeUnifiedControlDef),
|
|
50
|
+
[NumberDefinition.type]: NumberDefinition.deserialize,
|
|
51
|
+
[RichTextV1Definition.type]: RichTextV1Definition.deserialize,
|
|
52
|
+
[RichTextV2Definition.type]: (record2) => RichTextV2Definition.deserialize(record2, deserializeUnifiedControlDef),
|
|
53
|
+
[SelectDefinition.type]: SelectDefinition.deserialize,
|
|
54
|
+
[ShapeDefinition.type]: (record2) => ShapeDefinition.deserialize(record2, deserializeUnifiedControlDef),
|
|
55
|
+
[ShapeV2Definition.type]: (record2) => ShapeV2Definition.deserialize(record2, deserializeUnifiedControlDef),
|
|
56
|
+
[SlotDefinition.type]: SlotDefinition.deserialize,
|
|
57
|
+
[StyleDefinition.type]: StyleDefinition.deserialize,
|
|
58
|
+
[StyleV2Definition.type]: (record2) => StyleV2Definition.deserialize(record2, deserializeUnifiedControlDef),
|
|
59
|
+
[TextAreaDefinition.type]: TextAreaDefinition.deserialize,
|
|
60
|
+
[TextInputDefinition.type]: TextInputDefinition.deserialize,
|
|
61
|
+
[unstable_TypographyDefinition.type]: unstable_TypographyDefinition.deserialize
|
|
62
|
+
};
|
|
63
|
+
const deserialize = deserializeMethod[record.type] ?? null;
|
|
64
|
+
if (deserialize == null) {
|
|
65
|
+
throw new Error(`Unknown control type: ${record.type}`);
|
|
66
|
+
}
|
|
67
|
+
return deserialize(record);
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
deserializeControl,
|
|
71
|
+
deserializeUnifiedControlDef,
|
|
72
|
+
serializeControls
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/controls/serialization/base/index.ts"],"sourcesContent":["import {\n ControlDefinition,\n type SerializedRecord,\n type DeserializedRecord,\n ShapeV2Definition,\n DeserializationPlugin,\n deserializeRecord,\n} from '@makeswift/controls'\n\nimport {\n CheckboxDefinition,\n ColorDefinition,\n ComboboxDefinition,\n FontDefinition,\n GroupDefinition,\n IconRadioGroupDefinition,\n ImageDefinition,\n LinkDefinition,\n ListDefinition,\n NumberDefinition,\n RichTextV1Definition,\n RichTextV2Definition,\n SelectDefinition,\n ShapeDefinition,\n SlotDefinition,\n StyleDefinition,\n StyleV2Definition,\n TextAreaDefinition,\n TextInputDefinition,\n unstable_TypographyDefinition,\n} from '../../index'\n\nimport { BaseControlSerializationVisitor } from './visitor'\n\nexport { type SerializedRecord, type DeserializedRecord } from '@makeswift/controls'\n\nexport function serializeControls(\n controls: Record<string, ControlDefinition>,\n visitor: BaseControlSerializationVisitor,\n): Record<string, SerializedRecord> {\n return Object.entries(controls).reduce<Record<string, SerializedRecord>>(\n (acc, [key, control]) => {\n return { ...acc, [key]: control.accept(visitor) }\n },\n {},\n )\n}\n\nexport type DeserializeControlOptions = {\n plugins: DeserializationPlugin<any>[]\n}\n\nexport function deserializeControl(\n serializedControl: SerializedRecord,\n options: DeserializeControlOptions,\n): ControlDefinition {\n const plugins = options?.plugins ?? []\n\n return deserializeUnifiedControlDef(deserializeRecord(serializedControl, plugins))\n}\n\nexport function deserializeUnifiedControlDef(record: DeserializedRecord): ControlDefinition {\n type DeserializeMethod = (data: DeserializedRecord) => ControlDefinition\n const deserializeMethod: Record<string, DeserializeMethod> = {\n [CheckboxDefinition.type]: CheckboxDefinition.deserialize,\n [ColorDefinition.type]: ColorDefinition.deserialize,\n [ComboboxDefinition.type]: ComboboxDefinition.deserialize,\n [FontDefinition.type]: FontDefinition.deserialize,\n [GroupDefinition.type]: record =>\n GroupDefinition.deserialize(record, deserializeUnifiedControlDef),\n [IconRadioGroupDefinition.type]: IconRadioGroupDefinition.deserialize,\n [ImageDefinition.type]: ImageDefinition.deserialize,\n [LinkDefinition.type]: LinkDefinition.deserialize,\n [ListDefinition.type]: record =>\n ListDefinition.deserialize(record, deserializeUnifiedControlDef),\n [NumberDefinition.type]: NumberDefinition.deserialize,\n [RichTextV1Definition.type]: RichTextV1Definition.deserialize,\n [RichTextV2Definition.type]: record =>\n RichTextV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [SelectDefinition.type]: SelectDefinition.deserialize,\n [ShapeDefinition.type]: record =>\n ShapeDefinition.deserialize(record, deserializeUnifiedControlDef),\n [ShapeV2Definition.type]: record =>\n ShapeV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [SlotDefinition.type]: SlotDefinition.deserialize,\n [StyleDefinition.type]: StyleDefinition.deserialize,\n [StyleV2Definition.type]: record =>\n StyleV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [TextAreaDefinition.type]: TextAreaDefinition.deserialize,\n [TextInputDefinition.type]: TextInputDefinition.deserialize,\n [unstable_TypographyDefinition.type]: unstable_TypographyDefinition.deserialize,\n } as const\n\n const deserialize = deserializeMethod[record.type] ?? null\n if (deserialize == null) {\n throw new Error(`Unknown control type: ${record.type}`)\n }\n\n return deserialize(record)\n}\n"],"mappings":"AAAA;AAAA,EAIE;AAAA,EAEA;AAAA,O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D,CAAC,qBAAqB,IAAI,GAAG,CAAAA,YAC3B,qBAAqB,YAAYA,SAAQ,4BAA4B;AAAA,IACvE,CAAC,iBAAiB,IAAI,GAAG,iBAAiB;AAAA,IAC1C,CAAC,gBAAgB,IAAI,GAAG,CAAAA,YACtB,gBAAgB,YAAYA,SAAQ,4BAA4B;AAAA,IAClE,CAAC,kBAAkB,IAAI,GAAG,CAAAA,YACxB,kBAAkB,YAAYA,SAAQ,4BAA4B;AAAA,IACpE,CAAC,eAAe,IAAI,GAAG,eAAe;AAAA,IACtC,CAAC,gBAAgB,IAAI,GAAG,gBAAgB;AAAA,IACxC,CAAC,kBAAkB,IAAI,GAAG,CAAAA,YACxB,kBAAkB,YAAYA,SAAQ,4BAA4B;AAAA,IACpE,CAAC,mBAAmB,IAAI,GAAG,mBAAmB;AAAA,IAC9C,CAAC,oBAAoB,IAAI,GAAG,oBAAoB;AAAA,IAChD,CAAC,8BAA8B,IAAI,GAAG,8BAA8B;AAAA,EACtE;AAEA,QAAM,cAAc,kBAAkB,OAAO,IAAI,KAAK;AACtD,MAAI,eAAe,MAAM;AACvB,UAAM,IAAI,MAAM,yBAAyB,OAAO,IAAI,EAAE;AAAA,EACxD;AAEA,SAAO,YAAY,MAAM;AAC3B;","names":["record"]}
|
|
@@ -1,30 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ControlDefinition,
|
|
3
3
|
serializeObject,
|
|
4
|
-
ControlSerializationVisitor
|
|
5
|
-
isFunction
|
|
4
|
+
ControlSerializationVisitor
|
|
6
5
|
} from "@makeswift/controls";
|
|
7
6
|
import { RichTextV2Definition } from "../../rich-text-v2";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
transferables = [];
|
|
11
|
-
constructor() {
|
|
12
|
-
const serializeFunctionPlugin = {
|
|
13
|
-
match: isFunction,
|
|
14
|
-
serialize: (val) => {
|
|
15
|
-
const r = serializeFunction(val);
|
|
16
|
-
this.transferables.push(r);
|
|
17
|
-
return r;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
7
|
+
class BaseControlSerializationVisitor extends ControlSerializationVisitor {
|
|
8
|
+
constructor(plugins) {
|
|
20
9
|
const serializeDefinitionPlugin = {
|
|
21
10
|
match: (val) => val instanceof ControlDefinition,
|
|
22
11
|
serialize: (val) => val.accept(this)
|
|
23
12
|
};
|
|
24
|
-
super([
|
|
25
|
-
}
|
|
26
|
-
getTransferables() {
|
|
27
|
-
return [...this.transferables];
|
|
13
|
+
super([serializeDefinitionPlugin, ...plugins]);
|
|
28
14
|
}
|
|
29
15
|
visitRichTextV2(def) {
|
|
30
16
|
const { plugins, ...config } = def.config;
|
|
@@ -48,6 +34,6 @@ class ClientMessagePortSerializationVisitor extends ControlSerializationVisitor
|
|
|
48
34
|
}
|
|
49
35
|
}
|
|
50
36
|
export {
|
|
51
|
-
|
|
37
|
+
BaseControlSerializationVisitor
|
|
52
38
|
};
|
|
53
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=visitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/controls/serialization/base/visitor.ts"],"sourcesContent":["import {\n ControlDefinition,\n SerializedRecord,\n serializeObject,\n SerializationPlugin,\n ControlSerializationVisitor,\n} from '@makeswift/controls'\n\nimport { RichTextV2Definition } from '../../rich-text-v2'\n\nexport class BaseControlSerializationVisitor extends ControlSerializationVisitor {\n constructor(plugins: SerializationPlugin<any>[]) {\n const serializeDefinitionPlugin: SerializationPlugin<ControlDefinition> = {\n match: (val: unknown) => val instanceof ControlDefinition,\n serialize: (val: ControlDefinition) => val.accept(this),\n }\n\n super([serializeDefinitionPlugin, ...plugins])\n }\n\n visitRichTextV2(def: RichTextV2Definition): SerializedRecord {\n const { plugins, ...config } = def.config\n\n // serialize only the plugin control definition, if any\n const pluginDefs = plugins.map(({ control }) =>\n control\n ? {\n control: {\n definition: control.definition,\n // FIXME: remove getValue/onChange stubs once we released a version of the builder\n // built against the runtime where these can be optional\n getValue: () => undefined,\n onChange: () => {},\n },\n }\n : {},\n )\n\n const serialized = serializeObject(\n { config: { ...config, plugins: pluginDefs } },\n this.serializationPlugins,\n ) as SerializedRecord\n\n return { ...serialized, type: RichTextV2Definition.type }\n }\n}\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AAEP,SAAS,4BAA4B;AAE9B,MAAM,wCAAwC,4BAA4B;AAAA,EAC/E,YAAY,SAAqC;AAC/C,UAAM,4BAAoE;AAAA,MACxE,OAAO,CAAC,QAAiB,eAAe;AAAA,MACxC,WAAW,CAAC,QAA2B,IAAI,OAAO,IAAI;AAAA,IACxD;AAEA,UAAM,CAAC,2BAA2B,GAAG,OAAO,CAAC;AAAA,EAC/C;AAAA,EAEA,gBAAgB,KAA6C;AAC3D,UAAM,EAAE,SAAS,GAAG,OAAO,IAAI,IAAI;AAGnC,UAAM,aAAa,QAAQ;AAAA,MAAI,CAAC,EAAE,QAAQ,MACxC,UACI;AAAA,QACE,SAAS;AAAA,UACP,YAAY,QAAQ;AAAA;AAAA;AAAA,UAGpB,UAAU,MAAM;AAAA,UAChB,UAAU,MAAM;AAAA,UAAC;AAAA,QACnB;AAAA,MACF,IACA,CAAC;AAAA,IACP;AAEA,UAAM,aAAa;AAAA,MACjB,EAAE,QAAQ,EAAE,GAAG,QAAQ,SAAS,WAAW,EAAE;AAAA,MAC7C,KAAK;AAAA,IACP;AAEA,WAAO,EAAE,GAAG,YAAY,MAAM,qBAAqB,KAAK;AAAA,EAC1D;AACF;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
function isSerializedRecord(r) {
|
|
2
|
+
return r != null && typeof r === "object" && "type" in r && typeof r.type === "string";
|
|
3
|
+
}
|
|
4
|
+
function deserializeControlRecords(serializedControls, deserialize, { onError, plugins } = {}) {
|
|
5
|
+
return Object.entries(serializedControls).reduce(
|
|
6
|
+
(deserializedControls, [key, serializedControl]) => {
|
|
7
|
+
try {
|
|
8
|
+
if (!isSerializedRecord(serializedControl)) {
|
|
9
|
+
throw new Error(
|
|
10
|
+
`Expected serialized control data, got ${JSON.stringify(serializedControl)}`
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
const deserializedControl = deserialize(serializedControl, { plugins });
|
|
14
|
+
return { ...deserializedControls, [key]: deserializedControl };
|
|
15
|
+
} catch (err) {
|
|
16
|
+
const error = err instanceof Error ? new Error(`Could not deserialize control for "${key}": ${err.message}`, {
|
|
17
|
+
cause: err
|
|
18
|
+
}) : new Error(`Could not deserialize control for "${key}", unknown error: ${err}`);
|
|
19
|
+
onError?.(error, { key, serializedControl });
|
|
20
|
+
return deserializedControls;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
deserializeControlRecords,
|
|
28
|
+
isSerializedRecord
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/controls/serialization/index.ts"],"sourcesContent":["import { type SerializedRecord, type DeserializeControlOptions } from './base'\n\nexport function isSerializedRecord(r: unknown): r is SerializedRecord {\n return r != null && typeof r === 'object' && 'type' in r && typeof r.type === 'string'\n}\n\nexport type DeserializeControlRecordsOptions = {\n onError?: (err: Error, context: { key: string; serializedControl: unknown }) => void\n} & Partial<Pick<DeserializeControlOptions, 'plugins'>>\n\nexport function deserializeControlRecords<T>(\n serializedControls: Record<string, unknown>,\n deserialize: (\n serializedControl: SerializedRecord,\n options?: Partial<DeserializeControlOptions>,\n ) => T,\n { onError, plugins }: DeserializeControlRecordsOptions = {},\n): Record<string, T> {\n return Object.entries(serializedControls).reduce<Record<string, T>>(\n (deserializedControls, [key, serializedControl]) => {\n try {\n if (!isSerializedRecord(serializedControl)) {\n throw new Error(\n `Expected serialized control data, got ${JSON.stringify(serializedControl)}`,\n )\n }\n const deserializedControl = deserialize(serializedControl, { plugins })\n return { ...deserializedControls, [key]: deserializedControl }\n } catch (err: unknown) {\n const error =\n err instanceof Error\n ? new Error(`Could not deserialize control for \"${key}\": ${err.message}`, {\n cause: err,\n })\n : new Error(`Could not deserialize control for \"${key}\", unknown error: ${err}`)\n\n onError?.(error, { key, serializedControl })\n\n return deserializedControls\n }\n },\n {},\n )\n}\n"],"mappings":"AAEO,SAAS,mBAAmB,GAAmC;AACpE,SAAO,KAAK,QAAQ,OAAO,MAAM,YAAY,UAAU,KAAK,OAAO,EAAE,SAAS;AAChF;AAMO,SAAS,0BACd,oBACA,aAIA,EAAE,SAAS,QAAQ,IAAsC,CAAC,GACvC;AACnB,SAAO,OAAO,QAAQ,kBAAkB,EAAE;AAAA,IACxC,CAAC,sBAAsB,CAAC,KAAK,iBAAiB,MAAM;AAClD,UAAI;AACF,YAAI,CAAC,mBAAmB,iBAAiB,GAAG;AAC1C,gBAAM,IAAI;AAAA,YACR,yCAAyC,KAAK,UAAU,iBAAiB,CAAC;AAAA,UAC5E;AAAA,QACF;AACA,cAAM,sBAAsB,YAAY,mBAAmB,EAAE,QAAQ,CAAC;AACtE,eAAO,EAAE,GAAG,sBAAsB,CAAC,GAAG,GAAG,oBAAoB;AAAA,MAC/D,SAAS,KAAc;AACrB,cAAM,QACJ,eAAe,QACX,IAAI,MAAM,sCAAsC,GAAG,MAAM,IAAI,OAAO,IAAI;AAAA,UACtE,OAAO;AAAA,QACT,CAAC,IACD,IAAI,MAAM,sCAAsC,GAAG,qBAAqB,GAAG,EAAE;AAEnF,kBAAU,OAAO,EAAE,KAAK,kBAAkB,CAAC;AAE3C,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/controls/serialization/message-port/function-serialization.ts"],"sourcesContent":["import {\n DeserializationPlugin,\n type AnyFunction,\n type SerializedFunctionReturnType,\n type DeserializedFunction,\n} from '@makeswift/controls'\n\nexport { type DeserializedFunction } from '@makeswift/controls'\n\ndeclare const SerializedFunctionTag: unique symbol\n\ntype ResolveCallPromise<T extends AnyFunction> = (value: SerializedFunctionReturnType<T>) => void\n\ntype OnMessageHandler<T extends AnyFunction> = MessagePort['onmessage'] & {\n newCall?(resolve: ResolveCallPromise<T>): number\n}\n\nexport type SerializedFunction<T extends AnyFunction> = MessagePort & {\n onmessage: OnMessageHandler<T>\n readonly [SerializedFunctionTag]: T\n}\n\nexport function isSerializedFunction(value: any): value is SerializedFunction<AnyFunction> {\n return value instanceof MessagePort\n}\n\ntype CallID = number\n\nexport function serializeFunction<T extends AnyFunction>(func: T): SerializedFunction<T> {\n type CallMessageEvent = MessageEvent<[CallID, Parameters<T>]>\n\n const messageChannel = new MessageChannel()\n\n messageChannel.port1.onmessage = ({ data: [callId, args] }: CallMessageEvent) => {\n Promise.resolve()\n .then(() => func.apply(null, args))\n .then(result => messageChannel.port1.postMessage([callId, result]))\n }\n\n return messageChannel.port2 as SerializedFunction<T>\n}\n\nfunction onmessageHandler<T extends AnyFunction>(): OnMessageHandler<T> {\n type ResultMessageEvent = MessageEvent<[CallID, SerializedFunctionReturnType<T>]>\n let nextCallId = 0\n const calls = new Map<CallID, ResolveCallPromise<T>>()\n\n const result: OnMessageHandler<T> = ({ data: [callId, result] }: ResultMessageEvent) => {\n calls.get(callId)?.(result)\n calls.delete(callId)\n }\n\n result.newCall = (resolve: ResolveCallPromise<T>) => {\n const callId = nextCallId++\n calls.set(callId, resolve)\n return callId\n }\n\n return result\n}\n\nexport function deserializeFunction<T extends AnyFunction>(\n serializedFunction: SerializedFunction<T>,\n): DeserializedFunction<T> {\n if (serializedFunction.onmessage == null) {\n serializedFunction.onmessage = onmessageHandler<T>()\n }\n\n return function deserializedFunction(...args) {\n return new Promise(resolve => {\n const { newCall } = serializedFunction.onmessage\n if (newCall == null) {\n throw new Error(\n `Deserialized function call failed: 'onmessage' handler is missing 'newCall' method`,\n )\n }\n\n const callId = newCall(resolve)\n serializedFunction.postMessage([callId, args])\n })\n }\n}\n\nexport const functionDeserializationPlugin: DeserializationPlugin<\n SerializedFunction<AnyFunction>,\n DeserializedFunction<AnyFunction>\n> = {\n match: isSerializedFunction,\n deserialize: value => deserializeFunction(value),\n}\n"],"mappings":"AAsBO,SAAS,qBAAqB,OAAsD;AACzF,SAAO,iBAAiB;AAC1B;AAIO,SAAS,kBAAyC,MAAgC;AAGvF,QAAM,iBAAiB,IAAI,eAAe;AAE1C,iBAAe,MAAM,YAAY,CAAC,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE,MAAwB;AAC/E,YAAQ,QAAQ,EACb,KAAK,MAAM,KAAK,MAAM,MAAM,IAAI,CAAC,EACjC,KAAK,YAAU,eAAe,MAAM,YAAY,CAAC,QAAQ,MAAM,CAAC,CAAC;AAAA,EACtE;AAEA,SAAO,eAAe;AACxB;AAEA,SAAS,mBAA+D;AAEtE,MAAI,aAAa;AACjB,QAAM,QAAQ,oBAAI,IAAmC;AAErD,QAAM,SAA8B,CAAC,EAAE,MAAM,CAAC,QAAQA,OAAM,EAAE,MAA0B;AACtF,UAAM,IAAI,MAAM,IAAIA,OAAM;AAC1B,UAAM,OAAO,MAAM;AAAA,EACrB;AAEA,SAAO,UAAU,CAAC,YAAmC;AACnD,UAAM,SAAS;AACf,UAAM,IAAI,QAAQ,OAAO;AACzB,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,SAAS,oBACd,oBACyB;AACzB,MAAI,mBAAmB,aAAa,MAAM;AACxC,uBAAmB,YAAY,iBAAoB;AAAA,EACrD;AAEA,SAAO,SAAS,wBAAwB,MAAM;AAC5C,WAAO,IAAI,QAAQ,aAAW;AAC5B,YAAM,EAAE,QAAQ,IAAI,mBAAmB;AACvC,UAAI,WAAW,MAAM;AACnB,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AAEA,YAAM,SAAS,QAAQ,OAAO;AAC9B,yBAAmB,YAAY,CAAC,QAAQ,IAAI,CAAC;AAAA,IAC/C,CAAC;AAAA,EACH;AACF;AAEO,MAAM,gCAGT;AAAA,EACF,OAAO;AAAA,EACP,aAAa,WAAS,oBAAoB,KAAK;AACjD;","names":["result"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/controls/serialization/message-port/index.ts"],"sourcesContent":["export * from './function-serialization'\nexport * from './visitor'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isFunction } from "@makeswift/controls";
|
|
2
|
+
import { BaseControlSerializationVisitor } from "../base/visitor";
|
|
3
|
+
import { serializeFunction } from "./function-serialization";
|
|
4
|
+
class ClientMessagePortSerializationVisitor extends BaseControlSerializationVisitor {
|
|
5
|
+
transferables = [];
|
|
6
|
+
constructor() {
|
|
7
|
+
const serializeFunctionPlugin = {
|
|
8
|
+
match: isFunction,
|
|
9
|
+
serialize: (val) => {
|
|
10
|
+
const r = serializeFunction(val);
|
|
11
|
+
this.transferables.push(r);
|
|
12
|
+
return r;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
super([serializeFunctionPlugin]);
|
|
16
|
+
}
|
|
17
|
+
getTransferables() {
|
|
18
|
+
return [...this.transferables];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
ClientMessagePortSerializationVisitor
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=visitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/controls/serialization/message-port/visitor.ts"],"sourcesContent":["import { AnyFunction, SerializationPlugin, isFunction } from '@makeswift/controls'\n\nimport { BaseControlSerializationVisitor } from '../base/visitor'\nimport { serializeFunction } from './function-serialization'\n\nexport class ClientMessagePortSerializationVisitor extends BaseControlSerializationVisitor {\n private transferables: Transferable[] = []\n\n constructor() {\n const serializeFunctionPlugin: SerializationPlugin<AnyFunction> = {\n match: isFunction,\n serialize: (val: AnyFunction) => {\n const r = serializeFunction(val)\n this.transferables.push(r)\n return r\n },\n }\n\n super([serializeFunctionPlugin])\n }\n\n getTransferables(): Transferable[] {\n return [...this.transferables]\n }\n}\n"],"mappings":"AAAA,SAA2C,kBAAkB;AAE7D,SAAS,uCAAuC;AAChD,SAAS,yBAAyB;AAE3B,MAAM,8CAA8C,gCAAgC;AAAA,EACjF,gBAAgC,CAAC;AAAA,EAEzC,cAAc;AACZ,UAAM,0BAA4D;AAAA,MAChE,OAAO;AAAA,MACP,WAAW,CAAC,QAAqB;AAC/B,cAAM,IAAI,kBAAkB,GAAG;AAC/B,aAAK,cAAc,KAAK,CAAC;AACzB,eAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,CAAC,uBAAuB,CAAC;AAAA,EACjC;AAAA,EAEA,mBAAmC;AACjC,WAAO,CAAC,GAAG,KAAK,aAAa;AAAA,EAC/B;AACF;","names":[]}
|
|
@@ -1,52 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "@makeswift/controls";
|
|
5
|
-
import {
|
|
6
|
-
CheckboxDefinition,
|
|
7
|
-
ColorDefinition,
|
|
8
|
-
ComboboxDefinition,
|
|
9
|
-
FontDefinition,
|
|
10
|
-
GroupDefinition,
|
|
11
|
-
IconRadioGroupDefinition,
|
|
12
|
-
ImageDefinition,
|
|
13
|
-
LinkDefinition,
|
|
14
|
-
ListDefinition,
|
|
15
|
-
NumberDefinition,
|
|
16
|
-
RichTextV1Definition,
|
|
17
|
-
RichTextV2Definition,
|
|
18
|
-
SelectDefinition,
|
|
19
|
-
ShapeDefinition,
|
|
20
|
-
SlotDefinition,
|
|
21
|
-
StyleDefinition,
|
|
22
|
-
StyleV2Definition,
|
|
23
|
-
TextAreaDefinition,
|
|
24
|
-
TextInputDefinition,
|
|
25
|
-
unstable_TypographyDefinition
|
|
26
|
-
} from "../../controls";
|
|
27
|
-
import {
|
|
28
|
-
DELETED_PROP_CONTROLLER_TYPES
|
|
29
|
-
} from "../../prop-controllers/deleted";
|
|
2
|
+
Types as PropControllerTypes
|
|
3
|
+
} from "@makeswift/prop-controllers";
|
|
30
4
|
import {
|
|
31
5
|
deserializeFunction,
|
|
32
6
|
isSerializedFunction,
|
|
33
7
|
serializeFunction
|
|
34
|
-
} from "
|
|
8
|
+
} from "../controls/serialization/message-port/function-serialization";
|
|
35
9
|
import {
|
|
36
|
-
|
|
37
|
-
} from "
|
|
38
|
-
import { isLegacyDescriptor } from "../../prop-controllers/descriptors";
|
|
39
|
-
import { deserializeRecord } from "@makeswift/controls";
|
|
40
|
-
import {
|
|
41
|
-
ClientMessagePortSerializationVisitor,
|
|
42
|
-
functionDeserializationPlugin
|
|
43
|
-
} from "../../controls/visitors/message-port-serializer";
|
|
10
|
+
DELETED_PROP_CONTROLLER_TYPES
|
|
11
|
+
} from "./deleted";
|
|
44
12
|
function serializeShapeControl(control) {
|
|
45
13
|
const { type } = control.options;
|
|
46
14
|
const transferables = [];
|
|
47
15
|
const serializedType = {};
|
|
48
16
|
Object.entries(type).forEach(([key, control2]) => {
|
|
49
|
-
const [serializedControl, serializedControlTransferables] =
|
|
17
|
+
const [serializedControl, serializedControlTransferables] = serializeLegacyControl(control2);
|
|
50
18
|
serializedType[key] = serializedControl;
|
|
51
19
|
transferables.push(...serializedControlTransferables);
|
|
52
20
|
});
|
|
@@ -56,7 +24,7 @@ function deserializeShapeControl(control) {
|
|
|
56
24
|
const { type } = control.options;
|
|
57
25
|
const deserializedType = {};
|
|
58
26
|
Object.entries(type).forEach(([key, control2]) => {
|
|
59
|
-
deserializedType[key] =
|
|
27
|
+
deserializedType[key] = deserializeLegacyControl(
|
|
60
28
|
control2
|
|
61
29
|
);
|
|
62
30
|
});
|
|
@@ -65,7 +33,7 @@ function deserializeShapeControl(control) {
|
|
|
65
33
|
function serializeListControl(control) {
|
|
66
34
|
const { type, getItemLabel } = control.options;
|
|
67
35
|
const transferables = [];
|
|
68
|
-
const [serializedType, serializedTypeTransferables] =
|
|
36
|
+
const [serializedType, serializedTypeTransferables] = serializeLegacyControl(type);
|
|
69
37
|
const serializedGetItemLabel = getItemLabel && serializeFunction(getItemLabel);
|
|
70
38
|
transferables.push(...serializedTypeTransferables);
|
|
71
39
|
if (serializedGetItemLabel != null)
|
|
@@ -84,7 +52,7 @@ function serializeListControl(control) {
|
|
|
84
52
|
}
|
|
85
53
|
function deserializeListControl(serializedControl) {
|
|
86
54
|
const { type, getItemLabel } = serializedControl.options;
|
|
87
|
-
const deserializedType =
|
|
55
|
+
const deserializedType = deserializeLegacyControl(type);
|
|
88
56
|
const deserializedGetItemLabel = isSerializedFunction(getItemLabel) ? deserializeFunction(getItemLabel) : getItemLabel;
|
|
89
57
|
return {
|
|
90
58
|
...serializedControl,
|
|
@@ -279,17 +247,6 @@ function deserializeRichTextControl(serializedControl) {
|
|
|
279
247
|
const deserializedOptions = deserializeFunction(options);
|
|
280
248
|
return { ...serializedControl, options: deserializedOptions };
|
|
281
249
|
}
|
|
282
|
-
function serializeControl(control) {
|
|
283
|
-
if (isLegacyDescriptor(control)) {
|
|
284
|
-
return serializeLegacyControl(control);
|
|
285
|
-
}
|
|
286
|
-
const messagePortVisitor = new ClientMessagePortSerializationVisitor();
|
|
287
|
-
const serializedControl = control.accept(messagePortVisitor);
|
|
288
|
-
return [serializedControl, messagePortVisitor.getTransferables()];
|
|
289
|
-
}
|
|
290
|
-
function isSerializedControl(control) {
|
|
291
|
-
return control != null && typeof control === "object" && "type" in control && typeof control.type === "string";
|
|
292
|
-
}
|
|
293
250
|
function serializeLegacyControl(control) {
|
|
294
251
|
switch (control.type) {
|
|
295
252
|
case PropControllerTypes.Checkbox:
|
|
@@ -332,9 +289,6 @@ function serializeLegacyControl(control) {
|
|
|
332
289
|
return [control, []];
|
|
333
290
|
}
|
|
334
291
|
}
|
|
335
|
-
function isSerializedLegacyControl(control) {
|
|
336
|
-
return "options" in control;
|
|
337
|
-
}
|
|
338
292
|
function deserializeLegacyControl(serializedControl) {
|
|
339
293
|
switch (serializedControl.type) {
|
|
340
294
|
case PropControllerTypes.Checkbox:
|
|
@@ -377,87 +331,8 @@ function deserializeLegacyControl(serializedControl) {
|
|
|
377
331
|
return serializedControl;
|
|
378
332
|
}
|
|
379
333
|
}
|
|
380
|
-
function deserializeControl(serializedControl, options) {
|
|
381
|
-
if (isSerializedLegacyControl(serializedControl)) {
|
|
382
|
-
const record = options?.plugins ? deserializeObject(serializedControl, options?.plugins) : serializedControl;
|
|
383
|
-
return deserializeLegacyControl(record);
|
|
384
|
-
}
|
|
385
|
-
const plugins = [functionDeserializationPlugin, ...options?.plugins ?? []];
|
|
386
|
-
return deserializeUnifiedControlDef(
|
|
387
|
-
deserializeRecord(serializedControl, plugins)
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
function deserializeUnifiedControlDef(record) {
|
|
391
|
-
const deserializeMethod = {
|
|
392
|
-
[CheckboxDefinition.type]: CheckboxDefinition.deserialize,
|
|
393
|
-
[ColorDefinition.type]: ColorDefinition.deserialize,
|
|
394
|
-
[ComboboxDefinition.type]: ComboboxDefinition.deserialize,
|
|
395
|
-
[FontDefinition.type]: FontDefinition.deserialize,
|
|
396
|
-
[GroupDefinition.type]: (record2) => GroupDefinition.deserialize(record2, deserializeUnifiedControlDef),
|
|
397
|
-
[IconRadioGroupDefinition.type]: IconRadioGroupDefinition.deserialize,
|
|
398
|
-
[ImageDefinition.type]: ImageDefinition.deserialize,
|
|
399
|
-
[LinkDefinition.type]: LinkDefinition.deserialize,
|
|
400
|
-
[ListDefinition.type]: (record2) => ListDefinition.deserialize(record2, deserializeUnifiedControlDef),
|
|
401
|
-
[NumberDefinition.type]: NumberDefinition.deserialize,
|
|
402
|
-
[RichTextV1Definition.type]: RichTextV1Definition.deserialize,
|
|
403
|
-
[RichTextV2Definition.type]: (record2) => RichTextV2Definition.deserialize(record2, deserializeUnifiedControlDef),
|
|
404
|
-
[SelectDefinition.type]: SelectDefinition.deserialize,
|
|
405
|
-
[ShapeDefinition.type]: (record2) => ShapeDefinition.deserialize(record2, deserializeUnifiedControlDef),
|
|
406
|
-
[ShapeV2Definition.type]: (record2) => ShapeV2Definition.deserialize(record2, deserializeUnifiedControlDef),
|
|
407
|
-
[SlotDefinition.type]: SlotDefinition.deserialize,
|
|
408
|
-
[StyleDefinition.type]: StyleDefinition.deserialize,
|
|
409
|
-
[StyleV2Definition.type]: (record2) => StyleV2Definition.deserialize(record2, deserializeUnifiedControlDef),
|
|
410
|
-
[TextAreaDefinition.type]: TextAreaDefinition.deserialize,
|
|
411
|
-
[TextInputDefinition.type]: TextInputDefinition.deserialize,
|
|
412
|
-
[unstable_TypographyDefinition.type]: unstable_TypographyDefinition.deserialize
|
|
413
|
-
};
|
|
414
|
-
const deserialize = deserializeMethod[record.type] ?? null;
|
|
415
|
-
if (deserialize == null) {
|
|
416
|
-
throw new Error(`Unknown control type: ${record.type}`);
|
|
417
|
-
}
|
|
418
|
-
return deserialize(record);
|
|
419
|
-
}
|
|
420
|
-
function serializeControls(controls) {
|
|
421
|
-
return Object.entries(controls).reduce(
|
|
422
|
-
([accControls, accTransferables], [key, control]) => {
|
|
423
|
-
const [serializedControl, transferables] = serializeControl(control);
|
|
424
|
-
return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]];
|
|
425
|
-
},
|
|
426
|
-
[{}, []]
|
|
427
|
-
);
|
|
428
|
-
}
|
|
429
|
-
function deserializeControls(serializedControls, {
|
|
430
|
-
onError,
|
|
431
|
-
plugins
|
|
432
|
-
} = {}) {
|
|
433
|
-
return Object.entries(serializedControls).reduce(
|
|
434
|
-
(deserializedControls, [key, serializedControl]) => {
|
|
435
|
-
try {
|
|
436
|
-
if (!isSerializedControl(serializedControl)) {
|
|
437
|
-
throw new Error(
|
|
438
|
-
`Expected serialized control data, got ${JSON.stringify(serializedControl)}`
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
const deserializedControl = deserializeControl(serializedControl, { plugins });
|
|
442
|
-
return { ...deserializedControls, [key]: deserializedControl };
|
|
443
|
-
} catch (err) {
|
|
444
|
-
const error = err instanceof Error ? new Error(`Could not deserialize control for "${key}": ${err.message}`, {
|
|
445
|
-
cause: err
|
|
446
|
-
}) : new Error(`Could not deserialize control for "${key}", unknown error: ${err}`);
|
|
447
|
-
onError?.(error, { key, serializedControl });
|
|
448
|
-
return deserializedControls;
|
|
449
|
-
}
|
|
450
|
-
},
|
|
451
|
-
{}
|
|
452
|
-
);
|
|
453
|
-
}
|
|
454
334
|
export {
|
|
455
|
-
deserializeControl,
|
|
456
|
-
deserializeControls,
|
|
457
335
|
deserializeLegacyControl,
|
|
458
|
-
|
|
459
|
-
isSerializedControl,
|
|
460
|
-
serializeControl,
|
|
461
|
-
serializeControls
|
|
336
|
+
serializeLegacyControl
|
|
462
337
|
};
|
|
463
|
-
//# sourceMappingURL=
|
|
338
|
+
//# sourceMappingURL=serialization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/prop-controllers/serialization.ts"],"sourcesContent":["import {\n type Data,\n type Device,\n type RichTextValue as RichTextControlValue,\n} from '@makeswift/controls'\n\nimport {\n type Descriptor,\n type PropDef,\n type OptionsType,\n CheckboxDescriptor as CheckboxControl,\n CheckboxPropControllerData,\n DateDescriptor as DateControl,\n DatePropControllerData,\n ImageDescriptor as ImageControl,\n ImageData as ImageControlValue,\n GapData,\n GapX,\n GapYDescriptor,\n GapYPropControllerData,\n LinkData,\n LinkDescriptor as LinkControl,\n LinkPropControllerData,\n NumberDescriptor,\n NumberOptions,\n NumberPropControllerData,\n ResponsiveColorDescriptor,\n ResponsiveColorPropControllerData,\n ResponsiveIconRadioGroup,\n ResponsiveLengthDescriptor,\n ResponsiveLengthOptions,\n ResponsiveLengthPropControllerData,\n ResponsiveNumber,\n ResponsiveSelect,\n Types as PropControllerTypes,\n TextStyleDescriptor as TextStyleControl,\n TextStylePropControllerData,\n TextInputDescriptor as TextInputControl,\n} from '@makeswift/prop-controllers'\n\nimport {\n type DeserializedFunction,\n type SerializedFunction,\n deserializeFunction,\n isSerializedFunction,\n serializeFunction,\n} from '../controls/serialization/message-port/function-serialization'\n\nimport {\n PanelDescriptor as PanelControl,\n PanelDescriptorType as PanelControlType,\n PanelDescriptorValueType as PanelControlValueType,\n} from './descriptors'\n\nimport {\n DELETED_PROP_CONTROLLER_TYPES,\n ListDescriptor as ListControl,\n ListOptions as ListControlConfig,\n ListValue as ListControlValue,\n ShapeDescriptor as ShapeControl,\n ShapeValue as ShapeControlValue,\n TypeaheadDescriptor as TypeaheadControl,\n TypeaheadOptions as TypeaheadControlConfig,\n TypeaheadValue as TypeaheadControlValue,\n RichTextDescriptor as RichTextControl,\n} from './deleted'\n\nimport { type LegacyDescriptor } from './descriptors'\n\ntype SerializedShapeControlConfig<T extends Record<string, SerializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: SerializedPanelControlValueType<T[K]> }\n}\n\ntype SerializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: SerializedShapeControlConfig<U>\n}\n\nfunction serializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, PanelControl>,\n>(\n control: ShapeControl<T, U>,\n): [\n SerializedShapeControl<\n T,\n { [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>> }\n >,\n Transferable[],\n] {\n const { type } = control.options\n const transferables: Transferable[] = []\n const serializedType = {} as {\n [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n const [serializedControl, serializedControlTransferables] = serializeLegacyControl(control)\n\n serializedType[key as keyof typeof type] = serializedControl as SerializedPanelControl\n transferables.push(...serializedControlTransferables)\n })\n\n // @ts-expect-error: preset types are incompatible\n return [{ ...control, options: { ...control.options, type: serializedType } }, transferables]\n}\n\ntype DeserializedShapeControlConfig<T extends Record<string, DeserializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: DeserializedPanelControlValueType<T[K]> }\n}\n\ntype DeserializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, DeserializedPanelControl>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: DeserializedShapeControlConfig<U>\n}\n\nfunction deserializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n>(\n control: SerializedShapeControl<T, U>,\n): DeserializedShapeControl<\n T,\n { [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>> }\n> {\n const { type } = control.options\n const deserializedType = {} as {\n [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n deserializedType[key as keyof typeof type] = deserializeLegacyControl(\n control,\n ) as DeserializedPanelControl\n })\n\n // @ts-expect-error: preset types are incompatible\n return { ...control, options: { ...control.options, type: deserializedType } }\n}\n\ntype SerializedListControlConfig<T extends Data> = {\n type: SerializedPanelControl<T>\n label?: string\n getItemLabel?: SerializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\nexport type SerializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: SerializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction serializeListControl<T extends Data>(\n control: ListControl<ListControlValue<T>>,\n): [SerializedListControl<ListControlValue<T>>, Transferable[]] {\n const { type, getItemLabel } = control.options\n const transferables: Transferable[] = []\n\n const [serializedType, serializedTypeTransferables] = serializeLegacyControl(type)\n const serializedGetItemLabel = getItemLabel && serializeFunction(getItemLabel)\n\n transferables.push(...serializedTypeTransferables)\n if (serializedGetItemLabel != null) transferables.push(serializedGetItemLabel)\n\n return [\n {\n ...control,\n options: {\n ...control.options,\n type: serializedType as SerializedPanelControl,\n getItemLabel: serializedGetItemLabel,\n },\n },\n transferables,\n ]\n}\n\ntype DeserializedListControlConfig<T extends Data> = {\n type: DeserializedPanelControl<T>\n label?: string\n getItemLabel?: DeserializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype DeserializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: DeserializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction deserializeListControl<T extends Data>(\n serializedControl: SerializedListControl<ListControlValue<T>>,\n): DeserializedListControl<ListControlValue<T>> {\n const { type, getItemLabel } = serializedControl.options\n\n const deserializedType = deserializeLegacyControl(type) as DeserializedPanelControl\n const deserializedGetItemLabel = isSerializedFunction(getItemLabel)\n ? deserializeFunction(getItemLabel)\n : getItemLabel\n\n return {\n ...serializedControl,\n options: {\n ...serializedControl.options,\n type: deserializedType,\n getItemLabel: deserializedGetItemLabel,\n },\n }\n}\n\ntype SerializedTypeaheadControlConfig<T extends Data> = {\n getItems: SerializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\nexport type SerializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: SerializedTypeaheadControlConfig<T['value']>\n}\n\nfunction serializeTypeaheadControl<T extends Data>(\n control: TypeaheadControl<TypeaheadControlValue<T>>,\n): [SerializedTypeaheadControl<TypeaheadControlValue<T>>, Transferable[]] {\n const { getItems } = control.options\n\n const serializedGetItems = getItems && serializeFunction(getItems)\n\n return [\n { ...control, options: { ...control.options, getItems: serializedGetItems } },\n serializedGetItems == null ? [] : [serializedGetItems],\n ]\n}\n\ntype DeserializedTypeaheadControlConfig<T extends Data> = {\n getItems: DeserializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype DeserializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: DeserializedTypeaheadControlConfig<T['value']>\n}\n\nfunction deserializeTypeaheadControl<T extends Data>(\n serializedControl: SerializedTypeaheadControl<TypeaheadControlValue<T>>,\n): DeserializedTypeaheadControl<TypeaheadControlValue<T>> {\n const { getItems } = serializedControl.options\n\n const deserializedGetItems = isSerializedFunction(getItems)\n ? deserializeFunction(getItems)\n : getItems\n\n return {\n ...serializedControl,\n options: { ...serializedControl.options, getItems: deserializedGetItems },\n }\n}\n\ntype SerializedConfig<T> =\n | T\n | SerializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\nexport type DeserializedConfig<T> =\n | T\n | DeserializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\ntype SerializedControlDef<P extends PropDef> = Descriptor<P> & {\n options: SerializedConfig<OptionsType<P>>\n}\n\nfunction serializeControlDef<P extends PropDef>(\n control: Descriptor<P>,\n): [SerializedControlDef<P>, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\nexport type DeserializedControlDef<P extends PropDef> = Descriptor<P> & {\n options: DeserializedConfig<OptionsType<P>>\n}\n\nfunction deserializeControlDef<P extends PropDef>(\n serializedControl: SerializedControlDef<P>,\n): DeserializedControlDef<P> {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype GapYControlConfig = {\n preset?: GapYPropControllerData\n label?: string\n defaultValue?: GapData\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}\n\ntype SerializedGapYControl<_T = GapYPropControllerData> = {\n type: typeof PropControllerTypes.GapY\n options: SerializedConfig<GapYControlConfig>\n}\n\nfunction serializeGapYControl(control: GapYDescriptor): [SerializedGapYControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedGapYControl<_T = GapYPropControllerData> = {\n type: typeof PropControllerTypes.GapY\n options: DeserializedConfig<GapYControlConfig>\n}\n\nfunction deserializeGapYControl(serializedControl: SerializedGapYControl): DeserializedGapYControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype CheckboxControlConfig = {\n preset?: CheckboxPropControllerData\n label: string\n hidden?: boolean\n}\n\ntype SerializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: SerializedConfig<CheckboxControlConfig>\n}\n\nfunction serializeCheckboxControl(\n control: CheckboxControl,\n): [SerializedCheckboxControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: DeserializedConfig<CheckboxControlConfig>\n}\n\nfunction deserializeCheckboxControl(\n serializedControl: SerializedCheckboxControl,\n): DeserializedCheckboxControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ResponsiveColorControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype SerializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: SerializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction serializeResponsiveColorControl(\n control: ResponsiveColorDescriptor,\n): [SerializedResponsiveColorControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: DeserializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction deserializeResponsiveColorControl(\n serializedControl: SerializedResponsiveColorControl,\n): DeserializedResponsiveColorControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\ntype SerializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: SerializedConfig<NumberOptions>\n}\n\nfunction serializeNumberControl(\n control: NumberDescriptor,\n): [SerializedNumberControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: DeserializedConfig<NumberOptions>\n}\n\nfunction deserializeNumberControl(\n serializedControl: SerializedNumberControl,\n): DeserializedNumberControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype DateControlConfig = { preset?: DatePropControllerData }\n\ntype SerializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: SerializedConfig<DateControlConfig>\n}\n\nfunction serializeDateControl(control: DateControl): [SerializedDateControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: DeserializedConfig<DateControlConfig>\n}\n\nfunction deserializeDateControl(serializedControl: SerializedDateControl): DeserializedDateControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype LinkControlConfig = {\n preset?: LinkPropControllerData\n label?: string\n defaultValue?: LinkPropControllerData\n options?: { value: LinkData['type']; label: string }[]\n hidden?: boolean\n}\n\ntype SerializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: SerializedConfig<LinkControlConfig>\n}\n\nfunction serializeLinkControl(control: LinkControl): [SerializedLinkControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: DeserializedConfig<LinkControlConfig>\n}\n\nfunction deserializeLinkControl(serializedControl: SerializedLinkControl): DeserializedLinkControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype TextInputControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype TextInputControlValue = string\n\ntype SerializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof PropControllerTypes.TextInput\n options: SerializedConfig<TextInputControlConfig>\n}\n\nfunction serializeTextInputControl(\n control: TextInputControl,\n): [SerializedTextInputControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof PropControllerTypes.TextInput\n options: DeserializedConfig<TextInputControlConfig>\n}\n\nfunction deserializeTextInputControl(\n serializedControl: SerializedTextInputControl,\n): DeserializedTextInputControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: SerializedConfig<ResponsiveLengthOptions>\n}\n\nfunction serializeResponsiveLengthControl(\n control: ResponsiveLengthDescriptor,\n): [SerializedResponsiveLengthControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: DeserializedConfig<ResponsiveLengthOptions>\n}\n\nfunction deserializeResponsiveLengthControl(\n serializedControl: SerializedResponsiveLengthControl,\n): DeserializedResponsiveLengthControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: SerializedConfig<TextStyleControlConfig>\n}\n\nfunction serializeTextStyleControl(\n control: TextStyleControl,\n): [SerializedTextStyleControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype TextStyleControlConfig = {\n preset?: TextStylePropControllerData\n label?: string\n hidden?: boolean\n}\n\ntype DeserializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: DeserializedConfig<TextStyleControlConfig>\n}\n\nfunction deserializeTextStyleControl(\n serializedControl: SerializedTextStyleControl,\n): DeserializedTextStyleControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ImageControlConfig = { label?: string; hidden?: boolean }\n\ntype SerializedImageControl<_T = ImageControlValue> = {\n type: typeof PropControllerTypes.Image\n options: SerializedConfig<ImageControlConfig>\n}\n\nfunction serializeImageControl(control: ImageControl): [SerializedImageControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedImageControl<_T = ImageControlValue> = {\n type: typeof PropControllerTypes.Image\n options: DeserializedConfig<ImageControlConfig>\n}\n\nfunction deserializeImageControl(\n serializedControl: SerializedImageControl,\n): DeserializedImageControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype RichTextControlConfig = { preset?: RichTextControlValue }\n\ntype SerializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.RichText\n options: SerializedConfig<RichTextControlConfig>\n}\n\nfunction serializeRichTextControl(\n control: RichTextControl,\n): [SerializedRichTextControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.RichText\n options: DeserializedConfig<RichTextControlConfig>\n}\n\nfunction deserializeRichTextControl(\n serializedControl: SerializedRichTextControl,\n): DeserializedRichTextControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\nexport type SerializedLegacyControl<T extends Data = Data> =\n | Exclude<\n LegacyDescriptor<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | Descriptor<typeof GapX>\n | GapYDescriptor<T>\n | Descriptor<typeof ResponsiveNumber>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | Descriptor<typeof ResponsiveIconRadioGroup>\n | Descriptor<typeof ResponsiveSelect>\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n >\n | SerializedListControl<T extends ListControlValue ? T : ListControlValue>\n | SerializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | SerializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | SerializedControlDef<typeof GapX>\n | SerializedGapYControl<T>\n | SerializedControlDef<typeof ResponsiveNumber>\n | SerializedCheckboxControl<T>\n | SerializedResponsiveColorControl<T>\n | SerializedNumberControl<T>\n | SerializedControlDef<typeof ResponsiveIconRadioGroup>\n | SerializedControlDef<typeof ResponsiveSelect>\n | SerializedResponsiveLengthControl<T>\n | SerializedDateControl<T>\n | SerializedLinkControl<T>\n | SerializedTextInputControl<T>\n | SerializedTextStyleControl<T>\n | SerializedImageControl<T>\n | SerializedRichTextControl<T>\n\ntype SerializedPanelControl<T extends Data = Data> = Extract<\n SerializedLegacyControl<T>,\n { type: PanelControlType }\n>\n\ntype SerializedPanelControlValueType<T extends SerializedPanelControl> =\n T extends SerializedPanelControl<infer U> ? U : never\n\nexport type DeserializedLegacyControl<T extends Data = Data> =\n | Exclude<\n LegacyDescriptor<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | Descriptor<typeof GapX>\n | GapYDescriptor<T>\n | Descriptor<typeof ResponsiveNumber>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | Descriptor<typeof ResponsiveIconRadioGroup>\n | Descriptor<typeof ResponsiveSelect>\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n >\n | DeserializedListControl<T extends ListControlValue ? T : ListControlValue>\n | DeserializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | DeserializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | DeserializedControlDef<typeof GapX>\n | DeserializedGapYControl<T>\n | DeserializedControlDef<typeof ResponsiveNumber>\n | DeserializedCheckboxControl<T>\n | DeserializedResponsiveColorControl<T>\n | DeserializedNumberControl<T>\n | DeserializedControlDef<typeof ResponsiveIconRadioGroup>\n | DeserializedControlDef<typeof ResponsiveSelect>\n | DeserializedResponsiveLengthControl<T>\n | DeserializedDateControl<T>\n | DeserializedLinkControl<T>\n | DeserializedTextInputControl<T>\n | DeserializedTextStyleControl<T>\n | DeserializedImageControl<T>\n | DeserializedRichTextControl<T>\n\nexport type DeserializedPanelControl<T extends Data = Data> = Extract<\n DeserializedLegacyControl<T>,\n { type: PanelControlType }\n>\n\ntype DeserializedPanelControlValueType<T extends DeserializedPanelControl> =\n T extends DeserializedPanelControl<infer U> ? U : never\n\nexport function serializeLegacyControl<T extends Data>(\n control: LegacyDescriptor<T>,\n): [SerializedLegacyControl<T>, Transferable[]] {\n switch (control.type) {\n case PropControllerTypes.Checkbox:\n return serializeCheckboxControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.List:\n return serializeListControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.Shape:\n return serializeShapeControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.Typeahead:\n return serializeTypeaheadControl(control)\n\n case PropControllerTypes.GapX:\n return serializeControlDef<typeof GapX>(control)\n\n case PropControllerTypes.GapY:\n return serializeGapYControl(control)\n\n case PropControllerTypes.ResponsiveColor:\n return serializeResponsiveColorControl(control)\n\n case PropControllerTypes.ResponsiveNumber:\n return serializeControlDef<typeof ResponsiveNumber>(control)\n\n case PropControllerTypes.Number:\n return serializeNumberControl(control)\n\n case PropControllerTypes.ResponsiveIconRadioGroup:\n return serializeControlDef<typeof ResponsiveIconRadioGroup>(control)\n\n case PropControllerTypes.ResponsiveSelect:\n return serializeControlDef<typeof ResponsiveSelect>(control)\n\n case PropControllerTypes.ResponsiveLength:\n return serializeResponsiveLengthControl(control)\n\n case PropControllerTypes.Date:\n return serializeDateControl(control)\n\n case PropControllerTypes.Link:\n return serializeLinkControl(control)\n\n case PropControllerTypes.TextInput:\n return serializeTextInputControl(control)\n\n case PropControllerTypes.TextStyle:\n return serializeTextStyleControl(control)\n\n case PropControllerTypes.Image:\n return serializeImageControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\n return serializeRichTextControl(control)\n\n default:\n return [control, []]\n }\n}\n\nexport function deserializeLegacyControl<T extends Data>(\n serializedControl: SerializedLegacyControl<T>,\n): DeserializedLegacyControl<T> {\n switch (serializedControl.type) {\n case PropControllerTypes.Checkbox:\n return deserializeCheckboxControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.List:\n return deserializeListControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.Shape:\n return deserializeShapeControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.Typeahead:\n return deserializeTypeaheadControl(serializedControl)\n\n case PropControllerTypes.GapX:\n return deserializeControlDef<typeof GapX>(serializedControl)\n\n case PropControllerTypes.GapY:\n return deserializeGapYControl(serializedControl)\n\n case PropControllerTypes.ResponsiveColor:\n return deserializeResponsiveColorControl(serializedControl)\n\n case PropControllerTypes.ResponsiveNumber:\n return deserializeControlDef<typeof ResponsiveNumber>(serializedControl)\n\n case PropControllerTypes.Number:\n return deserializeNumberControl(serializedControl)\n\n case PropControllerTypes.ResponsiveIconRadioGroup:\n return deserializeControlDef<typeof ResponsiveIconRadioGroup>(serializedControl)\n\n case PropControllerTypes.ResponsiveSelect:\n return deserializeControlDef<typeof ResponsiveSelect>(serializedControl)\n\n case PropControllerTypes.ResponsiveLength:\n return deserializeResponsiveLengthControl(serializedControl)\n\n case PropControllerTypes.Date:\n return deserializeDateControl(serializedControl)\n\n case PropControllerTypes.Link:\n return deserializeLinkControl(serializedControl)\n\n case PropControllerTypes.TextInput:\n return deserializeTextInputControl(serializedControl)\n\n case PropControllerTypes.TextStyle:\n return deserializeTextStyleControl(serializedControl)\n\n case PropControllerTypes.Image:\n return deserializeImageControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\n return deserializeRichTextControl(serializedControl)\n\n default:\n return serializedControl\n }\n}\n"],"mappings":"AAMA;AAAA,EA4BE,SAAS;AAAA,OAIJ;AAEP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP;AAAA,EACE;AAAA,OAUK;AAiBP,SAAS,sBAIP,SAOA;AACA,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,gBAAgC,CAAC;AACvC,QAAM,iBAAiB,CAAC;AAIxB,SAAO,QAAQ,IAAI,EAAE,QAAQ,CAAC,CAAC,KAAKA,QAAO,MAAM;AAC/C,UAAM,CAAC,mBAAmB,8BAA8B,IAAI,uBAAuBA,QAAO;AAE1F,mBAAe,GAAwB,IAAI;AAC3C,kBAAc,KAAK,GAAG,8BAA8B;AAAA,EACtD,CAAC;AAGD,SAAO,CAAC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