okchroma 0.8.0 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "okchroma",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "license": "MIT",
5
5
  "description": "Color-system engine: one brand hex in, a light and dark set of color primitives out, with the contrast requirements solved during generation; emitted as CSS custom properties, DTCG documents, and Figma variables",
6
6
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "sideEffects": false,
24
24
  "scripts": {
25
25
  "build:lib": "node esbuild.config.js --lib && tsc -p tsconfig.lib.json",
26
- "prepack": "npm run build:lib",
26
+ "prepack": "npm run build:lib && npm run audit:lib",
27
27
  "generate": "node dist/build-script.js",
28
28
  "demo:build": "node esbuild.config.js",
29
29
  "build": "node esbuild.config.js",
@@ -56,6 +56,7 @@
56
56
  "docs:lint": "esbuild scripts/docs-lint.ts --bundle --platform=node --outfile=dist/docs-lint.js && node dist/docs-lint.js",
57
57
  "audit:tokens": "esbuild scripts/tokens-audit.ts --bundle --platform=node --outfile=dist/tokens-audit.js && node dist/tokens-audit.js",
58
58
  "audit:dtcg": "esbuild scripts/dtcg-audit.ts --bundle --platform=node --outfile=dist/dtcg-audit.js && node dist/dtcg-audit.js",
59
+ "audit:lib": "esbuild scripts/lib-audit.ts --bundle --platform=node --outfile=dist/lib-audit.js && node dist/lib-audit.js",
59
60
  "tokens:emit": "esbuild scripts/dtcg-emit.ts --bundle --platform=node --outfile=dist/dtcg-emit.js && node dist/dtcg-emit.js"
60
61
  },
61
62
  "devDependencies": {
@@ -1,35 +0,0 @@
1
- import { type OpacityRung } from './cssRender';
2
- import { type ThemeTokens, type TokenMode } from './tokensRender';
3
- export declare const INTERACTION_POLE_FAMILY: {
4
- readonly strong: "neutral-strong";
5
- readonly inverse: "neutral-inverse";
6
- };
7
- export type InteractionPoleFamily = (typeof INTERACTION_POLE_FAMILY)[keyof typeof INTERACTION_POLE_FAMILY];
8
- /** every family the register emits, color families first, the two pole families last */
9
- export declare const INTERACTION_FAMILIES: readonly string[];
10
- export type InteractionState = 'enabled' | 'hover' | 'pressed' | 'selected';
11
- export declare const INTERACTION_STATES: readonly InteractionState[];
12
- /** the rung each translucent tier takes per state; null is the transparent rest */
13
- export declare const INTERACTION_LADDER: Record<'subtle' | 'hint', Record<InteractionState, OpacityRung | null>>;
14
- export declare const INTERACTION_ROWS: readonly ["fg", "fg-strong", "fg-on-hint", "solid-bg-enabled", "solid-bg-hover", "solid-bg-pressed", "solid-border", "solid-fg", "subtle-bg-enabled", "subtle-bg-hover", "subtle-bg-pressed", "subtle-bg-selected", "hint-bg-enabled", "hint-bg-hover", "hint-bg-pressed", "hint-bg-selected"];
15
- export type InteractionRow = (typeof INTERACTION_ROWS)[number];
16
- /** the CSS custom property a family's row lives under */
17
- export declare const interactionVarName: (family: string, row: InteractionRow) => string;
18
- /**
19
- * The name whose channels a family's translucent rows ride: the family's
20
- * highlighter-26, or the pole for the pole families.
21
- */
22
- export declare function interactionTintName(family: string): string;
23
- /** One family's rows for one mode as [name, value] pairs, aliases as var() and rungs as rgba. */
24
- export declare function interactionRows(family: string, mode: TokenMode, tokens: ThemeTokens): Array<[InteractionRow, string]>;
25
- /**
26
- * The register as CSS for one brand: every family's rows under the brand scope, the
27
- * rung rows per mode, then one scope block per family that maps the family-agnostic
28
- * names (`--solid-bg-enabled`, `--fg`) onto that family, so a component reads one set
29
- * of names and `data-family` picks the family, the way a mode does on a Figma instance.
30
- */
31
- export declare function interactionCss(slug: string, tokens: ThemeTokens): string;
32
- /** The base tokens plus the register's rows, resolved to literals per mode. */
33
- export declare function interactionTokens(tokens: ThemeTokens): ThemeTokens;
34
- /** every rung the register uses is one of the engine's interaction rungs */
35
- export declare const interactionLadderIsLegal: () => boolean;
@@ -1,44 +0,0 @@
1
- import type { StopReq, RoleReq, ModeSpec } from './spec';
2
- import { type ResolvedRamp } from './resolve';
3
- export declare const EXT_KEY = "org.okchroma.requirement";
4
- export declare const RESOLVER_ID = "okchroma-reqtoken@2";
5
- export type DtcgColorValue = {
6
- colorSpace: 'srgb';
7
- components: [number, number, number];
8
- alpha: 1;
9
- hex: string;
10
- };
11
- type ExtCommon = {
12
- resolver: string;
13
- seed: string;
14
- mode: 'light' | 'dark';
15
- };
16
- export type DtcgRequirementToken = {
17
- $type: 'color';
18
- $value: DtcgColorValue;
19
- $extensions: {
20
- [EXT_KEY]: ExtCommon & (StopReq | RoleReq);
21
- };
22
- };
23
- export type DtcgSeedToken = {
24
- $type: 'color';
25
- $value: DtcgColorValue;
26
- };
27
- export type DtcgRampGroup = {
28
- seed: DtcgSeedToken;
29
- $extensions?: {
30
- [EXT_KEY]: {
31
- resolver: string;
32
- ons: ModeSpec['ons'];
33
- };
34
- };
35
- [key: string]: unknown;
36
- };
37
- export declare function emitDtcgRamp(hex: string, mode: 'light' | 'dark', groupName: string, spec?: ModeSpec): DtcgRampGroup;
38
- export declare function parseToken(token: DtcgRequirementToken): {
39
- req: StopReq | RoleReq;
40
- seedRef: string;
41
- mode: 'light' | 'dark';
42
- };
43
- export declare function resolveDtcgRamp(group: DtcgRampGroup): ResolvedRamp;
44
- export {};