eco-vue-js 0.11.17 → 0.11.19

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.
Files changed (47) hide show
  1. package/dist/assets/icons/IconUnderline.svg.js +24 -0
  2. package/dist/components/Button/WButtonDropdown.vue.js +1 -0
  3. package/dist/components/Dropdown/WDropdown.vue.d.ts.map +1 -1
  4. package/dist/components/Dropdown/WDropdown.vue.js +3 -3
  5. package/dist/components/Dropdown/utils/DropdownStyle.js +2 -2
  6. package/dist/components/DropdownMenu/WDropdownMenu.vue.d.ts.map +1 -1
  7. package/dist/components/DropdownMenu/WDropdownMenu.vue.js +4 -2
  8. package/dist/components/DropdownMenu/types.d.ts +1 -0
  9. package/dist/components/DropdownMenu/types.d.ts.map +1 -1
  10. package/dist/components/FormAsync/WFormAsyncSelect.vue.js +1 -0
  11. package/dist/components/FormAsync/WFormAsyncSelectInfiniteSingle.vue.js +1 -0
  12. package/dist/components/FormAsync/WFormAsyncSelectSingle.vue.js +1 -0
  13. package/dist/components/FormAsync/WFormAsyncSelectStringified.vue.js +1 -0
  14. package/dist/components/Input/WInput.vue.d.ts.map +1 -1
  15. package/dist/components/Input/WInput.vue.js +19 -17
  16. package/dist/components/Input/WInputDate.vue.js +1 -0
  17. package/dist/components/Input/WInputOptions.vue.js +1 -0
  18. package/dist/components/Input/WInputSuggest.vue.d.ts.map +1 -1
  19. package/dist/components/Input/WInputSuggest.vue.js +3 -1
  20. package/dist/components/Input/components/ContentEditable.vue.d.ts +5 -1
  21. package/dist/components/Input/components/ContentEditable.vue.d.ts.map +1 -1
  22. package/dist/components/Input/components/ContentEditable.vue.js +261 -2
  23. package/dist/components/Input/components/ContentEditable.vue2.js +2 -260
  24. package/dist/components/Input/models/toolbarActions.d.ts.map +1 -1
  25. package/dist/components/Input/models/toolbarActions.js +5 -0
  26. package/dist/components/Input/models/utils.d.ts +3 -1
  27. package/dist/components/Input/models/utils.d.ts.map +1 -1
  28. package/dist/components/Input/models/utils.js +12 -6
  29. package/dist/components/MenuItem/WMenuItem.vue.d.ts +6 -1
  30. package/dist/components/MenuItem/WMenuItem.vue.d.ts.map +1 -1
  31. package/dist/components/MenuItem/WMenuItem.vue.js +25 -8
  32. package/dist/components/Select/WSelect.vue.js +1 -0
  33. package/dist/components/Select/WSelectAsync.vue.js +1 -0
  34. package/dist/components/Select/WSelectAsyncSingle.vue.js +1 -0
  35. package/dist/components/Select/WSelectSingle.vue.js +1 -0
  36. package/dist/components/Select/WSelectStringified.vue.js +1 -0
  37. package/dist/components/Shine/WShine.vue.js +1 -1
  38. package/dist/components/Tooltip/WTooltipContainer.vue.d.ts.map +1 -1
  39. package/dist/components/Tooltip/WTooltipContainer.vue.js +4 -5
  40. package/dist/components/Tooltip/components/TooltipContainer.vue.d.ts +0 -2
  41. package/dist/components/Tooltip/components/TooltipContainer.vue.d.ts.map +1 -1
  42. package/dist/components/Tooltip/components/TooltipContainer.vue.js +1 -2
  43. package/dist/main.d.ts +1 -0
  44. package/dist/main.d.ts.map +1 -1
  45. package/dist/main.js +1 -0
  46. package/package.json +1 -1
  47. package/tailwind-base/plugins/default.ts +4 -0
@@ -0,0 +1,24 @@
1
+ import { createElementBlock, openBlock, createElementVNode } from 'vue';
2
+
3
+ const _hoisted_1 = {
4
+ width: "20",
5
+ height: "20",
6
+ viewBox: "0 0 24 24",
7
+ fill: "none",
8
+ xmlns: "http://www.w3.org/2000/svg"
9
+ };
10
+
11
+ function render(_ctx, _cache) {
12
+ return (openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
13
+ createElementVNode("path", {
14
+ d: "M5 21h14M5 3v7a7 7 0 1 0 14 0V3",
15
+ stroke: "currentcolor",
16
+ "stroke-linecap": "round",
17
+ "stroke-linejoin": "round",
18
+ "stroke-width": "1.5"
19
+ }, null, -1)
20
+ ])))
21
+ }
22
+ const IconUnderline = { render: render };
23
+
24
+ export { IconUnderline as default, render };
@@ -15,6 +15,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15
15
  disabled: { type: Boolean, default: void 0 },
16
16
  tooltipText: {},
17
17
  parentElement: {},
18
+ dropdownClass: {},
18
19
  top: { type: Boolean },
19
20
  bottom: { type: Boolean },
20
21
  horizontalAlign: { default: HorizontalAlign.LEFT_INNER }
