@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.
- package/README.md +8 -0
- package/dist/Hooks/layout_menu.d.ts +1 -0
- package/dist/Hooks/layout_menu.js +24 -0
- package/dist/Hooks/preview.d.ts +3 -0
- package/dist/Hooks/preview.js +24 -0
- package/dist/components/Core/Alerts/Backdrop/backdrop.svelte +27 -0
- package/dist/components/Core/Alerts/Backdrop/backdrop.svelte.d.ts +15 -0
- package/dist/components/Core/Alerts/Modal/modal.svelte +40 -0
- package/dist/components/Core/Alerts/Modal/modal.svelte.d.ts +26 -0
- package/dist/components/Core/Alerts/Toast/toast.css +39 -0
- package/dist/components/Core/Alerts/Toast/toast.svelte +32 -0
- package/dist/components/Core/Alerts/Toast/toast.svelte.d.ts +26 -0
- package/dist/components/Core/Alerts/Wrapper/wrapper.svelte +19 -0
- package/dist/components/Core/Alerts/Wrapper/wrapper.svelte.d.ts +17 -0
- package/dist/components/Core/Alerts/site-under-maintenance/site-under-maintenance.svelte +34 -0
- package/dist/components/Core/Alerts/site-under-maintenance/site-under-maintenance.svelte.d.ts +11 -0
- package/dist/components/Core/Form/Hr/hr.svelte +11 -0
- package/dist/components/Core/Form/Hr/hr.svelte.d.ts +21 -0
- package/dist/components/Core/Form/Input/FileInput/fileInput.svelte +130 -0
- package/dist/components/Core/Form/Input/FileInput/fileInput.svelte.d.ts +6 -0
- package/dist/components/Core/Form/Input/FileInput/preview.svelte +38 -0
- package/dist/components/Core/Form/Input/FileInput/preview.svelte.d.ts +18 -0
- package/dist/components/Core/Form/Input/input/input.svelte +17 -0
- package/dist/components/Core/Form/Input/input/input.svelte.d.ts +24 -0
- package/dist/components/Core/Form/Input/password/password.svelte +27 -0
- package/dist/components/Core/Form/Input/password/password.svelte.d.ts +23 -0
- package/dist/components/Core/Menus/DropdownContainer/dropdown.svelte +94 -0
- package/dist/components/Core/Menus/DropdownContainer/dropdown.svelte.d.ts +9 -0
- package/dist/components/Core/Menus/MenuItem/menuItem.svelte +44 -0
- package/dist/components/Core/Menus/MenuItem/menuItem.svelte.d.ts +10 -0
- package/dist/components/Core/Menus/UserMenu/profile.svelte +35 -0
- package/dist/components/Core/Menus/UserMenu/profile.svelte.d.ts +11 -0
- package/dist/components/Core/others/Button/Flip/button.css +51 -0
- package/dist/components/Core/others/Button/Flip/button.svelte +69 -0
- package/dist/components/Core/others/Button/Flip/button.svelte.d.ts +21 -0
- package/dist/components/Core/others/Button/Marquee/button.css +37 -0
- package/dist/components/Core/others/Button/Marquee/button.svelte +45 -0
- package/dist/components/Core/others/Button/Marquee/button.svelte.d.ts +9 -0
- package/dist/components/Core/others/Button/Swipe/button.css +31 -0
- package/dist/components/Core/others/Button/Swipe/button.svelte +45 -0
- package/dist/components/Core/others/Button/Swipe/button.svelte.d.ts +17 -0
- package/dist/components/Core/others/Button/default/button.css +52 -0
- package/dist/components/Core/others/Button/default/button.svelte +112 -0
- package/dist/components/Core/others/Button/default/button.svelte.d.ts +16 -0
- package/dist/components/Core/others/Button/select/select.svelte +29 -0
- package/dist/components/Core/others/Button/select/select.svelte.d.ts +3 -0
- package/dist/components/Core/others/Button/theme/theme.css +122 -0
- package/dist/components/Core/others/Button/theme/theme.svelte +68 -0
- package/dist/components/Core/others/Button/theme/theme.svelte.d.ts +19 -0
- package/dist/components/Core/others/Button/times/times.svelte +25 -0
- package/dist/components/Core/others/Button/times/times.svelte.d.ts +6 -0
- package/dist/components/Core/others/Clock/Date/date.svelte +25 -0
- package/dist/components/Core/others/Clock/Date/date.svelte.d.ts +20 -0
- package/dist/components/Core/others/Clock/Time/time.svelte +35 -0
- package/dist/components/Core/others/Clock/Time/time.svelte.d.ts +20 -0
- package/dist/components/Core/others/Previews/Audio/audio.svelte +62 -0
- package/dist/components/Core/others/Previews/Audio/audio.svelte.d.ts +22 -0
- package/dist/components/Core/others/Previews/Document/documents.svelte +25 -0
- package/dist/components/Core/others/Previews/Document/documents.svelte.d.ts +22 -0
- package/dist/components/Core/others/Previews/Image/image.svelte +27 -0
- package/dist/components/Core/others/Previews/Image/image.svelte.d.ts +22 -0
- package/dist/components/Core/others/Previews/Video/video.svelte +29 -0
- package/dist/components/Core/others/Previews/Video/video.svelte.d.ts +24 -0
- package/dist/components/Core/others/Progress/CircularProgress/CircularProgress.svelte +55 -0
- package/dist/components/Core/others/Progress/CircularProgress/CircularProgress.svelte.d.ts +15 -0
- package/dist/components/Core/others/Progress/LinearProgress/LinearProgress.css +61 -0
- package/dist/components/Core/others/Progress/LinearProgress/LinearProgress.svelte +79 -0
- package/dist/components/Core/others/Progress/LinearProgress/LinearProgress.svelte.d.ts +26 -0
- package/dist/components/Modules/Editor/Hooks/extractContent.d.ts +7 -0
- package/dist/components/Modules/Editor/Hooks/extractContent.js +15 -0
- package/dist/components/Modules/Editor/Hooks/extractImage.d.ts +7 -0
- package/dist/components/Modules/Editor/Hooks/extractImage.js +30 -0
- package/dist/components/Modules/Editor/Hooks/insertImage.d.ts +5 -0
- package/dist/components/Modules/Editor/Hooks/insertImage.js +27 -0
- package/dist/components/Modules/Editor/Hooks/insertYoutube.d.ts +6 -0
- package/dist/components/Modules/Editor/Hooks/insertYoutube.js +35 -0
- package/dist/components/Modules/Editor/Marks/Links/links.svelte +79 -0
- package/dist/components/Modules/Editor/Marks/Links/links.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Marks/TextFormatting/textFormatting.svelte +32 -0
- package/dist/components/Modules/Editor/Marks/TextFormatting/textFormatting.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Nodes/Headings/heading.svelte +58 -0
- package/dist/components/Modules/Editor/Nodes/Headings/heading.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Nodes/History/history.svelte +21 -0
- package/dist/components/Modules/Editor/Nodes/History/history.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Nodes/Images/images.svelte +85 -0
- package/dist/components/Modules/Editor/Nodes/Images/images.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Nodes/Lists/lists.svelte +30 -0
- package/dist/components/Modules/Editor/Nodes/Lists/lists.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Nodes/TextAlign/textAlign.svelte +55 -0
- package/dist/components/Modules/Editor/Nodes/TextAlign/textAlign.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Nodes/TextColor/styles.css +18 -0
- package/dist/components/Modules/Editor/Nodes/TextColor/textColor.svelte +88 -0
- package/dist/components/Modules/Editor/Nodes/TextColor/textColor.svelte.d.ts +22 -0
- package/dist/components/Modules/Editor/Nodes/Youtube/youtube.svelte +32 -0
- package/dist/components/Modules/Editor/Nodes/Youtube/youtube.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/colors.d.ts +2 -0
- package/dist/components/Modules/Editor/colors.js +21 -0
- package/dist/components/Modules/Editor/controls.svelte +72 -0
- package/dist/components/Modules/Editor/controls.svelte.d.ts +24 -0
- package/dist/components/Modules/Editor/extensions.d.ts +1 -0
- package/dist/components/Modules/Editor/extensions.js +59 -0
- package/dist/components/Modules/Editor/main.svelte +42 -0
- package/dist/components/Modules/Editor/main.svelte.d.ts +25 -0
- package/dist/components/Modules/Editor/save.svelte +28 -0
- package/dist/components/Modules/Editor/save.svelte.d.ts +23 -0
- package/dist/components/Modules/Editor/styles/controls.css +70 -0
- package/dist/components/Modules/Editor/styles/main.css +43 -0
- package/dist/components/Modules/Editor/tools.d.ts +14 -0
- package/dist/components/Modules/Editor/tools.js +23 -0
- package/dist/components/Modules/FilePicker/cloudStore.svelte +96 -0
- package/dist/components/Modules/FilePicker/cloudStore.svelte.d.ts +20 -0
- package/dist/components/Modules/FilePicker/controls.svelte +122 -0
- package/dist/components/Modules/FilePicker/controls.svelte.d.ts +20 -0
- package/dist/components/Modules/FilePicker/filePicker.svelte +61 -0
- package/dist/components/Modules/FilePicker/filePicker.svelte.d.ts +18 -0
- package/dist/components/Modules/FilePicker/previews.svelte +19 -0
- package/dist/components/Modules/FilePicker/previews.svelte.d.ts +20 -0
- package/dist/components/Modules/Layout/Header/header.css +38 -0
- package/dist/components/Modules/Layout/Header/header.svelte +29 -0
- package/dist/components/Modules/Layout/Header/header.svelte.d.ts +21 -0
- package/dist/components/Modules/Layout/Menu/menu.css +45 -0
- package/dist/components/Modules/Layout/Menu/menu.svelte +129 -0
- package/dist/components/Modules/Layout/Menu/menu.svelte.d.ts +24 -0
- package/dist/components/Modules/Layout/background.svelte +28 -0
- package/dist/components/Modules/Layout/background.svelte.d.ts +26 -0
- package/dist/components/Modules/Layout/main.css +21 -0
- package/dist/components/Modules/Layout/main.svelte +119 -0
- package/dist/components/Modules/Layout/main.svelte.d.ts +27 -0
- package/dist/global.css +226 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +53 -0
- package/dist/stores/core/general.d.ts +3 -0
- package/dist/stores/core/general.js +5 -0
- package/dist/stores/core/ismobile.d.ts +1 -0
- package/dist/stores/core/ismobile.js +14 -0
- package/dist/stores/core/modal.d.ts +14 -0
- package/dist/stores/core/modal.js +35 -0
- package/dist/stores/core/user.d.ts +9 -0
- package/dist/stores/core/user.js +14 -0
- package/dist/stores/modules/editor.d.ts +9 -0
- package/dist/stores/modules/editor.js +14 -0
- package/dist/stores/modules/fileInput.d.ts +22 -0
- package/dist/stores/modules/fileInput.js +25 -0
- package/dist/stores/modules/toast.d.ts +8 -0
- package/dist/stores/modules/toast.js +21 -0
- package/package.json +75 -0
package/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# @sierra-95/svelte-scaffold
|
|
2
|
+
[](https://michaelmachohi.com)
|
|
3
|
+
[](https://www.npmjs.com/package/@sierra-95/svelte-scaffold)
|
|
4
|
+
[](https://www.npmjs.com/package/@sierra-95/svelte-ui)
|
|
5
|
+
|
|
6
|
+
## Documentation
|
|
7
|
+
Full documentation: [https://svelte.michaelmachohi.com](https://svelte.michaelmachohi.com)
|
|
8
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function validateLayoutMenuSections(sections: Array<any>): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { setToastMessage } from '../index.js';
|
|
2
|
+
export function validateLayoutMenuSections(sections) {
|
|
3
|
+
const seenPaths = new Set();
|
|
4
|
+
for (const section of sections) {
|
|
5
|
+
for (const item of section.items) {
|
|
6
|
+
// Skip items that aren't parents
|
|
7
|
+
if (!item.children)
|
|
8
|
+
continue;
|
|
9
|
+
// Check for missing id
|
|
10
|
+
if (!item.id) {
|
|
11
|
+
setToastMessage('warning', `Parent item "${item.label}" with path "${item.path}" is missing an 'id'. Each parent must have a unique 'id'.`);
|
|
12
|
+
console.warn(`Missing id on parent item:`, item);
|
|
13
|
+
}
|
|
14
|
+
// Check for duplicate paths
|
|
15
|
+
if (seenPaths.has(item.path)) {
|
|
16
|
+
setToastMessage('warning', `Duplicate parent path detected: "${item.path}". Each parent must have a unique path.`);
|
|
17
|
+
console.warn(`Duplicate parent path: "${item.path}"`, item);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
seenPaths.add(item.path);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { fileInputStore } from '../index.js';
|
|
2
|
+
export function getPreviewUrlForMedia(file) {
|
|
3
|
+
return URL.createObjectURL(file);
|
|
4
|
+
}
|
|
5
|
+
export function toggleSelectForMedia(id, url, urlsOnly) {
|
|
6
|
+
if (!urlsOnly)
|
|
7
|
+
return;
|
|
8
|
+
fileInputStore.update(state => {
|
|
9
|
+
const index = state.submissions.findIndex(item => item.id === id);
|
|
10
|
+
return {
|
|
11
|
+
...state,
|
|
12
|
+
submissions: index === -1
|
|
13
|
+
? [...state.submissions, { id, url }] // select
|
|
14
|
+
: state.submissions.filter(item => item.id !== id) // deselect
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export function removeFileForMedia(index, e) {
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
fileInputStore.update(state => ({
|
|
21
|
+
...state,
|
|
22
|
+
selectedFiles: state.selectedFiles.filter((_, i) => i !== index)
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
let {
|
|
3
|
+
open = $bindable(false),
|
|
4
|
+
zIndex = 15,
|
|
5
|
+
children
|
|
6
|
+
} = $props();
|
|
7
|
+
</script>
|
|
8
|
+
<style>
|
|
9
|
+
#sierra-blur {
|
|
10
|
+
position: fixed;
|
|
11
|
+
top: 0;
|
|
12
|
+
right: 0;
|
|
13
|
+
bottom: 0;
|
|
14
|
+
left: 0;
|
|
15
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
padding: 1rem;
|
|
20
|
+
backdrop-filter: blur(2px);
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
23
|
+
{#if open}
|
|
24
|
+
<div id="sierra-blur" style="z-index: {zIndex};">
|
|
25
|
+
{@render children?.()}
|
|
26
|
+
</div>
|
|
27
|
+
{/if}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default Backdrop;
|
|
2
|
+
type Backdrop = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Backdrop: import("svelte").Component<{
|
|
7
|
+
open?: boolean;
|
|
8
|
+
zIndex?: number;
|
|
9
|
+
children: any;
|
|
10
|
+
}, {}, "open">;
|
|
11
|
+
type $$ComponentProps = {
|
|
12
|
+
open?: boolean;
|
|
13
|
+
zIndex?: number;
|
|
14
|
+
children: any;
|
|
15
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { modalStore, Button, Backdrop, Wrapper, resetModalStore} from '../../../../index.js';
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
|
+
|
|
5
|
+
function close() {
|
|
6
|
+
resetModalStore();
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @param {{ key: string; }} e
|
|
10
|
+
*/
|
|
11
|
+
function handleKeydown(e) {
|
|
12
|
+
if (e.key === 'Escape') close();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
onMount(() => {
|
|
16
|
+
window.addEventListener('keydown', handleKeydown);
|
|
17
|
+
return () => window.removeEventListener('keydown', handleKeydown);
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<Backdrop bind:open={$modalStore.open} zIndex={20}>
|
|
23
|
+
<Wrapper>
|
|
24
|
+
<h2 style="font-size: 1.3rem;">{$modalStore.title}</h2>
|
|
25
|
+
{#if $modalStore?.content}
|
|
26
|
+
<h3 style="font-size: 1rem;">{$modalStore.content}</h3>
|
|
27
|
+
{/if}
|
|
28
|
+
{@render $modalStore.render?.()}
|
|
29
|
+
<div style="display: flex; gap: 30px; margin-top: 20px;">
|
|
30
|
+
<Button onclick={() => { $modalStore.onConfirm?.(); close();}}>
|
|
31
|
+
{$modalStore.confirmText}
|
|
32
|
+
</Button>
|
|
33
|
+
{#if $modalStore.cancelText}
|
|
34
|
+
<button onclick={() => {$modalStore.onCancel?.();close();}}
|
|
35
|
+
>{$modalStore.cancelText}
|
|
36
|
+
</button>
|
|
37
|
+
{/if}
|
|
38
|
+
</div>
|
|
39
|
+
</Wrapper>
|
|
40
|
+
</Backdrop>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Modal;
|
|
2
|
+
type Modal = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Modal: $$__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,39 @@
|
|
|
1
|
+
#toast{
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 80px;
|
|
4
|
+
right: 20px;
|
|
5
|
+
width: 300px;
|
|
6
|
+
border-top-right-radius: 5px;
|
|
7
|
+
border-bottom-right-radius: 5px;
|
|
8
|
+
border-left: 6px solid var(--retval);
|
|
9
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
|
|
10
|
+
background-color: var(--background-secondary);
|
|
11
|
+
z-index: 25;
|
|
12
|
+
}
|
|
13
|
+
#toast div:nth-child(1){
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
font-weight: bold;
|
|
18
|
+
color: var(--retval);
|
|
19
|
+
padding: 5px 5px 5px 10px;
|
|
20
|
+
}
|
|
21
|
+
#toast div:nth-child(1) div{
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: 10px;
|
|
25
|
+
}
|
|
26
|
+
#toast div:nth-child(2){
|
|
27
|
+
padding: 0px 5px 5px 20px;
|
|
28
|
+
}
|
|
29
|
+
#toast p {
|
|
30
|
+
max-width: 250px;
|
|
31
|
+
white-space: normal;
|
|
32
|
+
overflow-wrap: break-word;
|
|
33
|
+
word-break: normal;
|
|
34
|
+
}
|
|
35
|
+
#toast i.fa-times{
|
|
36
|
+
color: var(--text);
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
padding-right: 20px;
|
|
39
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import './toast.css';
|
|
3
|
+
import {toastCarrier, clearToastMessage} from '../../../../index.js';
|
|
4
|
+
|
|
5
|
+
const statusClass = {
|
|
6
|
+
info: 'var(--primary-bg)',
|
|
7
|
+
success: 'var(--primary-bg)',
|
|
8
|
+
error: 'var(--error-bg)',
|
|
9
|
+
warning: 'var(--warning-bg)'
|
|
10
|
+
};
|
|
11
|
+
$: retval = statusClass[$toastCarrier.status]
|
|
12
|
+
</script>
|
|
13
|
+
{#if $toastCarrier.message}
|
|
14
|
+
<div id="toast" style="--retval: {retval};">
|
|
15
|
+
<div>
|
|
16
|
+
<div>
|
|
17
|
+
{#if $toastCarrier.status === 'info'}
|
|
18
|
+
<i class="fa-solid fa-circle-info"></i>
|
|
19
|
+
{:else if $toastCarrier.status === 'success'}
|
|
20
|
+
<i class="fa-solid fa-circle-check"></i>
|
|
21
|
+
{:else if $toastCarrier.status === 'error'}
|
|
22
|
+
<i class="fa-solid fa-circle-xmark"></i>
|
|
23
|
+
{:else if $toastCarrier.status === 'warning'}
|
|
24
|
+
<i class="fa-solid fa-triangle-exclamation"></i>
|
|
25
|
+
{/if}
|
|
26
|
+
<p>{$toastCarrier.status}</p>
|
|
27
|
+
</div>
|
|
28
|
+
<i on:click={clearToastMessage} role="none" class="fa-solid fa-times"></i>
|
|
29
|
+
</div>
|
|
30
|
+
<div>{ $toastCarrier.message }</div>
|
|
31
|
+
</div>
|
|
32
|
+
{/if}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Toast;
|
|
2
|
+
type Toast = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Toast: $$__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,19 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
let {
|
|
3
|
+
padding = '20px',
|
|
4
|
+
minHeight = '100px',
|
|
5
|
+
maxWidth = '500px',
|
|
6
|
+
children
|
|
7
|
+
} = $props();
|
|
8
|
+
</script>
|
|
9
|
+
<style>
|
|
10
|
+
#sierra-wrapper {
|
|
11
|
+
background-color: var(--background-secondary);
|
|
12
|
+
border-radius: 5px;
|
|
13
|
+
box-shadow: var(--box-shadow);
|
|
14
|
+
width: 100%;
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
<div id="sierra-wrapper" role='none' style="max-width: {maxWidth}; min-height: {minHeight}; padding: {padding};" onclick={e => e.stopPropagation()}>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default Wrapper;
|
|
2
|
+
type Wrapper = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Wrapper: import("svelte").Component<{
|
|
7
|
+
padding?: string;
|
|
8
|
+
minHeight?: string;
|
|
9
|
+
maxWidth?: string;
|
|
10
|
+
children: any;
|
|
11
|
+
}, {}, "">;
|
|
12
|
+
type $$ComponentProps = {
|
|
13
|
+
padding?: string;
|
|
14
|
+
minHeight?: string;
|
|
15
|
+
maxWidth?: string;
|
|
16
|
+
children: any;
|
|
17
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
const {email} = $props();
|
|
3
|
+
</script>
|
|
4
|
+
<style>
|
|
5
|
+
#maintenance {
|
|
6
|
+
position: fixed;
|
|
7
|
+
top: 0;
|
|
8
|
+
right: 0;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
gap: 10px;
|
|
17
|
+
padding: 1rem;
|
|
18
|
+
z-index: 5;
|
|
19
|
+
backdrop-filter: blur(2px);
|
|
20
|
+
color: white;
|
|
21
|
+
}
|
|
22
|
+
#maintenance a{
|
|
23
|
+
text-decoration: underline;
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
26
|
+
|
|
27
|
+
<div id="maintenance">
|
|
28
|
+
<h1>Under Construction</h1>
|
|
29
|
+
<p>This site is still being built and will be available soon. Thanks for your patience.</p>
|
|
30
|
+
<p>
|
|
31
|
+
Need immediate assistance?<br>
|
|
32
|
+
Contact <a href="mailto:{email}">{email}</a>
|
|
33
|
+
</p>
|
|
34
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default SiteUnderMaintenance;
|
|
2
|
+
type SiteUnderMaintenance = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const SiteUnderMaintenance: import("svelte").Component<{
|
|
7
|
+
email: any;
|
|
8
|
+
}, {}, "">;
|
|
9
|
+
type $$ComponentProps = {
|
|
10
|
+
email: any;
|
|
11
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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 Hr: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
width?: string;
|
|
16
|
+
color?: string;
|
|
17
|
+
}, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type Hr = InstanceType<typeof Hr>;
|
|
21
|
+
export default Hr;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onDestroy } from 'svelte';
|
|
3
|
+
import {fileInputStore, Button, setToastMessage} from '../../../../../index.js'
|
|
4
|
+
import Preview from './preview.svelte';
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
processing=$bindable(false),
|
|
8
|
+
minHeight = '300px',
|
|
9
|
+
...rest
|
|
10
|
+
} = $props();
|
|
11
|
+
|
|
12
|
+
let fileInput: HTMLInputElement;
|
|
13
|
+
|
|
14
|
+
const typeMap: Record<'image' | 'audio' | 'video' | 'pdf', string[]> = {
|
|
15
|
+
image: ['image/'],
|
|
16
|
+
audio: ['audio/'],
|
|
17
|
+
video: ['video/'],
|
|
18
|
+
pdf: ['application/pdf']
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
//Validate and add files
|
|
23
|
+
function isAllowedType(file: File): boolean {
|
|
24
|
+
return $fileInputStore.uploadType.some(type =>
|
|
25
|
+
typeMap[type].some(prefix => file.type.startsWith(prefix))
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function validateAndAddFile(file: File) {
|
|
30
|
+
if (!isAllowedType(file)) {
|
|
31
|
+
setToastMessage('error', `"${file.name}" is not an allowed file type`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (file.size > $fileInputStore.sizeConstraint) {
|
|
36
|
+
setToastMessage('error', `"${file.name}" exceeds the allowed file size`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
fileInputStore.update(state => ({
|
|
41
|
+
...state,
|
|
42
|
+
selectedFiles: [...state.selectedFiles, file]
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
//Handle file selection via input
|
|
48
|
+
function handleFileChange(event: Event) {
|
|
49
|
+
const files = (event.target as HTMLInputElement).files;
|
|
50
|
+
if (!files || files.length === 0) return;
|
|
51
|
+
|
|
52
|
+
for (const file of files) {
|
|
53
|
+
validateAndAddFile(file);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//Handle drag and drop
|
|
58
|
+
function handleDrop(event: DragEvent) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
if (!event.dataTransfer?.files.length) return;
|
|
61
|
+
|
|
62
|
+
for (const file of event.dataTransfer.files) {
|
|
63
|
+
validateAndAddFile(file);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function handleDragOver(event: DragEvent) {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//Delete selected files
|
|
73
|
+
function handleClear() {
|
|
74
|
+
fileInputStore.update(state => ({
|
|
75
|
+
...state,
|
|
76
|
+
selectedFiles: []
|
|
77
|
+
}));
|
|
78
|
+
if (fileInput) {
|
|
79
|
+
fileInput.value = '';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
onDestroy(() => {
|
|
85
|
+
handleClear();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<main style="padding: 1rem; height: 100%; min-height: {minHeight};">
|
|
91
|
+
<input
|
|
92
|
+
bind:this={fileInput}
|
|
93
|
+
type="file"
|
|
94
|
+
accept={$fileInputStore.uploadType
|
|
95
|
+
.map(t => (t === 'pdf' ? 'application/pdf' : `${t}/*`))
|
|
96
|
+
.join(',')
|
|
97
|
+
}
|
|
98
|
+
hidden
|
|
99
|
+
multiple
|
|
100
|
+
onchange={handleFileChange}
|
|
101
|
+
/>
|
|
102
|
+
<div
|
|
103
|
+
role="none"
|
|
104
|
+
ondrop={handleDrop}
|
|
105
|
+
ondragover={handleDragOver}
|
|
106
|
+
style="border: 2px dotted var(--text-tertiary);border-radius: 0.5rem; padding: 2rem; text-align: center; cursor: pointer;"
|
|
107
|
+
onclick={() => fileInput.click()}
|
|
108
|
+
>Drag & drop image here or click to choose file
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<Preview />
|
|
112
|
+
|
|
113
|
+
<div style="display: flex; justify-content: flex-end; gap: 2rem; margin-top: 1rem;">
|
|
114
|
+
{#if $fileInputStore.selectedFiles.length > 0}
|
|
115
|
+
<Button
|
|
116
|
+
variant="outlined"
|
|
117
|
+
color="warning"
|
|
118
|
+
onclick={handleClear}
|
|
119
|
+
>Clear All
|
|
120
|
+
</Button>
|
|
121
|
+
{/if}
|
|
122
|
+
<Button
|
|
123
|
+
onclick={(e: MouseEvent) => {
|
|
124
|
+
rest.onclick?.(e);
|
|
125
|
+
}}
|
|
126
|
+
isLoading={processing}
|
|
127
|
+
disabled={$fileInputStore.selectedFiles.length === 0}
|
|
128
|
+
>Upload</Button>
|
|
129
|
+
</div>
|
|
130
|
+
</main>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {fileInputStore, PreviewAudio,PreviewDocument,PreviewImage,PreviewVideo} from '../../../../../index.js';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
$: media = {
|
|
6
|
+
Audio: $fileInputStore.selectedFiles.filter(file =>
|
|
7
|
+
file.type.startsWith('audio/')
|
|
8
|
+
),
|
|
9
|
+
Documents: $fileInputStore.selectedFiles.filter(
|
|
10
|
+
file => file.type === 'application/pdf'
|
|
11
|
+
),
|
|
12
|
+
Images: $fileInputStore.selectedFiles.filter(file =>
|
|
13
|
+
file.type.startsWith('image/')
|
|
14
|
+
),
|
|
15
|
+
Videos: $fileInputStore.selectedFiles.filter(file =>
|
|
16
|
+
file.type.startsWith('video/')
|
|
17
|
+
)
|
|
18
|
+
};
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div style="max-height: 300px; overflow-y: auto; padding: 0.5rem;">
|
|
22
|
+
{#if media.Audio.length > 0}
|
|
23
|
+
<h3 style="margin: 1rem 0rem;">Audio</h3>
|
|
24
|
+
<PreviewAudio buttonTimes urlsOnly={false} {media}/>
|
|
25
|
+
{/if}
|
|
26
|
+
{#if media.Documents.length > 0}
|
|
27
|
+
<h3 style="margin: 1rem 0rem;">Documents</h3>
|
|
28
|
+
<PreviewDocument buttonTimes urlsOnly={false} {media}/>
|
|
29
|
+
{/if}
|
|
30
|
+
{#if media.Images.length > 0}
|
|
31
|
+
<h3 style="margin: 1rem 0rem;">Images</h3>
|
|
32
|
+
<PreviewImage buttonTimes urlsOnly={false} {media}/>
|
|
33
|
+
{/if}
|
|
34
|
+
{#if media.Videos.length > 0}
|
|
35
|
+
<h3 style="margin: 1rem 0rem;">Videos</h3>
|
|
36
|
+
<PreviewVideo buttonTimes urlsOnly={false} {media}/>
|
|
37
|
+
{/if}
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
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: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Preview: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Preview = InstanceType<typeof Preview>;
|
|
18
|
+
export default Preview;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export let id: string = '';
|
|
3
|
+
export let label: string = '';
|
|
4
|
+
export let value: string | number = '';
|
|
5
|
+
export let type: string = 'text';
|
|
6
|
+
export let placeholder: string = '';
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<label id="sierra-input" for={id}>{label}
|
|
10
|
+
<input
|
|
11
|
+
id={id}
|
|
12
|
+
name={id}
|
|
13
|
+
type={type}
|
|
14
|
+
bind:value={value}
|
|
15
|
+
placeholder={placeholder}
|
|
16
|
+
/>
|
|
17
|
+
</label>
|
|
@@ -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 Input: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
id?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
value?: string | number;
|
|
18
|
+
type?: string;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
}, {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
}, {}, {}, string>;
|
|
23
|
+
type Input = InstanceType<typeof Input>;
|
|
24
|
+
export default Input;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export let id: string = '';
|
|
3
|
+
export let label: string = '';
|
|
4
|
+
export let value: string = '';
|
|
5
|
+
export let placeholder: string = '';
|
|
6
|
+
let show: boolean = false;
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<label id="sierra-input" for={id}>{label}
|
|
10
|
+
<div style="position: relative; background-color: transparent;">
|
|
11
|
+
<input
|
|
12
|
+
style="width: 100%;"
|
|
13
|
+
type={show ? "text" : "password"}
|
|
14
|
+
id={id}
|
|
15
|
+
name={id}
|
|
16
|
+
bind:value={value}
|
|
17
|
+
placeholder={placeholder}
|
|
18
|
+
/>
|
|
19
|
+
<button on:click|preventDefault={() => show = !show}>
|
|
20
|
+
{#if show}
|
|
21
|
+
<i class="fa fa-eye"></i>
|
|
22
|
+
{:else}
|
|
23
|
+
<i class="fa fa-eye-slash"></i>
|
|
24
|
+
{/if}
|
|
25
|
+
</button>
|
|
26
|
+
</div>
|
|
27
|
+
</label>
|