@tailor-cms/ce-accordion-edit 0.0.4 → 0.0.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.
package/dist/index.js CHANGED
@@ -2552,7 +2552,7 @@ var DiscussionEvents = /* @__PURE__ */ ((DiscussionEvents2) => {
2552
2552
  return DiscussionEvents2;
2553
2553
  })(DiscussionEvents || {});
2554
2554
  var discussion_default = DiscussionEvents;
2555
- const UserAvatar_vue_vue_type_style_index_0_scoped_05c20e2a_lang = "";
2555
+ const UserAvatar_vue_vue_type_style_index_0_scoped_79158e3e_lang = "";
2556
2556
  function Cache(maxSize) {
2557
2557
  this._maxSize = maxSize;
2558
2558
  this.clear();
@@ -3902,10 +3902,10 @@ function baseSlice$1(array2, start, end) {
3902
3902
  return result;
3903
3903
  }
3904
3904
  var _baseSlice = baseSlice$1;
3905
- const CommentHeader_vue_vue_type_style_index_0_scoped_e096b5c1_lang = "";
3906
- const CommentPreview_vue_vue_type_style_index_0_scoped_39c90040_lang = "";
3907
- const index_vue_vue_type_style_index_0_scoped_242e5698_lang = "";
3908
- const ThreadList_vue_vue_type_style_index_0_scoped_69125c48_lang = "";
3905
+ const CommentHeader_vue_vue_type_style_index_0_scoped_a427532b_lang = "";
3906
+ const CommentPreview_vue_vue_type_style_index_0_scoped_8e7f19b8_lang = "";
3907
+ const index_vue_vue_type_style_index_0_scoped_344f08e5_lang = "";
3908
+ const ThreadList_vue_vue_type_style_index_0_scoped_1f95bfdb_lang = "";
3909
3909
  function commonjsRequire(path) {
3910
3910
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
3911
3911
  }
@@ -4259,18 +4259,18 @@ var pluralize = { exports: {} };
4259
4259
  return pluralize2;
4260
4260
  });
4261
4261
  })(pluralize);
4262
- const UnseenDivider_vue_vue_type_style_index_0_scoped_4f201343_lang = "";
4263
- const index_vue_vue_type_style_index_0_scoped_af4c1fdd_lang = "";
4262
+ const UnseenDivider_vue_vue_type_style_index_0_scoped_81b56d7c_lang = "";
4263
+ const index_vue_vue_type_style_index_0_scoped_b23d06d6_lang = "";
4264
4264
  const useConfirmationDialog = () => {
4265
4265
  const eventBus = inject("$eventBus");
4266
4266
  return (opts) => {
4267
4267
  eventBus.channel("app").emit("showConfirmationModal", opts);
4268
4268
  };
4269
4269
  };
4270
- const index_vue_vue_type_style_index_0_scoped_2eb30ac0_lang = "";
4271
- const ElementDiscussion_vue_vue_type_style_index_0_scoped_d9ba0a21_lang = "";
4272
- const ContentElement_vue_vue_type_style_index_0_scoped_9a9272e0_lang = "";
4273
- const ContainedContent_vue_vue_type_style_index_0_scoped_b97ee2aa_lang = "";
4270
+ const index_vue_vue_type_style_index_0_scoped_bdbd0b31_lang = "";
4271
+ const ElementDiscussion_vue_vue_type_style_index_0_scoped_fb32ecf9_lang = "";
4272
+ const ContentElement_vue_vue_type_style_index_0_scoped_f2b91b16_lang = "";
4273
+ const ContainedContent_vue_vue_type_style_index_0_scoped_caf26e8d_lang = "";
4274
4274
  /**!
4275
4275
  * Sortable 1.14.0
4276
4276
  * @author RubaXa <trash@rubaxa.org>
@@ -7145,9 +7145,9 @@ var pick = flatRest$1(function(object2, paths) {
7145
7145
  });
7146
7146
  var pick_1 = pick;
7147
7147
  const pick$1 = /* @__PURE__ */ getDefaultExportFromCjs(pick_1);
7148
- const AddNewElement_vue_vue_type_style_index_0_scoped_1960d7c8_lang = "";
7149
- const ContentElement_vue_vue_type_style_index_0_scoped_a6d26f4a_lang = "";
7150
- const SelectActivity_vue_vue_type_style_index_0_scoped_f56ca773_lang = "";
7148
+ const AddNewElement_vue_vue_type_style_index_0_scoped_2cf7249c_lang = "";
7149
+ const ContentElement_vue_vue_type_style_index_0_scoped_788ca810_lang = "";
7150
+ const SelectActivity_vue_vue_type_style_index_0_scoped_69a3da5b_lang = "";
7151
7151
  var yoctodelay = (d) => new Promise((r) => setTimeout(r, d));
