@refrakt-md/types 0.12.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.
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/theme.d.ts +54 -7
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +7 -1
- package/dist/theme.js.map +1 -1
- package/dist/token-contract.d.ts +248 -0
- package/dist/token-contract.d.ts.map +1 -0
- package/dist/token-contract.js +2 -0
- package/dist/token-contract.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { Newable, NodeType, } from './interfaces.js';
|
|
2
2
|
export type { DesignTokens } from './tokens.js';
|
|
3
|
-
export type {
|
|
3
|
+
export type { TokenContract, PartialTokenContract, ThemeTokensConfig, ThemeTokensModeOverlay, SentimentTokens, PrimaryScale, SyntaxTokens, DeepPartial, } from './token-contract.js';
|
|
4
|
+
export type { RefraktConfig, SiteConfig, SiteThemeConfig, PlanConfig, ThemeManifest, LayoutDefinition, RouteRule, ComponentDefinition, } from './theme.js';
|
|
5
|
+
export { getThemePackage } from './theme.js';
|
|
4
6
|
export type { Plugin, PluginRune, PluginAttribute, RuneExtension, PluginThemeConfig, } from './package.js';
|
|
5
7
|
export type { SerializedTag, RendererNode } from './serialized.js';
|
|
6
8
|
export type { BaseComponentProps, PageSectionSlots, SplitLayoutProperties, } from './component-props.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,QAAQ,GACT,MAAM,iBAAiB,CAAC;AAIzB,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,YAAY,EACV,aAAa,EACb,UAAU,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,mBAAmB,GACpB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,QAAQ,GACT,MAAM,iBAAiB,CAAC;AAIzB,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EACV,aAAa,EACb,UAAU,EACV,eAAe,EACf,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,YAAY,EACV,MAAM,EACN,UAAU,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGnE,YAAY,EACX,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,GACrB,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EACX,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,SAAS,EACT,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,eAAe,GACf,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACX,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,mBAAmB,GACnB,MAAM,eAAe,CAAC;AAGvB,YAAY,EACX,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACX,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAmE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/theme.d.ts
CHANGED
|
@@ -1,11 +1,57 @@
|
|
|
1
|
+
/** Extract the theme package identifier from a `SiteConfig.theme` value.
|
|
2
|
+
* Accepts either the legacy string form or the new {@link SiteThemeConfig}
|
|
3
|
+
* object form (where the identifier lives in `package`). Useful at call sites
|
|
4
|
+
* that need the package name for dynamic import or noExternal lists. */
|
|
5
|
+
export declare function getThemePackage(theme: string | SiteThemeConfig): string;
|
|
6
|
+
/** Per-site theme configuration. May be supplied as a string (legacy shorthand
|
|
7
|
+
* for `{ package: <string> }`) or as a full object with token overrides,
|
|
8
|
+
* presets, modes, and colour-scheme behaviour.
|
|
9
|
+
*
|
|
10
|
+
* Per SPEC-048: the contract is universal, values are themed; presets are
|
|
11
|
+
* plain data merged in declared order. Per SPEC-052: `colorScheme` is the
|
|
12
|
+
* *site-wide* root of the per-page tint cascade — every page inherits from
|
|
13
|
+
* this unless its layout or own frontmatter overrides. */
|
|
14
|
+
export interface SiteThemeConfig {
|
|
15
|
+
/** Active theme — package name or relative path. */
|
|
16
|
+
package: string;
|
|
17
|
+
/** Preset modules to merge into the theme, in declared order (last wins
|
|
18
|
+
* per token). Each entry is a module identifier (npm package + export
|
|
19
|
+
* path) that resolves to a `ThemeTokensConfig`. */
|
|
20
|
+
presets?: string[];
|
|
21
|
+
/** Initial colour scheme behaviour for the rendered site.
|
|
22
|
+
* - `'auto'` (default): respect user preference (saved or system).
|
|
23
|
+
* - `'light'` / `'dark'`: force this scheme regardless of user preference.
|
|
24
|
+
* The pre-paint client script no-ops and does not apply saved preference. */
|
|
25
|
+
colorScheme?: 'auto' | 'light' | 'dark';
|
|
26
|
+
/** Site-level token overrides applied on top of the theme's base values and
|
|
27
|
+
* any presets. Validated against the typed `TokenContract`. */
|
|
28
|
+
tokens?: import('./token-contract.js').ThemeTokensConfig;
|
|
29
|
+
/** Site-level per-mode overlays (e.g. `dark`). Layer on top of the theme's
|
|
30
|
+
* modes and any preset modes. */
|
|
31
|
+
modes?: Record<string, import('./token-contract.js').PartialTokenContract>;
|
|
32
|
+
/** Code-block-specific theme settings. */
|
|
33
|
+
code?: {
|
|
34
|
+
/** Force fenced code blocks to a specific colour scheme regardless of
|
|
35
|
+
* the surrounding page mode.
|
|
36
|
+
* - `'auto'` (default): code blocks follow the page's light/dark mode.
|
|
37
|
+
* - `'dark'` / `'light'`: stamp `data-color-scheme` on each `<pre>` so
|
|
38
|
+
* the cascade picks the matching scheme's values for syntax tokens,
|
|
39
|
+
* background, foreground, and border. Lets sites keep an
|
|
40
|
+
* always-dark code aesthetic on light pages (Stripe/Vercel-style)
|
|
41
|
+
* without hand-maintaining a parallel override stylesheet. */
|
|
42
|
+
colorScheme?: 'auto' | 'light' | 'dark';
|
|
43
|
+
};
|
|
44
|
+
}
|
|
1
45
|
/** Per-site configuration. A project may declare a single site (via `site`) or
|
|
2
46
|
* multiple named sites (via `sites: { name: SiteConfig }`).
|
|
3
47
|
* Only `contentDir` and `theme` are strictly required for the site to load. */
|
|
4
48
|
export interface SiteConfig {
|
|
5
49
|
/** Path to content directory, relative to project root */
|
|
6
50
|
contentDir: string;
|
|
7
|
-
/** Active theme — package name
|
|
8
|
-
|
|
51
|
+
/** Active theme — accepts either a package name string (legacy shorthand)
|
|
52
|
+
* or a full {@link SiteThemeConfig} with presets, token overrides, mode
|
|
53
|
+
* overlays, and `colorScheme`. */
|
|
54
|
+
theme: string | SiteThemeConfig;
|
|
9
55
|
/** Documentation-only adapter hint (`svelte`, `astro`, `next`, `nuxt`, `eleventy`, `html`).
|
|
10
56
|
* No adapter reads or validates this field today; it serves as an in-config record of
|
|
11
57
|
* which adapter the site is intended for. Slated for removal in v1.0. */
|
|
@@ -25,7 +71,10 @@ export interface SiteConfig {
|
|
|
25
71
|
icons?: Record<string, string>;
|
|
26
72
|
/** Plugins to merge into this site's ThemeConfig (runes, layouts, hooks, etc.) */
|
|
27
73
|
plugins?: string[];
|
|
28
|
-
/** Project-level tint presets — merged after theme tints (last wins)
|
|
74
|
+
/** Project-level tint presets — merged after theme tints (last wins).
|
|
75
|
+
* Field shape matches `TintDefinition` from `@refrakt-md/transform` per
|
|
76
|
+
* SPEC-053; `Record<string, unknown>` is used here to avoid a cross-package
|
|
77
|
+
* type dependency in `@refrakt-md/types`. */
|
|
29
78
|
tints?: Record<string, Record<string, unknown>>;
|
|
30
79
|
/** Project-level background presets — merged after theme backgrounds (last wins) */
|
|
31
80
|
backgrounds?: Record<string, Record<string, unknown>>;
|
|
@@ -77,8 +126,8 @@ export interface RefraktConfig {
|
|
|
77
126
|
sites?: Record<string, SiteConfig>;
|
|
78
127
|
/** @deprecated Shorthand for `sites.default.contentDir`. Undefined for multi-site configs — use `resolveSite(config).site.contentDir`. */
|
|
79
128
|
contentDir?: string;
|
|
80
|
-
/** @deprecated Shorthand for `sites.default.theme`. Undefined for multi-site configs — use `resolveSite(config).site.theme`. */
|
|
81
|
-
theme?: string;
|
|
129
|
+
/** @deprecated Shorthand for `sites.default.theme`. Undefined for multi-site configs — use `resolveSite(config).site.theme`. Accepts the same `string | SiteThemeConfig` shape as the per-site field. */
|
|
130
|
+
theme?: string | SiteThemeConfig;
|
|
82
131
|
/** @deprecated Shorthand for `sites.default.target`. Undefined for multi-site configs — use `resolveSite(config).site.target`. The field itself is also under review (v0.11.0 follow-up): adapters do not validate it and it is increasingly vestigial; treat it as documentation-only for now. */
|
|
83
132
|
target?: string;
|
|
84
133
|
/** @deprecated Shorthand for `sites.default.overrides` */
|
|
@@ -94,8 +143,6 @@ export interface RefraktConfig {
|
|
|
94
143
|
};
|
|
95
144
|
/** @deprecated Shorthand for `sites.default.icons` */
|
|
96
145
|
icons?: Record<string, string>;
|
|
97
|
-
/** @deprecated Shorthand for `sites.default.tints` */
|
|
98
|
-
tints?: Record<string, Record<string, unknown>>;
|
|
99
146
|
/** @deprecated Shorthand for `sites.default.backgrounds` */
|
|
100
147
|
backgrounds?: Record<string, Record<string, unknown>>;
|
|
101
148
|
/** @deprecated Shorthand for `sites.default.sandbox` */
|
package/dist/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;gFAEgF;AAChF,MAAM,WAAW,UAAU;IAC1B,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;yEAGyE;AACzE,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,GAAG,MAAM,CAEvE;AAED;;;;;;;2DAO2D;AAC3D,MAAM,WAAW,eAAe;IAC/B,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB;;wDAEoD;IACpD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;oFAGgF;IAChF,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACxC;oEACgE;IAChE,MAAM,CAAC,EAAE,OAAO,qBAAqB,EAAE,iBAAiB,CAAC;IACzD;sCACkC;IAClC,KAAK,CAAC,EAAE,MAAM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,sGAAsG;IACtG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAChD,qDAAqD;IACrD,uBAAuB,CAAC,EAAE,UAAU,GAAG,aAAa,GAAG,MAAM,CAAC;IAC9D,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAChC,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,SAAS;IACzB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IACnC,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,8CAA8C;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACzD"}
|
package/dist/theme.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/** Extract the theme package identifier from a `SiteConfig.theme` value.
|
|
2
|
+
* Accepts either the legacy string form or the new {@link SiteThemeConfig}
|
|
3
|
+
* object form (where the identifier lives in `package`). Useful at call sites
|
|
4
|
+
* that need the package name for dynamic import or noExternal lists. */
|
|
5
|
+
export function getThemePackage(theme) {
|
|
6
|
+
return typeof theme === 'string' ? theme : theme.package;
|
|
7
|
+
}
|
|
2
8
|
//# sourceMappingURL=theme.js.map
|
package/dist/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;yEAGyE;AACzE,MAAM,UAAU,eAAe,CAAC,KAA+B;IAC9D,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Contract — the universal design-token surface that every refrakt theme
|
|
3
|
+
* must populate.
|
|
4
|
+
*
|
|
5
|
+
* The contract describes the **named** tokens that runes depend on. Themes
|
|
6
|
+
* supply values for these names; sites can override individual tokens via
|
|
7
|
+
* `refrakt.config.json` → `theme.tokens`; presets ship `ThemeTokensConfig`
|
|
8
|
+
* modules that merge into the final value.
|
|
9
|
+
*
|
|
10
|
+
* **CSS-variable mapping rule.** Each contract leaf maps to a `--rf-*` CSS
|
|
11
|
+
* custom property. Nested namespaces flatten by joining keys with `-`. As a
|
|
12
|
+
* convenience, when the leaf key is `base`, it is *omitted* from the variable
|
|
13
|
+
* name — so `color.surface.base` produces `--rf-color-surface`, not
|
|
14
|
+
* `--rf-color-surface-base`, preserving the existing variable names that
|
|
15
|
+
* Lumina has shipped to date.
|
|
16
|
+
*
|
|
17
|
+
* Examples:
|
|
18
|
+
* - `color.text` → `--rf-color-text`
|
|
19
|
+
* - `color.surface.base` → `--rf-color-surface`
|
|
20
|
+
* - `color.surface.hover` → `--rf-color-surface-hover`
|
|
21
|
+
* - `color.info.base` → `--rf-color-info`
|
|
22
|
+
* - `color.info.bg` → `--rf-color-info-bg`
|
|
23
|
+
* - `color.code.inline-bg` → `--rf-color-inline-code-bg` *(special-cased,
|
|
24
|
+
* matching the existing variable name)*
|
|
25
|
+
* - `syntax.keyword` → `--rf-syntax-keyword`
|
|
26
|
+
* - `radius.md` → `--rf-radius-md`
|
|
27
|
+
*/
|
|
28
|
+
export interface TokenContract {
|
|
29
|
+
/** Typography tokens. The `serif` slot is reserved for a future SPEC-048
|
|
30
|
+
* amendment per SPEC-051; today the contract carries only sans and mono. */
|
|
31
|
+
font: {
|
|
32
|
+
/** Primary text family used for body and most UI. Includes its full
|
|
33
|
+
* fallback stack — e.g. `"'Inter', system-ui, -apple-system, sans-serif"`. */
|
|
34
|
+
sans: string;
|
|
35
|
+
/** Monospace family used for code blocks and inline code. */
|
|
36
|
+
mono: string;
|
|
37
|
+
};
|
|
38
|
+
/** Colour tokens. */
|
|
39
|
+
color: {
|
|
40
|
+
/** Body text colour. */
|
|
41
|
+
text: string;
|
|
42
|
+
/** Muted / secondary text (timestamps, captions, less emphatic copy). */
|
|
43
|
+
muted: string;
|
|
44
|
+
/** Default border colour for surfaces, separators, inputs. */
|
|
45
|
+
border: string;
|
|
46
|
+
/** Page background. */
|
|
47
|
+
bg: string;
|
|
48
|
+
/** Interactive primary colour — buttons, links, accents. May be
|
|
49
|
+
* monochromatic (matching `text`) for fully neutral themes. */
|
|
50
|
+
primary: string;
|
|
51
|
+
/** Primary colour on hover/active. */
|
|
52
|
+
'primary-hover': string;
|
|
53
|
+
/** Primary colour scale (50→950) for hover/active layering and
|
|
54
|
+
* rune-internal contrast steps that don't introduce a hue. */
|
|
55
|
+
'primary-scale': PrimaryScale;
|
|
56
|
+
/** Layered surfaces above the page background. `base` is the default
|
|
57
|
+
* card / panel surface; `raised` is the most elevated layer. */
|
|
58
|
+
surface: {
|
|
59
|
+
base: string;
|
|
60
|
+
hover: string;
|
|
61
|
+
active: string;
|
|
62
|
+
raised: string;
|
|
63
|
+
};
|
|
64
|
+
/** Sentiment colours — communicate state across callouts, banners,
|
|
65
|
+
* validation messages. Each has a saturated `base` (text/accent), a
|
|
66
|
+
* pale `bg` (filled surface), and a `border`. */
|
|
67
|
+
info: SentimentTokens;
|
|
68
|
+
warning: SentimentTokens;
|
|
69
|
+
danger: SentimentTokens;
|
|
70
|
+
success: SentimentTokens;
|
|
71
|
+
/** Code surface tokens. `inline-bg` covers inline `` `code` `` spans;
|
|
72
|
+
* `bg` covers full code blocks. */
|
|
73
|
+
code: {
|
|
74
|
+
bg: string;
|
|
75
|
+
text: string;
|
|
76
|
+
'inline-bg': string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/** Border-radius tokens. */
|
|
80
|
+
radius: {
|
|
81
|
+
sm: string;
|
|
82
|
+
md: string;
|
|
83
|
+
lg: string;
|
|
84
|
+
full: string;
|
|
85
|
+
};
|
|
86
|
+
/** Spacing tokens — generic scale plus the `section` namespace for
|
|
87
|
+
* page-section vertical rhythm. */
|
|
88
|
+
spacing: {
|
|
89
|
+
xs: string;
|
|
90
|
+
sm: string;
|
|
91
|
+
md: string;
|
|
92
|
+
lg: string;
|
|
93
|
+
xl: string;
|
|
94
|
+
'2xl': string;
|
|
95
|
+
/** Vertical spacing between top-level page sections.
|
|
96
|
+
* `base` is the default; `tight`/`loose`/`breathe` are author opt-ins. */
|
|
97
|
+
section: {
|
|
98
|
+
base: string;
|
|
99
|
+
tight: string;
|
|
100
|
+
loose: string;
|
|
101
|
+
breathe: string;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
/** Horizontal-padding tokens for page-section insets. */
|
|
105
|
+
inset: {
|
|
106
|
+
flush: string;
|
|
107
|
+
tight: string;
|
|
108
|
+
loose: string;
|
|
109
|
+
breathe: string;
|
|
110
|
+
};
|
|
111
|
+
/** Drop-shadow tokens for elevation. */
|
|
112
|
+
shadow: {
|
|
113
|
+
xs: string;
|
|
114
|
+
sm: string;
|
|
115
|
+
md: string;
|
|
116
|
+
lg: string;
|
|
117
|
+
};
|
|
118
|
+
/** Syntax highlighting colours. Highlighter-agnostic — the integration
|
|
119
|
+
* (Shiki today, anything tomorrow) is responsible for emitting these
|
|
120
|
+
* names. Per SPEC-048 the highlighter is an implementation detail behind
|
|
121
|
+
* the `--rf-syntax-*` contract. */
|
|
122
|
+
syntax: SyntaxTokens;
|
|
123
|
+
}
|
|
124
|
+
/** Three tokens per sentiment: saturated `base`, pale `bg`, complementary
|
|
125
|
+
* `border`. */
|
|
126
|
+
export interface SentimentTokens {
|
|
127
|
+
base: string;
|
|
128
|
+
bg: string;
|
|
129
|
+
border: string;
|
|
130
|
+
}
|
|
131
|
+
/** Eleven-stop colour scale, near-bg → near-text. */
|
|
132
|
+
export interface PrimaryScale {
|
|
133
|
+
'50': string;
|
|
134
|
+
'100': string;
|
|
135
|
+
'200': string;
|
|
136
|
+
'300': string;
|
|
137
|
+
'400': string;
|
|
138
|
+
'500': string;
|
|
139
|
+
'600': string;
|
|
140
|
+
'700': string;
|
|
141
|
+
'800': string;
|
|
142
|
+
'900': string;
|
|
143
|
+
'950': string;
|
|
144
|
+
}
|
|
145
|
+
/** Syntax-highlighting roles. Variables and ordinary identifiers fall through
|
|
146
|
+
* to body `text`; only the meaning-bearing roles get distinct colours.
|
|
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
|
+
*
|
|
156
|
+
* Naming follows Shiki's `token-*` vocabulary rather than language-specific
|
|
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. */
|
|
162
|
+
export interface SyntaxTokens {
|
|
163
|
+
keyword: string;
|
|
164
|
+
function: string;
|
|
165
|
+
string: string;
|
|
166
|
+
constant: string;
|
|
167
|
+
comment: string;
|
|
168
|
+
punctuation: string;
|
|
169
|
+
variable: string;
|
|
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. */
|
|
174
|
+
link?: string;
|
|
175
|
+
/** Interpolated expressions inside template literals (the `${foo}` part
|
|
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. */
|
|
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;
|
|
214
|
+
}
|
|
215
|
+
/** Recursive deep-partial. Every namespace optional; every leaf optional. */
|
|
216
|
+
export type DeepPartial<T> = T extends object ? {
|
|
217
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
218
|
+
} : T;
|
|
219
|
+
/** Partial token contract — for mode overlays, presets, and site overrides.
|
|
220
|
+
* Authors only specify the tokens they want to change; everything else
|
|
221
|
+
* inherits from the next-outer layer via CSS variable cascade. */
|
|
222
|
+
export type PartialTokenContract = DeepPartial<TokenContract>;
|
|
223
|
+
/** A per-mode overlay — a {@link PartialTokenContract} plus its own optional
|
|
224
|
+
* {@link ThemeTokensConfig.extra} escape hatch for mode-specific theme tokens.
|
|
225
|
+
* Useful when a Shiki-style alias has different values in light vs dark. */
|
|
226
|
+
export type ThemeTokensModeOverlay = PartialTokenContract & {
|
|
227
|
+
/** Mode-specific theme tokens outside the universal contract. Emitted into
|
|
228
|
+
* the same selector as the rest of the mode overlay. */
|
|
229
|
+
extra?: Record<string, string>;
|
|
230
|
+
};
|
|
231
|
+
/** The authoring-side shape — what preset modules export and what users
|
|
232
|
+
* author in `refrakt.config.json` → `theme.tokens`.
|
|
233
|
+
*
|
|
234
|
+
* Composed of:
|
|
235
|
+
* - the partial contract itself (base-mode overrides)
|
|
236
|
+
* - optional per-mode overlays keyed by mode name (e.g. `dark`)
|
|
237
|
+
* - an `extra` escape hatch for theme-specific tokens outside the contract */
|
|
238
|
+
export interface ThemeTokensConfig extends PartialTokenContract {
|
|
239
|
+
/** Per-mode token overlays applied via `[data-theme="<mode>"]` and the
|
|
240
|
+
* matching `prefers-color-scheme` media query. Mode `dark` is conventional;
|
|
241
|
+
* any name is valid (e.g. `high-contrast`, `sepia`, `print`). */
|
|
242
|
+
modes?: Record<string, ThemeTokensModeOverlay>;
|
|
243
|
+
/** Theme-specific tokens that don't fit the universal contract. Emitted as
|
|
244
|
+
* `:root { --<key>: <value> }`. Use sparingly — adding to the contract is
|
|
245
|
+
* preferred for anything reusable across themes. */
|
|
246
|
+
extra?: Record<string, string>;
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=token-contract.d.ts.map
|
|
@@ -0,0 +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,M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