@sierra-95/svelte-scaffold 1.0.4 → 1.0.7

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.
@@ -0,0 +1,3 @@
1
+ export declare function buttonRipple(node: HTMLElement): {
2
+ destroy(): void;
3
+ };
@@ -0,0 +1,33 @@
1
+ export function buttonRipple(node) {
2
+ const handleClick = (e) => {
3
+ const rect = node.getBoundingClientRect();
4
+ const ripple = document.createElement('span');
5
+ const size = Math.max(rect.width, rect.height);
6
+ const x = e.clientX - rect.left - size / 2;
7
+ const y = e.clientY - rect.top - size / 2;
8
+ ripple.style.position = 'absolute';
9
+ ripple.style.left = `${x}px`;
10
+ ripple.style.top = `${y}px`;
11
+ ripple.style.width = ripple.style.height = `${size}px`;
12
+ ripple.style.borderRadius = '50%';
13
+ ripple.style.background = 'currentColor';
14
+ ripple.style.opacity = '0.25';
15
+ ripple.style.transform = 'scale(0)';
16
+ ripple.style.pointerEvents = 'none';
17
+ ripple.style.transition = 'transform 400ms ease-out, opacity 600ms ease-out';
18
+ node.appendChild(ripple);
19
+ requestAnimationFrame(() => {
20
+ ripple.style.transform = 'scale(1)';
21
+ ripple.style.opacity = '0';
22
+ });
23
+ ripple.addEventListener('transitionend', () => ripple.remove());
24
+ };
25
+ node.style.position = 'relative';
26
+ node.style.overflow = 'hidden';
27
+ node.addEventListener('click', handleClick);
28
+ return {
29
+ destroy() {
30
+ node.removeEventListener('click', handleClick);
31
+ }
32
+ };
33
+ }
@@ -120,6 +120,7 @@
120
120
  </Button>
121
121
  {/if}
122
122
  <Button
123
+ endIcon="fa-cloud-arrow-up"
123
124
  onclick={(e: MouseEvent) => {
124
125
  rest.onclick?.(e);
125
126
  }}
@@ -1,52 +1,77 @@
1
- .base-btn {
2
- color: var(--button-text);
1
+ #sierra-button {
3
2
  padding: 0.5rem 1rem;
4
3
  border-radius: 4px;
5
4
  cursor: pointer;
6
- transition: all 0.3s ease-in-out;
5
+ transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out, opacity 0.3s ease-in-out;
7
6
  min-width: 100px;
8
7
  display: flex;
9
8
  justify-content: space-evenly;
10
9
  align-items: center;
11
10
  gap: 10px;
12
11
  }
13
- .base-btn:hover{
12
+ #sierra-button:hover{
14
13
  opacity: 0.8;
15
14
  }
15
+ #sierra-button i{
16
+ font-size: 0.9rem;
17
+ }
16
18
  /*********Button Variants*************************/
