@bagelink/vue 0.0.869 → 0.0.875

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
@@ -43727,17 +43727,249 @@ function useFormatting(modalInstance) {
43727
43727
  modal = modalInstance;
43728
43728
  return { applyFormatting, clearFormatting };
43729
43729
  }
43730
- const _hoisted_1$o = { class: "flex gap-05" };
43731
- const _hoisted_2$f = ["disabled"];
43732
- const _hoisted_3$c = { key: 1 };
43733
- const _hoisted_4$8 = {
43730
+ const _hoisted_1$o = {
43731
+ class: "toolbar flex gap-025 pb-05 flex-wrap",
43732
+ role: "toolbar"
43733
+ };
43734
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
43735
+ __name: "Toolbar",
43736
+ props: {
43737
+ config: {}
43738
+ },
43739
+ emits: ["action"],
43740
+ setup(__props, { emit: __emit }) {
43741
+ const emit2 = __emit;
43742
+ const toolbarOptions = [
43743
+ { name: "formatBlock", label: "h2", icon: "format_h2" },
43744
+ { name: "formatBlock", label: "h3", icon: "format_h3" },
43745
+ { name: "formatBlock", label: "h4", icon: "format_h4" },
43746
+ { name: "formatBlock", label: "h5", icon: "format_h5" },
43747
+ { name: "formatBlock", label: "h6", icon: "format_h6" },
43748
+ { name: "separator" },
43749
+ { name: "bold", label: "Bold", icon: "format_bold" },
43750
+ { name: "italic", label: "Italic", icon: "format_italic" },
43751
+ { name: "underline", label: "Underline", icon: "format_underlined" },
43752
+ { name: "separator" },
43753
+ { name: "orderedList", label: "Ordered List", icon: "format_list_numbered" },
43754
+ { name: "unorderedList", label: "Unordered List", icon: "format_list_bulleted" },
43755
+ { name: "separator" },
43756
+ { name: "link", label: "Link", icon: "add_link" },
43757
+ { name: "image", label: "Image", icon: "add_photo_alternate" },
43758
+ { name: "youtube", label: "YouTube", icon: "youtube_activity" },
43759
+ { name: "separator" },
43760
+ { name: "splitView", label: "Split View", icon: "code" },
43761
+ { name: "clear", label: "Clear Formatting", icon: "format_clear" },
43762
+ { name: "fullScreen", label: "Full Screen", icon: "fullscreen", class: "ms-auto" }
43763
+ ];
43764
+ return (_ctx, _cache) => {
43765
+ const _directive_tooltip = resolveDirective("tooltip");
43766
+ return openBlock(), createElementBlock("div", _hoisted_1$o, [
43767
+ (openBlock(), createElementBlock(Fragment$1, null, renderList(toolbarOptions, (action, index2) => {
43768
+ return openBlock(), createElementBlock(Fragment$1, { key: index2 }, [
43769
+ action.name !== "separator" && _ctx.config.includes(action.name) ? withDirectives((openBlock(), createBlock(unref(Btn), {
43770
+ key: 0,
43771
+ icon: action.icon,
43772
+ thin: "",
43773
+ flat: "",
43774
+ "aria-label": action.name,
43775
+ class: normalizeClass([action.class, "radius-05"]),
43776
+ onClick: ($event) => emit2("action", action.name, action.label)
43777
+ }, null, 8, ["icon", "aria-label", "class", "onClick"])), [
43778
+ [_directive_tooltip, action.label]
43779
+ ]) : action.name === "separator" ? (openBlock(), createElementBlock("span", {
43780
+ key: `separator-${index2}`,
43781
+ class: "opacity-2 mb-025"
43782
+ }, "|")) : createCommentVNode("", true)
43783
+ ], 64);
43784
+ }), 64))
43785
+ ]);
43786
+ };
43787
+ }
43788
+ });
43789
+ const _hoisted_1$n = { class: "rich-text-editor rounded pt-05 px-05 pb-1" };
43790
+ const _hoisted_2$f = { class: "editor-container flex flex-stretch gap-1 m_column" };
43791
+ const _hoisted_3$c = { class: "content-area radius-05 p-1 w-100 grid" };
43792
+ const _hoisted_4$8 = ["textContent"];
43793
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
43794
+ __name: "index",
43795
+ props: {
43796
+ modelValue: {},
43797
+ toolbarConfig: {}
43798
+ },
43799
+ emits: ["update:modelValue"],
43800
+ setup(__props, { emit: __emit }) {
43801
+ const props2 = __props;
43802
+ const emit2 = __emit;
43803
+ const modal2 = useModal();
43804
+ const { applyFormatting: applyFormatting2, clearFormatting: clearFormatting2 } = useFormatting(modal2);
43805
+ const editableContent = ref();
43806
+ const defaultConfig2 = [
43807
+ "formatBlock",
43808
+ "bold",
43809
+ "italic",
43810
+ "underline",
43811
+ "fontSize",
43812
+ "fontFamily",
43813
+ "textColor",
43814
+ "backgroundColor",
43815
+ "alignLeft",
43816
+ "alignCenter",
43817
+ "alignRight",
43818
+ "alignJustify",
43819
+ "orderedList",
43820
+ "unorderedList",
43821
+ "indent",
43822
+ "outdent",
43823
+ "link",
43824
+ "image",
43825
+ "table",
43826
+ "blockquote",
43827
+ "codeBlock",
43828
+ "splitView",
43829
+ "youtube",
43830
+ "codeView",
43831
+ "clear",
43832
+ "fullScreen"
43833
+ ];
43834
+ const config = ref(props2.toolbarConfig || defaultConfig2);
43835
+ let contentHtml = ref(props2.modelValue);
43836
+ let isCodeView = ref(false);
43837
+ let isSplitView = ref(false);
43838
+ function updateContent() {
43839
+ var _a2;
43840
+ if (!isCodeView.value) {
43841
+ contentHtml.value = ((_a2 = editableContent.value) == null ? void 0 : _a2.innerHTML) ?? "";
43842
+ }
43843
+ emit2("update:modelValue", contentHtml.value);
43844
+ }
43845
+ function updateToolbarHighlight() {
43846
+ if (document.getSelection()) {
43847
+ const selection = document.getSelection();
43848
+ const range2 = (selection == null ? void 0 : selection.rangeCount) ? selection.getRangeAt(0) : null;
43849
+ const container = range2 == null ? void 0 : range2.commonAncestorContainer;
43850
+ if (container) {
43851
+ let currentElement = container.nodeType === 3 ? container.parentElement : container;
43852
+ while (currentElement && currentElement !== editableContent.value) {
43853
+ if (["H1", "H2", "H3"].includes(currentElement.tagName)) {
43854
+ break;
43855
+ }
43856
+ currentElement = currentElement.parentElement;
43857
+ }
43858
+ }
43859
+ }
43860
+ }
43861
+ document.addEventListener("selectionchange", updateToolbarHighlight);
43862
+ function handleToolbarAction(action, value) {
43863
+ if (!editableContent.value) return;
43864
+ if (["alignLeft", "alignCenter", "alignRight", "alignJustify"].includes(action))
43865
+ value = action.replace("align", "").toLowerCase();
43866
+ if (action === "splitView") isSplitView.value = !isSplitView.value;
43867
+ else if (action === "codeView") isCodeView.value = !isCodeView.value;
43868
+ else if (action === "fullScreen") toggleFullScreen();
43869
+ else if (action === "clear") clearFormatting2();
43870
+ else applyFormatting2(action, value);
43871
+ updateContent();
43872
+ }
43873
+ function toggleFullScreen() {
43874
+ const editor = document.querySelector(".rich-text-editor");
43875
+ if (editor) {
43876
+ editor.classList.toggle("fullscreen-mode");
43877
+ }
43878
+ }
43879
+ watch(() => props2.modelValue, (newValue) => {
43880
+ if (newValue !== contentHtml.value) {
43881
+ contentHtml.value = newValue;
43882
+ if (editableContent.value) {
43883
+ editableContent.value.innerHTML = newValue;
43884
+ }
43885
+ }
43886
+ });
43887
+ onMounted(() => {
43888
+ if (editableContent.value) {
43889
+ editableContent.value.innerHTML = contentHtml.value;
43890
+ }
43891
+ });
43892
+ function handleKeyDown2(event) {
43893
+ if (event.ctrlKey || event.metaKey) {
43894
+ switch (event.key.toLowerCase()) {
43895
+ case "b":
43896
+ event.preventDefault();
43897
+ handleToolbarAction("bold");
43898
+ break;
43899
+ case "i":
43900
+ event.preventDefault();
43901
+ handleToolbarAction("italic");
43902
+ break;
43903
+ case "u":
43904
+ event.preventDefault();
43905
+ handleToolbarAction("underline");
43906
+ break;
43907
+ case "k":
43908
+ event.preventDefault();
43909
+ handleToolbarAction("link");
43910
+ break;
43911
+ case "l":
43912
+ event.preventDefault();
43913
+ handleToolbarAction("orderedList");
43914
+ break;
43915
+ }
43916
+ }
43917
+ }
43918
+ function logInput(e) {
43919
+ const target = e.target;
43920
+ contentHtml.value = target.textContent || "";
43921
+ }
43922
+ return (_ctx, _cache) => {
43923
+ return openBlock(), createElementBlock("div", _hoisted_1$n, [
43924
+ createVNode(_sfc_main$v, {
43925
+ config: config.value,
43926
+ onAction: handleToolbarAction
43927
+ }, null, 8, ["config"]),
43928
+ createElementVNode("div", _hoisted_2$f, [
43929
+ createElementVNode("div", _hoisted_3$c, [
43930
+ unref(isCodeView) ? withDirectives((openBlock(), createElementBlock("textarea", {
43931
+ key: 0,
43932
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(contentHtml) ? contentHtml.value = $event : contentHtml = $event),
43933
+ onInput: updateContent
43934
+ }, null, 544)), [
43935
+ [vModelText, unref(contentHtml)]
43936
+ ]) : (openBlock(), createElementBlock("div", {
43937
+ key: 1,
43938
+ ref_key: "editableContent",
43939
+ ref: editableContent,
43940
+ contenteditable: "true",
43941
+ class: "editableContent",
43942
+ role: "textbox",
43943
+ "aria-multiline": "true",
43944
+ tabindex: "0",
43945
+ onInput: updateContent,
43946
+ onKeydown: handleKeyDown2
43947
+ }, null, 544))
43948
+ ]),
43949
+ unref(isSplitView) ? (openBlock(), createElementBlock("code", {
43950
+ key: 0,
43951
+ contenteditable: "true",
43952
+ class: "preview-area w-100 radius-05 p-1",
43953
+ onInput: _cache[1] || (_cache[1] = (e) => logInput(e)),
43954
+ textContent: toDisplayString(unref(contentHtml))
43955
+ }, null, 40, _hoisted_4$8)) : createCommentVNode("", true)
43956
+ ])
43957
+ ]);
43958
+ };
43959
+ }
43960
+ });
43961
+ const RichText = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-492bb647"]]);
43962
+ const _hoisted_1$m = { class: "flex gap-05" };
43963
+ const _hoisted_2$e = ["disabled"];
43964
+ const _hoisted_3$b = { key: 1 };
43965
+ const _hoisted_4$7 = {
43734
43966
  key: 2,
43735
43967
  class: "ms-auto ps-05 me-05"
43736
43968
  };
