@bagelink/vue 1.2.79 → 1.2.81

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
@@ -552,7 +552,7 @@ const _hoisted_2$K = ["data-date", "onClick"];
552
552
  const _hoisted_3$E = { class: "event-content" };
553
553
  const _hoisted_4$r = { class: "event-time" };
554
554
  const _hoisted_5$q = { class: "event-details" };
555
- const _hoisted_6$n = { class: "event-title" };
555
+ const _hoisted_6$m = { class: "event-title" };
556
556
  const _sfc_main$17 = /* @__PURE__ */ defineComponent({
557
557
  __name: "AgendaView",
558
558
  props: {
@@ -675,7 +675,7 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
675
675
  createElementVNode("div", _hoisted_3$E, [
676
676
  createElementVNode("div", _hoisted_4$r, toDisplayString(unref(formatDate)(event.start_time, { fmt: "HH:mm" })), 1),
677
677
  createElementVNode("div", _hoisted_5$q, [
678
- createElementVNode("div", _hoisted_6$n, toDisplayString(event.title), 1),
678
+ createElementVNode("div", _hoisted_6$m, toDisplayString(event.title), 1),
679
679
  createElementVNode("div", {
680
680
  class: normalizeClass(["event-day", { today: event.isToday }])
681
681
  }, toDisplayString(event.dayLabel), 3)
@@ -694,7 +694,7 @@ const _hoisted_2$J = { class: "border-bottom me-1 txt-center p-05 dayGrid" };
694
694
  const _hoisted_3$D = { class: "overflow h-100p pe-05" };
695
695
  const _hoisted_4$q = { class: "time-column" };
696
696
  const _hoisted_5$p = { class: "events-column" };
697
- const _hoisted_6$m = ["onClick"];
697
+ const _hoisted_6$l = ["onClick"];
698
698
  const _hoisted_7$h = { class: "event-content" };
699
699
  const _hoisted_8$b = { class: "white-space ellipsis-1" };
700
700
  const _hoisted_9$7 = { class: "event-time opacity-8" };
@@ -878,7 +878,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
878
878
  createElementVNode("div", _hoisted_8$b, toDisplayString(event.title), 1),
879
879
  createElementVNode("div", _hoisted_9$7, toDisplayString(unref(formatDate)(new Date(event.start_time), { fmt: "HH:mm" })) + " - " + toDisplayString(unref(formatDate)(new Date(event.end_time), { fmt: "HH:mm" })), 1)
880
880
  ])
881
- ], 12, _hoisted_6$m);
881
+ ], 12, _hoisted_6$l);
882
882
  }), 128))
883
883
  ]),
