@sierra-95/svelte-scaffold 1.0.1

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 (146) hide show
  1. package/README.md +8 -0
  2. package/dist/Hooks/layout_menu.d.ts +1 -0
  3. package/dist/Hooks/layout_menu.js +24 -0
  4. package/dist/Hooks/preview.d.ts +3 -0
  5. package/dist/Hooks/preview.js +24 -0
  6. package/dist/components/Core/Alerts/Backdrop/backdrop.svelte +27 -0
  7. package/dist/components/Core/Alerts/Backdrop/backdrop.svelte.d.ts +15 -0
  8. package/dist/components/Core/Alerts/Modal/modal.svelte +40 -0
  9. package/dist/components/Core/Alerts/Modal/modal.svelte.d.ts +26 -0
  10. package/dist/components/Core/Alerts/Toast/toast.css +39 -0
  11. package/dist/components/Core/Alerts/Toast/toast.svelte +32 -0
  12. package/dist/components/Core/Alerts/Toast/toast.svelte.d.ts +26 -0
  13. package/dist/components/Core/Alerts/Wrapper/wrapper.svelte +19 -0
  14. package/dist/components/Core/Alerts/Wrapper/wrapper.svelte.d.ts +17 -0
  15. package/dist/components/Core/Alerts/site-under-maintenance/site-under-maintenance.svelte +34 -0
  16. package/dist/components/Core/Alerts/site-under-maintenance/site-under-maintenance.svelte.d.ts +11 -0
  17. package/dist/components/Core/Form/Hr/hr.svelte +11 -0
  18. package/dist/components/Core/Form/Hr/hr.svelte.d.ts +21 -0
  19. package/dist/components/Core/Form/Input/FileInput/fileInput.svelte +130 -0
  20. package/dist/components/Core/Form/Input/FileInput/fileInput.svelte.d.ts +6 -0
  21. package/dist/components/Core/Form/Input/FileInput/preview.svelte +38 -0
  22. package/dist/components/Core/Form/Input/FileInput/preview.svelte.d.ts +18 -0
  23. package/dist/components/Core/Form/Input/input/input.svelte +17 -0
  24. package/dist/components/Core/Form/Input/input/input.svelte.d.ts +24 -0
  25. package/dist/components/Core/Form/Input/password/password.svelte +27 -0
  26. package/dist/components/Core/Form/Input/password/password.svelte.d.ts +23 -0
  27. package/dist/components/Core/Menus/DropdownContainer/dropdown.svelte +94 -0
  28. package/dist/components/Core/Menus/DropdownContainer/dropdown.svelte.d.ts +9 -0
  29. package/dist/components/Core/Menus/MenuItem/menuItem.svelte +44 -0
  30. package/dist/components/Core/Menus/MenuItem/menuItem.svelte.d.ts +10 -0
  31. package/dist/components/Core/Menus/UserMenu/profile.svelte +35 -0
  32. package/dist/components/Core/Menus/UserMenu/profile.svelte.d.ts +11 -0
  33. package/dist/components/Core/others/Button/Flip/button.css +51 -0
  34. package/dist/components/Core/others/Button/Flip/button.svelte +69 -0
  35. package/dist/components/Core/others/Button/Flip/button.svelte.d.ts +21 -0
  36. package/dist/components/Core/others/Button/Marquee/button.css +37 -0
  37. package/dist/components/Core/others/Button/Marquee/button.svelte +45 -0
  38. package/dist/components/Core/others/Button/Marquee/button.svelte.d.ts +9 -0
  39. package/dist/components/Core/others/Button/Swipe/button.css +31 -0
  40. package/dist/components/Core/others/Button/Swipe/button.svelte +45 -0
  41. package/dist/components/Core/others/Button/Swipe/button.svelte.d.ts +17 -0
  42. package/dist/components/Core/others/Button/default/button.css +52 -0
  43. package/dist/components/Core/others/Button/default/button.svelte +112 -0
  44. package/dist/components/Core/others/Button/default/button.svelte.d.ts +16 -0
  45. package/dist/components/Core/others/Button/select/select.svelte +29 -0
  46. package/dist/components/Core/others/Button/select/select.svelte.d.ts +3 -0
  47. package/dist/components/Core/others/Button/theme/theme.css +122 -0
  48. package/dist/components/Core/others/Button/theme/theme.svelte +68 -0
  49. package/dist/components/Core/others/Button/theme/theme.svelte.d.ts +19 -0
  50. package/dist/components/Core/others/Button/times/times.svelte +25 -0
  51. package/dist/components/Core/others/Button/times/times.svelte.d.ts +6 -0
  52. package/dist/components/Core/others/Clock/Date/date.svelte +25 -0
  53. package/dist/components/Core/others/Clock/Date/date.svelte.d.ts +20 -0
  54. package/dist/components/Core/others/Clock/Time/time.svelte +35 -0
  55. package/dist/components/Core/others/Clock/Time/time.svelte.d.ts +20 -0
  56. package/dist/components/Core/others/Previews/Audio/audio.svelte +62 -0
  57. package/dist/components/Core/others/Previews/Audio/audio.svelte.d.ts +22 -0
  58. package/dist/components/Core/others/Previews/Document/documents.svelte +25 -0
  59. package/dist/components/Core/others/Previews/Document/documents.svelte.d.ts +22 -0
  60. package/dist/components/Core/others/Previews/Image/image.svelte +27 -0
  61. package/dist/components/Core/others/Previews/Image/image.svelte.d.ts +22 -0
  62. package/dist/components/Core/others/Previews/Video/video.svelte +29 -0
  63. package/dist/components/Core/others/Previews/Video/video.svelte.d.ts +24 -0
  64. package/dist/components/Core/others/Progress/CircularProgress/CircularProgress.svelte +55 -0
  65. package/dist/components/Core/others/Progress/CircularProgress/CircularProgress.svelte.d.ts +15 -0
  66. package/dist/components/Core/others/Progress/LinearProgress/LinearProgress.css +61 -0
  67. package/dist/components/Core/others/Progress/LinearProgress/LinearProgress.svelte +79 -0
  68. package/dist/components/Core/others/Progress/LinearProgress/LinearProgress.svelte.d.ts +26 -0
  69. package/dist/components/Modules/Editor/Hooks/extractContent.d.ts +7 -0
  70. package/dist/components/Modules/Editor/Hooks/extractContent.js +15 -0
  71. package/dist/components/Modules/Editor/Hooks/extractImage.d.ts +7 -0
  72. package/dist/components/Modules/Editor/Hooks/extractImage.js +30 -0
  73. package/dist/components/Modules/Editor/Hooks/insertImage.d.ts +5 -0
  74. package/dist/components/Modules/Editor/Hooks/insertImage.js +27 -0
  75. package/dist/components/Modules/Editor/Hooks/insertYoutube.d.ts +6 -0
  76. package/dist/components/Modules/Editor/Hooks/insertYoutube.js +35 -0
  77. package/dist/components/Modules/Editor/Marks/Links/links.svelte +79 -0
  78. package/dist/components/Modules/Editor/Marks/Links/links.svelte.d.ts +21 -0
  79. package/dist/components/Modules/Editor/Marks/TextFormatting/textFormatting.svelte +32 -0
  80. package/dist/components/Modules/Editor/Marks/TextFormatting/textFormatting.svelte.d.ts +21 -0
  81. package/dist/components/Modules/Editor/Nodes/Headings/heading.svelte +58 -0
  82. package/dist/components/Modules/Editor/Nodes/Headings/heading.svelte.d.ts +21 -0
  83. package/dist/components/Modules/Editor/Nodes/History/history.svelte +21 -0
  84. package/dist/components/Modules/Editor/Nodes/History/history.svelte.d.ts +21 -0
  85. package/dist/components/Modules/Editor/Nodes/Images/images.svelte +85 -0
  86. package/dist/components/Modules/Editor/Nodes/Images/images.svelte.d.ts +21 -0
  87. package/dist/components/Modules/Editor/Nodes/Lists/lists.svelte +30 -0
  88. package/dist/components/Modules/Editor/Nodes/Lists/lists.svelte.d.ts +21 -0
  89. package/dist/components/Modules/Editor/Nodes/TextAlign/textAlign.svelte +55 -0
  90. package/dist/components/Modules/Editor/Nodes/TextAlign/textAlign.svelte.d.ts +21 -0
  91. package/dist/components/Modules/Editor/Nodes/TextColor/styles.css +18 -0
  92. package/dist/components/Modules/Editor/Nodes/TextColor/textColor.svelte +88 -0
  93. package/dist/components/Modules/Editor/Nodes/TextColor/textColor.svelte.d.ts +22 -0
  94. package/dist/components/Modules/Editor/Nodes/Youtube/youtube.svelte +32 -0
  95. package/dist/components/Modules/Editor/Nodes/Youtube/youtube.svelte.d.ts +21 -0
  96. package/dist/components/Modules/Editor/colors.d.ts +2 -0
  97. package/dist/components/Modules/Editor/colors.js +21 -0
  98. package/dist/components/Modules/Editor/controls.svelte +72 -0
  99. package/dist/components/Modules/Editor/controls.svelte.d.ts +24 -0
  100. package/dist/components/Modules/Editor/extensions.d.ts +1 -0
  101. package/dist/components/Modules/Editor/extensions.js +59 -0
  102. package/dist/components/Modules/Editor/main.svelte +42 -0
  103. package/dist/components/Modules/Editor/main.svelte.d.ts +25 -0
  104. package/dist/components/Modules/Editor/save.svelte +28 -0
  105. package/dist/components/Modules/Editor/save.svelte.d.ts +23 -0
  106. package/dist/components/Modules/Editor/styles/controls.css +70 -0
  107. package/dist/components/Modules/Editor/styles/main.css +43 -0
  108. package/dist/components/Modules/Editor/tools.d.ts +14 -0
  109. package/dist/components/Modules/Editor/tools.js +23 -0
  110. package/dist/components/Modules/FilePicker/cloudStore.svelte +96 -0
  111. package/dist/components/Modules/FilePicker/cloudStore.svelte.d.ts +20 -0
  112. package/dist/components/Modules/FilePicker/controls.svelte +122 -0
  113. package/dist/components/Modules/FilePicker/controls.svelte.d.ts +20 -0
  114. package/dist/components/Modules/FilePicker/filePicker.svelte +61 -0
  115. package/dist/components/Modules/FilePicker/filePicker.svelte.d.ts +18 -0
  116. package/dist/components/Modules/FilePicker/previews.svelte +19 -0
  117. package/dist/components/Modules/FilePicker/previews.svelte.d.ts +20 -0
  118. package/dist/components/Modules/Layout/Header/header.css +38 -0
  119. package/dist/components/Modules/Layout/Header/header.svelte +29 -0
  120. package/dist/components/Modules/Layout/Header/header.svelte.d.ts +21 -0
  121. package/dist/components/Modules/Layout/Menu/menu.css +45 -0
  122. package/dist/components/Modules/Layout/Menu/menu.svelte +129 -0
  123. package/dist/components/Modules/Layout/Menu/menu.svelte.d.ts +24 -0
  124. package/dist/components/Modules/Layout/background.svelte +28 -0
  125. package/dist/components/Modules/Layout/background.svelte.d.ts +26 -0
  126. package/dist/components/Modules/Layout/main.css +21 -0
  127. package/dist/components/Modules/Layout/main.svelte +119 -0
  128. package/dist/components/Modules/Layout/main.svelte.d.ts +27 -0
  129. package/dist/global.css +226 -0
  130. package/dist/index.d.ts +40 -0
  131. package/dist/index.js +53 -0
  132. package/dist/stores/core/general.d.ts +3 -0
  133. package/dist/stores/core/general.js +5 -0
  134. package/dist/stores/core/ismobile.d.ts +1 -0
  135. package/dist/stores/core/ismobile.js +14 -0
  136. package/dist/stores/core/modal.d.ts +14 -0
  137. package/dist/stores/core/modal.js +35 -0
  138. package/dist/stores/core/user.d.ts +9 -0
  139. package/dist/stores/core/user.js +14 -0
  140. package/dist/stores/modules/editor.d.ts +9 -0
  141. package/dist/stores/modules/editor.js +14 -0
  142. package/dist/stores/modules/fileInput.d.ts +22 -0
  143. package/dist/stores/modules/fileInput.js +25 -0
  144. package/dist/stores/modules/toast.d.ts +8 -0
  145. package/dist/stores/modules/toast.js +21 -0
  146. package/package.json +75 -0