17
- .btn-outlined {
19
+ .sierra-button-contained {
20
+ color: var(--button-text);
21
+ }
22
+ .sierra-button-outlined {
18
23
  border-width: 1px;
19
24
  border-style: solid;
20
25
  }
21
- .btn-contained-primary {
26
+
27
+ /*********Contained Button Colors*************************/
28
+ .sierra-button-contained-primary {
22
29
  background-color: var(--primary-bg);
23
30
  }
24
- .btn-contained-warning {
31
+ .sierra-button-contained-warning {
25
32
  background-color: var(--warning-bg);
26
33
  }
27
- .btn-contained-error {
34
+ .sierra-button-contained-error {
28
35
  background-color: var(--error-bg);
29
36
  }
30
- .btn-outlined-primary {
37
+ /*********Outlined Button Colors*************************/
38
+ .sierra-button-outlined-primary {
31
39
  border-color: var(--primary-bg);
32
40
  color: var(--primary-bg);
33
41
  }
34
- .btn-outlined-warning {
42
+ .sierra-button-outlined-warning {
35
43
  border-color: var(--warning-bg);
36
44
  color: var(--warning-bg);
37
45
  }
38
- .btn-outlined-error {
46
+ .sierra-button-outlined-error {
39
47
  border-color: var(--error-bg);
40
48
  color: var(--error-bg);
41
49
  }
42
50
 
43
51
  /*****Disabled********/
44
- .base-btn.disabled {
52
+ #sierra-button.disabled {
45
53
  opacity: 0.6;
46
54
  cursor: not-allowed;
47
55
  }
48
56
  /****Pill Button******/
49
- .base-btn.pill{
57
+ #sierra-button.pill{
50
58
  border-radius: 50%;
51
59
  min-width: unset;
52
- }
60
+ }
61
+
62
+ .ripple {
63
+ position: relative;
64
+ overflow: hidden; /* IMPORTANT */
65
+ }
66
+
67
+ .ripple::after {
68
+ content: '';
69
+ position: absolute;
70
+ width: 20px;
71
+ height: 20px;
72
+ border-radius: 50%;
73
+ pointer-events: none;
74
+ transform: scale(0);
75
+ opacity: 0.4;
76
+ background: currentColor;
77
+ }
@@ -1,10 +1,9 @@
1
1
  <script lang="ts">
2
- // @enable runes
3
- import { CircularProgress } from '../../../../../index.js';
2
+ import { CircularProgress, buttonRipple } from '../../../../../index.js';
4
3
 
5
- type _variant = 'contained' | 'outlined';
6
- type _color = 'primary' | 'warning' | 'error';
7
- type _buttonType = 'button' | 'submit' | 'reset';
4
+ type _variant = 'contained' | 'outlined';
5
+ type _color = 'primary' | 'warning' | 'error';
6
+ type _buttonType = 'button' | 'submit' | 'reset';
8
7
 
9
8
  const {
10
9
  variant = 'contained' as _variant,
@@ -17,83 +16,106 @@
17
16
  disabled = false,
18
17
  isLoading = false,
19
18
  html2canvas_ignore = 'false',
19
+ startIcon = '',
20
+ endIcon = '',
20
21
  style = '',
21
22
  children = null,
22
23
  ...rest
23
24
  } = $props();
24
25
 
26
+ const name = 'sierra-button';
25
27
  const buttonClasses = $derived(() => {
26
- let classes = 'base-btn';
27
-
28
- if (variant) classes += ` btn-${variant}`;
29
-
28
+ let classes = '';
29
+ if (variant) classes += `${name}-${variant}`;
30
30
  if (variant === 'contained') {
31
- classes += ` btn-contained-${color}`;
31
+ classes += ` ${name}-contained-${color}`;
32
32
  } else if (variant === 'outlined') {
33
- classes += ` btn-outlined-${color}`;
33
+ classes += ` ${name}-outlined-${color}`;
34
34
  }
35
-
36
35
  if (style) classes += ` ${style}`;
37
-
38
36
  return classes;
39
37
  });
40
38
  </script>
41
39
 
42
- <style>.base-btn {
43
- color: var(--button-text);
40
+ <style>#sierra-button {
44
41
  padding: 0.5rem 1rem;
45
42
  border-radius: 4px;
46
43
  cursor: pointer;
47
- transition: all 0.3s ease-in-out;
44
+ transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out, opacity 0.3s ease-in-out;
48
45
  min-width: 100px;
49
46
  display: flex;
50
47
  justify-content: space-evenly;
51
48
  align-items: center;
52
49
  gap: 10px;
53
50
  }
54
- .base-btn:hover{
51
+ #sierra-button:hover{
55
52
  opacity: 0.8;
56
53
  }
54
+ #sierra-button i{
55
+ font-size: 0.9rem;
56
+ }
57
57
  /*********Button Variants*************************/
58
- .btn-outlined {
58
+ .sierra-button-contained {
59
+ color: var(--button-text);
60
+ }
61
+ .sierra-button-outlined {
59
62
  border-width: 1px;
60
63
  border-style: solid;
61
64
  }
62
- .btn-contained-primary {
65
+ /*********Contained Button Colors*************************/
66
+ .sierra-button-contained-primary {
63
67
  background-color: var(--primary-bg);
64
68
  }
65
- .btn-contained-warning {
69
+ .sierra-button-contained-warning {
66
70
  background-color: var(--warning-bg);
67
71
  }
68
- .btn-contained-error {
72
+ .sierra-button-contained-error {
69
73
  background-color: var(--error-bg);
70
74
  }
71
- .btn-outlined-primary {
75
+ /*********Outlined Button Colors*************************/
76
+ .sierra-button-outlined-primary {
72
77
  border-color: var(--primary-bg);
73
78
  color: var(--primary-bg);
74
79
  }
75
- .btn-outlined-warning {
80
+ .sierra-button-outlined-warning {
76
81
  border-color: var(--warning-bg);
77
82
  color: var(--warning-bg);
78
83
  }
79
- .btn-outlined-error {
84
+ .sierra-button-outlined-error {
80
85
  border-color: var(--error-bg);
81
86
  color: var(--error-bg);
82
87
  }
83
88
  /*****Disabled********/
84
- .base-btn.disabled {
89
+ #sierra-button.disabled {
85
90
  opacity: 0.6;
86
91
  cursor: not-allowed;
87
92
  }
88
93
  /****Pill Button******/
89
- .base-btn.pill{
94
+ #sierra-button.pill{
90
95
  border-radius: 50%;
91
96
  min-width: unset;
92
97
  }
98
+ .ripple {
99
+ position: relative;
100
+ overflow: hidden; /* IMPORTANT */
101
+ }
102
+ .ripple::after {
103
+ content: '';
104
+ position: absolute;
105
+ width: 20px;
106
+ height: 20px;
107
+ border-radius: 50%;
108
+ pointer-events: none;
109
+ transform: scale(0);
110
+ opacity: 0.4;
111
+ background: currentColor;
112
+ }
93
113
  </style>
94
114
 
95
115
  <button
116
+ id={name}
96
117
  {...rest}
118
+ use:buttonRipple
97
119
  data-html2canvas-ignore={html2canvas_ignore}
98
120
  class:pill={pill}
99
121
  class:disabled={isLoading || disabled}
@@ -105,8 +127,14 @@
105
127
  rest.onclick?.(e);
106
128
  }}
107
129
  >
130
+ {#if startIcon}
131
+ <i class="fa {startIcon}"></i>
132
+ {/if}
108
133
  {@render children?.()}
134
+ {#if endIcon}
135
+ <i class="fa {endIcon}"></i>
136
+ {/if}
109
137
  {#if isLoading}
110
138
  <CircularProgress size={spinner} thickness={thickness} />
111
139
  {/if}
112
- </button>
140
+ </button>
@@ -9,6 +9,8 @@ declare const Button: import("svelte").Component<{
9
9
  disabled?: boolean;
10
10
  isLoading?: boolean;
11
11
  html2canvas_ignore?: string;
12
+ startIcon?: string;
13
+ endIcon?: string;
12
14
  style?: string;
13
15
  children?: any;
14
16
  } & Record<string, any>, {}, "">;
@@ -0,0 +1,64 @@
1
+ <script lang="ts">
2
+ import { onMount, onDestroy } from "svelte";
3
+ let {
4
+ value = $bindable(0),
5
+ height = '5px',
6
+ radius = '8px',
7
+ color = 'var(--primary-bg)',
8
+ useTimeout = false,
9
+ seconds = 0,
10
+ onComplete = null,
11
+ } = $props();
12
+
13
+ let intervalId: any;
14
+
15
+ onMount(() => {
16
+ if (useTimeout && seconds > 0) {
17
+ const startTime = Date.now();
18
+ const endTime = startTime + seconds * 1000;
19
+
20
+ intervalId = setInterval(() => {
21
+ const now = Date.now();
22
+ const remaining = Math.max(endTime - now, 0);
23
+ const percentage = (remaining / (seconds * 1000)) * 100;
24
+ value = percentage;
25
+
26
+ if (remaining <= 0) {
27
+ clearInterval(intervalId);
28
+ intervalId = null;
29
+ if (onComplete) onComplete();
30
+ }
31
+ }, 50); // update 20 times per second
32
+ }
33
+ });
34
+
35
+ onDestroy(() => {
36
+ if (intervalId) clearInterval(intervalId);
37
+ });
38
+ </script>
39
+
40
+ <div
41
+ class="sierra-custom-progress"
42
+ style="border-radius: {radius}; height: {height}; background-color: var(--background-tertiary); overflow: hidden;"
43
+ >
44
+ <div
45
+ class="sierra-custom-progress-fill"
46
+ style="
47
+ width: {Math.min(Math.max(value, 0), 100)}%;
48
+ background-color: {color};
49
+ height: 100%;
50
+ transition: width 0.3s ease;
51
+ "
52
+ ></div>
53
+ </div>
54
+
55
+ <style>
56
+ .sierra-custom-progress {
57
+ width: 100%;
58
+ display: block;
59
+ }
60
+
61
+ .sierra-custom-progress-fill {
62
+ border-radius: inherit;
63
+ }
64
+ </style>
@@ -0,0 +1,11 @@
1
+ declare const CustomProgress: import("svelte").Component<{
2
+ value?: number;
3
+ height?: string;
4
+ radius?: string;
5
+ color?: string;
6
+ useTimeout?: boolean;
7
+ seconds?: number;
8
+ onComplete?: any;
9
+ }, {}, "value">;
10
+ type CustomProgress = ReturnType<typeof CustomProgress>;
11
+ export default CustomProgress;
@@ -4,7 +4,6 @@
4
4
  appearance: none;
5
5
  border: none;
6
6
  height: 0.25em;
7
- color: var(--primary-bg);
8
7
  background-color: rgba( 33, 150, 243, 0.12);
9
8
  font-size: 16px;
10
9
  }
@@ -1,10 +1,14 @@
1
+ <script>
2
+ const {
3
+ color = 'var(--primary-bg)',
4
+ } = $props();
5
+ </script>
1
6
  <style>.pure-material-progress-linear {
2
7
  -webkit-appearance: none;
3
8
  -moz-appearance: none;
4
9
  appearance: none;
5
10
  border: none;
6
11
  height: 0.25em;
7
- color: var(--primary-bg);
8
12
  background-color: rgba( 33, 150, 243, 0.12);
9
13
  font-size: 16px;
10
14
  }
@@ -75,5 +79,8 @@
75
79
  }
76
80
  </style>
77
81
  <div class="cover">
78
- <progress class="pure-material-progress-linear child"></progress>
82
+ <progress
83
+ style="color: {color};"
84
+ class="pure-material-progress-linear child"
85
+ ></progress>
79
86
  </div>
@@ -1,26 +1,11 @@
1
1
  export default LinearProgress;
2
- type LinearProgress = SvelteComponent<{
3
- [x: string]: never;
4
- }, {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> & {
7
- $$bindings?: string | undefined;
2
+ type LinearProgress = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const LinearProgress: import("svelte").Component<{
7
+ color?: string;
8
+ }, {}, "">;
9
+ type $$ComponentProps = {
10
+ color?: string;
8
11
  };
9
- declare const LinearProgress: $$__sveltets_2_IsomorphicComponent<{
10
- [x: string]: never;
11
- }, {
12
- [evt: string]: CustomEvent<any>;
13
- }, {}, {}, string>;
14
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
- new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
- $$bindings?: Bindings;
17
- } & Exports;
18
- (internal: unknown, props: {
19
- $$events?: Events;
20
- $$slots?: Slots;
21
- }): Exports & {
22
- $set?: any;
23
- $on?: any;
24
- };
25
- z_$$bindings?: Bindings;
26
- }
@@ -25,4 +25,5 @@
25
25
  <Button
26
26
  onclick={onSave}
27
27
  disabled={disabled}
28
+ endIcon="fa-regular fa-floppy-disk"
28
29
  >{exportText}</Button>
@@ -2,17 +2,17 @@
2
2
  margin: 0px 10px;
3
3
  padding-top: 5px;
4
4
  }
5
- #editor #controls .controls-menu i {
5
+ #editor #controls .controls-menu i:not(#sierra-button i){
6
6
  display: none;
7
7
  }
8
- #editor #controls .controls-menu #sierra-menu-item i{
8
+ #editor #controls .controls-menu #sierra-menu-item i:not(#sierra-button i){
9
9
  display: inline-block;
10
10
  }
11
11
  @media (max-width: 400px) {
12
12
  #editor #controls .controls-menu span {
13
13
  display: none;
14
14
  }
15
- #editor #controls .controls-menu i {
15
+ #editor #controls .controls-menu i:not(#sierra-button i) {
16
16
  display: inline-block;
17
17
  }
18
18
  }
@@ -42,11 +42,14 @@
42
42
  opacity: 1;
43
43
  pointer-events: all;
44
44
  }
45
-
46
45
  #editor #controls button{
47
- align-self:center;
48
- cursor: pointer;
46
+ align-self: center;
47
+ }
48
+ #editor #controls button{
49
49
  padding: 2px;
50
+ }
51
+ #editor #controls button:not(#sierra-button) {
52
+ align-self:center;
50
53
  border-radius: 3px;
51
54
  transition: background-color 0.3s ease, color 0.1s ease;
52
55
  }
@@ -58,7 +61,7 @@
58
61
  opacity: 0.5;
59
62
  cursor: not-allowed;
60
63
  }
61
- #editor #controls button:hover:not(.active):not(.base-btn) {
64
+ #editor #controls button:hover:not(.active):not(#sierra-button) {
62
65
  color: var(--primary-bg);
63
66
  }
