@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.mjs CHANGED
@@ -4962,7 +4962,7 @@ function frmRow(...children2) {
4962
4962
  children: children2
4963
4963
  };
4964
4964
  }
4965
- const BagelFormUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4965
+ const bagelFormUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4966
4966
  __proto__: null,
4967
4967
  frmRow,
4968
4968
  numField,
@@ -5040,7 +5040,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
5040
5040
  });
5041
5041
  const _hoisted_1$E = { class: "full-nav" };
5042
5042
  const _hoisted_2$x = { class: "nav-scroll" };
5043
- const _hoisted_3$m = { class: "nav-links-wrapper" };
5043
+ const _hoisted_3$l = { class: "nav-links-wrapper" };
5044
5044
  const _hoisted_4$e = { class: "tooltip" };
5045
5045
  const _hoisted_5$b = { class: "bot-buttons-wrapper" };
5046
5046
  const _hoisted_6$7 = { class: "tooltip" };
@@ -5075,7 +5075,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5075
5075
  ], 32),
5076
5076
  createElementVNode("div", _hoisted_1$E, [
5077
5077
  createElementVNode("div", _hoisted_2$x, [
5078
- createElementVNode("div", _hoisted_3$m, [
5078
+ createElementVNode("div", _hoisted_3$l, [
5079
5079
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.links, (link) => {
5080
5080
  return openBlock(), createBlock(resolveDynamicComponent(link.to ? "router-link" : "div"), {
5081
5081
  class: "nav-button",
@@ -5255,6 +5255,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
5255
5255
  props: {
5256
5256
  side: { type: Boolean },
5257
5257
  title: {},
5258
+ width: {},
5258
5259
  dismissable: { type: Boolean },
5259
5260
  actions: {},
5260
5261
  visible: { type: Boolean }
@@ -5263,14 +5264,26 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
5263
5264
  setup(__props, { expose: __expose, emit: __emit }) {
5264
5265
  const props2 = __props;
5265
5266
  let isVisible = ref(false);
5266
- watch(() => props2.visible, (val) => {
5267
- if (val === isVisible.value || val === void 0)
5268
- return;
5269
- if (val)
5270
- openModal();
5271
- else
5272
- closeModal();
5273
- }, { immediate: true });
5267
+ watch(
5268
+ () => props2.visible,
5269
+ (val) => {
5270
+ if (val === isVisible.value || val === void 0)
5271
+ return;
5272
+ if (val)
5273
+ openModal();
5274
+ else
5275
+ closeModal();
5276
+ },
5277
+ { immediate: true }
5278
+ );
5279
+ const maxWidth = computed(() => {
5280
+ const { width } = props2;
5281
+ if (width == null ? void 0 : width.match(/px|em|rem|vw|vh|%/))
5282
+ return { "max-width": width };
5283
+ if (width == null ? void 0 : width.match(/\d+/))
5284
+ return { "max-width": `${width}px` };
5285
+ return { "max-width": "720px" };
5286
+ });
5274
5287
  const emit2 = __emit;
5275
5288
  const closeModal = () => {
5276
5289
  isVisible.value = false;
@@ -5294,7 +5307,8 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
5294
5307
  createVNode(unref(_sfc_main$u), {
5295
5308
  class: "modal",
5296
5309
  onClick: _cache[0] || (_cache[0] = withModifiers(() => {
5297
- }, ["stop"]))
5310
+ }, ["stop"])),
5311
+ style: normalizeStyle({ ...maxWidth.value })
5298
5312
  }, {
5299
5313
  default: withCtx(() => [
5300
5314
  createElementVNode("header", _hoisted_1$C, [
@@ -5325,7 +5339,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
5325
5339
  ])
5326
5340
  ]),
5327
5341
  _: 3
5328
- })
5342
+ }, 8, ["style"])
5329
5343
  ], 34);
5330
5344
  };
5331
5345
  }
@@ -5335,6 +5349,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
5335
5349
  props: /* @__PURE__ */ mergeModels({
5336
5350
  side: { type: Boolean },
5337
5351
  title: {},
5352
+ width: {},
5338
5353
  dismissable: { type: Boolean },
5339
5354
  actions: {},
5340
5355
  schema: { type: Function },
@@ -5344,7 +5359,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
5344
5359
  onError: { type: Function },
5345
5360
  modelValue: {}
5346
5361
  }, {
5347
- "modelValue": { default: {} },
5362
+ "modelValue": {
5363
+ default: {}
5364
+ },
5348
5365
  "modelModifiers": {}
5349
5366
  }),
5350
5367
  emits: ["update:modelValue"],
@@ -5392,6 +5409,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
5392
5409
  side: _ctx.side,
5393
5410
  ref_key: "modal",
5394
5411
  ref: modal,
5412
+ width: _ctx.width,
5395
5413
  dismissable: _ctx.dismissable,
5396
5414
  title: _ctx.title
5397
5415
  }, createSlots({
@@ -5434,14 +5452,14 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
5434
5452
  ]),
5435
5453
  key: "0"
5436
5454
  } : void 0
5437
- ]), 1032, ["onOnUpdate:isModalVisible", "side", "dismissable", "title"]);
5455
+ ]), 1032, ["onOnUpdate:isModalVisible", "side", "width", "dismissable", "title"]);
5438
5456
  };
