@bezel-labs/bezel-kit 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.
- package/LICENSE +93 -0
- package/README.md +69 -0
- package/dist/chunk-5EW7EW3R.js +370 -0
- package/dist/chunk-5EW7EW3R.js.map +1 -0
- package/dist/chunk-WLGTZBXW.js +139 -0
- package/dist/chunk-WLGTZBXW.js.map +1 -0
- package/dist/cli.cjs +567 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +93 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +401 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +133 -0
- package/dist/index.d.ts +133 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/node.cjs +530 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +73 -0
- package/dist/node.d.ts +73 -0
- package/dist/node.js +31 -0
- package/dist/node.js.map +1 -0
- package/package.json +76 -0
package/dist/node.d.cts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CssOptions } from './index.cjs';
|
|
2
|
+
export { ColorValue, DEFAULT_CONTEXTS, DEFAULT_CONTEXT_NAME, DEFAULT_NAME_EXTENSION, DimensionValue, DtcgNode, FlatToken, FontDef, ResolvedCssOptions, TokenValue, emitCss, formatContextsModule, formatFontsModule, getContexts, getFonts, resolveCssOptions, tokensToCss } from './index.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Options for {@link generateVariablesCss} — the Node, file-oriented surface.
|
|
6
|
+
* Extends the pure {@link CssOptions} with input/output paths. All optional;
|
|
7
|
+
* defaults make the zero-config case work.
|
|
8
|
+
*/
|
|
9
|
+
interface BezelOptions extends CssOptions {
|
|
10
|
+
/** Path to write the generated CSS. Default: `"variables.css"` (resolved from `cwd`). */
|
|
11
|
+
variablesOutput?: string;
|
|
12
|
+
/** Base directory paths are resolved against. Default: `process.cwd()`. */
|
|
13
|
+
cwd?: string;
|
|
14
|
+
/**
|
|
15
|
+
* When set, also write a generated TypeScript module exporting `CONTEXTS` (the list of
|
|
16
|
+
* context names derived from the tokens). Path resolved against `cwd`. Default: none.
|
|
17
|
+
*/
|
|
18
|
+
contextsOutput?: string;
|
|
19
|
+
/**
|
|
20
|
+
* When set, also write a generated TypeScript module exporting `FONTS` (the web fonts
|
|
21
|
+
* derived from the tokens). Path resolved against `cwd`. Default: none.
|
|
22
|
+
*/
|
|
23
|
+
fontsOutput?: string;
|
|
24
|
+
/** When `false`, return the CSS string without touching the filesystem. Default: `true`. */
|
|
25
|
+
write?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Create/update a project `.gitignore` so the generated outputs are ignored. The
|
|
28
|
+
* entries live in a marked block, rewritten on each run so renamed outputs are
|
|
29
|
+
* cleaned up. Default: `true`.
|
|
30
|
+
*/
|
|
31
|
+
gitignore?: boolean;
|
|
32
|
+
/** Path to the `.gitignore` to manage. Default: `".gitignore"` (resolved from `cwd`). */
|
|
33
|
+
gitignorePath?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Fully-resolved options (no `undefined`), produced by {@link resolveOptions}. */
|
|
36
|
+
interface ResolvedOptions {
|
|
37
|
+
inputPath: string;
|
|
38
|
+
variablesOutputPath: string;
|
|
39
|
+
contexts: Record<string, string>;
|
|
40
|
+
colorFormat: "oklch" | "hex";
|
|
41
|
+
dimensionUnit: "preserve" | "rem";
|
|
42
|
+
nameExtension: string;
|
|
43
|
+
contextsOutput: string | null;
|
|
44
|
+
fontsOutput: string | null;
|
|
45
|
+
write: boolean;
|
|
46
|
+
gitignore: boolean;
|
|
47
|
+
gitignorePath: string;
|
|
48
|
+
}
|
|
49
|
+
/** Apply defaults and resolve input/output paths against `cwd`. */
|
|
50
|
+
declare function resolveOptions(options?: BezelOptions): ResolvedOptions;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Generate a scoped `variables.css` from a W3C DTCG tokens file.
|
|
54
|
+
*
|
|
55
|
+
* Reads the tokens file, resolves each configured context (with `$root` fallback
|
|
56
|
+
* and reference resolution), and writes one CSS scope per context — the base
|
|
57
|
+
* context in full, others as override-only blocks. Returns the generated CSS.
|
|
58
|
+
*
|
|
59
|
+
* The tokens file is always read from `design-tokens.json` at the project root
|
|
60
|
+
* (resolved against `cwd`); the name and location are fixed and not configurable.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // zero-config: ./design-tokens.json → ./variables.css
|
|
64
|
+
* await generateVariablesCss()
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* await generateVariablesCss({
|
|
68
|
+
* variablesOutput: "packages/ui/src/styles/variables.css",
|
|
69
|
+
* })
|
|
70
|
+
*/
|
|
71
|
+
declare function generateVariablesCss(options?: BezelOptions): Promise<string>;
|
|
72
|
+
|
|
73
|
+
export { type BezelOptions, CssOptions, type ResolvedOptions, generateVariablesCss, resolveOptions };
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CssOptions } from './index.js';
|
|
2
|
+
export { ColorValue, DEFAULT_CONTEXTS, DEFAULT_CONTEXT_NAME, DEFAULT_NAME_EXTENSION, DimensionValue, DtcgNode, FlatToken, FontDef, ResolvedCssOptions, TokenValue, emitCss, formatContextsModule, formatFontsModule, getContexts, getFonts, resolveCssOptions, tokensToCss } from './index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Options for {@link generateVariablesCss} — the Node, file-oriented surface.
|
|
6
|
+
* Extends the pure {@link CssOptions} with input/output paths. All optional;
|
|
7
|
+
* defaults make the zero-config case work.
|
|
8
|
+
*/
|
|
9
|
+
interface BezelOptions extends CssOptions {
|
|
10
|
+
/** Path to write the generated CSS. Default: `"variables.css"` (resolved from `cwd`). */
|
|
11
|
+
variablesOutput?: string;
|
|
12
|
+
/** Base directory paths are resolved against. Default: `process.cwd()`. */
|
|
13
|
+
cwd?: string;
|
|
14
|
+
/**
|
|
15
|
+
* When set, also write a generated TypeScript module exporting `CONTEXTS` (the list of
|
|
16
|
+
* context names derived from the tokens). Path resolved against `cwd`. Default: none.
|
|
17
|
+
*/
|
|
18
|
+
contextsOutput?: string;
|
|
19
|
+
/**
|
|
20
|
+
* When set, also write a generated TypeScript module exporting `FONTS` (the web fonts
|
|
21
|
+
* derived from the tokens). Path resolved against `cwd`. Default: none.
|
|
22
|
+
*/
|
|
23
|
+
fontsOutput?: string;
|
|
24
|
+
/** When `false`, return the CSS string without touching the filesystem. Default: `true`. */
|
|
25
|
+
write?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Create/update a project `.gitignore` so the generated outputs are ignored. The
|
|
28
|
+
* entries live in a marked block, rewritten on each run so renamed outputs are
|
|
29
|
+
* cleaned up. Default: `true`.
|
|
30
|
+
*/
|
|
31
|
+
gitignore?: boolean;
|
|
32
|
+
/** Path to the `.gitignore` to manage. Default: `".gitignore"` (resolved from `cwd`). */
|
|
33
|
+
gitignorePath?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Fully-resolved options (no `undefined`), produced by {@link resolveOptions}. */
|
|
36
|
+
interface ResolvedOptions {
|
|
37
|
+
inputPath: string;
|
|
38
|
+
variablesOutputPath: string;
|
|
39
|
+
contexts: Record<string, string>;
|
|
40
|
+
colorFormat: "oklch" | "hex";
|
|
41
|
+
dimensionUnit: "preserve" | "rem";
|
|
42
|
+
nameExtension: string;
|
|
43
|
+
contextsOutput: string | null;
|
|
44
|
+
fontsOutput: string | null;
|
|
45
|
+
write: boolean;
|
|
46
|
+
gitignore: boolean;
|
|
47
|
+
gitignorePath: string;
|
|
48
|
+
}
|
|
49
|
+
/** Apply defaults and resolve input/output paths against `cwd`. */
|
|
50
|
+
declare function resolveOptions(options?: BezelOptions): ResolvedOptions;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Generate a scoped `variables.css` from a W3C DTCG tokens file.
|
|
54
|
+
*
|
|
55
|
+
* Reads the tokens file, resolves each configured context (with `$root` fallback
|
|
56
|
+
* and reference resolution), and writes one CSS scope per context — the base
|
|
57
|
+
* context in full, others as override-only blocks. Returns the generated CSS.
|
|
58
|
+
*
|
|
59
|
+
* The tokens file is always read from `design-tokens.json` at the project root
|
|
60
|
+
* (resolved against `cwd`); the name and location are fixed and not configurable.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // zero-config: ./design-tokens.json → ./variables.css
|
|
64
|
+
* await generateVariablesCss()
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* await generateVariablesCss({
|
|
68
|
+
* variablesOutput: "packages/ui/src/styles/variables.css",
|
|
69
|
+
* })
|
|
70
|
+
*/
|
|
71
|
+
declare function generateVariablesCss(options?: BezelOptions): Promise<string>;
|
|
72
|
+
|
|
73
|
+
export { type BezelOptions, CssOptions, type ResolvedOptions, generateVariablesCss, resolveOptions };
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
generateVariablesCss,
|
|
3
|
+
resolveOptions
|
|
4
|
+
} from "./chunk-WLGTZBXW.js";
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_CONTEXTS,
|
|
7
|
+
DEFAULT_CONTEXT_NAME,
|
|
8
|
+
DEFAULT_NAME_EXTENSION,
|
|
9
|
+
emitCss,
|
|
10
|
+
formatContextsModule,
|
|
11
|
+
formatFontsModule,
|
|
12
|
+
getContexts,
|
|
13
|
+
getFonts,
|
|
14
|
+
resolveCssOptions,
|
|
15
|
+
tokensToCss
|
|
16
|
+
} from "./chunk-5EW7EW3R.js";
|
|
17
|
+
export {
|
|
18
|
+
DEFAULT_CONTEXTS,
|
|
19
|
+
DEFAULT_CONTEXT_NAME,
|
|
20
|
+
DEFAULT_NAME_EXTENSION,
|
|
21
|
+
emitCss,
|
|
22
|
+
formatContextsModule,
|
|
23
|
+
formatFontsModule,
|
|
24
|
+
generateVariablesCss,
|
|
25
|
+
getContexts,
|
|
26
|
+
getFonts,
|
|
27
|
+
resolveCssOptions,
|
|
28
|
+
resolveOptions,
|
|
29
|
+
tokensToCss
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bezel-labs/bezel-kit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Convert a W3C Design Tokens (DTCG) file into a scoped variables.css, with one CSS scope per context.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"design-tokens",
|
|
8
|
+
"dtcg",
|
|
9
|
+
"css-variables",
|
|
10
|
+
"css-custom-properties",
|
|
11
|
+
"theming",
|
|
12
|
+
"style-dictionary"
|
|
13
|
+
],
|
|
14
|
+
"license": "PolyForm-Shield-1.0.0",
|
|
15
|
+
"author": "Bezel (https://bezel.new)",
|
|
16
|
+
"homepage": "https://github.com/bezel-labs/bezel-kit#readme",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/bezel-labs/bezel-kit.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/bezel-labs/bezel-kit/issues"
|
|
23
|
+
},
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"main": "./dist/index.cjs",
|
|
26
|
+
"module": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"require": "./dist/index.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./node": {
|
|
35
|
+
"types": "./dist/node.d.ts",
|
|
36
|
+
"import": "./dist/node.js",
|
|
37
|
+
"require": "./dist/node.cjs"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"bin": {
|
|
41
|
+
"bezel": "./dist/cli.js"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist"
|
|
45
|
+
],
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public",
|
|
48
|
+
"provenance": true
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=22"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsup",
|
|
55
|
+
"typecheck": "tsc --noEmit",
|
|
56
|
+
"test": "jest",
|
|
57
|
+
"prepare": "husky"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"tslib": "^2.3.0"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@commitlint/cli": "^19.6.0",
|
|
64
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
65
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
66
|
+
"@semantic-release/git": "^10.0.1",
|
|
67
|
+
"@types/jest": "^29.5.14",
|
|
68
|
+
"@types/node": "^22.10.0",
|
|
69
|
+
"husky": "^9.1.7",
|
|
70
|
+
"jest": "^29.7.0",
|
|
71
|
+
"semantic-release": "^24.2.0",
|
|
72
|
+
"ts-jest": "^29.2.5",
|
|
73
|
+
"tsup": "^8.3.5",
|
|
74
|
+
"typescript": "5.9.3"
|
|
75
|
+
}
|
|
76
|
+
}
|