@tenphi/tasty 0.0.0-snapshot.12940ba → 0.0.0-snapshot.1a41a6b

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.
Files changed (58) hide show
  1. package/README.md +35 -15
  2. package/dist/config.js +2 -2
  3. package/dist/core/index.d.ts +33 -0
  4. package/dist/core/index.js +26 -0
  5. package/dist/hooks/useStyles.js +1 -1
  6. package/dist/index.d.ts +24 -14
  7. package/dist/index.js +14 -11
  8. package/dist/injector/injector.js +1 -1
  9. package/dist/parser/parser.js +1 -1
  10. package/dist/pipeline/conditions.d.ts +134 -0
  11. package/dist/pipeline/conditions.js +14 -12
  12. package/dist/pipeline/conditions.js.map +1 -1
  13. package/dist/pipeline/index.d.ts +2 -2
  14. package/dist/pipeline/index.js +5 -6
  15. package/dist/pipeline/index.js.map +1 -1
  16. package/dist/pipeline/materialize.js +223 -209
  17. package/dist/pipeline/materialize.js.map +1 -1
  18. package/dist/pipeline/parseStateKey.d.ts +15 -1
  19. package/dist/pipeline/parseStateKey.js +10 -19
  20. package/dist/pipeline/parseStateKey.js.map +1 -1
  21. package/dist/pipeline/simplify.js.map +1 -1
  22. package/dist/states/index.d.ts +6 -2
  23. package/dist/styles/index.d.ts +2 -2
  24. package/dist/styles/inset.d.ts +3 -1
  25. package/dist/styles/inset.js +48 -40
  26. package/dist/styles/inset.js.map +1 -1
  27. package/dist/styles/margin.d.ts +1 -5
  28. package/dist/styles/margin.js +48 -40
  29. package/dist/styles/margin.js.map +1 -1
  30. package/dist/styles/padding.d.ts +1 -5
  31. package/dist/styles/padding.js +48 -40
  32. package/dist/styles/padding.js.map +1 -1
  33. package/dist/styles/predefined.d.ts +0 -1
  34. package/dist/styles/transition.js +26 -6
  35. package/dist/styles/transition.js.map +1 -1
  36. package/dist/styles/types.d.ts +1 -1
  37. package/dist/tasty.d.ts +9 -10
  38. package/dist/tasty.js +3 -3
  39. package/dist/tasty.js.map +1 -1
  40. package/dist/types.d.ts +6 -4
  41. package/dist/utils/css-types.d.ts +7 -0
  42. package/dist/utils/is-valid-element-type.js +15 -0
  43. package/dist/utils/is-valid-element-type.js.map +1 -0
  44. package/dist/utils/process-tokens.d.ts +1 -1
  45. package/dist/utils/process-tokens.js.map +1 -1
  46. package/dist/utils/resolve-recipes.js +1 -1
  47. package/dist/utils/styles.js +1 -1
  48. package/dist/zero/extractor.d.ts +0 -1
  49. package/package.json +22 -12
  50. package/tasty.config.ts +14 -0
  51. package/dist/chunks/cacheKey.d.ts +0 -1
  52. package/dist/chunks/index.d.ts +0 -3
  53. package/dist/chunks/renderChunk.d.ts +0 -2
  54. package/dist/hooks/index.d.ts +0 -5
  55. package/dist/parser/index.d.ts +0 -3
  56. package/dist/parser/index.js +0 -4
  57. package/dist/pipeline/exclusive.d.ts +0 -1
  58. package/dist/plugins/index.d.ts +0 -2
package/README.md CHANGED
@@ -24,9 +24,10 @@ On top of that foundation, Tasty gives you a concise, CSS-like DSL with design t
24
24
  ## Why Tasty
25
25
 
26
26
  - **Deterministic at any scale** — Exclusive selector generation eliminates the entire class of cascade/specificity bugs. Every state combination resolves to exactly one CSS rule per property. Refactor freely.
27
+ - **AI-friendly by design** — Style definitions are declarative, self-contained, and structurally consistent. AI tools can read, understand, and refactor even advanced state bindings as confidently as a human — because there's no hidden cascade logic or implicit ordering to second-guess.
27
28
  - **DSL that feels like CSS** — Property names you already know (`padding`, `color`, `display`) with syntax sugar that removes boilerplate. Learn the DSL in minutes, not days.
28
29
  - **Design-system native** — Color tokens (`#primary`), spacing units (`2x`), typography presets (`h1`, `t2`), border radius (`1r`), and recipes are first-class primitives, not afterthoughts.
29
- - **Full modern CSS coverage** — Media queries, container queries, `@supports`, `:has()`, `@starting-style`, `@property`, keyframes, boolean state logic with `&`, `|`, `!` operators. If CSS can do it, Tasty can express it concisely.
30
+ - **Near-complete modern CSS coverage** — Media queries, container queries, `@supports`, `:has()`, `@starting-style`, `@property`, `@keyframes`, etc. Some features that don't fit Tasty's component model (such as `@layer` and `!important`) are intentionally omitted, but real-world use cases are covered almost completely.
30
31
  - **Runtime or zero-runtime — your call** — Use `tasty()` for dynamic React components with runtime injection, or `tastyStatic()` with the Babel plugin for zero-runtime CSS extraction. Same DSL, same tokens, same output.
31
32
  - **Only generate what is used** — In runtime mode, Tasty injects CSS on demand for mounted components/variants, so your app avoids shipping style rules for UI states that are never rendered.
