@refrakt-md/types 0.11.3 → 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 CHANGED
@@ -1,10 +1,14 @@
1
1
  export { Newable, NodeType, } from './interfaces.js';
2
2
  export type { DesignTokens } from './tokens.js';
3
- export type { RefraktConfig, SiteConfig, PlanConfig, ThemeManifest, LayoutDefinition, RouteRule, ComponentDefinition, } from './theme.js';
4
- export type { RunePackage, RunePackageEntry, RunePackageAttribute, RuneExtension, RunePackageThemeConfig, } from './package.js';
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';
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';
7
9
  export type { ContentFieldDefinition, SequenceModel, HeadingExtractField, HeadingExtract, KnownSectionDefinition, SectionsModel, DelimitedZone, DelimitedModel, CustomModel, ItemFieldDefinition, ItemModel, AttributeInCondition, AttributeExistsCondition, HasChildCondition, ContentModelCondition, ConditionalContentModel, StructuralContentModel, ContentModel, ResolvedField, ResolvedContent, } from './content-model.js';
8
- export type { TransformedPage, PipelineHeadingInfo, EntityRegistration, EntityRegistry, AggregatedData, PipelineContext, PipelineWarning, PackagePipelineHooks, } from './pipeline.js';
10
+ export type { TransformedPage, PipelineHeadingInfo, EntityRegistration, EntityRegistry, AggregatedData, PipelineContext, PipelineWarning, PluginPipelineHooks, } from './pipeline.js';
9
11
  export type { CliPlugin, CliPluginCommand, McpHandlerContext, JSONSchema7, } from './cli-plugin.js';
12
+ export type { SecurityPolicy, ResolvedSecurityPolicy } from './security.js';
13
+ export { resolveSecurityPolicy } from './security.js';
10
14
  //# sourceMappingURL=index.d.ts.map
