@tenphi/tasty 2.0.2 → 2.0.4
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/{ssr/async-storage.js → async-storage-B7_o6FKt.js} +2 -2
- package/dist/async-storage-B7_o6FKt.js.map +1 -0
- package/dist/{ssr/collector.d.ts → collector-CkZ517g4.d.ts} +3 -3
- package/dist/{ssr/collector.js → collector-DXqvGOb1.js} +5 -10
- package/dist/collector-DXqvGOb1.js.map +1 -0
- package/dist/config-5jzS6k6B.js +10005 -0
- package/dist/config-5jzS6k6B.js.map +1 -0
- package/dist/config-DknGsfMo.d.ts +857 -0
- package/dist/{ssr/context.js → context-CkSg-kDT.js} +11 -3
- package/dist/context-CkSg-kDT.js.map +1 -0
- package/dist/core/index.d.ts +5 -34
- package/dist/core/index.js +5 -26
- package/dist/core-CtU6-9OC.js +1507 -0
- package/dist/core-CtU6-9OC.js.map +1 -0
- package/dist/{zero/extractor.js → css-writer-DHkX0JuE.js} +74 -11
- package/dist/css-writer-DHkX0JuE.js.map +1 -0
- package/dist/{ssr/format-global-rules.js → format-global-rules-Dbc_1tc3.js} +2 -2
- package/dist/format-global-rules-Dbc_1tc3.js.map +1 -0
- package/dist/format-rules-DH13ewDu.js +143 -0
- package/dist/format-rules-DH13ewDu.js.map +1 -0
- package/dist/{ssr/hydrate.js → hydrate-C1Gv-DoS.js} +3 -3
- package/dist/hydrate-C1Gv-DoS.js.map +1 -0
- package/dist/{styles/types.d.ts → index-PzENbpAq.d.ts} +701 -5
- package/dist/index-o7zV2yCr.d.ts +1561 -0
- package/dist/index.d.ts +5 -51
- package/dist/index.js +728 -35
- package/dist/index.js.map +1 -0
- package/dist/keyframes-b7X3UxDV.js +587 -0
- package/dist/keyframes-b7X3UxDV.js.map +1 -0
- package/dist/{utils/merge-styles.d.ts → merge-styles-C7KTy7MY.d.ts} +3 -3
- package/dist/{utils/merge-styles.js → merge-styles-Tgo3BbL2.js} +3 -4
- package/dist/merge-styles-Tgo3BbL2.js.map +1 -0
- package/dist/{utils/resolve-recipes.js → resolve-recipes-Ca2-5CxM.js} +4 -6
- package/dist/resolve-recipes-Ca2-5CxM.js.map +1 -0
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro.js +4 -4
- package/dist/ssr/index.d.ts +44 -4
- package/dist/ssr/index.js +4 -4
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +6 -6
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +91 -5
- package/dist/static/index.js +49 -3
- package/dist/static/index.js.map +1 -0
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +10 -6
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +67 -3
- package/dist/zero/index.js +1 -2
- package/docs/pipeline.md +204 -50
- package/package.json +3 -3
- package/dist/_virtual/_rolldown/runtime.js +0 -7
- package/dist/chunks/cacheKey.d.ts +0 -1
- package/dist/chunks/cacheKey.js +0 -77
- package/dist/chunks/cacheKey.js.map +0 -1
- package/dist/chunks/definitions.d.ts +0 -37
- package/dist/chunks/definitions.js +0 -258
- package/dist/chunks/definitions.js.map +0 -1
- package/dist/chunks/index.d.ts +0 -1
- package/dist/chunks/renderChunk.d.ts +0 -1
- package/dist/chunks/renderChunk.js +0 -59
- package/dist/chunks/renderChunk.js.map +0 -1
- package/dist/compute-styles.d.ts +0 -31
- package/dist/compute-styles.js +0 -322
- package/dist/compute-styles.js.map +0 -1
- package/dist/config.d.ts +0 -407
- package/dist/config.js +0 -591
- package/dist/config.js.map +0 -1
- package/dist/counter-style/index.js +0 -51
- package/dist/counter-style/index.js.map +0 -1
- package/dist/debug.d.ts +0 -89
- package/dist/debug.js +0 -453
- package/dist/debug.js.map +0 -1
- package/dist/font-face/index.js +0 -63
- package/dist/font-face/index.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/useCounterStyle.d.ts +0 -36
- package/dist/hooks/useCounterStyle.js +0 -65
- package/dist/hooks/useCounterStyle.js.map +0 -1
- package/dist/hooks/useFontFace.d.ts +0 -45
- package/dist/hooks/useFontFace.js +0 -66
- package/dist/hooks/useFontFace.js.map +0 -1
- package/dist/hooks/useGlobalStyles.d.ts +0 -46
- package/dist/hooks/useGlobalStyles.js +0 -88
- package/dist/hooks/useGlobalStyles.js.map +0 -1
- package/dist/hooks/useKeyframes.d.ts +0 -58
- package/dist/hooks/useKeyframes.js +0 -55
- package/dist/hooks/useKeyframes.js.map +0 -1
- package/dist/hooks/useProperty.d.ts +0 -81
- package/dist/hooks/useProperty.js +0 -96
- package/dist/hooks/useProperty.js.map +0 -1
- package/dist/hooks/useRawCSS.d.ts +0 -22
- package/dist/hooks/useRawCSS.js +0 -103
- package/dist/hooks/useRawCSS.js.map +0 -1
- package/dist/hooks/useStyles.d.ts +0 -40
- package/dist/hooks/useStyles.js +0 -31
- package/dist/hooks/useStyles.js.map +0 -1
- package/dist/injector/index.d.ts +0 -182
- package/dist/injector/index.js +0 -185
- package/dist/injector/index.js.map +0 -1
- package/dist/injector/injector.d.ts +0 -198
- package/dist/injector/injector.js +0 -651
- package/dist/injector/injector.js.map +0 -1
- package/dist/injector/sheet-manager.d.ts +0 -132
- package/dist/injector/sheet-manager.js +0 -699
- package/dist/injector/sheet-manager.js.map +0 -1
- package/dist/injector/types.d.ts +0 -235
- package/dist/keyframes/index.js +0 -206
- package/dist/keyframes/index.js.map +0 -1
- package/dist/parser/classify.js +0 -319
- package/dist/parser/classify.js.map +0 -1
- package/dist/parser/const.js +0 -60
- package/dist/parser/const.js.map +0 -1
- package/dist/parser/lru.js +0 -109
- package/dist/parser/lru.js.map +0 -1
- package/dist/parser/parser.d.ts +0 -25
- package/dist/parser/parser.js +0 -115
- package/dist/parser/parser.js.map +0 -1
- package/dist/parser/tokenizer.js +0 -69
- package/dist/parser/tokenizer.js.map +0 -1
- package/dist/parser/types.d.ts +0 -51
- package/dist/parser/types.js +0 -46
- package/dist/parser/types.js.map +0 -1
- package/dist/pipeline/conditions.d.ts +0 -134
- package/dist/pipeline/conditions.js +0 -406
- package/dist/pipeline/conditions.js.map +0 -1
- package/dist/pipeline/exclusive.js +0 -382
- package/dist/pipeline/exclusive.js.map +0 -1
- package/dist/pipeline/index.d.ts +0 -55
- package/dist/pipeline/index.js +0 -708
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/materialize.js +0 -1157
- package/dist/pipeline/materialize.js.map +0 -1
- package/dist/pipeline/parseStateKey.d.ts +0 -15
- package/dist/pipeline/parseStateKey.js +0 -446
- package/dist/pipeline/parseStateKey.js.map +0 -1
- package/dist/pipeline/simplify.js +0 -690
- package/dist/pipeline/simplify.js.map +0 -1
- package/dist/pipeline/warnings.js +0 -18
- package/dist/pipeline/warnings.js.map +0 -1
- package/dist/plugins/index.d.ts +0 -2
- package/dist/plugins/okhsl-plugin.d.ts +0 -35
- package/dist/plugins/okhsl-plugin.js +0 -97
- package/dist/plugins/okhsl-plugin.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -87
- package/dist/properties/index.js +0 -222
- package/dist/properties/index.js.map +0 -1
- package/dist/properties/property-type-resolver.d.ts +0 -24
- package/dist/properties/property-type-resolver.js +0 -90
- package/dist/properties/property-type-resolver.js.map +0 -1
- package/dist/rsc-cache.js +0 -79
- package/dist/rsc-cache.js.map +0 -1
- package/dist/ssr/async-storage.d.ts +0 -17
- package/dist/ssr/async-storage.js.map +0 -1
- package/dist/ssr/collect-auto-properties.js +0 -58
- package/dist/ssr/collect-auto-properties.js.map +0 -1
- package/dist/ssr/collector.js.map +0 -1
- package/dist/ssr/context.js.map +0 -1
- package/dist/ssr/format-global-rules.js.map +0 -1
- package/dist/ssr/format-keyframes.js +0 -69
- package/dist/ssr/format-keyframes.js.map +0 -1
- package/dist/ssr/format-property.js +0 -49
- package/dist/ssr/format-property.js.map +0 -1
- package/dist/ssr/format-rules.js +0 -73
- package/dist/ssr/format-rules.js.map +0 -1
- package/dist/ssr/hydrate.d.ts +0 -29
- package/dist/ssr/hydrate.js.map +0 -1
- package/dist/ssr/ssr-collector-ref.js +0 -29
- package/dist/ssr/ssr-collector-ref.js.map +0 -1
- package/dist/states/index.d.ts +0 -49
- package/dist/states/index.js +0 -170
- package/dist/states/index.js.map +0 -1
- package/dist/static/tastyStatic.d.ts +0 -46
- package/dist/static/tastyStatic.js +0 -30
- package/dist/static/tastyStatic.js.map +0 -1
- package/dist/static/types.d.ts +0 -49
- package/dist/static/types.js +0 -24
- package/dist/static/types.js.map +0 -1
- package/dist/styles/border.d.ts +0 -25
- package/dist/styles/border.js +0 -120
- package/dist/styles/border.js.map +0 -1
- package/dist/styles/color.d.ts +0 -14
- package/dist/styles/color.js +0 -26
- package/dist/styles/color.js.map +0 -1
- package/dist/styles/const.js +0 -17
- package/dist/styles/const.js.map +0 -1
- package/dist/styles/createStyle.js +0 -79
- package/dist/styles/createStyle.js.map +0 -1
- package/dist/styles/dimension.js +0 -109
- package/dist/styles/dimension.js.map +0 -1
- package/dist/styles/directional.js +0 -133
- package/dist/styles/directional.js.map +0 -1
- package/dist/styles/display.d.ts +0 -30
- package/dist/styles/display.js +0 -73
- package/dist/styles/display.js.map +0 -1
- package/dist/styles/fade.d.ts +0 -15
- package/dist/styles/fade.js +0 -62
- package/dist/styles/fade.js.map +0 -1
- package/dist/styles/fill.d.ts +0 -42
- package/dist/styles/fill.js +0 -51
- package/dist/styles/fill.js.map +0 -1
- package/dist/styles/flow.d.ts +0 -16
- package/dist/styles/flow.js +0 -12
- package/dist/styles/flow.js.map +0 -1
- package/dist/styles/gap.d.ts +0 -31
- package/dist/styles/gap.js +0 -38
- package/dist/styles/gap.js.map +0 -1
- package/dist/styles/height.d.ts +0 -17
- package/dist/styles/height.js +0 -19
- package/dist/styles/height.js.map +0 -1
- package/dist/styles/index.d.ts +0 -1
- package/dist/styles/index.js +0 -8
- package/dist/styles/index.js.map +0 -1
- package/dist/styles/inset.d.ts +0 -24
- package/dist/styles/inset.js +0 -34
- package/dist/styles/inset.js.map +0 -1
- package/dist/styles/list.d.ts +0 -16
- package/dist/styles/list.js +0 -100
- package/dist/styles/list.js.map +0 -1
- package/dist/styles/margin.d.ts +0 -24
- package/dist/styles/margin.js +0 -32
- package/dist/styles/margin.js.map +0 -1
- package/dist/styles/outline.d.ts +0 -29
- package/dist/styles/outline.js +0 -55
- package/dist/styles/outline.js.map +0 -1
- package/dist/styles/padding.d.ts +0 -24
- package/dist/styles/padding.js +0 -32
- package/dist/styles/padding.js.map +0 -1
- package/dist/styles/placement.d.ts +0 -37
- package/dist/styles/placement.js +0 -74
- package/dist/styles/placement.js.map +0 -1
- package/dist/styles/predefined.d.ts +0 -71
- package/dist/styles/predefined.js +0 -237
- package/dist/styles/predefined.js.map +0 -1
- package/dist/styles/preset.d.ts +0 -52
- package/dist/styles/preset.js +0 -127
- package/dist/styles/preset.js.map +0 -1
- package/dist/styles/radius.d.ts +0 -12
- package/dist/styles/radius.js +0 -83
- package/dist/styles/radius.js.map +0 -1
- package/dist/styles/scrollMargin.d.ts +0 -24
- package/dist/styles/scrollMargin.js +0 -32
- package/dist/styles/scrollMargin.js.map +0 -1
- package/dist/styles/scrollbar.d.ts +0 -25
- package/dist/styles/scrollbar.js +0 -51
- package/dist/styles/scrollbar.js.map +0 -1
- package/dist/styles/shadow.d.ts +0 -14
- package/dist/styles/shadow.js +0 -25
- package/dist/styles/shadow.js.map +0 -1
- package/dist/styles/shared.js +0 -17
- package/dist/styles/shared.js.map +0 -1
- package/dist/styles/transition.d.ts +0 -14
- package/dist/styles/transition.js +0 -159
- package/dist/styles/transition.js.map +0 -1
- package/dist/styles/width.d.ts +0 -17
- package/dist/styles/width.js +0 -19
- package/dist/styles/width.js.map +0 -1
- package/dist/tasty.d.ts +0 -134
- package/dist/tasty.js +0 -248
- package/dist/tasty.js.map +0 -1
- package/dist/types.d.ts +0 -184
- package/dist/utils/cache-wrapper.js +0 -21
- package/dist/utils/cache-wrapper.js.map +0 -1
- package/dist/utils/case-converter.js +0 -8
- package/dist/utils/case-converter.js.map +0 -1
- package/dist/utils/color-math.d.ts +0 -46
- package/dist/utils/color-math.js +0 -749
- package/dist/utils/color-math.js.map +0 -1
- package/dist/utils/color-space.d.ts +0 -5
- package/dist/utils/color-space.js +0 -228
- package/dist/utils/color-space.js.map +0 -1
- package/dist/utils/colors.d.ts +0 -5
- package/dist/utils/colors.js +0 -10
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/css-types.d.ts +0 -7
- package/dist/utils/deps-equal.js +0 -15
- package/dist/utils/deps-equal.js.map +0 -1
- package/dist/utils/dotize.d.ts +0 -26
- package/dist/utils/dotize.js +0 -122
- package/dist/utils/dotize.js.map +0 -1
- package/dist/utils/filter-base-props.d.ts +0 -15
- package/dist/utils/filter-base-props.js +0 -45
- package/dist/utils/filter-base-props.js.map +0 -1
- package/dist/utils/get-display-name.d.ts +0 -7
- package/dist/utils/get-display-name.js +0 -10
- package/dist/utils/get-display-name.js.map +0 -1
- package/dist/utils/has-keys.js +0 -13
- package/dist/utils/has-keys.js.map +0 -1
- package/dist/utils/hash.js +0 -14
- package/dist/utils/hash.js.map +0 -1
- package/dist/utils/is-dev-env.js +0 -19
- package/dist/utils/is-dev-env.js.map +0 -1
- package/dist/utils/is-valid-element-type.js +0 -15
- package/dist/utils/is-valid-element-type.js.map +0 -1
- package/dist/utils/merge-styles.js.map +0 -1
- package/dist/utils/mod-attrs.d.ts +0 -6
- package/dist/utils/mod-attrs.js +0 -20
- package/dist/utils/mod-attrs.js.map +0 -1
- package/dist/utils/process-tokens.d.ts +0 -17
- package/dist/utils/process-tokens.js +0 -83
- package/dist/utils/process-tokens.js.map +0 -1
- package/dist/utils/resolve-recipes.d.ts +0 -17
- package/dist/utils/resolve-recipes.js.map +0 -1
- package/dist/utils/selector-transform.js +0 -32
- package/dist/utils/selector-transform.js.map +0 -1
- package/dist/utils/string.js +0 -8
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/styles.d.ts +0 -99
- package/dist/utils/styles.js +0 -220
- package/dist/utils/styles.js.map +0 -1
- package/dist/utils/typography.d.ts +0 -58
- package/dist/utils/typography.js +0 -51
- package/dist/utils/typography.js.map +0 -1
- package/dist/utils/warnings.d.ts +0 -16
- package/dist/utils/warnings.js +0 -16
- package/dist/utils/warnings.js.map +0 -1
- package/dist/zero/css-writer.d.ts +0 -45
- package/dist/zero/css-writer.js +0 -73
- package/dist/zero/css-writer.js.map +0 -1
- package/dist/zero/extractor.d.ts +0 -24
- package/dist/zero/extractor.js.map +0 -1
|
@@ -1,7 +1,467 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CSSProperties } from "../utils/css-types.js";
|
|
3
|
-
import { StyleValue, StyleValueStateMap } from "../utils/styles.js";
|
|
1
|
+
import { Properties } from "csstype";
|
|
4
2
|
|
|
3
|
+
//#region src/properties/property-type-resolver.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* PropertyTypeResolver
|
|
6
|
+
*
|
|
7
|
+
* Automatically infers CSS @property types from custom property values.
|
|
8
|
+
* Supports deferred resolution for var() reference chains of arbitrary depth.
|
|
9
|
+
*/
|
|
10
|
+
declare class PropertyTypeResolver {
|
|
11
|
+
/** propName → the prop it depends on */
|
|
12
|
+
private pendingDeps;
|
|
13
|
+
/** propName → list of props waiting on it */
|
|
14
|
+
private reverseDeps;
|
|
15
|
+
/**
|
|
16
|
+
* Scan CSS declarations and auto-register @property for custom properties
|
|
17
|
+
* whose types can be inferred from their values.
|
|
18
|
+
*/
|
|
19
|
+
scanDeclarations(declarations: string, isPropertyDefined: (name: string) => boolean, registerProperty: (name: string, syntax: string, initialValue: string) => void): void;
|
|
20
|
+
private addDependency;
|
|
21
|
+
private resolve;
|
|
22
|
+
private isComplexValue;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/injector/types.d.ts
|
|
26
|
+
declare global {
|
|
27
|
+
interface Window {
|
|
28
|
+
__TASTY__?: string[];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
interface InjectResult {
|
|
32
|
+
className: string;
|
|
33
|
+
dispose: () => void;
|
|
34
|
+
}
|
|
35
|
+
interface GlobalInjectResult {
|
|
36
|
+
dispose: () => void;
|
|
37
|
+
}
|
|
38
|
+
type DisposeFunction = () => void;
|
|
39
|
+
interface StyleInjectorConfig {
|
|
40
|
+
nonce?: string;
|
|
41
|
+
maxRulesPerSheet?: number;
|
|
42
|
+
forceTextInjection?: boolean;
|
|
43
|
+
/** Enable development mode features: performance metrics and debug information storage */
|
|
44
|
+
devMode?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Global predefined states for advanced state mapping.
|
|
47
|
+
* These are state aliases that can be used in any component.
|
|
48
|
+
* Example: { '@mobile': '@media(w < 920px)', '@dark': '@root(theme=dark)' }
|
|
49
|
+
*/
|
|
50
|
+
states?: Record<string, string>;
|
|
51
|
+
/**
|
|
52
|
+
* Automatically infer and register CSS @property declarations
|
|
53
|
+
* from custom property values. When false, only explicit @properties are used.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
autoPropertyTypes?: boolean;
|
|
57
|
+
/** Garbage collection configuration for unused styles */
|
|
58
|
+
gc?: GCConfig;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Per-className usage tracking for GC.
|
|
62
|
+
*/
|
|
63
|
+
interface StyleUsage {
|
|
64
|
+
lastTouchedAt: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Configuration for the style garbage collector.
|
|
68
|
+
*
|
|
69
|
+
* GC is triggered by touch count rather than timers: every `touchInterval`
|
|
70
|
+
* touches, an idle callback is scheduled to evict unused styles above
|
|
71
|
+
* `capacity`, oldest first.
|
|
72
|
+
*/
|
|
73
|
+
interface GCConfig {
|
|
74
|
+
/**
|
|
75
|
+
* Number of touch events between GC cycles.
|
|
76
|
+
* @default 1000
|
|
77
|
+
*/
|
|
78
|
+
touchInterval?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Maximum number of unused styles to retain.
|
|
81
|
+
* GC evicts the oldest unused styles when this limit is exceeded.
|
|
82
|
+
* Actively referenced styles (refCount > 0) and DOM-live styles
|
|
83
|
+
* do not count against this limit.
|
|
84
|
+
* @default 1000
|
|
85
|
+
*/
|
|
86
|
+
capacity?: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Per-call options for gc().
|
|
90
|
+
*/
|
|
91
|
+
interface GCOptions {
|
|
92
|
+
root?: Document | ShadowRoot;
|
|
93
|
+
/** Bypass capacity threshold and remove ALL unused styles. */
|
|
94
|
+
force?: boolean;
|
|
95
|
+
}
|
|
96
|
+
interface RuleInfo {
|
|
97
|
+
className: string;
|
|
98
|
+
ruleIndex: number;
|
|
99
|
+
sheetIndex: number;
|
|
100
|
+
/** Dev-only: full CSS texts inserted for this class; omitted in production */
|
|
101
|
+
cssText?: string[];
|
|
102
|
+
/** Inclusive end index of the contiguous block of inserted rules for this className */
|
|
103
|
+
endRuleIndex?: number;
|
|
104
|
+
/** NEW: exact indices of all inserted rules for this className */
|
|
105
|
+
indices?: number[];
|
|
106
|
+
}
|
|
107
|
+
interface SheetInfo {
|
|
108
|
+
sheet: HTMLStyleElement;
|
|
109
|
+
ruleCount: number;
|
|
110
|
+
holes: number[];
|
|
111
|
+
}
|
|
112
|
+
interface CleanupStats {
|
|
113
|
+
timestamp: number;
|
|
114
|
+
classesDeleted: number;
|
|
115
|
+
cssSize: number;
|
|
116
|
+
rulesDeleted: number;
|
|
117
|
+
}
|
|
118
|
+
interface CacheMetrics {
|
|
119
|
+
hits: number;
|
|
120
|
+
misses: number;
|
|
121
|
+
bulkCleanups: number;
|
|
122
|
+
totalInsertions: number;
|
|
123
|
+
totalUnused: number;
|
|
124
|
+
stylesCleanedUp: number;
|
|
125
|
+
cleanupHistory: CleanupStats[];
|
|
126
|
+
startTime: number;
|
|
127
|
+
unusedHits?: number;
|
|
128
|
+
}
|
|
129
|
+
interface RootRegistry {
|
|
130
|
+
sheets: SheetInfo[];
|
|
131
|
+
refCounts: Map<string, number>;
|
|
132
|
+
rules: Map<string, RuleInfo>;
|
|
133
|
+
/** Cache key to className mapping to avoid dual storage of RuleInfo objects */
|
|
134
|
+
cacheKeyToClassName: Map<string, string>;
|
|
135
|
+
/** Deduplication set of fully materialized CSS rules inserted into sheets */
|
|
136
|
+
ruleTextSet: Set<string>;
|
|
137
|
+
/** Performance metrics (optional) */
|
|
138
|
+
metrics?: CacheMetrics;
|
|
139
|
+
/** Keyframes cache by content hash -> entry */
|
|
140
|
+
keyframesCache: Map<string, KeyframesCacheEntry>;
|
|
141
|
+
/** Keyframes name to content hash mapping for collision detection */
|
|
142
|
+
keyframesNameToContent: Map<string, string>;
|
|
143
|
+
/** Counter for generating keyframes names like k0, k1, k2... */
|
|
144
|
+
keyframesCounter: number;
|
|
145
|
+
/** Map of injected @property names to their normalized declarations for tracking */
|
|
146
|
+
injectedProperties: Map<string, string>;
|
|
147
|
+
/** Content hashes of injected @font-face rules for deduplication */
|
|
148
|
+
injectedFontFaces: Set<string>;
|
|
149
|
+
/** Names of injected @counter-style rules for deduplication */
|
|
150
|
+
injectedCounterStyles: Set<string>;
|
|
151
|
+
/** Global rules tracking for index adjustment */
|
|
152
|
+
globalRules: Map<string, RuleInfo>;
|
|
153
|
+
/** Resolver for auto-inferring @property types from declaration values */
|
|
154
|
+
propertyTypeResolver: PropertyTypeResolver;
|
|
155
|
+
/** Per-className usage tracking for GC */
|
|
156
|
+
usageMap: Map<string, StyleUsage>;
|
|
157
|
+
/** Touch counter for scheduling GC (per-root) */
|
|
158
|
+
touchCount: number;
|
|
159
|
+
/** How many entries from `window.__TASTY__` have been synced into this registry */
|
|
160
|
+
serverClassSyncIndex: number;
|
|
161
|
+
/** Whether `<style data-tasty-rsc>` tags have been scanned for class names */
|
|
162
|
+
rscStylesScanned: boolean;
|
|
163
|
+
}
|
|
164
|
+
type StyleRule = StyleResult;
|
|
165
|
+
interface KeyframesInfo {
|
|
166
|
+
name: string;
|
|
167
|
+
sheetIndex: number;
|
|
168
|
+
ruleIndex: number;
|
|
169
|
+
/** Dev-only: full CSS text of the @keyframes rule; omitted in production */
|
|
170
|
+
cssText?: string;
|
|
171
|
+
}
|
|
172
|
+
type KeyframeStep = string | Record<string, string | number>;
|
|
173
|
+
type KeyframesSteps = Record<string, KeyframeStep>;
|
|
174
|
+
interface KeyframesResult {
|
|
175
|
+
toString(): string;
|
|
176
|
+
dispose: () => void;
|
|
177
|
+
}
|
|
178
|
+
interface KeyframesCacheEntry {
|
|
179
|
+
name: string;
|
|
180
|
+
refCount: number;
|
|
181
|
+
info: KeyframesInfo;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Definition for a CSS @property at-rule.
|
|
185
|
+
* Used to define custom property syntax, inheritance, and initial value.
|
|
186
|
+
*/
|
|
187
|
+
interface PropertyDefinition {
|
|
188
|
+
/** CSS syntax string (e.g., '<color>', '<angle>', '<number>') */
|
|
189
|
+
syntax?: string;
|
|
190
|
+
/** Whether the property inherits (default: true) */
|
|
191
|
+
inherits?: boolean;
|
|
192
|
+
/** Initial value for the property */
|
|
193
|
+
initialValue?: string | number;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Descriptors for a CSS @font-face at-rule.
|
|
197
|
+
*/
|
|
198
|
+
interface FontFaceDescriptors {
|
|
199
|
+
/** Required. URL(s) to the font file(s). */
|
|
200
|
+
src: string;
|
|
201
|
+
/** Font weight or range. Default: 'normal'. */
|
|
202
|
+
fontWeight?: string | number;
|
|
203
|
+
/** Font style. Default: 'normal'. */
|
|
204
|
+
fontStyle?: 'normal' | 'italic' | 'oblique' | (string & {});
|
|
205
|
+
/** Font stretch. Default: 'normal'. */
|
|
206
|
+
fontStretch?: string;
|
|
207
|
+
/** Loading behavior. Default: 'auto'. */
|
|
208
|
+
fontDisplay?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
|
|
209
|
+
/** Unicode range to cover. */
|
|
210
|
+
unicodeRange?: string;
|
|
211
|
+
/** Ascent metric override. */
|
|
212
|
+
ascentOverride?: string;
|
|
213
|
+
/** Descent metric override. */
|
|
214
|
+
descentOverride?: string;
|
|
215
|
+
/** Line gap metric override. */
|
|
216
|
+
lineGapOverride?: string;
|
|
217
|
+
/** Size adjustment factor. */
|
|
218
|
+
sizeAdjust?: string;
|
|
219
|
+
/** OpenType feature settings. */
|
|
220
|
+
fontFeatureSettings?: string;
|
|
221
|
+
/** Font variation axis settings. */
|
|
222
|
+
fontVariationSettings?: string;
|
|
223
|
+
}
|
|
224
|
+
/** Single descriptor or array of descriptors for multiple weights/styles. */
|
|
225
|
+
type FontFaceInput = FontFaceDescriptors | FontFaceDescriptors[];
|
|
226
|
+
/**
|
|
227
|
+
* Descriptors for a CSS @counter-style at-rule.
|
|
228
|
+
*/
|
|
229
|
+
interface CounterStyleDescriptors {
|
|
230
|
+
/** Required. Numbering algorithm. */
|
|
231
|
+
system: 'cyclic' | 'numeric' | 'alphabetic' | 'symbolic' | 'additive' | 'fixed' | (string & {});
|
|
232
|
+
/** Symbols for non-additive systems. */
|
|
233
|
+
symbols?: string;
|
|
234
|
+
/** Symbol-value pairs for additive system. */
|
|
235
|
+
additiveSymbols?: string;
|
|
236
|
+
/** String prepended to the marker. Default: "". */
|
|
237
|
+
prefix?: string;
|
|
238
|
+
/** String appended to the marker. Default: ". ". */
|
|
239
|
+
suffix?: string;
|
|
240
|
+
/** Negative-value wrapping (e.g., '"(" ")"'). */
|
|
241
|
+
negative?: string;
|
|
242
|
+
/** Counter range (e.g., 'infinite infinite'). */
|
|
243
|
+
range?: string;
|
|
244
|
+
/** Minimum marker width and pad symbol (e.g., '3 "0"'). */
|
|
245
|
+
pad?: string;
|
|
246
|
+
/** Fallback counter style name. */
|
|
247
|
+
fallback?: string;
|
|
248
|
+
/** Speech synthesis hint. */
|
|
249
|
+
speakAs?: string;
|
|
250
|
+
}
|
|
251
|
+
interface RawCSSResult {
|
|
252
|
+
dispose: () => void;
|
|
253
|
+
}
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/utils/css-types.d.ts
|
|
256
|
+
interface CSSProperties extends Properties<string | number> {}
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/parser/types.d.ts
|
|
259
|
+
declare enum Bucket {
|
|
260
|
+
Color = 0,
|
|
261
|
+
Value = 1,
|
|
262
|
+
Mod = 2
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* A part within a group, representing a slash-separated segment.
|
|
266
|
+
* For example, in `'2px solid #red / 4px'`, there are two parts:
|
|
267
|
+
* - Part 0: `2px solid #red`
|
|
268
|
+
* - Part 1: `4px`
|
|
269
|
+
*/
|
|
270
|
+
interface StyleDetailsPart {
|
|
271
|
+
mods: string[];
|
|
272
|
+
values: string[];
|
|
273
|
+
colors: string[];
|
|
274
|
+
all: string[];
|
|
275
|
+
output: string;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* A group of style details, representing a comma-separated segment.
|
|
279
|
+
* Contains aggregated values from all parts for backward compatibility,
|
|
280
|
+
* plus the structured `parts` array for handlers that need slash separation.
|
|
281
|
+
*/
|
|
282
|
+
interface StyleDetails {
|
|
283
|
+
input: string;
|
|
284
|
+
output: string;
|
|
285
|
+
/** Aggregated mods from all parts (backward compatible) */
|
|
286
|
+
mods: string[];
|
|
287
|
+
/** Aggregated values from all parts (backward compatible) */
|
|
288
|
+
values: string[];
|
|
289
|
+
/** Aggregated colors from all parts (backward compatible) */
|
|
290
|
+
colors: string[];
|
|
291
|
+
/** Aggregated all tokens from all parts (backward compatible) */
|
|
292
|
+
all: string[];
|
|
293
|
+
/** Slash-separated parts within this group */
|
|
294
|
+
parts: StyleDetailsPart[];
|
|
295
|
+
}
|
|
296
|
+
interface ProcessedStyle {
|
|
297
|
+
output: string;
|
|
298
|
+
groups: StyleDetails[];
|
|
299
|
+
}
|
|
300
|
+
type UnitHandler = (scalar: number) => string;
|
|
301
|
+
interface ParserOptions {
|
|
302
|
+
funcs?: Record<string, (parsed: StyleDetails[]) => string>;
|
|
303
|
+
units?: Record<string, string | UnitHandler>;
|
|
304
|
+
cacheSize?: number;
|
|
305
|
+
}
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region src/parser/parser.d.ts
|
|
308
|
+
declare class StyleParser {
|
|
309
|
+
private opts;
|
|
310
|
+
private cache;
|
|
311
|
+
constructor(opts?: ParserOptions);
|
|
312
|
+
process(src: string): ProcessedStyle;
|
|
313
|
+
setFuncs(funcs: Required<ParserOptions>['funcs']): void;
|
|
314
|
+
setUnits(units: Required<ParserOptions>['units']): void;
|
|
315
|
+
updateOptions(patch: Partial<ParserOptions>): void;
|
|
316
|
+
/**
|
|
317
|
+
* Clear the parser cache.
|
|
318
|
+
* Call this when external state that affects parsing results has changed
|
|
319
|
+
* (e.g., predefined tokens).
|
|
320
|
+
*/
|
|
321
|
+
clearCache(): void;
|
|
322
|
+
/**
|
|
323
|
+
* Get the current units configuration.
|
|
324
|
+
*/
|
|
325
|
+
getUnits(): ParserOptions['units'];
|
|
326
|
+
}
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region src/utils/color-math.d.ts
|
|
329
|
+
/**
|
|
330
|
+
* Consolidated color conversion math.
|
|
331
|
+
*
|
|
332
|
+
* Single source of truth for all color space conversions used across the
|
|
333
|
+
* library: sRGB gamma, HSL, OKLab, OKLCH, OKHSL, hex parsing, named
|
|
334
|
+
* colors, and CSS string converters.
|
|
335
|
+
*
|
|
336
|
+
* This module has zero internal imports — it is a leaf dependency.
|
|
337
|
+
*
|
|
338
|
+
* Reference: https://bottosson.github.io/posts/oklab/
|
|
339
|
+
*/
|
|
340
|
+
type Vec3 = [number, number, number];
|
|
341
|
+
/**
|
|
342
|
+
* HSL to RGB.
|
|
343
|
+
* Algorithm from CSS Color 4 spec.
|
|
344
|
+
*
|
|
345
|
+
* @param h - Hue in degrees (0-360)
|
|
346
|
+
* @param s - Saturation (0-1)
|
|
347
|
+
* @param l - Lightness (0-1)
|
|
348
|
+
* @returns RGB values in 0-255 range (may have fractional values)
|
|
349
|
+
*/
|
|
350
|
+
declare function hslToRgbValues(h: number, s: number, l: number): Vec3;
|
|
351
|
+
declare function getNamedColorHex(): Map<string, string>;
|
|
352
|
+
/**
|
|
353
|
+
* Convert hex color string to `rgb()` CSS string.
|
|
354
|
+
* Supports 3, 4, 6, and 8 character hex values (with or without `#`).
|
|
355
|
+
*/
|
|
356
|
+
declare function hexToRgb(hex: string): string | null;
|
|
357
|
+
/**
|
|
358
|
+
* Extract RGB values from an `rgb()`/`rgba()` string.
|
|
359
|
+
* Supports comma-separated, space-separated, fractional, percentage,
|
|
360
|
+
* and slash alpha notation.
|
|
361
|
+
*
|
|
362
|
+
* @returns Array of RGB values (0-255 range), converting percentages as needed.
|
|
363
|
+
*/
|
|
364
|
+
declare function getRgbValuesFromRgbaString(str: string): number[];
|
|
365
|
+
/**
|
|
366
|
+
* Convert any recognized color string to an `rgb()` CSS string.
|
|
367
|
+
* Handles hex, `okhsl()`, `hsl()`/`hsla()`, named CSS colors,
|
|
368
|
+
* and `rgb()`/`rgba()` pass-through.
|
|
369
|
+
*/
|
|
370
|
+
declare function strToRgb(color: string, _ignoreAlpha?: boolean): string | null | undefined;
|
|
371
|
+
//#endregion
|
|
372
|
+
//#region src/utils/styles.d.ts
|
|
373
|
+
type StyleValue<T = string> = T | boolean | number | null | undefined;
|
|
374
|
+
/**
|
|
375
|
+
* Normalize a color token value.
|
|
376
|
+
* - Boolean `true` is converted to `'transparent'`
|
|
377
|
+
* - Boolean `false` returns `null` (signals the token should be skipped)
|
|
378
|
+
* - Other values are returned as-is
|
|
379
|
+
*
|
|
380
|
+
* @param value - The raw token value
|
|
381
|
+
* @returns Normalized value or null if the token should be skipped
|
|
382
|
+
*/
|
|
383
|
+
declare function normalizeColorTokenValue<T>(value: T | boolean): T | 'transparent' | null;
|
|
384
|
+
type StyleValueStateMap<T = string> = Record<string, StyleValue<T> | '@inherit'>;
|
|
385
|
+
/**
|
|
386
|
+
* Combined type for style values that can be either a direct value or a state map.
|
|
387
|
+
* Use this for component props that accept style values.
|
|
388
|
+
*/
|
|
389
|
+
type StylePropValue<T = string> = StyleValue<T> | StyleValueStateMap<T>;
|
|
390
|
+
type CSSMap = {
|
|
391
|
+
$?: string | string[];
|
|
392
|
+
} & Record<string, string | string[]>;
|
|
393
|
+
type StyleHandlerResult = CSSMap | CSSMap[] | null | void;
|
|
394
|
+
type RawStyleHandler = (value: StyleValueStateMap) => StyleHandlerResult;
|
|
395
|
+
type StyleHandler = RawStyleHandler & {
|
|
396
|
+
__lookupStyles: string[];
|
|
397
|
+
};
|
|
398
|
+
/**
|
|
399
|
+
* Handler definition forms for configure() and plugins.
|
|
400
|
+
* - Function only: lookup styles inferred from key name
|
|
401
|
+
* - Single property tuple: ['styleName', handler]
|
|
402
|
+
* - Multi-property tuple: [['style1', 'style2'], handler]
|
|
403
|
+
*/
|
|
404
|
+
type StyleHandlerDefinition = RawStyleHandler | [string, RawStyleHandler] | [string[], RawStyleHandler];
|
|
405
|
+
interface ParsedColor {
|
|
406
|
+
color?: string;
|
|
407
|
+
name?: string;
|
|
408
|
+
opacity?: number;
|
|
409
|
+
}
|
|
410
|
+
type StyleMap = Record<string, StyleValue | StyleValueStateMap>;
|
|
411
|
+
declare const CUSTOM_UNITS: {
|
|
412
|
+
r: string;
|
|
413
|
+
cr: string;
|
|
414
|
+
bw: string;
|
|
415
|
+
ow: string;
|
|
416
|
+
x: string;
|
|
417
|
+
sf: (num: number) => string;
|
|
418
|
+
};
|
|
419
|
+
declare const DIRECTIONS: string[];
|
|
420
|
+
declare function customFunc(name: string, fn: (groups: StyleDetails[]) => string): void;
|
|
421
|
+
/**
|
|
422
|
+
* Get the global StyleParser instance.
|
|
423
|
+
* Used by configure() to apply parser configuration.
|
|
424
|
+
*/
|
|
425
|
+
declare function getGlobalParser(): StyleParser;
|
|
426
|
+
/**
|
|
427
|
+
* Get the current custom functions registry.
|
|
428
|
+
* Used by configure() to merge with new functions.
|
|
429
|
+
*/
|
|
430
|
+
declare function getGlobalFuncs(): Record<string, (groups: StyleDetails[]) => string>;
|
|
431
|
+
/**
|
|
432
|
+
* Set global predefined tokens.
|
|
433
|
+
* Called from configure() after processing token values.
|
|
434
|
+
* Merges with existing tokens (new tokens override existing ones with same key).
|
|
435
|
+
* Keys are normalized to lowercase (parser lowercases input before classification).
|
|
436
|
+
* @internal
|
|
437
|
+
*/
|
|
438
|
+
declare function setGlobalPredefinedTokens(tokens: Record<string, string>): void;
|
|
439
|
+
/**
|
|
440
|
+
* Get the current global predefined tokens.
|
|
441
|
+
* Returns null if no tokens are configured.
|
|
442
|
+
*/
|
|
443
|
+
declare function getGlobalPredefinedTokens(): Record<string, string> | null;
|
|
444
|
+
/**
|
|
445
|
+
* Reset global predefined tokens.
|
|
446
|
+
* Used for testing.
|
|
447
|
+
* @internal
|
|
448
|
+
*/
|
|
449
|
+
declare function resetGlobalPredefinedTokens(): void;
|
|
450
|
+
/**
|
|
451
|
+
*
|
|
452
|
+
* @param {String} value
|
|
453
|
+
* @param {Number} mode
|
|
454
|
+
* @returns {Object<String,String|Array>}
|
|
455
|
+
*/
|
|
456
|
+
declare function parseStyle(value: StyleValue): ProcessedStyle;
|
|
457
|
+
/**
|
|
458
|
+
* Parse color. Find it value, name and opacity.
|
|
459
|
+
* Optimized to avoid heavy parseStyle calls for simple color patterns.
|
|
460
|
+
*/
|
|
461
|
+
declare function parseColor(val: string, ignoreError?: boolean): ParsedColor;
|
|
462
|
+
declare function filterMods(mods: string[], allowedMods: string[]): string[];
|
|
463
|
+
declare function stringifyStyles(styles: unknown): string;
|
|
464
|
+
//#endregion
|
|
5
465
|
//#region src/styles/types.d.ts
|
|
6
466
|
/**
|
|
7
467
|
* Extensible interface for named color tokens.
|
|
@@ -560,5 +1020,241 @@ type ConfigTokenValue = string | number | boolean | Record<string, string | numb
|
|
|
560
1020
|
*/
|
|
561
1021
|
type ConfigTokens = Record<`$${string}` | `#${string}`, ConfigTokenValue>;
|
|
562
1022
|
//#endregion
|
|
563
|
-
|
|
564
|
-
|
|
1023
|
+
//#region src/pipeline/conditions.d.ts
|
|
1024
|
+
/**
|
|
1025
|
+
* ConditionNode Types and Helpers
|
|
1026
|
+
*
|
|
1027
|
+
* Core data structures for representing style conditions as an abstract syntax tree.
|
|
1028
|
+
* Used throughout the pipeline for parsing, simplification, and CSS generation.
|
|
1029
|
+
*/
|
|
1030
|
+
/**
|
|
1031
|
+
* Base interface for all state conditions (leaf nodes)
|
|
1032
|
+
*/
|
|
1033
|
+
interface BaseStateCondition {
|
|
1034
|
+
kind: 'state';
|
|
1035
|
+
negated: boolean;
|
|
1036
|
+
raw: string;
|
|
1037
|
+
uniqueId: string;
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Modifier condition: [data-attr] or [data-attr="value"]
|
|
1041
|
+
*/
|
|
1042
|
+
interface ModifierCondition extends BaseStateCondition {
|
|
1043
|
+
type: 'modifier';
|
|
1044
|
+
attribute: string;
|
|
1045
|
+
value?: string;
|
|
1046
|
+
operator?: '=' | '^=' | '$=' | '*=';
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* Pseudo-class condition: :hover, :focus-visible
|
|
1050
|
+
*/
|
|
1051
|
+
interface PseudoCondition extends BaseStateCondition {
|
|
1052
|
+
type: 'pseudo';
|
|
1053
|
+
pseudo: string;
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Numeric bound for dimension queries
|
|
1057
|
+
*/
|
|
1058
|
+
interface NumericBound {
|
|
1059
|
+
value: string;
|
|
1060
|
+
valueNumeric: number | null;
|
|
1061
|
+
inclusive: boolean;
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Media query condition
|
|
1065
|
+
*/
|
|
1066
|
+
interface MediaCondition extends BaseStateCondition {
|
|
1067
|
+
type: 'media';
|
|
1068
|
+
subtype: 'dimension' | 'feature' | 'type';
|
|
1069
|
+
dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
|
|
1070
|
+
lowerBound?: NumericBound;
|
|
1071
|
+
upperBound?: NumericBound;
|
|
1072
|
+
feature?: string;
|
|
1073
|
+
featureValue?: string;
|
|
1074
|
+
mediaType?: 'print' | 'screen' | 'all' | 'speech';
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Container query condition
|
|
1078
|
+
*/
|
|
1079
|
+
interface ContainerCondition extends BaseStateCondition {
|
|
1080
|
+
type: 'container';
|
|
1081
|
+
subtype: 'dimension' | 'style' | 'raw';
|
|
1082
|
+
containerName?: string;
|
|
1083
|
+
dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
|
|
1084
|
+
lowerBound?: NumericBound;
|
|
1085
|
+
upperBound?: NumericBound;
|
|
1086
|
+
property?: string;
|
|
1087
|
+
propertyValue?: string;
|
|
1088
|
+
rawCondition?: string;
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* Root state condition: @root(theme=dark)
|
|
1092
|
+
*/
|
|
1093
|
+
interface RootCondition extends BaseStateCondition {
|
|
1094
|
+
type: 'root';
|
|
1095
|
+
innerCondition: ConditionNode;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Parent state condition: @parent(hovered), @parent(theme=dark, >)
|
|
1099
|
+
*/
|
|
1100
|
+
interface ParentCondition extends BaseStateCondition {
|
|
1101
|
+
type: 'parent';
|
|
1102
|
+
innerCondition: ConditionNode;
|
|
1103
|
+
direct: boolean;
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Own state condition: @own(hovered)
|
|
1107
|
+
*/
|
|
1108
|
+
interface OwnCondition extends BaseStateCondition {
|
|
1109
|
+
type: 'own';
|
|
1110
|
+
innerCondition: ConditionNode;
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Starting style condition: @starting
|
|
1114
|
+
*/
|
|
1115
|
+
interface StartingCondition extends BaseStateCondition {
|
|
1116
|
+
type: 'starting';
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Supports query condition: @supports(display: grid), @supports($, :has(*))
|
|
1120
|
+
*/
|
|
1121
|
+
interface SupportsCondition extends BaseStateCondition {
|
|
1122
|
+
type: 'supports';
|
|
1123
|
+
subtype: 'feature' | 'selector';
|
|
1124
|
+
condition: string;
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Union of all state condition types
|
|
1128
|
+
*/
|
|
1129
|
+
type StateCondition = ModifierCondition | PseudoCondition | MediaCondition | ContainerCondition | RootCondition | ParentCondition | OwnCondition | StartingCondition | SupportsCondition;
|
|
1130
|
+
/**
|
|
1131
|
+
* Compound node: combines conditions with AND/OR
|
|
1132
|
+
*/
|
|
1133
|
+
interface CompoundCondition {
|
|
1134
|
+
kind: 'compound';
|
|
1135
|
+
operator: 'AND' | 'OR';
|
|
1136
|
+
children: ConditionNode[];
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* True condition (matches everything)
|
|
1140
|
+
*/
|
|
1141
|
+
interface TrueCondition {
|
|
1142
|
+
kind: 'true';
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* False condition (matches nothing - skip this rule)
|
|
1146
|
+
*/
|
|
1147
|
+
interface FalseCondition {
|
|
1148
|
+
kind: 'false';
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Union of all condition node types
|
|
1152
|
+
*/
|
|
1153
|
+
type ConditionNode = StateCondition | CompoundCondition | TrueCondition | FalseCondition;
|
|
1154
|
+
//#endregion
|
|
1155
|
+
//#region src/states/index.d.ts
|
|
1156
|
+
/**
|
|
1157
|
+
* Parsed advanced state information
|
|
1158
|
+
*/
|
|
1159
|
+
interface ParsedAdvancedState {
|
|
1160
|
+
type: 'media' | 'container' | 'root' | 'parent' | 'own' | 'starting' | 'predefined' | 'modifier';
|
|
1161
|
+
condition: string;
|
|
1162
|
+
containerName?: string;
|
|
1163
|
+
raw: string;
|
|
1164
|
+
mediaType?: string;
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* Context for state parsing operations
|
|
1168
|
+
*/
|
|
1169
|
+
interface StateParserContext {
|
|
1170
|
+
localPredefinedStates: Record<string, string>;
|
|
1171
|
+
globalPredefinedStates: Record<string, string>;
|
|
1172
|
+
isSubElement?: boolean;
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* At-rule context for CSS generation
|
|
1176
|
+
*/
|
|
1177
|
+
interface AtRuleContext {
|
|
1178
|
+
media?: string[];
|
|
1179
|
+
container?: {
|
|
1180
|
+
name?: string;
|
|
1181
|
+
condition: string;
|
|
1182
|
+
}[];
|
|
1183
|
+
startingStyle?: boolean;
|
|
1184
|
+
rootStates?: string[];
|
|
1185
|
+
negatedRootStates?: string[];
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Configure global predefined states
|
|
1189
|
+
*/
|
|
1190
|
+
declare function setGlobalPredefinedStates(states: Record<string, string>): void;
|
|
1191
|
+
/**
|
|
1192
|
+
* Get global predefined states
|
|
1193
|
+
*/
|
|
1194
|
+
declare function getGlobalPredefinedStates(): Record<string, string>;
|
|
1195
|
+
/**
|
|
1196
|
+
* Create a state parser context from styles
|
|
1197
|
+
*/
|
|
1198
|
+
declare function createStateParserContext(styles?: Styles, isSubElement?: boolean): StateParserContext;
|
|
1199
|
+
//#endregion
|
|
1200
|
+
//#region src/pipeline/parseStateKey.d.ts
|
|
1201
|
+
interface ParseStateKeyOptions {
|
|
1202
|
+
context?: StateParserContext;
|
|
1203
|
+
isSubElement?: boolean;
|
|
1204
|
+
}
|
|
1205
|
+
/**
|
|
1206
|
+
* Parse a state key string into a ConditionNode
|
|
1207
|
+
*/
|
|
1208
|
+
declare function parseStateKey(stateKey: string, options?: ParseStateKeyOptions): ConditionNode;
|
|
1209
|
+
//#endregion
|
|
1210
|
+
//#region src/pipeline/index.d.ts
|
|
1211
|
+
/**
|
|
1212
|
+
* Matches the old StyleResult interface for backward compatibility
|
|
1213
|
+
*/
|
|
1214
|
+
interface StyleResult {
|
|
1215
|
+
selector: string;
|
|
1216
|
+
declarations: string;
|
|
1217
|
+
atRules?: string[];
|
|
1218
|
+
needsClassName?: boolean;
|
|
1219
|
+
rootPrefix?: string;
|
|
1220
|
+
/** When true, declarations are wrapped in @starting-style { ... } inside the selector rule */
|
|
1221
|
+
startingStyle?: boolean;
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* Matches the old RenderResult interface for backward compatibility
|
|
1225
|
+
*/
|
|
1226
|
+
interface RenderResult {
|
|
1227
|
+
rules: StyleResult[];
|
|
1228
|
+
className?: string;
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Check if a key is a CSS selector
|
|
1232
|
+
*/
|
|
1233
|
+
declare function isSelector(key: string): boolean;
|
|
1234
|
+
/**
|
|
1235
|
+
* Options for renderStyles when using direct selector mode.
|
|
1236
|
+
*/
|
|
1237
|
+
interface RenderStylesOptions {
|
|
1238
|
+
/**
|
|
1239
|
+
* Whether to double the class selector for increased specificity.
|
|
1240
|
+
* When true, `.myClass` becomes `.myClass.myClass` for higher specificity.
|
|
1241
|
+
*
|
|
1242
|
+
* @default false - User-provided selectors are not doubled.
|
|
1243
|
+
*
|
|
1244
|
+
* Note: This only applies when a classNameOrSelector is provided.
|
|
1245
|
+
* When renderStyles returns RenderResult with needsClassName=true,
|
|
1246
|
+
* the injector handles doubling automatically.
|
|
1247
|
+
*/
|
|
1248
|
+
doubleSelector?: boolean;
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Render styles to CSS rules.
|
|
1252
|
+
*
|
|
1253
|
+
* When called without classNameOrSelector, returns RenderResult with needsClassName=true.
|
|
1254
|
+
* When called with a selector/className string, returns StyleResult[] for direct injection.
|
|
1255
|
+
*/
|
|
1256
|
+
declare function renderStyles(styles?: Styles, classNameOrSelector?: undefined, options?: undefined, pipelineCacheKey?: string): RenderResult;
|
|
1257
|
+
declare function renderStyles(styles: Styles | undefined, classNameOrSelector: string, options?: RenderStylesOptions): StyleResult[];
|
|
1258
|
+
//#endregion
|
|
1259
|
+
export { strToRgb as $, RawStyleHandler as A, getGlobalFuncs as B, SuffixForSelector as C, RootRegistry as Ct, CUSTOM_UNITS as D, StyleRule as Dt, CSSMap as E, StyleInjectorConfig as Et, StylePropValue as F, parseStyle as G, getGlobalPredefinedTokens as H, StyleValue as I, stringifyStyles as J, resetGlobalPredefinedTokens as K, StyleValueStateMap as L, StyleHandlerDefinition as M, StyleHandlerResult as N, DIRECTIONS as O, StyleUsage as Ot, StyleMap as P, hslToRgbValues as Q, customFunc as R, StylesWithoutSelectors as S, RawCSSResult as St, TastyPresetNames as T, SheetInfo as Tt, normalizeColorTokenValue as U, getGlobalParser as V, parseColor as W, getRgbValuesFromRgbaString as X, getNamedColorHex as Y, hexToRgb as Z, NotSelector as _, KeyframesCacheEntry as _t, ParseStateKeyOptions as a, StyleDetailsPart as at, Styles as b, KeyframesSteps as bt, ParsedAdvancedState as c, CacheMetrics as ct, getGlobalPredefinedStates as d, FontFaceDescriptors as dt, StyleParser as et, setGlobalPredefinedStates as f, FontFaceInput as ft, NoType as g, InjectResult as gt, ConfigTokens as h, GlobalInjectResult as ht, renderStyles as i, StyleDetails as it, StyleHandler as j, ParsedColor as k, StateParserContext as l, CounterStyleDescriptors as lt, ConfigTokenValue as m, GCOptions as mt, StyleResult as n, ParserOptions as nt, parseStateKey as o, UnitHandler as ot, ConditionNode as p, GCConfig as pt, setGlobalPredefinedTokens as q, isSelector as r, ProcessedStyle as rt, AtRuleContext as s, CSSProperties as st, RenderResult as t, Bucket as tt, createStateParserContext as u, DisposeFunction as ut, RecipeStyles as v, KeyframesInfo as vt, TastyNamedColors as w, RuleInfo as wt, StylesInterface as x, PropertyDefinition as xt, Selector as y, KeyframesResult as yt, filterMods as z };
|
|
1260
|
+
//# sourceMappingURL=index-PzENbpAq.d.ts.map
|