fractalstyler2 0.4.0 → 0.7.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 +114 -95
- package/dist/cli.js +105 -25
- package/dist/components/Accordion.svelte +44 -0
- package/dist/components/Accordion.svelte.d.ts +23 -0
- package/dist/components/AccordionItem.svelte +44 -0
- package/dist/components/AccordionItem.svelte.d.ts +21 -0
- package/dist/components/AppShell.svelte +86 -0
- package/dist/components/AppShell.svelte.d.ts +39 -0
- package/dist/components/ColorPicker.svelte +38 -0
- package/dist/components/ColorPicker.svelte.d.ts +6 -0
- package/dist/components/Hero.svelte +14 -0
- package/dist/components/Hero.svelte.d.ts +9 -0
- package/dist/components/LayoutPicker.svelte +34 -0
- package/dist/components/LayoutPicker.svelte.d.ts +6 -0
- package/dist/components/MotionPicker.svelte +34 -0
- package/dist/components/MotionPicker.svelte.d.ts +6 -0
- package/dist/components/PageShell.svelte +14 -0
- package/dist/components/PageShell.svelte.d.ts +9 -0
- package/dist/components/PageSplit.svelte +26 -0
- package/dist/components/PageSplit.svelte.d.ts +18 -0
- package/dist/components/ShapePicker.svelte +37 -0
- package/dist/components/ShapePicker.svelte.d.ts +6 -0
- package/dist/css/fractalstyler.css +10643 -0
- package/dist/css/fractalstyler.min.css +2 -0
- package/dist/index.d.ts +18 -6
- package/dist/index.js +30 -12
- package/dist/mcp/schemas/compile_fractals.json +3 -3
- package/dist/mcp/schemas/css_to_fractals.json +1 -1
- package/dist/mcp/schemas/generate_component.json +2 -2
- package/dist/mcp/schemas/instructions.md +41 -14
- package/dist/mcp/schemas/list_fractals.json +9 -7
- package/dist/mcp/schemas/validate_recipe.json +2 -2
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +334 -237
- package/dist/presets.core.d.ts +42 -0
- package/dist/presets.core.js +190 -0
- package/dist/presets.svelte.d.ts +6 -0
- package/dist/presets.svelte.js +21 -0
- package/dist/styles/_00_presets.sass +111 -0
- package/dist/styles/_00_themes.sass +1061 -0
- package/dist/styles/_00_tokens.sass +57 -17
- package/dist/styles/_01_config.sass +77 -70
- package/dist/styles/_02_dimensions.sass +174 -0
- package/dist/styles/_03_containers.sass +105 -0
- package/dist/styles/_04_layouts.sass +100 -0
- package/dist/styles/_05_shells.sass +374 -0
- package/dist/styles/_06_visuals.sass +236 -0
- package/dist/styles/_07_interactions.sass +112 -0
- package/dist/styles/_08_own.sass +4 -0
- package/dist/styles/canonical-markups.md +160 -0
- package/dist/styles/index.sass +11 -18
- package/dist/themes.d.ts +7 -0
- package/dist/themes.js +45 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/package.json +26 -15
- package/plugin.json +11 -10
- package/registry.json +2002 -0
- package/skills/fractal-styler/SKILL.md +137 -50
- package/skills/fractal-styler/references/fractals.md +416 -28
- package/skills/fractal-styler/references/tokens.md +110 -36
- package/dist/styles/_02_fonts.sass +0 -13
- package/dist/styles/_03_responsive.sass +0 -31
- package/dist/styles/_04_atoms.sass +0 -155
- package/dist/styles/_05_molecules.sass +0 -97
- package/dist/styles/_06_recipes.sass +0 -189
- package/dist/styles/_07_base.sass +0 -44
- package/dist/styles/_08_blocks.sass +0 -433
- package/dist/styles/_09_utilities.sass +0 -208
- package/dist/styles/_10_layouts.sass +0 -373
- package/dist/styles/_11_own.sass +0 -21
- package/dist/styles/_fractals.sass +0 -14
- package/skills/style-migration/SKILL.md +0 -45
- package/templates/_00_tokens.sass +0 -136
- package/templates/_01_config.sass +0 -66
- package/templates/_02_fonts.sass +0 -13
- package/templates/_03_responsive.sass +0 -31
- package/templates/_04_atoms.sass +0 -155
- package/templates/_05_molecules.sass +0 -97
- package/templates/_06_recipes.sass +0 -189
- package/templates/_07_base.sass +0 -44
- package/templates/_08_blocks.sass +0 -433
- package/templates/_09_utilities.sass +0 -207
- package/templates/_10_layouts.sass +0 -373
- package/templates/_11_own.sass +0 -21
- package/templates/_fractals.sass +0 -14
- package/templates/index.sass +0 -18
|
@@ -1,83 +1,170 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fractal-styler
|
|
3
|
-
description:
|
|
3
|
+
description: Compose UI components and page layouts with the fractalstyler2 class registry — fluid tokens, container primitives, harmonic grids, and canonical application shells. Use when authoring components, applying design tokens, styling layouts, or reviewing markup for a fractalstyler2 project.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Fractal Styler (fractalstyler2)
|
|
7
7
|
|
|
8
|
-
`fractalstyler2` is a
|
|
8
|
+
`fractalstyler2` is a composition styling system. **The class registry is the
|
|
9
|
+
entire public API.** You compose in markup; you do not author CSS.
|
|
10
|
+
|
|
11
|
+
It ships as plain CSS and as editable SASS, from one source. Which one a
|
|
12
|
+
project took changes nothing you do: the classes, tokens, 41 themes and four
|
|
13
|
+
preset axes are identical either way. Check for `fractalstyler.css` or a
|
|
14
|
+
`src/lib/styles/` directory to know which you are in — and never assume a SASS
|
|
15
|
+
toolchain exists.
|
|
16
|
+
|
|
17
|
+
The system defines no authoring mixins and no SASS functions. If you find
|
|
18
|
+
yourself reaching for `+stack`, `+surface`, `+gap()`, `space()` or `radius()`,
|
|
19
|
+
you are inventing an API: none of them exist. The only two mixins in the source
|
|
20
|
+
are internal theme generators you never call.
|
|
21
|
+
|
|
22
|
+
Full class list: `references/fractals.md`. Tokens: `references/tokens.md`.
|
|
23
|
+
Both are generated from the stylesheet, so they cannot be stale.
|
|
9
24
|
|
|
10
25
|
---
|
|
11
26
|
|
|
12
|
-
## The
|
|
27
|
+
## The Prohibition
|
|
28
|
+
|
|
29
|
+
This is the rule the system is most often broken by, so it comes first.
|
|
30
|
+
|
|
31
|
+
**Do not create new classes.** Not in `_08_own.sass`, not in a component
|
|
32
|
+
`<style>` block, not anywhere. Compose from the registry in the `class`
|
|
33
|
+
attribute instead.
|
|
34
|
+
|
|
35
|
+
`_08_own.sass` exists for third-party widget overrides — a code editor, an
|
|
36
|
+
embedded chart, a map library that ships its own DOM. It is not for your
|
|
37
|
+
layout, your card, your sidebar, or your spacing. A module that adds hundreds
|
|
38
|
+
of lines there has not used the system; it has bypassed it.
|
|
39
|
+
|
|
40
|
+
Before you write a single custom declaration, run this checklist from
|
|
41
|
+
`docs/13-cookbook.md`:
|
|
42
|
+
|
|
43
|
+
1. Can it be composed with `.box` or `.row`?
|
|
44
|
+
2. Can `.gap-*` and `.pad-*` provide all the breathing room?
|
|
45
|
+
3. Can `.surface`, `.raised` or `.panel` provide the background?
|
|
46
|
+
4. Can `.border` or `.border-bottom` provide the dividing line?
|
|
47
|
+
5. Can `.button`, `.badge`, `.input` or `.select` handle the interactive state?
|
|
13
48
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
49
|
+
Five yeses means it belongs in the markup. That is nearly always the answer —
|
|
50
|
+
the cookbook composes segmented controls, tab strips, search bars, metric
|
|
51
|
+
tiles, activity feeds, dialogs and dropdowns with zero custom CSS.
|
|
52
|
+
|
|
53
|
+
Do **not** replace a composed class string with a "cleaner" semantic class.
|
|
54
|
+
`class="row ycenter xbetween gap-sm pad-md surface border"` is the finished
|
|
55
|
+
state, not an intermediate one to tidy away.
|
|
20
56
|
|
|
21
57
|
---
|
|
22
58
|
|
|
23
|
-
##
|
|
59
|
+
## The Six Layers
|
|
60
|
+
|
|
61
|
+
Each layer is built from the one below it. Naming follows all the way down.
|
|
24
62
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
63
|
+
| Layer | What it is | Reach for |
|
|
64
|
+
|:---|:---|:---|
|
|
65
|
+
| **L0** Tokens | Fluid scales and 31 colour roles | `--space-md`, `--text-lg`, `--bg-surface` |
|
|
66
|
+
| **L1** Dimensions | Space, size, radius | `.gap-sm`, `.pad-x-md`, `.marg--xs`, `.w-240`, `.min0` |
|
|
67
|
+
| **L2** Containers | Flow and alignment | `.box`, `.row`, `.grid`, `.xcenter`, `.ycenter`, `.grow` |
|
|
68
|
+
| **L3** Layouts | Grids, measures, frames | `.grid-3`, `.card-grid`, `.prose`, `.frame-16-9`, `.reel` |
|
|
69
|
+
| **L4** Shells | Page and app scaffolding | `.app-shell`, `.sidebar-left`, `.drawer`, `.dialog` |
|
|
70
|
+
| **L5** Visuals | Surfaces, ink, controls | `.surface`, `.text-muted`, `.border`, `.button.primary` |
|
|
30
71
|
|
|
31
72
|
---
|
|
32
73
|
|
|
33
|
-
##
|
|
74
|
+
## Rules That Actually Bite
|
|
75
|
+
|
|
76
|
+
**1. Every token is also a class.** `--space-md` implies `.gap-md`, `.pad-md`,
|
|
77
|
+
`.marg-md`. Never invent a second vocabulary.
|
|
78
|
+
|
|
79
|
+
**2. `x` is always horizontal, `y` is always vertical — in every container.**
|
|
80
|
+
This is the system's central convenience. `.xcenter` centres horizontally on
|
|
81
|
+
`.box`, on `.row`, and on `.grid`, even though the underlying property differs
|
|
82
|
+
each time. Never reason about `justify-content` vs `align-items`.
|
|
83
|
+
|
|
84
|
+
Not every combination exists, because not every one is meaningful:
|
|
85
|
+
`.box` has no `x`-distribution (`xbetween`, `xevenly`, `xaround`), and
|
|
86
|
+
`.row` has no `y`-distribution. Check `references/fractals.md` rather than
|
|
87
|
+
guessing.
|
|
88
|
+
|
|
89
|
+
**3. Grids step through divisors only.** `.grid-6` goes 6 → 3 → 2 → 1 and
|
|
90
|
+
never 5 or 4, so no row is ever left holding one card. Use `.grid-N` when you
|
|
91
|
+
know the count at authoring time; use `.card-grid` when you do not (a query
|
|
92
|
+
result, a feed) and let it auto-fit.
|
|
93
|
+
|
|
94
|
+
**4. A shell class without its canonical markup is half a definition.** L4
|
|
95
|
+
classes assume a specific structure. Copy it from
|
|
96
|
+
`docs/08-shells-and-markups.md` or `styles/canonical-markups.md` verbatim —
|
|
97
|
+
the responsive behaviour (right rail retracts at 1280, left rail becomes a
|
|
98
|
+
drawer at 1024) is a consequence of that structure, and you get it for free
|
|
99
|
+
only by following it.
|
|
100
|
+
|
|
101
|
+
**5. Prefer preset steps to literals.** `.gap-sm` over `.gap-16`. Literals are
|
|
102
|
+
the sanctioned escape hatch for exact requirements — a 16px icon box, a 1px
|
|
103
|
+
rule — not the default. They come from a discrete ladder, not any integer:
|
|
104
|
+
`0, 1, 2, 4, 6, 8, 12`, then every multiple of 8 — up to 64px for `gap`, `pad`,
|
|
105
|
+
`marg` and `radius`, up to 512px for `w`, `h` and `square`.
|
|
106
|
+
|
|
107
|
+
**6. Responsive without media queries.** Append `-mob` (below 768px) or
|
|
108
|
+
`-desk` (768px and above) to any dimension class: `pad-xs-mob pad-lg-desk`.
|
|
109
|
+
|
|
110
|
+
**7. Visual toggles ride classes; semantics stay native.** `.open`, `.active`
|
|
111
|
+
for JS-driven looks; `[disabled]`, `[aria-expanded]`, `:focus-visible` keep
|
|
112
|
+
their own meaning.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Authoring a Component
|
|
34
117
|
|
|
35
118
|
```svelte
|
|
36
119
|
<script lang="ts">
|
|
37
|
-
let {
|
|
38
|
-
title = 'Pricing Tier',
|
|
39
|
-
price = '$29',
|
|
40
|
-
highlighted = false,
|
|
41
|
-
children
|
|
42
|
-
} = $props();
|
|
120
|
+
let { title = 'Pricing', price = '$29', highlighted = false, children } = $props();
|
|
43
121
|
</script>
|
|
44
122
|
|
|
45
|
-
<article class="
|
|
46
|
-
<div class="row ycenter xbetween">
|
|
47
|
-
<h3 class="text-
|
|
48
|
-
{#if highlighted}
|
|
49
|
-
<span class="badge" data-variant="theme">Popular</span>
|
|
50
|
-
{/if}
|
|
123
|
+
<article class="card box gap-md pad-md surface border radius-md" class:active={highlighted}>
|
|
124
|
+
<div class="row ycenter xbetween gap-sm">
|
|
125
|
+
<h3 class="text-lg weight-600 marg-0">{title}</h3>
|
|
126
|
+
{#if highlighted}<span class="badge">Popular</span>{/if}
|
|
51
127
|
</div>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<span class="
|
|
128
|
+
|
|
129
|
+
<div class="row ybot gap-2xs">
|
|
130
|
+
<span class="text-3xl weight-700 text-primary">{price}</span>
|
|
131
|
+
<span class="text-xs text-muted">/month</span>
|
|
55
132
|
</div>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
133
|
+
|
|
134
|
+
{#if children}{@render children()}{/if}
|
|
135
|
+
|
|
136
|
+
<button class="button primary wfull">Choose plan</button>
|
|
59
137
|
</article>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
No `<style>` block. That is the expected outcome, not an unusual one.
|
|
141
|
+
|
|
142
|
+
---
|
|
60
143
|
|
|
61
|
-
|
|
62
|
-
@use '$lib/styles/fractals' as *
|
|
144
|
+
## Presets
|
|
63
145
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
+stack(m)
|
|
67
|
-
transition: transform 150ms ease, box-shadow 150ms ease
|
|
146
|
+
Four axes, applied as attributes on `<html>` — or on any element, to scope a
|
|
147
|
+
themed region:
|
|
68
148
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
+shadow(lg)
|
|
72
|
-
</style>
|
|
149
|
+
```html
|
|
150
|
+
<html data-shape="sharp" data-layout="tight" data-color="vibrant" data-motion="springy">
|
|
73
151
|
```
|
|
74
152
|
|
|
153
|
+
An absent attribute means that axis's default. Values are in
|
|
154
|
+
`references/tokens.md`. Presets remap tokens only; they never require a markup
|
|
155
|
+
change.
|
|
156
|
+
|
|
75
157
|
---
|
|
76
158
|
|
|
77
|
-
## MCP Tools
|
|
159
|
+
## MCP Tools
|
|
160
|
+
|
|
161
|
+
If the host connects the `fractalstyler2` MCP server:
|
|
162
|
+
|
|
163
|
+
- `list_fractals` — the class registry, filterable by layer (`L0`..`L5`)
|
|
164
|
+
- `get_design_tokens` — space, type, radius and colour scales
|
|
165
|
+
- `css_to_fractals` — translate raw CSS declarations into registry classes
|
|
166
|
+
- `snap_to_tokens` — snap arbitrary pixel values to the nearest token step
|
|
167
|
+
- `validate_recipe` — lint markup against these rules
|
|
168
|
+
- `compile_fractals` — compile the stylesheet and verify output
|
|
78
169
|
|
|
79
|
-
|
|
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.
|
|
170
|
+
Query `list_fractals` before naming any class you are not certain of.
|