64
67
 
@@ -71,7 +71,7 @@
71
71
 
72
72
  <style>
73
73
  #sierra-cloud-store .icon-active {
74
- background-color: var(--menu-icon-active-bg);
74
+ background-color: var(--menu-item-active);
75
75
  }
76
76
  </style>
77
77
  <main id="sierra-cloud-store" style="display: flex; gap: 1rem; height: 100%; min-height: 300px;">
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import './global.css';
2
2
  export { default as CircularProgress } from './components/Core/others/Progress/CircularProgress/CircularProgress.svelte';
3
3
  export { default as LinearProgress } from './components/Core/others/Progress/LinearProgress/LinearProgress.svelte';
4
+ export { default as CustomProgress } from './components/Core/others/Progress/CustomProgress/customProgress.svelte';
4
5
  export { default as Button } from './components/Core/others/Button/default/button.svelte';
5
6
  export { default as ButtonFlip } from './components/Core/others/Button/Flip/button.svelte';
6
7
  export { default as ButtonMarquee } from './components/Core/others/Button/Marquee/button.svelte';
@@ -39,3 +40,4 @@ export { fileInputStore, resetFileInputStore } from './stores/modules/fileInput.
39
40
  export { toastCarrier, setToastMessage, clearToastMessage } from './stores/modules/toast.js';
