breakouts 0.8.0 → 0.8.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,22 +1,34 @@
1
1
  {
2
2
  "name": "breakouts",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "A focused SCSS/CSS breakout layout toolkit inspired by the Mulligan named-grid pattern.",
5
+ "homepage": "https://cantilux.github.io/breakouts/",
6
+ "bugs": "https://github.com/Cantilux/breakouts/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Cantilux/breakouts.git"
10
+ },
5
11
  "main": "dist/breakouts.css",
12
+ "sass": "src/breakouts.scss",
6
13
  "files": [
14
+ "_index.scss",
7
15
  "src/",
8
- "dist/"
16
+ "dist/",
17
+ "CHANGELOG.md"
9
18
  ],
10
19
  "scripts": {
20
+ "test": "sh test/compile.sh",
11
21
  "build": "sass src/_index.scss dist/breakouts.css --style=expanded && sass src/_index.scss dist/breakouts.min.css --style=compressed && cp dist/breakouts.css docs/breakouts.css",
12
- "release:patch": "npm run build && npm version patch --sign-git-tag && git push && git push --follow-tags && npm publish --access public",
13
- "release:minor": "npm run build && npm version minor --sign-git-tag && git push && git push --follow-tags && npm publish --access public",
14
- "release:major": "npm run build && npm version major --sign-git-tag && git push && git push --follow-tags && npm publish --access public"
22
+ "changeset": "changeset",
23
+ "release:version": "changeset version"
15
24
  },
16
25
  "author": "Cantilux",
17
26
  "license": "MIT",
18
27
  "devDependencies": {
28
+ "@changesets/cli": "3.0.3",
19
29
  "sass": "^1.86.2"
20
30
  },
21
- "sass": "src/breakouts.scss"
31
+ "publishConfig": {
32
+ "access": "public"
33
+ }
22
34
  }
package/src/_index.scss CHANGED
@@ -1,14 +1,5 @@
1
- // Full bundle entry point. Use src/core, src/base, src/reset, or
2
- // src/utilities when you need a smaller Sass surface.
1
+ // Full bundle entry point: base layers, then utilities last (ITCSS order, see AGENTS.md).
2
+ // Use src/core, src/base, src/reset, or src/utilities when you need a smaller Sass surface.
3
3
 
4
- // Theme and configurable variables
5
- @forward 'base/variables';
6
- @use 'base/variables' as *;
7
- @forward 'base/colors';
8
-
9
- // Base styles
10
- @forward 'base/reset';
11
- @forward 'base/spacing';
12
- @forward 'base/positions';
13
- @forward 'base/typography';
14
- @forward 'base/layout';
4
+ @forward 'base';
5
+ @forward 'utilities';
@@ -2,6 +2,21 @@
2
2
 
3
3
  @use 'variables' as *;
4
4
 
