@splendidlabz/styles 4.0.0-alpha.0 → 4.0.0-alpha.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splendidlabz/styles",
3
- "version": "4.0.0-alpha.0",
3
+ "version": "4.0.0-alpha.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "author": "Zell Liew <zellwk@gmail.com>",
@@ -10,13 +10,13 @@
10
10
  ],
11
11
  "exports": {
12
12
  ".": "./src/styles.css",
13
+ "./astro": "./src/astro/index.css",
13
14
  "./components": "./src/components/index.css",
14
15
  "./addons": "./src/addons/index.css",
15
16
  "./no-tw": "./dist/no-tw/styles.css",
16
17
  "./no-tw/*": "./dist/no-tw/*.css",
17
18
  "./*": "./src/*.css",
18
- "./scripts": "./src/scripts/index.js",
19
- "./scripts/*": "./src/scripts/*.js"
19
+ "./scripts": "./scripts/index.js"
20
20
  },
21
21
  "scripts": {
22
22
  "lint": "stylelint '**/*.{css,scss}' --fix",
@@ -27,10 +27,10 @@
27
27
  "build": "npm run build-styles & npm run build-layouts"
28
28
  },
29
29
  "dependencies": {
30
- "@splendidlabz/utils": "1.5.0-alpha.3"
30
+ "@splendidlabz/utils": "1.5.0-alpha.4"
31
31
  },
32
32
  "devDependencies": {
33
- "@splendidlabz/stylelint-config": "3.0.0-alpha.3",
33
+ "@splendidlabz/stylelint-config": "3.0.0-alpha.4",
34
34
  "@tailwindcss/cli": "^4.1.3",
35
35
  "lightningcss-cli": "^1.29.3",
36
36
  "tailwindcss": "^4.1.3",
@@ -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,32 +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%;
20
21
  text-align: left;
21
22
 
22
- /* astro-slot contains the title */
23
+ > svg {
24
+ width: 1em;
25
+ height: 1lh;
26
+ }
27
+
23
28
  &:where(:has(svg + span)),
24
29
  &:where(:has(svg + astro-slot)) {
25
30
  justify-content: start;
26
31
  }
27
32
  }
33
+ }
28
34
 
29
- .accordion-content {
30
- @apply padding-scaffold;
31
- }
35
+ @utility accordion-content {
36
+ padding: 1rem;
32
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
+ }
@@ -2,3 +2,5 @@
2
2
  @import './accordion.css';
3
3
  @import './popover.css';
4
4
  @import './modal.css';
5
+ @import './tabs.css';
6
+ @import './browserframe.css';
@@ -1,6 +1,5 @@
1
1
  @layer base {
2
2
  /* Prevent scroll when modal is open */
3
-
4
3
  html:has(.modal) {
5
4
  @apply transition-scaffold;
6
5
  --transition-props: overflow;
@@ -23,11 +22,13 @@
23
22
  .modal {
24
23
  @apply border-scaffold;
25
24
  margin: auto;
26
- padding: 2rem;
25
+ padding: 1lh;
26
+ color: var(--text-color);
27
+ background: var(--bg-color);
27
28
  }
28
29
 
29
30
  .modal::backdrop {
30
- backdrop-filter: blur(var(--blur, 0));
31
+ backdrop-filter: blur(0);
31
32
  }
32
33
 
33
34
  .modal,
@@ -47,13 +48,14 @@
47
48
  }
48
49
 
49
50
  .modal[open]::backdrop {
50
- background-color: oklch(0% 0 0deg / 50%);
51
+ backdrop-filter: blur(var(--blur, 6px));
52
+ background: var(--backdrop-bg, oklch(0% 0 0deg / 50%));
51
53
  }
52
54
 
53
55
  @starting-style {
54
56
  .modal[open],
55
57
  .modal[open]::backdrop {
56
- --blur: 0;
58
+ backdrop-filter: blur(0);
57
59
  opacity: 0;
58
60
  }
59
61
  }
@@ -7,6 +7,8 @@
7
7
  position: absolute;
8
8
  max-width: 100%;
9
9
  padding: 1rem;
10
+ color: var(--text-color);
11
+ background: var(--bg-color);
10
12
  opacity: 0;
11
13
  }
12
14
 
@@ -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
+ }
@@ -3,5 +3,6 @@
3
3
  @import './fancy-box.css';
4
4
  @import './highlight.css';
5
5
  @import './shadows.css';
6
- @import './text-outline.css';
6
+ @import './text.css';
7
7
  @import './frosted-glass.css';
