@placeholderco/placeholder-ui 1.0.12 → 2.1.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 (278) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +134 -130
  3. package/dist/app.css +178 -0
  4. package/dist/bootstrap.min.css +3600 -0
  5. package/dist/cards/GitCard.svelte +115 -0
  6. package/dist/cards/GitCard.svelte.d.ts +22 -0
  7. package/dist/display/Avatar.svelte +29 -17
  8. package/dist/display/Avatar.svelte.d.ts +12 -2
  9. package/dist/display/LinkCollection.svelte +40 -18
  10. package/dist/display/LinkCollection.svelte.d.ts +9 -2
  11. package/dist/display/Paper.svelte +31 -19
  12. package/dist/display/Paper.svelte.d.ts +12 -3
  13. package/dist/display/alert/Alert.svelte +129 -0
  14. package/dist/display/alert/Alert.svelte.d.ts +15 -0
  15. package/dist/display/alert/AlertVariant.d.ts +1 -0
  16. package/dist/display/alert/AlertVariant.js +1 -0
  17. package/dist/display/filetree/FileTree.svelte +259 -0
  18. package/dist/display/filetree/FileTree.svelte.d.ts +76 -0
  19. package/dist/display/filetree/FileTreeItem.svelte +396 -0
  20. package/dist/display/filetree/FileTreeItem.svelte.d.ts +40 -0
  21. package/dist/display/filetree/FileTreeNode.d.ts +46 -0
  22. package/dist/display/filetree/FileTreeNode.js +115 -0
  23. package/dist/display/filetree/index.d.ts +5 -0
  24. package/dist/display/filetree/index.js +3 -0
  25. package/dist/editors/CodeMirror.svelte +306 -0
  26. package/dist/editors/CodeMirror.svelte.d.ts +31 -0
  27. package/dist/editors/tiptap/LinkActionMenu.svelte +307 -0
  28. package/dist/editors/tiptap/LinkActionMenu.svelte.d.ts +8 -0
  29. package/dist/editors/tiptap/TipTap.svelte +856 -0
  30. package/dist/editors/tiptap/TipTap.svelte.d.ts +54 -0
  31. package/dist/editors/tiptap/TipTapBubble.svelte +790 -0
  32. package/dist/editors/tiptap/TipTapBubble.svelte.d.ts +44 -0
  33. package/dist/editors/tiptap/collaboration.d.ts +55 -0
  34. package/dist/editors/tiptap/collaboration.js +1 -0
  35. package/dist/editors/tiptap/extensions/Alert.d.ts +18 -0
  36. package/dist/editors/tiptap/extensions/Alert.js +72 -0
  37. package/dist/editors/tiptap/extensions/CodeBlockEditor.d.ts +21 -0
  38. package/dist/editors/tiptap/extensions/CodeBlockEditor.js +326 -0
  39. package/dist/editors/tiptap/extensions/Div.d.ts +19 -0
  40. package/dist/editors/tiptap/extensions/Div.js +89 -0
  41. package/dist/editors/tiptap/extensions/Span.d.ts +5 -0
  42. package/dist/editors/tiptap/extensions/Span.js +56 -0
  43. package/dist/editors/tiptap/extensions/codeBlockEditor.css +236 -0
  44. package/dist/editors/tiptap/extensions/codeBlockLanguages.d.ts +17 -0
  45. package/dist/editors/tiptap/extensions/codeBlockLanguages.js +124 -0
  46. package/dist/editors/tiptap/extensions/index.d.ts +7 -0
  47. package/dist/editors/tiptap/extensions/index.js +5 -0
  48. package/dist/editors/tiptap/toolbar/AlertButton.svelte +261 -0
  49. package/dist/editors/tiptap/toolbar/AlertButton.svelte.d.ts +7 -0
  50. package/dist/editors/tiptap/toolbar/AlignCenterButton.svelte +18 -0
  51. package/dist/editors/tiptap/toolbar/AlignCenterButton.svelte.d.ts +7 -0
  52. package/dist/editors/tiptap/toolbar/AlignJustifyButton.svelte +18 -0
  53. package/dist/editors/tiptap/toolbar/AlignJustifyButton.svelte.d.ts +7 -0
  54. package/dist/editors/tiptap/toolbar/AlignLeftButton.svelte +18 -0
  55. package/dist/editors/tiptap/toolbar/AlignLeftButton.svelte.d.ts +7 -0
  56. package/dist/editors/tiptap/toolbar/AlignRightButton.svelte +18 -0
  57. package/dist/editors/tiptap/toolbar/AlignRightButton.svelte.d.ts +7 -0
  58. package/dist/editors/tiptap/toolbar/BoldButton.svelte +18 -0
  59. package/dist/editors/tiptap/toolbar/BoldButton.svelte.d.ts +7 -0
  60. package/dist/editors/tiptap/toolbar/BulletListButton.svelte +18 -0
  61. package/dist/editors/tiptap/toolbar/BulletListButton.svelte.d.ts +7 -0
  62. package/dist/editors/tiptap/toolbar/CodeBlockButton.svelte +18 -0
  63. package/dist/editors/tiptap/toolbar/CodeBlockButton.svelte.d.ts +7 -0
  64. package/dist/editors/tiptap/toolbar/CodeButton.svelte +18 -0
  65. package/dist/editors/tiptap/toolbar/CodeButton.svelte.d.ts +7 -0
  66. package/dist/editors/tiptap/toolbar/ColorButton.svelte +299 -0
  67. package/dist/editors/tiptap/toolbar/ColorButton.svelte.d.ts +20 -0
  68. package/dist/editors/tiptap/toolbar/DocumentButton.svelte +58 -0
  69. package/dist/editors/tiptap/toolbar/DocumentButton.svelte.d.ts +9 -0
  70. package/dist/editors/tiptap/toolbar/HeadingButton.svelte +30 -0
  71. package/dist/editors/tiptap/toolbar/HeadingButton.svelte.d.ts +8 -0
  72. package/dist/editors/tiptap/toolbar/HtmlButton.svelte +68 -0
  73. package/dist/editors/tiptap/toolbar/HtmlButton.svelte.d.ts +7 -0
  74. package/dist/editors/tiptap/toolbar/ImageButton.svelte +54 -0
  75. package/dist/editors/tiptap/toolbar/ImageButton.svelte.d.ts +8 -0
  76. package/dist/editors/tiptap/toolbar/ItalicButton.svelte +18 -0
  77. package/dist/editors/tiptap/toolbar/ItalicButton.svelte.d.ts +7 -0
  78. package/dist/editors/tiptap/toolbar/LinkButton.svelte +257 -0
  79. package/dist/editors/tiptap/toolbar/LinkButton.svelte.d.ts +7 -0
  80. package/dist/editors/tiptap/toolbar/OrderedListButton.svelte +18 -0
  81. package/dist/editors/tiptap/toolbar/OrderedListButton.svelte.d.ts +7 -0
  82. package/dist/editors/tiptap/toolbar/RedoButton.svelte +18 -0
  83. package/dist/editors/tiptap/toolbar/RedoButton.svelte.d.ts +7 -0
  84. package/dist/editors/tiptap/toolbar/StrikethroughButton.svelte +18 -0
  85. package/dist/editors/tiptap/toolbar/StrikethroughButton.svelte.d.ts +7 -0
  86. package/dist/editors/tiptap/toolbar/SubscriptButton.svelte +18 -0
  87. package/dist/editors/tiptap/toolbar/SubscriptButton.svelte.d.ts +7 -0
  88. package/dist/editors/tiptap/toolbar/SuperscriptButton.svelte +18 -0
  89. package/dist/editors/tiptap/toolbar/SuperscriptButton.svelte.d.ts +7 -0
  90. package/dist/editors/tiptap/toolbar/TableButton.svelte +258 -0
  91. package/dist/editors/tiptap/toolbar/TableButton.svelte.d.ts +7 -0
  92. package/dist/editors/tiptap/toolbar/ToolbarButton.svelte +84 -0
  93. package/dist/editors/tiptap/toolbar/ToolbarButton.svelte.d.ts +10 -0
  94. package/dist/editors/tiptap/toolbar/UnderlineButton.svelte +18 -0
  95. package/dist/editors/tiptap/toolbar/UnderlineButton.svelte.d.ts +7 -0
  96. package/dist/editors/tiptap/toolbar/UndoButton.svelte +18 -0
  97. package/dist/editors/tiptap/toolbar/UndoButton.svelte.d.ts +7 -0
  98. package/dist/form/Autocomplete.svelte +86 -135
  99. package/dist/form/Autocomplete.svelte.d.ts +6 -8
  100. package/dist/form/AutocompleteMulti.svelte +385 -227
  101. package/dist/form/AutocompleteMulti.svelte.d.ts +59 -10
  102. package/dist/form/Checkbox.svelte +59 -54
  103. package/dist/form/Checkbox.svelte.d.ts +14 -5
  104. package/dist/form/Chips.svelte +29 -13
  105. package/dist/form/Chips.svelte.d.ts +16 -2
  106. package/dist/form/ColorPicker.svelte +957 -0
  107. package/dist/form/ColorPicker.svelte.d.ts +78 -0
  108. package/dist/form/ComboBox.svelte +30 -20
  109. package/dist/form/ComboBox.svelte.d.ts +1 -1
  110. package/dist/form/ComboBoxItemBuilder.svelte +161 -188
  111. package/dist/form/ComboBoxItemBuilder.svelte.d.ts +19 -2
  112. package/dist/form/ComboBoxMulti.svelte +38 -24
  113. package/dist/form/ComboBoxMulti.svelte.d.ts +1 -1
  114. package/dist/form/CronBuilder.svelte +84 -67
  115. package/dist/form/CronBuilder.svelte.d.ts +16 -3
  116. package/dist/form/DatePicker.svelte +148 -195
  117. package/dist/form/DateRangePicker.svelte +101 -98
  118. package/dist/form/DateTimePicker.svelte +167 -208
  119. package/dist/form/DateTimePicker.svelte.d.ts +10 -2
  120. package/dist/form/FormGroup.svelte +33 -10
  121. package/dist/form/FormGroup.svelte.d.ts +12 -2
  122. package/dist/form/Number.svelte +70 -47
  123. package/dist/form/Number.svelte.d.ts +36 -6
  124. package/dist/form/Radio.svelte +18 -18
  125. package/dist/form/RadioGroup.svelte +23 -12
  126. package/dist/form/RadioGroup.svelte.d.ts +13 -2
  127. package/dist/form/SegmentedControl.svelte +76 -56
  128. package/dist/form/SegmentedControl.svelte.d.ts +9 -4
  129. package/dist/form/Select.svelte +150 -233
  130. package/dist/form/Select.svelte.d.ts +29 -5
  131. package/dist/form/SelectMulti.svelte +163 -277
  132. package/dist/form/SelectMulti.svelte.d.ts +36 -7
  133. package/dist/form/Slider.svelte +183 -269
  134. package/dist/form/Slider.svelte.d.ts +32 -17
  135. package/dist/form/StringArrayBuilder.svelte +249 -0
  136. package/dist/form/StringArrayBuilder.svelte.d.ts +15 -0
  137. package/dist/form/Switch.svelte +164 -106
  138. package/dist/form/Switch.svelte.d.ts +22 -3
  139. package/dist/form/TextArea.svelte +49 -29
  140. package/dist/form/TextArea.svelte.d.ts +23 -3
  141. package/dist/form/Textbox.svelte +69 -68
  142. package/dist/form/Textbox.svelte.d.ts +32 -4
  143. package/dist/form/TimePicker.svelte +42 -47
  144. package/dist/form/TimePicker.svelte.d.ts +12 -2
  145. package/dist/form/comboBoxCore.svelte.d.ts +99 -0
  146. package/dist/form/comboBoxCore.svelte.js +243 -0
  147. package/dist/icon/Icon.svelte +8 -3
  148. package/dist/icon/Icon.svelte.d.ts +8 -3
  149. package/dist/icon/file-type-bmp.svg +1 -0
  150. package/dist/icon/file-type-csv.svg +1 -0
  151. package/dist/icon/file-type-doc.svg +1 -0
  152. package/dist/icon/file-type-docx.svg +1 -0
  153. package/dist/icon/file-type-jpg.svg +1 -0
  154. package/dist/icon/file-type-pdf.svg +1 -0
  155. package/dist/icon/file-type-png.svg +1 -0
  156. package/dist/icon/file-type-ppt.svg +1 -0
  157. package/dist/icon/file-type-svg.svg +1 -0
  158. package/dist/icon/file-type-txt.svg +1 -0
  159. package/dist/icon/file-type-xls.svg +1 -0
  160. package/dist/icon/file-type-zip.svg +1 -0
  161. package/dist/icon/index.d.ts +166 -151
  162. package/dist/icon/index.js +166 -152
  163. package/dist/icon/logo-placeholder.svg +6 -0
  164. package/dist/icon/source-code.svg +1 -0
  165. package/dist/icon/sun-moon.svg +1 -0
  166. package/dist/icon/table.svg +6 -0
  167. package/dist/index.d.ts +146 -82
  168. package/dist/index.js +77 -78
  169. package/dist/layout/AppShell.svelte +12 -162
  170. package/dist/layout/AppShell.svelte.d.ts +6 -27
  171. package/dist/layout/CustomNavbar.svelte +9 -7
  172. package/dist/layout/CustomNavbar.svelte.d.ts +4 -2
  173. package/dist/layout/Navbar.svelte +161 -129
  174. package/dist/layout/Navbar.svelte.d.ts +29 -15
  175. package/dist/layout/NavbarItemDisplay.svelte +2 -2
  176. package/dist/layout/NavbarItemView.svelte +182 -0
  177. package/dist/layout/NavbarItemView.svelte.d.ts +10 -0
  178. package/dist/layout/Sidenav.svelte +280 -341
  179. package/dist/layout/Sidenav.svelte.d.ts +36 -4
  180. package/dist/models/ComboBoxItem.d.ts +2 -0
  181. package/dist/models/Employee.d.ts +53 -0
  182. package/dist/models/Employee.js +23 -0
  183. package/dist/models/Hyperlink.d.ts +3 -1
  184. package/dist/models/LinkCollectionItem.d.ts +3 -1
  185. package/dist/models/NavbarItem.d.ts +6 -2
  186. package/dist/theme.svelte.d.ts +0 -1
  187. package/dist/theme.svelte.js +46 -58
  188. package/dist/ui/Accordion.svelte +81 -242
  189. package/dist/ui/Accordion.svelte.d.ts +37 -14
  190. package/dist/ui/AccordionItem.svelte +303 -0
  191. package/dist/ui/AccordionItem.svelte.d.ts +21 -0
  192. package/dist/ui/ActionIcon.svelte +25 -21
  193. package/dist/ui/ActionIcon.svelte.d.ts +15 -2
  194. package/dist/ui/Badge.svelte +163 -171
  195. package/dist/ui/Badge.svelte.d.ts +13 -5
  196. package/dist/ui/Button.svelte +178 -205
  197. package/dist/ui/Button.svelte.d.ts +19 -2
  198. package/dist/ui/ButtonVariant.d.ts +15 -1
  199. package/dist/ui/ContextMenu.svelte +146 -0
  200. package/dist/ui/ContextMenu.svelte.d.ts +37 -0
  201. package/dist/ui/ContextMenuList.svelte +188 -0
  202. package/dist/ui/ContextMenuList.svelte.d.ts +12 -0
  203. package/dist/ui/Dialog.svelte +183 -111
  204. package/dist/ui/Dialog.svelte.d.ts +21 -4
  205. package/dist/ui/Drawer.svelte +237 -184
  206. package/dist/ui/Drawer.svelte.d.ts +20 -2
  207. package/dist/ui/Dropdown.svelte +24 -14
  208. package/dist/ui/Dropdown.svelte.d.ts +11 -2
  209. package/dist/ui/Dropzone.svelte +159 -57
  210. package/dist/ui/Dropzone.svelte.d.ts +29 -2
  211. package/dist/ui/Link.svelte +12 -4
  212. package/dist/ui/Link.svelte.d.ts +8 -2
  213. package/dist/ui/Loader.svelte +23 -18
  214. package/dist/ui/Loader.svelte.d.ts +5 -2
  215. package/dist/ui/Logo.svelte +37 -0
  216. package/dist/ui/Logo.svelte.d.ts +16 -0
  217. package/dist/ui/MultiSortable.svelte +287 -0
  218. package/dist/ui/MultiSortable.svelte.d.ts +50 -0
  219. package/dist/ui/Pagination.svelte +15 -9
  220. package/dist/ui/Pagination.svelte.d.ts +6 -2
  221. package/dist/ui/Popover.svelte +43 -65
  222. package/dist/ui/Popover.svelte.d.ts +14 -5
  223. package/dist/ui/ProgressBar.svelte +28 -30
  224. package/dist/ui/ProgressBarVariant.d.ts +7 -1
  225. package/dist/ui/SegmentedControl.svelte +0 -0
  226. package/dist/ui/SegmentedControl.svelte.d.ts +26 -0
  227. package/dist/ui/Sortable.svelte +163 -0
  228. package/dist/ui/Sortable.svelte.d.ts +47 -0
  229. package/dist/ui/Table.svelte +383 -80
  230. package/dist/ui/Table.svelte.d.ts +43 -2
  231. package/dist/ui/Tabs.svelte +22 -18
  232. package/dist/ui/Tabs.svelte.d.ts +6 -2
  233. package/dist/ui/ThemeSwitcher.svelte +26 -7
  234. package/dist/ui/ThemeSwitcher.svelte.d.ts +4 -2
  235. package/dist/ui/Tooltip.svelte +312 -180
  236. package/dist/ui/Tooltip.svelte.d.ts +4 -3
  237. package/dist/uiTheme.svelte.d.ts +86 -0
  238. package/dist/uiTheme.svelte.js +214 -0
  239. package/dist/util/DateFunctions.js +1 -1
  240. package/dist/util/DragDrop.d.ts +50 -0
  241. package/dist/util/DragDrop.js +154 -0
  242. package/dist/util/NavigateTo.js +2 -2
  243. package/dist/util/dayjs.d.ts +4 -0
  244. package/dist/util/dayjs.js +15 -0
  245. package/package.json +66 -26
  246. package/dist/display/Alert.svelte +0 -179
  247. package/dist/display/Alert.svelte.d.ts +0 -13
  248. package/dist/form/FileInput.svelte +0 -235
  249. package/dist/form/FileInput.svelte.d.ts +0 -23
  250. package/dist/form/PasswordInput.svelte +0 -253
  251. package/dist/form/PasswordInput.svelte.d.ts +0 -34
  252. package/dist/form/Rating.svelte +0 -235
  253. package/dist/form/Rating.svelte.d.ts +0 -21
  254. package/dist/styles/components.css +0 -199
  255. package/dist/styles/dark.css +0 -146
  256. package/dist/styles/index.css +0 -116
  257. package/dist/styles/reset.css +0 -110
  258. package/dist/styles/semantic.css +0 -86
  259. package/dist/styles/tokens.css +0 -203
  260. package/dist/styles/utilities.css +0 -523
  261. package/dist/ui/Breadcrumbs.svelte +0 -131
  262. package/dist/ui/Breadcrumbs.svelte.d.ts +0 -16
  263. package/dist/ui/LoadingOverlay.svelte +0 -53
  264. package/dist/ui/LoadingOverlay.svelte.d.ts +0 -11
  265. package/dist/ui/Progress.svelte +0 -191
  266. package/dist/ui/Progress.svelte.d.ts +0 -15
  267. package/dist/ui/RingProgress.svelte +0 -141
  268. package/dist/ui/RingProgress.svelte.d.ts +0 -18
  269. package/dist/ui/Skeleton.svelte +0 -85
  270. package/dist/ui/Skeleton.svelte.d.ts +0 -12
  271. package/dist/ui/Stepper.svelte +0 -355
  272. package/dist/ui/Stepper.svelte.d.ts +0 -24
  273. package/dist/ui/Timeline.svelte +0 -225
  274. package/dist/ui/Timeline.svelte.d.ts +0 -23
  275. /package/dist/{actions → util}/ClickOutside.d.ts +0 -0
  276. /package/dist/{actions → util}/ClickOutside.js +0 -0
  277. /package/dist/{transitions → util}/Transitions.d.ts +0 -0
  278. /package/dist/{transitions → util}/Transitions.js +0 -0
