@idaho6/design 0.1.0 → 0.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.
@@ -1,22 +1,46 @@
1
1
  {
2
2
  "color": {
3
3
  "action": {
4
- "primary": { "value": "{openprops.color.blue.6}" },
5
- "hover": { "value": "{openprops.color.blue.7}" },
6
- "active": { "value": "{openprops.color.blue.8}" },
7
- "focus-ring": { "value": "{openprops.color.blue.6}" }
4
+ "primary": {
5
+ "$value": "{openprops.color.blue.6}"
6
+ },
7
+ "hover": {
8
+ "$value": "{openprops.color.blue.7}"
9
+ },
10
+ "active": {
11
+ "$value": "{openprops.color.blue.8}"
12
+ },
13
+ "focus-ring": {
14
+ "$value": "{openprops.color.blue.6}"
15
+ }
8
16
  },
9
17
  "text": {
10
- "primary": { "value": "{openprops.color.slate.9}" },
11
- "secondary": { "value": "{openprops.color.slate.7}" },
12
- "on-dark": { "value": "{openprops.color.white}" }
18
+ "primary": {
19
+ "$value": "{openprops.color.slate.9}"
20
+ },
21
+ "secondary": {
22
+ "$value": "{openprops.color.slate.7}"
23
+ },
24
+ "on-dark": {
25
+ "$value": "{openprops.color.white}"
26
+ }
13
27
  },
14
28
  "surface": {
15
- "page": { "value": "{openprops.color.white}" },
16
- "card": { "value": "{openprops.color.slate.1}" },
17
- "border": { "value": "{openprops.color.slate.4}" },
18
- "border-subtle": { "value": "{openprops.color.slate.3}" },
19
- "border-strong": { "value": "{openprops.color.slate.5}" }
29
+ "page": {
30
+ "$value": "{openprops.color.white}"
31
+ },
32
+ "card": {
33
+ "$value": "{openprops.color.slate.1}"
34
+ },
35
+ "border": {
36
+ "$value": "{openprops.color.slate.4}"
37
+ },
38
+ "border-subtle": {
39
+ "$value": "{openprops.color.slate.3}"
40
+ },
41
+ "border-strong": {
42
+ "$value": "{openprops.color.slate.5}"
43
+ }
20
44
  }
21
45
  }
22
46
  }
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "opacity": {
3
- "disabled": { "value": "0.6" }
3
+ "disabled": {
4
+ "$value": "0.6"
5
+ }
4
6
  }
5
7
  }
@@ -1,9 +1,19 @@
1
1
  {
2
2
  "spacing": {
3
- "xs": { "value": "{openprops.spacing.size.1}" },
4
- "sm": { "value": "{openprops.spacing.size.2}" },
5
- "md": { "value": "{openprops.spacing.size.3}" },
6
- "lg": { "value": "{openprops.spacing.size.4}" },
7
- "xl": { "value": "{openprops.spacing.size.5}" }
3
+ "xs": {
4
+ "$value": "{openprops.spacing.size.1}"
5
+ },
6
+ "sm": {
7
+ "$value": "{openprops.spacing.size.2}"
8
+ },
9
+ "md": {
10
+ "$value": "{openprops.spacing.size.3}"
11
+ },
12
+ "lg": {
13
+ "$value": "{openprops.spacing.size.4}"
14
+ },
15
+ "xl": {
16
+ "$value": "{openprops.spacing.size.5}"
17
+ }
8
18
  }
9
19
  }
