From cea86ed8099a6f1e45d4bdca58fb0382340ded94 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 6 Sep 2024 15:08:13 -0400 Subject: [PATCH] Cleanup code --- packages/tailwindcss/src/compat/plugin-functions.ts | 4 ++-- packages/tailwindcss/src/theme.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/tailwindcss/src/compat/plugin-functions.ts b/packages/tailwindcss/src/compat/plugin-functions.ts index ec4765f7a32c..416da6eb3404 100644 --- a/packages/tailwindcss/src/compat/plugin-functions.ts +++ b/packages/tailwindcss/src/compat/plugin-functions.ts @@ -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 diff --git a/packages/tailwindcss/src/theme.ts b/packages/tailwindcss/src/theme.ts index 775c06836300..b545462efb76 100644 --- a/packages/tailwindcss/src/theme.ts +++ b/packages/tailwindcss/src/theme.ts @@ -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() {