@sierra-95/svelte-scaffold 1.0.6 → 1.0.8

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.
@@ -1,10 +1,30 @@
1
- <a href={link}
2
- aria-label="button"
1
+ <script lang="ts">
2
+ type _buttonType = 'button' | 'submit' | 'reset';
3
+ const {
4
+ back = "back",
5
+ front = "front",
6
+ bgFront = "var(--primary-bg)",
7
+ bgBack = "var(--primary-bg)",
8
+ color = "var(--button-text)",
9
+ title = "",
10
+ type = 'button' as _buttonType,
11
+ disabled = false,
12
+ ...rest
13
+ } = $props();
14
+ </script>
15
+ <button
16
+ type={type}
17
+ title={title}
18
+ disabled={disabled}
19
+ aria-label="Flip button"
3
20
  class="btn-flip"
4
21
  data-back={back}
5
22
  data-front={front}
6
23
  style="--bg-front: {bgFront}; --bg-back: {bgBack}; --text-color: {color}"
7
- ></a>
24
+ onclick={(e: MouseEvent) => {
25
+ rest.onclick?.(e);
26
+ }}
27
+ ></button>
8
28
  <style>.btn-flip {
9
29
  position: relative;
10
30
  display: inline-block;
@@ -57,13 +77,3 @@
57
77
  transform: translateY(0) rotateX(0);
58
78
  }
59
79
  </style>
60
- <script>
61
- const {
62
- link = "#",
63
- back = "back",
64
- front = "front",
65
- bgFront = "var(--primary-bg)",
66
- bgBack = "var(--primary-bg)",
67
- color = "var(--button-text)",
68
- } = $props();
69
- </script>
@@ -1,21 +1,12 @@
1
- export default Button;
2
- type Button = {
3
- $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
5
- };
6
1
  declare const Button: import("svelte").Component<{
7
- link?: string;
8
2
  back?: string;
9
3
  front?: string;
10
4
  bgFront?: string;
11
5
  bgBack?: string;
12
6
  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
- };
7
+ title?: string;
8
+ type?: "button" | "submit" | "reset";
9
+ disabled?: boolean;
10
+ } & Record<string, any>, {}, "">;
11
+ type Button = ReturnType<typeof Button>;
12
+ export default Button;
@@ -2,17 +2,21 @@
2
2
  import { onMount } from 'svelte';
3
3
  import './button.css';
4
4
 
5
+ type _buttonType = 'button' | 'submit' | 'reset';
5
6
  const {
6
7
  text = "Hover me",
7
- link = "#",
8
8
  bg = "var(--primary-bg)",
9
- color = "var(--text)"
9
+ color = "var(--text)",
10
+ title = "",
11
+ type = 'button' as _buttonType,
12
+ disabled = false,
13
+ ...rest
10
14
  } = $props();
11
15
 
12
16
  let scrolling = $state(false);
13
17
 
14
18
  let container: HTMLDivElement;
15
- let marquee: HTMLAnchorElement;
19
+ let marquee: HTMLButtonElement;
16
20
 
17
21
  let containerWidth = 0;
18
22
  let textWidth = 0;
@@ -37,9 +41,18 @@
37
41
  onmouseleave={() => scrolling = false}
38
42
  style="--border-color: {bg}; --text-color: {color}"
39
43
  >
40
- <a href={link} class="marquee {scrolling ? 'scrolling' : ''}" bind:this={marquee}>
44
+ <button
45
+ type={type}
46
+ title={title}
47
+ disabled={disabled}
48
+ class="marquee {scrolling ? 'scrolling' : ''}"
49
+ bind:this={marquee}
50
+ onclick={(e: MouseEvent) => {
51
+ rest.onclick?.(e);
52
+ }}
53
+ >
41
54
  <span>{text}</span>
42
55
  <span>{text}</span>
43
56
  <span>{text}</span>
44
- </a>
57
+ </button>
45
58
  </div>
@@ -1,9 +1,11 @@
1
1
  import './button.css';
2
2
  declare const Button: import("svelte").Component<{
3
3
  text?: string;
4
- link?: string;
5
4
  bg?: string;
6
5
  color?: string;
7
- }, {}, "">;
6
+ title?: string;
7
+ type?: "button" | "submit" | "reset";
8
+ disabled?: boolean;
9
+ } & Record<string, any>, {}, "">;
8
10
  type Button = ReturnType<typeof Button>;
9
11
  export default Button;
@@ -13,9 +13,6 @@
13
13
  color: var(--text-color);
14
14
  transition: color 0.4s ease;
15
15
  }
16
- a{
17
- text-decoration: none;
18
- }
19
16
  /* Swipe layer */
