@geoffcox/sterling-svelte 0.0.1 → 0.0.2
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/buttons/Button.svelte +159 -0
- package/buttons/Button.svelte.d.ts +48 -0
- package/buttons/types.d.ts +2 -0
- package/buttons/types.js +1 -0
- package/index.d.ts +9 -1
- package/index.js +9 -1
- package/package.json +42 -40
- package/theme/index.d.ts +0 -8
- package/theme/index.js +0 -8
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<script>export let variant = "regular";
|
|
2
|
+
export let shape = "rounded";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
@component
|
|
7
|
+
provides a styled HTML button element.
|
|
8
|
+
-->
|
|
9
|
+
<button
|
|
10
|
+
class="sterling-button"
|
|
11
|
+
class:square={shape === 'square'}
|
|
12
|
+
class:circular={shape === 'circular'}
|
|
13
|
+
class:outline={variant === 'outline'}
|
|
14
|
+
class:ghost={variant === 'ghost'}
|
|
15
|
+
on:blur
|
|
16
|
+
on:click
|
|
17
|
+
on:dblclick
|
|
18
|
+
on:focus
|
|
19
|
+
on:focusin
|
|
20
|
+
on:focusout
|
|
21
|
+
on:keydown
|
|
22
|
+
on:keypress
|
|
23
|
+
on:keyup
|
|
24
|
+
on:mousedown
|
|
25
|
+
on:mouseenter
|
|
26
|
+
on:mouseleave
|
|
27
|
+
on:mousemove
|
|
28
|
+
on:mouseover
|
|
29
|
+
on:mouseout
|
|
30
|
+
on:mouseup
|
|
31
|
+
on:pointercancel
|
|
32
|
+
on:pointerdown
|
|
33
|
+
on:pointerenter
|
|
34
|
+
on:pointerleave
|
|
35
|
+
on:pointermove
|
|
36
|
+
on:pointerover
|
|
37
|
+
on:pointerout
|
|
38
|
+
on:pointerup
|
|
39
|
+
on:wheel
|
|
40
|
+
{...$$restProps}
|
|
41
|
+
>
|
|
42
|
+
<slot />
|
|
43
|
+
</button>
|
|
44
|
+
|
|
45
|
+
<style>
|
|
46
|
+
button {
|
|
47
|
+
background-color: var(--Button__background-color);
|
|
48
|
+
border-color: var(--Button__border-color);
|
|
49
|
+
border-radius: var(--Button__border-radius);
|
|
50
|
+
border-style: var(--Button__border-style);
|
|
51
|
+
border-width: var(--Button__border-width);
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
color: var(--Button__color);
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
flex-direction: row;
|
|
57
|
+
font: inherit;
|
|
58
|
+
align-content: center;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
justify-items: center;
|
|
62
|
+
column-gap: 0.25em;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
padding: 0.5em 1em;
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
text-overflow: ellipsis;
|
|
67
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
user-select: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
button.vertical {
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
row-gap: 0.15em;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
button.circular {
|
|
78
|
+
border-radius: 10000px;
|
|
79
|
+
padding: 0.5em;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
button.square {
|
|
83
|
+
border-radius: 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
button:hover {
|
|
87
|
+
background-color: var(--Button__background-color--hover);
|
|
88
|
+
border-color: var(--Button__border-color--hover);
|
|
89
|
+
color: var(--Button__color--hover);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
button:active {
|
|
93
|
+
background-color: var(--Button__background-color--active);
|
|
94
|
+
border-color: var(--Button__border-color--active);
|
|
95
|
+
color: var(--Button__color--active);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
button:focus-visible {
|
|
99
|
+
border-color: var(--Button__border-color--focus);
|
|
100
|
+
outline-color: var(--Common__outline-color);
|
|
101
|
+
outline-offset: var(--Common__outline-offset);
|
|
102
|
+
outline-style: var(--Common__outline-style);
|
|
103
|
+
outline-width: var(--Common__outline-width);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
button:disabled {
|
|
107
|
+
background-color: var(--Button__background-color--disabled);
|
|
108
|
+
border-color: var(--Button__border-color--disabled);
|
|
109
|
+
color: var(--Button__color--disabled);
|
|
110
|
+
cursor: not-allowed;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
button.outline {
|
|
114
|
+
background-color: transparent;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
button.outline:hover {
|
|
118
|
+
background-color: var(--Button__background-color--hover);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
button.outline:active {
|
|
122
|
+
background-color: var(--Button__background-color--active);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
button.outline:disabled {
|
|
126
|
+
background-color: transparent;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
button.outline:disabled:hover {
|
|
130
|
+
border-color: var(--Button__border-color--disabled);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
button.ghost {
|
|
134
|
+
background-color: transparent;
|
|
135
|
+
border-color: transparent;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
button.ghost:hover {
|
|
139
|
+
background-color: var(--Button__background-color--hover);
|
|
140
|
+
border-color: transparent;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
button.ghost:active {
|
|
144
|
+
background-color: var(--Button__background-color--active);
|
|
145
|
+
border-color: transparent;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
button.ghost:focus-visible {
|
|
149
|
+
border-color: var(--Button__border-color--focus);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
button.ghost:disabled {
|
|
153
|
+
border-color: transparent;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
button.ghost:disabled:hover {
|
|
157
|
+
background-color: var(--Button__background-color--disabled);
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { ButtonShape, ButtonVariant } from './types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
variant?: ButtonVariant | undefined;
|
|
7
|
+
shape?: ButtonShape | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
blur: FocusEvent;
|
|
11
|
+
click: MouseEvent;
|
|
12
|
+
dblclick: MouseEvent;
|
|
13
|
+
focus: FocusEvent;
|
|
14
|
+
focusin: FocusEvent;
|
|
15
|
+
focusout: FocusEvent;
|
|
16
|
+
keydown: KeyboardEvent;
|
|
17
|
+
keypress: KeyboardEvent;
|
|
18
|
+
keyup: KeyboardEvent;
|
|
19
|
+
mousedown: MouseEvent;
|
|
20
|
+
mouseenter: MouseEvent;
|
|
21
|
+
mouseleave: MouseEvent;
|
|
22
|
+
mousemove: MouseEvent;
|
|
23
|
+
mouseover: MouseEvent;
|
|
24
|
+
mouseout: MouseEvent;
|
|
25
|
+
mouseup: MouseEvent;
|
|
26
|
+
pointercancel: PointerEvent;
|
|
27
|
+
pointerdown: PointerEvent;
|
|
28
|
+
pointerenter: PointerEvent;
|
|
29
|
+
pointerleave: PointerEvent;
|
|
30
|
+
pointermove: PointerEvent;
|
|
31
|
+
pointerover: PointerEvent;
|
|
32
|
+
pointerout: PointerEvent;
|
|
33
|
+
pointerup: PointerEvent;
|
|
34
|
+
wheel: WheelEvent;
|
|
35
|
+
} & {
|
|
36
|
+
[evt: string]: CustomEvent<any>;
|
|
37
|
+
};
|
|
38
|
+
slots: {
|
|
39
|
+
default: {};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type ButtonProps = typeof __propDef.props;
|
|
43
|
+
export type ButtonEvents = typeof __propDef.events;
|
|
44
|
+
export type ButtonSlots = typeof __propDef.slots;
|
|
45
|
+
/** provides a styled HTML button element. */
|
|
46
|
+
export default class Button extends SvelteComponentTyped<ButtonProps, ButtonEvents, ButtonSlots> {
|
|
47
|
+
}
|
|
48
|
+
export {};
|
package/buttons/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/index.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export { type Theme, type ThemeActionParams
|
|
1
|
+
export { type Theme, type ThemeActionParams } from './theme/types';
|
|
2
|
+
export { applyDarkTheme } from './theme/applyDarkTheme';
|
|
3
|
+
export { applyLightTheme } from './theme/applyLightTheme';
|
|
4
|
+
export { applyTheme } from './theme/applyTheme';
|
|
5
|
+
export { darkTheme } from './theme/darkTheme';
|
|
6
|
+
export { lightTheme } from './theme/lightTheme';
|
|
7
|
+
export { neutrals } from './theme/colors';
|
|
8
|
+
export { toggleDarkTheme } from './theme/toggleDarkTheme';
|
|
9
|
+
export { type ButtonVariant, type ButtonShape } from './buttons/types';
|
package/index.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {} from './theme/types';
|
|
2
|
+
export { applyDarkTheme } from './theme/applyDarkTheme';
|
|
3
|
+
export { applyLightTheme } from './theme/applyLightTheme';
|
|
4
|
+
export { applyTheme } from './theme/applyTheme';
|
|
5
|
+
export { darkTheme } from './theme/darkTheme';
|
|
6
|
+
export { lightTheme } from './theme/lightTheme';
|
|
7
|
+
export { neutrals } from './theme/colors';
|
|
8
|
+
export { toggleDarkTheme } from './theme/toggleDarkTheme';
|
|
9
|
+
export {} from './buttons/types';
|
package/package.json
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
2
|
+
"name": "@geoffcox/sterling-svelte",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"devDependencies": {
|
|
5
|
+
"@fontsource/fira-mono": "^4.5.10",
|
|
6
|
+
"@fontsource/overpass": "^4.5.10",
|
|
7
|
+
"@playwright/test": "^1.28.1",
|
|
8
|
+
"@sveltejs/adapter-auto": "^1.0.0",
|
|
9
|
+
"@sveltejs/adapter-static": "^1.0.0",
|
|
10
|
+
"@sveltejs/kit": "^1.0.0",
|
|
11
|
+
"@sveltejs/package": "^1.0.0",
|
|
12
|
+
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
|
13
|
+
"@typescript-eslint/parser": "^5.45.0",
|
|
14
|
+
"eslint": "^8.28.0",
|
|
15
|
+
"eslint-config-prettier": "^8.5.0",
|
|
16
|
+
"eslint-plugin-svelte3": "^4.0.0",
|
|
17
|
+
"mdsvex": "^0.10.6",
|
|
18
|
+
"prettier": "^2.8.0",
|
|
19
|
+
"prettier-plugin-svelte": "^2.8.1",
|
|
20
|
+
"svelte": "^3.54.0",
|
|
21
|
+
"svelte-check": "^2.9.2",
|
|
22
|
+
"tslib": "^2.4.1",
|
|
23
|
+
"typescript": "^4.9.3",
|
|
24
|
+
"vite": "^4.0.0",
|
|
25
|
+
"vitest": "^0.25.3"
|
|
26
|
+
},
|
|
27
|
+
"type": "module",
|
|
28
|
+
"exports": {
|
|
29
|
+
"./package.json": "./package.json",
|
|
30
|
+
"./buttons/Button.svelte": "./buttons/Button.svelte",
|
|
31
|
+
"./buttons/types": "./buttons/types.js",
|
|
32
|
+
".": "./index.js",
|
|
33
|
+
"./theme/applyDarkTheme": "./theme/applyDarkTheme.js",
|
|
34
|
+
"./theme/applyLightTheme": "./theme/applyLightTheme.js",
|
|
35
|
+
"./theme/applyTheme": "./theme/applyTheme.js",
|
|
36
|
+
"./theme/colors": "./theme/colors.js",
|
|
37
|
+
"./theme/darkTheme": "./theme/darkTheme.js",
|
|
38
|
+
"./theme/lightTheme": "./theme/lightTheme.js",
|
|
39
|
+
"./theme/toggleDarkTheme": "./theme/toggleDarkTheme.js",
|
|
40
|
+
"./theme/types": "./theme/types.js"
|
|
41
|
+
},
|
|
42
|
+
"svelte": "./index.js"
|
|
43
|
+
}
|
package/theme/index.d.ts
DELETED
package/theme/index.js
DELETED