Skip to content

Commit

Permalink
Update typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Feb 25, 2024
1 parent 4005f41 commit deda1f8
Show file tree
Hide file tree
Showing 9 changed files with 290 additions and 272 deletions.
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,52 +24,52 @@
"dependencies": {
"@google-cloud/storage": "^7.7.0",
"@swc-node/jest": "^1.7.0",
"@techor/fs": "^3.0.11",
"@techor/glob": "^3.0.11",
"@techor/jest-dom": "^3.0.11",
"@techor/repo": "^3.0.11",
"@techor/fs": "^3.0.13",
"@techor/glob": "^3.0.13",
"@techor/jest-dom": "^3.0.13",
"@techor/repo": "^3.0.13",
"@types/node-fetch": "^2.6.11",
"@types/shuffle-array": "^1.0.5",
"cheerio": "1.0.0-rc.12",
"cross-env": "^7.0.3",
"css-shared": "workspace:^",
"execa": "^8.0.1",
"fast-glob": "^3.3.2",
"firebase-admin": "^11.11.1",
"jest-extended": "^4.0.2",
"jest-text-transformer": "^1.0.4",
"lightningcss-cli": "^1.23.0",
"lightningcss-cli": "^1.24.0",
"nanoid": "^4.0.2",
"nodemon": "^2.0.22",
"normalize-newline": "^4.1.0",
"pretty-ms": "^8.0.0",
"shuffle-array": "^1.0.1",
"spawnd": "^9.0.2",
"strip-ansi": "^7.1.0",
"techor": "^3.0.11",
"techor": "^3.0.13",
"tinybench": "^2.6.0",
"ts-dedent": "^2.2.0",
"tsx": "^4.7.1"
},
"devDependencies": {
"class-variant": "workspace:^",
"@master/css-cli": "workspace:^",
"css-shared": "workspace:^",
"@master/create-css": "workspace:^",
"@master/css": "workspace:^",
"@master/eslint-config-css": "workspace:^",
"@master/eslint-plugin-css": "workspace:^",
"@master/css-cli": "workspace:^",
"@master/css-extractor": "workspace:^",
"@master/css-extractor.vite": "workspace:^",
"@master/css-extractor.webpack": "workspace:^",
"@master/css-language-server": "workspace:^",
"@master/css-language-service": "workspace:^",
"@master/css.nuxt": "workspace:^",
"@master/css.react": "workspace:^",
"@master/css-runtime": "workspace:^",
"@master/css-server": "workspace:^",
"@master/css.svelte": "workspace:^",
"@master/css-validator": "workspace:^",
"@master/css.nuxt": "workspace:^",
"@master/css.react": "workspace:^",
"@master/css.svelte": "workspace:^",
"@master/css.vue": "workspace:^",
"@master/eslint-config-css": "workspace:^",
"@master/eslint-plugin-css": "workspace:^",
"class-variant": "workspace:^",
"theme-service": "workspace:^"
}
}
10 changes: 2 additions & 8 deletions packages/css/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import './src'
import '@types/jest'

import { default as _MasterCSS } from './src/core'

declare global {
var MasterCSS: typeof _MasterCSS
var masterCSSs: _MasterCSS[]
}
import './types/global'
import '@types/jest'
2 changes: 1 addition & 1 deletion packages/css/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export type SelectorDefinitions = { [key: string]: string | string[] | SelectorD
export type MediaQueryDefinitions = { [key: string]: number | string | MediaQueryDefinitions }
export type StyleDefinitions = { [key: string]: string | StyleDefinitions }
export type RuleDefinitions = { [key in keyof typeof rules | string]?: RuleDefinition }
export type VariableDefinitions = { [key in keyof typeof rules]?: VariableDefinition } & { [key: string]: VariableDefinition | VariableValue }
export type VariableDefinitions = { [key in keyof typeof rules]?: VariableDefinition | VariableValue } & { [key: string]: VariableDefinition | VariableValue }
export type SemanticDefinitions = { [key in keyof typeof semantics]?: PropertiesHyphen } & { [key: string]: PropertiesHyphen }
export interface FunctionDefinition {
unit?: string
Expand Down
27 changes: 14 additions & 13 deletions packages/css/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { hexToRgb } from './utils/hex-to-rgb'
import { flattenObject } from './utils/flatten-object'
import { extendConfig } from './utils/extend-config'
import { PropertiesHyphen } from 'csstype'
import '../types/global.d' // fix: ../css/src/core.ts:1205:16 - error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.

type VariableValue =
{ type: 'string', value: string }
Expand All @@ -20,18 +21,6 @@ export type Variable = Omit<VariableValue, 'value' | 'space'> & {
themes?: { [theme: string]: VariableValue }
}

export default interface MasterCSS {
readonly style: HTMLStyleElement
styles: Record<string, string[]>
stylesBy: Record<string, string[]>
selectors: Record<string, [RegExp, string[]][]>
variables: Record<string, Variable>
mediaQueries: Record<string, string | number>
variablesNativeRules: Record<string, NativeRule>
hasKeyframesRule: boolean
animations: Record<string, AnimationDefinitions & { usage?: number, native?: NativeRule }>
}

export default class MasterCSS {
static config: Config = defaultConfig
readonly rules: Rule[] = []
Expand Down Expand Up @@ -1198,7 +1187,19 @@ export default class MasterCSS {
}
}

export const masterCSSs: MasterCSS[] = [];
export const masterCSSs: MasterCSS[] = []

export default interface MasterCSS {
readonly style: HTMLStyleElement
styles: Record<string, string[]>
stylesBy: Record<string, string[]>
selectors: Record<string, [RegExp, string[]][]>
variables: Record<string, Variable>
mediaQueries: Record<string, string | number>
variablesNativeRules: Record<string, NativeRule>
hasKeyframesRule: boolean
animations: Record<string, AnimationDefinitions & { usage?: number, native?: NativeRule }>
}

(() => {
globalThis.MasterCSS = MasterCSS
Expand Down
8 changes: 4 additions & 4 deletions packages/css/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
},
"include": [
"src/**/*.ts",
"declarations.d.ts",
"./setup-jest.ts"
"**/*.ts"
],
"exclude": [
"node_modules/**/*"
]
}
6 changes: 6 additions & 0 deletions packages/css/tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "src"
}
}
8 changes: 8 additions & 0 deletions packages/css/types/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type Core from '../src/core'

declare global {
// eslint-disable-next-line no-var
var masterCSSs: Core[]
// eslint-disable-next-line no-var
var MasterCSS: typeof Core
}
Loading

0 comments on commit deda1f8

Please sign in to comment.