eco-vue-js 0.11.12 → 0.11.14

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 (52) hide show
  1. package/dist/assets/icons/IconList.svg.js +24 -0
  2. package/dist/assets/icons/IconListDecrease.svg.js +24 -0
  3. package/dist/assets/icons/IconListIncrease.svg.js +24 -0
  4. package/dist/assets/icons/{IconTableSettings.svg.js → IconListSettings.svg.js} +2 -2
  5. package/dist/assets/icons/IconRedo.svg.js +32 -0
  6. package/dist/assets/icons/IconTable.svg.js +10 -1
  7. package/dist/assets/icons/IconTableCollapsed.svg.js +37 -0
  8. package/dist/assets/icons/IconUndo.svg.js +32 -0
  9. package/dist/components/FieldWrapper/WFieldWrapper.vue.d.ts +1 -0
  10. package/dist/components/FieldWrapper/WFieldWrapper.vue.d.ts.map +1 -1
  11. package/dist/components/FieldWrapper/WFieldWrapper.vue.js +36 -6
  12. package/dist/components/FieldWrapper/use/useFieldSaved.d.ts +4 -5
  13. package/dist/components/FieldWrapper/use/useFieldSaved.d.ts.map +1 -1
  14. package/dist/components/FieldWrapper/use/useFieldSaved.js +10 -25
  15. package/dist/components/FormAsync/use/useFormAsync.js +3 -3
  16. package/dist/components/Input/WInput.vue.d.ts +5 -5
  17. package/dist/components/Input/WInput.vue.d.ts.map +1 -1
  18. package/dist/components/Input/WInput.vue.js +102 -48
  19. package/dist/components/Input/WInputDate.vue.d.ts +2 -8
  20. package/dist/components/Input/WInputDate.vue.d.ts.map +1 -1
  21. package/dist/components/Input/WInputSuggest.vue.d.ts +1 -4
  22. package/dist/components/Input/WInputSuggest.vue.d.ts.map +1 -1
  23. package/dist/components/Input/WInputSuggest.vue.js +2 -2
  24. package/dist/components/Input/WInputToolbarButton.vue.d.ts +5 -8
  25. package/dist/components/Input/WInputToolbarButton.vue.d.ts.map +1 -1
  26. package/dist/components/Input/WInputToolbarButton.vue.js +40 -38
  27. package/dist/components/Input/components/ContentEditable.vue.d.ts +1 -4
  28. package/dist/components/Input/components/ContentEditable.vue.d.ts.map +1 -1
  29. package/dist/components/Input/components/ContentEditable.vue2.js +54 -30
  30. package/dist/components/Input/components/InputToolbar.vue.d.ts +6 -0
  31. package/dist/components/Input/components/InputToolbar.vue.d.ts.map +1 -1
  32. package/dist/components/Input/components/InputToolbar.vue2.js +36 -13
  33. package/dist/components/Input/components/InputToolbarButton.vue.d.ts +5 -2
  34. package/dist/components/Input/components/InputToolbarButton.vue.d.ts.map +1 -1
  35. package/dist/components/Input/components/InputToolbarButton.vue.js +19 -11
  36. package/dist/components/Input/models/toolbarActions.d.ts +2 -0
  37. package/dist/components/Input/models/toolbarActions.d.ts.map +1 -1
  38. package/dist/components/Input/models/toolbarActions.js +67 -7
  39. package/dist/components/Input/models/utils.d.ts +6 -0
  40. package/dist/components/Input/models/utils.d.ts.map +1 -0
  41. package/dist/components/Input/models/utils.js +14 -0
  42. package/dist/components/Input/types.d.ts +12 -3
  43. package/dist/components/Input/types.d.ts.map +1 -1
  44. package/dist/components/List/components/HeaderSettings.vue.js +2 -2
  45. package/dist/components/List/use/useListConfig.js +2 -2
  46. package/dist/main.d.ts +7 -1
  47. package/dist/main.d.ts.map +1 -1
  48. package/dist/main.js +8 -2
  49. package/dist/utils/useCopy.d.ts +1 -0
  50. package/dist/utils/useCopy.d.ts.map +1 -1
  51. package/dist/utils/useCopy.js +20 -18
  52. package/package.json +1 -1
@@ -16,10 +16,7 @@ declare function __VLS_template(): {
16
16
  scrollToInput: () => void | undefined;
17
17
  wrapSelection: (value: import('./types').WrapSelection) => void | undefined;
18
18
  setCaret: (indexStart: number, indexEnd?: number) => void | undefined;
19
- getSelectionOffsets: () => {
20
- start: number;
21
- end: number;
22
- } | undefined;
19
+ getCaret: () => import('./models/utils').CaretOffset | undefined;
23
20
  }> | null;
24
21
  };
25
22
  rootEl: any;
