@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
|
@@ -0,0 +1,23 @@
|
|
|
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 Password: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
id?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
value?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
}, {
|
|
20
|
+
[evt: string]: CustomEvent<any>;
|
|
21
|
+
}, {}, {}, string>;
|
|
22
|
+
type Password = InstanceType<typeof Password>;
|
|
23
|
+
export default Password;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { browser } from '$app/environment';
|
|
3
|
+
import { onMount, onDestroy } from 'svelte';
|
|
4
|
+
import { scale } from 'svelte/transition';
|
|
5
|
+
import { quintOut } from 'svelte/easing';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
top = '130%',
|
|
9
|
+
width = 'auto',
|
|
10
|
+
open = $bindable(true),
|
|
11
|
+
dropdownTrigger = null,
|
|
12
|
+
children = null,
|
|
13
|
+
} = $props();
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
let dropdown = $state<HTMLElement | null>(null);
|
|
17
|
+
let dropdownStyle = $state({ left: '0', right: 'auto' });
|
|
18
|
+
|
|
19
|
+
const adjustDropdownPosition = () => {
|
|
20
|
+
if (!container || !dropdown) return;
|
|
21
|
+
const rect = container.getBoundingClientRect();
|
|
22
|
+
const dropdownWidth = dropdown.offsetWidth;
|
|
23
|
+
const viewportWidth = window.innerWidth;
|
|
24
|
+
|
|
25
|
+
// Check if dropdown would overflow right
|
|
26
|
+
if (rect.left + dropdownWidth > viewportWidth) {
|
|
27
|
+
dropdownStyle = { left: 'auto', right: '0' };
|
|
28
|
+
} else {
|
|
29
|
+
dropdownStyle = { left: '0', right: 'auto' };
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
$effect(() => {
|
|
34
|
+
if (open) {
|
|
35
|
+
adjustDropdownPosition();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Close dropdown on outside click
|
|
40
|
+
let container = $state<HTMLElement | null>(null);
|
|
41
|
+
|
|
42
|
+
const handleClose = () => {
|
|
43
|
+
open = false;
|
|
44
|
+
};
|
|
45
|
+
const handleDocumentClick = (event: MouseEvent) => {
|
|
46
|
+
if (open && container && !container.contains(event.target as Node)) {
|
|
47
|
+
handleClose();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
if (browser) {
|
|
51
|
+
onMount(() => {
|
|
52
|
+
document.addEventListener('click', handleDocumentClick);
|
|
53
|
+
});
|
|
54
|
+
onDestroy(() => {
|
|
55
|
+
document.removeEventListener('click', handleDocumentClick);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<style>
|
|
61
|
+
#sierra-dropdown {
|
|
62
|
+
position: relative;
|
|
63
|
+
}
|
|
64
|
+
#sierra-dropdown .dropdown-paper {
|
|
65
|
+
position: absolute;
|
|
66
|
+
background-color: var(--background-secondary);
|
|
67
|
+
border-radius: 5px;
|
|
68
|
+
box-shadow: var(--box-shadow);
|
|
69
|
+
min-width: 5px;
|
|
70
|
+
min-height: 5px;
|
|
71
|
+
z-index: 5;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
74
|
+
|
|
75
|
+
<main id="sierra-dropdown" bind:this={container}>
|
|
76
|
+
{@render dropdownTrigger?.()}
|
|
77
|
+
{#if open}
|
|
78
|
+
<div
|
|
79
|
+
bind:this={dropdown}
|
|
80
|
+
class="dropdown-paper"
|
|
81
|
+
transition:scale={{
|
|
82
|
+
start: 0.9,
|
|
83
|
+
duration: 180,
|
|
84
|
+
easing: quintOut,
|
|
85
|
+
opacity: 0
|
|
86
|
+
}}
|
|
87
|
+
style="
|
|
88
|
+
transform-origin: top; top: {top}; width: {width};
|
|
89
|
+
left: {dropdownStyle.left}; right: {dropdownStyle.right};
|
|
90
|
+
"
|
|
91
|
+
>{@render children?.()}
|
|
92
|
+
</div>
|
|
93
|
+
{/if}
|
|
94
|
+
</main>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
const {
|
|
3
|
+
icon = '',
|
|
4
|
+
active = false,
|
|
5
|
+
disabled = false,
|
|
6
|
+
iconSize = '20px',
|
|
7
|
+
iconBg: iconBg = 'var(--primary-bg)',
|
|
8
|
+
children = null,
|
|
9
|
+
...rest
|
|
10
|
+
} = $props();
|
|
11
|
+
</script>
|
|
12
|
+
<style>
|
|
13
|
+
#sierra-menu-item {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
padding: 10px 16px;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
transition: background-color 0.2s ease;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#sierra-menu-item:hover {
|
|
22
|
+
background-color: var(--menu-item-hover);
|
|
23
|
+
}
|
|
24
|
+
#sierra-menu-item.disabled {
|
|
25
|
+
cursor: not-allowed;
|
|
26
|
+
opacity: 0.6;
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
29
|
+
<div
|
|
30
|
+
id="sierra-menu-item"
|
|
31
|
+
role="none"
|
|
32
|
+
style="background-color: {active ? 'var(--menu-item-active)' : ''}"
|
|
33
|
+
class="{disabled? 'disabled':''}"
|
|
34
|
+
{...rest}
|
|
35
|
+
onclick={(e: MouseEvent) => {
|
|
36
|
+
rest.onclick?.(e);
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
{#if icon}
|
|
40
|
+
<i style="font-size: {iconSize}; color: {iconBg}"
|
|
41
|
+
class="fa {icon}"></i>
|
|
42
|
+
{/if}
|
|
43
|
+
<h4 style="margin-left: {icon ? '20px' : '0'};">{@render children?.()}</h4>
|
|
44
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const MenuItem: import("svelte").Component<{
|
|
2
|
+
icon?: string;
|
|
3
|
+
active?: boolean;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
iconSize?: string;
|
|
6
|
+
iconBg?: string;
|
|
7
|
+
children?: any;
|
|
8
|
+
} & Record<string, any>, {}, "">;
|
|
9
|
+
type MenuItem = ReturnType<typeof MenuItem>;
|
|
10
|
+
export default MenuItem;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {DropdownContainer} from '../../../../index.js';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
top = '150%',
|
|
6
|
+
width = '300px',
|
|
7
|
+
iconSize = '30px',
|
|
8
|
+
iconBg = 'var(--primary-bg)',
|
|
9
|
+
user = $bindable({}),
|
|
10
|
+
open = $bindable(false),
|
|
11
|
+
children = null,
|
|
12
|
+
} = $props();
|
|
13
|
+
|
|
14
|
+
const handleClick = () => {
|
|
15
|
+
open = !open;
|
|
16
|
+
};
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<DropdownContainer bind:open {top} {width}>
|
|
20
|
+
{#snippet dropdownTrigger()}
|
|
21
|
+
<button aria-label="none" onclick={handleClick}>
|
|
22
|
+
<i style="font-size: {iconSize}; color: {iconBg}" class="fa-solid fa-user"></i>
|
|
23
|
+
</button>
|
|
24
|
+
{/snippet}
|
|
25
|
+
<div style="padding:15px; border-bottom:1px solid var(--border);">
|
|
26
|
+
{#if Object.keys(user).length > 0}
|
|
27
|
+
{#each Object.entries(user) as [key, value], i}
|
|
28
|
+
<p>{value}</p>
|
|
29
|
+
{/each}
|
|
30
|
+
{:else}
|
|
31
|
+
<p>No user info</p>
|
|
32
|
+
{/if}
|
|
33
|
+
</div>
|
|
34
|
+
{@render children?.()}
|
|
35
|
+
</DropdownContainer>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const Profile: import("svelte").Component<{
|
|
2
|
+
top?: string;
|
|
3
|
+
width?: string;
|
|
4
|
+
iconSize?: string;
|
|
5
|
+
iconBg?: string;
|
|
6
|
+
user?: Record<string, any>;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
children?: any;
|
|
9
|
+
}, {}, "open" | "user">;
|
|
10
|
+
type Profile = ReturnType<typeof Profile>;
|
|
11
|
+
export default Profile;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.btn-flip {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
width: 150px; /* you can fix width if needed */
|
|
5
|
+
height: 40px;
|
|
6
|
+
text-align: center;
|
|
7
|
+
perspective: 1000px;
|
|
8
|
+
color: var(--text-color);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.btn-flip::before,
|
|
12
|
+
.btn-flip::after {
|
|
13
|
+
content: attr(data-front);
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 0;
|
|
16
|
+
left: 0;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
padding: 0 30px;
|
|
23
|
+
line-height: 40px;
|
|
24
|
+
transition: 0.5s;
|
|
25
|
+
backface-visibility: hidden;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.btn-flip::before {
|
|
30
|
+
content: attr(data-front);
|
|
31
|
+
background: var(--bg-front);
|
|
32
|
+
transform: translateY(0) rotateX(0);
|
|
33
|
+
opacity: 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.btn-flip::after {
|
|
37
|
+
content: attr(data-back);
|
|
38
|
+
background: var(--bg-back);
|
|
39
|
+
transform: translateY(-50%) rotateX(90deg);
|
|
40
|
+
opacity: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.btn-flip:hover::before {
|
|
44
|
+
opacity: 0;
|
|
45
|
+
transform: translateY(50%) rotateX(90deg);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.btn-flip:hover::after {
|
|
49
|
+
opacity: 1;
|
|
50
|
+
transform: translateY(0) rotateX(0);
|
|
51
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<a href={link}
|
|
2
|
+
aria-label="button"
|
|
3
|
+
class="btn-flip"
|
|
4
|
+
data-back={back}
|
|
5
|
+
data-front={front}
|
|
6
|
+
style="--bg-front: {bgFront}; --bg-back: {bgBack}; --text-color: {color}"
|
|
7
|
+
></a>
|
|
8
|
+
<style>.btn-flip {
|
|
9
|
+
position: relative;
|
|
10
|
+
display: inline-block;
|
|
11
|
+
width: 150px; /* you can fix width if needed */
|
|
12
|
+
height: 40px;
|
|
13
|
+
text-align: center;
|
|
14
|
+
perspective: 1000px;
|
|
15
|
+
color: var(--text-color);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.btn-flip::before,
|
|
19
|
+
.btn-flip::after {
|
|
20
|
+
content: attr(data-front);
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 0;
|
|
23
|
+
left: 0;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
padding: 0 30px;
|
|
30
|
+
line-height: 40px;
|
|
31
|
+
transition: 0.5s;
|
|
32
|
+
backface-visibility: hidden;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.btn-flip::before {
|
|
37
|
+
content: attr(data-front);
|
|
38
|
+
background: var(--bg-front);
|
|
39
|
+
transform: translateY(0) rotateX(0);
|
|
40
|
+
opacity: 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.btn-flip::after {
|
|
44
|
+
content: attr(data-back);
|
|
45
|
+
background: var(--bg-back);
|
|
46
|
+
transform: translateY(-50%) rotateX(90deg);
|
|
47
|
+
opacity: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.btn-flip:hover::before {
|
|
51
|
+
opacity: 0;
|
|
52
|
+
transform: translateY(50%) rotateX(90deg);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.btn-flip:hover::after {
|
|
56
|
+
opacity: 1;
|
|
57
|
+
transform: translateY(0) rotateX(0);
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
60
|
+
<script>
|
|
61
|
+
const {
|
|
62
|
+
link = "#",
|
|
63
|
+
back = "back",
|
|
64
|
+
front = "front",
|
|
65
|
+
bgFront = "var(--primary-bg)",
|
|
66
|
+
bgBack = "#f4e5d4",
|
|
67
|
+
color = "var(--button-text)",
|
|
68
|
+
} = $props();
|
|
69
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default Button;
|
|
2
|
+
type Button = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Button: import("svelte").Component<{
|
|
7
|
+
link?: string;
|
|
8
|
+
back?: string;
|
|
9
|
+
front?: string;
|
|
10
|
+
bgFront?: string;
|
|
11
|
+
bgBack?: string;
|
|
12
|
+
color?: string;
|
|
13
|
+
}, {}, "">;
|
|
14
|
+
type $$ComponentProps = {
|
|
15
|
+
link?: string;
|
|
16
|
+
back?: string;
|
|
17
|
+
front?: string;
|
|
18
|
+
bgFront?: string;
|
|
19
|
+
bgBack?: string;
|
|
20
|
+
color?: string;
|
|
21
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.marquee-container {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
white-space: nowrap;
|
|
4
|
+
position: relative;
|
|
5
|
+
font-size: 1rem;
|
|
6
|
+
padding: 0.2rem 10px;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
border: 1px solid var(--border-color);
|
|
9
|
+
color: var(--text-color);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.marquee {
|
|
13
|
+
display: inline-block;
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
transition: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* scrolling animation only active when hovered */
|
|
19
|
+
.scrolling {
|
|
20
|
+
animation: scroll 2s linear infinite;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes scroll {
|
|
24
|
+
0% {
|
|
25
|
+
transform: translateX(0%);
|
|
26
|
+
}
|
|
27
|
+
100% {
|
|
28
|
+
transform: translateX(-66.66%);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
.marquee:not(.scrolling) span:not(:first-child) {
|
|
32
|
+
visibility: hidden;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.marquee span {
|
|
36
|
+
margin-right: 2rem;
|
|
37
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import './button.css';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
text = "Hover me",
|
|
7
|
+
link = "#",
|
|
8
|
+
bg = "var(--primary-bg)",
|
|
9
|
+
color = "var(--text)"
|
|
10
|
+
} = $props();
|
|
11
|
+
|
|
12
|
+
let scrolling = $state(false);
|
|
13
|
+
|
|
14
|
+
let container: HTMLDivElement;
|
|
15
|
+
let marquee: HTMLAnchorElement;
|
|
16
|
+
|
|
17
|
+
let containerWidth = 0;
|
|
18
|
+
let textWidth = 0;
|
|
19
|
+
|
|
20
|
+
onMount(() => {
|
|
21
|
+
if (container && marquee) {
|
|
22
|
+
// width of one sentence
|
|
23
|
+
textWidth = marquee.offsetWidth / 3; // because we repeat text 3x
|
|
24
|
+
containerWidth = textWidth - 10;
|
|
25
|
+
container.style.width = containerWidth + "px";
|
|
26
|
+
const containerHeight = container.offsetHeight;
|
|
27
|
+
container.style.borderRadius = containerHeight / 2 + "px";
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<div
|
|
33
|
+
role='none'
|
|
34
|
+
bind:this={container}
|
|
35
|
+
class="marquee-container"
|
|
36
|
+
onmouseenter={() => scrolling = true}
|
|
37
|
+
onmouseleave={() => scrolling = false}
|
|
38
|
+
style="--border-color: {bg}; --text-color: {color}"
|
|
39
|
+
>
|
|
40
|
+
<a href={link} class="marquee {scrolling ? 'scrolling' : ''}" bind:this={marquee}>
|
|
41
|
+
<span>{text}</span>
|
|
42
|
+
<span>{text}</span>
|
|
43
|
+
<span>{text}</span>
|
|
44
|
+
</a>
|
|
45
|
+
</div>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.btn-0 {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: block;
|
|
4
|
+
width:130px;
|
|
5
|
+
height: 30px;
|
|
6
|
+
line-height: 27px;
|
|
7
|
+
text-align: center;
|
|
8
|
+
border: 1px solid var(--btn-color);
|
|
9
|
+
border-radius: 50px;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
z-index: 0;
|
|
13
|
+
color: var(--text-color);
|
|
14
|
+
}
|
|
15
|
+
a{
|
|
16
|
+
text-decoration: none;
|
|
17
|
+
}
|
|
18
|
+
/* Swipe layer */
|
|
19
|
+
.btn-0::before {
|
|
20
|
+
content: '';
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 0; left: 0; bottom: 0; right: 0;
|
|
23
|
+
background-color: var(--btn-color);
|
|
24
|
+
transform: translateX(-100%);
|
|
25
|
+
transition: transform 0.4s ease;
|
|
26
|
+
z-index: -1;
|
|
27
|
+
}
|
|
28
|
+
/* Hover triggers swipe */
|
|
29
|
+
.btn-0:hover::before {
|
|
30
|
+
transform: translateX(0);
|
|
31
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<a
|
|
2
|
+
class="btn-0"
|
|
3
|
+
href={link}
|
|
4
|
+
style="--btn-color: {bg}; --text-color: {color}"
|
|
5
|
+
>{text}</a>
|
|
6
|
+
<style>.btn-0 {
|
|
7
|
+
position: relative;
|
|
8
|
+
display: block;
|
|
9
|
+
width:130px;
|
|
10
|
+
height: 30px;
|
|
11
|
+
line-height: 27px;
|
|
12
|
+
text-align: center;
|
|
13
|
+
border: 1px solid var(--btn-color);
|
|
14
|
+
border-radius: 50px;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
z-index: 0;
|
|
18
|
+
color: var(--text-color);
|
|
19
|
+
}
|
|
20
|
+
a{
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
}
|
|
23
|
+
/* Swipe layer */
|
|
24
|
+
.btn-0::before {
|
|
25
|
+
content: '';
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: 0; left: 0; bottom: 0; right: 0;
|
|
28
|
+
background-color: var(--btn-color);
|
|
29
|
+
transform: translateX(-100%);
|
|
30
|
+
transition: transform 0.4s ease;
|
|
31
|
+
z-index: -1;
|
|
32
|
+
}
|
|
33
|
+
/* Hover triggers swipe */
|
|
34
|
+
.btn-0:hover::before {
|
|
35
|
+
transform: translateX(0);
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
38
|
+
<script>
|
|
39
|
+
const {
|
|
40
|
+
link = "#",
|
|
41
|
+
text = "Button",
|
|
42
|
+
bg = "var(--primary-bg)",
|
|
43
|
+
color = "var(--text)"
|
|
44
|
+
} = $props();
|
|
45
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default Button;
|
|
2
|
+
type Button = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Button: import("svelte").Component<{
|
|
7
|
+
link?: string;
|
|
8
|
+
text?: string;
|
|
9
|
+
bg?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
}, {}, "">;
|
|
12
|
+
type $$ComponentProps = {
|
|
13
|
+
link?: string;
|
|
14
|
+
text?: string;
|
|
15
|
+
bg?: string;
|
|
16
|
+
color?: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.base-btn {
|
|
2
|
+
color: var(--button-text);
|
|
3
|
+
padding: 0.5rem 1rem;
|
|
4
|
+
border-radius: 4px;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
transition: all 0.3s ease-in-out;
|
|
7
|
+
min-width: 100px;
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: space-evenly;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: 10px;
|
|
12
|
+
}
|
|
13
|
+
.base-btn:hover{
|
|
14
|
+
opacity: 0.8;
|
|
15
|
+
}
|
|
16
|
+
/*********Button Variants*************************/
|
|
17
|
+
.btn-outlined {
|
|
18
|
+
border-width: 1px;
|
|
19
|
+
border-style: solid;
|
|
20
|
+
}
|
|
21
|
+
.btn-contained-primary {
|
|
22
|
+
background-color: var(--primary-bg);
|
|
23
|
+
}
|
|
24
|
+
.btn-contained-warning {
|
|
25
|
+
background-color: var(--warning-bg);
|
|
26
|
+
}
|
|
27
|
+
.btn-contained-error {
|
|
28
|
+
background-color: var(--error-bg);
|
|
29
|
+
}
|
|
30
|
+
.btn-outlined-primary {
|
|
31
|
+
border-color: var(--primary-bg);
|
|
32
|
+
color: var(--primary-bg);
|
|
33
|
+
}
|
|
34
|
+
.btn-outlined-warning {
|
|
35
|
+
border-color: var(--warning-bg);
|
|
36
|
+
color: var(--warning-bg);
|
|
37
|
+
}
|
|
38
|
+
.btn-outlined-error {
|
|
39
|
+
border-color: var(--error-bg);
|
|
40
|
+
color: var(--error-bg);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/*****Disabled********/
|
|
44
|
+
.base-btn.disabled {
|
|
45
|
+
opacity: 0.6;
|
|
46
|
+
cursor: not-allowed;
|
|
47
|
+
}
|
|
48
|
+
/****Pill Button******/
|
|
49
|
+
.base-btn.pill{
|
|
50
|
+
border-radius: 50%;
|
|
51
|
+
min-width: unset;
|
|
52
|
+
}
|