@tenphi/tasty 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/pipeline/materialize.js +59 -47
- package/dist/pipeline/materialize.js.map +1 -1
- package/dist/pipeline/parseStateKey.js +18 -5
- package/dist/pipeline/parseStateKey.js.map +1 -1
- package/dist/utils/selector-transform.js +32 -0
- package/dist/utils/selector-transform.js.map +1 -0
- package/dist/utils/styles.d.ts +1 -2
- package/dist/utils/styles.js +1 -22
- package/dist/utils/styles.js.map +1 -1
- package/docs/usage.md +53 -1
- package/package.json +1 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CSSProperties } from "../utils/css-types.js";
|
|
|
3
3
|
import { Bucket, ParserOptions, ProcessedStyle, StyleDetails, StyleDetailsPart, UnitHandler } from "../parser/types.js";
|
|
4
4
|
import { StyleParser } from "../parser/parser.js";
|
|
5
5
|
import { AtRuleContext, ParsedAdvancedState, StateParserContext, createStateParserContext, getGlobalPredefinedStates, setGlobalPredefinedStates } from "../states/index.js";
|
|
6
|
-
import { COMPUTE_FUNC_MAP, CSSMap, CUSTOM_UNITS, ComputeModel, DIRECTIONS, ParsedColor, RawStyleHandler, STATE_OPERATORS, STATE_OPERATOR_LIST, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleMap, StylePropValue, StyleStateData, StyleStateDataList, StyleStateDataListMap, StyleStateMap, StyleValue, StyleValueStateMap, buildAtRuleContext, computeState, customFunc, extendStyles, extractStyles, filterMods, getGlobalFuncs, getGlobalParser, getGlobalPredefinedTokens,
|
|
6
|
+
import { COMPUTE_FUNC_MAP, CSSMap, CUSTOM_UNITS, ComputeModel, DIRECTIONS, ParsedColor, RawStyleHandler, STATE_OPERATORS, STATE_OPERATOR_LIST, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleMap, StylePropValue, StyleStateData, StyleStateDataList, StyleStateDataListMap, StyleStateMap, StyleValue, StyleValueStateMap, buildAtRuleContext, computeState, customFunc, extendStyles, extractStyles, filterMods, getGlobalFuncs, getGlobalParser, getGlobalPredefinedTokens, getRgbValuesFromRgbaString, hexToRgb, isAdvancedStateToken, normalizeColorTokenValue, parseColor, parseStateNotation, parseStyle, resetGlobalPredefinedTokens, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleStateMapToStyleStateDataList } from "../utils/styles.js";
|
|
7
7
|
import { NoType, NotSelector, RecipeStyles, Selector, Styles, StylesInterface, StylesWithoutSelectors, SuffixForSelector, TastyNamedColors, TastyPresetNames } from "../styles/types.js";
|
|
8
8
|
import { ConditionNode } from "../pipeline/conditions.js";
|
|
9
9
|
import { ParseStateKeyOptions, parseStateKey } from "../pipeline/parseStateKey.js";
|
|
@@ -30,4 +30,4 @@ import { hslToRgbValues, processTokens, stringifyTokens } from "../utils/process
|
|
|
30
30
|
import { TypographyPreset } from "../tokens/typography.js";
|
|
31
31
|
import { generateTypographyTokens } from "../utils/typography.js";
|
|
32
32
|
import { tastyDebug } from "../debug.js";
|
|
33
|
-
export { type AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, type BaseStyleProps, type BlockInnerStyleProps, type BlockOuterStyleProps, type BlockStyleProps, Bucket, CHUNK_NAMES, COLOR_STYLES, COMPUTE_FUNC_MAP, CONTAINER_STYLES, CSSMap, type CSSProperties, CUSTOM_UNITS, CacheMetrics, type ChunkInfo, type ChunkName, type ColorStyleProps, ComputeModel, type ConditionNode, type ContainerStyleProps, DIMENSION_STYLES, DIRECTIONS, type DimensionStyleProps, DisposeFunction, FLOW_STYLES, type FlowStyleProps, type GlobalStyledProps, INNER_STYLES, InjectResult, type InnerStyleProps, KeyframesCacheEntry, KeyframesInfo, KeyframesResult, KeyframesSteps, type ModValue, type Mods, type NoType, type NotSelector, OUTER_STYLES, type OuterStyleProps, POSITION_STYLES, type ParseStateKeyOptions, type ParsedAdvancedState, ParsedColor, type ParserOptions, type PositionStyleProps, type ProcessedStyle, PropertyDefinition, PropertyOptions, type Props, RawCSSResult, RawStyleHandler, type RecipeStyles, type RenderResult, RootRegistry, RuleInfo, STATE_OPERATORS, STATE_OPERATOR_LIST, STYLE_TO_CHUNK, type Selector, SheetInfo, SheetManager, type ShortGridStyles, type StateParserContext, type StyleDetails, type StyleDetailsPart, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleInjector, StyleInjectorConfig, StyleMap, StyleParser, StylePropValue, type StyleResult, StyleRule, StyleStateData, StyleStateDataList, StyleStateDataListMap, StyleStateMap, StyleValue, StyleValueStateMap, type Styles, type StylesInterface, type StylesWithoutSelectors, type SuffixForSelector, TEXT_STYLES, type TagName, type TastyConfig, type TastyExtensionConfig, type TastyNamedColors, type TastyPlugin, type TastyPluginFactory, type TastyPresetNames, type TastyThemeNames, type TextStyleProps, type TokenValue, type Tokens, TypographyPreset, type UnitHandler, allocateClassName, buildAtRuleContext, categorizeStyleKeys, cleanup, color, computeState, configure, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, extendStyles, extractStyles, filterBaseProps, filterMods, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment,
|
|
33
|
+
export { type AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, type BaseStyleProps, type BlockInnerStyleProps, type BlockOuterStyleProps, type BlockStyleProps, Bucket, CHUNK_NAMES, COLOR_STYLES, COMPUTE_FUNC_MAP, CONTAINER_STYLES, CSSMap, type CSSProperties, CUSTOM_UNITS, CacheMetrics, type ChunkInfo, type ChunkName, type ColorStyleProps, ComputeModel, type ConditionNode, type ContainerStyleProps, DIMENSION_STYLES, DIRECTIONS, type DimensionStyleProps, DisposeFunction, FLOW_STYLES, type FlowStyleProps, type GlobalStyledProps, INNER_STYLES, InjectResult, type InnerStyleProps, KeyframesCacheEntry, KeyframesInfo, KeyframesResult, KeyframesSteps, type ModValue, type Mods, type NoType, type NotSelector, OUTER_STYLES, type OuterStyleProps, POSITION_STYLES, type ParseStateKeyOptions, type ParsedAdvancedState, ParsedColor, type ParserOptions, type PositionStyleProps, type ProcessedStyle, PropertyDefinition, PropertyOptions, type Props, RawCSSResult, RawStyleHandler, type RecipeStyles, type RenderResult, RootRegistry, RuleInfo, STATE_OPERATORS, STATE_OPERATOR_LIST, STYLE_TO_CHUNK, type Selector, SheetInfo, SheetManager, type ShortGridStyles, type StateParserContext, type StyleDetails, type StyleDetailsPart, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleInjector, StyleInjectorConfig, StyleMap, StyleParser, StylePropValue, type StyleResult, StyleRule, StyleStateData, StyleStateDataList, StyleStateDataListMap, StyleStateMap, StyleValue, StyleValueStateMap, type Styles, type StylesInterface, type StylesWithoutSelectors, type SuffixForSelector, TEXT_STYLES, type TagName, type TastyConfig, type TastyExtensionConfig, type TastyNamedColors, type TastyPlugin, type TastyPluginFactory, type TastyPresetNames, type TastyThemeNames, type TextStyleProps, type TokenValue, type Tokens, TypographyPreset, type UnitHandler, allocateClassName, buildAtRuleContext, categorizeStyleKeys, cleanup, color, computeState, configure, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, extendStyles, extractStyles, filterBaseProps, filterMods, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isAdvancedStateToken, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunc, okhslPlugin, parseColor, parseStateKey, parseStateNotation, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, stringifyTokens, styleHandlers, styleStateMapToStyleStateDataList, tastyDebug, warn };
|
package/dist/core/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { StyleParser } from "../parser/parser.js";
|
|
|
3
3
|
import { okhslFunc, okhslPlugin } from "../plugins/okhsl-plugin.js";
|
|
4
4
|
import { createStateParserContext, getGlobalPredefinedStates, setGlobalPredefinedStates } from "../states/index.js";
|
|
5
5
|
import { hslToRgbValues, processTokens, stringifyTokens } from "../utils/process-tokens.js";
|
|
6
|
-
import { COMPUTE_FUNC_MAP, CUSTOM_UNITS, DIRECTIONS, STATE_OPERATORS, STATE_OPERATOR_LIST, buildAtRuleContext, computeState, customFunc, extendStyles, extractStyles, filterMods, getGlobalFuncs, getGlobalParser, getGlobalPredefinedTokens,
|
|
6
|
+
import { COMPUTE_FUNC_MAP, CUSTOM_UNITS, DIRECTIONS, STATE_OPERATORS, STATE_OPERATOR_LIST, buildAtRuleContext, computeState, customFunc, extendStyles, extractStyles, filterMods, getGlobalFuncs, getGlobalParser, getGlobalPredefinedTokens, getRgbValuesFromRgbaString, hexToRgb, isAdvancedStateToken, normalizeColorTokenValue, parseColor, parseStateNotation, parseStyle, resetGlobalPredefinedTokens, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleStateMapToStyleStateDataList } from "../utils/styles.js";
|
|
7
7
|
import { styleHandlers } from "../styles/predefined.js";
|
|
8
8
|
import { SheetManager } from "../injector/sheet-manager.js";
|
|
9
9
|
import { StyleInjector } from "../injector/injector.js";
|
|
@@ -23,4 +23,4 @@ import { deprecationWarning, warn } from "../utils/warnings.js";
|
|
|
23
23
|
import { generateTypographyTokens } from "../utils/typography.js";
|
|
24
24
|
import { tastyDebug } from "../debug.js";
|
|
25
25
|
|
|
26
|
-
export { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, Bucket, CHUNK_NAMES, COLOR_STYLES, COMPUTE_FUNC_MAP, CONTAINER_STYLES, CUSTOM_UNITS, DIMENSION_STYLES, DIRECTIONS, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, STATE_OPERATORS, STATE_OPERATOR_LIST, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, allocateClassName, buildAtRuleContext, categorizeStyleKeys, cleanup, color, computeState, configure, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, extendStyles, extractStyles, filterBaseProps, filterMods, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment,
|
|
26
|
+
export { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, Bucket, CHUNK_NAMES, COLOR_STYLES, COMPUTE_FUNC_MAP, CONTAINER_STYLES, CUSTOM_UNITS, DIMENSION_STYLES, DIRECTIONS, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, STATE_OPERATORS, STATE_OPERATOR_LIST, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, allocateClassName, buildAtRuleContext, categorizeStyleKeys, cleanup, color, computeState, configure, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, extendStyles, extractStyles, filterBaseProps, filterMods, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isAdvancedStateToken, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunc, okhslPlugin, parseColor, parseStateKey, parseStateNotation, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, stringifyTokens, styleHandlers, styleStateMapToStyleStateDataList, tastyDebug, warn };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CSSProperties } from "./utils/css-types.js";
|
|
|
3
3
|
import { Bucket, ParserOptions, ProcessedStyle, StyleDetails, StyleDetailsPart, UnitHandler } from "./parser/types.js";
|
|
4
4
|
import { StyleParser } from "./parser/parser.js";
|
|
5
5
|
import { AtRuleContext, ParsedAdvancedState, StateParserContext, createStateParserContext, getGlobalPredefinedStates, setGlobalPredefinedStates } from "./states/index.js";
|
|
6
|
-
import { COMPUTE_FUNC_MAP, CSSMap, CUSTOM_UNITS, ComputeModel, DIRECTIONS, ParsedColor, RawStyleHandler, STATE_OPERATORS, STATE_OPERATOR_LIST, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleMap, StylePropValue, StyleStateData, StyleStateDataList, StyleStateDataListMap, StyleStateMap, StyleValue, StyleValueStateMap, buildAtRuleContext, computeState, customFunc, extendStyles, extractStyles, filterMods, getGlobalFuncs, getGlobalParser, getGlobalPredefinedTokens,
|
|
6
|
+
import { COMPUTE_FUNC_MAP, CSSMap, CUSTOM_UNITS, ComputeModel, DIRECTIONS, ParsedColor, RawStyleHandler, STATE_OPERATORS, STATE_OPERATOR_LIST, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleMap, StylePropValue, StyleStateData, StyleStateDataList, StyleStateDataListMap, StyleStateMap, StyleValue, StyleValueStateMap, buildAtRuleContext, computeState, customFunc, extendStyles, extractStyles, filterMods, getGlobalFuncs, getGlobalParser, getGlobalPredefinedTokens, getRgbValuesFromRgbaString, hexToRgb, isAdvancedStateToken, normalizeColorTokenValue, parseColor, parseStateNotation, parseStyle, resetGlobalPredefinedTokens, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleStateMapToStyleStateDataList } from "./utils/styles.js";
|
|
7
7
|
import { NoType, NotSelector, RecipeStyles, Selector, Styles, StylesInterface, StylesWithoutSelectors, SuffixForSelector, TastyNamedColors, TastyPresetNames } from "./styles/types.js";
|
|
8
8
|
import { ConditionNode } from "./pipeline/conditions.js";
|
|
9
9
|
import { ParseStateKeyOptions, parseStateKey } from "./pipeline/parseStateKey.js";
|
|
@@ -44,5 +44,5 @@ declare module './utils/css-types' {
|
|
|
44
44
|
interface CSSProperties extends CSSProperties$1 {}
|
|
45
45
|
}
|
|
46
46
|
//#endregion
|
|
47
|
-
export { type AllBaseProps, type AllBasePropsWithMods, AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, type BaseProps, type BasePropsWithoutChildren, BaseStyleProps, BlockInnerStyleProps, BlockOuterStyleProps, BlockStyleProps, Bucket, CHUNK_NAMES, COLOR_STYLES, COMPUTE_FUNC_MAP, CONTAINER_STYLES, CSSMap, CSSProperties, CUSTOM_UNITS, CacheMetrics, ChunkInfo, ChunkName, ColorStyleProps, ComputeModel, ConditionNode, ContainerStyleProps, DIMENSION_STYLES, DIRECTIONS, DimensionStyleProps, DisposeFunction, Element, type ElementsDefinition, FLOW_STYLES, FlowStyleProps, GlobalStyledProps, INNER_STYLES, InjectResult, InnerStyleProps, KeyframesCacheEntry, KeyframesInfo, KeyframesResult, KeyframesSteps, ModValue, Mods, NoType, NotSelector, OUTER_STYLES, OuterStyleProps, POSITION_STYLES, ParseStateKeyOptions, ParsedAdvancedState, ParsedColor, ParserOptions, PositionStyleProps, ProcessedStyle, PropertyDefinition, PropertyOptions, Props, RawCSSResult, RawStyleHandler, RecipeStyles, RenderResult, RootRegistry, RuleInfo, STATE_OPERATORS, STATE_OPERATOR_LIST, STYLE_TO_CHUNK, Selector, SheetInfo, SheetManager, ShortGridStyles, StateParserContext, StyleDetails, StyleDetailsPart, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleInjector, StyleInjectorConfig, StyleMap, StyleParser, StylePropValue, StyleResult, StyleRule, StyleStateData, StyleStateDataList, StyleStateDataListMap, StyleStateMap, StyleValue, StyleValueStateMap, Styles, StylesInterface, StylesWithoutSelectors, type SubElementDefinition, type SubElementProps, SuffixForSelector, TEXT_STYLES, TagName, TastyConfig, type TastyElementOptions, type TastyElementProps, TastyExtensionConfig, TastyNamedColors, TastyPlugin, TastyPluginFactory, TastyPresetNames, type TastyProps, TastyThemeNames, TextStyleProps, TokenValue, Tokens, TypographyPreset, UnitHandler, type UsePropertyOptions, type UseStylesOptions, type UseStylesResult, type VariantMap, type WithVariant, allocateClassName, buildAtRuleContext, categorizeStyleKeys, cleanup, color, computeState, configure, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, extendStyles, extractStyles, filterBaseProps, filterMods, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getDisplayName, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment,
|
|
47
|
+
export { type AllBaseProps, type AllBasePropsWithMods, AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, type BaseProps, type BasePropsWithoutChildren, BaseStyleProps, BlockInnerStyleProps, BlockOuterStyleProps, BlockStyleProps, Bucket, CHUNK_NAMES, COLOR_STYLES, COMPUTE_FUNC_MAP, CONTAINER_STYLES, CSSMap, CSSProperties, CUSTOM_UNITS, CacheMetrics, ChunkInfo, ChunkName, ColorStyleProps, ComputeModel, ConditionNode, ContainerStyleProps, DIMENSION_STYLES, DIRECTIONS, DimensionStyleProps, DisposeFunction, Element, type ElementsDefinition, FLOW_STYLES, FlowStyleProps, GlobalStyledProps, INNER_STYLES, InjectResult, InnerStyleProps, KeyframesCacheEntry, KeyframesInfo, KeyframesResult, KeyframesSteps, ModValue, Mods, NoType, NotSelector, OUTER_STYLES, OuterStyleProps, POSITION_STYLES, ParseStateKeyOptions, ParsedAdvancedState, ParsedColor, ParserOptions, PositionStyleProps, ProcessedStyle, PropertyDefinition, PropertyOptions, Props, RawCSSResult, RawStyleHandler, RecipeStyles, RenderResult, RootRegistry, RuleInfo, STATE_OPERATORS, STATE_OPERATOR_LIST, STYLE_TO_CHUNK, Selector, SheetInfo, SheetManager, ShortGridStyles, StateParserContext, StyleDetails, StyleDetailsPart, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleInjector, StyleInjectorConfig, StyleMap, StyleParser, StylePropValue, StyleResult, StyleRule, StyleStateData, StyleStateDataList, StyleStateDataListMap, StyleStateMap, StyleValue, StyleValueStateMap, Styles, StylesInterface, StylesWithoutSelectors, type SubElementDefinition, type SubElementProps, SuffixForSelector, TEXT_STYLES, TagName, TastyConfig, type TastyElementOptions, type TastyElementProps, TastyExtensionConfig, TastyNamedColors, TastyPlugin, TastyPluginFactory, TastyPresetNames, type TastyProps, TastyThemeNames, TextStyleProps, TokenValue, Tokens, TypographyPreset, UnitHandler, type UsePropertyOptions, type UseStylesOptions, type UseStylesResult, type VariantMap, type WithVariant, allocateClassName, buildAtRuleContext, categorizeStyleKeys, cleanup, color, computeState, configure, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, extendStyles, extractStyles, filterBaseProps, filterMods, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getDisplayName, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isAdvancedStateToken, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunc, okhslPlugin, parseColor, parseStateKey, parseStateNotation, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, stringifyTokens, styleHandlers, styleStateMapToStyleStateDataList, tasty, tastyDebug, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles, warn };
|
|
48
48
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { StyleParser } from "./parser/parser.js";
|
|
|
3
3
|
import { okhslFunc, okhslPlugin } from "./plugins/okhsl-plugin.js";
|
|
4
4
|
import { createStateParserContext, getGlobalPredefinedStates, setGlobalPredefinedStates } from "./states/index.js";
|
|
5
5
|
import { hslToRgbValues, processTokens, stringifyTokens } from "./utils/process-tokens.js";
|
|
6
|
-
import { COMPUTE_FUNC_MAP, CUSTOM_UNITS, DIRECTIONS, STATE_OPERATORS, STATE_OPERATOR_LIST, buildAtRuleContext, computeState, customFunc, extendStyles, extractStyles, filterMods, getGlobalFuncs, getGlobalParser, getGlobalPredefinedTokens,
|
|
6
|
+
import { COMPUTE_FUNC_MAP, CUSTOM_UNITS, DIRECTIONS, STATE_OPERATORS, STATE_OPERATOR_LIST, buildAtRuleContext, computeState, customFunc, extendStyles, extractStyles, filterMods, getGlobalFuncs, getGlobalParser, getGlobalPredefinedTokens, getRgbValuesFromRgbaString, hexToRgb, isAdvancedStateToken, normalizeColorTokenValue, parseColor, parseStateNotation, parseStyle, resetGlobalPredefinedTokens, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleStateMapToStyleStateDataList } from "./utils/styles.js";
|
|
7
7
|
import { styleHandlers } from "./styles/predefined.js";
|
|
8
8
|
import { SheetManager } from "./injector/sheet-manager.js";
|
|
9
9
|
import { StyleInjector } from "./injector/injector.js";
|
|
@@ -30,4 +30,4 @@ import { useRawCSS } from "./hooks/useRawCSS.js";
|
|
|
30
30
|
import { useKeyframes } from "./hooks/useKeyframes.js";
|
|
31
31
|
import { useProperty } from "./hooks/useProperty.js";
|
|
32
32
|
|
|
33
|
-
export { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, Bucket, CHUNK_NAMES, COLOR_STYLES, COMPUTE_FUNC_MAP, CONTAINER_STYLES, CUSTOM_UNITS, DIMENSION_STYLES, DIRECTIONS, Element, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, STATE_OPERATORS, STATE_OPERATOR_LIST, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, allocateClassName, buildAtRuleContext, categorizeStyleKeys, cleanup, color, computeState, configure, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, extendStyles, extractStyles, filterBaseProps, filterMods, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getDisplayName, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment,
|
|
33
|
+
export { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, Bucket, CHUNK_NAMES, COLOR_STYLES, COMPUTE_FUNC_MAP, CONTAINER_STYLES, CUSTOM_UNITS, DIMENSION_STYLES, DIRECTIONS, Element, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, STATE_OPERATORS, STATE_OPERATOR_LIST, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, allocateClassName, buildAtRuleContext, categorizeStyleKeys, cleanup, color, computeState, configure, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, extendStyles, extractStyles, filterBaseProps, filterMods, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getDisplayName, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isAdvancedStateToken, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunc, okhslPlugin, parseColor, parseStateKey, parseStateNotation, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, stringifyTokens, styleHandlers, styleStateMapToStyleStateDataList, tasty, tastyDebug, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles, warn };
|
|
@@ -141,14 +141,31 @@ function pseudoToParsed(state) {
|
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
|
-
* Convert parsed pseudo to CSS selector string (for final output)
|
|
144
|
+
* Convert parsed pseudo to CSS selector string (for final output).
|
|
145
|
+
*
|
|
146
|
+
* :not() is normalized to negated :is() at parse time, so pseudo.pseudo
|
|
147
|
+
* never starts with ':not(' here. When negated:
|
|
148
|
+
* - :is(X) → :not(X) (unwrap :is)
|
|
149
|
+
* - :where(X) → :not(X) (unwrap :where)
|
|
150
|
+
* - :has(X) → :not(:has(X))
|
|
151
|
+
* - other → :not(other)
|
|
152
|
+
*
|
|
153
|
+
* When not negated, single-argument :is()/:where() is unwrapped when the
|
|
154
|
+
* inner content is a simple compound selector that can safely append to
|
|
155
|
+
* the base selector (this happens after double-negation of :not()).
|
|
145
156
|
*/
|
|
146
157
|
function pseudoToCSS(pseudo) {
|
|
158
|
+
const p = pseudo.pseudo;
|
|
147
159
|
if (pseudo.negated) {
|
|
148
|
-
if (
|
|
149
|
-
return `:not(${
|
|
160
|
+
if (p.startsWith(":is(") || p.startsWith(":where(")) return `:not(${p.slice(p.indexOf("(") + 1, -1)})`;
|
|
161
|
+
return `:not(${p})`;
|
|
162
|
+
}
|
|
163
|
+
if ((p.startsWith(":is(") || p.startsWith(":where(")) && !p.includes(",")) {
|
|
164
|
+
const inner = p.slice(p.indexOf("(") + 1, -1);
|
|
165
|
+
const ch = inner[0];
|
|
166
|
+
if ((ch === ":" || ch === "." || ch === "[" || ch === "#") && !/\s/.test(inner)) return inner;
|
|
150
167
|
}
|
|
151
|
-
return
|
|
168
|
+
return p;
|
|
152
169
|
}
|
|
153
170
|
/**
|
|
154
171
|
* Convert media condition to parsed structure(s)
|
|
@@ -276,11 +293,12 @@ function innerConditionToVariants(innerCondition, negated, target) {
|
|
|
276
293
|
};
|
|
277
294
|
}
|
|
278
295
|
/**
|
|
279
|
-
* Convert a @parent() inner condition into
|
|
296
|
+
* Convert a @parent() inner condition into a single SelectorVariant with
|
|
297
|
+
* one ParentGroup whose branches represent the inner OR alternatives.
|
|
280
298
|
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
299
|
+
* Both positive and negated cases produce one variant with one group.
|
|
300
|
+
* Negation simply sets the `negated` flag, which swaps :is() for :not()
|
|
301
|
+
* in the final CSS output — no structural transformation is needed.
|
|
284
302
|
*/
|
|
285
303
|
function parentConditionToVariants(innerCondition, negated, direct) {
|
|
286
304
|
const innerCSS = conditionToCSS(innerCondition);
|
|
@@ -288,44 +306,23 @@ function parentConditionToVariants(innerCondition, negated, direct) {
|
|
|
288
306
|
variants: [],
|
|
289
307
|
isImpossible: true
|
|
290
308
|
};
|
|
291
|
-
|
|
292
|
-
const v = emptyVariant();
|
|
293
|
-
for (const innerVariant of innerCSS.variants) {
|
|
294
|
-
const conditions = collectSelectorConditions(innerVariant);
|
|
295
|
-
if (conditions.length > 0) v.parentGroups.push({
|
|
296
|
-
conditions,
|
|
297
|
-
direct,
|
|
298
|
-
negated: true
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
if (v.parentGroups.length === 0) return {
|
|
302
|
-
variants: [emptyVariant()],
|
|
303
|
-
isImpossible: false
|
|
304
|
-
};
|
|
305
|
-
return {
|
|
306
|
-
variants: [v],
|
|
307
|
-
isImpossible: false
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
const variants = [];
|
|
309
|
+
const branches = [];
|
|
311
310
|
for (const innerVariant of innerCSS.variants) {
|
|
312
311
|
const conditions = collectSelectorConditions(innerVariant);
|
|
313
|
-
if (conditions.length > 0)
|
|
314
|
-
const v = emptyVariant();
|
|
315
|
-
v.parentGroups.push({
|
|
316
|
-
conditions,
|
|
317
|
-
direct,
|
|
318
|
-
negated: false
|
|
319
|
-
});
|
|
320
|
-
variants.push(v);
|
|
321
|
-
}
|
|
312
|
+
if (conditions.length > 0) branches.push(conditions);
|
|
322
313
|
}
|
|
323
|
-
if (
|
|
314
|
+
if (branches.length === 0) return {
|
|
324
315
|
variants: [emptyVariant()],
|
|
325
316
|
isImpossible: false
|
|
326
317
|
};
|
|
318
|
+
const v = emptyVariant();
|
|
319
|
+
v.parentGroups.push({
|
|
320
|
+
branches,
|
|
321
|
+
direct,
|
|
322
|
+
negated
|
|
323
|
+
});
|
|
327
324
|
return {
|
|
328
|
-
variants,
|
|
325
|
+
variants: [v],
|
|
329
326
|
isImpossible: false
|
|
330
327
|
};
|
|
331
328
|
}
|
|
@@ -346,10 +343,13 @@ function parentGroupsToCSS(groups) {
|
|
|
346
343
|
let result = "";
|
|
347
344
|
for (const group of groups) {
|
|
348
345
|
const combinator = group.direct ? " > *" : " *";
|
|
349
|
-
|
|
350
|
-
|
|
346
|
+
const selectorArgs = group.branches.map((branch) => {
|
|
347
|
+
let parts = "";
|
|
348
|
+
for (const cond of branch) parts += selectorConditionToCSS(cond);
|
|
349
|
+
return parts + combinator;
|
|
350
|
+
});
|
|
351
351
|
const wrapper = group.negated ? ":not" : ":is";
|
|
352
|
-
result += `${wrapper}(${
|
|
352
|
+
result += `${wrapper}(${selectorArgs.join(", ")})`;
|
|
353
353
|
}
|
|
354
354
|
return result;
|
|
355
355
|
}
|
|
@@ -459,10 +459,18 @@ function hasSelectorConditionContradiction(conditions) {
|
|
|
459
459
|
* with opposite negation. E.g. :not([data-hovered] *) and :is([data-hovered] *)
|
|
460
460
|
* in the same variant is impossible.
|
|
461
461
|
*/
|
|
462
|
+
function getBranchesKey(branches) {
|
|
463
|
+
if (branches.length === 1) {
|
|
464
|
+
const b = branches[0];
|
|
465
|
+
if (b.length === 1) return getSelectorConditionKey(b[0]);
|
|
466
|
+
return b.map(getSelectorConditionKey).sort().join("+");
|
|
467
|
+
}
|
|
468
|
+
return branches.map((b) => b.map(getSelectorConditionKey).sort().join("+")).sort().join(",");
|
|
469
|
+
}
|
|
462
470
|
function hasParentGroupContradiction(groups) {
|
|
463
471
|
const byBaseKey = /* @__PURE__ */ new Map();
|
|
464
472
|
for (const g of groups) {
|
|
465
|
-
const baseKey = `${g.direct ? ">" : ""}(${g.
|
|
473
|
+
const baseKey = `${g.direct ? ">" : ""}(${getBranchesKey(g.branches)})`;
|
|
466
474
|
const existing = byBaseKey.get(baseKey);
|
|
467
475
|
if (existing !== void 0 && existing !== !g.negated) return true;
|
|
468
476
|
byBaseKey.set(baseKey, !g.negated);
|
|
@@ -649,6 +657,12 @@ function getVariantKey(v) {
|
|
|
649
657
|
return key;
|
|
650
658
|
}
|
|
651
659
|
/**
|
|
660
|
+
* Total number of leaf conditions in a variant (for superset / dedup comparisons).
|
|
661
|
+
*/
|
|
662
|
+
function variantConditionCount(v) {
|
|
663
|
+
return v.modifierConditions.length + v.pseudoConditions.length + v.ownConditions.length + v.mediaConditions.length + v.containerConditions.length + v.supportsConditions.length + v.rootConditions.length + v.parentGroups.reduce((sum, g) => sum + g.branches.reduce((s, b) => s + b.length, 0), 0);
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
652
666
|
* Check if variant A is a superset of variant B (A is more restrictive)
|
|
653
667
|
*
|
|
654
668
|
* If A has all of B's conditions plus more, then A is redundant
|
|
@@ -669,8 +683,7 @@ function isVariantSuperset(a, b) {
|
|
|
669
683
|
if (!isPseudoConditionsSuperset(a.pseudoConditions, b.pseudoConditions)) return false;
|
|
670
684
|
if (!isSelectorConditionsSuperset(a.ownConditions, b.ownConditions)) return false;
|
|
671
685
|
if (!isParentGroupsSuperset(a.parentGroups, b.parentGroups)) return false;
|
|
672
|
-
|
|
673
|
-
return a.mediaConditions.length + a.containerConditions.length + a.supportsConditions.length + a.modifierConditions.length + a.pseudoConditions.length + a.rootConditions.length + parentConditionCount(a.parentGroups) + a.ownConditions.length > b.mediaConditions.length + b.containerConditions.length + b.supportsConditions.length + b.modifierConditions.length + b.pseudoConditions.length + b.rootConditions.length + parentConditionCount(b.parentGroups) + b.ownConditions.length;
|
|
686
|
+
return variantConditionCount(a) > variantConditionCount(b);
|
|
674
687
|
}
|
|
675
688
|
/**
|
|
676
689
|
* Generic superset check: true if every item in B has a matching key in A.
|
|
@@ -706,7 +719,7 @@ function isParentGroupsSuperset(a, b) {
|
|
|
706
719
|
return isConditionsSuperset(a, b, getParentGroupKey);
|
|
707
720
|
}
|
|
708
721
|
function getParentGroupKey(g) {
|
|
709
|
-
return `${g.negated ? "!" : ""}${g.direct ? ">" : ""}(${g.
|
|
722
|
+
return `${g.negated ? "!" : ""}${g.direct ? ">" : ""}(${getBranchesKey(g.branches)})`;
|
|
710
723
|
}
|
|
711
724
|
/**
|
|
712
725
|
* Deduplicate variants
|
|
@@ -725,7 +738,6 @@ function dedupeVariants(variants) {
|
|
|
725
738
|
result.push(v);
|
|
726
739
|
}
|
|
727
740
|
}
|
|
728
|
-
const variantConditionCount = (v) => v.modifierConditions.length + v.pseudoConditions.length + v.ownConditions.length + v.mediaConditions.length + v.containerConditions.length + v.supportsConditions.length + v.rootConditions.length + v.parentGroups.reduce((sum, g) => sum + g.conditions.length, 0);
|
|
729
741
|
result.sort((a, b) => variantConditionCount(a) - variantConditionCount(b));
|
|
730
742
|
const filtered = [];
|
|
731
743
|
for (const candidate of result) {
|