UNPKG

@pandabox/panda-plugins

Version:

- `missing-css-warnings` - Logs a warning message when a CSS rule was used at runtime but couldn't be statically extracted - `strict-tokens-scope` - Enforce `strictTokens` only for a set of `TokenCategory` or style props - `strict-tokens-runtime` - Enfo

130 lines (120 loc) 6.29 kB
import * as _pandacss_types from '@pandacss/types'; import { PandaPlugin, CodegenPrepareHookArgs, TokenCategory, CssProperties, UserConfig, LoggerInterface } from '@pandacss/types'; import { PandaContext } from '@pandacss/node'; type Feature = 'no-jsx' | 'no-styled' | 'no-recipes' | 'no-patterns' | 'only-css-dir' | 'no-cva' | 'no-sva'; interface RemoveFeaturesOptions { features: Feature[]; } /** * Removes features from the `styled-system` generated folder. * - `no-jsx`: Removes every file in `/jsx * - `no-styled`: Removes `factory.m?(j|d.t)s` from `/jsx` * - `no-recipes`: Removes every file in `/recipes` * - `no-patterns`: Removes every file in `/patterns` * - `only-css-dir`: Removes jsx/recipes/patterns files * - `no-cva`: Removes `cva.m?(j|d.t)s` from `/css` * - `no-sva`: Removes `sva.m?(j|d.t)s` from `/css` */ declare const pluginRemoveFeatures: (options: RemoveFeaturesOptions) => PandaPlugin; declare const transformFeatures: (args: CodegenPrepareHookArgs, options: RemoveFeaturesOptions) => _pandacss_types.Artifact[]; /** * Enables a minimal setup for Panda CSS. * @see https://panda-css.com/docs/guides/minimal-setup * * - Removes the `@pandacss/preset-base` preset with `eject: true` * @see https://panda-css.com/docs/references/config#eject * * - Removes the built-in `@pandacss/preset-panda` by setting `presets: []` if not defined * @see https://panda-css.com/docs/customization/presets#which-panda-presets-will-be-included- * * - Allows removing features from the `styled-system` generated folder * */ declare const pluginMinimalSetup: (options: RemoveFeaturesOptions) => PandaPlugin; interface MissingCssWarnings { enabled?: boolean; } /** * Logs a warning message when a CSS rule was used at runtime but couldn't be statically extracted * * @see https://github.com/chakra-ui/panda/pull/1194 */ declare const pluginMissingCssWarnings: (options?: MissingCssWarnings) => PandaPlugin; declare const transformMissingCssWarnings: (args: CodegenPrepareHookArgs, options?: MissingCssWarnings) => _pandacss_types.Artifact[]; interface NegativeTransformOptions { spacingTokenType?: boolean; tokenType?: boolean; } /** * Removes negative spacing tokens * - `spacingTokenType`: Removes negative spacing tokens from `tokens.d.ts` * - `tokenType`: Removes negative tokens from `tokens.d.ts` * * @default options: { spacingTokenType: true, tokenType: true }` */ declare const pluginRemoveNegativeSpacing: (options?: NegativeTransformOptions) => PandaPlugin; declare const transformNegativeSpacing: (args: CodegenPrepareHookArgs, options: NegativeTransformOptions) => _pandacss_types.Artifact[]; interface RemoveUnusedCssOptions { /** * Remove unused CSS variables * @default true * * NOTE: using this means you can't use the JS function `token.var(xxx)` / `token(xxx)` from `styled-system/tokens` * where `xxx` is the path to a semanticToken * * since the CSS variables will be removed based on the usage found in the generated CSS only * without looking at your style usage in your source files */ removeCssVars?: boolean; /** * Remove unused keyframes * @default true */ removeKeyframes?: boolean; } /** * Removes unused CSS vars and/or @keyframes * * @see https://panda-css.com/docs/concepts/hooks#remove-unused-variables-from-final-css * * NOTE: using this means you can't use the JS function `token.var(xxx)` / `token(xxx)` from `styled-system/tokens` * where `xxx` is the path to a semanticToken * * since the CSS variables will be removed based on the usage found in the generated CSS only * without looking at your style usage in your source files */ declare const pluginRemoveUnusedCss: (options?: RemoveUnusedCssOptions) => PandaPlugin; /** * Adds a `props` on the `styled` JSX Factory to restrict the props that can be passed to the component */ declare const pluginRestrictStyledProps: () => PandaPlugin; declare const transformRestrictStyledProps: (args: CodegenPrepareHookArgs) => _pandacss_types.Artifact[]; interface StrictTokensRuntimeOptions { categories?: TokenCategory[]; props?: Array<keyof CssProperties | (string & {})>; } /** * Enforce `strictTokens` at runtime, optionnally scope it to a set of `TokenCategory` or style props * - `categories`: Every properties bound to those token categories will be restricted (at runtime) with `strictTokens` * - `props`: Explicit list of props that will be restricted (at runtime) with `strictTokens` * * @see https://panda-css.com/docs/concepts/writing-styles#type-safety */ declare const pluginStrictTokensRuntime: (options: StrictTokensRuntimeOptions) => PandaPlugin; interface StrictTokensRuntimeConfig extends Pick<UserConfig, 'shorthands' | 'strictTokens'> { } declare const transformStrictTokensRuntime: (args: CodegenPrepareHookArgs, options: StrictTokensRuntimeOptions, config?: StrictTokensRuntimeConfig) => _pandacss_types.Artifact[]; interface StrictTokensScopeOptions { categories?: TokenCategory[]; props?: Array<keyof CssProperties | (string & {})>; } /** * Enforce `strictTokens` only for a set of `TokenCategory` or style props * - `categories`: Every properties bound to those token categories will be restricted with `strictTokens` * - `props`: Explicit list of props that will be restricted with `strictTokens` * * @see https://panda-css.com/docs/concepts/writing-styles#type-safety */ declare const pluginStrictTokensScope: (options: StrictTokensScopeOptions) => PandaPlugin; declare const transformPropTypes: (args: CodegenPrepareHookArgs, options: StrictTokensScopeOptions, ctx: PandaContext, logger?: LoggerInterface) => _pandacss_types.Artifact[]; export { type MissingCssWarnings, type NegativeTransformOptions, type RemoveFeaturesOptions, type RemoveUnusedCssOptions, type StrictTokensRuntimeConfig, type StrictTokensRuntimeOptions, type StrictTokensScopeOptions, pluginMinimalSetup, pluginMissingCssWarnings, pluginRemoveFeatures, pluginRemoveNegativeSpacing, pluginRemoveUnusedCss, pluginRestrictStyledProps, pluginStrictTokensRuntime, pluginStrictTokensScope, transformFeatures, transformMissingCssWarnings, transformNegativeSpacing, transformPropTypes, transformRestrictStyledProps, transformStrictTokensRuntime };