@splendidlabz/styles 3.0.0 → 4.0.0-alpha.1
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/package.json +9 -8
- package/src/animation/animation.css +14 -0
- package/src/animation/fly.css +74 -0
- package/src/animation/index.css +2 -0
- package/src/astro/index.css +1 -0
- package/src/astro/textwall.css +26 -0
- package/src/components/accordion.css +21 -15
- package/src/components/browserframe.css +84 -0
- package/src/components/drawer.css +23 -17
- package/src/components/index.css +4 -0
- package/src/components/modal.css +62 -0
- package/src/components/popover.css +38 -0
- package/src/components/tabs.css +111 -0
- package/src/effects/fancy-box.css +259 -0
- package/src/effects/gradients.css +8 -9
- package/src/effects/index.css +3 -1
- package/src/effects/shadows.css +0 -9
- package/src/effects/stroke.css +25 -0
- package/src/form/checkbox-and-radio.css +137 -0
- package/src/form/index.css +3 -1
- package/src/form/{text-field.css → input.css} +5 -17
- package/src/form/select.css +55 -0
- package/src/generic/anchors-and-buttons.css +11 -6
- package/src/generic/form.css +1 -7
- package/src/layouts/macro/grid.css +36 -7
- package/src/layouts/micro/micro.css +0 -4
- package/src/layouts/position/fixed.css +80 -49
- package/src/primitives/hero-heading.css +2 -2
- package/src/primitives/index.css +0 -2
- package/src/primitives/prose.css +8 -8
- package/src/primitives/simple-svg.css +1 -1
- package/src/reset.css +1 -2
- package/src/styles.css +2 -0
- package/src/tools/object.css +4 -1
- package/src/tools/outlines.css +30 -0
- package/src/tools/transitions.css +13 -2
- package/src/transitions/index.css +1 -0
- package/src/transitions/starting-style.css +74 -0
- package/src/variables/variables.css +4 -3
- package/src/primitives/backdrop.css +0 -8
- package/src/primitives/focus-within.css +0 -12
- package/src/scripts/Masonry.js +0 -8
- package/src/scripts/Scrollable.js +0 -14
- package/src/scripts/Sticky.js +0 -34
- package/src/scripts/all.js +0 -7
- package/src/scripts/index.js +0 -4
- /package/src/effects/{text-outline.css → text.css} +0 -0
|
@@ -5,98 +5,129 @@
|
|
|
5
5
|
/* top *
|
|
6
6
|
*********************/
|
|
7
7
|
@utility fixed-top {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
& {
|
|
9
|
+
position: fixed;
|
|
10
|
+
top: 0;
|
|
11
|
+
bottom: auto;
|
|
12
|
+
inset-inline: 0;
|
|
13
|
+
}
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
@utility fixed-topleft {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
& {
|
|
18
|
+
@apply fixed-top;
|
|
19
|
+
right: auto;
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
@utility fixed-topright {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
& {
|
|
25
|
+
@apply fixed-top;
|
|
26
|
+
left: auto;
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
@utility fixed-topfull {
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
& {
|
|
32
|
+
@apply fixed-top;
|
|
33
|
+
width: 100%;
|
|
34
|
+
max-width: none;
|
|
35
|
+
margin-inline: 0;
|
|
36
|
+
}
|
|
29
37
|
}
|
|
30
38
|
|
|
31
39
|
/* bottom *
|
|
32
40
|
*********************/
|
|
33
41
|
@utility fixed-bottom {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
& {
|
|
43
|
+
position: fixed;
|
|
44
|
+
top: auto;
|
|
45
|
+
bottom: 0;
|
|
46
|
+
inset-inline: 0;
|
|
47
|
+
}
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
@utility fixed-bottomleft {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
& {
|
|
52
|
+
@apply fixed-bottom;
|
|
53
|
+
right: auto;
|
|
54
|
+
}
|
|
44
55
|
}
|
|
45
56
|
|
|
46
57
|
@utility fixed-bottomright {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
& {
|
|
59
|
+
@apply fixed-bottom;
|
|
60
|
+
left: auto;
|
|
61
|
+
}
|
|
50
62
|
}
|
|
51
63
|
|
|
52
64
|
@utility fixed-bottomfull {
|
|
53
|
-
|
|
54
|
-
|
|
65
|
+
& {
|
|
66
|
+
@apply fixed-bottom;
|
|
67
|
+
width: 100%;
|
|
68
|
+
max-width: none;
|
|
69
|
+
margin-inline: 0;
|
|
70
|
+
}
|
|
55
71
|
}
|
|
56
72
|
|
|
57
73
|
/* left *
|
|
58
|
-
|
|
74
|
+
*********************/
|
|
59
75
|
@utility fixed-left {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
76
|
+
& {
|
|
77
|
+
position: fixed;
|
|
78
|
+
inset-block: 0;
|
|
79
|
+
left: 0;
|
|
80
|
+
right: auto;
|
|
81
|
+
}
|
|
64
82
|
}
|
|
65
83
|
|
|
66
84
|
@utility fixed-leftfull {
|
|
67
|
-
|
|
68
|
-
|
|
85
|
+
& {
|
|
86
|
+
@apply fixed-left;
|
|
87
|
+
height: auto;
|
|
88
|
+
max-height: none;
|
|
89
|
+
margin-block: 0;
|
|
90
|
+
}
|
|
69
91
|
}
|
|
70
92
|
|
|
71
93
|
/* right *
|
|
72
|
-
|
|
94
|
+
*********************/
|
|
73
95
|
@utility fixed-right {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
96
|
+
& {
|
|
97
|
+
position: fixed;
|
|
98
|
+
inset-block: 0;
|
|
99
|
+
left: auto;
|
|
100
|
+
right: 0;
|
|
101
|
+
}
|
|
78
102
|
}
|
|
79
103
|
|
|
80
104
|
@utility fixed-rightfull {
|
|
81
|
-
|
|
82
|
-
|
|
105
|
+
& {
|
|
106
|
+
@apply fixed-right;
|
|
107
|
+
height: auto;
|
|
108
|
+
max-height: none;
|
|
109
|
+
margin-block: 0;
|
|
110
|
+
}
|
|
83
111
|
}
|
|
84
112
|
|
|
85
113
|
/* center *
|
|
86
|
-
|
|
114
|
+
*********************/
|
|
87
115
|
@utility fixed-center {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
116
|
+
& {
|
|
117
|
+
position: fixed;
|
|
118
|
+
width: fit-content;
|
|
119
|
+
height: fit-content;
|
|
120
|
+
margin: auto;
|
|
121
|
+
}
|
|
92
122
|
}
|
|
93
123
|
|
|
94
124
|
/* overlay *
|
|
95
|
-
|
|
125
|
+
*********************/
|
|
96
126
|
@utility fixed-overlay {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
127
|
+
& {
|
|
128
|
+
position: fixed;
|
|
129
|
+
inset-block: var(--nudge-y, var(--nudge, 0));
|
|
130
|
+
inset-inline: var(--nudge-x, var(--nudge, 0));
|
|
131
|
+
display: grid;
|
|
132
|
+
}
|
|
102
133
|
}
|
package/src/primitives/index.css
CHANGED
package/src/primitives/prose.css
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
& {
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-flow: column;
|
|
5
|
-
gap:
|
|
5
|
+
gap: 1lh;
|
|
6
6
|
max-width: 100%;
|
|
7
7
|
|
|
8
8
|
/* Using padding instead of margin, so #targets will leave some whitespace above when scrolling to the component. (We can also use scroll-margin-top + margin-top... but this is simpler). */
|
|
9
9
|
* + :where(h2, h3),
|
|
10
10
|
* + :where(astro-island, astro-slot) > :where(:where(h2, h3):first-child) {
|
|
11
|
-
margin-top:
|
|
12
|
-
scroll-margin-top:
|
|
11
|
+
margin-top: 2lh;
|
|
12
|
+
scroll-margin-top: 2lh;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
* + :where(h4, h5, h6),
|
|
16
16
|
*
|
|
17
17
|
+ :where(astro-island, astro-slot)
|
|
18
18
|
> :where(:where(h4, h5, h6):first-child) {
|
|
19
|
-
margin-top:
|
|
20
|
-
scroll-margin-top:
|
|
19
|
+
margin-top: 1lh;
|
|
20
|
+
scroll-margin-top: 2lh;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
:where(ul, ol) {
|
|
@@ -39,15 +39,15 @@
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
li + li {
|
|
42
|
-
margin-top: 0.
|
|
42
|
+
margin-top: 0.25lh;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
li:has(li) + li {
|
|
46
|
-
margin-top: 0.
|
|
46
|
+
margin-top: 0.5lh;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
li > :where(ul, ol) {
|
|
50
|
-
margin-top: 0.
|
|
50
|
+
margin-top: 0.25lh;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
package/src/reset.css
CHANGED
|
@@ -82,13 +82,12 @@ canvas {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
svg {
|
|
85
|
-
pointer-events: none; /* Because SVGs should not intercept events */
|
|
86
85
|
flex-shrink: 0; /* Prevents SVG from being squished when used as flexbox descendant */
|
|
87
86
|
box-sizing: content-box; /* Prevents SVG from being squished when adding padding values */
|
|
88
87
|
|
|
89
88
|
/* Default SVG dimensions. Override as necessary */
|
|
90
89
|
width: var(--svg-width, auto);
|
|
91
|
-
height: var(--svg-height,
|
|
90
|
+
height: var(--svg-height, auto);
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
hr {
|
package/src/styles.css
CHANGED
package/src/tools/object.css
CHANGED
package/src/tools/outlines.css
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Setup outlines *
|
|
3
3
|
* Useful for all outline transitions and animations
|
|
4
4
|
*********************/
|
|
5
|
+
|
|
6
|
+
/* Can improve this... */
|
|
5
7
|
@layer base {
|
|
6
8
|
* {
|
|
7
9
|
outline: var(--outline-width) var(--outline-style) transparent;
|
|
@@ -9,11 +11,39 @@
|
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
13
|
|
|
14
|
+
@utility outline-scaffold {
|
|
15
|
+
& {
|
|
16
|
+
outline: var(--outline-width) var(--outline-style) transparent;
|
|
17
|
+
outline-offset: var(--outline-offset);
|
|
18
|
+
|
|
19
|
+
&:focus {
|
|
20
|
+
@apply outline-visible;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
12
25
|
/* Utility to make outline visible. typically used in focus or focus-visible */
|
|
13
26
|
@utility outline-visible {
|
|
14
27
|
outline-color: var(--outline-color);
|
|
15
28
|
}
|
|
16
29
|
|
|
30
|
+
@utility focus-outline-visible {
|
|
31
|
+
&:focus {
|
|
32
|
+
@apply outline-visible;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@utility focus-within {
|
|
37
|
+
& {
|
|
38
|
+
outline: var(--outline-width) var(--outline-style) transparent;
|
|
39
|
+
outline-offset: var(--outline-offset);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:focus-within {
|
|
43
|
+
outline-color: var(--outline-color);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
17
47
|
/* These preserve outlines on scrollable elements that use a flex display *
|
|
18
48
|
* Notes:
|
|
19
49
|
- content-box is necessary, if not present, box will be cut on the right side
|
|
@@ -6,8 +6,19 @@
|
|
|
6
6
|
--transition-values: var(--transition-duration) var(--transition-delay)
|
|
7
7
|
var(--transition-easing);
|
|
8
8
|
--transition-props:
|
|
9
|
-
backdrop-filter, background, border, color, fill, filter, gap,
|
|
10
|
-
opacity, outline, stroke, transform;
|
|
9
|
+
backdrop-filter, background, border, color, display, fill, filter, gap,
|
|
10
|
+
opacity, outline, overlay, stroke, transform;
|
|
11
|
+
transition: var(--transition-values);
|
|
12
|
+
transition-property: var(--transition-props);
|
|
13
|
+
transition-behavior: allow-discrete;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@utility transition-svg {
|
|
18
|
+
& {
|
|
19
|
+
--transition-values: var(--transition-duration) var(--transition-delay)
|
|
20
|
+
var(--transition-easing);
|
|
21
|
+
--transition-props: opacity, fill, stroke;
|
|
11
22
|
transition: var(--transition-values);
|
|
12
23
|
transition-property: var(--transition-props);
|
|
13
24
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import './starting-style.css';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*********************
|
|
2
|
+
* Fade *
|
|
3
|
+
*********************/
|
|
4
|
+
@utility fade {
|
|
5
|
+
& {
|
|
6
|
+
--opacity: var(--closed-opacity, 0);
|
|
7
|
+
opacity: var(--opacity, 0);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&:where([open], :popover-open, .open, .show) {
|
|
11
|
+
--opacity: var(--opened-opacity, 1);
|
|
12
|
+
|
|
13
|
+
@starting-style {
|
|
14
|
+
--opacity: var(--opening-opacity, 0);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/*********************
|
|
20
|
+
* Fly *
|
|
21
|
+
*********************/
|
|
22
|
+
@utility fly {
|
|
23
|
+
& {
|
|
24
|
+
--tx: var(--closed-tx, 0);
|
|
25
|
+
--ty: var(--closed-ty, 0);
|
|
26
|
+
transform: translateX(var(--tx)) translateY(var(--ty));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:where([open], :popover-open, .open, .show) {
|
|
30
|
+
--tx: var(--opened-tx, 0);
|
|
31
|
+
--ty: var(--opened-ty, 0);
|
|
32
|
+
|
|
33
|
+
@starting-style {
|
|
34
|
+
--tx: var(--opening-tx, 0);
|
|
35
|
+
--ty: var(--opening-ty, 0);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@utility fly-from-top {
|
|
41
|
+
& {
|
|
42
|
+
@apply fly;
|
|
43
|
+
--closed-ty: -100%;
|
|
44
|
+
--opened-ty: 0;
|
|
45
|
+
--opening-ty: -100%;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@utility fly-from-bottom {
|
|
50
|
+
& {
|
|
51
|
+
@apply fly;
|
|
52
|
+
--closed-ty: 100%;
|
|
53
|
+
--opened-ty: 0;
|
|
54
|
+
--opening-ty: 100%;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@utility fly-from-left {
|
|
59
|
+
& {
|
|
60
|
+
@apply fly;
|
|
61
|
+
--closed-tx: -100%;
|
|
62
|
+
--opened-tx: 0;
|
|
63
|
+
--opening-tx: -100%;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@utility fly-from-right {
|
|
68
|
+
& {
|
|
69
|
+
@apply fly;
|
|
70
|
+
--closed-tx: 100%;
|
|
71
|
+
--opened-tx: 0;
|
|
72
|
+
--opening-tx: 100%;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
@theme {
|
|
2
2
|
/* Typography */
|
|
3
|
-
--bg-color:
|
|
4
|
-
--text-color:
|
|
3
|
+
--bg-color: var(--color-cdarkblue-900);
|
|
4
|
+
--text-color: var(--color-cneutral-100);
|
|
5
5
|
--leading: 1.5;
|
|
6
|
+
--gap: 1lh;
|
|
6
7
|
|
|
7
8
|
/* Padding */
|
|
8
9
|
--padding: 1rem;
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
--radius: 0.5rem;
|
|
15
16
|
|
|
16
17
|
/* Outline */
|
|
17
|
-
--outline-width:
|
|
18
|
+
--outline-width: 2px;
|
|
18
19
|
--outline-style: solid;
|
|
19
20
|
--outline-color: oklch(61.52% 0.178 257.59deg);
|
|
20
21
|
--outline-offset: 0px;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* Transfers outlines from the focusable element within to the container */
|
|
2
|
-
@utility has-focus-within {
|
|
3
|
-
&:focus-within {
|
|
4
|
-
outline: var(--outline-width) var(--outline-style) transparent;
|
|
5
|
-
outline-offset: var(--outline-offset);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
*:focus,
|
|
9
|
-
*:focus-visible {
|
|
10
|
-
outline-color: transparent;
|
|
11
|
-
}
|
|
12
|
-
}
|
package/src/scripts/Masonry.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { getElement } from '@splendidlabz/utils/dom'
|
|
2
|
-
import { masonry } from '@splendidlabz/utils/actions'
|
|
3
|
-
|
|
4
|
-
export function Masonry(selector) {
|
|
5
|
-
const container = getElement(selector) || document
|
|
6
|
-
const elements = Array.from(container.querySelectorAll("[class*='masonry']"))
|
|
7
|
-
elements.forEach(masonry)
|
|
8
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { getElement } from '@splendidlabz/utils/dom'
|
|
2
|
-
import { preferHorizontalScroll } from '@splendidlabz/utils/actions'
|
|
3
|
-
|
|
4
|
-
export function ScrollableHorizontal(selector) {
|
|
5
|
-
const container = getElement(selector) || document
|
|
6
|
-
const elements = Array.from(
|
|
7
|
-
container.querySelectorAll('.scrollable-prefer-horizontal'),
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
if (container.classList?.contains('scrollable-prefer-horizontal'))
|
|
11
|
-
elements.push(container)
|
|
12
|
-
|
|
13
|
-
elements.forEach(preferHorizontalScroll)
|
|
14
|
-
}
|
package/src/scripts/Sticky.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { mutationObserver, sticky } from '@splendidlabz/utils/actions'
|
|
2
|
-
|
|
3
|
-
import { getElement } from '@splendidlabz/utils/dom'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Initializes sticky behavior for elements within a container.
|
|
7
|
-
* @param {string|HTMLElement} selector - The selector or element to initialize sticky behavior within.
|
|
8
|
-
* @param {Object} [options] - Optional settings.
|
|
9
|
-
* @param {number} [options.observeTimeout=0] - The timeout in milliseconds to observe DOM mutations.
|
|
10
|
-
*/
|
|
11
|
-
export function Sticky(selector, { observerTimeout = 1000 } = {}) {
|
|
12
|
-
const container = getElement(selector) || document.body
|
|
13
|
-
const elements = Array.from(container.querySelectorAll('.sticky-check'))
|
|
14
|
-
|
|
15
|
-
if (container.classList.contains('sticky-check')) elements.push(container)
|
|
16
|
-
|
|
17
|
-
elements.forEach(sticky)
|
|
18
|
-
|
|
19
|
-
if (observerTimeout) {
|
|
20
|
-
const obs = mutationObserver(container, {
|
|
21
|
-
childList: true,
|
|
22
|
-
subtree: true,
|
|
23
|
-
callback: function ({ entry, observer }) {
|
|
24
|
-
// Nodes seem to be added one by one, so getting the first one is enough
|
|
25
|
-
const node = entry.addedNodes[0]
|
|
26
|
-
const klass = node?.className
|
|
27
|
-
if (!klass || typeof klass !== 'string') return
|
|
28
|
-
if (!klass.includes('sticky-check')) return
|
|
29
|
-
sticky(node)
|
|
30
|
-
},
|
|
31
|
-
})
|
|
32
|
-
if (observerTimeout) setTimeout(_ => obs.disconnect(), observerTimeout)
|
|
33
|
-
}
|
|
34
|
-
}
|
package/src/scripts/all.js
DELETED
package/src/scripts/index.js
DELETED
|
File without changes
|