5
+ // One definition for both dark-mode selectors, so they cannot drift apart.
6
+ @mixin -dark-tokens {
7
+ --color-background: #{$color-background-dark};
8
+ --color-surface: #{$color-surface-dark};
9
+ --color-text: #{$color-text-dark};
10
+ --color-muted: #{$color-muted-dark};
11
+ --color-primary: #{$color-primary-dark};
12
+ --color-secondary: #{$color-secondary-dark};
13
+ --color-accent: #{$color-accent-dark};
14
+ --color-success: #{$color-success-dark};
15
+ --color-error: #{$color-error-dark};
16
+ --color-warning: #{$color-warning-dark};
17
+ color-scheme: dark;
18
+ }
19
+
5
20
  :root {
6
21
  --color-background: #{$color-background};
7
22
  --color-surface: #{$color-surface};
@@ -29,17 +44,7 @@
29
44
  html.dark,
30
45
  :root.dark,
31
46
  .dark {
32
- --color-background: #{$color-background-dark};
33
- --color-surface: #{$color-surface-dark};
34
- --color-text: #{$color-text-dark};
35
- --color-muted: #{$color-muted-dark};
36
- --color-primary: #{$color-primary-dark};
37
- --color-secondary: #{$color-secondary-dark};
38
- --color-accent: #{$color-accent-dark};
39
- --color-success: #{$color-success-dark};
40
- --color-error: #{$color-error-dark};
41
- --color-warning: #{$color-warning-dark};
42
- color-scheme: dark;
47
+ @include -dark-tokens;
43
48
  }
44
49
 
45
50
  html.light,
@@ -60,16 +65,6 @@ html.light,
60
65
 
61
66
  @media (prefers-color-scheme: dark) {
62
67
  :root:not(.light):not(.dark) {
63
- --color-background: #{$color-background-dark};
64
- --color-surface: #{$color-surface-dark};
65
- --color-text: #{$color-text-dark};
66
- --color-muted: #{$color-muted-dark};
67
- --color-primary: #{$color-primary-dark};
68
- --color-secondary: #{$color-secondary-dark};
69
- --color-accent: #{$color-accent-dark};
70
- --color-success: #{$color-success-dark};
71
- --color-error: #{$color-error-dark};
72
- --color-warning: #{$color-warning-dark};
73
- color-scheme: dark;
68
+ @include -dark-tokens;
74
69
  }
75
70
  }
@@ -1,113 +1,25 @@
1
1
  // Utility classes for background and text colors.
2
2
 
3
- .bg-background {
4
- background-color: var(--color-background);
5
- }
6
-
7
- .bg-surface {
8
- background-color: var(--color-surface);
9
- }
10
-
11
- .bg-primary {
12
- background-color: var(--color-primary);
13
- }
14
-
15
- .bg-secondary {
16
- background-color: var(--color-secondary);
17
- }
18
-
19
- .bg-accent {
20
- background-color: var(--color-accent);
21
- }
22
-
23
- .bg-muted {
24
- background-color: var(--color-muted);
25
- }
26
-
27
- .bg-success {
28
- background-color: var(--color-success);
29
- }
30
-
31
- .bg-error {
32
- background-color: var(--color-error);
33
- }
3
+ $-colors: background, surface, primary, secondary, accent, muted, success, error, warning;
34
4
 
35
- .bg-warning {
36
- background-color: var(--color-warning);
37
- }
38
-
39
- .text-background {
40
- color: var(--color-background);
5
+ @each $name in $-colors {
6
+ .bg-#{$name} {
7
+ background-color: var(--color-#{$name});
8
+ }
41
9
  }
42
10
 
43
11
  .text-color {
44
12
  color: var(--color-text);
45
13
  }
46
14
 
47
- .text-primary {
48
- color: var(--color-primary);
49
- }
50
-
51
- .text-accent {
52
- color: var(--color-accent);
53
- }
54
-
55
- .text-secondary {
56
- color: var(--color-secondary);
57
- }
58
-
59
- .text-surface {
60
- color: var(--color-surface);
61
- }
62
-
63
- .text-muted {
64
- color: var(--color-muted);
65
- }
66
-
67
- .text-success {
68
- color: var(--color-success);
69
- }
70
-
71
- .text-error {
72
- color: var(--color-error);
73
- }
74
-
75
- .text-warning {
76
- color: var(--color-warning);
77
- }
78
-
79
- .text-neutral-100 {
80
- color: var(--color-neutral-100);
81
- }
82
-
83
- .text-neutral-200 {
84
- color: var(--color-neutral-200);
85
- }
86
-
87
- .text-neutral-300 {
88
- color: var(--color-neutral-300);
89
- }
90
-
91
- .text-neutral-400 {
92
- color: var(--color-neutral-400);
93
- }
94
-
95
- .text-neutral-500 {
96
- color: var(--color-neutral-500);
97
- }
98
-
99
- .text-neutral-600 {
100
- color: var(--color-neutral-600);
101
- }
102
-
103
- .text-neutral-700 {
104
- color: var(--color-neutral-700);
105
- }
106
-
107
- .text-neutral-800 {
108
- color: var(--color-neutral-800);
15
+ @each $name in $-colors {
16
+ .text-#{$name} {
17
+ color: var(--color-#{$name});
18
+ }
109
19
  }
110
20
 
111
- .text-neutral-900 {
112
- color: var(--color-neutral-900);
21
+ @each $step in 100, 200, 300, 400, 500, 600, 700, 800, 900 {
22
+ .text-neutral-#{$step} {
23
+ color: var(--color-neutral-#{$step});
24
+ }
113
25
  }
@@ -1,6 +1,9 @@
1
1
  // This file contains the layout styles for the site, including grid and flexbox layouts.
2
2
  // It uses CSS custom properties for responsive design and theming.
3
3
 
4
+ @use 'sass:list';
5
+ @use 'sass:string';
6
+
4
7
  :root {
5
8
  --gap: clamp(1rem, 6vw, 3rem);
6
9
  --full: minmax(var(--gap), 1fr);
@@ -16,40 +19,26 @@
16
19
  padding-inline: 1rem;
17
20
  }
18
21
 
19
- // Breakout classes
20
- .full-bleed {
21
- width: 100vw;
22
- margin-left: 50%;
23
- transform: translateX(-50%);
24
- }
25
-
26
- .full-bleed--left {
27
- width: 100vw;
28
- margin-left: 0;
29
- transform: translateX(0);
30
- }
31
-
32
- .full-bleed--right {
33
- width: 100vw;
34
- margin-left: calc(-1 * (100vw - 100%) / 2);
35
- transform: translateX(calc(100% - 100vw));
36
- }
37
-
22
+ // Viewport-wide helpers outside the named grid, for a parent centered in the viewport.
23
+ // 100vw includes a classic scrollbar: pages using them may need `overflow-x: clip` on body.
24
+ // .breakout* are deprecated aliases of .full-bleed*, to be removed in the next major.
25
+ .full-bleed,
38
26
  .breakout {
39
27
  width: 100vw;
40
- margin-left: calc(-1 * (100vw - 100%) / 2);
28
+ margin-left: calc(50% - 50vw);
41
29
  }
42
30
 
31
+ // Viewport's left edge to the parent's right edge.
32
+ .full-bleed--left,
43
33
  .breakout--left {
44
- width: 100vw;
45
- margin-left: 0;
46
- transform: translateX(0);
34
+ width: calc(50% + 50vw);
35
+ margin-left: calc(50% - 50vw);
47
36
  }
48
37
 
38
+ // Parent's left edge to the viewport's right edge.
39
+ .full-bleed--right,
49
40
  .breakout--right {
50
- width: 100vw;
51
- margin-left: calc(-1 * (100vw - 100%) / 2);
52
- transform: translateX(calc(100% - 100vw));
41
+ width: calc(50% + 50vw);
53
42
  }
54
43
 
55
44
  // Breakouts Grid (named lines)
@@ -113,11 +102,51 @@
113
102
  grid-column: content-start / full-end;
114
103
  }
115
104
 
116
- .breakouts > .breakouts,
117
- .breakouts > .breakouts-grid,
118
- .breakouts-grid > .breakouts,
119
- .breakouts-grid > .breakouts-grid {
120
- grid-template-columns: inherit;
105
+ // Nested grids reuse the parent's tracks (subgrid), so their columns line up with the parent's.
106
+ // Outer lines the nested area does not span are named on its edges: .full inside a nested
107
+ // .feature fills that .feature. Without subgrid support a nested grid keeps its own tracks.
108
+ $-outer-lines: (popout, feature, full);
109
+
110
+ // Placement classes -> (start, end) level: 0 content, 1 popout, 2 feature, 3 full.
111
+ $-nested-areas: (
112
+ '*': (0, 0),
113
+ '.content': (0, 0),
114
+ '.popout': (1, 1),
115
+ '.popout-start, .popout-left': (1, 0),
116
+ '.popout-end, .popout-right': (0, 1),
117
+ '.feature': (2, 2),
118
+ '.feature-start, .feature-left': (2, 0),
119
+ '.feature-end, .feature-right': (0, 2),
120
+ '.full': (3, 3),
121
+ '.full-start, .full-left': (3, 0),
122
+ '.full-end, .full-right': (0, 3),
123
+ );
124
+
125
+ // Line names beyond $level on one side, e.g. (1, start) -> "[feature-start full-start]".
126
+ @function -edge-names($level, $side) {
127
+ $names: ();
128
+ @each $line in $-outer-lines {
129
+ @if list.index($-outer-lines, $line) > $level {
130
+ $names: list.append($names, string.unquote('#{$line}-#{$side}'), space);
131
+ }
132
+ }
133
+ @if list.length($names) == 0 {
134
+ @return '[]';
135
+ }
136
+ @return '[#{$names}]';
137
+ }
138
+
139
+ @each $classes, $levels in $-nested-areas {
140
+ $start: list.nth($levels, 1);
141
+ $end: list.nth($levels, 2);
142
+ $lines: -edge-names($start, start);
143
+ @for $i from 0 to $start + $end {
144
+ $lines: $lines + ' []';
145
+ }
146
+
147
+ :is(.breakouts, .breakouts-grid) > :is(.breakouts, .breakouts-grid):is(#{$classes}) {
148
+ grid-template-columns: subgrid #{$lines} #{-edge-names($end, end)};
149
+ }
121
150
  }
122
151
 
123
152
  // Standard Grid (for .grid and .grid--full compatibility)
@@ -44,3 +44,9 @@ a {
44
44
  color: var(--color-secondary);
45
45
  }
46
46
  }
47
+
48
+ // Rows of a breakouts grid are already spaced by row-gap; flow margins would add to it.
49
+ // Same specificity as the element rules above, so utilities like .my-4 still win.
50
+ :where(.breakouts, .breakouts-grid) > :is(h1, h2, h3, h4, h5, h6, p) {
51
+ margin-block: 0;
52
+ }
@@ -1,45 +1,49 @@
1
1
  // This file contains the default variables for the default theme.
2
+ // `-dark` values apply in dark mode, `-light` values in explicit light mode.
3
+
4
+ @use 'sass:color';
2
5
 
3
6
  // color variables
4
7
  $color-background: #ffffff !default;
5
8
  $color-background-dark: #111111 !default;
6
- $color-background-light: #ffffff !default;
9
+ $color-background-light: $color-background !default;
7
10
 
8
11
  $color-surface: #f0f0f0 !default;
9
12
  $color-surface-dark: #1a1a1a !default;
10
- $color-surface-light: #f8f8f8 !default;
13
+ $color-surface-light: $color-surface !default;
11
14
 
12
15
  $color-text: #111111 !default;
13
16
  $color-text-dark: #eeeeee !default;
14
- $color-text-light: #222222 !default;
17
+ $color-text-light: $color-text !default;
15
18
 
16
19
  $color-muted: #666666 !default;
17
20
  $color-muted-dark: #aaaaaa !default;
18
- $color-muted-light: #999999 !default;
21
+ $color-muted-light: $color-muted !default;
19
22
 
23
+ // Brand and status colors: dark mode uses a lighter tint, so it stays readable on dark backgrounds.
20
24
  $color-primary: #0055ff !default;
21
- $color-primary-dark: #0033aa !default;
22
- $color-primary-light: #88b0ff !default;
25
+ $color-primary-dark: color.scale($color-primary, $lightness: 50%) !default;
26
+ $color-primary-light: $color-primary !default;
23
27
 
24
28
  $color-secondary: #0033aa !default;
25
- $color-secondary-dark: #002277 !default;
26
- $color-secondary-light: #ccd9ff !default;
29
+ $color-secondary-dark: color.scale($color-secondary, $lightness: 50%) !default;
30
+ $color-secondary-light: $color-secondary !default;
27
31
 
28
32
  $color-accent: #ff4081 !default;
29
- $color-accent-dark: #c60055 !default;
30
- $color-accent-light: #ff80ab !default;
33
+ $color-accent-dark: color.scale($color-accent, $lightness: 50%) !default;
34
+ $color-accent-light: $color-accent !default;
31
35
 
32
36
  $color-success: #28a745 !default;
33
- $color-success-dark: #1e7e34 !default;
34
- $color-success-light: #71dd8a !default;
37
+ $color-success-dark: color.scale($color-success, $lightness: 50%) !default;
38
+ $color-success-light: $color-success !default;
35
39
 
36
40
  $color-error: #dc3545 !default;
37
- $color-error-dark: #a71d2a !default;
38
- $color-error-light: #ff6b6b !default;
41
+ $color-error-dark: color.scale($color-error, $lightness: 50%) !default;
42
+ $color-error-light: $color-error !default;
39
43
 
40
44
  $color-warning: #ffc107 !default;
41
- $color-warning-dark: #c79100 !default;
42
- $color-warning-light: #ffdb4d !default;
45
+ $color-warning-dark: color.scale($color-warning, $lightness: 50%) !default;
46
+ $color-warning-light: $color-warning !default;
43
47
 
44
48
  $color-neutral-100: #f8f9fa !default;
45
49
  $color-neutral-200: #e9ecef !default;
@@ -50,4 +54,3 @@ $color-neutral-600: #6c757d !default;
50
54
  $color-neutral-700: #495057 !default;
51
55
  $color-neutral-800: #343a40 !default;
52
56
  $color-neutral-900: #212529 !default;
53
-
package/src/base.scss CHANGED
@@ -1,5 +1,7 @@
1
- // Optional base element styles, without utility classes.
1
+ // Optional base element styles, without utility classes: settings, generic, elements, objects.
2
2
 
3
- @forward 'core';
3
+ @forward 'base/variables';
4
+ @forward 'base/color-tokens';
4
5
  @forward 'base/reset';
5
6
  @forward 'base/typography-base';
7
+ @forward 'base/layout';
@@ -4,28 +4,19 @@
4
4
  // The theme variables are used to customize the appearance of the Chupa Pop theme.
5
5
  // The theme variables are defined using the SCSS @use and @forward directives.
6
6
 
7
- @use 'sass:color';
8
-
9
7
  $primary: #ecb838 !default;
10
8
  $secondary: #ab4073 !default;
11
9
  $accent: #196484 !default;
12
10
 
13
11
  @forward '../base/variables' with (
14
12
  $color-primary: $primary,
15
- $color-primary-dark: color.adjust($primary, $lightness: -15%),
16
- $color-primary-light: color.adjust($primary, $lightness: 15%),
17
-
18
13
  $color-secondary: $secondary,
19
- $color-secondary-dark: color.adjust($secondary, $lightness: -15%),
20
- $color-secondary-light: color.adjust($secondary, $lightness: 15%),
21
-
22
14
  $color-accent: $accent,
23
- $color-accent-dark: color.adjust($accent, $lightness: -15%),
24
- $color-accent-light: color.adjust($accent, $lightness: 15%),
25
15
  );
26
16
 
27
- @use '../base/variables' as *;
28
- @forward '../base/colors';
17
+ @forward '../base/color-tokens';
29
18
  @forward '../base/reset';
30
- @forward '../base/typography';
19
+ @forward '../base/typography-base';
31
20
  @forward '../base/layout';
21
+ @forward '../base/color-utilities';
22
+ @forward '../base/typography-utilities';
@@ -4,38 +4,23 @@
4
4
  // The theme variables are used to customize the appearance of the Medical theme.
5
5
  // The theme variables are defined using the SCSS @use and @forward directives.
6
6
 
7
- @use 'sass:color';
8
-
9
7
  $primary: #4682B4 !default;
10
8
  $secondary: #9DC183 !default;
11
9
  $accent: #A9A9A9 !default;
12
- $muted: #D3D3D3 !default;
10
+ $muted: #6B7280 !default;
13
11
  $background: #FFFFFF !default;
14
12
 
15
13
  @forward '../base/variables' with (
16
14
  $color-primary: $primary,
17
- $color-primary-dark: color.adjust($primary, $lightness: -15%),
18
- $color-primary-light: color.adjust($primary, $lightness: 15%),
19
-
20
15
  $color-secondary: $secondary,
21
- $color-secondary-dark: color.adjust($secondary, $lightness: -15%),
22
- $color-secondary-light: color.adjust($secondary, $lightness: 15%),
23
-
24
16
  $color-accent: $accent,
25
- $color-accent-dark: color.adjust($accent, $lightness: -15%),
26
- $color-accent-light: color.adjust($accent, $lightness: 15%),
27
-
28
17
  $color-muted: $muted,
29
- $color-muted-dark: color.adjust($muted, $lightness: -15%),
30
- $color-muted-light: color.adjust($muted, $lightness: 15%),
31
-
32
- $color-background: $background,
33
- $color-background-dark: color.adjust($background, $lightness: -5%),
34
- $color-background-light: color.adjust($background, $lightness: 5%)
18
+ $color-background: $background
35
19
  );
36
20
 
37
- @use '../base/variables' as *;
38
- @forward '../base/colors';
21
+ @forward '../base/color-tokens';
39
22
  @forward '../base/reset';
40
- @forward '../base/typography';
23
+ @forward '../base/typography-base';
41
24
  @forward '../base/layout';
25
+ @forward '../base/color-utilities';
26
+ @forward '../base/typography-utilities';
@@ -11,31 +11,23 @@ $secondary: #F2711C !default;
11
11
  $accent: #E94057 !default;
12
12
  $muted: #FFE5B4 !default;
13
13
  $background: #4F2F4C !default;
14
+ // Dark background in every mode, so text stays light in every mode.
15
+ $text: #FFF5E6 !default;
14
16
 
15
17
  @forward '../base/variables' with (
16
18
  $color-primary: $primary,
17
- $color-primary-dark: color.adjust($primary, $lightness: -15%),
18
- $color-primary-light: color.adjust($primary, $lightness: 15%),
19
-
20
19
  $color-secondary: $secondary,
21
- $color-secondary-dark: color.adjust($secondary, $lightness: -15%),
22
- $color-secondary-light: color.adjust($secondary, $lightness: 15%),
23
-
24
20
  $color-accent: $accent,
25
- $color-accent-dark: color.adjust($accent, $lightness: -15%),
26
- $color-accent-light: color.adjust($accent, $lightness: 15%),
27
-
28
21
  $color-muted: $muted,
29
- $color-muted-dark: color.adjust($muted, $lightness: -15%),
30
- $color-muted-light: color.adjust($muted, $lightness: 15%),
31
-
22
+ $color-text: $text,
23
+ $color-text-dark: $text,
32
24
  $color-background: $background,
33
25
  $color-background-dark: color.adjust($background, $lightness: -5%),
34
- $color-background-light: color.adjust($background, $lightness: 5%)
35
26
  );
36
27
 
37
- @use '../base/variables' as *;
38
- @forward '../base/colors';
28
+ @forward '../base/color-tokens';
39
29
  @forward '../base/reset';
40
- @forward '../base/typography';
30
+ @forward '../base/typography-base';
41
31
  @forward '../base/layout';
32
+ @forward '../base/color-utilities';
33
+ @forward '../base/typography-utilities';