@@ -1 +1 @@
1
- {"version":3,"file":"WDropdown.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/WDropdown.vue"],"names":[],"mappings":"AA6BA;AA8IA,OAAO,KAAK,EAAC,wBAAwB,EAAE,aAAa,EAAC,MAAM,SAAS,CAAA;AAEpE,OAAO,EAAC,KAAK,KAAK,EAAyF,MAAM,KAAK,CAAA;AAoHtH,iBAAS,cAAc;WA4CT,OAAO,IAA6B;;iBA5DvC,CAAC,KAAK,EAAE,wBAAwB,KAAK,KAAK,EAAE;;iBAA5C,CAAC,KAAK,EAAE,wBAAwB,KAAK,KAAK,EAAE;;;;;;EAiEtD;AAiBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;kBAUnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAQpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"WDropdown.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/WDropdown.vue"],"names":[],"mappings":"AAiCA;AAkJA,OAAO,KAAK,EAAC,wBAAwB,EAAE,aAAa,EAAC,MAAM,SAAS,CAAA;AAEpE,OAAO,EAAC,KAAK,KAAK,EAAyF,MAAM,KAAK,CAAA;AAoHtH,iBAAS,cAAc;WA4CT,OAAO,IAA6B;;iBA5DvC,CAAC,KAAK,EAAE,wBAAwB,KAAK,KAAK,EAAE;;iBAA5C,CAAC,KAAK,EAAE,wBAAwB,KAAK,KAAK,EAAE;;;;;;EAiEtD;AAiBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;kBAUnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAQpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -79,9 +79,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
79
79
  return openBlock(), createElementBlock("div", {
80
80
  ref: "dropdown",
81
81
  style: normalizeStyle([{
82
- "--dropdown-x": x.value + "px",
83
- "--dropdown-y": y.value + "px"
84
- }, { "transform": "translate(var(--dropdown-x, 0px), var(--dropdown-y, 0px))" }]),
82
+ "--w-dropdown-x": x.value + "px",
83
+ "--w-dropdown-y": y.value + "px"
84
+ }, { "transform": "translate(var(--dropdown-x, 0px), var(--dropdown-y, 0px))", "--dropdown-x": "calc(max(min(var(--w-dropdown-x, 0px), var(--w-dropdown-x-max, 100vw)), var(--w-dropdown-x-min, 0px)))", "--dropdown-y": "calc(max(min(var(--w-dropdown-y, 0px), var(--w-dropdown-y-max, 100vh)), var(--w-dropdown-y-min, 0px)))" }]),
85
85
  class: normalizeClass(["group/dropdown width-0 height-0 fixed left-0 top-0 grid will-change-transform", [
86
86
  { "dropdown-top": isTop.value },
87
87
  horizontalGetter.value?.origin,
@@ -45,7 +45,7 @@ const RIGHT_EDGE = window.innerWidth * EDGE_FACTOR;
45
45
  const RightOuter = markRaw({
46
46
  verticalGetterOrder: [BottomInner, TopInner],
47
47
  origin: "justify-start" /* LEFT */,
48
- style: { maxWidth: "calc(100vw - var(--dropdown-x, 0px) - var(--w-right-inner, 0px))" },
48
+ style: { maxWidth: "calc(var(--w-dropdown-x-max, calc(100vw - var(--w-right-inner, 0px))) - var(--dropdown-x, 0px))" },
49
49
  x: (parentRect) => Math.round(parentRect.right),
50
50
  isEdge: (parentRect) => parentRect.right > RIGHT_EDGE
51
51
  });
@@ -77,7 +77,7 @@ const LEFT_EDGE = window.innerWidth * (1 - EDGE_FACTOR);
77
77
  const LeftInner = markRaw({
78
78
  verticalGetterOrder: [BottomOuter, TopOuter],
79
79
  origin: "justify-end" /* RIGHT */,
80
- style: { maxWidth: "calc(var(--dropdown-x, 0px) - var(--w-left-inner, 0px))" },
80
+ style: { maxWidth: "calc(var(--dropdown-x, 0px) - var(--w-dropdown-x-min, var(--w-left-inner, 0px)))" },
81
81
  x: (parentRect) => Math.round(parentRect.right),
82
82
  isEdge: (parentRect) => parentRect.right < LEFT_EDGE
83
83
  });
@@ -1 +1 @@
1
- {"version":3,"file":"WDropdownMenu.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/DropdownMenu/WDropdownMenu.vue"],"names":[],"mappings":"AA+BA;AAsEA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,6BAA6B,CAAA;AAEzE,OAAO,EAAC,KAAK,KAAK,EAAmC,MAAM,KAAK,CAAA;AAyChE,iBAAS,cAAc;WAyFT,OAAO,IAA6B;;iBA1GvC,CAAC,KAAK,EAAE;YAAC,KAAK,EAAE,OAAO,CAAC;YAAC,WAAW,EAAE,SAAS,CAAA;SAAC,KAAK,KAAK,EAAE;kBAC3D,CAAC,KAAK,EAAE,wBAAwB,KAAK,KAAK,EAAE;;iBAD7C,CAAC,KAAK,EAAE;YAAC,KAAK,EAAE,OAAO,CAAC;YAAC,WAAW,EAAE,SAAS,CAAA;SAAC,KAAK,KAAK,EAAE;kBAC3D,CAAC,KAAK,EAAE,wBAAwB,KAAK,KAAK,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;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,KAAK,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAwJqtiB,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;EAxCl4iB;AAeD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAwBwviB,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;OAfj4iB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAQpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { defineComponent, inject, useTemplateRef, computed, createElementBlock, openBlock, Fragment, createBlock, resolveDynamicComponent, unref, mergeProps, Teleport, createCommentVNode, normalizeStyle, withCtx, renderSlot, normalizeProps, guardReactiveProps } from 'vue';
1
+ import { defineComponent, inject, useTemplateRef, computed, createElementBlock, openBlock, Fragment, createBlock, resolveDynamicComponent, unref, mergeProps, Teleport, createCommentVNode, normalizeClass, normalizeStyle, withCtx, renderSlot, normalizeProps, guardReactiveProps } from 'vue';
2
2
  import _sfc_main$1 from '../Dropdown/WDropdown.vue.js';
3
3
  import { wBaseZIndex, isClientSide, unwrapSlots, BASE_ZINDEX_DROPDOWN } from '../../utils/utils.js';
4
4
 
@@ -7,6 +7,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  props: {
8
8
  isOpen: { type: Boolean },
9
9
  parentElement: {},
10
+ dropdownClass: {},
10
11
  horizontalAlign: {},
11
12
  top: { type: Boolean },
12
13
  bottom: { type: Boolean },
@@ -41,13 +42,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
41
42
  "emit-update": _ctx.emitUpdate,
42
43
  style: normalizeStyle({ zIndex: unref(baseZIndex) + unref(BASE_ZINDEX_DROPDOWN) }),
43
44
  top: _ctx.top,
45
+ class: normalizeClass(_ctx.dropdownClass),
44
46
  "onUpdate:rect": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:rect"))
45
47
  }, {
46
48
  default: withCtx((defaultScope) => [
47
49
  renderSlot(_ctx.$slots, "content", normalizeProps(guardReactiveProps(defaultScope)))
48
50
  ]),
49
51
  _: 3
50
- }, 8, ["parent-element", "horizontal-align", "update-align", "emit-update", "style", "top"])) : createCommentVNode("", true)
52
+ }, 8, ["parent-element", "horizontal-align", "update-align", "emit-update", "style", "top", "class"])) : createCommentVNode("", true)
51
53
  ], 8, ["disabled"]))
