@designid/tokens 1.1.2 → 1.2.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/README.md CHANGED
@@ -25,6 +25,8 @@ To build the design system tokens, you need to run the `bun tokens-build` or `bu
25
25
  ### Quick Start
26
26
  Copy the example folder in this project. To be able to configure it, you need to customize `designid.config.ts` based on your setup.
27
27
 
28
+ > **Note:** All commands (`tokens-build`, `tokens-watch`, `tokens-editor`) automatically compile your `designid.config.ts` to `.mjs` when they run. You never need to manually compile your config file!
29
+
28
30
  #### Building tokens
29
31
  If you have the `designid.config.ts` in your root project folder you can execute the following build script.
30
32
  ```bash
@@ -45,6 +47,96 @@ To build the design system tokens in development mode, you can use the `tokens-w
45
47
  bun tokens-watch
46
48
  ```
47
49
 
50
+ ## Token Editor
51
+
52
+ A web-based editor for managing W3C Design Tokens with full CRUD operations, token references, and mode support.
53
+
54
+ ### Configuration
55
+
56
+ Configure the editor in your `designid.config.ts`:
57
+
58
+ ```typescript
59
+ {
60
+ $metaData: {
61
+ editor: {
62
+ enabled: true, // Enable/disable the editor
63
+ port: 3002, // Editor server port
64
+ },
65
+ },
66
+ }
67
+ ```
68
+
69
+ ### Starting the Editor
70
+
71
+ After installing the package, you can start the editor using the `tokens-editor` command:
72
+
73
+ #### 1. Using the CLI command (Recommended)
74
+ ```bash
75
+ # Start with settings from config file
76
+ tokens-editor
77
+
78
+ # Override port from command line
79
+ tokens-editor --port=4000
80
+
81
+ # Start with verbose logging
82
+ tokens-editor --verbose
83
+
84
+ # View all options
85
+ tokens-editor --help
86
+ ```
87
+
88
+ **Note:** CLI arguments override config file settings. The editor automatically compiles your config file when starting, so you don't need to manually compile `designid.config.ts` anymore - just run the editor and it will handle compilation for you!
89
+
90
+ #### 2. Using npm scripts
91
+ ```bash
92
+ # Start the server
93
+ npm run editor:server
94
+
95
+ # Open in browser
96
+ npm run editor:open
97
+ ```
98
+
99
+ #### 3. Programmatic API (from external packages)
100
+
101
+ ```typescript
102
+ import { startEditorServer } from '@designid/tokens/editor';
103
+
104
+ // Start with default options (port 3002)
105
+ await startEditorServer();
106
+
107
+ // Start with custom options
108
+ await startEditorServer({
109
+ port: 4000,
110
+ configPath: './my-config.ts',
111
+ verbose: true
112
+ });
113
+ ```
114
+
115
+ **EditorServerOptions:**
116
+ - `port` (number, default: 3002) - Server port
117
+ - `configPath` (string, default: './designid.config.ts') - Path to config file
118
+ - `verbose` (boolean, default: false) - Enable verbose logging
119
+
120
+ #### 4. Direct command (for development)
121
+ ```bash
122
+ bun src/editor/server.ts
123
+ ```
124
+
125
+ The editor will be available at `http://localhost:3002` (or your custom port).
126
+
127
+ ### Editor Features
128
+
129
+ - 🌲 **Tree View**: Hierarchical display of tokens with expand/collapse
130
+ - 🔍 **Search & Filter**: Search by token path and name
131
+ - ✏️ **Full CRUD**: Create, read, update, and delete tokens
132
+ - 🔗 **Token References**: Autocomplete with `{path}` syntax
133
+ - 🎨 **Mode Support**: Light, dark, and custom theme modes
134
+ - ✅ **Path Validation**: Client and server-side validation
135
+ - 🔄 **Real-time Feedback**: Live warnings for conflicts and errors
136
+ - 📝 **W3C Compliance**: Full support for W3C Design Tokens spec
137
+
138
+ For detailed documentation, see [src/editor/README.md](src/editor/README.md).
139
+
48
140
  ### File structure
49
141
  The file structure of the design system tokens is as follows in a typical web application project:
50
142