@primitiv-ui/tokens 0.1.1 → 0.1.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +2 -1
  3. package/src/dtcg.ts +9 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Simon Revill
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@primitiv-ui/tokens",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
+ "description": "The DTCG-conformant design-token layer for the Primitiv ecosystem, plus helpers that transform Figma variable exports into DTCG JSON.",
4
5
  "type": "module",
5
6
  "main": "src/index.ts",
6
7
  "types": "src/index.ts",
package/src/dtcg.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  * it but is a separate module.
9
9
  */
10
10
 
11
+ /** A Figma variable collection as surfaced by the Plugin Variables API — its modes and default mode. */
11
12
  export type FigmaCollection = {
12
13
  id: string
13
14
  name: string
@@ -15,12 +16,16 @@ export type FigmaCollection = {
15
16
  defaultModeId: string
16
17
  }
17
18
 
19
+ /** The resolved primitive type of a Figma variable. */
18
20
  export type FigmaResolvedType = 'BOOLEAN' | 'COLOR' | 'FLOAT' | 'STRING'
19
21
 
22
+ /** An RGBA colour as Figma reports it — each channel in the 0–1 range. */
20
23
  export type FigmaRgba = { r: number; g: number; b: number; a: number }
21
24
 
25
+ /** A Figma variable alias — a reference to another variable by id. */
22
26
  export type FigmaAlias = { type: 'VARIABLE_ALIAS'; id: string }
23
27
 
28
+ /** A single Figma variable with its per-mode values. */
24
29
  export type FigmaVariable = {
25
30
  id: string
26
31
  name: string
@@ -29,15 +34,19 @@ export type FigmaVariable = {
29
34
  valuesByMode: Record<string, unknown>
30
35
  }
31
36
 
37
+ /** A DTCG token `$type`. */
32
38
  export type DtcgType = 'string' | 'number' | 'color' | 'boolean'
33
39
 
40
+ /** A resolved DTCG token `$value`. */
34
41
  export type DtcgValue = string | number | boolean
35
42
 
43
+ /** A DTCG token — a `$type` / `$value` pair. */
36
44
  export type DtcgToken = {
37
45
  $type: DtcgType
38
46
  $value: DtcgValue
39
47
  }
40
48
 
49
+ /** A DTCG group — a tree of nested groups and tokens. */
41
50
  export type DtcgGroup = { [key: string]: DtcgGroup | DtcgToken }
42
51
 
43
52
  /** One DTCG file per Figma collection. */