@fastkit/vui 0.12.9 → 0.12.10

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 (33) hide show
  1. package/dist/vui.css +138 -409
  2. package/dist/vui.css.map +1 -1
  3. package/dist/vui.d.ts +97 -409
  4. package/dist/vui.mjs +167 -1125
  5. package/dist/vui.mjs.map +1 -1
  6. package/package.json +18 -40
  7. package/src/components/index.ts +3 -1
  8. package/src/injections.ts +1 -1
  9. package/src/components/VWysiwygEditor/VWysiwygEditor.scss +0 -68
  10. package/src/components/VWysiwygEditor/VWysiwygEditor.tsx +0 -354
  11. package/src/components/VWysiwygEditor/extensions/color.ts +0 -72
  12. package/src/components/VWysiwygEditor/extensions/index.ts +0 -2
  13. package/src/components/VWysiwygEditor/extensions/linter/Linter.scss +0 -139
  14. package/src/components/VWysiwygEditor/extensions/linter/Linter.tsx +0 -210
  15. package/src/components/VWysiwygEditor/extensions/linter/LinterPlugin.ts +0 -65
  16. package/src/components/VWysiwygEditor/extensions/linter/index.ts +0 -5
  17. package/src/components/VWysiwygEditor/extensions/linter/plugins/BadWords.tsx +0 -50
  18. package/src/components/VWysiwygEditor/extensions/linter/plugins/HeadingLevel.ts +0 -39
  19. package/src/components/VWysiwygEditor/extensions/linter/plugins/Punctuation.ts +0 -49
  20. package/src/components/VWysiwygEditor/extensions/linter/plugins/index.ts +0 -3
  21. package/src/components/VWysiwygEditor/extensions/linter/utils.ts +0 -28
  22. package/src/components/VWysiwygEditor/index.ts +0 -4
  23. package/src/components/VWysiwygEditor/schemes.ts +0 -251
  24. package/src/components/VWysiwygEditor/tools/bullet-list.ts +0 -18
  25. package/src/components/VWysiwygEditor/tools/color.scss +0 -134
  26. package/src/components/VWysiwygEditor/tools/color.tsx +0 -90
  27. package/src/components/VWysiwygEditor/tools/format-bold.ts +0 -19
  28. package/src/components/VWysiwygEditor/tools/format-italic.ts +0 -18
  29. package/src/components/VWysiwygEditor/tools/format-underline.ts +0 -18
  30. package/src/components/VWysiwygEditor/tools/history.ts +0 -26
  31. package/src/components/VWysiwygEditor/tools/index.ts +0 -8
  32. package/src/components/VWysiwygEditor/tools/link.ts +0 -57
  33. package/src/components/VWysiwygEditor/tools/ordered-list.ts +0 -21
package/dist/vui.mjs CHANGED
@@ -5,13 +5,12 @@ export * from '@fastkit/icon-font';
5
5
  export { ICON_NAMES } from '@fastkit/icon-font';
6
6
  export * from '@fastkit/media-match';
7
7
  export * from '@fastkit/vue-media-match';
8
- import { validateIf, url } from '@fastkit/rules';
9
8
  export * from '@fastkit/rules';
10
9
  import { VAppContainer, VueAppLayout, VAppLayout, installVueAppLayout } from '@fastkit/vue-app-layout';
11
10
  export * from '@fastkit/vue-app-layout';
12
11
  import { useScopeColorClass, useColorClasses, colorSchemeProps, toScopeColorClass, useInjectTheme, VueColorSchemePlugin } from '@fastkit/vue-color-scheme';
13
12
  export * from '@fastkit/vue-color-scheme';
14
- import { createFormControlSettings, useFormControl, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, useParentFormNode, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, createTextInputSettings, useTextInputControl, createTextareaSettings, useTextareaControl, createTextableProps, createTextableEmits, TextableControl, createFormSettings, useForm } from '@fastkit/vue-form-control';
13
+ import { createFormControlSettings, useFormControl, useParentFormNode, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, createTextInputSettings, useTextInputControl, createTextareaSettings, useTextareaControl, createFormSettings, useForm } from '@fastkit/vue-form-control';
15
14
  export * from '@fastkit/vue-form-control';
16
15
  import { getDocumentScroller, useVScrollerRef, VScroller } from '@fastkit/vue-scroller';
17
16
  export * from '@fastkit/vue-scroller';
@@ -24,19 +23,6 @@ import * as vue_loading_star from '@fastkit/vue-loading';
24
23
  export * from '@fastkit/vue-loading';
25
24
  import { defineComponent, computed, createVNode, mergeProps, ref, watch, onMounted, onBeforeUnmount, isVNode, cloneVNode, withDirectives, Fragment, vShow, onBeforeUpdate, vModelSelect, Transition, inject, provide, createTextVNode, reactive, nextTick } from 'vue';
26
25
  import { useRouter, useRoute, RouterLink, useLink } from 'vue-router';
27
- import { useEditor, EditorContent, BubbleMenu } from '@tiptap/vue-3';
28
- import { StarterKit } from '@tiptap/starter-kit';
29
- import { Extension } from '@tiptap/core';
30
- import { Decoration, DecorationSet } from 'prosemirror-view';
31
- import { Plugin, PluginKey, TextSelection } from 'prosemirror-state';
32
- import TextStyle from '@tiptap/extension-text-style';
33
- import { BulletList } from '@tiptap/extension-bullet-list';
34
- import { Bold } from '@tiptap/extension-bold';
35
- import { Italic } from '@tiptap/extension-italic';
36
- import { Underline } from '@tiptap/extension-underline';
37
- import { History } from '@tiptap/extension-history';
38
- import { Link } from '@tiptap/extension-link';
39
- import { OrderedList } from '@tiptap/extension-ordered-list';
40
26
 
41
27
  var __defProp = Object.defineProperty;