52
54
  ], 64);
53
55
  };
@@ -2,5 +2,6 @@ import { DropdownProps } from '../Dropdown/types';
2
2
  export interface DropdownMenuProps extends Omit<DropdownProps, 'parentElement'> {
3
3
  isOpen: boolean;
4
4
  parentElement?: DropdownProps['parentElement'];
5
+ dropdownClass?: string;
5
6
  }
6
7
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/DropdownMenu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAEpD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC;IAC7E,MAAM,EAAE,OAAO,CAAA;IACf,aAAa,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAA;CAC/C"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/DropdownMenu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAEpD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC;IAC7E,MAAM,EAAE,OAAO,CAAA;IACf,aAAa,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAA;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB"}
@@ -68,6 +68,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
68
68
  savedText: {},
69
69
  topText: { type: Boolean },
70
70
  parentElement: {},
71
+ dropdownClass: {},
71
72
  horizontalAlign: {},
72
73
  top: { type: Boolean },
73
74
  bottom: { type: Boolean },
@@ -73,6 +73,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
73
73
  savedText: {},
74
74
  topText: { type: Boolean },
75
75
  parentElement: {},
76
+ dropdownClass: {},
76
77
  horizontalAlign: {},
77
78
  top: { type: Boolean },
78
79
  bottom: { type: Boolean },
@@ -69,6 +69,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
69
69
  savedText: {},
70
70
  topText: { type: Boolean },
71
71
  parentElement: {},
72
+ dropdownClass: {},
72
73
  horizontalAlign: {},
73
74
  top: { type: Boolean },
74
75
  bottom: { type: Boolean },
@@ -69,6 +69,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
69
69
  savedText: {},
70
70
  topText: { type: Boolean },
71
71
  parentElement: {},
72
+ dropdownClass: {},
72
73
  horizontalAlign: {},
73
74
  top: { type: Boolean },
74
75
  bottom: { type: Boolean },
@@ -1 +1 @@
1
- {"version":3,"file":"WInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/WInput.vue"],"names":[],"mappings":"AAkPA;AAmiBA,OAAO,KAAK,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,SAAS,CAAA;AAatD,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,gBAAgB,CAAA;yBAE9B,IAAI,SAAS,SAAS,GAAG,MAAM,EAC/C,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,C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BAAgB,SAAS,aAAa,GAAG,IAAI;YAC7C,aAAa,SAAS,aAAa,GAAG,IAAI;YAC1C,eAAe,SAAS,aAAa,GAAG,IAAI;YAC5C,iBAAiB,SAAS,aAAa,GAAG,IAAI;YAC9C,oBAAoB,SAAS,aAAa,GAAG,IAAI;YACjD,aAAa,GAAG,IAAI;YACpB,OAAO,SAAS,UAAU,GAAG,SAAS,GAAG,IAAI;YAC7C,MAAM,SAAS,UAAU,GAAG,IAAI;YAChC,OAAO,SAAS,UAAU,GAAG,IAAI;YACjC,WAAW,SAAS,UAAU,GAAG,IAAI;YACrC,cAAc,SAAS,UAAU,GAAG,IAAI;YACxC,cAAc,SAAS,KAAK,GAAG,IAAI;YACnC,OAAO,GAAG,IAAI;;EAmwBhB,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AA9yBzE,wBA8yB4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -5,7 +5,8 @@ import { Notify } from '../../utils/Notify.js';
5
5
  import { useComponentStates } from '../../utils/useComponentStates.js';
