@phcdevworks/spectre-tokens 1.0.0 → 2.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 CHANGED
File without changes
package/README.md CHANGED
@@ -1,20 +1,33 @@
1
1
  # @phcdevworks/spectre-tokens
2
2
 
3
- JSON-first design tokens that power Spectre UI, Spectre Blocks, Spectre Astro, Spectre 11ty, and every future Spectre surface.
3
+ ### **The DNA (Layer 1 of the Spectre 8-Layer Arsenal)**
4
4
 
5
- 🤝 **[Contributing Guide](CONTRIBUTING.md)** | 📝 **[Changelog](CHANGELOG.md)** | 🎨 **[Token Examples](example/examples.md)**
5
+ `@phcdevworks/spectre-tokens` is the Single Source of Truth for the entire Spectre ecosystem. It defines the visual language—colors, typography, space, and semantic roles—that all other layers consume.
6
6
 
7
- ## Overview
7
+ 🤝 **[Contributing Guide](CONTRIBUTING.md)** | 📝 **[Changelog](CHANGELOG.md)** | 🏛️ **[Spectre Arsenal](https://github.com/phcdevworks)**
8
8
 
9
- `@phcdevworks/spectre-tokens` defines Spectre's visual language—colors, typography, space, radii, shadows, breakpoints, z-index scales, transitions, and CRO-focused interaction states. The package turns the raw JSON tokens in `tokens/` into multiple consumption modes (JS, TS, Tailwind, CSS variables) so teams can stay in sync regardless of framework.
9
+ ---
10
+
11
+ ## 🏗️ Core Architecture
12
+
13
+ This package is the foundation. It follows a strict **JSON-First** policy—authoritative values live in `tokens/` and are transformed into multiple consumption modes (CSS, JS/TS, Tailwind).
14
+
15
+ - 🧬 **Authoritative JSON**: Domain-specific token storage for better maintainability.
16
+ - 🧪 **Type-Safe DNA**: 100% strict TypeScript interfaces derived directly from JSON.
17
+ - 🌪️ **Multi-Format Output**: Generates CSS Variables, Tailwind Presets, and ESM/CJS exports.
18
+ - ♿ **Accessibility First**: Encodes WCAG constraints (contrast, touch targets) at the token level.
19
+
20
+ ---
10
21
 
11
22
  **Single source of truth:** JSON is the source. Everything else is generated.
12
23
 
13
- - ✅ Centralized token definitions and semantic naming
14
- - ✅ JS/TS objects, Tailwind theme + preset, and CSS variable outputs
15
- - ✅ CRO-focused surfaces (buttons, forms, states) and accessibility-first tokens
16
- - ✅ Helpers for scoped CSS variable generation
17
- - ✅ Type-safe outputs with bundled `.d.ts` files
24
+ - ✅ **Modular Architecture**: domain-specific token storage for better maintainability
25
+ - ✅ **AI-Ready DNA**: Zero `any` types and 100% strict TypeScript build process
26
+ - ✅ **Auto-Generated Typings**: Strictly-typed TS interfaces derived directly from JSON
27
+ - ✅ **Multi-File Merging**: Type-safe merging of cross-domain token references
28
+ - ✅ **JS/TS objects**, Tailwind theme + preset, and CSS variable outputs
29
+ - ✅ **CRO-focused surfaces** (buttons, forms, states) and accessibility-first tokens
30
+ - ✅ **Type-safe outputs** with bundled `.d.ts` files
18
31
 
19
32
  ## Installation
20
33
 
@@ -132,7 +145,7 @@ The `tokens` object includes:
132
145
  - `opacity`: Opacity scale (hover, active, disabled, focus, overlay, tooltip)
133
146
  - `borders`: Border color tokens
134
147
  - `surface`: Semantic surface backgrounds (page, card, input, overlay)
135
- - `text`: Semantic text colors (onPage, onSurface with default/muted/subtle/meta)
148
+ - `text`: Semantic text colors (onPage, onSurface with default/muted/subtle/meta/**brand**)
136
149
  - `component`: Component-specific tokens (card, input, button, badge, iconBox)
137
150
  - `modes`: Theme mode definitions (default/light and dark)
138
151
 
@@ -429,6 +442,7 @@ For secondary/metadata text styling:
429
442
  ```ts
430
443
  tokens.text.onPage.meta; // Metadata text on page backgrounds
431
444
  tokens.text.onSurface.meta; // Metadata text on card/surface backgrounds
445
+ tokens.text.onPage.brand; // Brand accent text on page canvas
432
446
  ```
433
447
 
434
448
  ```css
@@ -744,12 +758,12 @@ tokens.borders.input; // "#cbd5f5"
744
758
 
745
759
  | Folder | Responsibility |
746
760
  | ---------- | ------------------------------------------------------------------------------------------------------------- |
747
- | `tokens/` | Raw JSON token files owned by design (e.g. `core.json`, modes, component semantics). |
761
+ | `tokens/` | Raw JSON token files (modularized as `palette.json`, `typography.json`, `components.json`, etc.). |
748
762
  | `src/` | TypeScript source that turns JSON into reusable formats (JS/TS exports, Tailwind theme, CSS helpers). |
749
- | `scripts/` | Build utilities. `build-css.js` consumes the compiled library and writes `dist/index.css`. |
763
+ | `scripts/` | Build utilities and strictly-typed token merging engines. |
750
764
  | `dist/` | Generated artifacts: `index.js`, `index.cjs`, `index.d.ts`, and `index.css`. Regenerated via `npm run build`. |
751
765
 
752
- Designers only touch the JSON under `tokens/`. Engineering evolves `src/` + `scripts/` when structure changes.
766
+ Designers only touch the JSON under `tokens/`. Engineering evolves `src/` + `scripts/` when structure or transforms change.
753
767
 
754
768
  ## Build & Release
755
769
 
@@ -853,7 +867,7 @@ Spectre is a **specification-driven design system** built on three strict layers
853
867
  - Designers own `tokens/*.json`; engineers maintain `src/` transforms
854
868
  - Contrast targets and accessibility constraints are encoded at the token level
855
869
 
856
- **Status**: v0.1.0 released with stable semantic roles (`surface.*`, `text.*`, `component.*`) and considered correct/locked
870
+ **Status**: v2.0.0 released. Transitioned to modular JSON storage and full AI-readiness.
857
871
 
858
872
  ### 2. @phcdevworks/spectre-ui (Framework-Agnostic UI Layer)
859
873
 
@@ -874,7 +888,7 @@ Spectre is a **specification-driven design system** built on three strict layers
874
888
  - Every CSS selector has a matching recipe where applicable
875
889
  - Tailwind preset is optional and non-authoritative
876
890
 
877
- **Status**: v0.1.0 released, hardened and aligned to tokens
891
+ **Status**: v1.0.0 hardened and aligned to tokens. v2.0.0 compatibility ready.
878
892
 
879
893
  ### 3. Adapters (WordPress, Astro, etc.)
880
894
 
@@ -1420,7 +1434,7 @@ const customThemeCSS = generateCssVariables(tokens, {
1420
1434
  **Question:** Can I add my own theme modes beyond default/dark?
1421
1435
 
1422
1436
  **Answer:**
1423
- Yes! Extend the `modes` object in your `core.json`:
1437
+ Yes! Extend the `modes` object in your `tokens/modes.json`:
1424
1438
 
1425
1439
  ```json
1426
1440
  {
@@ -1488,7 +1502,7 @@ Two approaches:
1488
1502
  Semantic tokens in `modes` use the `{ value: "..." }` format for metadata. The TypeScript library automatically resolves these:
1489
1503
 
1490
1504
  ```ts
1491
- // In core.json: { "value": "#f8fafc" }
1505
+ // In tokens/*.json: { "value": "#f8fafc" }
1492
1506
  tokens.surface.page; // Returns "#f8fafc" (string)
1493
1507
 
1494
1508
  // The library handles resolution automatically
@@ -1506,15 +1520,18 @@ Issues and pull requests are welcome. If you are proposing token changes, update
1506
1520
 
1507
1521
  For detailed contribution guidelines, see **[CONTRIBUTING.md](CONTRIBUTING.md)**.
1508
1522
 
1509
- ## License
1523
+ ---
1510
1524
 
1511
- See **[LICENSE](LICENSE)** for details.
1525
+ ## 🏛️ The Spectre Suite Hierarchy
1512
1526
 
1513
- ---
1527
+ Spectre is built on a non-negotiable hierarchy to prevent style leakage and duplication:
1528
+
1529
+ 1. **Layer 1: DNA (This Package)** – The source of truth for all design values.
1530
+ 2. **Layer 2: Blueprint (UI)** ([@phcdevworks/spectre-ui](https://github.com/phcdevworks/spectre-ui)) – Translates tokens into CSS structure and recipes.
1531
+ 3. **Layer 3: Adapters** (WordPress, Astro, etc.) – Thin bridges that map Layer 2 to specific frameworks.
1514
1532
 
1515
- ## ❤️ Support Spectre
1533
+ > **The Golden Rule**: Tokens define *meaning*. UI defines *structure*. Adapters define *delivery*.
1534
+
1535
+ ---
1516
1536
 
1517
- If Spectre Tokens helps your workflow, consider sponsoring:
1518
1537
 
1519
- - [GitHub Sponsors](https://github.com/sponsors/phcdevworks)
1520
- - [Buy Me a Coffee](https://buymeacoffee.com/phcdevworks)