@@ -0,0 +1,22 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Image: $$__sveltets_2_IsomorphicComponent<{
15
+ media: any;
16
+ buttonTimes?: boolean;
17
+ urlsOnly?: boolean;
18
+ }, {
19
+ [evt: string]: CustomEvent<any>;
20
+ }, {}, {}, string>;
21
+ type Image = InstanceType<typeof Image>;
22
+ export default Image;
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ import {ButtonTimes, fileInputStore, ButtonSelect, getPreviewUrlForMedia, toggleSelectForMedia, removeFileForMedia} from '../../../../../index.js'
3
+
4
+ export let media;
5
+ export let buttonTimes = false;
6
+ export let urlsOnly = true;
7
+ </script>
8
+ {#if media.Videos.length === 0}
9
+ <p>No videos available.</p>
10
+ {:else}
11
+ <div style="display: flex; flex-wrap: wrap; gap: 1rem;">
12
+ {#each media.Videos as item}
13
+ <div on:click={() => toggleSelectForMedia(item.id,item.url,urlsOnly)} role="none" class="sierra-translate" style="position:relative; box-shadow: var(--box-shadow-secondary);width: 150px;border-radius: 0.3rem; cursor: pointer;">
14
+ <video on:click|stopPropagation src={urlsOnly ? item.url : getPreviewUrlForMedia(item)} controls style="width: 100%; height: 100px; object-fit: cover; border-top-left-radius: 0.3rem; border-top-right-radius: 0.3rem;">
15
+ <track kind="captions" />
16
+ </video>
17
+ <h3 style=" margin: 0.5rem" class="sierra-text-ellipsis">{item.original_name || item.name}</h3>
18
+ {#if buttonTimes}
19
+ <ButtonTimes vertical="bottom" onclick={(e: Event) => removeFileForMedia(
20
+ $fileInputStore.selectedFiles.indexOf(item), e
21
+ )}/>
22
+ {/if}
23
+ {#if $fileInputStore.submissions.some(sub => sub.url === item.url || sub.id === item.id)}
24
+ <ButtonSelect />
25
+ {/if}
26
+ </div>
27
+ {/each}
28
+ </div>
29
+ {/if}
@@ -0,0 +1,24 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Video: $$__sveltets_2_IsomorphicComponent<{
15
+ media: any;
16
+ buttonTimes?: boolean;
17
+ urlsOnly?: boolean;
18
+ }, {
19
+ click: MouseEvent;
20
+ } & {
21
+ [evt: string]: CustomEvent<any>;
22
+ }, {}, {}, string>;
23
+ type Video = InstanceType<typeof Video>;
24
+ export default Video;
@@ -0,0 +1,55 @@
1
+ <script>
2
+ // enable runes for this component (if not global)
3
+ // @enable runes
4
+
5
+ const { size = 50, thickness = 4, color = 'var(--primary-bg)' } = $props();
6
+ const radius = $derived((size - thickness) / 2);
7
+ const circumference = $derived(2 * Math.PI * radius);
8
+ </script>
9
+
10
+ <svg
11
+ width={size}
12
+ height={size}
13
+ viewBox={`0 0 ${size} ${size}`}
14
+ class="spinner"
15
+ >
16
+ <circle
17
+ cx={size / 2}
18
+ cy={size / 2}
19
+ r={radius}
20
+ fill="none"
21
+ stroke="#e5e7eb"
22
+ stroke-width={thickness}
23
+ />
24
+ <circle
25
+ cx={size / 2}
26
+ cy={size / 2}
27
+ r={radius}
28
+ fill="none"
29
+ stroke={color}
30
+ stroke-width={thickness}
31
+ stroke-linecap="round"
32
+ stroke-dasharray={circumference}
33
+ stroke-dashoffset={circumference * 0.25}
34
+ />
35
+ </svg>
36
+
37
+ <style>
38
+ .spinner {
39
+ animation: spin 1s linear infinite;
40
+ }
41
+
42
+ @keyframes spin {
43
+ 100% {
44
+ transform: rotate(360deg);
45
+ }
46
+ }
47
+
48
+ svg {
49
+ display: block;
50
+ }
51
+
52
+ circle {
53
+ transform-origin: center;
54
+ }
55
+ </style>
@@ -0,0 +1,15 @@
1
+ export default CircularProgress;
2
+ type CircularProgress = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const CircularProgress: import("svelte").Component<{
7
+ size?: number;
8
+ thickness?: number;
9
+ color?: string;
10
+ }, {}, "">;
11
+ type $$ComponentProps = {
12
+ size?: number;
13
+ thickness?: number;
14
+ color?: string;
15
+ };
@@ -0,0 +1,61 @@
1
+ .pure-material-progress-linear {
2
+ -webkit-appearance: none;
3
+ -moz-appearance: none;
4
+ appearance: none;
5
+ border: none;
6
+ height: 0.25em;
7
+ color: var(--primary-bg);
8
+ background-color: rgba( 33, 150, 243, 0.12);
9
+ font-size: 16px;
10
+ }
11
+
12
+ .pure-material-progress-linear::-webkit-progress-bar {
13
+ background-color: transparent;
14
+ }
15
+
16
+ /* Determinate */
17
+ .pure-material-progress-linear::-webkit-progress-value {
18
+ background-color: currentColor;
19
+ transition: all 0.2s;
20
+ }
21
+
22
+ .pure-material-progress-linear::-moz-progress-bar {
23
+ background-color: currentColor;
24
+ transition: all 0.2s;
25
+ }
26
+
27
+ .pure-material-progress-linear::-ms-fill {
28
+ border: none;
29
+ background-color: currentColor;
30
+ transition: all 0.2s;
31
+ }
32
+
33
+ /* Indeterminate */
34
+ .pure-material-progress-linear:indeterminate {
35
+ background-size: 200% 100%;
36
+ background-image: linear-gradient(to right, transparent 50%, currentColor 50%, currentColor 60%, transparent 60%, transparent 71.5%, currentColor 71.5%, currentColor 84%, transparent 84%);
37
+ animation: pure-material-progress-linear 2s infinite linear;
38
+ }
39
+
40
+ .pure-material-progress-linear:indeterminate::-moz-progress-bar {
41
+ background-color: transparent;
42
+ }
43
+
44
+ .pure-material-progress-linear:indeterminate::-ms-fill {
45
+ animation-name: none;
46
+ }
47
+
48
+ @keyframes pure-material-progress-linear {
49
+ 0% {
50
+ background-size: 200% 100%;
51
+ background-position: left -31.25% top 0%;
52
+ }
53
+ 50% {
54
+ background-size: 800% 100%;
55
+ background-position: left -49% top 0%;
56
+ }
57
+ 100% {
58
+ background-size: 400% 100%;
59
+ background-position: left -102% top 0%;
60
+ }
61
+ }
@@ -0,0 +1,79 @@
1
+ <style>.pure-material-progress-linear {
2
+ -webkit-appearance: none;
3
+ -moz-appearance: none;
4
+ appearance: none;
5
+ border: none;
6
+ height: 0.25em;
7
+ color: var(--primary-bg);
8
+ background-color: rgba( 33, 150, 243, 0.12);
9
+ font-size: 16px;
10
+ }
11
+
12
+ .pure-material-progress-linear::-webkit-progress-bar {
13
+ background-color: transparent;
14
+ }
15
+
16
+ /* Determinate */
17
+
18
+ .pure-material-progress-linear::-webkit-progress-value {
19
+ background-color: currentColor;
20
+ transition: all 0.2s;
21
+ }
22
+
23
+ .pure-material-progress-linear::-moz-progress-bar {
24
+ background-color: currentColor;
25
+ transition: all 0.2s;
26
+ }
27
+
28
+ .pure-material-progress-linear::-ms-fill {
29
+ border: none;
30
+ background-color: currentColor;
31
+ transition: all 0.2s;
32
+ }
33
+
34
+ /* Indeterminate */
35
+
36
+ .pure-material-progress-linear:indeterminate {
37
+ background-size: 200% 100%;
38
+ background-image: linear-gradient(to right, transparent 50%, currentColor 50%, currentColor 60%, transparent 60%, transparent 71.5%, currentColor 71.5%, currentColor 84%, transparent 84%);
39
+ animation: pure-material-progress-linear 2s infinite linear;
40
+ }
41
+
42
+ .pure-material-progress-linear:indeterminate::-moz-progress-bar {
43
+ background-color: transparent;
44
+ }
45
+
46
+ .pure-material-progress-linear:indeterminate::-ms-fill {
47
+ animation-name: none;
48
+ }
49
+
50
+ @keyframes pure-material-progress-linear {
51
+ 0% {
52
+ background-size: 200% 100%;
53
+ background-position: left -31.25% top 0%;
54
+ }
55
+ 50% {
56
+ background-size: 800% 100%;
57
+ background-position: left -49% top 0%;
58
+ }
59
+ 100% {
60
+ background-size: 400% 100%;
61
+ background-position: left -102% top 0%;
62
+ }
63
+ }
64
+
65
+ .cover{
66
+ position: relative;
67
+ height: 0.25em;
68
+ }
69
+
70
+ .child{
71
+ width: 100%;
72
+ position: absolute;
73
+ left: 0;
74
+ right: 0;
75
+ }
76
+ </style>
77
+ <div class="cover">
78
+ <progress class="pure-material-progress-linear child"></progress>
79
+ </div>
@@ -0,0 +1,26 @@
1
+ export default LinearProgress;
2
+ type LinearProgress = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const LinearProgress: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @param {import('@tiptap/core').Editor} editor
3
+ */
4
+ export function exractContent(editor: import("@tiptap/core").Editor): Promise<{
5
+ json_content: import("@tiptap/core").DocumentType<Record<string, any> | undefined, import("@tiptap/core").NodeType<string, Record<string, any> | undefined, any, (import("@tiptap/core").NodeType<any, any, any, any> | import("@tiptap/core").TextType<import("@tiptap/core").MarkType<any, any>>)[]>[]>;
6
+ images: string[];
7
+ } | undefined>;
@@ -0,0 +1,15 @@
1
+ import { setToastMessage } from '../../../../index.js';
2
+ import { extractImagesFromJSON } from '../tools.js';
3
+ /**
4
+ * @param {import('@tiptap/core').Editor} editor
5
+ */
6
+ export async function exractContent(editor) {
7
+ if (!editor) return;
8
+ try {
9
+ const json_content = editor.getJSON();
10
+ const fnl_imgs = extractImagesFromJSON(json_content);
11
+ return { json_content, images: fnl_imgs };
12
+ }catch (error) {
13
+ setToastMessage('error', 'An error occurred while saving.');
14
+ }
15
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Extract all image slugs from a Tiptap JSON document.
3
+ *
4
+ * @param {import('@tiptap/core').JSONContent} json - Tiptap JSON content
5
+ * @returns {string[]} - Array of image slugs
6
+ */
7
+ export function extractImagesFromJSON(json: import("@tiptap/core").JSONContent): string[];
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Extract all image slugs from a Tiptap JSON document.
3
+ *
4
+ * @param {import('@tiptap/core').JSONContent} json - Tiptap JSON content
5
+ * @returns {string[]} - Array of image slugs
6
+ */
7
+
8
+ export function extractImagesFromJSON(json) {
9
+ const slugs = new Set();
10
+
11
+ /**
12
+ * Recursively walk a node and collect image slugs
13
+ * @param {any} node - Node in the JSON tree
14
+ */
15
+
16
+ function walk(node) {
17
+ if (!node) return;
18
+ if (node.type === 'image' && typeof node.attrs?.src === 'string') {
19
+ const url = node.attrs.src;
20
+ const slug = url.split('/').pop();
21
+ if (slug) slugs.add(slug);
22
+ }
23
+ if (node.content && Array.isArray(node.content)) {
24
+ node.content.forEach(walk);
25
+ }
26
+ }
27
+
28
+ walk(json);
29
+ return [...slugs];
30
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @param {string} base64 - Base64 string for the image
3
+ * @param {import('@tiptap/core').Editor} editor - Tiptap editor instance
4
+ */
5
+ export function insertImageAndMoveCursor(base64: string, editor: import("@tiptap/core").Editor): void;
@@ -0,0 +1,27 @@
1
+
2
+ import { TextSelection } from 'prosemirror-state';
3
+
4
+ /**
5
+ * @param {string} base64 - Base64 string for the image
6
+ * @param {import('@tiptap/core').Editor} editor - Tiptap editor instance
7
+ */
8
+
9
+ export function insertImageAndMoveCursor(base64, editor) {
10
+ const { state, view } = editor;
11
+ const { tr } = state;
12
+
13
+ // 1. Insert the image at the current selection
14
+ const imageNode = editor.schema.nodes.image.create({ src: base64 });
15
+ const pos = tr.selection.$from.after(); // get position after current node
16
+ tr.insert(pos, imageNode);
17
+
18
+ // 2. Insert an empty paragraph after the image
19
+ const paragraph = editor.schema.nodes.paragraph.create();
20
+ tr.insert(pos + 1, paragraph);
21
+
22
+ // 3. Move the cursor inside the new paragraph
23
+ const newSelection = TextSelection.create(tr.doc, pos + 2);
24
+ tr.setSelection(newSelection);
25
+ view.dispatch(tr);
26
+ view.focus();
27
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Prompt for a YouTube URL and insert it into the editor, placing the cursor after it.
3
+ * @param {import('@tiptap/core').Editor} editor - The Tiptap editor instance
4
+ * @param {string} url
5
+ */
6
+ export function addYoutubeVideo(editor: import("@tiptap/core").Editor, url: string): void;
@@ -0,0 +1,35 @@
1
+ import { TextSelection } from 'prosemirror-state';
2
+
3
+
4
+ /**
5
+ * Prompt for a YouTube URL and insert it into the editor, placing the cursor after it.
6
+ * @param {import('@tiptap/core').Editor} editor - The Tiptap editor instance
7
+ * @param {string} url
8
+ */
9
+ export function addYoutubeVideo(editor, url) {
10
+ if (!url) return;
11
+
12
+ const { state, view, schema } = editor;
13
+ const { tr } = state;
14
+
15
+ // Create the YouTube video node
16
+ const youtubeNode = schema.nodes.youtube.create({ src: url });
17
+
18
+ // Position after current selection
19
+ const pos = tr.selection.$from.after();
20
+
21
+ // Insert video node at position
22
+ tr.insert(pos, youtubeNode);
23
+
24
+ // Insert empty paragraph after the video node
25
+ const paragraph = schema.nodes.paragraph.create();
26
+ tr.insert(pos + 1, paragraph);
27
+
28
+ // Set cursor inside the new paragraph
29
+ const newSelection = TextSelection.create(tr.doc, pos + 2);
30
+ tr.setSelection(newSelection);
31
+
32
+ // Apply transaction and focus editor
33
+ view.dispatch(tr);
34
+ view.focus();
35
+ }
@@ -0,0 +1,79 @@
1
+ <script lang="ts">
2
+ import type { Editor } from "@tiptap/core";
3
+ import {modalStore, Input} from '../../../../../index.js'
4
+
5
+ export let editor: Editor;
6
+
7
+ let text = '';
8
+ let url = '';
9
+
10
+ function newLink() {
11
+ modalStore.update(m => ({
12
+ ...m,
13
+ open: true,
14
+ title: 'Editor',
15
+ onConfirm: () => {
16
+ setLink(text, url);
17
+ text = '';
18
+ url = '';
19
+ },
20
+ render: addLinkContent
21
+ }));
22
+ }
23
+
24
+ function setLink(text: string, url: string) {
25
+ editor
26
+ .chain()
27
+ .focus()
28
+ .insertContent(`<a href="${url}" target="_blank" rel="noopener noreferrer">${text}</a>`)
29
+ .insertContent(' ')
30
+ .unsetMark('link')
31
+ .run();
32
+ }
33
+
34
+ function updateLink() {
35
+ const previousUrl = editor.getAttributes('link').href
36
+ url = previousUrl || '';
37
+ modalStore.update(m => ({
38
+ ...m,
39
+ open: true,
40
+ title: 'Editor',
41
+ onConfirm: () => {
42
+ editLink(url);
43
+ url = '';
44
+ },
45
+ onCancel: () => url = '',
46
+ render: editLinkContent
47
+ }));
48
+ }
49
+
50
+ function editLink(url: string){
51
+ if (url === null) {
52
+ return
53
+ }
54
+ if (url === '') {
55
+ editor.chain().focus().extendMarkRange('link').unsetLink()
56
+ .run()
57
+ return
58
+ }try {
59
+ editor.chain().focus().extendMarkRange('link').setLink({ href: url }).run()
60
+ } catch (e) {
61
+ const errorMessage = e instanceof Error ? e.message : String(e)
62
+ alert(errorMessage)
63
+ }
64
+ }
65
+
66
+ </script>
67
+
68
+ {#snippet addLinkContent()}
69
+ <Input label="Enter Link Text" id="link-text" bind:value={text}/>
70
+ <Input label="Enter Link URL" id="link-url" bind:value={url}/>
71
+ {/snippet}
72
+
73
+ {#snippet editLinkContent()}
74
+ <Input label="Edit Link URL" id="link-url" bind:value={url}/>
75
+ {/snippet}
76
+
77
+ <button aria-label="Link Button" on:click={ editor.isActive('link')? updateLink : newLink} title="Add/Edit Link">
78
+ <i class="fa fa-link"></i>
79
+ </button>
@@ -0,0 +1,21 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
12
+ };
13
+ z_$$bindings?: Bindings;
14
+ }
15
+ declare const Links: $$__sveltets_2_IsomorphicComponent<{
16
+ editor: Editor;
17
+ }, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, string>;
20
+ type Links = InstanceType<typeof Links>;
21
+ export default Links;
@@ -0,0 +1,32 @@
1
+ <script lang="ts">
2
+ import type { Editor } from "@tiptap/core";
3
+
4
+ export let editor: Editor;
5
+
6
+ const actions = [
7
+ { name: 'bold', icon: 'bold' },
8
+ { name: 'italic', icon: 'italic' },
9
+ { name: 'underline', icon: 'underline' },
10
+ ];
11
+
12
+ function runToggle(name: string) {
13
+ if (!editor) return;
14
+ const cmd = `toggle${name.charAt(0).toUpperCase() + name.slice(1)}`;
15
+ (editor.chain().focus() as any)[cmd]().run();
16
+ }
17
+ </script>
18
+
19
+ {#if editor}
20
+ <div style="display: flex; gap: 0.5rem">
21
+ {#each actions as { name, icon }}
22
+ <button
23
+ aria-label="Text Formatting: {name}"
24
+ title={name.charAt(0).toUpperCase() + name.slice(1)}
25
+ on:click={() => runToggle(name)}
26
+ class="{editor.isActive(name) ? 'active' : ''}"
27
+ >
28
+ <i class="fa fa-{icon}"></i>
29
+ </button>
30
+ {/each}
31
+ </div>
32
+ {/if}
@@ -0,0 +1,21 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
12
+ };
13
+ z_$$bindings?: Bindings;
14
+ }
15
+ declare const TextFormatting: $$__sveltets_2_IsomorphicComponent<{
16
+ editor: Editor;
17
+ }, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, string>;
20
+ type TextFormatting = InstanceType<typeof TextFormatting>;
21
+ export default TextFormatting;
@@ -0,0 +1,58 @@
1
+ <script lang="ts">
2
+ import { onMount } from "svelte";
3
+ import type { Editor } from "@tiptap/core";
4
+ import {DropdownContainer, MenuItem} from '../../../../../index.js';
5
+
6
+ export let editor: Editor;
7
+
8
+ let open = false;
9
+
10
+ const headingOptions = [
11
+ { label: 'H1', value: 'heading', level: 1 as const },
12
+ { label: 'H2', value: 'heading', level: 2 as const },
13
+ { label: 'H3', value: 'heading', level: 3 as const },
14
+ { label: 'H4', value: 'heading', level: 4 as const },
15
+ { label: 'H5', value: 'heading', level: 5 as const },
16
+ { label: 'H6', value: 'heading', level: 6 as const }
17
+ ];
18
+
19
+ type HeadingOption = {
20
+ label: string;
21
+ value: string;
22
+ level: 1 | 2 | 3 | 4 | 5 | 6;
23
+ };
24
+
25
+ function applyHeading(option: HeadingOption) {
26
+ if (option.value === 'paragraph') {
27
+ editor.chain().focus().setParagraph().run();
28
+ } else {
29
+ editor.chain().focus().toggleHeading({ level: option.level }).run();
30
+ }
31
+ }
32
+
33
+ onMount(() => {
34
+ editor.chain().focus().toggleHeading({ level: 5 }).run();
35
+ });
36
+ </script>
37
+
38
+ {#if editor}
39
+ <DropdownContainer bind:open>
40
+ {#snippet dropdownTrigger()}
41
+ <button aria-label="Heading Options" on:click={() => (open = !open)} style="display: flex; align-items: center; gap: 4px;">
42
+ <h5 style="font-weight: bold;">H{editor.getAttributes('heading').level}</h5>
43
+ <i class="fa fa-chevron-down {open ? 'active' : ''}"></i>
44
+ </button>
45
+ {/snippet}
46
+ {#each headingOptions as option}
47
+ <MenuItem
48
+ active={option.level === editor.getAttributes('heading').level}
49
+ onclick={() => {
50
+ applyHeading(option);
51
+ open = false;
52
+ }}
53
+ >
54
+ {option.label}
55
+ </MenuItem>
56
+ {/each}
57
+ </DropdownContainer>
58
+ {/if}