@bagelink/vue 0.0.1117 → 0.0.1121

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
@@ -59,7 +59,7 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
59
59
  };
60
60
  }
61
61
  });
62
- const _hoisted_1$X = ["aria-expanded", "aria-controls"];
62
+ const _hoisted_1$W = ["aria-expanded", "aria-controls"];
63
63
  const _hoisted_2$D = { class: "accordion-label" };
64
64
  const _hoisted_3$t = ["id", "aria-hidden"];
65
65
  const _sfc_main$17 = /* @__PURE__ */ defineComponent({
@@ -136,7 +136,7 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
136
136
  }, [
137
137
  createVNode(unref(_sfc_main$d), { icon: computedIcon.value }, null, 8, ["icon"])
138
138
  ], 2)) : createCommentVNode("", true)
139
- ], 8, _hoisted_1$X),
139
+ ], 8, _hoisted_1$W),
140
140
  createVNode(Transition, { name: "expand" }, {
141
141
  default: withCtx(() => [
142
142
  unref(isOpen) ? (openBlock(), createElementBlock("div", {
@@ -162,7 +162,7 @@ const _export_sfc = (sfc, props2) => {
162
162
  return target;
163
163
  };
164
164
  const AccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["__scopeId", "data-v-1e73ca3e"]]);
165
- const _hoisted_1$W = { class: "relative" };
165
+ const _hoisted_1$V = { class: "relative" };
166
166
  const _sfc_main$16 = /* @__PURE__ */ defineComponent({
167
167
  __name: "AddressSearch",
168
168
  emits: ["addressSelected"],
@@ -185,7 +185,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
185
185
  (_a2 = suggestion.value) == null ? void 0 : _a2.show();
186
186
  }
187
187
  return (_ctx, _cache) => {
188
- return openBlock(), createElementBlock("div", _hoisted_1$W, [
188
+ return openBlock(), createElementBlock("div", _hoisted_1$V, [
189
189
  createVNode(unref(_sfc_main$X), {
190
190
  ref_key: "suggestion",
191
191
  ref: suggestion,
@@ -221,7 +221,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
221
221
  };
222
222
  }
223
223
  });
224
- const _hoisted_1$V = {
224
+ const _hoisted_1$U = {
225
225
  key: 1,
226
226
  class: "bgl_btn-flex"
227
227
  };
@@ -291,7 +291,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
291
291
  key: 0,
292
292
  class: "h-100p",
293
293
  size: "15"
294
- })) : (openBlock(), createElementBlock("div", _hoisted_1$V, [
294
+ })) : (openBlock(), createElementBlock("div", _hoisted_1$U, [
295
295
  _ctx.icon ? (openBlock(), createBlock(unref(_sfc_main$d), {
296
296
  key: 0,
297
297
  icon: _ctx.icon
@@ -314,7 +314,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
314
314
  }
315
315
  });
316
316
  const Btn = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-3efa79fb"]]);
317
- const _hoisted_1$U = ["dismissable"];
317
+ const _hoisted_1$T = ["dismissable"];
318
318
  const _hoisted_2$C = { class: "m-0" };
319
319
  const _sfc_main$14 = /* @__PURE__ */ defineComponent({
320
320
  __name: "Alert",
@@ -352,12 +352,12 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
352
352
  icon: "close",
353
353
  onClick: _cache[0] || (_cache[0] = ($event) => isDismissed.value = true)
354
354
  })
355
- ], 10, _hoisted_1$U)) : createCommentVNode("", true);
355
+ ], 10, _hoisted_1$T)) : createCommentVNode("", true);
356
356
  };
357
357
  }
358
358
  });
359
359
  const Alert = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__scopeId", "data-v-57141c32"]]);
360
- const _hoisted_1$T = ["src", "alt"];
360
+ const _hoisted_1$S = ["src", "alt"];
361
361
  const _sfc_main$13 = /* @__PURE__ */ defineComponent({
362
362
  __name: "Avatar",
363
363
  props: {
@@ -376,7 +376,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
376
376
  key: 0,
377
377
  src: _ctx.src,
378
378
  alt: _ctx.name
379
- }, null, 8, _hoisted_1$T)) : (openBlock(), createElementBlock("p", {
379
+ }, null, 8, _hoisted_1$S)) : (openBlock(), createElementBlock("p", {
380
380
  key: 1,
381
381
  style: normalizeStyle({ "line-height": `${_ctx.size}px`, "font-size": `calc(1.5rem * ${_ctx.size} / 50)` })
382
382
  }, toDisplayString((_ctx.fallback || unref(initials)(_ctx.name || "")).toUpperCase()), 5))
@@ -415,7 +415,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
415
415
  }
416
416
  });
417
417
  const Badge = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__scopeId", "data-v-2f3caf93"]]);