@@ -46,10 +43,7 @@ declare const __VLS_component: import('vue').DefineComponent<InputDateProps, {},
46
43
  scrollToInput: () => void | undefined;
47
44
  wrapSelection: (value: import('./types').WrapSelection) => void | undefined;
48
45
  setCaret: (indexStart: number, indexEnd?: number) => void | undefined;
49
- getSelectionOffsets: () => {
50
- start: number;
51
- end: number;
52
- } | undefined;
46
+ getCaret: () => import('./models/utils').CaretOffset | undefined;
53
47
  }> | null;
54
48
  }, any>;
55
49
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
@@ -1 +1 @@
1
- {"version":3,"file":"WInputDate.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/WInputDate.vue"],"names":[],"mappings":"AAiDA;AAmHA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAO3C,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAA;AAuEvD,iBAAS,cAAc;WA6HT,OAAO,IAA6B;;uBAbtB,GAAG;0BACA,GAAG;uBACN,GAAG;;;;;;;;;;;;;;;;;;EAgB9B;AAeD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;OASnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"WInputDate.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/WInputDate.vue"],"names":[],"mappings":"AAiDA;AAmHA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAO3C,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAA;AAuEvD,iBAAS,cAAc;WA6HT,OAAO,IAA6B;;uBAbtB,GAAG;0BACA,GAAG;uBACN,GAAG;;;;;;;;;;;;;;;EAgB9B;AAeD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;OASnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -10,10 +10,7 @@ declare const _default: <Type extends InputType = "text">(__VLS_props: NonNullab
10
10
  scrollToInput: () => void | undefined;
11
11
  wrapSelection: (value: WrapSelection) => void | undefined;
12
12
  setCaret: (indexStart: number, indexEnd?: number) => void | undefined;
13
- getSelectionOffsets: () => {
14
- start: number;
15
- end: number;
16
- } | undefined;
13
+ getCaret: () => import('./models/utils').CaretOffset | undefined;
17
14
  }>): void;
18
15
  attrs: any;