32
33
  - **Runtime performance that holds at scale** — The runtime path is tested against enterprise-scale applications and tuned with multi-level caching, chunk-level style reuse, style garbage collection, and a dedicated injector.
@@ -119,7 +120,7 @@ configure({
119
120
  states: {
120
121
  '@mobile': '@media(w < 768px)',
121
122
  '@tablet': '@media(w < 1024px)',
122
- '@dark': '@root(schema=dark) | @media(prefers-color-scheme: dark)',
123
+ '@dark': '@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))',
123
124
  },
124
125
  recipes: {
125
126
  card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
@@ -133,9 +134,13 @@ Predefined states turn complex selector logic into single tokens. Use `@mobile`
133
134
 
134
135
  This is the core idea that makes everything else possible.
135
136
 
136
- Traditional CSS uses the cascade to resolve conflicts: when multiple selectors match, the one with the highest specificity wins, or — if specificity is equal — the last one in source order wins. This makes styles inherently fragile. Reordering imports, adding a new media query, or composing components from different libraries can silently break styling.
137
+ Traditional CSS has two structural problems.
137
138
 
138
- Tasty takes a fundamentally different approach: **every state mapping compiles into selectors that are guaranteed to never overlap.**
139
+ First, the **cascade** resolves conflicts by specificity and source order: when multiple selectors match, the one with the highest specificity wins, or — if specificity is equal — the last one in source order wins. That makes styles inherently fragile. Reordering imports, adding a media query, or composing components from different libraries can silently break styling.
140
+
141
+ Second, **authoring selectors that capture real-world state logic is fundamentally hard.** A single state like "dark mode" may depend on a root attribute, an OS preference, or both — each branch needing its own selector, proper negation of competing branches, and correct `@media` nesting. The example below shows the CSS you'd write by hand for just *one* property with *one* state. Scale that across dozens of properties, then add breakpoints and container queries, and the selector logic quickly becomes unmanageable.
142
+
143
+ Tasty solves both problems at once: **every state mapping compiles into mutually exclusive selectors.**
139
144
 
140
145
  ```tsx
141
146
  const Text = tasty({
@@ -152,30 +157,37 @@ const Text = tasty({
152
157
  });
153
158
  ```
154
159
 
155
- If `@dark` expands to `@root(schema=dark) | @media(prefers-color-scheme: dark)`, Tasty generates:
160
+ If `@dark` expands to `@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))`, Tasty generates:
156
161
 
157
162
  ```css
158
- /* Explicit dark mode */
163
+ /* Branch 1: Explicit dark schema */
159
164
  :root[data-schema="dark"] .t0.t0 {
160
165
  color: var(--text-on-dark-color);
161
166
  }
162
167
 
163
- /* OS dark preference, no explicit override */
168
+ /* Branch 2: No schema attribute + OS prefers dark */
164
169
  @media (prefers-color-scheme: dark) {
165
- :root:not([data-schema="dark"]) .t0.t0 {
170
+ :root:not([data-schema]) .t0.t0 {
166
171
  color: var(--text-on-dark-color);
167
172
  }
168
173
  }
169
174
 
170
- /* Light mode neither condition */
175
+ /* Default: no schema + OS does not prefer dark */
171
176
  @media (not (prefers-color-scheme: dark)) {
172
177
  :root:not([data-schema="dark"]) .t0.t0 {
173
178
  color: var(--text-color);
174
179
  }
175
180
  }
181
+
182
+ /* Default: schema is set but not dark (any OS preference) */
183
+ :root:not([data-schema="dark"])[data-schema] .t0.t0 {
184
+ color: var(--text-color);
185
+ }
176
186
  ```
177
187
 
178
- Every rule is guarded by the negation of all higher-priority rules. No two rules can ever match simultaneously. No specificity arithmetic. No source-order dependence. Components compose and extend without ever colliding.
188
+ Every rule is guarded by the negation of higher-priority rules. No two rules can match at the same time. No specificity arithmetic. No source-order dependence. Components compose and extend without collisions.
189
+
190
+ By absorbing selector complexity, Tasty makes advanced CSS patterns practical again — nested container queries, multi-condition `@supports` gates, and combined root-state/media branches. You stay in pure CSS instead of relying on JavaScript workarounds, so the browser can optimize layout, painting, and transitions natively. Tasty doesn't limit CSS; it unlocks its full potential by removing the complexity that held teams back.
179
191
 
180
192
  ## Capabilities
181
193
 
@@ -407,11 +419,12 @@ If you choose the runtime approach, performance is usually a non-issue in practi
407
419
 
408
420
  | Import | Description | Platform |
409
421
  |--------|-------------|----------|
410
- | `@tenphi/tasty` | Runtime style engine | Browser |
411
- | `@tenphi/tasty/static` | Zero-runtime static styles | Browser |
412
- | `@tenphi/tasty/babel-plugin` | Babel plugin for CSS extraction | Node |
422
+ | `@tenphi/tasty` | Runtime style engine (`tasty`, hooks, `configure`) | Browser |
423
+ | `@tenphi/tasty/static` | Zero-runtime static styles (`tastyStatic`) | Browser |
424
+ | `@tenphi/tasty/core` | Lower-level internals (config, parser, pipeline, injector, style handlers) for tooling and advanced use | Browser / Node |
425
+ | `@tenphi/tasty/babel-plugin` | Babel plugin for zero-runtime CSS extraction | Node |
413
426
  | `@tenphi/tasty/zero` | Programmatic extraction API | Node |
414
- | `@tenphi/tasty/next` | Next.js integration | Node |
427
+ | `@tenphi/tasty/next` | Next.js integration wrapper | Node |
415
428
 
416
429
  ## Ecosystem
417
430
 
@@ -450,14 +463,21 @@ const tokens = theme.tasty(); // Ready-to-use Tasty tokens
450
463
 
451
464
  Syntax highlighting for Tasty styles in TypeScript, TSX, JavaScript, and JSX. Highlights color tokens, custom units, state keys, presets, and style properties inside `tasty()`, `tastyStatic()`, and related APIs.
452
465
 
466
+ <p align="center">
467
+ <img src="assets/tasty-vscode-highlight.png" width="512" alt="Tasty VS Code syntax highlighting example">
468
+ </p>
469
+
453
470
  ### [Cube UI Kit](https://github.com/cube-js/cube-ui-kit)
454
471
 
455
472
  Open-source React UI kit built on Tasty + React Aria. 100+ production components proving Tasty works at design-system scale. A reference implementation and a ready-to-use component library.
456
473
 
457
474
  ## Documentation
458
475
 
459
- - **[Runtime API (tasty)](docs/tasty.md)** — Full runtime styling documentation: component creation, state mappings, sub-elements, variants, hooks, configuration, and style property reference
476
+ - **[Runtime API (tasty)](docs/tasty.md)** — Full runtime styling documentation: component creation, state mappings, sub-elements, variants, hooks, and configuration
477
+ - **[Style Properties](docs/styles.md)** — Complete reference for all enhanced style properties: syntax, values, modifiers, and recommendations
460
478
  - **[Zero Runtime (tastyStatic)](docs/tasty-static.md)** — Build-time static styling: Babel plugin setup, Next.js integration, and static style patterns
479
+ - **[Style Injector](docs/injector.md)** — Internal CSS injection engine: `inject()`, `injectGlobal()`, `injectRawCSS()`, `keyframes()`, deduplication, reference counting, cleanup, SSR support, and Shadow DOM
480
+ - **[Debug Utilities](docs/debug.md)** — Runtime CSS inspection via `tastyDebug`: CSS extraction, element inspection, cache metrics, chunk breakdown, and performance monitoring
461
481
 
462
482
  ## License
463
483
 
package/dist/config.js CHANGED
@@ -1,8 +1,8 @@
1
- import { CUSTOM_UNITS, getGlobalFuncs, getGlobalParser, normalizeColorTokenValue, resetGlobalPredefinedTokens, setGlobalPredefinedTokens } from "./utils/styles.js";
2
1
  import { isDevEnv } from "./utils/is-dev-env.js";
2
+ import { setGlobalPredefinedStates } from "./states/index.js";
3
+ import { CUSTOM_UNITS, getGlobalFuncs, getGlobalParser, normalizeColorTokenValue, resetGlobalPredefinedTokens, setGlobalPredefinedTokens } from "./utils/styles.js";
3
4
  import { normalizeHandlerDefinition, registerHandler, resetHandlers } from "./styles/predefined.js";
4
5
  import { StyleInjector } from "./injector/injector.js";
5
- import { setGlobalPredefinedStates } from "./states/index.js";
6
6
  import { clearPipelineCache, isSelector } from "./pipeline/index.js";
7
7
 
8
8
  //#region src/config.ts
@@ -0,0 +1,33 @@
1
+ import { CacheMetrics, DisposeFunction, InjectResult, KeyframesCacheEntry, KeyframesInfo, KeyframesResult, KeyframesSteps, PropertyDefinition, RawCSSResult, RootRegistry, RuleInfo, SheetInfo, StyleInjectorConfig, StyleRule } from "../injector/types.js";
2
+ import { CSSProperties } from "../utils/css-types.js";
3
+ import { Bucket, ParserOptions, ProcessedStyle, StyleDetails, StyleDetailsPart, UnitHandler } from "../parser/types.js";
4
+ import { StyleParser } from "../parser/parser.js";
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, getModSelector, getRgbValuesFromRgbaString, hexToRgb, isAdvancedStateToken, normalizeColorTokenValue, parseColor, parseStateNotation, parseStyle, resetGlobalPredefinedTokens, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleStateMapToStyleStateDataList } from "../utils/styles.js";
7
+ import { NoType, NotSelector, RecipeStyles, Selector, Styles, StylesInterface, StylesWithoutSelectors, SuffixForSelector, TastyNamedColors, TastyPresetNames } from "../styles/types.js";
8
+ import { ConditionNode } from "../pipeline/conditions.js";
9
+ import { ParseStateKeyOptions, parseStateKey } from "../pipeline/parseStateKey.js";
10
+ import { RenderResult, StyleResult, isSelector, renderStyles } from "../pipeline/index.js";
11
+ import { SheetManager } from "../injector/sheet-manager.js";
12
+ import { StyleInjector } from "../injector/injector.js";
13
+ import { TastyPlugin, TastyPluginFactory } from "../plugins/types.js";
14
+ import { TastyConfig, configure, getConfig, getGlobalKeyframes, getGlobalRecipes, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, isConfigLocked, isTestEnvironment, resetConfig } from "../config.js";
15
+ import { okhslFunc, okhslPlugin } from "../plugins/okhsl-plugin.js";
16
+ import { CHUNK_NAMES, ChunkInfo, ChunkName, STYLE_TO_CHUNK, categorizeStyleKeys } from "../chunks/definitions.js";
17
+ import { PropertyOptions, allocateClassName, cleanup, createInjector, destroy, getCssText, getCssTextForNode, getIsTestEnvironment, getRawCSSText, inject, injectGlobal, injectRawCSS, injector, isPropertyDefined, keyframes, property } from "../injector/index.js";
18
+ import { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, COLOR_STYLES, CONTAINER_STYLES, DIMENSION_STYLES, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, TEXT_STYLES } from "../styles/list.js";
19
+ import { BaseStyleProps, BlockInnerStyleProps, BlockOuterStyleProps, BlockStyleProps, ColorStyleProps, ContainerStyleProps, DimensionStyleProps, FlowStyleProps, GlobalStyledProps, InnerStyleProps, ModValue, Mods, OuterStyleProps, PositionStyleProps, Props, ShortGridStyles, TagName, TastyExtensionConfig, TastyThemeNames, TextStyleProps, TokenValue, Tokens } from "../types.js";
20
+ import { styleHandlers } from "../styles/predefined.js";
21
+ import "../styles/index.js";
22
+ import { filterBaseProps } from "../utils/filter-base-props.js";
23
+ import { color } from "../utils/colors.js";
24
+ import { _modAttrs } from "../utils/mod-attrs.js";
25
+ import { dotize } from "../utils/dotize.js";
26
+ import { mergeStyles } from "../utils/merge-styles.js";
27
+ import { resolveRecipes } from "../utils/resolve-recipes.js";
28
+ import { deprecationWarning, warn } from "../utils/warnings.js";
29
+ import { hslToRgbValues, processTokens, stringifyTokens } from "../utils/process-tokens.js";
30
+ import { TypographyPreset } from "../tokens/typography.js";
31
+ import { generateTypographyTokens } from "../utils/typography.js";
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, getModSelector, 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 };
@@ -0,0 +1,26 @@
1
+ import { Bucket } from "../parser/types.js";
2
+ import { StyleParser } from "../parser/parser.js";
3
+ import { okhslFunc, okhslPlugin } from "../plugins/okhsl-plugin.js";
4
+ import { createStateParserContext, getGlobalPredefinedStates, setGlobalPredefinedStates } from "../states/index.js";
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, getModSelector, getRgbValuesFromRgbaString, hexToRgb, isAdvancedStateToken, normalizeColorTokenValue, parseColor, parseStateNotation, parseStyle, resetGlobalPredefinedTokens, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleStateMapToStyleStateDataList } from "../utils/styles.js";
7
+ import { styleHandlers } from "../styles/predefined.js";
8
+ import { SheetManager } from "../injector/sheet-manager.js";
9
+ import { StyleInjector } from "../injector/injector.js";
10
+ import { parseStateKey } from "../pipeline/parseStateKey.js";
11
+ import { isSelector, renderStyles } from "../pipeline/index.js";
12
+ import { configure, getConfig, getGlobalKeyframes, getGlobalRecipes, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, isConfigLocked, isTestEnvironment, resetConfig } from "../config.js";
13
+ import { CHUNK_NAMES, STYLE_TO_CHUNK, categorizeStyleKeys } from "../chunks/definitions.js";
14
+ import { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, COLOR_STYLES, CONTAINER_STYLES, DIMENSION_STYLES, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, TEXT_STYLES } from "../styles/list.js";
15
+ import { allocateClassName, cleanup, createInjector, destroy, getCssText, getCssTextForNode, getIsTestEnvironment, getRawCSSText, inject, injectGlobal, injectRawCSS, injector, isPropertyDefined, keyframes, property } from "../injector/index.js";
16
+ import { filterBaseProps } from "../utils/filter-base-props.js";
17
+ import { color } from "../utils/colors.js";
18
+ import { _modAttrs } from "../utils/mod-attrs.js";
19
+ import { dotize } from "../utils/dotize.js";
20
+ import { mergeStyles } from "../utils/merge-styles.js";
21
+ import { resolveRecipes } from "../utils/resolve-recipes.js";
22
+ import { deprecationWarning, warn } from "../utils/warnings.js";
23
+ import { generateTypographyTokens } from "../utils/typography.js";
24
+ import { tastyDebug } from "../debug.js";
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, getModSelector, 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 };
@@ -5,8 +5,8 @@ import { CHUNK_NAMES, categorizeStyleKeys } from "../chunks/definitions.js";
5
5
  import { generateChunkCacheKey } from "../chunks/cacheKey.js";
6
6
  import { renderStylesForChunk } from "../chunks/renderChunk.js";
7
7
  import { allocateClassName, inject, keyframes, property } from "../injector/index.js";
8
- import { extractAnimationNamesFromStyles, extractLocalKeyframes, filterUsedKeyframes, hasLocalKeyframes, mergeKeyframes, replaceAnimationNames } from "../keyframes/index.js";
9
8
  import { resolveRecipes } from "../utils/resolve-recipes.js";
9
+ import { extractAnimationNamesFromStyles, extractLocalKeyframes, filterUsedKeyframes, hasLocalKeyframes, mergeKeyframes, replaceAnimationNames } from "../keyframes/index.js";
10
10
  import { useInsertionEffect, useMemo, useRef } from "react";
11
11
 
12
12
  //#region src/hooks/useStyles.ts
package/dist/index.d.ts CHANGED
@@ -1,38 +1,48 @@
1
1
  import { CacheMetrics, DisposeFunction, InjectResult, KeyframesCacheEntry, KeyframesInfo, KeyframesResult, KeyframesSteps, PropertyDefinition, RawCSSResult, RootRegistry, RuleInfo, SheetInfo, StyleInjectorConfig, StyleRule } from "./injector/types.js";
2
- import { AtRuleContext, ParsedAdvancedState, StateParserContext, getGlobalPredefinedStates, setGlobalPredefinedStates } from "./states/index.js";
2
+ import { CSSProperties } from "./utils/css-types.js";
3
+ import { Bucket, ParserOptions, ProcessedStyle, StyleDetails, StyleDetailsPart, UnitHandler } from "./parser/types.js";
4
+ import { StyleParser } from "./parser/parser.js";
5
+ import { AtRuleContext, ParsedAdvancedState, StateParserContext, createStateParserContext, getGlobalPredefinedStates, setGlobalPredefinedStates } from "./states/index.js";
3
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, getModSelector, getRgbValuesFromRgbaString, hexToRgb, isAdvancedStateToken, normalizeColorTokenValue, parseColor, parseStateNotation, parseStyle, resetGlobalPredefinedTokens, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleStateMapToStyleStateDataList } from "./utils/styles.js";
4
7
  import { NoType, NotSelector, RecipeStyles, Selector, Styles, StylesInterface, StylesWithoutSelectors, SuffixForSelector, TastyNamedColors, TastyPresetNames } from "./styles/types.js";
