@apollion-dsi/tokens 4.2.0 → 4.3.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/CHANGELOG.md ADDED
@@ -0,0 +1,112 @@
1
+ # @apollion-dsi/tokens
2
+
3
+ ## 4.3.0
4
+
5
+ ## 4.2.0
6
+
7
+ ### Minor Changes
8
+
9
+ - 12ae4e0: feat(tokens): DTCG 2025.10 remainders — dimension references, per-token metadata, and Resolver (R5)
10
+ - **Spacing + composite sub-value references**: `spacing` and `border.width`
11
+ now reference primitive scales (`{space.*}`, `{border-width.*}`) instead of
12
+ inlining literals. The `space` primitives are built per density via
13
+ `createSpacing`, so references resolve correctly under compact/normal/spacious.
14
+ - **`$deprecated` + `$description` per token**: populated from a `TOKEN_META`
15
+ registry through the IR into the JSON output (a stale-key guard fails the
16
+ build if a meta entry points at a non-existent token).
17
+ - **DTCG Resolver (R5)**: the JSON surface now emits a single `resolver.json`
18
+ plus composable `sets/` (axis-invariant `base` + per-axis colour/spacing sets)
19
+ instead of one fully-resolved document per variant — a hard cutover, made
20
+ pre-GA. A composition-equivalence test proves `base + colour + spacing`
21
+ reproduces the old per-variant document exactly. The CSS and TS surfaces are
22
+ unchanged: still per-variant, fully resolved, byte-identical.
23
+
24
+ ## 4.1.0
25
+
26
+ ### Minor Changes
27
+
28
+ - 063e0e9: Align `@apollion-dsi/tokens` DTCG output with the Design Tokens Format Module 2025.10.
29
+ - **Structured values:** `color` `$value` is now an OKLch object `{ colorSpace, components, hex, alpha? }` and `dimension` is `{ value, unit }` (was bare hex / length strings).
30
+ - **Typed IR:** a single intermediate representation (`src/ir.ts`) drives the JSON/CSS/TS renderers as pure projections.
31
+ - **Reference graph:** JSON emits a `color` primitives layer (structural SSOT) and foundation `bg`/`text` colours reference it via DTCG aliases (`{color.primary.base}`), with inline fallback when a resolved value diverges (e.g. surface inversion).
32
+ - **Composite tokens:** `border` (dimension / strokeStyle), `typography` (fontFamily / fontWeight / number + dimension) and `shadow` (DTCG shadow composite) now ship; values DTCG cannot model (em `letterSpacing`, `textTransform`, `fontStyle`, `100%` radius) travel in `$extensions` under `com.apollion.*`.
33
+
34
+ `@apollion-dsi/core` now exports the `themes/{border,depth,font}` subpaths so tokens consumes them as the single source of truth.
35
+
36
+ CSS/TS outputs for the existing `bg`/`text`/`spacing` layers are byte-identical; JSON is the spec-interop surface.
37
+
38
+ ## 4.0.0
39
+
40
+ ### Major Changes
41
+
42
+ - bd7d6cb: # v4.0.0 — OKLch + Dimension + Token Split
43
+
44
+ The v4 epic per [ADR-006](../packages/core/docs/adr/ADR-006-v4-oklch-dimension-token-split.md) + [PRD-002](../packages/core/docs/prd/PRD-002-v4-epic-execution.md). DS-from-scratch (Q-G grilling 2026-05-24); no consumer migration. Greenfield adoption via [MIGRATION-v4.md](../packages/core/docs/migration/MIGRATION-v4.md).
45
+
46
+ ## Breaking — `@apollion-dsi/core@4.0.0`
47
+ - **Root barrel removed.** `import { Button } from '@apollion-dsi/core'` no longer works. Use granular subpaths (`@apollion-dsi/core/elements/button`). ESLint rule flips warn → error. ADR-001 Slice 6 finalized here. ADR-006 §3.7 E7.
48
+ - **OKLch palette derivation.** All `mount*Colors` helpers + `getOppositeColor` migrated from `color@5` RGB lerp to `culori@4` OKLch lerp. Validated by `spike/culori-oklch-lerp-parity` (0 unexpected regressions; greyscale 19× more uniform in OKLAB L). ADR-006 §2 B1 + §6 S2.
49
+ - **`defaultInputColors.opposite` token value changed.** OKLch hue rotation differs from HSL rotation (the OKLch is the perceptually correct opposite). Audit `theme.colors.opposite.*` consumers.
50
+ - **Dimension axis added.** `<ApollionProvider dimension="compact|normal|spacious">` is a new prop; default `normal` preserves v3.x spacing byte-exact. ADR-006 §6 S3.
51
+ - **`vendors/Color` eliminated.** Internal `color@5` vendor deleted (zero call-sites after S6 migration). `color` + `@types/color` removed from `package.json#dependencies`. WCAG functions migrated to `culori.wcagContrast` + `culori.wcagLuminance` (100% bit-exact parity per `spike/culori-wcag-parity`).
52
+ - **`invertForSurface(theme, surface, mode)` 3-arg signature.** `mode` is additive optional — existing 2-arg calls continue to work; `mode` is a placeholder for future PRD-003 mode-aware inversion. ADR-006 §6 S6.
53
+
54
+ ## Minor — `@apollion-dsi/eslint-config`
55
+ - `culori` + `zod` added to `VENDORED_V4_LIBS` — must import via `vendors/Culori|Zod`.
56
+ - `color` removed from `VENDORED_T2_LIBS` (eliminated).
57
+ - `no-restricted-imports` for `'@apollion-dsi/core'` root: `warn` → `error` (per v4 barrel removal above).
58
+
59
+ ## Major — `@apollion-dsi/tokens@4.0.0` (first release)
60
+
61
+ New package — framework-agnostic design tokens consumed via `runtime/v1` versioned API + `apollion-tokens build` CLI.
62
+ - **Strangler Fig builders** duplicated from core (`colors.ts`, `spacing.ts`); Foundation + Surface re-exported. Parity enforced by `__tests__/parity.test.ts`. ADR-006 §3.1 + §6 S4.
63
+ - **Atomic + idempotent build CLI.** `apollion-tokens build [--check] [--verbose] --config <path> [--out <dir>]`. Emits `dist/{css,json,ts}/*` + `dist/manifest.json` with sha256 audit trail. Rerun byte-identical. `--check` mode for CI gate. ADR-006 §3.5 + §6 S5.
64
+ - **DTCG-compliant JSON output** (tech-radar R1).
65
+ - **`as const` TypeScript output** (tech-radar R4).
66
+ - **CSS `@property` declarations** (tech-radar R3) + custom properties `--apollion-{layer}-{role}-{variant}`.
67
+ - **Sandboxed `apollion.config.mjs` loader** (`node:vm` + zod schema) — threat-model T2+E1 mitigation. ADR-006 §3.8 B3 + §6 S6.
68
+ - **Lockstep version** with `@apollion-dsi/core` via `.changeset/config.json#fixed`.
69
+
70
+ ## Minor — `@apollion-dsi/scripts`
71
+ - `codemods/v4-migrate.mjs` — one-way codemod (Q-G10: no `--revert`; DEX/Jovian/Fanaticofc don't consume v3.x, no legacy to revert). Transforms `invertForSurface` to 3-arg, flags `createTheme` for manual hoist to `apollion.config.mjs`. Transcript JSONL audit log.
72
+ - `verify-no-install-scripts.js` — supply-chain hardening; blocks `preinstall`/`install`/`postinstall` in `@apollion-dsi/*` workspaces (threat-model E2 mitigation).
73
+
74
+ ## Spike validation (preserved local, NOT merged to main)
75
+ - `spike/culori-wcag-parity` — 100.0000% bit-exact culori vs color@5 (262 measurements / 10 palettes). `vendors/Color` elimination LOCKED.
76
+ - `spike/culori-oklch-lerp-parity` — 0 unexpected regressions in 68 deltas; greyscale ramp 19× more uniform in OKLAB L. DECISION ✅ PROCEED.
77
+
78
+ ### Patch Changes
79
+
80
+ - Updated dependencies [032f81c]
81
+ - Updated dependencies [32f7a1d]
82
+ - Updated dependencies [2dadba5]
83
+ - Updated dependencies [820a612]
84
+ - Updated dependencies [c056ee3]
85
+ - Updated dependencies [d032437]
86
+ - Updated dependencies [00e0525]
87
+ - Updated dependencies [1c87be8]
88
+ - Updated dependencies [d1192da]
89
+ - Updated dependencies [3194fba]
90
+ - Updated dependencies [f359982]
91
+ - Updated dependencies [5d17ebc]
92
+ - Updated dependencies [bd7d6cb]
93
+ - Updated dependencies [6545751]
94
+ - Updated dependencies [36eaf4a]
95
+ - Updated dependencies [802828f]
96
+ - Updated dependencies [e14469c]
97
+ - Updated dependencies [81cd55b]
98
+ - Updated dependencies [c57c548]
99
+ - Updated dependencies [879eedd]
100
+ - Updated dependencies [e2abc9c]
101
+ - Updated dependencies [75961a1]
102
+ - Updated dependencies [e55019a]
103
+ - Updated dependencies [fba9a41]
104
+ - Updated dependencies [3a90653]
105
+ - Updated dependencies [5fca933]
106
+ - Updated dependencies [ea3dc3a]
107
+ - Updated dependencies [51f71f6]
108
+ - Updated dependencies [0a1baeb]
109
+ - Updated dependencies [6d1371e]
110
+ - Updated dependencies [e55019a]
111
+ - Updated dependencies [29081ae]
112
+ - @apollion-dsi/core@4.0.0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Framework-agnostic design tokens for Apollion Design System v4+.
4
4
 
5
- **Status:** 🟡 `0.0.0-alpha.0`S1 scaffold. Public surface stabilizes at `4.0.0` GA.
5
+ **Status:** **GA @ 4.2.0**v4 epic shipped 2026-05-25 (ADR-006). Lockstep com `@apollion-dsi/core@4.2.0`.
6
6
 
7
7
  ## Versioned API
8
8
 
@@ -38,15 +38,15 @@ Hard rule per ADR-006 §3.1:
38
38
 
39
39
  ## Slicing (ADR-006 §6)
40
40
 
41
- | Slice | Status | Deliverable |
42
- | ----------------------------------------------- | -------------- | -------------------------------------------------------------- |
43
- | S1 — scaffold + versioned API | ✅ this commit | `runtime/v1` namespace, esbuild ESM/CJS dual emit, smoke test |
44
- | S2 — culori vendor + OKLch lerp (in core) | pending | spike `spike/culori-oklch-lerp-parity` validated 0 regressions |
45
- | S3 — Dimension axis | pending | `compact/normal/spacious` multipliers |
46
- | S4 — builders duplicated here via Strangler Fig | pending | parity tests vs core |
47
- | S5 — atomic+idempotent build CLI | pending | `apollion-tokens build` + `dist/manifest.json` |
48
- | S6 — Config-First + sandboxed loader | pending | `node:vm` + zod schema |
49
- | S7 — release `4.0.0` | pending | first major + lockstep changesets |
41
+ | Slice | Status | Deliverable |
42
+ | ------------------------------------ | ---------- | ------------------------------------------------- |
43
+ | S1 — scaffold + versioned API | ✅ shipped | `runtime/v1` namespace, esbuild ESM/CJS dual emit |
44
+ | S2 — culori vendor + OKLch lerp | shipped | `vendors/Culori` in core; OKLch palette |
45
+ | S3 — Dimension axis | ✅ shipped | `compact/normal/spacious` multipliers |
46
+ | S4 — Foundation/Surface builders | shipped | Strangler Fig parity with core |
47
+ | S5 — atomic+idempotent build CLI | ✅ shipped | `apollion-tokens build` + `dist/manifest.json` |
48
+ | S6 — Config-First + sandboxed loader | ✅ shipped | `apollion.config.mjs` + zod schema |
49
+ | S7 — release `4.0.0` | shipped | lockstep changesets with core |
50
50
 
51
51
  ## Refs
52
52
 
@@ -0,0 +1,35 @@
1
+ /**
2
+ * OKLch palette builders — **Strangler Fig duplicate** of
3
+ * `@apollion-dsi/core/themes/colors` (ADR-006 §6 S4, PRD-002 §S4).
4
+ *
5
+ * **Strangler Fig contract:** this file DUPLICATES the implementation from
6
+ * `packages/core/src/themes/Colors/Colors.helpers.ts` (S2 OKLch migration).
7
+ * It does NOT delegate to core. Rationale:
8
+ *
9
+ * - Core remains SSOT for v4.x release line.
10
+ * - Tokens v4.0.0 ships standalone — consumer that opts into
11
+ * `@apollion-dsi/tokens` (via `optionalDependencies` in core) gets a
12
+ * self-contained palette derivation without runtime dep on core internals.
13
+ * - Future PRD-003 (post-v4) consolidates by deleting either copy after
14
+ * real consumer adoption validates the API surface.
15
+ *
16
+ * Parity is enforced via `__tests__/parity.test.ts`: given identical input,
17
+ * `core.mountSingleColor(...) === tokens.mountSingleColor(...)` for every
18
+ * exported function. Drift = build fail.
19
+ *
20
+ * Types are imported from core via the stable subpath
21
+ * `@apollion-dsi/core/themes/colors` (NOT the root barrel that gets removed
22
+ * in E7) — types ARE shared SSOT; only logic is duplicated.
23
+ *
24
+ * @see ../../docs/adr/ADR-006-v4-oklch-dimension-token-split.md §3.1 §6 S4
25
+ * @see ../../docs/prd/PRD-002-v4-epic-execution.md §S4
26
+ */
27
+ import type { AcceptColorType, ColorPalleteInterface, ColorsInput, GrayscaleColorsType, NeutralColorsType } from '@apollion-dsi/core/themes/colors';
28
+ /** Rotate hue 180° in OKLch space. Semantic shift vs HSL — see core for details. */
29
+ export declare function getOppositeColor(color: AcceptColorType): string;
30
+ /** Derive `{ base, dark, action, active, light }` via OKLch lerp. */
31
+ export declare function mountSingleColor(color: AcceptColorType, colors: ColorsInput): ColorPalleteInterface;
32
+ /** 12-step greyscale ramp — perceptually uniform via OKLch lerp. */
33
+ export declare function mountGreyscaleColors(colors: ColorsInput): Record<GrayscaleColorsType, string>;
34
+ /** 20-step neutral ramp anchored at n170 (primary mixed with darker). */
35
+ export declare function mountNeutralColors(colors: ColorsInput): Record<NeutralColorsType, string>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Foundation builder — **interim re-export** from
3
+ * `@apollion-dsi/core/themes/foundation` (ADR-006 §6 S4, PRD-002 §S4).
4
+ *
5
+ * **Interim contract:** Foundation is complex (ADR-002 §3) and ships
6
+ * unchanged in v4. Tokens re-exports `createFoundation` from core via the
7
+ * stable subpath. Strangler Fig consolidation to standalone implementation
8
+ * is deferred to PRD-003 post-v4 if/when real consumer adoption justifies
9
+ * the duplication cost.
10
+ *
11
+ * Unlike `./colors.ts` and `./spacing.ts` (full duplicates because v4 logic
12
+ * is new), Foundation logic exists pre-v4 and parity is enforced trivially
13
+ * by re-export identity.
14
+ *
15
+ * @see ./colors.ts (Strangler Fig contract notes)
16
+ * @see ../../docs/adr/ADR-002-layered-theme-aliases-and-surface.md §3
17
+ */
18
+ export { createFoundation } from '@apollion-dsi/core/themes/foundation';
19
+ export type { FoundationLayer } from '@apollion-dsi/core/themes/foundation';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Spacing builder — **Strangler Fig duplicate** of
3
+ * `@apollion-dsi/core/themes/spacing` (ADR-006 §6 S4).
4
+ *
5
+ * Same dimension override semantics as core: when `dimension` arg
6
+ * provided, its calibrated multiplier wins over `input.multiplier`.
7
+ *
8
+ * @see ./colors.ts (Strangler Fig contract notes)
9
+ */
10
+ import type { Dimension } from '@apollion-dsi/core/themes/dimension';
11
+ import type { SpacingInput, SpacingThemeInterface } from '@apollion-dsi/core/themes/spacing';
12
+ export declare function createSpacing({ multiplier, alias }: SpacingInput, dimension?: Dimension): SpacingThemeInterface;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Surface builder — **interim re-export** from
3
+ * `@apollion-dsi/core/themes/surface` (ADR-006 §6 S4, PRD-002 §S4).
4
+ *
5
+ * **Interim contract:** Surface ships unchanged in v4 S4. Tokens re-exports
6
+ * `invertForSurface` from core via the stable subpath. Surface-within-mode
7
+ * extension (E6 in S6) will REPLACE the signature to
8
+ * `invertForSurface(theme, surface, mode)`; tokens will update its re-export
9
+ * accordingly in S6.
10
+ *
11
+ * @see ./colors.ts (Strangler Fig contract notes)
12
+ * @see ../../docs/adr/ADR-002-layered-theme-aliases-and-surface.md §3
13
+ * @see ../../docs/adr/ADR-006-v4-oklch-dimension-token-split.md §3.6 (E6 in S6)
14
+ */
15
+ export { invertForSurface } from '@apollion-dsi/core/themes/surface';
16
+ export type { SurfaceMode } from '@apollion-dsi/core/themes/surface';
@@ -0,0 +1,35 @@
1
+ /**
2
+ * `@apollion-dsi/tokens/runtime/v1` — Versioned API surface for v4+.
3
+ *
4
+ * **Status:** S4 Strangler Fig builders (ADR-006 §6 S4).
5
+ *
6
+ * This is the ONLY public entry of `@apollion-dsi/tokens`. Bumping to `/v2`
7
+ * adds new exports without breaking `/v1` (versioned API decoupling per
8
+ * ADR-006 §3.3). Consumers import:
9
+ *
10
+ * ```ts
11
+ * import {
12
+ * mountSingleColor, mountGreyscaleColors, mountNeutralColors, getOppositeColor,
13
+ * createSpacing,
14
+ * createFoundation, invertForSurface,
15
+ * TOKENS_RUNTIME_API_VERSION,
16
+ * } from '@apollion-dsi/tokens/runtime/v1';
17
+ * ```
18
+ *
19
+ * **Strangler Fig:** `colors` + `spacing` builders are DUPLICATES of core's
20
+ * implementation (validated bit-equivalent via parity tests). `foundation`
21
+ * + `surface` are re-exports from core via stable subpaths. Both classes
22
+ * coexist orthogonally — core remains SSOT until PRD-003 post-v4
23
+ * consolidation.
24
+ *
25
+ * @see ADR-006 §3.3 (versioned API + decoupling B2 mitigation)
26
+ * @see ADR-006 §6 S1 + §6 S4
27
+ * @see PRD-002 §S4
28
+ */
29
+ export declare const TOKENS_RUNTIME_API_VERSION: "v1";
30
+ export { getOppositeColor, mountGreyscaleColors, mountNeutralColors, mountSingleColor } from '../builders/colors';
31
+ export { createSpacing } from '../builders/spacing';
32
+ export { createFoundation } from '../builders/foundation';
33
+ export type { FoundationLayer } from '../builders/foundation';
34
+ export { invertForSurface } from '../builders/surface';
35
+ export type { SurfaceMode } from '../builders/surface';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollion-dsi/tokens",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "Apollion Design System — Framework-agnostic design tokens",
5
5
  "homepage": "https://github.com/apollion-ds/apollion",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "test": "jest --passWithNoTests",
62
62
  "coverage": "jest --coverage --passWithNoTests",
63
63
  "validate": "./scripts/validate.sh",
64
- "release": "yarn build && changeset publish"
64
+ "release": "yarn build && yarn run -T changeset publish"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "@apollion-dsi/core": ">=4.0.0"
@@ -71,7 +71,7 @@
71
71
  "zod": "4.4.3"
72
72
  },
73
73
  "devDependencies": {
74
- "@apollion-dsi/core": "workspace:*",
74
+ "@apollion-dsi/core": "4.3.0",
75
75
  "@apollion-dsi/eslint-config": "0.8.0",
76
76
  "@types/culori": "4.0.1",
77
77
  "@types/jest": "30.0.0",
@@ -83,4 +83,4 @@
83
83
  "ts-jest": "^29.4.11",
84
84
  "typescript": "6.0.3"
85
85
  }
86
- }
86
+ }