@cgboiler/biz-basic 1.0.53 → 1.0.55

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 (321) hide show
  1. package/es/index.d.ts +1 -1
  2. package/es/index.js +1 -1
  3. package/es/rich-text-editor/RichTextEditor.d.ts +14 -5
  4. package/es/rich-text-editor/RichTextEditor.js +76 -196
  5. package/es/rich-text-editor/_atomic.css +2 -1
  6. package/es/rich-text-editor/extensions/ConsumedTrigger.d.ts +8 -0
  7. package/es/rich-text-editor/extensions/ConsumedTrigger.js +22 -0
  8. package/es/rich-text-editor/extensions/CustomContent.d.ts +5 -0
  9. package/es/rich-text-editor/extensions/CustomContent.js +103 -0
  10. package/es/rich-text-editor/extensions/HashTag.d.ts +15 -0
  11. package/es/rich-text-editor/extensions/HashTag.js +133 -0
  12. package/es/rich-text-editor/extensions/HorizontalRule.d.ts +2 -0
  13. package/es/rich-text-editor/extensions/HorizontalRule.js +16 -0
  14. package/es/rich-text-editor/extensions/IMEComposition.d.ts +16 -0
  15. package/es/rich-text-editor/extensions/IMEComposition.js +30 -0
  16. package/es/rich-text-editor/extensions/ImageUpload.d.ts +56 -0
  17. package/es/rich-text-editor/extensions/ImageUpload.js +80 -0
  18. package/es/rich-text-editor/extensions/MarkdownExtensions.d.ts +15 -0
  19. package/es/rich-text-editor/extensions/MarkdownExtensions.js +35 -0
  20. package/es/rich-text-editor/extensions/MediaInputRules.d.ts +17 -0
  21. package/es/rich-text-editor/extensions/MediaInputRules.js +47 -0
  22. package/es/rich-text-editor/extensions/MentionExtension.d.ts +15 -0
  23. package/es/rich-text-editor/extensions/MentionExtension.js +60 -0
  24. package/es/rich-text-editor/extensions/index.d.ts +16 -0
  25. package/es/rich-text-editor/extensions/index.js +20 -0
  26. package/es/rich-text-editor/hooks/index.d.ts +6 -0
  27. package/es/rich-text-editor/hooks/index.js +4 -0
  28. package/es/rich-text-editor/hooks/useEditorHistory.d.ts +17 -0
  29. package/es/rich-text-editor/hooks/useEditorHistory.js +87 -0
  30. package/es/rich-text-editor/index copy 2.css +1 -0
  31. package/es/rich-text-editor/index copy 2.less +598 -0
  32. package/es/rich-text-editor/index copy.css +1 -0
  33. package/es/rich-text-editor/index copy.less +356 -0
  34. package/es/rich-text-editor/index.css +1 -1
  35. package/es/rich-text-editor/index.less +444 -254
  36. package/es/rich-text-editor/lib/utils.d.ts +123 -0
  37. package/es/rich-text-editor/lib/utils.js +244 -0
  38. package/es/rich-text-editor/menu-system/components/_atomic.css +44 -0
  39. package/es/rich-text-editor/menu-system/components/blockquote-button.d.ts +49 -0
  40. package/es/rich-text-editor/menu-system/components/blockquote-button.js +75 -0
  41. package/es/rich-text-editor/menu-system/components/code-block-button.d.ts +49 -0
  42. package/es/rich-text-editor/menu-system/components/code-block-button.js +75 -0
  43. package/es/rich-text-editor/menu-system/components/color-highlight-button.d.ts +61 -0
  44. package/es/rich-text-editor/menu-system/components/color-highlight-button.js +102 -0
  45. package/es/rich-text-editor/menu-system/components/color-highlight-popover.d.ts +32 -0
  46. package/es/rich-text-editor/menu-system/components/color-highlight-popover.js +99 -0
  47. package/es/rich-text-editor/menu-system/components/heading-dropdown-menu.d.ts +43 -0
  48. package/es/rich-text-editor/menu-system/components/heading-dropdown-menu.js +102 -0
  49. package/es/rich-text-editor/menu-system/components/horizontal-rule-button.d.ts +22 -0
  50. package/es/rich-text-editor/menu-system/components/horizontal-rule-button.js +42 -0
  51. package/es/rich-text-editor/menu-system/components/image-upload-button.d.ts +40 -0
  52. package/es/rich-text-editor/menu-system/components/image-upload-button.js +71 -0
  53. package/es/rich-text-editor/menu-system/components/image-upload-node.d.ts +93 -0
  54. package/es/rich-text-editor/menu-system/components/image-upload-node.js +299 -0
  55. package/es/rich-text-editor/menu-system/components/link-popover.d.ts +32 -0
  56. package/es/rich-text-editor/menu-system/components/link-popover.js +127 -0
  57. package/es/rich-text-editor/menu-system/components/list-button.d.ts +40 -0
  58. package/es/rich-text-editor/menu-system/components/list-button.js +69 -0
  59. package/es/rich-text-editor/menu-system/components/list-dropdown-menu.d.ts +41 -0
  60. package/es/rich-text-editor/menu-system/components/list-dropdown-menu.js +97 -0
  61. package/es/rich-text-editor/menu-system/components/mark-button.d.ts +58 -0
  62. package/es/rich-text-editor/menu-system/components/mark-button.js +80 -0
  63. package/es/rich-text-editor/menu-system/components/text-align-button.d.ts +58 -0
  64. package/es/rich-text-editor/menu-system/components/text-align-button.js +80 -0
  65. package/es/rich-text-editor/menu-system/components/undo-redo-button.d.ts +58 -0
  66. package/es/rich-text-editor/menu-system/components/undo-redo-button.js +77 -0
  67. package/es/rich-text-editor/menu-system/hooks/use-blockquote.d.ts +34 -0
  68. package/es/rich-text-editor/menu-system/hooks/use-blockquote.js +140 -0
  69. package/es/rich-text-editor/menu-system/hooks/use-code-block.d.ts +34 -0
  70. package/es/rich-text-editor/menu-system/hooks/use-code-block.js +140 -0
  71. package/es/rich-text-editor/menu-system/hooks/use-color-highlight.d.ts +46 -0
  72. package/es/rich-text-editor/menu-system/hooks/use-color-highlight.js +166 -0
  73. package/es/rich-text-editor/menu-system/hooks/use-cursor-visibility.d.ts +7 -0
  74. package/es/rich-text-editor/menu-system/hooks/use-cursor-visibility.js +46 -0
  75. package/es/rich-text-editor/menu-system/hooks/use-element-rect.d.ts +10 -0
  76. package/es/rich-text-editor/menu-system/hooks/use-element-rect.js +132 -0
  77. package/es/rich-text-editor/menu-system/hooks/use-file-upload.d.ts +94 -0
  78. package/es/rich-text-editor/menu-system/hooks/use-file-upload.js +135 -0
  79. package/es/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.d.ts +41 -0
  80. package/es/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.js +70 -0
  81. package/es/rich-text-editor/menu-system/hooks/use-heading.d.ts +26 -0
  82. package/es/rich-text-editor/menu-system/hooks/use-heading.js +166 -0
  83. package/es/rich-text-editor/menu-system/hooks/use-image-upload.d.ts +35 -0
  84. package/es/rich-text-editor/menu-system/hooks/use-image-upload.js +103 -0
  85. package/es/rich-text-editor/menu-system/hooks/use-link-popover.d.ts +10 -0
  86. package/es/rich-text-editor/menu-system/hooks/use-link-popover.js +62 -0
  87. package/es/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.d.ts +34 -0
  88. package/es/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.js +121 -0
  89. package/es/rich-text-editor/menu-system/hooks/use-list.d.ts +28 -0
  90. package/es/rich-text-editor/menu-system/hooks/use-list.js +191 -0
  91. package/es/rich-text-editor/menu-system/hooks/use-mark.d.ts +22 -0
  92. package/es/rich-text-editor/menu-system/hooks/use-mark.js +109 -0
  93. package/es/rich-text-editor/menu-system/hooks/use-menu-navigation.d.ts +16 -0
  94. package/es/rich-text-editor/menu-system/hooks/use-menu-navigation.js +134 -0
  95. package/es/rich-text-editor/menu-system/hooks/use-mobile.d.ts +1 -0
  96. package/es/rich-text-editor/menu-system/hooks/use-mobile.js +20 -0
  97. package/es/rich-text-editor/menu-system/hooks/use-text-align.d.ts +28 -0
  98. package/es/rich-text-editor/menu-system/hooks/use-text-align.js +113 -0
  99. package/es/rich-text-editor/menu-system/hooks/use-throttled-callback.d.ts +8 -0
  100. package/es/rich-text-editor/menu-system/hooks/use-throttled-callback.js +45 -0
  101. package/es/rich-text-editor/menu-system/hooks/use-undo-redo.d.ts +60 -0
  102. package/es/rich-text-editor/menu-system/hooks/use-undo-redo.js +96 -0
  103. package/es/rich-text-editor/menu-system/hooks/use-window-size.d.ts +21 -0
  104. package/es/rich-text-editor/menu-system/hooks/use-window-size.js +74 -0
  105. package/es/rich-text-editor/menu-system/icons/_atomic.css +32 -0
  106. package/es/rich-text-editor/menu-system/icons/index.d.ts +546 -0
  107. package/es/rich-text-editor/menu-system/icons/index.js +487 -0
  108. package/es/rich-text-editor/menu-system/primitives/_atomic.css +38 -0
  109. package/es/rich-text-editor/menu-system/primitives/button.d.ts +110 -0
  110. package/es/rich-text-editor/menu-system/primitives/button.js +107 -0
  111. package/es/rich-text-editor/menu-system/primitives/card.d.ts +75 -0
  112. package/es/rich-text-editor/menu-system/primitives/card.js +116 -0
  113. package/es/rich-text-editor/menu-system/primitives/input.d.ts +37 -0
  114. package/es/rich-text-editor/menu-system/primitives/input.js +55 -0
  115. package/es/rich-text-editor/menu-system/primitives/separator.d.ts +34 -0
  116. package/es/rich-text-editor/menu-system/primitives/separator.js +42 -0
  117. package/es/rich-text-editor/menu-system/primitives/toolbar.d.ts +39 -0
  118. package/es/rich-text-editor/menu-system/primitives/toolbar.js +149 -0
  119. package/es/rich-text-editor/menu-system/styles/animations.css +1 -0
  120. package/es/rich-text-editor/menu-system/styles/animations.less +91 -0
  121. package/es/rich-text-editor/menu-system/styles/button-colors.css +1 -0
  122. package/es/rich-text-editor/menu-system/styles/button-colors.less +142 -0
  123. package/es/rich-text-editor/menu-system/styles/button-group.css +1 -0
  124. package/es/rich-text-editor/menu-system/styles/button-group.less +23 -0
  125. package/es/rich-text-editor/menu-system/styles/button.css +1 -0
  126. package/es/rich-text-editor/menu-system/styles/button.less +322 -0
  127. package/es/rich-text-editor/menu-system/styles/card.css +1 -0
  128. package/es/rich-text-editor/menu-system/styles/card.less +78 -0
  129. package/es/rich-text-editor/menu-system/styles/color-highlight-button.css +1 -0
  130. package/es/rich-text-editor/menu-system/styles/color-highlight-button.less +57 -0
  131. package/es/rich-text-editor/menu-system/styles/color-highlight-popover.css +1 -0
  132. package/es/rich-text-editor/menu-system/styles/color-highlight-popover.less +51 -0
  133. package/es/rich-text-editor/menu-system/styles/dropdown-menu.css +1 -0
  134. package/es/rich-text-editor/menu-system/styles/dropdown-menu.less +40 -0
  135. package/es/rich-text-editor/menu-system/styles/image-upload-node.css +1 -0
  136. package/es/rich-text-editor/menu-system/styles/image-upload-node.less +240 -0
  137. package/es/rich-text-editor/menu-system/styles/input.css +1 -0
  138. package/es/rich-text-editor/menu-system/styles/input.less +53 -0
  139. package/es/rich-text-editor/menu-system/styles/link-popover.css +1 -0
  140. package/es/rich-text-editor/menu-system/styles/link-popover.less +32 -0
  141. package/es/rich-text-editor/menu-system/styles/separator.css +1 -0
  142. package/es/rich-text-editor/menu-system/styles/separator.less +26 -0
  143. package/es/rich-text-editor/menu-system/styles/simple-editor.css +1 -0
  144. package/es/rich-text-editor/menu-system/styles/simple-editor.less +39 -0
  145. package/es/rich-text-editor/menu-system/styles/toolbar.css +1 -0
  146. package/es/rich-text-editor/menu-system/styles/toolbar.less +87 -0
  147. package/es/rich-text-editor/menu-system/styles/variables.css +1 -0
  148. package/es/rich-text-editor/menu-system/styles/variables.less +296 -0
  149. package/es/rich-text-editor/menu-system/utils/tiptap-utils.d.ts +122 -0
  150. package/es/rich-text-editor/menu-system/utils/tiptap-utils.js +243 -0
  151. package/es/rich-text-editor/types.d.ts +4 -0
  152. package/es/rich-text-editor/types.js +4 -0
  153. package/es/rich-text-editor/useExtensions.d.ts +3 -3
  154. package/es/rich-text-editor/useExtensions.js +63 -428
  155. package/es/rich-text-editor/utils/eventHandlers.d.ts +37 -0
  156. package/es/rich-text-editor/utils/eventHandlers.js +103 -0
  157. package/es/rich-text-editor/utils/index.d.ts +6 -0
  158. package/es/rich-text-editor/utils/index.js +19 -0
  159. package/es/rich-text-editor/utils/triggerHelpers.d.ts +31 -0
  160. package/es/rich-text-editor/utils/triggerHelpers.js +46 -0
  161. package/lib/index.d.ts +1 -1
  162. package/lib/index.js +1 -1
  163. package/lib/rich-text-editor/RichTextEditor.d.ts +14 -5
  164. package/lib/rich-text-editor/RichTextEditor.js +76 -206
  165. package/lib/rich-text-editor/_atomic.css +2 -1
  166. package/lib/rich-text-editor/extensions/ConsumedTrigger.d.ts +8 -0
  167. package/lib/rich-text-editor/extensions/ConsumedTrigger.js +41 -0
  168. package/lib/rich-text-editor/extensions/CustomContent.d.ts +5 -0
  169. package/lib/rich-text-editor/extensions/CustomContent.js +132 -0
  170. package/lib/rich-text-editor/extensions/HashTag.d.ts +15 -0
  171. package/lib/rich-text-editor/extensions/HashTag.js +157 -0
  172. package/lib/rich-text-editor/extensions/HorizontalRule.d.ts +2 -0
  173. package/lib/rich-text-editor/extensions/HorizontalRule.js +45 -0
  174. package/lib/rich-text-editor/extensions/IMEComposition.d.ts +16 -0
  175. package/lib/rich-text-editor/extensions/IMEComposition.js +49 -0
  176. package/lib/rich-text-editor/extensions/ImageUpload.d.ts +56 -0
  177. package/lib/rich-text-editor/extensions/ImageUpload.js +99 -0
  178. package/lib/rich-text-editor/extensions/MarkdownExtensions.d.ts +15 -0
  179. package/lib/rich-text-editor/extensions/MarkdownExtensions.js +54 -0
  180. package/lib/rich-text-editor/extensions/MediaInputRules.d.ts +17 -0
  181. package/lib/rich-text-editor/extensions/MediaInputRules.js +66 -0
  182. package/lib/rich-text-editor/extensions/MentionExtension.d.ts +15 -0
  183. package/lib/rich-text-editor/extensions/MentionExtension.js +89 -0
  184. package/lib/rich-text-editor/extensions/index.d.ts +16 -0
  185. package/lib/rich-text-editor/extensions/index.js +49 -0
  186. package/lib/rich-text-editor/hooks/index.d.ts +6 -0
  187. package/lib/rich-text-editor/hooks/index.js +23 -0
  188. package/lib/rich-text-editor/hooks/useEditorHistory.d.ts +17 -0
  189. package/lib/rich-text-editor/hooks/useEditorHistory.js +116 -0
  190. package/lib/rich-text-editor/index copy 2.css +1 -0
  191. package/lib/rich-text-editor/index copy 2.less +598 -0
  192. package/lib/rich-text-editor/index copy.css +1 -0
  193. package/lib/rich-text-editor/index copy.less +356 -0
  194. package/lib/rich-text-editor/index.css +1 -1
  195. package/lib/rich-text-editor/index.less +444 -254
  196. package/lib/rich-text-editor/lib/utils.d.ts +123 -0
  197. package/lib/rich-text-editor/lib/utils.js +263 -0
  198. package/lib/rich-text-editor/menu-system/components/_atomic.css +44 -0
  199. package/lib/rich-text-editor/menu-system/components/blockquote-button.d.ts +49 -0
  200. package/lib/rich-text-editor/menu-system/components/blockquote-button.js +94 -0
  201. package/lib/rich-text-editor/menu-system/components/code-block-button.d.ts +49 -0
  202. package/lib/rich-text-editor/menu-system/components/code-block-button.js +94 -0
  203. package/lib/rich-text-editor/menu-system/components/color-highlight-button.d.ts +61 -0
  204. package/lib/rich-text-editor/menu-system/components/color-highlight-button.js +119 -0
  205. package/lib/rich-text-editor/menu-system/components/color-highlight-popover.d.ts +32 -0
  206. package/lib/rich-text-editor/menu-system/components/color-highlight-popover.js +118 -0
  207. package/lib/rich-text-editor/menu-system/components/heading-dropdown-menu.d.ts +43 -0
  208. package/lib/rich-text-editor/menu-system/components/heading-dropdown-menu.js +131 -0
  209. package/lib/rich-text-editor/menu-system/components/horizontal-rule-button.d.ts +22 -0
  210. package/lib/rich-text-editor/menu-system/components/horizontal-rule-button.js +61 -0
  211. package/lib/rich-text-editor/menu-system/components/image-upload-button.d.ts +40 -0
  212. package/lib/rich-text-editor/menu-system/components/image-upload-button.js +90 -0
  213. package/lib/rich-text-editor/menu-system/components/image-upload-node.d.ts +93 -0
  214. package/lib/rich-text-editor/menu-system/components/image-upload-node.js +316 -0
  215. package/lib/rich-text-editor/menu-system/components/link-popover.d.ts +32 -0
  216. package/lib/rich-text-editor/menu-system/components/link-popover.js +146 -0
  217. package/lib/rich-text-editor/menu-system/components/list-button.d.ts +40 -0
  218. package/lib/rich-text-editor/menu-system/components/list-button.js +88 -0
  219. package/lib/rich-text-editor/menu-system/components/list-dropdown-menu.d.ts +41 -0
  220. package/lib/rich-text-editor/menu-system/components/list-dropdown-menu.js +116 -0
  221. package/lib/rich-text-editor/menu-system/components/mark-button.d.ts +58 -0
  222. package/lib/rich-text-editor/menu-system/components/mark-button.js +99 -0
  223. package/lib/rich-text-editor/menu-system/components/text-align-button.d.ts +58 -0
  224. package/lib/rich-text-editor/menu-system/components/text-align-button.js +99 -0
  225. package/lib/rich-text-editor/menu-system/components/undo-redo-button.d.ts +58 -0
  226. package/lib/rich-text-editor/menu-system/components/undo-redo-button.js +96 -0
  227. package/lib/rich-text-editor/menu-system/hooks/use-blockquote.d.ts +34 -0
  228. package/lib/rich-text-editor/menu-system/hooks/use-blockquote.js +154 -0
  229. package/lib/rich-text-editor/menu-system/hooks/use-code-block.d.ts +34 -0
  230. package/lib/rich-text-editor/menu-system/hooks/use-code-block.js +154 -0
  231. package/lib/rich-text-editor/menu-system/hooks/use-color-highlight.d.ts +46 -0
  232. package/lib/rich-text-editor/menu-system/hooks/use-color-highlight.js +185 -0
  233. package/lib/rich-text-editor/menu-system/hooks/use-cursor-visibility.d.ts +7 -0
  234. package/lib/rich-text-editor/menu-system/hooks/use-cursor-visibility.js +65 -0
  235. package/lib/rich-text-editor/menu-system/hooks/use-element-rect.d.ts +10 -0
  236. package/lib/rich-text-editor/menu-system/hooks/use-element-rect.js +149 -0
  237. package/lib/rich-text-editor/menu-system/hooks/use-file-upload.d.ts +94 -0
  238. package/lib/rich-text-editor/menu-system/hooks/use-file-upload.js +154 -0
  239. package/lib/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.d.ts +41 -0
  240. package/lib/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.js +84 -0
  241. package/lib/rich-text-editor/menu-system/hooks/use-heading.d.ts +26 -0
  242. package/lib/rich-text-editor/menu-system/hooks/use-heading.js +190 -0
  243. package/lib/rich-text-editor/menu-system/hooks/use-image-upload.d.ts +35 -0
  244. package/lib/rich-text-editor/menu-system/hooks/use-image-upload.js +122 -0
  245. package/lib/rich-text-editor/menu-system/hooks/use-link-popover.d.ts +10 -0
  246. package/lib/rich-text-editor/menu-system/hooks/use-link-popover.js +81 -0
  247. package/lib/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.d.ts +34 -0
  248. package/lib/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.js +140 -0
  249. package/lib/rich-text-editor/menu-system/hooks/use-list.d.ts +28 -0
  250. package/lib/rich-text-editor/menu-system/hooks/use-list.js +205 -0
  251. package/lib/rich-text-editor/menu-system/hooks/use-mark.d.ts +22 -0
  252. package/lib/rich-text-editor/menu-system/hooks/use-mark.js +138 -0
  253. package/lib/rich-text-editor/menu-system/hooks/use-menu-navigation.d.ts +16 -0
  254. package/lib/rich-text-editor/menu-system/hooks/use-menu-navigation.js +153 -0
  255. package/lib/rich-text-editor/menu-system/hooks/use-mobile.d.ts +1 -0
  256. package/lib/rich-text-editor/menu-system/hooks/use-mobile.js +39 -0
  257. package/lib/rich-text-editor/menu-system/hooks/use-text-align.d.ts +28 -0
  258. package/lib/rich-text-editor/menu-system/hooks/use-text-align.js +132 -0
  259. package/lib/rich-text-editor/menu-system/hooks/use-throttled-callback.d.ts +8 -0
  260. package/lib/rich-text-editor/menu-system/hooks/use-throttled-callback.js +64 -0
  261. package/lib/rich-text-editor/menu-system/hooks/use-undo-redo.d.ts +60 -0
  262. package/lib/rich-text-editor/menu-system/hooks/use-undo-redo.js +115 -0
  263. package/lib/rich-text-editor/menu-system/hooks/use-window-size.d.ts +21 -0
  264. package/lib/rich-text-editor/menu-system/hooks/use-window-size.js +93 -0
  265. package/lib/rich-text-editor/menu-system/icons/_atomic.css +32 -0
  266. package/lib/rich-text-editor/menu-system/icons/index.d.ts +546 -0
  267. package/lib/rich-text-editor/menu-system/icons/index.js +506 -0
  268. package/lib/rich-text-editor/menu-system/primitives/_atomic.css +38 -0
  269. package/lib/rich-text-editor/menu-system/primitives/button.d.ts +110 -0
  270. package/lib/rich-text-editor/menu-system/primitives/button.js +126 -0
  271. package/lib/rich-text-editor/menu-system/primitives/card.d.ts +75 -0
  272. package/lib/rich-text-editor/menu-system/primitives/card.js +135 -0
  273. package/lib/rich-text-editor/menu-system/primitives/input.d.ts +37 -0
  274. package/lib/rich-text-editor/menu-system/primitives/input.js +74 -0
  275. package/lib/rich-text-editor/menu-system/primitives/separator.d.ts +34 -0
  276. package/lib/rich-text-editor/menu-system/primitives/separator.js +61 -0
  277. package/lib/rich-text-editor/menu-system/primitives/toolbar.d.ts +39 -0
  278. package/lib/rich-text-editor/menu-system/primitives/toolbar.js +168 -0
  279. package/lib/rich-text-editor/menu-system/styles/animations.css +1 -0
  280. package/lib/rich-text-editor/menu-system/styles/animations.less +91 -0
  281. package/lib/rich-text-editor/menu-system/styles/button-colors.css +1 -0
  282. package/lib/rich-text-editor/menu-system/styles/button-colors.less +142 -0
  283. package/lib/rich-text-editor/menu-system/styles/button-group.css +1 -0
  284. package/lib/rich-text-editor/menu-system/styles/button-group.less +23 -0
  285. package/lib/rich-text-editor/menu-system/styles/button.css +1 -0
  286. package/lib/rich-text-editor/menu-system/styles/button.less +322 -0
  287. package/lib/rich-text-editor/menu-system/styles/card.css +1 -0
  288. package/lib/rich-text-editor/menu-system/styles/card.less +78 -0
  289. package/lib/rich-text-editor/menu-system/styles/color-highlight-button.css +1 -0
  290. package/lib/rich-text-editor/menu-system/styles/color-highlight-button.less +57 -0
  291. package/lib/rich-text-editor/menu-system/styles/color-highlight-popover.css +1 -0
  292. package/lib/rich-text-editor/menu-system/styles/color-highlight-popover.less +51 -0
  293. package/lib/rich-text-editor/menu-system/styles/dropdown-menu.css +1 -0
  294. package/lib/rich-text-editor/menu-system/styles/dropdown-menu.less +40 -0
  295. package/lib/rich-text-editor/menu-system/styles/image-upload-node.css +1 -0
  296. package/lib/rich-text-editor/menu-system/styles/image-upload-node.less +240 -0
  297. package/lib/rich-text-editor/menu-system/styles/input.css +1 -0
  298. package/lib/rich-text-editor/menu-system/styles/input.less +53 -0
  299. package/lib/rich-text-editor/menu-system/styles/link-popover.css +1 -0
  300. package/lib/rich-text-editor/menu-system/styles/link-popover.less +32 -0
  301. package/lib/rich-text-editor/menu-system/styles/separator.css +1 -0
  302. package/lib/rich-text-editor/menu-system/styles/separator.less +26 -0
  303. package/lib/rich-text-editor/menu-system/styles/simple-editor.css +1 -0
  304. package/lib/rich-text-editor/menu-system/styles/simple-editor.less +39 -0
  305. package/lib/rich-text-editor/menu-system/styles/toolbar.css +1 -0
  306. package/lib/rich-text-editor/menu-system/styles/toolbar.less +87 -0
  307. package/lib/rich-text-editor/menu-system/styles/variables.css +1 -0
  308. package/lib/rich-text-editor/menu-system/styles/variables.less +296 -0
  309. package/lib/rich-text-editor/menu-system/utils/tiptap-utils.d.ts +122 -0
  310. package/lib/rich-text-editor/menu-system/utils/tiptap-utils.js +262 -0
  311. package/lib/rich-text-editor/types.d.ts +4 -0
  312. package/lib/rich-text-editor/types.js +4 -0
  313. package/lib/rich-text-editor/useExtensions.d.ts +3 -3
  314. package/lib/rich-text-editor/useExtensions.js +64 -429
  315. package/lib/rich-text-editor/utils/eventHandlers.d.ts +37 -0
  316. package/lib/rich-text-editor/utils/eventHandlers.js +132 -0
  317. package/lib/rich-text-editor/utils/index.d.ts +6 -0
  318. package/lib/rich-text-editor/utils/index.js +32 -0
  319. package/lib/rich-text-editor/utils/triggerHelpers.d.ts +31 -0
  320. package/lib/rich-text-editor/utils/triggerHelpers.js +65 -0
  321. package/package.json +13 -3
