@tenphi/tasty 2.0.3 → 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/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 -389
- package/dist/pipeline/exclusive.js.map +0 -1
- package/dist/pipeline/index.d.ts +0 -55
- package/dist/pipeline/index.js +0 -749
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/materialize-contradictions.js +0 -125
- package/dist/pipeline/materialize-contradictions.js.map +0 -1
- package/dist/pipeline/materialize.js +0 -1038
- 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 -725
- 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
package/dist/config.d.ts
DELETED
|
@@ -1,407 +0,0 @@
|
|
|
1
|
-
import { CounterStyleDescriptors, FontFaceInput, GCConfig, KeyframesSteps, PropertyDefinition } from "./injector/types.js";
|
|
2
|
-
import { StyleDetails, UnitHandler } from "./parser/types.js";
|
|
3
|
-
import { StyleHandlerDefinition } from "./utils/styles.js";
|
|
4
|
-
import { ConfigTokens, RecipeStyles, Styles } from "./styles/types.js";
|
|
5
|
-
import { StyleInjector } from "./injector/injector.js";
|
|
6
|
-
import { ColorSpace } from "./utils/color-space.js";
|
|
7
|
-
import { TypographyPreset } from "./utils/typography.js";
|
|
8
|
-
import { TastyPlugin } from "./plugins/types.js";
|
|
9
|
-
|
|
10
|
-
//#region src/config.d.ts
|
|
11
|
-
/**
|
|
12
|
-
* Configuration options for the Tasty style system
|
|
13
|
-
*/
|
|
14
|
-
interface TastyConfig {
|
|
15
|
-
/** CSP nonce for style elements */
|
|
16
|
-
nonce?: string;
|
|
17
|
-
/** Maximum rules per stylesheet (default: 8192) */
|
|
18
|
-
maxRulesPerSheet?: number;
|
|
19
|
-
/** Force text injection mode, auto-detected in test environments (default: auto) */
|
|
20
|
-
forceTextInjection?: boolean;
|
|
21
|
-
/** Enable development mode features: performance metrics and debug info (default: auto) */
|
|
22
|
-
devMode?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Global predefined states for advanced state mapping.
|
|
25
|
-
* These are state aliases that can be used in any component.
|
|
26
|
-
* Example: { '@mobile': '@media(w < 920px)', '@dark': '@root(theme=dark)' }
|
|
27
|
-
*/
|
|
28
|
-
states?: Record<string, string>;
|
|
29
|
-
/**
|
|
30
|
-
* Parser LRU cache size (default: 1000).
|
|
31
|
-
* Larger values improve performance for apps with many unique style values.
|
|
32
|
-
*/
|
|
33
|
-
parserCacheSize?: number;
|
|
34
|
-
/**
|
|
35
|
-
* Custom units for the style parser (merged with built-in units).
|
|
36
|
-
* Units transform numeric values like `2x` → `calc(2 * var(--gap))`.
|
|
37
|
-
* @example { em: 'em', vw: 'vw', custom: (n) => `${n * 10}px` }
|
|
38
|
-
*/
|
|
39
|
-
units?: Record<string, string | UnitHandler>;
|
|
40
|
-
/**
|
|
41
|
-
* Custom functions for the style parser (merged with existing).
|
|
42
|
-
* Functions process parsed style groups and return CSS values.
|
|
43
|
-
* @example { myFunc: (groups) => groups.map(g => g.output).join(' ') }
|
|
44
|
-
*/
|
|
45
|
-
funcs?: Record<string, (groups: StyleDetails[]) => string>;
|
|
46
|
-
/**
|
|
47
|
-
* Color space used for decomposed color token companion variables.
|
|
48
|
-
* Controls the CSS function and suffix for alpha composition.
|
|
49
|
-
*
|
|
50
|
-
* - `'rgb'` — suffix `-rgb`, e.g. `rgb(var(--name-color-rgb) / .5)`
|
|
51
|
-
* - `'hsl'` — suffix `-hsl`, e.g. `hsl(var(--name-color-hsl) / .5)`
|
|
52
|
-
* - `'oklch'` — suffix `-oklch`, e.g. `oklch(var(--name-color-oklch) / .5)`
|
|
53
|
-
*
|
|
54
|
-
* @default 'oklch'
|
|
55
|
-
*/
|
|
56
|
-
colorSpace?: ColorSpace;
|
|
57
|
-
/**
|
|
58
|
-
* Automatically infer and register CSS @property declarations
|
|
59
|
-
* from custom property values found in styles, keyframes, and global config.
|
|
60
|
-
* Covers all types: \<color\>, \<number\>, \<length\>, \<angle\>, \<percentage\>, \<time\>.
|
|
61
|
-
* When false, only explicitly declared @properties are registered.
|
|
62
|
-
* @default true
|
|
63
|
-
*/
|
|
64
|
-
autoPropertyTypes?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Garbage collection configuration for unused styles.
|
|
67
|
-
* GC is triggered by touch count: every `touchInterval` touches, the
|
|
68
|
-
* oldest unused styles are evicted when their count exceeds `capacity`.
|
|
69
|
-
* @example
|
|
70
|
-
* ```ts
|
|
71
|
-
* configure({
|
|
72
|
-
* gc: { touchInterval: 1000, capacity: 1000 },
|
|
73
|
-
* });
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
gc?: GCConfig;
|
|
77
|
-
/**
|
|
78
|
-
* Plugins that extend tasty with custom functions, units, or states.
|
|
79
|
-
* Plugins are processed in order, with later plugins overriding earlier ones.
|
|
80
|
-
* @example
|
|
81
|
-
* ```ts
|
|
82
|
-
* import { okhslPlugin } from '@tenphi/tasty';
|
|
83
|
-
*
|
|
84
|
-
* configure({
|
|
85
|
-
* plugins: [okhslPlugin()],
|
|
86
|
-
* });
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
plugins?: TastyPlugin[];
|
|
90
|
-
/**
|
|
91
|
-
* Global keyframes definitions that can be referenced by animation names in styles.
|
|
92
|
-
* Keys are animation names, values are keyframes step definitions.
|
|
93
|
-
* Keyframes are only injected when actually used in styles.
|
|
94
|
-
* @example
|
|
95
|
-
* ```ts
|
|
96
|
-
* configure({
|
|
97
|
-
* keyframes: {
|
|
98
|
-
* fadeIn: { from: { opacity: 0 }, to: { opacity: 1 } },
|
|
99
|
-
* pulse: { '0%, 100%': { transform: 'scale(1)' }, '50%': { transform: 'scale(1.05)' } },
|
|
100
|
-
* },
|
|
101
|
-
* });
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
keyframes?: Record<string, KeyframesSteps>;
|
|
105
|
-
/**
|
|
106
|
-
* Global CSS @property definitions for custom properties.
|
|
107
|
-
* Keys use tasty token syntax ($name for properties, #name for colors).
|
|
108
|
-
*
|
|
109
|
-
* Tasty ships with `DEFAULT_PROPERTIES` (e.g. `$gap`, `$radius`, `#white`,
|
|
110
|
-
* `#black`, `#clear`, `#border`, etc.) that are always included.
|
|
111
|
-
* Properties you specify here are merged on top, so you can override any
|
|
112
|
-
* default by using the same key.
|
|
113
|
-
*
|
|
114
|
-
* For color tokens (#name), `syntax: '<color>'` is auto-set and
|
|
115
|
-
* `initialValue` defaults to `'transparent'` if not specified.
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```ts
|
|
119
|
-
* configure({
|
|
120
|
-
* properties: {
|
|
121
|
-
* '$rotation': { syntax: '<angle>', initialValue: '0deg' },
|
|
122
|
-
* '$scale': { syntax: '<number>', inherits: false, initialValue: 1 },
|
|
123
|
-
* '#accent': { initialValue: 'purple' }, // syntax: '<color>' auto-set
|
|
124
|
-
* // Override a default property:
|
|
125
|
-
* '$gap': { syntax: '<length>', inherits: true, initialValue: '8px' },
|
|
126
|
-
* },
|
|
127
|
-
* });
|
|
128
|
-
*
|
|
129
|
-
* // Now use in styles - properties are registered when component renders:
|
|
130
|
-
* const Spinner = tasty({
|
|
131
|
-
* styles: {
|
|
132
|
-
* transform: 'rotate($rotation)',
|
|
133
|
-
* transition: '$$rotation 0.3s', // outputs: --rotation 0.3s
|
|
134
|
-
* },
|
|
135
|
-
* });
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
properties?: Record<string, PropertyDefinition>;
|
|
139
|
-
/**
|
|
140
|
-
* Global @font-face definitions.
|
|
141
|
-
* Keys are font-family names, values are descriptors or arrays of descriptors
|
|
142
|
-
* (for multiple weights/styles of the same family).
|
|
143
|
-
* Injected eagerly when styles are first generated.
|
|
144
|
-
* @example
|
|
145
|
-
* ```ts
|
|
146
|
-
* configure({
|
|
147
|
-
* fontFace: {
|
|
148
|
-
* 'Brand Sans': [
|
|
149
|
-
* { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
|
|
150
|
-
* { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
|
|
151
|
-
* ],
|
|
152
|
-
* Icons: { src: 'url("/fonts/icons.woff2") format("woff2")', fontDisplay: 'block' },
|
|
153
|
-
* },
|
|
154
|
-
* });
|
|
155
|
-
* ```
|
|
156
|
-
*/
|
|
157
|
-
fontFace?: Record<string, FontFaceInput>;
|
|
158
|
-
/**
|
|
159
|
-
* Global @counter-style definitions.
|
|
160
|
-
* Keys are counter-style names, values are descriptor objects.
|
|
161
|
-
* Injected eagerly when styles are first generated.
|
|
162
|
-
* @example
|
|
163
|
-
* ```ts
|
|
164
|
-
* configure({
|
|
165
|
-
* counterStyle: {
|
|
166
|
-
* thumbs: { system: 'cyclic', symbols: '"👍"', suffix: '" "' },
|
|
167
|
-
* },
|
|
168
|
-
* });
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
counterStyle?: Record<string, CounterStyleDescriptors>;
|
|
172
|
-
/**
|
|
173
|
-
* Custom style handlers that transform style properties into CSS declarations.
|
|
174
|
-
* Handlers replace built-in handlers for the same style name.
|
|
175
|
-
* @example
|
|
176
|
-
* ```ts
|
|
177
|
-
* import { styleHandlers } from '@tenphi/tasty';
|
|
178
|
-
*
|
|
179
|
-
* configure({
|
|
180
|
-
* handlers: {
|
|
181
|
-
* // Override fill with custom behavior
|
|
182
|
-
* fill: ({ fill }) => {
|
|
183
|
-
* if (fill?.startsWith('gradient:')) {
|
|
184
|
-
* return { background: fill.slice(9) };
|
|
185
|
-
* }
|
|
186
|
-
* return styleHandlers.fill({ fill });
|
|
187
|
-
* },
|
|
188
|
-
* // Add new custom style
|
|
189
|
-
* elevation: ({ elevation }) => {
|
|
190
|
-
* const level = parseInt(elevation) || 1;
|
|
191
|
-
* return {
|
|
192
|
-
* 'box-shadow': `0 ${level * 2}px ${level * 4}px rgba(0,0,0,0.1)`,
|
|
193
|
-
* 'z-index': String(level * 100),
|
|
194
|
-
* };
|
|
195
|
-
* },
|
|
196
|
-
* },
|
|
197
|
-
* });
|
|
198
|
-
* ```
|
|
199
|
-
*/
|
|
200
|
-
handlers?: Record<string, StyleHandlerDefinition>;
|
|
201
|
-
/**
|
|
202
|
-
* Design tokens injected as CSS custom properties on `:root`.
|
|
203
|
-
* Values are parsed through the Tasty DSL. Supports state maps
|
|
204
|
-
* for responsive/theme-aware tokens.
|
|
205
|
-
*
|
|
206
|
-
* - `$name` keys become `--name` CSS custom properties
|
|
207
|
-
* - `#name` keys become `--name-color` and `--name-color-{colorSpace}` properties
|
|
208
|
-
*
|
|
209
|
-
* Tokens are injected once when the first style is rendered.
|
|
210
|
-
*
|
|
211
|
-
* @example
|
|
212
|
-
* ```ts
|
|
213
|
-
* configure({
|
|
214
|
-
* tokens: {
|
|
215
|
-
* '$gap': '4px',
|
|
216
|
-
* '#primary': {
|
|
217
|
-
* '': '#purple',
|
|
218
|
-
* '@dark': '#light-purple',
|
|
219
|
-
* },
|
|
220
|
-
* },
|
|
221
|
-
* });
|
|
222
|
-
* ```
|
|
223
|
-
*/
|
|
224
|
-
tokens?: ConfigTokens;
|
|
225
|
-
/**
|
|
226
|
-
* Predefined tokens that are replaced during style parsing (parse-time substitution).
|
|
227
|
-
* Use `$name` for custom properties and `#name` for color tokens.
|
|
228
|
-
* Values are substituted inline before CSS generation, unlike `tokens` which
|
|
229
|
-
* inject CSS custom properties on `:root`.
|
|
230
|
-
*
|
|
231
|
-
* For color tokens (#name), boolean `true` is converted to `transparent`.
|
|
232
|
-
*
|
|
233
|
-
* @example
|
|
234
|
-
* ```ts
|
|
235
|
-
* configure({
|
|
236
|
-
* replaceTokens: {
|
|
237
|
-
* $spacing: '2x',
|
|
238
|
-
* '#accent': '#purple',
|
|
239
|
-
* '#overlay': true, // → transparent
|
|
240
|
-
* },
|
|
241
|
-
* });
|
|
242
|
-
*
|
|
243
|
-
* // Now use in styles - tokens are replaced at parse time:
|
|
244
|
-
* const Card = tasty({
|
|
245
|
-
* styles: {
|
|
246
|
-
* padding: '$spacing', // → calc(2 * var(--gap))
|
|
247
|
-
* fill: '#accent', // → var(--purple-color)
|
|
248
|
-
* },
|
|
249
|
-
* });
|
|
250
|
-
* ```
|
|
251
|
-
*/
|
|
252
|
-
replaceTokens?: Record<`$${string}`, string | number | boolean> & Record<`#${string}`, string | number | boolean>;
|
|
253
|
-
/**
|
|
254
|
-
* Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
|
|
255
|
-
* Recipe values are flat tasty styles (no sub-element keys). They may contain base styles,
|
|
256
|
-
* tokens (`$name`/`#name` definitions), local states, `@keyframes`, and `@properties`.
|
|
257
|
-
*
|
|
258
|
-
* Components reference recipes via: `recipe: 'name1 name2'` in their styles.
|
|
259
|
-
* Use `/` to separate base recipes from post recipes: `recipe: 'base1 base2 / post1'`.
|
|
260
|
-
* Use `none` to skip base recipes: `recipe: 'none / post1'`.
|
|
261
|
-
* Resolution order: `base_recipes → component styles → post_recipes`.
|
|
262
|
-
*
|
|
263
|
-
* Recipes cannot reference other recipes.
|
|
264
|
-
*
|
|
265
|
-
* @example
|
|
266
|
-
* ```ts
|
|
267
|
-
* configure({
|
|
268
|
-
* recipes: {
|
|
269
|
-
* card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
|
|
270
|
-
* elevated: { shadow: '2x 2x 4x #shadow' },
|
|
271
|
-
* },
|
|
272
|
-
* });
|
|
273
|
-
*
|
|
274
|
-
* // Usage in styles:
|
|
275
|
-
* const Card = tasty({
|
|
276
|
-
* styles: {
|
|
277
|
-
* recipe: 'card elevated',
|
|
278
|
-
* color: '#text', // Overrides recipe values
|
|
279
|
-
* },
|
|
280
|
-
* });
|
|
281
|
-
* ```
|
|
282
|
-
*/
|
|
283
|
-
recipes?: Record<string, RecipeStyles>;
|
|
284
|
-
/**
|
|
285
|
-
* Typography presets — shorthand for `generateTypographyTokens()`.
|
|
286
|
-
* Accepts the same input and internally generates typography tokens
|
|
287
|
-
* that are merged into `tokens`. Explicit `tokens` override preset-generated ones.
|
|
288
|
-
*
|
|
289
|
-
* @example
|
|
290
|
-
* ```ts
|
|
291
|
-
* configure({
|
|
292
|
-
* presets: {
|
|
293
|
-
* h1: { fontSize: '32px', lineHeight: '1.2', fontWeight: '700' },
|
|
294
|
-
* t2: { fontSize: '16px', lineHeight: '1.5', fontWeight: '400' },
|
|
295
|
-
* },
|
|
296
|
-
* tokens: {
|
|
297
|
-
* // Overrides the preset-generated $t2-font-weight
|
|
298
|
-
* '$t2-font-weight': { '': '400', '@dark': '300' },
|
|
299
|
-
* },
|
|
300
|
-
* });
|
|
301
|
-
* ```
|
|
302
|
-
*/
|
|
303
|
-
presets?: Record<string, TypographyPreset>;
|
|
304
|
-
/**
|
|
305
|
-
* Global Tasty styles keyed by CSS selector.
|
|
306
|
-
* Each entry applies the full Tasty style syntax (style properties,
|
|
307
|
-
* tokens, state maps, selector-based sub-styling) to the given selector.
|
|
308
|
-
* Injected alongside `:root` tokens when the first style is rendered.
|
|
309
|
-
*
|
|
310
|
-
* @example
|
|
311
|
-
* ```ts
|
|
312
|
-
* configure({
|
|
313
|
-
* globalStyles: {
|
|
314
|
-
* body: { fill: '#surface', color: '#text', preset: 't2', margin: 0 },
|
|
315
|
-
* html: { overflow: 'hidden' },
|
|
316
|
-
* },
|
|
317
|
-
* });
|
|
318
|
-
* ```
|
|
319
|
-
*/
|
|
320
|
-
globalStyles?: Record<string, Styles>;
|
|
321
|
-
}
|
|
322
|
-
declare const GLOBAL_INJECTOR_KEY = "__TASTY_GLOBAL_INJECTOR__";
|
|
323
|
-
declare global {
|
|
324
|
-
interface Window {
|
|
325
|
-
[GLOBAL_INJECTOR_KEY]?: StyleInjector;
|
|
326
|
-
}
|
|
327
|
-
var __TASTY_GLOBAL_INJECTOR__: StyleInjector | undefined;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Detect if we're running in a test environment
|
|
331
|
-
*/
|
|
332
|
-
declare function isTestEnvironment(): boolean;
|
|
333
|
-
/**
|
|
334
|
-
* Check if styles have been generated (configuration is locked)
|
|
335
|
-
*/
|
|
336
|
-
declare function hasStylesGenerated(): boolean;
|
|
337
|
-
/**
|
|
338
|
-
* Check if any global keyframes are configured.
|
|
339
|
-
* Uses a pre-computed flag to avoid Object.keys() allocation on every call.
|
|
340
|
-
*/
|
|
341
|
-
declare function hasGlobalKeyframes(): boolean;
|
|
342
|
-
/**
|
|
343
|
-
* Get global keyframes configuration.
|
|
344
|
-
* Returns null if no keyframes configured (fast path for zero-overhead).
|
|
345
|
-
*/
|
|
346
|
-
declare function getGlobalKeyframes(): Record<string, KeyframesSteps> | null;
|
|
347
|
-
/**
|
|
348
|
-
* Get global font-face configuration.
|
|
349
|
-
* Returns null if no font faces configured.
|
|
350
|
-
* Reads from globalThis first for cross-module SSR support.
|
|
351
|
-
*/
|
|
352
|
-
declare function getGlobalFontFace(): Record<string, FontFaceInput> | null;
|
|
353
|
-
/**
|
|
354
|
-
* Get global counter-style configuration.
|
|
355
|
-
* Returns null if no counter styles configured.
|
|
356
|
-
* Reads from globalThis first for cross-module SSR support.
|
|
357
|
-
*/
|
|
358
|
-
declare function getGlobalCounterStyle(): Record<string, CounterStyleDescriptors> | null;
|
|
359
|
-
/**
|
|
360
|
-
* Check if any global recipes are configured.
|
|
361
|
-
* Fast path: returns false if no recipes were ever set.
|
|
362
|
-
*/
|
|
363
|
-
declare function hasGlobalRecipes(): boolean;
|
|
364
|
-
/**
|
|
365
|
-
* Get global recipes configuration.
|
|
366
|
-
* Returns null if no recipes configured (fast path for zero-overhead).
|
|
367
|
-
*/
|
|
368
|
-
declare function getGlobalRecipes(): Record<string, RecipeStyles> | null;
|
|
369
|
-
/**
|
|
370
|
-
* Check if configuration is locked (styles have been generated)
|
|
371
|
-
*/
|
|
372
|
-
declare function isConfigLocked(): boolean;
|
|
373
|
-
/**
|
|
374
|
-
* Configure the Tasty style system.
|
|
375
|
-
*
|
|
376
|
-
* Must be called BEFORE any styles are generated (before first render that uses tasty).
|
|
377
|
-
* After styles are generated, configuration is locked and calls to configure() will
|
|
378
|
-
* emit a warning and be ignored.
|
|
379
|
-
*
|
|
380
|
-
* @example
|
|
381
|
-
* ```ts
|
|
382
|
-
* import { configure } from '@tenphi/tasty';
|
|
383
|
-
*
|
|
384
|
-
* // Configure before app renders
|
|
385
|
-
* configure({
|
|
386
|
-
* nonce: 'abc123',
|
|
387
|
-
* states: {
|
|
388
|
-
* '@mobile': '@media(w < 768px)',
|
|
389
|
-
* '@dark': '@root(theme=dark)',
|
|
390
|
-
* },
|
|
391
|
-
* });
|
|
392
|
-
* ```
|
|
393
|
-
*/
|
|
394
|
-
declare function configure(config?: Partial<TastyConfig>): void;
|
|
395
|
-
/**
|
|
396
|
-
* Get the current configuration.
|
|
397
|
-
* If not configured, returns default configuration.
|
|
398
|
-
*/
|
|
399
|
-
declare function getConfig(): TastyConfig;
|
|
400
|
-
/**
|
|
401
|
-
* Reset configuration (for testing only).
|
|
402
|
-
* Clears the global injector and allows reconfiguration.
|
|
403
|
-
*/
|
|
404
|
-
declare function resetConfig(): void;
|
|
405
|
-
//#endregion
|
|
406
|
-
export { TastyConfig, configure, getConfig, getGlobalCounterStyle, getGlobalFontFace, getGlobalKeyframes, getGlobalRecipes, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, isConfigLocked, isTestEnvironment, resetConfig };
|
|
407
|
-
//# sourceMappingURL=config.d.ts.map
|