6
6
  import { checkPermissionPaste } from '../../utils/useCopy.js';
7
7
  import { debounce } from '../../utils/utils.js';
8
- import _sfc_main$2 from './components/InputActions.vue.js';
8
+ import _sfc_main$2 from './components/ContentEditable.vue.js';
9
+ import _sfc_main$3 from './components/InputActions.vue.js';
9
10
 
10
11
  const _hoisted_1 = { class: "relative flex min-h-full flex-1" };
11
12
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -67,7 +68,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
67
68
  emits: ["update:model-value", "keypress:enter", "keypress:up", "keypress:down", "keypress:delete", "keypress:backspace", "click:clear", "focus", "blur", "click", "mousedown", "click:suffix", "select:input", "paste"],
68
69
  setup(__props, { expose: __expose, emit: __emit }) {
69
70
  const InputToolbar = defineAsyncComponent(() => import('./components/InputToolbar.vue.js'));
70
- const ContentEditable = defineAsyncComponent(() => import('./components/ContentEditable.vue.js'));
71
71
  const props = __props;
72
72
  const emit = __emit;
73
73
  const { isReadonly, isDisabled } = useComponentStates(props);
@@ -211,7 +211,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
211
211
  };
212
212
  const scrollToInput = () => {
213
213
  if (!contentRef.value || !inputRef.value) return;
214
- contentRef.value.scrollTo({ left: contentRef.value.scrollWidth - inputRef.value.offsetWidth - 40 });
214
+ if (inputRef.value instanceof HTMLElement) inputRef.value.scrollIntoView({ behavior: "instant", block: "center" });
215
+ else contentRef.value.scrollTo({ left: contentRef.value.scrollWidth - 40 });
215
216
  };
216
217
  const wrapSelection = (value) => inputRef.value && "wrapSelection" in inputRef.value ? inputRef.value.wrapSelection(value) : void 0;
217
218
  let timeout;
@@ -288,7 +289,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
288
289
  name: "default",
289
290
  fn: withCtx(() => [
290
291
  createElementVNode("div", {
291
- class: normalizeClass(["flex gap-1", {
292
+ class: normalizeClass(["flex max-w-full gap-1", {
292
293
  "flex-wrap": !_ctx.seamless,
293
294
  "overflow-hidden": _ctx.seamless
294
295
  }])
@@ -296,10 +297,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
296
297
  renderSlot(_ctx.$slots, "prefix"),
297
298
  !_ctx.hideInput ? (openBlock(), createElementBlock("div", {
298
299
  key: 0,
299
- class: normalizeClass({
300
+ class: normalizeClass([{
300
301
  "font-mono": _ctx.mono,
301
- "text-secure": _ctx.textSecure && !isSecureVisible.value && _ctx.modelValue
302
- })
302
+ "text-secure": _ctx.textSecure && !isSecureVisible.value && _ctx.modelValue,
303
+ "whitespace-pre": _ctx.textarea
304
+ }, "overflow-x-auto overscroll-x-contain"])
303
305
  }, toDisplayString(_ctx.modelValue || _ctx.emptyValue), 3)) : createCommentVNode("", true)
304
306
  ], 2)
305
307
  ]),
@@ -319,12 +321,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
319
321
  }]),
320
322
  onClick: focus