7152
7152
  const delay = /* @__PURE__ */ getDefaultExportFromCjs(yoctodelay);
7153
7153
  async function pMinDelay(promise, minimumDelay, { delayRejection = true } = {}) {
@@ -7167,9 +7167,9 @@ const useLoader = () => {
7167
7167
  };
7168
7168
  return { loader, loading };
7169
7169
  };
7170
- const TailorDialog_vue_vue_type_style_index_0_scoped_d5112d4b_lang = "";
7171
- const ElementList_vue_vue_type_style_index_0_scoped_d33d8047_lang = "";
7172
- const InlineActivator_vue_vue_type_style_index_0_scoped_eaccc16f_lang = "";
7170
+ const TailorDialog_vue_vue_type_style_index_0_scoped_b27f4c9a_lang = "";
7171
+ const ElementList_vue_vue_type_style_index_0_scoped_75eb7284_lang = "";
7172
+ const InlineActivator_vue_vue_type_style_index_0_scoped_61d96366_lang = "";
7173
7173
  function noop$1() {
7174
7174
  }
7175
7175
  var noop_1 = noop$1;
@@ -7241,8 +7241,8 @@ flatRest(function(object2, paths) {
7241
7241
  }
7242
7242
  return result;
7243
7243
  });
7244
- const ListItem_vue_vue_type_style_index_0_scoped_570b8171_lang = "";
7245
- const ItemGroup_vue_vue_type_style_index_0_scoped_85267ad2_lang = "";
7244
+ const ListItem_vue_vue_type_style_index_0_scoped_10fef400_lang = "";
7245
+ const ItemGroup_vue_vue_type_style_index_0_scoped_905defd8_lang = "";
7246
7246
  const download = (url, fileName) => {
7247
7247
  const anchor = document.createElement("a");
7248
7248
  Object.assign(anchor, { href: url, download: fileName, target: "_blank" });
@@ -7282,7 +7282,7 @@ const useUpload = (emit2) => {
7282
7282
  error
7283
7283
  };
7284
7284
  };
7285
- const FileInput_vue_vue_type_style_index_0_scoped_f3d00dc2_lang = "";
7285
+ const FileInput_vue_vue_type_style_index_0_scoped_7e5f9e00_lang = "";
7286
7286
  function OrderedMap(content) {
7287
7287
  this.content = content;
7288
7288
  }
@@ -19589,8 +19589,8 @@ Mark2.create({
19589
19589
  };
19590
19590
  }
19591
19591
  });
19592
- const EditorToolbar_vue_vue_type_style_index_0_scoped_37fd2dee_lang = "";
19593
- const index_vue_vue_type_style_index_0_scoped_b7fc3b8b_lang = "";
19592
+ const EditorToolbar_vue_vue_type_style_index_0_scoped_a00f26d5_lang = "";
19593
+ const index_vue_vue_type_style_index_0_scoped_4dc69d89_lang = "";
19594
19594
  var toString = toString_1;
19595
19595
  var idCounter = 0;
19596
19596
  function uniqueId(prefix) {
@@ -19599,7 +19599,7 @@ function uniqueId(prefix) {
19599
19599
  }
19600
19600
  var uniqueId_1 = uniqueId;
19601
19601
  const uniqueId$1 = /* @__PURE__ */ getDefaultExportFromCjs(uniqueId_1);
19602
- const _hoisted_1$3 = ["id", "accept"];
19602
+ const _hoisted_1$4 = ["id", "accept"];
19603
19603
  /* @__PURE__ */ defineComponent({
19604
19604
  __name: "UploadBtn",
19605
19605
  props: {
@@ -19652,7 +19652,7 @@ const _hoisted_1$3 = ["id", "accept"];
19652
19652
  class: "d-none",
19653
19653
  type: "file",
19654
19654
  onChange: _cache[1] || (_cache[1] = ($event) => validateAndUpload($event.target))
19655
- }, null, 40, _hoisted_1$3)),
19655
+ }, null, 40, _hoisted_1$4)),
19656
19656
  fileInput.value ? (openBlock(), createBlock(_component_VBtn, {
19657
19657
  key: 0,
19658
19658
  loading: unref(uploading),
@@ -19673,11 +19673,11 @@ const _hoisted_1$3 = ["id", "accept"];
19673
19673
  };
19674
19674
  }
19675
19675
  });
