@theme-registry/refract-css 0.1.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.
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Render the CSS adapter's `CssNode[]` IR to a CSS string, plus the enrich/split
3
+ * helpers the delivery modes need. Ported (copy, not rewrite) from the proven
4
+ * `core/common/{cssRenderer,cssEnrich,cssRender}.ts`, self-contained (no core imports).
5
+ */
6
+ import type { CssNode, CssVariablesNode } from "./nodes";
7
+ export type RenderCssOptions = {
8
+ indent?: string;
9
+ newline?: string;
10
+ };
11
+ /**
12
+ * Render an IR (`CssNode[]`) to a CSS string. Adjacent variable nodes sharing the same
13
+ * `selector` + `media` merge into one block, so two subsystems that both contribute
14
+ * `:root` variables produce one `:root { … }` block.
15
+ */
16
+ export declare const renderToCssString: (nodes: CssNode[], options?: RenderCssOptions) => string;
17
+ export declare const splitNodes: (nodes: CssNode[]) => {
18
+ variables: CssVariablesNode[];
19
+ rules: CssNode[];
20
+ };
21
+ export declare const renderVariablesCss: (nodes: CssNode[]) => string;
22
+ export declare const renderRulesCss: (nodes: CssNode[]) => string;
23
+ /**
24
+ * Build the `var name → resolved literal value` map from a node set's variable blocks: direct
25
+ * literals first, then a second pass resolving one level of `var(--…)` indirection. Shared by
26
+ * `enrichDeclarationsWithRefs` (inline baking) and the `components` non-inline tree-shaken
27
+ * variables file, so both source values the same way (no re-derived formatting).
28
+ */
29
+ export declare const buildVariableValueMap: (nodes: CssNode[]) => Map<string, string>;
30
+ /**
31
+ * Enrich `CssRuleNode` declarations with `ref` (the CSS var they reference) and `resolved`
32
+ * (its literal value), cross-referenced against the variable nodes. Mutates in place.
33
+ */
34
+ export declare const enrichDeclarationsWithRefs: (nodes: CssNode[]) => void;
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@theme-registry/refract-css",
3
+ "version": "0.1.0",
4
+ "description": "The CSS output adapter for @theme-registry/refract — lowers a ThemeModel to CSS custom properties + class rules.",
5
+ "author": {
6
+ "name": "Petyo Stoyanov",
7
+ "email": "petyosv@gmail.com"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/theme-registry/refract.git",
12
+ "directory": "packages/refract-css"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/theme-registry/refract/issues"
16
+ },
17
+ "homepage": "https://github.com/theme-registry/refract#readme",
18
+ "license": "MIT",
19
+ "main": "./dist/index.cjs.js",
20
+ "module": "./dist/index.esm.js",
21
+ "types": "./dist/index.d.ts",
22
+ "files": [
23
+ "/dist"
24
+ ],
25
+ "sideEffects": false,
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.esm.js",
30
+ "require": "./dist/index.cjs.js"
31
+ },
32
+ "./package.json": "./package.json"
33
+ },
34
+ "peerDependencies": {
35
+ "@theme-registry/refract": "^0.1.0"
36
+ },
37
+ "devDependencies": {
38
+ "@rollup/plugin-terser": "^0.4.4",
39
+ "@rollup/plugin-typescript": "^11.1.6",
40
+ "rimraf": "^5.0.5",
41
+ "rollup": "^3.29.4",
42
+ "rollup-plugin-peer-deps-external": "^2.2.4",
43
+ "typescript": "^5.4.2",
44
+ "vitest": "^4.1.10",
45
+ "@theme-registry/theme-fixtures": "^0.0.0",
46
+ "@theme-registry/refract": "^0.1.0"
47
+ },
48
+ "scripts": {
49
+ "build": "rollup -c",
50
+ "typecheck": "tsc -p tsconfig.typecheck.json",
51
+ "clean": "rimraf dist",
52
+ "test": "vitest run"
53
+ }
54
+ }