@mekari/pixel3-rich-text-editor 0.0.1-dev.0

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 (67) hide show
  1. package/dist/chunk-2SSVSEKG.mjs +28 -0
  2. package/dist/chunk-3RJGWHBG.mjs +122 -0
  3. package/dist/chunk-CE52CW3F.mjs +0 -0
  4. package/dist/chunk-CENCRLRC.mjs +40 -0
  5. package/dist/chunk-IE2ITPBX.mjs +106 -0
  6. package/dist/chunk-J5QZDLNA.mjs +282 -0
  7. package/dist/chunk-JURYRRU5.mjs +61 -0
  8. package/dist/chunk-MMFX326I.mjs +44 -0
  9. package/dist/chunk-N5YFARYC.mjs +89 -0
  10. package/dist/chunk-OFJH5BEQ.mjs +176 -0
  11. package/dist/chunk-QZ7VFGWC.mjs +6 -0
  12. package/dist/chunk-VQOMXS6M.mjs +27 -0
  13. package/dist/editor-toolbar.d.mts +12 -0
  14. package/dist/editor-toolbar.d.ts +12 -0
  15. package/dist/editor-toolbar.js +698 -0
  16. package/dist/editor-toolbar.mjs +12 -0
  17. package/dist/extensions/align-extension.d.mts +12 -0
  18. package/dist/extensions/align-extension.d.ts +12 -0
  19. package/dist/extensions/align-extension.js +406 -0
  20. package/dist/extensions/align-extension.mjs +8 -0
  21. package/dist/extensions/heading-extension.d.mts +12 -0
  22. package/dist/extensions/heading-extension.d.ts +12 -0
  23. package/dist/extensions/heading-extension.js +463 -0
  24. package/dist/extensions/heading-extension.mjs +8 -0
  25. package/dist/extensions/icons.d.mts +20 -0
  26. package/dist/extensions/icons.d.ts +20 -0
  27. package/dist/extensions/icons.js +320 -0
  28. package/dist/extensions/icons.mjs +35 -0
  29. package/dist/extensions/index.d.mts +5 -0
  30. package/dist/extensions/index.d.ts +5 -0
  31. package/dist/extensions/index.js +609 -0
  32. package/dist/extensions/index.mjs +17 -0
  33. package/dist/extensions/single-extension.d.mts +16 -0
  34. package/dist/extensions/single-extension.d.ts +16 -0
  35. package/dist/extensions/single-extension.js +322 -0
  36. package/dist/extensions/single-extension.mjs +8 -0
  37. package/dist/index.d.mts +6 -0
  38. package/dist/index.d.ts +6 -0
  39. package/dist/index.js +914 -0
  40. package/dist/index.mjs +20 -0
  41. package/dist/metafile-cjs.json +1 -0
  42. package/dist/metafile-esm.json +1 -0
  43. package/dist/modules/rich-text-editor.connects.d.mts +11 -0
  44. package/dist/modules/rich-text-editor.connects.d.ts +11 -0
  45. package/dist/modules/rich-text-editor.connects.js +83 -0
  46. package/dist/modules/rich-text-editor.connects.mjs +9 -0
  47. package/dist/modules/rich-text-editor.hooks.d.mts +8 -0
  48. package/dist/modules/rich-text-editor.hooks.d.ts +8 -0
  49. package/dist/modules/rich-text-editor.hooks.js +101 -0
  50. package/dist/modules/rich-text-editor.hooks.mjs +10 -0
  51. package/dist/modules/rich-text-editor.props.d.mts +40 -0
  52. package/dist/modules/rich-text-editor.props.d.ts +40 -0
  53. package/dist/modules/rich-text-editor.props.js +66 -0
  54. package/dist/modules/rich-text-editor.props.mjs +11 -0
  55. package/dist/modules/rich-text-editor.types.d.mts +54 -0
  56. package/dist/modules/rich-text-editor.types.d.ts +54 -0
  57. package/dist/modules/rich-text-editor.types.js +18 -0
  58. package/dist/modules/rich-text-editor.types.mjs +0 -0
  59. package/dist/rich-text-editor.d.mts +67 -0
  60. package/dist/rich-text-editor.d.ts +67 -0
  61. package/dist/rich-text-editor.js +910 -0
  62. package/dist/rich-text-editor.mjs +17 -0
  63. package/dist/rte-style-provider.d.mts +17 -0
  64. package/dist/rte-style-provider.d.ts +17 -0
  65. package/dist/rte-style-provider.js +85 -0
  66. package/dist/rte-style-provider.mjs +10 -0
  67. package/package.json +55 -0