@@ -0,0 +1,68 @@
1
+ <script lang="ts">
2
+ import type { Editor } from '@tiptap/core'
3
+ import ToolbarButton from './ToolbarButton.svelte'
4
+ import Dialog from '../../../ui/Dialog.svelte'
5
+ import Button from '../../../ui/Button.svelte'
6
+ import CodeMirror from '../../CodeMirror.svelte'
7
+ import { iconCode } from '../../../icon/index.js'
8
+ import { themeState } from '../../../theme.svelte.js'
9
+
10
+ interface Props {
11
+ editor: Editor
12
+ }
13
+
14
+ let { editor }: Props = $props()
15
+
16
+ let showDialog = $state(false)
17
+ let htmlContent = $state('')
18
+ let codeMirrorRef: any
19
+
20
+ const openHtmlEditor = () => {
21
+ htmlContent = editor.getHTML()
22
+ showDialog = true
23
+ }
24
+
25
+ const closeDialog = () => {
26
+ showDialog = false
27
+ }
28
+
29
+ const saveHtml = () => {
30
+ if (codeMirrorRef) {
31
+ const newHtml = codeMirrorRef.getValue()
32
+ editor.commands.setContent(newHtml)
33
+ }
34
+ closeDialog()
35
+ }
36
+ </script>
37
+
38
+ <ToolbarButton
39
+ icon={iconCode}
40
+ title="Edit HTML"
41
+ onclick={openHtmlEditor}
42
+ />
43
+
44
+ <Dialog bind:show={showDialog} title="Edit HTML" size="full" preventOverflow={false}>
45
+ <div class="html-editor-container">
46
+ <CodeMirror
47
+ bind:this={codeMirrorRef}
48
+ value={htmlContent}
49
+ language="html"
50
+ theme={themeState.isDarkMode ? 'dark' : 'light'}
51
+ height="100%"
52
+ />
53
+ </div>
54
+
55
+ {#snippet footer()}
56
+ <Button variant="secondary" onclick={closeDialog}>Cancel</Button>
57
+ <Button onclick={saveHtml}>Save</Button>
58
+ {/snippet}
59
+ </Dialog>
60
+
61
+ <style>
62
+ .html-editor-container {
63
+ width: 100%;
64
+ height: calc(100vh - 200px);
65
+ max-height: 600px;
66
+ min-height: 300px;
67
+ }
68
+ </style>
@@ -0,0 +1,7 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ interface Props {
3
+ editor: Editor;
4
+ }
5
+ declare const HtmlButton: import("svelte").Component<Props, {}, "">;
6
+ type HtmlButton = ReturnType<typeof HtmlButton>;
7
+ export default HtmlButton;
@@ -0,0 +1,54 @@
1
+ <script lang="ts">
2
+ import type { Editor } from '@tiptap/core'
3
+ import ToolbarButton from './ToolbarButton.svelte'
4
+ import { iconPhoto } from '../../../icon/index.js'
5
+
6
+ interface Props {
7
+ editor: Editor
8
+ onImageUpload?: (file: File) => Promise<string | null>
9
+ }
10
+
11
+ let { editor, onImageUpload }: Props = $props()
12
+
13
+ let fileInputElement: HTMLInputElement | undefined = $state()
14
+
15
+ const handleFileSelect = async (event: Event) => {
16
+ const target = event.target as HTMLInputElement
17
+ const file = target.files?.[0]
18
+
19
+ if (!file || !onImageUpload) return
20
+
21
+ try {
22
+ const imageUrl = await onImageUpload(file)
23
+
24
+ if (imageUrl) {
25
+ editor.chain().focus().setImage({ src: imageUrl }).run()
26
+ }
27
+ } catch (error) {
28
+ console.error('Failed to upload image:', error)
29
+ }
30
+
31
+ // Reset the input
32
+ if (fileInputElement) {
33
+ fileInputElement.value = ''
34
+ }
35
+ }
36
+
37
+ const openFilePicker = () => {
38
+ fileInputElement?.click()
39
+ }
40
+ </script>
41
+
42
+ <input
43
+ type="file"
44
+ accept="image/*"
45
+ bind:this={fileInputElement}
46
+ onchange={handleFileSelect}
47
+ style="display: none;"
48
+ />
49
+
50
+ <ToolbarButton
51
+ icon={iconPhoto}
52
+ title="Add Image"
53
+ onclick={openFilePicker}
54
+ />
@@ -0,0 +1,8 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ interface Props {
3
+ editor: Editor;
4
+ onImageUpload?: (file: File) => Promise<string | null>;
5
+ }
6
+ declare const ImageButton: import("svelte").Component<Props, {}, "">;
7
+ type ImageButton = ReturnType<typeof ImageButton>;
8
+ export default ImageButton;
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ import type { Editor } from '@tiptap/core'
3
+ import ToolbarButton from './ToolbarButton.svelte'
4
+ import { iconItalic } from '../../../icon/index.js'
5
+
6
+ interface Props {
7
+ editor: Editor
8
+ }
9
+
10
+ let { editor }: Props = $props()
11
+ </script>
12
+
13
+ <ToolbarButton
14
+ icon={iconItalic}
15
+ title="Italic"
16
+ active={editor.isActive('italic')}
17
+ onclick={() => editor.chain().focus().toggleItalic().run()}
18
+ />
@@ -0,0 +1,7 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ interface Props {
3
+ editor: Editor;
4
+ }
5
+ declare const ItalicButton: import("svelte").Component<Props, {}, "">;
6
+ type ItalicButton = ReturnType<typeof ItalicButton>;
7
+ export default ItalicButton;
@@ -0,0 +1,257 @@
1
+ <script lang="ts">
2
+ import type { Editor } from '@tiptap/core'
3
+ import ToolbarButton from './ToolbarButton.svelte'
4
+ import { iconLink } from '../../../icon/index.js'
5
+
6
+ interface Props {
7
+ editor: Editor
8
+ }
9
+
10
+ let { editor }: Props = $props()
11
+
12
+ let showLinkInput = $state(false)
13
+ let linkUrl = $state('')
14
+ let linkOpenInNewTab = $state(false)
15
+ let linkInputElement: HTMLInputElement | undefined = $state()
16
+ let linkDropdownElement: HTMLDivElement | undefined = $state()
17
+
18
+ const toggleLink = () => {
19
+ const attrs = editor.getAttributes('link')
20
+ linkUrl = attrs?.href || ''
21
+ linkOpenInNewTab = attrs?.target === '_blank'
22
+ showLinkInput = !showLinkInput
23
+
24
+ if (showLinkInput) {
25
+ setTimeout(() => {
26
+ linkInputElement?.focus()
27
+ linkInputElement?.select()
28
+ }, 0)
29
+ }
30
+ }
31
+
32
+ const setLink = () => {
33
+ if (linkUrl === '') {
34
+ editor.chain().focus().extendMarkRange('link').unsetLink().run()
35
+ } else {
36
+ const linkAttrs: { href: string; target?: string; rel?: string } = { href: linkUrl }
37
+ if (linkOpenInNewTab) {
38
+ linkAttrs.target = '_blank'
39
+ linkAttrs.rel = 'noopener noreferrer'
40
+ }
41
+ editor.chain().focus().extendMarkRange('link').setLink(linkAttrs).run()
42
+ }
43
+ showLinkInput = false
44
+ linkUrl = ''
45
+ linkOpenInNewTab = false
46
+ }
47
+
48
+ const updateLinkTarget = () => {
49
+ if (!linkUrl) return
50
+
51
+ const linkAttrs: { href: string; target?: string; rel?: string } = { href: linkUrl }
52
+ if (linkOpenInNewTab) {
53
+ linkAttrs.target = '_blank'
54
+ linkAttrs.rel = 'noopener noreferrer'
55
+ }
56
+
57
+ if (editor.isActive('link')) {
58
+ editor.chain().focus().extendMarkRange('link').setLink(linkAttrs).run()
59
+ } else if (!editor.state.selection.empty) {
60
+ editor.chain().focus().setLink(linkAttrs).run()
61
+ }
62
+ }
63
+
64
+ const removeLink = () => {
65
+ editor.chain().focus().extendMarkRange('link').unsetLink().run()
66
+ showLinkInput = false
67
+ linkUrl = ''
68
+ linkOpenInNewTab = false
69
+ }
70
+
71
+ const handleLinkKeydown = (e: KeyboardEvent) => {
72
+ if (e.key === 'Enter') {
73
+ e.preventDefault()
74
+ setLink()
75
+ } else if (e.key === 'Escape') {
76
+ showLinkInput = false
77
+ linkUrl = ''
78
+ linkOpenInNewTab = false
79
+ }
80
+ }
81
+ </script>
82
+
83
+ <div style="position: relative; display: inline-block;">
84
+ <ToolbarButton
85
+ icon={iconLink}
86
+ title="Link"
87
+ active={editor.isActive('link')}
88
+ onclick={toggleLink}
89
+ />
90
+
91
+ {#if showLinkInput}
92
+ <div class="link-dropdown" bind:this={linkDropdownElement}>
93
+ <div class="link-input-row">
94
+ <input
95
+ type="text"
96
+ bind:this={linkInputElement}
97
+ bind:value={linkUrl}
98
+ onkeydown={handleLinkKeydown}
99
+ placeholder="Enter URL"
100
+ class="link-input"
101
+ />
102
+ <button onclick={setLink} class="link-submit-button" title="Apply">✓</button>
103
+ {#if editor.isActive('link')}
104
+ <button onclick={removeLink} class="link-remove-button" title="Remove Link">✕</button>
105
+ {/if}
106
+ </div>
107
+ <label class="link-checkbox-label">
108
+ <input
109
+ type="checkbox"
110
+ bind:checked={linkOpenInNewTab}
111
+ onchange={updateLinkTarget}
112
+ class="link-checkbox"
113
+ />
114
+ <span>Open in new tab</span>
115
+ </label>
116
+ </div>
117
+ {/if}
118
+ </div>
119
+
120
+ <style>
121
+ .link-dropdown {
122
+ position: absolute;
123
+ top: 100%;
124
+ left: 0;
125
+ margin-top: 4px;
126
+ display: flex;
127
+ flex-direction: column;
128
+ gap: 8px;
129
+ padding: 8px;
130
+ background: var(--paper-body-bg);
131
+ border: 1px solid var(--border-color);
132
+ border-radius: 4px;
133
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
134
+ z-index: 1000;
135
+ min-width: 320px;
136
+ }
137
+
138
+ :global(.dark) .link-dropdown {
139
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
140
+ }
141
+
142
+ .link-input-row {
143
+ display: flex;
144
+ gap: 4px;
145
+ }
146
+
147
+ .link-input {
148
+ flex: 1;
149
+ padding: 6px 10px;
150
+ border: 1px solid var(--border-color);
151
+ border-radius: 4px;
152
+ font-size: 14px;
153
+ outline: none;
154
+ font-family: inherit;
155
+ background: var(--paper-body-bg);
156
+ color: var(--text-color);
157
+ }
158
+
159
+ .link-input::placeholder {
160
+ color: var(--placeholder-color);
161
+ }
162
+
163
+ .link-input:focus {
164
+ border-color: var(--ui-primary);
165
+ box-shadow: 0 0 0 2px rgba(var(--ui-primary-rgbc), 0.1);
166
+ }
167
+
168
+ :global(.dark) .link-input:focus {
169
+ border-color: var(--ui-accent);
170
+ box-shadow: 0 0 0 2px rgba(var(--ui-accent-rgbc), 0.1);
171
+ }
172
+
173
+ .link-checkbox-label {
174
+ display: flex;
175
+ align-items: center;
176
+ gap: 6px;
177
+ font-size: 14px;
178
+ color: var(--text-color);
179
+ cursor: pointer;
180
+ user-select: none;
181
+ }
182
+
183
+ .link-checkbox {
184
+ width: 16px;
185
+ height: 16px;
186
+ cursor: pointer;
187
+ accent-color: var(--ui-primary);
188
+ }
189
+
190
+ :global(.dark) .link-checkbox {
191
+ accent-color: var(--ui-accent);
192
+ }
193
+
194
+ .link-checkbox-label:hover {
195
+ color: var(--ui-primary);
196
+ }
197
+
198
+ :global(.dark) .link-checkbox-label:hover {
199
+ color: var(--ui-accent);
200
+ }
201
+
202
+ .link-submit-button {
203
+ display: flex;
204
+ align-items: center;
205
+ justify-content: center;
206
+ padding: 6px 12px;
207
+ border: none;
208
+ background: var(--ui-primary);
209
+ color: white;
210
+ border-radius: 4px;
211
+ cursor: pointer;
212
+ font-size: 16px;
213
+ font-weight: bold;
214
+ transition: background 0.15s ease;
215
+ }
216
+
217
+ .link-submit-button:hover {
218
+ background: var(--ui-tertiary-dark);
219
+ }
220
+
221
+ :global(.dark) .link-submit-button {
222
+ background: var(--ui-accent);
223
+ color: var(--ui-primary);
224
+ }
225
+
226
+ :global(.dark) .link-submit-button:hover {
227
+ background: var(--ui-accent-dark);
228
+ }
229
+
230
+ .link-remove-button {
231
+ display: flex;
232
+ align-items: center;
233
+ justify-content: center;
234
+ padding: 6px 12px;
235
+ border: none;
236
+ background: var(--ui-tertiary);
237
+ color: var(--ui-primary);
238
+ border-radius: 4px;
239
+ cursor: pointer;
240
+ font-size: 16px;
241
+ font-weight: bold;
242
+ transition: background 0.15s ease;
243
+ }
244
+
245
+ .link-remove-button:hover {
246
+ background: var(--ui-tertiary-dark);
247
+ }
248
+
249
+ :global(.dark) .link-remove-button {
250
+ background: var(--ui-accent);
251
+ color: var(--ui-primary);
252
+ }
253
+
254
+ :global(.dark) .link-remove-button:hover {
255
+ background: var(--ui-accent-dark);
256
+ }
257
+ </style>
@@ -0,0 +1,7 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ interface Props {
3
+ editor: Editor;
4
+ }
5
+ declare const LinkButton: import("svelte").Component<Props, {}, "">;
6
+ type LinkButton = ReturnType<typeof LinkButton>;
7
+ export default LinkButton;
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ import type { Editor } from '@tiptap/core'
3
+ import ToolbarButton from './ToolbarButton.svelte'
4
+ import { iconListNumbers } from '../../../icon/index.js'
5
+
6
+ interface Props {
7
+ editor: Editor
8
+ }
9
+
10
+ let { editor }: Props = $props()
11
+ </script>
12
+
13
+ <ToolbarButton
14
+ icon={iconListNumbers}
15
+ title="Numbered List"
16
+ active={editor.isActive('orderedList')}
17
+ onclick={() => editor.chain().focus().toggleOrderedList().run()}
18
+ />
@@ -0,0 +1,7 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ interface Props {
3
+ editor: Editor;
4
+ }
5
+ declare const OrderedListButton: import("svelte").Component<Props, {}, "">;
6
+ type OrderedListButton = ReturnType<typeof OrderedListButton>;
7
+ export default OrderedListButton;
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ import type { Editor } from '@tiptap/core'
3
+ import ToolbarButton from './ToolbarButton.svelte'
4
+ import { iconArrowForwardUp } from '../../../icon/index.js'
5
+
6
+ interface Props {
7
+ editor: Editor
8
+ }
9
+
10
+ let { editor }: Props = $props()
11
+ </script>
12
+
13
+ <ToolbarButton
14
+ icon={iconArrowForwardUp}
15
+ title="Redo"
16
+ disabled={!editor.can().redo()}
17
+ onclick={() => editor.chain().focus().redo().run()}
18
+ />
@@ -0,0 +1,7 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ interface Props {
3
+ editor: Editor;
4
+ }
5
+ declare const RedoButton: import("svelte").Component<Props, {}, "">;
6
+ type RedoButton = ReturnType<typeof RedoButton>;
7
+ export default RedoButton;
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ import type { Editor } from '@tiptap/core'
3
+ import ToolbarButton from './ToolbarButton.svelte'
4
+ import { iconStrikethrough } from '../../../icon/index.js'
5
+
6
+ interface Props {
7
+ editor: Editor
8
+ }
9
+
10
+ let { editor }: Props = $props()
11
+ </script>
12
+
13
+ <ToolbarButton
14
+ icon={iconStrikethrough}
15
+ title="Strikethrough"
16
+ active={editor.isActive('strike')}
17
+ onclick={() => editor.chain().focus().toggleStrike().run()}
18
+ />
@@ -0,0 +1,7 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ interface Props {
3
+ editor: Editor;
4
+ }
5
+ declare const StrikethroughButton: import("svelte").Component<Props, {}, "">;
6
+ type StrikethroughButton = ReturnType<typeof StrikethroughButton>;
7
+ export default StrikethroughButton;
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ import type { Editor } from '@tiptap/core'
3
+ import ToolbarButton from './ToolbarButton.svelte'
4
+ import { iconSubscript } from '../../../icon/index.js'
5
+
6
+ interface Props {
7
+ editor: Editor
8
+ }
9
+
10
+ let { editor }: Props = $props()
11
+ </script>
12
+
13
+ <ToolbarButton
14
+ icon={iconSubscript}
15
+ title="Subscript"
16
+ active={editor.isActive('subscript')}
17
+ onclick={() => editor.chain().focus().toggleSubscript().run()}
18
+ />
@@ -0,0 +1,7 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ interface Props {
3
+ editor: Editor;
4
+ }
5
+ declare const SubscriptButton: import("svelte").Component<Props, {}, "">;
6
+ type SubscriptButton = ReturnType<typeof SubscriptButton>;
7
+ export default SubscriptButton;
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ import type { Editor } from '@tiptap/core'
3
+ import ToolbarButton from './ToolbarButton.svelte'
4
+ import { iconSuperscript } from '../../../icon/index.js'
5
+
6
+ interface Props {
7
+ editor: Editor
8
+ }
9
+
10
+ let { editor }: Props = $props()
11
+ </script>
12
+
13
+ <ToolbarButton
14
+ icon={iconSuperscript}
15
+ title="Superscript"
16
+ active={editor.isActive('superscript')}
17
+ onclick={() => editor.chain().focus().toggleSuperscript().run()}
18
+ />
@@ -0,0 +1,7 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ interface Props {
3
+ editor: Editor;
4
+ }
5
+ declare const SuperscriptButton: import("svelte").Component<Props, {}, "">;
6
+ type SuperscriptButton = ReturnType<typeof SuperscriptButton>;
7
+ export default SuperscriptButton;