Skip to content

Commit

Permalink
Cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace committed Sep 6, 2024
1 parent c45ed2b commit cea86ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/tailwindcss/src/compat/plugin-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ function readFromCss(
// the `DEFAULT` key from the list of possible values. If there is no
// `DEFAULT` in the list, there is no match so return `null`.
if (path[path.length - 1] === 'DEFAULT') {
return [(obj?.DEFAULT ?? null) as any, optionsObj.DEFAULT ?? 0] as const
return [(obj?.DEFAULT ?? null) as any, optionsObj.DEFAULT ?? ThemeOptions.NONE] as const
}

// The request looked like `theme('animation.spin')` and was turned into a
// lookup for `--animation-spin-*` which had only one entry which means it
// should be returned directly.
if ('DEFAULT' in obj && Object.keys(obj).length === 1) {
return [obj.DEFAULT as any, optionsObj.DEFAULT ?? 0] as const
return [obj.DEFAULT as any, optionsObj.DEFAULT ?? ThemeOptions.NONE] as const
}

// Attach the CSS values to the object for later use. This object could be
Expand Down
4 changes: 2 additions & 2 deletions packages/tailwindcss/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ export class Theme {
}

hasDefault(key: string): boolean {
return ((this.values.get(key)?.options ?? 0) & ThemeOptions.DEFAULT) === ThemeOptions.DEFAULT
return (this.getOptions(key) & ThemeOptions.DEFAULT) === ThemeOptions.DEFAULT
}

getOptions(key: string) {
return this.values.get(key)?.options ?? 0
return this.values.get(key)?.options ?? ThemeOptions.NONE
}

entries() {
Expand Down

0 comments on commit cea86ed

Please sign in to comment.