@@ -0,0 +1,44 @@
1
+ import {
2
+ BlockquoteIcon,
3
+ BoldIcon,
4
+ BulletListIcon,
5
+ ClearIcon,
6
+ ItalicIcon,
7
+ OrderedListIcon,
8
+ RedoIcon,
9
+ StrikeIcon,
10
+ UnderlineIcon,
11
+ UndoIcon
12
+ } from "./chunk-J5QZDLNA.mjs";
13
+
14
+ // src/extensions/single-extension.tsx
15
+ import { withDirectives as _withDirectives, resolveDirective as _resolveDirective, createVNode as _createVNode } from "vue";
16
+ import { defineComponent } from "vue";
17
+ var SingleExtention = defineComponent({
18
+ name: "SingleExtention",
19
+ props: {
20
+ name: String,
21
+ tooltipLabel: String,
22
+ onClick: Function,
23
+ editor: Object
24
+ },
25
+ setup({
26
+ name,
27
+ tooltipLabel,
28
+ onClick,
29
+ editor
30
+ }) {
31
+ return () => _withDirectives(_createVNode("button", {
32
+ "class": {
33
+ "is-active": editor == null ? void 0 : editor.isActive(name)
34
+ },
35
+ "onClick": onClick
36
+ }, [name === "bold" && _createVNode(BoldIcon, null, null), name === "italic" && _createVNode(ItalicIcon, null, null), name === "underline" && _createVNode(UnderlineIcon, null, null), name === "strike" && _createVNode(StrikeIcon, null, null), name === "blockquote" && _createVNode(BlockquoteIcon, null, null), name === "bulletList" && _createVNode(BulletListIcon, null, null), name === "orderedList" && _createVNode(OrderedListIcon, null, null), name === "undo" && _createVNode(UndoIcon, null, null), name === "redo" && _createVNode(RedoIcon, null, null), name === "clear" && _createVNode(ClearIcon, null, null)]), [[_resolveDirective("tooltip"), {
37
+ label: tooltipLabel
38
+ }]]);
39
+ }
40
+ });
41
+
42
+ export {
43
+ SingleExtention
44
+ };
@@ -0,0 +1,89 @@
1
+ import {
2
+ EditorToolbar
3
+ } from "./chunk-IE2ITPBX.mjs";
4
+ import {
5
+ MpRTEStyleProvider
6
+ } from "./chunk-VQOMXS6M.mjs";
7
+ import {
8
+ useRichTextEditor
9
+ } from "./chunk-2SSVSEKG.mjs";
10
+ import {
11
+ richTextEditorEmits,
12
+ richTextEditorProps
13
+ } from "./chunk-CENCRLRC.mjs";
14
+
15
+ // src/rich-text-editor.tsx
16
+ import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
17
+ import { defineComponent, ref } from "vue";
18
+ import { Editor, EditorContent } from "@tiptap/vue-3";
19
+ import StarterKit from "@tiptap/starter-kit";
20
+ import Underline from "@tiptap/extension-underline";
21
+ import TextAlign from "@tiptap/extension-text-align";
22
+ import Placeholder from "@tiptap/extension-placeholder";
23
+ import { token } from "@mekari/pixel3-styled-system/tokens";
24
+ import { useFormControlContext } from "@mekari/pixel3-form-control";
25
+ var MpRichTextEditor = defineComponent({
26
+ name: "MpRichTextEditor",
27
+ props: richTextEditorProps,
28
+ emits: richTextEditorEmits,
29
+ setup(props, {
30
+ emit
31
+ }) {
32
+ const formControlProp = useFormControlContext();
33
+ const api = useRichTextEditor(props);
34
+ const isFocused = ref(false);
35
+ const editor = new Editor({
36
+ content: api.value.value,
37
+ editable: (formControlProp == null ? void 0 : formControlProp.value.isDisabled) === void 0 ? !api.value.isDisabled : !(formControlProp == null ? void 0 : formControlProp.value.isDisabled),
38
+ extensions: [StarterKit.configure({
39
+ heading: {
40
+ levels: [1, 2, 3]
41
+ }
42
+ }), Underline, TextAlign.configure({
43
+ types: ["heading", "paragraph"]
44
+ }), Placeholder.configure({
45
+ placeholder: api.value.placeholder || ""
46
+ })],
47
+ onFocus({
48
+ editor: editor2,
49
+ event
50
+ }) {
51
+ isFocused.value = true;
52
+ emit("focus", editor2, event);
53
+ },
54
+ onBlur({
55
+ editor: editor2,
56
+ event
57
+ }) {
58
+ isFocused.value = false;
59
+ emit("blur", editor2, event);
60
+ },
61
+ onUpdate({
62
+ editor: editor2
63
+ }) {
64
+ emit("change", editor2.getHTML(), editor2);
65
+ }
66
+ });
67
+ return () => {
68
+ return _createVNode("div", _mergeProps(api.value.rootProps, {
69
+ "style": {
70
+ "--mp-rich-text-editor--border-color-hover": (formControlProp == null ? void 0 : formControlProp.value.isInvalid) || api.value.isInvalid ? token.var("colors.red.400") : isFocused.value ? token.var("colors.blue.400") : token.var("colors.gray.400"),
71
+ "--mp-rich-text-editor--border-color": (formControlProp == null ? void 0 : formControlProp.value.isInvalid) || api.value.isInvalid ? token.var("colors.red.400") : isFocused.value ? token.var("colors.blue.400") : token.var("colors.gray.100"),
72
+ "--mp-rich-text-editor--box-shadow": isFocused.value ? token.var("shadows.outer") : void 0,
73
+ "--mp-rich-text-editor--background-color": (formControlProp == null ? void 0 : formControlProp.value.isDisabled) || api.value.isDisabled ? token.var("colors.gray.50") : token.var("colors.white")
74
+ }
75
+ }), [_createVNode(EditorToolbar, _mergeProps({
76
+ "editor": editor,
77
+ "options": api.value.options
78
+ }, api.value.toolbarProps), null), _createVNode(MpRTEStyleProvider, null, {
79
+ default: () => [_createVNode(EditorContent, _mergeProps({
80
+ "editor": editor
81
+ }, api.value.areaProps), null)]
82
+ })]);
83
+ };
84
+ }
85
+ });
86
+
87
+ export {
88
+ MpRichTextEditor
89
+ };
@@ -0,0 +1,176 @@
1
+ import {
2
+ CaretIcon
3
+ } from "./chunk-J5QZDLNA.mjs";
4
+
5
+ // src/extensions/heading-extension.tsx
6
+ import { withDirectives as _withDirectives, resolveDirective as _resolveDirective, createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
7
+ import { defineComponent } from "vue";
8
+ import { MpPopover, MpPopoverTrigger, MpPopoverContent, MpPopoverList, MpPopoverListItem } from "@mekari/pixel3-popover";
9
+ import { MpText } from "@mekari/pixel3-text";
10
+ import { css } from "@mekari/pixel3-styled-system/css";
11
+ var HeadingExtention = defineComponent({
12
+ name: "HeadingExtention",
13
+ props: {
14
+ tooltipLabel: String,
15
+ editor: Object
16
+ },
17
+ setup({
18
+ tooltipLabel,
19
+ editor
20
+ }) {
21
+ return () => _createVNode(MpPopover, null, {
22
+ default: () => [_createVNode(MpPopoverTrigger, null, {
23
+ default: () => [_withDirectives(_createVNode("button", {
24
+ "class": {
25
+ "is-active": (editor == null ? void 0 : editor.isActive("heading", {
26
+ level: 1
27
+ })) || (editor == null ? void 0 : editor.isActive("heading", {
28
+ level: 2
29
+ })) || (editor == null ? void 0 : editor.isActive("heading", {
30
+ level: 3
31
+ })) || (editor == null ? void 0 : editor.isActive("paragraph")),
32
+ "text-sizing": true
33
+ }
34
+ }, [(editor == null ? void 0 : editor.isActive("heading", {
35
+ level: 1
36
+ })) && _createVNode(MpText, {
37
+ "class": css({
38
+ color: "currentColor"
39
+ })
40
+ }, {
41
+ default: () => [_createTextVNode("Heading 1")]
42
+ }), (editor == null ? void 0 : editor.isActive("heading", {
43
+ level: 2
44
+ })) && _createVNode(MpText, {
45
+ "class": css({
46
+ color: "currentColor"
47
+ })
48
+ }, {
49
+ default: () => [_createTextVNode("Heading 2")]
50
+ }), (editor == null ? void 0 : editor.isActive("heading", {
51
+ level: 3
52
+ })) && _createVNode(MpText, {
53
+ "class": css({
54
+ color: "currentColor"
55
+ })
56
+ }, {
57
+ default: () => [_createTextVNode("Heading 3")]
58
+ }), (editor == null ? void 0 : editor.isActive("paragraph")) && _createVNode(MpText, {
59
+ "class": css({
60
+ color: "currentColor"
61
+ })
62
+ }, {
63
+ default: () => [_createTextVNode("Normal text")]
64
+ }), !(editor == null ? void 0 : editor.isActive("heading", {
65
+ level: 1
66
+ })) && !(editor == null ? void 0 : editor.isActive("heading", {
67
+ level: 2
68
+ })) && !(editor == null ? void 0 : editor.isActive("heading", {
69
+ level: 3
70
+ })) && !(editor == null ? void 0 : editor.isActive("paragraph")) && _createVNode(MpText, {
71
+ "class": css({
72
+ color: "currentColor"
73
+ })
74
+ }, {
75
+ default: () => [_createTextVNode("Normal text")]
76
+ }), _createVNode(CaretIcon, null, null)]), [[_resolveDirective("tooltip"), {
77
+ label: tooltipLabel
78
+ }]])]
79
+ }), _createVNode(MpPopoverContent, {
80
+ "class": css({
81
+ width: "200px",
82
+ maxWidth: "200px",
83
+ maxHeight: "300px"
84
+ })
85
+ }, {
86
+ default: () => [_createVNode(MpPopoverList, {
87
+ "class": css({
88
+ gap: "2",
89
+ alignItems: "flex-start",
90
+ paddingLeft: "3"
91
+ })
92
+ }, {
93
+ default: () => [_createVNode(MpPopoverListItem, {
94
+ "onClick": () => editor == null ? void 0 : editor.chain().focus().toggleHeading({
95
+ level: 1
96
+ }).run(),
97
+ "class": {
98
+ "is-active": editor == null ? void 0 : editor.isActive("heading", {
99
+ level: 1
100
+ }),
101
+ "text-sizing": true
102
+ }
103
+ }, {
104
+ default: () => [_createVNode(MpText, {
105
+ "as": "h1",
106
+ "size": "h1",
107
+ "class": css({
108
+ color: "currentColor"
109
+ })
110
+ }, {
111
+ default: () => [_createTextVNode("Heading 1")]
112
+ })]
113
+ }), _createVNode(MpPopoverListItem, {
114
+ "onClick": () => editor == null ? void 0 : editor.chain().focus().toggleHeading({
115
+ level: 2
116
+ }).run(),
117
+ "class": {
118
+ "is-active": editor == null ? void 0 : editor.isActive("heading", {
119
+ level: 2
120
+ }),
121
+ "text-sizing": true
122
+ }
123
+ }, {
124
+ default: () => [_createVNode(MpText, {
125
+ "as": "h2",
126
+ "size": "h2",
127
+ "class": css({
128
+ color: "currentColor"
129
+ })
130
+ }, {
131
+ default: () => [_createTextVNode("Heading 2")]
132
+ })]
133
+ }), _createVNode(MpPopoverListItem, {
134
+ "onClick": () => editor == null ? void 0 : editor.chain().focus().toggleHeading({
135
+ level: 3
136
+ }).run(),
137
+ "class": {
138
+ "is-active": editor == null ? void 0 : editor.isActive("heading", {
139
+ level: 3
140
+ }),
141
+ "text-sizing": true
142
+ }
143
+ }, {
144
+ default: () => [_createVNode(MpText, {
145
+ "as": "h3",
146
+ "size": "h3",
147
+ "class": css({
148
+ color: "currentColor"
149
+ })
150
+ }, {
151
+ default: () => [_createTextVNode("Heading 3")]
152
+ })]
153
+ }), _createVNode(MpPopoverListItem, {
154
+ "onClick": () => editor == null ? void 0 : editor.chain().focus().setParagraph().run(),
155
+ "class": {
156
+ "is-active": editor == null ? void 0 : editor.isActive("paragraph"),
157
+ "text-sizing": true
158
+ }
159
+ }, {
160
+ default: () => [_createVNode(MpText, {
161
+ "class": css({
162
+ color: "currentColor"
163
+ })
164
+ }, {
165
+ default: () => [_createTextVNode("Normal text")]
166
+ })]
167
+ })]
168
+ })]
169
+ })]
170
+ });
171
+ }
172
+ });
173
+
174
+ export {
175
+ HeadingExtention
176
+ };
@@ -0,0 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ export {
5
+ __name
6
+ };
@@ -0,0 +1,27 @@
1
+ import {
2
+ useRTEStyleProvider
3
+ } from "./chunk-2SSVSEKG.mjs";
4
+ import {
5
+ RTEStyleProviderProps
6
+ } from "./chunk-CENCRLRC.mjs";
7
+
8
+ // src/rte-style-provider.tsx
9
+ import { createVNode as _createVNode } from "vue";
10
+ import { defineComponent } from "vue";
11
+ var MpRTEStyleProvider = defineComponent({
12
+ name: "MpRTEStyleProvider",
13
+ props: RTEStyleProviderProps,
14
+ setup(props, {
15
+ slots
16
+ }) {
17
+ const api = useRTEStyleProvider(props);
18
+ return () => {
19
+ var _a;
20
+ return _createVNode("div", api.value.rootProps, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
21
+ };
22
+ }
23
+ });
24
+
25
+ export {
26
+ MpRTEStyleProvider
27
+ };
@@ -0,0 +1,12 @@
1
+ import * as vue from 'vue';
2
+ import * as vue_jsx_runtime from 'vue/jsx-runtime';
3
+
4
+ declare const EditorToolbar: vue.DefineComponent<{
5
+ editor: ObjectConstructor;
6
+ options: ObjectConstructor;
7
+ }, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
8
+ editor: ObjectConstructor;
9
+ options: ObjectConstructor;
10
+ }>>, {}, {}>;
11
+
12
+ export { EditorToolbar };
@@ -0,0 +1,12 @@
1
+ import * as vue from 'vue';
2
+ import * as vue_jsx_runtime from 'vue/jsx-runtime';
3
+
4
+ declare const EditorToolbar: vue.DefineComponent<{
5
+ editor: ObjectConstructor;
6
+ options: ObjectConstructor;
7
+ }, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
8
+ editor: ObjectConstructor;
9
+ options: ObjectConstructor;
10
+ }>>, {}, {}>;
11
+
12
+ export { EditorToolbar };