@sierra-95/svelte-scaffold 1.0.79 → 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.
@@ -22,7 +22,18 @@
22
22
 
23
23
  <Backdrop onClose={close} bind:open={$modalStore.open} zIndex={20}>
24
24
  <Wrapper>
25
- <h2 style="font-size: 1.3rem;">{$modalStore.title}</h2>
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,2 @@
1
+ export default colors;
2
+ declare const colors: string[];
@@ -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>
@@ -0,0 +1,8 @@
1
+ declare const Main: import("svelte").Component<{
2
+ selectedColor?: string;
3
+ openDropdown?: boolean;
4
+ dropdownTrigger: any;
5
+ onSelect?: Function;
6
+ }, {}, "selectedColor" | "openDropdown">;
7
+ type Main = ReturnType<typeof Main>;
8
+ export default Main;
@@ -1,88 +1,61 @@
1
1
  <script lang="ts">
2
- import './styles.css';
3
2
  import { onMount } from 'svelte';
4
- import {theme, DropdownContainer} from '../../../../index.js';
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
- let textColor: HTMLDivElement;
11
- let highlightColor = '#ffe066';
12
- let textColorDropdown = false;
13
- let highlightDropdown = false;
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
- editor.chain().focus().setColor(value).run();
19
- textColor.style.backgroundColor = value;
17
+ setTextColor(value);
20
18
  });
21
19
 
22
- function applyColor(color: string) {
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
- textColorDropdown = false;
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
- <DropdownContainer bind:open={textColorDropdown}>
33
- {#snippet dropdownTrigger()}
34
- <button aria-label="Text Color" title="Color" on:click={() => textColorDropdown = !textColorDropdown}>
35
- <i class="fa fa-font"></i>
36
- <div bind:this={textColor} style="height: 3px; border-radius: 0.3125rem;"></div>
37
- </button>
38
- {/snippet}
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
- on:click={() => editor.chain().focus().toggleHighlight().run()}
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
- <DropdownContainer bind:open={highlightDropdown}>
64
- {#snippet dropdownTrigger()}
65
- <button aria-label="Highlight Color" on:click={() => highlightDropdown = !highlightDropdown}>
66
- <i class="fa fa-chevron-down {highlightDropdown ? 'active' : ''}"></i>
67
- </button>
68
- {/snippet}
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 './styles.css';
2
- import type { Editor } from "@tiptap/core";
3
- 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> {
4
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
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;
@@ -18,6 +18,7 @@
18
18
  color: {$layoutStore.headerTitleColor};
19
19
  font-family: {$layoutStore.headerTitleFont};
20
20
  font-size: {$layoutStore.headerTitleFontSize};
21
+ font-weight: {$layoutStore.headerTitleFontWeight};
21
22
  ">{$layoutStore.headerTitle}</h2>
22
23
  {/if}
23
24
  </a>
package/dist/global.css CHANGED
@@ -261,4 +261,12 @@ button:disabled{
261
261
  transform: scale(0);
262
262
  opacity: 0.4;
263
263
  background: currentColor;
264
+ }
265
+
266
+ /**/
267
+ i.fa-chevron-down {
268
+ transition: transform 0.2s;
269
+ }
270
+ i.fa-chevron-down.active {
271
+ transform: rotate(180deg);
264
272
  }
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
- * open: boolean,
6
- * title: string,
7
- * content?: string,
8
- * confirmText?: string,
9
- * cancelText?: string,
10
- * onConfirm?: (() => void) | null,
11
- * onCancel?: (() => void) | null,
12
- * closeOnOverlay?: boolean,
13
- * render?: (() => any) | null
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,
@@ -20,6 +20,7 @@ export type LayoutState = {
20
20
  headerTitleColor?: string;
21
21
  headerTitleFont?: string;
22
22
  headerTitleFontSize?: string;
23
+ headerTitleFontWeight?: string;
23
24
  headerLink: string;
24
25
  headerImage: string;
25
26
  headerImageSize: string;
@@ -5,6 +5,7 @@ const defaultLayoutState = {
5
5
  headerTitleColor: 'inherit',
6
6
  headerTitleFont: 'inherit',
7
7
  headerTitleFontSize: 'inherit',
8
+ headerTitleFontWeight: 'inherit',
8
9
  headerLink: '',
9
10
  headerImage: '',
10
11
  headerImageSize: '30px',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sierra-95/svelte-scaffold",
3
- "version": "1.0.79",
3
+ "version": "1.0.80",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
@@ -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
- }