sprintify-ui 0.11.34 → 0.12.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.
@@ -2,12 +2,6 @@ import { Size } from '@/utils/sizes';
2
2
  import { ToolbarOption } from '@/types/ToolbarOption';
3
3
  type __VLS_Props = {
4
4
  modelValue: string | null | undefined;
5
- driver?: 'ckeditor' | 'tiptap';
6
- /**
7
- * Defines the CKEditor layout style.
8
- * Only applicable when `driver` is 'ckeditor'.
9
- */
10
- editor?: 'classic' | 'inline' | 'balloon';
11
5
  size?: Size;
12
6
  toolbar?: ToolbarOption[] | string[];
13
7
  placeholder?: string;
@@ -35,7 +29,5 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
35
29
  name: string;
36
30
  hasError: boolean;
37
31
  toolbar: ToolbarOption[] | string[];
38
- editor: "classic" | "inline" | "balloon";
39
- driver: "ckeditor" | "tiptap";
40
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
41
33
  export default _default;
@@ -4,7 +4,8 @@ type __VLS_Props = {
4
4
  hasError?: boolean;
5
5
  disabled?: boolean;
6
6
  placeholder?: string;
7
- toolbar?: string[];
7
+ toolbar?: string[] | 'simple' | 'complete';
8
+ noMargin?: boolean;
8
9
  };
9
10
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
11
  "update:modelValue": (...args: any[]) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.11.34",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "generate-llm-txt": "node scripts/generate-llm-txt.js",
@@ -16,13 +16,11 @@
16
16
  "vue-tsc": "vue-tsc"
17
17
  },
18
18
  "peerDependencies": {
19
- "@ckeditor/ckeditor5-vue": "^7.3.0",
20
19
  "@tailwindcss/aspect-ratio": "^0.4.2",
21
20
  "@tailwindcss/forms": "^0.5.3",
22
21
  "@tailwindcss/typography": "^0.5.8",
23
22
  "@vueuse/core": "^10.0.0",
24
23
  "axios": "^0.26.1 || ^1.0.0",
25
- "ckeditor5": "^47.3.0",
26
24
  "croppie": "^2.6.5",
27
25
  "flatpickr": "^4.6.13",
28
26
  "humanize-duration": "^3.0.0",
@@ -47,7 +45,6 @@
47
45
  },
