@g1cloud/page-builder-editor 1.0.0-alpha.5 → 1.0.0-alpha.6

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.
@@ -3,7 +3,6 @@ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimePr
3
3
  title?: string | undefined;
4
4
  editMode?: string | undefined;
5
5
  pageContent?: any;
6
- locales?: string[] | undefined;
7
6
  language?: string | undefined;
8
7
  }>, {
9
8
  getLocalDesignPartContent: () => any[] | undefined;
@@ -12,7 +11,6 @@ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimePr
12
11
  title?: string | undefined;
13
12
  editMode?: string | undefined;
14
13
  pageContent?: any;
15
- locales?: string[] | undefined;
16
14
  language?: string | undefined;
17
15
  }>>>, {}, {}>;
18
16
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString } from "vue";
2
2
  import { useModal } from "@g1cloud/bluesea";
3
- import { u as usePageBuilderEditor, P as PageBuilderEditorEvent } from "./index-Mob7K7vK.js";
3
+ import { u as usePageBuilderEditor, P as PageBuilderEditorEvent } from "./index-DQLcq5fP.js";
4
4
  const _hoisted_1 = { class: "property-editor property-editor-image flex-align-center" };
5
5
  const _hoisted_2 = { class: "label" };
6
6
  const _hoisted_3 = ["textContent"];
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, unref } from "vue";
2
2
  import { BSTextArea } from "@g1cloud/bluesea";
3
- import { u as usePageBuilderEditor } from "./index-Mob7K7vK.js";
3
+ import { u as usePageBuilderEditor } from "./index-DQLcq5fP.js";
4
4
  const _hoisted_1 = { class: "property-editor property-editor-multiline-text" };
5
5
  const _hoisted_2 = { class: "label" };
6
6
  const _hoisted_3 = ["textContent"];
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString } from "vue";
2
2
  import { useModal } from "@g1cloud/bluesea";
3
- import { u as usePageBuilderEditor, P as PageBuilderEditorEvent } from "./index-Mob7K7vK.js";
3
+ import { u as usePageBuilderEditor, P as PageBuilderEditorEvent } from "./index-DQLcq5fP.js";
4
4
  const _hoisted_1 = { class: "property-editor property-editor-product flex-align-center" };
5
5
  const _hoisted_2 = { class: "label" };
6
6
  const _hoisted_3 = ["textContent"];
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  import { ref, defineComponent, openBlock, createElementBlock, createCommentVNode, computed, normalizeClass, createElementVNode, mergeProps, toDisplayString, onMounted, watch, Fragment, renderList, provide, inject, createBlock as createBlock$1, resolveDynamicComponent, reactive, defineAsyncComponent, withDirectives, unref, createVNode, normalizeStyle, resolveComponent, vModelText, onBeforeUnmount, resolveDirective, withModifiers, renderSlot, normalizeProps, guardReactiveProps, markRaw, Teleport, withCtx } from "vue";
8
- import { notNull, BSTextInput, vClickOutside, useModal, useContextMenu, BSSelect, BSLocaleSelect, BSTabSheet, BSTree, BSDateRange } from "@g1cloud/bluesea";
8
+ import { notNull, BSTextInput, vClickOutside, useModal, useContextMenu, BSSelect, BSTabSheet, BSTree, BSDateRange } from "@g1cloud/bluesea";
9
9
  const create$5 = () => /* @__PURE__ */ new Map();
