@vizel/core 0.0.1-alpha.1 → 0.0.1-alpha.3

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 (71) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.ts +13 -13
  3. package/dist/index.js +141 -141
  4. package/dist/index10.js +70 -110
  5. package/dist/index11.js +135 -168
  6. package/dist/index12.js +83 -74
  7. package/dist/index13.js +13 -134
  8. package/dist/index14.js +13 -146
  9. package/dist/index15.js +303 -15
  10. package/dist/index16.js +69 -14
  11. package/dist/index17.js +26 -295
  12. package/dist/index18.js +2 -2
  13. package/dist/index19.js +355 -24
  14. package/dist/index20.js +25 -264
  15. package/dist/index21.js +85 -68
  16. package/dist/index22.js +97 -353
  17. package/dist/index23.js +66 -84
  18. package/dist/index24.js +12 -36
  19. package/dist/index25.js +53 -92
  20. package/dist/index26.js +132 -96
  21. package/dist/index27.js +59 -126
  22. package/dist/index28.js +37 -53
  23. package/dist/index29.js +19 -62
  24. package/dist/index3.js +165 -60
  25. package/dist/index30.js +9 -37
  26. package/dist/index31.js +143 -19
  27. package/dist/index32.js +264 -11
  28. package/dist/index33.js +92 -9
  29. package/dist/index34.js +63 -16
  30. package/dist/index35.js +4 -58
  31. package/dist/index36.js +123 -15
  32. package/dist/index37.js +305 -42
  33. package/dist/index38.js +487 -4
  34. package/dist/index39.js +37 -112
  35. package/dist/index4.js +10 -86
  36. package/dist/index40.js +653 -301
  37. package/dist/index41.js +4 -487
  38. package/dist/index42.js +4 -48
  39. package/dist/index43.js +206 -642
  40. package/dist/index44.js +82 -4
  41. package/dist/index45.js +17 -4
  42. package/dist/index46.js +57 -237
  43. package/dist/index47.js +15 -82
  44. package/dist/index48.js +190 -274
  45. package/dist/index49.js +281 -1497
  46. package/dist/index5.js +132 -10
  47. package/dist/index50.js +1502 -5
  48. package/dist/index51.js +5 -1561
  49. package/dist/index52.js +1551 -192
  50. package/dist/index53.js +1 -1
  51. package/dist/index54.js +84 -21
  52. package/dist/index55.js +246 -10
  53. package/dist/index56.js +3 -7
  54. package/dist/index57.js +1231 -7
  55. package/dist/index58.js +731 -11
  56. package/dist/index59.js +21 -19
  57. package/dist/index6.js +48 -131
  58. package/dist/index60.js +10 -25
  59. package/dist/index61.js +6 -83
  60. package/dist/index62.js +7 -245
  61. package/dist/index63.js +11 -1229
  62. package/dist/index64.js +17 -732
  63. package/dist/index65.js +25 -3
  64. package/dist/index66.js +53 -1059
  65. package/dist/index67.js +1059 -53
  66. package/dist/index69.js +90 -3
  67. package/dist/index7.js +228 -409
  68. package/dist/index70.js +3 -90
  69. package/dist/index8.js +111 -45
  70. package/dist/index9.js +409 -228
  71. package/package.json +54 -80
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Seiji Kohara
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -2575,17 +2575,14 @@ export { }
2575
2575
 