20
17
  .swipe-btn::before {
21
18
  content: '';
@@ -1,8 +1,28 @@
1
- <a
1
+ <script lang="ts">
2
+ import {buttonRipple} from '../../../../../index.js'
3
+
4
+ type _buttonType = 'button' | 'submit' | 'reset';
5
+ const {
6
+ text = "Button",
7
+ bg = "var(--primary-bg)",
8
+ color = "var(--text)",
9
+ title = "",
10
+ type = 'button' as _buttonType,
11
+ disabled = false,
12
+ ...rest
13
+ } = $props();
14
+ </script>
15
+ <button
16
+ type={type}
17
+ title={title}
18
+ disabled={disabled}
19
+ use:buttonRipple
2
20
  class="swipe-btn"
3
- href={link}
4
21
  style="--btn-color: {bg}; --text-color: {color}"
5
- >{text}</a>
22
+ onclick={(e: MouseEvent) => {
23
+ rest.onclick?.(e);
24
+ }}
25
+ >{text}</button>
6
26
  <style>.swipe-btn {
7
27
  position: relative;
8
28
  display: block;
@@ -18,9 +38,6 @@
18
38
  color: var(--text-color);
19
39
  transition: color 0.4s ease;
20
40
  }
21
- a{
22
- text-decoration: none;
23
- }
24
41
  /* Swipe layer */
25
42
  .swipe-btn::before {
26
43
  content: '';
@@ -38,12 +55,4 @@ a{
38
55
  .swipe-btn:hover {
39
56
  color: var(--button-text);
40
57
  }
41
- </style>
42
- <script>
43
- const {
44
- link = "#",
45
- text = "Button",
46
- bg = "var(--primary-bg)",
47
- color = "var(--text)"
48
- } = $props();
49
- </script>
58
+ </style>
@@ -1,17 +1,10 @@
1
- export default Button;
2
- type Button = {
3
- $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
5
- };
6
1
  declare const Button: import("svelte").Component<{
7
- link?: string;
8
2
  text?: string;
9
3
  bg?: string;
10
4
  color?: string;
11
- }, {}, "">;
12
- type $$ComponentProps = {
13
- link?: string;
14
- text?: string;
15
- bg?: string;
16
- color?: string;
17
- };
5
+ title?: string;
6
+ type?: "button" | "submit" | "reset";
7
+ disabled?: boolean;
8
+ } & Record<string, any>, {}, "">;
9
+ type Button = ReturnType<typeof Button>;
10
+ export default Button;
@@ -58,20 +58,3 @@
58
58
  border-radius: 50%;
59
59
  min-width: unset;
60
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
- }
@@ -95,21 +95,6 @@
95
95
  border-radius: 50%;
96
96
  min-width: unset;
97
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
- }
113
98
  </style>
114
99
 
115
100
  <button
@@ -2,7 +2,7 @@
2
2
  import { onMount, onDestroy } from "svelte";
3
3
  let {
4
4
  value = $bindable(0),
5
- height = '10px',
5
+ height = '5px',
6
6
  radius = '8px',
7
7
  color = 'var(--primary-bg)',
8
8
  useTimeout = false,
@@ -57,10 +57,6 @@
57
57
  color: var(--background);
58
58
  background-color: var(--text);
59
59
  }
60
- #editor #controls button:disabled{
61
- opacity: 0.5;
62
- cursor: not-allowed;
63
- }
64
60
  #editor #controls button:hover:not(.active):not(#sierra-button) {
65
61
  color: var(--primary-bg);
66
62
  }
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { onMount } from 'svelte';
3
- import { fileInputStore, User, isLoggedIn, setToastMessage } from '../../../index.js';
3
+ import { fileInputStore, User, isLoggedIn, setToastMessage, buttonRipple } from '../../../index.js';
4
4
  import Previews from './previews.svelte';
5
5
 
6
6
  export let processing: boolean;
@@ -78,6 +78,7 @@
78
78
  <nav style="display: flex; flex-direction: column; gap: 0.5rem; padding-top: 1rem; background-color: var(--background); border-bottom-left-radius:5px;">
79
79
  {#each tabs as tab}
80
80
  <button
81
+ use:buttonRipple
81
82
  on:click={() =>
82
83
  fileInputStore.update(store =>({
83
84
  ...store,
package/dist/global.css CHANGED
@@ -217,4 +217,26 @@ select option {
217
217
 
218
218
  ::-webkit-scrollbar-thumb:hover {
219
219
  background: var(--scroll-bar-thumb-hover);
220
+ }
221
+
222
+ /**Button Ripple Effect */
223
+ button:disabled{
224
+ opacity: 0.6;
225
+ cursor: not-allowed;
226
+ }
227
+ .ripple {
228
+ position: relative;
229
+ overflow: hidden; /* IMPORTANT */
230
+ }
231
+
232
+ .ripple::after {
233
+ content: '';
234
+ position: absolute;
235
+ width: 20px;
236
+ height: 20px;
237
+ border-radius: 50%;
238
+ pointer-events: none;
239
+ transform: scale(0);
240
+ opacity: 0.4;
241
+ background: currentColor;
220
242
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sierra-95/svelte-scaffold",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",