418
- const _hoisted_1$S = { key: 1 };
418
+ const _hoisted_1$R = { key: 1 };
419
419
  const _sfc_main$11 = /* @__PURE__ */ defineComponent({
420
420
  __name: "BglComponent",
421
421
  props: {
@@ -445,7 +445,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
445
445
  if (props2.field.$el === "file") return FileUpload;
446
446
  if (props2.field.$el === "date") return _sfc_main$L;
447
447
  if (props2.field.$el === "tabs") return TabsNav;
448
- if (props2.field.$el === "form") return _sfc_main$S;
448
+ if (props2.field.$el === "form") return _sfc_main$R;
449
449
  return props2.field.$el ?? "div";
450
450
  });
451
451
  function getFieldData(path) {
@@ -562,7 +562,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
562
562
  id: [props2.id, child.id].filter(Boolean).join("."),
563
563
  field: child,
564
564
  "parent-path": props2.id
565
- }, null, 8, ["id", "field", "parent-path"])) : (openBlock(), createElementBlock("span", _hoisted_1$S, toDisplayString(child), 1))
565
+ }, null, 8, ["id", "field", "parent-path"])) : (openBlock(), createElementBlock("span", _hoisted_1$R, toDisplayString(child), 1))
566
566
  ], 64);
567
567
  }), 128))
568
568
  ], 64))
@@ -572,7 +572,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
572
572
  };
573
573
  }
574
574
  });
575
- const _hoisted_1$R = ["src"];
575
+ const _hoisted_1$Q = ["src"];
576
576
  const _hoisted_2$B = ["autoplay", "muted", "loop", "controls", "playsinline"];
577
577
  const _hoisted_3$s = ["src", "type"];
578
578
  const _sfc_main$10 = /* @__PURE__ */ defineComponent({
@@ -652,7 +652,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
652
652
  allowfullscreen: "",
653
653
  title: "Video",
654
654
  allow: "autoplay"
655
- }, null, 12, _hoisted_1$R)) : _ctx.src ? (openBlock(), createElementBlock("video", {
655
+ }, null, 12, _hoisted_1$Q)) : _ctx.src ? (openBlock(), createElementBlock("video", {
656
656
  key: 1,
657
657
  ref_key: "video",
658
658
  ref: video,
@@ -673,7 +673,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
673
673
  }
674
674
  });
675
675
  const BglVideo = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__scopeId", "data-v-006552f6"]]);
676
- const _hoisted_1$Q = {
676
+ const _hoisted_1$P = {
677
677
  key: 0,
678
678
  class: "card_label"
679
679
  };
@@ -706,7 +706,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
706
706
  }])
707
707
  }, {
708
708
  default: withCtx(() => [
709
- _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_1$Q, toDisplayString(_ctx.label), 1)) : createCommentVNode("", true),
709
+ _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_1$P, toDisplayString(_ctx.label), 1)) : createCommentVNode("", true),
710
710
  renderSlot(_ctx.$slots, "default")
711
711
  ]),
712
712
  _: 3
@@ -716,7 +716,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
716
716
  };
717
717
  }
718
718
  });
719
- const _hoisted_1$P = ["dir"];
719
+ const _hoisted_1$O = ["dir"];
720
720
  const _hoisted_2$A = {
721
721
  key: 0,
722
722
  class: "blocker"
@@ -931,7 +931,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
931
931
  }, void 0, true)
932
932
  ])
933
933
  ])
934
- ], 14, _hoisted_1$P);
934
+ ], 14, _hoisted_1$O);
935
935
  };
936
936
  }
937
937
  });
@@ -6879,13 +6879,13 @@ var script = defineComponent({
6879
6879
  return { bar, canvas, direction, mouse };
6880
6880
  }
6881
6881
  });