19676
- const _hoisted_1$2 = {
19676
+ const _hoisted_1$3 = {
19677
19677
  key: 0,
19678
19678
  class: "text-grey-darken-2 text-subtitle-1"
19679
19679
  };
19680
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
19680
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
19681
19681
  __name: "ElementPlaceholder",
19682
19682
  props: {
19683
19683
  icon: {},
@@ -19725,7 +19725,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
19725
19725
  _ctx.dense ? "my-2 text-subtitle-2" : "my-4 text-h5"
19726
19726
  ])
19727
19727
  }, toDisplayString(_ctx.name), 3),
19728
- !_ctx.dense && !_ctx.isDisabled ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
19728
+ !_ctx.dense && !_ctx.isDisabled ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
19729
19729
  !_ctx.isFocused ? (openBlock(), createElementBlock(Fragment$1, { key: 0 }, [
19730
19730
  createTextVNode(toDisplayString(_ctx.placeholder), 1)
19731
19731
  ], 64)) : (openBlock(), createElementBlock(Fragment$1, { key: 1 }, [
@@ -27488,7 +27488,7 @@ function isEmpty(value) {
27488
27488
  }
27489
27489
  var isEmpty_1 = isEmpty;
27490
27490
  const isEmpty$1 = /* @__PURE__ */ getDefaultExportFromCjs(isEmpty_1);
27491
- const _hoisted_1$1 = {
27491
+ const _hoisted_1$2 = {
27492
27492
  key: 2,
27493
27493
  class: "accordion-title ml-4"
27494
27494
  };
@@ -27496,29 +27496,26 @@ const _hoisted_2 = {
27496
27496
  key: 3,
27497
27497
  class: "d-flex mx-2 ga-1"
27498
27498
  };
27499
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
27499
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
27500
27500
  __name: "AccordionItem",
27501
27501
  props: {
27502
27502
  item: {},
27503
- embedTypes: {},
27503
+ allowedEmbedTypes: {},
27504
27504
  embeds: { default: () => {
27505
27505
  } },
27506
27506
  isFocused: { type: Boolean, default: false },
27507
27507
  isDisabled: { type: Boolean, default: false },
27508
27508
  isExpanded: { type: Boolean, default: false }
27509
27509
  },
27510
- emits: ["save", "expand", "delete"],
27510
+ emits: ["save", "delete"],
27511
27511
  setup(__props, { emit: emit2 }) {
27512
27512
  const props2 = __props;
27513
27513
  const eventBus = inject("$eventBus");
27514
27514
  const isEditing = ref(!props2.item.title);
27515
27515
  const form = ref();
27516
27516
  const title = ref(props2.item.title);
27517
- const isNew = computed(() => !props2.item.title);
27518
27517
  const hasElements = computed(() => !isEmpty$1(props2.embeds));
27519
27518
  const cancel = () => {
27520
- if (isNew.value)
27521
- return emit2("delete");
27522
27519
  title.value = props2.item.title;
27523
27520
  isEditing.value = false;
27524
27521
  };
@@ -27530,8 +27527,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
27530
27527
  isEditing.value = false;
27531
27528
  const item = { ...props2.item, title: title.value };
27532
27529
  emit2("save", { item, embeds: props2.embeds });
27533
- if (isNew.value)
27534
- emit2("expand");
27535
27530
  };
27536
27531
  const saveEmbed = (embeds) => {
27537
27532
  const item = cloneDeep$1(props2.item);
@@ -27567,8 +27562,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
27567
27562
  const _component_VExpansionPanel = resolveComponent("VExpansionPanel");
27568
27563
  const _directive_tooltip = resolveDirective("tooltip");
27569
27564
  return openBlock(), createBlock(_component_VExpansionPanel, {
27570
- "hide-actions": isNew.value,
27571
- readonly: isNew.value,
27572
27565
  value: _ctx.item.id
27573
27566
  }, {
27574
27567
  default: withCtx(() => [
@@ -27577,7 +27570,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
27577
27570
  createVNode(_component_VExpansionPanelTitle, mergeProps(hoverProps, {
27578
27571
  class: "pa-2 pr-4",
27579
27572
  color: "primary-lighten-5",
27580
- "min-height": "56"
27573
+ "min-height": "64"
27581
27574
  }), {
27582
27575
  default: withCtx(() => [
27583
27576
  createVNode(_component_VForm, {
@@ -27611,7 +27604,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
27611
27604
  }, ["stop"])),
27612
27605
  onKeyup: _cache[3] || (_cache[3] = withKeys(withModifiers(() => {
27613
27606
  }, ["prevent"]), ["space"]))
27614
- }, null, 8, ["modelValue", "rules"])) : (openBlock(), createElementBlock("div", _hoisted_1$1, toDisplayString(_ctx.item.title), 1)),
27607
+ }, null, 8, ["modelValue", "rules"])) : (openBlock(), createElementBlock("div", _hoisted_1$2, toDisplayString(_ctx.item.title), 1)),
27615
27608
  createVNode(_component_VSpacer),
27616
27609
  !_ctx.isDisabled ? (openBlock(), createElementBlock("div", _hoisted_2, [
27617
27610
  isEditing.value ? (openBlock(), createElementBlock(Fragment$1, { key: 0 }, [
@@ -27688,7 +27681,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
27688
27681
  createVNode(_component_TailorEmbeddedContainer, {
27689
27682
  container: { embeds: _ctx.embeds },
27690
27683
  "is-disabled": _ctx.isDisabled,
27691
- types: _ctx.embedTypes,
27684
+ types: _ctx.allowedEmbedTypes,
27692
27685
  onDelete: deleteEmbed,
27693
27686
  onSave: _cache[6] || (_cache[6] = ($event) => saveEmbed($event.embeds))
27694
27687
  }, null, 8, ["container", "is-disabled", "types"])
@@ -27697,24 +27690,25 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
27697
27690
  })
27698
27691
  ]),
27699
27692
  _: 1
27700
- }, 8, ["hide-actions", "readonly", "value"]);
27693
+ }, 8, ["value"]);
27701
27694
  };
27702
27695
  }
27703
27696
  });
