Skip to content

Commit 77b0d90

Browse files
authored
Replace type property with suggestion and fix some suggestion values (#28)
* we dont need type Property * fix suggestion values! * type value based on type * typo!
1 parent 31b589c commit 77b0d90

9 files changed

Lines changed: 697 additions & 644 deletions

File tree

src/data/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export {propertiesMap, type Property} from './properties-generated'
1+
export {propertiesMap} from './properties-generated'
22
export {aliases} from './aliases'
33
export {type Suggestion} from './rules'

src/data/precompile.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,22 @@ fs.writeFileSync(
3030
filePath,
3131
`// Generated file, do not edit manually. Run 'npm run precompile' to regenerate.
3232
33-
export type Property = {
34-
name: string
35-
value?: string
36-
kind: 'base' | 'functional'
37-
type: string
38-
}
33+
// copy of type Suggestion from data/rules
34+
type Suggestion =
35+
| {
36+
name: \`--$\{string}\`
37+
kind: 'base' | 'functional'
38+
} & (
39+
| {
40+
value: string
41+
type: 'dimension' | 'color' | 'string' | 'fontFamily' | 'typography' | 'duration'
42+
}
43+
| {
44+
value: number
45+
type: 'fontWeight' | 'number' | 'cubicBezier'
46+
}
47+
)
3948
40-
export const propertiesMap: Record<string, Property[]> = ${JSON.stringify(propertiesMapFromRules, null, 2)}
49+
export const propertiesMap: Record<string, Suggestion[]> = ${JSON.stringify(propertiesMapFromRules, null, 2)}
4150
`,
4251
)

0 commit comments

Comments
 (0)