19
16
  slots: Readonly<{
@@ -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;;;;;;+BA9VjB,aAAa;+BACb,MAAM,aAAa,MAAM;;;;;MA6Vc,GAAG,IAAI;WACpE,GAAG;;gBAnUD,MAAM,IAAI;iBACT,MAAM,IAAI;mBACR,MAAM,IAAI;kBACX,MAAM,IAAI;iBACX,CAAC,KAAK,EAAE;YAAC,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;SAAC,KAAK,IAAI;gBAChD,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI;kBACpC,MAAM,KAAK,EAAE;;gBANf,MAAM,IAAI;iBACT,MAAM,IAAI;mBACR,MAAM,IAAI;kBACX,MAAM,IAAI;iBACX,CAAC,KAAK,EAAE;YAAC,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;SAAC,KAAK,IAAI;gBAChD,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI;kBACpC,MAAM,KAAK,EAAE;;;YA9EnB,oBAAoB,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;;EAsYlC,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAvazE,wBAua4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
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;;;;;;+BA9VjB,aAAa;+BACb,MAAM,aAAa,MAAM;;MA6Vc,GAAG,IAAI;WACpE,GAAG;;gBAnUD,MAAM,IAAI;iBACT,MAAM,IAAI;mBACR,MAAM,IAAI;kBACX,MAAM,IAAI;iBACX,CAAC,KAAK,EAAE;YAAC,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;SAAC,KAAK,IAAI;gBAChD,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI;kBACpC,MAAM,KAAK,EAAE;;gBANf,MAAM,IAAI;iBACT,MAAM,IAAI;mBACR,MAAM,IAAI;kBACX,MAAM,IAAI;iBACX,CAAC,KAAK,EAAE;YAAC,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;SAAC,KAAK,IAAI;gBAChD,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI;kBACpC,MAAM,KAAK,EAAE;;;YA9EnB,oBAAoB,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;;EAsYlC,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAvazE,wBAua4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -99,7 +99,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
99
99
  const scrollToInput = () => inputRef.value?.scrollToInput();
100
100
  const wrapSelection = (value) => inputRef.value?.wrapSelection(value);
101
101
  const setCaret = (indexStart, indexEnd) => inputRef.value?.setCaret(indexStart, indexEnd);
102
- const getSelectionOffsets = () => inputRef.value?.getSelectionOffsets();
102
+ const getCaret = () => inputRef.value?.getCaret();
103
103
  const updateDropdown = () => dropdownMenuRef.value && "updateDropdown" in dropdownMenuRef.value ? dropdownMenuRef.value.updateDropdown() : void 0;
104
104
  __expose({
105
105
  focus,
@@ -109,7 +109,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
109
109
  scrollToInput,
110
110
  wrapSelection,
111
111
  setCaret,
112
- getSelectionOffsets
112
+ getCaret
113
113
  });
114
114
  return (_ctx, _cache) => {
115
115
  return openBlock(), createBlock(resolveDynamicComponent(_ctx.static ? InputSuggestStatic : unref(isMobile) ? _sfc_main$1 : _sfc_main$2), mergeProps({ ref: "dropdownMenu" }, _ctx.static ? void 0 : unref(isMobile) ? {
@@ -1,11 +1,8 @@
1
- import { ToolbarAction, WrapSelection } from './types';
2
- type __VLS_Props = {
3
- action: ToolbarAction;
4
- };
5
- declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
6
- "wrap-selection": (value: WrapSelection) => any;
7
- }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
8
- "onWrap-selection"?: ((value: WrapSelection) => any) | undefined;
1
+ import { ToolbarAction } from './types';
2
+ declare const _default: import('vue').DefineComponent<ToolbarAction, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
3
+ click: (index: number | undefined) => any;
4
+ }, string, import('vue').PublicProps, Readonly<ToolbarAction> & Readonly<{
5
+ onClick?: ((index: number | undefined) => any) | undefined;
9
6
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
10
7
  export default _default;
11
8
  //# sourceMappingURL=WInputToolbarButton.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WInputToolbarButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/WInputToolbarButton.vue"],"names":[],"mappings":"AA4CA;AA4FA,OAAO,KAAK,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAA;AAY1E,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,aAAa,CAAA;CACtB,CAAC;;;;;;AAoNF,wBAOG"}
1
+ {"version":3,"file":"WInputToolbarButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/WInputToolbarButton.vue"],"names":[],"mappings":"AAmDA;AA+FA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,SAAS,CAAA;;;;;;AA2M1C,wBAOG"}
@@ -1,16 +1,18 @@
1
- import { defineComponent, ref, createBlock, openBlock, unref, withCtx, createVNode, withModifiers, createElementBlock, Fragment, renderList, createTextVNode, resolveDynamicComponent, toDisplayString } from 'vue';
2
- import _sfc_main$2 from '../ClickOutside/WClickOutside.vue.js';
1
+ import { defineComponent, ref, createBlock, openBlock, unref, withCtx, createElementVNode, withModifiers, createElementBlock, Fragment, renderList, createVNode } from 'vue';
3
2
  import _sfc_main$1 from '../DropdownMenu/WDropdownMenu.vue.js';
4
- import _sfc_main$3 from '../MenuItem/WMenuItem.vue.js';
5
3
  import { HorizontalAlign } from '../../utils/HorizontalAlign.js';
6
- import _sfc_main$4 from './components/InputToolbarButton.vue.js';
4
+ import _sfc_main$2 from './components/InputToolbarButton.vue.js';
7
5
 
8
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
9
7
  __name: "WInputToolbarButton",
10
8
  props: {
11
- action: {}
9
+ title: {},
10
+ icon: {},
11
+ value: {},
12
+ tooltip: {},
13
+ disabled: { type: Boolean }
12
14
  },
13
- emits: ["wrap-selection"],
15
+ emits: ["click"],
14
16
  setup(__props) {
15
17
  const isOpen = ref(false);
16
18
  let timeout = null;
@@ -29,55 +31,55 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29
31
  timeout = setTimeout(() => {
30
32
  isOpen.value = false;
31
33
  timeout = null;
32
- });
34
+ }, 500);
33
35
  };
34
36
  return (_ctx, _cache) => {
35
- return Array.isArray(_ctx.action.value) ? (openBlock(), createBlock(_sfc_main$1, {
37
+ return Array.isArray(_ctx.value) ? (openBlock(), createBlock(_sfc_main$1, {
36
38
  key: 0,
37
- "is-open": isOpen.value,
39
+ "is-open": !_ctx.disabled && isOpen.value,
38
40
  "horizontal-align": unref(HorizontalAlign).CENTER,
39
41
  top: ""
40
42
  }, {
41
43
  toggle: withCtx(() => [
42
- createVNode(_sfc_main$4, {
43
- action: _ctx.action,
44
- onClick: _cache[0] || (_cache[0] = ($event) => isOpen.value ? leave : enter),
44
+ createVNode(_sfc_main$2, {
45
+ title: _ctx.title,
46
+ icon: _ctx.icon,
47
+ tooltip: _ctx.tooltip,
48
+ disabled: _ctx.disabled,
49
+ active: isOpen.value,
45
50
  onMouseenter: enter,
46
51
  onMouseleave: leave
47
- }, null, 8, ["action"])
52
+ }, null, 8, ["title", "icon", "tooltip", "disabled", "active"])
48
53
  ]),
49
54
  content: withCtx(() => [
50
- createVNode(_sfc_main$2, {
51
- class: "bg-default dark:bg-default-dark max-h-80 overflow-y-auto overscroll-y-contain rounded-xl text-start text-xs font-semibold shadow-md dark:border dark:border-solid dark:border-gray-800",
52
- onClick: leave,
55
+ createElementVNode("div", {
56
+ class: "bg-default dark:bg-default-dark flex overflow-y-auto overscroll-y-contain rounded-md text-xs shadow-md dark:border dark:border-solid dark:border-gray-800",
53
57
  onMouseenter: enter,
54
58
  onMouseleave: leave,
55
- onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {
59
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
56
60
  }, ["prevent"]))
57
- }, {
58
- default: withCtx(() => [
59
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.action.value, (item, index) => {
60
- return openBlock(), createBlock(_sfc_main$3, {
61
- key: index,
62
- onClick: ($event) => _ctx.$emit("wrap-selection", item.value)
63
- }, {
64
- default: withCtx(() => [
65
- (openBlock(), createBlock(resolveDynamicComponent(item.icon))),
66
- createTextVNode(" " + toDisplayString(item.title), 1)
67
- ]),
68
- _: 2
69
- }, 1032, ["onClick"]);
70
- }), 128))
71
- ]),
72
- _: 1
73
- })
61
+ }, [
62
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.value, (item, index) => {
63
+ return openBlock(), createBlock(_sfc_main$2, {
64
+ key: index,
65
+ icon: item.icon,
66
+ title: item.title,
67
+ disabled: _ctx.disabled,
68
+ tooltip: void 0,
69
+ onClick: ($event) => _ctx.$emit("click", index)
70
+ }, null, 8, ["icon", "title", "disabled", "onClick"]);
71
+ }), 128))
72
+ ], 32)
74
73
  ]),