8
+ @import './stroke.css';
@@ -38,12 +38,3 @@
38
38
  filter: drop-shadow(var(--drop-shadow, var(--drop-shadow-string)));
39
39
  }
40
40
  }
41
-
42
- /* Will this work? */
43
- /*********************
44
- * Shadow Utilities *
45
- * Haven't managed to get Functional Utilities to work yet
46
- *********************/
47
- /* @utility shadow-x-* {
48
- --shadow-x: --value([integer]);
49
- } */
@@ -0,0 +1,25 @@
1
+ /*********************
2
+ * Stroke *
3
+ * Allows spl-stroke-<length> to create --stroke-width
4
+ * Allows spl-stroke-<color>/<modifier> to create --stroke-color
5
+ *********************/
6
+ /* prettier-ignore */
7
+ @utility spl-stroke-* {
8
+ & {
9
+ --stroke-width: --value([length]);
10
+ --stroke-color: --value(--color-*, [color]);
11
+ --stroke-color: oklch(from --value(--color-*, [color]) l c h / --modifier(integer)%);
12
+ }
13
+ }
14
+
15
+ /*********************
16
+ * Fill *
17
+ * Allows spl-fill-<color>/<modifier> to create --fill-color
18
+ *********************/
19
+ /* prettier-ignore */
20
+ @utility spl-fill-* {
21
+ & {
22
+ --fill-color: --value(--color-*, [color]);
23
+ --fill-color: oklch(from --value(--color-*, [color]) l c h / --modifier(integer)%);
24
+ }
25
+ }
@@ -40,6 +40,7 @@
40
40
  @layer base {
41
41
  a {
42
42
  @apply pigment;
43
+ border-radius: 0;
43
44
  }
44
45
 
45
46
  a:where(:not(.button)) {
@@ -34,7 +34,7 @@
34
34
  /* --span: 1; */
35
35
  /* Revert to default span for children in nested grids */
36
36
  display: grid;
37
- gap: var(--gap-y, var(--gap, 1rem)) var(--gap-x, var(--gap, 1rem));
37
+ gap: var(--gap-y, var(--gap)) var(--gap-x, var(--gap));
38
38
  max-width: 100%;
39
39
 
40
40
  /* width: 100%; */
@@ -1,7 +1,3 @@
1
- @theme {
2
- --gap: 1rem;
3
- }
4
-
5
1
  /* Used for every micro utility in this file */
6
2
 
7
3
  @utility micro {
@@ -4,10 +4,10 @@
4
4
  @utility hero-heading {
5
5
  display: flex;
6
6
  flex-direction: column;
7
- gap: var(--gap, 0.25em);
7
+ gap: 0.25rem;
8
8
  max-width: 100%;
9
9
 
10
- > :where(.hero-eyebrow) {
10
+ > .eyebrow {
11
11
  font-size: var(--eyebrow-size, 0.6em);
12
12
  }
13
13
 
@@ -2,22 +2,22 @@
2
2
  & {
3
3
  display: flex;
4
4
  flex-flow: column;
5
- gap: 1em;
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: 2em;
12
- scroll-margin-top: 2em;
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: 1em;
20
- scroll-margin-top: 2em;
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.25em;
42
+ margin-top: 0.25lh;
43
43
  }
44
44
 
45
45
  li:has(li) + li {
46
- margin-top: 0.5em;
46
+ margin-top: 0.5lh;
47
47
  }
48
48
 
49
49
  li > :where(ul, ol) {
50
- margin-top: 0.25em;
50
+ margin-top: 0.25lh;
51
51
  }
52
52
  }
53
53
 
@@ -1,5 +1,5 @@
1
1
  @utility simple-svg {
2
- :where(path) {
2
+ * {
3
3
  fill: var(--fill-color);
4
4
  stroke: var(--stroke-color); /* Fallback to text color */
5
5
  stroke-width: var(--stroke-width);
@@ -1,8 +1,9 @@
1
1
  @theme {
2
2
  /* Typography */
3
- --bg-color: white;
4
- --text-color: black;
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: 3px;
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,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
- }
@@ -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
- }
@@ -1,7 +0,0 @@
1
- import { Masonry, ScrollableHorizontal, Sticky } from './index.js'
2
-
3
- export default function LayoutScripts(element = null) {
4
- Masonry(element)
5
- Sticky(element)
6
- ScrollableHorizontal(element)
7
- }
@@ -1,4 +0,0 @@
1
- export * from './all.js'
2
- export * from './Masonry.js'
3
- export * from './Scrollable.js'
4
- export * from './Sticky.js'
File without changes