48
46
  "devDependencies": {
49
47
  "@babel/core": "^7.24.0",
50
- "@ckeditor/ckeditor5-vue": "^7.3.0",
51
48
  "@commitlint/cli": "^17.8.1",
52
49
  "@commitlint/config-conventional": "^17.8.1",
53
50
  "@iconify/vue": "^4.1.1",
@@ -77,7 +74,6 @@
77
74
  "autoprefixer": "^10.4.18",
78
75
  "axios": "^0.26.1",
79
76
  "babel-loader": "^8.3.0",
80
- "ckeditor5": "^47.3.0",
81
77
  "croppie": "^2.6.5",
82
78
  "cz-conventional-changelog": "^3.3.0",
83
79
  "eslint": "^8.57.0",
@@ -1,291 +1,4 @@
1
1
  body {
2
- .base-rich-text {
3
-
4
- &.error {
5
- .ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content, .ck.ck-editor__main > .ck-editor__editable:not(.ck-focused) {
6
- @apply border-red-500;
7
- }
8
- }
9
-
10
- /** Style Prose */
11
- .ck-content {
12
-
13
- @apply p-3.5;
14
-
15
- @apply leading-snug;
16
-
17
- h1, h2, h3, h4, h5, h6 {
18
- @apply font-bold leading-snug tracking-normal;
19
- margin-top: 0;
20
- margin-bottom: 0.375em;
21
- }
22
-
23
- h1 {
24
- @apply text-4xl;
25
- }
26
-
27
- h2 {
28
- @apply text-3xl;
29
- }
30
-
31
- h3 {
32
- @apply text-2xl;
33
- }
34
-
35
- h4 {
36
- @apply text-xl;
37
- }
38
-
39
- h5 {
40
- @apply text-lg;
41
- }
42
-
43
- h6 {
44
- @apply text-base;
45
- }
46
-
47
- p {
48
- @apply text-base leading-snug;
49
- margin: 1em 0;
50
- }
51
-
52
- h1,
53
- h2,
54
- h3,
55
- h4,
56
- h5,
57
- h6,
58
- p {
59
- &:first-child {
60
- margin-top: 0;
61
- }
62
- }
63
-
64
- ol,
65
- ul {
66
- @apply text-base leading-snug;
67
- padding-left: 1.5em;
68
- margin-bottom: 1em;
69
-
70
- li {
71
- @apply leading-snug;
72
- margin: 0.3em 0;
73
-
74
- &::before {
75
- @apply text-slate-500;
76
- width: 2em;
77
- left: 3em;
78
- text-align: left;
79
- position: absolute;
80
- }
81
- }
82
- }
83
-
84
- blockquote {
85
- @apply text-base bg-slate-100;
86
- margin: 1em 0;
87
- padding: 1em;
88
- }
89
-
90
- a {
91
- @apply text-blue-600 underline;
92
- }
93
- }
94
- }
95
-
96
- /* Size: xs */
97
- .base-rich-text-xs {
98
- .ck-content {
99
-
100
- @apply p-2.5;
101
-
102
- h1 {
103
- @apply text-2xl;
104
- }
105
-
106
- h2 {
107
- @apply text-xl;
108
- }
109
-
110
- h3 {
111
- @apply text-lg;
112
- }
113
-
114
- h4 {
115
- @apply text-base;
116
- }
117
-
118
- p {
119
- @apply text-xs;
120
- }
121
-
122
- ol,
123
- ul {
124
- li {
125
- @apply text-xs;
126
- }
127
- }
128
-
129
- blockquote {
130
- @apply text-xs;
131
- }
132
-
133
- pre, .ql-syntax {
134
- @apply text-xs;
135
- }
136
- }
137
-
138
-
139
- }
140
-
141
- /* Size: sm */
142
- .base-rich-text-sm {
143
- .ck-content {
144
-
145
- @apply p-3;
146
-
147
- h1 {
148
- @apply text-3xl;
149
- }
150
-
151
- h2 {
152
- @apply text-2xl;
153
- }
154
-
155
- h3 {
156
- @apply text-xl;
157
- }
158
-
159
- h4 {
160
- @apply text-lg;
161
- }
162
-
163
- p {
164
- @apply text-sm;
165
- }
166
-
167
- ol,
168
- ul {
169
- li {
170
- @apply text-sm;
171
- }
172
- }
173
-
174
- blockquote {
175
- @apply text-sm;
176
- }
177
-
178
- pre, .ql-syntax {
179
- @apply text-sm;
180
- }
181
- }
182
- }
183
-
184
- /* Size: md */
185
- .base-rich-text-md {
186
-
187
- }
188
-
189
- /* Size: lg */
190
- .base-rich-text-lg {
191
- .ck-content {
192
-
193
- @apply p-5;
194
-
195
- h1 {
196
- @apply text-5xl;
197
- }
198
-
199
- h2 {
200
- @apply text-4xl;
201
- }
202
-
203
- h3 {
204
- @apply text-3xl;
205
- }
206
-
207
- h4 {
208
- @apply text-2xl;
209
- }
210
-
211
- p {
212
- @apply text-lg;
213
- }
214
-
215
- ol,
216
- ul {
217
- li {
218
- @apply text-lg;
219
- }
220
- }
221
-
222
- blockquote {
223
- @apply text-lg;
224
- }
225
-
226
- pre, .ql-syntax {
227
- @apply text-lg;
228
- }
229
- }
230
- }
231
-
232
- /* Size: xl */
233
- .base-rich-text-xl {
234
- .ck-content {
235
-
236
- @apply p-6;
237
-
238
- h1 {
239
- @apply text-6xl;
240
- }
241
-
242
- h2 {
243
- @apply text-5xl;
244
- }
245
-
246
- h3 {
247
- @apply text-2xl;
248
- }
249
-
250
- h4 {
251
- @apply text-xl;
252
- }
253
-
254
- p {
255
- @apply text-xl;
256
- }
257
-
258
- ol,
259
- ul {
260
- li {
261
- @apply text-xl;
262
- }
263
- }
264
-
265
- blockquote {
266
- @apply text-xl;
267
- }
268
-
269
- pre, .ql-syntax {
270
- @apply text-xl;
271
- }
272
- }
273
- }
274
-
275
- .base-rich-text-no-margin {
276
- .ck-content {
277
- h1, h2, h3, h4, h5, h6, p, ol, ul {
278
- margin: 0;
279
- }
280
-
281
- ol, ul {
282
- li {
283
- margin: 0;
284
- }
285
- }
286
- }
287
- }
288
- }
289
2
 
290
3
  /** TipTap */
291
4
 
@@ -317,3 +30,16 @@ body .tiptap {
317
30
  pointer-events: none;
318
31
  }
319
32
  }