8
+ import { ConditionNode } from "./pipeline/conditions.js";
9
+ import { ParseStateKeyOptions, parseStateKey } from "./pipeline/parseStateKey.js";
5
10
  import { RenderResult, StyleResult, isSelector, renderStyles } from "./pipeline/index.js";
6
11
  import { SheetManager } from "./injector/sheet-manager.js";
7
12
  import { StyleInjector } from "./injector/injector.js";
13
+ import { TastyPlugin, TastyPluginFactory } from "./plugins/types.js";
14
+ import { TastyConfig, configure, getConfig, getGlobalKeyframes, getGlobalRecipes, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, isConfigLocked, isTestEnvironment, resetConfig } from "./config.js";
15
+ import { okhslFunc, okhslPlugin } from "./plugins/okhsl-plugin.js";
16
+ import { CHUNK_NAMES, ChunkInfo, ChunkName, STYLE_TO_CHUNK, categorizeStyleKeys } from "./chunks/definitions.js";
8
17
  import { PropertyOptions, allocateClassName, cleanup, createInjector, destroy, getCssText, getCssTextForNode, getIsTestEnvironment, getRawCSSText, inject, injectGlobal, injectRawCSS, injector, isPropertyDefined, keyframes, property } from "./injector/index.js";
9
18
  import { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, COLOR_STYLES, CONTAINER_STYLES, DIMENSION_STYLES, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, TEXT_STYLES } from "./styles/list.js";