10
10
  const copy = (m) => {
11
11
  const r = create$5();
@@ -6773,12 +6773,6 @@ class Part {
6773
6773
  if (this.parent)
6774
6774
  return this.parent.getPageBuilderId();
6775
6775
  }
6776
- getLanguage() {
6777
- if (this.isRoot())
6778
- return this.language;
6779
- if (this.parent)
6780
- return this.parent.getLanguage();
6781
- }
6782
6776
  isGlobalDesignPart() {
6783
6777
  return false;
6784
6778
  }
@@ -7023,18 +7017,43 @@ const _sfc_main$3$1 = /* @__PURE__ */ defineComponent({
7023
7017
  },
7024
7018
  setup(__props) {
7025
7019
  const props = __props;
7020
+ const pageBuilder = usePageBuilder();
7021
+ const emptyClass = computed(() => {
7022
+ var _a;
7023
+ if (props.viewMode) {
7024
+ return false;
7025
+ } else if ((_a = props.part.properties) == null ? void 0 : _a.text) {
7026
+ if (typeof props.part.properties.text === "string") {
7027
+ return true;
7028
+ } else {
7029
+ return !props.part.properties.text[pageBuilder.language.value];
7030
+ }
7031
+ } else {
7032
+ return true;
7033
+ }
7034
+ });
7026
7035
  const text = computed(() => {
7027
7036
  var _a;
7028
7037
  if ((_a = props.part.properties) == null ? void 0 : _a.text) {
7029
7038
  if (typeof props.part.properties.text === "string") {
7030
- return props.part.properties.text;
7039
+ if (props.viewMode) {
7040
+ return "";
7041
+ } else {
7042
+ return "Empty text";
7043
+ }
7031
7044
  } else {
7032
- return props.part.properties.text[props.part.getLanguage() || "en"];
7045
+ const t = props.part.properties.text[pageBuilder.language.value];
7046
+ if (props.viewMode) {
7047
+ return t || "";
7048
+ } else {
7049
+ return t || "Empty text";
7050
+ }
7033
7051
  }
7034
- } else if (!props.viewMode) {
7052
+ } else if (props.viewMode) {
7053
+ return "";
7054
+ } else {
7035
7055
  return "Empty text";
7036
7056
  }
7037
- return "";
7038
7057
  });
7039
7058
  const style = computed(() => {
7040
7059
  var _a;
@@ -7046,7 +7065,7 @@ const _sfc_main$3$1 = /* @__PURE__ */ defineComponent({
7046
7065
  });
7047
7066
  return (_ctx, _cache) => {
7048
7067
  return openBlock(), createElementBlock("div", {
7049
- class: normalizeClass([[!_ctx.viewMode && !text.value ? "empty" : ""], "pb-text-widget"])
7068
+ class: normalizeClass([[emptyClass.value ? "empty" : ""], "pb-text-widget"])
7050
7069
  }, [
7051
7070
  createElementVNode("div", mergeProps({ class: "text" }, style.value, {
7052
7071
  textContent: toDisplayString(text.value)
@@ -7091,7 +7110,7 @@ const PageBuilderViewerEvent = {
7091
7110
  };
7092
7111
  const _hoisted_1$1$1 = { class: "pb-product-list-widget" };
7093
7112
  const _hoisted_2$l = { class: "product" };
7094
- const _hoisted_3$g = { class: "image" };
7113
+ const _hoisted_3$f = { class: "image" };
7095
7114
  const _hoisted_4$d = ["src"];
7096
7115
  const _hoisted_5$8 = { class: "name" };
7097
7116
  const _hoisted_6$7 = { class: "price" };
@@ -7139,7 +7158,7 @@ const _sfc_main$2$1 = /* @__PURE__ */ defineComponent({
7139
7158
  }, [
7140
7159
  createElementVNode("div", _hoisted_2$l, [
7141
7160
  products.value[index - 1] ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7142
- createElementVNode("div", _hoisted_3$g, [
7161
+ createElementVNode("div", _hoisted_3$f, [
7143
7162
  createElementVNode("img", {
7144
7163
  src: products.value[index - 1].image,
7145
7164
  alt: ""
@@ -7197,19 +7216,18 @@ const partDefinitions$1 = {
7197
7216
  creator: () => _sfc_main$2$1
7198
7217
  }
7199
7218
  };
7219
+ const PAGE_BUILDER_KEY = "PageBuilder";
7200
7220
  const PAGE_BUILDER_VIEWER_KEY = "PageBuilderViewer";
7201
7221
  class PageBuilderViewerImpl {
7202
7222
  constructor() {
7203
7223
  __publicField2(this, "instanceId");
7204
7224
  __publicField2(this, "model");
7205
- __publicField2(this, "language");
7225
+ __publicField2(this, "language", ref("en"));
7206
7226
  this.model = new Model$1();
7207
- this.language = "en";
7208
7227
  }
7209
7228
  render(pageContent) {
7210
7229
  const rootPart = new RootPart();
7211
7230
  rootPart.pageBuilderId = this.instanceId;
7212
- rootPart.language = this.language;
7213
7231
  rootPart.children = this.parsePageContent(pageContent);
7214
7232
  if (rootPart.children) {
7215
7233
  for (let page of rootPart.children) {
@@ -7253,13 +7271,22 @@ const createPageBuilderViewer = () => {
7253
7271
  const viewer = new PageBuilderViewerImpl();
7254
7272
  return viewer;
7255
7273
  };
7274
+ const providePageBuilder = (pageBuilder) => {
7275
+ provide(PAGE_BUILDER_KEY, pageBuilder);
7276
+ };
7256
7277
  const providePageBuilderViewer = (pageBuilderViewer) => {
7257
7278
  provide(PAGE_BUILDER_VIEWER_KEY, pageBuilderViewer);
7258
7279
  };
7280
+ const usePageBuilder = () => {
7281
+ const pageBuilder = inject(PAGE_BUILDER_KEY);
7282
+ if (!pageBuilder)
7283
+ throw Error("PageBuilder not found");
7284
+ return pageBuilder;
7285
+ };
7259
7286
  const usePageBuilderViewer = () => {
7260
7287
  const pageBuilderViewer = inject(PAGE_BUILDER_VIEWER_KEY);
7261
7288
  if (!pageBuilderViewer)
7262
- throw Error("PageBuilder not found");
7289
+ throw Error("PageBuilderViewer not found");
7263
7290
  return pageBuilderViewer;
7264
7291
  };
7265
7292
  const createPartComponents = (parts) => {
@@ -7319,8 +7346,9 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
7319
7346
  const props = __props;
7320
7347
  const pageBuilderViewer = createPageBuilderViewer();
7321
7348
  pageBuilderViewer.instanceId = props.instanceId;
7322
- pageBuilderViewer.language = props.language || "en";
7349
+ pageBuilderViewer.language.value = props.language || "en";
7323
7350
  providePageBuilderViewer(pageBuilderViewer);
7351
+ providePageBuilder(pageBuilderViewer);
7324
7352
  const page = computed(() => pageBuilderViewer.model.rootPart.value.children && pageBuilderViewer.model.rootPart.value.children[props.isMobilePage ? 0 : 1]);
7325
7353
  onMounted(() => {
7326
7354
  if (props.pageContent) {
@@ -7941,10 +7969,10 @@ const defaultPartPropertyEditors = () => {
7941
7969
  return {
7942
7970
  "readonly-text": () => defineAsyncComponent(() => import("./PbPropertyEditorReadonlyText-Bk0WJxA0.js")),
7943
7971
  "text": () => defineAsyncComponent(() => import("./PbPropertyEditorText-DNdXl-Tr.js")),
7944
- "multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-CfRbKELF.js")),
7972
+ "multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-BFzT7dlG.js")),
7945
7973
  "select": () => defineAsyncComponent(() => import("./PbPropertyEditorSelect-BJovN1su.js")),
7946
- "image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-EuqsavTF.js")),
7947
- "product": () => defineAsyncComponent(() => import("./PbPropertyEditorProduct-COnCyYJl.js"))
7974
+ "image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-D85hteOg.js")),
7975
+ "product": () => defineAsyncComponent(() => import("./PbPropertyEditorProduct-CUSpnV8o.js"))
7948
7976
  };
7949
7977
  };
7950
7978
  const getPropertyValueOfParts = (parts, propertyName) => {
@@ -8177,10 +8205,10 @@ const _export_sfc = (sfc, props) => {
8177
8205
  const _sfc_main$p = {};
8178
8206
  const _hoisted_1$t = { class: "pb-add-widget-button" };
8179
8207
  const _hoisted_2$k = /* @__PURE__ */ createElementVNode("span", { class: "icon material-icons-outlined" }, "add_box", -1);
8180
- const _hoisted_3$f = /* @__PURE__ */ createElementVNode("span", { class: "text" }, "Add Widget", -1);
8208
+ const _hoisted_3$e = /* @__PURE__ */ createElementVNode("span", { class: "text" }, "Add Widget", -1);
8181
8209
  const _hoisted_4$c = [
8182
8210
  _hoisted_2$k,
8183
- _hoisted_3$f
8211
+ _hoisted_3$e
8184
8212
  ];
8185
8213
  function _sfc_render$1(_ctx, _cache) {
8186
8214
  return openBlock(), createElementBlock("div", _hoisted_1$t, [
@@ -8906,7 +8934,7 @@ const _hoisted_2$i = /* @__PURE__ */ createElementVNode("div", {
8906
8934
  /* @__PURE__ */ createElementVNode("h3", null, "Login Design Part")
8907
8935
  ])
8908
8936
  ], -1);
8909
- const _hoisted_3$e = [
8937
+ const _hoisted_3$d = [
8910
8938
  _hoisted_2$i
8911
8939
  ];
8912
8940
  const _sfc_main$m = /* @__PURE__ */ defineComponent({
@@ -8916,7 +8944,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
8916
8944
  },
8917
8945
  setup(__props) {
8918
8946
  return (_ctx, _cache) => {
8919
- return openBlock(), createElementBlock("div", _hoisted_1$q, _hoisted_3$e);
8947
+ return openBlock(), createElementBlock("div", _hoisted_1$q, _hoisted_3$d);
8920
8948
  };
8921
8949
  }
8922
8950
  });
@@ -9055,7 +9083,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
9055
9083
  });
9056
9084
  const _hoisted_1$o = { class: "group-editor group-editor-position" };
9057
9085
  const _hoisted_2$h = { class: "flex-align-center" };
9058
- const _hoisted_3$d = /* @__PURE__ */ createElementVNode("div", { class: "label" }, [
9086
+ const _hoisted_3$c = /* @__PURE__ */ createElementVNode("div", { class: "label" }, [
9059
9087
  /* @__PURE__ */ createElementVNode("label", null, "Position")
9060
9088
  ], -1);
9061
9089
  const _hoisted_4$b = { class: "flex-grow-1" };
@@ -9089,7 +9117,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
9089
9117
  return (_ctx, _cache) => {
9090
9118
  return openBlock(), createElementBlock("div", _hoisted_1$o, [
9091
9119
  createElementVNode("div", _hoisted_2$h, [
9092
- _hoisted_3$d,
9120
+ _hoisted_3$c,
9093
9121
  createElementVNode("div", _hoisted_4$b, [
9094
9122
  createElementVNode("div", null, [
9095
9123
  _hoisted_5$7,
@@ -9129,7 +9157,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
9129
9157
  });
9130
9158
  const _hoisted_1$n = { class: "group-editor group-editor-size" };
9131
9159
  const _hoisted_2$g = { class: "flex-align-center" };
9132
- const _hoisted_3$c = /* @__PURE__ */ createElementVNode("div", { class: "label" }, [
9160
+ const _hoisted_3$b = /* @__PURE__ */ createElementVNode("div", { class: "label" }, [
9133
9161
  /* @__PURE__ */ createElementVNode("label", null, "Size")
9134
9162
  ], -1);
9135
9163
  const _hoisted_4$a = { class: "flex-grow-1" };
@@ -9157,7 +9185,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
9157
9185
  return (_ctx, _cache) => {
9158
9186
  return openBlock(), createElementBlock("div", _hoisted_1$n, [
9159
9187
  createElementVNode("div", _hoisted_2$g, [
9160
- _hoisted_3$c,
9188
+ _hoisted_3$b,
9161
9189
  createElementVNode("div", _hoisted_4$a, [
9162
9190
  _hoisted_5$6,
9163
9191
  createVNode(unref(BSTextInput), {
@@ -9338,7 +9366,7 @@ var script$4 = {
9338
9366
  };
9339
9367
  const _hoisted_1$m = { class: "vc-alpha" };
9340
9368
  const _hoisted_2$f = { class: "vc-alpha-checkboard-wrap" };
9341
- const _hoisted_3$b = /* @__PURE__ */ createElementVNode(
9369
+ const _hoisted_3$a = /* @__PURE__ */ createElementVNode(
9342
9370
  "div",
9343
9371
  { class: "vc-alpha-picker" },
9344
9372
  null,
@@ -9346,7 +9374,7 @@ const _hoisted_3$b = /* @__PURE__ */ createElementVNode(
9346
9374
  /* HOISTED */
9347
9375
  );
9348
9376
  const _hoisted_4$9 = [
9349
- _hoisted_3$b
9377
+ _hoisted_3$a
9350
9378
  ];
9351
9379
  function render$4(_ctx, _cache, $props, $setup, $data, $options) {
9352
9380
  const _component_Checkboard = resolveComponent("Checkboard");
@@ -10456,7 +10484,7 @@ var script$3 = {
10456
10484
  };
10457
10485
  const _hoisted_1$l = { class: "vc-editable-input" };
10458
10486
  const _hoisted_2$e = ["aria-labelledby"];
10459
- const _hoisted_3$a = ["id", "for"];
10487
+ const _hoisted_3$9 = ["id", "for"];
10460
10488
  const _hoisted_4$8 = { class: "vc-input__desc" };
10461
10489
  function render$3(_ctx, _cache, $props, $setup, $data, $options) {
10462
10490
  return openBlock(), createElementBlock("div", _hoisted_1$l, [
@@ -10474,7 +10502,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
10474
10502
  id: $options.labelId,
10475
10503
  for: $props.label,
10476
10504
  class: "vc-input__label"
10477
- }, toDisplayString($options.labelSpanText), 9, _hoisted_3$a),
10505
+ }, toDisplayString($options.labelSpanText), 9, _hoisted_3$9),
10478
10506
  createElementVNode(
10479
10507
  "span",
10480
10508
  _hoisted_4$8,
@@ -10568,7 +10596,7 @@ const _hoisted_2$d = /* @__PURE__ */ createElementVNode(
10568
10596
  -1
10569
10597
  /* HOISTED */
10570
10598
  );
10571
- const _hoisted_3$9 = /* @__PURE__ */ createElementVNode(
10599
+ const _hoisted_3$8 = /* @__PURE__ */ createElementVNode(
10572
10600
  "div",
10573
10601
  { class: "vc-saturation-circle" },
10574
10602
  null,
@@ -10576,7 +10604,7 @@ const _hoisted_3$9 = /* @__PURE__ */ createElementVNode(
10576
10604
  /* HOISTED */
10577
10605
  );
10578
10606
  const _hoisted_4$7 = [
10579
- _hoisted_3$9
10607
+ _hoisted_3$8
10580
10608
  ];
10581
10609
  function render$2(_ctx, _cache, $props, $setup, $data, $options) {
10582
10610
  return openBlock(), createElementBlock(
@@ -10747,7 +10775,7 @@ const _hoisted_2$c = /* @__PURE__ */ createElementVNode(
10747
10775
  -1
10748
10776
  /* HOISTED */
10749
10777
  );
10750
- const _hoisted_3$8 = [
10778
+ const _hoisted_3$7 = [
10751
10779
  _hoisted_2$c
10752
10780
  ];
10753
10781
  function render$1(_ctx, _cache, $props, $setup, $data, $options) {
@@ -10775,7 +10803,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
10775
10803
  style: normalizeStyle({ top: $options.pointerTop, left: $options.pointerLeft }),
10776
10804
  role: "presentation"
10777
10805
  },
10778
- _hoisted_3$8,
10806
+ _hoisted_3$7,
10779
10807
  4
10780
10808
  /* STYLE */
10781
10809
  )
@@ -10877,7 +10905,7 @@ var script = {
10877
10905
  };
10878
10906
  const _hoisted_1$i = { class: "vc-sketch-saturation-wrap" };
10879
10907
  const _hoisted_2$b = { class: "vc-sketch-controls" };
10880
- const _hoisted_3$7 = { class: "vc-sketch-sliders" };
10908
+ const _hoisted_3$6 = { class: "vc-sketch-sliders" };
10881
10909
  const _hoisted_4$6 = { class: "vc-sketch-hue-wrap" };
10882
10910
  const _hoisted_5$5 = {
10883
10911
  key: 0,
@@ -10925,7 +10953,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
10925
10953
  }, null, 8, ["value", "onChange"])
10926
10954
  ]),
10927
10955
  createElementVNode("div", _hoisted_2$b, [
10928
- createElementVNode("div", _hoisted_3$7, [
10956
+ createElementVNode("div", _hoisted_3$6, [
10929
10957
  createElementVNode("div", _hoisted_4$6, [
10930
10958
  createVNode(_component_Hue, {
10931
10959
  value: _ctx.colors,
@@ -11090,7 +11118,7 @@ const _sfc_main$i = defineComponent({
11090
11118
  });
11091
11119
  const _hoisted_1$h = { class: "buttons" };
11092
11120
  const _hoisted_2$a = /* @__PURE__ */ createElementVNode("i", { class: "material-icons-outlined" }, "delete", -1);
11093
- const _hoisted_3$6 = [
11121
+ const _hoisted_3$5 = [
11094
11122
  _hoisted_2$a
11095
11123
  ];
11096
11124
  const _hoisted_4$5 = { class: "sketch-wrap" };
@@ -11114,7 +11142,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
11114
11142
  key: 0,
11115
11143
  class: "pb-button",
11116
11144
  onClick: _cache[1] || (_cache[1] = (...args) => _ctx.emptyColor && _ctx.emptyColor(...args))
11117
- }, _hoisted_3$6)) : createCommentVNode("", true)
11145
+ }, _hoisted_3$5)) : createCommentVNode("", true)
11118
11146
  ]),
11119
11147
  createElementVNode("div", _hoisted_4$5, [
11120
11148
  _ctx.isShowColorPicker ? (openBlock(), createBlock$1(_component_Sketch, {
@@ -11131,7 +11159,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
11131
11159
  const PbColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render]]);
11132
11160
  const _hoisted_1$g = { class: "group-editor group-editor-background" };
11133
11161
  const _hoisted_2$9 = { class: "flex-align-center" };
11134
- const _hoisted_3$5 = /* @__PURE__ */ createElementVNode("div", { class: "label" }, [
11162
+ const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("div", { class: "label" }, [
11135
11163
  /* @__PURE__ */ createElementVNode("label", null, "Background")
11136
11164
  ], -1);
11137
11165
  const _hoisted_4$4 = { class: "bs-layout-horizontal" };
@@ -11169,7 +11197,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
11169
11197
  return (_ctx, _cache) => {
11170
11198
  return openBlock(), createElementBlock("div", _hoisted_1$g, [
11171
11199
  createElementVNode("div", _hoisted_2$9, [
11172
- _hoisted_3$5,
11200
+ _hoisted_3$4,
11173
11201
  createElementVNode("div", _hoisted_4$4, [
11174
11202
  createElementVNode("div", _hoisted_5$4, [
11175
11203
  createVNode(PbColorPicker, {
@@ -11198,7 +11226,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
11198
11226
  });
11199
11227
  const _hoisted_1$f = { class: "group-editor group-editor-border" };
11200
11228
  const _hoisted_2$8 = { class: "flex-align-center" };
11201
- const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("div", { class: "label" }, [
11229
+ const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("div", { class: "label" }, [
11202
11230
  /* @__PURE__ */ createElementVNode("label", null, "Border")
11203
11231
  ], -1);
11204
11232
  const _hoisted_4$3 = { class: "color" };
@@ -11252,7 +11280,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
11252
11280
  return (_ctx, _cache) => {
11253
11281
  return openBlock(), createElementBlock("div", _hoisted_1$f, [
11254
11282
  createElementVNode("div", _hoisted_2$8, [
11255
- _hoisted_3$4,
11283
+ _hoisted_3$3,
11256
11284
  createElementVNode("div", _hoisted_4$3, [
11257
11285
  createVNode(PbColorPicker, {
11258
11286
  value: color.value,
@@ -11340,7 +11368,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
11340
11368
  });
11341
11369
  const _hoisted_1$e = { class: "group-editor group-editor-margin" };
11342
11370
  const _hoisted_2$7 = { class: "flex-align-center" };
11343
- const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("div", { class: "label" }, [
11371
+ const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("div", { class: "label" }, [
11344
11372
  /* @__PURE__ */ createElementVNode("label", null, "Margin")
11345
11373
  ], -1);
11346
11374
  const _hoisted_4$2 = { class: "flex-grow-1" };
@@ -11374,7 +11402,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
11374
11402
  return (_ctx, _cache) => {
11375
11403
  return openBlock(), createElementBlock("div", _hoisted_1$e, [
11376
11404
  createElementVNode("div", _hoisted_2$7, [
11377
- _hoisted_3$3,
11405
+ _hoisted_3$2,
11378
11406
  createElementVNode("div", _hoisted_4$2, [
11379
11407
  createElementVNode("div", null, [
11380
11408
  _hoisted_5$2,
@@ -11414,7 +11442,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
11414
11442
  });
11415
11443
  const _hoisted_1$d = { class: "group-editor group-editor-margin" };
11416
11444
  const _hoisted_2$6 = { class: "flex-align-center" };
11417
- const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("div", { class: "label" }, [
11445
+ const _hoisted_3$1 = /* @__PURE__ */ createElementVNode("div", { class: "label" }, [
11418
11446
  /* @__PURE__ */ createElementVNode("label", null, "Padding")
11419
11447
  ], -1);
11420
11448
  const _hoisted_4$1 = { class: "flex-grow-1" };
@@ -11448,7 +11476,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
11448
11476
  return (_ctx, _cache) => {
11449
11477
  return openBlock(), createElementBlock("div", _hoisted_1$d, [
11450
11478
  createElementVNode("div", _hoisted_2$6, [
11451
- _hoisted_3$2,
11479
+ _hoisted_3$1,
11452
11480
  createElementVNode("div", _hoisted_4$1, [
11453
11481
  createElementVNode("div", null, [
11454
11482
  _hoisted_5$1,
@@ -13128,7 +13156,6 @@ class PageBuilderEditorImpl {
13128
13156
  __publicField(this, "title");
13129
13157
  __publicField(this, "editMode");
13130
13158
  __publicField(this, "scale", ref(1));
13131
- __publicField(this, "locales", ref(["en"]));
13132
13159
  __publicField(this, "language", ref("en"));
13133
13160
  this.model = new Model2();
13134
13161
  this.context = new PageBuilderContextImpl(this);
@@ -13189,12 +13216,6 @@ class PageBuilderEditorImpl {
13189
13216
  zoom(scale) {
13190
13217
  this.scale.value = scale;
13191
13218
  }
13192
- setLocales(locales) {
13193
- this.locales.value = locales;
13194
- if (!locales.includes(this.language.value)) {
13195
- this.language.value = locales[0];
13196
- }
13197
- }
13198
13219
  setLanguage(language) {
13199
13220
  this.language.value = language;
13200
13221
  }
@@ -13446,15 +13467,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
13446
13467
  });
13447
13468
  const _hoisted_1$7 = { class: "pb-toolbar bs-layout-horizontal align-items-center" };
13448
13469
  const _hoisted_2$4 = { class: "ml-8 w-64" };
13449
- const _hoisted_3$1 = { class: "ml-8 w-80" };
13450
13470
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
13451
13471
  __name: "PbToolbar",
13452
13472
  setup(__props) {
13453
13473
  const pageBuilder = usePageBuilderEditor();
13454
13474
  const buttonGroups = pageBuilder.toolButtonRegistry.getToolButtonGroups();
13455
- const locales = computed(() => {
13456
- return pageBuilder.locales.value;
13457
- });
13458
13475
  const scale = computed(() => `${Math.round(100 * pageBuilder.scale.value)}%`);
13459
13476
  const zoom = async (scaleString) => {
13460
13477
  if (!scaleString)
@@ -13462,9 +13479,6 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
13462
13479
  const scale2 = parseInt(scaleString.replaceAll(/[^0-9]+/g, "")) / 100;
13463
13480
  pageBuilder.zoom(scale2);
13464
13481
  };
13465
- const changeLocale = (locale) => {
13466
- pageBuilder.setLanguage(locale);
13467
- };
13468
13482
  return (_ctx, _cache) => {
13469
13483
  return openBlock(), createElementBlock("div", _hoisted_1$7, [
13470
13484
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(buttonGroups), (group) => {
@@ -13484,12 +13498,6 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
13484
13498
  "view-mode": false,
13485
13499
  placeholder: "Scale"
13486
13500
  }, null, 8, ["modelValue"])
13487
- ]),
13488
- createElementVNode("div", _hoisted_3$1, [
13489
- createVNode(unref(BSLocaleSelect), {
13490
- locales: locales.value,
13491
- onChangeLocale: changeLocale
13492
- }, null, 8, ["locales"])
13493
13501
  ])
13494
13502
  ]);
13495
13503
  };
@@ -13964,7 +13972,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13964
13972
  title: {},
13965
13973
  editMode: {},
13966
13974
  pageContent: {},
13967
- locales: {},
13968
13975
  language: {}
13969
13976
  },
13970
13977
  setup(__props, { expose: __expose }) {
@@ -13974,8 +13981,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13974
13981
  pageBuilderEditor.instanceId = props.instanceId;
13975
13982
  pageBuilderEditor.title = props.title;
13976
13983
  pageBuilderEditor.editMode = props.editMode || "free";
13977
- if (props.locales)
13978
- pageBuilderEditor.setLocales(props.locales);
13979
13984
  if (props.language)
13980
13985
  pageBuilderEditor.setLanguage(props.language);
13981
13986
  pageBuilderEditor.registerPlugin({
@@ -13984,8 +13989,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13984
13989
  });
13985
13990
  pageBuilderEditor.keyHandlers.addDocumentKeyEventListener(window.document);
13986
13991
  providePageBuilderEditor(pageBuilderEditor);
13992
+ providePageBuilder(pageBuilderEditor);
13987
13993
  onMounted(() => pageBuilderEditor.initData(props.pageContent));
13988
13994
  watch(() => props.pageContent, (pageContent) => pageContent && pageBuilderEditor.initData(pageContent));
13995
+ watch(() => props.language, (language) => {
13996
+ pageBuilderEditor.setLanguage(language || "en");
13997
+ });
13989
13998
  const colorHistory = ref([]);
13990
13999
  provide("colorHistory", colorHistory);
13991
14000
  const getLocalDesignPartContent = () => {
@@ -14061,21 +14070,24 @@ export {
14061
14070
  WIDGET_TYPE$1 as W,
14062
14071
  _sfc_main as _,
14063
14072
  Block as a,
14064
- PAGE_TYPE$1 as b,
14065
- Page as c,
14066
- _sfc_main$q as d,
14067
- PageBuilderViewerEvent as e,
14068
- Part as f,
14069
- _sfc_main$4$1 as g,
14070
- _sfc_main$2$1 as h,
14071
- _sfc_main$3$1 as i,
14072
- RootPart as j,
14073
- Section as k,
14074
- Widget as l,
14075
- createPageBuilderViewer as m,
14076
- createPartComponent as n,
14077
- createPartComponents as o,
14078
- providePageBuilderViewer as p,
14079
- usePageBuilderViewer as q,
14073
+ PAGE_BUILDER_KEY as b,
14074
+ PAGE_TYPE$1 as c,
14075
+ Page as d,
14076
+ _sfc_main$q as e,
14077
+ PageBuilderViewerEvent as f,
14078
+ Part as g,
14079
+ _sfc_main$4$1 as h,
14080
+ _sfc_main$2$1 as i,
14081
+ _sfc_main$3$1 as j,
14082
+ RootPart as k,
14083
+ Section as l,
14084
+ Widget as m,
14085
+ createPageBuilderViewer as n,
14086
+ createPartComponent as o,
14087
+ createPartComponents as p,
14088
+ providePageBuilder as q,
14089
+ providePageBuilderViewer as r,
14090
+ usePageBuilder as s,
14091
+ usePageBuilderViewer as t,
14080
14092
  usePageBuilderEditor as u
14081
14093
  };
@@ -49,7 +49,6 @@ export declare class PageBuilderContextImpl implements PageBuilderContext {
49
49
  getClassNames: () => string;
50
50
  getStyles: () => Record<string, string>;
51
51
  getPageBuilderId: () => string | undefined;
52
- getLanguage: () => string | undefined;
53
52
  isGlobalDesignPart: () => boolean;
54
53
  isLocalDesignPart: () => boolean;
55
54
  isLocalMarketingPart: () => boolean;
@@ -72,7 +71,6 @@ export declare class PageBuilderContextImpl implements PageBuilderContext {
72
71
  getClassNames: () => string;
73
72
  getStyles: () => Record<string, string>;
74
73
  getPageBuilderId: () => string | undefined;
75
- getLanguage: () => string | undefined;
76
74
  isGlobalDesignPart: () => boolean;
77
75
  isLocalDesignPart: () => boolean;
78
76
  isLocalMarketingPart: () => boolean;
@@ -95,7 +93,6 @@ export declare class PageBuilderContextImpl implements PageBuilderContext {
95
93
  getClassNames: () => string;
96
94
  getStyles: () => Record<string, string>;
97
95
  getPageBuilderId: () => string | undefined;
98
- getLanguage: () => string | undefined;
99
96
  isGlobalDesignPart: () => boolean;
100
97
  isLocalDesignPart: () => boolean;
101
98
  isLocalMarketingPart: () => boolean;
@@ -1,6 +1,7 @@
1
1
  import { ContextMenuRegistry, ContextMenuRegistryImpl, KeyHandlers, PageBuilderContext, PageBuilderContextImpl } from './context.ts';
2
2
  import { ToolButtonRegistry } from './toolbar.ts';
3
3
  import { PageBuilderPlugin } from './plugin.ts';
4
+ import { PageBuilder } from '@g1cloud/page-builder-viewer';
4
5
  import { CommandRegistry, CommandRegistryImpl } from './command';
5
6
  import { PartManager } from './part-manager';
6
7
  import { Model } from './model';
@@ -8,9 +9,11 @@ import { Ref } from 'vue';
8
9
 
9
10
  export type PageBuilderEditMode = 'template' | 'global' | 'local' | 'free';
10
11
  export declare const createPageBuilderEditor: () => PageBuilderEditor;
12
+ export declare const providePageBuilder: (pageBuilder: PageBuilder) => void;
11
13
  export declare const providePageBuilderEditor: (pageBuilderEditor: PageBuilderEditor) => void;
14
+ export declare const usePageBuilder: () => PageBuilder;
12
15
  export declare const usePageBuilderEditor: () => PageBuilderEditor;
13
- export interface PageBuilderEditor {
16
+ export interface PageBuilderEditor extends PageBuilder {
14
17
  instanceId?: string;
15
18
  partManager: PartManager;
16
19
  model: Model;
@@ -22,14 +25,11 @@ export interface PageBuilderEditor {
22
25
  title?: string;
23
26
  editMode: PageBuilderEditMode;
24
27
  scale: Ref<number>;
25
- locales: Ref<string[]>;
26
- language: Ref<string>;
27
28
  registerPlugin(plugin: PageBuilderPlugin): void;
28
29
  initData(content?: any): void;
29
30
  undo(): void;
30
31
  redo(): void;
31
32
  zoom(scale: number): void;
32
- setLocales(locales: string[]): void;
33
33
  setLanguage(language: string): void;
34
34
  }
35
35
  export declare class PageBuilderEditorImpl implements PageBuilderEditor {
@@ -44,7 +44,6 @@ export declare class PageBuilderEditorImpl implements PageBuilderEditor {
44
44
  title?: string;
45
45
  editMode: PageBuilderEditMode;
46
46
  scale: Ref<number>;
47
- locales: Ref<string[]>;
48
47
  language: Ref<string>;
49
48
  constructor();
50
49
  registerPlugin(plugin: PageBuilderPlugin): void;
@@ -52,7 +51,6 @@ export declare class PageBuilderEditorImpl implements PageBuilderEditor {
52
51
  undo(): void;
53
52
  redo(): void;
54
53
  zoom(scale: number): void;
55
- setLocales(locales: string[]): void;
56
54
  setLanguage(language: string): void;
57
55
  private getEmptyPageContent;
58
56
  private initPlugins;
@@ -1,27 +1,30 @@
1
- import { B, a, M, b, c, _, P, d, e, f, g, h, i, R, j, S, k, W, l, m, n, o, p, q } from "./index-Mob7K7vK.js";
1
+ import { B, a, M, b, c, d, _, P, e, f, g, h, i, j, R, k, S, l, W, m, n, o, p, q, r, s, t } from "./index-DQLcq5fP.js";
2
2
  export {
3
3
  B as BLOCK_TYPE,
4
4
  a as Block,
5
5
  M as Model,
6
- b as PAGE_TYPE,
7
- c as Page,
6
+ b as PAGE_BUILDER_KEY,
7
+ c as PAGE_TYPE,
8
+ d as Page,
8
9
  _ as PageBuilderEditor,
9
10
  P as PageBuilderEditorEvent,
10
- d as PageBuilderViewer,
11
- e as PageBuilderViewerEvent,
12
- f as Part,
13
- g as PbImageWidget,
14
- h as PbProductListWidget,
15
- i as PbTextWidget,
11
+ e as PageBuilderViewer,
12
+ f as PageBuilderViewerEvent,
13
+ g as Part,
14
+ h as PbImageWidget,
15
+ i as PbProductListWidget,
16
+ j as PbTextWidget,
16
17
  R as ROOT_TYPE,
17
- j as RootPart,
18
+ k as RootPart,
18
19
  S as SECTION_TYPE,
19
- k as Section,
20
+ l as Section,
20
21
  W as WIDGET_TYPE,
21
- l as Widget,
22
- m as createPageBuilderViewer,
23
- n as createPartComponent,
24
- o as createPartComponents,
25
- p as providePageBuilderViewer,
26
- q as usePageBuilderViewer
22
+ m as Widget,
23
+ n as createPageBuilderViewer,
24
+ o as createPartComponent,
25
+ p as createPartComponents,
26
+ q as providePageBuilder,
27
+ r as providePageBuilderViewer,
28
+ s as usePageBuilder,
29
+ t as usePageBuilderViewer
27
30
  };
@@ -6775,12 +6775,6 @@ var __publicField = (obj, key, value) => {
6775
6775
  if (this.parent)
6776
6776
  return this.parent.getPageBuilderId();
6777
6777
  }
6778
- getLanguage() {
6779
- if (this.isRoot())
6780
- return this.language;
6781
- if (this.parent)
6782
- return this.parent.getLanguage();
6783
- }
6784
6778
  isGlobalDesignPart() {
6785
6779
  return false;
6786
6780
  }
@@ -7025,18 +7019,43 @@ var __publicField = (obj, key, value) => {
7025
7019
  },
7026
7020
  setup(__props) {
7027
7021
  const props = __props;
7022
+ const pageBuilder = usePageBuilder();
7023
+ const emptyClass = vue.computed(() => {
7024
+ var _a;
7025
+ if (props.viewMode) {
7026
+ return false;
7027
+ } else if ((_a = props.part.properties) == null ? void 0 : _a.text) {
7028
+ if (typeof props.part.properties.text === "string") {
7029
+ return true;
7030
+ } else {
7031
+ return !props.part.properties.text[pageBuilder.language.value];
7032
+ }
7033
+ } else {
7034
+ return true;
7035
+ }
7036
+ });
7028
7037
  const text = vue.computed(() => {
7029
7038
  var _a;
7030
7039
  if ((_a = props.part.properties) == null ? void 0 : _a.text) {
7031
7040
  if (typeof props.part.properties.text === "string") {
7032
- return props.part.properties.text;
7041
+ if (props.viewMode) {
7042
+ return "";
7043
+ } else {
7044
+ return "Empty text";
7045
+ }
7033
7046
  } else {
7034
- return props.part.properties.text[props.part.getLanguage() || "en"];
7047
+ const t = props.part.properties.text[pageBuilder.language.value];
7048
+ if (props.viewMode) {
7049
+ return t || "";
7050
+ } else {
7051
+ return t || "Empty text";
7052
+ }
7035
7053
  }
7036
- } else if (!props.viewMode) {
7054
+ } else if (props.viewMode) {
7055
+ return "";
7056
+ } else {
7037
7057
  return "Empty text";
7038
7058
  }
7039
- return "";
7040
7059
  });
7041
7060
  const style = vue.computed(() => {
7042
7061
  var _a;
@@ -7048,7 +7067,7 @@ var __publicField = (obj, key, value) => {
7048
7067
  });
7049
7068
  return (_ctx, _cache) => {
7050
7069
  return vue.openBlock(), vue.createElementBlock("div", {
7051
- class: vue.normalizeClass([[!_ctx.viewMode && !text.value ? "empty" : ""], "pb-text-widget"])
7070
+ class: vue.normalizeClass([[emptyClass.value ? "empty" : ""], "pb-text-widget"])
7052
7071
  }, [
7053
7072
  vue.createElementVNode("div", vue.mergeProps({ class: "text" }, style.value, {
7054
7073
  textContent: vue.toDisplayString(text.value)
@@ -7093,7 +7112,7 @@ var __publicField = (obj, key, value) => {
7093
7112
  };
7094
7113
  const _hoisted_1$1$1 = { class: "pb-product-list-widget" };
7095
7114
  const _hoisted_2$t = { class: "product" };
7096
- const _hoisted_3$o = { class: "image" };
7115
+ const _hoisted_3$n = { class: "image" };
7097
7116
  const _hoisted_4$f = ["src"];
7098
7117
  const _hoisted_5$8 = { class: "name" };
7099
7118
  const _hoisted_6$7 = { class: "price" };
@@ -7141,7 +7160,7 @@ var __publicField = (obj, key, value) => {
7141
7160
  }, [
7142
7161
  vue.createElementVNode("div", _hoisted_2$t, [
7143
7162
  products.value[index - 1] ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
7144
- vue.createElementVNode("div", _hoisted_3$o, [
7163
+ vue.createElementVNode("div", _hoisted_3$n, [
7145
7164
  vue.createElementVNode("img", {
7146
7165
  src: products.value[index - 1].image,
7147
7166
  alt: ""
@@ -7199,19 +7218,18 @@ var __publicField = (obj, key, value) => {
7199
7218
  creator: () => _sfc_main$2$1
7200
7219
  }
7201
7220
  };
7221
+ const PAGE_BUILDER_KEY = "PageBuilder";
7202
7222
  const PAGE_BUILDER_VIEWER_KEY = "PageBuilderViewer";
7203
7223
  class PageBuilderViewerImpl {
7204
7224
  constructor() {
7205
7225
  __publicField2(this, "instanceId");
7206
7226
  __publicField2(this, "model");
7207
- __publicField2(this, "language");
7227
+ __publicField2(this, "language", vue.ref("en"));
7208
7228
  this.model = new Model$1();
7209
- this.language = "en";
7210
7229
  }
7211
7230
  render(pageContent) {
7212
7231
  const rootPart = new RootPart();
7213
7232
  rootPart.pageBuilderId = this.instanceId;
7214
- rootPart.language = this.language;
7215
7233
  rootPart.children = this.parsePageContent(pageContent);
7216
7234
  if (rootPart.children) {
7217
7235
  for (let page of rootPart.children) {
@@ -7255,13 +7273,22 @@ var __publicField = (obj, key, value) => {
7255
7273
  const viewer = new PageBuilderViewerImpl();
7256
7274
  return viewer;
7257
7275
  };
7276
+ const providePageBuilder = (pageBuilder) => {
7277
+ vue.provide(PAGE_BUILDER_KEY, pageBuilder);
7278
+ };
7258
7279
  const providePageBuilderViewer = (pageBuilderViewer) => {
7259
7280
  vue.provide(PAGE_BUILDER_VIEWER_KEY, pageBuilderViewer);
7260
7281
  };
7282
+ const usePageBuilder = () => {
7283
+ const pageBuilder = vue.inject(PAGE_BUILDER_KEY);
7284
+ if (!pageBuilder)
7285
+ throw Error("PageBuilder not found");
7286
+ return pageBuilder;
7287
+ };
7261
7288
  const usePageBuilderViewer = () => {
7262
7289
  const pageBuilderViewer = vue.inject(PAGE_BUILDER_VIEWER_KEY);
7263
7290
  if (!pageBuilderViewer)
7264
- throw Error("PageBuilder not found");
7291
+ throw Error("PageBuilderViewer not found");
7265
7292
  return pageBuilderViewer;
7266
7293
  };
7267
7294
  const createPartComponents = (parts) => {
@@ -7321,8 +7348,9 @@ var __publicField = (obj, key, value) => {
7321
7348
  const props = __props;
7322
7349
  const pageBuilderViewer = createPageBuilderViewer();
7323
7350
  pageBuilderViewer.instanceId = props.instanceId;
7324
- pageBuilderViewer.language = props.language || "en";
7351
+ pageBuilderViewer.language.value = props.language || "en";
7325
7352
  providePageBuilderViewer(pageBuilderViewer);
7353
+ providePageBuilder(pageBuilderViewer);
7326
7354
  const page = vue.computed(() => pageBuilderViewer.model.rootPart.value.children && pageBuilderViewer.model.rootPart.value.children[props.isMobilePage ? 0 : 1]);
7327
7355
  vue.onMounted(() => {
7328
7356
  if (props.pageContent) {
@@ -8179,10 +8207,10 @@ var __publicField = (obj, key, value) => {
8179
8207
  const _sfc_main$x = {};
8180
8208
  const _hoisted_1$B = { class: "pb-add-widget-button" };
8181
8209
  const _hoisted_2$s = /* @__PURE__ */ vue.createElementVNode("span", { class: "icon material-icons-outlined" }, "add_box", -1);
8182
- const _hoisted_3$n = /* @__PURE__ */ vue.createElementVNode("span", { class: "text" }, "Add Widget", -1);
8210
+ const _hoisted_3$m = /* @__PURE__ */ vue.createElementVNode("span", { class: "text" }, "Add Widget", -1);
8183
8211
  const _hoisted_4$e = [
8184
8212
  _hoisted_2$s,
8185
- _hoisted_3$n
8213
+ _hoisted_3$m
8186
8214
  ];
8187
8215
  function _sfc_render$1(_ctx, _cache) {
8188
8216
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$B, [
@@ -8908,7 +8936,7 @@ var __publicField = (obj, key, value) => {
8908
8936
  /* @__PURE__ */ vue.createElementVNode("h3", null, "Login Design Part")
8909
8937
  ])
8910
8938
  ], -1);
8911
- const _hoisted_3$m = [
8939
+ const _hoisted_3$l = [
8912
8940
  _hoisted_2$q
8913
8941
  ];
8914
8942
  const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
@@ -8918,7 +8946,7 @@ var __publicField = (obj, key, value) => {
8918
8946
  },
8919
8947
  setup(__props) {
8920
8948
  return (_ctx, _cache) => {
8921
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$y, _hoisted_3$m);
8949
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$y, _hoisted_3$l);
8922
8950
  };
8923
8951
  }
8924
8952
  });
@@ -9057,7 +9085,7 @@ var __publicField = (obj, key, value) => {
9057
9085
  });
9058
9086
  const _hoisted_1$w = { class: "group-editor group-editor-position" };
9059
9087
  const _hoisted_2$p = { class: "flex-align-center" };
9060
- const _hoisted_3$l = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, [
9088
+ const _hoisted_3$k = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, [
9061
9089
  /* @__PURE__ */ vue.createElementVNode("label", null, "Position")
9062
9090
  ], -1);
9063
9091
  const _hoisted_4$d = { class: "flex-grow-1" };
@@ -9091,7 +9119,7 @@ var __publicField = (obj, key, value) => {
9091
9119
  return (_ctx, _cache) => {
9092
9120
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$w, [
9093
9121
  vue.createElementVNode("div", _hoisted_2$p, [
9094
- _hoisted_3$l,
9122
+ _hoisted_3$k,
9095
9123
  vue.createElementVNode("div", _hoisted_4$d, [
9096
9124
  vue.createElementVNode("div", null, [
9097
9125
  _hoisted_5$7,
@@ -9131,7 +9159,7 @@ var __publicField = (obj, key, value) => {
9131
9159
  });
9132
9160
  const _hoisted_1$v = { class: "group-editor group-editor-size" };
9133
9161
  const _hoisted_2$o = { class: "flex-align-center" };
9134
- const _hoisted_3$k = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, [
9162
+ const _hoisted_3$j = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, [
9135
9163
  /* @__PURE__ */ vue.createElementVNode("label", null, "Size")
9136
9164
  ], -1);
9137
9165
  const _hoisted_4$c = { class: "flex-grow-1" };
@@ -9159,7 +9187,7 @@ var __publicField = (obj, key, value) => {
9159
9187
  return (_ctx, _cache) => {
9160
9188
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$v, [
9161
9189
  vue.createElementVNode("div", _hoisted_2$o, [
9162
- _hoisted_3$k,
9190
+ _hoisted_3$j,
9163
9191
  vue.createElementVNode("div", _hoisted_4$c, [
9164
9192
  _hoisted_5$6,
9165
9193
  vue.createVNode(vue.unref(bluesea.BSTextInput), {
@@ -9340,7 +9368,7 @@ var __publicField = (obj, key, value) => {
9340
9368
  };
9341
9369
  const _hoisted_1$u = { class: "vc-alpha" };
9342
9370
  const _hoisted_2$n = { class: "vc-alpha-checkboard-wrap" };
9343
- const _hoisted_3$j = /* @__PURE__ */ vue.createElementVNode(
9371
+ const _hoisted_3$i = /* @__PURE__ */ vue.createElementVNode(
9344
9372
  "div",
9345
9373
  { class: "vc-alpha-picker" },
9346
9374
  null,
@@ -9348,7 +9376,7 @@ var __publicField = (obj, key, value) => {
9348
9376
  /* HOISTED */
9349
9377
  );
9350
9378
  const _hoisted_4$b = [
9351
- _hoisted_3$j
9379
+ _hoisted_3$i
9352
9380
  ];
9353
9381
  function render$4(_ctx, _cache, $props, $setup, $data, $options) {
9354
9382
  const _component_Checkboard = vue.resolveComponent("Checkboard");
@@ -10458,7 +10486,7 @@ var __publicField = (obj, key, value) => {
10458
10486
  };
10459
10487
  const _hoisted_1$t = { class: "vc-editable-input" };
10460
10488
  const _hoisted_2$m = ["aria-labelledby"];
10461
- const _hoisted_3$i = ["id", "for"];
10489
+ const _hoisted_3$h = ["id", "for"];
10462
10490
  const _hoisted_4$a = { class: "vc-input__desc" };
10463
10491
  function render$3(_ctx, _cache, $props, $setup, $data, $options) {
10464
10492
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$t, [
@@ -10476,7 +10504,7 @@ var __publicField = (obj, key, value) => {
10476
10504
  id: $options.labelId,
10477
10505
  for: $props.label,
10478
10506
  class: "vc-input__label"
10479
- }, vue.toDisplayString($options.labelSpanText), 9, _hoisted_3$i),
10507
+ }, vue.toDisplayString($options.labelSpanText), 9, _hoisted_3$h),
10480
10508
  vue.createElementVNode(
10481
10509
  "span",
10482
10510
  _hoisted_4$a,
@@ -10570,7 +10598,7 @@ var __publicField = (obj, key, value) => {
10570
10598
  -1
10571
10599
  /* HOISTED */
10572
10600
  );
10573
- const _hoisted_3$h = /* @__PURE__ */ vue.createElementVNode(
10601
+ const _hoisted_3$g = /* @__PURE__ */ vue.createElementVNode(
10574
10602
  "div",
10575
10603
  { class: "vc-saturation-circle" },
10576
10604
  null,
@@ -10578,7 +10606,7 @@ var __publicField = (obj, key, value) => {
10578
10606
  /* HOISTED */
10579
10607
  );
10580
10608
  const _hoisted_4$9 = [
10581
- _hoisted_3$h
10609
+ _hoisted_3$g
10582
10610
  ];
10583
10611
  function render$2(_ctx, _cache, $props, $setup, $data, $options) {
10584
10612
  return vue.openBlock(), vue.createElementBlock(
@@ -10749,7 +10777,7 @@ var __publicField = (obj, key, value) => {
10749
10777
  -1
10750
10778
  /* HOISTED */
10751
10779
  );
10752
- const _hoisted_3$g = [
10780
+ const _hoisted_3$f = [
10753
10781
  _hoisted_2$k
10754
10782
  ];
10755
10783
  function render$1(_ctx, _cache, $props, $setup, $data, $options) {
@@ -10777,7 +10805,7 @@ var __publicField = (obj, key, value) => {
10777
10805
  style: vue.normalizeStyle({ top: $options.pointerTop, left: $options.pointerLeft }),
10778
10806
  role: "presentation"
10779
10807
  },
10780
- _hoisted_3$g,
10808
+ _hoisted_3$f,
10781
10809
  4
10782
10810
  /* STYLE */
10783
10811
  )
@@ -10879,7 +10907,7 @@ var __publicField = (obj, key, value) => {
10879
10907
  };
10880
10908
  const _hoisted_1$q = { class: "vc-sketch-saturation-wrap" };
10881
10909
  const _hoisted_2$j = { class: "vc-sketch-controls" };
10882
- const _hoisted_3$f = { class: "vc-sketch-sliders" };
10910
+ const _hoisted_3$e = { class: "vc-sketch-sliders" };
10883
10911
  const _hoisted_4$8 = { class: "vc-sketch-hue-wrap" };
10884
10912
  const _hoisted_5$5 = {
10885
10913
  key: 0,
@@ -10927,7 +10955,7 @@ var __publicField = (obj, key, value) => {
10927
10955
  }, null, 8, ["value", "onChange"])
10928
10956
  ]),
10929
10957
  vue.createElementVNode("div", _hoisted_2$j, [
10930
- vue.createElementVNode("div", _hoisted_3$f, [
10958
+ vue.createElementVNode("div", _hoisted_3$e, [
10931
10959
  vue.createElementVNode("div", _hoisted_4$8, [
10932
10960
  vue.createVNode(_component_Hue, {
10933
10961
  value: _ctx.colors,
@@ -11092,7 +11120,7 @@ var __publicField = (obj, key, value) => {
11092
11120
  });
11093
11121
  const _hoisted_1$p = { class: "buttons" };
11094
11122
  const _hoisted_2$i = /* @__PURE__ */ vue.createElementVNode("i", { class: "material-icons-outlined" }, "delete", -1);
11095
- const _hoisted_3$e = [
11123
+ const _hoisted_3$d = [
11096
11124
  _hoisted_2$i
11097
11125
  ];
11098
11126
  const _hoisted_4$7 = { class: "sketch-wrap" };
@@ -11116,7 +11144,7 @@ var __publicField = (obj, key, value) => {
11116
11144
  key: 0,
11117
11145
  class: "pb-button",
11118
11146
  onClick: _cache[1] || (_cache[1] = (...args) => _ctx.emptyColor && _ctx.emptyColor(...args))
11119
- }, _hoisted_3$e)) : vue.createCommentVNode("", true)
11147
+ }, _hoisted_3$d)) : vue.createCommentVNode("", true)
11120
11148
  ]),
11121
11149
  vue.createElementVNode("div", _hoisted_4$7, [
11122
11150
  _ctx.isShowColorPicker ? (vue.openBlock(), vue.createBlock(_component_Sketch, {
@@ -11133,7 +11161,7 @@ var __publicField = (obj, key, value) => {
11133
11161
  const PbColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render]]);
11134
11162
  const _hoisted_1$o = { class: "group-editor group-editor-background" };
11135
11163
  const _hoisted_2$h = { class: "flex-align-center" };
11136
- const _hoisted_3$d = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, [
11164
+ const _hoisted_3$c = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, [
11137
11165
  /* @__PURE__ */ vue.createElementVNode("label", null, "Background")
11138
11166
  ], -1);
11139
11167
  const _hoisted_4$6 = { class: "bs-layout-horizontal" };
@@ -11171,7 +11199,7 @@ var __publicField = (obj, key, value) => {
11171
11199
  return (_ctx, _cache) => {
11172
11200
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$o, [
11173
11201
  vue.createElementVNode("div", _hoisted_2$h, [
11174
- _hoisted_3$d,
11202
+ _hoisted_3$c,
11175
11203
  vue.createElementVNode("div", _hoisted_4$6, [
11176
11204
  vue.createElementVNode("div", _hoisted_5$4, [
11177
11205
  vue.createVNode(PbColorPicker, {
@@ -11200,7 +11228,7 @@ var __publicField = (obj, key, value) => {
11200
11228
  });
11201
11229
  const _hoisted_1$n = { class: "group-editor group-editor-border" };
11202
11230
  const _hoisted_2$g = { class: "flex-align-center" };
11203
- const _hoisted_3$c = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, [
11231
+ const _hoisted_3$b = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, [
11204
11232
  /* @__PURE__ */ vue.createElementVNode("label", null, "Border")
11205
11233
  ], -1);
11206
11234
  const _hoisted_4$5 = { class: "color" };
@@ -11254,7 +11282,7 @@ var __publicField = (obj, key, value) => {
11254
11282
  return (_ctx, _cache) => {
11255
11283
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
11256
11284
  vue.createElementVNode("div", _hoisted_2$g, [
11257
- _hoisted_3$c,
11285
+ _hoisted_3$b,
11258
11286
  vue.createElementVNode("div", _hoisted_4$5, [
11259
11287
  vue.createVNode(PbColorPicker, {
11260
11288
  value: color.value,
@@ -11342,7 +11370,7 @@ var __publicField = (obj, key, value) => {
11342
11370
  });
11343
11371
  const _hoisted_1$m = { class: "group-editor group-editor-margin" };
11344
11372
  const _hoisted_2$f = { class: "flex-align-center" };
11345
- const _hoisted_3$b = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, [
11373
+ const _hoisted_3$a = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, [
11346
11374
  /* @__PURE__ */ vue.createElementVNode("label", null, "Margin")
11347
11375
  ], -1);
11348
11376
  const _hoisted_4$4 = { class: "flex-grow-1" };
@@ -11376,7 +11404,7 @@ var __publicField = (obj, key, value) => {
11376
11404
  return (_ctx, _cache) => {
11377
11405
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
11378
11406
  vue.createElementVNode("div", _hoisted_2$f, [
11379
- _hoisted_3$b,
11407
+ _hoisted_3$a,
11380
11408
  vue.createElementVNode("div", _hoisted_4$4, [
11381
11409
  vue.createElementVNode("div", null, [
11382
11410
  _hoisted_5$2,
@@ -11416,7 +11444,7 @@ var __publicField = (obj, key, value) => {
11416
11444
  });
11417
11445
  const _hoisted_1$l = { class: "group-editor group-editor-margin" };
11418
11446
  const _hoisted_2$e = { class: "flex-align-center" };
11419
- const _hoisted_3$a = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, [
11447
+ const _hoisted_3$9 = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, [
11420
11448
  /* @__PURE__ */ vue.createElementVNode("label", null, "Padding")
11421
11449
  ], -1);
11422
11450
  const _hoisted_4$3 = { class: "flex-grow-1" };
@@ -11450,7 +11478,7 @@ var __publicField = (obj, key, value) => {
11450
11478
  return (_ctx, _cache) => {
11451
11479
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
11452
11480
  vue.createElementVNode("div", _hoisted_2$e, [
11453
- _hoisted_3$a,
11481
+ _hoisted_3$9,
11454
11482
  vue.createElementVNode("div", _hoisted_4$3, [
11455
11483
  vue.createElementVNode("div", null, [
11456
11484
  _hoisted_5$1,
@@ -13130,7 +13158,6 @@ var __publicField = (obj, key, value) => {
13130
13158
  __publicField(this, "title");
13131
13159
  __publicField(this, "editMode");
13132
13160
  __publicField(this, "scale", vue.ref(1));
13133
- __publicField(this, "locales", vue.ref(["en"]));
13134
13161
  __publicField(this, "language", vue.ref("en"));
13135
13162
  this.model = new Model();
13136
13163
  this.context = new PageBuilderContextImpl(this);
@@ -13191,12 +13218,6 @@ var __publicField = (obj, key, value) => {
13191
13218
  zoom(scale) {
13192
13219
  this.scale.value = scale;
13193
13220
  }
13194
- setLocales(locales) {
13195
- this.locales.value = locales;
13196
- if (!locales.includes(this.language.value)) {
13197
- this.language.value = locales[0];
13198
- }
13199
- }
13200
13221
  setLanguage(language) {
13201
13222
  this.language.value = language;
13202
13223
  }
@@ -13448,15 +13469,11 @@ var __publicField = (obj, key, value) => {
13448
13469
  });
13449
13470
  const _hoisted_1$f = { class: "pb-toolbar bs-layout-horizontal align-items-center" };
13450
13471
  const _hoisted_2$c = { class: "ml-8 w-64" };
13451
- const _hoisted_3$9 = { class: "ml-8 w-80" };
13452
13472
  const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
13453
13473
  __name: "PbToolbar",
13454
13474
  setup(__props) {
13455
13475
  const pageBuilder = usePageBuilderEditor();
13456
13476
  const buttonGroups = pageBuilder.toolButtonRegistry.getToolButtonGroups();
13457
- const locales = vue.computed(() => {
13458
- return pageBuilder.locales.value;
13459
- });
13460
13477
  const scale = vue.computed(() => `${Math.round(100 * pageBuilder.scale.value)}%`);
13461
13478
  const zoom = async (scaleString) => {
13462
13479
  if (!scaleString)
@@ -13464,9 +13481,6 @@ var __publicField = (obj, key, value) => {
13464
13481
  const scale2 = parseInt(scaleString.replaceAll(/[^0-9]+/g, "")) / 100;
13465
13482
  pageBuilder.zoom(scale2);
13466
13483
  };
13467
- const changeLocale = (locale) => {
13468
- pageBuilder.setLanguage(locale);
13469
- };
13470
13484
  return (_ctx, _cache) => {
13471
13485
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
13472
13486
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttonGroups), (group) => {
@@ -13486,12 +13500,6 @@ var __publicField = (obj, key, value) => {
13486
13500
  "view-mode": false,
13487
13501
  placeholder: "Scale"
13488
13502
  }, null, 8, ["modelValue"])
13489
- ]),
13490
- vue.createElementVNode("div", _hoisted_3$9, [
13491
- vue.createVNode(vue.unref(bluesea.BSLocaleSelect), {
13492
- locales: locales.value,
13493
- onChangeLocale: changeLocale
13494
- }, null, 8, ["locales"])
13495
13503
  ])
13496
13504
  ]);
13497
13505
  };
@@ -13966,7 +13974,6 @@ var __publicField = (obj, key, value) => {
13966
13974
  title: {},
13967
13975
  editMode: {},
13968
13976
  pageContent: {},
13969
- locales: {},
13970
13977
  language: {}
13971
13978
  },
13972
13979
  setup(__props, { expose: __expose }) {
@@ -13976,8 +13983,6 @@ var __publicField = (obj, key, value) => {
13976
13983
  pageBuilderEditor.instanceId = props.instanceId;
13977
13984
  pageBuilderEditor.title = props.title;
13978
13985
  pageBuilderEditor.editMode = props.editMode || "free";
13979
- if (props.locales)
13980
- pageBuilderEditor.setLocales(props.locales);
13981
13986
  if (props.language)
13982
13987
  pageBuilderEditor.setLanguage(props.language);
13983
13988
  pageBuilderEditor.registerPlugin({
@@ -13986,8 +13991,12 @@ var __publicField = (obj, key, value) => {
13986
13991
  });
13987
13992
  pageBuilderEditor.keyHandlers.addDocumentKeyEventListener(window.document);
13988
13993
  providePageBuilderEditor(pageBuilderEditor);
13994
+ providePageBuilder(pageBuilderEditor);
13989
13995
  vue.onMounted(() => pageBuilderEditor.initData(props.pageContent));
13990
13996
  vue.watch(() => props.pageContent, (pageContent) => pageContent && pageBuilderEditor.initData(pageContent));
13997
+ vue.watch(() => props.language, (language) => {
13998
+ pageBuilderEditor.setLanguage(language || "en");
13999
+ });
13991
14000
  const colorHistory = vue.ref([]);
13992
14001
  vue.provide("colorHistory", colorHistory);
13993
14002
  const getLocalDesignPartContent = () => {
@@ -14424,6 +14433,7 @@ var __publicField = (obj, key, value) => {
14424
14433
  exports2.BLOCK_TYPE = BLOCK_TYPE$1;
14425
14434
  exports2.Block = Block;
14426
14435
  exports2.Model = Model$1;
14436
+ exports2.PAGE_BUILDER_KEY = PAGE_BUILDER_KEY;
14427
14437
  exports2.PAGE_TYPE = PAGE_TYPE$1;
14428
14438
  exports2.Page = Page;
14429
14439
  exports2.PageBuilderEditor = _sfc_main$8;
@@ -14443,7 +14453,9 @@ var __publicField = (obj, key, value) => {
14443
14453
  exports2.createPageBuilderViewer = createPageBuilderViewer;
14444
14454
  exports2.createPartComponent = createPartComponent;
14445
14455
  exports2.createPartComponents = createPartComponents;
14456
+ exports2.providePageBuilder = providePageBuilder;
14446
14457
  exports2.providePageBuilderViewer = providePageBuilderViewer;
14458
+ exports2.usePageBuilder = usePageBuilder;
14447
14459
  exports2.usePageBuilderViewer = usePageBuilderViewer;
14448
14460
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
14449
14461
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@g1cloud/page-builder-editor",
3
3
  "private": false,
4
- "version": "1.0.0-alpha.5",
4
+ "version": "1.0.0-alpha.6",
5
5
  "engins": {
6
6
  "node": ">= 20.0.0"
7
7
  },
@@ -27,7 +27,7 @@
27
27
  "vue-router": "^4.3.2",
28
28
  "vue3-click-away": "^1.2.4",
29
29
  "yjs": "^13.6.14",
30
- "@g1cloud/page-builder-viewer": "1.0.0-alpha.5"
30
+ "@g1cloud/page-builder-viewer": "1.0.0-alpha.6"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^20.12.7",