@refrakt-md/types 0.14.0 → 0.14.1

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.
@@ -145,16 +145,20 @@ export interface PrimaryScale {
145
145
  /** Syntax-highlighting roles. Variables and ordinary identifiers fall through
146
146
  * to body `text`; only the meaning-bearing roles get distinct colours.
147
147
  *
148
+ * The contract is **tiered** (SPEC-056): seven required core roles cover
149
+ * everything a theme must define to render code at all, and nine optional
150
+ * extended roles let preset authors faithfully carry palettes that
151
+ * intentionally split distinctions the core collapses. Each optional role
152
+ * falls back to a documented core role via a `var()` chain emitted by the
153
+ * CSS generator — so a preset that doesn't set the optional role still
154
+ * renders correctly, just with less fidelity than a preset that does.
155
+ *
148
156
  * Naming follows Shiki's `token-*` vocabulary rather than language-specific
149
- * intuition. Two roles that might surprise you:
150
- * - `constant` covers numeric literals AND boolean/null/Symbol-style
151
- * language constants — Shiki paints them all from one slot, so the
152
- * contract reflects that rather than pretending `number` is distinct.
153
- * - There is no `type` field. Shiki's css-variables theme has no
154
- * `token-type` slot — type names get painted as `token-function`
155
- * (entity-name) and built-in types like `string` as `token-constant`.
156
- * Themes that want a distinct type colour need a custom highlighter
157
- * or grammar-level CSS, not a contract token. */
157
+ * intuition. One role that might surprise you: `constant` covers boolean/
158
+ * null/Symbol-style language constants AND numeric literals by default —
159
+ * Shiki paints them all from one slot. Palettes that distinguish numbers
160
+ * (e.g. Tokyo Night, One Dark) can set the optional `number` role to split
161
+ * them out. */
158
162
  export interface SyntaxTokens {
159
163
  keyword: string;
160
164
  function: string;
@@ -163,17 +167,50 @@ export interface SyntaxTokens {
163
167
  comment: string;
164
168
  punctuation: string;
165
169
  variable: string;
166
- /** URL/link tokens — markdown links, autolinks, comment URLs. Optional;
167
- * the generator defaults `--rf-syntax-token-link` to `function` when this
168
- * isn't set, so themes that don't care about distinguishing link from
169
- * function can omit it. Set explicitly when you want a distinct colour. */
170
+ /** URL/link tokens — markdown links, autolinks, comment URLs. Falls back
171
+ * to `function` when unset, so themes that don't care about distinguishing
172
+ * link from function can omit it. Set explicitly when you want a distinct
173
+ * colour. */
170
174
  link?: string;
171
175
  /** Interpolated expressions inside template literals (the `${foo}` part
172
- * of a backtick string). Optional; the generator defaults
173
- * `--rf-syntax-token-string-expression` to `string` when this isn't set.
174
- * Set explicitly when you want template-literal expressions to read
175
- * distinctly from the surrounding string. */
176
+ * of a backtick string). Falls back to `string` when unset. Set explicitly
177
+ * when you want template-literal expressions to read distinctly from the
178
+ * surrounding string. */
176
179
  'string-expression'?: string;
180
+ /** Type names, class names, interface names, generic parameters. Falls
181
+ * back to `function` when unset. Palettes that intentionally split type
182
+ * from function (Nord's Frost-7 vs Frost-8, Dracula's Cyan vs Green,
183
+ * Tokyo Night, One Dark, Catppuccin) set this; minimal palettes leave
184
+ * it unset and accept that types and functions share a colour. */
185
+ type?: string;
186
+ /** Object property access (`foo.bar`), object literal keys. Falls back
187
+ * to `variable` when unset. Some palettes paint properties as muted
188
+ * text; others give them a dedicated hue. */
189
+ property?: string;
190
+ /** Function/method parameters in declaration position. Falls back to
191
+ * `variable` when unset. Palettes that italicise or hue-shift
192
+ * parameters in declarations set this. */
193
+ parameter?: string;
194
+ /** JSX/HTML/XML element tag names. Falls back to `keyword` when unset —
195
+ * most palettes paint tags like keywords because both read as
196
+ * "control structure." Set explicitly when you want tags to read
197
+ * distinctly. */
198
+ tag?: string;
199
+ /** JSX/HTML/XML attribute names. Falls back to `function` when unset.
200
+ * Many palettes paint attributes the same as function names because
201
+ * they're both "named callables / addressable bindings." */
202
+ attribute?: string;
203
+ /** Arithmetic, comparison, logical operators (`+`, `===`, `&&`, etc.).
204
+ * Falls back to `punctuation` when unset. Most palettes don't split
205
+ * operators from punctuation; the ones that do (Tokyo Night, some
206
+ * Solarized variants) get a dedicated hue. */
207
+ operator?: string;
208
+ /** Numeric literals — split out when a palette colours numbers distinctly
209
+ * from booleans/null/Symbol-style constants. Falls back to `constant`
210
+ * when unset. */
211
+ number?: string;
212
+ /** Regular expression literals. Falls back to `string` when unset. */
213
+ regex?: string;
177
214
  }
178
215
  /** Recursive deep-partial. Every namespace optional; every leaf optional. */
179
216
  export type DeepPartial<T> = T extends object ? {
@@ -1 +1 @@
1
- {"version":3,"file":"token-contract.d.ts","sourceRoot":"","sources":["../src/token-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,aAAa;IAC7B;iFAC6E;IAC7E,IAAI,EAAE;QACL;uFAC+E;QAC/E,IAAI,EAAE,MAAM,CAAC;QACb,6DAA6D;QAC7D,IAAI,EAAE,MAAM,CAAC;KACb,CAAC;IAEF,qBAAqB;IACrB,KAAK,EAAE;QACN,wBAAwB;QACxB,IAAI,EAAE,MAAM,CAAC;QACb,yEAAyE;QACzE,KAAK,EAAE,MAAM,CAAC;QACd,8DAA8D;QAC9D,MAAM,EAAE,MAAM,CAAC;QACf,uBAAuB;QACvB,EAAE,EAAE,MAAM,CAAC;QAEX;wEACgE;QAChE,OAAO,EAAE,MAAM,CAAC;QAChB,sCAAsC;QACtC,eAAe,EAAE,MAAM,CAAC;QACxB;uEAC+D;QAC/D,eAAe,EAAE,YAAY,CAAC;QAE9B;yEACiE;QACjE,OAAO,EAAE;YACR,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,MAAM,CAAC;YACf,MAAM,EAAE,MAAM,CAAC;SACf,CAAC;QAEF;;0DAEkD;QAClD,IAAI,EAAE,eAAe,CAAC;QACtB,OAAO,EAAE,eAAe,CAAC;QACzB,MAAM,EAAE,eAAe,CAAC;QACxB,OAAO,EAAE,eAAe,CAAC;QAEzB;4CACoC;QACpC,IAAI,EAAE;YACL,EAAE,EAAE,MAAM,CAAC;YACX,IAAI,EAAE,MAAM,CAAC;YACb,WAAW,EAAE,MAAM,CAAC;SACpB,CAAC;KACF,CAAC;IAEF,4BAA4B;IAC5B,MAAM,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WAAW,iBAAkB,SAAQ,oBAAoB;IAC9D;;sEAEkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAE/C;;yDAEqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@refrakt-md/types",
3
3
  "description": "Shared type definitions for refrakt.md",
4
- "version": "0.14.0",
4
+ "version": "0.14.1",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {