fractalstyler2 0.0.2 → 0.3.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 (59) hide show
  1. package/README.md +60 -45
  2. package/dist/cli.js +54 -11
  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.d.ts +7 -0
  16. package/dist/mcp/server.js +837 -0
  17. package/dist/styles/_00_tokens.sass +177 -0
  18. package/{templates/_config.sass → dist/styles/_01_config.sass} +11 -5
  19. package/dist/styles/_02_fonts.sass +13 -0
  20. package/dist/styles/_03_responsive.sass +31 -0
  21. package/dist/styles/{_atoms.sass → _04_atoms.sass} +4 -4
  22. package/{templates/_molecules.sass → dist/styles/_05_molecules.sass} +16 -12
  23. package/dist/styles/_06_recipes.sass +189 -0
  24. package/dist/styles/{_base.sass → _07_base.sass} +3 -2
  25. package/dist/styles/_08_blocks.sass +433 -0
  26. package/dist/styles/{_utilities.sass → _09_utilities.sass} +96 -16
  27. package/dist/styles/_10_layouts.sass +373 -0
  28. package/dist/styles/_11_own.sass +21 -0
  29. package/dist/styles/_fractals.sass +7 -6
  30. package/dist/styles/index.sass +14 -16
  31. package/mcp.json +11 -0
  32. package/package.json +14 -6
  33. package/plugin.json +22 -0
  34. package/skills/fractal-styler/SKILL.md +83 -0
  35. package/skills/fractal-styler/references/fractals.md +28 -0
  36. package/skills/fractal-styler/references/tokens.md +36 -0
  37. package/skills/style-migration/SKILL.md +45 -0
  38. package/templates/_00_tokens.sass +177 -0
  39. package/{dist/styles/_config.sass → templates/_01_config.sass} +11 -5
  40. package/templates/_02_fonts.sass +13 -0
  41. package/templates/_03_responsive.sass +31 -0
  42. package/templates/{_atoms.sass → _04_atoms.sass} +4 -4
  43. package/{dist/styles/_molecules.sass → templates/_05_molecules.sass} +16 -12
  44. package/templates/_06_recipes.sass +189 -0
  45. package/templates/{_base.sass → _07_base.sass} +3 -2
  46. package/templates/_08_blocks.sass +433 -0
  47. package/templates/{_utilities.sass → _09_utilities.sass} +96 -16
  48. package/templates/_10_layouts.sass +373 -0
  49. package/templates/_11_own.sass +21 -0
  50. package/templates/_fractals.sass +7 -6
  51. package/templates/index.sass +14 -16
  52. package/dist/styles/_blocks.sass +0 -88
  53. package/dist/styles/_layouts.sass +0 -108
  54. package/dist/styles/_responsive.sass +0 -43
  55. package/dist/styles/_tokens.sass +0 -127
  56. package/templates/_blocks.sass +0 -88
  57. package/templates/_layouts.sass +0 -108
  58. package/templates/_responsive.sass +0 -43
  59. package/templates/_tokens.sass +0 -127