10
- import { AllBaseProps, BaseProps, BasePropsWithoutChildren, BaseStyleProps, BlockInnerStyleProps, BlockOuterStyleProps, BlockStyleProps, ColorStyleProps, ContainerStyleProps, DimensionStyleProps, FlowStyleProps, GlobalStyledProps, ModValue, Mods, OuterStyleProps, PositionStyleProps, Props, ShortGridStyles, TagName, TastyExtensionConfig, TastyThemeNames, TextStyleProps, TokenValue, Tokens } from "./types.js";
11
- import { AllBasePropsWithMods, Element, ElementsDefinition, SubElementDefinition, SubElementProps, TastyElementOptions, TastyElementProps, TastyProps, tasty } from "./tasty.js";
19
+ import { AllBaseProps, BaseProps, BasePropsWithoutChildren, BaseStyleProps, BlockInnerStyleProps, BlockOuterStyleProps, BlockStyleProps, ColorStyleProps, ContainerStyleProps, DimensionStyleProps, FlowStyleProps, GlobalStyledProps, InnerStyleProps, ModValue, Mods, OuterStyleProps, PositionStyleProps, Props, ShortGridStyles, TagName, TastyExtensionConfig, TastyThemeNames, TextStyleProps, TokenValue, Tokens } from "./types.js";
20
+ import { AllBasePropsWithMods, Element, ElementsDefinition, SubElementDefinition, SubElementProps, TastyElementOptions, TastyElementProps, TastyProps, VariantMap, WithVariant, tasty } from "./tasty.js";
12
21
  import { UseStylesOptions, UseStylesResult, useStyles } from "./hooks/useStyles.js";
13
22
  import { useGlobalStyles } from "./hooks/useGlobalStyles.js";
14
23
  import { useRawCSS } from "./hooks/useRawCSS.js";
15
24
  import { useKeyframes } from "./hooks/useKeyframes.js";
16
25
  import { UsePropertyOptions, useProperty } from "./hooks/useProperty.js";
17
- import "./hooks/index.js";
18
- import { TastyPlugin, TastyPluginFactory } from "./plugins/types.js";
19
- import { TastyConfig, configure, getConfig, getGlobalKeyframes, getGlobalRecipes, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, isConfigLocked, isTestEnvironment, resetConfig } from "./config.js";
20
- import { okhslFunc, okhslPlugin } from "./plugins/okhsl-plugin.js";
21
- import "./plugins/index.js";
22
- import { CHUNK_NAMES, ChunkInfo, ChunkName, STYLE_TO_CHUNK, categorizeStyleKeys } from "./chunks/definitions.js";
23
- import "./chunks/index.js";
26
+ import { getDisplayName } from "./utils/get-display-name.js";
27
+ import { styleHandlers } from "./styles/predefined.js";
24
28
  import { filterBaseProps } from "./utils/filter-base-props.js";
