@makeswift/runtime 0.7.5 → 0.7.7
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/Box.cjs.js +0 -1
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +0 -1
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +0 -1
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +0 -1
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +0 -1
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +0 -1
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +0 -1
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +0 -1
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +0 -1
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +0 -1
- package/dist/Divider.es.js.map +1 -1
- package/dist/EditableText.cjs.js +0 -1
- package/dist/EditableText.cjs.js.map +1 -1
- package/dist/EditableText.es.js +1 -2
- package/dist/EditableText.es.js.map +1 -1
- package/dist/Embed.cjs.js +0 -1
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +0 -1
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +0 -1
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +0 -1
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +0 -1
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +0 -1
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +0 -1
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +0 -1
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +0 -1
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +0 -1
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +6 -2
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +8 -4
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +0 -1
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +0 -1
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/Root.cjs.js +0 -1
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +0 -1
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +0 -1
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +0 -1
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +0 -1
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +0 -1
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +0 -1
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +0 -1
- package/dist/Video.es.js.map +1 -1
- package/dist/builder.cjs.js +0 -1
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +0 -1
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +0 -1
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +0 -1
- package/dist/components.es.js.map +1 -1
- package/dist/constants.cjs.js +18 -3
- package/dist/constants.cjs.js.map +1 -1
- package/dist/constants.es.js +17 -3
- package/dist/constants.es.js.map +1 -1
- package/dist/control-serialization.cjs.js +107 -108
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +1 -2
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +14 -11
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +1 -2
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +133 -114
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs5.js +0 -1
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.es.js +107 -88
- package/dist/index.es.js.map +1 -1
- package/dist/index.es5.js +0 -1
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +1 -1
- package/dist/main.cjs.js +0 -1
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +0 -1
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +0 -1
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +0 -1
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.es.js +1 -1
- package/dist/react.cjs.js +0 -1
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +0 -1
- package/dist/react.es.js.map +1 -1
- package/dist/rich-text.cjs.js +499 -7
- package/dist/rich-text.cjs.js.map +1 -1
- package/dist/rich-text.es.js +484 -7
- package/dist/rich-text.es.js.map +1 -1
- package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/src/controls/control.d.ts +2 -1
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/list.d.ts +20 -0
- package/dist/types/src/controls/list.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +21 -0
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/instances.d.ts +3 -2
- package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +6 -3
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/list.d.ts +3 -2
- package/dist/types/src/runtimes/react/controls/list.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/shape.d.ts +3 -2
- package/dist/types/src/runtimes/react/controls/shape.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/src/state/modules/read-only-documents.d.ts +1 -0
- package/dist/types/src/state/modules/read-only-documents.d.ts.map +1 -1
- package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
- package/dist/types/src/state/react-page.d.ts +6 -0
- package/dist/types/src/state/react-page.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/control.cjs.js +0 -437
- package/dist/control.cjs.js.map +0 -1
- package/dist/control.es.js +0 -426
- package/dist/control.es.js.map +0 -1
package/dist/rich-text.es.js
CHANGED
|
@@ -200,10 +200,10 @@ function Image$1(options = {}) {
|
|
|
200
200
|
function Images(options = {}) {
|
|
201
201
|
return { type: Types.Images, options };
|
|
202
202
|
}
|
|
203
|
-
function Link(options = {}) {
|
|
203
|
+
function Link$1(options = {}) {
|
|
204
204
|
return { type: Types.Link, options };
|
|
205
205
|
}
|
|
206
|
-
function List(options) {
|
|
206
|
+
function List$1(options) {
|
|
207
207
|
return { type: Types.List, options };
|
|
208
208
|
}
|
|
209
209
|
const MarginPropControllerFormat = {
|
|
@@ -257,7 +257,7 @@ function Shadows(options = {}) {
|
|
|
257
257
|
return { type: Types.Shadows, options };
|
|
258
258
|
}
|
|
259
259
|
Shadows.Format = ShadowsPropControllerFormat;
|
|
260
|
-
function Shape(options) {
|
|
260
|
+
function Shape$1(options) {
|
|
261
261
|
return { type: Types.Shape, options };
|
|
262
262
|
}
|
|
263
263
|
function SocialLinks(options = {}) {
|
|
@@ -309,8 +309,8 @@ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
309
309
|
Grid,
|
|
310
310
|
Image: Image$1,
|
|
311
311
|
Images,
|
|
312
|
-
Link,
|
|
313
|
-
List,
|
|
312
|
+
Link: Link$1,
|
|
313
|
+
List: List$1,
|
|
314
314
|
MarginPropControllerFormat,
|
|
315
315
|
Margin,
|
|
316
316
|
NavigationLinks,
|
|
@@ -326,7 +326,7 @@ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
326
326
|
RichText: RichText$1,
|
|
327
327
|
ShadowsPropControllerFormat,
|
|
328
328
|
Shadows,
|
|
329
|
-
Shape,
|
|
329
|
+
Shape: Shape$1,
|
|
330
330
|
SocialLinks,
|
|
331
331
|
Table,
|
|
332
332
|
TableFormFields,
|
|
@@ -353,6 +353,26 @@ function copyImageData(value, context) {
|
|
|
353
353
|
return value;
|
|
354
354
|
return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
|
|
355
355
|
}
|
|
356
|
+
const LinkControlType = "makeswift::controls::link";
|
|
357
|
+
function Link(config = {}) {
|
|
358
|
+
return { type: LinkControlType, config };
|
|
359
|
+
}
|
|
360
|
+
function copyLinkData(value, context) {
|
|
361
|
+
var _a;
|
|
362
|
+
if (value == null)
|
|
363
|
+
return value;
|
|
364
|
+
if (value.type === "OPEN_PAGE") {
|
|
365
|
+
const pageId = value.payload.pageId;
|
|
366
|
+
if (pageId != null) {
|
|
367
|
+
return __spreadProps(__spreadValues({}, value), {
|
|
368
|
+
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
369
|
+
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
|
|
370
|
+
})
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return value;
|
|
375
|
+
}
|
|
356
376
|
const RichTextPropControllerMessageType = {
|
|
357
377
|
CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
|
|
358
378
|
INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
|
|
@@ -449,10 +469,108 @@ function createPropController(descriptor, send) {
|
|
|
449
469
|
return new SlotControl(send);
|
|
450
470
|
case RichTextControlType:
|
|
451
471
|
return new RichTextControl(send);
|
|
472
|
+
case ListControlType:
|
|
473
|
+
return new ListControl(send, descriptor);
|
|
474
|
+
case ShapeControlType:
|
|
475
|
+
return new ShapeControl(send, descriptor);
|
|
452
476
|
default:
|
|
453
477
|
return new DefaultPropController(send);
|
|
454
478
|
}
|
|
455
479
|
}
|
|
480
|
+
const ListControlType = "makeswift::controls::list";
|
|
481
|
+
function List(config) {
|
|
482
|
+
return { type: ListControlType, config };
|
|
483
|
+
}
|
|
484
|
+
const ListControlMessageType = {
|
|
485
|
+
LIST_CONTROL_ITEM_CONTROL_MESSAGE: "makeswift::controls::list::message::item-control-message"
|
|
486
|
+
};
|
|
487
|
+
class ListControl extends PropController {
|
|
488
|
+
constructor(send, descriptor) {
|
|
489
|
+
super(send);
|
|
490
|
+
__publicField(this, "controls");
|
|
491
|
+
__publicField(this, "descriptor");
|
|
492
|
+
__publicField(this, "send");
|
|
493
|
+
__publicField(this, "setItemsControl", (value) => {
|
|
494
|
+
const controls = /* @__PURE__ */ new Map();
|
|
495
|
+
if (value == null)
|
|
496
|
+
return;
|
|
497
|
+
const shouldUpdate = () => {
|
|
498
|
+
if (value.length !== this.controls.size)
|
|
499
|
+
return true;
|
|
500
|
+
if (!value.every(({ id }) => this.controls.has(id)))
|
|
501
|
+
return true;
|
|
502
|
+
return false;
|
|
503
|
+
};
|
|
504
|
+
if (!shouldUpdate())
|
|
505
|
+
return this.controls;
|
|
506
|
+
value.forEach((item) => {
|
|
507
|
+
const control = createPropController(this.descriptor.config.type, (message) => this.send({
|
|
508
|
+
type: ListControlMessageType.LIST_CONTROL_ITEM_CONTROL_MESSAGE,
|
|
509
|
+
payload: { message, itemId: item.id }
|
|
510
|
+
}));
|
|
511
|
+
controls.set(item.id, control);
|
|
512
|
+
});
|
|
513
|
+
this.controls = controls;
|
|
514
|
+
return this.controls;
|
|
515
|
+
});
|
|
516
|
+
this.descriptor = descriptor;
|
|
517
|
+
this.send = send;
|
|
518
|
+
this.controls = /* @__PURE__ */ new Map();
|
|
519
|
+
}
|
|
520
|
+
recv() {
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
function copyListData(definition, value, context) {
|
|
524
|
+
if (value == null)
|
|
525
|
+
return value;
|
|
526
|
+
return value && value.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
527
|
+
value: copy(definition.config.type, item.value, context)
|
|
528
|
+
}));
|
|
529
|
+
}
|
|
530
|
+
const ShapeControlType = "makeswift::controls::shape";
|
|
531
|
+
function Shape(config) {
|
|
532
|
+
return { type: ShapeControlType, config };
|
|
533
|
+
}
|
|
534
|
+
const ShapeControlMessageType = {
|
|
535
|
+
SHAPE_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::shape::message::child-control-message"
|
|
536
|
+
};
|
|
537
|
+
class ShapeControl extends PropController {
|
|
538
|
+
constructor(send, descriptor) {
|
|
539
|
+
super(send);
|
|
540
|
+
__publicField(this, "controls");
|
|
541
|
+
__publicField(this, "descriptor");
|
|
542
|
+
__publicField(this, "send");
|
|
543
|
+
__publicField(this, "setControls", () => {
|
|
544
|
+
const controls = /* @__PURE__ */ new Map();
|
|
545
|
+
const children = this.descriptor.config.type;
|
|
546
|
+
Object.keys(children).forEach((key) => {
|
|
547
|
+
const control = createPropController(children[key], (message) => this.send({
|
|
548
|
+
type: ShapeControlMessageType.SHAPE_CONTROL_CHILD_CONTROL_MESSAGE,
|
|
549
|
+
payload: { message, key }
|
|
550
|
+
}));
|
|
551
|
+
controls.set(key, control);
|
|
552
|
+
});
|
|
553
|
+
this.controls = controls;
|
|
554
|
+
return this.controls;
|
|
555
|
+
});
|
|
556
|
+
this.descriptor = descriptor;
|
|
557
|
+
this.send = send;
|
|
558
|
+
this.controls = /* @__PURE__ */ new Map();
|
|
559
|
+
this.setControls();
|
|
560
|
+
}
|
|
561
|
+
recv() {
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
function copyShapeData(definition, value, context) {
|
|
565
|
+
if (value == null)
|
|
566
|
+
return value;
|
|
567
|
+
const newValue = {};
|
|
568
|
+
for (const [key, itemDefinition] of Object.entries(definition.config.type)) {
|
|
569
|
+
const prop = value[key];
|
|
570
|
+
newValue[key] = copy(itemDefinition, prop, context);
|
|
571
|
+
}
|
|
572
|
+
return newValue;
|
|
573
|
+
}
|
|
456
574
|
const SlotControlType = "makeswift::controls::slot";
|
|
457
575
|
function Slot() {
|
|
458
576
|
return { type: SlotControlType };
|
|
@@ -478,6 +596,365 @@ function copySlotData(value, context) {
|
|
|
478
596
|
elements: value.elements.map((element) => context.copyElement(element))
|
|
479
597
|
});
|
|
480
598
|
}
|
|
599
|
+
function copy$e(value, context) {
|
|
600
|
+
if (value == null)
|
|
601
|
+
return value;
|
|
602
|
+
return value.map((override) => __spreadProps(__spreadValues({}, override), {
|
|
603
|
+
value: override.value.map((backgroundItem) => {
|
|
604
|
+
var _a, _b;
|
|
605
|
+
switch (backgroundItem.type) {
|
|
606
|
+
case "color":
|
|
607
|
+
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
608
|
+
payload: backgroundItem.payload === null ? null : __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
609
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(backgroundItem.payload.swatchId)) != null ? _a : backgroundItem.payload.swatchId
|
|
610
|
+
})
|
|
611
|
+
});
|
|
612
|
+
case "gradient":
|
|
613
|
+
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
614
|
+
payload: __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
615
|
+
stops: backgroundItem.payload.stops.map((stop) => {
|
|
616
|
+
var _a2;
|
|
617
|
+
return __spreadProps(__spreadValues({}, stop), {
|
|
618
|
+
color: stop.color == null ? null : __spreadProps(__spreadValues({}, stop.color), {
|
|
619
|
+
swatchId: (_a2 = context.replacementContext.swatchIds.get(stop.color.swatchId)) != null ? _a2 : stop.color.swatchId
|
|
620
|
+
})
|
|
621
|
+
});
|
|
622
|
+
})
|
|
623
|
+
})
|
|
624
|
+
});
|
|
625
|
+
case "image":
|
|
626
|
+
return __spreadProps(__spreadValues({}, backgroundItem), {
|
|
627
|
+
payload: __spreadProps(__spreadValues({}, backgroundItem.payload), {
|
|
628
|
+
imageId: (_b = context.replacementContext.fileIds.get(backgroundItem.payload.imageId)) != null ? _b : backgroundItem.payload.imageId
|
|
629
|
+
})
|
|
630
|
+
});
|
|
631
|
+
default:
|
|
632
|
+
return backgroundItem;
|
|
633
|
+
}
|
|
634
|
+
})
|
|
635
|
+
}));
|
|
636
|
+
}
|
|
637
|
+
function copy$d(value, context) {
|
|
638
|
+
if (value == null)
|
|
639
|
+
return void 0;
|
|
640
|
+
return __spreadProps(__spreadValues({}, value), {
|
|
641
|
+
elements: value.elements.map((element) => context.copyElement(element))
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
function copy$c(value, context) {
|
|
645
|
+
var _a, _b;
|
|
646
|
+
if (value == null)
|
|
647
|
+
return value;
|
|
648
|
+
switch (value.type) {
|
|
649
|
+
case "OPEN_PAGE": {
|
|
650
|
+
const pageId = value.payload.pageId;
|
|
651
|
+
if (pageId == null)
|
|
652
|
+
return value;
|
|
653
|
+
return __spreadProps(__spreadValues({}, value), {
|
|
654
|
+
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
655
|
+
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
|
|
656
|
+
})
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
case "SCROLL_TO_ELEMENT": {
|
|
660
|
+
const elementIdConfig = value.payload.elementIdConfig;
|
|
661
|
+
if (elementIdConfig == null)
|
|
662
|
+
return value;
|
|
663
|
+
return __spreadProps(__spreadValues({}, value), {
|
|
664
|
+
payload: __spreadProps(__spreadValues({}, value.payload), {
|
|
665
|
+
elementIdConfig: __spreadProps(__spreadValues({}, elementIdConfig), {
|
|
666
|
+
elementKey: (_b = context.replacementContext.elementKeys.get(elementIdConfig.elementKey)) != null ? _b : elementIdConfig.elementKey
|
|
667
|
+
})
|
|
668
|
+
})
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
default:
|
|
672
|
+
return value;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
function copy$b(value, context) {
|
|
676
|
+
if (value == null)
|
|
677
|
+
return value;
|
|
678
|
+
return value.map(copyNavigationLinksPanelItem);
|
|
679
|
+
function copyNavigationLinksPanelItem(item) {
|
|
680
|
+
switch (item.type) {
|
|
681
|
+
case "button":
|
|
682
|
+
case "dropdown": {
|
|
683
|
+
const { color, link } = item.payload;
|
|
684
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
685
|
+
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
686
|
+
link: link != null ? copy$c(link, context) : void 0,
|
|
687
|
+
color: color != null ? color.map((override) => {
|
|
688
|
+
var _a;
|
|
689
|
+
return __spreadProps(__spreadValues({}, override), {
|
|
690
|
+
value: __spreadProps(__spreadValues({}, override.value), {
|
|
691
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a : override.value.swatchId
|
|
692
|
+
})
|
|
693
|
+
});
|
|
694
|
+
}) : void 0
|
|
695
|
+
})
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
default:
|
|
699
|
+
return item;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
function copy$a(value, context) {
|
|
704
|
+
if (value == null)
|
|
705
|
+
return value;
|
|
706
|
+
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: override.value.map(copyShadowItem) }));
|
|
707
|
+
function copyShadowItem(item) {
|
|
708
|
+
var _a;
|
|
709
|
+
const { color } = item.payload;
|
|
710
|
+
if (color == null)
|
|
711
|
+
return item;
|
|
712
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
713
|
+
payload: __spreadProps(__spreadValues({}, item.payload), {
|
|
714
|
+
color: __spreadProps(__spreadValues({}, color), {
|
|
715
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
|
|
716
|
+
})
|
|
717
|
+
})
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
function copy$9(value, context) {
|
|
722
|
+
var _a;
|
|
723
|
+
if (value == null)
|
|
724
|
+
return value;
|
|
725
|
+
return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
|
|
726
|
+
}
|
|
727
|
+
function copy$8(value, context) {
|
|
728
|
+
if (value == null)
|
|
729
|
+
return value;
|
|
730
|
+
return value.map(copyImagesPanelItem);
|
|
731
|
+
function copyImagesPanelItem(imagesPanelItem) {
|
|
732
|
+
var _a;
|
|
733
|
+
const { file } = imagesPanelItem.props;
|
|
734
|
+
if (file == null)
|
|
735
|
+
return imagesPanelItem;
|
|
736
|
+
return __spreadProps(__spreadValues({}, imagesPanelItem), {
|
|
737
|
+
props: __spreadProps(__spreadValues({}, imagesPanelItem.props), {
|
|
738
|
+
file: (_a = context.replacementContext.fileIds.get(file)) != null ? _a : file
|
|
739
|
+
})
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
function copy$7(value, context) {
|
|
744
|
+
if (value == null)
|
|
745
|
+
return value;
|
|
746
|
+
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyColorValue(override.value) }));
|
|
747
|
+
function copyColorValue(colorValue) {
|
|
748
|
+
var _a;
|
|
749
|
+
return __spreadProps(__spreadValues({}, colorValue), {
|
|
750
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(colorValue.swatchId)) != null ? _a : colorValue.swatchId
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
function copy$6(value, context) {
|
|
755
|
+
if (value == null)
|
|
756
|
+
return value;
|
|
757
|
+
return __spreadProps(__spreadValues({}, value), { fields: value.fields.map(copyFormFieldsPanelItem) });
|
|
758
|
+
function copyFormFieldsPanelItem(item) {
|
|
759
|
+
var _a;
|
|
760
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
761
|
+
tableColumnId: (_a = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a : item.tableColumnId
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
function copy$5(value, context) {
|
|
766
|
+
var _a;
|
|
767
|
+
if (value == null)
|
|
768
|
+
return value;
|
|
769
|
+
return (_a = context.replacementContext.tableIds.get(value)) != null ? _a : value;
|
|
770
|
+
}
|
|
771
|
+
function copy$4(value, context) {
|
|
772
|
+
if (value == null)
|
|
773
|
+
return value;
|
|
774
|
+
return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyBorderValue(override.value) }));
|
|
775
|
+
function copyBorderValue({ borderTop, borderRight, borderBottom, borderLeft }) {
|
|
776
|
+
return {
|
|
777
|
+
borderTop: borderTop && copyBorderSide(borderTop),
|
|
778
|
+
borderRight: borderRight && copyBorderSide(borderRight),
|
|
779
|
+
borderBottom: borderBottom && copyBorderSide(borderBottom),
|
|
780
|
+
borderLeft: borderLeft && copyBorderSide(borderLeft)
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
function copyBorderSide(borderSide) {
|
|
784
|
+
var _a;
|
|
785
|
+
const { color } = borderSide;
|
|
786
|
+
if (color == null)
|
|
787
|
+
return borderSide;
|
|
788
|
+
return __spreadProps(__spreadValues({}, borderSide), {
|
|
789
|
+
color: __spreadProps(__spreadValues({}, color), {
|
|
790
|
+
swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
|
|
791
|
+
})
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
function copy$3(value, context) {
|
|
796
|
+
if (value == null)
|
|
797
|
+
return value;
|
|
798
|
+
return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
|
|
799
|
+
function copyNode(node) {
|
|
800
|
+
var _a;
|
|
801
|
+
switch (node.object) {
|
|
802
|
+
case "document":
|
|
803
|
+
case "block":
|
|
804
|
+
case "inline":
|
|
805
|
+
return copyInline(node);
|
|
806
|
+
case "text":
|
|
807
|
+
return __spreadProps(__spreadValues({}, node), { marks: (_a = node.marks) == null ? void 0 : _a.map(copyMark) });
|
|
808
|
+
default:
|
|
809
|
+
return node;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
function copyInline(inline) {
|
|
813
|
+
var _a, _b;
|
|
814
|
+
switch (inline.type) {
|
|
815
|
+
case "link":
|
|
816
|
+
return __spreadProps(__spreadValues({}, inline), {
|
|
817
|
+
nodes: (_a = inline.nodes) == null ? void 0 : _a.map(copyNode),
|
|
818
|
+
data: inline.data ? copyLinkData2(inline.data) : inline.data
|
|
819
|
+
});
|
|
820
|
+
default:
|
|
821
|
+
return __spreadProps(__spreadValues({}, inline), { nodes: (_b = inline.nodes) == null ? void 0 : _b.map(copyNode) });
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
function copyLinkData2(data) {
|
|
825
|
+
var _a, _b;
|
|
826
|
+
switch (data.type) {
|
|
827
|
+
case "OPEN_PAGE": {
|
|
828
|
+
const pageId = data.payload.pageId;
|
|
829
|
+
if (pageId == null)
|
|
830
|
+
return data;
|
|
831
|
+
return __spreadProps(__spreadValues({}, data), {
|
|
832
|
+
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
833
|
+
pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : data.payload.pageId
|
|
834
|
+
})
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
case "SCROLL_TO_ELEMENT": {
|
|
838
|
+
const elementIdConfig = data.payload.elementIdConfig;
|
|
839
|
+
if (elementIdConfig == null)
|
|
840
|
+
return data;
|
|
841
|
+
return __spreadProps(__spreadValues({}, data), {
|
|
842
|
+
payload: __spreadProps(__spreadValues({}, data.payload), {
|
|
843
|
+
elementIdConfig: __spreadProps(__spreadValues({}, elementIdConfig), {
|
|
844
|
+
elementKey: (_b = context.replacementContext.elementKeys.get(elementIdConfig.elementKey)) != null ? _b : elementIdConfig.elementKey
|
|
845
|
+
})
|
|
846
|
+
})
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
default:
|
|
850
|
+
return data;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
function copyMark(mark) {
|
|
854
|
+
var _a, _b, _c, _d;
|
|
855
|
+
switch (mark.type) {
|
|
856
|
+
case "typography": {
|
|
857
|
+
const typographyId = (_a = mark.data) == null ? void 0 : _a.value.id;
|
|
858
|
+
return __spreadProps(__spreadValues({}, mark), {
|
|
859
|
+
data: __spreadProps(__spreadValues({}, mark.data), {
|
|
860
|
+
value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
|
|
861
|
+
id: (_c = context.replacementContext.typographyIds.get(typographyId)) != null ? _c : typographyId,
|
|
862
|
+
style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
|
|
863
|
+
var _a2, _b2, _c2;
|
|
864
|
+
return __spreadProps(__spreadValues({}, override), {
|
|
865
|
+
value: __spreadProps(__spreadValues({}, override.value), {
|
|
866
|
+
color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
|
|
867
|
+
swatchId: (_c2 = context.replacementContext.swatchIds.get((_a2 = override.value.color) == null ? void 0 : _a2.swatchId)) != null ? _c2 : (_b2 = override.value.color) == null ? void 0 : _b2.swatchId
|
|
868
|
+
})
|
|
869
|
+
})
|
|
870
|
+
});
|
|
871
|
+
})
|
|
872
|
+
})
|
|
873
|
+
})
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
default:
|
|
877
|
+
return mark;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
function copy$2(value, context) {
|
|
882
|
+
if (value == null)
|
|
883
|
+
return value;
|
|
884
|
+
if (context.replacementContext.elementHtmlIds.has(value))
|
|
885
|
+
return void 0;
|
|
886
|
+
context.replacementContext.elementHtmlIds.add(value);
|
|
887
|
+
return value;
|
|
888
|
+
}
|
|
889
|
+
function copy$1(descriptor, value, context) {
|
|
890
|
+
switch (descriptor.type) {
|
|
891
|
+
case "Backgrounds":
|
|
892
|
+
return copy$e(value, context);
|
|
893
|
+
case "Grid":
|
|
894
|
+
return copy$d(value, context);
|
|
895
|
+
case "NavigationLinks":
|
|
896
|
+
return copy$b(value, context);
|
|
897
|
+
case "Link":
|
|
898
|
+
return copy$c(value, context);
|
|
899
|
+
case "Shadows":
|
|
900
|
+
return copy$a(value, context);
|
|
901
|
+
case "Image":
|
|
902
|
+
return copy$9(value, context);
|
|
903
|
+
case "Images":
|
|
904
|
+
return copy$8(value, context);
|
|
905
|
+
case "ResponsiveColor":
|
|
906
|
+
return copy$7(value, context);
|
|
907
|
+
case "TableFormFields":
|
|
908
|
+
return copy$6(value, context);
|
|
909
|
+
case "Table":
|
|
910
|
+
return copy$5(value, context);
|
|
911
|
+
case "Border":
|
|
912
|
+
return copy$4(value, context);
|
|
913
|
+
case "RichText":
|
|
914
|
+
return copy$3(value, context);
|
|
915
|
+
case "ElementID":
|
|
916
|
+
return copy$2(value, context);
|
|
917
|
+
default:
|
|
918
|
+
return value;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
function copyElementReference(value, context) {
|
|
922
|
+
return context.replacementContext.globalElementIds.get(value) || value;
|
|
923
|
+
}
|
|
924
|
+
function copy(definition, value, context) {
|
|
925
|
+
switch (definition.type) {
|
|
926
|
+
case Types.Backgrounds:
|
|
927
|
+
case Types.Grid:
|
|
928
|
+
case Types.NavigationLinks:
|
|
929
|
+
case Types.Link:
|
|
930
|
+
case Types.Shadows:
|
|
931
|
+
case Types.Image:
|
|
932
|
+
case Types.Images:
|
|
933
|
+
case Types.ResponsiveColor:
|
|
934
|
+
case Types.TableFormFields:
|
|
935
|
+
case Types.Table:
|
|
936
|
+
case Types.Border:
|
|
937
|
+
case Types.RichText:
|
|
938
|
+
case Types.ElementID:
|
|
939
|
+
return copy$1(definition, value, context);
|
|
940
|
+
case ColorControlType:
|
|
941
|
+
return copyColorData(value, context);
|
|
942
|
+
case ImageControlType:
|
|
943
|
+
return copyImageData(value, context);
|
|
944
|
+
case LinkControlType:
|
|
945
|
+
return copyLinkData(value, context);
|
|
946
|
+
case ShapeControlType:
|
|
947
|
+
return copyShapeData(definition, value, context);
|
|
948
|
+
case ListControlType:
|
|
949
|
+
return copyListData(definition, value, context);
|
|
950
|
+
case StyleControlType:
|
|
951
|
+
return copyStyleData(value, context);
|
|
952
|
+
case SlotControlType:
|
|
953
|
+
return copySlotData(value, context);
|
|
954
|
+
default:
|
|
955
|
+
return value;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
481
958
|
const RichTextControlType = "makeswift::controls::rich-text";
|
|
482
959
|
function RichText() {
|
|
483
960
|
return { type: RichTextControlType };
|
|
@@ -543,5 +1020,5 @@ class RichTextControl extends PropController {
|
|
|
543
1020
|
this.send({ type: RichTextControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
544
1021
|
}
|
|
545
1022
|
}
|
|
546
|
-
export { WidthPropControllerFormat as $,
|
|
1023
|
+
export { WidthPropControllerFormat as $, NavigationLinks as A, Backgrounds as B, ColorControlType as C, Date as D, ElementID as E, Font as F, GapY as G, SocialLinks as H, ImageControlType as I, RichText$1 as J, StyleControlProperty as K, ListControlType as L, Margin as M, Number as N, ImageControlValueFormat as O, Padding as P, LinkControlType as Q, RichTextPropControllerMessageType as R, SlotControlType as S, Types as T, BorderPropControllerFormat as U, Video as V, Width as W, ShadowsPropControllerFormat as X, BorderRadiusPropControllerFormat as Y, MarginPropControllerFormat as Z, PaddingPropControllerFormat as _, copy as a, RichTextControlType as a0, StyleControlType as a1, Color as a2, copyColorData as a3, Image as a4, copyImageData as a5, Link as a6, copyLinkData as a7, List as a8, ListControlMessageType as a9, ListControl as aa, copyListData as ab, Shape as ac, ShapeControlMessageType as ad, ShapeControl as ae, copyShapeData as af, Slot as ag, SlotControlMessageType as ah, SlotControl as ai, copySlotData as aj, Style as ak, copyStyleData as al, RichText as am, RichTextControlMessageType as an, RichTextControl as ao, BuilderEditMode as ap, createPropController as aq, TableFormFieldsMessageType as b, copyElementReference as c, descriptors as d, ShapeControlType as e, ResponsiveIconRadioGroup as f, Border as g, BorderRadius as h, Shadows as i, GapX as j, ResponsiveSelect as k, ResponsiveNumber as l, Checkbox as m, Grid as n, TextInput as o, Link$1 as p, ResponsiveColor as q, reducer as r, TextStyle as s, Images as t, ResponsiveLength as u, TextArea as v, Table as w, TableFormFields as x, Image$1 as y, ResponsiveOpacity as z };
|
|
547
1024
|
//# sourceMappingURL=rich-text.es.js.map
|