@g1cloud/page-builder-editor 1.0.0-alpha.27 → 1.0.0-alpha.29

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.
@@ -6688,18 +6688,19 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
6688
6688
  if (align === "right") return "flex-end";
6689
6689
  return "center";
6690
6690
  }
6691
- getStyles() {
6691
+ getStyles(isMobilePage) {
6692
6692
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P;
6693
6693
  const style = {};
6694
6694
  const align = ((_a = this.properties) == null ? void 0 : _a.align) || "center";
6695
6695
  if (this.isWidget()) {
6696
6696
  style.alignSelf = this.getAlignStyleValue(align);
6697
6697
  } else {
6698
- if (((_b = this.properties) == null ? void 0 : _b.direction) === "horizontal") {
6698
+ const direction = isMobilePage ? (_b = this.properties) == null ? void 0 : _b.directionSm : (_c = this.properties) == null ? void 0 : _c.directionLg;
6699
+ if (direction === "horizontal") {
6699
6700
  style.display = "flex";
6700
6701
  style.flexDirection = "row";
6701
6702
  style.justifyContent = this.getAlignStyleValue(align);
6702
- } else if (((_c = this.properties) == null ? void 0 : _c.direction) === "vertical") {
6703
+ } else if (direction === "vertical") {
6703
6704
  style.display = "flex";
6704
6705
  style.flexDirection = "column";
6705
6706
  style.alignItems = this.getAlignStyleValue(align);
@@ -6853,7 +6854,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
6853
6854
  },
6854
6855
  setup(__props) {
6855
6856
  const props = __props;
6856
- const className = vue.computed(() => getPartClassName(props.part));
6857
+ const classNames = vue.computed(() => [getPartClassName(props.part), props.part.getClassNames()]);
6857
6858
  const styleTag = vue.computed(() => props.part.getStyleTag());
6858
6859
  const style = vue.computed(() => ({
6859
6860
  ...props.part.getStyles(),
@@ -6867,7 +6868,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
6867
6868
  innerHTML: styleTag.value
6868
6869
  }, null, 8, ["innerHTML"])) : vue.createCommentVNode("", true),
6869
6870
  vue.createElementVNode("div", {
6870
- class: vue.normalizeClass([className.value, "pb-widget"]),
6871
+ class: vue.normalizeClass([classNames.value, "pb-widget"]),
6871
6872
  "data-part-id": _ctx.part.partId,
6872
6873
  style: vue.normalizeStyle(style.value)
6873
6874
  }, [
@@ -6884,14 +6885,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
6884
6885
  const _sfc_main$b$1 = /* @__PURE__ */ vue.defineComponent({
6885
6886
  __name: "PbBlock",
6886
6887
  props: {
6887
- part: {}
6888
+ part: {},
6889
+ isMobilePage: { type: Boolean }
6888
6890
  },
6889
6891
  setup(__props) {
6890
6892
  const props = __props;
6891
- const classNames = vue.computed(() => props.part.getClassNames());
6893
+ const classNames = vue.computed(() => [getPartClassName(props.part), props.part.getClassNames()]);
6892
6894
  const styleTag = vue.computed(() => props.part.getStyleTag());
6893
6895
  const style = vue.computed(() => ({
6894
- ...props.part.getStyles(),
6896
+ ...props.part.getStyles(props.isMobilePage),
6895
6897
  ...props.part.getInlineStyles()
6896
6898
  }));
6897
6899
  vue.computed(() => createPartComponents(props.part.children));
@@ -6942,14 +6944,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
6942
6944
  const _sfc_main$9$1 = /* @__PURE__ */ vue.defineComponent({
6943
6945
  __name: "PbSection",
6944
6946
  props: {
6945
- part: {}
6947
+ part: {},
6948
+ isMobilePage: { type: Boolean }
6946
6949
  },
6947
6950
  setup(__props) {
6948
6951
  const props = __props;
6949
- const classNames = vue.computed(() => props.part.getClassNames());
6952
+ const classNames = vue.computed(() => [getPartClassName(props.part), props.part.getClassNames()]);
6950
6953
  const styleTag = vue.computed(() => props.part.getStyleTag());
6951
6954
  const style = vue.computed(() => ({
6952
- ...props.part.getStyles(),
6955
+ ...props.part.getStyles(props.isMobilePage),
6953
6956
  ...props.part.getInlineStyles()
6954
6957
  }));
6955
6958
  return (_ctx, _cache) => {
@@ -6970,8 +6973,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
6970
6973
  }, null, 8, ["part"])) : _ctx.part.children && _ctx.part.children.length > 0 ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(_ctx.part.children, (block) => {
6971
6974
  return vue.openBlock(), vue.createBlock(_sfc_main$b$1, {
6972
6975
  key: block.partId,
6976
+ "is-mobile-page": _ctx.isMobilePage,
6973
6977
  part: block
6974
- }, null, 8, ["part"]);
6978
+ }, null, 8, ["is-mobile-page", "part"]);
6975
6979
  }), 128)) : vue.createCommentVNode("", true)
6976
6980
  ], 14, _hoisted_1$8$1)
6977
6981
  ], 64);
@@ -7404,13 +7408,10 @@ ${_html.style}
7404
7408
  },
7405
7409
  setup(__props) {
7406
7410
  const props = __props;
7407
- const classNames = vue.computed(() => {
7408
- var _a;
7409
- return `${(_a = props.part) == null ? void 0 : _a.getClassNames()} ${props.isMobilePage ? "mobile" : "pc"}`;
7410
- });
7411
+ const classNames = vue.computed(() => [getPartClassName(props.part), props.part.getClassNames(), props.isMobilePage ? "mobile" : "pc"]);
7411
7412
  const styleTag = vue.computed(() => props.part.getStyleTag());
7412
7413
  const style = vue.computed(() => ({
7413
- ...props.part.getStyles(),
7414
+ ...props.part.getStyles(props.isMobilePage),
7414
7415
  ...props.part.getInlineStyles()
7415
7416
  }));
7416
7417
  return (_ctx, _cache) => {
@@ -7430,8 +7431,9 @@ ${_html.style}
7430
7431
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.part.children, (section) => {
7431
7432
  return vue.openBlock(), vue.createBlock(_sfc_main$9$1, {
7432
7433
  key: section.partId,
7434
+ "is-mobile-page": _ctx.isMobilePage,
7433
7435
  part: section
7434
- }, null, 8, ["part"]);
7436
+ }, null, 8, ["is-mobile-page", "part"]);
7435
7437
  }), 128))
7436
7438
  ], 2)
7437
7439
  ], 14, _hoisted_1$2$1)
@@ -8375,6 +8377,13 @@ ${_html.style}
8375
8377
  style.width = "20px";
8376
8378
  style.height = height || "";
8377
8379
  };
8380
+ const getLayoutDirection = (isMobilePage, properties) => {
8381
+ if (isMobilePage) {
8382
+ return properties && properties.directionSm || "vertical";
8383
+ } else {
8384
+ return properties && properties.directionLg || "horizontal";
8385
+ }
8386
+ };
8378
8387
  const _export_sfc = (sfc, props) => {
8379
8388
  const target = sfc.__vccOpts || sfc;
8380
8389
  for (const [key, val] of props) {
@@ -8426,7 +8435,8 @@ ${_html.style}
8426
8435
  const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
8427
8436
  __name: "PbWidget",
8428
8437
  props: {
8429
- part: {}
8438
+ part: {},
8439
+ isMobilePage: { type: Boolean }
8430
8440
  },
8431
8441
  setup(__props) {
8432
8442
  const mouseTracker = useMouseTracker();
@@ -8510,11 +8520,7 @@ ${_html.style}
8510
8520
  placeholder: true
8511
8521
  };
8512
8522
  });