25
29
  import { color } from "./utils/colors.js";
26
30
  import { _modAttrs } from "./utils/mod-attrs.js";
27
- import { styleHandlers } from "./styles/predefined.js";
28
- import "./styles/index.js";
29
31
  import { dotize } from "./utils/dotize.js";
30
32
  import { mergeStyles } from "./utils/merge-styles.js";
31
33
  import { resolveRecipes } from "./utils/resolve-recipes.js";
32
34
  import { deprecationWarning, warn } from "./utils/warnings.js";
33
- import { getDisplayName } from "./utils/get-display-name.js";
34
35
  import { hslToRgbValues, processTokens, stringifyTokens } from "./utils/process-tokens.js";
35
36
  import { TypographyPreset } from "./tokens/typography.js";
36
37
  import { generateTypographyTokens } from "./utils/typography.js";
37
38
  import { tastyDebug } from "./debug.js";
38
- export { type AllBaseProps, type AllBasePropsWithMods, type AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, type BaseProps, type BasePropsWithoutChildren, type BaseStyleProps, type BlockInnerStyleProps, type BlockOuterStyleProps, type BlockStyleProps, CHUNK_NAMES, COLOR_STYLES, COMPUTE_FUNC_MAP, CONTAINER_STYLES, CSSMap, CUSTOM_UNITS, CacheMetrics, type ChunkInfo, type ChunkName, type ColorStyleProps, ComputeModel, type ContainerStyleProps, DIMENSION_STYLES, DIRECTIONS, type DimensionStyleProps, DisposeFunction, Element, type ElementsDefinition, FLOW_STYLES, type FlowStyleProps, type GlobalStyledProps, INNER_STYLES, InjectResult, KeyframesCacheEntry, KeyframesInfo, KeyframesResult, KeyframesSteps, type ModValue, type Mods, type NoType, type NotSelector, OUTER_STYLES, type OuterStyleProps, POSITION_STYLES, type ParsedAdvancedState, ParsedColor, type PositionStyleProps, 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, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleInjector, StyleInjectorConfig, StyleMap, StylePropValue, type StyleResult, StyleRule, StyleStateData, StyleStateDataList, StyleStateDataListMap, StyleStateMap, StyleValue, StyleValueStateMap, type Styles, type StylesInterface, type StylesWithoutSelectors, type SubElementDefinition, type SubElementProps, type SuffixForSelector, TEXT_STYLES, type TagName, type TastyConfig, type TastyElementOptions, type TastyElementProps, type TastyExtensionConfig, type TastyNamedColors, type TastyPlugin, type TastyPluginFactory, type TastyPresetNames, type TastyProps, type TastyThemeNames, type TextStyleProps, type TokenValue, type Tokens, TypographyPreset, type UsePropertyOptions, type UseStylesOptions, type UseStylesResult, allocateClassName, buildAtRuleContext, categorizeStyleKeys, cleanup, color, computeState, configure, createInjector, customFunc, deprecationWarning, destroy, dotize, extendStyles, extractStyles, filterBaseProps, filterMods, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getDisplayName, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getModSelector, 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, parseStateNotation, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, stringifyTokens, styleHandlers, styleStateMapToStyleStateDataList, tasty, tastyDebug, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles, warn };
39
+ import "./core/index.js";
40
+ import { CSSProperties as CSSProperties$1 } from "react";
41
+
42
+ //#region src/index.d.ts
43
+ declare module './utils/css-types' {
44
+ interface CSSProperties extends CSSProperties$1 {}
45
+ }
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, getModSelector, 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
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,30 +1,33 @@
1
+ import { Bucket } from "./parser/types.js";
2
+ import { StyleParser } from "./parser/parser.js";
1
3
  import { okhslFunc, okhslPlugin } from "./plugins/okhsl-plugin.js";
4
+ import { createStateParserContext, getGlobalPredefinedStates, setGlobalPredefinedStates } from "./states/index.js";
2
5
  import { hslToRgbValues, processTokens, stringifyTokens } from "./utils/process-tokens.js";
3
6
  import { COMPUTE_FUNC_MAP, CUSTOM_UNITS, DIRECTIONS, STATE_OPERATORS, STATE_OPERATOR_LIST, buildAtRuleContext, computeState, customFunc, extendStyles, extractStyles, filterMods, getGlobalFuncs, getGlobalParser, getGlobalPredefinedTokens, getModSelector, getRgbValuesFromRgbaString, hexToRgb, isAdvancedStateToken, normalizeColorTokenValue, parseColor, parseStateNotation, parseStyle, resetGlobalPredefinedTokens, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleStateMapToStyleStateDataList } from "./utils/styles.js";
4
7
  import { styleHandlers } from "./styles/predefined.js";
5
8
  import { SheetManager } from "./injector/sheet-manager.js";
6
9
  import { StyleInjector } from "./injector/injector.js";
7
- import { configure, getConfig, getGlobalKeyframes, getGlobalRecipes, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, isConfigLocked, isTestEnvironment, resetConfig } from "./config.js";
8
- import { getGlobalPredefinedStates, setGlobalPredefinedStates } from "./states/index.js";
10
+ import { parseStateKey } from "./pipeline/parseStateKey.js";
9
11
  import { isSelector, renderStyles } from "./pipeline/index.js";
12
+ import { configure, getConfig, getGlobalKeyframes, getGlobalRecipes, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, isConfigLocked, isTestEnvironment, resetConfig } from "./config.js";
10
13
  import { CHUNK_NAMES, STYLE_TO_CHUNK, categorizeStyleKeys } from "./chunks/definitions.js";
