@monospaced/set-config 0.25.0 → 0.27.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 +6 -3
- package/package.json +1 -1
- package/set.catalog.css +9 -1
- package/stylelint/index.mjs +52 -12
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ export default [
|
|
|
67
67
|
|
|
68
68
|
## Stylelint
|
|
69
69
|
|
|
70
|
-
Drop-in shareable config — extends `stylelint-config-standard` and layers on Set's CSS authoring discipline: alphabetical property ordering (`stylelint-order`), token-discipline rules (no raw colors, no absolute lengths, no
|
|
70
|
+
Drop-in shareable config — extends `stylelint-config-standard` and layers on Set's CSS authoring discipline: alphabetical property ordering (`stylelint-order`), token-discipline rules (no raw colors, no absolute lengths, no `!important`, no `letter-spacing`, numeric `font-weight` only), logical-CSS enforcement (`stylelint-plugin-logical-css`) so component CSS stays portable across writing modes, and the Baseline rule (`plugin/use-baseline`, see above). Needless disables are reported: a `stylelint-disable` comment that suppresses nothing fails, so a Baseline justification is removed the moment the data makes it unnecessary.
|
|
71
71
|
|
|
72
72
|
```js
|
|
73
73
|
// .stylelintrc.mjs
|
|
@@ -88,10 +88,13 @@ Or as JSON:
|
|
|
88
88
|
|
|
89
89
|
### Authoring stance
|
|
90
90
|
|
|
91
|
-
This preset is opinionated. It encodes Set's
|
|
91
|
+
This preset is opinionated. It encodes Set's authoring discipline rather than a generic Stylelint baseline, and it is the same in every Set mode (strict, loose and free; see `@monospaced/set-skills`): the modes differ in where custom CSS is written, not in what it may contain. Some defaults are worth highlighting because they often surface in consumer projects:
|
|
92
92
|
|
|
93
93
|
- **Same-file custom-property scope.** The `set/set-known-tokens` rule rejects `var(--*)` references that aren't defined in the same file — including consumers' own organisation across CSS files (`theme.css` defining vars, `card.css` consuming them). Define within the file you use it in. Catalog tokens (`--set-*` from the catalog) and same-file definitions both pass; everything else fails.
|
|
94
|
-
- **Tight value lists.** `border-radius`, `border-width`, `box-shadow`, `font`, `
|
|
94
|
+
- **Tight value lists.** `border-radius`, `border-width`, `box-shadow`, `font`, `line-height`, `opacity`, and the timing-function properties only accept `var()`, function calls (`calc()`, `cubic-bezier()`, etc.), `0`/`1`/keywords, and percentages. The timing-function properties also accept the CSS easing keywords (`linear`, `ease-out`, `step-end`, etc.).
|
|
95
|
+
- **Time units are allowed.** Durations usually come from the motion tokens, but `ms` and `s` pass, so graphics can step on any timing.
|
|
96
|
+
- **`font-weight` is a number, never a keyword.** A weight token resolves to a number, and any number on the font's weight axis passes; `bold` and `normal` fail (`font-weight-notation: numeric`).
|
|
97
|
+
- **`letter-spacing` is banned.** Tracking breaks the character grid, and Set already fits the type.
|
|
95
98
|
|
|
96
99
|
If your project organises tokens across files and you want catalog enforcement without same-file scope, opt out:
|
|
97
100
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monospaced/set-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Shared developer-tooling config for Set. ESLint, Stylelint, Prettier, browserslist presets plus the --set-* token catalog for editor autocomplete and tooling.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
package/set.catalog.css
CHANGED
|
@@ -132,6 +132,10 @@
|
|
|
132
132
|
--set-layout-icon-size-xs: 1.125rem; /** Small icon size. */
|
|
133
133
|
--set-layout-icon-viewbox-inset-ratio: 0.08854167; /** Icon viewBox inset ratio. Use as the multiplier for compensating icon edge inset in layout calculations. */
|
|
134
134
|
--set-layout-icon-viewbox-outset-ratio: -0.08854167; /** Icon viewBox outset ratio. Use as the multiplier for compensating icon edge outset in layout calculations. */
|
|
135
|
+
--set-layout-page-header-block-size-current: 3.75rem; /** The page header block size in effect; defaults to `page.header.blockSize.md`. The page shell sets it for its header size, so anything that lines up with the header, such as a sticky element below it, reads this token rather than a spacing step. */
|
|
136
|
+
--set-layout-page-header-block-size-lg: 4.5rem; /** Large page header block size. Grows from tablet. */
|
|
137
|
+
--set-layout-page-header-block-size-md: 3.75rem; /** Default page header block size. */
|
|
138
|
+
--set-layout-page-header-block-size-sm: 3rem; /** Small page header block size. */
|
|
135
139
|
--set-layout-spacing-vertical-1000: 4.5rem; /** Responsive layout vertical spacing 1000. */
|
|
136
140
|
--set-layout-spacing-vertical-1100: 5.25rem; /** Responsive layout vertical spacing 1100. */
|
|
137
141
|
--set-layout-spacing-vertical-1200: 6rem; /** Responsive layout vertical spacing 1200. Largest vertical block gap. */
|
|
@@ -157,7 +161,7 @@
|
|
|
157
161
|
--set-motion-easing-ease-in: cubic-bezier(0.32, 0, 1, 1); /** Ease-in curve. Use for elements leaving the viewport — slow start, accelerating exit. */
|
|
158
162
|
--set-motion-easing-ease-in-out: cubic-bezier(0.25, 0, 0.75, 1); /** Ease-in-out curve. Use for movements that both originate and settle on screen (e.g. expansions in place). */
|
|
159
163
|
--set-motion-easing-ease-out: cubic-bezier(0, 0, 0.68, 1); /** Ease-out curve. Use for elements entering the viewport — fast start, gentle settle. */
|
|
160
|
-
--set-motion-easing-emphasized: cubic-bezier(0.518, 0, 0.482, 1); /** Emphasised easing curve. Use for transitions that should feel more expressive
|
|
164
|
+
--set-motion-easing-emphasized: cubic-bezier(0.518, 0, 0.482, 1); /** Emphasised easing curve. Use for transitions that should feel more expressive. */
|
|
161
165
|
--set-motion-frame-default: 0.125s; /** Default frame period for stepped graphic motion, 8fps (on threes). Use for dissolves, scans and lighting changes; not for UI transitions. */
|
|
162
166
|
--set-motion-frame-fast: 0.083333s; /** Frame period for stepped graphic motion, 12fps (on twos). Use for redraws that follow the pointer; not for UI transitions. */
|
|
163
167
|
--set-motion-frame-slow: 0.166667s; /** Frame period for stepped graphic motion, 6fps (on fours). Use for ambient drift; not for UI transitions. */
|
|
@@ -277,10 +281,14 @@
|
|
|
277
281
|
--set-typography-leading-950: 3.75rem; /** Leading step 950. */
|
|
278
282
|
--set-typography-measure-default: 35.25em; /** Default measure (line length, in em). Use as the comfortable maximum width to keep line lengths readable. */
|
|
279
283
|
--set-typography-measure-tight: 31.75em; /** Tighter measure (line length, in em). A more constrained alternative to the default. */
|
|
284
|
+
--set-typography-metric-default-ascent: 0.956em; /** Depth of the baseline below the top of the character cell (the font's ascent), in em. In a line box of any height, the baseline sits this, plus half the line height, less half the cell height, below its top. */
|
|
280
285
|
--set-typography-metric-default-cap-balance: 0.031em; /** Bottom padding to vertically balance a filled single-line cell (e.g. inline code), in em. */
|
|
286
|
+
--set-typography-metric-default-cap-height: 0.68em; /** Height of flat capitals (e.g. H) above the baseline, in em. */
|
|
281
287
|
--set-typography-metric-default-cell-height: 1.2em; /** Character cell height (full line box), in em. */
|
|
282
288
|
--set-typography-metric-default-cell-width: 0.6em; /** Character cell width (advance), in em. */
|
|
283
289
|
--set-typography-metric-default-cell-width-condensed: 0.45em; /** Character cell width (advance) at the narrowest font width, in em. Advance runs in a straight line between this at the ultra-condensed width and the cell width at normal, because the width axis interpolates between two masters; where the font has no width axis the two are equal. */
|
|
290
|
+
--set-typography-metric-default-descender: 0.215em; /** Depth of descenders (e.g. p) below the baseline, in em. */
|
|
291
|
+
--set-typography-metric-default-overshoot: 0.01em; /** How far round letters (e.g. O, S) pass the cap height above and the baseline below, in em. */
|
|
284
292
|
--set-typography-metric-default-side-bearing-pair: 0.17em; /** Both facing sidebearings combined — one inter-letter gap (2× single); basis for word-spacing, in em. */
|
|
285
293
|
--set-typography-metric-default-side-bearing-single: 0.085em; /** A single per-side sidebearing, in em. */
|
|
286
294
|
--set-typography-paragraph-spacing-default: 1.5rem; /** Default vertical spacing between paragraphs. */
|
package/stylelint/index.mjs
CHANGED
|
@@ -25,7 +25,32 @@ const COLOR_FUNCTIONS_DISALLOWED = [
|
|
|
25
25
|
const TOKENS_HINT =
|
|
26
26
|
"Set values come from tokens — see @monospaced/set-config/set.catalog.css.";
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
// Time units stay: durations come from tokens, and graphics in loose and
|
|
29
|
+
// free mode may step on any timing.
|
|
30
|
+
const UNITS_DISALLOWED = ["cm", "in", "mm", "pc", "pt", "px", "Q"];
|
|
31
|
+
|
|
32
|
+
// What the strict-value properties may take besides a token or a function.
|
|
33
|
+
const STRICT_VALUE_KEYWORDS = [
|
|
34
|
+
"/^[\\d.]+%$/",
|
|
35
|
+
"0",
|
|
36
|
+
"1",
|
|
37
|
+
"inherit",
|
|
38
|
+
"initial",
|
|
39
|
+
"none",
|
|
40
|
+
"revert",
|
|
41
|
+
"unset",
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
// The CSS easing keywords, allowed alongside the easing tokens.
|
|
45
|
+
const EASING_KEYWORDS = [
|
|
46
|
+
"ease",
|
|
47
|
+
"ease-in",
|
|
48
|
+
"ease-in-out",
|
|
49
|
+
"ease-out",
|
|
50
|
+
"linear",
|
|
51
|
+
"step-end",
|
|
52
|
+
"step-start",
|
|
53
|
+
];
|
|
29
54
|
|
|
30
55
|
const stylelintConfig = {
|
|
31
56
|
extends: [
|
|
@@ -67,6 +92,12 @@ const stylelintConfig = {
|
|
|
67
92
|
},
|
|
68
93
|
{ message: `Property "%s" cannot use unit "%s". ${TOKENS_HINT}` },
|
|
69
94
|
],
|
|
95
|
+
// Any value is a number: a weight token resolves to one, and free mode
|
|
96
|
+
// can set any weight on the font's axis. Keywords never.
|
|
97
|
+
"font-weight-notation": [
|
|
98
|
+
"numeric",
|
|
99
|
+
{ message: "Use a numeric font-weight: a token, or a number." },
|
|
100
|
+
],
|
|
70
101
|
"function-disallowed-list": [
|
|
71
102
|
COLOR_FUNCTIONS_DISALLOWED,
|
|
72
103
|
{ message: `Function "%s()" is disallowed. ${TOKENS_HINT}` },
|
|
@@ -97,29 +128,38 @@ const stylelintConfig = {
|
|
|
97
128
|
ignoreSelectors: ["marker", "selection"],
|
|
98
129
|
},
|
|
99
130
|
],
|
|
131
|
+
"property-disallowed-list": [
|
|
132
|
+
["letter-spacing"],
|
|
133
|
+
{
|
|
134
|
+
message:
|
|
135
|
+
"letter-spacing is disallowed. Tracking breaks the character grid, and Set already fits the type.",
|
|
136
|
+
},
|
|
137
|
+
],
|
|
100
138
|
"scale-unlimited/declaration-strict-value": [
|
|
101
139
|
[
|
|
102
140
|
"/^border.*radius$/",
|
|
103
141
|
"/^border.*width$/",
|
|
104
142
|
"animation-timing-function",
|
|
105
143
|
"box-shadow",
|
|
106
|
-
"font-weight",
|
|
107
144
|
"font",
|
|
108
145
|
"line-height",
|
|
109
146
|
"opacity",
|
|
110
147
|
"transition-timing-function",
|
|
111
148
|
],
|
|
112
149
|
{
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"
|
|
122
|
-
|
|
150
|
+
// A property's own list replaces the catch-all, so the timing
|
|
151
|
+
// functions restate it.
|
|
152
|
+
ignoreValues: {
|
|
153
|
+
"": STRICT_VALUE_KEYWORDS,
|
|
154
|
+
"animation-timing-function": [
|
|
155
|
+
...STRICT_VALUE_KEYWORDS,
|
|
156
|
+
...EASING_KEYWORDS,
|
|
157
|
+
],
|
|
158
|
+
"transition-timing-function": [
|
|
159
|
+
...STRICT_VALUE_KEYWORDS,
|
|
160
|
+
...EASING_KEYWORDS,
|
|
161
|
+
],
|
|
162
|
+
},
|
|
123
163
|
message: `Value for "\${property}" must be a token, calc(), %, 0, 1, or keyword. ${TOKENS_HINT}`,
|
|
124
164
|
},
|
|
125
165
|
],
|