75
74
  _: 1
76
- }, 8, ["is-open", "horizontal-align"])) : (openBlock(), createBlock(_sfc_main$4, {
75
+ }, 8, ["is-open", "horizontal-align"])) : (openBlock(), createBlock(_sfc_main$2, {
77
76
  key: 1,
78
- action: _ctx.action,
79
- onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("wrap-selection", _ctx.action.value))
80
- }, null, 8, ["action"]));
77
+ title: _ctx.title,
78
+ icon: _ctx.icon,
79
+ tooltip: _ctx.tooltip,
80
+ disabled: _ctx.disabled,
81
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("click", void 0))
82
+ }, null, 8, ["title", "icon", "tooltip", "disabled"]));
81
83
  };
82
84
  }
83
85
  });
@@ -10,10 +10,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
10
10
  blur: () => void;
11
11
  wrapSelection: (value: WrapSelection) => void;
12
12
  setCaret: (indexStart: number, indexEnd?: number) => void;
13
- getSelectionOffsets: () => {
14
- start: number;
15
- end: number;
16
- };
13
+ getCaret: () => import('../models/utils').CaretOffset;
17
14
  offsetWidth: number;
18
15
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
19
16
  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;AAwVA,OAAO,KAAK,EAAC,QAAQ,EAAG,aAAa,EAAC,MAAM,UAAU,CAAA;AAQtD,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;;;;2BAsN4B,aAAa,KAAG,IAAI;2BAnBpB,MAAM,aAAa,MAAM;;;;;;;;;;;;;;;;;;;AAgMvD,wBAUG"}
1
+ {"version":3,"file":"ContentEditable.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/components/ContentEditable.vue"],"names":[],"mappings":"AAiBA;AA8WA,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;;;;2BA4M4B,aAAa,KAAG,IAAI;2BArBpB,MAAM,aAAa,MAAM;;;;;;;;;;;;;;;;AAiOvD,wBAUG"}
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, useTemplateRef, ref, watch, onMounted, createElementBlock, openBlock, nextTick } from 'vue';
2
2
  import { WrapSelectionType } from '../../../utils/utils.js';
3
- import { linePrefixRegex } from '../models/toolbarActions.js';
3
+ import { preserveIndentation } from '../models/toolbarActions.js';
4
+ import { getCaretOffset } from '../models/utils.js';
4
5
 
5
6
  const _hoisted_1 = ["placeholder"];
6
7
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -19,7 +20,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19
20
  const focused = ref(false);
20
21
  const updateTextParts = () => {
21
22
  if (!elementRef.value || !props.textParts) return;
22
- const offsets = getSelectionOffsets();
23
+ const offsets = getCaret();
23
24
  const existingNodes = Array.from(elementRef.value.childNodes);
24
25
  let nodeIndex = 0;
25
26
  for (const item of props.textParts) {
@@ -57,9 +58,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
57
58
  }
58
59
  nodeIndex++;
59
60
  }
60
- while (nodeIndex < existingNodes.length) {
61
- elementRef.value.removeChild(existingNodes[nodeIndex]);
62
- nodeIndex++;
61
+ while (elementRef.value.childNodes.length > props.textParts.length) {
62
+ const nodeToRemove = elementRef.value.childNodes[props.textParts.length];
63
+ elementRef.value.removeChild(nodeToRemove);
63
64
  }
64
65
  if (focused.value) setCaret(offsets.start, offsets.end !== offsets.start ? void 0 : offsets.end);
65
66
  };
@@ -67,7 +68,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
67
68
  const updateTextValue = (value) => {
68
69
  if (props.textParts || !elementRef.value) return;
69
70
  if (elementRef.value.textContent !== value) {
70
- const offsets = getSelectionOffsets();
71
+ const offsets = getCaret();
71
72
  elementRef.value.textContent = value;
72
73
  if (focused.value) setCaret(offsets.start, offsets.end !== offsets.start ? void 0 : offsets.end);
73
74
  }
@@ -118,24 +119,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
118
119
  const insertPlain = (text) => {
119
120
  const root = elementRef.value;
120
121
  if (!root) return;
121
- const { start, end } = getSelectionOffsets();
122
+ const { start, end } = getCaret();
122
123
  const currentText = getCurrentText();
123
124
  const next = (currentText ?? "").slice(0, start) + text + ((currentText ?? "").slice(end) || " ");
124
125
  const caretAfter = start + text.length;
125
126
  emit("update:model-value", props.maxLength && next.length > props.maxLength ? next.substring(0, props.maxLength) : next);
126
127
  nextTick(() => setCaret(props.maxLength ? Math.min(caretAfter, props.maxLength) : caretAfter));
127
128
  };
128
- const getSelectionOffsets = () => {
129
- const selection = window.getSelection();
130
- if (!elementRef.value || !selection || selection.rangeCount === 0) return { start: 0, end: 0 };
131
- const range = selection.getRangeAt(0);
132
- const pre = range.cloneRange();
133
- pre.selectNodeContents(elementRef.value);
134
- pre.setEnd(range.startContainer, range.startOffset);
135
- const start = pre.toString().length;
136
- const selected = range.toString().length;
137
- return { start, end: start + selected };
138
- };
129
+ const getCaret = () => getCaretOffset(elementRef.value);
139
130
  const getNodeOffset = (index) => {
140
131
  if (!elementRef.value || index === void 0) return void 0;
141
132
  if (!elementRef.value.firstChild) elementRef.value.appendChild(document.createTextNode(""));
@@ -162,9 +153,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
162
153
  selection?.removeAllRanges();
163
154
  selection?.addRange(range);
164
155
  };
156
+ const collapseList = [" ", "\n"];
165
157
  let offsetsOld = null;
166
158
  const wrapSelection = (value) => {
167
- let offsets = getSelectionOffsets();
159
+ let offsets = getCaret();
168
160
  if (focused.value || !offsetsOld) offsetsOld = offsets;
169
161
  else offsets = offsetsOld;
170
162
  const currentText = getCurrentText() ?? "";
@@ -173,21 +165,54 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
173
165
  let newCursorEnd = void 0;
174
166
  switch (value.type) {
175
167
  case WrapSelectionType.TOGGLE:
176
- const startLen = value.start.length;
168
+ let startLen = value.start.length;
177
169
  const endLen = value.end.length;
178
170
  const textWithContext = currentText.slice(
179
171
  Math.max(0, offsets.start - startLen),
180
172
  Math.min(currentText.length, offsets.end + endLen)
181
173
  );
182
- if (textWithContext.startsWith(value.start) && textWithContext.endsWith(value.end)) {
183
- const expandedStart = Math.max(0, offsets.start - startLen);
184
- newText = currentText.slice(0, expandedStart) + currentText.slice(offsets.start, offsets.end) + currentText.slice(Math.min(currentText.length, offsets.end + endLen));
174
+ if ((!value.start || textWithContext.startsWith(value.start)) && (!value.end || textWithContext.endsWith(value.end))) {
175
+ let expandedStart = Math.max(0, offsets.start - startLen);
176
+ let start = currentText.slice(0, expandedStart);
177
+ const middle = currentText.slice(offsets.start, offsets.end);
178
+ let end = currentText.slice(Math.min(currentText.length, offsets.end + endLen));
179
+ for (const item of collapseList) {
180
+ if (value.start.startsWith(item) && !start.endsWith(item) && !middle.startsWith(item)) {
181
+ start += item;
182
+ expandedStart += item.length;
183
+ }
184
+ if (value.end.endsWith(item) && !end.startsWith(item) && !middle.endsWith(item)) end = item + end;
185
+ }
186
+ newText = start + middle + end;
185
187
  if (value.prepare) newText = value.prepare(newText, 0);
186
188
  newCursorStart = expandedStart;
187
189
  newCursorEnd = expandedStart + offsets.end - offsets.start;
188
190
  } else {
189
- const p = value.prepare;
190
- newText = p ? p(currentText.slice(0, offsets.start), 0) + value.start + p(currentText.slice(offsets.start, offsets.end), offsets.start) + value.end + p(currentText.slice(offsets.end), offsets.end) : currentText.slice(0, offsets.start) + value.start + currentText.slice(offsets.start, offsets.end) + value.end + currentText.slice(offsets.end);
191
+ if (!value.start || !value.end) {
192
+ const offset = value.start ? offsets.start : offsets.end;
193
+ let start = currentText.slice(0, offset);
194
+ let end = currentText.slice(offset);
195
+ for (const item of collapseList) {
196
+ if (value.start.startsWith(item) && start.endsWith(item)) {
197
+ start = start.slice(0, offsets.start - item.length);
198
+ startLen -= item.length;
199
+ }
200
+ if (value.end.endsWith(item) && end.startsWith(item)) end = end.slice(item.length);
201
+ }
202
+ newText = (value.prepare?.(start, 0) ?? start) + (value.start || value.end) + (value.prepare?.(end, offset) ?? end);
203
+ } else {
204
+ let start = currentText.slice(0, offsets.start);
205
+ const middle = currentText.slice(offsets.start, offsets.end);
206
+ let end = currentText.slice(offsets.end);
207
+ for (const item of collapseList) {
208
+ if (value.start.startsWith(item) && start.endsWith(item)) {
209
+ start = start.slice(0, offsets.start - item.length);
210
+ startLen -= item.length;
211
+ }
212
+ if (value.end.endsWith(item) && end.startsWith(item)) end = end.slice(item.length);
213
+ }
214
+ newText = (value.prepare?.(start, 0) ?? start) + value.start + (value.prepare?.(middle, offsets.start) ?? middle) + value.end + (value.prepare?.(end, offsets.end) ?? end);
215
+ }
191
216
  newCursorStart = offsets.start + startLen;
192
217
  if (offsets.start !== offsets.end) newCursorEnd = newCursorStart + offsets.end - offsets.start;
193
218
  }
@@ -201,15 +226,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
201
226
  const afterLines = currentText.slice(actualLineEnd);
202
227
  const lines = linesText.split("\n");
203
228
  if (lines.length === 0) lines.push("");
204
- const allLinesHavePrefix = value.detectPattern ? lines.every((line) => !line.trim() || value.detectPattern.test(line)) : lines.every((line) => !line.trim() || line.startsWith(value.linePrefix));
229
+ 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;
205
230
  if (allLinesHavePrefix) {
206
- const cleanText = lines.map((line) => line.replace(linePrefixRegex, "")).join("\n");
231
+ const cleanText = lines.map((line) => preserveIndentation(line, "")).join("\n");
207
232
  newText = beforeLines + cleanText + afterLines;
208
233
  newCursorStart = lineStart;
209
234
  newCursorEnd = lineStart + cleanText.length;
210
235
  } else {
211
- const processedLines = value.lineTransform ? lines.map((line, index) => value.lineTransform(line, index)) : lines.map((line) => line.trim() ? value.linePrefix + line.replace(linePrefixRegex, "") : line);
212
- const processedText = processedLines.join("\n");
236
+ 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");
213
237
  newText = beforeLines + processedText + afterLines;
214
238
  newCursorStart = lineStart;
215
239
  newCursorEnd = lineStart + processedText.length;
@@ -234,7 +258,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
234
258
  blur,
235
259
  wrapSelection,
236
260
  setCaret,
237
- getSelectionOffsets,
261
+ getCaret,
238
262
  get offsetWidth() {
239
263
  return elementRef.value?.offsetWidth ?? 0;
240
264
  }
@@ -2,6 +2,8 @@ import { ToolbarAction, WrapSelection } from '../types';
2
2
  type __VLS_Props = {
3
3
  list: ToolbarAction[] | undefined;
4
4
  rich: boolean;
5
+ isUndo: boolean;
6
+ isRedo: boolean;
5
7
  };
6
8
  declare function __VLS_template(): {
7
9
  attrs: Partial<{}>;
@@ -14,8 +16,12 @@ declare function __VLS_template(): {
14
16
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
15
17
  declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
16
18
  "wrap-selection": (value: WrapSelection) => any;
19
+ undo: () => any;
20
+ redo: () => any;
17
21
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
18
22
  "onWrap-selection"?: ((value: WrapSelection) => any) | undefined;
23
+ onUndo?: (() => any) | undefined;
24
+ onRedo?: (() => any) | undefined;
19
25
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
20
26
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
21
27
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"InputToolbar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/components/InputToolbar.vue"],"names":[],"mappings":"AA2BA;AA4CA,OAAO,KAAK,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAA;AAK1E,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,aAAa,EAAE,GAAG,SAAS,CAAA;IACjC,IAAI,EAAE,OAAO,CAAA;CACd,CAAC;AAUF,iBAAS,cAAc;WA0ET,OAAO,IAA6B;;yBAVrB,GAAG;;;;EAe/B;AAWD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;6FAQnB,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":"InputToolbar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/components/InputToolbar.vue"],"names":[],"mappings":"AAyCA;AAwEA,OAAO,KAAK,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAA;AAU1E,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,aAAa,EAAE,GAAG,SAAS,CAAA;IACjC,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;CAChB,CAAC;AAiBF,iBAAS,cAAc;WAwHT,OAAO,IAA6B;;yBAVrB,GAAG;;;;EAe/B;AAeD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;6FAQnB,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,6 @@
1
- import { defineComponent, createElementBlock, openBlock, withModifiers, renderSlot, createCommentVNode, Fragment, renderList, createBlock, unref } from 'vue';
1
+ import { defineComponent, createElementBlock, openBlock, withModifiers, renderSlot, createCommentVNode, createVNode, Fragment, renderList, createBlock, mergeProps, unref, markRaw } from 'vue';
2
+ import IconRedo from '../../../assets/icons/IconRedo.svg.js';
3
+ import IconUndo from '../../../assets/icons/IconUndo.svg.js';
2
4
  import _sfc_main$1 from '../WInputToolbarButton.vue.js';
3
5
  import { toolbarActionList } from '../models/toolbarActions.js';
4
6
 
@@ -6,10 +8,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
6
8
  __name: "InputToolbar",
7
9
  props: {
8
10
  list: {},
9
- rich: { type: Boolean }
11
+ rich: { type: Boolean },
12
+ isUndo: { type: Boolean },
13
+ isRedo: { type: Boolean }
10
14
  },
11
- emits: ["wrap-selection"],
12
- setup(__props) {
15
+ emits: ["wrap-selection", "undo", "redo"],
16
+ setup(__props, { emit: __emit }) {
17
+ const emit = __emit;
18
+ const wrapSelection = (action, index) => {
19
+ const value = Array.isArray(action.value) && typeof index === "number" ? action.value[index].value : action.value;
20
+ if (value) emit("wrap-selection", value);
21
+ };
13
22
  return (_ctx, _cache) => {
14
23
  return openBlock(), createElementBlock("div", {
15
24
  class: "bg-default dark:bg-default-dark no-scrollbar sticky top-0 z-[2] col-span-full -mb-2 flex overflow-x-auto overscroll-x-contain border-b border-solid border-gray-50 text-xs dark:border-gray-800/50",
@@ -18,19 +27,33 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
18
27
  }, [
19
28
  renderSlot(_ctx.$slots, "default"),
20
29
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (action, index) => {
21
- return openBlock(), createBlock(_sfc_main$1, {
30
+ return openBlock(), createBlock(_sfc_main$1, mergeProps({
22
31
  key: index,
23
- action,
24
- onWrapSelection: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("wrap-selection", $event))
25
- }, null, 8, ["action"]);
32
+ ref_for: true
33
+ }, action, {
34
+ onClick: ($event) => wrapSelection(action, $event)
35
+ }), null, 16, ["onClick"]);
26
36
  }), 128)),
27
37
  _ctx.rich ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(toolbarActionList), (action, index) => {
28
- return openBlock(), createBlock(_sfc_main$1, {
38
+ return openBlock(), createBlock(_sfc_main$1, mergeProps({
29
39
  key: index,
30
- action,
31
- onWrapSelection: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("wrap-selection", $event))
32
- }, null, 8, ["action"]);
33
- }), 128)) : createCommentVNode("", true)
40
+ ref_for: true
41
+ }, action, {
42
+ onClick: ($event) => wrapSelection(action, $event)
43
+ }), null, 16, ["onClick"]);
44
+ }), 128)) : createCommentVNode("", true),
45
+ createVNode(_sfc_main$1, {
46
+ tooltip: "Undo",
47
+ icon: markRaw(unref(IconUndo)),
48
+ disabled: !_ctx.isUndo,
49
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("undo"))
50
+ }, null, 8, ["icon", "disabled"]),
51
+ createVNode(_sfc_main$1, {
52
+ tooltip: "Redo",
53
+ icon: markRaw(unref(IconRedo)),
54
+ disabled: !_ctx.isRedo,
55
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("redo"))
56
+ }, null, 8, ["icon", "disabled"])
34
57
  ], 32);