14
+ import { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, COLOR_STYLES, CONTAINER_STYLES, DIMENSION_STYLES, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, TEXT_STYLES } from "./styles/list.js";
11
15
  import { allocateClassName, cleanup, createInjector, destroy, getCssText, getCssTextForNode, getIsTestEnvironment, getRawCSSText, inject, injectGlobal, injectRawCSS, injector, isPropertyDefined, keyframes, property } from "./injector/index.js";
16
+ import { filterBaseProps } from "./utils/filter-base-props.js";
17
+ import { color } from "./utils/colors.js";
18
+ import { _modAttrs } from "./utils/mod-attrs.js";
19
+ import { dotize } from "./utils/dotize.js";
12
20
  import { mergeStyles } from "./utils/merge-styles.js";
13
21
  import { resolveRecipes } from "./utils/resolve-recipes.js";
22
+ import { deprecationWarning, warn } from "./utils/warnings.js";
23
+ import { generateTypographyTokens } from "./utils/typography.js";
24
+ import { tastyDebug } from "./debug.js";
14
25
  import { useStyles } from "./hooks/useStyles.js";
15
- import { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, COLOR_STYLES, CONTAINER_STYLES, DIMENSION_STYLES, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, TEXT_STYLES } from "./styles/list.js";
16
26
  import { getDisplayName } from "./utils/get-display-name.js";
17
- import { _modAttrs } from "./utils/mod-attrs.js";
18
27
  import { Element, tasty } from "./tasty.js";
19
28
  import { useGlobalStyles } from "./hooks/useGlobalStyles.js";
20
29
  import { useRawCSS } from "./hooks/useRawCSS.js";
21
30
  import { useKeyframes } from "./hooks/useKeyframes.js";
22
31
  import { useProperty } from "./hooks/useProperty.js";
23
- import { filterBaseProps } from "./utils/filter-base-props.js";
24
- import { color } from "./utils/colors.js";
25
- import { dotize } from "./utils/dotize.js";
26
- import { deprecationWarning, warn } from "./utils/warnings.js";
27
- import { generateTypographyTokens } from "./utils/typography.js";
28
- import { tastyDebug } from "./debug.js";
29
32
 
30
- export { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, 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, TEXT_STYLES, allocateClassName, buildAtRuleContext, categorizeStyleKeys, cleanup, color, computeState, configure, createInjector, customFunc, deprecationWarning, destroy, dotize, extendStyles, extractStyles, filterBaseProps, filterMods, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getDisplayName, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getModSelector, 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, parseStateNotation, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, stringifyTokens, styleHandlers, styleStateMapToStyleStateDataList, tasty, tastyDebug, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles, warn };
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, getModSelector, 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 };
@@ -1,6 +1,6 @@
1
+ import { isDevEnv } from "../utils/is-dev-env.js";
1
2
  import { parseStyle } from "../utils/styles.js";
2
3
  import { colorInitialValueToRgb, getEffectiveDefinition, normalizePropertyDefinition } from "../properties/index.js";
3
- import { isDevEnv } from "../utils/is-dev-env.js";
4
4
  import { SheetManager } from "./sheet-manager.js";
5
5
 
6
6
  //#region src/injector/injector.ts
@@ -1,6 +1,6 @@
1
- import { Lru } from "./lru.js";
2
1
  import { Bucket, finalizeGroup, finalizePart, makeEmptyDetails, makeEmptyPart } from "./types.js";
3
2
  import { classify } from "./classify.js";
3
+ import { Lru } from "./lru.js";
4
4
  import { scan } from "./tokenizer.js";
5
5
 
6
6
  //#region src/parser/parser.ts
