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.
- package/README.md +60 -45
- package/dist/cli.js +54 -11
- package/dist/index.d.ts +32 -1
- package/dist/index.js +73 -4
- package/dist/mcp/export.d.ts +13 -0
- package/dist/mcp/export.js +76 -0
- package/dist/mcp/schemas/compile_fractals.json +20 -0
- package/dist/mcp/schemas/css_to_fractals.json +16 -0
- package/dist/mcp/schemas/generate_component.json +45 -0
- package/dist/mcp/schemas/get_design_tokens.json +23 -0
- package/dist/mcp/schemas/instructions.md +18 -0
- package/dist/mcp/schemas/list_fractals.json +20 -0
- package/dist/mcp/schemas/snap_to_tokens.json +25 -0
- package/dist/mcp/schemas/validate_recipe.json +16 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +837 -0
- package/dist/styles/_00_tokens.sass +177 -0
- package/{templates/_config.sass → dist/styles/_01_config.sass} +11 -5
- package/dist/styles/_02_fonts.sass +13 -0
- package/dist/styles/_03_responsive.sass +31 -0
- package/dist/styles/{_atoms.sass → _04_atoms.sass} +4 -4
- package/{templates/_molecules.sass → dist/styles/_05_molecules.sass} +16 -12
- package/dist/styles/_06_recipes.sass +189 -0
- package/dist/styles/{_base.sass → _07_base.sass} +3 -2
- package/dist/styles/_08_blocks.sass +433 -0
- package/dist/styles/{_utilities.sass → _09_utilities.sass} +96 -16
- package/dist/styles/_10_layouts.sass +373 -0
- package/dist/styles/_11_own.sass +21 -0
- package/dist/styles/_fractals.sass +7 -6
- package/dist/styles/index.sass +14 -16
- package/mcp.json +11 -0
- package/package.json +14 -6
- package/plugin.json +22 -0
- package/skills/fractal-styler/SKILL.md +83 -0
- package/skills/fractal-styler/references/fractals.md +28 -0
- package/skills/fractal-styler/references/tokens.md +36 -0
- package/skills/style-migration/SKILL.md +45 -0
- package/templates/_00_tokens.sass +177 -0
- package/{dist/styles/_config.sass → templates/_01_config.sass} +11 -5
- package/templates/_02_fonts.sass +13 -0
- package/templates/_03_responsive.sass +31 -0
- package/templates/{_atoms.sass → _04_atoms.sass} +4 -4
- package/{dist/styles/_molecules.sass → templates/_05_molecules.sass} +16 -12
- package/templates/_06_recipes.sass +189 -0
- package/templates/{_base.sass → _07_base.sass} +3 -2
- package/templates/_08_blocks.sass +433 -0
- package/templates/{_utilities.sass → _09_utilities.sass} +96 -16
- package/templates/_10_layouts.sass +373 -0
- package/templates/_11_own.sass +21 -0
- package/templates/_fractals.sass +7 -6
- package/templates/index.sass +14 -16
- package/dist/styles/_blocks.sass +0 -88
- package/dist/styles/_layouts.sass +0 -108
- package/dist/styles/_responsive.sass +0 -43
- package/dist/styles/_tokens.sass +0 -127
- package/templates/_blocks.sass +0 -88
- package/templates/_layouts.sass +0 -108
- package/templates/_responsive.sass +0 -43
- package/templates/_tokens.sass +0 -127
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// 10_LAYOUTS — the largest fractals. Same recipe move, page scale.
|
|
3
|
+
// -----------------------------------------------------------------------------
|
|
4
|
+
// Layouts compose molecule and atom fractals into structural arrangements.
|
|
5
|
+
// State and responsive reflow are handled with +cols, +auto-grid, +cover.
|
|
6
|
+
// =============================================================================
|
|
7
|
+
|
|
8
|
+
@use 'fractals' as *
|
|
9
|
+
|
|
10
|
+
// Column grid presets
|
|
11
|
+
.grid-1
|
|
12
|
+
+cols((base: 1), s)
|
|
13
|
+
|
|
14
|
+
.grid-2
|
|
15
|
+
+cols((base: 1, md: 2), m)
|
|
16
|
+
|
|
17
|
+
.grid-3
|
|
18
|
+
+cols((base: 1, sm: 2, lg: 3), s)
|
|
19
|
+
|
|
20
|
+
.grid-4
|
|
21
|
+
+cols((base: 1, sm: 2, lg: 4), s)
|
|
22
|
+
|
|
23
|
+
.grid-6
|
|
24
|
+
+cols((base: 2, sm: 3, md: 4, lg: 6), xs)
|
|
25
|
+
|
|
26
|
+
// A grid that never needs breakpoints: it fits as many columns as will hold
|
|
27
|
+
// the min track. Reach for this when column count is negotiable.
|
|
28
|
+
.card-grid
|
|
29
|
+
+auto-grid(16rem, s)
|
|
30
|
+
|
|
31
|
+
// Hero — full-viewport cover with a centered, measured message.
|
|
32
|
+
.hero
|
|
33
|
+
+cover(80vh, xl)
|
|
34
|
+
> .center
|
|
35
|
+
+stack(m, center)
|
|
36
|
+
text-align: center
|
|
37
|
+
max-width: 45ch
|
|
38
|
+
|
|
39
|
+
// Holy grail — header / (nav · main · aside) / footer.
|
|
40
|
+
.holy-grail
|
|
41
|
+
display: grid
|
|
42
|
+
min-height: 100vh
|
|
43
|
+
grid-template-rows: auto 1fr auto
|
|
44
|
+
grid-template-areas: 'header' 'main' 'footer'
|
|
45
|
+
> .hg-header
|
|
46
|
+
grid-area: header
|
|
47
|
+
> .hg-footer
|
|
48
|
+
grid-area: footer
|
|
49
|
+
> .hg-body
|
|
50
|
+
grid-area: main
|
|
51
|
+
display: grid
|
|
52
|
+
grid-template-columns: 1fr
|
|
53
|
+
+gap(m)
|
|
54
|
+
+pad(m)
|
|
55
|
+
+at(lg)
|
|
56
|
+
> .hg-body
|
|
57
|
+
grid-template-columns: var(--nav-w, 220px) minmax(0, 1fr) var(--aside-w, 260px)
|
|
58
|
+
> .hg-nav
|
|
59
|
+
+sticky(var(--space-m))
|
|
60
|
+
align-self: start
|
|
61
|
+
> .hg-aside
|
|
62
|
+
+sticky(var(--space-m))
|
|
63
|
+
align-self: start
|
|
64
|
+
|
|
65
|
+
// Docs layout — responsive 3-column frame (nav · main · TOC).
|
|
66
|
+
.docs
|
|
67
|
+
position: relative
|
|
68
|
+
display: grid
|
|
69
|
+
grid-template-columns: 1fr
|
|
70
|
+
min-height: calc(100vh - var(--header-height, 48px))
|
|
71
|
+
|
|
72
|
+
// Left Nav Rail (off-canvas drawer on mobile, sticky rail on desktop)
|
|
73
|
+
> .docs-nav
|
|
74
|
+
position: fixed
|
|
75
|
+
top: var(--header-height, 48px)
|
|
76
|
+
left: 0
|
|
77
|
+
z-index: var(--z-modal, 200)
|
|
78
|
+
width: min(85vw, 280px)
|
|
79
|
+
height: calc(100dvh - var(--header-height, 48px))
|
|
80
|
+
padding: var(--space-s)
|
|
81
|
+
overflow-y: auto
|
|
82
|
+
background: var(--bg)
|
|
83
|
+
+border(right)
|
|
84
|
+
transform: translateX(-105%)
|
|
85
|
+
transition: transform 200ms ease-out
|
|
86
|
+
|
|
87
|
+
&[data-drawer-open='true'] > .docs-nav
|
|
88
|
+
transform: translateX(0)
|
|
89
|
+
|
|
90
|
+
// Backdrop for mobile drawer
|
|
91
|
+
> .docs-backdrop
|
|
92
|
+
position: fixed
|
|
93
|
+
inset: var(--header-height, 48px) 0 0 0
|
|
94
|
+
z-index: calc(var(--z-modal, 200) - 1)
|
|
95
|
+
background: rgba(0, 0, 0, 0.5)
|
|
96
|
+
backdrop-filter: blur(2px)
|
|
97
|
+
border: none
|
|
98
|
+
cursor: pointer
|
|
99
|
+
|
|
100
|
+
// Center Reading Column
|
|
101
|
+
> .docs-main
|
|
102
|
+
+min0
|
|
103
|
+
+box
|
|
104
|
+
padding-block: var(--space-l)
|
|
105
|
+
padding-inline: var(--space-s)
|
|
106
|
+
> *
|
|
107
|
+
width: 100%
|
|
108
|
+
max-width: clamp(600px, 58vw, 760px)
|
|
109
|
+
margin-inline: auto
|
|
110
|
+
|
|
111
|
+
// Right TOC Rail (desktop only)
|
|
112
|
+
> .docs-toc
|
|
113
|
+
display: none
|
|
114
|
+
|
|
115
|
+
// Desktop Breakpoint (>= 1024px)
|
|
116
|
+
+at(lg)
|
|
117
|
+
--docs-nav-w: clamp(220px, 20vw, 270px)
|
|
118
|
+
--docs-toc-w: clamp(200px, 18vw, 240px)
|
|
119
|
+
grid-template-columns: var(--docs-nav-w) minmax(0, 1fr) var(--docs-toc-w)
|
|
120
|
+
|
|
121
|
+
> .docs-nav
|
|
122
|
+
position: sticky
|
|
123
|
+
top: var(--header-height, 48px)
|
|
124
|
+
width: auto
|
|
125
|
+
height: calc(100vh - var(--header-height, 48px))
|
|
126
|
+
transform: none
|
|
127
|
+
z-index: 10
|
|
128
|
+
padding: var(--space-m) var(--space-s)
|
|
129
|
+
|
|
130
|
+
> .docs-toc
|
|
131
|
+
display: block
|
|
132
|
+
position: sticky
|
|
133
|
+
top: var(--header-height, 48px)
|
|
134
|
+
height: calc(100vh - var(--header-height, 48px))
|
|
135
|
+
overflow-y: auto
|
|
136
|
+
padding: var(--space-m) var(--space-s)
|
|
137
|
+
+border(left)
|
|
138
|
+
|
|
139
|
+
> .docs-backdrop
|
|
140
|
+
display: none
|
|
141
|
+
|
|
142
|
+
// NavTree styling
|
|
143
|
+
.navtree
|
|
144
|
+
+box
|
|
145
|
+
+gap(m)
|
|
146
|
+
|
|
147
|
+
.navtree-group
|
|
148
|
+
+box
|
|
149
|
+
+gap(3xs)
|
|
150
|
+
|
|
151
|
+
.navtree-title
|
|
152
|
+
font-size: var(--text-xs)
|
|
153
|
+
font-weight: 600
|
|
154
|
+
text-transform: uppercase
|
|
155
|
+
letter-spacing: 0.06em
|
|
156
|
+
color: var(--text-muted)
|
|
157
|
+
padding: 6px 8px
|
|
158
|
+
|
|
159
|
+
.navtree-link
|
|
160
|
+
+row(between, center)
|
|
161
|
+
padding: 6px 10px
|
|
162
|
+
font-size: var(--text-sm)
|
|
163
|
+
color: var(--text-secondary)
|
|
164
|
+
border-radius: var(--radius-4)
|
|
165
|
+
text-decoration: none
|
|
166
|
+
transition: all 120ms ease
|
|
167
|
+
&:hover
|
|
168
|
+
+bg(raised)
|
|
169
|
+
+ink(primary)
|
|
170
|
+
&[aria-current='page'], &[data-active='true']
|
|
171
|
+
+bg(surface)
|
|
172
|
+
color: var(--theme)
|
|
173
|
+
font-weight: 500
|
|
174
|
+
+border
|
|
175
|
+
|
|
176
|
+
.navtree-sub
|
|
177
|
+
+box
|
|
178
|
+
+gap(3xs)
|
|
179
|
+
margin-left: 12px
|
|
180
|
+
padding-left: 8px
|
|
181
|
+
+border(left)
|
|
182
|
+
|
|
183
|
+
// TOC styling
|
|
184
|
+
.toc
|
|
185
|
+
+box
|
|
186
|
+
+gap(m)
|
|
187
|
+
height: 100%
|
|
188
|
+
|
|
189
|
+
.toc-title
|
|
190
|
+
font-size: var(--text-xs)
|
|
191
|
+
font-weight: 600
|
|
192
|
+
text-transform: uppercase
|
|
193
|
+
letter-spacing: 0.06em
|
|
194
|
+
color: var(--text-muted)
|
|
195
|
+
|
|
196
|
+
.toc-list
|
|
197
|
+
list-style: none
|
|
198
|
+
margin: 0
|
|
199
|
+
padding: 0
|
|
200
|
+
+box
|
|
201
|
+
+gap(2xs)
|
|
202
|
+
|
|
203
|
+
.toc-link
|
|
204
|
+
display: block
|
|
205
|
+
font-size: var(--text-xs)
|
|
206
|
+
color: var(--text-muted)
|
|
207
|
+
text-decoration: none
|
|
208
|
+
padding: 3px 0
|
|
209
|
+
transition: color 120ms ease
|
|
210
|
+
&:hover
|
|
211
|
+
+ink(primary)
|
|
212
|
+
&[aria-current='true']
|
|
213
|
+
color: var(--theme)
|
|
214
|
+
font-weight: 500
|
|
215
|
+
&[data-depth='3']
|
|
216
|
+
padding-left: 10px
|
|
217
|
+
|
|
218
|
+
.toc-footer
|
|
219
|
+
+partition(top, s)
|
|
220
|
+
+box
|
|
221
|
+
+gap(2xs)
|
|
222
|
+
|
|
223
|
+
// Mobile TOC Disclosure
|
|
224
|
+
.docs-mobile-toc
|
|
225
|
+
+box
|
|
226
|
+
+gap(xs)
|
|
227
|
+
+pad(xs)
|
|
228
|
+
+radius(6)
|
|
229
|
+
+bg(surface)
|
|
230
|
+
+border(all, var(--border))
|
|
231
|
+
summary
|
|
232
|
+
+row(between, center)
|
|
233
|
+
+weight(500)
|
|
234
|
+
+type(sm)
|
|
235
|
+
+ink(primary)
|
|
236
|
+
cursor: pointer
|
|
237
|
+
user-select: none
|
|
238
|
+
list-style: none
|
|
239
|
+
&::-webkit-details-marker
|
|
240
|
+
display: none
|
|
241
|
+
&[open]
|
|
242
|
+
+bg(raised)
|
|
243
|
+
summary
|
|
244
|
+
margin-bottom: var(--space-xs)
|
|
245
|
+
padding-bottom: var(--space-2xs)
|
|
246
|
+
+border(bottom, var(--border))
|
|
247
|
+
|
|
248
|
+
// Prose Typography Container
|
|
249
|
+
.prose
|
|
250
|
+
font-size: var(--text-sm)
|
|
251
|
+
line-height: 1.65
|
|
252
|
+
color: var(--text-secondary)
|
|
253
|
+
|
|
254
|
+
> * + *
|
|
255
|
+
margin-top: 1rem
|
|
256
|
+
|
|
257
|
+
h1
|
|
258
|
+
font-size: var(--text-3xl)
|
|
259
|
+
font-weight: 700
|
|
260
|
+
color: var(--text-primary)
|
|
261
|
+
line-height: 1.2
|
|
262
|
+
margin-top: 0
|
|
263
|
+
margin-bottom: 0.5rem
|
|
264
|
+
|
|
265
|
+
h2
|
|
266
|
+
font-size: var(--text-xl)
|
|
267
|
+
font-weight: 600
|
|
268
|
+
color: var(--text-primary)
|
|
269
|
+
line-height: 1.3
|
|
270
|
+
margin-top: 2rem
|
|
271
|
+
margin-bottom: 0.5rem
|
|
272
|
+
padding-bottom: 0.25rem
|
|
273
|
+
+border(bottom)
|
|
274
|
+
|
|
275
|
+
h3
|
|
276
|
+
font-size: var(--text-md)
|
|
277
|
+
font-weight: 600
|
|
278
|
+
color: var(--text-primary)
|
|
279
|
+
margin-top: 1.5rem
|
|
280
|
+
margin-bottom: 0.25rem
|
|
281
|
+
|
|
282
|
+
h4
|
|
283
|
+
font-size: var(--text-sm)
|
|
284
|
+
font-weight: 600
|
|
285
|
+
color: var(--text-primary)
|
|
286
|
+
|
|
287
|
+
p
|
|
288
|
+
margin-bottom: 1rem
|
|
289
|
+
|
|
290
|
+
ul, ol
|
|
291
|
+
padding-left: 1.25rem
|
|
292
|
+
margin-bottom: 1rem
|
|
293
|
+
li
|
|
294
|
+
margin-bottom: 0.25rem
|
|
295
|
+
|
|
296
|
+
code:not(pre code)
|
|
297
|
+
font-family: var(--font-mono)
|
|
298
|
+
font-size: 0.85em
|
|
299
|
+
padding: 2px 6px
|
|
300
|
+
background: var(--bg-raised)
|
|
301
|
+
border: 1px solid var(--border)
|
|
302
|
+
border-radius: var(--radius-3)
|
|
303
|
+
color: var(--text-primary)
|
|
304
|
+
|
|
305
|
+
pre
|
|
306
|
+
position: relative
|
|
307
|
+
background: var(--bg-surface)
|
|
308
|
+
border: 1px solid var(--border)
|
|
309
|
+
border-radius: var(--radius-6)
|
|
310
|
+
padding: var(--space-s)
|
|
311
|
+
overflow-x: auto
|
|
312
|
+
font-family: var(--font-mono)
|
|
313
|
+
font-size: var(--text-xs)
|
|
314
|
+
line-height: 1.5
|
|
315
|
+
color: var(--text-primary)
|
|
316
|
+
code
|
|
317
|
+
font-family: inherit
|
|
318
|
+
font-size: inherit
|
|
319
|
+
background: none
|
|
320
|
+
border: none
|
|
321
|
+
padding: 0
|
|
322
|
+
|
|
323
|
+
table
|
|
324
|
+
width: 100%
|
|
325
|
+
border-collapse: collapse
|
|
326
|
+
margin-block: 1.25rem
|
|
327
|
+
font-size: var(--text-sm)
|
|
328
|
+
th
|
|
329
|
+
text-align: left
|
|
330
|
+
padding: 8px 12px
|
|
331
|
+
border-bottom: 1px solid var(--border-subtle)
|
|
332
|
+
font-size: var(--text-xs)
|
|
333
|
+
font-weight: 600
|
|
334
|
+
text-transform: uppercase
|
|
335
|
+
letter-spacing: 0.04em
|
|
336
|
+
color: var(--text-primary)
|
|
337
|
+
td
|
|
338
|
+
padding: 8px 12px
|
|
339
|
+
border-bottom: 1px solid var(--border)
|
|
340
|
+
color: var(--text-secondary)
|
|
341
|
+
|
|
342
|
+
blockquote
|
|
343
|
+
margin: 1.25rem 0
|
|
344
|
+
padding: 8px 16px
|
|
345
|
+
border-left: 3px solid var(--theme)
|
|
346
|
+
background: var(--bg-raised)
|
|
347
|
+
border-radius: 0 var(--radius-4) var(--radius-4) 0
|
|
348
|
+
p
|
|
349
|
+
margin: 0
|
|
350
|
+
color: var(--text-primary)
|
|
351
|
+
|
|
352
|
+
// App shell — sticky header, fluid body, footer.
|
|
353
|
+
.app-shell
|
|
354
|
+
+box
|
|
355
|
+
+relative
|
|
356
|
+
isolation: isolate
|
|
357
|
+
min-height: 100vh
|
|
358
|
+
> .app-header
|
|
359
|
+
+row(null, center)
|
|
360
|
+
+sticky(0)
|
|
361
|
+
+px(m)
|
|
362
|
+
background: var(--bg)
|
|
363
|
+
z-index: var(--z-sticky)
|
|
364
|
+
height: var(--header-height)
|
|
365
|
+
+border(bottom)
|
|
366
|
+
> .app-main
|
|
367
|
+
+grow
|
|
368
|
+
+min0
|
|
369
|
+
> .app-footer
|
|
370
|
+
+row(null, center)
|
|
371
|
+
+px(m)
|
|
372
|
+
min-height: var(--footer-height)
|
|
373
|
+
+border(top)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// 11_OWN — bespoke project-specific styles and micro-components.
|
|
3
|
+
// =============================================================================
|
|
4
|
+
|
|
5
|
+
@use 'fractals' as *
|
|
6
|
+
|
|
7
|
+
.logomotif
|
|
8
|
+
height: 28px
|
|
9
|
+
width: 28px
|
|
10
|
+
filter: saturate(0)
|
|
11
|
+
|
|
12
|
+
.logotype
|
|
13
|
+
height: 16px
|
|
14
|
+
filter: saturate(0)
|
|
15
|
+
|
|
16
|
+
.header-nav
|
|
17
|
+
font-size: var(--text-sm)
|
|
18
|
+
text-decoration: none
|
|
19
|
+
color: var(--text-secondary)
|
|
20
|
+
&:hover
|
|
21
|
+
color: var(--theme-color)
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// =============================================================================
|
|
2
|
-
// FRACTALS — the pure API barrel. Emits NO
|
|
2
|
+
// FRACTALS — the pure API barrel. Emits NO CSS on its own.
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
4
|
// In any component partial or Svelte component:
|
|
5
5
|
// @use '$lib/styles/fractals' as *
|
|
6
6
|
// (or @use './fractals' as *)
|
|
7
|
-
// then call fractals freely: +surface(...) +stack(...)
|
|
7
|
+
// then call fractals freely: +surface(...) +stack(...) +card(...)
|
|
8
8
|
// =============================================================================
|
|
9
9
|
|
|
10
|
-
@forward '
|
|
11
|
-
@forward '
|
|
12
|
-
@forward '
|
|
13
|
-
@forward '
|
|
10
|
+
@forward '01_config'
|
|
11
|
+
@forward '03_responsive'
|
|
12
|
+
@forward '04_atoms'
|
|
13
|
+
@forward '05_molecules'
|
|
14
|
+
@forward '06_recipes'
|
package/dist/styles/index.sass
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
// =============================================================================
|
|
2
|
-
//
|
|
2
|
+
// FRACTALSTYLER2 — Master Stylesheet & Public Mixin API
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// 3. utilities atom fractals projected to markup classes (optional layer)
|
|
7
|
-
// 4. blocks components composed from fractals
|
|
8
|
-
// 5. layouts page templates composed from fractals
|
|
9
|
-
//
|
|
10
|
-
// Consume from a SvelteKit app: import '$lib/styles/index.sass'
|
|
11
|
-
// or from package: import 'fractalstyler2/styles'
|
|
12
|
-
// The fractal mixins/functions themselves emit nothing until called, so output
|
|
13
|
-
// contains only what you use.
|
|
4
|
+
// 1. Public API: Forwards all pure mixins, functions, and atoms (0 bytes CSS)
|
|
5
|
+
// 2. Cascade Order: Emits CSS rules in strict specificity sequence
|
|
14
6
|
// =============================================================================
|
|
15
7
|
|
|
16
|
-
@
|
|
17
|
-
@
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@use '
|
|
8
|
+
// Public Sass API — available to any file that @uses this module
|
|
9
|
+
@forward 'fractals'
|
|
10
|
+
|
|
11
|
+
// Global Stylesheet Cascade
|
|
12
|
+
@use '02_fonts' as *
|
|
13
|
+
@use '00_tokens' as *
|
|
14
|
+
@use '07_base' as *
|
|
15
|
+
@use '08_blocks' as *
|
|
16
|
+
@use '09_utilities' as *
|
|
17
|
+
@use '10_layouts' as *
|
|
18
|
+
@use '11_own' as *
|
package/mcp.json
ADDED
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fractalstyler2",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A fractal-composition styling system for SvelteKit — every style unit is a SASS mixin, and components and layouts are recipes of smaller fractals.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"fractalstyler2": "./dist/cli.js",
|
|
7
|
-
"fractalstyler": "./dist/cli.js"
|
|
7
|
+
"fractalstyler": "./dist/cli.js",
|
|
8
|
+
"fractalstyler2-mcp": "./dist/mcp/server.js"
|
|
8
9
|
},
|
|
9
10
|
"scripts": {
|
|
10
11
|
"dev": "vite dev",
|
|
11
12
|
"build": "vite build && npm run prepack",
|
|
12
13
|
"preview": "vite preview",
|
|
13
14
|
"prepare": "svelte-kit sync || echo ''",
|
|
14
|
-
"prepack": "svelte-kit sync && svelte-package && chmod +x dist/cli.js && publint",
|
|
15
|
+
"prepack": "svelte-kit sync && svelte-package && chmod +x dist/cli.js && chmod +x dist/mcp/server.js && publint",
|
|
15
16
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
16
17
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
|
|
17
18
|
},
|
|
@@ -19,7 +20,10 @@
|
|
|
19
20
|
"dist",
|
|
20
21
|
"!dist/**/*.test.*",
|
|
21
22
|
"!dist/**/*.spec.*",
|
|
22
|
-
"templates"
|
|
23
|
+
"templates",
|
|
24
|
+
"skills",
|
|
25
|
+
"plugin.json",
|
|
26
|
+
"mcp.json"
|
|
23
27
|
],
|
|
24
28
|
"sideEffects": [
|
|
25
29
|
"**/*.css"
|
|
@@ -35,7 +39,8 @@
|
|
|
35
39
|
"./styles": "./dist/styles/index.sass",
|
|
36
40
|
"./styles/*": "./dist/styles/*",
|
|
37
41
|
"./fractals": "./dist/styles/_fractals.sass",
|
|
38
|
-
"./tokens": "./dist/styles/
|
|
42
|
+
"./tokens": "./dist/styles/_00_tokens.sass",
|
|
43
|
+
"./mcp": "./dist/mcp/server.js",
|
|
39
44
|
"./package.json": "./package.json"
|
|
40
45
|
},
|
|
41
46
|
"peerDependencies": {
|
|
@@ -62,5 +67,8 @@
|
|
|
62
67
|
"design-system",
|
|
63
68
|
"mixins",
|
|
64
69
|
"fractal"
|
|
65
|
-
]
|
|
70
|
+
],
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@modelcontextprotocol/sdk": "^1.30.0"
|
|
73
|
+
}
|
|
66
74
|
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fractalstyler2",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Fractal-composition styling system and design token engine for SvelteKit and AI design tools (OpenDesign, Pencil, Cursor).",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Amrit",
|
|
7
|
+
"url": "https://github.com/fractal-mandala"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"svelte",
|
|
12
|
+
"sveltekit",
|
|
13
|
+
"sass",
|
|
14
|
+
"css",
|
|
15
|
+
"design-system",
|
|
16
|
+
"mcp",
|
|
17
|
+
"tokens",
|
|
18
|
+
"fractals"
|
|
19
|
+
],
|
|
20
|
+
"homepage": "https://github.com/fractal-mandala/fractalstyler2",
|
|
21
|
+
"repository": "https://github.com/fractal-mandala/fractalstyler2"
|
|
22
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fractal-styler
|
|
3
|
+
description: Design, compose, and build UI components and page layouts using the fractalstyler2 SASS mixin system and fluid design tokens in SvelteKit. Use when authoring components, applying design tokens, styling layouts, or compiling fractal recipes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Fractal Styler (fractalstyler2)
|
|
7
|
+
|
|
8
|
+
`fractalstyler2` is a fractal-composition styling system for SvelteKit and modern web applications. Every styling decision is a reusable SASS mixin ("a fractal"), and components and layouts are clean recipes composed of smaller fractals.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## The Four Tiers of Composition
|
|
13
|
+
|
|
14
|
+
| Tier | Role | Examples |
|
|
15
|
+
| :--- | :--- | :--- |
|
|
16
|
+
| **1. Tokens & Config** | Fluid Utopia scales & resolvers | `space(m)` → `var(--space-m)`, `radius(12)` → `var(--radius-12)` |
|
|
17
|
+
| **2. Atoms** | Single layout/styling decisions | `+box`, `+row`, `+gap(s)`, `+pad(m)`, `+border`, `+radius(12)`, `+bg(surface)`, `+ink(primary)` |
|
|
18
|
+
| **3. Molecules** | Compositions of atoms | `+stack(s)`, `+cluster(xs)`, `+surface(surface, s, 12)`, `+cover(80vh)`, `+frame(16/9)`, `+with-sidebar` |
|
|
19
|
+
| **4. Components & Layouts** | Recipes of molecules | `.card`, `.panel`, `.button`, `.badge` · `.grid-3`, `.card-grid`, `.hero`, `.holy-grail`, `.docs`, `.app-shell` |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Golden Rules for Agents
|
|
24
|
+
|
|
25
|
+
1. **Never hardcode values that tokens cover**: Use `+gap(m)`, `+radius(12)`, `+bg(surface)` instead of arbitrary pixel values.
|
|
26
|
+
2. **Compose fractals; don't write raw CSS**: Raw CSS is strictly for unique lines that no fractal covers.
|
|
27
|
+
3. **State on `data-*` / `aria-*` attributes**: Never use modifier classes like `.is-active` or `.btn--primary`. Use `&[data-elevated]`, `&[data-variant='primary']`.
|
|
28
|
+
4. **Markup stays semantic**: Prefer `<article class="card">` over 20 nested utility classes.
|
|
29
|
+
5. **Mobile-first**: Define base layout first, grow with `+at(md/lg/xl)` and `+cols()`.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## How to Author a Svelte 5 Component
|
|
34
|
+
|
|
35
|
+
```svelte
|
|
36
|
+
<script lang="ts">
|
|
37
|
+
let {
|
|
38
|
+
title = 'Pricing Tier',
|
|
39
|
+
price = '$29',
|
|
40
|
+
highlighted = false,
|
|
41
|
+
children
|
|
42
|
+
} = $props();
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<article class="pricing-card" data-highlighted={highlighted || undefined}>
|
|
46
|
+
<div class="row ycenter xbetween">
|
|
47
|
+
<h3 class="text-xl">{title}</h3>
|
|
48
|
+
{#if highlighted}
|
|
49
|
+
<span class="badge" data-variant="theme">Popular</span>
|
|
50
|
+
{/if}
|
|
51
|
+
</div>
|
|
52
|
+
<div class="row ycenter gap-2xs">
|
|
53
|
+
<span class="text-4xl font-bold">{price}</span>
|
|
54
|
+
<span class="muted">/month</span>
|
|
55
|
+
</div>
|
|
56
|
+
{#if children}
|
|
57
|
+
{@render children()}
|
|
58
|
+
{/if}
|
|
59
|
+
</article>
|
|
60
|
+
|
|
61
|
+
<style lang="sass">
|
|
62
|
+
@use '$lib/styles/fractals' as *
|
|
63
|
+
|
|
64
|
+
.pricing-card
|
|
65
|
+
+surface(surface, m, 16)
|
|
66
|
+
+stack(m)
|
|
67
|
+
transition: transform 150ms ease, box-shadow 150ms ease
|
|
68
|
+
|
|
69
|
+
&[data-highlighted]
|
|
70
|
+
+border(all, var(--theme))
|
|
71
|
+
+shadow(lg)
|
|
72
|
+
</style>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## MCP Tools Integration
|
|
78
|
+
|
|
79
|
+
If the host environment connects to the `fractalstyler2` MCP server, use the available tools:
|
|
80
|
+
* `get_design_tokens`: Query available space, typography, and radius steps.
|
|
81
|
+
* `compile_fractals`: Compile SASS mixin recipes to verify CSS output.
|
|
82
|
+
* `snap_to_tokens`: Snap canvas pixel values to tokens.
|
|
83
|
+
* `validate_recipe`: Lint SASS/Svelte against the golden rules.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Fractals Catalog Reference
|
|
2
|
+
|
|
3
|
+
## Atom Fractals (Single Decisions)
|
|
4
|
+
|
|
5
|
+
* **Layout Flow**: `+box(x, y)` (flex col), `+row(x, y)` (flex row), `+wrap`, `+grid(cols)`, `+auto-grid(min, gap)`, `+center` (grid center).
|
|
6
|
+
* **Spacing**: `+gap(v)`, `+pad(v)`, `+px(v)`, `+py(v)`, `+mx-auto`, `+my-auto`.
|
|
7
|
+
* **Sizing**: `+w(v)`, `+h(v)`, `+full`, `+square(v)`, `+grow(n)`, `+shrink(n)`, `+min0`.
|
|
8
|
+
* **Surfaces**: `+bg(role)`, `+ink(role)`, `+border(side, color)`, `+radius(v)`, `+shadow(v)`.
|
|
9
|
+
* **Position**: `+relative`, `+absolute(inset)`, `+sticky(top)`, `+fill`.
|
|
10
|
+
* **Type**: `+type(v)`, `+weight(w)`, `+leading(lh)`, `+truncate`, `+clamp-lines(n)`.
|
|
11
|
+
* **Motion**: `+transition(props, dur, ease)`, `+ring(color)`.
|
|
12
|
+
|
|
13
|
+
## Molecule Fractals (Compositions of Atoms)
|
|
14
|
+
|
|
15
|
+
* **`+stack($gap: xs, $x: null)`**: Vertical flex column rhythm with uniform gap.
|
|
16
|
+
* **`+cluster($gap: xs, $x: start, $y: center)`**: Wrapping flex row for tag clouds, chips, and button rows.
|
|
17
|
+
* **`+center-column($max: 60ch, $pad: s)`**: Bounded reading column with max-width measure and auto margins.
|
|
18
|
+
* **`+cover($min: 100vh, $pad: s)`**: Full-height container with a vertically centered focal child (`> .center`).
|
|
19
|
+
* **`+frame($ratio: 16 / 9)`**: Fixed aspect-ratio container for media.
|
|
20
|
+
* **`+reel($gap: xs)`**: Horizontal scroll-snap rail.
|
|
21
|
+
* **`+with-sidebar($rail: 240px, $gap: s, $min: 60%)`**: Intrinsic sidebar + fluid main layout.
|
|
22
|
+
* **`+surface($bg: surface, $pad: s, $radius: 12, $elevation: none)`**: The all-in-one material mixin.
|
|
23
|
+
* **`+cols($map, $gap: s)`**: Responsive grid mapped across breakpoints, e.g. `+cols((base: 1, sm: 2, lg: 3), m)`.
|
|
24
|
+
|
|
25
|
+
## Responsive Utilities
|
|
26
|
+
* `+at(sm | md | lg | xl)`: Mobile-first min-width media query.
|
|
27
|
+
* `+until(sm | md | lg | xl)`: Max-width media query.
|
|
28
|
+
* `+cq`, `+cq-at(width)`, `+cq-until(width)`: Container queries.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Design Tokens Reference
|
|
2
|
+
|
|
3
|
+
## Space Scale (Fluid Utopia)
|
|
4
|
+
| Step | Token Variable | Approximate Px | Clamp Formula |
|
|
5
|
+
| :--- | :--- | :--- | :--- |
|
|
6
|
+
| `3xs` | `--space-3xs` | ~5px | `clamp(0.3125rem, 0.3125rem + 0vw, 0.3125rem)` |
|
|
7
|
+
| `2xs` | `--space-2xs` | ~9px | `clamp(0.5625rem, 0.5369rem + 0.1136vw, 0.625rem)` |
|
|
8
|
+
| `xs` | `--space-xs` | ~14px | `clamp(0.875rem, 0.8494rem + 0.1136vw, 0.9375rem)` |
|
|
9
|
+
| `s` | `--space-s` | ~18px | `clamp(1.125rem, 1.0739rem + 0.2273vw, 1.25rem)` |
|
|
10
|
+
| `m` | `--space-m` | ~27px | `clamp(1.6875rem, 1.6108rem + 0.3409vw, 1.875rem)` |
|
|
11
|
+
| `l` | `--space-l` | ~36px | `clamp(2.25rem, 2.1477rem + 0.4545vw, 2.5rem)` |
|
|
12
|
+
| `xl` | `--space-xl` | ~54px | `clamp(3.375rem, 3.2216rem + 0.6818vw, 3.75rem)` |
|
|
13
|
+
| `2xl` | `--space-2xl` | ~72px | `clamp(4.5rem, 4.2955rem + 0.9091vw, 5rem)` |
|
|
14
|
+
| `3xl` | `--space-3xl` | ~108px | `clamp(6.75rem, 6.4432rem + 1.3636vw, 7.5rem)` |
|
|
15
|
+
| `s-l` | `--space-s-l` | ~18→40px | `clamp(1.125rem, 0.5625rem + 2.5vw, 2.5rem)` |
|
|
16
|
+
|
|
17
|
+
## Typography Scale
|
|
18
|
+
| Step | Token Variable | Fluid Clamp |
|
|
19
|
+
| :--- | :--- | :--- |
|
|
20
|
+
| `xs` | `--text-xs` | `0.75rem` (12px) |
|
|
21
|
+
| `sm` | `--text-sm` | `clamp(0.9375rem, 0.9119rem + 0.1136vw, 1rem)` |
|
|
22
|
+
| `md` | `--text-md` | `clamp(1.125rem, 1.0739rem + 0.2273vw, 1.25rem)` |
|
|
23
|
+
| `lg` | `--text-lg` | `clamp(1.35rem, 1.2631rem + 0.3864vw, 1.5625rem)` |
|
|
24
|
+
| `xl` | `--text-xl` | `clamp(1.62rem, 1.4837rem + 0.6057vw, 1.9531rem)` |
|
|
25
|
+
| `2xl` | `--text-2xl` | `clamp(1.944rem, 1.7405rem + 0.9044vw, 2.4414rem)` |
|
|
26
|
+
| `3xl` | `--text-3xl` | `clamp(2.3328rem, 2.0387rem + 1.3072vw, 3.0518rem)` |
|
|
27
|
+
| `4xl` | `--text-4xl` | `clamp(2.7994rem, 2.384rem + 1.8461vw, 3.8147rem)` |
|
|
28
|
+
|
|
29
|
+
## Radius Scale
|
|
30
|
+
`0`, `2`, `4`, `6`, `8`, `12`, `16`, `24`, `full`
|
|
31
|
+
|
|
32
|
+
## Color & Surface Roles
|
|
33
|
+
* **Surfaces**: `--bg`, `--bg-surface`, `--bg-raised`
|
|
34
|
+
* **Ink**: `--text-primary`, `--text-secondary`, `--text-muted`, `--text-inverse`
|
|
35
|
+
* **Borders**: `--border`, `--border-strong`
|
|
36
|
+
* **Brand**: `--theme`, `--theme-hover`, `--theme-active`, `--ring`
|