884
884
  dragState.value.isDragging && dragState.value.start && dragState.value.end ? (openBlock(), createElementBlock("div", {
@@ -906,7 +906,7 @@ const _hoisted_2$I = { class: "month-header" };
906
906
  const _hoisted_3$C = { class: "month-grid" };
907
907
  const _hoisted_4$p = { class: "day-number" };
908
908
  const _hoisted_5$o = { class: "day-events" };
909
- const _hoisted_6$l = {
909
+ const _hoisted_6$k = {
910
910
  key: 0,
911
911
  class: "event-dot"
912
912
  };
@@ -1009,7 +1009,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
1009
1009
  createElementVNode("div", _hoisted_4$p, toDisplayString(unref(fmtDate)(day.date, { fmt: "DD" })), 1),
1010
1010
  createElementVNode("div", _hoisted_5$o, [
1011
1011
  isMobile.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1012
- day.events.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_6$l)) : createCommentVNode("", true)
1012
+ day.events.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_6$k)) : createCommentVNode("", true)
1013
1013
  ], 64)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(day.events, (event) => {
1014
1014
  return openBlock(), createElementBlock("div", {
1015
1015
  key: event.id,
@@ -1035,7 +1035,7 @@ const _hoisted_2$H = { class: "overflow h-100p pe-05" };
1035
1035
  const _hoisted_3$B = ["onMousedown"];
1036
1036
  const _hoisted_4$o = ["onClick"];
1037
1037
  const _hoisted_5$n = { class: "overflow-hidden color-white p-025 txt12 h-100p" };
1038
- const _hoisted_6$k = { class: "white-space ellipsis-1" };
1038
+ const _hoisted_6$j = { class: "white-space ellipsis-1" };
1039
1039
  const _hoisted_7$f = { class: "txt10 opacity-8 user-select-none" };
1040
1040
  const _hoisted_8$9 = { class: "color-primary txt-12 p-025" };
1041
1041
  const slotHeight = 60;
@@ -1366,7 +1366,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
1366
1366
  onClick: withModifiers(($event) => handleEventSelection(event, $event), ["stop"])
1367
1367
  }, [
1368
1368
  createElementVNode("div", _hoisted_5$n, [
1369
- createElementVNode("div", _hoisted_6$k, toDisplayString(event.title), 1),
1369
+ createElementVNode("div", _hoisted_6$j, toDisplayString(event.title), 1),
1370
1370
  createElementVNode("div", _hoisted_7$f, toDisplayString(unref(formatDate)(event.start_time, { fmt: "HH:mm" })) + " - " + toDisplayString(unref(formatDate)(event.end_time, { fmt: "HH:mm" })), 1)
1371
1371
  ])
1372
1372
  ], 44, _hoisted_4$o);
@@ -7925,7 +7925,7 @@ const _hoisted_2$1$1 = ["width", "height", "viewBox"];
7925
7925
  const _hoisted_3$y = { class: "layer-rectangles" };
7926
7926
  const _hoisted_4$m = ["transform", "onMouseover"];
7927
7927
  const _hoisted_5$m = ["width", "height"];
7928
- const _hoisted_6$j = {
7928
+ const _hoisted_6$i = {
7929
7929
  x: 0 + 10,
7930
7930
  y: 0 + 20,
7931
7931
  "font-size": `15px`,
@@ -7968,7 +7968,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
7968
7968
  }, () => [
7969
7969
  createElementVNode(
7970
7970
  "text",
7971
- _hoisted_6$j,
7971
+ _hoisted_6$i,
7972
7972
  toDisplayString(r2.data.name),
7973
7973
  1
7974
7974
  /* TEXT */
@@ -9531,7 +9531,7 @@ const _hoisted_2$C = {
9531
9531
  const _hoisted_3$x = { class: "infinite-wrapper" };
9532
9532
  const _hoisted_4$l = { class: "row first-row" };
9533
9533
  const _hoisted_5$l = { key: 0 };
9534
- const _hoisted_6$i = ["onClick"];
9534
+ const _hoisted_6$h = ["onClick"];
9535
9535
  const _hoisted_7$d = { class: "flex" };
9536
9536
  const _hoisted_8$8 = ["onClick"];
9537
9537
  const _hoisted_9$5 = { key: 0 };
@@ -9693,7 +9693,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
9693
9693
  }, null, 8, ["class"])
9694
9694
  ], 2)
9695
9695
  ])
9696
- ], 8, _hoisted_6$i);
9696
+ ], 8, _hoisted_6$h);
9697
9697
  }), 128))
9698
9698
  ]),