@@ -0,0 +1,134 @@
1
+ //#region src/pipeline/conditions.d.ts
2
+ /**
3
+ * ConditionNode Types and Helpers
4
+ *
5
+ * Core data structures for representing style conditions as an abstract syntax tree.
6
+ * Used throughout the pipeline for parsing, simplification, and CSS generation.
7
+ */
8
+ /**
9
+ * Base interface for all state conditions (leaf nodes)
10
+ */
11
+ interface BaseStateCondition {
12
+ kind: 'state';
13
+ negated: boolean;
14
+ raw: string;
15
+ uniqueId: string;
16
+ }
17
+ /**
18
+ * Modifier condition: [data-attr] or [data-attr="value"]
19
+ */
20
+ interface ModifierCondition extends BaseStateCondition {
21
+ type: 'modifier';
22
+ attribute: string;
23
+ value?: string;
24
+ operator?: '=' | '^=' | '$=' | '*=';
25
+ }
26
+ /**
27
+ * Pseudo-class condition: :hover, :focus-visible
28
+ */
29
+ interface PseudoCondition extends BaseStateCondition {
30
+ type: 'pseudo';
31
+ pseudo: string;
32
+ }
33
+ /**
34
+ * Numeric bound for dimension queries
35
+ */
36
+ interface NumericBound {
37
+ value: string;
38
+ valueNumeric: number | null;
39
+ inclusive: boolean;
40
+ }
41
+ /**
42
+ * Media query condition
43
+ */
44
+ interface MediaCondition extends BaseStateCondition {
45
+ type: 'media';
46
+ subtype: 'dimension' | 'feature' | 'type';
47
+ dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
48
+ lowerBound?: NumericBound;
49
+ upperBound?: NumericBound;
50
+ feature?: string;
51
+ featureValue?: string;
52
+ mediaType?: 'print' | 'screen' | 'all' | 'speech';
53
+ }
54
+ /**
55
+ * Container query condition
56
+ */
57
+ interface ContainerCondition extends BaseStateCondition {
58
+ type: 'container';
59
+ subtype: 'dimension' | 'style' | 'raw';
60
+ containerName?: string;
61
+ dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
62
+ lowerBound?: NumericBound;
63
+ upperBound?: NumericBound;
64
+ property?: string;
65
+ propertyValue?: string;
66
+ rawCondition?: string;
67
+ }
68
+ /**
69
+ * Root state condition: @root(theme=dark)
70
+ */
71
+ interface RootCondition extends BaseStateCondition {
72
+ type: 'root';
73
+ innerCondition: ConditionNode;
74
+ }
75
+ /**
76
+ * Parent state condition: @parent(hovered), @parent(theme=dark, >)
77
+ */
78
+ interface ParentCondition extends BaseStateCondition {
79
+ type: 'parent';
80
+ innerCondition: ConditionNode;
81
+ direct: boolean;
82
+ }
83
+ /**
84
+ * Own state condition: @own(hovered)
85
+ */
86
+ interface OwnCondition extends BaseStateCondition {
87
+ type: 'own';
88
+ innerCondition: ConditionNode;
89
+ }
90
+ /**
91
+ * Starting style condition: @starting
92
+ */
93
+ interface StartingCondition extends BaseStateCondition {
94
+ type: 'starting';
95
+ }
96
+ /**
97
+ * Supports query condition: @supports(display: grid), @supports($, :has(*))
98
+ */
99
+ interface SupportsCondition extends BaseStateCondition {
100
+ type: 'supports';
101
+ subtype: 'feature' | 'selector';
102
+ condition: string;
103
+ }
104
+ /**
105
+ * Union of all state condition types
106
+ */
107
+ type StateCondition = ModifierCondition | PseudoCondition | MediaCondition | ContainerCondition | RootCondition | ParentCondition | OwnCondition | StartingCondition | SupportsCondition;
108
+ /**
109
+ * Compound node: combines conditions with AND/OR
110
+ */
111
+ interface CompoundCondition {
112
+ kind: 'compound';
113
+ operator: 'AND' | 'OR';
114
+ children: ConditionNode[];
115
+ }
116
+ /**
117
+ * True condition (matches everything)
118
+ */
119
+ interface TrueCondition {
120
+ kind: 'true';
121
+ }
122
+ /**
123
+ * False condition (matches nothing - skip this rule)
124
+ */
125
+ interface FalseCondition {
126
+ kind: 'false';
127
+ }
128
+ /**
129
+ * Union of all condition node types
130
+ */
131
+ type ConditionNode = StateCondition | CompoundCondition | TrueCondition | FalseCondition;
132
+ //#endregion
133
+ export { ConditionNode };
134
+ //# sourceMappingURL=conditions.d.ts.map
@@ -137,15 +137,15 @@ function containerUniqueId(subtype, props, negated = false) {
137
137
  /**
138
138
  * Generate a normalized unique ID for a root condition
139
139
  */
140
- function rootUniqueId(selector, negated = false) {
141
- const base = `root:${selector}`;
140
+ function rootUniqueId(innerUniqueId, negated = false) {
141
+ const base = `root:${innerUniqueId}`;
142
142
  return negated ? `!${base}` : base;
143
143
  }
144
144
  /**
145
145
  * Generate a normalized unique ID for a parent condition
146
146
  */
147
- function parentUniqueId(selector, direct, negated = false) {
148
- const base = `parent:${direct ? ">" : ""}${selector}`;
147
+ function parentUniqueId(innerUniqueId, direct, negated = false) {
148
+ const base = `parent:${direct ? ">" : ""}${innerUniqueId}`;
149
149
  return negated ? `!${base}` : base;
150
150
  }
151
151
  /**
@@ -312,27 +312,29 @@ function createContainerRawCondition(rawCondition, containerName, negated = fals
312
312
  /**
313
313
  * Create a root condition
314
314
  */
315
- function createRootCondition(selector, negated = false, raw) {
315
+ function createRootCondition(innerCondition, negated = false, raw) {
316
+ const innerUniqueId = getConditionUniqueId(innerCondition);
316
317
  return {
317
318
  kind: "state",
318
319
  type: "root",
319
320
  negated,
320
- raw: raw || `@root(${selector})`,
321
- uniqueId: rootUniqueId(selector, negated),
322
- selector
321
+ raw: raw || `@root(${innerUniqueId})`,
322
+ uniqueId: rootUniqueId(innerUniqueId, negated),
323
+ innerCondition
323
324
  };
324
325
  }
325
326
  /**
326
327
  * Create a parent condition
327
328
  */
328
- function createParentCondition(selector, direct, negated = false, raw) {
329
+ function createParentCondition(innerCondition, direct, negated = false, raw) {
330
+ const innerUniqueId = getConditionUniqueId(innerCondition);
329
331
  return {
330
332
  kind: "state",
331
333
  type: "parent",
332
334
  negated,
333
- raw: raw || `@parent(${selector}${direct ? " >" : ""})`,
334
- uniqueId: parentUniqueId(selector, direct, negated),
335
- selector,
335
+ raw: raw || `@parent(${innerUniqueId})`,
336
+ uniqueId: parentUniqueId(innerUniqueId, direct, negated),
337
+ innerCondition,
336
338
  direct
337
339
  };
338
340
  }