8513
- const thisComponent = vue.computed(() => pageBuilder.partManager.createPartComponent(props.part));
8514
- vue.computed(() => pageBuilder.partManager.createPartComponents(props.part.children));
8515
- const droppable = vue.computed(() => {
8516
- return pageBuilder.partManager.isChildAllowed(props.part);
8517
- });
8523
+ const component = vue.computed(() => pageBuilder.partManager.createPartComponent(props.part));
8518
8524
  const locatePositionMark = (mark, target, mouseOffsetX, mouseOffsetY, draggingPart2, event) => {
8519
8525
  if (props.part.isNestedWidget()) {
8520
8526
  if (draggingPart2.isWidget())
@@ -8529,7 +8535,6 @@ ${_html.style}
8529
8535
  locateWidget(mark, target, mouseOffsetX, mouseOffsetY, draggingPart2);
8530
8536
  };
8531
8537
  const locateSection = (mark, target, mouseOffsetX, mouseOffsetY, draggingPart2, event) => {
8532
- var _a, _b, _c;
8533
8538
  mark.style.background = "#e67e22";
8534
8539
  const widget2 = props.part;
8535
8540
  const widgetElement = target;
@@ -8544,8 +8549,10 @@ ${_html.style}
8544
8549
  const isFirstBlock = blockIndex === 0;
8545
8550
  const isLastBlock = blockIndex === section.children.length - 1;
8546
8551
  const centerY = widgetElement.offsetHeight / 2;
8547
- if (((_a = section.properties) == null ? void 0 : _a.direction) === "vertical") {
8548
- if (((_b = block.properties) == null ? void 0 : _b.direction) === "vertical") {
8552
+ const sectionDirection = getLayoutDirection(props.isMobilePage, section.properties);
8553
+ const blockDirection = getLayoutDirection(props.isMobilePage, block.properties);
8554
+ if (sectionDirection === "vertical") {
8555
+ if (blockDirection === "vertical") {
8549
8556
  if (isFirstBlock && isFirstWidget && mouseOffsetY <= centerY)
8550
8557
  locateTop(mark.style);
8551
8558
  else if (isLastBlock && isLastWidget && mouseOffsetY > centerY)
@@ -8561,7 +8568,7 @@ ${_html.style}
8561
8568
  locateNone(mark.style);
8562
8569
  }
8563
8570
  } else {
8564
- if (((_c = block.properties) == null ? void 0 : _c.direction) === "vertical") {
8571
+ if (blockDirection === "vertical") {
8565
8572
  if (isFirstWidget && mouseOffsetY <= centerY)
8566
8573
  locateTop(mark.style, `-${blockElement.offsetLeft + widgetElement.offsetLeft}px`, `${sectionElement.offsetWidth}px`);
8567
8574
  else if (isLastWidget && mouseOffsetY > centerY)
@@ -8577,7 +8584,6 @@ ${_html.style}
8577
8584
  }
8578
8585
  };
8579
8586
  const locateBlock = (mark, target, mouseOffsetX, mouseOffsetY, draggingPart2, event) => {
8580
- var _a, _b, _c;
8581
8587
  mark.style.background = "#8e44ad";
8582
8588
  const widgetElement = target;
8583
8589
  const block = props.part.parent;
@@ -8586,9 +8592,12 @@ ${_html.style}
8586
8592
  const isFirstWidget = widgetIndex === 0;
8587
8593
  const isLastWidget = widgetIndex === block.children.length - 1;
8588
8594
  const section = block.parent;
8589
- if (((_a = section.properties) == null ? void 0 : _a.direction) === "vertical") {
8595
+ const sectionDirection = getLayoutDirection(props.isMobilePage, section.properties);
8596
+ const blockDirection = getLayoutDirection(props.isMobilePage, block.properties);
8597
+ console.log(sectionDirection, blockDirection);
8598
+ if (sectionDirection === "vertical") {
8590
8599
  const centerY = widgetElement.offsetHeight / 2;
8591
- if (((_b = block.properties) == null ? void 0 : _b.direction) === "vertical") {
8600
+ if (blockDirection === "vertical") {
8592
8601
  if (isFirstWidget && mouseOffsetY <= centerY)
8593
8602
  locateTop(mark.style);
8594
8603
  else if (isLastWidget && mouseOffsetY > centerY)
@@ -8603,7 +8612,7 @@ ${_html.style}
8603
8612
  }
8604
8613
  } else {
8605
8614
  const centerX = widgetElement.offsetWidth / 2;
8606
- if (((_c = block.properties) == null ? void 0 : _c.direction) === "vertical") {
8615
+ if (blockDirection === "vertical") {
8607
8616
  if (mouseOffsetX <= centerX)
8608
8617
  locateLeft(mark.style, `-${widgetElement.offsetTop}px`, `${blockElement.offsetHeight}px`);
8609
8618
  else
@@ -8619,8 +8628,11 @@ ${_html.style}
8619
8628
  }
8620
8629
  };
8621
8630
  const locateWidget = (mark, target, mouseOffsetX, mouseOffsetY, draggingPart2, event) => {
8622
- var _a, _b, _c;
8623
- if (draggingPart2.partId === props.part.partId && !props.part.isNestedWidget()) return;
8631
+ var _a;
8632
+ if (props.part.isNestedWidget()) {
8633
+ locateNone(mark.style);
8634
+ return;
8635
+ }
8624
8636
  mark.style.background = "#27ae60";
8625
8637
  const isNestedWidget = props.part.isNestedWidget();
8626
8638
  const widget2 = isNestedWidget ? props.part.parent : props.part;
@@ -8630,25 +8642,26 @@ ${_html.style}
8630
8642
  const centerY = widgetElement.offsetHeight / 2;
8631
8643
  const quaterX = centerX / 2;
8632
8644
  const quaterY = centerY / 2;
8645
+ const blockDirection = getLayoutDirection(props.isMobilePage, block.properties);
8633
8646
  if (!((_a = draggingPart2.children) == null ? void 0 : _a.length)) {
8634
- if (((_b = block.properties) == null ? void 0 : _b.direction) === "vertical") {
8647
+ if (blockDirection === "vertical") {
8635
8648
  if (mouseOffsetY <= quaterY)
8636
8649
  locateTop(mark.style);
8637
8650
  else if (mouseOffsetY > quaterY * 3)
8638
8651
  locateBottom(mark.style);
8639
- else
8652
+ else if (pageBuilder.partManager.isChildAllowed(props.part))
8640
8653
  locateCenter(mark.style);
8641
8654
  } else {
8642
8655
  if (mouseOffsetX <= quaterX)
8643
8656
  locateLeft(mark.style);
8644
8657
  else if (mouseOffsetX > quaterX * 3)
8645
8658
  locateRight(mark.style);
8646
- else
8659
+ else if (pageBuilder.partManager.isChildAllowed(props.part))
8647
8660
  locateCenter(mark.style);
8648
8661
  }
8649
8662
  return;
8650
8663
  }
8651
- if (((_c = block.properties) == null ? void 0 : _c.direction) === "vertical") {
8664
+ if (blockDirection === "vertical") {
8652
8665
  if (mouseOffsetY <= centerY)
8653
8666
  locateTop(mark.style);
8654
8667
  else
@@ -8661,17 +8674,13 @@ ${_html.style}
8661
8674
  }
8662
8675
  };
8663
8676
  const acceptChildPart = (pageBuilder2, part, target, _index, partId, event) => {
8664
- if (partId === props.part.partId && !props.part.isNestedWidget()) return;
8677
+ if (partId === props.part.partId) return;
8678
+ if (props.part.isNestedWidget()) return;
8665
8679
  const droppedPart = pageBuilder2.model.findPartById(partId);
8666
8680
  if (!droppedPart) return;
8667
8681
  const targetRect = target.getBoundingClientRect();
8668
8682
  const mouseOffsetX = event.clientX - targetRect.left;
8669
8683
  const mouseOffsetY = event.clientY - targetRect.top;
8670
- if (props.part.isNestedWidget()) {
8671
- if (droppedPart.isWidget())
8672
- acceptWidget(pageBuilder2, target, droppedPart, mouseOffsetX, mouseOffsetY);
8673
- return;
8674
- }
8675
8684
  if (droppedPart.isSection())
8676
8685
  acceptSection(pageBuilder2, target, droppedPart, mouseOffsetX, mouseOffsetY);
8677
8686
  else if (droppedPart.isBlock())
@@ -8680,7 +8689,7 @@ ${_html.style}
8680
8689
  acceptWidget(pageBuilder2, target, droppedPart, mouseOffsetX, mouseOffsetY);
8681
8690
  };
8682
8691
  const acceptSection = (pageBuilder2, target, droppedPart, mouseOffsetX, mouseOffsetY) => {
8683
- var _a, _b, _c, _d;
8692
+ var _a;
8684
8693
  const widget2 = props.part;
8685
8694
  const widgetElement = target;
8686
8695
  const block = widget2.parent;
@@ -8694,8 +8703,10 @@ ${_html.style}
8694
8703
  const centerY = widgetElement.offsetHeight / 2;
8695
8704
  const page = section.parent;
8696
8705
  let index;
8697
- if (((_a = section.properties) == null ? void 0 : _a.direction) === "vertical") {
8698
- if (((_b = block.properties) == null ? void 0 : _b.direction) === "vertical") {
8706
+ const sectionDirection = getLayoutDirection(props.isMobilePage, section.properties);
8707
+ const blockDirection = getLayoutDirection(props.isMobilePage, block.properties);
8708
+ if (sectionDirection === "vertical") {
8709
+ if (blockDirection === "vertical") {
8699
8710
  if (isFirstBlock && isFirstWidget && mouseOffsetY <= centerY) index = blockIndex;
8700
8711
  else if (isLastBlock && isLastWidget && mouseOffsetY > centerY) index = blockIndex + 1;
8701
8712
  else return;
@@ -8705,7 +8716,7 @@ ${_html.style}
8705
8716
  else return;
8706
8717
  }
8707
8718
  } else {
8708
- if (((_c = block.properties) == null ? void 0 : _c.direction) === "vertical") {
8719
+ if (blockDirection === "vertical") {
8709
8720
  if (isFirstWidget && mouseOffsetY <= centerY) index = blockIndex;
8710
8721
  else if (isLastWidget && mouseOffsetY > centerY) index = blockIndex + 1;
8711
8722
  else return;
@@ -8714,11 +8725,11 @@ ${_html.style}
8714
8725
  else index = blockIndex + 1;
8715
8726
  }
8716
8727
  }
8717
- if (((_d = page.children) == null ? void 0 : _d.indexOf(droppedPart)) === index) return;
8728
+ if (((_a = page.children) == null ? void 0 : _a.indexOf(droppedPart)) === index) return;
8718
8729
  pageBuilder2.model.moveElements(droppedPart.partId, section.partId, index);
8719
8730
  };
8720
8731
  const acceptBlock = (pageBuilder2, target, droppedPart, mouseOffsetX, mouseOffsetY) => {
8721
- var _a, _b, _c, _d;
8732
+ var _a;
8722
8733
  const widget2 = props.part;
8723
8734
  const widgetElement = target;
8724
8735
  const block = widget2.parent;
@@ -8728,9 +8739,11 @@ ${_html.style}
8728
8739
  const section = block.parent;
8729
8740
  let blockIndex = section.children.indexOf(block) || 0;
8730
8741
  let index;
8731
- if (((_a = section.properties) == null ? void 0 : _a.direction) === "vertical") {
8742
+ const sectionDirection = getLayoutDirection(props.isMobilePage, section.properties);
8743
+ const blockDirection = getLayoutDirection(props.isMobilePage, block.properties);
8744
+ if (sectionDirection === "vertical") {
8732
8745
  const centerY = widgetElement.offsetHeight / 2;
8733
- if (((_b = block.properties) == null ? void 0 : _b.direction) === "vertical") {
8746
+ if (blockDirection === "vertical") {
8734
8747
  if (isFirstWidget && mouseOffsetY <= centerY) index = blockIndex;
8735
8748
  else if (isLastWidget && mouseOffsetY > centerY) index = blockIndex + 1;
8736
8749
  else return;
@@ -8740,7 +8753,7 @@ ${_html.style}
8740
8753
  }
8741
8754
  } else {
8742
8755
  const centerX = widgetElement.offsetWidth / 2;
8743
- if (((_c = block.properties) == null ? void 0 : _c.direction) === "vertical") {
8756
+ if (blockDirection === "vertical") {
8744
8757
  if (mouseOffsetX <= centerX) index = blockIndex;
8745
8758
  else index = blockIndex + 1;
8746
8759
  } else {
@@ -8749,11 +8762,10 @@ ${_html.style}
8749
8762
  else return;
8750
8763
  }
8751
8764
  }
8752
- if (((_d = section.children) == null ? void 0 : _d.indexOf(droppedPart)) === index) return;
8765
+ if (((_a = section.children) == null ? void 0 : _a.indexOf(droppedPart)) === index) return;
8753
8766
  pageBuilder2.model.moveElements(droppedPart.partId, section.partId, index);
8754
8767
  };
8755
8768
  const acceptWidget = (pageBuilder2, target, droppedPart, mouseOffsetX, mouseOffsetY) => {
8756
- var _a, _b, _c, _d, _e, _f, _g;
8757
8769
  const isNestedWidget = props.part.isNestedWidget();
8758
8770
  const widget2 = isNestedWidget ? props.part.parent : props.part;
8759
8771
  const block = widget2.parent;
@@ -8763,73 +8775,64 @@ ${_html.style}
8763
8775
  const quaterX = centerX / 2;
8764
8776
  const quaterY = centerY / 2;
8765
8777
  let index;
8766
- if (!((_a = droppedPart.children) == null ? void 0 : _a.length)) {
8767
- if (((_b = block.properties) == null ? void 0 : _b.direction) === "vertical") {
8768
- if (mouseOffsetY <= quaterY) {
8769
- index = widgetIndex;
8770
- } else if (mouseOffsetY > quaterY * 3) {
8771
- index = widgetIndex + 1;
8772
- } else {
8773
- index = ((_c = widget2.children) == null ? void 0 : _c.length) || 0;
8774
- if (((_d = widget2.children) == null ? void 0 : _d.indexOf(droppedPart)) === index) return;
8775
- const update2 = [{
8776
- partId: droppedPart.partId,
8777
- properties: {
8778
- left: "25%",
8779
- top: "25%",
8780
- width: "50%"
8781
- }
8782
- }];
8783
- pageBuilder2.model.moveElements(droppedPart.partId, widget2.partId, index, update2);
8784
- return;
8785
- }
8778
+ const blockDirection = getLayoutDirection(props.isMobilePage, block.properties);
8779
+ if (blockDirection === "vertical") {
8780
+ if (mouseOffsetY <= quaterY) {
8781
+ index = widgetIndex;
8782
+ } else if (mouseOffsetY > quaterY * 3) {
8783
+ index = widgetIndex + 1;
8786
8784
  } else {
8787
- if (mouseOffsetX <= quaterX) {
8788
- index = widgetIndex;
8789
- } else if (mouseOffsetX > quaterX * 3) {
8790
- index = widgetIndex + 1;
8791
- } else {
8792
- index = ((_e = widget2.children) == null ? void 0 : _e.length) || 0;
8793
- if (((_f = widget2.children) == null ? void 0 : _f.indexOf(droppedPart)) === index) return;
8794
- const update2 = [{
8795
- partId: droppedPart.partId,
8796
- properties: {
8797
- left: "25%",
8798
- top: "25%",
8799
- width: "50%"
8800
- }
8801
- }];
8802
- pageBuilder2.model.moveElements(droppedPart.partId, widget2.partId, index, update2);
8803
- return;
8785
+ if (pageBuilder2.partManager.isChildAllowed(props.part)) {
8786
+ acceptWidgetInside(widget2, droppedPart, pageBuilder2);
8804
8787
  }
8788
+ return;
8805
8789
  }
8806
8790
  } else {
8807
- if (((_g = block.properties) == null ? void 0 : _g.direction) === "vertical") {
8808
- index = mouseOffsetY <= centerY ? widgetIndex : widgetIndex + 1;
8791
+ if (mouseOffsetX <= quaterX) {
8792
+ index = widgetIndex;
8793
+ } else if (mouseOffsetX > quaterX * 3) {
8794
+ index = widgetIndex + 1;
8809
8795
  } else {
8810
- index = mouseOffsetX <= centerX ? widgetIndex : widgetIndex + 1;
8796
+ if (pageBuilder2.partManager.isChildAllowed(props.part)) {
8797
+ acceptWidgetInside(widget2, droppedPart, pageBuilder2);
8798
+ }
8799
+ return;
8811
8800
  }
8812
8801
  }
8813
8802
  if (block.children.indexOf(droppedPart) === index) return;
8814
8803
  const update = [{
8815
8804
  partId: droppedPart.partId,
8816
- properties: {
8805
+ properties: droppedPart.isNestedWidget() ? {
8817
8806
  left: "",
8818
8807
  top: "",
8819
8808
  width: "",
8820
8809
  height: ""
8821
- }
8810
+ } : {}
8822
8811
  }];
8823
8812
  pageBuilder2.model.moveElements(droppedPart.partId, block.partId, index, update);
8824
8813
  };
8814
+ const acceptWidgetInside = (widget2, droppedPart, pageBuilder2) => {
8815
+ var _a, _b;
8816
+ const index = ((_a = widget2.children) == null ? void 0 : _a.length) || 0;
8817
+ if (((_b = widget2.children) == null ? void 0 : _b.indexOf(droppedPart)) !== index) {
8818
+ const update = [{
8819
+ partId: droppedPart.partId,
8820
+ properties: {
8821
+ left: "25%",
8822
+ top: "25%",
8823
+ width: "50%"
8824
+ }
8825
+ }];
8826
+ pageBuilder2.model.moveElements(droppedPart.partId, widget2.partId, index, update);
8827
+ }
8828
+ };
8825
8829
  const calculateDropIndex = (part, target, mouseOffsetX, mouseOffsetY, _event) => {
8826
- var _a;
8827
8830
  if (!part.children || part.children.length === 0) return 0;
8828
8831
  const children = Array.from(target.children).filter((child) => !isPositionMark(child)).map((child) => child);
8829
- const dir = ((_a = props.part.properties) == null ? void 0 : _a.direction) || "vertical";
8832
+ const direction = getLayoutDirection(props.isMobilePage, props.part.properties);
8830
8833
  let index = 0;
8831
8834
  for (const child of children) {
8832
- if (dir === "horizontal") {
8835
+ if (direction === "horizontal") {
8833
8836
  const centerX = child.offsetLeft + child.offsetWidth / 2;
8834
8837
  if (mouseOffsetX <= centerX) return index;
8835
8838
  } else {
@@ -8854,7 +8857,7 @@ ${_html.style}
8854
8857
  draggable: draggable.value,
8855
8858
  style: vue.normalizeStyle(style.value)
8856
8859
  }, [
8857
- thisComponent.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(thisComponent.value), vue.normalizeProps(vue.mergeProps({ key: 0 }, bind.value)), null, 16)) : vue.createCommentVNode("", true),
8860
+ component.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(component.value), vue.normalizeProps(vue.mergeProps({ key: 0 }, bind.value)), null, 16)) : vue.createCommentVNode("", true),
8858
8861
  selected.value && _ctx.part.isNestedWidget() ? (vue.openBlock(), vue.createElementBlock("div", {
8859
8862
  key: 1,
8860
8863
  class: "pan-handle",
@@ -8866,7 +8869,7 @@ ${_html.style}
8866
8869
  onMousedown: resizeChild
8867
8870
  }, null, 32)) : vue.createCommentVNode("", true)
8868
8871
  ], 14, _hoisted_1$D)), [
8869
- [vue.unref(vPartHandler), { pageBuilder: vue.unref(pageBuilder), part: _ctx.part, droppable: droppable.value, locatePositionMark, calculateDropIndex, acceptChildPart }]
8872
+ [vue.unref(vPartHandler), { pageBuilder: vue.unref(pageBuilder), part: _ctx.part, droppable: true, locatePositionMark, calculateDropIndex, acceptChildPart }]
8870
8873
  ])
8871
8874
  ], 64);
8872
8875
  };
@@ -8876,7 +8879,8 @@ ${_html.style}
8876
8879
  const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
8877
8880
  __name: "PbBlock",
8878
8881
  props: {
8879
- part: {}
8882
+ part: {},
8883
+ isMobilePage: { type: Boolean }
8880
8884
  },
8881
8885
  setup(__props) {
8882
8886
  const props = __props;
@@ -8889,7 +8893,7 @@ ${_html.style}
8889
8893
  const styleTag = vue.computed(() => props.part.getStyleTag());
8890
8894
  const properties = vue.computed(() => ({
8891
8895
  style: {
8892
- ...props.part.getStyles(),
8896
+ ...props.part.getStyles(props.isMobilePage),
8893
8897
  ...props.part.getInlineStyles()
8894
8898
  }
8895
8899
  }));
@@ -8908,7 +8912,6 @@ ${_html.style}
8908
8912
  locateNone(mark.style);
8909
8913
  };
8910
8914
  const locateSection = (mark, target, mouseOffsetX, mouseOffsetY, draggingPart2, event) => {
8911
- var _a;
8912
8915
  mark.style.background = "#e67e22";
8913
8916
  const section = props.part.parent;
8914
8917
  const sectionElement = target.parentElement;
@@ -8916,7 +8919,8 @@ ${_html.style}
8916
8919
  const isFirstBlock = index === 0;
8917
8920
  const isLastBlock = index === section.children.length - 1;
8918
8921
  const centerY = target.offsetHeight / 2;
8919
- if (((_a = section.properties) == null ? void 0 : _a.direction) === "vertical") {
8922
+ const sectionDirection = getLayoutDirection(props.isMobilePage, section.properties);
8923
+ if (sectionDirection === "vertical") {
8920
8924
  if (isFirstBlock && mouseOffsetY <= centerY)
8921
8925
  locateTop(mark.style);
8922
8926
  else if (isLastBlock && mouseOffsetY > centerY)
@@ -8931,12 +8935,12 @@ ${_html.style}
8931
8935
  }
8932
8936
  };
8933
8937
  const locateBlock = (mark, target, mouseOffsetX, mouseOffsetY, draggingPart2, event) => {
8934
- var _a;
8935
8938
  mark.style.background = "#8e44ad";
8936
8939
  const block = props.part;
8937
8940
  const blockElement = target;
8938
8941
  const section = block.parent;
8939
- if (((_a = section.properties) == null ? void 0 : _a.direction) === "vertical") {
8942
+ const sectionDirection = getLayoutDirection(props.isMobilePage, section.properties);
8943
+ if (sectionDirection === "vertical") {
8940
8944
  const centerY = blockElement.offsetHeight / 2;
8941
8945
  if (mouseOffsetY <= centerY)
8942
8946
  locateTop(mark.style);
@@ -8973,7 +8977,7 @@ ${_html.style}
8973
8977
  acceptWidget(pageBuilder2, target, droppedPart);
8974
8978
  };
8975
8979
  const acceptSection = (pageBuilder2, target, droppedPart, mouseOffsetX, mouseOffsetY) => {
8976
- var _a, _b;
8980
+ var _a;
8977
8981
  const block = props.part;
8978
8982
  const blockElement = target;
8979
8983
  const section = block.parent;
@@ -8983,8 +8987,9 @@ ${_html.style}
8983
8987
  const isLastBlock = blockIndex === section.children.length - 1;
8984
8988
  let sectionIndex = page.children.indexOf(section) || 0;
8985
8989
  let index;
8990
+ const sectionDirection = getLayoutDirection(props.isMobilePage, section.properties);
8986
8991
  const centerY = blockElement.offsetHeight / 2;
8987
- if (((_a = section.properties) == null ? void 0 : _a.direction) === "vertical") {
8992
+ if (sectionDirection === "vertical") {
8988
8993
  if (isFirstBlock && mouseOffsetY <= centerY) index = sectionIndex;
8989
8994
  else if (isLastBlock && mouseOffsetY > centerY) index = sectionIndex + 1;
8990
8995
  else return;
@@ -8992,16 +8997,16 @@ ${_html.style}
8992
8997
  if (mouseOffsetY <= centerY) index = sectionIndex;
8993
8998
  else index = sectionIndex + 1;
8994
8999
  }
8995
- if (((_b = page.children) == null ? void 0 : _b.indexOf(droppedPart)) === index) return;
9000
+ if (((_a = page.children) == null ? void 0 : _a.indexOf(droppedPart)) === index) return;
8996
9001
  pageBuilder2.model.moveElements(droppedPart.partId, page.partId, index);
8997
9002
  };
8998
9003
  const acceptBlock = (pageBuilder2, target, droppedPart, mouseOffsetX, mouseOffsetY) => {
8999
- var _a;
9000
9004
  const block = props.part;
9001
9005
  const section = props.part.parent;
9002
9006
  const blockIndex = section.children.indexOf(block) || 0;
9003
9007
  let index;
9004
- if (((_a = section.properties) == null ? void 0 : _a.direction) === "vertical") {
9008
+ const sectionDirection = getLayoutDirection(props.isMobilePage, section.properties);
9009
+ if (sectionDirection === "vertical") {
9005
9010
  const centerY = target.offsetHeight / 2;
9006
9011
  index = mouseOffsetY <= centerY ? blockIndex : blockIndex + 1;
9007
9012
  } else {
@@ -9028,13 +9033,12 @@ ${_html.style}
9028
9033
  pageBuilder2.model.moveElements(droppedPart.partId, block.partId, 0, update);
9029
9034
  };
9030
9035
  const calculateDropIndex = (part, target, mouseOffsetX, mouseOffsetY, _event) => {
9031
- var _a;
9032
9036
  if (!part.children || part.children.length === 0) return 0;
9033
9037
  const children = Array.from(target.children).filter((child) => !isPositionMark(child)).map((child) => child);
9034
- const dir = ((_a = props.part.properties) == null ? void 0 : _a.direction) || "vertical";
9038
+ const direction = getLayoutDirection(props.isMobilePage, props.part.properties);
9035
9039
  let index = 0;
9036
9040
  for (const child of children) {
9037
- if (dir === "horizontal") {
9041
+ if (direction === "horizontal") {
9038
9042
  const centerX = child.offsetLeft + child.offsetWidth / 2;
9039
9043
  if (mouseOffsetX <= centerX) return index;
9040
9044
  } else {
@@ -9099,7 +9103,8 @@ ${_html.style}
9099
9103
  const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
9100
9104
  __name: "PbSection",
9101
9105
  props: {
9102
- part: {}
9106
+ part: {},
9107
+ isMobilePage: { type: Boolean }
9103
9108
  },
9104
9109
  setup(__props) {
9105
9110
  const props = __props;
@@ -9115,7 +9120,7 @@ ${_html.style}
9115
9120
  const styleTag = vue.computed(() => props.part.getStyleTag());
9116
9121
  const properties = vue.computed(() => ({
9117
9122
  style: {
9118
- ...props.part.getStyles(),
9123
+ ...props.part.getStyles(props.isMobilePage),
9119
9124
  ...props.part.getInlineStyles()
9120
9125
  }
9121
9126
  }));
@@ -9176,13 +9181,12 @@ ${_html.style}
9176
9181
  pageBuilder2.model.moveElements(droppedPart.partId, section.partId, 0);
9177
9182
  };
9178
9183
  const calculateDropIndex = (part, target, mouseOffsetX, mouseOffsetY, _event) => {
9179
- var _a;
9180
9184
  if (!part.children || part.children.length === 0) return 0;
9181
9185
  const children = Array.from(target.children).filter((child) => !isPositionMark(child)).map((child) => child);
9182
- const dir = ((_a = props.part.properties) == null ? void 0 : _a.direction) || "vertical";
9186
+ const direction = getLayoutDirection(props.isMobilePage, props.part.properties);
9183
9187
  let index = 0;
9184
9188
  for (const child of children) {
9185
- if (dir === "horizontal") {
9189
+ if (direction === "horizontal") {
9186
9190
  const centerX = child.offsetLeft + child.offsetWidth / 2;
9187
9191
  if (mouseOffsetX <= centerX) return index;
9188
9192
  } else {
@@ -9214,8 +9218,9 @@ ${_html.style}
9214
9218
  _ctx.part.children && _ctx.part.children.length > 0 ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.part.children, (block) => {
9215
9219
  return vue.openBlock(), vue.createBlock(_sfc_main$z, {
9216
9220
  key: block.partId,
9221
+ "is-mobile-page": _ctx.isMobilePage,
9217
9222
  part: block
9218
- }, null, 8, ["part"]);
9223
+ }, null, 8, ["is-mobile-page", "part"]);
9219
9224
  }), 128)) : (vue.openBlock(), vue.createBlock(PbAddWidgetButton, {
9220
9225
  key: 1,
9221
9226
  onAddWidget: addWidget
@@ -11945,8 +11950,14 @@ ${_html.style}
11945
11950
  caption: "Layout",
11946
11951
  properties: [
11947
11952
  {
11948
- propertyName: "direction",
11949
- caption: "Direction",
11953
+ propertyName: "directionSm",
11954
+ caption: "Direction for Mobile (<= 768px)",
11955
+ propertyType: "select",
11956
+ params: "vertical,horizontal"
11957
+ },
11958
+ {
11959
+ propertyName: "directionLg",
11960
+ caption: "Direction for PC (> 768px)",
11950
11961
  propertyType: "select",
11951
11962
  params: "vertical,horizontal"
11952
11963
  },
@@ -12069,6 +12080,7 @@ ${_html.style}
12069
12080
  _ctx.part.children ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.part.children, (child) => {
12070
12081
  return vue.openBlock(), vue.createBlock(_sfc_main$A, {
12071
12082
  key: child.partId,
12083
+ "is-mobile-page": false,
12072
12084
  part: child
12073
12085
  }, null, 8, ["part"]);
12074
12086
  }), 128)) : vue.createCommentVNode("", true),
@@ -12111,7 +12123,8 @@ ${_html.style}
12111
12123
  ...defaultPropertyGroups()
12112
12124
  ],
12113
12125
  initialProperties: {
12114
- direction: "horizontal",
12126
+ directionSm: "horizontal",
12127
+ directionLg: "horizontal",
12115
12128
  align: "center"
12116
12129
  },
12117
12130
  allowsChild: () => true,
@@ -12129,6 +12142,8 @@ ${_html.style}
12129
12142
  ...defaultPropertyGroups()
12130
12143
  ],
12131
12144
  initialProperties: {
12145
+ directionSm: "vertical",
12146
+ directionLg: "vertical",
12132
12147
  align: "center"
12133
12148
  },
12134
12149
  allowsChild: () => true,
@@ -12311,7 +12326,7 @@ ${_html.style}
12311
12326
  ...defaultWidgetPropertyGroups()
12312
12327
  ],
12313
12328
  initialProperties: {
12314
- height: "200px"
12329
+ height: "300px"
12315
12330
  },
12316
12331
  allowsChild: () => true,
12317
12332
  creator: () => _sfc_main$p
@@ -12504,9 +12519,13 @@ ${_html.style}
12504
12519
  this.modal = modal;
12505
12520
  }
12506
12521
  execute(pageBuilder, args) {
12507
- const def = pageBuilder.partManager.getSectionDefinition();
12508
- if (!def) return;
12509
- addPart(pageBuilder, def);
12522
+ if (args && args.page) {
12523
+ addSectionToPage(pageBuilder, args.page);
12524
+ } else {
12525
+ const def = pageBuilder.partManager.getSectionDefinition();
12526
+ if (!def) return;
12527
+ addPart(pageBuilder, def);
12528
+ }
12510
12529
  }
12511
12530
  };
12512
12531
  __publicField(_AddSectionCommand, "COMMAND_ID", "AddSection");
@@ -12628,6 +12647,15 @@ ${_html.style}
12628
12647
  const index = section.parent.children.indexOf(section) + 1;
12629
12648
  insertParts(pageBuilder, section.parent.partId, index, [newSection], true);
12630
12649
  };
12650
+ const addSectionToPage = (pageBuilder, page) => {
12651
+ var _a;
12652
+ const newSection = createSection(pageBuilder);
12653
+ if (!newSection) return;
12654
+ const child = createBlock(pageBuilder);
12655
+ newSection.children = [child];
12656
+ const index = ((_a = page.children) == null ? void 0 : _a.length) || 0;
12657
+ insertParts(pageBuilder, page.partId, index, [newSection], true);
12658
+ };
12631
12659
  const addBlockBefore = (pageBuilder) => {
12632
12660
  const selected = pageBuilder.context.getSelectedParts()[0];
12633
12661
  if (!selected) return;
@@ -14236,6 +14264,11 @@ ${_html.style}
14236
14264
  setup(__props) {
14237
14265
  const props = __props;
14238
14266
  const editor = usePageBuilderEditor();
14267
+ const classNames = vue.computed(() => {
14268
+ return [
14269
+ props.part.getClassNames()
14270
+ ];
14271
+ });
14239
14272
  const styleTag = vue.computed(() => props.part.getStyleTag());
14240
14273
  const style = vue.computed(() => {
14241
14274
  var _a, _b;
@@ -14248,14 +14281,14 @@ ${_html.style}
14248
14281
  var _a, _b;
14249
14282
  return {
14250
14283
  style: {
14251
- ...(_a = props.part) == null ? void 0 : _a.getStyles(),
14284
+ ...(_a = props.part) == null ? void 0 : _a.getStyles(props.isMobilePage),
14252
14285
  ...(_b = props.part) == null ? void 0 : _b.getInlineStyles()
14253
14286
  }
14254
14287
  };
14255
14288
  });
14256
14289
  const selected = vue.computed(() => !!props.part && editor.context.isSelected(props.part));
14257
- const insertSection = (index) => {
14258
- editor.commandRegistry.executeCommand(AddSectionCommand.COMMAND_ID);
14290
+ const addSection = () => {
14291
+ editor.commandRegistry.executeCommand(AddSectionCommand.COMMAND_ID, { page: props.part });
14259
14292
  };
14260
14293
  const pageBuilder = usePageBuilderEditor();
14261
14294
  const contextMenu = bluesea.useContextMenu();
@@ -14285,9 +14318,9 @@ ${_html.style}
14285
14318
  innerHTML: styleTag.value
14286
14319
  }, null, 8, ["innerHTML"])) : vue.createCommentVNode("", true),
14287
14320
  vue.createElementVNode("div", {
14321
+ class: vue.normalizeClass([classNames.value, "pb-page"]),
14288
14322
  "data-part-id": (_a = _ctx.part) == null ? void 0 : _a.partId,
14289
14323
  style: vue.normalizeStyle(style.value),
14290
- class: "pb-page",
14291
14324
  onContextmenu: showContextMenu,
14292
14325
  onMousedown: vue.withModifiers(handleClick, ["stop"])
14293
14326
  }, [
@@ -14297,33 +14330,30 @@ ${_html.style}
14297
14330
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList((_b = _ctx.part) == null ? void 0 : _b.children, (section, index) => {
14298
14331
  return vue.openBlock(), vue.createBlock(_sfc_main$x, {
14299
14332
  key: section.partId,
14333
+ "is-mobile-page": _ctx.isMobilePage,
14300
14334
  part: section
14301
- }, null, 8, ["part"]);
14335
+ }, null, 8, ["is-mobile-page", "part"]);
14302
14336
  }), 128))
14303
14337
  ], 16),
14304
14338
  vue.createElementVNode("div", {
14305
14339
  class: "pb-add-section-handle bottom",
14306
- onClick: _cache[0] || (_cache[0] = ($event) => {
14307
- var _a2, _b2;
14308
- return insertSection(((_b2 = (_a2 = _ctx.part) == null ? void 0 : _a2.children) == null ? void 0 : _b2.length) || 0);
14309
- })
14310
- }, _cache[1] || (_cache[1] = [
14340
+ onClick: addSection
14341
+ }, _cache[0] || (_cache[0] = [
14311
14342
  vue.createElementVNode("i", { class: "material-icons-outlined" }, "add_circle_outline", -1)
14312
14343
  ]))
14313
- ], 44, _hoisted_1$f),
14314
- _cache[2] || (_cache[2] = vue.createElementVNode("div", { style: { "height": "100px" } }, null, -1))
14344
+ ], 46, _hoisted_1$f),
14345
+ _cache[1] || (_cache[1] = vue.createElementVNode("div", { style: { "height": "100px" } }, null, -1))
14315
14346
  ], 64);
14316
14347
  };
14317
14348
  }
14318
14349
  });
14319
- const canvasStyle = '.pb-page-wrapper {\n margin: 0 auto;\n padding: 0;\n}\n\n.pb-page {\n width: 100%;\n margin: 0;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n}\n\n.pb-page .pb-page-content.selected::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4998f8;\n z-index: 999;\n pointer-events: none;\n}\n\n.pb-page * {\n box-sizing: border-box;\n}\n\n.pb-add-widget-button {\n width: 100%;\n height: 100%;\n min-height: 200px;\n position: relative;\n}\n\n.pb-add-widget-button button {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n padding: 8px;\n background: none;\n border: none;\n cursor: pointer;\n}\n\n.pb-add-widget-button button:hover {\n background-color: #eeeeee;\n}\n\n.pb-add-widget-button .icon {\n font-size: 1rem;\n vertical-align: middle;\n}\n\n.pb-add-widget-button .text {\n font-size: 1rem;\n vertical-align: middle;\n margin-left: 0.4rem;\n}\n\n.pb-section {\n position: relative;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n outline: 1px dashed #ccc;\n background-color: #fff;\n}\n\n.pb-section:hover:not(:has(.pb-block:hover)) {\n background-color: #f0f0f0;\n}\n\n.pb-section.selected::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4998f8;\n z-index: 999;\n pointer-events: none;\n}\n\n.pb-section.pb-section-static {\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\n.pb-section.pb-section-static:after {\n content: "";\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.2);\n}\n\n.pb-section-static .pb-widget {\n outline: none;\n}\n\n.pb-block {\n display: flex;\n min-width: 1px;\n position: relative;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n width: 100%;\n outline: 1px dashed #ccc;\n}\n\n.pb-block:hover:not(:has(.pb-widget:hover)) {\n background-color: #f0f0f0;\n}\n\n.pb-block.selected::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4998f8;\n z-index: 999;\n pointer-events: none;\n}\n\n.pb-widget {\n position: relative;\n outline: 1px dashed #ccc;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n}\n\n.pb-widget.selected::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4998f8;\n z-index: 999;\n pointer-events: none;\n}\n\n.pb-widget .children {\n position: absolute;\n width: 100%;\n height: 100%;\n}\n\n.pb-widget .pan-handle {\n position: absolute;\n left: -6px;\n top: -6px;\n width: 12px;\n height: 12px;\n background-color: #27ae60;\n cursor: move;\n}\n\n.pb-widget .resize-handle {\n position: absolute;\n right: -6px;\n bottom: -6px;\n width: 12px;\n height: 12px;\n background-color: #27ae60;\n cursor: nwse-resize;\n}\n\n.pb-widget {\n position: relative;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n width: 100%;\n}\n\n.pb-widget .children {\n position: absolute;\n width: 100%;\n height: 100%;\n}\n\n.pb-text-widget {\n width: 100%;\n height: fit-content;\n}\n\n.pb-text-widget .text {\n color: #333;\n}\n\n.pb-text-widget .placeholder {\n padding: 4px 0;\n font-size: 18px;\n text-align: center;\n color: #999;\n}\n\n.pb-image-widget {\n width: 100%;\n}\n\n.pb-image-widget .image {\n width: 100%;\n}\n\n.pb-image-widget .placeholder {\n height: 100px;\n background-color: #eee;\n text-align: center;\n}\n\n.pb-image-widget .placeholder span {\n font-size: 40px;\n color: #999;\n line-height: 100px;\n vertical-align: middle;\n}\n\n.pb-html-widget {\n width: 100%;\n height: fit-content;\n}\n\n.pb-html-widget .placeholder {\n padding: 4px 0;\n font-size: 18px;\n text-align: center;\n color: #999;\n}\n\n.pb-iframe-widget {\n width: 100%;\n height: fit-content;\n}\n\n.pb-iframe-widget .placeholder {\n padding: 4px 0;\n font-size: 18px;\n text-align: center;\n color: #999;\n}\n\n.pb-youtube-widget {\n width: 100%;\n}\n\n.pb-youtube-widget .youtube {\n width: 100%;\n height: 100%;\n}\n\n.pb-youtube-widget .placeholder {\n height: 100px;\n background-color: #eee;\n text-align: center;\n}\n\n.pb-youtube-widget .placeholder span {\n font-size: 40px;\n color: #999;\n line-height: 100px;\n vertical-align: middle;\n}\n\n.pb-container-widget {\n width: 100%;\n}\n\n.pb-container-widget .placeholder {\n height: 100px;\n background-color: #eee;\n text-align: center;\n}\n\n.pb-container-widget .placeholder span {\n font-size: 40px;\n color: #999;\n line-height: 100px;\n vertical-align: middle;\n}\n\n.pb-product-list-widget {\n width: 100%;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: flex-start;\n align-items: center;\n}\n\n.pb-product-list-widget .product-wrapper {\n width: 25%;\n}\n\n.pb-product-list-widget .product-wrapper .product {\n width: 95%;\n margin: 0 auto;\n padding-top: 8px;\n padding-bottom: 8px;\n}\n\n.pb-product-list-widget .product-wrapper img {\n width: 100%;\n}\n\n.pb-product-list-widget .product-wrapper .name {\n margin-top: 8px;\n font-size: 14px;\n}\n\n.pb-product-list-widget .product-wrapper .price {\n margin-top: 8px;\n font-size: 14px;\n font-weight: bold;\n}\n\n.pb-product-list-widget .product-wrapper .empty {\n height: 200px;\n background-color: #eee;\n text-align: center;\n}\n\n.pb-product-list-widget .product-wrapper .empty span {\n font-size: 40px;\n color: #999;\n line-height: 200px;\n vertical-align: middle;\n}\n\n@media (max-width: 768px) {\n .pb-product-list-widget .product-wrapper {\n width: 50%;\n }\n}\n\n.mobile .pb-product-list-widget .product-wrapper {\n width: 50%;\n}\n\n.pb-login-widget {\n height: 200px;\n text-align: center;\n}\n\n.pb-login-widget h3 {\n padding: 0;\n margin: 0;\n font-size: 32px;\n font-weight: bold;\n color: #ccc;\n line-height: 200px;\n vertical-align: middle;\n}\n\n.font-icon {\n font-family: Material Symbols Outlined, monospace;\n font-size: 1rem;\n max-width: 1em;\n}\n\nhtml, body {\n font-family: Noto Sans, Noto Sans KR, Noto Sans JP, Arial, sans-serif;\n font-size: 12px;\n}\n\nbody {\n margin: 0;\n padding: 0;\n background-color: #aaa;\n overflow: hidden;\n}\n\n.pb-position-mark {\n background-color: #ff3333;\n opacity: 0.5;\n border-radius: 2px;\n}\n\n.pb-add-section-handle {\n position: relative;\n text-align: center;\n cursor: pointer;\n z-index: 5;\n height: 0;\n}\n\n.pb-add-section-handle.top::before, .pb-add-section-handle.bottom::before, .pb-add-section-handle.middle::before {\n content: "";\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n opacity: 0;\n pointer-events: none;\n}\n\n.pb-add-section-handle.bottom {\n left: 50%;\n bottom: -32px;\n}\n\n.pb-add-section-handle:hover.top::before, .pb-add-section-handle:hover.bottom::before, .pb-add-section-handle:hover.middle::before,\n.pb-add-section-handle:hover > i {\n opacity: 1;\n}\n\n.pb-add-section-handle > i {\n vertical-align: middle;\n position: absolute;\n top: 50%;\n left: 0;\n font-size: 2rem;\n transform: translate(-50%, -50%);\n opacity: 0.2;\n}';
14350
+ const canvasStyle = '.pb-page-wrapper {\n margin: 0 auto;\n padding: 0;\n}\n\n.pb-page {\n width: 100%;\n margin: 0 auto;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n}\n\n.pb-page .pb-page-content.selected::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4998f8;\n z-index: 999;\n pointer-events: none;\n}\n\n.pb-page * {\n box-sizing: border-box;\n}\n\n.pb-add-widget-button {\n width: 100%;\n height: 100%;\n min-height: 200px;\n position: relative;\n}\n\n.pb-add-widget-button button {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n padding: 8px;\n background: none;\n border: none;\n cursor: pointer;\n}\n\n.pb-add-widget-button button:hover {\n background-color: #eeeeee;\n}\n\n.pb-add-widget-button .icon {\n font-size: 1rem;\n vertical-align: middle;\n}\n\n.pb-add-widget-button .text {\n font-size: 1rem;\n vertical-align: middle;\n margin-left: 0.4rem;\n}\n\n.pb-section {\n position: relative;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n outline: 1px dashed #ccc;\n background-color: #fff;\n}\n\n.pb-section:hover:not(:has(.pb-block:hover)) {\n background-color: #f0f0f0;\n}\n\n.pb-section.selected::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4998f8;\n z-index: 999;\n pointer-events: none;\n}\n\n.pb-section.pb-section-static {\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\n.pb-section.pb-section-static:after {\n content: "";\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.2);\n}\n\n.pb-section-static .pb-widget {\n outline: none;\n}\n\n.pb-block {\n display: flex;\n min-width: 1px;\n position: relative;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n width: 100%;\n outline: 1px dashed #ccc;\n}\n\n.pb-block:hover:not(:has(.pb-widget:hover)) {\n background-color: #f0f0f0;\n}\n\n.pb-block.selected::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4998f8;\n z-index: 999;\n pointer-events: none;\n}\n\n.pb-widget {\n position: relative;\n outline: 1px dashed #ccc;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n}\n\n.pb-widget.selected::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4998f8;\n z-index: 999;\n pointer-events: none;\n}\n\n.pb-widget .children {\n position: absolute;\n width: 100%;\n height: 100%;\n}\n\n.pb-widget .pan-handle {\n position: absolute;\n left: -6px;\n top: -6px;\n width: 12px;\n height: 12px;\n background-color: #27ae60;\n cursor: move;\n}\n\n.pb-widget .resize-handle {\n position: absolute;\n right: -6px;\n bottom: -6px;\n width: 12px;\n height: 12px;\n background-color: #27ae60;\n cursor: nwse-resize;\n}\n\n.pb-widget {\n position: relative;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n width: 100%;\n}\n\n.pb-widget .children {\n position: absolute;\n width: 100%;\n height: 100%;\n}\n\n.pb-text-widget {\n width: 100%;\n height: fit-content;\n}\n\n.pb-text-widget .text {\n color: #333;\n}\n\n.pb-text-widget .placeholder {\n padding: 4px 0;\n font-size: 18px;\n text-align: center;\n color: #999;\n}\n\n.pb-image-widget {\n width: 100%;\n}\n\n.pb-image-widget .image {\n width: 100%;\n}\n\n.pb-image-widget .placeholder {\n height: 100px;\n background-color: #eee;\n text-align: center;\n}\n\n.pb-image-widget .placeholder span {\n font-size: 40px;\n color: #999;\n line-height: 100px;\n vertical-align: middle;\n}\n\n.pb-html-widget {\n width: 100%;\n height: fit-content;\n}\n\n.pb-html-widget .placeholder {\n padding: 4px 0;\n font-size: 18px;\n text-align: center;\n color: #999;\n}\n\n.pb-iframe-widget {\n width: 100%;\n height: fit-content;\n}\n\n.pb-iframe-widget .placeholder {\n padding: 4px 0;\n font-size: 18px;\n text-align: center;\n color: #999;\n}\n\n.pb-youtube-widget {\n width: 100%;\n}\n\n.pb-youtube-widget .youtube {\n width: 100%;\n height: 100%;\n}\n\n.pb-youtube-widget .placeholder {\n height: 100px;\n background-color: #eee;\n text-align: center;\n}\n\n.pb-youtube-widget .placeholder span {\n font-size: 40px;\n color: #999;\n line-height: 100px;\n vertical-align: middle;\n}\n\n.pb-container-widget {\n width: 100%;\n}\n\n.pb-container-widget .placeholder {\n height: 100px;\n background-color: #eee;\n text-align: center;\n}\n\n.pb-container-widget .placeholder span {\n font-size: 40px;\n color: #999;\n line-height: 100px;\n vertical-align: middle;\n}\n\n.pb-product-list-widget {\n width: 100%;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: flex-start;\n align-items: center;\n}\n\n.pb-product-list-widget .product-wrapper {\n width: 25%;\n}\n\n.pb-product-list-widget .product-wrapper .product {\n width: 95%;\n margin: 0 auto;\n padding-top: 8px;\n padding-bottom: 8px;\n}\n\n.pb-product-list-widget .product-wrapper img {\n width: 100%;\n}\n\n.pb-product-list-widget .product-wrapper .name {\n margin-top: 8px;\n font-size: 14px;\n}\n\n.pb-product-list-widget .product-wrapper .price {\n margin-top: 8px;\n font-size: 14px;\n font-weight: bold;\n}\n\n.pb-product-list-widget .product-wrapper .empty {\n height: 200px;\n background-color: #eee;\n text-align: center;\n}\n\n.pb-product-list-widget .product-wrapper .empty span {\n font-size: 40px;\n color: #999;\n line-height: 200px;\n vertical-align: middle;\n}\n\n@media (max-width: 768px) {\n .pb-product-list-widget .product-wrapper {\n width: 50%;\n }\n}\n\n.mobile .pb-product-list-widget .product-wrapper {\n width: 50%;\n}\n\n.pb-login-widget {\n height: 200px;\n text-align: center;\n}\n\n.pb-login-widget h3 {\n padding: 0;\n margin: 0;\n font-size: 32px;\n font-weight: bold;\n color: #ccc;\n line-height: 200px;\n vertical-align: middle;\n}\n\n.font-icon {\n font-family: Material Symbols Outlined, monospace;\n font-size: 1rem;\n max-width: 1em;\n}\n\nhtml, body {\n font-family: Noto Sans, Noto Sans KR, Noto Sans JP, Arial, sans-serif;\n font-size: 12px;\n}\n\nbody {\n margin: 0;\n padding: 0;\n background-color: #aaa;\n overflow: hidden;\n}\n\n.pb-position-mark {\n background-color: #ff3333;\n opacity: 0.5;\n border-radius: 2px;\n}\n\n.pb-add-section-handle {\n position: relative;\n text-align: center;\n cursor: pointer;\n z-index: 5;\n height: 0;\n}\n\n.pb-add-section-handle.top::before, .pb-add-section-handle.bottom::before, .pb-add-section-handle.middle::before {\n content: "";\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n opacity: 0;\n pointer-events: none;\n}\n\n.pb-add-section-handle.bottom {\n left: 50%;\n bottom: -32px;\n}\n\n.pb-add-section-handle:hover.top::before, .pb-add-section-handle:hover.bottom::before, .pb-add-section-handle:hover.middle::before,\n.pb-add-section-handle:hover > i {\n opacity: 1;\n}\n\n.pb-add-section-handle > i {\n vertical-align: middle;\n position: absolute;\n top: 50%;\n left: 0;\n font-size: 2rem;\n transform: translate(-50%, -50%);\n opacity: 0.2;\n}';
14320
14351
  const _hoisted_1$e = ["height", "width"];
14321
14352
  const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
14322
14353
  __name: "PbPageFrame",
14323
14354
  props: {
14324
14355
  part: {},
14325
- width: {},
14326
- isMobilePage: { type: Boolean }
14356
+ width: {}
14327
14357
  },
14328
14358
  setup(__props) {
14329
14359
  const props = __props;
@@ -14380,17 +14410,20 @@ ${_html.style}
14380
14410
  );
14381
14411
  const width = vue.ref(props.width);
14382
14412
  const height = vue.ref(200);
14413
+ const isMobilePage = vue.computed(() => width.value <= 768);
14383
14414
  const style = vue.computed(() => ({
14384
14415
  // width: `${width.value}px`,
14385
14416
  // height: `${height.value}px`,
14386
14417
  }));
14387
14418
  let iframeObserver;
14388
14419
  const updateIframeHeight = () => {
14389
- if (!iframeRef.value || !iframeRef.value.contentDocument) return;
14390
- const iframeBody = iframeRef.value.contentDocument.body;
14391
- if (iframeBody) {
14392
- height.value = iframeBody.scrollHeight;
14393
- }
14420
+ setTimeout(() => {
14421
+ if (!iframeRef.value || !iframeRef.value.contentDocument) return;
14422
+ const iframeBody = iframeRef.value.contentDocument.body;
14423
+ if (iframeBody) {
14424
+ height.value = iframeBody.scrollHeight;
14425
+ }
14426
+ }, 100);
14394
14427
  };
14395
14428
  vue.onMounted(() => {
14396
14429
  if (!iframeRef.value || !iframeRef.value.contentDocument) return;
@@ -14431,7 +14464,7 @@ ${_html.style}
14431
14464
  to: (_d = (_c = iframeRef.value) == null ? void 0 : _c.contentWindow) == null ? void 0 : _d.document.body
14432
14465
  }, [
14433
14466
  vue.createVNode(_sfc_main$f, {
14434
- "is-mobile-page": _ctx.isMobilePage,
14467
+ "is-mobile-page": isMobilePage.value,
14435
14468
  part: _ctx.part,
14436
14469
  width: width.value
14437
14470
  }, null, 8, ["is-mobile-page", "part", "width"])
@@ -14471,14 +14504,12 @@ ${_html.style}
14471
14504
  vue.createElementVNode("div", vue.mergeProps({ class: "pb-canvas" }, style.value), [
14472
14505
  partS.value ? (vue.openBlock(), vue.createBlock(_sfc_main$e, {
14473
14506
  key: 0,
14474
- "is-mobile-page": true,
14475
14507
  part: partS.value,
14476
14508
  width: 480
14477
14509
  }, null, 8, ["part"])) : vue.createCommentVNode("", true),
14478
14510
  partL.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$d)) : vue.createCommentVNode("", true),
14479
14511
  partL.value ? (vue.openBlock(), vue.createBlock(_sfc_main$e, {
14480
14512
  key: 2,
14481
- "is-mobile-page": false,
14482
14513
  part: partL.value,
14483
14514
  width: 1024
14484
14515
  }, null, 8, ["part"])) : vue.createCommentVNode("", true)