35
58
  };
36
59
  }
@@ -1,6 +1,9 @@
1
- import { ToolbarAction } from '../types';
2
1
  type __VLS_Props = {
3
- action: ToolbarAction;
2
+ title: string | undefined;
3
+ icon: SVGComponent | undefined;
4
+ tooltip: string | undefined;
5
+ disabled: boolean | undefined;
6
+ active?: boolean;
4
7
  };
5
8
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
6
9
  click: (value: MouseEvent) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"InputToolbarButton.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/components/InputToolbarButton.vue"],"names":[],"mappings":"AAqBA;AAAA,OAsCO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAA;AAI3D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,aAAa,CAAA;CACtB,CAAC;;;;;;;;;;AAmFF,wBAQG"}
1
+ {"version":3,"file":"InputToolbarButton.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/components/InputToolbarButton.vue"],"names":[],"mappings":"AA0BA;AA+CA,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,IAAI,EAAE,YAAY,GAAG,SAAS,CAAA;IAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC;;;;;;;;;;AAwFF,wBAQG"}
@@ -1,31 +1,39 @@
1
- import { defineComponent, createElementBlock, openBlock, createElementVNode, createBlock, createCommentVNode, createTextVNode, resolveDynamicComponent, toDisplayString } from 'vue';
1
+ import { defineComponent, createElementBlock, openBlock, normalizeClass, createElementVNode, createBlock, createCommentVNode, createTextVNode, resolveDynamicComponent, toDisplayString } from 'vue';
2
2
  import _sfc_main$1 from '../../Tooltip/WTooltip.vue.js';