2576
2576
  declare module "@tiptap/core" {
2577
2577
  interface Commands<ReturnType> {
2578
- embed: {
2578
+ diagram: {
2579
2579
  /**
2580
- * Set an embed from URL
2580
+ * Insert a diagram block
2581
2581
  */
2582
- setEmbed: (options: {
2583
- url: string;
2582
+ insertDiagram: (options: {
2583
+ code: string;
2584
+ type?: VizelDiagramType;
2584
2585
  }) => ReturnType;
2585
- /**
2586
- * Update embed data
2587
- */
2588
- updateEmbed: (data: Partial<VizelEmbedData>) => ReturnType;
2589
2586
  };
2590
2587
  }
2591
2588
  }
@@ -2609,14 +2606,17 @@ declare module "@tiptap/core" {
2609
2606
 
2610
2607
  declare module "@tiptap/core" {
2611
2608
  interface Commands<ReturnType> {
2612
- diagram: {
2609
+ embed: {
2613
2610
  /**
2614
- * Insert a diagram block
2611
+ * Set an embed from URL
2615
2612
  */
2616
- insertDiagram: (options: {
2617
- code: string;
2618
- type?: VizelDiagramType;
2613
+ setEmbed: (options: {
2614
+ url: string;
2619
2615
  }) => ReturnType;
2616
+ /**
2617
+ * Update embed data
2618
+ */
2619
+ updateEmbed: (data: Partial<VizelEmbedData>) => ReturnType;
2620
2620
  };
2621
2621
  }
2622
2622
  }
package/dist/index.js CHANGED
@@ -1,150 +1,150 @@
1
1
  import { BubbleMenuPlugin as r } from "@tiptap/extension-bubble-menu";
2
2
  import { VIZEL_DEFAULT_AUTO_SAVE_OPTIONS as o, createVizelAutoSaveHandlers as t, formatVizelRelativeTime as i, getVizelStorageBackend as n } from "./index2.js";
3
- import { VIZEL_DEFAULT_THEME as z, VIZEL_DEFAULT_THEME_STORAGE_KEY as s, VIZEL_THEME_DATA_ATTRIBUTE as m, applyVizelTheme as d, createVizelSystemThemeListener as E, getStoredVizelTheme as p, getVizelSystemTheme as c, getVizelThemeInitScript as x, resolveVizelTheme as f, storeVizelTheme as g } from "./index3.js";
4
- import { VIZEL_HIGHLIGHT_COLORS as T, VIZEL_TEXT_COLORS as _, addVizelRecentColor as u, createVizelTextColorExtensions as h, getVizelRecentColors as L } from "./index4.js";
5
- import { createVizelCharacterCountExtension as C } from "./index5.js";
6
- import { createVizelCodeBlockExtension as M, findVizelLanguage as v, getAllVizelLanguageIds as A, getVizelRegisteredLanguages as P } from "./index6.js";
7
- import { VizelEmbed as U, createVizelDefaultFetchEmbedData as O, createVizelEmbedExtension as R, detectVizelEmbedProvider as b, vizelDefaultEmbedProviders as k, vizelEmbedPastePluginKey as Z } from "./index7.js";
8
- import { createVizelDetailsExtensions as B } from "./index8.js";
9
- import { VizelDiagram as G, createVizelDiagramExtension as N } from "./index9.js";
10
- import { VizelBlockMoveKeymap as K, createVizelDragHandleExtension as W, createVizelDragHandleExtensions as X } from "./index10.js";
11
- import { createVizelExtensions as j } from "./index11.js";
12
- import { VIZEL_DEFAULT_FILE_MIME_TYPES as J, createVizelFileHandlerExtension as Q, createVizelImageFileHandlers as $, filterVizelFilesByMimeType as ee } from "./index12.js";
13
- import { createVizelImageExtension as re, createVizelImageUploadExtensions as ae, createVizelImageUploadWithFileHandler as oe, vizelDefaultBase64Upload as te } from "./index13.js";
14
- import { createVizelImageUploadPlugin as ne, createVizelImageUploader as Ve, getVizelImageUploadPluginKey as ze, handleVizelImageDrop as se, handleVizelImagePaste as me, validateVizelImageFile as de } from "./index14.js";
15
- import { createVizelLinkExtension as pe } from "./index15.js";
16
- import { VizelMarkdown as xe, createVizelMarkdownExtension as fe } from "./index16.js";
17
- import { VizelMathBlock as Ie, VizelMathInline as Te, createVizelMathematicsExtensions as _e } from "./index17.js";
18
- import { createVizelTableExtensions as he } from "./index18.js";
19
- import { createVizelTaskListExtensions as Se } from "./index19.js";
20
- import { filterSlashCommands as De, flattenSlashCommandGroups as Me, groupSlashCommands as ve, searchSlashCommands as Ae, defaultGroupOrder as Pe, defaultSlashCommands as He } from "./index20.js";
21
- import { getVizelActiveNodeType as Oe, vizelDefaultNodeTypes as Re } from "./index21.js";
22
- import { VIZEL_TABLE_MENU_ITEMS as ke, VizelTableWithControls as Ze } from "./index22.js";
23
- import { default as Be } from "@tiptap/extension-drag-handle";
24
- import { default as Ge } from "@tiptap/extension-image";
25
- import { VizelResizableImage as we, VizelResizableImage as Ke } from "./index23.js";
26
- import { VizelSlashCommand as Xe } from "./index24.js";
27
- import { VizelTable as je, VizelTableCell as qe, VizelTableHeader as Je } from "./index25.js";
28
- import { getVizelIconId as $e, initVizelIconRenderer as el, renderVizelIcon as ll, renderVizelIconSvg as rl, setVizelIconRenderer as al, vizelDefaultIconIds as ol } from "./index26.js";
29
- import { VIZEL_UPLOAD_IMAGE_EVENT as il, convertVizelCodeBlocksToDiagrams as nl, createVizelUploadEventHandler as Vl, getVizelEditorState as zl, registerVizelUploadEventHandler as sl, resolveVizelFeatures as ml, transformVizelDiagramCodeBlocks as dl, vizelDefaultEditorProps as El } from "./index27.js";
30
- import { createVizelEditorInstance as cl } from "./index28.js";
31
- import { VIZEL_DEFAULT_MARKDOWN_DEBOUNCE_MS as fl, createVizelMarkdownSyncHandlers as gl, getVizelMarkdown as Il, initializeVizelMarkdownContent as Tl, parseVizelMarkdown as _l, setVizelMarkdown as ul } from "./index29.js";
32
- import { VIZEL_PORTAL_ID as Ll, VIZEL_PORTAL_Z_INDEX as Sl, createVizelPortalElement as Cl, getVizelPortalContainer as Dl, hasVizelPortalContainer as Ml, mountToVizelPortal as vl, removeVizelPortalContainer as Al, unmountFromVizelPortal as Pl } from "./index30.js";
33
- import { VIZEL_SUGGESTION_Z_INDEX as Ul, createVizelSuggestionContainer as Ol, handleVizelSuggestionEscape as Rl } from "./index31.js";
34
- import { isVizelValidHexColor as kl, normalizeVizelHexColor as Zl } from "./index32.js";
35
- import { splitVizelTextByMatches as Bl } from "./index33.js";
3
+ import { createVizelExtensions as z } from "./index3.js";
4
+ import { createVizelCharacterCountExtension as m } from "./index4.js";
5
+ import { createVizelCodeBlockExtension as E, findVizelLanguage as p, getAllVizelLanguageIds as c, getVizelRegisteredLanguages as x } from "./index5.js";
6
+ import { createVizelDetailsExtensions as g } from "./index6.js";
7
+ import { VizelDiagram as T, createVizelDiagramExtension as _ } from "./index7.js";
8
+ import { VizelBlockMoveKeymap as h, createVizelDragHandleExtension as L, createVizelDragHandleExtensions as S } from "./index8.js";
9
+ import { VizelEmbed as D, createVizelDefaultFetchEmbedData as M, createVizelEmbedExtension as v, detectVizelEmbedProvider as A, vizelDefaultEmbedProviders as P, vizelEmbedPastePluginKey as H } from "./index9.js";
10
+ import { VIZEL_DEFAULT_FILE_MIME_TYPES as O, createVizelFileHandlerExtension as R, createVizelImageFileHandlers as b, filterVizelFilesByMimeType as k } from "./index10.js";
11
+ import { createVizelImageExtension as F, createVizelImageUploadExtensions as B, createVizelImageUploadWithFileHandler as y, vizelDefaultBase64Upload as G } from "./index11.js";
12
+ import { VizelResizableImage as w, VizelResizableImage as K } from "./index12.js";
13
+ import { createVizelLinkExtension as X } from "./index13.js";
14
+ import { VizelMarkdown as j, createVizelMarkdownExtension as q } from "./index14.js";
15
+ import { VizelMathBlock as Q, VizelMathInline as $, createVizelMathematicsExtensions as ee } from "./index15.js";
16
+ import { getVizelActiveNodeType as re, vizelDefaultNodeTypes as ae } from "./index16.js";
17
+ import { VizelSlashCommand as te } from "./index17.js";
18
+ import { createVizelTableExtensions as ne } from "./index18.js";
19
+ import { VIZEL_TABLE_MENU_ITEMS as ze, VizelTableWithControls as se } from "./index19.js";
20
+ import { createVizelTaskListExtensions as de } from "./index20.js";
21
+ import { VIZEL_HIGHLIGHT_COLORS as pe, VIZEL_TEXT_COLORS as ce, addVizelRecentColor as xe, createVizelTextColorExtensions as fe, getVizelRecentColors as ge } from "./index21.js";
22
+ import { getVizelIconId as Te, initVizelIconRenderer as _e, renderVizelIcon as ue, renderVizelIconSvg as he, setVizelIconRenderer as Le, vizelDefaultIconIds as Se } from "./index22.js";
23
+ import { VIZEL_DEFAULT_THEME as De, VIZEL_DEFAULT_THEME_STORAGE_KEY as Me, VIZEL_THEME_DATA_ATTRIBUTE as ve, applyVizelTheme as Ae, createVizelSystemThemeListener as Pe, getStoredVizelTheme as He, getVizelSystemTheme as Ue, getVizelThemeInitScript as Oe, resolveVizelTheme as Re, storeVizelTheme as be } from "./index23.js";
24
+ import { isVizelValidHexColor as Ze, normalizeVizelHexColor as Fe } from "./index24.js";
25
+ import { createVizelEditorInstance as ye } from "./index25.js";
26
+ import { VIZEL_UPLOAD_IMAGE_EVENT as Ne, convertVizelCodeBlocksToDiagrams as we, createVizelUploadEventHandler as Ke, getVizelEditorState as We, registerVizelUploadEventHandler as Xe, resolveVizelFeatures as Ye, transformVizelDiagramCodeBlocks as je, vizelDefaultEditorProps as qe } from "./index26.js";
27
+ import { VIZEL_DEFAULT_MARKDOWN_DEBOUNCE_MS as Qe, createVizelMarkdownSyncHandlers as $e, getVizelMarkdown as el, initializeVizelMarkdownContent as ll, parseVizelMarkdown as rl, setVizelMarkdown as al } from "./index27.js";
28
+ import { VIZEL_PORTAL_ID as tl, VIZEL_PORTAL_Z_INDEX as il, createVizelPortalElement as nl, getVizelPortalContainer as Vl, hasVizelPortalContainer as zl, mountToVizelPortal as sl, removeVizelPortalContainer as ml, unmountFromVizelPortal as dl } from "./index28.js";
29
+ import { VIZEL_SUGGESTION_Z_INDEX as pl, createVizelSuggestionContainer as cl, handleVizelSuggestionEscape as xl } from "./index29.js";
30
+ import { splitVizelTextByMatches as gl } from "./index30.js";
31
+ import { createVizelImageUploadPlugin as Tl, createVizelImageUploader as _l, getVizelImageUploadPluginKey as ul, handleVizelImageDrop as hl, handleVizelImagePaste as Ll, validateVizelImageFile as Sl } from "./index31.js";
32
+ import { filterSlashCommands as Dl, flattenSlashCommandGroups as Ml, groupSlashCommands as vl, searchSlashCommands as Al, defaultGroupOrder as Pl, defaultSlashCommands as Hl } from "./index32.js";
33
+ import { default as Ol } from "@tiptap/extension-drag-handle";
34
+ import { default as bl } from "@tiptap/extension-image";
35
+ import { VizelTable as Zl, VizelTableCell as Fl, VizelTableHeader as Bl } from "./index33.js";
36
36
  export {
37
37
  r as BubbleMenuPlugin,
38
38
  o as VIZEL_DEFAULT_AUTO_SAVE_OPTIONS,
39
- J as VIZEL_DEFAULT_FILE_MIME_TYPES,
40
- fl as VIZEL_DEFAULT_MARKDOWN_DEBOUNCE_MS,
41
- z as VIZEL_DEFAULT_THEME,
42
- s as VIZEL_DEFAULT_THEME_STORAGE_KEY,
43
- T as VIZEL_HIGHLIGHT_COLORS,
44
- Ll as VIZEL_PORTAL_ID,
45
- Sl as VIZEL_PORTAL_Z_INDEX,
46
- Ul as VIZEL_SUGGESTION_Z_INDEX,
47
- ke as VIZEL_TABLE_MENU_ITEMS,
48
- _ as VIZEL_TEXT_COLORS,
49
- m as VIZEL_THEME_DATA_ATTRIBUTE,
50
- il as VIZEL_UPLOAD_IMAGE_EVENT,
51
- K as VizelBlockMoveKeymap,
52
- G as VizelDiagram,
53
- Be as VizelDragHandle,
54
- U as VizelEmbed,
55
- Ge as VizelImage,
56
- we as VizelImageResize,
57
- xe as VizelMarkdown,
58
- Ie as VizelMathBlock,
59
- Te as VizelMathInline,
60
- Ke as VizelResizableImage,
61
- Xe as VizelSlashCommand,
62
- je as VizelTable,
63
- qe as VizelTableCell,
64
- Je as VizelTableHeader,
65
- Ze as VizelTableWithControls,
66
- u as addVizelRecentColor,
67
- d as applyVizelTheme,
68
- nl as convertVizelCodeBlocksToDiagrams,
39
+ O as VIZEL_DEFAULT_FILE_MIME_TYPES,
40
+ Qe as VIZEL_DEFAULT_MARKDOWN_DEBOUNCE_MS,
41
+ De as VIZEL_DEFAULT_THEME,
42
+ Me as VIZEL_DEFAULT_THEME_STORAGE_KEY,
43
+ pe as VIZEL_HIGHLIGHT_COLORS,
44
+ tl as VIZEL_PORTAL_ID,
45
+ il as VIZEL_PORTAL_Z_INDEX,
46
+ pl as VIZEL_SUGGESTION_Z_INDEX,
47
+ ze as VIZEL_TABLE_MENU_ITEMS,
48
+ ce as VIZEL_TEXT_COLORS,
49
+ ve as VIZEL_THEME_DATA_ATTRIBUTE,
50
+ Ne as VIZEL_UPLOAD_IMAGE_EVENT,
51
+ h as VizelBlockMoveKeymap,
52
+ T as VizelDiagram,
53
+ Ol as VizelDragHandle,
54
+ D as VizelEmbed,
55
+ bl as VizelImage,
56
+ w as VizelImageResize,
57
+ j as VizelMarkdown,
58
+ Q as VizelMathBlock,
59
+ $ as VizelMathInline,
60
+ K as VizelResizableImage,
61
+ te as VizelSlashCommand,
62
+ Zl as VizelTable,
63
+ Fl as VizelTableCell,
64
+ Bl as VizelTableHeader,
65
+ se as VizelTableWithControls,
66
+ xe as addVizelRecentColor,
67
+ Ae as applyVizelTheme,
68
+ we as convertVizelCodeBlocksToDiagrams,
69
69
  t as createVizelAutoSaveHandlers,
70
- C as createVizelCharacterCountExtension,
71
- M as createVizelCodeBlockExtension,
72
- O as createVizelDefaultFetchEmbedData,
73
- B as createVizelDetailsExtensions,
74
- N as createVizelDiagramExtension,
75
- W as createVizelDragHandleExtension,
76
- X as createVizelDragHandleExtensions,
77
- cl as createVizelEditorInstance,
78
- R as createVizelEmbedExtension,
79
- j as createVizelExtensions,
80
- Q as createVizelFileHandlerExtension,
81
- re as createVizelImageExtension,
82
- $ as createVizelImageFileHandlers,
83
- ae as createVizelImageUploadExtensions,
84
- ne as createVizelImageUploadPlugin,
85
- oe as createVizelImageUploadWithFileHandler,
86
- Ve as createVizelImageUploader,
87
- pe as createVizelLinkExtension,
88
- fe as createVizelMarkdownExtension,
89
- gl as createVizelMarkdownSyncHandlers,
90
- _e as createVizelMathematicsExtensions,
91
- Cl as createVizelPortalElement,
92
- Ol as createVizelSuggestionContainer,
93
- E as createVizelSystemThemeListener,
94
- he as createVizelTableExtensions,
95
- Se as createVizelTaskListExtensions,
96
- h as createVizelTextColorExtensions,
97
- Vl as createVizelUploadEventHandler,
98
- b as detectVizelEmbedProvider,
99
- ee as filterVizelFilesByMimeType,
100
- De as filterVizelSlashCommands,
101
- v as findVizelLanguage,
102
- Me as flattenVizelSlashCommandGroups,
70
+ m as createVizelCharacterCountExtension,
71
+ E as createVizelCodeBlockExtension,
72
+ M as createVizelDefaultFetchEmbedData,
73
+ g as createVizelDetailsExtensions,
74
+ _ as createVizelDiagramExtension,
75
+ L as createVizelDragHandleExtension,
76
+ S as createVizelDragHandleExtensions,
77
+ ye as createVizelEditorInstance,
78
+ v as createVizelEmbedExtension,
79
+ z as createVizelExtensions,
80
+ R as createVizelFileHandlerExtension,
81
+ F as createVizelImageExtension,
82
+ b as createVizelImageFileHandlers,
83
+ B as createVizelImageUploadExtensions,
84
+ Tl as createVizelImageUploadPlugin,
85
+ y as createVizelImageUploadWithFileHandler,
86
+ _l as createVizelImageUploader,
87
+ X as createVizelLinkExtension,
88
+ q as createVizelMarkdownExtension,
89
+ $e as createVizelMarkdownSyncHandlers,
90
+ ee as createVizelMathematicsExtensions,
91
+ nl as createVizelPortalElement,
92
+ cl as createVizelSuggestionContainer,
93
+ Pe as createVizelSystemThemeListener,
94
+ ne as createVizelTableExtensions,
95
+ de as createVizelTaskListExtensions,
96
+ fe as createVizelTextColorExtensions,
97
+ Ke as createVizelUploadEventHandler,
98
+ A as detectVizelEmbedProvider,
99
+ k as filterVizelFilesByMimeType,
100
+ Dl as filterVizelSlashCommands,
101
+ p as findVizelLanguage,
102
+ Ml as flattenVizelSlashCommandGroups,
103
103
  i as formatVizelRelativeTime,
104
- A as getAllVizelLanguageIds,
105
- p as getStoredVizelTheme,
106
- Oe as getVizelActiveNodeType,
107
- zl as getVizelEditorState,
108
- $e as getVizelIconId,
109
- ze as getVizelImageUploadPluginKey,
110
- Il as getVizelMarkdown,
111
- Dl as getVizelPortalContainer,
112
- L as getVizelRecentColors,
113
- P as getVizelRegisteredLanguages,
104
+ c as getAllVizelLanguageIds,
105
+ He as getStoredVizelTheme,
106
+ re as getVizelActiveNodeType,
107
+ We as getVizelEditorState,
108
+ Te as getVizelIconId,
109
+ ul as getVizelImageUploadPluginKey,
110
+ el as getVizelMarkdown,
111
+ Vl as getVizelPortalContainer,
112
+ ge as getVizelRecentColors,
113
+ x as getVizelRegisteredLanguages,
114
114
  n as getVizelStorageBackend,
115
- c as getVizelSystemTheme,
116
- x as getVizelThemeInitScript,
117
- ve as groupVizelSlashCommands,
118
- se as handleVizelImageDrop,
119
- me as handleVizelImagePaste,
120
- Rl as handleVizelSuggestionEscape,
121
- Ml as hasVizelPortalContainer,
122
- el as initVizelIconRenderer,
123
- Tl as initializeVizelMarkdownContent,
124
- kl as isVizelValidHexColor,
125
- vl as mountToVizelPortal,
126
- Zl as normalizeVizelHexColor,
127
- _l as parseVizelMarkdown,
128
- sl as registerVizelUploadEventHandler,
129
- Al as removeVizelPortalContainer,
130
- ll as renderVizelIcon,
131
- rl as renderVizelIconSvg,
132
- ml as resolveVizelFeatures,
133
- f as resolveVizelTheme,
134
- Ae as searchVizelSlashCommands,
135
- al as setVizelIconRenderer,
136
- ul as setVizelMarkdown,
137
- Bl as splitVizelTextByMatches,
138
- g as storeVizelTheme,
139
- dl as transformVizelDiagramCodeBlocks,
140
- Pl as unmountFromVizelPortal,
141
- de as validateVizelImageFile,
142
- te as vizelDefaultBase64Upload,
143
- El as vizelDefaultEditorProps,
144
- k as vizelDefaultEmbedProviders,
145
- Pe as vizelDefaultGroupOrder,
146
- ol as vizelDefaultIconIds,
147
- Re as vizelDefaultNodeTypes,
148
- He as vizelDefaultSlashCommands,
149
- Z as vizelEmbedPastePluginKey
115
+ Ue as getVizelSystemTheme,
116
+ Oe as getVizelThemeInitScript,
117
+ vl as groupVizelSlashCommands,
118
+ hl as handleVizelImageDrop,
119
+ Ll as handleVizelImagePaste,
120
+ xl as handleVizelSuggestionEscape,
121
+ zl as hasVizelPortalContainer,
122
+ _e as initVizelIconRenderer,
123
+ ll as initializeVizelMarkdownContent,
124
+ Ze as isVizelValidHexColor,
125
+ sl as mountToVizelPortal,
126
+ Fe as normalizeVizelHexColor,
127
+ rl as parseVizelMarkdown,
128
+ Xe as registerVizelUploadEventHandler,
129
+ ml as removeVizelPortalContainer,
130
+ ue as renderVizelIcon,
131
+ he as renderVizelIconSvg,
132
+ Ye as resolveVizelFeatures,
133
+ Re as resolveVizelTheme,
134
+ Al as searchVizelSlashCommands,
135
+ Le as setVizelIconRenderer,
136
+ al as setVizelMarkdown,
137
+ gl as splitVizelTextByMatches,
138
+ be as storeVizelTheme,
139
+ je as transformVizelDiagramCodeBlocks,
140
+ dl as unmountFromVizelPortal,
141
+ Sl as validateVizelImageFile,
142
+ G as vizelDefaultBase64Upload,
143
+ qe as vizelDefaultEditorProps,
144
+ P as vizelDefaultEmbedProviders,
145
+ Pl as vizelDefaultGroupOrder,
146
+ Se as vizelDefaultIconIds,
147
+ ae as vizelDefaultNodeTypes,
148
+ Hl as vizelDefaultSlashCommands,
149
+ H as vizelEmbedPastePluginKey
150
150
  };
package/dist/index10.js CHANGED
@@ -1,118 +1,78 @@
1
- import { Extension as f } from "@tiptap/core";
2
- import p from "@tiptap/extension-drag-handle";
3
- import { default as B } from "@tiptap/extension-drag-handle";
4
- import { renderVizelIcon as m } from "./index26.js";
5
- import { TextSelection as a } from "./index41.js";
6
- function v(e = {}) {
7
- const { enabled: o = !0 } = e;
8
- if (!o)
9
- return f.create({ name: "vizelDragHandleDisabled" });
10
- let r = null;
11
- return p.configure({
12
- render() {
13
- const t = document.createElement("div");
14
- t.classList.add("vizel-drag-handle"), t.setAttribute("data-vizel-drag-handle", ""), t.setAttribute("draggable", "true"), t.setAttribute("aria-label", "Drag to reorder block"), t.setAttribute("role", "button");
15
- const n = document.createElement("div");
16
- return n.classList.add("vizel-drag-handle-grip"), n.innerHTML = m("grip", { width: 14, height: 14 }), t.appendChild(n), r = t, t;
17
- },
18
- onNodeChange({ node: t }) {
19
- r && (t ? r.classList.add("is-visible") : r.classList.remove("is-visible"));
20
- },
21
- computePositionConfig: {
22
- placement: "left"
1
+ import { FileHandler as d } from "./index39.js";
2
+ const g = [
3
+ "image/jpeg",
4
+ "image/png",
5
+ "image/gif",
6
+ "image/webp",
7
+ "image/svg+xml"
8
+ ], m = 20 * 1024 * 1024;
9
+ function c(l, r) {
10
+ return l.filter((i) => r.includes(i.type) ? !0 : r.some((t) => {
11
+ if (t.endsWith("/*")) {
12
+ const n = t.slice(0, -2);
13
+ return i.type.startsWith(`${n}/`);
23
14
  }
24
- });
15
+ return !1;
16
+ }));
25
17
  }
26
- const b = /* @__PURE__ */ new Set(["listItem", "taskItem"]);
27
- function u(e) {
28
- for (let o = e.depth; o > 0; o--) {
29
- const r = e.node(o), t = r.type.name;
30
- if (b.has(t))
31
- return {
32
- pos: e.before(o),
33
- node: r,
34
- depth: o
35
- };
36
- }
37
- if (e.depth >= 1) {
38
- const o = e.node(1);
39
- return {
40
- pos: e.before(1),
41
- node: o,
42
- depth: 1
43
- };
44
- }
45
- return null;
46
- }
47
- function g(e, o) {
48
- const r = e.doc.resolve(o.pos), t = r.depth, n = r.start(t), i = r.parent;
49
- let d = n, l = -1;
50
- for (let s = 0; s < i.childCount; s++) {
51
- if (d === o.pos) {
52
- l = s;
53
- break;
18
+ function p(l = {}) {
19
+ const { allowedMimeTypes: r = g, onPaste: i, onDrop: a, onError: t } = l;
20
+ return d.configure({
21
+ allowedMimeTypes: r,
22
+ onPaste: (n, e, o) => {
23
+ if (e.length === 0)
24
+ return;
25
+ const s = c(e, r);
26
+ if (s.length === 0) {
27
+ t?.({
28
+ type: "invalid_mime_type",
29
+ message: `No files with allowed MIME types. Allowed: ${r.join(", ")}`,
30
+ files: e
31
+ });
32
+ return;
33
+ }
34
+ i?.(n, s, o);
35
+ },
36
+ onDrop: (n, e, o) => {
37
+ if (e.length === 0)
38
+ return;
39
+ const s = c(e, r);
40
+ if (s.length === 0) {
41
+ t?.({
42
+ type: "invalid_mime_type",
43
+ message: `No files with allowed MIME types. Allowed: ${r.join(", ")}`,
44
+ files: e
45
+ });
46
+ return;
47
+ }
48
+ a?.(n, s, o);
54
49
  }
55
- d += i.child(s).nodeSize;
56
- }
57
- if (l <= 0) return null;
58
- let c = n;
59
- for (let s = 0; s < l - 1; s++)
60
- c += i.child(s).nodeSize;
61
- return { pos: c, node: i.child(l - 1) };
62
- }
63
- function h(e, o) {
64
- const r = o.pos + o.node.nodeSize, t = e.doc.resolve(r);
65
- if (r >= t.end(t.depth)) return null;
66
- const n = e.doc.nodeAt(r);
67
- return n ? { pos: r, node: n } : null;
50
+ });
68
51
  }
69
- const S = f.create({
70
- name: "vizelBlockMoveKeymap",
71
- addCommands() {
72
- return {
73
- moveBlockUp: () => ({ tr: e, state: o, dispatch: r }) => {
74
- const { $from: t } = o.selection, n = u(t);
75
- if (!n || n.pos <= 0) return !1;
76
- const i = g(o, n);
77
- if (!i) return !1;
78
- if (r) {
79
- const d = n.pos + n.node.nodeSize;
80
- e.delete(n.pos, d), e.insert(i.pos, n.node);
81
- const l = i.pos + 1;
82
- e.setSelection(a.near(e.doc.resolve(l)));
83
- }
84
- return !0;
85
- },
86
- moveBlockDown: () => ({ tr: e, state: o, dispatch: r }) => {
87
- const { $from: t } = o.selection, n = u(t);
88
- if (!n) return !1;
89
- const i = h(o, n);
90
- if (!i) return !1;
91
- if (r) {
92
- const d = n.pos + n.node.nodeSize;
93
- e.delete(n.pos, d);
94
- const l = n.pos + i.node.nodeSize;
95
- e.insert(l, n.node);
96
- const c = l + 1;
97
- e.setSelection(a.near(e.doc.resolve(c)));
98
- }
99
- return !0;
52
+ function f(l) {
53
+ const { onUpload: r, onUploadError: i } = l, a = async (t, n) => {
54
+ for (const e of n)
55
+ try {
56
+ const o = await r(e);
57
+ t.chain().focus().setImage({ src: o }).run();
58
+ } catch (o) {
59
+ i?.(o instanceof Error ? o : new Error(String(o)), e);
100
60
  }
101
- };
102
- },
103
- addKeyboardShortcuts() {
104
- return {
105
- "Alt-ArrowUp": () => this.editor.commands.moveBlockUp(),
106
- "Alt-ArrowDown": () => this.editor.commands.moveBlockDown()
107
- };
108
- }
109
- });
110
- function x(e = {}) {
111
- return [v(e), S];
61
+ };
62
+ return {
63
+ onPaste: (t, n, e) => {
64
+ a(t, n);
65
+ },
66
+ onDrop: (t, n, e) => {
67
+ a(t, n);
68
+ }
69
+ };
112
70
  }
113
71
  export {
114
- S as VizelBlockMoveKeymap,
115
- B as VizelDragHandle,
116
- v as createVizelDragHandleExtension,
117
- x as createVizelDragHandleExtensions
72
+ d as FileHandler,
73
+ g as VIZEL_DEFAULT_FILE_MIME_TYPES,
74
+ m as VIZEL_DEFAULT_IMAGE_MAX_FILE_SIZE,
75
+ p as createVizelFileHandlerExtension,
76
+ f as createVizelImageFileHandlers,
77
+ c as filterVizelFilesByMimeType
118
78
  };