fractalstyler2 0.1.0 → 0.4.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.
Files changed (58) hide show
  1. package/README.md +61 -59
  2. package/dist/cli.js +47 -9
  3. package/dist/index.d.ts +32 -1
  4. package/dist/index.js +73 -4
  5. package/dist/mcp/export.d.ts +13 -0
  6. package/dist/mcp/export.js +76 -0
  7. package/dist/mcp/schemas/compile_fractals.json +20 -0
  8. package/dist/mcp/schemas/css_to_fractals.json +16 -0
  9. package/dist/mcp/schemas/generate_component.json +45 -0
  10. package/dist/mcp/schemas/get_design_tokens.json +23 -0
  11. package/dist/mcp/schemas/instructions.md +18 -0
  12. package/dist/mcp/schemas/list_fractals.json +20 -0
  13. package/dist/mcp/schemas/snap_to_tokens.json +25 -0
  14. package/dist/mcp/schemas/validate_recipe.json +16 -0
  15. package/dist/mcp/server.js +28 -12
  16. package/dist/styles/{_tokens.sass → _00_tokens.sass} +75 -64
  17. package/dist/styles/{_config.sass → _01_config.sass} +28 -36
  18. package/dist/styles/_02_fonts.sass +13 -0
  19. package/dist/styles/_03_responsive.sass +31 -0
  20. package/dist/styles/{_atoms.sass → _04_atoms.sass} +4 -4
  21. package/{templates/_molecules.sass → dist/styles/_05_molecules.sass} +16 -12
  22. package/dist/styles/_06_recipes.sass +189 -0
  23. package/dist/styles/{_base.sass → _07_base.sass} +3 -2
  24. package/dist/styles/_08_blocks.sass +433 -0
  25. package/dist/styles/_09_utilities.sass +208 -0
  26. package/dist/styles/_10_layouts.sass +373 -0
  27. package/dist/styles/_11_own.sass +21 -0
  28. package/dist/styles/_fractals.sass +7 -6
  29. package/dist/styles/index.sass +14 -16
  30. package/mcp.json +11 -0
  31. package/package.json +6 -3
  32. package/plugin.json +22 -0
  33. package/skills/fractal-styler/SKILL.md +83 -0
  34. package/skills/fractal-styler/references/fractals.md +28 -0
  35. package/skills/fractal-styler/references/tokens.md +36 -0
  36. package/skills/style-migration/SKILL.md +45 -0
  37. package/templates/{_tokens.sass → _00_tokens.sass} +73 -64
  38. package/templates/{_config.sass → _01_config.sass} +24 -36
  39. package/templates/_02_fonts.sass +13 -0
  40. package/templates/_03_responsive.sass +31 -0
  41. package/templates/{_atoms.sass → _04_atoms.sass} +4 -4
  42. package/{dist/styles/_molecules.sass → templates/_05_molecules.sass} +16 -12
  43. package/templates/_06_recipes.sass +189 -0
  44. package/templates/{_base.sass → _07_base.sass} +3 -2
  45. package/templates/_08_blocks.sass +433 -0
  46. package/templates/_09_utilities.sass +207 -0
  47. package/templates/_10_layouts.sass +373 -0
  48. package/templates/_11_own.sass +21 -0
  49. package/templates/_fractals.sass +7 -6
  50. package/templates/index.sass +14 -16
  51. package/dist/styles/_blocks.sass +0 -88
  52. package/dist/styles/_layouts.sass +0 -108
  53. package/dist/styles/_responsive.sass +0 -43
  54. package/dist/styles/_utilities.sass +0 -125
  55. package/templates/_blocks.sass +0 -88
  56. package/templates/_layouts.sass +0 -108
  57. package/templates/_responsive.sass +0 -43
  58. package/templates/_utilities.sass +0 -125
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "snap_to_tokens",
3
+ "description": "Takes raw pixel values (e.g. from canvas elements in OpenDesign / Figma) and snaps them to the nearest fractalstyler2 design tokens, CSS variables, and suggested mixins.",
4
+ "parameters": {
5
+ "type": "object",
6
+ "properties": {
7
+ "gap": {
8
+ "type": "number",
9
+ "description": "Gap in pixels (e.g. 16)"
10
+ },
11
+ "padding": {
12
+ "type": "number",
13
+ "description": "Padding in pixels (e.g. 24)"
14
+ },
15
+ "radius": {
16
+ "type": "number",
17
+ "description": "Border radius in pixels (e.g. 10)"
18
+ },
19
+ "fontSize": {
20
+ "type": "number",
21
+ "description": "Font size in pixels (e.g. 18)"
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "validate_recipe",
3
+ "description": "Lints a SASS snippet or Svelte component against fractalstyler2 golden rules (flags legacy v1 classes like gap8/pad16, hardcoded pixels, modifier classes).",
4
+ "parameters": {
5
+ "type": "object",
6
+ "properties": {
7
+ "code": {
8
+ "type": "string",
9
+ "description": "The SASS or Svelte code to validate."
10
+ }
11
+ },
12
+ "required": [
13
+ "code"
14
+ ]
15
+ }
16
+ }
@@ -11,7 +11,7 @@ import * as sass from 'sass';
11
11
  import { existsSync, readFileSync } from 'node:fs';
12
12
  import { dirname, join } from 'node:path';
13
13
  import { fileURLToPath } from 'node:url';
14
- const VERSION = '0.1.0';
14
+ const VERSION = '0.3.0';
15
15
  // Resolve styles directory for SASS compiler loadPaths
16
16
  function getStylesDir() {
17
17
  const HERE = dirname(fileURLToPath(import.meta.url));
@@ -23,7 +23,7 @@ function getStylesDir() {
23
23
  join(process.cwd(), 'templates')
24
24
  ];
25
25
  for (const candidate of candidates) {
26
- if (existsSync(candidate) && existsSync(join(candidate, '_tokens.sass'))) {
26
+ if (existsSync(candidate) && existsSync(join(candidate, '_00_tokens.sass'))) {
27
27
  return candidate;
28
28
  }
29
29
  }
@@ -93,10 +93,11 @@ const DESIGN_TOKENS = {
93
93
  }
94
94
  },
95
95
  radius: {
96
- steps: ['0', '2', '4', '6', '8', '12', '16', '24', 'full'],
96
+ steps: ['0', '2', '3', '4', '6', '8', '12', '16', '24', 'full'],
97
97
  values: {
98
98
  '0': '0px',
99
99
  '2': '2px',
100
+ '3': '3px',
100
101
  '4': '4px',
101
102
  '6': '6px',
102
103
  '8': '8px',
@@ -114,13 +115,22 @@ const DESIGN_TOKENS = {
114
115
  surfaces: {
115
116
  bg: 'var(--bg)',
116
117
  surface: 'var(--bg-surface)',
117
- raised: 'var(--bg-raised)'
118
+ raised: 'var(--bg-raised)',
119
+ panel: 'var(--bg-panel)',
120
+ footer: 'var(--bg-footer)',
121
+ popover: 'var(--bg-popover)',
122
+ dialog: 'var(--bg-dialog)',
123
+ terminal: 'var(--bg-terminal)',
124
+ input: 'var(--bg-input)',
125
+ canvas: 'var(--bg-canvas)'
118
126
  },
119
127
  ink: {
120
128
  primary: 'var(--text-primary)',
121
129
  secondary: 'var(--text-secondary)',
122
130
  muted: 'var(--text-muted)',
123
- inverse: 'var(--text-inverse)'
131
+ inverse: 'var(--text-inverse)',
132
+ themeColor: 'var(--theme-color)',
133
+ themeColorAlt: 'var(--theme-color-alt)'
124
134
  },
125
135
  brand: {
126
136
  theme: 'var(--theme)',
@@ -158,10 +168,10 @@ const FRACTAL_CATALOG = {
158
168
  { name: 'grow', signature: '+grow($n: 1)', description: 'Sets flex-grow.' },
159
169
  { name: 'shrink', signature: '+shrink($n: 0)', description: 'Sets flex-shrink.' },
160
170
  { name: 'min0', signature: '+min0', description: 'Sets min-width: 0 and min-height: 0 to prevent overflow.' },
161
- { name: 'bg', signature: '+bg($role: surface)', description: 'Sets background-color to bg, surface, or raised.' },
162
- { name: 'ink', signature: '+ink($role: primary)', description: 'Sets text color to primary, secondary, muted, or inverse.' },
171
+ { name: 'bg', signature: '+bg($role: surface)', description: 'Sets background-color to any of the 21 surface tokens.' },
172
+ { name: 'ink', signature: '+ink($role: primary)', description: 'Sets text color to primary, secondary, muted, inverse, theme-color, theme-color-alt.' },
163
173
  { name: 'border', signature: '+border($side: all, $color: var(--border))', description: 'Applies 1px solid border on all sides or a specific side.' },
164
- { name: 'radius', signature: '+radius($v: 12)', description: 'Applies border-radius from radius token or raw px.' },
174
+ { name: 'radius', signature: '+radius($v: 6)', description: 'Applies border-radius from radius token or raw px.' },
165
175
  { name: 'shadow', signature: '+shadow($v: md)', description: 'Applies box-shadow from shadow scale (sm, md, lg).' },
166
176
  { name: 'type', signature: '+type($v)', description: 'Applies font-size from fluid type scale (xs..4xl).' },
167
177
  { name: 'weight', signature: '+weight($w: 500)', description: 'Sets font-weight.' },
@@ -179,9 +189,15 @@ const FRACTAL_CATALOG = {
179
189
  { name: 'frame', signature: '+frame($ratio: 16 / 9)', description: 'Aspect-ratio container for media (images, video, iframe).' },
180
190
  { name: 'reel', signature: '+reel($gap: xs)', description: 'Horizontal scroll-snap rail.' },
181
191
  { name: 'with-sidebar', signature: '+with-sidebar($rail: 240px, $gap: s, $min: 60%)', description: 'Intrinsic sidebar and fluid main content.' },
182
- { name: 'surface', signature: '+surface($bg: surface, $pad: s, $radius: 12, $elevation: none)', description: 'All-in-one material fractal: skin, border, radius, pad, and elevation.' },
192
+ { name: 'surface', signature: '+surface($bg: surface, $pad: null, $radius: 6, $elevation: none)', description: 'All-in-one material fractal: skin, radius, pad, and elevation.' },
183
193
  { name: 'cols', signature: '+cols($map, $gap: s)', description: 'Responsive column grid mapped across breakpoints, e.g. (base: 1, sm: 2, lg: 3).' }
184
194
  ],
195
+ recipes: [
196
+ { name: 'card', signature: '+card($bg: surface, $pad: null, $radius: 6, $elevation: none)', description: 'Vertical card container recipe with optional pad and elevation.' },
197
+ { name: 'control', signature: '+control($size: md, $radius: 4)', description: 'Universal interactive control recipe (buttons, triggers, inputs).' },
198
+ { name: 'select', signature: '+select($size: md, $radius: 4)', description: 'Select input recipe with embedded SVG chevron.' },
199
+ { name: 'badge', signature: '+badge($radius: 4)', description: 'Compact status badge recipe.' }
200
+ ],
185
201
  layouts: [
186
202
  { name: 'grid-3', class: '.grid-3', description: 'Responsive 1 → 2 → 3 column reflow.' },
187
203
  { name: 'card-grid', class: '.card-grid', description: 'Intrinsic auto-fit grid for cards.' },
@@ -195,8 +211,8 @@ const FRACTAL_CATALOG = {
195
211
  const GUIDELINES = `
196
212
  # fractalstyler2 Design System Rules
197
213
 
198
- 1. Never hardcode a value that a token covers (+gap(m), +radius(12), +bg(surface)).
199
- 2. Compose fractals (+surface, +stack, +cluster); write raw CSS only for genuinely unique lines.
214
+ 1. Never hardcode a value that a token covers (+gap(m), +radius(6), +bg(surface)).
215
+ 2. Compose fractals (+surface, +stack, +cluster, +card); write raw CSS only for genuinely unique lines.
200
216
  3. Express component state on data-* / aria-* attributes, never modifier classes (e.g. &[data-elevated], &[data-variant='ghost']).
201
217
  4. Markup stays thin and semantic: prefer clean tags (<article class="card">) over utility class soup.
202
218
  5. Mobile-first: define base styles first, then grow with +at(md/lg/xl) or +cols().
@@ -332,7 +348,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
332
348
  properties: {
333
349
  tier: {
334
350
  type: 'string',
335
- enum: ['all', 'atoms', 'molecules', 'layouts'],
351
+ enum: ['all', 'atoms', 'molecules', 'recipes', 'layouts'],
336
352
  description: 'Filter by fractal tier.'
337
353
  }
338
354
  }
@@ -1,16 +1,70 @@
1
1
  // =============================================================================
2
- // TOKENS — the only place literal values live. Everything else is a fractal
3
- // that consumes these custom properties. Light is the marker-free default so
4
- // tokens stay defined during SSR and with JS disabled; dark comes from
5
- // prefers-color-scheme and from an explicit [data-mode='dark'].
2
+ // 00_TOKENS — the single source of truth for runtime CSS custom properties.
3
+ // -----------------------------------------------------------------------------
4
+ // Light is the marker-free default so tokens stay defined during SSR and with
5
+ // JS disabled; dark comes from prefers-color-scheme and explicit [data-mode='dark'].
6
6
  // =============================================================================
7
7
 
8
+ =light-theme-tokens
9
+ color-scheme: light
10
+ --bg: #fdfefe
11
+ --bg-surface: #f8f7f7
12
+ --bg-raised: #f1f5f9
13
+ --bg-panel: #F1F3F5
14
+ --bg-footer: #E9ECEF
15
+ --bg-popover: #FFFFFF
16
+ --bg-dialog: #FFFFFF
17
+ --bg-terminal: #0F172A
18
+ --bg-input: #FFFFFF
19
+ --bg-canvas: #F8F9FA
20
+ --text-primary: #0f172a
21
+ --text-secondary: #5b6472
22
+ --text-muted: #929497
23
+ --text-inverse: #ffffff
24
+ --state-hover: #E2E8F0
25
+ --state-hover-subtle: #F1F5F9
26
+ --state-selected: #CBD5E1
27
+ --border: #E2E8F0
28
+ --border-subtle: #EDF2F7
29
+ --theme-color: #04825B
30
+ --theme-color-alt: #047857
31
+ --theme: var(--theme-color)
32
+ --theme-hover: var(--theme-color-alt)
33
+ --ring: rgba(0, 127, 78, 0.35)
34
+
35
+ =dark-theme-tokens
36
+ color-scheme: dark
37
+ --bg: #0E1118
38
+ --bg-surface: #141824
39
+ --bg-raised: #1C2232
40
+ --bg-panel: #101420
41
+ --bg-footer: #0B0D14
42
+ --bg-popover: #20273A
43
+ --bg-dialog: #20273A
44
+ --bg-terminal: #080A0F
45
+ --bg-input: #121622
46
+ --bg-canvas: #0E1118
47
+ --border: #28324A
48
+ --border-subtle: #1E2538
49
+ --text-primary: #EDF2F7
50
+ --text-secondary: #9BB0C7
51
+ --text-muted: #5D7087
52
+ --state-hover: #263047
53
+ --state-hover-subtle: #1B2233
54
+ --state-selected: #32405E
55
+ --theme-color: #38BDF8
56
+ --theme-color-alt: #0EA5E9
57
+ --theme: var(--theme-color)
58
+ --theme-hover: var(--theme-color-alt)
59
+ --text-inverse: #0E1118
60
+ --ring: rgba(16, 185, 129, 0.4)
61
+
8
62
  :root
9
63
  color-scheme: light
10
64
 
11
65
  // Fonts
12
- --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif
13
- --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace
66
+ --font-sans: "Google Sans Flex", sans-serif
67
+ --font-mono: "JetBrains Mono", monospace
14
68
 
15
69
  // Fluid type scale (Utopia 360→1240)
16
70
  --text-xs: 0.75rem
@@ -34,9 +88,10 @@
34
88
  --space-3xl: clamp(6.75rem, 6.4432rem + 1.3636vw, 7.5rem)
35
89
  --space-s-l: clamp(1.125rem, 0.5625rem + 2.5vw, 2.5rem)
36
90
 
37
- // Radius
91
+ // Radius (Concentric hierarchy)
38
92
  --radius-0: 0
39
93
  --radius-2: 2px
94
+ --radius-3: 3px
40
95
  --radius-4: 4px
41
96
  --radius-6: 6px
42
97
  --radius-8: 8px
@@ -45,6 +100,11 @@
45
100
  --radius-24: 24px
46
101
  --radius-full: 9999px
47
102
 
103
+ // Control Heights
104
+ --control-h-sm: 26px
105
+ --control-h-md: 32px
106
+ --control-h-lg: 38px
107
+
48
108
  // Shadow
49
109
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06)
50
110
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08)
@@ -58,70 +118,21 @@
58
118
  --z-toast: 300
59
119
 
60
120
  // Layout
61
- --header-height: 64px
121
+ --header-height: 48px
62
122
  --footer-height: 56px
63
123
  --measure: 65ch
64
124
 
65
- // Light palette (marker-free default)
66
- --bg: #fdfefe
67
- --bg-surface: #f8f7f7
68
- --bg-raised: #f1f5f9
69
- --text-primary: #0f172a
70
- --text-secondary: #5b6472
71
- --text-muted: #929497
72
- --text-inverse: #ffffff
73
- --border: #e2e8f0
74
- --border-strong: #cbd5e1
75
- --theme: #007f4e
76
- --theme-hover: #00663f
77
- --theme-active: #005031
78
- --ring: rgba(0, 127, 78, 0.35)
125
+ // Default Light Palette
126
+ +light-theme-tokens
79
127
 
80
128
  @media (prefers-color-scheme: dark)
81
129
  :root:not([data-mode='light'])
82
- color-scheme: dark
83
- --bg: #131313
84
- --bg-surface: #1e1e1e
85
- --bg-raised: #2b2b2b
86
- --text-primary: #f9fafb
87
- --text-secondary: #a7adb7
88
- --text-muted: #6b7280
89
- --text-inverse: #0b0f17
90
- --border: #2f3030
91
- --border-strong: #4a4b4b
92
- --theme: #10b981
93
- --theme-hover: #34d399
94
- --theme-active: #059669
95
- --ring: rgba(16, 185, 129, 0.4)
130
+ +dark-theme-tokens
96
131
 
97
132
  [data-mode='dark']
98
- color-scheme: dark
99
- --bg: #131313
100
- --bg-surface: #1e1e1e
101
- --bg-raised: #2b2b2b
102
- --text-primary: #f9fafb
103
- --text-secondary: #a7adb7
104
- --text-muted: #6b7280
105
- --text-inverse: #0b0f17
106
- --border: #2f3030
107
- --border-strong: #4a4b4b
108
- --theme: #10b981
109
- --theme-hover: #34d399
110
- --theme-active: #059669
111
- --ring: rgba(16, 185, 129, 0.4)
133
+ +dark-theme-tokens
112
134
 
113
135
  [data-mode='light']
114
- color-scheme: light
115
- --bg: #fdfefe
116
- --bg-surface: #f8f7f7
117
- --bg-raised: #f1f5f9
118
- --text-primary: #0f172a
119
- --text-secondary: #5b6472
120
- --text-muted: #929497
121
- --text-inverse: #ffffff
122
- --border: #e2e8f0
123
- --border-strong: #cbd5e1
124
- --theme: #007f4e
125
- --theme-hover: #00663f
126
- --theme-active: #005031
127
- --ring: rgba(0, 127, 78, 0.35)
136
+ +light-theme-tokens
137
+
138
+
@@ -1,5 +1,5 @@
1
1
  // =============================================================================
2
- // CONFIG — the finite vocabulary every fractal draws from.
2
+ // 01_CONFIG — the finite vocabulary every fractal draws from.
3
3
  // -----------------------------------------------------------------------------
4
4
  // Scales live here as Sass data; resolvers turn a keyword-or-raw value into the
5
5
  // right token var() or unit. Fractals never hardcode a px or a token name —
@@ -11,68 +11,60 @@
11
11
  @use 'sass:meta'
12
12
  @use 'sass:list'
13
13
 
14
- // --- Scales (mirror the custom properties in _tokens.sass) --------------------
14
+ // --- Scales (mirror the custom properties in _00_tokens.sass) ----------------
15
15
  $breakpoints: (sm: 640px, md: 768px, lg: 1024px, xl: 1240px)
16
16
 
17
17
  $space-steps: 3xs 2xs xs s m l xl 2xl 3xl s-l
18
- $radius-steps: 0 2 4 6 8 12 16 24 full
18
+ $radius-steps: 0 2 3 4 6 8 12 16 24 full
19
19
  $text-steps: xs sm md lg xl 2xl 3xl 4xl
20
20
  $shadow-steps: sm md lg
21
- $surface-roles: bg surface raised
22
- $ink-roles: primary secondary muted inverse
21
+
22
+ // Surfaces mapped to the 21 theme token contract
23
+ $surface-roles: bg surface raised panel footer popover dialog terminal input canvas
24
+ $ink-roles: primary secondary muted inverse theme-color theme-color-alt
23
25
 
24
26
  $align-map: (start: flex-start, end: flex-end, center: center, between: space-between, around: space-around, evenly: space-evenly, stretch: stretch, baseline: baseline)
25
27
 
28
+ // --- Universal Token Resolver --------------------------------------------------
29
+ @function tok($group, $v)
30
+ @if $v == null
31
+ @return null
32
+ @if meta.type-of($v) == number
33
+ @if math.is-unitless($v)
34
+ @return #{$v}px
35
+ @else
36
+ @return $v
37
+ @if meta.type-of($v) == string
38
+ @return var(--#{$group}-#{$v})
39
+ @return $v
40
+
26
41
  // --- Resolvers ----------------------------------------------------------------
27
42
 
28
- // space(m) → var(--space-m) | space(18) → 18px | space(2rem) → 2rem
29
43
  @function space($v)
30
- @if $v == null
31
- @return null
32
- @else if list.index($space-steps, $v)
33
- @return var(--space-#{$v})
34
- @else if meta.type-of($v) == number and math.is-unitless($v)
35
- @return #{$v}px
36
- @else
37
- @return $v
44
+ @return tok(space, $v)
38
45
 
39
46
  @function radius($v)
40
- @if list.index($radius-steps, $v)
41
- @return var(--radius-#{$v})
42
- @else if meta.type-of($v) == number and math.is-unitless($v)
43
- @return #{$v}px
44
- @else
45
- @return $v
47
+ @return tok(radius, $v)
46
48
 
47
49
  @function text-size($v)
48
- @if list.index($text-steps, $v)
49
- @return var(--text-#{$v})
50
- @else
51
- @return $v
50
+ @return tok(text, $v)
52
51
 
53
52
  @function shadow($v)
54
- @if list.index($shadow-steps, $v)
55
- @return var(--shadow-#{$v})
56
- @else
57
- @return $v
53
+ @return tok(shadow, $v)
58
54
 
59
55
  @function surface($role)
60
56
  @if $role == bg
61
57
  @return var(--bg)
62
- @else
63
- @return var(--bg-#{$role})
58
+ @return tok(bg, $role)
64
59
 
65
60
  @function ink($role)
66
61
  @if $role == primary
67
62
  @return var(--text-primary)
68
- @else
69
- @return var(--text-#{$role})
63
+ @return tok(text, $role)
70
64
 
71
65
  @function align($v)
72
- $m: map.get($align-map, $v)
73
- @if $m
74
- @return $m
75
- @return $v
66
+ @return map.get($align-map, $v) or $v
76
67
 
77
68
  @function bp($name)
78
69
  @return map.get($breakpoints, $name)
70
+
@@ -0,0 +1,13 @@
1
+ // =============================================================================
2
+ // 02_FONTS — local webfont declarations & font-family fallbacks.
3
+ // -----------------------------------------------------------------------------
4
+ // Downstream projects customize their font loading here.
5
+ // =============================================================================
6
+
7
+ // Define custom @font-face rules or load Google / local webfonts as needed:
8
+ // @font-face
9
+ // font-family: 'YourFont'
10
+ // src: url('/fonts/YourFont.woff2') format('woff2')
11
+ // font-weight: 100 900
12
+ // font-style: normal
13
+ // font-display: swap
@@ -0,0 +1,31 @@
1
+ // =============================================================================
2
+ // 03_RESPONSIVE — the breakpoint mixins. Viewport-aware conditional styling.
3
+ // -----------------------------------------------------------------------------
4
+ // Mobile-first defaults; use +at($bp) for min-width media queries.
5
+ // =============================================================================
6
+
7
+ @use '01_config' as *
8
+
9
+ =at($bp)
10
+ $width: bp($bp)
11
+ @if $width
12
+ @media (min-width: $width)
13
+ @content
14
+ @else
15
+ @media (min-width: $bp)
16
+ @content
17
+
18
+ =below($bp)
19
+ $width: bp($bp)
20
+ @if $width
21
+ @media (max-width: ($width - 1px))
22
+ @content
23
+ @else
24
+ @media (max-width: $bp)
25
+ @content
26
+
27
+ =between($min-bp, $max-bp)
28
+ $min: bp($min-bp)
29
+ $max: bp($max-bp)
30
+ @media (min-width: $min) and (max-width: ($max - 1px))
31
+ @content
@@ -1,11 +1,11 @@
1
1
  // =============================================================================
2
- // ATOM FRACTALS — the indivisible units. One visual decision each.
2
+ // 04_ATOMS — the indivisible units. One visual decision each.
3
3
  // -----------------------------------------------------------------------------
4
4
  // Every atom is a mixin. Call it inside a class to compose, or let
5
- // _utilities.sass project it to a utility class. Same fractal, two consumers.
5
+ // _09_utilities.sass project it to a utility class. Same fractal, two consumers.
6
6
  // =============================================================================
7
7
 
8
- @use 'config' as *
8
+ @use '01_config' as *
9
9
 
10
10
  // --- Flow: the two axes of layout ------------------------------------------
11
11
  // A box is a vertical stack, a row is horizontal. Optional semantic alignment:
@@ -102,7 +102,7 @@
102
102
  @else
103
103
  border-#{$side}: 1px solid $color
104
104
 
105
- =radius($v: 12)
105
+ =radius($v: 4)
106
106
  border-radius: radius($v)
107
107
 
108
108
  =shadow($v: md)
@@ -1,14 +1,15 @@
1
1
  // =============================================================================
2
- // MOLECULE FRACTALS — self-similar: each is a small graph of atom fractals.
2
+ // 05_MOLECULES — self-similar: each is a small graph of atom fractals.
3
3
  // -----------------------------------------------------------------------------
4
4
  // This is the payoff of the model. A molecule reads like a recipe of atoms,
5
5
  // and a component (next layer up) reads like a recipe of molecules. Same move
6
6
  // at every scale — that is the "fractal" in fractalstyler2.
7
7
  // =============================================================================
8
8
 
9
- @use 'config' as *
10
- @use 'atoms' as *
11
- @use 'responsive' as *
9
+ @use 'sass:string'
10
+ @use '01_config' as *
11
+ @use '04_atoms' as *
12
+ @use '03_responsive' as *
12
13
 
13
14
  // Stack — vertical rhythm with one shared gap.
14
15
  =stack($gap: xs, $x: null)
@@ -38,11 +39,13 @@
38
39
  +my-auto
39
40
 
40
41
  // Frame — fixed aspect-ratio media box.
41
- =frame($ratio: 16 / 9)
42
- aspect-ratio: $ratio
42
+ =frame($ratio: '16 / 9')
43
+ aspect-ratio: string.unquote('#{$ratio}')
43
44
  overflow: hidden
44
- > :is(img, video, iframe)
45
+ position: relative
46
+ > *
45
47
  +full
48
+ > :is(img, video, iframe)
46
49
  object-fit: cover
47
50
 
48
51
  // Reel — horizontal scroll-snap rail.
@@ -69,13 +72,14 @@
69
72
  flex-grow: 999
70
73
  min-width: $min
71
74
 
72
- // Surface — the "material" fractal: skin + elevation in one call.
75
+ // Surface — the "material" fractal: skin + border + optional radius + optional padding + elevation.
73
76
  // The building block of every card/panel/popover.
74
- =surface($bg: surface, $pad: s, $radius: 12, $elevation: none)
77
+ =surface($bg: surface, $pad: null, $radius: 6, $elevation: none)
75
78
  +bg($bg)
76
- +border
77
- +radius($radius)
78
- +pad($pad)
79
+ @if $radius != null
80
+ +radius($radius)
81
+ @if $pad != null
82
+ +pad($pad)
79
83
  @if $elevation != none
80
84
  +shadow($elevation)
81
85