5439
5457
  }
5440
5458
  });
5441
- const ModalForm = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-7e6899c7"]]);
5459
+ const ModalForm = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-204f5236"]]);
5442
5460
  const _hoisted_1$B = { class: "accordion-item" };
5443
5461
  const _hoisted_2$u = ["aria-expanded", "aria-controls"];
5444
- const _hoisted_3$l = { class: "accordion-label" };
5462
+ const _hoisted_3$k = { class: "accordion-label" };
5445
5463
  const _hoisted_4$d = ["id", "aria-hidden"];
5446
5464
  const _sfc_main$C = /* @__PURE__ */ defineComponent({
5447
5465
  __name: "AccordionItem",
@@ -5474,7 +5492,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
5474
5492
  class: "accordion-head",
5475
5493
  "aria-controls": `accordion-body-${unref(id)}`
5476
5494
  }, [
5477
- createElementVNode("span", _hoisted_3$l, toDisplayString(_ctx.label), 1),
5495
+ createElementVNode("span", _hoisted_3$k, toDisplayString(_ctx.label), 1),
5478
5496
  createElementVNode("div", {
5479
5497
  class: normalizeClass(["accordion-icon", { open: unref(open) }])
5480
5498
  }, [
@@ -5501,7 +5519,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
5501
5519
  const AccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-bf74738b"]]);
5502
5520
  const _hoisted_1$A = { class: "list-wrap bgl_card thin grid overflow-hidden h-100 p-0" };
5503
5521
  const _hoisted_2$t = { class: "p-1" };
5504
- const _hoisted_3$k = { class: "list-content auto-flow-rows align-items-start overflow-y h-100" };
5522
+ const _hoisted_3$j = { class: "list-content auto-flow-rows align-items-start overflow-y h-100" };
5505
5523
  const _sfc_main$B = /* @__PURE__ */ defineComponent({
5506
5524
  __name: "ListView",
5507
5525
  setup(__props) {
@@ -5510,7 +5528,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
5510
5528
  createElementVNode("div", _hoisted_2$t, [
5511
5529
  renderSlot(_ctx.$slots, "header")
5512
5530
  ]),
5513
- createElementVNode("div", _hoisted_3$k, [
5531
+ createElementVNode("div", _hoisted_3$j, [
5514
5532
  renderSlot(_ctx.$slots, "default")
5515
5533
  ])
5516
5534
  ]);
@@ -5581,7 +5599,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5581
5599
  });
5582
5600
  const _hoisted_1$x = { class: "table-list-wrap h-100" };
5583
5601
  const _hoisted_2$q = { class: "infinite-wrapper" };
5584
- const _hoisted_3$j = { class: "row first-row" };
5602
+ const _hoisted_3$i = { class: "row first-row" };
5585
5603
  const _hoisted_4$c = ["onClick"];
5586
5604
  const _hoisted_5$a = { class: "flex" };
5587
5605
  const _hoisted_6$6 = ["onClick"];
@@ -5622,7 +5640,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
5622
5640
  return (_ctx, _cache) => {
5623
5641
  return openBlock(), createElementBlock("div", _hoisted_1$x, [
5624
5642
  createElementVNode("table", _hoisted_2$q, [
5625
- createElementVNode("thead", _hoisted_3$j, [
5643
+ createElementVNode("thead", _hoisted_3$i, [
5626
5644
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(computedSchema.value, (field) => {
5627
5645
  return openBlock(), createElementBlock("th", {
5628
5646
  class: "col",
@@ -5718,7 +5736,7 @@ const _hoisted_2$p = {
5718
5736
  key: 0,
5719
5737
  class: "data-row"
5720
5738
  };
5721
- const _hoisted_3$i = { class: "key" };
5739
+ const _hoisted_3$h = { class: "key" };
5722
5740
  const _hoisted_4$b = { key: 1 };
5723
5741
  const _hoisted_5$9 = { class: "key" };
5724
5742
  const _hoisted_6$5 = { class: "vlue" };
@@ -5746,7 +5764,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
5746
5764
  key: field.id
5747
5765
  }, [
5748
5766
  unref(iffer)(field, itemData.value) ? (openBlock(), createElementBlock("div", _hoisted_2$p, [
5749
- createElementVNode("div", _hoisted_3$i, toDisplayString((field == null ? void 0 : field.label) || unref(keyToLabel)(field.id)), 1),
5767
+ createElementVNode("div", _hoisted_3$h, toDisplayString((field == null ? void 0 : field.label) || unref(keyToLabel)(field.id)), 1),
5750
5768
  createVNode(unref(_sfc_main$l), {
5751
5769
  field,
5752
5770
  modelValue: itemData.value,
@@ -5943,10 +5961,9 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
5943
5961
  };
5944
5962
  }
5945
5963
  });
5946
- const Badge = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-10743b06"]]);
5947
- const _hoisted_1$r = { class: "bgl_vid" };
5948
- const _hoisted_2$n = ["src"];
5949
- const _hoisted_3$h = ["src", "autoplay", "muted", "loop", "controls"];
5964
+ const Badge = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-561f7a72"]]);
5965
+ const _hoisted_1$r = ["src"];
5966
+ const _hoisted_2$n = ["src", "autoplay", "muted", "loop", "controls"];
5950
5967
  const _sfc_main$o = /* @__PURE__ */ defineComponent({
5951
5968
  __name: "BglVideo",
5952
5969
  props: {
@@ -5959,26 +5976,31 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
5959
5976
  },
5960
5977
  setup(__props) {
5961
5978
  const props2 = __props;
5962
- const aspectRatio = computed(() => props2.aspectRatio.replace(":", "/"));
5979
+ const aspectRatio = computed(
5980
+ () => {
5981
+ var _a2;
5982
+ return ((_a2 = props2.aspectRatio) == null ? void 0 : _a2.replace(":", "/")) || "16/9";
5983
+ }
5984
+ );
5963
5985
  const embedType = computed(() => {
5964
5986
  const youtubeRegex = /youtube\.com|youtu\.be/;
5965
- if (youtubeRegex.test(props2.src))
5987
+ if (youtubeRegex.test(props2.src || ""))
5966
5988
  return "YouTube";
5967
5989
  const vimeoRegex = /vimeo\.com/;
5968
- if (vimeoRegex.test(props2.src))
5990
+ if (vimeoRegex.test(props2.src || ""))
5969
5991
  return "Vimeo";
5970
5992
  return null;
5971
5993
  });
5972
5994
  const videoUrl = computed(() => {
5973
- var _a2, _b, _c, _d;
5995
+ var _a2, _b, _c, _d, _e2, _f;
5974
5996
  if (embedType.value) {
5975
5997
  if (embedType.value === "YouTube") {
5976
- 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];
5998
+ 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];
5977
5999
  return `https://www.youtube.com/embed/${videoId}`;
5978
6000
  }
5979
6001
  if (embedType.value === "Vimeo") {
5980
6002
  const vimeoRegex = /vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/)?(\d+)(?:$|\/|\?)/;
5981
- const videoId = (_d = props2.src.match(vimeoRegex)) == null ? void 0 : _d[3];
6003
+ const videoId = (_f = (_e2 = props2.src) == null ? void 0 : _e2.match(vimeoRegex)) == null ? void 0 : _f[3];
5982
6004
  return `https://player.vimeo.com/video/${videoId}`;
5983
6005
  }
5984
6006
  }
@@ -5986,7 +6008,9 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
5986
6008
  });
5987
6009
  console.log("Video URL:", videoUrl.value);
5988
6010
  return (_ctx, _cache) => {
5989
- return openBlock(), createElementBlock("div", _hoisted_1$r, [
6011
+ return openBlock(), createElementBlock("div", {
6012
+ class: normalizeClass(["bgl_vid", { vid_empty: !_ctx.src }])
6013
+ }, [
5990
6014
  embedType.value ? (openBlock(), createElementBlock("iframe", {
5991
6015
  key: 0,
5992
6016
  src: videoUrl.value,
@@ -5994,7 +6018,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
5994
6018
  frameborder: "0",
5995
6019
  allowfullscreen: "",
5996
6020
  title: "Video"
5997
- }, null, 12, _hoisted_2$n)) : (openBlock(), createElementBlock("video", {
6021
+ }, null, 12, _hoisted_1$r)) : _ctx.src ? (openBlock(), createElementBlock("video", {
5998
6022
  key: 1,
5999
6023
  src: _ctx.src,
6000
6024
  autoplay: _ctx.autoplay,
@@ -6003,12 +6027,12 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6003
6027
  style: normalizeStyle({ aspectRatio: aspectRatio.value }),
6004
6028
  controls: _ctx.controls,
6005
6029
  playsinline: ""
6006
- }, null, 12, _hoisted_3$h))
6007
- ]);
6030
+ }, null, 12, _hoisted_2$n)) : createCommentVNode("", true)
6031
+ ], 2);
6008
6032
  };
6009
6033
  }
6010
6034
  });
6011
- const BglVideo = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-23835d69"]]);
6035
+ const BglVideo = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-bbfc4353"]]);
6012
6036
  const _hoisted_1$q = {
6013
6037
  key: 0,
6014
6038
  class: "blocker"
@@ -18334,7 +18358,6 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
18334
18358
  __name: "RadioPillsInput",
18335
18359
  props: {
18336
18360
  options: {},
18337
- stringOptions: {},
18338
18361
  modelValue: {},
18339
18362
  id: {},
18340
18363
  label: {}
@@ -18342,12 +18365,21 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
18342
18365
  emits: ["update:modelValue"],
18343
18366
  setup(__props, { emit: __emit }) {
18344
18367
  const emits = __emit;
18368
+ const getLabel = (option2) => {
18369
+ if (typeof option2 === "string")
18370
+ return option2;
18371
+ if (typeof option2 === "number")
18372
+ return `${option2}`;
18373
+ return option2.label;
18374
+ };
18375
+ const getValue = (option2) => {
18376
+ if (typeof option2 === "string")
18377
+ return option2;
18378
+ if (typeof option2 === "number")
18379
+ return option2;
18380
+ return option2.value;
18381
+ };
18345
18382
  const props2 = __props;
18346
- const cumputedOptions = computed(() => props2.options || props2.stringOptions.map((v2) => ({
18347
- optioId: v2,
18348
- label: v2,
18349
- value: v2
18350
- })));
18351
18383
  let selectedValue = ref("");
18352
18384
  function handleSelect(e) {
18353
18385
  var _a2;
@@ -18372,20 +18404,22 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
18372
18404
  return openBlock(), createElementBlock("div", _hoisted_1$g, [
18373
18405
  createElementVNode("label", _hoisted_2$d, toDisplayString(_ctx.label), 1),
18374
18406
  createElementVNode("div", _hoisted_3$a, [
18375
- (openBlock(true), createElementBlock(Fragment$1, null, renderList(cumputedOptions.value, ({ optioId, label, value }, index2) => {
18407
+ (openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.options, (option2, index2) => {
18376
18408
  return openBlock(), createElementBlock("div", {
18377
18409
  class: "radio-pill",
18378
18410
  key: index2
18379
18411
  }, [
18380
18412
  createElementVNode("input", {
18381
18413
  type: "radio",
18382
- id: optioId,
18414
+ id: getValue(option2),
18383
18415
  name: _ctx.id,
18384
- value,
18385
- checked: unref(selectedValue) === value,
18416
+ value: getValue(option2),
18417
+ checked: unref(selectedValue) === getValue(option2),
18386
18418
  onChange: handleSelect
18387
18419
  }, null, 40, _hoisted_4$6),
18388
- createElementVNode("label", { for: optioId }, toDisplayString(label), 9, _hoisted_5$5)
18420
+ createElementVNode("label", {
18421
+ for: getValue(option2)
18422
+ }, toDisplayString(getLabel(option2)), 9, _hoisted_5$5)
18389
18423
  ]);
18390
18424
  }), 128))
18391
18425
  ])
@@ -18393,7 +18427,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
18393
18427
  };
18394
18428
  }
18395
18429
  });
18396
- const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-e47ae8b5"]]);
18430
+ const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-ee7dd382"]]);
18397
18431
  const _hoisted_1$f = { class: "bagel-input" };
18398
18432
  const _hoisted_2$c = {
18399
18433
  key: 0,
@@ -18421,7 +18455,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
18421
18455
  label: {},
18422
18456
  multiple: { type: Boolean },
18423
18457
  files: {},
18424
- deleteEndpoint: {}
18458
+ deleteEndpoint: {},
18459
+ bindkey: {}
18425
18460
  }, {
18426
18461
  "modelValue": {},
18427
18462
  "modelModifiers": {}
@@ -18430,7 +18465,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
18430
18465
  setup(__props) {
18431
18466
  const bagel = useBagel();
18432
18467
  const props2 = __props;
18433
- const file_ids = useModel(__props, "modelValue");
18468
+ const bindKey2 = props2.bindkey || "id";
18469
+ const file_bindkeys = useModel(__props, "modelValue");
18434
18470
  const storageFiles = ref([]);
18435
18471
  const compareIds = (v1, v2) => [v1].flat().join(",") === [v2].flat().join(",");
18436
18472
  watch(
@@ -18445,13 +18481,15 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
18445
18481
  () => storageFiles.value,
18446
18482
  (newFiles) => {
18447
18483
  var _a2;
18448
- let idValue = "";
18484
+ let idValue;
18449
18485
  if (props2.multiple)
18450
- idValue = newFiles.map((f2) => f2.id || "");
18451
- else
18452
- idValue = ((_a2 = newFiles[0]) == null ? void 0 : _a2.id) || "";
18453
- if (!compareIds(file_ids == null ? void 0 : file_ids.value, idValue))
18454
- file_ids.value = idValue;
18486
+ idValue = newFiles.map((f2) => f2[bindKey2]);
18487
+ else {
18488
+ idValue = ((_a2 = newFiles[0]) == null ? void 0 : _a2[bindKey2]) || "";
18489
+ }
18490
+ if (!compareIds(file_bindkeys == null ? void 0 : file_bindkeys.value, idValue)) {
18491
+ file_bindkeys.value = idValue;
18492
+ }
18455
18493
  },
18456
18494
  { deep: true }
18457
18495
  );
@@ -18600,7 +18638,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
18600
18638
  };
18601
18639
  }
18602
18640
  });
18603
- const FileUpload = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-3bb24b0c"]]);
18641
+ const $el = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-0dbacaa0"]]);
18604
18642
  const _withScopeId = (n2) => (pushScopeId("data-v-b87221d6"), n2 = n2(), popScopeId(), n2);
18605
18643
  const _hoisted_1$e = ["title"];
18606
18644
  const _hoisted_2$b = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "slider round" }, null, -1));
@@ -33869,7 +33907,24 @@ function markPasteRule(config) {
33869
33907
  }
33870
33908
  });
33871
33909
  }
33872
- const inputRegex$4 = /^\s*>\s$/;
33910
+ function nodePasteRule(config) {
33911
+ return new PasteRule({
33912
+ find: config.find,
33913
+ handler({ match: match2, chain, range: range2, pasteEvent }) {
33914
+ const attributes = callOrReturn(config.getAttributes, void 0, match2, pasteEvent);
33915
+ if (attributes === false || attributes === null) {
33916
+ return null;
33917
+ }
33918
+ if (match2.input) {
33919
+ chain().deleteRange(range2).insertContentAt(range2.from, {
33920
+ type: config.type.name,
33921
+ attrs: attributes
33922
+ });
33923
+ }
33924
+ }
33925
+ });
33926
+ }
33927
+ const inputRegex$5 = /^\s*>\s$/;
33873
33928
  const Blockquote = Node$2.create({
33874
33929
  name: "blockquote",
33875
33930
  addOptions() {
@@ -33909,7 +33964,7 @@ const Blockquote = Node$2.create({
33909
33964
  addInputRules() {
33910
33965
  return [
33911
33966
  wrappingInputRule({
33912
- find: inputRegex$4,
33967
+ find: inputRegex$5,
33913
33968
  type: this.type
33914
33969
  })
33915
33970
  ];
@@ -34054,7 +34109,7 @@ const TextStyle$1 = Mark.create({
34054
34109
  };
34055
34110
  }
34056
34111
  });
34057
- const inputRegex$3 = /^\s*([-+*])\s$/;
34112
+ const inputRegex$4 = /^\s*([-+*])\s$/;
34058
34113
  const BulletList = Node$2.create({
34059
34114
  name: "bulletList",
34060
34115
  addOptions() {
@@ -34094,12 +34149,12 @@ const BulletList = Node$2.create({
34094
34149
  },
34095
34150
  addInputRules() {
34096
34151
  let inputRule = wrappingInputRule({
34097
- find: inputRegex$3,
34152
+ find: inputRegex$4,
34098
34153
  type: this.type
34099
34154
  });
34100
34155
  if (this.options.keepMarks || this.options.keepAttributes) {
34101
34156
  inputRule = wrappingInputRule({
34102
- find: inputRegex$3,
34157
+ find: inputRegex$4,
34103
34158
  type: this.type,
34104
34159
  keepMarks: this.options.keepMarks,
34105
34160
  keepAttributes: this.options.keepAttributes,
@@ -34114,7 +34169,7 @@ const BulletList = Node$2.create({
34114
34169
  ];
34115
34170
  }
34116
34171
  });
34117
- const inputRegex$2 = /(?:^|\s)((?:`)((?:[^`]+))(?:`))$/;
34172
+ const inputRegex$3 = /(?:^|\s)((?:`)((?:[^`]+))(?:`))$/;
34118
34173
  const pasteRegex$1 = /(?:^|\s)((?:`)((?:[^`]+))(?:`))/g;
34119
34174
  const Code = Mark.create({
34120
34175
  name: "code",
@@ -34155,7 +34210,7 @@ const Code = Mark.create({
34155
34210
  addInputRules() {
34156
34211
  return [
34157
34212
  markInputRule({
34158
- find: inputRegex$2,
34213
+ find: inputRegex$3,
34159
34214
  type: this.type
34160
34215
  })
34161
34216
  ];
@@ -35643,7 +35698,7 @@ const TextStyle = Mark.create({
35643
35698
  };
35644
35699
  }
35645
35700
  });
35646
- const inputRegex$1 = /^(\d+)\.\s$/;
35701
+ const inputRegex$2 = /^(\d+)\.\s$/;
35647
35702
  const OrderedList = Node$2.create({
35648
35703
  name: "orderedList",
35649
35704
  addOptions() {
@@ -35696,14 +35751,14 @@ const OrderedList = Node$2.create({
35696
35751
  },
35697
35752
  addInputRules() {
35698
35753
  let inputRule = wrappingInputRule({
35699
- find: inputRegex$1,
35754
+ find: inputRegex$2,
35700
35755
  type: this.type,
35701
35756
  getAttributes: (match2) => ({ start: +match2[1] }),
35702
35757
  joinPredicate: (match2, node) => node.childCount + node.attrs.start === +match2[1]
35703
35758
  });
35704
35759
  if (this.options.keepMarks || this.options.keepAttributes) {
35705
35760
  inputRule = wrappingInputRule({
35706
- find: inputRegex$1,
35761
+ find: inputRegex$2,
35707
35762
  type: this.type,
35708
35763
  keepMarks: this.options.keepMarks,
35709
35764
  keepAttributes: this.options.keepAttributes,
@@ -35748,7 +35803,7 @@ const Paragraph = Node$2.create({
35748
35803
  };
35749
35804
  }
35750
35805
  });
35751
- const inputRegex = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/;
35806
+ const inputRegex$1 = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/;
35752
35807
  const pasteRegex = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g;
35753
35808
  const Strike = Mark.create({
35754
35809
  name: "strike",
@@ -35803,7 +35858,7 @@ const Strike = Mark.create({
35803
35858
  addInputRules() {
35804
35859
  return [
35805
35860
  markInputRule({
35806
- find: inputRegex,
35861
+ find: inputRegex$1,
35807
35862
  type: this.type
35808
35863
  })
35809
35864
  ];
@@ -39095,6 +39150,285 @@ defineComponent({
39095
39150
  }, (_b = (_a2 = this.$slots).default) === null || _b === void 0 ? void 0 : _b.call(_a2));
39096
39151
  }
39097
39152
  });
39153
+ const inputRegex = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
39154
+ const Image = Node$2.create({
39155
+ name: "image",
39156
+ addOptions() {
39157
+ return {
39158
+ inline: false,
39159
+ allowBase64: false,
39160
+ HTMLAttributes: {}
39161
+ };
39162
+ },
39163
+ inline() {
39164
+ return this.options.inline;
39165
+ },
39166
+ group() {
39167
+ return this.options.inline ? "inline" : "block";
39168
+ },
39169
+ draggable: true,
39170
+ addAttributes() {
39171
+ return {
39172
+ src: {
39173
+ default: null
39174
+ },
39175
+ alt: {
39176
+ default: null
39177
+ },
39178
+ title: {
39179
+ default: null
39180
+ }
39181
+ };
39182
+ },
39183
+ parseHTML() {
39184
+ return [
39185
+ {
39186
+ tag: this.options.allowBase64 ? "img[src]" : 'img[src]:not([src^="data:"])'
39187
+ }
39188
+ ];
39189
+ },
39190
+ renderHTML({ HTMLAttributes }) {
39191
+ return ["img", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
39192
+ },
39193
+ addCommands() {
39194
+ return {
39195
+ setImage: (options) => ({ commands: commands2 }) => {
39196
+ return commands2.insertContent({
39197
+ type: this.name,
39198
+ attrs: options
39199
+ });
39200
+ }
39201
+ };
39202
+ },
39203
+ addInputRules() {
39204
+ return [
39205
+ nodeInputRule({
39206
+ find: inputRegex,
39207
+ type: this.type,
39208
+ getAttributes: (match2) => {
39209
+ const [, , alt, src, title] = match2;
39210
+ return { src, alt, title };
39211
+ }
39212
+ })
39213
+ ];
39214
+ }
39215
+ });
39216
+ const YOUTUBE_REGEX = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?!channel\/)(?!@)(.+)?$/;
39217
+ const YOUTUBE_REGEX_GLOBAL = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/g;
39218
+ const isValidYoutubeUrl = (url) => {
39219
+ return url.match(YOUTUBE_REGEX);
39220
+ };
39221
+ const getYoutubeEmbedUrl = (nocookie) => {
39222
+ return nocookie ? "https://www.youtube-nocookie.com/embed/" : "https://www.youtube.com/embed/";
39223
+ };
39224
+ const getEmbedUrlFromYoutubeUrl = (options) => {
39225
+ const { url, allowFullscreen, autoplay, ccLanguage, ccLoadPolicy, controls, disableKBcontrols, enableIFrameApi, endTime, interfaceLanguage, ivLoadPolicy, loop, modestBranding, nocookie, origin, playlist, progressBarColor, startAt } = options;
39226
+ if (!isValidYoutubeUrl(url)) {
39227
+ return null;
39228
+ }
39229
+ if (url.includes("/embed/")) {
39230
+ return url;
39231
+ }
39232
+ if (url.includes("youtu.be")) {
39233
+ const id = url.split("/").pop();
39234
+ if (!id) {
39235
+ return null;
39236
+ }
39237
+ return `${getYoutubeEmbedUrl(nocookie)}${id}`;
39238
+ }
39239
+ const videoIdRegex = /(?:v=|shorts\/)([-\w]+)/gm;
39240
+ const matches2 = videoIdRegex.exec(url);
39241
+ if (!matches2 || !matches2[1]) {
39242
+ return null;
39243
+ }
39244
+ let outputUrl = `${getYoutubeEmbedUrl(nocookie)}${matches2[1]}`;
39245
+ const params = [];
39246
+ if (allowFullscreen === false) {
39247
+ params.push("fs=0");
39248
+ }
39249
+ if (autoplay) {
39250
+ params.push("autoplay=1");
39251
+ }
39252
+ if (ccLanguage) {
39253
+ params.push(`cc_lang_pref=${ccLanguage}`);
39254
+ }
39255
+ if (ccLoadPolicy) {
39256
+ params.push("cc_load_policy=1");
39257
+ }
39258
+ if (!controls) {
39259
+ params.push("controls=0");
39260
+ }
39261
+ if (disableKBcontrols) {
39262
+ params.push("disablekb=1");
39263
+ }
39264
+ if (enableIFrameApi) {
39265
+ params.push("enablejsapi=1");
39266
+ }
39267
+ if (endTime) {
39268
+ params.push(`end=${endTime}`);
39269
+ }
39270
+ if (interfaceLanguage) {
39271
+ params.push(`hl=${interfaceLanguage}`);
39272
+ }
39273
+ if (ivLoadPolicy) {
39274
+ params.push(`iv_load_policy=${ivLoadPolicy}`);
39275
+ }
39276
+ if (loop) {
39277
+ params.push("loop=1");
39278
+ }
39279
+ if (modestBranding) {
39280
+ params.push("modestbranding=1");
39281
+ }
39282
+ if (origin) {
39283
+ params.push(`origin=${origin}`);
39284
+ }
39285
+ if (playlist) {
39286
+ params.push(`playlist=${playlist}`);
39287
+ }
39288
+ if (startAt) {
39289
+ params.push(`start=${startAt}`);
39290
+ }
39291
+ if (progressBarColor) {
39292
+ params.push(`color=${progressBarColor}`);
39293
+ }
39294
+ if (params.length) {
39295
+ outputUrl += `?${params.join("&")}`;
39296
+ }
39297
+ return outputUrl;
39298
+ };
39299
+ const Youtube = Node$2.create({
39300
+ name: "youtube",
39301
+ addOptions() {
39302
+ return {
39303
+ addPasteHandler: true,
39304
+ allowFullscreen: true,
39305
+ autoplay: false,
39306
+ ccLanguage: void 0,
39307
+ ccLoadPolicy: void 0,
39308
+ controls: true,
39309
+ disableKBcontrols: false,
39310
+ enableIFrameApi: false,
39311
+ endTime: 0,
39312
+ height: 480,
39313
+ interfaceLanguage: void 0,
39314
+ ivLoadPolicy: 0,
39315
+ loop: false,
39316
+ modestBranding: false,
39317
+ HTMLAttributes: {},
39318
+ inline: false,
39319
+ nocookie: false,
39320
+ origin: "",
39321
+ playlist: "",
39322
+ progressBarColor: void 0,
39323
+ width: 640
39324
+ };
39325
+ },
39326
+ inline() {
39327
+ return this.options.inline;
39328
+ },
39329
+ group() {
39330
+ return this.options.inline ? "inline" : "block";
39331
+ },
39332
+ draggable: true,
39333
+ addAttributes() {
39334
+ return {
39335
+ src: {
39336
+ default: null
39337
+ },
39338
+ start: {
39339
+ default: 0
39340
+ },
39341
+ width: {
39342
+ default: this.options.width
39343
+ },
39344
+ height: {
39345
+ default: this.options.height
39346
+ }
39347
+ };
39348
+ },
39349
+ parseHTML() {
39350
+ return [
39351
+ {
39352
+ tag: "div[data-youtube-video] iframe"
39353
+ }
39354
+ ];
39355
+ },
39356
+ addCommands() {
39357
+ return {
39358
+ setYoutubeVideo: (options) => ({ commands: commands2 }) => {
39359
+ if (!isValidYoutubeUrl(options.src)) {
39360
+ return false;
39361
+ }
39362
+ return commands2.insertContent({
39363
+ type: this.name,
39364
+ attrs: options
39365
+ });
39366
+ }
39367
+ };
39368
+ },
39369
+ addPasteRules() {
39370
+ if (!this.options.addPasteHandler) {
39371
+ return [];
39372
+ }
39373
+ return [
39374
+ nodePasteRule({
39375
+ find: YOUTUBE_REGEX_GLOBAL,
39376
+ type: this.type,
39377
+ getAttributes: (match2) => {
39378
+ return { src: match2.input };
39379
+ }
39380
+ })
39381
+ ];
39382
+ },
39383
+ renderHTML({ HTMLAttributes }) {
39384
+ const embedUrl = getEmbedUrlFromYoutubeUrl({
39385
+ url: HTMLAttributes.src,
39386
+ allowFullscreen: this.options.allowFullscreen,
39387
+ autoplay: this.options.autoplay,
39388
+ ccLanguage: this.options.ccLanguage,
39389
+ ccLoadPolicy: this.options.ccLoadPolicy,
39390
+ controls: this.options.controls,
39391
+ disableKBcontrols: this.options.disableKBcontrols,
39392
+ enableIFrameApi: this.options.enableIFrameApi,
39393
+ endTime: this.options.endTime,
39394
+ interfaceLanguage: this.options.interfaceLanguage,
39395
+ ivLoadPolicy: this.options.ivLoadPolicy,
39396
+ loop: this.options.loop,
39397
+ modestBranding: this.options.modestBranding,
39398
+ nocookie: this.options.nocookie,
39399
+ origin: this.options.origin,
39400
+ playlist: this.options.playlist,
39401
+ progressBarColor: this.options.progressBarColor,
39402
+ startAt: HTMLAttributes.start || 0
39403
+ });
39404
+ HTMLAttributes.src = embedUrl;
39405
+ return [
39406
+ "div",
39407
+ { "data-youtube-video": "" },
39408
+ [
39409
+ "iframe",
39410
+ mergeAttributes(this.options.HTMLAttributes, {
39411
+ width: this.options.width,
39412
+ height: this.options.height,
39413
+ allowfullscreen: this.options.allowFullscreen,
39414
+ autoplay: this.options.autoplay,
39415
+ ccLanguage: this.options.ccLanguage,
39416
+ ccLoadPolicy: this.options.ccLoadPolicy,
39417
+ disableKBcontrols: this.options.disableKBcontrols,
39418
+ enableIFrameApi: this.options.enableIFrameApi,
39419
+ endTime: this.options.endTime,
39420
+ interfaceLanguage: this.options.interfaceLanguage,
39421
+ ivLoadPolicy: this.options.ivLoadPolicy,
39422
+ loop: this.options.loop,
39423
+ modestBranding: this.options.modestBranding,
39424
+ origin: this.options.origin,
39425
+ playlist: this.options.playlist,
39426
+ progressBarColor: this.options.progressBarColor
39427
+ }, HTMLAttributes)
39428
+ ]
39429
+ ];
39430
+ }
39431
+ });
39098
39432
  const _hoisted_1$d = { class: "RichText" };
39099
39433
  const _hoisted_2$a = {
39100
39434
  key: 0,
@@ -39107,6 +39441,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
39107
39441
  },
39108
39442
  emits: ["update:modelValue"],
39109
39443
  setup(__props, { emit: __emit }) {
39444
+ const { txtField: txtField2 } = bagelFormUtils;
39110
39445
  let editor = ref();
39111
39446
  const props2 = __props;
39112
39447
  const focus2 = () => {
@@ -39114,6 +39449,18 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
39114
39449
  throw new Error("editor is not defined");
39115
39450
  return editor.value.chain().focus();
39116
39451
  };
39452
+ const { showModalForm } = useModal();
39453
+ function addImage() {
39454
+ showModalForm({
39455
+ title: "Add Image",
39456
+ schema: [
39457
+ txtField2("title", "Title"),
39458
+ { $el, id: "src", attrs: { bindkey: "url" } },
39459
+ txtField2("alt", "Alt Text")
39460
+ ],
39461
+ onSubmit: (imgObj) => focus2().setImage(imgObj).run()
39462
+ });
39463
+ }
39117
39464
  const config = [
39118
39465
  {
39119
39466
  name: "Bold",
@@ -39150,11 +39497,31 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
39150
39497
  command: () => focus2().toggleCode().run(),
39151
39498
  icon: "code"
39152
39499
  },
39153
- // {
39154
- // name: 'clearMarks',
39155
- // command: () => focus().unsetAllMarks(),
39156
- // icon: 'clear',
39157
- // },
39500
+ {
39501
+ name: "Image",
39502
+ command: addImage,
39503
+ icon: "image"
39504
+ },
39505
+ {
39506
+ name: "YouTube",
39507
+ command: () => {
39508
+ showModalForm({
39509
+ title: "Add YouTube Video",
39510
+ schema: [
39511
+ txtField2("src", "YouTube URL"),
39512
+ {
39513
+ $el: BglVideo,
39514
+ attrs: { src: (_2, { src }) => src || "" }
39515
+ }
39516
+ ],
39517
+ onSubmit: (videoObj) => {
39518
+ var _a2;
39519
+ return (_a2 = editor.value) == null ? void 0 : _a2.commands.setYoutubeVideo(videoObj);
39520
+ }
39521
+ });
39522
+ },
39523
+ icon: "youtube_activity"
39524
+ },
39158
39525
  {
39159
39526
  name: "Clear",
39160
39527
  command: () => focus2().clearNodes().run(),
@@ -39253,7 +39620,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
39253
39620
  const emit2 = __emit;
39254
39621
  function initEditor() {
39255
39622
  editor.value = new Editor({
39256
- extensions: [StarterKit],
39623
+ extensions: [StarterKit, Image, Youtube],
39257
39624
  content: props2.modelValue,
39258
39625
  onUpdate: ({ editor: editor2 }) => emit2("update:modelValue", editor2.getHTML())
39259
39626
  });
@@ -39280,6 +39647,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
39280
39647
  (openBlock(), createElementBlock(Fragment$1, null, renderList(config, (item) => {
39281
39648
  var _a2;
39282
39649
  return withDirectives(createVNode(unref(Btn), {
39650
+ tabindex: "-1",
39283
39651
  flat: !unref(editor).isActive(item.name, item.option),
39284
39652
  onClick: item.command,
39285
39653
  thin: "",
@@ -45997,7 +46365,7 @@ export {
45997
46365
  _sfc_main$j as DateInput,
45998
46366
  _sfc_main$c as DatePicker,
45999
46367
  kt$1 as Dropdown,
46000
- FileUpload,
46368
+ $el as FileUpload,
46001
46369
  _sfc_main$H as Icon,
46002
46370
  JSONInput,
46003
46371
  Layout,
@@ -46025,7 +46393,7 @@ export {
46025
46393
  _sfc_main$s as Title,
46026
46394
  ToggleInput,
46027
46395
  TopBar,
46028
- BagelFormUtils as bagelFormUtils,
46396
+ bagelFormUtils,
46029
46397
  bagelInjectionKey,
46030
46398
  bindAttrs,
46031
46399
  classify,