33
+ }
34
+
35
+ body .tip-tap-no-margin .prose {
36
+ h1, h2, h3, h4, h5, h6, p, ol, ul {
37
+ margin: 0;
38
+ }
39
+
40
+ ol, ul {
41
+ li {
42
+ margin: 0;
43
+ }
44
+ }
45
+ }
@@ -11,9 +11,6 @@
11
11
  /** BaseCropper */
12
12
  @import "croppie/croppie.css";
13
13
 
14
- /** CK Editor */
15
- @import 'ckeditor5/ckeditor5.css';
16
-
17
14
  /** Global styles */
18
15
 
19
16
  @import "./flatpickr.css";
@@ -19,10 +19,6 @@ export default {
19
19
  placeholder: "This is a custom placeholder...",
20
20
  },
21
21
  argTypes: {
22
- driver: {
23
- control: { type: "select" },
24
- options: ["ckeditor", "tiptap"],
25
- },
26
22
  editor: {
27
23
  control: { type: "select" },
28
24
  options: ["classic", "inline", "balloon"],
@@ -47,35 +43,22 @@ const Template = (args) => ({
47
43
  `,
48
44
  });
49
45
 
50
- export const TipTapEditor = Template.bind({});
51
- TipTapEditor.args = {
52
- driver: "tiptap",
53
- };
54
-
55
- export const ClassicEditor = Template.bind({});
56
- ClassicEditor.args = {
57
- editor: "classic",
58
- };
59
-
60
- export const InlineEditor = Template.bind({});
61
- InlineEditor.args = {
62
- editor: "inline",
46
+ export const Demo = Template.bind({});
47
+ Demo.args = {
63
48
  };
64
49
 
65
- export const BalloonEditor = Template.bind({});
66
- BalloonEditor.args = {
67
- editor: "balloon",
50
+ export const NoMargin = Template.bind({});
51
+ NoMargin.args = {
52
+ noMargin: true,
68
53
  };
69
54
 
70
55
  export const CustomToolbar = Template.bind({});
71
56
  CustomToolbar.args = {
72
- editor: "classic",
73
57
  toolbar: [
74
58
  "bold",
75
59
  "italic",
76
60
  "underline",
77
61
  "strikethrough",
78
- "|",
79
62
  "undo",
80
63
  "redo",
81
64
  ]
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div v-if="driver == 'tiptap'">
2
+ <div>
3
3
  <BaseTipTap
4
4
  :model-value="modelValue"
5
5
  :size="sizeInternal"
@@ -7,36 +7,10 @@
7
7
  :has-error="hasErrorInternal"
8
8
  :placeholder="placeholder"
9
9
  :toolbar="toolbar"
10
+ :no-margin="noMargin"
10
11
  @update:model-value="emitUpdate"
11
12
  />
12
13
  </div>
13
- <div
14
- v-else
15
- class="base-rich-text relative"
16
- :class="[
17
- hasErrorInternal ? 'error' : '',
18
- sizeInternal == 'xs' ? 'base-rich-text-xs' : '',
19
- sizeInternal == 'sm' ? 'base-rich-text-sm' : '',
20
- sizeInternal == 'md' ? 'base-rich-text-base' : '',
21
- sizeInternal == 'lg' ? 'base-rich-text-lg' : '',
22
- sizeInternal == 'xl' ? 'base-rich-text-xl' : '',
23
- props.noMargin ? 'base-rich-text-no-margin' : '',
24
- ]"
25
- >
26
- <BaseCkeditor
27
- ref="baseCkeditorRef"
28
- :model-value="modelValue"
29
- :editor="editor"
30
- :size="sizeInternal"
31
- :toolbar="toolbar"
32
- :placeholder="placeholder"
33
- :disabled="disabled"
34
- @update:model-value="emitUpdate"
35
- @focus="emit('focus', $event)"
36
- @blur="emit('blur', $event)"
37
- @input="emit('input', $event)"
38
- />
39
- </div>
40
14
  </template>
41
15
 
42
16
  <script lang="ts" setup>
@@ -45,16 +19,8 @@ import { Size } from '@/utils/sizes';
45
19
  import { ToolbarOption } from '@/types/ToolbarOption';
46
20
  import BaseTipTap from './BaseTipTap.vue';
47
21
 
48
- const BaseCkeditor = defineAsyncComponent(() => import('./BaseCkeditor.vue'));
49
-
50
22
  const props = withDefaults(defineProps<{
51
23
  modelValue: string | null | undefined;
52
- driver?: 'ckeditor' | 'tiptap';
53
- /**
54
- * Defines the CKEditor layout style.
55
- * Only applicable when `driver` is 'ckeditor'.
56
- */
57
- editor?: 'classic' | 'inline' | 'balloon';
58
24
  size?: Size;
59
25
  toolbar?: ToolbarOption[] | string[];
60
26
  placeholder?: string;
@@ -64,7 +30,6 @@ const props = withDefaults(defineProps<{
64
30
  hasError?: boolean;
65
31
  noMargin?: boolean;
66
32
  }>(), {
67
- driver: 'ckeditor',
68
33
  editor: 'classic',
69
34
  size: 'md',
70
35
  toolbar: undefined,
@@ -77,7 +42,7 @@ const props = withDefaults(defineProps<{
77
42
 
78
43
  const emit = defineEmits(['update:modelValue', 'focus', 'blur', 'input']);
79
44
 
80
- const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate, sizeInternal, addBeforeSubmitListener } =
45
+ const { hasErrorInternal, emitUpdate, sizeInternal } =
81
46
  useField({
82
47
  name: computed(() => props.name),
83
48
  required: computed(() => props.required),
@@ -86,19 +51,4 @@ const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate, sizeIntern
86
51
  emit: emit,
87
52
  });
88
53
 
89
- const baseCkeditorRef = ref<InstanceType<typeof BaseCkeditor> | null>(null);
90
-
91
- // This make sure that the latest editor data is emitted when the form is submitted
92
- // If the user types really fast, then press submit really fast, the editor data might not be up to date
93
- // This is a workaround to make sure that the latest data is emitted
94
- addBeforeSubmitListener(() => {
95
- if (!baseCkeditorRef.value) {
96
- return;
97
- }
98
-
99
- const latestData = baseCkeditorRef.value.getEditorData();
100
-
101
- emitUpdate(latestData);
102
- });
103
-
104
54
  </script>
@@ -3,6 +3,7 @@
3
3
  class="border rounded-md overflow-hidden bg-white || tiptap"
4
4
  :class="[
5
5
  hasError ? 'border-red-500' : 'border-slate-300',
6
+ noMargin ? 'tip-tap-no-margin' : ''
6
7
  ]"
7
8
  >
8
9
  <div class="divide-x px-1 py-1 border-b flex">
@@ -23,7 +24,7 @@
23
24
 
24
25
  <div
25
26
  class="bg-white p-5"
26
- :class="[disabled ? 'cursor-not-allowed' : '']"
27
+ :class="[disabled ? 'cursor-not-allowed opacity-80' : '']"
27
28
  >
28
29
  <editor-content
29
30
  v-if="editor"
@@ -39,6 +40,7 @@ import Document from '@tiptap/extension-document';
39
40
  import Link from '@tiptap/extension-link';
40
41
  import Superscript from '@tiptap/extension-superscript';
41
42
  import Subscript from '@tiptap/extension-subscript';
43
+ import Strike from '@tiptap/extension-strike'
42
44
  import { Placeholder } from '@tiptap/extensions'
43
45
  import { Footnotes, FootnoteReference, Footnote } from "tiptap-footnotes";
44
46
  import StarterKit from '@tiptap/starter-kit';
@@ -51,7 +53,8 @@ const props = defineProps<{
51
53
  hasError?: boolean;
52
54
  disabled?: boolean;
53
55
  placeholder?: string;
54
- toolbar?: string[];
56
+ toolbar?: string[] | 'simple' | 'complete';
57
+ noMargin?: boolean;
55
58
  }>();
56
59
 
57
60
  const editor = new Editor({
@@ -72,6 +75,7 @@ const editor = new Editor({
72
75
  Placeholder.configure({
73
76
  placeholder: props.placeholder || 'Start typing here...',
74
77
  }),
78
+ Strike,
75
79
  Superscript,
76
80
  Subscript,
77
81
  Footnotes,
@@ -223,6 +227,11 @@ const actions = computed<Action[]>(() => {
223
227
  icon: 'material-symbols:format-underlined',
224
228
  command: () => editor.chain().focus().toggleUnderline().run(),
225
229
  },
230
+ {
231
+ name: 'strikethrough',
232
+ icon: 'material-symbols:strikethrough-s',
233
+ command: () => editor.chain().focus().toggleStrike().run(),
234
+ },
226
235
  {
227
236
  name: 'superscript',
228
237
  icon: 'material-symbols:superscript',
@@ -267,12 +276,38 @@ const actions = computed<Action[]>(() => {
267
276
  ];
268
277
  });
269
278
 
279
+ const toolbarTemplates: Record<string, string[]> = {
280
+ simple: ['bold', 'italic', 'underline', 'link'],
281
+ complete: [
282
+ 'undo',
283
+ 'redo',
284
+ 'paragraph',
285
+ 'heading-2',
286
+ 'heading-3',
287
+ 'bold',
288
+ 'italic',
289
+ 'underline',
290
+ 'superscript',
291
+ 'subscript',
292
+ 'link',
293
+ 'unlink',
294
+ 'bulletList',
295
+ 'orderedList',
296
+ 'footnote',
297
+ 'nonBreakingSpace',
298
+ ],
299
+ };
300
+
270
301
  const filteredActions = computed(() => {
271
302
  if (!props.toolbar || props.toolbar.length === 0) {
272
303
  return actions.value;
273
304
  }
274
305
 
275
- return actions.value.filter(action => props.toolbar?.includes(action.name));
306
+ const toolbar = typeof props.toolbar === 'string'
307
+ ? toolbarTemplates[props.toolbar] ?? []
308
+ : props.toolbar;
309
+
310
+ return actions.value.filter(action => toolbar.includes(action.name));
276
311
  });
277
312
 
278
313
  </script>