42
28
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -83,6 +69,7 @@ __export(src_exports, {
83
69
  VCheckboxGroup: () => VCheckboxGroup,
84
70
  VChip: () => VChip,
85
71
  VContentSwitcher: () => VContentSwitcher,
72
+ VControlField: () => VControlField,
86
73
  VDataTable: () => VDataTable,
87
74
  VDialog: () => VDialog,
88
75
  VDrawerLayout: () => VDrawerLayout,
@@ -109,6 +96,7 @@ __export(src_exports, {
109
96
  VSwitch: () => VSwitch,
110
97
  VSwitchGroup: () => VSwitchGroup,
111
98
  VTabs: () => VTabs,
99
+ VTextCounter: () => VTextCounter,
112
100
  VTextField: () => VTextField,
113
101
  VTextarea: () => VTextarea,
114
102
  VToolbar: () => VToolbar,
@@ -127,32 +115,17 @@ __export(src_exports, {
127
115
  VUI_SWITCH_SYMBOL: () => VUI_SWITCH_SYMBOL,
128
116
  VUI_TEXTAREA_SYMBOL: () => VUI_TEXTAREA_SYMBOL,
129
117
  VUI_TEXT_FIELD_SYMBOL: () => VUI_TEXT_FIELD_SYMBOL,
130
- VUI_WYSIWYG_EDITOR_SYMBOL: () => VUI_WYSIWYG_EDITOR_SYMBOL,
131
- VWysiwygEditor: () => VWysiwygEditor,
132
118
  VuiColorProviderInjectionKey: () => VuiColorProviderInjectionKey,
133
119
  VuiControlFieldInjectionKey: () => VuiControlFieldInjectionKey,
134
120
  VuiControlInjectionKey: () => VuiControlInjectionKey,
135
121
  VuiInjectionKey: () => VuiInjectionKey,
136
122
  VuiPlugin: () => VuiPlugin,
137
123
  VuiService: () => VuiService,
138
- WysiwygBulletListTool: () => WysiwygBulletListTool,
139
- WysiwygColorExtension: () => WysiwygColorExtension,
140
- WysiwygEditorInitializeContext: () => WysiwygEditorInitializeContext,
141
- WysiwygFormatBoldTool: () => WysiwygFormatBoldTool,
142
- WysiwygFormatItalicTool: () => WysiwygFormatItalicTool,
143
- WysiwygFormatUnderlineTool: () => WysiwygFormatUnderlineTool,
144
- WysiwygHistoryTool: () => WysiwygHistoryTool,
145
- WysiwygLinkTool: () => WysiwygLinkTool,
146
- WysiwygLinter: () => WysiwygLinter,
147
- WysiwygLinterBadWords: () => WysiwygLinterBadWords,
148
- WysiwygLinterHeadingLevel: () => WysiwygLinterHeadingLevel,
149
- WysiwygLinterPlugin: () => WysiwygLinterPlugin,
150
- WysiwygLinterPunctuation: () => WysiwygLinterPunctuation,
151
- WysiwygOrderedListTool: () => WysiwygOrderedListTool,
152
124
  configureDataTableDefaults: () => configureDataTableDefaults,
153
125
  createAvatarProps: () => createAvatarProps,
154
126
  createCardProps: () => createCardProps,
155
127
  createChipProps: () => createChipProps,
128
+ createControlFieldProps: () => createControlFieldProps,
156
129
  createControlFieldProviderProps: () => createControlFieldProviderProps,
157
130
  createControlProps: () => createControlProps,
158
131
  createElevationProps: () => createElevationProps,
@@ -163,8 +136,6 @@ __export(src_exports, {
163
136
  createPaperProps: () => createPaperProps,
164
137
  createRequiredChipRenderer: () => createRequiredChipRenderer,
165
138
  createVFormProps: () => createVFormProps,
166
- createWysiwygColorTool: () => createWysiwygColorTool,
167
- createWysiwygExtension: () => createWysiwygExtension,
168
139
  defineFormSelectorComponent: () => defineFormSelectorComponent,
169
140
  iconProps: () => iconProps,
170
141
  installVuiPlugin: () => installVuiPlugin,
@@ -178,8 +149,6 @@ __export(src_exports, {
178
149
  renderNavigationItemInput: () => renderNavigationItemInput,
179
150
  resolveNavigationItemInput: () => resolveNavigationItemInput,
180
151
  resolveRawIconProp: () => resolveRawIconProp,
181
- resolveRawWysiwygEditorTools: () => resolveRawWysiwygEditorTools,
182
- resolveRawWysiwygExtensions: () => resolveRawWysiwygExtensions,
183
152
  splitAttrs: () => splitAttrs,
184
153
  useControl: () => useControl,
185
154
  useControlField: () => useControlField,
@@ -203,7 +172,6 @@ var VuiControlFieldInjectionKey = Symbol();
203
172
  var VuiColorProviderInjectionKey = Symbol();
204
173
  var VUI_TEXT_FIELD_SYMBOL = "vui-text-field";
205
174
  var VUI_TEXTAREA_SYMBOL = "vui-textarea";
206
- var VUI_WYSIWYG_EDITOR_SYMBOL = "vui-wysiwyg-editor";
207
175
  var VUI_SELECT_SYMBOL = "vui-select";
208
176
  var VUI_OPTION_SYMBOL = "vui-option";
209
177
  var VUI_CHECKBOX_GROUP_SYMBOL = "vui-checkbox-group";
@@ -615,6 +583,7 @@ __export(components_exports, {
615
583
  VCheckboxGroup: () => VCheckboxGroup,
616
584
  VChip: () => VChip,
617
585
  VContentSwitcher: () => VContentSwitcher,
586
+ VControlField: () => VControlField,
618
587
  VDataTable: () => VDataTable,
619
588
  VDialog: () => VDialog,
620
589
  VDrawerLayout: () => VDrawerLayout,
@@ -641,6 +610,7 @@ __export(components_exports, {
641
610
  VSwitch: () => VSwitch,
642
611
  VSwitchGroup: () => VSwitchGroup,
643
612
  VTabs: () => VTabs,
613
+ VTextCounter: () => VTextCounter,
644
614
  VTextField: () => VTextField,
645
615
  VTextarea: () => VTextarea,
646
616
  VToolbar: () => VToolbar,
@@ -648,25 +618,11 @@ __export(components_exports, {
648
618
  VToolbarMenu: () => VToolbarMenu,
649
619
  VToolbarTitle: () => VToolbarTitle,
650
620
  VTooltip: () => VTooltip,
651
- VWysiwygEditor: () => VWysiwygEditor,
652
- WysiwygBulletListTool: () => WysiwygBulletListTool,
653
- WysiwygColorExtension: () => WysiwygColorExtension,
654
- WysiwygEditorInitializeContext: () => WysiwygEditorInitializeContext,
655
- WysiwygFormatBoldTool: () => WysiwygFormatBoldTool,
656
- WysiwygFormatItalicTool: () => WysiwygFormatItalicTool,
657
- WysiwygFormatUnderlineTool: () => WysiwygFormatUnderlineTool,
658
- WysiwygHistoryTool: () => WysiwygHistoryTool,
659
- WysiwygLinkTool: () => WysiwygLinkTool,
660
- WysiwygLinter: () => WysiwygLinter,
661
- WysiwygLinterBadWords: () => WysiwygLinterBadWords,
662
- WysiwygLinterHeadingLevel: () => WysiwygLinterHeadingLevel,
663
- WysiwygLinterPlugin: () => WysiwygLinterPlugin,
664
- WysiwygLinterPunctuation: () => WysiwygLinterPunctuation,
665
- WysiwygOrderedListTool: () => WysiwygOrderedListTool,
666
621
  configureDataTableDefaults: () => configureDataTableDefaults,
667
622
  createAvatarProps: () => createAvatarProps,
668
623
  createCardProps: () => createCardProps,
669
624
  createChipProps: () => createChipProps,
625
+ createControlFieldProps: () => createControlFieldProps,
670
626
  createListTileProps: () => createListTileProps,
671
627
  createNavigationItemProps: () => createNavigationItemProps,
672
628
  createNavigationProps: () => createNavigationProps,
@@ -674,8 +630,6 @@ __export(components_exports, {
674
630
  createPaperProps: () => createPaperProps,
675
631
  createRequiredChipRenderer: () => createRequiredChipRenderer,
676
632
  createVFormProps: () => createVFormProps,
677
- createWysiwygColorTool: () => createWysiwygColorTool,
678
- createWysiwygExtension: () => createWysiwygExtension,
679
633
  iconProps: () => iconProps,
680
634
  listTileEmits: () => listTileEmits,
681
635
  paginationProps: () => paginationProps,
@@ -683,8 +637,6 @@ __export(components_exports, {
683
637
  renderNavigationItemInput: () => renderNavigationItemInput,
684
638
  resolveNavigationItemInput: () => resolveNavigationItemInput,
685
639
  resolveRawIconProp: () => resolveRawIconProp,
686
- resolveRawWysiwygEditorTools: () => resolveRawWysiwygEditorTools,
687
- resolveRawWysiwygExtensions: () => resolveRawWysiwygExtensions,
688
640
  splitAttrs: () => splitAttrs,
689
641
  vueButtonProps: () => vueButtonProps
690
642
  });
@@ -2110,11 +2062,11 @@ var VNavigation = defineComponent({
2110
2062
  function onItemActivated(item) {
2111
2063
  itemsRef.value.forEach(({
2112
2064
  key,
2113
- ref: ref11
2065
+ ref: ref10
2114
2066
  }) => {
2115
2067
  if (key === item.key)
2116
2068
  return;
2117
- ref11.close();
2069
+ ref10.close();
2118
2070
  });
2119
2071
  }
2120
2072
  return () => {
@@ -2126,8 +2078,8 @@ var VNavigation = defineComponent({
2126
2078
  }, [$caption]), items.value.map((item) => renderNavigationItemInput(item, {
2127
2079
  class: "v-navigation__item",
2128
2080
  startIconEmptySpace: startIconEmptySpace.value,
2129
- ref: (ref11) => {
2130
- setItemRef(item, ref11);
2081
+ ref: (ref10) => {
2082
+ setItemRef(item, ref10);
2131
2083
  },
2132
2084
  onChangeActive: (isActive) => {
2133
2085
  if (isActive) {
@@ -2138,6 +2090,117 @@ var VNavigation = defineComponent({
2138
2090
  };
2139
2091
  }
2140
2092
  });
2093
+ var ADORNMENT_POSITIONS = ["start", "end"];
2094
+ function createControlFieldProps() {
2095
+ return {
2096
+ ...createPropsOptions({
2097
+ startAdornment: {},
2098
+ endAdornment: {},
2099
+ tabindex: {
2100
+ type: [String, Number],
2101
+ default: 0
2102
+ }
2103
+ }),
2104
+ ...createControlFieldProviderProps(),
2105
+ ...createControlProps()
2106
+ };
2107
+ }
2108
+ var VControlField = defineComponent({
2109
+ name: "VControlField",
2110
+ props: {
2111
+ ...createControlFieldProps(),
2112
+ focused: Boolean,
2113
+ autoHeight: Boolean,
2114
+ ...defineSlotsProps(),
2115
+ error: Boolean
2116
+ },
2117
+ // _slots: inputBoxSlots,
2118
+ emits: {
2119
+ click: (ev) => true
2120
+ },
2121
+ setup(props10, ctx) {
2122
+ const parentNode = useParentFormNode();
2123
+ const control = useControl(props10);
2124
+ const inputBox = useControlField(props10);
2125
+ const hostElRef = ref(null);
2126
+ const disabled = computed(() => !!parentNode && parentNode.isDisabled);
2127
+ const invalid = computed(() => !!parentNode && parentNode.invalid);
2128
+ const autoHeight = computed(() => props10.autoHeight);
2129
+ const readonly = computed(() => !!parentNode && parentNode.isReadonly);
2130
+ const colorProvider = useVuiColorProvider();
2131
+ const classes = computed(() => {
2132
+ const classes2 = ["v-control-field", `v-control-field--${inputBox.variant.value}`, {
2133
+ "v-control-field--disabled": disabled.value,
2134
+ "v-control-field--invalid": invalid.value || props10.error,
2135
+ "v-control-field--readonly": readonly.value,
2136
+ "v-control-field--focused": props10.focused,
2137
+ "v-control-field--auto-height": autoHeight.value
2138
+ }, control.classes.value, colorProvider.className(props10.error ? "error" : invalid.value && !readonly.value ? "error" : "primary")];
2139
+ return classes2;
2140
+ });
2141
+ const resolvedSlots = computed(() => {
2142
+ const slots = {};
2143
+ ADORNMENT_POSITIONS.forEach((position) => {
2144
+ const key = `${position}Adornment`;
2145
+ slots[position] = resolveVNodeChildOrSlots(props10[key], ctx.slots[key]);
2146
+ });
2147
+ return slots;
2148
+ });
2149
+ const renderAdornment = (position) => {
2150
+ let child;
2151
+ if (position === "end" && props10.loading) {
2152
+ child = createVNode(loading_exports.VProgressCircular, {
2153
+ "indeterminate": true,
2154
+ "size": CONTROL_LOADING_SPINNER_SIZES[props10.size || "md"]
2155
+ }, null);
2156
+ } else {
2157
+ child = renderSlotOrEmpty(resolvedSlots.value, position);
2158
+ }
2159
+ if (!child)
2160
+ return;
2161
+ return createVNode("div", {
2162
+ "class": ["v-control-field__adornment", `v-control-field__adornment--${position}`]
2163
+ }, [child]);
2164
+ };
2165
+ const handleClick = (ev) => {
2166
+ ctx.emit("click", ev);
2167
+ };
2168
+ return {
2169
+ classes,
2170
+ renderAdornment,
2171
+ hostElRef: () => hostElRef,
2172
+ handleClick
2173
+ // computedTabindex,
2174
+ };
2175
+ },
2176
+ render() {
2177
+ return createVNode("div", {
2178
+ "class": this.classes,
2179
+ "onClick": this.handleClick,
2180
+ "ref": this.hostElRef()
2181
+ }, [this.renderAdornment("start"), createVNode("div", {
2182
+ "class": "v-control-field__body"
2183
+ }, [renderSlotOrEmpty(this.$slots, "default")]), this.renderAdornment("end")]);
2184
+ }
2185
+ });
2186
+ var VTextCounter = defineComponent({
2187
+ name: "VTextCounter",
2188
+ props: {
2189
+ length: {
2190
+ type: Number,
2191
+ required: true
2192
+ },
2193
+ maxlength: {
2194
+ type: Number,
2195
+ required: true
2196
+ }
2197
+ },
2198
+ render() {
2199
+ return createVNode("span", {
2200
+ "class": "v-text-counter"
2201
+ }, [`${this.length} / ${this.maxlength}`]);
2202
+ }
2203
+ });
2141
2204
  var VCheckable = defineComponent({
2142
2205
  name: "VCheckable",
2143
2206
  props: {
@@ -2455,101 +2518,6 @@ var VOptionGroup = defineComponent({
2455
2518
  }, [label]), renderSlotOrEmpty(this.$slots, "default")]);
2456
2519
  }
2457
2520
  });
2458
- var ADORNMENT_POSITIONS = ["start", "end"];
2459
- function createControlFieldProps() {
2460
- return {
2461
- ...createPropsOptions({
2462
- startAdornment: {},
2463
- endAdornment: {},
2464
- tabindex: {
2465
- type: [String, Number],
2466
- default: 0
2467
- }
2468
- }),
2469
- ...createControlFieldProviderProps(),
2470
- ...createControlProps()
2471
- };
2472
- }
2473
- var VControlField = defineComponent({
2474
- name: "VControlField",
2475
- props: {
2476
- ...createControlFieldProps(),
2477
- focused: Boolean,
2478
- autoHeight: Boolean,
2479
- ...defineSlotsProps(),
2480
- error: Boolean
2481
- },
2482
- // _slots: inputBoxSlots,
2483
- emits: {
2484
- click: (ev) => true
2485
- },
2486
- setup(props10, ctx) {
2487
- const parentNode = useParentFormNode();
2488
- const control = useControl(props10);
2489
- const inputBox = useControlField(props10);
2490
- const hostElRef = ref(null);
2491
- const disabled = computed(() => !!parentNode && parentNode.isDisabled);
2492
- const invalid = computed(() => !!parentNode && parentNode.invalid);
2493
- const autoHeight = computed(() => props10.autoHeight);
2494
- const readonly = computed(() => !!parentNode && parentNode.isReadonly);
2495
- const colorProvider = useVuiColorProvider();
2496
- const classes = computed(() => {
2497
- const classes2 = ["v-control-field", `v-control-field--${inputBox.variant.value}`, {
2498
- "v-control-field--disabled": disabled.value,
2499
- "v-control-field--invalid": invalid.value || props10.error,
2500
- "v-control-field--readonly": readonly.value,
2501
- "v-control-field--focused": props10.focused,
2502
- "v-control-field--auto-height": autoHeight.value
2503
- }, control.classes.value, colorProvider.className(props10.error ? "error" : invalid.value && !readonly.value ? "error" : "primary")];
2504
- return classes2;
2505
- });
2506
- const resolvedSlots = computed(() => {
2507
- const slots = {};
2508
- ADORNMENT_POSITIONS.forEach((position) => {
2509
- const key = `${position}Adornment`;
2510
- slots[position] = resolveVNodeChildOrSlots(props10[key], ctx.slots[key]);
2511
- });
2512
- return slots;
2513
- });
2514
- const renderAdornment = (position) => {
2515
- let child;
2516
- if (position === "end" && props10.loading) {
2517
- child = createVNode(loading_exports.VProgressCircular, {
2518
- "indeterminate": true,
2519
- "size": CONTROL_LOADING_SPINNER_SIZES[props10.size || "md"]
2520
- }, null);
2521
- } else {
2522
- child = renderSlotOrEmpty(resolvedSlots.value, position);
2523
- }
2524
- if (!child)
2525
- return;
2526
- return createVNode("div", {
2527
- "class": ["v-control-field__adornment", `v-control-field__adornment--${position}`]
2528
- }, [child]);
2529
- };
2530
- const handleClick = (ev) => {
2531
- ctx.emit("click", ev);
2532
- };
2533
- return {
2534
- classes,
2535
- renderAdornment,
2536
- hostElRef: () => hostElRef,
2537
- handleClick
2538
- // computedTabindex,
2539
- };
2540
- },
2541
- render() {
2542
- return createVNode("div", {
2543
- "class": this.classes,
2544
- "onClick": this.handleClick,
2545
- "ref": this.hostElRef()
2546
- }, [this.renderAdornment("start"), createVNode("div", {
2547
- "class": "v-control-field__body"
2548
- }, [renderSlotOrEmpty(this.$slots, "default")]), this.renderAdornment("end")]);
2549
- }
2550
- });
2551
-
2552
- // src/components/VSelect/VSelect.tsx
2553
2521
  function _isSlot8(s) {
2554
2522
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
2555
2523
  }
@@ -2892,26 +2860,6 @@ var VSelect = defineComponent({
2892
2860
  });
2893
2861
  }
2894
2862
  });
2895
- var VTextCounter = defineComponent({
2896
- name: "VTextCounter",
2897
- props: {
2898
- length: {
2899
- type: Number,
2900
- required: true
2901
- },
2902
- maxlength: {
2903
- type: Number,
2904
- required: true
2905
- }
2906
- },
2907
- render() {
2908
- return createVNode("span", {
2909
- "class": "v-text-counter"
2910
- }, [`${this.length} / ${this.maxlength}`]);
2911
- }
2912
- });
2913
-
2914
- // src/components/VTextField/VTextField.tsx
2915
2863
  var {
2916
2864
  props: props7,
2917
2865
  emits: emits7
@@ -3019,424 +2967,63 @@ var VNumberField = defineComponent({
3019
2967
  }
3020
2968
  }), ctx.slots);
3021
2969
  };
3022
- }
3023
- });
3024
- var {
3025
- props: props8,
3026
- emits: emits8
3027
- } = createTextareaSettings();
3028
- var VTextarea = defineComponent({
3029
- name: "VTextarea",
3030
- props: {
3031
- ...props8,
3032
- ...createFormControlProps(),
3033
- ...createControlFieldProps(),
3034
- ...createControlFieldProviderProps(),
3035
- ...createControlProps(),
3036
- ...defineSlotsProps()
3037
- },
3038
- emits: emits8,
3039
- setup(props10, ctx) {
3040
- const vui = useVui();
3041
- const inputControl = useTextareaControl(props10, ctx, {
3042
- nodeType: VUI_TEXTAREA_SYMBOL,
3043
- defaultRows: vui.textareaRows
3044
- });
3045
- const control = useControl(props10);
3046
- useControlField(props10);
3047
- return {
3048
- ...inputControl.expose(),
3049
- ...control
3050
- };
3051
- },
3052
- render() {
3053
- return createVNode(VFormControl, {
3054
- "nodeControl": this.nodeControl,
3055
- "focused": this.nodeControl.focused,
3056
- "class": ["v-textarea", this.classes],
3057
- "label": this.label,
3058
- "hint": this.hint,
3059
- "hinttip": this.hinttip,
3060
- "hiddenInfo": this.hiddenInfo,
3061
- "requiredChip": this.requiredChip,
3062
- "onClickLabel": (ev) => {
3063
- this.focus();
3064
- }
3065
- }, {
3066
- ...this.$slots,
3067
- default: () => createVNode(VControlField, {
3068
- "class": "v-textarea__input",
3069
- "size": this.size,
3070
- "autoHeight": true,
3071
- "startAdornment": this.startAdornment,
3072
- "endAdornment": this.endAdornment
3073
- }, {
3074
- ...this.$slots,
3075
- default: () => this.textareaControl.createInputElement({
3076
- class: "v-textarea__input__element"
3077
- })
3078
- }),
3079
- infoAppends: () => {
3080
- const {
3081
- counterResult
3082
- } = this;
3083
- if (!counterResult)
3084
- return;
3085
- return createVNode(VTextCounter, counterResult, null);
3086
- }
3087
- });
3088
- }
3089
- });
3090
-
3091
- // src/components/VWysiwygEditor/schemes.ts
3092
- var EDITOR_EVENTS = [
3093
- "beforeCreate",
3094
- "create",
3095
- "update",
3096
- "selectionUpdate",
3097
- "transaction",
3098
- "focus",
3099
- "blur",
3100
- "destroy"
3101
- ];
3102
- var prefixedEventName = (source) => {
3103
- return `on${source.charAt(0).toUpperCase()}${source.slice(1)}`;
3104
- };
3105
- var WysiwygEditorInitializeContext = class {
3106
- listeners = {};
3107
- _vui;
3108
- get vui() {
3109
- return this._vui();
3110
- }
3111
- constructor(vuiGetter, opts = {}) {
3112
- this._vui = vuiGetter;
3113
- EDITOR_EVENTS.forEach((event) => {
3114
- this.listeners[event] = [];
3115
- const prefixed = prefixedEventName(event);
3116
- const fn = opts[prefixed];
3117
- fn && this.listeners[event].push(fn);
3118
- });
3119
- }
3120
- on(ev, handler) {
3121
- this.listeners[ev].push(handler);
3122
- return () => this.off(ev, handler);
3123
- }
3124
- off(ev, handler) {
3125
- this.listeners[ev] = this.listeners[ev].filter(
3126
- (_handler) => _handler !== handler
3127
- );
3128
- }
3129
- editorOptions() {
3130
- const opts = {};
3131
- EDITOR_EVENTS.forEach((event) => {
3132
- const prefixed = prefixedEventName(event);
3133
- opts[prefixed] = (props10) => {
3134
- const handlers = this.listeners[event];
3135
- handlers.forEach((handler) => {
3136
- handler(props10);
3137
- });
3138
- };
3139
- });
3140
- return opts;
3141
- }
3142
- };
3143
- function isCreatedWysiwygExtension(source) {
3144
- return !!source && typeof source === "object" && source.__isCreatedWysiwygExtension === true;
3145
- }
3146
- function createWysiwygExtension(extension) {
3147
- const ext = {
3148
- __isCreatedWysiwygExtension: true,
3149
- _configs: [],
3150
- configure: (opts) => {
3151
- opts && ext._configs.push(opts);
3152
- return ext;
3153
- },
3154
- raw: extension
3155
- };
3156
- return ext;
3157
- }
3158
- function resolveRawWysiwygExtension(raw, ctx) {
3159
- if (isCreatedWysiwygExtension(raw)) {
3160
- const { raw: _raw, _configs } = raw;
3161
- let ext = typeof _raw === "function" ? _raw(ctx) : _raw;
3162
- _configs.forEach((config) => {
3163
- ext = ext.configure(config);
3164
- });
3165
- return ext;
3166
- }
3167
- return typeof raw === "function" ? raw(ctx) : raw;
3168
- }
3169
- function resolveRawWysiwygExtensions(raws, ctx) {
3170
- return raws.map((raw) => resolveRawWysiwygExtension(raw, ctx));
3171
- }
3172
- function resolveRawWysiwygEditorTool(raw, vui) {
3173
- return typeof raw === "function" ? raw(vui) : raw;
3174
- }
3175
- function resolveRawWysiwygEditorTools(rawTools, vui) {
3176
- const tools = [];
3177
- const extensions = [];
3178
- rawTools.forEach((raw) => {
3179
- let resolved = resolveRawWysiwygEditorTool(raw, vui);
3180
- if (!Array.isArray(resolved)) {
3181
- resolved = [resolved];
3182
- }
3183
- resolved.forEach((tool) => {
3184
- tools.push(tool);
3185
- if (tool.extensions) {
3186
- extensions.push(...tool.extensions);
3187
- }
3188
- });
3189
- });
3190
- return {
3191
- tools,
3192
- extensions
3193
- };
3194
- }
3195
-
3196
- // src/components/VWysiwygEditor/VWysiwygEditor.tsx
3197
- function _isSlot9(s) {
3198
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
3199
- }
3200
- var VWysiwygEditor = defineComponent({
3201
- name: "VWysiwygEditor",
2970
+ }
2971
+ });
2972
+ var {
2973
+ props: props8,
2974
+ emits: emits8
2975
+ } = createTextareaSettings();
2976
+ var VTextarea = defineComponent({
2977
+ name: "VTextarea",
3202
2978
  props: {
3203
- // ...props,
3204
- ...createTextableProps(),
2979
+ ...props8,
3205
2980
  ...createFormControlProps(),
3206
2981
  ...createControlFieldProps(),
3207
2982
  ...createControlFieldProviderProps(),
3208
2983
  ...createControlProps(),
3209
- ...defineSlotsProps(),
3210
- extensions: {
3211
- type: Array,
3212
- default: () => []
3213
- },
3214
- tools: {
3215
- type: Array,
3216
- default: () => []
3217
- },
3218
- floatingToolbar: Boolean,
3219
- disabledMinHeight: Boolean,
3220
- disabledMaxHeight: Boolean
3221
- },
3222
- emits: {
3223
- ...createTextableEmits()
2984
+ ...defineSlotsProps()
3224
2985
  },
2986
+ emits: emits8,
3225
2987
  setup(props10, ctx) {
3226
2988
  const vui = useVui();
3227
- const textRef = ref("");
3228
- const toolButtonActiveColor = vui.setting("primaryScope");
3229
- const wysiwygSettings = computed(() => resolveRawWysiwygEditorTools(props10.tools, vui));
2989
+ const inputControl = useTextareaControl(props10, ctx, {
2990
+ nodeType: VUI_TEXTAREA_SYMBOL,
2991
+ defaultRows: vui.textareaRows
2992
+ });
3230
2993
  const control = useControl(props10);
3231
2994
  useControlField(props10);
3232
- const inputControl = new TextableControl(props10, ctx, {
3233
- nodeType: VUI_WYSIWYG_EDITOR_SYMBOL,
3234
- validationValue: () => textRef.value
3235
- });
3236
- const initializeCtx = new WysiwygEditorInitializeContext(() => vui, {
3237
- onCreate: ({
3238
- editor: editor2
3239
- }) => {
3240
- textRef.value = editor2.getText();
3241
- updateEditable();
3242
- },
3243
- onFocus: ({
3244
- event
3245
- }) => {
3246
- inputControl.focusHandler(event);
3247
- },
3248
- onBlur: ({
3249
- event
3250
- }) => {
3251
- inputControl.blurHandler(event);
3252
- },
3253
- onUpdate: ({
3254
- editor: editor2
3255
- }) => {
3256
- inputControl.value = editor2.getHTML();
3257
- textRef.value = editor2.getText();
3258
- }
3259
- });
3260
- const extensions = [
3261
- StarterKit.configure({
3262
- bold: false,
3263
- bulletList: false,
3264
- orderedList: false,
3265
- history: false,
3266
- italic: false
3267
- }),
3268
- // Linter.configure({
3269
- // plugins: [BadWords(['abc', 'evidently']), Punctuation, HeadingLevel],
3270
- // }),
3271
- ...resolveRawWysiwygExtensions(props10.extensions, initializeCtx),
3272
- ...wysiwygSettings.value.extensions
3273
- ];
3274
- const updateEditable = () => {
3275
- if (!editor.value)
3276
- return;
3277
- editor.value.setEditable(inputControl.canOperation);
3278
- };
3279
- watch(() => inputControl.canOperation, updateEditable);
3280
- watch(() => props10.modelValue, (modelValue) => {
3281
- const $editor = editor.value;
3282
- if (!$editor || $editor.getHTML() === modelValue)
3283
- return;
3284
- $editor.commands.setContent(modelValue == null ? "" : modelValue, false);
3285
- textRef.value = $editor.getText();
3286
- });
3287
- initializeCtx.on("create", ({
3288
- editor: editor2
3289
- }) => {
3290
- textRef.value = editor2.getText();
3291
- updateEditable();
3292
- });
3293
- const editor = useEditor({
3294
- ...initializeCtx.editorOptions(),
3295
- autofocus: props10.autofocus,
3296
- content: props10.modelValue,
3297
- extensions,
3298
- editorProps: {
3299
- attributes: {
3300
- class: "v-wysiwyg-editor__input__prose"
3301
- }
3302
- }
3303
- });
3304
- const focus = (position, options) => {
3305
- if (!editor.value)
3306
- return;
3307
- return editor.value.chain().focus(position, options);
3308
- };
3309
- const blur = () => {
3310
- if (!editor.value)
3311
- return;
3312
- return editor.value.chain().blur();
3313
- };
3314
- const wysiwygContext = computed(() => {
3315
- const _editor = editor.value;
3316
- return {
3317
- vui,
3318
- editor: _editor
3319
- };
3320
- });
3321
- const createTools = (bubbleMenu = false) => {
3322
- let _slot;
3323
- const {
3324
- value: settings
3325
- } = wysiwygSettings;
3326
- const {
3327
- value: context
3328
- } = wysiwygContext;
3329
- const tools = bubbleMenu ? settings.tools.filter((t) => !!t.floating) : settings.tools;
3330
- const _editor = editor.value;
3331
- const variant = vui.setting(bubbleMenu ? "containedVariant" : "plainVariant");
3332
- return createVNode(VButtonGroup, {
3333
- "class": ["v-wysiwyg-editor__toolbar", {
3334
- "v-wysiwyg-editor__floating-toolbar": props10.floatingToolbar
3335
- }],
3336
- "variant": variant
3337
- }, _isSlot9(_slot = tools.map(({
3338
- key,
3339
- icon,
3340
- onClick,
3341
- disabled,
3342
- active
3343
- }) => {
3344
- const isActive = !!_editor && resolveContextableValue(context, active);
3345
- const isDisabled = !inputControl.canOperation || !!_editor && resolveContextableValue(context, disabled);
3346
- let iconName;
3347
- let child;
3348
- if (typeof icon === "function") {
3349
- if (_editor) {
3350
- const _child = icon(context);
3351
- if (typeof _child === "function") {
3352
- child = _child();
3353
- } else {
3354
- iconName = _child;
3355
- }
3356
- }
3357
- } else {
3358
- iconName = icon;
3359
- }
3360
- if (!iconName && child == null)
3361
- return;
3362
- return createVNode(VButton, {
3363
- "tabindex": -1,
3364
- "key": key,
3365
- "icon": iconName,
3366
- "onClick": (ev) => onClick(context, ev),
3367
- "color": isActive ? toolButtonActiveColor : void 0,
3368
- "disabled": isDisabled
3369
- }, _isSlot9(child) ? child : {
3370
- default: () => [child]
3371
- });
3372
- })) ? _slot : {
3373
- default: () => [_slot]
3374
- });
3375
- };
3376
- onBeforeUnmount(() => {
3377
- editor.value && editor.value.destroy();
3378
- });
3379
2995
  return {
3380
- editor,
3381
2996
  ...inputControl.expose(),
3382
- ...control,
3383
- focus,
3384
- blur,
3385
- createTools
2997
+ ...control
3386
2998
  };
3387
2999
  },
3388
3000
  render() {
3389
3001
  return createVNode(VFormControl, {
3390
3002
  "nodeControl": this.nodeControl,
3391
3003
  "focused": this.nodeControl.focused,
3392
- "class": ["v-wysiwyg-editor", this.classes, `v-wysiwyg-editor--${this.size}`, {
3393
- "v-wysiwyg-editor--disabled-min-heihgt": this.disabledMinHeight,
3394
- "v-wysiwyg-editor--disabled-max-heihgt": this.disabledMaxHeight
3395
- }],
3004
+ "class": ["v-textarea", this.classes],
3396
3005
  "label": this.label,
3397
3006
  "hint": this.hint,
3398
3007
  "hinttip": this.hinttip,
3399
3008
  "hiddenInfo": this.hiddenInfo,
3400
3009
  "requiredChip": this.requiredChip,
3401
3010
  "onClickLabel": (ev) => {
3402
- this.focus("start", {
3403
- scrollIntoView: true
3404
- });
3011
+ this.focus();
3405
3012
  }
3406
3013
  }, {
3407
3014
  ...this.$slots,
3408
- default: () => {
3409
- const {
3410
- editor
3411
- } = this;
3412
- return createVNode("div", {
3413
- "class": "v-wysiwyg-editor__wrapper"
3414
- }, [!this.isReadonly && this.createTools(), createVNode(VControlField, {
3415
- "class": "v-wysiwyg-editor__input",
3416
- "autoHeight": true,
3417
- "startAdornment": this.startAdornment,
3418
- "endAdornment": this.endAdornment,
3419
- "size": this.size
3420
- }, {
3421
- ...this.$slots,
3422
- default: () => {
3423
- let _slot2;
3424
- return createVNode("div", {
3425
- "class": "v-wysiwyg-editor__body"
3426
- }, [createVNode(EditorContent, mergeProps({
3427
- class: "v-wysiwyg-editor__input__element wysiwyg"
3428
- }, {
3429
- "editor": editor
3430
- }), null), !this.floatingToolbar && !!editor && !this.isReadonly && createVNode(BubbleMenu, mergeProps({
3431
- class: "v-wysiwyg-editor__bubble-menu"
3432
- }, {
3433
- "editor": editor
3434
- }), _isSlot9(_slot2 = this.createTools(true)) ? _slot2 : {
3435
- default: () => [_slot2]
3436
- })]);
3437
- }
3438
- })]);
3439
- },
3015
+ default: () => createVNode(VControlField, {
3016
+ "class": "v-textarea__input",
3017
+ "size": this.size,
3018
+ "autoHeight": true,
3019
+ "startAdornment": this.startAdornment,
3020
+ "endAdornment": this.endAdornment
3021
+ }, {
3022
+ ...this.$slots,
3023
+ default: () => this.textareaControl.createInputElement({
3024
+ class: "v-textarea__input__element"
3025
+ })
3026
+ }),
3440
3027
  infoAppends: () => {
3441
3028
  const {
3442
3029
  counterResult
@@ -3448,551 +3035,6 @@ var VWysiwygEditor = defineComponent({
3448
3035
  });
3449
3036
  }
3450
3037
  });
3451
- function resolveContextableValue(ctx, source) {
3452
- return typeof source === "function" ? source(ctx) : source;
3453
- }
3454
- var PROBLEM_CLASS_NAME = "v-linter__problem";
3455
- var ISSUE_ICON_CLASS_NAME = "v-linter__issue-icon";
3456
- var ISSUE_DATASET_NAME = "data-issue-id";
3457
- function resolveWysiwygLinterFixMessage(message) {
3458
- return typeof message === "function" ? message() : message;
3459
- }
3460
- function renderIcon(view, issue) {
3461
- const {
3462
- level = "warning"
3463
- } = issue;
3464
- const icon = document.createElement("div");
3465
- const message = resolveWysiwygLinterFixMessage(issue.message);
3466
- icon.className = `${ISSUE_ICON_CLASS_NAME} ${level}-scope`;
3467
- icon.setAttribute(ISSUE_DATASET_NAME, issue.id);
3468
- if (typeof message === "string") {
3469
- icon.title = message;
3470
- }
3471
- return icon;
3472
- }
3473
- function runAllLinterPlugins(doc, plugins) {
3474
- const decorations = [];
3475
- const issues = plugins.map((RegisteredLinterPlugin) => {
3476
- return new RegisteredLinterPlugin(doc).scan().getResults();
3477
- }).flat();
3478
- issues.forEach((issue) => {
3479
- const {
3480
- level = "warning",
3481
- icon
3482
- } = issue;
3483
- const message = resolveWysiwygLinterFixMessage(issue.message);
3484
- decorations.push(Decoration.inline(issue.from, issue.to, {
3485
- class: `${PROBLEM_CLASS_NAME} ${level}-scope`,
3486
- "data-issue-id": issue.id,
3487
- title: typeof message === "string" ? message : void 0
3488
- }));
3489
- if (icon) {
3490
- decorations.push(Decoration.widget(issue.from, (view) => renderIcon(view, issue)));
3491
- }
3492
- });
3493
- const decorationSet = DecorationSet.create(doc, decorations);
3494
- return {
3495
- issues,
3496
- decorationSet
3497
- };
3498
- }
3499
- var WysiwygLinter = createWysiwygExtension((ctx) => {
3500
- function showMenu(view, issue, event) {
3501
- const message = resolveWysiwygLinterFixMessage(issue.message);
3502
- const variant = ctx.vui.setting("containedVariant");
3503
- const scope = ctx.vui.setting(`${issue.level}Scope`);
3504
- return ctx.vui.menu({
3505
- activator: event,
3506
- content: (stack) => createVNode("div", {
3507
- "class": "v-linter__issue-menu__body"
3508
- }, [createVNode("div", {
3509
- "class": ["v-linter__issue-menu__message", `${scope}-scope ${variant}`]
3510
- }, [message]), issue.fix.length && createVNode("div", {
3511
- "class": "v-linter__issue-menu__fixers"
3512
- }, [issue.fix.map((fixer, index) => createVNode("div", {
3513
- "key": index,
3514
- "class": "v-linter__issue-menu__fixer"
3515
- }, [createVNode("button", {
3516
- "type": "button",
3517
- "class": "v-linter__issue-menu__fixer__button",
3518
- "onClick": () => {
3519
- stack.close();
3520
- fixer.handler(view, issue);
3521
- }
3522
- }, [createVNode("span", {
3523
- "class": "v-linter__issue-menu__fixer__button__message"
3524
- }, [resolveWysiwygLinterFixMessage(fixer.message)])])]))])])
3525
- });
3526
- }
3527
- return Extension.create({
3528
- name: "linter",
3529
- addOptions() {
3530
- return {
3531
- plugins: []
3532
- };
3533
- },
3534
- addStorage() {
3535
- return {
3536
- issues: []
3537
- };
3538
- },
3539
- addProseMirrorPlugins() {
3540
- const {
3541
- plugins
3542
- } = this.options;
3543
- const {
3544
- storage
3545
- } = this;
3546
- const runAll = (doc) => {
3547
- const {
3548
- issues,
3549
- decorationSet
3550
- } = runAllLinterPlugins(doc, plugins);
3551
- storage.issues = issues;
3552
- return decorationSet;
3553
- };
3554
- const getIssue = (id) => storage.issues.find((issue) => issue.id === id);
3555
- const getIssueElementByEvent = (source) => {
3556
- if (!source || !(source instanceof HTMLElement)) {
3557
- return;
3558
- }
3559
- const issueId = source.getAttribute(ISSUE_DATASET_NAME);
3560
- const issue = issueId && getIssue(issueId);
3561
- if (!issue)
3562
- return;
3563
- return {
3564
- issue
3565
- };
3566
- };
3567
- const linterPlugin = new Plugin({
3568
- key: new PluginKey("linter"),
3569
- state: {
3570
- init(_, {
3571
- doc
3572
- }) {
3573
- return runAll(doc);
3574
- },
3575
- apply(transaction, oldState) {
3576
- return transaction.docChanged ? runAll(transaction.doc) : oldState;
3577
- }
3578
- },
3579
- props: {
3580
- decorations(state) {
3581
- return linterPlugin.getState(state);
3582
- },
3583
- handleClick(view, _, event) {
3584
- const info = getIssueElementByEvent(event.target);
3585
- if (!info) {
3586
- return false;
3587
- }
3588
- const {
3589
- issue
3590
- } = info;
3591
- const {
3592
- from,
3593
- to
3594
- } = issue;
3595
- const focus = () => view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, from, to)).scrollIntoView());
3596
- focus();
3597
- showMenu(view, issue, event);
3598
- return true;
3599
- }
3600
- }
3601
- });
3602
- return [linterPlugin];
3603
- }
3604
- });
3605
- });
3606
-
3607
- // src/components/VWysiwygEditor/extensions/linter/utils.ts
3608
- var IDX = 256;
3609
- var BUFFER;
3610
- var HEX = [];
3611
- while (IDX--)
3612
- HEX[IDX] = (IDX + 256).toString(16).substring(1);
3613
- function cheepUUID() {
3614
- let i = 0, num, out = "";
3615
- if (!BUFFER || IDX + 16 > 256) {
3616
- BUFFER = Array(i = 256);
3617
- while (i--)
3618
- BUFFER[i] = 256 * Math.random() | 0;
3619
- i = IDX = 0;
3620
- }
3621
- for (; i < 16; i++) {
3622
- num = BUFFER[IDX + i];
3623
- if (i == 6)
3624
- out += HEX[num & 15 | 64];
3625
- else if (i == 8)
3626
- out += HEX[num & 63 | 128];
3627
- else
3628
- out += HEX[num];
3629
- if (i & 1 && i > 1 && i < 11)
3630
- out += "-";
3631
- }
3632
- IDX++;
3633
- return out;
3634
- }
3635
-
3636
- // src/components/VWysiwygEditor/extensions/linter/LinterPlugin.ts
3637
- var WysiwygLinterPlugin = class {
3638
- doc;
3639
- results = [];
3640
- constructor(doc) {
3641
- this.doc = doc;
3642
- }
3643
- record(result) {
3644
- const { fix = [], icon = false } = result;
3645
- this.results.push({
3646
- level: "error",
3647
- id: cheepUUID(),
3648
- ...result,
3649
- fix: Array.isArray(fix) ? fix : [fix],
3650
- icon
3651
- });
3652
- }
3653
- scan() {
3654
- return this;
3655
- }
3656
- getResults() {
3657
- return this.results;
3658
- }
3659
- };
3660
- function WysiwygLinterBadWords(words) {
3661
- const regex = new RegExp(`\\b(${words.join("|")})\\b`);
3662
- return class WysiwygLinterBadWords extends WysiwygLinterPlugin {
3663
- scan() {
3664
- this.doc.descendants((node, position) => {
3665
- if (!node.isText) {
3666
- return;
3667
- }
3668
- const matches = regex.exec(node.text);
3669
- if (matches) {
3670
- const fixValue = matches[0] + "!!!!!";
3671
- this.record({
3672
- level: "warning",
3673
- message: `Try not to say '${matches[0]}'`,
3674
- from: position + matches.index,
3675
- to: position + matches.index + matches[0].length,
3676
- fix: [{
3677
- message: () => createVNode("span", null, [createVNode("code", null, [fixValue]), createTextVNode("\u306B\u4FEE\u6B63\u3059\u308B\u3002")]),
3678
- handler: () => {
3679
- console.log("hoge");
3680
- }
3681
- }, {
3682
- message: "\u3069\u3046\u306B\u304B\u3059\u308B",
3683
- handler: () => {
3684
- console.log("hoge");
3685
- }
3686
- }]
3687
- });
3688
- }
3689
- });
3690
- return this;
3691
- }
3692
- };
3693
- }
3694
-
3695
- // src/components/VWysiwygEditor/extensions/linter/plugins/HeadingLevel.ts
3696
- var WysiwygLinterHeadingLevel = class extends WysiwygLinterPlugin {
3697
- fixHeader(level) {
3698
- return function({ state, dispatch }, issue) {
3699
- dispatch(state.tr.setNodeMarkup(issue.from - 1, void 0, { level }));
3700
- };
3701
- }
3702
- scan() {
3703
- let lastHeadLevel = null;
3704
- this.doc.descendants((node, position) => {
3705
- if (node.type.name === "heading") {
3706
- const { level } = node.attrs;
3707
- if (lastHeadLevel != null && level > lastHeadLevel + 1) {
3708
- this.record({
3709
- message: `Heading too small (${level} under ${lastHeadLevel})`,
3710
- from: position + 1,
3711
- to: position + 1 + node.content.size,
3712
- fix: {
3713
- message: "\u4FEE\u6B63\u3059\u308B",
3714
- handler: this.fixHeader(lastHeadLevel + 1)
3715
- }
3716
- });
3717
- }
3718
- lastHeadLevel = level;
3719
- }
3720
- });
3721
- return this;
3722
- }
3723
- };
3724
-
3725
- // src/components/VWysiwygEditor/extensions/linter/plugins/Punctuation.ts
3726
- var WysiwygLinterPunctuation = class extends WysiwygLinterPlugin {
3727
- regex = / ([,.!?:]) ?/g;
3728
- fix(replacement) {
3729
- return function({ state, dispatch }, issue) {
3730
- dispatch(
3731
- state.tr.replaceWith(
3732
- issue.from,
3733
- issue.to,
3734
- state.schema.text(replacement)
3735
- )
3736
- );
3737
- };
3738
- }
3739
- scan() {
3740
- this.doc.descendants((node, position) => {
3741
- if (!node.isText) {
3742
- return;
3743
- }
3744
- if (!node.text) {
3745
- return;
3746
- }
3747
- const matches = this.regex.exec(node.text);
3748
- if (matches) {
3749
- this.record({
3750
- message: "Suspicious spacing around punctuation",
3751
- from: position + matches.index,
3752
- to: position + matches.index + matches[0].length,
3753
- fix: {
3754
- message: "Fix it!!!",
3755
- handler: this.fix(`${matches[1]} `)
3756
- }
3757
- });
3758
- }
3759
- });
3760
- return this;
3761
- }
3762
- };
3763
- var WysiwygColorExtension = Extension.create({
3764
- name: "color",
3765
- addOptions() {
3766
- return {
3767
- types: ["textStyle"]
3768
- };
3769
- },
3770
- addGlobalAttributes() {
3771
- return [
3772
- {
3773
- types: this.options.types,
3774
- attributes: {
3775
- color: {
3776
- default: null,
3777
- parseHTML: (element) => element.style.color.replace(/['"]+/g, ""),
3778
- renderHTML: (attributes) => {
3779
- if (!attributes.color) {
3780
- return {};
3781
- }
3782
- return {
3783
- style: `color: ${attributes.color}`
3784
- };
3785
- }
3786
- }
3787
- }
3788
- }
3789
- ];
3790
- },
3791
- addCommands() {
3792
- return {
3793
- setColor: (color) => ({ chain }) => {
3794
- return chain().setMark("textStyle", { color }).run();
3795
- },
3796
- unsetColor: () => ({ chain }) => {
3797
- return chain().setMark("textStyle", { color: null }).removeEmptyTextStyle().run();
3798
- }
3799
- };
3800
- }
3801
- });
3802
- var WysiwygBulletListTool = (vui, options) => {
3803
- const tool = {
3804
- key: "bulletList",
3805
- icon: vui.icon("editorformatListBulleted"),
3806
- active: ({ editor }) => editor.isActive("bulletList"),
3807
- onClick: ({ editor }) => {
3808
- editor.chain().focus().toggleBulletList().run();
3809
- },
3810
- floating: true,
3811
- extensions: [BulletList.configure(options)]
3812
- };
3813
- return tool;
3814
- };
3815
- var WysiwygFormatBoldTool = (vui, options) => {
3816
- const tool = {
3817
- key: "formatBold",
3818
- icon: vui.icon("editorformatBold"),
3819
- active: ({ editor }) => editor.isActive("bold"),
3820
- onClick: ({ editor }) => {
3821
- editor.chain().focus().toggleBold().run();
3822
- },
3823
- floating: true,
3824
- extensions: [Bold.configure(options)]
3825
- };
3826
- return tool;
3827
- };
3828
- var WysiwygFormatItalicTool = (vui, options) => {
3829
- const tool = {
3830
- key: "formatItalic",
3831
- icon: vui.icon("editorformatItalic"),
3832
- active: ({ editor }) => editor.isActive("italic"),
3833
- onClick: ({ editor }) => {
3834
- editor.chain().focus().toggleItalic().run();
3835
- },
3836
- floating: true,
3837
- extensions: [Italic.configure(options)]
3838
- };
3839
- return tool;
3840
- };
3841
- var WysiwygFormatUnderlineTool = (vui, options) => {
3842
- const tool = {
3843
- key: "formatUnderline",
3844
- icon: vui.icon("editorformatUnderline"),
3845
- active: ({ editor }) => editor.isActive("underline"),
3846
- onClick: ({ editor }) => {
3847
- editor.chain().focus().toggleUnderline().run();
3848
- },
3849
- floating: true,
3850
- extensions: [Underline.configure(options)]
3851
- };
3852
- return tool;
3853
- };
3854
- var WysiwygHistoryTool = (vui, options) => {
3855
- const undo = {
3856
- key: "history-undo",
3857
- icon: vui.icon("editorUndo"),
3858
- disabled: ({ editor }) => !editor.can().undo(),
3859
- onClick: ({ editor }) => {
3860
- editor.chain().focus().undo().run();
3861
- },
3862
- extensions: [History.configure(options)]
3863
- };
3864
- const redo = {
3865
- key: "history-redo",
3866
- icon: vui.icon("editorRedo"),
3867
- disabled: ({ editor }) => !editor.can().redo(),
3868
- onClick: ({ editor }) => {
3869
- editor.chain().focus().redo().run();
3870
- }
3871
- };
3872
- return [undo, redo];
3873
- };
3874
- var WysiwygLinkTool = (vui, options) => {
3875
- const tool = {
3876
- key: "link",
3877
- // icon: ({ editor }) => {
3878
- // return vui.icon(editor.isActive('link') ? 'editorLinkOff' : 'editorLink');
3879
- // },
3880
- icon: vui.icon("editorLink"),
3881
- active: ({ editor }) => editor.isActive("link"),
3882
- // disabled: ({ editor }) => {
3883
- // const { $from, $to } = editor.view.state.selection;
3884
- // return $to.pos - $from.pos === 0;
3885
- // },
3886
- onClick: async ({ vui: vui2, editor }) => {
3887
- const { href = "" } = editor.getAttributes("link");
3888
- const result = await vui2.prompt({
3889
- input: {
3890
- label: "Link URL",
3891
- rules: [validateIf, url],
3892
- initialValue: href,
3893
- size: "sm",
3894
- autofocus: true
3895
- }
3896
- });
3897
- if (result === void 0 || result === false) {
3898
- return;
3899
- }
3900
- const range = editor.chain().focus().extendMarkRange("link");
3901
- if (!result) {
3902
- range.unsetLink().run();
3903
- } else {
3904
- range.setLink({
3905
- href: result
3906
- }).run();
3907
- }
3908
- },
3909
- floating: true,
3910
- extensions: [
3911
- Link.configure({
3912
- openOnClick: false,
3913
- ...options
3914
- })
3915
- ]
3916
- };
3917
- return tool;
3918
- };
3919
- var WysiwygOrderedListTool = (vui, options) => {
3920
- const tool = {
3921
- key: "orderedList",
3922
- icon: vui.icon("editorformatListNumbered"),
3923
- active: ({ editor }) => editor.isActive("orderedList"),
3924
- onClick: ({ editor }) => {
3925
- editor.chain().focus().toggleOrderedList().run();
3926
- },
3927
- floating: true,
3928
- extensions: [OrderedList.configure(options)]
3929
- };
3930
- return tool;
3931
- };
3932
- function createWysiwygColorTool(opts) {
3933
- const WysiwygColorTool = (vui) => {
3934
- const tool = {
3935
- key: "textColor",
3936
- // active: ({ editor }) => editor.isActive('textStyle'),
3937
- icon: ({
3938
- editor
3939
- }) => () => {
3940
- const color = editor.getAttributes("textStyle").color;
3941
- const style = {
3942
- color
3943
- };
3944
- return createVNode("span", {
3945
- "class": "v-wysiwyg-color-tool__button"
3946
- }, [createVNode(VIcon, {
3947
- "class": "v-wysiwyg-color-tool__button__icon",
3948
- "name": vui.icon("editorTextColor")
3949
- }, null), createVNode("span", {
3950
- "class": "v-wysiwyg-color-tool__button__bar",
3951
- "style": style
3952
- }, null)]);
3953
- },
3954
- onClick: (ctx, ev) => {
3955
- ctx.vui.menu({
3956
- class: "v-wysiwyg-color-tool__menu",
3957
- activator: ev,
3958
- content: (stack) => createVNode("div", {
3959
- "class": ["v-wysiwyg-color-tool__items", {
3960
- "v-wysiwyg-color-tool__items--with-label": opts.withLabel
3961
- }]
3962
- }, [opts.items.map((item, index) => createVNode("button", {
3963
- "key": item.key == null ? index : item.key,
3964
- "class": "v-wysiwyg-color-tool__item",
3965
- "type": "button",
3966
- "onClick": () => {
3967
- const {
3968
- color
3969
- } = item;
3970
- let command = ctx.editor.chain().focus();
3971
- if (color) {
3972
- command = command.setColor(color);
3973
- } else {
3974
- command = command.unsetColor();
3975
- }
3976
- command.run();
3977
- stack.close();
3978
- }
3979
- }, [createVNode("span", {
3980
- "class": "v-wysiwyg-color-tool__item__color",
3981
- "style": item.color ? {
3982
- color: item.color
3983
- } : {}
3984
- }, null), opts.withLabel && createVNode("span", {
3985
- "class": "v-wysiwyg-color-tool__item__name"
3986
- }, [item.name])]))])
3987
- });
3988
- },
3989
- floating: true,
3990
- extensions: [TextStyle, WysiwygColorExtension]
3991
- };
3992
- return tool;
3993
- };
3994
- return WysiwygColorTool;
3995
- }
3996
3038
  var {
3997
3039
  props: props9,
3998
3040
  emits: emits9
@@ -4051,7 +3093,7 @@ var VForm = defineComponent({
4051
3093
  }, [renderSlotOrEmpty(this.$slots, "default", form)]);
4052
3094
  }
4053
3095
  });
4054
- function _isSlot10(s) {
3096
+ function _isSlot9(s) {
4055
3097
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
4056
3098
  }
4057
3099
  var VTab = defineComponent({
@@ -4096,7 +3138,7 @@ var VTab = defineComponent({
4096
3138
  "class": classes,
4097
3139
  "to": to,
4098
3140
  "replace": replace
4099
- }, _isSlot10(children) ? children : {
3141
+ }, _isSlot9(children) ? children : {
4100
3142
  default: () => [children]
4101
3143
  });
4102
3144
  } else {
@@ -4112,7 +3154,7 @@ var VTab = defineComponent({
4112
3154
  };
4113
3155
  }
4114
3156
  });
4115
- function _isSlot11(s) {
3157
+ function _isSlot10(s) {
4116
3158
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
4117
3159
  }
4118
3160
  var VTabs = defineComponent({
@@ -4197,8 +3239,8 @@ var VTabs = defineComponent({
4197
3239
  };
4198
3240
  });
4199
3241
  });
4200
- const setTabRef = (ref11) => {
4201
- tabRefs.value.push(ref11);
3242
+ const setTabRef = (ref10) => {
3243
+ tabRefs.value.push(ref10);
4202
3244
  };
4203
3245
  function setupInternalValue(routable) {
4204
3246
  let value = props10.modelValue;
@@ -4375,7 +3417,7 @@ var VTabs = defineComponent({
4375
3417
  to(value);
4376
3418
  }
4377
3419
  }
4378
- }, _isSlot11(children2) ? children2 : {
3420
+ }, _isSlot10(children2) ? children2 : {
4379
3421
  default: () => [children2]
4380
3422
  });
4381
3423
  });
@@ -4395,7 +3437,7 @@ var VTabs = defineComponent({
4395
3437
  };
4396
3438
  }
4397
3439
  });
4398
- function _isSlot12(s) {
3440
+ function _isSlot11(s) {
4399
3441
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
4400
3442
  }
4401
3443
  var VBreadcrumbs = defineComponent({
@@ -4479,7 +3521,7 @@ var VBreadcrumbs = defineComponent({
4479
3521
  "class": "v-breadcrumbs__link",
4480
3522
  "to": to,
4481
3523
  "exactActiveClass": "v-breadcrumbs__link--active"
4482
- }, _isSlot12(myChildren) ? myChildren : {
3524
+ }, _isSlot11(myChildren) ? myChildren : {
4483
3525
  default: () => [myChildren]
4484
3526
  }) : myChildren;
4485
3527
  children.push(createVNode("li", {
@@ -4497,7 +3539,7 @@ var VBreadcrumbs = defineComponent({
4497
3539
  };
4498
3540
  }
4499
3541
  });
4500
- function _isSlot13(s) {
3542
+ function _isSlot12(s) {
4501
3543
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
4502
3544
  }
4503
3545
  var VContentSwitcher = defineComponent({
@@ -4617,7 +3659,7 @@ var VContentSwitcher = defineComponent({
4617
3659
  "onLeaveCancelled": () => {
4618
3660
  getEl().style.height = "";
4619
3661
  }
4620
- }, _isSlot13(children) ? children : {
3662
+ }, _isSlot12(children) ? children : {
4621
3663
  default: () => [children]
4622
3664
  })]);
4623
3665
  };
@@ -5289,7 +4331,7 @@ var VToolbar = defineComponent({
5289
4331
  };
5290
4332
  }
5291
4333
  });
5292
- function _isSlot14(s) {
4334
+ function _isSlot13(s) {
5293
4335
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
5294
4336
  }
5295
4337
  var VToolbarMenu = defineComponent({
@@ -5305,7 +4347,7 @@ var VToolbarMenu = defineComponent({
5305
4347
  return createVNode(VButton, mergeProps(ctx.attrs, {
5306
4348
  "variant": variant,
5307
4349
  "class": ["v-toolbar-menu"]
5308
- }), _isSlot14(_slot = renderSlotOrEmpty(ctx.slots)) ? _slot : {
4350
+ }), _isSlot13(_slot = renderSlotOrEmpty(ctx.slots)) ? _slot : {
5309
4351
  default: () => [_slot]
5310
4352
  });
5311
4353
  };
@@ -5332,7 +4374,7 @@ var VToolbarEdge = defineComponent({
5332
4374
  };
5333
4375
  }
5334
4376
  });
5335
- function _isSlot15(s) {
4377
+ function _isSlot14(s) {
5336
4378
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
5337
4379
  }
5338
4380
  var VToolbarTitle = defineComponent({
@@ -5350,7 +4392,7 @@ var VToolbarTitle = defineComponent({
5350
4392
  const TagName = _TagName.value;
5351
4393
  return createVNode(TagName, {
5352
4394
  "class": "v-toolbar-title"
5353
- }, _isSlot15(_slot = renderSlotOrEmpty(ctx.slots, "default")) ? _slot : {
4395
+ }, _isSlot14(_slot = renderSlotOrEmpty(ctx.slots, "default")) ? _slot : {
5354
4396
  default: () => [_slot]
5355
4397
  });
5356
4398
  };
@@ -5608,6 +4650,6 @@ function installVuiPlugin(app, opts) {
5608
4650
  return app.use(VuiPlugin, opts);
5609
4651
  }
5610
4652
 
5611
- export { ARROW_KEY_TYPES, AVATAR_SIZES, BUTTON_ALIGNS, CHIP_SIZES, CHOICE_KEY_TYPES, CONTROL_FIELD_VARIANTS, CONTROL_LOADING_SPINNER_SIZES, CONTROL_SIZES, KEYBORD_EVENT_TYPES, PAGINATION_ALIGNS, VApp, VAvatar, VBreadcrumbs, VBusyImage, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VChip, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VNumberField, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSkeltonLoaderBone, VSwitch, VSwitchGroup, VTabs, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, WysiwygBulletListTool, WysiwygColorExtension, WysiwygEditorInitializeContext, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, configureDataTableDefaults, createAvatarProps, createCardProps, createChipProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createNavigationProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, createVFormProps, createWysiwygColorTool, createWysiwygExtension, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, mergeVuiPluginOptions, mergeVuiServiceIconSettings, mergeVuiServiceOptions, mergeVuiServiceUISettings, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions, splitAttrs, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
4653
+ export { ARROW_KEY_TYPES, AVATAR_SIZES, BUTTON_ALIGNS, CHIP_SIZES, CHOICE_KEY_TYPES, CONTROL_FIELD_VARIANTS, CONTROL_LOADING_SPINNER_SIZES, CONTROL_SIZES, KEYBORD_EVENT_TYPES, PAGINATION_ALIGNS, VApp, VAvatar, VBreadcrumbs, VBusyImage, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VChip, VContentSwitcher, VControlField, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VNumberField, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSkeltonLoaderBone, VSwitch, VSwitchGroup, VTabs, VTextCounter, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, configureDataTableDefaults, createAvatarProps, createCardProps, createChipProps, createControlFieldProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createNavigationProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, createVFormProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, mergeVuiPluginOptions, mergeVuiServiceIconSettings, mergeVuiServiceOptions, mergeVuiServiceUISettings, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, splitAttrs, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
5612
4654
  //# sourceMappingURL=out.js.map
5613
4655
  //# sourceMappingURL=vui.mjs.map