@@ -1,27 +1,57 @@
1
1
  {
2
2
  "typography": {
3
3
  "family": {
4
- "base": { "value": "{openprops.typography.font.family.neo-grotesque}" },
5
- "mono": { "value": "{openprops.typography.font.family.mono}" }
4
+ "base": {
5
+ "$value": "{openprops.typography.font.family.neo-grotesque}"
6
+ },
7
+ "mono": {
8
+ "$value": "{openprops.typography.font.family.mono}"
9
+ }
6
10
  },
7
11
  "scale": {
8
- "xs": { "value": "{openprops.typography.font.size.0}" },
9
- "sm": { "value": "{openprops.typography.font.size.1}" },
10
- "base": { "value": "{openprops.typography.font.size.2}" },
11
- "md": { "value": "{openprops.typography.font.size.3}" },
12
- "lg": { "value": "{openprops.typography.font.size.4}" },
13
- "2xl": { "value": "{openprops.typography.font.size.7}" },
14
- "3xl": { "value": "{openprops.typography.font.size.8}" }
12
+ "xs": {
13
+ "$value": "{openprops.typography.font.size.0}"
14
+ },
15
+ "sm": {
16
+ "$value": "{openprops.typography.font.size.1}"
17
+ },
18
+ "base": {
19
+ "$value": "{openprops.typography.font.size.2}"
20
+ },
21
+ "md": {
22
+ "$value": "{openprops.typography.font.size.3}"
23
+ },
24
+ "lg": {
25
+ "$value": "{openprops.typography.font.size.4}"
26
+ },
27
+ "2xl": {
28
+ "$value": "{openprops.typography.font.size.7}"
29
+ },
30
+ "3xl": {
31
+ "$value": "{openprops.typography.font.size.8}"
32
+ }
15
33
  },
16
34
  "weight": {
17
- "base": { "value": "{openprops.typography.font.weight.6}" },
18
- "bold": { "value": "{openprops.typography.font.weight.7}" }
35
+ "base": {
36
+ "$value": "{openprops.typography.font.weight.6}"
37
+ },
38
+ "bold": {
39
+ "$value": "{openprops.typography.font.weight.7}"
40
+ }
19
41
  },
20
42
  "lineheight": {
21
- "tight": { "value": "{openprops.typography.font.lineheight.1}" },
22
- "snug": { "value": "{openprops.typography.font.lineheight.2}" },
23
- "base": { "value": "{openprops.typography.font.lineheight.3}" },
24
- "relaxed": { "value": "{openprops.typography.font.lineheight.4}" }
43
+ "tight": {
44
+ "$value": "{openprops.typography.font.lineheight.1}"
45
+ },
46
+ "snug": {
47
+ "$value": "{openprops.typography.font.lineheight.2}"
48
+ },
49
+ "base": {
50
+ "$value": "{openprops.typography.font.lineheight.3}"
51
+ },
52
+ "relaxed": {
53
+ "$value": "{openprops.typography.font.lineheight.4}"
54
+ }
25
55
  }
26
56
  }
27
57
  }
