@bagelink/vue 0.0.374 → 0.0.384

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.cjs CHANGED
@@ -4793,7 +4793,7 @@ class Bagel {
4793
4793
  async uploadFile(file, options) {
4794
4794
  const formData = new FormData();
4795
4795
  formData.append("file", file);
4796
- const { data: data2 } = await axios.post("/files/upload", formData, {
4796
+ const { data: data2 } = await axios.post("/static_files/upload", formData, {
4797
4797
  headers: {
4798
4798
  "Content-Type": "multipart/form-data"
4799
4799
  },
@@ -4964,7 +4964,7 @@ function frmRow(...children2) {
4964
4964
  children: children2
4965
4965
  };
4966
4966
  }
4967
- const BagelFormUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4967
+ const bagelFormUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4968
4968
  __proto__: null,
4969
4969
  frmRow,
4970
4970
  numField,
@@ -5042,7 +5042,7 @@ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
5042
5042
  });
5043
5043
  const _hoisted_1$E = { class: "full-nav" };
5044
5044
  const _hoisted_2$x = { class: "nav-scroll" };
5045
- const _hoisted_3$m = { class: "nav-links-wrapper" };
5045
+ const _hoisted_3$l = { class: "nav-links-wrapper" };
5046
5046
  const _hoisted_4$e = { class: "tooltip" };
5047
5047
  const _hoisted_5$b = { class: "bot-buttons-wrapper" };
5048
5048
  const _hoisted_6$7 = { class: "tooltip" };
@@ -5077,7 +5077,7 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
5077
5077
  ], 32),
5078
5078
  vue.createElementVNode("div", _hoisted_1$E, [
5079
5079
  vue.createElementVNode("div", _hoisted_2$x, [
5080
- vue.createElementVNode("div", _hoisted_3$m, [
5080
+ vue.createElementVNode("div", _hoisted_3$l, [
5081
5081
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.links, (link) => {
5082
5082
  return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(link.to ? "router-link" : "div"), {
5083
5083
  class: "nav-button",
@@ -5257,6 +5257,7 @@ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
5257
5257
  props: {
5258
5258
  side: { type: Boolean },
5259
5259
  title: {},
5260
+ width: {},
5260
5261
  dismissable: { type: Boolean },
5261
5262
  actions: {},
5262
5263
  visible: { type: Boolean }
@@ -5265,14 +5266,26 @@ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
5265
5266
  setup(__props, { expose: __expose, emit: __emit }) {
5266
5267
  const props2 = __props;
5267
5268
  let isVisible = vue.ref(false);
5268
- vue.watch(() => props2.visible, (val) => {
5269
- if (val === isVisible.value || val === void 0)
5270
- return;
5271
- if (val)
5272
- openModal();
5273
- else
5274
- closeModal();
5275
- }, { immediate: true });
5269
+ vue.watch(
5270
+ () => props2.visible,
5271
+ (val) => {
5272
+ if (val === isVisible.value || val === void 0)
5273
+ return;
5274
+ if (val)
5275
+ openModal();
5276
+ else
5277
+ closeModal();
5278
+ },
5279
+ { immediate: true }
5280
+ );
5281
+ const maxWidth = vue.computed(() => {
5282
+ const { width } = props2;
5283
+ if (width == null ? void 0 : width.match(/px|em|rem|vw|vh|%/))
5284
+ return { "max-width": width };
5285
+ if (width == null ? void 0 : width.match(/\d+/))
5286
+ return { "max-width": `${width}px` };
5287
+ return { "max-width": "720px" };
5288
+ });
5276
5289
  const emit2 = __emit;
5277
5290
  const closeModal = () => {
5278
5291
  isVisible.value = false;
@@ -5296,7 +5309,8 @@ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
5296
5309
  vue.createVNode(vue.unref(_sfc_main$u), {
5297
5310
  class: "modal",
5298
5311
  onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
5299
- }, ["stop"]))
5312
+ }, ["stop"])),
5313
+ style: vue.normalizeStyle({ ...maxWidth.value })
5300
5314
  }, {
5301
5315
  default: vue.withCtx(() => [
5302
5316
  vue.createElementVNode("header", _hoisted_1$C, [
@@ -5327,7 +5341,7 @@ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
5327
5341
  ])
5328
5342
  ]),
5329
5343
  _: 3
5330
- })
5344
+ }, 8, ["style"])
5331
5345
  ], 34);
5332
5346
  };
5333
5347
  }
@@ -5337,6 +5351,7 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
5337
5351
  props: /* @__PURE__ */ vue.mergeModels({
5338
5352
  side: { type: Boolean },
5339
5353
  title: {},
5354
+ width: {},
5340
5355
  dismissable: { type: Boolean },
5341
5356
  actions: {},
5342
5357
  schema: { type: Function },
@@ -5346,7 +5361,9 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
5346
5361
  onError: { type: Function },
5347
5362
  modelValue: {}
5348
5363
  }, {
5349
- "modelValue": { default: {} },
5364
+ "modelValue": {
5365
+ default: {}
5366
+ },
5350
5367
  "modelModifiers": {}
5351
5368
  }),
5352
5369
  emits: ["update:modelValue"],
@@ -5394,6 +5411,7 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
5394
5411
  side: _ctx.side,
5395
5412
  ref_key: "modal",
5396
5413
  ref: modal,
5414
+ width: _ctx.width,
5397
5415
  dismissable: _ctx.dismissable,
5398
5416
  title: _ctx.title
5399
5417
  }, vue.createSlots({
@@ -5436,14 +5454,14 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
5436
5454
  ]),
5437
5455
  key: "0"
5438
5456
  } : void 0