6882
- const _hoisted_1$O = {
6882
+ const _hoisted_1$N = {
6883
6883
  key: 0,
6884
6884
  class: "layer-hover-bar"
6885
6885
  };
6886
6886
  const _hoisted_2$z = ["x", "y", "width", "height"];
6887
6887
  function render(_ctx, _cache, $props, $setup, $data, $options) {
6888
- return _ctx.mouse.hover ? (openBlock(), createElementBlock("g", _hoisted_1$O, [
6888
+ return _ctx.mouse.hover ? (openBlock(), createElementBlock("g", _hoisted_1$N, [
6889
6889
  createElementVNode("rect", mergeProps({ class: "hover-bar" }, _ctx.barStyle, {
6890
6890
  x: _ctx.bar.x,
6891
6891
  y: _ctx.bar.y,
@@ -7037,7 +7037,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
7037
7037
  };
7038
7038
  }
7039
7039
  });
7040
- const _hoisted_1$N = {
7040
+ const _hoisted_1$M = {
7041
7041
  key: 0,
7042
7042
  class: "data"
7043
7043
  };
@@ -7094,7 +7094,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
7094
7094
  const computedSchema = computed(() => getFallbackSchema([itemData.value], props2.showFields));
7095
7095
  return (_ctx, _cache) => {
7096
7096
  var _a2;
7097
- return __props.data ? (openBlock(), createElementBlock("div", _hoisted_1$N, [
7097
+ return __props.data ? (openBlock(), createElementBlock("div", _hoisted_1$M, [
7098
7098
  _ctx.title ? (openBlock(), createBlock(unref(_sfc_main$4), {
7099
7099
  key: 0,
7100
7100
  label: _ctx.title
@@ -7107,7 +7107,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
7107
7107
  createElementVNode("div", _hoisted_3$p, [
7108
7108
  createElementVNode("p", _hoisted_4$h, toDisplayString((field == null ? void 0 : field.label) || unref(keyToLabel)(field.id)), 1)
7109
7109
  ]),
7110
- createVNode(unref(_sfc_main$T), {
7110
+ createVNode(unref(_sfc_main$S), {
7111
7111
  modelValue: itemData.value,
7112
7112
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => itemData.value = $event),
7113
7113
  label: "",
@@ -9761,7 +9761,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
9761
9761
  };
9762
9762
  }
9763
9763
  });
9764
- const _hoisted_1$M = { class: "px-1 pt-025 pb-1" };
9764
+ const _hoisted_1$L = { class: "px-1 pt-025 pb-1" };
9765
9765
  const _hoisted_2$x = { class: "ms-1" };
9766
9766
  const _sfc_main$W = /* @__PURE__ */ defineComponent({
9767
9767
  __name: "FieldSetVue",
@@ -9771,7 +9771,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
9771
9771
  },
9772
9772
  setup(__props) {
9773
9773
  return (_ctx, _cache) => {
9774
- return openBlock(), createElementBlock("fieldset", _hoisted_1$M, [
9774
+ return openBlock(), createElementBlock("fieldset", _hoisted_1$L, [
9775
9775
  createElementVNode("legend", _hoisted_2$x, toDisplayString(_ctx.legend || _ctx.label), 1),
9776
9776
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
9777
9777
  ]);
@@ -9810,6 +9810,128 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
9810
9810
  }
9811
9811
  });
9812
9812
  const Flag = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__scopeId", "data-v-f99f1900"]]);
9813
+ const _sfc_main$U = /* @__PURE__ */ defineComponent({
9814
+ __name: "BagelForm",
9815
+ props: {
9816
+ modelValue: { default: () => ({}) },
9817
+ schema: { default: void 0 }
9818
+ },
9819
+ emits: ["update:modelValue", "submit"],
9820
+ setup(__props, { expose: __expose, emit: __emit }) {
9821
+ const props2 = __props;
9822
+ const emit2 = __emit;
9823
+ const form = ref();
9824
+ let formData = ref({ ...props2.modelValue });
9825
+ let initialFormData = ref({ ...props2.modelValue });
9826
+ watch(() => props2.modelValue, (newValue) => {
9827
+ formData.value = { ...newValue };
9828
+ }, { immediate: true, deep: true });
9829
+ const resolvedSchema = computed(() => {
9830
+ if (!props2.schema) return void 0;
9831
+ return typeof props2.schema === "function" ? props2.schema() : props2.schema;
9832
+ });
9833
+ const isDirty = computed(() => {
9834
+ const current = JSON.stringify(formData.value);
9835
+ const initial = JSON.stringify(initialFormData.value);
9836
+ return current !== initial;
9837
+ });
9838
+ function getComponent(field) {
9839
+ var _a2;
9840
+ const componentMap = {
9841
+ text: TextInput,
9842
+ textarea: TextInput,
9843
+ number: NumberInput,
9844
+ array: _sfc_main$Q,
9845
+ select: SelectInput,
9846
+ toggle: ToggleInput,
9847
+ check: CheckInput,
9848
+ richtext: RichText,
9849
+ upload: UploadInput,
9850
+ file: FileUpload,
9851
+ date: _sfc_main$L,
9852
+ tabs: TabsNav,
9853
+ bglform: _sfc_main$R
9854
+ };
9855
+ if (field.$el === "textarea" && !((_a2 = field.attrs) == null ? void 0 : _a2.multiline)) {
9856
+ field.attrs = { ...field.attrs, multiline: true };
9857
+ }
9858
+ return componentMap[field.$el] ?? field.$el ?? "div";
9859
+ }
9860
+ function processFieldValue(fieldType, value) {
9861
+ if (value == null) return value;
9862
+ if (fieldType === "select" && typeof value === "object") return value.value;
9863
+ if (typeof value === "object" && "value" in value) return value.value;
9864
+ return value;
9865
+ }
9866
+ function updateFormData(fieldId, value, fieldType) {
9867
+ formData.value = {
9868
+ ...formData.value,
9869
+ [fieldId]: processFieldValue(fieldType, value)
9870
+ };
9871
+ emit2("update:modelValue", formData.value);
9872
+ }
9873
+ function handleSubmit() {
9874
+ emit2("submit", formData.value);
9875
+ initialFormData.value = { ...formData.value };
9876
+ }
9877
+ function renderSchemaField(field) {
9878
+ var _a2;
9879
+ const Component = getComponent(field);
9880
+ if (!Component) return null;
9881
+ const { $el, vIf, "v-if": vIf2, children: children2, ...fieldProps } = field;
9882
+ const currentValue = field.id ? formData.value[field.id] : void 0;
9883
+ const props22 = {
9884
+ ...fieldProps,
9885
+ "modelValue": processFieldValue(field.$el, currentValue),
9886
+ "onUpdate:modelValue": (value) => {
9887
+ var _a3;
9888
+ if (!field.id) return;
9889
+ updateFormData(field.id, value, field.$el);
9890
+ (_a3 = field.onUpdate) == null ? void 0 : _a3.call(field, value, formData.value);
9891
+ }
9892
+ };
9893
+ if (field.attrs) {
9894
+ Object.entries(field.attrs).forEach(([key, value]) => {
9895
+ props22[key] = typeof value === "function" ? value(field, formData.value) : value;
9896
+ });
9897
+ }
9898
+ if (field.class) {
9899
+ props22.class = typeof field.class === "function" ? field.class(field, formData.value) : field.class;
9900
+ }
9901
+ const slots = ((_a2 = field.children) == null ? void 0 : _a2.length) ? {
9902
+ default: () => field.children.map(
9903
+ (child) => typeof child === "string" ? child : renderSchemaField(child)
9904
+ )
9905
+ } : void 0;
9906
+ return h$2(Component, props22, slots);
9907
+ }
9908
+ function shouldRenderField(field) {
9909
+ const condition = field.vIf ?? field["v-if"];
9910
+ if (condition === void 0) return true;
9911
+ return typeof condition === "function" ? condition(formData.value[field.id], formData.value) : !!condition;
9912
+ }
9913
+ __expose({ form: form.value, isDirty: isDirty.value });
9914
+ return (_ctx, _cache) => {
9915
+ return openBlock(), createElementBlock("form", {
9916
+ ref_key: "form",
9917
+ ref: form,
9918
+ onSubmit: withModifiers(handleSubmit, ["prevent"])
9919
+ }, [
9920
+ resolvedSchema.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(resolvedSchema.value, (field, index2) => {
9921
+ return openBlock(), createElementBlock(Fragment, {
9922
+ key: field.id || index2
9923
+ }, [
9924
+ shouldRenderField(field) ? (openBlock(), createBlock(resolveDynamicComponent(renderSchemaField(field)), { key: 0 })) : createCommentVNode("", true)
9925
+ ], 64);
9926
+ }), 128)) : renderSlot(_ctx.$slots, "default", { key: 1 }),
9927
+ renderSlot(_ctx.$slots, "submit", {
9928
+ submit: handleSubmit,
9929
+ isDirty: isDirty.value
9930
+ })
9931
+ ], 544);
9932
+ };
9933
+ }
9934
+ });
9813
9935
  const state$1 = reactive(/* @__PURE__ */ new Map());
9814
9936
  function useTabs(group) {
9815
9937
  if (!state$1.has(group)) {
@@ -9823,8 +9945,8 @@ function useTabs(group) {
9823
9945
  });
9824
9946
  return { currentTab };
9825
9947
  }
9826
- const _hoisted_1$L = ["onClick"];
9827
- const _sfc_main$U = /* @__PURE__ */ defineComponent({
9948
+ const _hoisted_1$K = ["onClick"];
9949
+ const _sfc_main$T = /* @__PURE__ */ defineComponent({
9828
9950
  __name: "TabsNav",
9829
9951
  props: {
9830
9952
  title: {},
@@ -9906,14 +10028,14 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
9906
10028
  icon: tab.icon
9907
10029
  }, null, 8, ["icon"])) : createCommentVNode("", true),
9908
10030
  createTextVNode(" " + toDisplayString(tabLabel(tab)), 1)
9909
- ], 10, _hoisted_1$L);
10031
+ ], 10, _hoisted_1$K);
9910
10032
  }), 128))
9911
10033
  ], true)
9912
10034
  ], 2);
9913
10035
  };
9914
10036
  }
9915
10037
  });
9916
- const TabsNav = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__scopeId", "data-v-307612a9"]]);
10038
+ const TabsNav = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-307612a9"]]);
9917
10039
  const FORM_STATE_KEY = Symbol("bagelFormState");
9918
10040
  function safeClone(obj) {
9919
10041
  if (obj === null || typeof obj !== "object") return obj;
@@ -9975,8 +10097,8 @@ function useBagelFormState() {
9975
10097
  if (!state2) throw new Error("BagelFormState must be provided");
9976
10098
  return state2;
9977
10099
  }
9978
- const _hoisted_1$K = { key: 1 };
9979
- const _sfc_main$T = /* @__PURE__ */ defineComponent({
10100
+ const _hoisted_1$J = { key: 1 };
10101
+ const _sfc_main$S = /* @__PURE__ */ defineComponent({
9980
10102
  __name: "BglField",
9981
10103
  props: {
9982
10104
  field: {},
@@ -10006,7 +10128,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
10006
10128
  if (props2.field.$el === "file") return FileUpload;
10007
10129
  if (props2.field.$el === "date") return _sfc_main$L;
10008
10130
  if (props2.field.$el === "tabs") return TabsNav;
10009
- if (props2.field.$el === "bglform") return _sfc_main$S;
10131
+ if (props2.field.$el === "bglform") return _sfc_main$R;
10010
10132
  return props2.field.$el ?? "div";
10011
10133
  });
10012
10134
  const fieldData = computed({
@@ -10071,7 +10193,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
10071
10193
  fieldID: [props2.fieldID, child.id].filter(Boolean).join("."),
10072
10194
  field: child,
10073
10195
  "parent-path": props2.fieldID
10074
- }, null, 8, ["fieldID", "field", "parent-path"])) : (openBlock(), createElementBlock("span", _hoisted_1$K, toDisplayString(child), 1))
10196
+ }, null, 8, ["fieldID", "field", "parent-path"])) : (openBlock(), createElementBlock("span", _hoisted_1$J, toDisplayString(child), 1))
10075
10197
  ], 64);
10076
10198
  }), 128))
10077
10199
  ]),
@@ -10080,7 +10202,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
10080
10202
  };
10081
10203
  }
10082
10204
  });
10083
- const _sfc_main$S = /* @__PURE__ */ defineComponent({
10205
+ const _sfc_main$R = /* @__PURE__ */ defineComponent({
10084
10206
  __name: "BglForm",
10085
10207
  props: {
10086
10208
  label: {},
@@ -10182,7 +10304,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
10182
10304
  return openBlock(), createElementBlock(Fragment, null, [
10183
10305
  _ctx.tag === "template" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
10184
10306
  (openBlock(true), createElementBlock(Fragment, null, renderList(computedSchema.value, (field, i2) => {
10185
- return openBlock(), createBlock(unref(_sfc_main$T), {
10307
+ return openBlock(), createBlock(unref(_sfc_main$S), {
10186
10308
  key: field.id || `${i2}p`,
10187
10309
  fieldID: field.id,
10188
10310
  field
@@ -10205,7 +10327,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
10205
10327
  label: _ctx.label
10206
10328
  }, null, 8, ["label"])) : createCommentVNode("", true),
10207
10329
  (openBlock(true), createElementBlock(Fragment, null, renderList(computedSchema.value, (field, i2) => {
10208
- return openBlock(), createBlock(unref(_sfc_main$T), {
10330
+ return openBlock(), createBlock(unref(_sfc_main$S), {
10209
10331
  key: field.id || `${i2}p`,
10210
10332
  fieldID: field.id,
10211
10333
  field
@@ -10223,114 +10345,6 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
10223
10345
  };
10224
10346
  }
10225
10347
  });
10226
- const _hoisted_1$J = { key: 0 };
10227
- const _sfc_main$R = /* @__PURE__ */ defineComponent({
10228
- __name: "BglMultiStepForm",
10229
- props: /* @__PURE__ */ mergeModels({
10230
- bagelFormProps: { default: () => ({}) },
10231
- schema: {}
10232
- }, {
10233
- "modelValue": { default: () => {
10234
- }, required: true },
10235
- "modelModifiers": {}
10236
- }),
10237
- emits: /* @__PURE__ */ mergeModels(["submit"], ["update:modelValue"]),
10238
- setup(__props, { expose: __expose, emit: __emit }) {
10239
- var _a2, _b, _c, _d;
10240
- const props2 = __props;
10241
- const emits = __emit;
10242
- const formRef = ref();
10243
- const formData = useModel(
10244
- __props,
10245
- "modelValue"
10246
- );
10247
- function reportValidity() {
10248
- if (!formRef.value) return false;
10249
- return formRef.value.validateForm();
10250
- }
10251
- const computedSchema = computed(
10252
- () => useBglSchema({ schema: props2.schema })
10253
- );
10254
- const numberOfSteps = ref(computedSchema.value.length);
10255
- let currentStep = ref(0);
10256
- const currentStepSchema = computed(() => computedSchema.value[currentStep.value]);
10257
- let isStepping = ref(false);
10258
- let isSteppingTO;
10259
- watch(
10260
- () => currentStep.value,
10261
- () => {
10262
- clearTimeout(isSteppingTO);
10263
- isStepping.value = true;
10264
- isSteppingTO = setTimeout(() => isStepping.value = false, 600);
10265
- }
10266
- );
10267
- const canDoNext = computed(() => currentStep.value < numberOfSteps.value - 1);
10268
- function prevStep() {
10269
- if (currentStep.value > 0) currentStep.value--;
10270
- }
10271
- function nextStep() {
10272
- if (reportValidity() === false) return;
10273
- if (canDoNext.value) currentStep.value++;
10274
- }
10275
- function handleSubmit() {
10276
- if (reportValidity() === false) return;
10277
- emits("submit", formData.value);
10278
- }
10279
- __expose({
10280
- submit: handleSubmit,
10281
- validateForm: (_a2 = formRef.value) == null ? void 0 : _a2.validateForm,
10282
- deleteItem: (_b = formRef.value) == null ? void 0 : _b.deleteItem,
10283
- isDirty: (_c = formRef.value) == null ? void 0 : _c.isDirty,
10284
- clearForm: (_d = formRef.value) == null ? void 0 : _d.clearForm
10285
- });
10286
- return (_ctx, _cache) => {
10287
- return openBlock(), createElementBlock(Fragment, null, [
10288
- createVNode(Transition, {
10289
- duration: 600,
10290
- name: "fade",
10291
- mode: "out-in"
10292
- }, {
10293
- default: withCtx(() => [
10294
- !unref(isStepping) ? (openBlock(), createElementBlock("div", _hoisted_1$J, [
10295
- createVNode(unref(_sfc_main$S), mergeProps({
10296
- ref_key: "formRef",
10297
- ref: formRef,
10298
- modelValue: formData.value,
10299
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formData.value = $event),
10300
- schema: [currentStepSchema.value]
10301
- }, _ctx.bagelFormProps), {
10302
- success: withCtx(() => [
10303
- renderSlot(_ctx.$slots, "success")
10304
- ]),
10305
- error: withCtx(() => [
10306
- renderSlot(_ctx.$slots, "error")
10307
- ]),
10308
- _: 3
10309
- }, 16, ["modelValue", "schema"])
10310
- ])) : createCommentVNode("", true)
10311
- ]),
10312
- _: 3
10313
- }),
10314
- renderSlot(_ctx.$slots, "steppers", normalizeProps(guardReactiveProps({ prevStep, nextStep, submit: handleSubmit })), () => [
10315
- createVNode(unref(Btn), {
10316
- disabled: unref(currentStep) === 0,
10317
- value: "Back",
10318
- onClick: prevStep
10319
- }, null, 8, ["disabled"]),
10320
- canDoNext.value ? (openBlock(), createBlock(unref(Btn), {
10321
- key: 0,
10322
- value: "Next",
10323
- onClick: nextStep
10324
- })) : (openBlock(), createBlock(unref(Btn), {
10325
- key: 1,
10326
- value: "Submit",
10327
- onClick: handleSubmit
10328
- }))
10329
- ])
10330
- ], 64);
10331
- };
10332
- }
10333
- });
10334
10348
  const _hoisted_1$I = { class: "label mb-05" };
10335
10349
  const _hoisted_2$w = {
10336
10350
  key: 0,
@@ -10402,7 +10416,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
10402
10416
  thin: "",
10403
10417
  class: "mb-05 itemBox transition p-05"
10404
10418
  }, [
10405
- createVNode(unref(_sfc_main$S), {
10419
+ createVNode(unref(_sfc_main$R), {
10406
10420
  modelValue: data2.value[i2],
10407
10421
  "onUpdate:modelValue": [($event) => data2.value[i2] = $event, emitValue],
10408
10422
  schema: _ctx.schema
@@ -10432,7 +10446,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
10432
10446
  _: 1
10433
10447
  })) : createCommentVNode("", true)
10434
10448
  ])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(data2.value, (_2, i2) => {
10435
- return openBlock(), createBlock(unref(_sfc_main$T), {
10449
+ return openBlock(), createBlock(unref(_sfc_main$S), {
10436
10450
  key: i2,
10437
10451
  modelValue: data2.value[i2],
10438
10452
  "onUpdate:modelValue": [($event) => data2.value[i2] = $event, emitValue],
@@ -20284,7 +20298,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
20284
20298
  emits: ["update:modelValue"],
20285
20299
  setup(__props, { emit: __emit }) {
20286
20300
  const emit2 = __emit;
20287
- let numberValue = ref(__props.modelValue || 0);
20301
+ let numberValue = ref(Number.parseFloat(`${__props.modelValue}`) || 0);
20288
20302
  const btnLayouts = ["horizontal", "vertical"];
20289
20303
  const canAdd = computed(() => !(__props.max !== void 0 && numberValue.value + __props.step > __props.max));
20290
20304
  const canDecrement = computed(() => !(__props.min !== void 0 && numberValue.value - __props.step < __props.min));
@@ -20318,7 +20332,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
20318
20332
  }, { immediate: true });
20319
20333
  watch(() => __props.modelValue, (newVal) => {
20320
20334
  if (newVal !== numberValue.value) {
20321
- numberValue.value = newVal || 0;
20335
+ numberValue.value = Number.parseFloat(`${newVal}`) || 0;
20322
20336
  }
20323
20337
  }, { immediate: true });
20324
20338
  return (_ctx, _cache) => {
@@ -20422,7 +20436,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
20422
20436
  };
20423
20437
  }
20424
20438
  });
20425
- const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-f265687e"]]);
20439
+ const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-4a70ce50"]]);
20426
20440
  const _hoisted_1$x = ["value", "autofocus", "onKeydown", "onPaste"];
20427
20441
  const _sfc_main$F = /* @__PURE__ */ defineComponent({
20428
20442
  __name: "OTP",
@@ -21111,6 +21125,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
21111
21125
  flat: "",
21112
21126
  "aria-label": action.name,
21113
21127
  class: normalizeClass([[action.class, { active: _ctx.selectedStyles.has(action.name) }], ""]),
21128
+ tabindex: "-1",
21114
21129
  onClick: ($event) => runAction(action.name)
21115
21130
  }, null, 8, ["icon", "aria-label", "class", "onClick"])), [
21116
21131
  [_directive_tooltip, action.label]
@@ -21124,7 +21139,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
21124
21139
  };
21125
21140
  }
21126
21141
  });
21127
- const EditorToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-33dff8fa"]]);
21142
+ const EditorToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-bcd681b9"]]);
21128
21143
  function createCommandExecutor(state2, commands) {
21129
21144
  return {
21130
21145
  execute(command, value) {
@@ -31384,65 +31399,82 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
31384
31399
  props: {
31385
31400
  src: {},
31386
31401
  pathKey: {},
31387
- alt: { default: "" },
31402
+ alt: {},
31388
31403
  width: {},
31389
31404
  height: {},
31390
31405
  caption: {}
31391
31406
  },
31392
31407
  setup(__props) {
31408
+ const props2 = __props;
31393
31409
  let imageSrc = ref(null);
31394
- const fileBaseUrl = computed(() => "https://files.bagel.design".replace(/\/$/, ""));
31395
- function pathToUrl() {
31410
+ let loadingError = ref(false);
31411
+ const fileBaseUrl = computed(() => "https://files.bagel.design");
31412
+ function getImageUrl() {
31396
31413
  var _a2;
31397
- if ((_a2 = __props.pathKey) == null ? void 0 : _a2.startsWith("static/")) return `${void 0}/${__props.pathKey}`;
31398
- return `${fileBaseUrl.value}/${__props.pathKey}`;
31414
+ if (!props2.src && !props2.pathKey) return null;
31415
+ if (props2.src) return props2.src;
31416
+ if ((_a2 = props2.pathKey) == null ? void 0 : _a2.startsWith("static/")) {
31417
+ return `${void 0}/${props2.pathKey}`;
31418
+ }
31419
+ return `${fileBaseUrl.value}/${props2.pathKey}`;
31420
+ }
31421
+ async function getCachedImage(url) {
31422
+ if (!("caches" in window)) return null;
31423
+ try {
31424
+ const imgCache = await window.caches.open("img-cache");
31425
+ const cachedResponse = await imgCache.match(url);
31426
+ if (cachedResponse) {
31427
+ return URL.createObjectURL(await cachedResponse.blob());
31428
+ }
31429
+ } catch (error) {
31430
+ console.warn("Cache access error:", error);
31431
+ }
31432
+ return null;
31433
+ }
31434
+ async function cacheImage(url, blob) {
31435
+ if (!("caches" in window)) return;
31436
+ try {
31437
+ const imgCache = await window.caches.open("img-cache");
31438
+ await imgCache.put(url, new Response(blob));
31439
+ } catch (error) {
31440
+ console.warn("Cache write error:", error);
31441
+ }
31442
+ }
31443
+ async function convertHeicImage(url) {
31444
+ await appendScript("https://cdnjs.cloudflare.com/ajax/libs/heic2any/0.0.1/index.min.js");
31445
+ const response = await fetch(normalizeURL(url));
31446
+ const blob = await response.blob();
31447
+ const convertedBlob = await window.heic2any({ blob });
31448
+ await cacheImage(url, convertedBlob);
31449
+ return URL.createObjectURL(convertedBlob);
31399
31450
  }
31400
31451
  async function loadImage() {
31401
31452
  var _a2;
31402
- const url = __props.src || pathToUrl();
31403
- console.log(url);
31453
+ loadingError.value = false;
31454
+ const url = getImageUrl();
31404
31455
  if (!url) {
31405
31456
  imageSrc.value = null;
31406
31457
  return;
31407
31458
  }
31408
- const ext = (_a2 = url.split(".").pop()) == null ? void 0 : _a2.toLowerCase().split("?").shift();
31409
- if (ext === "heic") {
31410
- if (!("caches" in window)) {
31411
- console.warn("Caching is not available. Proceeding without cache.");
31412
- } else {
31413
- try {
31414
- const imgCache = await window.caches.open("img-cache");
31415
- const cachedResponse = await imgCache.match(url);
31416
- if (cachedResponse) {
31417
- imageSrc.value = URL.createObjectURL(await cachedResponse.blob());
31418
- return;
31419
- }
31420
- } catch (error) {
31421
- console.warn("Error accessing cache:", error);
31422
- }
31423
- }
31424
- try {
31425
- await appendScript("https://cdnjs.cloudflare.com/ajax/libs/heic2any/0.0.1/index.min.js");
31426
- const response = await fetch(normalizeURL(url));
31427
- const blob = await response.blob();
31428
- const convertedBlob = await window.heic2any({ blob });
31429
- imageSrc.value = URL.createObjectURL(convertedBlob);
31430
- if ("caches" in window) {
31431
- try {
31432
- const imgCache = await window.caches.open("img-cache");
31433
- imgCache.put(url, new Response(convertedBlob));
31434
- } catch (cacheError) {
31435
- console.warn("Failed to cache the image:", cacheError);
31436
- }
31459
+ try {
31460
+ const ext = (_a2 = url.split(".").pop()) == null ? void 0 : _a2.toLowerCase().split("?")[0];
31461
+ if (ext === "heic") {
31462
+ const cachedSrc = await getCachedImage(url);
31463
+ if (cachedSrc) {
31464
+ imageSrc.value = cachedSrc;
31465
+ return;
31437
31466
  }
31438
- } catch (error) {
31439
- console.error("Error converting HEIC file:", error);
31467
+ imageSrc.value = await convertHeicImage(url);
31468
+ } else {
31469
+ imageSrc.value = url;
31440
31470
  }
31441
- } else {
31442
- imageSrc.value = url;
31471
+ } catch (error) {
31472
+ console.error("Image loading error:", error);
31473
+ loadingError.value = true;
31474
+ imageSrc.value = null;
31443
31475
  }
31444
31476
  }
31445
- watch(() => [__props.src, __props.pathKey], loadImage, { immediate: true });
31477
+ watch(() => [props2.src, props2.pathKey], loadImage, { immediate: true });
31446
31478
  return (_ctx, _cache) => {
31447
31479
  return _ctx.caption ? (openBlock(), createElementBlock("figcaption", _hoisted_1$h, [
31448
31480
  unref(imageSrc) ? (openBlock(), createElementBlock("img", mergeProps({
@@ -31465,8 +31497,17 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
31465
31497
  alt: _ctx.alt,
31466
31498
  width: unref(normalizeDimension)(_ctx.width),
31467
31499
  height: unref(normalizeDimension)(_ctx.height)
31468
- }), null, 16, _hoisted_3$7)) : (openBlock(), createBlock(unref(Skeleton), {
31500
+ }), null, 16, _hoisted_3$7)) : unref(loadingError) ? (openBlock(), createElementBlock("div", {
31469
31501
  key: 2,
31502
+ class: "flex-center error-image",
31503
+ style: normalizeStyle({
31504
+ width: unref(normalizeDimension)(_ctx.width),
31505
+ height: unref(normalizeDimension)(_ctx.height)
31506
+ })
31507
+ }, [
31508
+ createVNode(unref(_sfc_main$d), { name: "broken_image" })
31509
+ ], 4)) : (openBlock(), createBlock(unref(Skeleton), {
31510
+ key: 3,
31470
31511
  class: "img-web-kit",
31471
31512
  width: unref(normalizeDimension)(_ctx.width),
31472
31513
  height: unref(normalizeDimension)(_ctx.height)
@@ -31474,7 +31515,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
31474
31515
  };
31475
31516
  }
31476
31517
  });
31477
- const Image$1 = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-1b7f9bb3"]]);
31518
+ const Image$1 = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-6f277b5b"]]);
31478
31519
  const _hoisted_1$g = { class: "m-0 pb-025 txt14 line-height-1 w60 menu-text" };
31479
31520
  const _sfc_main$o = /* @__PURE__ */ defineComponent({
31480
31521
  __name: "BottomMenu",
@@ -32282,15 +32323,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
32282
32323
  "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => emit2("update:visible", $event))
32283
32324
  }, createSlots({
32284
32325
  default: withCtx(() => [
32285
- _ctx.visible ? (openBlock(), createBlock(unref(_sfc_main$S), {
32286
- key: 0,
32287
- ref_key: "form",
32288
- ref: form,
32326
+ createVNode(unref(_sfc_main$U), {
32289
32327
  modelValue: formData.value,
32290
32328
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formData.value = $event),
32291
32329
  schema: computedFormSchema.value,
32292
32330
  onSubmit: runSubmit
32293
- }, null, 8, ["modelValue", "schema"])) : createCommentVNode("", true)
32331
+ }, null, 8, ["modelValue", "schema"])
32294
32332
  ]),
32295
32333
  _: 2
32296
32334
  }, [
@@ -32325,7 +32363,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
32325
32363
  };
32326
32364
  }
32327
32365
  });
32328
- const ModalForm = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-7361477b"]]);
32366
+ const ModalForm = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-f796c518"]]);
32329
32367
  const _hoisted_1$6 = { class: "full-nav" };
32330
32368
  const _hoisted_2$4 = { class: "nav-scroll" };
32331
32369
  const _hoisted_3$3 = { class: "nav-links-wrapper" };
@@ -32631,6 +32669,7 @@ function debounceFilter(ms, options = {}) {
32631
32669
  lastRejector();
32632
32670
  lastRejector = noop;
32633
32671
  };
32672
+ let lastInvoker;
32634
32673
  const filter3 = (invoke) => {
32635
32674
  const duration = toValue(ms);
32636
32675
  const maxDuration = toValue(options.maxWait);
@@ -32645,12 +32684,13 @@ function debounceFilter(ms, options = {}) {
32645
32684
  }
32646
32685
  return new Promise((resolve, reject3) => {
32647
32686
  lastRejector = options.rejectOnCancel ? reject3 : resolve;
32687
+ lastInvoker = invoke;
32648
32688
  if (maxDuration && !maxTimer) {
32649
32689
  maxTimer = setTimeout(() => {
32650
32690
  if (timer)
32651
32691
  _clearTimeout(timer);
32652
32692
  maxTimer = null;
32653
- resolve(invoke());
32693
+ resolve(lastInvoker());
32654
32694
  }, maxDuration);
32655
32695
  }
32656
32696
  timer = setTimeout(() => {
@@ -35534,12 +35574,12 @@ export {
35534
35574
  Alert,
35535
35575
  Avatar,
35536
35576
  Badge,
35537
- _sfc_main$S as BagelForm,
35577
+ _sfc_main$R as BagelForm,
35578
+ _sfc_main$U as BagelForm2,
35538
35579
  BagelVue,
35539
35580
  _sfc_main$11 as BglComponent,
35540
- _sfc_main$T as BglField,
35541
- _sfc_main$S as BglForm,
35542
- _sfc_main$R as BglMultiStepForm,
35581
+ _sfc_main$S as BglField,
35582
+ _sfc_main$R as BglForm,
35543
35583
  BglVideo,
35544
35584
  BottomMenu,
35545
35585
  Btn,