package/project.json DELETED
@@ -1,34 +0,0 @@
1
- {
2
- "name": "@idaho6/design",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "packages/design/src",
5
- "prefix": "id6",
6
- "targets": {
7
- "extract-primitives": {
8
- "executor": "nx:run-commands",
9
- "options": {
10
- "cwd": "packages/design",
11
- "command": "pnpm run extract-primitives"
12
- },
13
- "outputs": ["{projectRoot}/tokens/primitives"]
14
- },
15
- "typecheck": {
16
- "executor": "nx:run-commands",
17
- "options": {
18
- "command": "tsc --build tsconfig.lib.json --noEmit"
19
- }
20
- },
21
- "build": {
22
- "executor": "nx:run-commands",
23
- "options": {
24
- "cwd": "packages/design",
25
- "command": "tsc --build tsconfig.lib.json && pnpm run build:factory && pnpm run build:tokens"
26
- },
27
- "outputs": ["{projectRoot}/dist"],
28
- "dependsOn": ["extract-primitives"]
29
- },
30
- "lint": {
31
- "executor": "@nx/eslint:lint"
32
- }
33
- }
34
- }
@@ -1,28 +0,0 @@
1
- version: 1.0.0
2
- package: '@id6/design'
3
-
4
- rules:
5
- - id: conformance/layout/no-media-queries
6
- description: Use clamp() for fluid layout instead of viewport breakpoints
7
- rationale: Viewport breakpoints create discrete jumps and require tokens that can't be expressed as CSS custom properties in media query conditions. clamp() produces fluid scaling between min and max values with no additional token infrastructure.
8
- severity: error
9
-
10
- - id: conformance/color/no-hardcoded-values
11
- description: All color values must reference semantic tokens, not raw OpenProps primitives or hardcoded hex/rgb values
12
- rationale: Hardcoded color values break the token pipeline. A color change in @w4i/brand must propagate automatically to all consumers. Direct primitive or hardcoded references bypass that chain and require manual updates.
13
- severity: error
14
-
15
- - id: conformance/spacing/no-hardcoded-px
16
- description: All spacing and sizing values must reference OpenProps size tokens or be expressed as clamp()
17
- rationale: Hardcoded px values for spacing scatter layout decisions across files with no single source of truth. OpenProps size tokens and clamp() expressions keep spacing decisions in the token pipeline.
18
- severity: error
19
-
20
- - id: conformance/border/no-hardcoded-px
21
- description: Border sizes must reference OpenProps border-size tokens
22
- rationale: Hardcoded border sizes (e.g. 1px) bypass the token pipeline. OpenProps --border-size-* tokens ensure consistency and single-source control.
23
- severity: warning
24
-
25
- - id: conformance/tokens/no-primitive-reference
26
- description: Component styles must reference semantic tokens, not OpenProps primitives directly
27
- rationale: Components referencing primitives directly (e.g. --blue-6) couple the component to a specific value rather than an intent. Semantic tokens (e.g. --color-action-primary) decouple intent from value, enabling campaign-level theming via @w4i/brand without touching component code.
28
- severity: error
@@ -1,8 +0,0 @@
1
- import { build } from './createConfig.mjs'
2
-
3
- await build({
4
- source: ['tokens/primitives/**/*.json', 'tokens/semantic/**/*.json'],
5
- buildPath: 'dist',
6
- })
7
-
8
- console.log('✔︎ @idaho6/design tokens built')
@@ -1,4 +0,0 @@
1
- export function build(options: {
2
- source: string[]
3
- buildPath: string
4
- }): Promise<void>
@@ -1,39 +0,0 @@
1
- import StyleDictionary from 'style-dictionary'
2
-
3
- export async function build({ source, buildPath }) {
4
- const sd = new StyleDictionary({
5
- log: {
6
- warnings: 'warn',
7
- verbosity: 'default',
8
- },
9
- source,
10
- platforms: {
11
- css: {
12
- transformGroup: 'css',
13
- buildPath: `${buildPath}/css/`,
14
- files: [
15
- {
16
- destination: 'tokens.css',
17
- format: 'css/variables',
18
- options: {
19
- selector: ':root',
20
- },
21
- },
22
- ],
23
- },
24
- figma: {
25
- transformGroup: 'js',
26
- buildPath: `${buildPath}/figma/`,
27
- files: [
28
- {
29
- destination: 'tokens.json',
30
- format: 'json/nested',
31
- },
32
- ],
33
- },
34
- },
35
- })
36
-
37
- await sd.hasInitialized
38
- await sd.buildAllPlatforms()
39
- }
@@ -1,189 +0,0 @@
1
- import fs from 'fs'
2
- import path from 'path'
3
- import { fileURLToPath } from 'url'
4
-
5
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
6
-
7
- // OpenProps provides CSS custom property definitions
8
- // We'll import the JS module which exports token values
9
- import openProps from 'open-props'
10
-
11
- // Extract color primitives
12
- const colorPrimitives = {
13
- openprops: {
14
- color: {},
15
- },
16
- }
17
-
18
- // Map OpenProps color scales to our structure
19
- // OpenProps: gray, red, green, blue, teal, yellow, orange, etc.
20
- // We need: slate, red, green, blue, teal, amber, white, black
21
- const colorMapping = {
22
- slate: 'gray', // Map gray from OpenProps to slate
23
- blue: 'blue',
24
- red: 'red',
25
- green: 'green',
26
- teal: 'teal',
27
- amber: 'yellow', // Map yellow to amber (closest OpenProps equivalent)
28
- }
29
-
30
- // Add white and black as hardcoded values (standard CSS colors)
31
- colorPrimitives.openprops.color.white = {
32
- value: '#ffffff',
33
- }
34
-
35
- colorPrimitives.openprops.color.black = {
36
- value: '#000000',
37
- }
38
-
39
- // Extract colors from OpenProps
40
- Object.entries(colorMapping).forEach(([targetName, opName]) => {
41
- colorPrimitives.openprops.color[targetName] = {}
42
-
43
- // For numbered scales (0-12 for most OpenProps colors)
44
- for (let i = 0; i <= 12; i++) {
45
- const key = `--${opName}-${i}`
46
- if (key in openProps) {
47
- colorPrimitives.openprops.color[targetName][i] = {
48
- value: openProps[key],
49
- }
50
- }
51
- }
52
- })
53
-
54
- // Extract typography primitives
55
- const typographyPrimitives = {
56
- openprops: {
57
- typography: {
58
- font: {
59
- family: {},
60
- size: {},
61
- weight: {},
62
- lineheight: {},
63
- },
64
- },
65
- },
66
- }
67
-
68
- // Font families
69
- const fontFamilies = [
70
- 'neo-grotesque',
71
- 'monospace-code',
72
- 'mono',
73
- 'system-ui',
74
- 'serif',
75
- ]
76
- fontFamilies.forEach((family) => {
77
- const key = `--font-${family}`
78
- if (key in openProps) {
79
- typographyPrimitives.openprops.typography.font.family[family] = {
80
- value: openProps[key],
81
- }
82
- }
83
- })
84
-
85
- // Font sizes (0-8)
86
- for (let i = 0; i <= 8; i++) {
87
- const key = `--font-size-${i}`
88
- if (key in openProps) {
89
- typographyPrimitives.openprops.typography.font.size[i] = {
90
- value: openProps[key],
91
- }
92
- }
93
- }
94
-
95
- // Font weights (0-9)
96
- for (let i = 0; i <= 9; i++) {
97
- const key = `--font-weight-${i}`
98
- if (key in openProps) {
99
- typographyPrimitives.openprops.typography.font.weight[i] = {
100
- value: openProps[key],
101
- }
102
- }
103
- }
104
-
105
- // Line heights (0-9)
106
- for (let i = 0; i <= 9; i++) {
107
- const key = `--font-lineheight-${i}`
108
- if (key in openProps) {
109
- typographyPrimitives.openprops.typography.font.lineheight[i] = {
110
- value: openProps[key],
111
- }
112
- }
113
- }
114
-
115
- // Extract border primitives
116
- const borderPrimitives = {
117
- openprops: {
118
- border: {
119
- radius: {},
120
- size: {},
121
- },
122
- },
123
- }
124
-
125
- // Border radii (0-9)
126
- for (let i = 0; i <= 9; i++) {
127
- const key = `--radius-${i}`
128
- if (key in openProps) {
129
- borderPrimitives.openprops.border.radius[i] = {
130
- value: openProps[key],
131
- }
132
- }
133
- }
134
-
135
- // Border sizes (0-9)
136
- for (let i = 0; i <= 9; i++) {
137
- const key = `--border-size-${i}`
138
- if (key in openProps) {
139
- borderPrimitives.openprops.border.size[i] = {
140
- value: openProps[key],
141
- }
142
- }
143
- }
144
-
145
- // Extract spacing primitives
146
- const spacingPrimitives = {
147
- openprops: {
148
- spacing: {
149
- size: {},
150
- },
151
- },
152
- }
153
-
154
- // Spacing scale (0-13)
155
- for (let i = 0; i <= 13; i++) {
156
- const key = `--size-${i}`
157
- if (key in openProps) {
158
- spacingPrimitives.openprops.spacing.size[i] = {
159
- value: openProps[key],
160
- }
161
- }
162
- }
163
-
164
- // Write primitives to files
165
- const tokensDir = path.join(__dirname, '../tokens/primitives')
166
-
167
- fs.mkdirSync(tokensDir, { recursive: true })
168
-
169
- fs.writeFileSync(
170
- path.join(tokensDir, 'color.json'),
171
- JSON.stringify(colorPrimitives, null, 2)
172
- )
173
-
174
- fs.writeFileSync(
175
- path.join(tokensDir, 'typography.json'),
176
- JSON.stringify(typographyPrimitives, null, 2)
177
- )
178
-
179
- fs.writeFileSync(
180
- path.join(tokensDir, 'border.json'),
181
- JSON.stringify(borderPrimitives, null, 2)
182
- )
183
-
184
- fs.writeFileSync(
185
- path.join(tokensDir, 'spacing.json'),
186
- JSON.stringify(spacingPrimitives, null, 2)
187
- )
188
-
189
- console.log('✔︎ Primitives extracted from OpenProps')
package/src/index.ts DELETED
@@ -1,13 +0,0 @@
1
- import { readFileSync } from 'fs'
2
- import { join, dirname } from 'path'
3
- import { load } from 'js-yaml'
4
- import { fileURLToPath } from 'url'
5
-
6
- const __dirname = dirname(fileURLToPath(import.meta.url))
7
-
8
- const conformanceSpecPath = join(__dirname, '../spec/conformance.yaml')
9
- const conformanceSpecContent = readFileSync(conformanceSpecPath, 'utf-8')
10
-
11
- export const conformanceSpec = load(conformanceSpecContent)
12
-
13
- export { build } from './createConfig.mjs'
package/src/lib/design.ts DELETED
@@ -1 +0,0 @@
1
- export {}
package/tsconfig.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "files": [],
4
- "include": [],
5
- "references": [
6
- {
7
- "path": "./tsconfig.lib.json"
8
- }
9
- ]
10
- }
package/tsconfig.lib.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "rootDir": "src",
6
- "outDir": "dist",
7
- "module": "nodenext",
8
- "moduleResolution": "nodenext",
9
- "tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
10
- "emitDeclarationOnly": false,
11
- "types": ["node"]
12
- },
13
- "include": ["src/**/*.ts"],
14
- "references": []
15
- }