5439
- ]), 1032, ["onOnUpdate:isModalVisible", "side", "dismissable", "title"]);
5457
+ ]), 1032, ["onOnUpdate:isModalVisible", "side", "width", "dismissable", "title"]);
5440
5458
  };
5441
5459
  }
5442
5460
  });
5443
- const ModalForm = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-7e6899c7"]]);
5461
+ const ModalForm = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-204f5236"]]);
5444
5462
  const _hoisted_1$B = { class: "accordion-item" };
5445
5463
  const _hoisted_2$u = ["aria-expanded", "aria-controls"];
5446
- const _hoisted_3$l = { class: "accordion-label" };
5464
+ const _hoisted_3$k = { class: "accordion-label" };
5447
5465
  const _hoisted_4$d = ["id", "aria-hidden"];
5448
5466
  const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
5449
5467
  __name: "AccordionItem",
@@ -5476,7 +5494,7 @@ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
5476
5494
  class: "accordion-head",
5477
5495
  "aria-controls": `accordion-body-${vue.unref(id)}`
5478
5496
  }, [
5479
- vue.createElementVNode("span", _hoisted_3$l, vue.toDisplayString(_ctx.label), 1),
5497
+ vue.createElementVNode("span", _hoisted_3$k, vue.toDisplayString(_ctx.label), 1),
5480
5498
  vue.createElementVNode("div", {
5481
5499
  class: vue.normalizeClass(["accordion-icon", { open: vue.unref(open) }])
5482
5500
  }, [
@@ -5503,7 +5521,7 @@ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
5503
5521
  const AccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-bf74738b"]]);
5504
5522
  const _hoisted_1$A = { class: "list-wrap bgl_card thin grid overflow-hidden h-100 p-0" };
5505
5523
  const _hoisted_2$t = { class: "p-1" };
5506
- const _hoisted_3$k = { class: "list-content auto-flow-rows align-items-start overflow-y h-100" };
5524
+ const _hoisted_3$j = { class: "list-content auto-flow-rows align-items-start overflow-y h-100" };
5507
5525
  const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
5508
5526
  __name: "ListView",
5509
5527
  setup(__props) {
@@ -5512,7 +5530,7 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
5512
5530
  vue.createElementVNode("div", _hoisted_2$t, [
5513
5531
  vue.renderSlot(_ctx.$slots, "header")
5514
5532
  ]),
5515
- vue.createElementVNode("div", _hoisted_3$k, [
5533
+ vue.createElementVNode("div", _hoisted_3$j, [
5516
5534
  vue.renderSlot(_ctx.$slots, "default")
5517
5535
  ])
5518
5536
  ]);
@@ -5583,7 +5601,7 @@ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
5583
5601
  });
5584
5602
  const _hoisted_1$x = { class: "table-list-wrap h-100" };
5585
5603
  const _hoisted_2$q = { class: "infinite-wrapper" };
5586
- const _hoisted_3$j = { class: "row first-row" };
5604
+ const _hoisted_3$i = { class: "row first-row" };
5587
5605
  const _hoisted_4$c = ["onClick"];
5588
5606
  const _hoisted_5$a = { class: "flex" };
5589
5607
  const _hoisted_6$6 = ["onClick"];
@@ -5624,7 +5642,7 @@ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
5624
5642
  return (_ctx, _cache) => {
5625
5643
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$x, [
5626
5644
  vue.createElementVNode("table", _hoisted_2$q, [
5627
- vue.createElementVNode("thead", _hoisted_3$j, [
5645
+ vue.createElementVNode("thead", _hoisted_3$i, [
5628
5646
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(computedSchema.value, (field) => {
5629
5647
  return vue.openBlock(), vue.createElementBlock("th", {
5630
5648
  class: "col",
@@ -5720,7 +5738,7 @@ const _hoisted_2$p = {
5720
5738
  key: 0,
5721
5739
  class: "data-row"
5722
5740
  };
5723
- const _hoisted_3$i = { class: "key" };
5741
+ const _hoisted_3$h = { class: "key" };
5724
5742
  const _hoisted_4$b = { key: 1 };
5725
5743
  const _hoisted_5$9 = { class: "key" };
5726
5744
  const _hoisted_6$5 = { class: "vlue" };
@@ -5748,7 +5766,7 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
5748
5766
  key: field.id
5749
5767
  }, [
5750
5768
  vue.unref(iffer)(field, itemData.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$p, [
5751
- vue.createElementVNode("div", _hoisted_3$i, vue.toDisplayString((field == null ? void 0 : field.label) || vue.unref(keyToLabel)(field.id)), 1),
5769
+ vue.createElementVNode("div", _hoisted_3$h, vue.toDisplayString((field == null ? void 0 : field.label) || vue.unref(keyToLabel)(field.id)), 1),
5752
5770
  vue.createVNode(vue.unref(_sfc_main$l), {
5753
5771
  field,
5754
5772
  modelValue: itemData.value,
@@ -5946,9 +5964,8 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
5946
5964
  }
5947
5965
  });
5948
5966
  const Badge = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-10743b06"]]);
5949
- const _hoisted_1$r = { class: "bgl_vid" };
5950
- const _hoisted_2$n = ["src"];
5951
- const _hoisted_3$h = ["src", "autoplay", "muted", "loop", "controls"];
5967
+ const _hoisted_1$r = ["src"];
5968
+ const _hoisted_2$n = ["src", "autoplay", "muted", "loop", "controls"];
5952
5969
  const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
5953
5970
  __name: "BglVideo",
5954
5971
  props: {
@@ -5961,26 +5978,31 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
5961
5978
  },
5962
5979
  setup(__props) {
5963
5980
  const props2 = __props;
5964
- const aspectRatio = vue.computed(() => props2.aspectRatio.replace(":", "/"));
5981
+ const aspectRatio = vue.computed(
5982
+ () => {
5983
+ var _a2;
5984
+ return ((_a2 = props2.aspectRatio) == null ? void 0 : _a2.replace(":", "/")) || "16/9";
5985
+ }
5986
+ );
5965
5987
  const embedType = vue.computed(() => {
5966
5988
  const youtubeRegex = /youtube\.com|youtu\.be/;
5967
- if (youtubeRegex.test(props2.src))
5989
+ if (youtubeRegex.test(props2.src || ""))
5968
5990
  return "YouTube";
5969
5991
  const vimeoRegex = /vimeo\.com/;
5970
- if (vimeoRegex.test(props2.src))
5992
+ if (vimeoRegex.test(props2.src || ""))
5971
5993
  return "Vimeo";
5972
5994
  return null;
5973
5995
  });
5974
5996
  const videoUrl = vue.computed(() => {
5975
- var _a2, _b, _c, _d;
5997
+ var _a2, _b, _c, _d, _e2, _f;
5976
5998
  if (embedType.value) {
5977
5999
  if (embedType.value === "YouTube") {
5978
- const videoId = (_c = (_b = (_a2 = props2.src.split(/v=|youtu\.be\//)) == null ? void 0 : _a2[1]) == null ? void 0 : _b.split("&")) == null ? void 0 : _c[0];
6000
+ const videoId = (_d = (_c = (_b = (_a2 = props2.src) == null ? void 0 : _a2.split(/v=|youtu\.be\//)) == null ? void 0 : _b[1]) == null ? void 0 : _c.split("&")) == null ? void 0 : _d[0];
5979
6001
  return `https://www.youtube.com/embed/${videoId}`;
5980
6002
  }
5981
6003
  if (embedType.value === "Vimeo") {
5982
6004
  const vimeoRegex = /vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/)?(\d+)(?:$|\/|\?)/;
5983
- const videoId = (_d = props2.src.match(vimeoRegex)) == null ? void 0 : _d[3];
6005
+ const videoId = (_f = (_e2 = props2.src) == null ? void 0 : _e2.match(vimeoRegex)) == null ? void 0 : _f[3];
5984
6006
  return `https://player.vimeo.com/video/${videoId}`;
5985
6007
  }
5986
6008
  }
@@ -5988,7 +6010,9 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
5988
6010
  });
5989
6011
  console.log("Video URL:", videoUrl.value);
5990
6012
  return (_ctx, _cache) => {
5991
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$r, [
6013
+ return vue.openBlock(), vue.createElementBlock("div", {
6014
+ class: vue.normalizeClass(["bgl_vid", { vid_empty: !_ctx.src }])
6015
+ }, [
5992
6016
  embedType.value ? (vue.openBlock(), vue.createElementBlock("iframe", {
5993
6017
  key: 0,
5994
6018
  src: videoUrl.value,
@@ -5996,7 +6020,7 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
5996
6020
  frameborder: "0",
5997
6021
  allowfullscreen: "",
5998
6022
  title: "Video"
5999
- }, null, 12, _hoisted_2$n)) : (vue.openBlock(), vue.createElementBlock("video", {
6023
+ }, null, 12, _hoisted_1$r)) : _ctx.src ? (vue.openBlock(), vue.createElementBlock("video", {
6000
6024
  key: 1,
6001
6025
  src: _ctx.src,
6002
6026
  autoplay: _ctx.autoplay,
@@ -6005,12 +6029,12 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
6005
6029
  style: vue.normalizeStyle({ aspectRatio: aspectRatio.value }),
6006
6030
  controls: _ctx.controls,
6007
6031
  playsinline: ""
6008
- }, null, 12, _hoisted_3$h))
6009
- ]);
6032
+ }, null, 12, _hoisted_2$n)) : vue.createCommentVNode("", true)
6033
+ ], 2);
6010
6034
  };
6011
6035
  }
6012
6036
  });
6013
- const BglVideo = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-23835d69"]]);
6037
+ const BglVideo = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-bbfc4353"]]);
6014
6038
  const _hoisted_1$q = {
6015
6039
  key: 0,
6016
6040
  class: "blocker"
@@ -18423,7 +18447,8 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18423
18447
  label: {},
18424
18448
  multiple: { type: Boolean },
18425
18449
  files: {},
18426
- deleteEndpoint: {}
18450
+ deleteEndpoint: {},
18451
+ bindkey: {}
18427
18452
  }, {
18428
18453
  "modelValue": {},
18429
18454
  "modelModifiers": {}
@@ -18432,23 +18457,34 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18432
18457
  setup(__props) {
18433
18458
  const bagel = useBagel();
18434
18459
  const props2 = __props;
18435
- const file_ids = vue.useModel(__props, "modelValue");
18460
+ const bindKey2 = props2.bindkey || "id";
18461
+ const file_bindkeys = vue.useModel(__props, "modelValue");
18436
18462
  const storageFiles = vue.ref([]);
18437
18463
  const compareIds = (v1, v2) => [v1].flat().join(",") === [v2].flat().join(",");
18438
- vue.watch(() => props2.files, (newFiles) => {
18439
- if (newFiles)
18440
- storageFiles.value.push(...[newFiles].flat());
18441
- }, { immediate: true });
18442
- vue.watch(() => storageFiles.value, (newFiles) => {
18443
- var _a2;
18444
- let idValue = "";
18445
- if (props2.multiple)
18446
- idValue = newFiles.map((f2) => f2.id || "");
18447
- else
18448
- idValue = ((_a2 = newFiles[0]) == null ? void 0 : _a2.id) || "";
18449
- if (!compareIds(file_ids == null ? void 0 : file_ids.value, idValue))
18450
- file_ids.value = idValue;
18451
- }, { deep: true });
18464
+ vue.watch(
18465
+ () => props2.files,
18466
+ (newFiles) => {
18467
+ if (newFiles)
18468
+ storageFiles.value.push(...[newFiles].flat());
18469
+ },
18470
+ { immediate: true }
18471
+ );
18472
+ vue.watch(
18473
+ () => storageFiles.value,
18474
+ (newFiles) => {
18475
+ var _a2;
18476
+ let idValue;
18477
+ if (props2.multiple)
18478
+ idValue = newFiles.map((f2) => f2[bindKey2]);
18479
+ else {
18480
+ idValue = ((_a2 = newFiles[0]) == null ? void 0 : _a2[bindKey2]) || "";
18481
+ }
18482
+ if (!compareIds(file_bindkeys == null ? void 0 : file_bindkeys.value, idValue)) {
18483
+ file_bindkeys.value = idValue;
18484
+ }
18485
+ },
18486
+ { deep: true }
18487
+ );
18452
18488
  const fileQueue = vue.ref([]);
18453
18489
  let isDragOver = vue.ref(false);
18454
18490
  const preventDefault = (e) => {
@@ -18459,21 +18495,20 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18459
18495
  const removeFile = (file) => {
18460
18496
  const index2 = storageFiles.value.indexOf(file);
18461
18497
  storageFiles.value.splice(index2, 1);
18462
- if (props2.deleteEndpoint)
18498
+ if (props2.deleteEndpoint) {
18463
18499
  void bagel.delete(`${props2.deleteEndpoint}/${file.id}`);
18500
+ }
18464
18501
  };
18465
18502
  const flushQueue = () => {
18466
- fileQueue.value.forEach(
18467
- async (file, i2) => {
18468
- if (!props2.multiple)
18469
- storageFiles.value.splice(0, 1);
18470
- const serverFile = await bagel.uploadFile(file.file, {
18471
- onUploadProgress: (e) => file.progress = e.progress * 100 - 1
18472
- });
18473
- storageFiles.value.push(serverFile);
18474
- fileQueue.value.splice(i2, 1);
18475
- }
18476
- );
18503
+ fileQueue.value.forEach(async (file, i2) => {
18504
+ if (!props2.multiple)
18505
+ storageFiles.value.splice(0, 1);
18506
+ const serverFile = await bagel.uploadFile(file.file, {
18507
+ onUploadProgress: (e) => file.progress = e.progress * 100 - 1
18508
+ });
18509
+ storageFiles.value.push(serverFile);
18510
+ fileQueue.value.splice(i2, 1);
18511
+ });
18477
18512
  };
18478
18513
  const browse = () => {
18479
18514
  const input = document.createElement("input");
@@ -18482,7 +18517,9 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18482
18517
  input.onchange = (e) => {
18483
18518
  const target = e == null ? void 0 : e.target;
18484
18519
  if (target == null ? void 0 : target.files) {
18485
- Array.from(target.files).forEach((file) => fileQueue.value.push({ name: file.name, file, progress: 0 }));
18520
+ Array.from(target.files).forEach(
18521
+ (file) => fileQueue.value.push({ name: file.name, file, progress: 0 })
18522
+ );
18486
18523
  }
18487
18524
  flushQueue();
18488
18525
  };
@@ -18520,7 +18557,10 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18520
18557
  onDragover: dragover,
18521
18558
  onDrop: drop3,
18522
18559
  onDragleave: dragleave,
18523
- class: vue.normalizeClass(["fileUploadWrap", { fileDropZone: !storageFiles.value.length && !fileQueue.value.length, dragover: vue.unref(isDragOver) }])
18560
+ class: vue.normalizeClass(["fileUploadWrap", {
18561
+ fileDropZone: !storageFiles.value.length && !fileQueue.value.length,
18562
+ dragover: vue.unref(isDragOver)
18563
+ }])
18524
18564
  }, [
18525
18565
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(storageFiles.value, (file) => {
18526
18566
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
@@ -18590,7 +18630,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18590
18630
  };
18591
18631
  }
18592
18632
  });
18593
- const FileUpload = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-1be8d7b1"]]);
18633
+ const $el = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-0dbacaa0"]]);
18594
18634
  const _withScopeId = (n2) => (vue.pushScopeId("data-v-b87221d6"), n2 = n2(), vue.popScopeId(), n2);
18595
18635
  const _hoisted_1$e = ["title"];
18596
18636
  const _hoisted_2$b = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "slider round" }, null, -1));
@@ -33859,7 +33899,24 @@ function markPasteRule(config) {
33859
33899
  }
33860
33900
  });
33861
33901
  }
33862
- const inputRegex$4 = /^\s*>\s$/;
33902
+ function nodePasteRule(config) {
33903
+ return new PasteRule({
33904
+ find: config.find,
33905
+ handler({ match: match2, chain, range: range2, pasteEvent }) {
33906
+ const attributes = callOrReturn(config.getAttributes, void 0, match2, pasteEvent);
33907
+ if (attributes === false || attributes === null) {
33908
+ return null;
33909
+ }
33910
+ if (match2.input) {
33911
+ chain().deleteRange(range2).insertContentAt(range2.from, {
33912
+ type: config.type.name,
33913
+ attrs: attributes
33914
+ });
33915
+ }
33916
+ }
33917
+ });
33918
+ }
33919
+ const inputRegex$5 = /^\s*>\s$/;
33863
33920
  const Blockquote = Node$2.create({
33864
33921
  name: "blockquote",
33865
33922
  addOptions() {
@@ -33899,7 +33956,7 @@ const Blockquote = Node$2.create({
33899
33956
  addInputRules() {
33900
33957
  return [
33901
33958
  wrappingInputRule({
33902
- find: inputRegex$4,
33959
+ find: inputRegex$5,
33903
33960
  type: this.type
33904
33961
  })
33905
33962
  ];
@@ -34044,7 +34101,7 @@ const TextStyle$1 = Mark.create({
34044
34101
  };
34045
34102
  }
34046
34103
  });
34047
- const inputRegex$3 = /^\s*([-+*])\s$/;
34104
+ const inputRegex$4 = /^\s*([-+*])\s$/;
34048
34105
  const BulletList = Node$2.create({
34049
34106
  name: "bulletList",
34050
34107
  addOptions() {
@@ -34084,12 +34141,12 @@ const BulletList = Node$2.create({
34084
34141
  },
34085
34142
  addInputRules() {
34086
34143
  let inputRule = wrappingInputRule({
34087
- find: inputRegex$3,
34144
+ find: inputRegex$4,
34088
34145
  type: this.type
34089
34146
  });
34090
34147
  if (this.options.keepMarks || this.options.keepAttributes) {
34091
34148
  inputRule = wrappingInputRule({
34092
- find: inputRegex$3,
34149
+ find: inputRegex$4,
34093
34150
  type: this.type,
34094
34151
  keepMarks: this.options.keepMarks,
34095
34152
  keepAttributes: this.options.keepAttributes,
@@ -34104,7 +34161,7 @@ const BulletList = Node$2.create({
34104
34161
  ];
34105
34162
  }
34106
34163
  });
34107
- const inputRegex$2 = /(?:^|\s)((?:`)((?:[^`]+))(?:`))$/;
34164
+ const inputRegex$3 = /(?:^|\s)((?:`)((?:[^`]+))(?:`))$/;
34108
34165
  const pasteRegex$1 = /(?:^|\s)((?:`)((?:[^`]+))(?:`))/g;
34109
34166
  const Code = Mark.create({
34110
34167
  name: "code",
@@ -34145,7 +34202,7 @@ const Code = Mark.create({
34145
34202
  addInputRules() {
34146
34203
  return [
34147
34204
  markInputRule({
34148
- find: inputRegex$2,
34205
+ find: inputRegex$3,
34149
34206
  type: this.type
34150
34207
  })
34151
34208
  ];
@@ -35633,7 +35690,7 @@ const TextStyle = Mark.create({
35633
35690
  };
35634
35691
  }
35635
35692
  });
35636
- const inputRegex$1 = /^(\d+)\.\s$/;
35693
+ const inputRegex$2 = /^(\d+)\.\s$/;
35637
35694
  const OrderedList = Node$2.create({
35638
35695
  name: "orderedList",
35639
35696
  addOptions() {
@@ -35686,14 +35743,14 @@ const OrderedList = Node$2.create({
35686
35743
  },
35687
35744
  addInputRules() {
35688
35745
  let inputRule = wrappingInputRule({
35689
- find: inputRegex$1,
35746
+ find: inputRegex$2,
35690
35747
  type: this.type,
35691
35748
  getAttributes: (match2) => ({ start: +match2[1] }),
35692
35749
  joinPredicate: (match2, node) => node.childCount + node.attrs.start === +match2[1]
35693
35750
  });
35694
35751
  if (this.options.keepMarks || this.options.keepAttributes) {
35695
35752
  inputRule = wrappingInputRule({
35696
- find: inputRegex$1,
35753
+ find: inputRegex$2,
35697
35754
  type: this.type,
35698
35755
  keepMarks: this.options.keepMarks,
35699
35756
  keepAttributes: this.options.keepAttributes,
@@ -35738,7 +35795,7 @@ const Paragraph = Node$2.create({
35738
35795
  };
35739
35796
  }
35740
35797
  });
35741
- const inputRegex = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/;
35798
+ const inputRegex$1 = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/;
35742
35799
  const pasteRegex = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g;
35743
35800
  const Strike = Mark.create({
35744
35801
  name: "strike",
@@ -35793,7 +35850,7 @@ const Strike = Mark.create({
35793
35850
  addInputRules() {
35794
35851
  return [
35795
35852
  markInputRule({
35796
- find: inputRegex,
35853
+ find: inputRegex$1,
35797
35854
  type: this.type
35798
35855
  })
35799
35856
  ];
@@ -39085,6 +39142,285 @@ vue.defineComponent({
39085
39142
  }, (_b = (_a2 = this.$slots).default) === null || _b === void 0 ? void 0 : _b.call(_a2));
39086
39143
  }
39087
39144
  });
39145
+ const inputRegex = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
39146
+ const Image = Node$2.create({
39147
+ name: "image",
39148
+ addOptions() {
39149
+ return {
39150
+ inline: false,
39151
+ allowBase64: false,
39152
+ HTMLAttributes: {}
39153
+ };
39154
+ },
39155
+ inline() {
39156
+ return this.options.inline;
39157
+ },
39158
+ group() {
39159
+ return this.options.inline ? "inline" : "block";
39160
+ },
39161
+ draggable: true,
39162
+ addAttributes() {
39163
+ return {
39164
+ src: {
39165
+ default: null
39166
+ },
39167
+ alt: {
39168
+ default: null
39169
+ },
39170
+ title: {
39171
+ default: null
39172
+ }
39173
+ };
39174
+ },
39175
+ parseHTML() {
39176
+ return [
39177
+ {
39178
+ tag: this.options.allowBase64 ? "img[src]" : 'img[src]:not([src^="data:"])'
39179
+ }
39180
+ ];
39181
+ },
39182
+ renderHTML({ HTMLAttributes }) {
39183
+ return ["img", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
39184
+ },
39185
+ addCommands() {
39186
+ return {
39187
+ setImage: (options) => ({ commands: commands2 }) => {
39188
+ return commands2.insertContent({
39189
+ type: this.name,
39190
+ attrs: options
39191
+ });
39192
+ }
39193
+ };
39194
+ },
39195
+ addInputRules() {
39196
+ return [
39197
+ nodeInputRule({
39198
+ find: inputRegex,
39199
+ type: this.type,
39200
+ getAttributes: (match2) => {
39201
+ const [, , alt, src, title] = match2;
39202
+ return { src, alt, title };
39203
+ }
39204
+ })
39205
+ ];
39206
+ }
39207
+ });
39208
+ const YOUTUBE_REGEX = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?!channel\/)(?!@)(.+)?$/;
39209
+ const YOUTUBE_REGEX_GLOBAL = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/g;
39210
+ const isValidYoutubeUrl = (url) => {
39211
+ return url.match(YOUTUBE_REGEX);
39212
+ };
39213
+ const getYoutubeEmbedUrl = (nocookie) => {
39214
+ return nocookie ? "https://www.youtube-nocookie.com/embed/" : "https://www.youtube.com/embed/";
39215
+ };
39216
+ const getEmbedUrlFromYoutubeUrl = (options) => {
39217
+ const { url, allowFullscreen, autoplay, ccLanguage, ccLoadPolicy, controls, disableKBcontrols, enableIFrameApi, endTime, interfaceLanguage, ivLoadPolicy, loop, modestBranding, nocookie, origin, playlist, progressBarColor, startAt } = options;
39218
+ if (!isValidYoutubeUrl(url)) {
39219
+ return null;
39220
+ }
39221
+ if (url.includes("/embed/")) {
39222
+ return url;
39223
+ }
39224
+ if (url.includes("youtu.be")) {
39225
+ const id = url.split("/").pop();
39226
+ if (!id) {
39227
+ return null;
39228
+ }
39229
+ return `${getYoutubeEmbedUrl(nocookie)}${id}`;
39230
+ }
39231
+ const videoIdRegex = /(?:v=|shorts\/)([-\w]+)/gm;
39232
+ const matches2 = videoIdRegex.exec(url);
39233
+ if (!matches2 || !matches2[1]) {
39234
+ return null;
39235
+ }
39236
+ let outputUrl = `${getYoutubeEmbedUrl(nocookie)}${matches2[1]}`;
39237
+ const params = [];
39238
+ if (allowFullscreen === false) {
39239
+ params.push("fs=0");
39240
+ }
39241
+ if (autoplay) {
39242
+ params.push("autoplay=1");
39243
+ }
39244
+ if (ccLanguage) {
39245
+ params.push(`cc_lang_pref=${ccLanguage}`);
39246
+ }
39247
+ if (ccLoadPolicy) {
39248
+ params.push("cc_load_policy=1");
39249
+ }
39250
+ if (!controls) {
39251
+ params.push("controls=0");
39252
+ }
39253
+ if (disableKBcontrols) {
39254
+ params.push("disablekb=1");
39255
+ }
39256
+ if (enableIFrameApi) {
39257
+ params.push("enablejsapi=1");
39258
+ }
39259
+ if (endTime) {
39260
+ params.push(`end=${endTime}`);
39261
+ }
39262
+ if (interfaceLanguage) {
39263
+ params.push(`hl=${interfaceLanguage}`);
39264
+ }
39265
+ if (ivLoadPolicy) {
39266
+ params.push(`iv_load_policy=${ivLoadPolicy}`);
39267
+ }
39268
+ if (loop) {
39269
+ params.push("loop=1");
39270
+ }
39271
+ if (modestBranding) {
39272
+ params.push("modestbranding=1");
39273
+ }
39274
+ if (origin) {
39275
+ params.push(`origin=${origin}`);
39276
+ }
39277
+ if (playlist) {
39278
+ params.push(`playlist=${playlist}`);
39279
+ }
39280
+ if (startAt) {
39281
+ params.push(`start=${startAt}`);
39282
+ }
39283
+ if (progressBarColor) {
39284
+ params.push(`color=${progressBarColor}`);
39285
+ }
39286
+ if (params.length) {
39287
+ outputUrl += `?${params.join("&")}`;
39288
+ }
39289
+ return outputUrl;
39290
+ };
39291
+ const Youtube = Node$2.create({
39292
+ name: "youtube",
39293
+ addOptions() {
39294
+ return {
39295
+ addPasteHandler: true,
39296
+ allowFullscreen: true,
39297
+ autoplay: false,
39298
+ ccLanguage: void 0,
39299
+ ccLoadPolicy: void 0,
39300
+ controls: true,
39301
+ disableKBcontrols: false,
39302
+ enableIFrameApi: false,
39303
+ endTime: 0,
39304
+ height: 480,
39305
+ interfaceLanguage: void 0,
39306
+ ivLoadPolicy: 0,
39307
+ loop: false,
39308
+ modestBranding: false,
39309
+ HTMLAttributes: {},
39310
+ inline: false,
39311
+ nocookie: false,
39312
+ origin: "",
39313
+ playlist: "",
39314
+ progressBarColor: void 0,
39315
+ width: 640
39316
+ };
39317
+ },
39318
+ inline() {
39319
+ return this.options.inline;
39320
+ },
39321
+ group() {
39322
+ return this.options.inline ? "inline" : "block";
39323
+ },
39324
+ draggable: true,
39325
+ addAttributes() {
39326
+ return {
39327
+ src: {
39328
+ default: null
39329
+ },
39330
+ start: {
39331
+ default: 0
39332
+ },
39333
+ width: {
39334
+ default: this.options.width
39335
+ },
39336
+ height: {
39337
+ default: this.options.height
39338
+ }
39339
+ };
39340
+ },
39341
+ parseHTML() {
39342
+ return [
39343
+ {
39344
+ tag: "div[data-youtube-video] iframe"
39345
+ }
39346
+ ];
39347
+ },
39348
+ addCommands() {
39349
+ return {
39350
+ setYoutubeVideo: (options) => ({ commands: commands2 }) => {
39351
+ if (!isValidYoutubeUrl(options.src)) {
39352
+ return false;
39353
+ }
39354
+ return commands2.insertContent({
39355
+ type: this.name,
39356
+ attrs: options
39357
+ });
39358
+ }
39359
+ };
39360
+ },
39361
+ addPasteRules() {
39362
+ if (!this.options.addPasteHandler) {
39363
+ return [];
39364
+ }
39365
+ return [
39366
+ nodePasteRule({
39367
+ find: YOUTUBE_REGEX_GLOBAL,
39368
+ type: this.type,
39369
+ getAttributes: (match2) => {
39370
+ return { src: match2.input };
39371
+ }
39372
+ })
39373
+ ];
39374
+ },
39375
+ renderHTML({ HTMLAttributes }) {
39376
+ const embedUrl = getEmbedUrlFromYoutubeUrl({
39377
+ url: HTMLAttributes.src,
39378
+ allowFullscreen: this.options.allowFullscreen,
39379
+ autoplay: this.options.autoplay,
39380
+ ccLanguage: this.options.ccLanguage,
39381
+ ccLoadPolicy: this.options.ccLoadPolicy,
39382
+ controls: this.options.controls,
39383
+ disableKBcontrols: this.options.disableKBcontrols,
39384
+ enableIFrameApi: this.options.enableIFrameApi,
39385
+ endTime: this.options.endTime,
39386
+ interfaceLanguage: this.options.interfaceLanguage,
39387
+ ivLoadPolicy: this.options.ivLoadPolicy,
39388
+ loop: this.options.loop,
39389
+ modestBranding: this.options.modestBranding,
39390
+ nocookie: this.options.nocookie,
39391
+ origin: this.options.origin,
39392
+ playlist: this.options.playlist,
39393
+ progressBarColor: this.options.progressBarColor,
39394
+ startAt: HTMLAttributes.start || 0
39395
+ });
39396
+ HTMLAttributes.src = embedUrl;
39397
+ return [
39398
+ "div",
39399
+ { "data-youtube-video": "" },
39400
+ [
39401
+ "iframe",
39402
+ mergeAttributes(this.options.HTMLAttributes, {
39403
+ width: this.options.width,
39404
+ height: this.options.height,
39405
+ allowfullscreen: this.options.allowFullscreen,
39406
+ autoplay: this.options.autoplay,
39407
+ ccLanguage: this.options.ccLanguage,
39408
+ ccLoadPolicy: this.options.ccLoadPolicy,
39409
+ disableKBcontrols: this.options.disableKBcontrols,
39410
+ enableIFrameApi: this.options.enableIFrameApi,
39411
+ endTime: this.options.endTime,
39412
+ interfaceLanguage: this.options.interfaceLanguage,
39413
+ ivLoadPolicy: this.options.ivLoadPolicy,
39414
+ loop: this.options.loop,
39415
+ modestBranding: this.options.modestBranding,
39416
+ origin: this.options.origin,
39417
+ playlist: this.options.playlist,
39418
+ progressBarColor: this.options.progressBarColor
39419
+ }, HTMLAttributes)
39420
+ ]
39421
+ ];
39422
+ }
39423
+ });
39088
39424
  const _hoisted_1$d = { class: "RichText" };
39089
39425
  const _hoisted_2$a = {
39090
39426
  key: 0,
@@ -39097,6 +39433,7 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
39097
39433
  },
39098
39434
  emits: ["update:modelValue"],
39099
39435
  setup(__props, { emit: __emit }) {
39436
+ const { txtField: txtField2 } = bagelFormUtils;
39100
39437
  let editor = vue.ref();
39101
39438
  const props2 = __props;
39102
39439
  const focus2 = () => {
@@ -39104,6 +39441,18 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
39104
39441
  throw new Error("editor is not defined");
39105
39442
  return editor.value.chain().focus();
39106
39443
  };
39444
+ const { showModalForm } = useModal();
39445
+ function addImage() {
39446
+ showModalForm({
39447
+ title: "Add Image",
39448
+ schema: [
39449
+ txtField2("title", "Title"),
39450
+ { $el, id: "src", attrs: { bindkey: "url" } },
39451
+ txtField2("alt", "Alt Text")
39452
+ ],
39453
+ onSubmit: (imgObj) => focus2().setImage(imgObj).run()
39454
+ });
39455
+ }
39107
39456
  const config = [
39108
39457
  {
39109
39458
  name: "Bold",
@@ -39140,11 +39489,31 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
39140
39489
  command: () => focus2().toggleCode().run(),
39141
39490
  icon: "code"
39142
39491
  },
39143
- // {
39144
- // name: 'clearMarks',
39145
- // command: () => focus().unsetAllMarks(),
39146
- // icon: 'clear',
39147
- // },
39492
+ {
39493
+ name: "Image",
39494
+ command: addImage,
39495
+ icon: "image"
39496
+ },
39497
+ {
39498
+ name: "YouTube",
39499
+ command: () => {
39500
+ showModalForm({
39501
+ title: "Add YouTube Video",
39502
+ schema: [
39503
+ txtField2("src", "YouTube URL"),
39504
+ {
39505
+ $el: BglVideo,
39506
+ attrs: { src: (_2, { src }) => src || "" }
39507
+ }
39508
+ ],
39509
+ onSubmit: (videoObj) => {
39510
+ var _a2;
39511
+ return (_a2 = editor.value) == null ? void 0 : _a2.commands.setYoutubeVideo(videoObj);
39512
+ }
39513
+ });
39514
+ },
39515
+ icon: "youtube_activity"
39516
+ },
39148
39517
  {
39149
39518
  name: "Clear",
39150
39519
  command: () => focus2().clearNodes().run(),
@@ -39243,7 +39612,7 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
39243
39612
  const emit2 = __emit;
39244
39613
  function initEditor() {
39245
39614
  editor.value = new Editor({
39246
- extensions: [StarterKit],
39615
+ extensions: [StarterKit, Image, Youtube],
39247
39616
  content: props2.modelValue,
39248
39617
  onUpdate: ({ editor: editor2 }) => emit2("update:modelValue", editor2.getHTML())
39249
39618
  });
@@ -39270,6 +39639,7 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
39270
39639
  (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(config, (item) => {
39271
39640
  var _a2;
39272
39641
  return vue.withDirectives(vue.createVNode(vue.unref(Btn), {
39642
+ tabindex: "-1",
39273
39643
  flat: !vue.unref(editor).isActive(item.name, item.option),
39274
39644
  onClick: item.command,
39275
39645
  thin: "",
@@ -45986,7 +46356,7 @@ exports.DataPreview = DataPreview;
45986
46356
  exports.DateInput = _sfc_main$j;
45987
46357
  exports.DatePicker = _sfc_main$c;
45988
46358
  exports.Dropdown = kt$1;
45989
- exports.FileUpload = FileUpload;
46359
+ exports.FileUpload = $el;
45990
46360
  exports.Icon = _sfc_main$H;
45991
46361
  exports.JSONInput = JSONInput;
45992
46362
  exports.Layout = Layout;
@@ -46014,7 +46384,7 @@ exports.TextInput = TextInput;
46014
46384
  exports.Title = _sfc_main$s;
46015
46385
  exports.ToggleInput = ToggleInput;
46016
46386
  exports.TopBar = TopBar;
46017
- exports.bagelFormUtils = BagelFormUtils;
46387
+ exports.bagelFormUtils = bagelFormUtils;
46018
46388
  exports.bagelInjectionKey = bagelInjectionKey;
46019
46389
  exports.bindAttrs = bindAttrs;
46020
46390
  exports.classify = classify;