40
41
  export { getPreviewUrlForMedia, toggleSelectForMedia, removeFileForMedia } from './Hooks/preview.js';
41
42
  export { validateLayoutMenuSections } from './Hooks/layout_menu.js';
43
+ export { buttonRipple } from './Hooks/button.js';
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import './global.css';
3
3
  //Progress
4
4
  export { default as CircularProgress } from './components/Core/others/Progress/CircularProgress/CircularProgress.svelte';
5
5
  export { default as LinearProgress } from './components/Core/others/Progress/LinearProgress/LinearProgress.svelte';
6
+ export { default as CustomProgress } from './components/Core/others/Progress/CustomProgress/customProgress.svelte';
6
7
  //Buttons
7
8
  export { default as Button } from './components/Core/others/Button/default/button.svelte';
8
9
  export { default as ButtonFlip } from './components/Core/others/Button/Flip/button.svelte';
@@ -52,3 +53,4 @@ export { toastCarrier, setToastMessage, clearToastMessage } from './stores/modul
52
53
  //#######################HOOKS/UTILS########################
53
54
  export { getPreviewUrlForMedia, toggleSelectForMedia, removeFileForMedia } from './Hooks/preview.js';
54
55
  export { validateLayoutMenuSections } from './Hooks/layout_menu.js';
56
+ export { buttonRipple } from './Hooks/button.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sierra-95/svelte-scaffold",
3
- "version": "1.0.4",
3
+ "version": "1.0.7",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",