@sierra-95/svelte-scaffold 1.0.78 → 1.0.80
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/dist/Core/components/Alerts/Modal/modal.svelte +12 -1
- package/dist/Core/components/Form/Input/Date/date.svelte +34 -0
- package/dist/Core/components/Form/Input/Date/date.svelte.d.ts +16 -0
- package/dist/Core/components/Form/Input/Time/time.svelte +34 -0
- package/dist/Core/components/Form/Input/Time/time.svelte.d.ts +16 -0
- package/dist/Core/components/others/ColorPicker/colors.d.ts +2 -0
- package/dist/Core/components/others/ColorPicker/colors.js +21 -0
- package/dist/Core/components/others/ColorPicker/main.svelte +89 -0
- package/dist/Core/components/others/ColorPicker/main.svelte.d.ts +8 -0
- package/dist/Modules/Editor/Nodes/TextColor/textColor.svelte +32 -59
- package/dist/Modules/Editor/Nodes/TextColor/textColor.svelte.d.ts +4 -21
- package/dist/Modules/Layout/Header/header.svelte +1 -0
- package/dist/Modules/Layout/Menu/menu.svelte +9 -10
- package/dist/Modules/Layout/Menu/menu.svelte.d.ts +0 -1
- package/dist/Modules/Layout/collapse.svelte +4 -3
- package/dist/Modules/Layout/collapse.svelte.d.ts +0 -2
- package/dist/Modules/Layout/main.svelte +9 -11
- package/dist/global.css +8 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/stores/core/modal.d.ts +6 -0
- package/dist/stores/core/modal.js +21 -9
- package/dist/stores/modules/layout.d.ts +2 -0
- package/dist/stores/modules/layout.js +2 -0
- package/package.json +1 -1
- package/dist/Modules/Editor/Nodes/TextColor/styles.css +0 -18
|
@@ -22,7 +22,18 @@
|
|
|
22
22
|
|
|
23
23
|
<Backdrop onClose={close} bind:open={$modalStore.open} zIndex={20}>
|
|
24
24
|
<Wrapper>
|
|
25
|
-
<
|
|
25
|
+
<div style="display: flex; align-items: center; gap: {$modalStore.logo_url_spacing};">
|
|
26
|
+
{#if $modalStore.logo_url}
|
|
27
|
+
<img src={$modalStore.logo_url} alt="Modal Logo"
|
|
28
|
+
style="width: {$modalStore.logo_url_size};"
|
|
29
|
+
/>
|
|
30
|
+
{/if}
|
|
31
|
+
<h2 style="
|
|
32
|
+
font: {$modalStore.titleFont};
|
|
33
|
+
font-weight: {$modalStore.titleFontWeight};
|
|
34
|
+
font-size: {$modalStore.titleFontSize};
|
|
35
|
+
">{$modalStore.title}</h2>
|
|
36
|
+
</div>
|
|
26
37
|
{#if $modalStore?.content}
|
|
27
38
|
<h3 style="font-size: 1rem;">{$modalStore.content}</h3>
|
|
28
39
|
{/if}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let {
|
|
3
|
+
id = '',
|
|
4
|
+
label = '',
|
|
5
|
+
value = $bindable(""),
|
|
6
|
+
type = 'text',
|
|
7
|
+
placeholder = '',
|
|
8
|
+
underline = false,
|
|
9
|
+
borderSize = '1px',
|
|
10
|
+
borderColor = 'var(--input-border)',
|
|
11
|
+
background = 'transparent',
|
|
12
|
+
width = '100%',
|
|
13
|
+
maxWidth = '',
|
|
14
|
+
textColor = 'inherit',
|
|
15
|
+
...rest
|
|
16
|
+
} = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<label class="sierra-input" style="width: {width}; max-width: {maxWidth}; color: {textColor}" for={id}>{label}
|
|
20
|
+
<input
|
|
21
|
+
id={id}
|
|
22
|
+
name={id}
|
|
23
|
+
type="date"
|
|
24
|
+
bind:value={value}
|
|
25
|
+
placeholder={placeholder}
|
|
26
|
+
required={rest.required}
|
|
27
|
+
readonly={rest.readonly}
|
|
28
|
+
class="{underline? 'underline-input':''}"
|
|
29
|
+
style="background-color: {background}; border: {borderSize} solid {borderColor};"
|
|
30
|
+
onclick={(e: MouseEvent) => {
|
|
31
|
+
rest.onclick?.(e);
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
</label>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const Date: import("svelte").Component<{
|
|
2
|
+
id?: string;
|
|
3
|
+
label?: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
type?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
underline?: boolean;
|
|
8
|
+
borderSize?: string;
|
|
9
|
+
borderColor?: string;
|
|
10
|
+
background?: string;
|
|
11
|
+
width?: string;
|
|
12
|
+
maxWidth?: string;
|
|
13
|
+
textColor?: string;
|
|
14
|
+
} & Record<string, any>, {}, "value">;
|
|
15
|
+
type Date = ReturnType<typeof Date>;
|
|
16
|
+
export default Date;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let {
|
|
3
|
+
id = '',
|
|
4
|
+
label = '',
|
|
5
|
+
value = $bindable(""),
|
|
6
|
+
type = 'text',
|
|
7
|
+
placeholder = '',
|
|
8
|
+
underline = false,
|
|
9
|
+
borderSize = '1px',
|
|
10
|
+
borderColor = 'var(--input-border)',
|
|
11
|
+
background = 'transparent',
|
|
12
|
+
width = '100%',
|
|
13
|
+
maxWidth = '',
|
|
14
|
+
textColor = 'inherit',
|
|
15
|
+
...rest
|
|
16
|
+
} = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<label class="sierra-input" style="width: {width}; max-width: {maxWidth}; color: {textColor}" for={id}>{label}
|
|
20
|
+
<input
|
|
21
|
+
id={id}
|
|
22
|
+
name={id}
|
|
23
|
+
type="time"
|
|
24
|
+
bind:value={value}
|
|
25
|
+
placeholder={placeholder}
|
|
26
|
+
required={rest.required}
|
|
27
|
+
readonly={rest.readonly}
|
|
28
|
+
class="{underline? 'underline-input':''}"
|
|
29
|
+
style="background-color: {background}; border: {borderSize} solid {borderColor};"
|
|
30
|
+
onclick={(e: MouseEvent) => {
|
|
31
|
+
rest.onclick?.(e);
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
</label>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const Time: import("svelte").Component<{
|
|
2
|
+
id?: string;
|
|
3
|
+
label?: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
type?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
underline?: boolean;
|
|
8
|
+
borderSize?: string;
|
|
9
|
+
borderColor?: string;
|
|
10
|
+
background?: string;
|
|
11
|
+
width?: string;
|
|
12
|
+
maxWidth?: string;
|
|
13
|
+
textColor?: string;
|
|
14
|
+
} & Record<string, any>, {}, "value">;
|
|
15
|
+
type Time = ReturnType<typeof Time>;
|
|
16
|
+
export default Time;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const colors = [
|
|
2
|
+
// Grayscale
|
|
3
|
+
'#000000', '#2E2E2E', '#595959', '#7F7F7F', '#A6A6A6', '#D9D9D9',
|
|
4
|
+
|
|
5
|
+
// Reds
|
|
6
|
+
'#7F1D1D', '#991B1B', '#B91C1C', '#DC2626', '#EF4444', '#F87171',
|
|
7
|
+
|
|
8
|
+
// Oranges / Browns
|
|
9
|
+
'#78350F', '#92400E', '#A16207', '#D97706', '#F59E0B', '#FDBA74',
|
|
10
|
+
|
|
11
|
+
// Yellows / Golds
|
|
12
|
+
'#854D0E', '#A16207', '#CA8A04', '#EAB308', '#FACC15', '#FEF08A',
|
|
13
|
+
|
|
14
|
+
// Greens
|
|
15
|
+
'#14532D', '#166534', '#15803D', '#16A34A', '#22C55E', '#86EFAC',
|
|
16
|
+
|
|
17
|
+
// Blues
|
|
18
|
+
'#1E3A8A', '#1D4ED8', '#2563EB', '#3B82F6', '#60A5FA', '#93C5FD',
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
export default colors;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import { DropdownContainer } from '../../../../index.js';
|
|
4
|
+
import colors from './colors.js'
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
selectedColor=$bindable(''),
|
|
8
|
+
openDropdown =$bindable(false),
|
|
9
|
+
dropdownTrigger,
|
|
10
|
+
onSelect =(color: string) => {},
|
|
11
|
+
} =$props();
|
|
12
|
+
|
|
13
|
+
let recentColors = $state<string[]>([]);
|
|
14
|
+
|
|
15
|
+
const STORAGE_KEY = 'sierra_recent_colors';
|
|
16
|
+
const MAX = 6;
|
|
17
|
+
|
|
18
|
+
function saveRecentColor(color: string) {
|
|
19
|
+
let stored = JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]');
|
|
20
|
+
stored = stored.filter((c: string) => c !== color); // remove if already exists (so it moves to the end)
|
|
21
|
+
stored.push(color); // add new color to the end
|
|
22
|
+
if (stored.length > MAX) {
|
|
23
|
+
stored.shift(); // removes first (oldest)
|
|
24
|
+
}
|
|
25
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(stored));
|
|
26
|
+
recentColors = stored;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
onMount(() => {
|
|
30
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
31
|
+
if (!stored) {
|
|
32
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify([]));
|
|
33
|
+
recentColors = [];
|
|
34
|
+
} else {
|
|
35
|
+
recentColors = JSON.parse(stored);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
function handleSelect(color: string) {
|
|
40
|
+
selectedColor = color;
|
|
41
|
+
onSelect?.(color);
|
|
42
|
+
openDropdown = false;
|
|
43
|
+
saveRecentColor(color);
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
{#snippet Color(color:string)}
|
|
48
|
+
<button
|
|
49
|
+
aria-label={`Select color: ${color}`}
|
|
50
|
+
class="color-swatch"
|
|
51
|
+
style="background-color: {color};"
|
|
52
|
+
onclick={() => handleSelect(color)}
|
|
53
|
+
></button>
|
|
54
|
+
{/snippet}
|
|
55
|
+
<DropdownContainer bind:open={openDropdown} dropdownTrigger={dropdownTrigger}>
|
|
56
|
+
<div class="color-picker">
|
|
57
|
+
{#each colors as color}
|
|
58
|
+
{@render Color?.(color)}
|
|
59
|
+
{/each}
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
{#if recentColors.length > 0}
|
|
63
|
+
<p style="margin-left: 5px; font-size: 12px; color: var(--text-secondary);">Recently used</p>
|
|
64
|
+
<div class="color-picker">
|
|
65
|
+
{#each recentColors as color}
|
|
66
|
+
{@render Color?.(color)}
|
|
67
|
+
{/each}
|
|
68
|
+
</div>
|
|
69
|
+
{/if}
|
|
70
|
+
</DropdownContainer>
|
|
71
|
+
|
|
72
|
+
<style>
|
|
73
|
+
.color-picker {
|
|
74
|
+
display: grid;
|
|
75
|
+
grid-template-columns: repeat(6, 1fr);
|
|
76
|
+
gap: 5px;
|
|
77
|
+
padding: 5px;
|
|
78
|
+
}
|
|
79
|
+
.color-picker .color-swatch {
|
|
80
|
+
width: 20px;
|
|
81
|
+
height: 20px;
|
|
82
|
+
border-radius: 50% !important;
|
|
83
|
+
transition: transform 0.1s ease-in-out;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.color-picker .color-swatch:hover {
|
|
87
|
+
transform: scale(1.1);
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
@@ -1,88 +1,61 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import './styles.css';
|
|
3
2
|
import { onMount } from 'svelte';
|
|
4
|
-
import {theme,
|
|
5
|
-
import colors from '../../colors.js';
|
|
6
|
-
|
|
7
|
-
import type { Editor } from "@tiptap/core";
|
|
8
|
-
export let editor: Editor;
|
|
3
|
+
import {theme, ColorPicker} from '../../../../index.js';
|
|
9
4
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
const {
|
|
6
|
+
editor,
|
|
7
|
+
}= $props();
|
|
8
|
+
|
|
9
|
+
let textColor = $state<HTMLDivElement>();
|
|
10
|
+
let highlightColor = $state('#ffe066');
|
|
11
|
+
let textColorDropdown = $state(false);
|
|
12
|
+
let highlightDropdown = $state(false);
|
|
14
13
|
|
|
15
14
|
onMount(() => {
|
|
16
|
-
if (!editor) return;
|
|
15
|
+
if (!editor || !textColor) return;
|
|
17
16
|
const value = $theme === 'dark' ? '#ffffff' : '#000000';
|
|
18
|
-
|
|
19
|
-
textColor.style.backgroundColor = value;
|
|
17
|
+
setTextColor(value);
|
|
20
18
|
});
|
|
21
19
|
|
|
22
|
-
function
|
|
20
|
+
function setTextColor(color: string) {
|
|
21
|
+
if (!editor || !textColor) return;
|
|
23
22
|
editor.chain().focus().setColor(color).run();
|
|
24
23
|
textColor.style.backgroundColor = color;
|
|
25
|
-
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function setHighlightColor(color: string) {
|
|
27
|
+
highlightColor = color;
|
|
28
|
+
if (editor) editor.chain().focus().setHighlight({ color }).run();
|
|
26
29
|
}
|
|
27
30
|
</script>
|
|
28
31
|
|
|
29
32
|
{#if editor}
|
|
30
33
|
|
|
31
34
|
<main id="editor-text-color" style="display: flex; gap: 0.5rem; align-items: center;">
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
{#if textColorDropdown}
|
|
40
|
-
<div class="text-color-selector-dropdown ">
|
|
41
|
-
{#each colors as color}
|
|
42
|
-
<div
|
|
43
|
-
role="none"
|
|
44
|
-
class="color-swatch"
|
|
45
|
-
style="background-color: {color};"
|
|
46
|
-
on:click={() => applyColor(color)}
|
|
47
|
-
></div>
|
|
48
|
-
{/each}
|
|
49
|
-
</div>
|
|
50
|
-
{/if}
|
|
51
|
-
</DropdownContainer>
|
|
35
|
+
{#snippet TriggerText()}
|
|
36
|
+
<button aria-label="Text Color" title="Color" onclick={() => textColorDropdown = !textColorDropdown}>
|
|
37
|
+
<i class="fa fa-font"></i>
|
|
38
|
+
<div bind:this={textColor} style="height: 3px; border-radius: 0.3125rem;"></div>
|
|
39
|
+
</button>
|
|
40
|
+
{/snippet}
|
|
41
|
+
<ColorPicker bind:openDropdown={textColorDropdown} dropdownTrigger={TriggerText} onSelect={setTextColor}/>
|
|
52
42
|
|
|
53
43
|
<div style="display: flex;">
|
|
54
44
|
<button
|
|
55
45
|
aria-label="Highlight"
|
|
56
46
|
title="Highlight"
|
|
57
47
|
class="{editor.isActive('highlight') ? 'active' : ''}"
|
|
58
|
-
|
|
48
|
+
onclick={() => editor.chain().focus().toggleHighlight().run()}
|
|
59
49
|
style={editor.isActive('highlight') ? `background-color: ${highlightColor};` : ''}
|
|
60
50
|
>
|
|
61
51
|
<i class="fa fa-font"></i>
|
|
62
52
|
</button>
|
|
63
|
-
|
|
64
|
-
{
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
{#if highlightDropdown}
|
|
70
|
-
<div class="text-color-selector-dropdown">
|
|
71
|
-
{#each colors as color}
|
|
72
|
-
<div
|
|
73
|
-
role="none"
|
|
74
|
-
class="color-swatch"
|
|
75
|
-
style="background-color: {color};"
|
|
76
|
-
on:click={() => {
|
|
77
|
-
editor.chain().focus().setHighlight({ color }).run();
|
|
78
|
-
highlightDropdown = false;
|
|
79
|
-
highlightColor = color;
|
|
80
|
-
}}
|
|
81
|
-
></div>
|
|
82
|
-
{/each}
|
|
83
|
-
</div>
|
|
84
|
-
{/if}
|
|
85
|
-
</DropdownContainer>
|
|
53
|
+
{#snippet TriggerHighlight()}
|
|
54
|
+
<button id="color-picker-trigger" aria-label="Highlight Color" onclick={() => highlightDropdown = !highlightDropdown}>
|
|
55
|
+
<i class="fa fa-chevron-down {highlightDropdown ? 'active' : ''}"></i>
|
|
56
|
+
</button>
|
|
57
|
+
{/snippet}
|
|
58
|
+
<ColorPicker bind:openDropdown={highlightDropdown} dropdownTrigger={TriggerHighlight} onSelect={setHighlightColor}/>
|
|
86
59
|
</div>
|
|
87
60
|
</main>
|
|
88
61
|
{/if}
|
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
$$bindings?: Bindings;
|
|
6
|
-
} & Exports;
|
|
7
|
-
(internal: unknown, props: Props & {
|
|
8
|
-
$$events?: Events;
|
|
9
|
-
$$slots?: Slots;
|
|
10
|
-
}): Exports & {
|
|
11
|
-
$set?: any;
|
|
12
|
-
$on?: any;
|
|
13
|
-
};
|
|
14
|
-
z_$$bindings?: Bindings;
|
|
15
|
-
}
|
|
16
|
-
declare const TextColor: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
-
editor: Editor;
|
|
18
|
-
}, {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
}, {}, {}, string>;
|
|
21
|
-
type TextColor = InstanceType<typeof TextColor>;
|
|
1
|
+
declare const TextColor: import("svelte").Component<{
|
|
2
|
+
editor: any;
|
|
3
|
+
}, {}, "">;
|
|
4
|
+
type TextColor = ReturnType<typeof TextColor>;
|
|
22
5
|
export default TextColor;
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
export let toggleMenu: () => void;
|
|
9
9
|
export let closeMobileMenu: () => void;
|
|
10
|
-
export let isMenuOpen: boolean;
|
|
11
10
|
|
|
12
11
|
$: sections = filterSectionsByRole(
|
|
13
12
|
$layoutStore.sections,
|
|
@@ -27,7 +26,7 @@
|
|
|
27
26
|
let openSubsections = new Set();
|
|
28
27
|
|
|
29
28
|
function toggleSubsection(id: string) {
|
|
30
|
-
if (
|
|
29
|
+
if (!$layoutStore.isMenuOpen){
|
|
31
30
|
toggleMenu();
|
|
32
31
|
if(openSubsections.has(id)) return;
|
|
33
32
|
}
|
|
@@ -74,12 +73,12 @@
|
|
|
74
73
|
</script>
|
|
75
74
|
<nav id="sierra-menu">
|
|
76
75
|
<div class="sierra-menu-global-search">
|
|
77
|
-
<GlobalSearch {sections} iconMode={
|
|
76
|
+
<GlobalSearch {sections} iconMode={!$layoutStore.isMenuOpen} onClose={closeMobileMenu} />
|
|
78
77
|
</div>
|
|
79
78
|
{#each sections.filter(section => !section.hidden) as section, i}
|
|
80
79
|
{#if section.label}
|
|
81
80
|
<div style="width: 80%;">
|
|
82
|
-
<h3 style="font-size:small; {isMenuOpen? '':'display:none;'}">{section.label}</h3>
|
|
81
|
+
<h3 style="font-size:small; {$layoutStore.isMenuOpen? '':'display:none;'}">{section.label}</h3>
|
|
83
82
|
<hr/>
|
|
84
83
|
</div>
|
|
85
84
|
{/if}
|
|
@@ -94,27 +93,27 @@
|
|
|
94
93
|
closeMobileMenu();
|
|
95
94
|
}
|
|
96
95
|
}}
|
|
97
|
-
style="{isMenuOpen? '':'border-radius: unset;border-left: none;'}; --menu-active-icon-color: {$layoutStore.menuActiveIconColor};"
|
|
96
|
+
style="{$layoutStore.isMenuOpen? '':'border-radius: unset;border-left: none;'}; --menu-active-icon-color: {$layoutStore.menuActiveIconColor};"
|
|
98
97
|
class={`
|
|
99
98
|
icon-base
|
|
100
99
|
${
|
|
101
100
|
item.children
|
|
102
|
-
? (
|
|
101
|
+
? (!$layoutStore.isMenuOpen && isParentActive(item, page.url.pathname) ? 'icon-active' : '')
|
|
103
102
|
: (isParentActive(item, page.url.pathname) ? 'icon-active' : '')
|
|
104
103
|
}
|
|
105
104
|
`}
|
|
106
105
|
|
|
107
106
|
>
|
|
108
107
|
<i class={item.icon}></i>
|
|
109
|
-
<h3 style="{isMenuOpen ? '':'display:none'}">{item.label}</h3>
|
|
108
|
+
<h3 style="{$layoutStore.isMenuOpen ? '':'display:none'}">{item.label}</h3>
|
|
110
109
|
{#if item.children}
|
|
111
110
|
<i
|
|
112
111
|
class={`fa fa-chevron-right ${openSubsections.has(item.id) ? 'active' : ''}`}
|
|
113
|
-
style="position: absolute; right: 10px; font-size: 12px; {isMenuOpen ? '':'display:none'}"
|
|
112
|
+
style="position: absolute; right: 10px; font-size: 12px; {$layoutStore.isMenuOpen ? '':'display:none'}"
|
|
114
113
|
></i>
|
|
115
114
|
{/if}
|
|
116
115
|
</a>
|
|
117
|
-
{#if item.children && openSubsections.has(item.id) && isMenuOpen}
|
|
116
|
+
{#if item.children && openSubsections.has(item.id) && $layoutStore.isMenuOpen}
|
|
118
117
|
<div style="width: 75%; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px">
|
|
119
118
|
{#each item.children as child}
|
|
120
119
|
<a
|
|
@@ -127,7 +126,7 @@
|
|
|
127
126
|
`}
|
|
128
127
|
style="margin-left: 10px"
|
|
129
128
|
>
|
|
130
|
-
<h3 style="{isMenuOpen ? '':'display:none'}">
|
|
129
|
+
<h3 style="{$layoutStore.isMenuOpen ? '':'display:none'}">
|
|
131
130
|
{child.label}
|
|
132
131
|
</h3>
|
|
133
132
|
</a>
|
|
@@ -15,7 +15,6 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
15
15
|
declare const Menu: $$__sveltets_2_IsomorphicComponent<{
|
|
16
16
|
toggleMenu: () => void;
|
|
17
17
|
closeMobileMenu: () => void;
|
|
18
|
-
isMenuOpen: boolean;
|
|
19
18
|
}, {
|
|
20
19
|
[evt: string]: CustomEvent<any>;
|
|
21
20
|
}, {}, {}, string>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
2
|
+
import { layoutStore } from "../../index.js";
|
|
3
|
+
|
|
3
4
|
export let toggleMenu;
|
|
4
5
|
</script>
|
|
5
6
|
<div class="menu-collapse">
|
|
6
|
-
<button on:click={toggleMenu} aria-label="Collapse Menu" title="{isMenuOpen? 'Close Menu':'Open Menu'}">
|
|
7
|
+
<button on:click={toggleMenu} aria-label="Collapse Menu" title="{$layoutStore.isMenuOpen? 'Close Menu':'Open Menu'}">
|
|
7
8
|
<svg
|
|
8
9
|
width="30"
|
|
9
10
|
height="30"
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
stroke-linejoin="round"
|
|
16
17
|
aria-hidden="true"
|
|
17
18
|
focusable="false"
|
|
18
|
-
style="transform: {isMenuOpen? 'scaleX(1)': 'scaleX(-1)'}; flexShrink: 0"
|
|
19
|
+
style="transform: {$layoutStore.isMenuOpen? 'scaleX(1)': 'scaleX(-1)'}; flexShrink: 0"
|
|
19
20
|
>
|
|
20
21
|
<path d="M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z" />
|
|
21
22
|
<path d="M9 4v16" />
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export default Collapse;
|
|
2
2
|
type Collapse = SvelteComponent<{
|
|
3
|
-
isMenuOpen: any;
|
|
4
3
|
toggleMenu: any;
|
|
5
4
|
}, {
|
|
6
5
|
[evt: string]: CustomEvent<any>;
|
|
@@ -8,7 +7,6 @@ type Collapse = SvelteComponent<{
|
|
|
8
7
|
$$bindings?: string | undefined;
|
|
9
8
|
};
|
|
10
9
|
declare const Collapse: $$__sveltets_2_IsomorphicComponent<{
|
|
11
|
-
isMenuOpen: any;
|
|
12
10
|
toggleMenu: any;
|
|
13
11
|
}, {
|
|
14
12
|
[evt: string]: CustomEvent<any>;
|
|
@@ -12,11 +12,10 @@
|
|
|
12
12
|
} = $props();
|
|
13
13
|
|
|
14
14
|
let isSmallscreen = $state(true);
|
|
15
|
-
let isMenuOpen = $state(false);
|
|
16
15
|
|
|
17
16
|
$effect(() => {
|
|
18
17
|
isSmallscreen = $isMobile || $isTablet;
|
|
19
|
-
if (isSmallscreen) isMenuOpen = false;
|
|
18
|
+
if (isSmallscreen) $layoutStore.isMenuOpen = false;
|
|
20
19
|
if ($theme){
|
|
21
20
|
document.body.setAttribute('data-theme', $theme);
|
|
22
21
|
localStorage.setItem('theme', $theme);
|
|
@@ -29,9 +28,9 @@
|
|
|
29
28
|
const stored = localStorage.getItem('isMenuOpen');
|
|
30
29
|
if (stored === null) {
|
|
31
30
|
localStorage.setItem('isMenuOpen', 'true');
|
|
32
|
-
isMenuOpen = true;
|
|
31
|
+
$layoutStore.isMenuOpen = true;
|
|
33
32
|
} else {
|
|
34
|
-
isMenuOpen = stored === 'true';
|
|
33
|
+
$layoutStore.isMenuOpen = stored === 'true';
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
const storedTheme = localStorage.getItem('theme');
|
|
@@ -47,14 +46,14 @@
|
|
|
47
46
|
});
|
|
48
47
|
|
|
49
48
|
const toggleMenu = () => {
|
|
50
|
-
isMenuOpen =
|
|
49
|
+
$layoutStore.isMenuOpen = !$layoutStore.isMenuOpen;
|
|
51
50
|
if(isSmallscreen) return;
|
|
52
51
|
if (typeof localStorage !== 'undefined') {
|
|
53
|
-
localStorage.setItem('isMenuOpen', isMenuOpen.toString());
|
|
52
|
+
localStorage.setItem('isMenuOpen', $layoutStore.isMenuOpen.toString());
|
|
54
53
|
}
|
|
55
54
|
};
|
|
56
55
|
const closeMobileMenu = () => {
|
|
57
|
-
if (isSmallscreen && isMenuOpen) isMenuOpen = false;
|
|
56
|
+
if (isSmallscreen && $layoutStore.isMenuOpen) $layoutStore.isMenuOpen = false;
|
|
58
57
|
};
|
|
59
58
|
</script>
|
|
60
59
|
|
|
@@ -70,16 +69,15 @@
|
|
|
70
69
|
data-label="Menu Container"
|
|
71
70
|
style={
|
|
72
71
|
isSmallscreen
|
|
73
|
-
? `width:300px; transform: translateX(${isMenuOpen ? '0%' : '-100%'}); transition: transform 0.3s ease; position: fixed; left: 0; padding-bottom: 50px`
|
|
74
|
-
: `width: ${isMenuOpen ? '300px' : '70px'}; transition: width 0.3s ease;`
|
|
72
|
+
? `width:300px; transform: translateX(${ $layoutStore.isMenuOpen ? '0%' : '-100%'}); transition: transform 0.3s ease; position: fixed; left: 0; padding-bottom: 50px`
|
|
73
|
+
: `width: ${$layoutStore.isMenuOpen ? '300px' : '70px'}; transition: width 0.3s ease;`
|
|
75
74
|
}
|
|
76
75
|
>
|
|
77
76
|
<Menu
|
|
78
|
-
{isMenuOpen}
|
|
79
77
|
{toggleMenu}
|
|
80
78
|
{closeMobileMenu}
|
|
81
79
|
/>
|
|
82
|
-
<Collapse {
|
|
80
|
+
<Collapse {toggleMenu}/>
|
|
83
81
|
</div>
|
|
84
82
|
<div data-label="Content Container" class="content" role="none" onclick={closeMobileMenu} style={$layoutStore.paddingOff ? 'padding: 0px;' : 'padding: 20px'}>
|
|
85
83
|
<Background />
|
package/dist/global.css
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export { default as Select } from './Core/components/Form/Input/select/select.sv
|
|
|
16
16
|
export { default as FileInput } from './Core/components/Form/Input/FileInput/fileInput.svelte';
|
|
17
17
|
export { default as SearchBar } from './Core/components/Form/Input/SearchBar/search.svelte';
|
|
18
18
|
export { default as TextArea } from './Core/components/Form/Input/TextArea/textarea.svelte';
|
|
19
|
+
export { default as DateInput } from './Core/components/Form/Input/Date/date.svelte';
|
|
20
|
+
export { default as TimeInput } from './Core/components/Form/Input/Time/time.svelte';
|
|
19
21
|
export { default as PreviewAudio } from './Core/components/others/Previews/Audio/audio.svelte';
|
|
20
22
|
export { default as PreviewImage } from './Core/components/others/Previews/Image/image.svelte';
|
|
21
23
|
export { default as PreviewVideo } from './Core/components/others/Previews/Video/video.svelte';
|
|
@@ -38,6 +40,7 @@ export { default as Checkbox } from './Core/components/Form/Checkbox/checkbox.sv
|
|
|
38
40
|
export { default as Form } from './Core/components/Form/Form/form.svelte';
|
|
39
41
|
export { default as Carousel } from './Core/components/others/Carousel/carousel.svelte';
|
|
40
42
|
export { default as Avatar } from './Core/components/others/Avatar/avatar.svelte';
|
|
43
|
+
export { default as ColorPicker } from './Core/components/others/ColorPicker/main.svelte';
|
|
41
44
|
export { default as GlobalSearch } from './Core/features/GlobalSearch/main.svelte';
|
|
42
45
|
export { default as Editor } from './Modules/Editor/main.svelte';
|
|
43
46
|
export { default as Layout } from './Modules/Layout/main.svelte';
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,8 @@ export { default as Select } from './Core/components/Form/Input/select/select.sv
|
|
|
20
20
|
export { default as FileInput } from './Core/components/Form/Input/FileInput/fileInput.svelte';
|
|
21
21
|
export { default as SearchBar } from './Core/components/Form/Input/SearchBar/search.svelte';
|
|
22
22
|
export { default as TextArea } from './Core/components/Form/Input/TextArea/textarea.svelte';
|
|
23
|
+
export { default as DateInput } from './Core/components/Form/Input/Date/date.svelte';
|
|
24
|
+
export { default as TimeInput } from './Core/components/Form/Input/Time/time.svelte';
|
|
23
25
|
//Previews
|
|
24
26
|
export { default as PreviewAudio } from './Core/components/others/Previews/Audio/audio.svelte';
|
|
25
27
|
export { default as PreviewImage } from './Core/components/others/Previews/Image/image.svelte';
|
|
@@ -46,6 +48,7 @@ export { default as Checkbox } from './Core/components/Form/Checkbox/checkbox.sv
|
|
|
46
48
|
export { default as Form } from './Core/components/Form/Form/form.svelte';
|
|
47
49
|
export { default as Carousel } from './Core/components/others/Carousel/carousel.svelte';
|
|
48
50
|
export { default as Avatar } from './Core/components/others/Avatar/avatar.svelte';
|
|
51
|
+
export { default as ColorPicker } from './Core/components/others/ColorPicker/main.svelte';
|
|
49
52
|
//####################Features##################################
|
|
50
53
|
export { default as GlobalSearch } from './Core/features/GlobalSearch/main.svelte';
|
|
51
54
|
//####################MODULES COMPONENTS########################
|
|
@@ -4,7 +4,13 @@ export function resetModalStore(): void;
|
|
|
4
4
|
export type ModalData = {
|
|
5
5
|
open: boolean;
|
|
6
6
|
title: string;
|
|
7
|
+
titleFont?: string;
|
|
8
|
+
titleFontSize?: string;
|
|
9
|
+
titleFontWeight?: string;
|
|
7
10
|
content?: string;
|
|
11
|
+
logo_url?: string;
|
|
12
|
+
logo_url_size?: string;
|
|
13
|
+
logo_url_spacing?: string;
|
|
8
14
|
confirmText?: string;
|
|
9
15
|
cancelText?: string;
|
|
10
16
|
onConfirm?: (() => void) | null;
|
|
@@ -2,15 +2,21 @@ import { writable } from 'svelte/store';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @typedef {{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
* open: boolean,
|
|
6
|
+
* title: string,
|
|
7
|
+
* titleFont?: string,
|
|
8
|
+
* titleFontSize?: string,
|
|
9
|
+
* titleFontWeight?: string,
|
|
10
|
+
* content?: string,
|
|
11
|
+
* logo_url?: string,
|
|
12
|
+
* logo_url_size?: string,
|
|
13
|
+
* logo_url_spacing?: string,
|
|
14
|
+
* confirmText?: string,
|
|
15
|
+
* cancelText?: string,
|
|
16
|
+
* onConfirm?: (() => void) | null,
|
|
17
|
+
* onCancel?: (() => void) | null,
|
|
18
|
+
* closeOnOverlay?: boolean,
|
|
19
|
+
* render?: (() => any) | null
|
|
14
20
|
* }} ModalData
|
|
15
21
|
*/
|
|
16
22
|
|
|
@@ -18,7 +24,13 @@ import { writable } from 'svelte/store';
|
|
|
18
24
|
const defaultModalState = {
|
|
19
25
|
open: false,
|
|
20
26
|
title: '',
|
|
27
|
+
titleFont: 'inherit',
|
|
28
|
+
titleFontSize: '1.3rem',
|
|
29
|
+
titleFontWeight: 'inherit',
|
|
21
30
|
content: '',
|
|
31
|
+
logo_url: '',
|
|
32
|
+
logo_url_size: '30px',
|
|
33
|
+
logo_url_spacing: '1rem',
|
|
22
34
|
confirmText: 'Confirm',
|
|
23
35
|
cancelText: 'Cancel',
|
|
24
36
|
onConfirm: null,
|
|
@@ -15,10 +15,12 @@ export type Section = {
|
|
|
15
15
|
items: SectionItem[];
|
|
16
16
|
};
|
|
17
17
|
export type LayoutState = {
|
|
18
|
+
isMenuOpen: boolean;
|
|
18
19
|
headerTitle: string;
|
|
19
20
|
headerTitleColor?: string;
|
|
20
21
|
headerTitleFont?: string;
|
|
21
22
|
headerTitleFontSize?: string;
|
|
23
|
+
headerTitleFontWeight?: string;
|
|
22
24
|
headerLink: string;
|
|
23
25
|
headerImage: string;
|
|
24
26
|
headerImageSize: string;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { writable } from 'svelte/store';
|
|
2
2
|
const defaultLayoutState = {
|
|
3
|
+
isMenuOpen: false,
|
|
3
4
|
headerTitle: '',
|
|
4
5
|
headerTitleColor: 'inherit',
|
|
5
6
|
headerTitleFont: 'inherit',
|
|
6
7
|
headerTitleFontSize: 'inherit',
|
|
8
|
+
headerTitleFontWeight: 'inherit',
|
|
7
9
|
headerLink: '',
|
|
8
10
|
headerImage: '',
|
|
9
11
|
headerImageSize: '30px',
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#editor-text-color .text-color-selector-dropdown {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-columns: repeat(6, 1fr);
|
|
4
|
-
gap: 5px;
|
|
5
|
-
padding: 5px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
#editor-text-color .color-swatch {
|
|
9
|
-
width: 20px;
|
|
10
|
-
height: 20px;
|
|
11
|
-
cursor: pointer;
|
|
12
|
-
border-radius: 50%;
|
|
13
|
-
transition: transform 0.1s ease-in-out;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
#editor-text-color .color-swatch:hover {
|
|
17
|
-
transform: scale(1.1);
|
|
18
|
-
}
|