3
3
 
4
4
  const _hoisted_1 = { class: "border-r border-solid border-gray-300 px-2 group-last/toolbar:border-r-0 dark:border-gray-600" };
5
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "InputToolbarButton",
7
7
  props: {
8
- action: {}
8
+ title: {},
9
+ icon: {},
10
+ tooltip: {},
11
+ disabled: { type: Boolean },
12
+ active: { type: Boolean }
9
13
  },
10
14
  emits: ["click", "mouseenter", "mouseleave"],
11
15
  setup(__props) {
12
16
  return (_ctx, _cache) => {
13
17
  return openBlock(), createElementBlock("button", {
14
- class: "text-accent w-ripple w-ripple-hover group/toolbar first-not:-ml-px relative pb-1 pt-2",
15
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event)),
16
- onMouseenter: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("mouseenter", $event)),
17
- onMouseleave: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("mouseleave", $event))
18
+ class: normalizeClass(["text-accent group/toolbar first-not:-ml-px relative pb-1 pt-2", {
19
+ "cursor-not-allowed opacity-50": _ctx.disabled,
20
+ "w-ripple w-ripple-hover cursor-pointer": !_ctx.disabled,
21
+ "before:opacity-10": !_ctx.disabled && _ctx.active
22
+ }]),
23
+ onClick: _cache[0] || (_cache[0] = ($event) => !_ctx.disabled && _ctx.$emit("click", $event)),
24
+ onMouseenter: _cache[1] || (_cache[1] = ($event) => !_ctx.disabled && _ctx.$emit("mouseenter", $event)),
25
+ onMouseleave: _cache[2] || (_cache[2] = ($event) => !_ctx.disabled && _ctx.$emit("mouseleave", $event))
18
26
  }, [
19
27
  createElementVNode("div", _hoisted_1, [
20
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.action.icon), { class: "square-[1.25em] -mt-[0.25em] inline" })),
21
- createTextVNode(" " + toDisplayString(_ctx.action.title ?? ""), 1)
28
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { class: "square-[1.25em] -mt-[0.25em] inline" })),
29
+ createTextVNode(" " + toDisplayString(_ctx.title ?? ""), 1)
22
30
  ]),