@@ -0,0 +1,185 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var stdin_exports = {};
19
+ __export(stdin_exports, {
20
+ COLOR_HIGHLIGHT_SHORTCUT_KEY: () => COLOR_HIGHLIGHT_SHORTCUT_KEY,
21
+ HIGHLIGHT_COLORS: () => HIGHLIGHT_COLORS,
22
+ canColorHighlight: () => canColorHighlight,
23
+ isColorHighlightActive: () => isColorHighlightActive,
24
+ removeHighlight: () => removeHighlight,
25
+ shouldShowButton: () => shouldShowButton,
26
+ useColorHighlight: () => useColorHighlight
27
+ });
28
+ module.exports = __toCommonJS(stdin_exports);
29
+ var import_vue = require("vue");
30
+ var import_tiptap_utils = require("../utils/tiptap-utils");
31
+ var import_icons = require("../icons");
32
+ const COLOR_HIGHLIGHT_SHORTCUT_KEY = "mod+shift+h";
33
+ const HIGHLIGHT_COLORS = [
34
+ {
35
+ label: "Default background",
36
+ value: "var(--tt-bg-color)",
37
+ border: "var(--tt-bg-color-contrast)"
38
+ },
39
+ {
40
+ label: "Gray background",
41
+ value: "var(--tt-color-highlight-gray)",
42
+ border: "var(--tt-color-highlight-gray-contrast)"
43
+ },
44
+ {
45
+ label: "Brown background",
46
+ value: "var(--tt-color-highlight-brown)",
47
+ border: "var(--tt-color-highlight-brown-contrast)"
48
+ },
49
+ {
50
+ label: "Orange background",
51
+ value: "var(--tt-color-highlight-orange)",
52
+ border: "var(--tt-color-highlight-orange-contrast)"
53
+ },
54
+ {
55
+ label: "Yellow background",
56
+ value: "var(--tt-color-highlight-yellow)",
57
+ border: "var(--tt-color-highlight-yellow-contrast)"
58
+ },
59
+ {
60
+ label: "Green background",
61
+ value: "var(--tt-color-highlight-green)",
62
+ border: "var(--tt-color-highlight-green-contrast)"
63
+ },
64
+ {
65
+ label: "Blue background",
66
+ value: "var(--tt-color-highlight-blue)",
67
+ border: "var(--tt-color-highlight-blue-contrast)"
68
+ },
69
+ {
70
+ label: "Purple background",
71
+ value: "var(--tt-color-highlight-purple)",
72
+ border: "var(--tt-color-highlight-purple-contrast)"
73
+ },
74
+ {
75
+ label: "Pink background",
76
+ value: "var(--tt-color-highlight-pink)",
77
+ border: "var(--tt-color-highlight-pink-contrast)"
78
+ },
79
+ {
80
+ label: "Red background",
81
+ value: "var(--tt-color-highlight-red)",
82
+ border: "var(--tt-color-highlight-red-contrast)"
83
+ }
84
+ ];
85
+ function canColorHighlight(editor) {
86
+ if (!editor || !editor.isEditable)
87
+ return false;
88
+ if (!(0, import_tiptap_utils.isMarkInSchema)("highlight", editor) || (0, import_tiptap_utils.isNodeTypeSelected)(editor, ["image"]))
89
+ return false;
90
+ return editor.can().setMark("highlight");
91
+ }
92
+ function isColorHighlightActive(editor, highlightColor) {
93
+ if (!editor || !editor.isEditable)
94
+ return false;
95
+ return highlightColor ? editor.isActive("highlight", { color: highlightColor }) : editor.isActive("highlight");
96
+ }
97
+ function removeHighlight(editor) {
98
+ if (!editor || !editor.isEditable)
99
+ return false;
100
+ if (!canColorHighlight(editor))
101
+ return false;
102
+ return editor.chain().focus().unsetMark("highlight").run();
103
+ }
104
+ function shouldShowButton(props) {
105
+ const { editor, hideWhenUnavailable } = props;
106
+ if (!editor || !editor.isEditable)
107
+ return false;
108
+ if (!(0, import_tiptap_utils.isMarkInSchema)("highlight", editor))
109
+ return false;
110
+ if (hideWhenUnavailable && !editor.isActive("code")) {
111
+ return canColorHighlight(editor);
112
+ }
113
+ return true;
114
+ }
115
+ function useColorHighlight(config) {
116
+ const { label, highlightColor, hideWhenUnavailable = false, onApplied } = config;
117
+ const isVisible = (0, import_vue.ref)(true);
118
+ const isActive = (0, import_vue.ref)(false);
119
+ const canHighlight = (0, import_vue.ref)(false);
120
+ const getEditor = () => {
121
+ const editor = config.editor;
122
+ return editor && "value" in editor ? editor.value : editor;
123
+ };
124
+ const updateState = () => {
125
+ const editor = getEditor();
126
+ if (!editor || !editor.isEditable) {
127
+ isVisible.value = false;
128
+ isActive.value = false;
129
+ canHighlight.value = false;
130
+ return;
131
+ }
132
+ isActive.value = isColorHighlightActive(editor, highlightColor);
133
+ canHighlight.value = canColorHighlight(editor);
134
+ isVisible.value = shouldShowButton({ editor, hideWhenUnavailable });
135
+ };
136
+ (0, import_vue.watch)(
137
+ () => getEditor(),
138
+ (editor) => {
139
+ if (!editor)
140
+ return;
141
+ updateState();
142
+ editor.on("selectionUpdate", updateState);
143
+ editor.on("transaction", updateState);
144
+ (0, import_vue.onBeforeUnmount)(() => {
145
+ editor.off("selectionUpdate", updateState);
146
+ editor.off("transaction", updateState);
147
+ });
148
+ },
149
+ { immediate: true }
150
+ );
151
+ const handleColorHighlight = () => {
152
+ const editor = getEditor();
153
+ if (!editor || !canHighlight.value || !highlightColor || !label)
154
+ return;
155
+ if (editor.state.storedMarks) {
156
+ const highlightMarkType = editor.schema.marks.highlight;
157
+ if (highlightMarkType) {
158
+ editor.view.dispatch(editor.state.tr.removeStoredMark(highlightMarkType));
159
+ }
160
+ }
161
+ setTimeout(() => {
162
+ const success = editor.chain().focus().toggleMark("highlight", { color: highlightColor }).run();
163
+ if (success) {
164
+ onApplied == null ? void 0 : onApplied({ color: highlightColor, label });
165
+ }
166
+ }, 0);
167
+ };
168
+ const handleRemoveHighlight = () => {
169
+ const editor = getEditor();
170
+ const success = removeHighlight(editor);
171
+ if (success) {
172
+ onApplied == null ? void 0 : onApplied({ color: "", label: "Remove highlight" });
173
+ }
174
+ };
175
+ return {
176
+ isVisible,
177
+ isActive,
178
+ handleColorHighlight,
179
+ handleRemoveHighlight,
180
+ canHighlight,
181
+ label: label || "Highlight",
182
+ shortcutKeys: COLOR_HIGHLIGHT_SHORTCUT_KEY,
183
+ Icon: import_icons.HighlighterIcon
184
+ };
185
+ }
@@ -0,0 +1,7 @@
1
+ import { type Ref } from 'vue';
2
+ import type { Editor } from '@tiptap/vue-3';
3
+ export interface CursorVisibilityOptions {
4
+ editor?: Editor | null | Ref<Editor | null | undefined>;
5
+ overlayHeight?: number | Ref<number>;
6
+ }
7
+ export declare function useCursorVisibility(options: CursorVisibilityOptions): Ref<import("./use-element-rect").RectState, import("./use-element-rect").RectState>;
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var stdin_exports = {};
19
+ __export(stdin_exports, {
20
+ useCursorVisibility: () => useCursorVisibility
21
+ });
22
+ module.exports = __toCommonJS(stdin_exports);
23
+ var import_vue = require("vue");
24
+ var import_use_window_size = require("./use-window-size");
25
+ var import_use_element_rect = require("./use-element-rect");
26
+ function useCursorVisibility(options) {
27
+ const windowSize = (0, import_use_window_size.useWindowSizeStore)();
28
+ const rect = (0, import_use_element_rect.useBodyRect)({
29
+ enabled: true,
30
+ throttleMs: 100,
31
+ useResizeObserver: true
32
+ });
33
+ const ensureCursorVisibility = () => {
34
+ const editor = typeof options.editor === "function" ? options.editor() : options.editor && "value" in options.editor ? options.editor.value : options.editor;
35
+ const overlayHeight = options.overlayHeight && "value" in options.overlayHeight ? options.overlayHeight.value : options.overlayHeight || 0;
36
+ if (!editor)
37
+ return;
38
+ const { state, view } = editor;
39
+ if (!view.hasFocus())
40
+ return;
41
+ const { from } = state.selection;
42
+ const cursorCoords = view.coordsAtPos(from);
43
+ if (windowSize.value.height < rect.value.height && cursorCoords) {
44
+ const availableSpace = windowSize.value.height - cursorCoords.top;
45
+ if (availableSpace < overlayHeight) {
46
+ const targetCursorY = Math.max(windowSize.value.height / 2, overlayHeight);
47
+ const currentScrollY = window.scrollY;
48
+ const cursorAbsoluteY = cursorCoords.top + currentScrollY;
49
+ const newScrollY = cursorAbsoluteY - targetCursorY;
50
+ window.scrollTo({
51
+ top: Math.max(0, newScrollY),
52
+ behavior: "smooth"
53
+ });
54
+ }
55
+ }
56
+ };
57
+ (0, import_vue.watch)(
58
+ [windowSize, rect, () => options.overlayHeight, () => options.editor],
59
+ () => {
60
+ ensureCursorVisibility();
61
+ },
62
+ { deep: true }
63
+ );
64
+ return rect;
65
+ }
@@ -0,0 +1,10 @@
1
+ import { type Ref } from 'vue';
2
+ export type RectState = Omit<DOMRect, 'toJSON'>;
3
+ export interface ElementRectOptions {
4
+ element?: Element | Ref<Element | null> | string | null;
5
+ enabled?: boolean;
6
+ throttleMs?: number;
7
+ useResizeObserver?: boolean;
8
+ }
9
+ export declare function useElementRect(options?: ElementRectOptions): Ref<RectState>;
10
+ export declare function useBodyRect(options?: Omit<ElementRectOptions, 'element'>): Ref<RectState>;
@@ -0,0 +1,149 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
+ var __export = (target, all) => {
23
+ for (var name in all)
24
+ __defProp(target, name, { get: all[name], enumerable: true });
25
+ };
26
+ var __copyProps = (to, from, except, desc) => {
27
+ if (from && typeof from === "object" || typeof from === "function") {
28
+ for (let key of __getOwnPropNames(from))
29
+ if (!__hasOwnProp.call(to, key) && key !== except)
30
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
31
+ }
32
+ return to;
33
+ };
34
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
+ var stdin_exports = {};
36
+ __export(stdin_exports, {
37
+ useBodyRect: () => useBodyRect,
38
+ useElementRect: () => useElementRect
39
+ });
40
+ module.exports = __toCommonJS(stdin_exports);
41
+ var import_vue = require("vue");
42
+ var import_use_throttled_callback = require("./use-throttled-callback");
43
+ const initialRect = {
44
+ x: 0,
45
+ y: 0,
46
+ width: 0,
47
+ height: 0,
48
+ top: 0,
49
+ right: 0,
50
+ bottom: 0,
51
+ left: 0
52
+ };
53
+ const isSSR = typeof window === "undefined";
54
+ const hasResizeObserver = !isSSR && typeof ResizeObserver !== "undefined";
55
+ function useElementRect(options = {}) {
56
+ const { element, enabled = true, throttleMs = 100, useResizeObserver = true } = options;
57
+ const rect = (0, import_vue.ref)(initialRect);
58
+ const getTargetElement = () => {
59
+ if (!enabled || isSSR)
60
+ return null;
61
+ if (!element) {
62
+ return document.body;
63
+ }
64
+ if (typeof element === "string") {
65
+ return document.querySelector(element);
66
+ }
67
+ if (element && "value" in element) {
68
+ return element.value;
69
+ }
70
+ return element;
71
+ };
72
+ const updateRect = (0, import_use_throttled_callback.useThrottledCallback)(
73
+ () => {
74
+ if (!enabled || isSSR)
75
+ return;
76
+ const targetElement = getTargetElement();
77
+ if (!targetElement) {
78
+ rect.value = initialRect;
79
+ return;
80
+ }
81
+ const newRect = targetElement.getBoundingClientRect();
82
+ rect.value = {
83
+ x: newRect.x,
84
+ y: newRect.y,
85
+ width: newRect.width,
86
+ height: newRect.height,
87
+ top: newRect.top,
88
+ right: newRect.right,
89
+ bottom: newRect.bottom,
90
+ left: newRect.left
91
+ };
92
+ },
93
+ throttleMs,
94
+ { leading: true, trailing: true }
95
+ );
96
+ let resizeObserver = null;
97
+ const cleanup = () => {
98
+ if (resizeObserver) {
99
+ resizeObserver.disconnect();
100
+ resizeObserver = null;
101
+ }
102
+ window.removeEventListener("scroll", updateRect);
103
+ window.removeEventListener("resize", updateRect);
104
+ };
105
+ (0, import_vue.onMounted)(() => {
106
+ if (!enabled || isSSR)
107
+ return;
108
+ const targetElement = getTargetElement();
109
+ if (!targetElement)
110
+ return;
111
+ updateRect();
112
+ if (useResizeObserver && hasResizeObserver) {
113
+ resizeObserver = new ResizeObserver(() => {
114
+ window.requestAnimationFrame(updateRect);
115
+ });
116
+ resizeObserver.observe(targetElement);
117
+ }
118
+ window.addEventListener("scroll", updateRect, { passive: true });
119
+ window.addEventListener("resize", updateRect, { passive: true });
120
+ });
121
+ (0, import_vue.onBeforeUnmount)(() => {
122
+ cleanup();
123
+ });
124
+ if (element && "value" in element) {
125
+ (0, import_vue.watch)(
126
+ () => element.value,
127
+ (newVal) => {
128
+ cleanup();
129
+ if (newVal && enabled && !isSSR) {
130
+ updateRect();
131
+ if (useResizeObserver && hasResizeObserver) {
132
+ resizeObserver = new ResizeObserver(() => {
133
+ window.requestAnimationFrame(updateRect);
134
+ });
135
+ resizeObserver.observe(newVal);
136
+ }
137
+ window.addEventListener("scroll", updateRect, { passive: true });
138
+ window.addEventListener("resize", updateRect, { passive: true });
139
+ }
140
+ }
141
+ );
142
+ }
143
+ return rect;
144
+ }
145
+ function useBodyRect(options = {}) {
146
+ return useElementRect(__spreadProps(__spreadValues({}, options), {
147
+ element: isSSR ? null : document.body
148
+ }));
149
+ }
@@ -0,0 +1,94 @@
1
+ export interface FileItem {
2
+ id: string;
3
+ file: File;
4
+ progress: number;
5
+ status: 'uploading' | 'success' | 'error';
6
+ url?: string;
7
+ abortController?: AbortController;
8
+ }
9
+ export interface UploadOptions {
10
+ maxSize: number;
11
+ limit: number;
12
+ accept: string;
13
+ upload: (file: File, onProgress: (event: {
14
+ progress: number;
15
+ }) => void, signal: AbortSignal) => Promise<string>;
16
+ onSuccess?: (url: string) => void;
17
+ onError?: (error: Error) => void;
18
+ }
19
+ export declare function useFileUpload(options: UploadOptions): {
20
+ fileItems: import("vue").Ref<{
21
+ id: string;
22
+ file: {
23
+ readonly lastModified: number;
24
+ readonly name: string;
25
+ readonly webkitRelativePath: string;
26
+ readonly size: number;
27
+ readonly type: string;
28
+ arrayBuffer: () => Promise<ArrayBuffer>;
29
+ bytes: () => Promise<Uint8Array<ArrayBuffer>>;
30
+ slice: (start?: number, end?: number, contentType?: string) => Blob;
31
+ stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
32
+ text: () => Promise<string>;
33
+ };
34
+ progress: number;
35
+ status: "uploading" | "success" | "error";
36
+ url?: string | undefined;
37
+ abortController?: {
38
+ readonly signal: {
39
+ readonly aborted: boolean;
40
+ onabort: ((this: AbortSignal, ev: Event) => any) | null;
41
+ readonly reason: any;
42
+ throwIfAborted: () => void;
43
+ addEventListener: {
44
+ <K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
45
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
46
+ };
47
+ removeEventListener: {
48
+ <K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
49
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
50
+ };
51
+ dispatchEvent: (event: Event) => boolean;
52
+ };
53
+ abort: (reason?: any) => void;
54
+ } | undefined;
55
+ }[], FileItem[] | {
56
+ id: string;
57
+ file: {
58
+ readonly lastModified: number;
59
+ readonly name: string;
60
+ readonly webkitRelativePath: string;
61
+ readonly size: number;
62
+ readonly type: string;
63
+ arrayBuffer: () => Promise<ArrayBuffer>;
64
+ bytes: () => Promise<Uint8Array<ArrayBuffer>>;
65
+ slice: (start?: number, end?: number, contentType?: string) => Blob;
66
+ stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
67
+ text: () => Promise<string>;
68
+ };
69
+ progress: number;
70
+ status: "uploading" | "success" | "error";
71
+ url?: string | undefined;
72
+ abortController?: {
73
+ readonly signal: {
74
+ readonly aborted: boolean;
75
+ onabort: ((this: AbortSignal, ev: Event) => any) | null;
76
+ readonly reason: any;
77
+ throwIfAborted: () => void;
78
+ addEventListener: {
79
+ <K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
80
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
81
+ };
82
+ removeEventListener: {
83
+ <K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
84
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
85
+ };
86
+ dispatchEvent: (event: Event) => boolean;
87
+ };
88
+ abort: (reason?: any) => void;
89
+ } | undefined;
90
+ }[]>;
91
+ uploadFiles: (files: File[]) => Promise<string[]>;
92
+ removeFileItem: (fileId: string) => void;
93
+ clearAllFiles: () => void;
94
+ };
@@ -0,0 +1,154 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var __async = (__this, __arguments, generator) => {
19
+ return new Promise((resolve, reject) => {
20
+ var fulfilled = (value) => {
21
+ try {
22
+ step(generator.next(value));
23
+ } catch (e) {
24
+ reject(e);
25
+ }
26
+ };
27
+ var rejected = (value) => {
28
+ try {
29
+ step(generator.throw(value));
30
+ } catch (e) {
31
+ reject(e);
32
+ }
33
+ };
34
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
35
+ step((generator = generator.apply(__this, __arguments)).next());
36
+ });
37
+ };
38
+ var stdin_exports = {};
39
+ __export(stdin_exports, {
40
+ useFileUpload: () => useFileUpload
41
+ });
42
+ module.exports = __toCommonJS(stdin_exports);
43
+ var import_vue = require("vue");
44
+ function useFileUpload(options) {
45
+ const fileItems = (0, import_vue.ref)([]);
46
+ const uploadFile = (file) => __async(this, null, function* () {
47
+ var _a, _b, _c;
48
+ if (file.size > options.maxSize) {
49
+ const error = new Error(
50
+ `File size exceeds maximum allowed (${options.maxSize / 1024 / 1024}MB)`
51
+ );
52
+ (_a = options.onError) == null ? void 0 : _a.call(options, error);
53
+ return null;
54
+ }
55
+ const abortController = new AbortController();
56
+ const fileId = crypto.randomUUID();
57
+ const newFileItem = {
58
+ id: fileId,
59
+ file,
60
+ progress: 0,
61
+ status: "uploading",
62
+ abortController
63
+ };
64
+ fileItems.value.push(newFileItem);
65
+ try {
66
+ if (!options.upload) {
67
+ throw new Error("Upload function is not defined");
68
+ }
69
+ const url = yield options.upload(
70
+ file,
71
+ (event) => {
72
+ const item = fileItems.value.find((i) => i.id === fileId);
73
+ if (item) {
74
+ item.progress = event.progress;
75
+ }
76
+ },
77
+ abortController.signal
78
+ );
79
+ if (!url)
80
+ throw new Error("Upload failed: No URL returned");
81
+ if (!abortController.signal.aborted) {
82
+ const item = fileItems.value.find((i) => i.id === fileId);
83
+ if (item) {
84
+ item.status = "success";
85
+ item.url = url;
86
+ item.progress = 100;
87
+ }
88
+ (_b = options.onSuccess) == null ? void 0 : _b.call(options, url);
89
+ return url;
90
+ }
91
+ return null;
92
+ } catch (error) {
93
+ if (!abortController.signal.aborted) {
94
+ const item = fileItems.value.find((i) => i.id === fileId);
95
+ if (item) {
96
+ item.status = "error";
97
+ item.progress = 0;
98
+ }
99
+ (_c = options.onError) == null ? void 0 : _c.call(options, error instanceof Error ? error : new Error("Upload failed"));
100
+ }
101
+ return null;
102
+ }
103
+ });
104
+ const uploadFiles = (files) => __async(this, null, function* () {
105
+ var _a, _b;
106
+ if (!files || files.length === 0) {
107
+ (_a = options.onError) == null ? void 0 : _a.call(options, new Error("No files to upload"));
108
+ return [];
109
+ }
110
+ if (options.limit && files.length > options.limit) {
111
+ (_b = options.onError) == null ? void 0 : _b.call(
112
+ options,
113
+ new Error(`Maximum ${options.limit} file${options.limit === 1 ? "" : "s"} allowed`)
114
+ );
115
+ return [];
116
+ }
117
+ const uploadPromises = files.map((file) => uploadFile(file));
118
+ const results = yield Promise.all(uploadPromises);
119
+ return results.filter((url) => url !== null);
120
+ });
121
+ const removeFileItem = (fileId) => {
122
+ const index = fileItems.value.findIndex((item) => item.id === fileId);
123
+ if (index !== -1) {
124
+ const item = fileItems.value[index];
125
+ if (item.abortController) {
126
+ item.abortController.abort();
127
+ }
128
+ if (item.url) {
129
+ URL.revokeObjectURL(item.url);
130
+ }
131
+ fileItems.value.splice(index, 1);
132
+ }
133
+ };
134
+ const clearAllFiles = () => {
135
+ fileItems.value.forEach((item) => {
136
+ if (item.abortController) {
137
+ item.abortController.abort();
138
+ }
139
+ if (item.url) {
140
+ URL.revokeObjectURL(item.url);
141
+ }
142
+ });
143
+ fileItems.value = [];
144
+ };
145
+ (0, import_vue.onBeforeUnmount)(() => {
146
+ clearAllFiles();
147
+ });
148
+ return {
149
+ fileItems,
150
+ uploadFiles,
151
+ removeFileItem,
152
+ clearAllFiles
153
+ };
154
+ }