@@ -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;AAGpB,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,sBAAsB,GACvB,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,oBAAoB,GACpB,MAAM,eAAe,CAAC;AAGvB,YAAY,EACX,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACX,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/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sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export {};
1
+ export { getThemePackage } from './theme.js';
2
+ export { resolveSecurityPolicy } from './security.js';
2
3
  //# sourceMappingURL=index.js.map
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/package.d.ts CHANGED
@@ -1,18 +1,18 @@
1
- /** Community rune package registration types */
2
- /** Attribute definition for community rune tooling and validation */
3
- export interface RunePackageAttribute {
1
+ /** Plugin registration types */
2
+ /** Attribute definition for plugin rune tooling and validation */
3
+ export interface PluginAttribute {
4
4
  type: 'string' | 'number' | 'boolean';
5
5
  default?: string | number | boolean;
6
6
  required?: boolean;
7
7
  /** Allowed values for enum-style attributes */
8
8
  matches?: string[];
9
9
  }
10
- /** A single rune provided by a community package */
11
- export interface RunePackageEntry {
10
+ /** A single rune provided by a plugin */
11
+ export interface PluginRune {
12
12
  /** Markdoc Schema for parsing and transformation (built using the full Model API) */
13
13
  transform: Record<string, unknown>;
14
14
  /** Attribute schema for tooling and validation */
15
- schema?: Record<string, RunePackageAttribute>;
15
+ schema?: Record<string, PluginAttribute>;
16
16
  /** Markdoc fixture string for the inspect command */
17
17
  fixture?: string;
18
18
  /**
@@ -36,36 +36,39 @@ export interface RunePackageEntry {
36
36
  /** Additive extension to a core rune's schema */
37
37
  export interface RuneExtension {
38
38
  /** Additional attributes to accept on the core rune */
39
- schema?: Record<string, RunePackageAttribute>;
39
+ schema?: Record<string, PluginAttribute>;
40
40
  }
41
- /** Theme configuration contributed by a community package */
42
- export interface RunePackageThemeConfig {
43
- /** RuneConfig entries for the package's runes (keyed by typeof name) */
41
+ /** Theme configuration contributed by a plugin */
42
+ export interface PluginThemeConfig {
43
+ /** RuneConfig entries for the plugin's runes (keyed by typeof name) */
44
44
  runes?: Record<string, Record<string, unknown>>;
45
45
  /** Additional icon SVGs (group name → icon name → SVG string) */
46
46
  icons?: Record<string, Record<string, string>>;
47
- /** Background preset definitions for this package's runes */
47
+ /** Background preset definitions for this plugin's runes */
48
48
  backgrounds?: Record<string, Record<string, unknown>>;
49
49
  }
50
- /** A community rune package's exported registration object */
51
- export interface RunePackage {
52
- /** Short package identifier used for namespacing (e.g., 'dnd-5e') */
50
+ /** A plugin's exported registration object.
51
+ * A plugin is an npm package that may contribute runes, layouts, theme config,
52
+ * pipeline hooks, behaviors, and/or CLI commands (via a separate `cli-plugin`
53
+ * entry point). */
54
+ export interface Plugin {
55
+ /** Short identifier used for namespacing (e.g., 'dnd-5e') */
53
56
  name: string;
54
57
  /** Human-readable display name */
55
58
  displayName?: string;
56
- /** Package version (semver) */
59
+ /** Plugin version (semver) */
57
60
  version: string;
58
- /** Rune definitions provided by this package */
59
- runes: Record<string, RunePackageEntry>;
61
+ /** Rune definitions provided by this plugin */
62
+ runes: Record<string, PluginRune>;
60
63
  /** Additive extensions to core runes (schema additions only) */
61
64
  extends?: Record<string, RuneExtension>;
62
- /** Identity transform config and icons for this package's runes */
63
- theme?: RunePackageThemeConfig;
65
+ /** Identity transform config and icons for this plugin's runes */
66
+ theme?: PluginThemeConfig;
64
67
  /** Client-side behavior functions keyed by rune typeof name (lowercase).
65
68
  * Typed as unknown here — actual BehaviorFn type lives in @refrakt-md/behaviors. */
66
69
  behaviors?: Record<string, unknown>;
67
70
  /** Build-time cross-page pipeline hooks.
68
- * Optional — packages that don't need cross-page awareness omit this entirely. */
69
- pipeline?: import('./pipeline.js').PackagePipelineHooks;
71
+ * Optional — plugins that don't need cross-page awareness omit this entirely. */
72
+ pipeline?: import('./pipeline.js').PluginPipelineHooks;
70
73
  }
71
74
  //# sourceMappingURL=package.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../src/package.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAEhD,qEAAqE;AACrE,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,oDAAoD;AACpD,MAAM,WAAW,gBAAgB;IAChC,qFAAqF;IACrF,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC9C,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;iEAC6D;IAC7D,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,iDAAiD;AACjD,MAAM,WAAW,aAAa;IAC7B,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;CAC9C;AAED,6DAA6D;AAC7D,MAAM,WAAW,sBAAsB;IACtC,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAA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AE,UAAU,CAAC,CAAC;IAClC,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACxC,kEAAkE;IAClE,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B;yFACqF;IACrF,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC;sFACkF;IAClF,QAAQ,CAAC,EAAE,OAAO,eAAe,EAAE,mBAAmB,CAAC;CACvD"}
package/dist/package.js CHANGED
@@ -1,3 +1,3 @@
1
- /** Community rune package registration types */
1
+ /** Plugin registration types */
2
2
  export {};
3
3
  //# sourceMappingURL=package.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","sourceRoot":"","sources":["../src/package.ts"],"names":[],"mappings":"AAAA,gDAAgD"}
1
+ {"version":3,"file":"package.js","sourceRoot":"","sources":["../src/package.ts"],"names":[],"mappings":"AAAA,gCAAgC"}
@@ -54,7 +54,7 @@ export interface EntityRegistry {
54
54
  }
55
55
  /**
56
56
  * Cross-page data produced by aggregate hooks (Phase 3).
57
- * Keyed by package name to prevent collisions between packages.
57
+ * Keyed by plugin name to prevent collisions between plugins.
58
58
  */
59
59
  export type AggregatedData = Record<string, unknown>;
60
60
  /** Context object passed to each pipeline hook for emitting structured warnings */
@@ -67,17 +67,17 @@ export interface PipelineContext {
67
67
  export interface PipelineWarning {
68
68
  severity: 'info' | 'warning' | 'error';
69
69
  phase: 'register' | 'aggregate' | 'postProcess';
70
- packageName: string;
70
+ pluginName: string;
71
71
  /** Page URL that triggered the warning, if applicable */
72
72
  url?: string;
73
73
  message: string;
74
74
  }
75
75
  /**
76
- * Build-time cross-page pipeline hooks a RunePackage can provide.
77
- * All three hooks are optional — packages that don't need cross-page
76
+ * Build-time cross-page pipeline hooks a Plugin can provide.
77
+ * All three hooks are optional — plugins that don't need cross-page
78
78
  * awareness omit this field entirely.
79
79
  */
80
- export interface PackagePipelineHooks {
80
+ export interface PluginPipelineHooks {
81
81
  /**
82
82
  * Phase 2 — Register.
83
83
  * Scan all transformed pages and register named entities in the site-wide registry.
@@ -88,13 +88,13 @@ export interface PackagePipelineHooks {
88
88
  * Phase 3 — Aggregate.
89
89
  * Build cross-page indexes, graphs, or collections from the full registry.
90
90
  * Called once after all register hooks have run.
91
- * Return value is stored as aggregated[packageName].
91
+ * Return value is stored as aggregated[pluginName].
92
92
  */
93
93
  aggregate?: (registry: Readonly<EntityRegistry>, ctx: PipelineContext) => unknown;
94
94
  /**
95
95
  * Phase 4 — Post-process.
96
96
  * Enrich a page's renderable tree using cross-page data from aggregated.
97
- * Called once per page, in package registration order.
97
+ * Called once per page, in plugin registration order.
98
98
  * Return the modified page (or the original if no changes needed).
99
99
  */
100
100
  postProcess?: (page: TransformedPage, aggregated: AggregatedData, ctx: PipelineContext) => TransformedPage;
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACX;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC;;;;;OAKG;IACH,UAAU,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,uFAAuF;IACvF,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,SAAS,EAAE,MAA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AEV;;;;;OAKG;IACH,SAAS,CAAC,EAAE,CACX,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,EAClC,GAAG,EAAE,eAAe,KAChB,OAAO,CAAC;IAEb;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CACb,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,cAAc,EAC1B,GAAG,EAAE,eAAe,KAChB,eAAe,CAAC;CACrB"}
@@ -0,0 +1,38 @@
1
+ /** Security policy controlling how the transform pipeline treats untrusted
2
+ * author content (sandbox HTML/CSS/JS, etc.).
3
+ *
4
+ * Use the string presets for the common cases:
5
+ * - `'trusted'` — current default; full power, no sanitisation, sandbox iframes get
6
+ * `allow-scripts allow-same-origin`. Self-hosted single-author projects.
7
+ * - `'strict'` — sugar for `{ trust: 'untrusted', allowJs: false }`. Hosted-product
8
+ * default: scripts and event handlers stripped; only HTML/CSS rendered.
9
+ *
10
+ * Use the object form when you need to allow JS in untrusted mode:
11
+ * - `allowJs: true` — keep author scripts but harden the iframe (drop
12
+ * `allow-same-origin`, inject meta-CSP). Fingerprinting and
13
+ * cryptojacking remain accepted residual risks.
14
+ * - `sandboxOrigin` — host-provided URL (e.g. `https://sandbox.example.com`).
15
+ * Sandbox iframes load from this origin instead of `srcdoc`,
16
+ * enabling real CSP response headers and cross-origin browser
17
+ * protections. Falls back to srcdoc + meta-CSP when unset.
18
+ */
19
+ export type SecurityPolicy = 'trusted' | 'strict' | {
20
+ trust: 'untrusted';
21
+ /** Allow author `<script>` blocks and event-handler attributes through.
22
+ * Default `false` — scripts are stripped before they reach the iframe. */
23
+ allowJs?: boolean;
24
+ /** When set, sandbox iframes load from this origin instead of `srcdoc`.
25
+ * The host must serve sandbox content from this origin with appropriate
26
+ * CSP headers — see docs/security for the endpoint contract. */
27
+ sandboxOrigin?: string;
28
+ };
29
+ /** Internal resolved form of `SecurityPolicy` after preset expansion. */
30
+ export interface ResolvedSecurityPolicy {
31
+ trust: 'trusted' | 'untrusted';
32
+ allowJs: boolean;
33
+ sandboxOrigin: string | undefined;
34
+ }
35
+ /** Expand the `SecurityPolicy` shorthand into its canonical resolved form.
36
+ * Centralised so every consumer reads the same defaults. */
37
+ export declare function resolveSecurityPolicy(policy: SecurityPolicy | undefined): ResolvedSecurityPolicy;
38
+ //# sourceMappingURL=security.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,QAAQ,GACR;IACE,KAAK,EAAE,WAAW,CAAC;IACnB;+EAC2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;qEAEiE;IACjE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEN,yEAAyE;AACzE,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,SAAS,GAAG,WAAW,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;6DAC6D;AAC7D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,GAAG,sBAAsB,CAYhG"}
@@ -0,0 +1,16 @@
1
+ /** Expand the `SecurityPolicy` shorthand into its canonical resolved form.
2
+ * Centralised so every consumer reads the same defaults. */
3
+ export function resolveSecurityPolicy(policy) {
4
+ if (policy === undefined || policy === 'trusted') {
5
+ return { trust: 'trusted', allowJs: true, sandboxOrigin: undefined };
6
+ }
7
+ if (policy === 'strict') {
8
+ return { trust: 'untrusted', allowJs: false, sandboxOrigin: undefined };
9
+ }
10
+ return {
11
+ trust: 'untrusted',
12
+ allowJs: policy.allowJs ?? false,
13
+ sandboxOrigin: policy.sandboxOrigin,
14
+ };
15
+ }
16
+ //# sourceMappingURL=security.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.js","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":"AAuCA;6DAC6D;AAC7D,MAAM,UAAU,qBAAqB,CAAC,MAAkC;IACtE,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACjD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;IACvE,CAAC;IACD,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxB,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;IAC1E,CAAC;IACD,OAAO;QACL,KAAK,EAAE,WAAW;QAClB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK;QAChC,aAAa,EAAE,MAAM,CAAC,aAAa;KACpC,CAAC;AACJ,CAAC"}
package/dist/theme.d.ts CHANGED
@@ -1,13 +1,61 @@
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
- * All fields except `contentDir`, `theme`, and `target` are optional. */
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 or relative path */
8
- theme: string;
9
- /** Target framework identifier */
10
- target: string;
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;
55
+ /** Documentation-only adapter hint (`svelte`, `astro`, `next`, `nuxt`, `eleventy`, `html`).
56
+ * No adapter reads or validates this field today; it serves as an in-config record of
57
+ * which adapter the site is intended for. Slated for removal in v1.0. */
58
+ target?: string;
11
59
  /** Component overrides — maps typeof names to relative paths of replacement components */
12
60
  overrides?: Record<string, string>;
13
61
  /** Route-to-layout mapping rules, evaluated in order (first match wins) */
@@ -21,9 +69,12 @@ export interface SiteConfig {
21
69
  };
22
70
  /** Custom icon SVGs — merged into the theme's global icon group */
23
71
  icons?: Record<string, string>;
24
- /** Community rune packages to merge into this site's ThemeConfig */
25
- packages?: string[];
26
- /** Project-level tint presets — merged after theme tints (last wins) */
72
+ /** Plugins to merge into this site's ThemeConfig (runes, layouts, hooks, etc.) */
73
+ plugins?: string[];
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`. */
27
78
  tints?: Record<string, Record<string, unknown>>;
28
79
  /** Project-level background presets — merged after theme backgrounds (last wins) */
29
80
  backgrounds?: Record<string, Record<string, unknown>>;
@@ -62,7 +113,8 @@ export interface PlanConfig {
62
113
  * Flat and singular shapes both collapse to `sites.default`. Plural projects
63
114
  * must reference sites by name in CLI commands and adapter options. */
64
115
  export interface RefraktConfig {
65
- /** Plugin packages contributing CLI commands and MCP tools.
116
+ /** Plugins for this project npm packages that contribute runes, layouts,
117
+ * pipeline hooks, behaviors, and/or CLI commands and MCP tools.
66
118
  * When set, this is authoritative; when absent, plugin discovery falls back
67
119
  * to scanning `package.json` for `@refrakt-md/*` dependencies. */
68
120
  plugins?: string[];
@@ -72,12 +124,12 @@ export interface RefraktConfig {
72
124
  site?: SiteConfig;
73
125
  /** Multi-site declaration keyed by site name. Mutually exclusive with `site`. */
74
126
  sites?: Record<string, SiteConfig>;
75
- /** @deprecated Shorthand for `sites.default.contentDir` */
76
- contentDir: string;
77
- /** @deprecated Shorthand for `sites.default.theme` */
78
- theme: string;
79
- /** @deprecated Shorthand for `sites.default.target` */
80
- target: string;
127
+ /** @deprecated Shorthand for `sites.default.contentDir`. Undefined for multi-site configs — use `resolveSite(config).site.contentDir`. */
128
+ contentDir?: 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;
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. */
132
+ target?: string;
81
133
  /** @deprecated Shorthand for `sites.default.overrides` */
82
134
  overrides?: Record<string, string>;
83
135
  /** @deprecated Shorthand for `sites.default.routeRules` */
@@ -91,10 +143,6 @@ export interface RefraktConfig {
91
143
  };
92
144
  /** @deprecated Shorthand for `sites.default.icons` */
93
145
  icons?: Record<string, string>;
94
- /** @deprecated Shorthand for `sites.default.packages` */
95
- packages?: string[];
96
- /** @deprecated Shorthand for `sites.default.tints` */
97
- tints?: Record<string, Record<string, unknown>>;
98
146
  /** @deprecated Shorthand for `sites.default.backgrounds` */
99
147
  backgrounds?: Record<string, Record<string, unknown>>;
100
148
  /** @deprecated Shorthand for `sites.default.sandbox` */
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;0EAE0E;AAC1E,MAAM,WAAW,UAAU;IAC1B,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,0FAA0F;IAC1F,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,2EAA2E;IAC3E,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,kCAAkC;IAClC,SAAS,CAAC,EAAE;QACX,KAAK,CAAC,EAAE,MAAM,GAAG;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,C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AAE,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
- export {};
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,MA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EjB;;;gFAG4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;kDAI8C;IAC9C,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,6EAA6E;AAC7E,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC1C;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtC,CAAC,CAAC;AAEL;;mEAEmE;AACnE,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;AAE9D;;6EAE6E;AAC7E,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,GAAG;IAC3D;6DACyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC;AAEF;;;;;;+EAM+E;AAC/E,MAAM,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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=token-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-contract.js","sourceRoot":"","sources":["../src/token-contract.ts"],"names":[],"mappings":""}
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.11.3",
4
+ "version": "0.14.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {