@bagelink/vue 0.0.378 → 0.0.390

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
@@ -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,
@@ -5945,10 +5963,9 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
5945
5963
  };
5946
5964
  }
5947
5965
  });
5948
- 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"];
5966
+ const Badge = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-561f7a72"]]);
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"
@@ -18336,7 +18360,6 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
18336
18360
  __name: "RadioPillsInput",
18337
18361
  props: {
18338
18362
  options: {},
18339
- stringOptions: {},
18340
18363
  modelValue: {},
18341
18364
  id: {},
18342
18365
  label: {}
@@ -18344,12 +18367,21 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
18344
18367
  emits: ["update:modelValue"],
18345
18368
  setup(__props, { emit: __emit }) {
18346
18369
  const emits = __emit;
18370
+ const getLabel = (option2) => {
18371
+ if (typeof option2 === "string")
18372
+ return option2;
18373
+ if (typeof option2 === "number")
18374
+ return `${option2}`;
18375
+ return option2.label;
18376
+ };
18377
+ const getValue = (option2) => {
18378
+ if (typeof option2 === "string")
18379
+ return option2;
18380
+ if (typeof option2 === "number")
18381
+ return option2;
18382
+ return option2.value;
18383
+ };
18347
18384
  const props2 = __props;
18348
- const cumputedOptions = vue.computed(() => props2.options || props2.stringOptions.map((v2) => ({
18349
- optioId: v2,
18350
- label: v2,
18351
- value: v2
18352
- })));
18353
18385
  let selectedValue = vue.ref("");
18354
18386
  function handleSelect(e) {
18355
18387
  var _a2;
@@ -18374,20 +18406,22 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
18374
18406
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
18375
18407
  vue.createElementVNode("label", _hoisted_2$d, vue.toDisplayString(_ctx.label), 1),
18376
18408
  vue.createElementVNode("div", _hoisted_3$a, [
18377
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(cumputedOptions.value, ({ optioId, label, value }, index2) => {
18409
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (option2, index2) => {
18378
18410
  return vue.openBlock(), vue.createElementBlock("div", {
18379
18411
  class: "radio-pill",
18380
18412
  key: index2
18381
18413
  }, [
18382
18414
  vue.createElementVNode("input", {
18383
18415
  type: "radio",
18384
- id: optioId,
18416
+ id: getValue(option2),
18385
18417
  name: _ctx.id,
18386
- value,
18387
- checked: vue.unref(selectedValue) === value,
18418
+ value: getValue(option2),
18419
+ checked: vue.unref(selectedValue) === getValue(option2),
18388
18420
  onChange: handleSelect
18389
18421
  }, null, 40, _hoisted_4$6),
18390
- vue.createElementVNode("label", { for: optioId }, vue.toDisplayString(label), 9, _hoisted_5$5)
18422
+ vue.createElementVNode("label", {
18423
+ for: getValue(option2)
18424
+ }, vue.toDisplayString(getLabel(option2)), 9, _hoisted_5$5)
18391
18425
  ]);
18392
18426
  }), 128))
18393
18427
  ])
@@ -18395,7 +18429,7 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
18395
18429
  };
18396
18430
  }
18397
18431
  });
18398
- const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-e47ae8b5"]]);
18432
+ const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-ee7dd382"]]);
18399
18433
  const _hoisted_1$f = { class: "bagel-input" };
18400
18434
  const _hoisted_2$c = {
18401
18435
  key: 0,
@@ -18423,7 +18457,8 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18423
18457
  label: {},
18424
18458
  multiple: { type: Boolean },
18425
18459
  files: {},
18426
- deleteEndpoint: {}
18460
+ deleteEndpoint: {},
18461
+ bindkey: {}
18427
18462
  }, {
18428
18463
  "modelValue": {},
18429
18464
  "modelModifiers": {}
@@ -18432,7 +18467,8 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18432
18467
  setup(__props) {
18433
18468
  const bagel = useBagel();
18434
18469
  const props2 = __props;
18435
- const file_ids = vue.useModel(__props, "modelValue");
18470
+ const bindKey2 = props2.bindkey || "id";
18471
+ const file_bindkeys = vue.useModel(__props, "modelValue");
18436
18472
  const storageFiles = vue.ref([]);
18437
18473
  const compareIds = (v1, v2) => [v1].flat().join(",") === [v2].flat().join(",");
18438
18474
  vue.watch(
@@ -18447,13 +18483,15 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18447
18483
  () => storageFiles.value,
18448
18484
  (newFiles) => {
18449
18485
  var _a2;
18450
- let idValue = "";
18486
+ let idValue;
18451
18487
  if (props2.multiple)
18452
- idValue = newFiles.map((f2) => f2.id || "");
18453
- else
18454
- idValue = ((_a2 = newFiles[0]) == null ? void 0 : _a2.id) || "";
18455
- if (!compareIds(file_ids == null ? void 0 : file_ids.value, idValue))
18456
- file_ids.value = idValue;
18488
+ idValue = newFiles.map((f2) => f2[bindKey2]);
18489
+ else {
18490
+ idValue = ((_a2 = newFiles[0]) == null ? void 0 : _a2[bindKey2]) || "";
18491
+ }
18492
+ if (!compareIds(file_bindkeys == null ? void 0 : file_bindkeys.value, idValue)) {
18493
+ file_bindkeys.value = idValue;
18494
+ }
18457
18495
  },
18458
18496
  { deep: true }
18459
18497
  );
@@ -18602,7 +18640,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18602
18640
  };
18603
18641
  }
18604
18642
  });
18605
- const FileUpload = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-3bb24b0c"]]);
18643
+ const $el = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-0dbacaa0"]]);
18606
18644
  const _withScopeId = (n2) => (vue.pushScopeId("data-v-b87221d6"), n2 = n2(), vue.popScopeId(), n2);
18607
18645
  const _hoisted_1$e = ["title"];
18608
18646
  const _hoisted_2$b = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "slider round" }, null, -1));
@@ -33871,7 +33909,24 @@ function markPasteRule(config) {
33871
33909
  }
33872
33910
  });
33873
33911
  }
33874
- const inputRegex$4 = /^\s*>\s$/;
33912
+ function nodePasteRule(config) {
33913
+ return new PasteRule({
33914
+ find: config.find,
33915
+ handler({ match: match2, chain, range: range2, pasteEvent }) {
33916
+ const attributes = callOrReturn(config.getAttributes, void 0, match2, pasteEvent);
33917
+ if (attributes === false || attributes === null) {
33918
+ return null;
33919
+ }
33920
+ if (match2.input) {
33921
+ chain().deleteRange(range2).insertContentAt(range2.from, {
33922
+ type: config.type.name,
33923
+ attrs: attributes
33924
+ });
33925
+ }
33926
+ }
33927
+ });
33928
+ }
33929
+ const inputRegex$5 = /^\s*>\s$/;
33875
33930
  const Blockquote = Node$2.create({
33876
33931
  name: "blockquote",
33877
33932
  addOptions() {
@@ -33911,7 +33966,7 @@ const Blockquote = Node$2.create({
33911
33966
  addInputRules() {
33912
33967
  return [
33913
33968
  wrappingInputRule({
33914
- find: inputRegex$4,
33969
+ find: inputRegex$5,
33915
33970
  type: this.type
33916
33971
  })
33917
33972
  ];
@@ -34056,7 +34111,7 @@ const TextStyle$1 = Mark.create({
34056
34111
  };
34057
34112
  }
34058
34113
  });
34059
- const inputRegex$3 = /^\s*([-+*])\s$/;
34114
+ const inputRegex$4 = /^\s*([-+*])\s$/;
34060
34115
  const BulletList = Node$2.create({
34061
34116
  name: "bulletList",
34062
34117
  addOptions() {
@@ -34096,12 +34151,12 @@ const BulletList = Node$2.create({
34096
34151
  },
34097
34152
  addInputRules() {
34098
34153
  let inputRule = wrappingInputRule({
34099
- find: inputRegex$3,
34154
+ find: inputRegex$4,
34100
34155
  type: this.type
34101
34156
  });
34102
34157
  if (this.options.keepMarks || this.options.keepAttributes) {
34103
34158
  inputRule = wrappingInputRule({
34104
- find: inputRegex$3,
34159
+ find: inputRegex$4,
34105
34160
  type: this.type,
34106
34161
  keepMarks: this.options.keepMarks,
34107
34162
  keepAttributes: this.options.keepAttributes,
@@ -34116,7 +34171,7 @@ const BulletList = Node$2.create({
34116
34171
  ];
34117
34172
  }
34118
34173
  });
34119
- const inputRegex$2 = /(?:^|\s)((?:`)((?:[^`]+))(?:`))$/;
34174
+ const inputRegex$3 = /(?:^|\s)((?:`)((?:[^`]+))(?:`))$/;
34120
34175
  const pasteRegex$1 = /(?:^|\s)((?:`)((?:[^`]+))(?:`))/g;
34121
34176
  const Code = Mark.create({
34122
34177
  name: "code",
@@ -34157,7 +34212,7 @@ const Code = Mark.create({
34157
34212
  addInputRules() {
34158
34213
  return [
34159
34214
  markInputRule({
34160
- find: inputRegex$2,
34215
+ find: inputRegex$3,
34161
34216
  type: this.type
34162
34217
  })
34163
34218
  ];
@@ -35645,7 +35700,7 @@ const TextStyle = Mark.create({
35645
35700
  };
35646
35701
  }
35647
35702
  });
35648
- const inputRegex$1 = /^(\d+)\.\s$/;
35703
+ const inputRegex$2 = /^(\d+)\.\s$/;
35649
35704
  const OrderedList = Node$2.create({
35650
35705
  name: "orderedList",
35651
35706
  addOptions() {
@@ -35698,14 +35753,14 @@ const OrderedList = Node$2.create({
35698
35753
  },
35699
35754
  addInputRules() {
35700
35755
  let inputRule = wrappingInputRule({
35701
- find: inputRegex$1,
35756
+ find: inputRegex$2,
35702
35757
  type: this.type,
35703
35758
  getAttributes: (match2) => ({ start: +match2[1] }),
35704
35759
  joinPredicate: (match2, node) => node.childCount + node.attrs.start === +match2[1]
35705
35760
  });
35706
35761
  if (this.options.keepMarks || this.options.keepAttributes) {
35707
35762
  inputRule = wrappingInputRule({
35708
- find: inputRegex$1,
35763
+ find: inputRegex$2,
35709
35764
  type: this.type,
35710
35765
  keepMarks: this.options.keepMarks,
35711
35766
  keepAttributes: this.options.keepAttributes,
@@ -35750,7 +35805,7 @@ const Paragraph = Node$2.create({
35750
35805
  };
35751
35806
  }
35752
35807
  });
35753
- const inputRegex = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/;
35808
+ const inputRegex$1 = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/;
35754
35809
  const pasteRegex = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g;
35755
35810
  const Strike = Mark.create({
35756
35811
  name: "strike",
@@ -35805,7 +35860,7 @@ const Strike = Mark.create({
35805
35860
  addInputRules() {
35806
35861
  return [
35807
35862
  markInputRule({
35808
- find: inputRegex,
35863
+ find: inputRegex$1,
35809
35864
  type: this.type
35810
35865
  })
35811
35866
  ];
@@ -39097,6 +39152,285 @@ vue.defineComponent({
39097
39152
  }, (_b = (_a2 = this.$slots).default) === null || _b === void 0 ? void 0 : _b.call(_a2));
39098
39153
  }
39099
39154
  });
39155
+ const inputRegex = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
39156
+ const Image = Node$2.create({
39157
+ name: "image",
39158
+ addOptions() {
39159
+ return {
39160
+ inline: false,
39161
+ allowBase64: false,
39162
+ HTMLAttributes: {}
39163
+ };
39164
+ },
39165
+ inline() {
39166
+ return this.options.inline;
39167
+ },
39168
+ group() {
39169
+ return this.options.inline ? "inline" : "block";
39170
+ },
39171
+ draggable: true,
39172
+ addAttributes() {
39173
+ return {
39174
+ src: {
39175
+ default: null
39176
+ },
39177
+ alt: {
39178
+ default: null
39179
+ },
39180
+ title: {
39181
+ default: null
39182
+ }
39183
+ };
39184
+ },
39185
+ parseHTML() {
39186
+ return [
39187
+ {
39188
+ tag: this.options.allowBase64 ? "img[src]" : 'img[src]:not([src^="data:"])'
39189
+ }
39190
+ ];
39191
+ },
39192
+ renderHTML({ HTMLAttributes }) {
39193
+ return ["img", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
39194
+ },
39195
+ addCommands() {
39196
+ return {
39197
+ setImage: (options) => ({ commands: commands2 }) => {
39198
+ return commands2.insertContent({
39199
+ type: this.name,
39200
+ attrs: options
39201
+ });
39202
+ }
39203
+ };
39204
+ },
39205
+ addInputRules() {
39206
+ return [
39207
+ nodeInputRule({
39208
+ find: inputRegex,
39209
+ type: this.type,
39210
+ getAttributes: (match2) => {
39211
+ const [, , alt, src, title] = match2;
39212
+ return { src, alt, title };
39213
+ }
39214
+ })
39215
+ ];
39216
+ }
39217
+ });
39218
+ const YOUTUBE_REGEX = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?!channel\/)(?!@)(.+)?$/;
39219
+ const YOUTUBE_REGEX_GLOBAL = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/g;
39220
+ const isValidYoutubeUrl = (url) => {
39221
+ return url.match(YOUTUBE_REGEX);
39222
+ };
39223
+ const getYoutubeEmbedUrl = (nocookie) => {
39224
+ return nocookie ? "https://www.youtube-nocookie.com/embed/" : "https://www.youtube.com/embed/";
39225
+ };
39226
+ const getEmbedUrlFromYoutubeUrl = (options) => {
39227
+ const { url, allowFullscreen, autoplay, ccLanguage, ccLoadPolicy, controls, disableKBcontrols, enableIFrameApi, endTime, interfaceLanguage, ivLoadPolicy, loop, modestBranding, nocookie, origin, playlist, progressBarColor, startAt } = options;
39228
+ if (!isValidYoutubeUrl(url)) {
39229
+ return null;
39230
+ }
39231
+ if (url.includes("/embed/")) {
39232
+ return url;
39233
+ }
39234
+ if (url.includes("youtu.be")) {
39235
+ const id = url.split("/").pop();
39236
+ if (!id) {
39237
+ return null;
39238
+ }
39239
+ return `${getYoutubeEmbedUrl(nocookie)}${id}`;
39240
+ }
39241
+ const videoIdRegex = /(?:v=|shorts\/)([-\w]+)/gm;
39242
+ const matches2 = videoIdRegex.exec(url);
39243
+ if (!matches2 || !matches2[1]) {
39244
+ return null;
39245
+ }
39246
+ let outputUrl = `${getYoutubeEmbedUrl(nocookie)}${matches2[1]}`;
39247
+ const params = [];
39248
+ if (allowFullscreen === false) {
39249
+ params.push("fs=0");
39250
+ }
39251
+ if (autoplay) {
39252
+ params.push("autoplay=1");
39253
+ }
39254
+ if (ccLanguage) {
39255
+ params.push(`cc_lang_pref=${ccLanguage}`);
39256
+ }
39257
+ if (ccLoadPolicy) {
39258
+ params.push("cc_load_policy=1");
39259
+ }
39260
+ if (!controls) {
39261
+ params.push("controls=0");
39262
+ }
39263
+ if (disableKBcontrols) {
39264
+ params.push("disablekb=1");
39265
+ }
39266
+ if (enableIFrameApi) {
39267
+ params.push("enablejsapi=1");
39268
+ }
39269
+ if (endTime) {
39270
+ params.push(`end=${endTime}`);
39271
+ }
39272
+ if (interfaceLanguage) {
39273
+ params.push(`hl=${interfaceLanguage}`);
39274
+ }
39275
+ if (ivLoadPolicy) {
39276
+ params.push(`iv_load_policy=${ivLoadPolicy}`);
39277
+ }
39278
+ if (loop) {
39279
+ params.push("loop=1");
39280
+ }
39281
+ if (modestBranding) {
39282
+ params.push("modestbranding=1");
39283
+ }
39284
+ if (origin) {
39285
+ params.push(`origin=${origin}`);
39286
+ }
39287
+ if (playlist) {
39288
+ params.push(`playlist=${playlist}`);
39289
+ }
39290
+ if (startAt) {
39291
+ params.push(`start=${startAt}`);
39292
+ }
39293
+ if (progressBarColor) {
39294
+ params.push(`color=${progressBarColor}`);
39295
+ }
39296
+ if (params.length) {
39297
+ outputUrl += `?${params.join("&")}`;
39298
+ }
39299
+ return outputUrl;
39300
+ };
39301
+ const Youtube = Node$2.create({
39302
+ name: "youtube",
39303
+ addOptions() {
39304
+ return {
39305
+ addPasteHandler: true,
39306
+ allowFullscreen: true,
39307
+ autoplay: false,
39308
+ ccLanguage: void 0,
39309
+ ccLoadPolicy: void 0,
39310
+ controls: true,
39311
+ disableKBcontrols: false,
39312
+ enableIFrameApi: false,
39313
+ endTime: 0,
39314
+ height: 480,
39315
+ interfaceLanguage: void 0,
39316
+ ivLoadPolicy: 0,
39317
+ loop: false,
39318
+ modestBranding: false,
39319
+ HTMLAttributes: {},
39320
+ inline: false,
39321
+ nocookie: false,
39322
+ origin: "",
39323
+ playlist: "",
39324
+ progressBarColor: void 0,
39325
+ width: 640
39326
+ };
39327
+ },
39328
+ inline() {
39329
+ return this.options.inline;
39330
+ },
39331
+ group() {
39332
+ return this.options.inline ? "inline" : "block";
39333
+ },
39334
+ draggable: true,
39335
+ addAttributes() {
39336
+ return {
39337
+ src: {
39338
+ default: null
39339
+ },
39340
+ start: {
39341
+ default: 0
39342
+ },
39343
+ width: {
39344
+ default: this.options.width
39345
+ },
39346
+ height: {
39347
+ default: this.options.height
39348
+ }
39349
+ };
39350
+ },
39351
+ parseHTML() {
39352
+ return [
39353
+ {
39354
+ tag: "div[data-youtube-video] iframe"
39355
+ }
39356
+ ];
39357
+ },
39358
+ addCommands() {
39359
+ return {
39360
+ setYoutubeVideo: (options) => ({ commands: commands2 }) => {
39361
+ if (!isValidYoutubeUrl(options.src)) {
39362
+ return false;
39363
+ }
39364
+ return commands2.insertContent({
39365
+ type: this.name,
39366
+ attrs: options
39367
+ });
39368
+ }
39369
+ };
39370
+ },
39371
+ addPasteRules() {
39372
+ if (!this.options.addPasteHandler) {
39373
+ return [];
39374
+ }
39375
+ return [
39376
+ nodePasteRule({
39377
+ find: YOUTUBE_REGEX_GLOBAL,
39378
+ type: this.type,
39379
+ getAttributes: (match2) => {
39380
+ return { src: match2.input };
39381
+ }
39382
+ })
39383
+ ];
39384
+ },
39385
+ renderHTML({ HTMLAttributes }) {
39386
+ const embedUrl = getEmbedUrlFromYoutubeUrl({
39387
+ url: HTMLAttributes.src,
39388
+ allowFullscreen: this.options.allowFullscreen,
39389
+ autoplay: this.options.autoplay,
39390
+ ccLanguage: this.options.ccLanguage,
39391
+ ccLoadPolicy: this.options.ccLoadPolicy,
39392
+ controls: this.options.controls,
39393
+ disableKBcontrols: this.options.disableKBcontrols,
39394
+ enableIFrameApi: this.options.enableIFrameApi,
39395
+ endTime: this.options.endTime,
39396
+ interfaceLanguage: this.options.interfaceLanguage,
39397
+ ivLoadPolicy: this.options.ivLoadPolicy,
39398
+ loop: this.options.loop,
39399
+ modestBranding: this.options.modestBranding,
39400
+ nocookie: this.options.nocookie,
39401
+ origin: this.options.origin,
39402
+ playlist: this.options.playlist,
39403
+ progressBarColor: this.options.progressBarColor,
39404
+ startAt: HTMLAttributes.start || 0
39405
+ });
39406
+ HTMLAttributes.src = embedUrl;
39407
+ return [
39408
+ "div",
39409
+ { "data-youtube-video": "" },
39410
+ [
39411
+ "iframe",
39412
+ mergeAttributes(this.options.HTMLAttributes, {
39413
+ width: this.options.width,
39414
+ height: this.options.height,
39415
+ allowfullscreen: this.options.allowFullscreen,
39416
+ autoplay: this.options.autoplay,
39417
+ ccLanguage: this.options.ccLanguage,
39418
+ ccLoadPolicy: this.options.ccLoadPolicy,
39419
+ disableKBcontrols: this.options.disableKBcontrols,
39420
+ enableIFrameApi: this.options.enableIFrameApi,
39421
+ endTime: this.options.endTime,
39422
+ interfaceLanguage: this.options.interfaceLanguage,
39423
+ ivLoadPolicy: this.options.ivLoadPolicy,
39424
+ loop: this.options.loop,
39425
+ modestBranding: this.options.modestBranding,
39426
+ origin: this.options.origin,
39427
+ playlist: this.options.playlist,
39428
+ progressBarColor: this.options.progressBarColor
39429
+ }, HTMLAttributes)
39430
+ ]
39431
+ ];
39432
+ }
39433
+ });
39100
39434
  const _hoisted_1$d = { class: "RichText" };
39101
39435
  const _hoisted_2$a = {
39102
39436
  key: 0,
@@ -39109,6 +39443,7 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
39109
39443
  },
39110
39444
  emits: ["update:modelValue"],
39111
39445
  setup(__props, { emit: __emit }) {
39446
+ const { txtField: txtField2 } = bagelFormUtils;
39112
39447
  let editor = vue.ref();
39113
39448
  const props2 = __props;
39114
39449
  const focus2 = () => {
@@ -39116,6 +39451,18 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
39116
39451
  throw new Error("editor is not defined");
39117
39452
  return editor.value.chain().focus();
39118
39453
  };
39454
+ const { showModalForm } = useModal();
39455
+ function addImage() {
39456
+ showModalForm({
39457
+ title: "Add Image",
39458
+ schema: [
39459
+ txtField2("title", "Title"),
39460
+ { $el, id: "src", attrs: { bindkey: "url" } },
39461
+ txtField2("alt", "Alt Text")
39462
+ ],
39463
+ onSubmit: (imgObj) => focus2().setImage(imgObj).run()
39464
+ });
39465
+ }
39119
39466
  const config = [
39120
39467
  {
39121
39468
  name: "Bold",
@@ -39152,11 +39499,31 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
39152
39499
  command: () => focus2().toggleCode().run(),
39153
39500
  icon: "code"
39154
39501
  },
39155
- // {
39156
- // name: 'clearMarks',
39157
- // command: () => focus().unsetAllMarks(),
39158
- // icon: 'clear',
39159
- // },
39502
+ {
39503
+ name: "Image",
39504
+ command: addImage,
39505
+ icon: "image"
39506
+ },
39507
+ {
39508
+ name: "YouTube",
39509
+ command: () => {
39510
+ showModalForm({
39511
+ title: "Add YouTube Video",
39512
+ schema: [
39513
+ txtField2("src", "YouTube URL"),
39514
+ {
39515
+ $el: BglVideo,
39516
+ attrs: { src: (_2, { src }) => src || "" }
39517
+ }
39518
+ ],
39519
+ onSubmit: (videoObj) => {
39520
+ var _a2;
39521
+ return (_a2 = editor.value) == null ? void 0 : _a2.commands.setYoutubeVideo(videoObj);
39522
+ }
39523
+ });
39524
+ },
39525
+ icon: "youtube_activity"
39526
+ },
39160
39527
  {
39161
39528
  name: "Clear",
39162
39529
  command: () => focus2().clearNodes().run(),
@@ -39255,7 +39622,7 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
39255
39622
  const emit2 = __emit;
39256
39623
  function initEditor() {
39257
39624
  editor.value = new Editor({
39258
- extensions: [StarterKit],
39625
+ extensions: [StarterKit, Image, Youtube],
39259
39626
  content: props2.modelValue,
39260
39627
  onUpdate: ({ editor: editor2 }) => emit2("update:modelValue", editor2.getHTML())
39261
39628
  });
@@ -39282,6 +39649,7 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
39282
39649
  (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(config, (item) => {
39283
39650
  var _a2;
39284
39651
  return vue.withDirectives(vue.createVNode(vue.unref(Btn), {
39652
+ tabindex: "-1",
39285
39653
  flat: !vue.unref(editor).isActive(item.name, item.option),
39286
39654
  onClick: item.command,
39287
39655
  thin: "",
@@ -45998,7 +46366,7 @@ exports.DataPreview = DataPreview;
45998
46366
  exports.DateInput = _sfc_main$j;
45999
46367
  exports.DatePicker = _sfc_main$c;
46000
46368
  exports.Dropdown = kt$1;
46001
- exports.FileUpload = FileUpload;
46369
+ exports.FileUpload = $el;
46002
46370
  exports.Icon = _sfc_main$H;
46003
46371
  exports.JSONInput = JSONInput;
46004
46372
  exports.Layout = Layout;
@@ -46026,7 +46394,7 @@ exports.TextInput = TextInput;
46026
46394
  exports.Title = _sfc_main$s;
46027
46395
  exports.ToggleInput = ToggleInput;
46028
46396
  exports.TopBar = TopBar;
46029
- exports.bagelFormUtils = BagelFormUtils;
46397
+ exports.bagelFormUtils = bagelFormUtils;
46030
46398
  exports.bagelInjectionKey = bagelInjectionKey;
46031
46399
  exports.bindAttrs = bindAttrs;
46032
46400
  exports.classify = classify;