@greendrake/theme 0.7.0 → 0.8.0
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/README.md +1 -1
- package/_index.scss +2 -43
- package/_mixins.scss +1 -1
- package/dashboard.scss +1 -0
- package/package.json +9 -4
- package/spinner.scss +49 -0
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ An app not on the dashboard palette defines the palette group itself: this packa
|
|
|
76
76
|
|
|
77
77
|
## Global spinner
|
|
78
78
|
|
|
79
|
-
This package defines the `spinner` keyframes and the `.spinner` / `body.spinner`
|
|
79
|
+
This package defines the `spinner` keyframes, `--spinner-size` (40px) and the `.spinner` / `body.spinner` rules, for components that show progress by toggling a `spinner` class and for `@greendrake/scss-kit`'s `img-spinner` mixin: a ring at the centre of the element, or of the viewport for `body`. They consume `--spinner-color` (palette) and `--spinner-side-color` (app). They are the `spinner` entry, which the root entry includes; an app not on this theme can `@use '@greendrake/theme/spinner'` alone, defining the two colours itself.
|
|
80
80
|
|
|
81
81
|
## Not included
|
|
82
82
|
|
package/_index.scss
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This entry EMITS global CSS (the reset, base element styles, the :root
|
|
2
|
-
// design tokens). It is the app-level base — `@use` it ONCE from the app's
|
|
2
|
+
// design tokens, the spinner). It is the app-level base — `@use` it ONCE from the app's
|
|
3
3
|
// main.scss. A component that needs only a mixin must `@use
|
|
4
4
|
// '@greendrake/theme/mixins'` (side-effect-free); importing this module from a
|
|
5
5
|
// per-component <style> re-emits the reset into a late stylesheet that
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
@use '@greendrake/css-reset';
|
|
8
8
|
@use '@greendrake/scss-kit' as kit;
|
|
9
9
|
@use 'mixins';
|
|
10
|
+
@use 'spinner';
|
|
10
11
|
@forward 'mixins';
|
|
11
12
|
|
|
12
13
|
:root {
|
|
@@ -49,11 +50,6 @@
|
|
|
49
50
|
--error-color: #ff4800;
|
|
50
51
|
--warning-color: #890095;
|
|
51
52
|
--accent-color: #0aa13e;
|
|
52
|
-
|
|
53
|
-
// Single source of truth for spinner ring size — the default centred
|
|
54
|
-
// spinner shown at the middle of a loading UI. The small in-control variant
|
|
55
|
-
// overrides this (see button.spinner in form-controls).
|
|
56
|
-
--spinner-size: 40px;
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
body {
|
|
@@ -135,40 +131,3 @@ blockquote {
|
|
|
135
131
|
[inert] {
|
|
136
132
|
@include kit.disabled;
|
|
137
133
|
}
|
|
138
|
-
|
|
139
|
-
@keyframes spinner {
|
|
140
|
-
to {
|
|
141
|
-
transform: rotate(360deg);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.spinner:not(.splash) {
|
|
146
|
-
position: relative;
|
|
147
|
-
&::before {
|
|
148
|
-
content: '';
|
|
149
|
-
box-sizing: border-box;
|
|
150
|
-
position: absolute;
|
|
151
|
-
border-radius: 50%;
|
|
152
|
-
z-index: kit.z('spinner');
|
|
153
|
-
border: 2px solid var(--spinner-color);
|
|
154
|
-
border-top-color: var(--spinner-side-color);
|
|
155
|
-
animation: spinner 0.6s linear infinite;
|
|
156
|
-
top: 50%;
|
|
157
|
-
left: 50%;
|
|
158
|
-
// Size from the single-source token, centred via negative
|
|
159
|
-
// half-margins. Applies to any host element — div, section, aside,
|
|
160
|
-
// ul — rather than a fixed list of them.
|
|
161
|
-
width: var(--spinner-size);
|
|
162
|
-
height: var(--spinner-size);
|
|
163
|
-
margin-top: calc(var(--spinner-size) / -2);
|
|
164
|
-
margin-left: calc(var(--spinner-size) / -2);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Full-page spinner: pin to the viewport centre rather than the host element.
|
|
169
|
-
// Size and centring come from the base rule above. body::before belongs to
|
|
170
|
-
// this spinner alone — the page vignette hangs off html::before precisely so
|
|
171
|
-
// the two can never share one pseudo-element (page-vignette in _mixins.scss).
|
|
172
|
-
body:not(.splash).spinner::before {
|
|
173
|
-
position: fixed;
|
|
174
|
-
}
|
package/_mixins.scss
CHANGED
|
@@ -35,7 +35,7 @@ $max-content-width: 850px;
|
|
|
35
35
|
//
|
|
36
36
|
// It hangs off <html>, not <body>: an element has exactly one ::before, and
|
|
37
37
|
// body's belongs to the full-page loading spinner (`body.spinner::before`, see
|
|
38
|
-
//
|
|
38
|
+
// spinner.scss). Sharing it made the two fight — the spinner ring inherited the
|
|
39
39
|
// vignette's page-sized inset shadow, and the vignette vanished for the
|
|
40
40
|
// duration of every page load. The canvas is html's job anyway; it already
|
|
41
41
|
// carries the page background above.
|
package/dashboard.scss
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@greendrake/theme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Design tokens, document-level element styling, a light/dark theming mixin and an opt-in dashboard palette",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Eugene Greendrake <eugene@greendrake.nz>",
|
|
@@ -39,6 +39,10 @@
|
|
|
39
39
|
"./dashboard": {
|
|
40
40
|
"sass": "./dashboard.scss",
|
|
41
41
|
"default": "./dashboard.scss"
|
|
42
|
+
},
|
|
43
|
+
"./spinner": {
|
|
44
|
+
"sass": "./spinner.scss",
|
|
45
|
+
"default": "./spinner.scss"
|
|
42
46
|
}
|
|
43
47
|
},
|
|
44
48
|
"files": [
|
|
@@ -47,15 +51,16 @@
|
|
|
47
51
|
"dashboard-palette.scss",
|
|
48
52
|
"form-controls.scss",
|
|
49
53
|
"editor-rows.scss",
|
|
50
|
-
"dashboard.scss"
|
|
54
|
+
"dashboard.scss",
|
|
55
|
+
"spinner.scss"
|
|
51
56
|
],
|
|
52
57
|
"publishConfig": {
|
|
53
58
|
"access": "public"
|
|
54
59
|
},
|
|
55
60
|
"prettier": "@greendrake/dev-config/prettier",
|
|
56
61
|
"dependencies": {
|
|
57
|
-
"@greendrake/css-reset": "0.7.0",
|
|
58
|
-
"@greendrake/scss-kit": "0.
|
|
62
|
+
"@greendrake/css-reset": "^0.7.0",
|
|
63
|
+
"@greendrake/scss-kit": "^0.8.0"
|
|
59
64
|
},
|
|
60
65
|
"devDependencies": {
|
|
61
66
|
"@greendrake/dev-config": "0.7.0"
|
package/spinner.scss
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// The spinner: a ring at the centre of whatever element has the `spinner` class while
|
|
2
|
+
// what it shows is on its way, or of the viewport for <body>. This entry EMITS global
|
|
3
|
+
// CSS. The root entry has it; an app not on this theme can `@use` it alone, defining
|
|
4
|
+
// --spinner-color and --spinner-side-color itself.
|
|
5
|
+
@use '@greendrake/scss-kit' as kit;
|
|
6
|
+
|
|
7
|
+
:root {
|
|
8
|
+
// Single source of truth for spinner ring size — the default centred
|
|
9
|
+
// spinner shown at the middle of a loading UI. The small in-control variant
|
|
10
|
+
// overrides this (see button.spinner in form-controls).
|
|
11
|
+
--spinner-size: 40px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@keyframes spinner {
|
|
15
|
+
to {
|
|
16
|
+
transform: rotate(360deg);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.spinner:not(.splash) {
|
|
21
|
+
position: relative;
|
|
22
|
+
&::before {
|
|
23
|
+
content: '';
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
position: absolute;
|
|
26
|
+
border-radius: 50%;
|
|
27
|
+
z-index: kit.z('spinner');
|
|
28
|
+
border: 2px solid var(--spinner-color);
|
|
29
|
+
border-top-color: var(--spinner-side-color);
|
|
30
|
+
animation: spinner 0.6s linear infinite;
|
|
31
|
+
top: 50%;
|
|
32
|
+
left: 50%;
|
|
33
|
+
// Size from the single-source token, centred via negative
|
|
34
|
+
// half-margins. Applies to any host element — div, section, aside,
|
|
35
|
+
// ul — rather than a fixed list of them.
|
|
36
|
+
width: var(--spinner-size);
|
|
37
|
+
height: var(--spinner-size);
|
|
38
|
+
margin-top: calc(var(--spinner-size) / -2);
|
|
39
|
+
margin-left: calc(var(--spinner-size) / -2);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Full-page spinner: pin to the viewport centre rather than the host element.
|
|
44
|
+
// Size and centring come from the base rule above. body::before belongs to
|
|
45
|
+
// this spinner alone — the page vignette hangs off html::before precisely so
|
|
46
|
+
// the two can never share one pseudo-element (page-vignette in _mixins.scss).
|
|
47
|
+
body:not(.splash).spinner::before {
|
|
48
|
+
position: fixed;
|
|
49
|
+
}
|