23
- _ctx.action.tooltip ? (openBlock(), createBlock(_sfc_main$1, {
31
+ _ctx.tooltip ? (openBlock(), createBlock(_sfc_main$1, {
24
32
  key: 0,
25
- text: _ctx.action.tooltip,
33
+ text: _ctx.tooltip,
26
34
  top: ""
27
35
  }, null, 8, ["text"])) : createCommentVNode("", true)
28
- ], 32);
36
+ ], 34);
29
37
  };
30
38
  }
31
39
  });
@@ -1,4 +1,6 @@
1
1
  import { ToolbarAction } from '../types';
2
2
  export declare const linePrefixRegex: RegExp;
3
+ export declare const indentRegex: RegExp;
4
+ export declare const preserveIndentation: (line: string, newPrefix: string) => string;
3
5
  export declare const toolbarActionList: ToolbarAction[];
4
6
  //# sourceMappingURL=toolbarActions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbarActions.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/models/toolbarActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,UAAU,CAAA;AAkB3C,eAAO,MAAM,eAAe,QAA0C,CAAA;AAEtE,eAAO,MAAM,iBAAiB,EAAE,aAAa,EA8D5C,CAAA"}
1
+ {"version":3,"file":"toolbarActions.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/models/toolbarActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,UAAU,CAAA;AAsB3C,eAAO,MAAM,eAAe,QAA0C,CAAA;AACtE,eAAO,MAAM,WAAW,QAAW,CAAA;AAGnC,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,KAAG,MAGrE,CAAA;AAgDD,eAAO,MAAM,iBAAiB,EAAE,aAAa,EAkF5C,CAAA"}