321
323
  }, [
322
- _ctx.textarea && (_ctx.rich || _ctx.toolbarActions || _ctx.$slots.toolbar) ? (openBlock(), createBlock(unref(InputToolbar), {
324
+ !unref(isDisabled) && !unref(isReadonly) && _ctx.textarea && (_ctx.rich || _ctx.toolbarActions || _ctx.$slots.toolbar) ? (openBlock(), createBlock(unref(InputToolbar), {
323
325
  key: 0,
324
326
  list: _ctx.toolbarActions,
325
327
  rich: _ctx.rich === true,
326
- "is-undo": historyPosition.value !== 0,
327
- "is-redo": historyPosition.value !== history.value.length - 1,
328
+ "is-undo": historyPosition.value > 0,
329
+ "is-redo": historyPosition.value < history.value.length - 1,
328
330
  "text-secure": _ctx.textSecure ?? false,
329
331
  onWrapSelection: wrapSelection,
330
332
  onUndo: undo,
@@ -348,7 +350,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
348
350
  ref: "content",
349
351
  class: normalizeClass(["group/input col-start-2 grid grid-cols-1", {
350
352
  "py-[--w-input-gap,0.25rem] first:pl-[--w-input-gap,0.25rem] last:pr-[--w-input-gap,0.25rem]": _ctx.$slots.prefix,
351
- "no-scrollbar overflow-x-auto overscroll-x-contain": _ctx.seamless && focused,
353
+ "no-scrollbar overflow-x-auto overscroll-x-contain": _ctx.noWrap && !(_ctx.seamless && !focused),
352
354
  "overflow-hidden": _ctx.seamless && !focused
353
355
  }])
354
356
  }, [
@@ -356,27 +358,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
356
358
  class: normalizeClass(["w-skeleton-w-32 flex gap-[--w-input-gap,0.25rem]", {
357
359
  "[&:not(:has(.w-option-has-bg))]:-px--w-option-padding": !_ctx.icon && !_ctx.textarea,
358
360
  "flex-wrap": !_ctx.noWrap && !_ctx.seamless,
359
- "w-full min-w-max": !_ctx.textarea && _ctx.$slots.prefix
361
+ "w-full min-w-max": !_ctx.textarea && _ctx.noWrap
360
362
  }])
361
363
  }, [
362
364
  renderSlot(_ctx.$slots, "prefix", normalizeProps(guardReactiveProps({ modelValue: _ctx.modelValue }))),
363
365
  createElementVNode("div", {
364
- class: normalizeClass(["flex-1 overflow-auto font-normal", {
366
+ class: normalizeClass(["flex-1 font-normal", {
365
367
  "w-full": !_ctx.hideInput && !_ctx.$slots.prefix,
366
368
  "w-option-has-bg-input": _ctx.$slots.prefix,
367
369
  "resize-y": _ctx.resize && _ctx.textarea,
368
370
  "resize-none": !_ctx.resize && _ctx.textarea,
369
371
  "h-[calc(var(--w-input-height,2.75rem)-2px)]": !_ctx.textarea && !_ctx.$slots.suffix,
370
- "w-option": !_ctx.textarea && _ctx.$slots.prefix,
372
+ "w-option min-w-40": !_ctx.textarea && _ctx.$slots.prefix && !_ctx.hideInput,
371
373
  "font-mono": _ctx.mono,
372
374
  "text-black-default dark:text-gray-200": !unref(isDisabled),
373
375
  "text-black-default/50 dark:text-gray-200/50": unref(isDisabled),
374
- "-p--w-option-padding h-[--w-textarea-height,10rem] min-h-[--w-textarea-height,10rem] w-full": _ctx.textarea
376
+ "-p--w-option-padding h-[--w-textarea-height,10rem] min-h-[--w-textarea-height,10rem] w-full overflow-auto overscroll-contain": _ctx.textarea
375
377
  }])
376
378
  }, [
377
379
  createElementVNode("div", _hoisted_1, [
378
380
  renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps({ modelValue: _ctx.modelValue }))),
379
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.textarea ? unref(ContentEditable) : "input"), {
381
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.textarea ? _sfc_main$2 : "input"), {
380
382
  id,
381
383
  ref: "input",
382
384
  class: normalizeClass(["w-input min-h-full flex-1 basis-auto appearance-none border-none bg-[inherit] outline-0 placeholder:text-gray-400 disabled:cursor-not-allowed dark:placeholder:text-gray-500", {
@@ -430,7 +432,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
430
432
  ], 2)
431
433
  ], 2)
432
434
  ], 2),
433
- !_ctx.seamless || focused ? (openBlock(), createBlock(_sfc_main$2, {
435
+ !_ctx.seamless || focused ? (openBlock(), createBlock(_sfc_main$3, {
434
436
  key: 2,
435
437
  "model-value": _ctx.modelValue,
436
438
  loading: _ctx.loading,
@@ -65,6 +65,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
65
65
  savedText: {},
66
66
  topText: { type: Boolean },
67
67
  parentElement: {},
68
+ dropdownClass: {},
68
69
  horizontalAlign: { default: HorizontalAlign.RIGHT_INNER },
69
70
  top: { type: Boolean },
70
71
  bottom: { type: Boolean }
@@ -71,6 +71,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
71
71
  savedText: {},
72
72
  topText: { type: Boolean },
73
73
  parentElement: {},
74
+ dropdownClass: {},
74
75
  horizontalAlign: {},
75
76
  top: { type: Boolean },
76
77
  bottom: { type: Boolean }
@@ -1 +1 @@
1
- {"version":3,"file":"WInputSuggest.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/WInputSuggest.vue"],"names":[],"mappings":"AAyHA;AAqOA,OAAO,KAAK,EAAC,iBAAiB,EAAE,aAAa,EAAC,MAAM,SAAS,CAAA;AAE7D,OAAO,EAAC,KAAK,KAAK,EAAgC,MAAM,KAAK,CAAA;yBAe5C,IAAI,SAAS,SAAS,GAAG,MAAM,EAC/C,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,eAAe,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EACjE;WA4ZO,mBAAmB,CAAC,2CAAkE,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB;;;;;;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AoB,mDAAsB,IAAI;YAC9C,gBAAgB,SAAS,aAAa,GAAG,IAAI;YAC7C,aAAa,SAAS,aAAa,GAAG,IAAI;YAC1C,eAAe,SAAS,aAAa,GAAG,IAAI;YAC5C,iBAAiB,SAAS,aAAa,GAAG,IAAI;YAC9C,MAAM,GAAG,IAAI;YACb,OAAO,GAAG,IAAI;YACd,aAAa,GAAG,IAAI;YACpB,OAAO,SAAS,UAAU,GAAG,SAAS,GAAG,IAAI;YAC7C,MAAM,SAAS,UAAU,GAAG,IAAI;;EAwYlC,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAzazE,wBAya4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -68,6 +68,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
68
68
  savedText: {},
69
69
  topText: { type: Boolean },
70
70
  parentElement: {},
71
+ dropdownClass: {},
71
72
  horizontalAlign: { default: HorizontalAlign.FILL },
72
73
  top: { type: Boolean },
73
74
  bottom: { type: Boolean }
@@ -119,7 +120,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
119
120
  isOpen: isOpen.value,
120
121
  horizontalAlign: _ctx.horizontalAlign,
121
122
  updateAlign: true,
122
- parentElement: unref(inputRef)?.fieldRef
123
+ parentElement: unref(inputRef)?.fieldRef,
124
+ dropdownClass: _ctx.dropdownClass
123
125
  }), createSlots({
124
126
  toggle: withCtx((toggleScope) => [
125
127
  createVNode(_sfc_main$3, mergeProps({ ref: "input" }, {
@@ -4,13 +4,17 @@ type __VLS_Props = {
4
4
  placeholder: string;
5
5
  maxLength: number;
6
6
  textParts: TextPart[] | undefined;
7
+ readonly: boolean | undefined;
8
+ disabled: boolean | undefined;
7
9
  };
8
10
  declare const _default: import('vue').DefineComponent<__VLS_Props, {
9
11
  focus: () => void;
10
12
  blur: () => void;
11
13
  wrapSelection: (value: WrapSelection) => void;
12
14
  setCaret: (indexStart: number, indexEnd?: number) => void;
13
- getCaret: () => import('../models/utils').CaretOffset;
15
+ getCaret: () => import('../models/utils').CaretOffset & {
16
+ trail: number;
17
+ };
14
18
  offsetWidth: number;
15
19
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
16
20
  blur: (value: FocusEvent) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"ContentEditable.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/components/ContentEditable.vue"],"names":[],"mappings":"AAiBA;AAyUA,OAAO,KAAK,EAAC,QAAQ,EAAG,aAAa,EAAC,MAAM,UAAU,CAAA;AAStD,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAA;CAClC,CAAC;;;;2BAsK4B,aAAa,KAAG,IAAI;2BATpB,MAAM,aAAa,MAAM;;;;;;;;;;;;;;;;AAsNvD,wBAUG"}
1
+ {"version":3,"file":"ContentEditable.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/components/ContentEditable.vue"],"names":[],"mappings":"AAiBA;AA0UA,OAAO,KAAK,EAAC,QAAQ,EAAG,aAAa,EAAC,MAAM,UAAU,CAAA;AAStD,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAA;IACjC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B,CAAC;;;;2BAqK4B,aAAa,KAAG,IAAI;2BATpB,MAAM,aAAa,MAAM;;;;;;;;;;;;;;;;;;AAsNvD,wBAUG"}
@@ -1,5 +1,264 @@
1
- import _sfc_main from './ContentEditable.vue2.js';
2
-
1
+ import { defineComponent, useTemplateRef, ref, watch, onMounted, createElementBlock, openBlock, nextTick } from 'vue';
2
+ import { WrapSelectionType } from '../../../utils/utils.js';
3
+ import { preserveIndentation } from '../models/toolbarActions.js';
4
+ import { getCaretOffset, setCaretOffset } from '../models/utils.js';
3
5
 
6
+ const _hoisted_1 = ["contenteditable", "placeholder"];
7
+ const _sfc_main = /* @__PURE__ */ defineComponent({
8
+ __name: "ContentEditable",
9
+ props: {
10
+ value: {},
11
+ placeholder: {},
12
+ maxLength: {},
13
+ textParts: {},
14
+ readonly: { type: Boolean },
15
+ disabled: { type: Boolean }
16
+ },
17
+ emits: ["update:model-value", "focus", "blur", "keydown"],
18
+ setup(__props, { expose: __expose, emit: __emit }) {
19
+ const props = __props;
20
+ const emit = __emit;
21
+ const elementRef = useTemplateRef("element");
22
+ const focused = ref(false);
23
+ const updateTextParts = () => {
24
+ if (!elementRef.value || !props.textParts) return;
25
+ const offsets = getCaret();
26
+ let nodeIndex = 0;
27
+ for (const item of props.textParts) {
28
+ const existingNode = elementRef.value.childNodes[nodeIndex] ?? null;
29
+ if (typeof item === "string") {
30
+ const displayText = item.replace(/\n$/g, "\n ");
31
+ if (existingNode instanceof Text) {
32
+ if (existingNode.textContent !== displayText) existingNode.textContent = displayText;
33
+ } else {
34
+ const textNode = document.createTextNode(displayText);
35
+ elementRef.value.insertBefore(textNode, existingNode);
36
+ }
37
+ } else {
38
+ if (existingNode instanceof HTMLElement && existingNode.tagName.toLowerCase() === item.tag.toLowerCase()) {
39
+ if (existingNode.textContent !== item.value) existingNode.textContent = item.value;
40
+ if (existingNode.className !== (item.class || "")) existingNode.className = item.class || "";
41
+ if (item.edit === false && existingNode.getAttribute("contenteditable") !== "false") {
42
+ existingNode.setAttribute("contenteditable", "false");
43
+ }
44
+ } else {
45
+ const element = document.createElement(item.tag);
46
+ element.textContent = item.value;
47
+ element.setAttribute("contenteditable", item.edit ? "plaintext-only" : "false");
48
+ if (item.class) element.className = item.class;
49
+ elementRef.value.insertBefore(element, existingNode);
50
+ }
51
+ }
52
+ nodeIndex++;
53
+ }
54
+ while (elementRef.value.childNodes.length > props.textParts.length) {
55
+ const nodeToRemove = elementRef.value.childNodes[props.textParts.length];
56
+ elementRef.value.removeChild(nodeToRemove);
57
+ }
58
+ if (focused.value && !isSetCaretNext) setCaret(offsets.start, offsets.end !== offsets.start ? void 0 : offsets.end);
59
+ };
60
+ watch(() => props.textParts, updateTextParts, { immediate: true });
61
+ const updateTextValue = (value) => {
62
+ if (props.textParts || !elementRef.value) return;
63
+ if (elementRef.value.textContent !== value) {
64
+ const offsets = getCaret();
65
+ elementRef.value.textContent = value;
66
+ if (focused.value) setCaret(offsets.start, offsets.end !== offsets.start ? void 0 : offsets.end);
67
+ }
68
+ };
69
+ watch(() => props.value, updateTextValue, { immediate: true });
70
+ const textPartsToText = (parts) => {
71
+ return parts.map((part) => typeof part === "string" ? part : part.value).join("");
72
+ };
73
+ const getCurrentText = () => {
74
+ return props.textParts ? textPartsToText(props.textParts) : props.value;
75
+ };
76
+ const lineBreakEvents = ["insertParagraph", "insertLineBreak"];
77
+ const insertParagraph = (e) => {
78
+ if (lineBreakEvents.includes(e.inputType)) {
79
+ e.preventDefault();
80
+ insertPlain("\n");
81
+ }
82
+ };
83
+ const regexDifferentEnding = /\r\n?/g;
84
+ const regexSpaces = /\n \n/g;
85
+ const regexEnding = / +$/gm;
86
+ const normalizeText = (text) => {
87
+ return text.replace(regexDifferentEnding, "\n").replace(regexSpaces, "\n\n").replace(regexEnding, "");
88
+ };
89
+ const onInput = (e) => {
90
+ e.stopImmediatePropagation();
91
+ if (!(e.target instanceof HTMLDivElement)) return;
92
+ const rawText = e.target.textContent ?? "";
93
+ const text = normalizeText(rawText);
94
+ const currentText = getCurrentText();
95
+ if (text === currentText) return;
96
+ if (props.maxLength && typeof text === "string" && text.length > props.maxLength) {
97
+ e.preventDefault();
98
+ const substring = text.substring(0, props.maxLength);
99
+ if (!props.textParts) updateTextValue(substring);
100
+ else updateTextParts();
101
+ emit("update:model-value", substring);
102
+ } else {
103
+ emit("update:model-value", text);
104
+ }
105
+ };
106
+ const onPaste = async (e) => {
107
+ e.preventDefault();
108
+ navigator.clipboard.readText();
109
+ const text = (e.clipboardData?.getData("text/plain") || await navigator.clipboard.readText()).replace(/\r\n?/g, "\n");
110
+ insertPlain(text);
111
+ };
112
+ const insertPlain = (text) => {
113
+ const root = elementRef.value;
114
+ if (!root) return;
115
+ const { start, end, trail } = getCaret();
116
+ const currentText = getCurrentText();
117
+ const next = (currentText ?? "").slice(0, start) + " ".repeat(trail) + text + ((currentText ?? "").slice(end) || " ");
118
+ const caretAfter = start + text.length + trail;
119
+ emit("update:model-value", props.maxLength && next.length > props.maxLength ? next.substring(0, props.maxLength) : next);
120
+ nextTick(() => setCaret(props.maxLength ? Math.min(caretAfter, props.maxLength) : caretAfter));
121
+ };
122
+ const getCaret = () => getCaretOffset(elementRef.value);
123
+ let isSetCaretNext = false;
124
+ const setCaret = (indexStart, indexEnd) => {
125
+ isSetCaretNext = false;
126
+ setCaretOffset(elementRef.value, indexStart, indexEnd);
127
+ };
128
+ const collapseList = [" ", "\n"];
129
+ let offsetsOld = null;
130
+ const wrapSelection = (value) => {
131
+ if (focused.value || !offsetsOld) offsetsOld = getCaret();
132
+ const offsets = offsetsOld;
133
+ const currentText = getCurrentText() ?? "";
134
+ let newText = "";
135
+ let newCursorStart = offsets.start;
136
+ let newCursorEnd = void 0;
137
+ switch (value.type) {
138
+ case WrapSelectionType.TOGGLE:
139
+ let startLen = value.start.length;
140
+ const endLen = value.end.length;
141
+ const textWithContext = currentText.slice(
142
+ Math.max(0, offsets.start - startLen),
143
+ Math.min(currentText.length, offsets.end + endLen)
144
+ );
145
+ if ((!value.start || textWithContext.startsWith(value.start)) && (!value.end || textWithContext.endsWith(value.end))) {
146
+ let expandedStart = Math.max(0, offsets.start - startLen);
147
+ let start = currentText.slice(0, expandedStart);
148
+ const middle = currentText.slice(offsets.start, offsets.end);
149
+ let end = currentText.slice(Math.min(currentText.length, offsets.end + endLen));
150
+ for (const item of collapseList) {
151
+ if (value.start.startsWith(item) && !start.endsWith(item) && !middle.startsWith(item)) {
152
+ start += item;
153
+ expandedStart += item.length;
154
+ }
155
+ if (value.end.endsWith(item) && !end.startsWith(item) && !middle.endsWith(item)) end = item + end;
156
+ }
157
+ newText = start + middle + end;
158
+ if (value.prepare) newText = value.prepare(newText, 0);
159
+ newCursorStart = expandedStart;
160
+ newCursorEnd = expandedStart + offsets.end - offsets.start;
161
+ } else {
162
+ if (!value.start || !value.end) {
163
+ const offset = value.start ? offsets.start : offsets.end;
164
+ let start = currentText.slice(0, offset);
165
+ let end = currentText.slice(offset);
166
+ for (const item of collapseList) {
167
+ if (value.start.startsWith(item) && start.endsWith(item)) {
168
+ start = start.slice(0, offsets.start - item.length);
169
+ startLen -= item.length;
170
+ }
171
+ if (value.end.endsWith(item) && end.startsWith(item)) end = end.slice(item.length);
172
+ }
173
+ newText = (value.prepare?.(start, 0) ?? start) + (value.start || value.end) + (value.prepare?.(end, offset) ?? end);
174
+ } else {
175
+ let start = currentText.slice(0, offsets.start);
176
+ const middle = currentText.slice(offsets.start, offsets.end);
177
+ let end = currentText.slice(offsets.end);
178
+ for (const item of collapseList) {
179
+ if (value.start.startsWith(item) && start.endsWith(item)) {
180
+ start = start.slice(0, offsets.start - item.length);
181
+ startLen -= item.length;
182
+ }
183
+ if (value.end.endsWith(item) && end.startsWith(item)) end = end.slice(item.length);
184
+ }
185
+ newText = (value.prepare?.(start, 0) ?? start) + value.start + (value.prepare?.(middle, offsets.start) ?? middle) + value.end + (value.prepare?.(end, offsets.end) ?? end);
186
+ }
187
+ newCursorStart = offsets.start + startLen;
188
+ if (offsets.start !== offsets.end) newCursorEnd = newCursorStart + offsets.end - offsets.start;
189
+ }
190
+ break;
191
+ case WrapSelectionType.LINE_PREFIX:
192
+ const lineStart = currentText.lastIndexOf("\n", offsets.start - 1) + 1;
193
+ const lineEnd = currentText.indexOf("\n", offsets.end);
194
+ const actualLineEnd = lineEnd === -1 ? currentText.length : lineEnd;
195
+ const linesText = currentText.slice(lineStart, actualLineEnd);
196
+ const beforeLines = currentText.slice(0, lineStart);
197
+ const afterLines = currentText.slice(actualLineEnd);
198
+ const lines = linesText.split("\n");
199
+ if (lines.length === 0) lines.push("");
200
+ const allLinesHavePrefix = value.detectPattern ? lines.every((line) => !line.trim() || value.detectPattern.test(line)) : value.linePrefix ? lines.every((line) => !line.trim() || line.startsWith(value.linePrefix)) : false;
201
+ if (allLinesHavePrefix) {
202
+ const cleanText = lines.map((line) => preserveIndentation(line, "")).join("\n");
203
+ newText = beforeLines + cleanText + afterLines;
204
+ newCursorStart = lineStart;
205
+ newCursorEnd = lineStart + cleanText.length;
206
+ } else {
207
+ const processedText = value.lineTransformAll ? value.lineTransformAll(lines) : value.lineTransform ? lines.map(value.lineTransform).join("\n") : lines.map((line) => line.trim() ? preserveIndentation(line, value.linePrefix) : line).join("\n");
208
+ newText = beforeLines + processedText + afterLines;
209
+ newCursorStart = lineStart;
210
+ newCursorEnd = lineStart + processedText.length;
211
+ }
212
+ break;
213
+ }
214
+ isSetCaretNext = true;
215
+ emit("update:model-value", newText);
216
+ requestAnimationFrame(() => setCaret(newCursorStart, newCursorEnd));
217
+ };
218
+ const focus = () => {
219
+ elementRef.value?.focus();
220
+ };
221
+ const blur = () => {
222
+ elementRef.value?.blur();
223
+ };
224
+ onMounted(() => {
225
+ updateTextValue(props.value);
226
+ updateTextParts();
227
+ });
228
+ __expose({
229
+ focus,
230
+ blur,
231
+ wrapSelection,
232
+ setCaret,
233
+ getCaret,
234
+ get offsetWidth() {
235
+ return elementRef.value?.offsetWidth ?? 0;
236
+ }
237
+ });
238
+ return (_ctx, _cache) => {
239
+ return openBlock(), createElementBlock("div", {
240
+ ref: "element",
241
+ contenteditable: _ctx.readonly || _ctx.disabled ? "false" : "plaintext-only",
242
+ role: "textbox",
243
+ "aria-multiline": "true",
244
+ spellcheck: "false",
245
+ placeholder: _ctx.placeholder,
246
+ class: "relative whitespace-pre",
247
+ onInput,
248
+ onBeforeinput: _cache[0] || (_cache[0] = ($event) => insertParagraph($event)),
249
+ onPaste,
250
+ onKeydown: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("keydown", $event)),
251
+ onFocus: _cache[2] || (_cache[2] = ($event) => {
252
+ _ctx.$emit("focus", $event);
253
+ focused.value = true;
254
+ }),
255
+ onBlur: _cache[3] || (_cache[3] = ($event) => {
256
+ _ctx.$emit("blur", $event);
257
+ focused.value = false;
258
+ })
259
+ }, null, 40, _hoisted_1);
260
+ };
261
+ }
262
+ });
4
263
 
5
264
  export { _sfc_main as default };