27704
- const AccordionItem_vue_vue_type_style_index_0_scoped_53dcf74b_lang = "";
27705
- const AccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-53dcf74b"]]);
27706
- const _hoisted_1 = { class: "tce-accordion d-flex flex-column align-center text-center" };
27707
- const _sfc_main = /* @__PURE__ */ defineComponent({
27697
+ const AccordionItem_vue_vue_type_style_index_0_scoped_2e9fbd32_lang = "";
27698
+ const AccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-2e9fbd32"]]);
27699
+ const _hoisted_1$1 = { class: "tce-accordion d-flex flex-column align-center text-center" };
27700
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
27708
27701
  __name: "Edit",
27709
27702
  props: {
27710
27703
  element: {},
27711
- embedTypes: {},
27704
+ allowedEmbedTypes: {},
27712
27705
  isFocused: { type: Boolean },
27713
27706
  isDisabled: { type: Boolean }
27714
27707
  },
27715
27708
  emits: ["save", "link"],
27716
27709
  setup(__props, { emit: emit2 }) {
27717
27710
  const props2 = __props;
27711
+ const elementBus = inject("$elementBus");
27718
27712
  const expanded = ref([]);
27719
27713
  const elementData = reactive(cloneDeep$1(props2.element.data));
27720
27714
  const panels = ref();
@@ -27725,10 +27719,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27725
27719
  return acc;
27726
27720
  }, {})
27727
27721
  );
27728
- const add2 = () => {
27729
- const id = createId_1();
27730
- elementData.items.push({ id, elementIds: [] });
27731
- };
27732
27722
  const saveItem = ({ item, embeds = {} }, index2) => {
27733
27723
  elementData.items[index2] = item;
27734
27724
  Object.assign(elementData.embeds, embeds);
@@ -27756,20 +27746,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27756
27746
  }
27757
27747
  });
27758
27748
  });
27749
+ elementBus.on("add", () => {
27750
+ const id = createId_1();
27751
+ elementData.items.push({ id, title: "Title", elementIds: [] });
27752
+ expanded.value.push(id);
27753
+ emit2("save", elementData);
27754
+ });
27759
27755
  onBeforeUnmount(() => {
27760
27756
  sortable.value.destroy();
27761
27757
  });
