@theme-registry/refract 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -104,7 +104,7 @@ const raw = {
104
104
  Property values can be **literals** (`"#4c6ef5"`, `16`), **references** to other tokens
105
105
  (`color: "brand.text"`), and carry **responsive / variant / target** overrides keyed on
106
106
  your breakpoints. Recipes group reusable rule-sets with **states** (`hover`, `disabled`, …).
107
- Full field-by-field walkthrough: **[docs/authoring.md](docs/authoring.md)**.
107
+ Full field-by-field walkthrough: **[docs/authoring.md](https://github.com/theme-registry/refract/blob/main/docs/authoring.md)**.
108
108
 
109
109
  ## Adapters — the multi-format thesis
110
110
 
@@ -121,7 +121,7 @@ Core ships **zero** adapters; each is its own installable package (`npm i @theme
121
121
 
122
122
  Write your own with `defineAdapter(spec)` — you fill four primitives (`recipeName`,
123
123
  `renderRecipe`, `renderVariables`, `join`) and core supplies the rest. See
124
- **[docs/extending.md](docs/extending.md)** or run the `adapter-scaffold` skill.
124
+ **[docs/extending.md](https://github.com/theme-registry/refract/blob/main/docs/extending.md)** or run the `adapter-scaffold` skill.
125
125
 
126
126
  ## Build to disk (CLI)
127
127
 
@@ -182,8 +182,8 @@ const doc = toDTCG(theme); // built theme's tokens → DTC
182
182
 
183
183
  ## Documentation
184
184
 
185
- - **[docs/authoring.md](docs/authoring.md)** — author a theme + consume its output (the user guide).
186
- - **[docs/extending.md](docs/extending.md)** — write a subsystem or an adapter against the frozen contract.
185
+ - **[docs/authoring.md](https://github.com/theme-registry/refract/blob/main/docs/authoring.md)** — author a theme + consume its output (the user guide).
186
+ - **[docs/extending.md](https://github.com/theme-registry/refract/blob/main/docs/extending.md)** — write a subsystem or an adapter against the frozen contract.
187
187
  - **[AGENTS.md](AGENTS.md)** — orientation for AI coding agents.
188
188
 
189
189
  ## License
@@ -1 +1 @@
1
- {"version":3,"file":"_errors-be768b25.cjs.js","sources":["../src/core/errors.ts"],"sourcesContent":["/**\n * Stable, machine-readable error codes (§P2-3). Every error refract throws for a theme authoring /\n * build problem — everything reachable from {@link createTheme} (subsystem normalization, token\n * derivation, DTCG parsing) — is a {@link RefractError} carrying a `code` from {@link RefractErrorCode}:\n * a stable identifier an agent (or a catch block) can branch on without string-matching the human\n * message. The message text stays human-first and unchanged; the code is additive.\n *\n * Scope: authoring/build errors. Pure CLI-tooling failures in `src/build/*` (bad arguments, a missing\n * file, an unknown command) stay plain `Error`s — they're usage errors from `refract <cmd>`, not a\n * problem with the theme an agent is editing.\n *\n * Dependency-free leaf on purpose, so any module (including the standalone `adapter-kit`) can throw one\n * without pulling in the core graph.\n */\nexport type RefractErrorCode =\n | \"REFRACT_E_COLOR_INPUT\" // a colour value wasn't a derivable colour\n | \"REFRACT_E_COLOR_TUPLE\" // an [r,g,b] tuple was malformed\n | \"REFRACT_E_STEPS\" // colors.<name>.steps out of range / non-numeric\n | \"REFRACT_E_VARIANT\" // a derivation-spec variant / modifier chain was malformed\n | \"REFRACT_E_VARIANT_REF\" // a variant referenced an unknown source\n | \"REFRACT_E_CYCLE\" // a cyclic reference (colour variant, token, recipe, DTCG alias)\n | \"REFRACT_E_ADJUST\" // an adjust dial was out of range\n | \"REFRACT_E_HARMONY\" // an invalid harmony scheme\n | \"REFRACT_E_VALIDATION\" // aggregate: one or more post-build ref-validation failures (see `failures`)\n | \"REFRACT_E_RECIPE_PROPERTY\" // a recipe declaration key is neither a known CSS property nor a reserved key\n | \"REFRACT_E_TOKEN_PATH\" // a token path is unknown / malformed / uses an unknown derivation fn\n | \"REFRACT_E_BREAKPOINT\" // a responsive entry omitted or named an unknown breakpoint\n | \"REFRACT_E_STATE\" // a recipe state entry named a state the adapter doesn't know\n | \"REFRACT_E_CONTAINER\" // a container-query entry named an unknown container / size / unsupported axis\n | \"REFRACT_E_RESPONSIVE\" // a responsive/mode override was malformed (variant+target conflict, unknown ref)\n | \"REFRACT_E_MEDIA\" // an invalid media / container query range (min > max)\n | \"REFRACT_E_MODE\" // an appearance-mode override with no base to override\n | \"REFRACT_E_PRESET\" // an unknown globals preset name\n | \"REFRACT_E_EFFECTS\" // a malformed effects value (shadow / transition layer)\n | \"REFRACT_E_LAYOUT\" // a malformed layout scale (ratio+step, bad rung)\n | \"REFRACT_E_UNITS\" // a malformed units config\n | \"REFRACT_E_PROPERTY\" // a property couldn't be normalized (no resolvable base value)\n | \"REFRACT_E_REFERENCE\" // a composition / rule-set reference didn't resolve\n | \"REFRACT_E_NAMING\" // a naming override / default path produced a collision\n | \"REFRACT_E_DTCG_VERSION\" // an unreadable DTCG refract-extension version\n | \"REFRACT_E_AUDIT\"; // a strict contrast audit failed\n\n/**\n * An authoring / build error with a stable {@link RefractErrorCode}. For an aggregate (collect-all)\n * error, `failures` lists each individual message so a caller can report them all at once.\n */\nexport class RefractError extends Error {\n readonly code: RefractErrorCode;\n readonly failures?: readonly string[];\n\n constructor(code: RefractErrorCode, message: string, failures?: readonly string[]) {\n super(message);\n this.name = \"RefractError\";\n this.code = code;\n if (failures) this.failures = failures;\n // Keep `instanceof RefractError` working after transpilation to ES5-ish targets.\n Object.setPrototypeOf(this, RefractError.prototype);\n }\n}\n"],"names":["RefractError","Error","constructor","code","message","failures","super","this","name","Object","setPrototypeOf","prototype"],"mappings":"aA8CM,MAAOA,UAAqBC,MAIhC,WAAAC,CAAYC,EAAwBC,EAAiBC,GACnDC,MAAMF,GACNG,KAAKC,KAAO,eACZD,KAAKJ,KAAOA,EACRE,IAAUE,KAAKF,SAAWA,GAE9BI,OAAOC,eAAeH,KAAMP,EAAaW,UAC1C"}
1
+ {"version":3,"file":"_errors-be768b25.cjs.js","sources":["../src/core/errors.ts"],"sourcesContent":["/**\n * Stable, machine-readable error codes (§P2-3). Every error refract throws for a theme authoring /\n * build problem — everything reachable from {@link createTheme} (subsystem normalization, token\n * derivation, DTCG parsing) — is a {@link RefractError} carrying a `code` from {@link RefractErrorCode}:\n * a stable identifier an agent (or a catch block) can branch on without string-matching the human\n * message. The message text stays human-first and unchanged; the code is additive.\n *\n * Scope: authoring/build errors. Pure CLI-tooling failures in `src/build/*` (bad arguments, a missing\n * file, an unknown command) stay plain `Error`s — they're usage errors from `refract <cmd>`, not a\n * problem with the theme an agent is editing. The one build-layer exception is `REFRACT_E_RAW_SHAPE`:\n * a value handed to `diff` / `validate` (or the MCP server) where a `RawTheme` is required but the\n * value isn't theme-shaped — that IS a theme problem, and a governance tool must fail loud + coded on\n * it (see {@link assertRawTheme}) rather than emit a nonsense \"everything removed\" diff at exit 0.\n *\n * Dependency-free leaf on purpose, so any module (including the standalone `adapter-kit`) can throw one\n * without pulling in the core graph.\n */\nexport type RefractErrorCode =\n | \"REFRACT_E_COLOR_INPUT\" // a colour value wasn't a derivable colour\n | \"REFRACT_E_COLOR_TUPLE\" // an [r,g,b] tuple was malformed\n | \"REFRACT_E_STEPS\" // colors.<name>.steps out of range / non-numeric\n | \"REFRACT_E_VARIANT\" // a derivation-spec variant / modifier chain was malformed\n | \"REFRACT_E_VARIANT_REF\" // a variant referenced an unknown source\n | \"REFRACT_E_CYCLE\" // a cyclic reference (colour variant, token, recipe, DTCG alias)\n | \"REFRACT_E_ADJUST\" // an adjust dial was out of range\n | \"REFRACT_E_HARMONY\" // an invalid harmony scheme\n | \"REFRACT_E_VALIDATION\" // aggregate: one or more post-build ref-validation failures (see `failures`)\n | \"REFRACT_E_RECIPE_PROPERTY\" // a recipe declaration key is neither a known CSS property nor a reserved key\n | \"REFRACT_E_TOKEN_PATH\" // a token path is unknown / malformed / uses an unknown derivation fn\n | \"REFRACT_E_BREAKPOINT\" // a responsive entry omitted or named an unknown breakpoint\n | \"REFRACT_E_STATE\" // a recipe state entry named a state the adapter doesn't know\n | \"REFRACT_E_CONTAINER\" // a container-query entry named an unknown container / size / unsupported axis\n | \"REFRACT_E_RESPONSIVE\" // a responsive/mode override was malformed (variant+target conflict, unknown ref)\n | \"REFRACT_E_MEDIA\" // an invalid media / container query range (min > max)\n | \"REFRACT_E_MODE\" // an appearance-mode override with no base to override\n | \"REFRACT_E_PRESET\" // an unknown globals preset name\n | \"REFRACT_E_EFFECTS\" // a malformed effects value (shadow / transition layer)\n | \"REFRACT_E_LAYOUT\" // a malformed layout scale (ratio+step, bad rung)\n | \"REFRACT_E_UNITS\" // a malformed units config\n | \"REFRACT_E_PROPERTY\" // a property couldn't be normalized (no resolvable base value)\n | \"REFRACT_E_REFERENCE\" // a composition / rule-set reference didn't resolve\n | \"REFRACT_E_NAMING\" // a naming override / default path produced a collision\n | \"REFRACT_E_DTCG_VERSION\" // an unreadable DTCG refract-extension version\n | \"REFRACT_E_AUDIT\" // a strict contrast audit failed\n | \"REFRACT_E_RAW_SHAPE\"; // a value passed where a RawTheme is required isn't theme-shaped (e.g. a defineConfig, an array, null)\n\n/**\n * An authoring / build error with a stable {@link RefractErrorCode}. For an aggregate (collect-all)\n * error, `failures` lists each individual message so a caller can report them all at once.\n */\nexport class RefractError extends Error {\n readonly code: RefractErrorCode;\n readonly failures?: readonly string[];\n\n constructor(code: RefractErrorCode, message: string, failures?: readonly string[]) {\n super(message);\n this.name = \"RefractError\";\n this.code = code;\n if (failures) this.failures = failures;\n // Keep `instanceof RefractError` working after transpilation to ES5-ish targets.\n Object.setPrototypeOf(this, RefractError.prototype);\n }\n}\n"],"names":["RefractError","Error","constructor","code","message","failures","super","this","name","Object","setPrototypeOf","prototype"],"mappings":"aAkDM,MAAOA,UAAqBC,MAIhC,WAAAC,CAAYC,EAAwBC,EAAiBC,GACnDC,MAAMF,GACNG,KAAKC,KAAO,eACZD,KAAKJ,KAAOA,EACRE,IAAUE,KAAKF,SAAWA,GAE9BI,OAAOC,eAAeH,KAAMP,EAAaW,UAC1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"_errors-d75a5c74.esm.js","sources":["../src/core/errors.ts"],"sourcesContent":["/**\n * Stable, machine-readable error codes (§P2-3). Every error refract throws for a theme authoring /\n * build problem — everything reachable from {@link createTheme} (subsystem normalization, token\n * derivation, DTCG parsing) — is a {@link RefractError} carrying a `code` from {@link RefractErrorCode}:\n * a stable identifier an agent (or a catch block) can branch on without string-matching the human\n * message. The message text stays human-first and unchanged; the code is additive.\n *\n * Scope: authoring/build errors. Pure CLI-tooling failures in `src/build/*` (bad arguments, a missing\n * file, an unknown command) stay plain `Error`s — they're usage errors from `refract <cmd>`, not a\n * problem with the theme an agent is editing.\n *\n * Dependency-free leaf on purpose, so any module (including the standalone `adapter-kit`) can throw one\n * without pulling in the core graph.\n */\nexport type RefractErrorCode =\n | \"REFRACT_E_COLOR_INPUT\" // a colour value wasn't a derivable colour\n | \"REFRACT_E_COLOR_TUPLE\" // an [r,g,b] tuple was malformed\n | \"REFRACT_E_STEPS\" // colors.<name>.steps out of range / non-numeric\n | \"REFRACT_E_VARIANT\" // a derivation-spec variant / modifier chain was malformed\n | \"REFRACT_E_VARIANT_REF\" // a variant referenced an unknown source\n | \"REFRACT_E_CYCLE\" // a cyclic reference (colour variant, token, recipe, DTCG alias)\n | \"REFRACT_E_ADJUST\" // an adjust dial was out of range\n | \"REFRACT_E_HARMONY\" // an invalid harmony scheme\n | \"REFRACT_E_VALIDATION\" // aggregate: one or more post-build ref-validation failures (see `failures`)\n | \"REFRACT_E_RECIPE_PROPERTY\" // a recipe declaration key is neither a known CSS property nor a reserved key\n | \"REFRACT_E_TOKEN_PATH\" // a token path is unknown / malformed / uses an unknown derivation fn\n | \"REFRACT_E_BREAKPOINT\" // a responsive entry omitted or named an unknown breakpoint\n | \"REFRACT_E_STATE\" // a recipe state entry named a state the adapter doesn't know\n | \"REFRACT_E_CONTAINER\" // a container-query entry named an unknown container / size / unsupported axis\n | \"REFRACT_E_RESPONSIVE\" // a responsive/mode override was malformed (variant+target conflict, unknown ref)\n | \"REFRACT_E_MEDIA\" // an invalid media / container query range (min > max)\n | \"REFRACT_E_MODE\" // an appearance-mode override with no base to override\n | \"REFRACT_E_PRESET\" // an unknown globals preset name\n | \"REFRACT_E_EFFECTS\" // a malformed effects value (shadow / transition layer)\n | \"REFRACT_E_LAYOUT\" // a malformed layout scale (ratio+step, bad rung)\n | \"REFRACT_E_UNITS\" // a malformed units config\n | \"REFRACT_E_PROPERTY\" // a property couldn't be normalized (no resolvable base value)\n | \"REFRACT_E_REFERENCE\" // a composition / rule-set reference didn't resolve\n | \"REFRACT_E_NAMING\" // a naming override / default path produced a collision\n | \"REFRACT_E_DTCG_VERSION\" // an unreadable DTCG refract-extension version\n | \"REFRACT_E_AUDIT\"; // a strict contrast audit failed\n\n/**\n * An authoring / build error with a stable {@link RefractErrorCode}. For an aggregate (collect-all)\n * error, `failures` lists each individual message so a caller can report them all at once.\n */\nexport class RefractError extends Error {\n readonly code: RefractErrorCode;\n readonly failures?: readonly string[];\n\n constructor(code: RefractErrorCode, message: string, failures?: readonly string[]) {\n super(message);\n this.name = \"RefractError\";\n this.code = code;\n if (failures) this.failures = failures;\n // Keep `instanceof RefractError` working after transpilation to ES5-ish targets.\n Object.setPrototypeOf(this, RefractError.prototype);\n }\n}\n"],"names":["RefractError","Error","constructor","code","message","failures","super","this","name","Object","setPrototypeOf","prototype"],"mappings":"AA8CM,MAAOA,UAAqBC,MAIhC,WAAAC,CAAYC,EAAwBC,EAAiBC,GACnDC,MAAMF,GACNG,KAAKC,KAAO,eACZD,KAAKJ,KAAOA,EACRE,IAAUE,KAAKF,SAAWA,GAE9BI,OAAOC,eAAeH,KAAMP,EAAaW,UAC1C"}
1
+ {"version":3,"file":"_errors-d75a5c74.esm.js","sources":["../src/core/errors.ts"],"sourcesContent":["/**\n * Stable, machine-readable error codes (§P2-3). Every error refract throws for a theme authoring /\n * build problem — everything reachable from {@link createTheme} (subsystem normalization, token\n * derivation, DTCG parsing) — is a {@link RefractError} carrying a `code` from {@link RefractErrorCode}:\n * a stable identifier an agent (or a catch block) can branch on without string-matching the human\n * message. The message text stays human-first and unchanged; the code is additive.\n *\n * Scope: authoring/build errors. Pure CLI-tooling failures in `src/build/*` (bad arguments, a missing\n * file, an unknown command) stay plain `Error`s — they're usage errors from `refract <cmd>`, not a\n * problem with the theme an agent is editing. The one build-layer exception is `REFRACT_E_RAW_SHAPE`:\n * a value handed to `diff` / `validate` (or the MCP server) where a `RawTheme` is required but the\n * value isn't theme-shaped — that IS a theme problem, and a governance tool must fail loud + coded on\n * it (see {@link assertRawTheme}) rather than emit a nonsense \"everything removed\" diff at exit 0.\n *\n * Dependency-free leaf on purpose, so any module (including the standalone `adapter-kit`) can throw one\n * without pulling in the core graph.\n */\nexport type RefractErrorCode =\n | \"REFRACT_E_COLOR_INPUT\" // a colour value wasn't a derivable colour\n | \"REFRACT_E_COLOR_TUPLE\" // an [r,g,b] tuple was malformed\n | \"REFRACT_E_STEPS\" // colors.<name>.steps out of range / non-numeric\n | \"REFRACT_E_VARIANT\" // a derivation-spec variant / modifier chain was malformed\n | \"REFRACT_E_VARIANT_REF\" // a variant referenced an unknown source\n | \"REFRACT_E_CYCLE\" // a cyclic reference (colour variant, token, recipe, DTCG alias)\n | \"REFRACT_E_ADJUST\" // an adjust dial was out of range\n | \"REFRACT_E_HARMONY\" // an invalid harmony scheme\n | \"REFRACT_E_VALIDATION\" // aggregate: one or more post-build ref-validation failures (see `failures`)\n | \"REFRACT_E_RECIPE_PROPERTY\" // a recipe declaration key is neither a known CSS property nor a reserved key\n | \"REFRACT_E_TOKEN_PATH\" // a token path is unknown / malformed / uses an unknown derivation fn\n | \"REFRACT_E_BREAKPOINT\" // a responsive entry omitted or named an unknown breakpoint\n | \"REFRACT_E_STATE\" // a recipe state entry named a state the adapter doesn't know\n | \"REFRACT_E_CONTAINER\" // a container-query entry named an unknown container / size / unsupported axis\n | \"REFRACT_E_RESPONSIVE\" // a responsive/mode override was malformed (variant+target conflict, unknown ref)\n | \"REFRACT_E_MEDIA\" // an invalid media / container query range (min > max)\n | \"REFRACT_E_MODE\" // an appearance-mode override with no base to override\n | \"REFRACT_E_PRESET\" // an unknown globals preset name\n | \"REFRACT_E_EFFECTS\" // a malformed effects value (shadow / transition layer)\n | \"REFRACT_E_LAYOUT\" // a malformed layout scale (ratio+step, bad rung)\n | \"REFRACT_E_UNITS\" // a malformed units config\n | \"REFRACT_E_PROPERTY\" // a property couldn't be normalized (no resolvable base value)\n | \"REFRACT_E_REFERENCE\" // a composition / rule-set reference didn't resolve\n | \"REFRACT_E_NAMING\" // a naming override / default path produced a collision\n | \"REFRACT_E_DTCG_VERSION\" // an unreadable DTCG refract-extension version\n | \"REFRACT_E_AUDIT\" // a strict contrast audit failed\n | \"REFRACT_E_RAW_SHAPE\"; // a value passed where a RawTheme is required isn't theme-shaped (e.g. a defineConfig, an array, null)\n\n/**\n * An authoring / build error with a stable {@link RefractErrorCode}. For an aggregate (collect-all)\n * error, `failures` lists each individual message so a caller can report them all at once.\n */\nexport class RefractError extends Error {\n readonly code: RefractErrorCode;\n readonly failures?: readonly string[];\n\n constructor(code: RefractErrorCode, message: string, failures?: readonly string[]) {\n super(message);\n this.name = \"RefractError\";\n this.code = code;\n if (failures) this.failures = failures;\n // Keep `instanceof RefractError` working after transpilation to ES5-ish targets.\n Object.setPrototypeOf(this, RefractError.prototype);\n }\n}\n"],"names":["RefractError","Error","constructor","code","message","failures","super","this","name","Object","setPrototypeOf","prototype"],"mappings":"AAkDM,MAAOA,UAAqBC,MAIhC,WAAAC,CAAYC,EAAwBC,EAAiBC,GACnDC,MAAMF,GACNG,KAAKC,KAAO,eACZD,KAAKJ,KAAOA,EACRE,IAAUE,KAAKF,SAAWA,GAE9BI,OAAOC,eAAeH,KAAMP,EAAaW,UAC1C"}