@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.
Files changed (47) hide show
  1. package/package.json +9 -8
  2. package/src/animation/animation.css +14 -0
  3. package/src/animation/fly.css +74 -0
  4. package/src/animation/index.css +2 -0
  5. package/src/astro/index.css +1 -0
  6. package/src/astro/textwall.css +26 -0
  7. package/src/components/accordion.css +21 -15
  8. package/src/components/browserframe.css +84 -0
  9. package/src/components/drawer.css +23 -17
  10. package/src/components/index.css +4 -0
  11. package/src/components/modal.css +62 -0
  12. package/src/components/popover.css +38 -0
  13. package/src/components/tabs.css +111 -0
  14. package/src/effects/fancy-box.css +259 -0
  15. package/src/effects/gradients.css +8 -9
  16. package/src/effects/index.css +3 -1
  17. package/src/effects/shadows.css +0 -9
  18. package/src/effects/stroke.css +25 -0
  19. package/src/form/checkbox-and-radio.css +137 -0
  20. package/src/form/index.css +3 -1
  21. package/src/form/{text-field.css → input.css} +5 -17
  22. package/src/form/select.css +55 -0
  23. package/src/generic/anchors-and-buttons.css +11 -6
  24. package/src/generic/form.css +1 -7
  25. package/src/layouts/macro/grid.css +36 -7
  26. package/src/layouts/micro/micro.css +0 -4
  27. package/src/layouts/position/fixed.css +80 -49
  28. package/src/primitives/hero-heading.css +2 -2
  29. package/src/primitives/index.css +0 -2
  30. package/src/primitives/prose.css +8 -8
  31. package/src/primitives/simple-svg.css +1 -1
  32. package/src/reset.css +1 -2
  33. package/src/styles.css +2 -0
  34. package/src/tools/object.css +4 -1
  35. package/src/tools/outlines.css +30 -0
  36. package/src/tools/transitions.css +13 -2
  37. package/src/transitions/index.css +1 -0
  38. package/src/transitions/starting-style.css +74 -0
  39. package/src/variables/variables.css +4 -3
  40. package/src/primitives/backdrop.css +0 -8
  41. package/src/primitives/focus-within.css +0 -12
  42. package/src/scripts/Masonry.js +0 -8
  43. package/src/scripts/Scrollable.js +0 -14
  44. package/src/scripts/Sticky.js +0 -34
  45. package/src/scripts/all.js +0 -7
  46. package/src/scripts/index.js +0 -4
  47. /package/src/effects/{text-outline.css → text.css} +0 -0
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@splendidlabz/styles",
3
- "version": "3.0.0",
3
+ "version": "4.0.0-alpha.1",
4
4
  "description": "",
5
+ "type": "module",
5
6
  "author": "Zell Liew <zellwk@gmail.com>",
6
7
  "files": [
7
8
  "src",
@@ -9,13 +10,13 @@
9
10
  ],
10
11
  "exports": {
11
12
  ".": "./src/styles.css",
13
+ "./astro": "./src/astro/index.css",
12
14
  "./components": "./src/components/index.css",
13
15
  "./addons": "./src/addons/index.css",
14
16
  "./no-tw": "./dist/no-tw/styles.css",
15
17
  "./no-tw/*": "./dist/no-tw/*.css",
16
18
  "./*": "./src/*.css",
17
- "./scripts": "./src/scripts/index.js",
18
- "./scripts/*": "./src/scripts/*.js"
19
+ "./scripts": "./scripts/index.js"
19
20
  },
20
21
  "scripts": {
21
22
  "lint": "stylelint '**/*.{css,scss}' --fix",
@@ -26,13 +27,13 @@
26
27
  "build": "npm run build-styles & npm run build-layouts"
27
28
  },
28
29
  "dependencies": {
29
- "@splendidlabz/utils": "*"
30
+ "@splendidlabz/utils": "1.5.0-alpha.4"
30
31
  },
31
32
  "devDependencies": {
32
- "@splendidlabz/stylelint-config": "3.0.0",
33
- "@tailwindcss/cli": "^4.0.9",
34
- "lightningcss-cli": "^1.29.1",
35
- "tailwindcss": "^4.0.9",
33
+ "@splendidlabz/stylelint-config": "3.0.0-alpha.4",
34
+ "@tailwindcss/cli": "^4.1.3",
35
+ "lightningcss-cli": "^1.29.3",
36
+ "tailwindcss": "^4.1.3",
36
37
  "turbowatch": "^2.29.4"
37
38
  }
38
39
  }
@@ -0,0 +1,14 @@
1
+ @utility animation {
2
+ & {
3
+ --_duration: var(--animation-duration, var(--transition-duration));
4
+ --_delay: var(--animation-delay, var(--transition-delay));
5
+ --_easing: var(--animation-easing, var(--transition-easing));
6
+ --_direction: var(--animation-direction, normal);
7
+ --_play-state: var(--animation-play-state, running);
8
+ --_fill-mode: var(--animation-fill-mode, none);
9
+ --_iteration-count: var(--animation-iteration-count, 1);
10
+ animation: var(--animation-name) var(--_duration) var(--_delay)
11
+ var(--_easing) var(--_direction) var(--_play-state) var(--_fill-mode)
12
+ var(--_iteration-count);
13
+ }
14
+ }
@@ -0,0 +1,74 @@
1
+ @keyframes fly {
2
+ from {
3
+ opacity: var(--from-opacity, 0);
4
+ transform: translate(var(--from-x, 0), var(--from-y, 0));
5
+ }
6
+
7
+ to {
8
+ opacity: var(--to-opacity, 1);
9
+ transform: translate(var(--to-x, 0), var(--to-y, 0));
10
+ }
11
+ }
12
+
13
+ @utility animation-fly {
14
+ & {
15
+ @apply animation;
16
+ --animation-name: fly;
17
+ }
18
+ }
19
+
20
+ @utility animation-fly-in-left {
21
+ @apply animation-fly;
22
+ --from-x: -100%;
23
+ --to-x: 0;
24
+ }
25
+
26
+ @utility animation-fly-in-right {
27
+ @apply animation-fly;
28
+ --from-x: 100%;
29
+ --to-x: 0;
30
+ }
31
+
32
+ @utility animation-fly-in-top {
33
+ @apply animation-fly;
34
+ --from-y: -100%;
35
+ --to-y: 0;
36
+ }
37
+
38
+ @utility animation-fly-in-bottom {
39
+ @apply animation-fly;
40
+ --from-y: 100%;
41
+ --to-y: 0;
42
+ }
43
+
44
+ @utility animation-fly-out-left {
45
+ @apply animation-fly;
46
+ --from-x: 0;
47
+ --to-x: -100%;
48
+ --from-opacity: 1;
49
+ --to-opacity: 0;
50
+ }
51
+
52
+ @utility animation-fly-out-right {
53
+ @apply animation-fly;
54
+ --from-x: 0;
55
+ --to-x: 100%;
56
+ --from-opacity: 1;
57
+ --to-opacity: 0;
58
+ }
59
+
60
+ @utility animation-fly-out-top {
61
+ @apply animation-fly;
62
+ --from-y: 0;
63
+ --to-y: -100%;
64
+ --from-opacity: 1;
65
+ --to-opacity: 0;
66
+ }
67
+
68
+ @utility animation-fly-out-bottom {
69
+ @apply animation-fly;
70
+ --from-y: 0;
71
+ --to-y: 100%;
72
+ --from-opacity: 1;
73
+ --to-opacity: 0;
74
+ }
@@ -0,0 +1,2 @@
1
+ @import './animation.css';
2
+ @import './fly.css';
@@ -0,0 +1 @@
1
+ @import './textwall.css';
@@ -0,0 +1,26 @@
1
+ @utility textwall {
2
+ /* Used to create the boundary boxes for the content */
3
+ .textwall-dimensions {
4
+ aspect-ratio: 4/3;
5
+ max-height: 75dvh;
6
+ }
7
+
8
+ /* Rotates the content to create the textwall effect */
9
+ /* Negative margins allow for the content to overflow the boundary boxes */
10
+ .textwall-content {
11
+ position: absolute;
12
+ inset: 0;
13
+ margin: -25%;
14
+ transform: rotate(var(--rotation, -25deg));
15
+ }
16
+
17
+ /* Prevent pointer blocks by massive boundary images */
18
+ [class*='textwall-boundary'] {
19
+ pointer-events: none;
20
+ }
21
+
22
+ /* Prevent pixel rounding errors */
23
+ .textwall-boundary-after {
24
+ bottom: -1px;
25
+ }
26
+ }
@@ -1,31 +1,37 @@
1
- @layer utilities {
2
- .accordion {
3
- svg {
4
- transition: var(--transition-values);
5
- transition-property: var(--transition-props);
6
- }
1
+ @utility accordion {
2
+ svg {
3
+ transition: var(--transition-values);
4
+ transition-property: var(--transition-props);
5
+ }
7
6
 
8
- :where([aria-expanded='true'] svg) {
9
- transform: rotate(90deg);
10
- }
7
+ :where([aria-expanded='true'] svg) {
8
+ transform: rotate(90deg);
11
9
  }
10
+ }
12
11
 
13
- .accordion-button {
12
+ @utility accordion-button {
13
+ & {
14
14
  @apply padding-scaffold;
15
15
  display: flex;
16
16
  justify-content: space-between;
17
- align-items: center;
17
+ align-items: start;
18
+ gap: var(--gap);
18
19
  width: 100%;
19
20
  max-width: 100%;
21
+ text-align: left;
22
+
23
+ > svg {
24
+ width: 1em;
25
+ height: 1lh;
26
+ }
20
27
 
21
- /* astro-slot contains the title */
22
28
  &:where(:has(svg + span)),
23
29
  &:where(:has(svg + astro-slot)) {
24
30
  justify-content: start;
25
31
  }
26
32
  }
33
+ }
27
34
 
28
- .accordion-content {
29
- @apply padding-scaffold;
30
- }
35
+ @utility accordion-content {
36
+ padding: 1rem;
31
37
  }
@@ -0,0 +1,84 @@
1
+ /* Variables
2
+ radius
3
+ bg-frame-header.
4
+ bg-frame-content.
5
+ border-width
6
+ border-frame-header
7
+ border-frame-content
8
+ border-color
9
+
10
+ dot-size
11
+ dot-gap
12
+ dot-color
13
+ dot-1-color
14
+ dot-2-color
15
+ dot-3-color */
16
+
17
+ @utility browserframe {
18
+ .frame-header {
19
+ display: flex;
20
+ flex-flow: row;
21
+ align-items: center;
22
+ border: var(--border-width, 1px) solid
23
+ var(--border-frame-header, var(--border-color));
24
+ border-bottom: 0;
25
+ border-radius: var(--radius) var(--radius) 0 0;
26
+ background: var(--bg-frame-header);
27
+ }
28
+
29
+ .frame-dots {
30
+ display: flex;
31
+ flex-flow: row;
32
+ align-items: center;
33
+ gap: var(--dot-gap, 0.5rem);
34
+ padding: var(--dot-padding, 0.5lh 0.75lh);
35
+ }
36
+
37
+ .frame-dot {
38
+ width: var(--dot-size, 0.7rem);
39
+ height: var(--dot-size, 0.7rem);
40
+
41
+ circle {
42
+ fill: var(--dot-color, #424242);
43
+ }
44
+ }
45
+
46
+ .frame-tabs {
47
+ overflow: hidden;
48
+ align-self: end;
49
+ padding-top: 0.5rem;
50
+
51
+ .tablist {
52
+ gap: 0.25lh;
53
+ padding-inline: calc(var(--outline-width) * 2);
54
+ }
55
+ }
56
+
57
+ .frame-content {
58
+ border: var(--border-width, 1px) solid
59
+ var(--border-frame-content, var(--border-color));
60
+ border-radius: 0 0 var(--radius) var(--radius);
61
+ background: var(--bg-frame-content);
62
+
63
+ > :where(.background) svg {
64
+ width: 100%;
65
+ height: 100%;
66
+ }
67
+ }
68
+ }
69
+
70
+ .BrowserFrame-colored {
71
+ .FrameHeaderDot {
72
+ &:first-child {
73
+ background-color: var(--dot-1-color, #e2544d);
74
+ }
75
+
76
+ &:nth-child(2) {
77
+ background-color: var(--dot-2-color, #d79f27);
78
+ }
79
+
80
+ &:last-child {
81
+ background-color: var(--dot-3-color, #22a936);
82
+ }
83
+ }
84
+ }
@@ -1,20 +1,26 @@
1
- @layer utilities {
2
- .drawer-backdrop {
3
- position: fixed;
4
- inset: 0;
5
- z-index: 15;
6
- background-color: oklch(0% 0 0deg / 50%);
7
- }
1
+ /* @utility backdrop {
2
+ position: fixed;
3
+ inset: 0;
4
+ z-index: 200;
5
+ background-color: oklch(0% 0 0deg / 50%);
6
+ } */
8
7
 
9
- /* // Note to self: */
10
- /* // Need to create another Class to contain default z-index for Absolute Drawers — so this doesn't show above it. */
11
- .drawer-content {
12
- position: fixed;
13
- overflow-y: auto;
14
- z-index: 100;
15
- }
8
+ /* // Note to self: */
9
+ /* // Need to create another Class to contain default z-index for Absolute Drawers — so this doesn't show above it. */
10
+ @utility drawer-content {
11
+ overflow-y: auto;
12
+ z-index: 100;
13
+ }
16
14
 
17
- .drawer-close-button {
18
- @apply button-icon;
19
- }
15
+ @utility drawer-close-button {
16
+ @apply button-icon;
20
17
  }
18
+
19
+ /* Attributes */
20
+ /* open -> nonmodal. Needs for dialog to be visible */
21
+
22
+ /* Methods */
23
+ /* showmodal -> modal */
24
+ /* show -> non-modal */
25
+ /* close -> close */
26
+ /* Focus on first item otherwise */
@@ -1,2 +1,6 @@
1
1
  @import './drawer.css';
2
2
  @import './accordion.css';
3
+ @import './popover.css';
4
+ @import './modal.css';
5
+ @import './tabs.css';
6
+ @import './browserframe.css';
@@ -0,0 +1,62 @@
1
+ @layer base {
2
+ /* Prevent scroll when modal is open */
3
+ html:has(.modal) {
4
+ @apply transition-scaffold;
5
+ --transition-props: overflow;
6
+ transition-duration: 300ms;
7
+ }
8
+
9
+ html:has(.modal[open]) {
10
+ overflow: hidden;
11
+ transition-delay: 0s;
12
+ }
13
+
14
+ .modal:not([open]) {
15
+ pointer-events: none;
16
+ opacity: 0;
17
+ }
18
+
19
+ /* Position fixed and some inset has been automatically applied */
20
+
21
+ /* Base/Closing Style */
22
+ .modal {
23
+ @apply border-scaffold;
24
+ margin: auto;
25
+ padding: 1lh;
26
+ color: var(--text-color);
27
+ background: var(--bg-color);
28
+ }
29
+
30
+ .modal::backdrop {
31
+ backdrop-filter: blur(0);
32
+ }
33
+
34
+ .modal,
35
+ .modal::backdrop {
36
+ @apply transition-scaffold;
37
+ --transition-duration: 300ms;
38
+ --transition-easing: ease-in;
39
+ opacity: 0;
40
+ transition-property: var(--transition-props);
41
+ }
42
+
43
+ /* Opened Style */
44
+ .modal[open],
45
+ .modal[open]::backdrop {
46
+ --transition-easing: ease-out;
47
+ opacity: 1;
48
+ }
49
+
50
+ .modal[open]::backdrop {
51
+ backdrop-filter: blur(var(--blur, 6px));
52
+ background: var(--backdrop-bg, oklch(0% 0 0deg / 50%));
53
+ }
54
+
55
+ @starting-style {
56
+ .modal[open],
57
+ .modal[open]::backdrop {
58
+ backdrop-filter: blur(0);
59
+ opacity: 0;
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,38 @@
1
+ @layer base {
2
+ [popover] {
3
+ @apply border-scaffold;
4
+ @apply transition-scaffold;
5
+ --transition-duration: 300ms;
6
+ --transition-easing: ease-out;
7
+ position: absolute;
8
+ max-width: 100%;
9
+ padding: 1rem;
10
+ color: var(--text-color);
11
+ background: var(--bg-color);
12
+ opacity: 0;
13
+ }
14
+
15
+ [popover]:popover-open {
16
+ --transition-easing: ease-in;
17
+ opacity: 1;
18
+ }
19
+
20
+ @starting-style {
21
+ [popover]:popover-open {
22
+ opacity: 0;
23
+ }
24
+ }
25
+
26
+ /* All modals should use `dialog` element with the `modal` class. */
27
+ /* They should not use [popover] dialogs with backdrops are modals — it only gives the right affordance this way. */
28
+
29
+ [popover]::backdrop {
30
+ pointer-events: none;
31
+ opacity: 0;
32
+ }
33
+
34
+ [popover] > .content,
35
+ .popover-content {
36
+ overflow: auto;
37
+ }
38
+ }
@@ -0,0 +1,111 @@
1
+ @utility tablist {
2
+ & {
3
+ display: flex;
4
+ gap: 0.5lh;
5
+ }
6
+ }
7
+
8
+ @utility tab {
9
+ & {
10
+ align-items: start;
11
+ padding: 0.25lh 0.5lh;
12
+ text-align: left;
13
+ }
14
+
15
+ &[aria-selected] {
16
+ z-index: 2;
17
+ }
18
+ }
19
+
20
+ @utility tabpanels {
21
+ & {
22
+ @apply border-scaffold;
23
+ position: relative;
24
+ }
25
+ }
26
+
27
+ @utility tabpanel {
28
+ :where(&) {
29
+ padding: 0.75lh;
30
+ }
31
+ }
32
+
33
+ /*********************
34
+ * Variations *
35
+ *********************/
36
+ @utility tablist-underline {
37
+ gap: 0;
38
+
39
+ .tab {
40
+ border-width: 0;
41
+ border-radius: 0;
42
+ }
43
+
44
+ &.tablist-top .tab {
45
+ border-bottom-width: var(--border-width);
46
+ }
47
+
48
+ &.tablist-left .tab {
49
+ border-right-width: var(--border-width);
50
+ }
51
+
52
+ &.tablist-right .tab {
53
+ border-left-width: var(--border-width);
54
+ }
55
+ }
56
+
57
+ @utility tablist-tab {
58
+ .tab {
59
+ position: relative;
60
+ z-index: 1;
61
+ }
62
+
63
+ &.tablist-top :where(.tab) {
64
+ top: var(--border-width);
65
+ border-bottom: 0;
66
+ border-end-start-radius: 0;
67
+ border-end-end-radius: 0;
68
+ }
69
+
70
+ &.tablist-left :where(.tab) {
71
+ right: var(--border-width);
72
+ border-right: 0;
73
+ border-start-end-radius: 0;
74
+ border-end-end-radius: 0;
75
+ }
76
+
77
+ &.tablist-right :where(.tab) {
78
+ left: var(--border-width);
79
+ border-left: 0;
80
+ border-start-start-radius: 0;
81
+ border-end-start-radius: 0;
82
+ }
83
+ }
84
+
85
+ @utility tablist-top {
86
+ --scrollbar-width: none;
87
+ --scrollbar-size: 0px;
88
+ max-width: 100%;
89
+ }
90
+
91
+ @layer components {
92
+ /*********************
93
+ * Tab placements *
94
+ *********************/
95
+
96
+ /* Top */
97
+
98
+ /* Left and Right */
99
+ :is(.tablist-left, .tablist-right) {
100
+ display: flex;
101
+ flex-flow: column nowrap;
102
+
103
+ :where(.tab) {
104
+ align-self: stretch;
105
+ }
106
+ }
107
+
108
+ .tablist-right {
109
+ order: 2;
110
+ }
111
+ }