@theme-registry/refract 0.1.8 → 0.1.9
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 +18 -7
- package/dist/build/preview.d.ts +19 -15
- package/dist/build.cjs.js +1 -1
- package/dist/build.cjs.js.map +1 -1
- package/dist/build.esm.js +1 -1
- package/dist/build.esm.js.map +1 -1
- package/dist/cli.js +779 -229
- package/dist/cli.js.map +1 -1
- package/dist/core/ThemeAdapter.d.ts +33 -0
- package/package.json +1 -1
- package/skills/build-config/SKILL.md +12 -1
|
@@ -195,6 +195,39 @@ export interface PreviewDescriptor {
|
|
|
195
195
|
readonly unavailable?: string;
|
|
196
196
|
/** Caveats worth surfacing on the page even when rendering does work (e.g. "`variables: false` — …"). */
|
|
197
197
|
readonly notes?: readonly string[];
|
|
198
|
+
/**
|
|
199
|
+
* A token path → the name the emitted output gives it (`colors.brand` → `--dt-colors-brand`).
|
|
200
|
+
* Shown beside each value, so a reader can go straight from the specimen to the thing they type.
|
|
201
|
+
* Return `undefined` for a path that mints no name.
|
|
202
|
+
*/
|
|
203
|
+
readonly tokenName?: (path: string) => string | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* The states a recipe actually declares (`["hover", "focus", "disabled"]`), so the page can render
|
|
206
|
+
* a state matrix instead of one at-rest specimen. Only states that also answer to
|
|
207
|
+
* {@link statePinClass} are rendered — a state nobody can pin can't be shown at rest.
|
|
208
|
+
*/
|
|
209
|
+
readonly states?: (recipe: UsageRecipe) => readonly string[];
|
|
210
|
+
/**
|
|
211
|
+
* The class that forces `state` to render at rest. CSS states are pseudo-classes (`:hover`) and
|
|
212
|
+
* attribute selectors (`[disabled]`) that markup cannot switch on, so the adapter emits a parallel
|
|
213
|
+
* pinnable rule (see {@link statePinCss}) and names its class here.
|
|
214
|
+
*/
|
|
215
|
+
readonly statePinClass?: (state: string) => string | undefined;
|
|
216
|
+
/**
|
|
217
|
+
* Extra stylesheet the page inlines to make {@link statePinClass} work. Kept out of the emitted
|
|
218
|
+
* theme on purpose: these rules exist only to drive a specimen sheet and must never reach a
|
|
219
|
+
* consumer's bundle.
|
|
220
|
+
*/
|
|
221
|
+
readonly statePinCss?: string;
|
|
222
|
+
/**
|
|
223
|
+
* A composed recipe's identity broken into its parts — each emitted class plus the recipe address
|
|
224
|
+
* it came from (`undefined` ⇒ this rule-set's own delta). Rendering the joined string without
|
|
225
|
+
* saying why it's two classes reads as a bug.
|
|
226
|
+
*/
|
|
227
|
+
readonly composition?: (recipe: UsageRecipe) => ReadonlyArray<{
|
|
228
|
+
readonly className: string;
|
|
229
|
+
readonly from?: string;
|
|
230
|
+
}> | undefined;
|
|
198
231
|
}
|
|
199
232
|
/** The Model-derived context bound alongside the Model. */
|
|
200
233
|
export interface RenderContext<TBreakpoint extends string = string> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theme-registry/refract",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "The framework-agnostic, format-neutral theme compiler core — build a ThemeModel from a RawTheme, then lower it with any adapter package (CSS, SCSS, JSON, styled-components).",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Petyo Stoyanov",
|
|
@@ -85,11 +85,22 @@ every token and lists every recipe by its real identity, and states why it can't
|
|
|
85
85
|
If a user wants a live design-review page from an SC or SCSS theme, tell them to **add a CSS target
|
|
86
86
|
to the same config** — same recipes through the same core, so it's a faithful specimen.
|
|
87
87
|
|
|
88
|
-
The page
|
|
88
|
+
The page is a **style guide**, not a token dump: sticky section rail, colour families as contiguous
|
|
89
|
+
ladders with live WCAG contrast readouts on each `text` pairing, the type ramp set in its own sizes,
|
|
90
|
+
spacing as a measure *and* an applied inset (there is no `padding` token — spacing IS the padding
|
|
91
|
+
scale), a **state matrix** per recipe, an **appearance-mode diff** of the tokens that actually carry
|
|
92
|
+
an override, **composition** broken into its parts, and a prose specimen for the bare elements the
|
|
93
|
+
`globals` subsystem themes. Sections appear only when the theme has tokens of that kind.
|
|
94
|
+
|
|
95
|
+
It follows the target's `emit` mode (variables load before styles in `split`; plates group by
|
|
89
96
|
subsystem or by component file), gains a light/dark toggle when the theme declares `modes`, and
|
|
90
97
|
frame-width buttons when it declares `breakpoints`. A theme with **no recipes** (e.g. straight out of
|
|
91
98
|
`refract create`) renders its tokens and says explicitly that recipes are missing.
|
|
92
99
|
|
|
100
|
+
**State rules never reach the shipped stylesheet.** A CSS pseudo-class can't be triggered from
|
|
101
|
+
markup, so the adapter emits parallel pinnable rules (`.cls.rfp-s-hover`) that are inlined into
|
|
102
|
+
`preview.html` only. If a user asks why those classes aren't in `theme.css`, that's why.
|
|
103
|
+
|
|
93
104
|
## Dark-mode strategy (differs by target)
|
|
94
105
|
|
|
95
106
|
- **CSS / SCSS / JSON** — dark rides the *referenced token's own `modes`* (see **theme-foundations**);
|