27762
27758
  return (_ctx, _cache) => {
27763
27759
  const _component_VExpandTransition = resolveComponent("VExpandTransition");
27764
27760
  const _component_VExpansionPanels = resolveComponent("VExpansionPanels");
27765
- const _component_VBtn = resolveComponent("VBtn");
27766
- return openBlock(), createElementBlock("div", _hoisted_1, [
27761
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
27767
27762
  createVNode(_component_VExpansionPanels, {
27768
27763
  ref_key: "panels",
27769
27764
  ref: panels,
27770
27765
  modelValue: expanded.value,
27771
27766
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => expanded.value = $event),
27772
- elevation: "0",
27773
27767
  rounded: "lg",
27774
27768
  multiple: ""
27775
27769
  }, {
@@ -27782,7 +27776,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27782
27776
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(elementData.items, (item, index2) => {
27783
27777
  return openBlock(), createBlock(AccordionItem, {
27784
27778
  key: item.id,
27785
- "embed-types": _ctx.embedTypes,
27779
+ "allowed-embed-types": _ctx.allowedEmbedTypes,
27786
27780
  embeds: embedsByItem.value[item.id],
27787
27781
  "is-disabled": _ctx.isDisabled,
27788
27782
  "is-expanded": expanded.value.includes(item.id),
@@ -27791,7 +27785,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27791
27785
  onDelete: ($event) => deleteItem(item.id, index2),
27792
27786
  onExpand: ($event) => expanded.value.push(item.id),
27793
27787
  onSave: ($event) => saveItem($event, index2)
27794
- }, null, 8, ["embed-types", "embeds", "is-disabled", "is-expanded", "is-focused", "item", "onDelete", "onExpand", "onSave"]);
27788
+ }, null, 8, ["allowed-embed-types", "embeds", "is-disabled", "is-expanded", "is-focused", "item", "onDelete", "onExpand", "onSave"]);
27795
27789
  }), 128))
27796
27790
  ]),
27797
27791
  _: 1
@@ -27799,39 +27793,51 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27799
27793
  ]),
27800
27794
  _: 1
27801
27795
  }, 8, ["modelValue"]),
27802
- !elementData.items.length ? (openBlock(), createBlock(unref(_sfc_main$2), {
27796
+ !elementData.items.length ? (openBlock(), createBlock(unref(_sfc_main$3), {
27803
27797
  key: 0,
27804
27798
  icon: unref(src_default).ui.icon,
27805
27799
  "is-disabled": _ctx.isDisabled,
27806
27800
  "is-focused": _ctx.isFocused,
27807
27801
  name: `${unref(src_default).name} component`,
27808
- "active-icon": "mdi-arrow-down",
27809
- "active-placeholder": "Click the button below to create the first item"
27810
- }, null, 8, ["icon", "is-disabled", "is-focused", "name"])) : createCommentVNode("", true),
27811
- !_ctx.isDisabled ? (openBlock(), createBlock(_component_VBtn, {
27812
- key: 1,
27813
- class: "mt-6",
27802
+ "active-icon": "mdi-arrow-up",
27803
+ "active-placeholder": "Use toolbar to create the first item"
27804
+ }, null, 8, ["icon", "is-disabled", "is-focused", "name"])) : createCommentVNode("", true)
27805
+ ]);
27806
+ };
27807
+ }
27808
+ });
27809
+ const Edit_vue_vue_type_style_index_0_scoped_28a6b1bd_lang = "";
27810
+ const Edit = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-28a6b1bd"]]);
27811
+ const _hoisted_1 = { class: "d-flex align-center justify-center" };
27812
+ const _sfc_main = /* @__PURE__ */ defineComponent({
27813
+ __name: "TopToolbar",
27814
+ setup(__props) {
27815
+ const elementBus = inject("$elementBus");
27816
+ return (_ctx, _cache) => {
27817
+ const _component_VBtn = resolveComponent("VBtn");
27818
+ return openBlock(), createElementBlock("div", _hoisted_1, [
27819
+ createVNode(_component_VBtn, {
27814
27820
  color: "primary-darken-4",
27815
27821
  "prepend-icon": "mdi-plus",
27816
27822
  variant: "text",
27817
- onClick: add2
27823
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(elementBus).emit("add"))
27818
27824
  }, {
27819
27825
  default: withCtx(() => [
27820
27826
  createTextVNode(" Add accordion item ")
27821
27827
  ]),
27822
27828
  _: 1
27823
- })) : createCommentVNode("", true)
27829
+ })
27824
27830
  ]);
27825
27831
  };
27826
27832
  }
27827
27833
  });
27828
- const Edit_vue_vue_type_style_index_0_scoped_6ca5c55f_lang = "";
27829
- const Edit = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6ca5c55f"]]);
27830
27834
  const manifest = {
27831
27835
  ...src_default,
27832
- Edit
27836
+ Edit,
27837
+ TopToolbar: _sfc_main
27833
27838
  };
27834
27839
  export {
27835
27840
  Edit,
27841
+ _sfc_main as TopToolbar,
27836
27842
  manifest as default
27837
27843
  };