@refrakt-md/types 0.12.0 → 0.14.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/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 +211 -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,211 @@
|
|
|
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
|
+
* 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. */
|
|
158
|
+
export interface SyntaxTokens {
|
|
159
|
+
keyword: string;
|
|
160
|
+
function: string;
|
|
161
|
+
string: string;
|
|
162
|
+
constant: string;
|
|
163
|
+
comment: string;
|
|
164
|
+
punctuation: string;
|
|
165
|
+
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
|
+
link?: string;
|
|
171
|
+
/** 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
|
+
'string-expression'?: string;
|
|
177
|
+
}
|
|
178
|
+
/** Recursive deep-partial. Every namespace optional; every leaf optional. */
|
|
179
|
+
export type DeepPartial<T> = T extends object ? {
|
|
180
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
181
|
+
} : T;
|
|
182
|
+
/** Partial token contract — for mode overlays, presets, and site overrides.
|
|
183
|
+
* Authors only specify the tokens they want to change; everything else
|
|
184
|
+
* inherits from the next-outer layer via CSS variable cascade. */
|
|
185
|
+
export type PartialTokenContract = DeepPartial<TokenContract>;
|
|
186
|
+
/** A per-mode overlay — a {@link PartialTokenContract} plus its own optional
|
|
187
|
+
* {@link ThemeTokensConfig.extra} escape hatch for mode-specific theme tokens.
|
|
188
|
+
* Useful when a Shiki-style alias has different values in light vs dark. */
|
|
189
|
+
export type ThemeTokensModeOverlay = PartialTokenContract & {
|
|
190
|
+
/** Mode-specific theme tokens outside the universal contract. Emitted into
|
|
191
|
+
* the same selector as the rest of the mode overlay. */
|
|
192
|
+
extra?: Record<string, string>;
|
|
193
|
+
};
|
|
194
|
+
/** The authoring-side shape — what preset modules export and what users
|
|
195
|
+
* author in `refrakt.config.json` → `theme.tokens`.
|
|
196
|
+
*
|
|
197
|
+
* Composed of:
|
|
198
|
+
* - the partial contract itself (base-mode overrides)
|
|
199
|
+
* - optional per-mode overlays keyed by mode name (e.g. `dark`)
|
|
200
|
+
* - an `extra` escape hatch for theme-specific tokens outside the contract */
|
|
201
|
+
export interface ThemeTokensConfig extends PartialTokenContract {
|
|
202
|
+
/** Per-mode token overlays applied via `[data-theme="<mode>"]` and the
|
|
203
|
+
* matching `prefers-color-scheme` media query. Mode `dark` is conventional;
|
|
204
|
+
* any name is valid (e.g. `high-contrast`, `sepia`, `print`). */
|
|
205
|
+
modes?: Record<string, ThemeTokensModeOverlay>;
|
|
206
|
+
/** Theme-specific tokens that don't fit the universal contract. Emitted as
|
|
207
|
+
* `:root { --<key>: <value> }`. Use sparingly — adding to the contract is
|
|
208
|
+
* preferred for anything reusable across themes. */
|
|
209
|
+
extra?: Record<string, string>;
|
|
210
|
+
}
|
|
211
|
+
//# 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,MAAM,CAAC;YACd,MA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