9699
9699
  createElementVNode("tbody", null, [
@@ -13394,17 +13394,19 @@ function getFallbackSchema(data2, columns) {
13394
13394
  function sleep(ms = 100) {
13395
13395
  return new Promise((resolve) => setTimeout(resolve, ms));
13396
13396
  }
13397
- function appendScript(src, options) {
13398
- return new Promise((resolve, reject3) => {
13399
- if (options == null ? void 0 : options.id) {
13400
- if (document.getElementById(options.id)) {
13401
- resolve();
13402
- return;
13403
- }
13404
- } else if (document.querySelector(`script[src="${src}"]`)) {
13405
- resolve();
13406
- return;
13407
- }
13397
+ const scriptsLoading = /* @__PURE__ */ new Map();
13398
+ async function appendScript(src, options) {
13399
+ const scriptId = (options == null ? void 0 : options.id) || src;
13400
+ await sleep(1);
13401
+ if (scriptsLoading.has(scriptId)) {
13402
+ return scriptsLoading.get(scriptId);
13403
+ }
13404
+ if ((options == null ? void 0 : options.id) && document.getElementById(options.id)) {
13405
+ return Promise.resolve();
13406
+ } else if (document.querySelector(`script[src="${src}"]`)) {
13407
+ return Promise.resolve();
13408
+ }
13409
+ const loadingPromise = new Promise((resolve, reject3) => {
13408
13410
  const script2 = document.createElement("script");
13409
13411
  script2.src = src;
13410
13412
  if (options == null ? void 0 : options.id) {
@@ -13412,10 +13414,16 @@ function appendScript(src, options) {
13412
13414
  }
13413
13415
  script2.onload = () => {
13414
13416
  resolve();
13417
+ scriptsLoading.delete(scriptId);
13418
+ };
13419
+ script2.onerror = (err) => {
13420
+ reject3(err);
13421
+ scriptsLoading.delete(scriptId);
13415
13422
  };
13416
- script2.onerror = reject3;
13417
13423
  document.head.append(script2);
13418
13424
  });
13425
+ scriptsLoading.set(scriptId, loadingPromise);
13426
+ return loadingPromise;
13419
13427
  }
13420
13428
  function appendStyle(src) {
13421
13429
  return new Promise((resolve, reject3) => {
@@ -13547,6 +13555,10 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
13547
13555
  var _a;
13548
13556
  return ((_a = form.value) == null ? void 0 : _a.reportValidity()) ?? false;
13549
13557
  };
13558
+ const checkValidity = () => {
13559
+ var _a;
13560
+ return ((_a = form.value) == null ? void 0 : _a.checkValidity()) ?? false;
13561
+ };
13550
13562
  const formError = ref();
13551
13563
  async function handleSubmit() {
13552
13564
  var _a;
@@ -13586,7 +13598,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
13586
13598
  updateFormData(input.name, value);
13587
13599
  }
13588
13600
  }
13589
- __expose({ form, isDirty, validateForm, resolveSchema, refreshSchema });
13601
+ __expose({ form, isDirty, validateForm, resolveSchema, refreshSchema, checkValidity });
13590
13602
  return (_ctx, _cache) => {
13591
13603
  return openBlock(), createElementBlock(Fragment, null, [
13592
13604
  formState.value !== "success" || !_ctx.$slots.success ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
@@ -13649,7 +13661,7 @@ const _hoisted_5$k = {
13649
13661
  key: 0,
13650
13662
  class: "bgl-step-label"
13651
13663
  };
13652
- const _hoisted_6$h = { class: "bgl-form-wrapper" };
13664
+ const _hoisted_6$g = { class: "bgl-form-wrapper" };
13653
13665
  const _hoisted_7$c = { class: "bgl-step-controls" };
13654
13666
  const _sfc_main$U = /* @__PURE__ */ defineComponent({
13655
13667
  __name: "BglMultiStepForm",
@@ -13671,6 +13683,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
13671
13683
  }),
13672
13684
  emits: /* @__PURE__ */ mergeModels(["submit", "stepChange"], ["update:modelValue"]),
13673
13685
  setup(__props, { expose: __expose, emit: __emit }) {
13686
+ var _a;
13674
13687
  const props2 = __props;
13675
13688
  const emits = __emit;
13676
13689
  const formRef = ref();
@@ -13732,8 +13745,6 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
13732
13745
  const actualIndex = schemaIndexMap.value[currentStep.value];
13733
13746
  return [computedSchema.value[actualIndex]];
13734
13747
  });
13735
- const isStepping = ref(false);
13736
- let isSteppingTO;
13737
13748
  const slideDirection = ref(props2.rtl ? "right" : "left");
13738
13749
  watch(
13739
13750
  () => currentStep.value,
@@ -13744,9 +13755,6 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
13744
13755
  slideDirection.value = props2.direction;
13745
13756
  }
13746
13757
  previousStep.value = oldStep;
13747
- clearTimeout(isSteppingTO);
13748
- isStepping.value = true;
13749
- isSteppingTO = setTimeout(() => isStepping.value = false, 200);
13750
13758
  emits("stepChange", {
13751
13759
  newStep,
13752
13760
  oldStep,
@@ -13755,15 +13763,24 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
13755
13763
  });
13756
13764
  }
13757
13765
  );
13758
- const canDoNext = computed(() => currentStep.value < numberOfSteps.value - 1);
13766
+ const isLastStep = computed(() => currentStep.value === numberOfSteps.value - 1);
13759
13767
  const isStepValidated = computed(() => (stepIndex) => validatedSteps.value.includes(stepIndex));
13768
+ const isStepValid = ref(false);
13769
+ async function checkCurrentStepValidity() {
13770
+ var _a2;
13771
+ await nextTick();
13772
+ if (!props2.validateOnSteps) isStepValid.value = true;
13773
+ else isStepValid.value = ((_a2 = formRef.value) == null ? void 0 : _a2.checkValidity()) ?? false;
13774
+ }
13760
13775
  function prevStep() {
13761
13776
  if (currentStep.value > 0) currentStep.value--;
13762
13777
  }
13763
13778
  const formContainer = ref();
13764
- function nextStep() {
13779
+ async function nextStep() {
13765
13780
  if (props2.validateOnSteps && reportValidity() === false) return;
13766
- if (canDoNext.value) currentStep.value++;
13781
+ if (!isLastStep.value) currentStep.value++;
13782
+ await sleep(400);
13783
+ checkCurrentStepValidity();
13767
13784
  }
13768
13785
  function goToStep(stepIndex) {
13769
13786
  if (stepIndex < currentStep.value || validatedSteps.value.includes(stepIndex)) {
@@ -13788,6 +13805,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
13788
13805
  currentStep.value = 0;
13789
13806
  }
13790
13807
  watch(() => formData.value, () => {
13808
+ checkCurrentStepValidity();
13791
13809
  if (currentStep.value >= numberOfSteps.value && numberOfSteps.value > 0) {
13792
13810
  currentStep.value = 0;
13793
13811
  }
@@ -13795,14 +13813,16 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
13795
13813
  __expose({
13796
13814
  submit: handleSubmit,
13797
13815
  validateForm: reportValidity,
13816
+ checkValidity: (_a = formRef.value) == null ? void 0 : _a.checkValidity,
13798
13817
  isDirty: computed(() => {
13799
- var _a;
13800
- return (_a = formRef.value) == null ? void 0 : _a.isDirty;
13818
+ var _a2;
13819
+ return (_a2 = formRef.value) == null ? void 0 : _a2.isDirty;
13801
13820
  }),
13802
13821
  reset,
13803
13822
  goToStep,
13804
13823
  currentStep: computed(() => currentStep.value),
13805
13824
  totalSteps: computed(() => numberOfSteps.value),
13825
+ isStepValid,
13806
13826
  nextStep,
13807
13827
  prevStep
13808
13828
  });
@@ -13835,13 +13855,13 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
13835
13855
  ])
13836
13856
  ], true)
13837
13857
  ])) : createCommentVNode("", true),
13838
- createElementVNode("div", _hoisted_6$h, [
13858
+ createElementVNode("div", _hoisted_6$g, [
13839
13859
  createVNode(Transition, {
13840
13860
  name: slideDirection.value === "right" ? "slide-right" : "slide-left",
13841
13861
  mode: "out-in"
13842
13862
  }, {
13843
13863
  default: withCtx(() => [
13844
- !isStepping.value ? (openBlock(), createElementBlock("div", {
13864
+ (openBlock(), createElementBlock("div", {
13845
13865
  key: currentStep.value,
13846
13866
  ref_key: "formContainer",
13847
13867
  ref: formContainer,
@@ -13869,7 +13889,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
13869
13889
  key: "1"
13870
13890
  } : void 0
13871
13891
  ]), 1040, ["modelValue", "schema"])
13872
- ])) : createCommentVNode("", true)
13892
+ ]))
13873
13893
  ]),
13874
13894
  _: 3
13875
13895
  }, 8, ["name"]),
@@ -13880,19 +13900,21 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
13880
13900
  submit: handleSubmit,
13881
13901
  currentStep: currentStep.value,
13882
13902
  totalSteps: numberOfSteps.value,
13883
- canDoNext: canDoNext.value
13903
+ isLastStep: isLastStep.value,
13904
+ isStepValid: isStepValid.value
13884
13905
  })), () => [
13885
13906
  currentStep.value !== 0 ? (openBlock(), createBlock(unref(Btn), {
13886
13907
  key: 0,
13887
13908
  color: "gray",
13888
13909
  icon: "arrow_back",
13889
- click: "prevStep"
13910
+ onClick: prevStep
13890
13911
  })) : createCommentVNode("", true),
13891
- canDoNext.value ? (openBlock(), createBlock(unref(Btn), {
13912
+ !isLastStep.value ? (openBlock(), createBlock(unref(Btn), {
13892
13913
  key: 1,
13893
13914
  icon: "arrow_forward",
13915
+ disabled: props2.validateOnSteps && !isStepValid.value,
13894
13916
  onClick: nextStep
13895
- })) : (openBlock(), createBlock(unref(Btn), {
13917
+ }, null, 8, ["disabled"])) : (openBlock(), createBlock(unref(Btn), {
13896
13918
  key: 2,
13897
13919
  value: "Submit",
13898
13920
  onClick: handleSubmit
@@ -13904,7 +13926,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
13904
13926
  };
13905
13927
  }
13906
13928
  });
13907
- const BglMultiStepForm = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__scopeId", "data-v-53bb3be3"]]);
13929
+ const BglMultiStepForm = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__scopeId", "data-v-9c0b618c"]]);
13908
13930
  const _hoisted_1$M = {
13909
13931
  key: 0,
13910
13932
  class: "label mb-05"
@@ -13922,7 +13944,7 @@ const _hoisted_5$j = {
13922
13944
  key: 0,
13923
13945
  class: "minimizedText txt14 p-025 opacity-7"
13924
13946
  };
13925
- const _hoisted_6$g = { class: "bg-gray-80 -my-05 px-025 pt-065 pb-05 txt-center space-between flex column" };
13947
+ const _hoisted_6$f = { class: "bg-gray-80 -my-05 px-025 pt-065 pb-05 txt-center space-between flex column" };
13926
13948
  const _sfc_main$T = /* @__PURE__ */ defineComponent({
13927
13949
  __name: "FieldArray",
13928
13950
  props: {
@@ -14056,7 +14078,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
14056
14078
  schema: resolvedSchemaData.value,
14057
14079
  "onUpdate:modelValue": (val) => updateItem(i2, val)
14058
14080
  }, null, 8, ["model-value", "schema", "onUpdate:modelValue"])),
14059
- createElementVNode("div", _hoisted_6$g, [
14081
+ createElementVNode("div", _hoisted_6$f, [
14060
14082
  showMinimizeButton.value ? (openBlock(), createBlock(unref(Btn), {
14061
14083
  key: 0,
14062
14084
  class: "block rotate-180 txt10 opacity-7 p-025",
@@ -14170,55 +14192,54 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
14170
14192
  }
14171
14193
  });
14172
14194
  const CheckInput = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-722373de"]]);
14173
- const _hoisted_1$J = { class: "mb-05" };
14174
- const _hoisted_2$x = {
14195
+ const _hoisted_1$J = {
14175
14196
  key: 0,
14176
- class: "label txt-start"
14197
+ class: "label"
14177
14198
  };
14199
+ const _hoisted_2$x = { class: "editor-content-papa relative" };
14178
14200
  const _hoisted_3$t = {
14179
- key: 1,
14180
- class: "code-editor-wrap grid rounded p-1 overflow hm-300px ltr txt-start relative h-100p"
14201
+ class: "code-display",
14202
+ wrap: ""
14181
14203
  };
14182
- const _hoisted_4$i = { class: "overflow-hidden absolute inset-0 p-0 m-0 h-100 codeText" };
14183
- const _hoisted_5$i = ["innerHTML"];
14184
- const _hoisted_6$f = ["onKeydown"];
14204
+ const _hoisted_4$i = ["innerHTML"];
14205
+ const _hoisted_5$i = ["value"];
14185
14206
  const _sfc_main$Q = /* @__PURE__ */ defineComponent({
14186
14207
  __name: "Index",
14187
14208
  props: {
14188
- language: {},
14209
+ language: { default: "html" },
14189
14210
  readonly: { type: Boolean, default: false },
14190
14211
  modelValue: { default: "" },
14191
- autodetect: { type: Boolean },
14212
+ autodetect: { type: Boolean, default: true },
14192
14213
  ignoreIllegals: { type: Boolean, default: true },
14193
- label: {},
14194
- height: { default: "300px" }
14214
+ label: { default: "" },
14215
+ height: { default: "240px" }
14195
14216
  },
14196
14217
  emits: ["update:modelValue"],
14197
14218
  setup(__props, { emit: __emit }) {
14219
+ const props2 = __props;
14198
14220
  const emit2 = __emit;
14199
- let hljs = ref(null);
14200
- let elHeight = ref(__props.height);
14201
- let code = ref("");
14202
- const textarea = ref();
14203
- let loaded = ref(false);
14204
- const cannotDetectLanguage = computed(() => {
14205
- var _a;
14206
- const lang = __props.language || "";
14207
- return !(__props.autodetect ?? !lang) && !((_a = hljs.value) == null ? void 0 : _a.getLanguage(lang));
14208
- });
14209
- const className = computed(() => {
14210
- if (cannotDetectLanguage.value) return "";
14211
- return `hljs ${__props.language || ""}`;
14212
- });
14213
- const highlightedCode = computed(() => {
14214
- var _a, _b;
14215
- if (cannotDetectLanguage.value) {
14216
- console.warn(`The language "${__props.language}" you specified could not be found.`);
14221
+ const code = ref(props2.modelValue || "");
14222
+ const editorRef = ref();
14223
+ const loaded = ref(false);
14224
+ const hljs = ref(null);
14225
+ const maxHeight = computed(() => {
14226
+ const h2 = props2.height ?? "240px";
14227
+ return h2.match(/^\d+$/) ? `${h2}px` : h2;
14228
+ });
14229
+ const formattedCode = computed(() => {
14230
+ if (!hljs.value) return escapeHtml(code.value);
14231
+ try {
14232
+ const lang = props2.language || "";
14233
+ if (lang && !props2.autodetect && !hljs.value.getLanguage(lang)) {
14234
+ console.warn(`The language "${lang}" is not available.`);
14235
+ return escapeHtml(code.value);
14236
+ }
14237
+ const result2 = props2.autodetect ? hljs.value.highlightAuto(code.value) : hljs.value.highlight(code.value, { language: lang, ignoreIllegals: props2.ignoreIllegals });
14238
+ return result2.value || escapeHtml(code.value);
14239
+ } catch (error) {
14240
+ console.error("Highlighting error:", error);
14217
14241
  return escapeHtml(code.value);
14218
14242
  }
14219
- const lang = __props.language || "";
14220
- const result2 = __props.autodetect ? (_a = hljs.value) == null ? void 0 : _a.highlightAuto(code.value) : (_b = hljs.value) == null ? void 0 : _b.highlight(code.value, { language: lang, ignoreIllegals: __props.ignoreIllegals });
14221
- return (result2 == null ? void 0 : result2.value) || "";
14222
14243
  });
14223
14244
  function escapeHtml(unsafe) {
14224
14245
  return unsafe.replace(/[&<>"']/g, (m2) => {
@@ -14232,75 +14253,77 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
14232
14253
  return replacements[m2] || "";
14233
14254
  });
14234
14255
  }
14256
+ function handleInput(e) {
14257
+ const target = e.target;
14258
+ code.value = target.value;
14259
+ emit2("update:modelValue", code.value);
14260
+ }
14235
14261
  function handleTab(event) {
14262
+ if (event.key !== "Tab") return;
14263
+ event.preventDefault();
14236
14264
  const target = event.target;
14237
14265
  const start = target.selectionStart;
14238
- const tab = " ";
14239
- code.value = code.value.slice(0, start) + tab + code.value.slice(start);
14240
- nextTick(() => {
14241
- target.selectionStart = target.selectionEnd = start + tab.length;
14242
- });
14243
- }
14244
- function adjustHeight() {
14245
- var _a;
14246
- if (((_a = textarea.value) == null ? void 0 : _a.scrollHeight) && textarea.value.scrollHeight > Number.parseInt(elHeight.value)) {
14247
- elHeight.value = `${textarea.value.scrollHeight}px`;
14248
- }
14266
+ const end = target.selectionEnd;
14267
+ const newValue = `${code.value.substring(0, start)} ${code.value.substring(end)}`;
14268
+ code.value = newValue;
14269
+ emit2("update:modelValue", code.value);
14270
+ setTimeout(() => {
14271
+ target.selectionStart = target.selectionEnd = start + 2;
14272
+ }, 0);
14249
14273
  }
14250
14274
  onMounted(async () => {
14251
- await appendScript("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.0/highlight.min.js", { id: "hljs-cdn" });
14252
- await appendStyle("https://cdn.jsdelivr.net/npm/highlight.js/styles/atom-one-dark.min.css");
14253
- if (window.hljs) {
14254
- hljs.value = window.hljs;
14255
- loaded.value = true;
14256
- } else {
14257
- console.error("Highlight.js failed to load.");
14275
+ try {
14276
+ await appendScript("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.0/highlight.min.js", { id: "hljs-cdn" });
14277
+ await appendStyle("https://cdn.jsdelivr.net/npm/highlight.js/styles/atom-one-dark.min.css");
14278
+ if (window.hljs) {
14279
+ hljs.value = window.hljs;
14280
+ loaded.value = true;
14281
+ } else {
14282
+ console.error("Failed to load highlight.js");
14283
+ }
14284
+ } catch (error) {
14285
+ console.error("Error loading highlight.js:", error);
14258
14286
  }
14259
14287
  });
14260
- watch(() => __props.modelValue, (newVal) => {
14261
- adjustHeight();
14262
- if (newVal !== code.value) {
14288
+ watch(() => props2.modelValue, (newVal) => {
14289
+ if (newVal !== void 0 && newVal !== code.value) {
14263
14290
  code.value = newVal;
14264
14291
  }
14265
14292
  }, { immediate: true });
14266
14293
  return (_ctx, _cache) => {
14267
- return openBlock(), createElementBlock("div", _hoisted_1$J, [
14268
- _ctx.label ? (openBlock(), createElementBlock("label", _hoisted_2$x, toDisplayString(_ctx.label), 1)) : createCommentVNode("", true),
14269
- unref(loaded) ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
14270
- createElementVNode("div", {
14271
- class: "relative block h-100",
14272
- style: normalizeStyle({ height: `calc(${unref(elHeight)} - 2rem)` })
14273
- }, [
14274
- createElementVNode("pre", _hoisted_4$i, [
14275
- _cache[2] || (_cache[2] = createTextVNode(" ")),
14276
- createElementVNode("code", {
14277
- class: normalizeClass(["absolute inset-0", className.value]),
14278
- innerHTML: highlightedCode.value
14279
- }, null, 10, _hoisted_5$i),
14280
- _cache[3] || (_cache[3] = createTextVNode("\n "))
14294
+ return openBlock(), createElementBlock("div", {
14295
+ class: "code-editor-container ltr",
14296
+ style: normalizeStyle({ maxHeight: maxHeight.value })
14297
+ }, [
14298
+ _ctx.label ? (openBlock(), createElementBlock("label", _hoisted_1$J, toDisplayString(_ctx.label), 1)) : createCommentVNode("", true),
14299
+ loaded.value ? (openBlock(), createElementBlock("div", {
14300
+ key: 1,
14301
+ ref_key: "editorRef",
14302
+ ref: editorRef,
14303
+ class: "code-editor-grandpa"
14304
+ }, [
14305
+ createElementVNode("div", _hoisted_2$x, [
14306
+ createElementVNode("pre", _hoisted_3$t, [
14307
+ createElementVNode("code", { innerHTML: formattedCode.value }, null, 8, _hoisted_4$i)
14281
14308
  ]),
14282
- !_ctx.readonly ? withDirectives((openBlock(), createElementBlock("textarea", {
14309
+ !_ctx.readonly ? (openBlock(), createElementBlock("textarea", {
14283
14310
  key: 0,
14284
- ref_key: "textarea",
14285
- ref: textarea,
14286
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(code) ? code.value = $event : code = $event),
14287
- class: "code-editor absolute inset-0 bg-transparent overflow-hidden h-100 p-0 m-0 codeText border-none txt-start",
14311
+ value: code.value,
14312
+ class: "code-input",
14288
14313
  spellcheck: "false",
14289
- placeholder: "Write your code here",
14290
- "aria-label": "Code Editor",
14291
- "data-gramm": "false",
14292
- onKeydown: withKeys(withModifiers(handleTab, ["prevent"]), ["tab"]),
14293
- onInput: _cache[1] || (_cache[1] = ($event) => emit2("update:modelValue", unref(code)))
14294
- }, null, 40, _hoisted_6$f)), [
14295
- [vModelText, unref(code)]
14296
- ]) : createCommentVNode("", true)
14297
- ], 4)
14298
- ])) : createCommentVNode("", true)
14299
- ]);
14314
+ autocomplete: "off",
14315
+ autocorrect: "off",
14316
+ autocapitalize: "off",
14317
+ onInput: handleInput,
14318
+ onKeydown: handleTab
14319
+ }, null, 40, _hoisted_5$i)) : createCommentVNode("", true)
14320
+ ])
14321
+ ], 512)) : createCommentVNode("", true)
14322
+ ], 4);
14300
14323
  };
14301
14324
  }
14302
14325
  });
14303
- const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-13335b34"]]);
14326
+ const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-6ab9613f"]]);
14304
14327
  const _hoisted_1$I = ["title"];
14305
14328
  const _hoisted_2$w = { class: "flex bg-input rounded px-025 colorInputPickWrap" };
14306
14329
  const _hoisted_3$s = ["id", "placeholder", "required"];
@@ -18795,6 +18818,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
18795
18818
  const editor = useEditor();
18796
18819
  const isInitializing = ref(false);
18797
18820
  const hasInitialized = ref(false);
18821
+ editor.state.content = props2.modelValue;
18798
18822
  if (props2.debug) {
18799
18823
  editor.initDebugger();
18800
18824
  }
@@ -18842,6 +18866,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
18842
18866
  doc.designMode = "on";
18843
18867
  doc.body.contentEditable = "true";
18844
18868
  doc.body.dir = hasRTL.value ? "rtl" : "ltr";
18869
+ editor.state.content = doc.body.innerHTML;
18845
18870
  editor.init(doc);
18846
18871
  useEditorKeyboard(doc, commands);
18847
18872
  if (!doc.body.firstElementChild) {
@@ -18849,6 +18874,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
18849
18874
  p2.dir = doc.body.dir;
18850
18875
  p2.innerHTML = "<br>";
18851
18876
  doc.body.appendChild(p2);
18877
+ editor.state.content = doc.body.innerHTML;
18852
18878
  } else {
18853
18879
  const walker = doc.createTreeWalker(doc.body, NodeFilter.SHOW_TEXT);
18854
18880
  const textNodes = [];
@@ -18869,6 +18895,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
18869
18895
  doc.body.removeChild(textNode);
18870
18896
  }
18871
18897
  });
18898
+ editor.state.content = doc.body.innerHTML;
18872
18899
  }
18873
18900
  doc.body.focus();
18874
18901
  hasInitialized.value = true;
@@ -18930,8 +18957,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
18930
18957
  _cache[1] || (_cache[1] = ($event) => unref(editor).updateState.content("html"))
18931
18958
  ],
18932
18959
  language: "html",
18933
- class: "code-editor"
18934
- }, null, 8, ["modelValue"])) : createCommentVNode("", true)
18960
+ height: unref(editor).state.isFullscreen ? "calc(100vh - 4rem)" : "250px"
18961
+ }, null, 8, ["modelValue", "height"])) : createCommentVNode("", true)
18935
18962
  ], 2),
18936
18963
  _ctx.debug ? (openBlock(), createElementBlock("div", _hoisted_3$h, [
18937
18964
  _cache[6] || (_cache[6] = createElementVNode("p", { class: "text12 txt-gray mb-0 p-0" }, " Debug ", -1)),
@@ -18977,7 +19004,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
18977
19004
  };
18978
19005
  }
18979
19006
  });
18980
- const RichText = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-30bcda4c"]]);
19007
+ const RichText = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-2782b5dd"]]);
18981
19008
  const _hoisted_1$t = { key: 0 };
18982
19009
  const _hoisted_2$j = { class: "flex gap-05" };
18983
19010
  const _hoisted_3$g = ["disabled"];