@@ -1,127 +0,0 @@
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'].
6
- // =============================================================================
7
-
8
- :root
9
- color-scheme: light
10
-
11
- // 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
14
-
15
- // Fluid type scale (Utopia 360→1240)
16
- --text-xs: 0.75rem
17
- --text-sm: clamp(0.9375rem, 0.9119rem + 0.1136vw, 1rem)
18
- --text-md: clamp(1.125rem, 1.0739rem + 0.2273vw, 1.25rem)
19
- --text-lg: clamp(1.35rem, 1.2631rem + 0.3864vw, 1.5625rem)
20
- --text-xl: clamp(1.62rem, 1.4837rem + 0.6057vw, 1.9531rem)
21
- --text-2xl: clamp(1.944rem, 1.7405rem + 0.9044vw, 2.4414rem)
22
- --text-3xl: clamp(2.3328rem, 2.0387rem + 1.3072vw, 3.0518rem)
23
- --text-4xl: clamp(2.7994rem, 2.384rem + 1.8461vw, 3.8147rem)
24
-
25
- // Fluid space scale
26
- --space-3xs: clamp(0.3125rem, 0.3125rem + 0vw, 0.3125rem)
27
- --space-2xs: clamp(0.5625rem, 0.5369rem + 0.1136vw, 0.625rem)
28
- --space-xs: clamp(0.875rem, 0.8494rem + 0.1136vw, 0.9375rem)
29
- --space-s: clamp(1.125rem, 1.0739rem + 0.2273vw, 1.25rem)
30
- --space-m: clamp(1.6875rem, 1.6108rem + 0.3409vw, 1.875rem)
31
- --space-l: clamp(2.25rem, 2.1477rem + 0.4545vw, 2.5rem)
32
- --space-xl: clamp(3.375rem, 3.2216rem + 0.6818vw, 3.75rem)
33
- --space-2xl: clamp(4.5rem, 4.2955rem + 0.9091vw, 5rem)
34
- --space-3xl: clamp(6.75rem, 6.4432rem + 1.3636vw, 7.5rem)
35
- --space-s-l: clamp(1.125rem, 0.5625rem + 2.5vw, 2.5rem)
36
-
37
- // Radius
38
- --radius-0: 0
39
- --radius-2: 2px
40
- --radius-4: 4px
41
- --radius-6: 6px
42
- --radius-8: 8px
43
- --radius-12: 12px
44
- --radius-16: 16px
45
- --radius-24: 24px
46
- --radius-full: 9999px
47
-
48
- // Shadow
49
- --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06)
50
- --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08)
51
- --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12)
52
-
53
- // Layering
54
- --z-base: 0
55
- --z-raised: 10
56
- --z-sticky: 100
57
- --z-modal: 200
58
- --z-toast: 300
59
-
60
- // Layout
61
- --header-height: 64px
62
- --footer-height: 56px
63
- --measure: 65ch
64
-
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)
79
-
80
- @media (prefers-color-scheme: dark)
81
- :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)
96
-
97
- [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)
112
-
113
- [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)
@@ -1,88 +0,0 @@
1
- // =============================================================================
2
- // BLOCKS — components as recipes of fractals. Note how little CSS is here:
3
- // each block is a handful of fractal calls plus its own genuinely-unique lines.
4
- // State is expressed with data-*/aria-*, never modifier classes.
5
- // =============================================================================
6
-
7
- @use 'fractals' as *
8
-
9
- .card
10
- +surface(surface, s, 12)
11
- +stack(s)
12
- &[data-elevated]
13
- +shadow(md)
14
-
15
- .panel
16
- +surface(raised, m, 16)
17
- +stack(m)
18
-
19
- .badge
20
- +row(center, center)
21
- display: inline-flex
22
- +px(2xs)
23
- +type(xs)
24
- +weight(500)
25
- +radius(full)
26
- +bg(raised)
27
- +ink(secondary)
28
- padding-block: 2px
29
-
30
- .avatar
31
- +center
32
- +square(var(--avatar-size, 40px))
33
- +radius(full)
34
- +bg(raised)
35
- +ink(secondary)
36
- overflow: hidden
37
-
38
- .input
39
- display: block
40
- +w(100%)
41
- +px(2xs)
42
- +type(md)
43
- +leading(1.5)
44
- +border
45
- +radius(6)
46
- +bg(bg)
47
- +ink(primary)
48
- padding-block: 8px
49
- &:focus-visible
50
- +ring
51
-
52
- .button
53
- +row(center, center)
54
- +gap(2xs)
55
- +px(s)
56
- +radius(6)
57
- +weight(500)
58
- +transition(background-color)
59
- cursor: pointer
60
- padding-block: 8px
61
- user-select: none
62
- // Exceptions: variants live on data-variant, not in the class name.
63
- &[data-variant='primary']
64
- background: var(--theme)
65
- color: var(--text-inverse)
66
- &:hover
67
- background: var(--theme-hover)
68
- &[data-variant='ghost']
69
- background: transparent
70
- +ink(secondary)
71
- &:hover
72
- +bg(raised)
73
-
74
- .divider
75
- border: none
76
- +border(top)
77
- margin-block: space(s)
78
-
79
- .kbd
80
- display: inline-block
81
- +px(3xs)
82
- +type(xs)
83
- +leading(1)
84
- +radius(4)
85
- +bg(raised)
86
- border: 1px solid var(--border-strong)
87
- font-family: var(--font-mono)
88
- padding-block: 2px
@@ -1,108 +0,0 @@
1
- // =============================================================================
2
- // LAYOUTS — the largest fractals. Same recipe move, page scale.
3
- // These are the concrete deliverables you named: a responsive 3-col grid, a
4
- // hero, a holy-grail, a docs template. Each is a short composition of fractals.
5
- // =============================================================================
6
-
7
- @use 'fractals' as *
8
-
9
- // 1. Responsive grid of 3 columns — 1 → 2 → 3 across breakpoints.
10
- .grid-3
11
- +cols((base: 1, sm: 2, lg: 3), m)
12
-
13
- // A grid that never needs breakpoints: it fits as many columns as will hold
14
- // the min track. Reach for this before .grid-3 when column count is negotiable.
15
- .card-grid
16
- +auto-grid(16rem, m)
17
-
18
- // 2. Hero — full-viewport cover with a centered, measured message.
19
- .hero
20
- +cover(80vh, xl)
21
- > .center
22
- +stack(m, center)
23
- text-align: center
24
- max-width: 45ch
25
-
26
- // 3. Holy grail — header / (nav · main · aside) / footer.
27
- .holy-grail
28
- display: grid
29
- min-height: 100vh
30
- grid-template-rows: auto 1fr auto
31
- grid-template-areas: 'header' 'main' 'footer'
32
- > .hg-header
33
- grid-area: header
34
- > .hg-footer
35
- grid-area: footer
36
- > .hg-body
37
- grid-area: main
38
- display: grid
39
- grid-template-columns: 1fr
40
- +gap(m)
41
- +pad(m)
42
- +at(lg)
43
- > .hg-body
44
- grid-template-columns: var(--nav-w, 220px) minmax(0, 1fr) var(--aside-w, 260px)
45
- > .hg-nav
46
- +sticky(var(--space-m))
47
- align-self: start
48
- > .hg-aside
49
- +sticky(var(--space-m))
50
- align-self: start
51
-
52
- // 4. Docs template — sidebar nav + reading column + on-page TOC.
53
- .docs
54
- display: grid
55
- min-height: 100vh
56
- grid-template-columns: 1fr
57
- > .docs-nav
58
- display: none
59
- > .docs-toc
60
- display: none
61
- > .docs-main
62
- +min0
63
- +stack(m)
64
- +center-column(72ch, s-l)
65
- +py(l)
66
- +at(md)
67
- grid-template-columns: var(--docs-nav-w, 240px) minmax(0, 1fr)
68
- > .docs-nav
69
- +box
70
- +sticky(0)
71
- +py(l)
72
- +px(s)
73
- height: 100vh
74
- overflow-y: auto
75
- +border(right)
76
- +at(xl)
77
- grid-template-columns: var(--docs-nav-w, 240px) minmax(0, 1fr) var(--docs-toc-w, 220px)
78
- > .docs-toc
79
- +box
80
- +sticky(0)
81
- +py(l)
82
- +px(s)
83
- height: 100vh
84
- overflow-y: auto
85
- +ink(secondary)
86
-
87
- // 5. App shell — sticky header, fluid body, footer. The frame most apps live in.
88
- .app-shell
89
- +box
90
- +relative
91
- isolation: isolate
92
- min-height: 100vh
93
- > .app-header
94
- +row(null, center)
95
- +sticky(0)
96
- +px(m)
97
- z-index: var(--z-sticky)
98
- height: var(--header-height)
99
- +bg(surface)
100
- +border(bottom)
101
- > .app-main
102
- +grow
103
- +min0
104
- > .app-footer
105
- +row(null, center)
106
- +px(m)
107
- min-height: var(--footer-height)
108
- +border(top)
@@ -1,43 +0,0 @@
1
- // =============================================================================
2
- // RESPONSIVE FRACTALS — the units that let any other fractal grow with the page.
3
- // -----------------------------------------------------------------------------
4
- // These are self-similar too: +at(md) wraps any block of fractal calls in a
5
- // breakpoint, so a "responsive component" is just a component whose fractals
6
- // are re-stated inside +at(...).
7
- // =============================================================================
8
-
9
- @use 'sass:map'
10
- @use 'config' as *
11
-
12
- // +at(md) — mobile-first min-width query by name (sm/md/lg/xl) or raw length.
13
- =at($name)
14
- $edge: $name
15
- @if map.has-key($breakpoints, $name)
16
- $edge: bp($name)
17
- @media (min-width: #{$edge})
18
- @content
19
-
20
- // +until(md) — max-width query (one below the named edge).
21
- =until($name)
22
- $edge: $name
23
- @if map.has-key($breakpoints, $name)
24
- $edge: bp($name)
25
- @media (max-width: #{$edge})
26
- @content
27
-
28
- // Container-query fractals — component-scoped responsiveness.
29
- =cq
30
- container-type: inline-size
31
-
32
- =cq-at($width)
33
- @container (min-width: #{$width})
34
- @content
35
-
36
- =cq-until($width)
37
- @container (max-width: #{$width})
38
- @content
39
-
40
- // Motion / preference-aware fractal.
41
- =reduce-motion
42
- @media (prefers-reduced-motion: reduce)
43
- @content
@@ -1,127 +0,0 @@
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'].
6
- // =============================================================================
7
-
8
- :root
9
- color-scheme: light
10
-
11
- // 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
14
-
15
- // Fluid type scale (Utopia 360→1240)
16
- --text-xs: 0.75rem
17
- --text-sm: clamp(0.9375rem, 0.9119rem + 0.1136vw, 1rem)
18
- --text-md: clamp(1.125rem, 1.0739rem + 0.2273vw, 1.25rem)
19
- --text-lg: clamp(1.35rem, 1.2631rem + 0.3864vw, 1.5625rem)
20
- --text-xl: clamp(1.62rem, 1.4837rem + 0.6057vw, 1.9531rem)
21
- --text-2xl: clamp(1.944rem, 1.7405rem + 0.9044vw, 2.4414rem)
22
- --text-3xl: clamp(2.3328rem, 2.0387rem + 1.3072vw, 3.0518rem)
23
- --text-4xl: clamp(2.7994rem, 2.384rem + 1.8461vw, 3.8147rem)
24
-
25
- // Fluid space scale
26
- --space-3xs: clamp(0.3125rem, 0.3125rem + 0vw, 0.3125rem)
27
- --space-2xs: clamp(0.5625rem, 0.5369rem + 0.1136vw, 0.625rem)
28
- --space-xs: clamp(0.875rem, 0.8494rem + 0.1136vw, 0.9375rem)
29
- --space-s: clamp(1.125rem, 1.0739rem + 0.2273vw, 1.25rem)
30
- --space-m: clamp(1.6875rem, 1.6108rem + 0.3409vw, 1.875rem)
31
- --space-l: clamp(2.25rem, 2.1477rem + 0.4545vw, 2.5rem)
32
- --space-xl: clamp(3.375rem, 3.2216rem + 0.6818vw, 3.75rem)
33
- --space-2xl: clamp(4.5rem, 4.2955rem + 0.9091vw, 5rem)
34
- --space-3xl: clamp(6.75rem, 6.4432rem + 1.3636vw, 7.5rem)
35
- --space-s-l: clamp(1.125rem, 0.5625rem + 2.5vw, 2.5rem)
36
-
37
- // Radius
38
- --radius-0: 0
39
- --radius-2: 2px
40
- --radius-4: 4px
41
- --radius-6: 6px
42
- --radius-8: 8px
43
- --radius-12: 12px
44
- --radius-16: 16px
45
- --radius-24: 24px
46
- --radius-full: 9999px
47
-
48
- // Shadow
49
- --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06)
50
- --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08)
51
- --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12)
52
-
53
- // Layering
54
- --z-base: 0
55
- --z-raised: 10
56
- --z-sticky: 100
57
- --z-modal: 200
58
- --z-toast: 300
59
-
60
- // Layout
61
- --header-height: 64px
62
- --footer-height: 56px
63
- --measure: 65ch
64
-
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)
79
-
80
- @media (prefers-color-scheme: dark)
81
- :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)
96
-
97
- [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)
112
-
113
- [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)