43737
43969
  const _hoisted_5$7 = ["value"];
43738
43970
  const _hoisted_6$6 = ["aria-selected", "onClick", "onKeydown"];
43739
43971
  const _hoisted_7$3 = { class: "block" };
43740
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
43972
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
43741
43973
  __name: "SelectInput",
43742
43974
  props: {
43743
43975
  options: {},
@@ -43913,7 +44145,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
43913
44145
  trigger: withCtx(() => [
43914
44146
  createElementVNode("label", null, [
43915
44147
  createTextVNode(toDisplayString(_ctx.label) + " ", 1),
43916
- createElementVNode("div", _hoisted_1$o, [
44148
+ createElementVNode("div", _hoisted_1$m, [
43917
44149
  _ctx.searchable && unref(open) ? (openBlock(), createBlock(unref(TextInput), {
43918
44150
  key: 0,
43919
44151
  ref_key: "searchInput",
@@ -43938,8 +44170,8 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
43938
44170
  key: 0,
43939
44171
  icon: _ctx.icon
43940
44172
  }, null, 8, ["icon"])) : createCommentVNode("", true),
43941
- !_ctx.hideLabel ? (openBlock(), createElementBlock("p", _hoisted_3$c, toDisplayString(selectedLabel.value), 1)) : createCommentVNode("", true),
43942
- _ctx.clearable && selectedItemCount.value > 0 ? (openBlock(), createElementBlock("div", _hoisted_4$8, [
44173
+ !_ctx.hideLabel ? (openBlock(), createElementBlock("p", _hoisted_3$b, toDisplayString(selectedLabel.value), 1)) : createCommentVNode("", true),
44174
+ _ctx.clearable && selectedItemCount.value > 0 ? (openBlock(), createElementBlock("div", _hoisted_4$7, [
43943
44175
  createVNode(unref(Btn), {
43944
44176
  flat: "",
43945
44177
  thin: "",
@@ -43955,7 +44187,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
43955
44187
  key: 3,
43956
44188
  thin: ""
43957
44189
  }, { icon: unref(open) ? "unfold_less" : "unfold_more" }), null, 16)) : createCommentVNode("", true)
43958
- ], 42, _hoisted_2$f)),
44190
+ ], 42, _hoisted_2$e)),
43959
44191
  _ctx.required ? (openBlock(), createElementBlock("input", {
43960
44192
  key: 2,
43961
44193
  tabindex: "-1",
@@ -44020,239 +44252,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
44020
44252
  };
44021
44253
  }
44022
44254
  });
44023
- const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-4d1e8e98"]]);
44024
- const _hoisted_1$n = {
44025
- class: "toolbar flex gap-025 pb-05 flex-wrap",
44026
- role: "toolbar"
44027
- };
44028
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
44029
- __name: "Toolbar",
44030
- props: {
44031
- config: {}
44032
- },
44033
- emits: ["action"],
44034
- setup(__props, { emit: __emit }) {
44035
- const emit2 = __emit;
44036
- const toolbarOptions = [
44037
- { name: "formatBlock", label: "h2", icon: "format_h2" },
44038
- { name: "formatBlock", label: "h3", icon: "format_h3" },
44039
- { name: "formatBlock", label: "h4", icon: "format_h4" },
44040
- { name: "formatBlock", label: "h5", icon: "format_h5" },
44041
- { name: "formatBlock", label: "h6", icon: "format_h6" },
44042
- { name: "separator" },
44043
- { name: "bold", label: "Bold", icon: "format_bold" },
44044
- { name: "italic", label: "Italic", icon: "format_italic" },
44045
- { name: "underline", label: "Underline", icon: "format_underlined" },
44046
- { name: "separator" },
44047
- { name: "orderedList", label: "Ordered List", icon: "format_list_numbered" },
44048
- { name: "unorderedList", label: "Unordered List", icon: "format_list_bulleted" },
44049
- { name: "separator" },
44050
- { name: "link", label: "Link", icon: "add_link" },
44051
- { name: "image", label: "Image", icon: "add_photo_alternate" },
44052
- { name: "youtube", label: "YouTube", icon: "youtube_activity" },
44053
- { name: "separator" },
44054
- { name: "splitView", label: "Split View", icon: "code" },
44055
- { name: "clear", label: "Clear Formatting", icon: "format_clear" },
44056
- { name: "fullScreen", label: "Full Screen", icon: "fullscreen", class: "ms-auto" }
44057
- ];
44058
- return (_ctx, _cache) => {
44059
- const _directive_tooltip = resolveDirective("tooltip");
44060
- return openBlock(), createElementBlock("div", _hoisted_1$n, [
44061
- (openBlock(), createElementBlock(Fragment$1, null, renderList(toolbarOptions, (action, index2) => {
44062
- return openBlock(), createElementBlock(Fragment$1, { key: index2 }, [
44063
- action.name !== "separator" && _ctx.config.includes(action.name) ? withDirectives((openBlock(), createBlock(unref(Btn), {
44064
- key: 0,
44065
- icon: action.icon,
44066
- thin: "",
44067
- flat: "",
44068
- "aria-label": action.name,
44069
- class: normalizeClass([action.class, "radius-05"]),
44070
- onClick: ($event) => emit2("action", action.name, action.label)
44071
- }, null, 8, ["icon", "aria-label", "class", "onClick"])), [
44072
- [_directive_tooltip, action.label]
44073
- ]) : action.name === "separator" ? (openBlock(), createElementBlock("span", {
44074
- key: `separator-${index2}`,
44075
- class: "opacity-2 mb-025"
44076
- }, "|")) : createCommentVNode("", true)
44077
- ], 64);
44078
- }), 64))
44079
- ]);
44080
- };
44081
- }
44082
- });
44083
- const _hoisted_1$m = { class: "rich-text-editor rounded pt-05 px-05 pb-1" };
44084
- const _hoisted_2$e = { class: "editor-container flex flex-stretch gap-1 m_column" };
44085
- const _hoisted_3$b = { class: "content-area radius-05 p-1 w-100 grid" };
44086
- const _hoisted_4$7 = ["textContent"];
44087
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
44088
- __name: "index",
44089
- props: {
44090
- modelValue: {},
44091
- toolbarConfig: {}
44092
- },
44093
- emits: ["update:modelValue"],
44094
- setup(__props, { emit: __emit }) {
44095
- const props2 = __props;
44096
- const emit2 = __emit;
44097
- const modal2 = useModal();
44098
- const { applyFormatting: applyFormatting2, clearFormatting: clearFormatting2 } = useFormatting(modal2);
44099
- const editableContent = ref();
44100
- const defaultConfig2 = [
44101
- "formatBlock",
44102
- "bold",
44103
- "italic",
44104
- "underline",
44105
- "fontSize",
44106
- "fontFamily",
44107
- "textColor",
44108
- "backgroundColor",
44109
- "alignLeft",
44110
- "alignCenter",
44111
- "alignRight",
44112
- "alignJustify",
44113
- "orderedList",
44114
- "unorderedList",
44115
- "indent",
44116
- "outdent",
44117
- "link",
44118
- "image",
44119
- "table",
44120
- "blockquote",
44121
- "codeBlock",
44122
- "splitView",
44123
- "youtube",
44124
- "codeView",
44125
- "clear",
44126
- "fullScreen"
44127
- ];
44128
- const config = ref(props2.toolbarConfig || defaultConfig2);
44129
- let contentHtml = ref(props2.modelValue);
44130
- let isCodeView = ref(false);
44131
- let isSplitView = ref(false);
44132
- function updateContent() {
44133
- var _a2;
44134
- if (!isCodeView.value) {
44135
- contentHtml.value = ((_a2 = editableContent.value) == null ? void 0 : _a2.innerHTML) ?? "";
44136
- }
44137
- emit2("update:modelValue", contentHtml.value);
44138
- }
44139
- function updateToolbarHighlight() {
44140
- if (document.getSelection()) {
44141
- const selection = document.getSelection();
44142
- const range2 = (selection == null ? void 0 : selection.rangeCount) ? selection.getRangeAt(0) : null;
44143
- const container = range2 == null ? void 0 : range2.commonAncestorContainer;
44144
- if (container) {
44145
- let currentElement = container.nodeType === 3 ? container.parentElement : container;
44146
- while (currentElement && currentElement !== editableContent.value) {
44147
- if (["H1", "H2", "H3"].includes(currentElement.tagName)) {
44148
- break;
44149
- }
44150
- currentElement = currentElement.parentElement;
44151
- }
44152
- }
44153
- }
44154
- }
44155
- document.addEventListener("selectionchange", updateToolbarHighlight);
44156
- function handleToolbarAction(action, value) {
44157
- if (!editableContent.value) return;
44158
- if (["alignLeft", "alignCenter", "alignRight", "alignJustify"].includes(action))
44159
- value = action.replace("align", "").toLowerCase();
44160
- if (action === "splitView") isSplitView.value = !isSplitView.value;
44161
- else if (action === "codeView") isCodeView.value = !isCodeView.value;
44162
- else if (action === "fullScreen") toggleFullScreen();
44163
- else if (action === "clear") clearFormatting2();
44164
- else applyFormatting2(action, value);
44165
- updateContent();
44166
- }
44167
- function toggleFullScreen() {
44168
- const editor = document.querySelector(".rich-text-editor");
44169
- if (editor) {
44170
- editor.classList.toggle("fullscreen-mode");
44171
- }
44172
- }
44173
- watch(() => props2.modelValue, (newValue) => {
44174
- if (newValue !== contentHtml.value) {
44175
- contentHtml.value = newValue;
44176
- if (editableContent.value) {
44177
- editableContent.value.innerHTML = newValue;
44178
- }
44179
- }
44180
- });
44181
- onMounted(() => {
44182
- if (editableContent.value) {
44183
- editableContent.value.innerHTML = contentHtml.value;
44184
- }
44185
- });
44186
- function handleKeyDown2(event) {
44187
- if (event.ctrlKey || event.metaKey) {
44188
- switch (event.key.toLowerCase()) {
44189
- case "b":
44190
- event.preventDefault();
44191
- handleToolbarAction("bold");
44192
- break;
44193
- case "i":
44194
- event.preventDefault();
44195
- handleToolbarAction("italic");
44196
- break;
44197
- case "u":
44198
- event.preventDefault();
44199
- handleToolbarAction("underline");
44200
- break;
44201
- case "k":
44202
- event.preventDefault();
44203
- handleToolbarAction("link");
44204
- break;
44205
- case "l":
44206
- event.preventDefault();
44207
- handleToolbarAction("orderedList");
44208
- break;
44209
- }
44210
- }
44211
- }
44212
- function logInput(e) {
44213
- const target = e.target;
44214
- contentHtml.value = target.textContent || "";
44215
- }
44216
- return (_ctx, _cache) => {
44217
- return openBlock(), createElementBlock("div", _hoisted_1$m, [
44218
- createVNode(_sfc_main$u, {
44219
- config: config.value,
44220
- onAction: handleToolbarAction
44221
- }, null, 8, ["config"]),
44222
- createElementVNode("div", _hoisted_2$e, [
44223
- createElementVNode("div", _hoisted_3$b, [
44224
- unref(isCodeView) ? withDirectives((openBlock(), createElementBlock("textarea", {
44225
- key: 0,
44226
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(contentHtml) ? contentHtml.value = $event : contentHtml = $event),
44227
- onInput: updateContent
44228
- }, null, 544)), [
44229
- [vModelText, unref(contentHtml)]
44230
- ]) : (openBlock(), createElementBlock("div", {
44231
- key: 1,
44232
- ref_key: "editableContent",
44233
- ref: editableContent,
44234
- contenteditable: "true",
44235
- class: "editableContent",
44236
- role: "textbox",
44237
- "aria-multiline": "true",
44238
- tabindex: "0",
44239
- onInput: updateContent,
44240
- onKeydown: handleKeyDown2
44241
- }, null, 544))
44242
- ]),
44243
- unref(isSplitView) ? (openBlock(), createElementBlock("code", {
44244
- key: 0,
44245
- contenteditable: "true",
44246
- class: "preview-area w-100 radius-05 p-1",
44247
- onInput: _cache[1] || (_cache[1] = (e) => logInput(e)),
44248
- textContent: toDisplayString(unref(contentHtml))
44249
- }, null, 40, _hoisted_4$7)) : createCommentVNode("", true)
44250
- ])
44251
- ]);
44252
- };
44253
- }
44254
- });
44255
- const RichText = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-492bb647"]]);
44255
+ const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-4d1e8e98"]]);
44256
44256
  /*!
44257
44257
  * Signature Pad v5.0.3 | https://github.com/szimek/signature_pad
44258
44258
  * (c) 2024 Szymon Nowak | Released under the MIT license
@@ -52610,7 +52610,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
52610
52610
  };
52611
52611
  }
52612
52612
  });
52613
- const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-e5ae4283"]]);
52613
+ const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-63ff8c9c"]]);
52614
52614
  const _hoisted_1$h = ["title"];
52615
52615
  const _hoisted_2$9 = ["id", "required"];
52616
52616
  const _hoisted_3$7 = ["for"];
@@ -52691,14 +52691,15 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
52691
52691
  ]),
52692
52692
  _: 2
52693
52693
  }, 1032, ["to", "onClick"]);
52694
- }), 128))
52694
+ }), 128)),
52695
+ renderSlot(_ctx.$slots, "end", {}, void 0, true)
52695
52696
  ]),
52696
52697
  _: 3
52697
52698
  });
52698
52699
  };
52699
52700
  }
52700
52701
  });
52701
- const BottomMenu = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-557bcad0"]]);
52702
+ const BottomMenu = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-ee7b8f1a"]]);
52702
52703
  const _sfc_main$m = /* @__PURE__ */ defineComponent({
52703
52704
  __name: "Layout",
52704
52705
  props: {
@@ -53147,20 +53148,22 @@ function _sfc_render$2(_ctx, _cache) {
53147
53148
  }
53148
53149
  const ListView = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$2]]);
53149
53150
  const _hoisted_1$8 = ["id"];
53150
- const defaultMarkerSVG = '<svg id="eCJDQPwuXje1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 36 36" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" project-id="ac827abc0a8c4922b76bac4df7bd7646" export-id="2cc86932ccbc4825a31fd063b3e75478" cached="false"><style><![CDATA[#eCJDQPwuXje3_ts {animation: eCJDQPwuXje3_ts__ts 3000ms linear infinite normal forwards}@keyframes eCJDQPwuXje3_ts__ts { 0% {transform: translate(18px,18px) scale(1,1)} 3.333333% {transform: translate(18px,18px) scale(1,1);animation-timing-function: cubic-bezier(0.42,0,0.58,1)} 100% {transform: translate(18px,18px) scale(1.8,1.8)}} #eCJDQPwuXje3 {animation: eCJDQPwuXje3_c_o 3000ms linear infinite normal forwards}@keyframes eCJDQPwuXje3_c_o { 0% {opacity: 0} 3.333333% {opacity: 1;animation-timing-function: cubic-bezier(0.42,0,0.58,1)} 100% {opacity: 0}}]]></style><ellipse rx="10.049312" ry="10.049312" transform="translate(18 18)" fill="#2e5bff" stroke-width="0"/><g id="eCJDQPwuXje3_ts" transform="translate(18,18) scale(1,1)"><ellipse id="eCJDQPwuXje3" rx="10.049312" ry="10.049312" transform="translate(0,0)" opacity="0" fill="#2e5bff" stroke-width="0"/></g></svg>';
53151
+ const defaultMarkerSVG = '<svg width="28" height="38" viewBox="0 0 28 38" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.2263 37.7955C17.0897 37.7955 19.4109 37.0138 19.4109 36.0496C19.4109 35.0854 17.0897 34.3037 14.2263 34.3037C11.363 34.3037 9.04175 35.0854 9.04175 36.0496C9.04175 37.0138 11.363 37.7955 14.2263 37.7955Z" fill="black" fill-opacity="0.1"/><path d="M14.2265 0.549591C21.2842 0.549591 27.0131 6.23786 27.0787 13.28V13.4024C27.0787 19.3328 24.4759 24.4306 21.5627 28.2764C18.6511 32.12 15.4577 34.6754 14.3457 35.5097C14.2748 35.5629 14.1778 35.5629 14.1068 35.5097C12.9947 34.675 9.80135 32.1197 6.88984 28.2762C3.97665 24.4304 1.37378 19.3328 1.37378 13.4024C1.37378 6.30387 7.12806 0.549591 14.2265 0.549591Z" fill="#ED1b3E" stroke="#ED6C6F"/><path d="M14.2263 21.6185C18.7639 21.6185 22.4424 17.94 22.4424 13.4024C22.4424 8.86477 18.7639 5.18631 14.2263 5.18631C9.68872 5.18631 6.01025 8.86477 6.01025 13.4024C6.01025 17.94 9.68872 21.6185 14.2263 21.6185Z" fill="white"/></svg>';
53151
53152
  const leafletScriptUrl = "https://unpkg.com/leaflet@1.9.4/dist/leaflet.js";
53152
53153
  const _sfc_main$d = /* @__PURE__ */ defineComponent({
53153
53154
  __name: "MapEmbed",
53154
53155
  props: {
53155
53156
  center: { default: () => [31.7683, 35.2137] },
53156
- zoom: { default: 13 },
53157
+ zoom: { default: 15 },
53157
53158
  height: { default: 400 },
53158
53159
  zoomControl: { type: Boolean, default: true },
53159
53160
  markers: {},
53160
53161
  markerIcon: { default: "" }
53161
53162
  },
53162
- setup(__props) {
53163
+ emits: ["select"],
53164
+ setup(__props, { emit: __emit }) {
53163
53165
  const props2 = __props;
53166
+ const emit2 = __emit;
53164
53167
  let L2 = ref();
53165
53168
  let map4 = ref();
53166
53169
  const _markers = ref([]);
@@ -53181,31 +53184,50 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
53181
53184
  L2.value.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { maxZoom: 18 }).addTo(map4.value);
53182
53185
  }
53183
53186
  }
53184
- function addMarker(L22, latlng) {
53187
+ async function addMarker(marker) {
53188
+ var _a2, _b;
53185
53189
  const iconSVG = props2.markerIcon || defaultMarkerSVG;
53186
- const customIcon = L22 == null ? void 0 : L22.icon({
53190
+ const icon = (_a2 = L2.value) == null ? void 0 : _a2.icon({
53187
53191
  iconUrl: `data:image/svg+xml;utf8,${encodeURIComponent(iconSVG)}`,
53188
53192
  iconSize: [32, 32]
53189
53193
  });
53190
- const marker = L22 == null ? void 0 : L22.marker(latlng, { icon: customIcon }).addTo(map4.value);
53191
- _markers.value.push(marker);
53194
+ const latlng = latLangFromMarker(marker);
53195
+ const title = Array.isArray(marker) ? marker[2] : marker.title ?? marker.tooltip;
53196
+ const tooltip = Array.isArray(marker) ? marker[2] : marker.tooltip;
53197
+ const m2 = (_b = L2.value) == null ? void 0 : _b.marker(latlng, { title, icon, interactive: true }).addTo(map4.value);
53198
+ if (tooltip) m2.bindTooltip(tooltip, { direction: "top" });
53199
+ m2.on("click", () => {
53200
+ emit2("select", marker);
53201
+ });
53202
+ _markers.value.push(m2);
53192
53203
  }
53193
53204
  function fitMarkers(L22) {
53194
- var _a2;
53205
+ var _a2, _b;
53195
53206
  if (_markers.value.length > 0) {
53196
- (_a2 = map4.value) == null ? void 0 : _a2.fitBounds(L22.featureGroup(_markers.value).getBounds());
53207
+ const latLngs = _markers.value.map((marker) => marker.getLatLng());
53208
+ const bounds = L22.latLngBounds(latLngs);
53209
+ const center2 = bounds.getCenter();
53210
+ (_a2 = map4.value) == null ? void 0 : _a2.setView(center2, props2.zoom);
53211
+ (_b = map4.value) == null ? void 0 : _b.fitBounds(bounds, {
53212
+ animate: true,
53213
+ padding: [20, 20]
53214
+ // Adjust padding as needed
53215
+ });
53197
53216
  }
53198
53217
  }
53218
+ function latLangFromMarker(marker) {
53219
+ const [lat, lng] = Array.isArray(marker) ? [marker[0], marker[1]] : [marker.lat, marker.lng];
53220
+ return { lat: +lat, lng: +lng };
53221
+ }
53199
53222
  async function watchMarkers(markers) {
53200
53223
  if (!L2.value) L2.value = await loadGlobalL();
53201
53224
  _markers.value.forEach((marker) => marker.remove());
53202
53225
  if (!markers) return;
53203
53226
  for (const marker of markers) {
53204
- const [lat, lon] = Array.isArray(marker) ? marker : [marker.lat, marker.lon];
53205
- if (!map4.value) initializeMap();
53206
- addMarker(L2.value, [lat, lon]);
53207
- fitMarkers(L2.value);
53227
+ if (!map4.value) await initializeMap();
53228
+ addMarker(marker);
53208
53229
  }
53230
+ fitMarkers(L2.value);
53209
53231
  }
53210
53232
  watch(() => props2.markers, watchMarkers, { immediate: true });
53211
53233
  watch(() => props2.center, (center2) => {
@@ -53217,7 +53239,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
53217
53239
  return openBlock(), createElementBlock("div", {
53218
53240
  id: id.value,
53219
53241
  class: "leaflet-map",
53220
- style: normalizeStyle({ height: `${props2.height || 400}px` })
53242
+ style: normalizeStyle({ height: `${props2.height || 400}px` }),
53243
+ dir: "ltr"
53221
53244
  }, null, 12, _hoisted_1$8);
53222
53245
  };
53223
53246
  }