@tenphi/tasty 0.0.0-snapshot.a8b0eee → 0.0.0-snapshot.a8da86e
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/README.md +181 -136
- package/dist/babel-types-C_7kRP38.d.ts +18 -0
- package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
- package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
- package/dist/chunks/build-config-Betc6IB6.js +60 -0
- package/dist/chunks/build-config-Betc6IB6.js.map +1 -0
- package/dist/{collector-Crs9kGJW.js → chunks/collector-DqqisglQ.js} +68 -101
- package/dist/chunks/collector-DqqisglQ.js.map +1 -0
- package/dist/chunks/config-engine-BPeROwq2.js +272 -0
- package/dist/chunks/config-engine-BPeROwq2.js.map +1 -0
- package/dist/chunks/css-definitions-IeuyJTGk.js +899 -0
- package/dist/chunks/css-definitions-IeuyJTGk.js.map +1 -0
- package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
- package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
- package/dist/chunks/debug-P1E2jkj7.js +502 -0
- package/dist/chunks/debug-P1E2jkj7.js.map +1 -0
- package/dist/chunks/dsl-DRhFWQzo.js +1378 -0
- package/dist/chunks/dsl-DRhFWQzo.js.map +1 -0
- package/dist/chunks/hydration-TRcz5vnk.js +41 -0
- package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
- package/dist/chunks/react-runtime-XMBbGRes.js +582 -0
- package/dist/chunks/react-runtime-XMBbGRes.js.map +1 -0
- package/dist/chunks/runtime-engine-CsIMtulO.js +2415 -0
- package/dist/chunks/runtime-engine-CsIMtulO.js.map +1 -0
- package/dist/chunks/runtime-state-CyKzDioI.js +141 -0
- package/dist/chunks/runtime-state-CyKzDioI.js.map +1 -0
- package/dist/{merge-styles-BzQutdAK.js → chunks/shared-utils-y-HjvPN4.js} +60 -55
- package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
- package/dist/chunks/style-engine-RbokDN6A.js +5427 -0
- package/dist/chunks/style-engine-RbokDN6A.js.map +1 -0
- package/dist/{css-writer-CPy_cbFJ.js → chunks/zero-engine-DbtjMsfo.js} +81 -137
- package/dist/chunks/zero-engine-DbtjMsfo.js.map +1 -0
- package/dist/{collector-osfWTeRd.d.ts → collector-w4mBj5gd.d.ts} +64 -8
- package/dist/{config-BoZDUHW5.d.ts → config-CrZOfNJ5.d.ts} +489 -85
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +9 -6
- package/dist/{index-B_k47mc_.d.ts → index-CYJtAI9a.d.ts} +664 -399
- package/dist/index.d.ts +5 -5
- package/dist/index.js +11 -732
- package/dist/{merge-styles-BMWcH6MF.d.ts → merge-styles-VXwJ0Frr.d.ts} +2 -3
- package/dist/ssr/astro-client.d.ts +1 -1
- package/dist/ssr/astro-client.js +1 -14
- package/dist/ssr/astro-client.js.map +1 -1
- package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
- package/dist/ssr/astro-middleware-extract-static.js +9 -0
- package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
- package/dist/ssr/astro-middleware-extract.d.ts +10 -0
- package/dist/ssr/astro-middleware-extract.js +9 -0
- package/dist/ssr/astro-middleware-extract.js.map +1 -0
- package/dist/ssr/astro-middleware-static.d.ts +17 -0
- package/dist/ssr/astro-middleware-static.js +7 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +11 -8
- package/dist/ssr/astro-middleware.js +2 -14
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.d.ts +40 -10
- package/dist/ssr/astro.js +163 -91
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/index.d.ts +10 -18
- package/dist/ssr/index.js +5 -5
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +64 -0
- package/dist/ssr/next-config.js +134 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +9 -9
- package/dist/ssr/next.js +29 -44
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +8 -9
- package/dist/static/index.js +4 -22
- package/dist/static/index.js.map +1 -1
- package/dist/static/inject.d.ts +1 -2
- package/dist/static/inject.js.map +1 -1
- package/dist/{index-tcHuMPFt.d.ts → types-JEY8PVYP.d.ts} +874 -593
- package/dist/zero/babel.d.ts +5 -19
- package/dist/zero/babel.js +74 -144
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +57 -7
- package/dist/zero/index.js +24 -2
- package/dist/zero/index.js.map +1 -0
- package/dist/zero/next.d.ts +4 -5
- package/dist/zero/next.js +0 -31
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +17 -9
- package/docs/adoption.md +56 -31
- package/docs/ai-agents.md +250 -0
- package/docs/comparison.md +69 -40
- package/docs/configuration.md +487 -86
- package/docs/debug.md +26 -14
- package/docs/design-system.md +43 -24
- package/docs/dsl.md +558 -181
- package/docs/getting-started.md +64 -41
- package/docs/injector.md +120 -30
- package/docs/methodology.md +46 -40
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +87 -21
- package/docs/plugins.md +353 -0
- package/docs/react-api.md +151 -42
- package/docs/runtime-benchmarks.md +388 -0
- package/docs/ssr.md +252 -86
- package/docs/styles.md +142 -25
- package/docs/tasty-static.md +174 -106
- package/package.json +127 -35
- package/tasty.config.ts +5 -0
- package/dist/async-storage-B7_o6FKt.js +0 -44
- package/dist/async-storage-B7_o6FKt.js.map +0 -1
- package/dist/collector-Crs9kGJW.js.map +0 -1
- package/dist/config-BaxtQMS3.js +0 -10464
- package/dist/config-BaxtQMS3.js.map +0 -1
- package/dist/context-CkSg-kDT.js +0 -24
- package/dist/context-CkSg-kDT.js.map +0 -1
- package/dist/core-CmxaoZ-N.js +0 -1598
- package/dist/core-CmxaoZ-N.js.map +0 -1
- package/dist/css-writer-CPy_cbFJ.js.map +0 -1
- package/dist/format-global-rules-Dbc_1tc3.js +0 -22
- package/dist/format-global-rules-Dbc_1tc3.js.map +0 -1
- package/dist/format-rules-CPirO_Mj.js +0 -143
- package/dist/format-rules-CPirO_Mj.js.map +0 -1
- package/dist/hydrate-CVn-A_3y.js +0 -45
- package/dist/hydrate-CVn-A_3y.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/keyframes-vpzoVdUR.js +0 -588
- package/dist/keyframes-vpzoVdUR.js.map +0 -1
- package/dist/merge-styles-BzQutdAK.js.map +0 -1
- package/dist/resolve-recipes-DgH8A3Nn.js +0 -144
- package/dist/resolve-recipes-DgH8A3Nn.js.map +0 -1
|
@@ -1,8 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as ServerStyleCollector } from "./collector-
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { Et as StyleDetails, G as NoType, M as StyleResult, X as StylesInterface, Y as Styles, _ as KeyframesSteps, a as FontFaceInput, ct as StyleHandler, d as InjectOptions, dt as StyleHandlerResult, f as InjectResult, g as KeyframesResult, ht as StyleValueStateMap, i as FontFaceDescriptors, kt as CSSProperties$1, l as GCOptions, mt as StyleValue, n as CounterStyleDescriptors, nt as CSSMap, o as FunctionDefinition, ot as RawStyleHandler, pt as StylePropValue, st as ResolvedStyleValue, t as CacheMetrics, u as GlobalInjectResult, w as StyleInjectorConfig, y as PropertyOptions } from "./types-JEY8PVYP.js";
|
|
2
|
+
import { f as TastyPluginFactory, y as StyleInjector } from "./config-CrZOfNJ5.js";
|
|
3
|
+
import { t as ServerStyleCollector } from "./collector-w4mBj5gd.js";
|
|
4
|
+
import "./merge-styles-VXwJ0Frr.js";
|
|
5
|
+
import { AllHTMLAttributes, CSSProperties, ComponentType, ElementType, ForwardRefExoticComponent, JSX, PropsWithoutRef, ReactNode, RefAttributes } from "react";
|
|
6
|
+
//#region src/utils/color-math.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Consolidated color conversion math.
|
|
9
|
+
*
|
|
10
|
+
* Single source of truth for all color space conversions used across the
|
|
11
|
+
* library: sRGB gamma, HSL, OKLab, OKLCH, OKHSL, hex parsing, named
|
|
12
|
+
* colors, and CSS string converters.
|
|
13
|
+
*
|
|
14
|
+
* This module has zero internal imports — it is a leaf dependency.
|
|
15
|
+
*
|
|
16
|
+
* Reference: https://bottosson.github.io/posts/oklab/
|
|
17
|
+
*/
|
|
18
|
+
type Vec3 = [number, number, number];
|
|
19
|
+
/**
|
|
20
|
+
* HSL to RGB.
|
|
21
|
+
* Algorithm from CSS Color 4 spec.
|
|
22
|
+
*
|
|
23
|
+
* @param h - Hue in degrees (0-360)
|
|
24
|
+
* @param s - Saturation (0-1)
|
|
25
|
+
* @param l - Lightness (0-1)
|
|
26
|
+
* @returns RGB values in 0-255 range (may have fractional values)
|
|
27
|
+
*/
|
|
28
|
+
declare function hslToRgbValues(h: number, s: number, l: number): Vec3;
|
|
29
|
+
declare function getNamedColorHex(): Map<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Convert hex color string to `rgb()` CSS string.
|
|
32
|
+
* Supports 3, 4, 6, and 8 character hex values (with or without `#`).
|
|
33
|
+
*/
|
|
34
|
+
declare function hexToRgb(hex: string): string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Extract RGB values from an `rgb()`/`rgba()` string.
|
|
37
|
+
* Supports comma-separated, space-separated, fractional, percentage,
|
|
38
|
+
* and slash alpha notation.
|
|
39
|
+
*
|
|
40
|
+
* @returns Array of RGB values (0-255 range), converting percentages as needed.
|
|
41
|
+
*/
|
|
42
|
+
declare function getRgbValuesFromRgbaString(str: string): number[];
|
|
43
|
+
/**
|
|
44
|
+
* Convert any recognized color string to an `rgb()` CSS string.
|
|
45
|
+
* Handles hex, `okhsl()`, `okhst()`, `hsl()`/`hsla()`, named CSS colors,
|
|
46
|
+
* and `rgb()`/`rgba()` pass-through.
|
|
47
|
+
*/
|
|
48
|
+
declare function strToRgb(color: string, _ignoreAlpha?: boolean): string | null | undefined;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/utils/is-selector.d.ts
|
|
51
|
+
/** Check whether a style-object key identifies a nested CSS selector. */
|
|
52
|
+
declare function isSelector(key: string): boolean;
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/config-state.d.ts
|
|
55
|
+
/**
|
|
56
|
+
* Minimal configuration state shared by the style engine, zero-runtime
|
|
57
|
+
* extractor, and runtime configuration module. Keeping it independent
|
|
58
|
+
* prevents pure rendering code from importing the full injector graph.
|
|
59
|
+
*/
|
|
60
|
+
declare function hasStylesGenerated(): boolean;
|
|
61
|
+
//#endregion
|
|
6
62
|
//#region src/utils/name-prefix.d.ts
|
|
7
63
|
/**
|
|
8
64
|
* Name prefix utilities for generated identifiers.
|
|
@@ -29,89 +85,21 @@ declare const DEFAULT_NAME_PREFIX = "t";
|
|
|
29
85
|
/** Default prefix used by the zero-runtime (`tastyStatic`) build path. */
|
|
30
86
|
declare const DEFAULT_ZERO_NAME_PREFIX = "ts";
|
|
31
87
|
//#endregion
|
|
32
|
-
//#region src/plugins/okhsl-plugin.d.ts
|
|
33
|
-
/**
|
|
34
|
-
* The okhsl function handler for tasty parser.
|
|
35
|
-
* Receives parsed style groups and returns an RGB color string.
|
|
36
|
-
*/
|
|
37
|
-
declare const okhslFunc: (groups: StyleDetails[]) => string;
|
|
38
|
-
/**
|
|
39
|
-
* OKHSL Plugin for Tasty.
|
|
40
|
-
*
|
|
41
|
-
* Adds support for the `okhsl()` color function in tasty styles.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```ts
|
|
45
|
-
* import { configure } from '@tenphi/tasty';
|
|
46
|
-
* import { okhslPlugin } from '@tenphi/tasty';
|
|
47
|
-
*
|
|
48
|
-
* configure({
|
|
49
|
-
* plugins: [okhslPlugin()],
|
|
50
|
-
* });
|
|
51
|
-
*
|
|
52
|
-
* // Now you can use okhsl in styles:
|
|
53
|
-
* const Box = tasty({
|
|
54
|
-
* styles: {
|
|
55
|
-
* fill: 'okhsl(240 50% 50%)',
|
|
56
|
-
* },
|
|
57
|
-
* });
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
declare const okhslPlugin: TastyPluginFactory;
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region src/chunks/definitions.d.ts
|
|
63
|
-
declare const CHUNK_NAMES: {
|
|
64
|
-
/** Special chunk for styles that cannot be split */readonly COMBINED: "combined";
|
|
65
|
-
readonly SUBCOMPONENTS: "subcomponents";
|
|
66
|
-
readonly APPEARANCE: "appearance";
|
|
67
|
-
readonly FONT: "font";
|
|
68
|
-
readonly DIMENSION: "dimension";
|
|
69
|
-
readonly DISPLAY: "display";
|
|
70
|
-
readonly LAYOUT: "layout";
|
|
71
|
-
readonly POSITION: "position";
|
|
72
|
-
readonly MISC: "misc";
|
|
73
|
-
};
|
|
74
|
-
type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];
|
|
75
|
-
/**
|
|
76
|
-
* Pre-computed map for O(1) style-to-chunk lookup.
|
|
77
|
-
* Built once at module load time.
|
|
78
|
-
*/
|
|
79
|
-
declare const STYLE_TO_CHUNK: Map<string, ChunkName>;
|
|
80
|
-
interface ChunkInfo$1 {
|
|
81
|
-
/** Name of the chunk */
|
|
82
|
-
name: ChunkName | string;
|
|
83
|
-
/** Style keys belonging to this chunk */
|
|
84
|
-
styleKeys: string[];
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Categorize style keys into chunks.
|
|
88
|
-
*
|
|
89
|
-
* Returns chunks in a deterministic order (by CHUNK_ORDER) regardless
|
|
90
|
-
* of the order of keys in the input styles object.
|
|
91
|
-
*
|
|
92
|
-
* @param styles - The styles object to categorize
|
|
93
|
-
* @returns Map of chunk name to array of style keys in that chunk (in priority order)
|
|
94
|
-
*/
|
|
95
|
-
declare function categorizeStyleKeys(styles: Record<string, unknown>): Map<string, string[]>;
|
|
96
|
-
//#endregion
|
|
97
88
|
//#region src/styles/list.d.ts
|
|
98
89
|
declare const BASE_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition"];
|
|
99
|
-
declare const POSITION_STYLES: readonly ["gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "inset", "position", "scrollMargin"];
|
|
100
|
-
declare const BLOCK_INNER_STYLES: readonly ["padding", "
|
|
101
|
-
declare const BLOCK_OUTER_STYLES: readonly ["border", "radius", "shadow", "outline"];
|
|
102
|
-
declare const BLOCK_STYLES: readonly ["padding", "
|
|
90
|
+
declare const POSITION_STYLES: readonly ["gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "blockMargin", "inlineMargin", "inset", "blockInset", "inlineInset", "position", "scrollMargin", "blockScrollMargin", "inlineScrollMargin", "scrollPadding", "blockScrollPadding", "inlineScrollPadding"];
|
|
91
|
+
declare const BLOCK_INNER_STYLES: readonly ["padding", "blockPadding", "inlinePadding", "overflow", "scrollbar", "textAlign"];
|
|
92
|
+
declare const BLOCK_OUTER_STYLES: readonly ["border", "blockBorder", "inlineBorder", "radius", "shadow", "outline"];
|
|
93
|
+
declare const BLOCK_STYLES: readonly ["padding", "blockPadding", "inlinePadding", "overflow", "scrollbar", "textAlign", "border", "blockBorder", "inlineBorder", "radius", "shadow", "outline"];
|
|
103
94
|
declare const COLOR_STYLES: readonly ["color", "fill", "fade", "image"];
|
|
104
95
|
declare const TEXT_STYLES: readonly ["textTransform", "fontWeight", "fontStyle"];
|
|
105
|
-
declare const DIMENSION_STYLES: readonly ["width", "height", "flexBasis", "flexGrow", "flexShrink", "flex"];
|
|
96
|
+
declare const DIMENSION_STYLES: readonly ["width", "height", "blockSize", "inlineSize", "flexBasis", "flexGrow", "flexShrink", "flex"];
|
|
106
97
|
declare const FLOW_STYLES: readonly ["flow", "place", "placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "gap", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas"];
|
|
107
|
-
declare const CONTAINER_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition", "color", "fill", "fade", "image", "width", "height", "flexBasis", "flexGrow", "flexShrink", "flex", "gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "inset", "position", "scrollMargin", "padding", "
|
|
108
|
-
declare const OUTER_STYLES: readonly ["gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "inset", "position", "scrollMargin", "width", "height", "flexBasis", "flexGrow", "flexShrink", "flex", "border", "radius", "shadow", "outline"];
|
|
109
|
-
declare const INNER_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition", "color", "fill", "fade", "image", "padding", "
|
|
98
|
+
declare const CONTAINER_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition", "color", "fill", "fade", "image", "width", "height", "blockSize", "inlineSize", "flexBasis", "flexGrow", "flexShrink", "flex", "gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "blockMargin", "inlineMargin", "inset", "blockInset", "inlineInset", "position", "scrollMargin", "blockScrollMargin", "inlineScrollMargin", "scrollPadding", "blockScrollPadding", "inlineScrollPadding", "padding", "blockPadding", "inlinePadding", "overflow", "scrollbar", "textAlign", "border", "blockBorder", "inlineBorder", "radius", "shadow", "outline", "flow", "place", "placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "gap", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas"];
|
|
99
|
+
declare const OUTER_STYLES: readonly ["gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "blockMargin", "inlineMargin", "inset", "blockInset", "inlineInset", "position", "scrollMargin", "blockScrollMargin", "inlineScrollMargin", "scrollPadding", "blockScrollPadding", "inlineScrollPadding", "width", "height", "blockSize", "inlineSize", "flexBasis", "flexGrow", "flexShrink", "flex", "border", "blockBorder", "inlineBorder", "radius", "shadow", "outline"];
|
|
100
|
+
declare const INNER_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition", "color", "fill", "fade", "image", "padding", "blockPadding", "inlinePadding", "overflow", "scrollbar", "textAlign", "flow", "place", "placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "gap", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas"];
|
|
110
101
|
//#endregion
|
|
111
102
|
//#region src/types.d.ts
|
|
112
|
-
interface GlobalStyledProps {
|
|
113
|
-
breakpoints?: number[];
|
|
114
|
-
}
|
|
115
103
|
/**
|
|
116
104
|
* Extensible interface for theme names.
|
|
117
105
|
* Augment this interface to register project-specific theme names for autocomplete.
|
|
@@ -129,6 +117,42 @@ interface GlobalStyledProps {
|
|
|
129
117
|
interface TastyThemeNames {}
|
|
130
118
|
type ThemeNameKey = Extract<keyof TastyThemeNames, string>;
|
|
131
119
|
type ThemeName = [ThemeNameKey] extends [never] ? string : ThemeNameKey;
|
|
120
|
+
/**
|
|
121
|
+
* Extensible interface for custom props added via `configure({ propHandlers })`.
|
|
122
|
+
* Augment it to type those props on every tasty component.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* declare module '@tenphi/tasty' {
|
|
127
|
+
* interface TastyCustomProps {
|
|
128
|
+
* glaze: 'soft' | 'strong' | { tone: string; intensity?: number };
|
|
129
|
+
* }
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
interface TastyCustomProps {}
|
|
134
|
+
/**
|
|
135
|
+
* Extensible interface for style names promoted via
|
|
136
|
+
* `configure({ baseStyleProps })`. Set each name to `true`; the prop is then typed
|
|
137
|
+
* exactly like the style it names.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* declare module '@tenphi/tasty' {
|
|
142
|
+
* interface TastyBaseStylePropNames {
|
|
143
|
+
* radius: true;
|
|
144
|
+
* shadow: true;
|
|
145
|
+
* }
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
interface TastyBaseStylePropNames {}
|
|
150
|
+
/**
|
|
151
|
+
* Props contributed by `configure({ baseStyleProps })`, each typed like the style
|
|
152
|
+
* it names. Intersecting with `keyof StylesInterface` makes a name that isn't a
|
|
153
|
+
* real style inert rather than `never`-typed.
|
|
154
|
+
*/
|
|
155
|
+
type ExtraBaseStyleProps = { [key in keyof TastyBaseStylePropNames & keyof StylesInterface]?: StylePropValue<StylesInterface[key]>; };
|
|
132
156
|
/** Allowed mod value types */
|
|
133
157
|
type ModValue = boolean | string | number | undefined | null;
|
|
134
158
|
/**
|
|
@@ -151,7 +175,7 @@ type TokenValue = string | number | boolean | undefined | null;
|
|
|
151
175
|
/**
|
|
152
176
|
* Tokens definition for inline CSS custom properties.
|
|
153
177
|
* - `$name` keys become `--name` CSS properties
|
|
154
|
-
* - `#name` keys become `--name-color`
|
|
178
|
+
* - `#name` keys become `--name-color` CSS properties
|
|
155
179
|
*/
|
|
156
180
|
type Tokens = Record<`$${string}` | `#${string}`, TokenValue>;
|
|
157
181
|
type Caps = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z';
|
|
@@ -166,20 +190,14 @@ interface BasePropsWithoutChildren<K extends TagName = TagName> extends Pick<All
|
|
|
166
190
|
element?: `${Caps}${string}`;
|
|
167
191
|
/** The style map */
|
|
168
192
|
styles?: Styles;
|
|
169
|
-
/** The list of responsive points in pixels */
|
|
170
|
-
breakpoints?: number[];
|
|
171
|
-
/** Whether the element has the block layout outside */
|
|
172
|
-
block?: boolean;
|
|
173
|
-
/** Whether the element has the inline layout outside */
|
|
174
|
-
inline?: boolean;
|
|
175
193
|
/** The list of element modifiers **/
|
|
176
194
|
mods?: Mods;
|
|
177
195
|
/** Whether the element is hidden (`hidden` attribute is set) */
|
|
178
196
|
isHidden?: boolean;
|
|
179
197
|
/** Whether the element is disabled (`disabled` attribute is set) */
|
|
180
198
|
isDisabled?: boolean;
|
|
181
|
-
/**
|
|
182
|
-
|
|
199
|
+
/** Whether the element is checked (`checked` attribute is set) */
|
|
200
|
+
isChecked?: boolean;
|
|
183
201
|
/** The CSS style map */
|
|
184
202
|
style?: CSSProperties$1 | (CSSProperties$1 & Record<string, string | number | null | undefined>);
|
|
185
203
|
/** User-defined theme for the element. Mapped to `data-theme` attribute. Augment `TastyThemeNames` to register project-specific themes for autocomplete. */
|
|
@@ -207,7 +225,6 @@ interface ShortGridStyles {
|
|
|
207
225
|
rows?: Styles['gridRows'];
|
|
208
226
|
areas?: Styles['gridAreas'];
|
|
209
227
|
}
|
|
210
|
-
type Props = Record<string, any>;
|
|
211
228
|
type TagName = keyof HTMLElementTagNameMap;
|
|
212
229
|
/**
|
|
213
230
|
* Configuration type for tasty.config.ts files.
|
|
@@ -252,7 +269,7 @@ interface TastyExtensionConfig {
|
|
|
252
269
|
* Set to `false` to disable function validation (overrides parent).
|
|
253
270
|
* @example ['clamp', 'double']
|
|
254
271
|
*/
|
|
255
|
-
|
|
272
|
+
functions?: false | string[];
|
|
256
273
|
/**
|
|
257
274
|
* State alias names for autocomplete.
|
|
258
275
|
* Must start with @ prefix.
|
|
@@ -286,7 +303,7 @@ interface TastyExtensionConfig {
|
|
|
286
303
|
}
|
|
287
304
|
//#endregion
|
|
288
305
|
//#region src/tasty.d.ts
|
|
289
|
-
type StyleList = readonly (keyof { [key in keyof StylesInterface]: StylesInterface[key] })[];
|
|
306
|
+
type StyleList = readonly (keyof { [key in keyof StylesInterface]: StylesInterface[key]; })[];
|
|
290
307
|
/** Type descriptor for a single mod prop: a JS constructor or an enum array. */
|
|
291
308
|
type ModPropDef = BooleanConstructor | StringConstructor | NumberConstructor | readonly string[];
|
|
292
309
|
/** Array form: list of mod key names (types default to ModValue). */
|
|
@@ -298,7 +315,7 @@ type ModPropsInput = ModPropsList | ModPropsMap;
|
|
|
298
315
|
/** Resolve a single ModPropDef to its TypeScript type. */
|
|
299
316
|
type ResolveModPropDef<T> = T extends BooleanConstructor ? boolean : T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends readonly (infer U)[] ? U : ModValue;
|
|
300
317
|
/** Resolve an entire `modProps` definition to the component prop types it adds. */
|
|
301
|
-
type ResolveModProps<M extends ModPropsInput> = M extends readonly (infer K)[] ? Partial<Record<K & string, ModValue>> : M extends Record<string, ModPropDef> ? { [key in keyof M & string]?: ResolveModPropDef<M[key]
|
|
318
|
+
type ResolveModProps<M extends ModPropsInput> = M extends readonly (infer K)[] ? Partial<Record<K & string, ModValue>> : M extends Record<string, ModPropDef> ? { [key in keyof M & string]?: ResolveModPropDef<M[key]>; } : {};
|
|
302
319
|
/** A token key with `$` or `#` prefix. */
|
|
303
320
|
type TokenPropKey = `$${string}` | `#${string}`;
|
|
304
321
|
/** Array form: list of prop names. Names ending in `Color` map to `#` color tokens. */
|
|
@@ -309,9 +326,10 @@ type TokenPropsMap = Readonly<Record<string, TokenPropKey>>;
|
|
|
309
326
|
type TokenPropsInput = TokenPropsList | TokenPropsMap;
|
|
310
327
|
/** Resolve a `tokenProps` definition to the component prop types it adds. */
|
|
311
328
|
type ResolveTokenProps<TP extends TokenPropsInput> = TP extends readonly (infer K)[] ? Partial<Record<K & string, TokenValue>> : TP extends Record<string, TokenPropKey> ? Partial<Record<keyof TP & string, TokenValue>> : {};
|
|
329
|
+
type AnyProps = Record<string, any>;
|
|
312
330
|
type PropsWithStyles = {
|
|
313
331
|
styles?: Styles;
|
|
314
|
-
} & Omit<
|
|
332
|
+
} & Omit<Record<string, any>, 'styles'>;
|
|
315
333
|
type VariantMap = Record<string, Styles>;
|
|
316
334
|
interface WithVariant<V extends VariantMap> {
|
|
317
335
|
variant?: keyof V;
|
|
@@ -353,23 +371,30 @@ type SubElementProps<Tag extends keyof JSX.IntrinsicElements = 'div'> = Omit<JSX
|
|
|
353
371
|
/**
|
|
354
372
|
* Generates the sub-element component types from an ElementsDefinition
|
|
355
373
|
*/
|
|
356
|
-
type SubElementComponents<E extends ElementsDefinition> = { [K in keyof E]: ForwardRefExoticComponent<PropsWithoutRef<SubElementProps<ResolveElementTag<E[K]>>> & RefAttributes<ResolveElementTag<E[K]> extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[ResolveElementTag<E[K]>] : Element$1
|
|
374
|
+
type SubElementComponents<E extends ElementsDefinition> = { [K in keyof E]: ForwardRefExoticComponent<PropsWithoutRef<SubElementProps<ResolveElementTag<E[K]>>> & RefAttributes<ResolveElementTag<E[K]> extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[ResolveElementTag<E[K]>] : Element$1>>; };
|
|
357
375
|
/**
|
|
358
376
|
* Base type containing common properties shared between TastyProps and TastyElementOptions.
|
|
359
377
|
* Separated to avoid code duplication while allowing different type constraints.
|
|
360
378
|
*/
|
|
361
379
|
type TastyBaseProps<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = {
|
|
362
|
-
/** Default styles of the element. */
|
|
363
|
-
|
|
364
|
-
|
|
380
|
+
/** Default styles of the element. */
|
|
381
|
+
styles?: Styles;
|
|
382
|
+
/** The list of styles that can be provided by props */
|
|
383
|
+
styleProps?: K;
|
|
384
|
+
/** Modifier keys exposed as top-level component props (array or typed object form). */
|
|
385
|
+
modProps?: M;
|
|
386
|
+
/** Token keys exposed as top-level component props (array or typed object form). */
|
|
365
387
|
tokenProps?: TP;
|
|
366
388
|
element?: BaseProps['element'];
|
|
367
|
-
variants?: V;
|
|
368
|
-
|
|
389
|
+
variants?: V;
|
|
390
|
+
/** Default tokens for inline CSS custom properties */
|
|
391
|
+
tokens?: Tokens;
|
|
392
|
+
/** Sub-element definitions for compound components */
|
|
369
393
|
elements?: E;
|
|
370
394
|
} & Pick<BaseProps, 'qa' | 'qaVal'> & WithVariant<V>;
|
|
371
|
-
type TastyProps<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, DefaultProps =
|
|
372
|
-
/** The tag name of the element or a React component. */
|
|
395
|
+
type TastyProps<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, DefaultProps = AnyProps, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = TastyBaseProps<K, V, E, M, TP> & {
|
|
396
|
+
/** The tag name of the element or a React component. */
|
|
397
|
+
as?: string | ComponentType<any>;
|
|
373
398
|
} & Partial<Omit<DefaultProps, 'as' | 'styles' | 'styleProps' | 'modProps' | 'tokenProps' | 'tokens'>>;
|
|
374
399
|
/**
|
|
375
400
|
* Resolves the props of a polymorphic `as` value (intrinsic tag or component).
|
|
@@ -384,18 +409,19 @@ type ResolveAsProps<AsType extends ElementType> = AsType extends keyof JSX.Intri
|
|
|
384
409
|
* element type from the `as` prop — both for intrinsic tags and for React
|
|
385
410
|
* components (so the wrapped component's prop API is preserved).
|
|
386
411
|
*
|
|
387
|
-
* Note: Uses a separate index signature with `unknown` instead of
|
|
388
|
-
*
|
|
412
|
+
* Note: Uses a separate index signature with `unknown` instead of an `any`
|
|
413
|
+
* record to ensure strict type checking for styles.
|
|
389
414
|
*/
|
|
390
415
|
type TastyElementOptions<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, AsType extends ElementType = 'div', M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = TastyBaseProps<K, V, E, M, TP> & {
|
|
391
|
-
/** The tag name of the element or a React component. */
|
|
416
|
+
/** The tag name of the element or a React component. */
|
|
417
|
+
as?: AsType;
|
|
392
418
|
} & Record<string, unknown>;
|
|
393
|
-
type AllBasePropsWithMods<K extends StyleList, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = AllBaseProps & { [key in K[number]]?: StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]
|
|
419
|
+
type AllBasePropsWithMods<K extends StyleList, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = AllBaseProps & { [key in K[number]]?: StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]>; } & BaseStyleProps & ExtraBaseStyleProps & Partial<TastyCustomProps> & ResolveModProps<M> & ResolveTokenProps<TP>;
|
|
394
420
|
/**
|
|
395
|
-
*
|
|
396
|
-
*
|
|
421
|
+
* Props consumed by Tasty rather than forwarded to the `as` component.
|
|
422
|
+
* Event handlers are resolved from JSX.IntrinsicElements or the component's own props.
|
|
397
423
|
*/
|
|
398
|
-
type TastySpecificKeys = 'as' | 'qa' | 'qaVal' | 'element' | 'styles' | '
|
|
424
|
+
type TastySpecificKeys = keyof BaseStyleProps | 'as' | 'qa' | 'qaVal' | 'element' | 'styles' | 'mods' | 'isHidden' | 'isDisabled' | 'isChecked' | 'style' | 'theme' | 'tokens' | 'ref';
|
|
399
425
|
/** Extract prop key names from a ModPropsInput (array elements or object keys). */
|
|
400
426
|
type ModPropsKeys<M extends ModPropsInput> = M extends readonly (infer K)[] ? K & string : keyof M & string;
|
|
401
427
|
/** Extract prop key names from a TokenPropsInput (array elements or object keys). */
|
|
@@ -416,8 +442,8 @@ type TokenPropsKeys<TP extends TokenPropsInput> = TP extends readonly (infer K)[
|
|
|
416
442
|
* baseline is preserved so generic HTML attributes still work even when `as`
|
|
417
443
|
* is a component type with a narrower prop API.
|
|
418
444
|
*/
|
|
419
|
-
type TastyElementProps<K extends StyleList, V extends VariantMap, AsType extends ElementType = 'div', M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = Omit<AllBasePropsWithMods<K, M, TP>, Exclude<keyof ResolveAsProps<AsType>, TastySpecificKeys | K[number] | ModPropsKeys<M> | TokenPropsKeys<TP>>> & WithVariant<V> & Omit<Omit<AllHTMLAttributes<HTMLElement>, keyof ResolveAsProps<AsType>> & ResolveAsProps<AsType>, TastySpecificKeys | K[number] | ModPropsKeys<M> | TokenPropsKeys<TP>>;
|
|
420
|
-
type TastyComponentPropsWithDefaults<Props extends PropsWithStyles, DefaultProps extends Partial<Props>> = keyof DefaultProps extends never ? Props : { [key in Extract<keyof Props, keyof DefaultProps>]?: Props[key] } & { [key in keyof Omit<Props, keyof DefaultProps>]: Props[key] };
|
|
445
|
+
type TastyElementProps<K extends StyleList, V extends VariantMap, AsType extends ElementType = 'div', M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = Omit<AllBasePropsWithMods<K, M, TP>, Exclude<keyof ResolveAsProps<AsType>, TastySpecificKeys | keyof TastyCustomProps | keyof ExtraBaseStyleProps | K[number] | ModPropsKeys<M> | TokenPropsKeys<TP>>> & WithVariant<V> & Omit<Omit<AllHTMLAttributes<HTMLElement>, keyof ResolveAsProps<AsType>> & ResolveAsProps<AsType>, TastySpecificKeys | keyof TastyCustomProps | keyof ExtraBaseStyleProps | K[number] | ModPropsKeys<M> | TokenPropsKeys<TP>>;
|
|
446
|
+
type TastyComponentPropsWithDefaults<Props extends PropsWithStyles, DefaultProps extends Partial<Props>> = keyof DefaultProps extends never ? Props : { [key in Extract<keyof Props, keyof DefaultProps>]?: Props[key]; } & { [key in keyof Omit<Props, keyof DefaultProps>]: Props[key]; };
|
|
421
447
|
/**
|
|
422
448
|
* The component type returned by the `tasty(options)` element-factory overload.
|
|
423
449
|
*
|
|
@@ -432,16 +458,11 @@ type TastyComponentPropsWithDefaults<Props extends PropsWithStyles, DefaultProps
|
|
|
432
458
|
* `SomeComponent`; create another `tasty({ as: SomeComponent })` for that.
|
|
433
459
|
*/
|
|
434
460
|
type TastyPolymorphicComponent<DefaultAs extends ElementType, K extends StyleList, V extends VariantMap, M extends ModPropsInput, TP extends TokenPropsInput> = ForwardRefExoticComponent<PropsWithoutRef<TastyElementProps<K, V, DefaultAs, M, TP>> & RefAttributes<unknown>>;
|
|
435
|
-
declare function tasty<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, AsType extends ElementType = 'div', M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]>(options: TastyElementOptions<K, V, E, AsType, M, TP>, secondArg?: never): TastyPolymorphicComponent<AsType, K, V, M, TP> & SubElementComponents<E>;
|
|
461
|
+
declare function tasty<K extends StyleList = readonly never[], V extends VariantMap = VariantMap, E extends ElementsDefinition = Record<string, never>, AsType extends ElementType = 'div', M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]>(options: TastyElementOptions<K, V, E, AsType, M, TP>, secondArg?: never): TastyPolymorphicComponent<AsType, K, V, M, TP> & SubElementComponents<E>;
|
|
436
462
|
declare function tasty<Props extends PropsWithStyles, DefaultProps extends Partial<Props> = Partial<Props>, K extends StyleList = readonly never[], V extends VariantMap = VariantMap, E extends ElementsDefinition = Record<string, never>, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]>(Component: ComponentType<Props>, options?: TastyProps<K, V, E, Props, M, TP>): ComponentType<TastyComponentPropsWithDefaults<Props, DefaultProps>>;
|
|
437
|
-
declare const Element$1: TastyPolymorphicComponent<"div",
|
|
463
|
+
declare const Element$1: TastyPolymorphicComponent<"div", readonly never[], VariantMap, readonly never[], readonly never[]> & SubElementComponents<Record<string, never>>;
|
|
438
464
|
//#endregion
|
|
439
465
|
//#region src/hooks/useStyles.d.ts
|
|
440
|
-
/**
|
|
441
|
-
* Tasty styles object to generate CSS classes for.
|
|
442
|
-
* Can be undefined or empty object for no styles.
|
|
443
|
-
*/
|
|
444
|
-
type UseStylesOptions = Styles | undefined;
|
|
445
466
|
interface UseStylesResult {
|
|
446
467
|
/**
|
|
447
468
|
* Generated className(s) to apply to the element.
|
|
@@ -470,7 +491,7 @@ interface UseStylesResult {
|
|
|
470
491
|
* }
|
|
471
492
|
* ```
|
|
472
493
|
*/
|
|
473
|
-
declare function useStyles(styles:
|
|
494
|
+
declare function useStyles(styles: Styles | undefined, options?: {
|
|
474
495
|
root?: Document | ShadowRoot;
|
|
475
496
|
}): UseStylesResult;
|
|
476
497
|
//#endregion
|
|
@@ -499,6 +520,10 @@ interface UseGlobalStylesOptions {
|
|
|
499
520
|
* Use the `id` option for update tracking when styles change over the
|
|
500
521
|
* component lifecycle.
|
|
501
522
|
*
|
|
523
|
+
* Update tracking is per-slot and per-root: a slot (`id`, or the selector when
|
|
524
|
+
* no `id` is given) holds exactly one injection per `root`. Changing the styles
|
|
525
|
+
* replaces it; rendering styles that produce no CSS clears it.
|
|
526
|
+
*
|
|
502
527
|
* @param selector - CSS selector to apply styles to (e.g., '.my-class', ':root', 'body')
|
|
503
528
|
* @param styles - Tasty styles object
|
|
504
529
|
* @param options - Optional settings including `id` for update tracking
|
|
@@ -521,9 +546,8 @@ declare function useGlobalStyles(selector: string, styles?: Styles, options?: Us
|
|
|
521
546
|
//#region src/hooks/useRawCSS.d.ts
|
|
522
547
|
interface UseRawCSSOptions {
|
|
523
548
|
/**
|
|
524
|
-
* Shadow root or document to inject into.
|
|
525
|
-
*
|
|
526
|
-
* only the root for the same id/content will not re-inject.
|
|
549
|
+
* Shadow root or document to inject into. Update tracking is per-root: the
|
|
550
|
+
* same id in two roots holds a separate injection in each.
|
|
527
551
|
*/
|
|
528
552
|
root?: Document | ShadowRoot;
|
|
529
553
|
/**
|
|
@@ -549,6 +573,11 @@ interface UseKeyframesOptions {
|
|
|
549
573
|
*
|
|
550
574
|
* Works in all environments: client, SSR with collector, and React Server Components.
|
|
551
575
|
*
|
|
576
|
+
* Passing `name` claims a slot owned by that one call site (like `useRawCSS`'s
|
|
577
|
+
* `id`): when its steps change, the previous injection is disposed and the name
|
|
578
|
+
* is reused, so the rules don't accumulate. Anonymous keyframes are permanent
|
|
579
|
+
* and shared by content.
|
|
580
|
+
*
|
|
552
581
|
* @example Basic usage - steps object is the dependency
|
|
553
582
|
* ```tsx
|
|
554
583
|
* function MyComponent() {
|
|
@@ -593,28 +622,11 @@ declare function useKeyframes(steps: KeyframesSteps, options?: UseKeyframesOptio
|
|
|
593
622
|
declare function useKeyframes(factory: () => KeyframesSteps, deps: readonly unknown[], options?: UseKeyframesOptions): string;
|
|
594
623
|
//#endregion
|
|
595
624
|
//#region src/hooks/useProperty.d.ts
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
*/
|
|
602
|
-
syntax?: string;
|
|
603
|
-
/**
|
|
604
|
-
* Whether the property inherits from parent elements
|
|
605
|
-
* @default true
|
|
606
|
-
*/
|
|
607
|
-
inherits?: boolean;
|
|
608
|
-
/**
|
|
609
|
-
* Initial value for the property.
|
|
610
|
-
* For color tokens (#name), this defaults to 'transparent' if not specified.
|
|
611
|
-
*/
|
|
612
|
-
initialValue?: string | number;
|
|
613
|
-
/**
|
|
614
|
-
* Shadow root or document to inject into
|
|
615
|
-
*/
|
|
616
|
-
root?: Document | ShadowRoot;
|
|
617
|
-
}
|
|
625
|
+
/**
|
|
626
|
+
* Options for {@link useProperty}. Extends the shared {@link PropertyOptions}
|
|
627
|
+
* (which is `PropertyDefinition` plus an optional injection `root`).
|
|
628
|
+
*/
|
|
629
|
+
type UsePropertyOptions = PropertyOptions;
|
|
618
630
|
/**
|
|
619
631
|
* Register a CSS @property custom property.
|
|
620
632
|
* This enables advanced features like animating custom properties.
|
|
@@ -744,6 +756,93 @@ interface UseCounterStyleOptions {
|
|
|
744
756
|
*/
|
|
745
757
|
declare function useCounterStyle(descriptors: CounterStyleDescriptors, options?: UseCounterStyleOptions): string;
|
|
746
758
|
//#endregion
|
|
759
|
+
//#region src/hooks/useFunction.d.ts
|
|
760
|
+
interface UseFunctionOptions {
|
|
761
|
+
/** Shadow root or document to inject into. */
|
|
762
|
+
root?: Document | ShadowRoot;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Register a CSS @function (custom function).
|
|
766
|
+
*
|
|
767
|
+
* @function rules are global and persistent once defined. The hook ensures the
|
|
768
|
+
* function is only registered once per root (deduplicated by function name).
|
|
769
|
+
*
|
|
770
|
+
* Accepts tasty token syntax for the function name:
|
|
771
|
+
* - `$$name` → defines `--name` (matches the call site `$$name(...)`)
|
|
772
|
+
* - `$name` / `--name` → also accepted
|
|
773
|
+
*
|
|
774
|
+
* Works in all environments: client, SSR with collector, and React Server Components.
|
|
775
|
+
*
|
|
776
|
+
* @param name - The function name token (`$$name`, `$name`, or `--name`)
|
|
777
|
+
* @param definition - Function definition (args, returns, result, local vars)
|
|
778
|
+
*
|
|
779
|
+
* Call the function through the Tasty DSL, not a raw `style` prop: an inline
|
|
780
|
+
* `style` value reaches the browser unparsed, so the `$$name(...)` sugar is never
|
|
781
|
+
* expanded and `polyfills.functions` cannot rewrite it either.
|
|
782
|
+
*
|
|
783
|
+
* @example
|
|
784
|
+
* ```tsx
|
|
785
|
+
* const Box = tasty({ styles: { marginTop: '$$negative(10px)' } });
|
|
786
|
+
*
|
|
787
|
+
* function Layout() {
|
|
788
|
+
* useFunction('$$negative', { args: ['$value'], result: '(-1 * $value)' });
|
|
789
|
+
* return <Box />;
|
|
790
|
+
* }
|
|
791
|
+
* ```
|
|
792
|
+
*/
|
|
793
|
+
declare function useFunction(name: string, definition: FunctionDefinition, options?: UseFunctionOptions): void;
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region src/batch-provider.d.ts
|
|
796
|
+
interface TastyBatchProviderProps {
|
|
797
|
+
children?: ReactNode;
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Opens a *batch window* for the commit it renders in, so `batchInjection`
|
|
801
|
+
* can defer stylesheet writes without ever letting a layout effect measure an
|
|
802
|
+
* unstyled element.
|
|
803
|
+
*
|
|
804
|
+
* Every `insertRule()` on a live sheet invalidates style for that sheet's
|
|
805
|
+
* scope. When components inject during React's render phase while others read
|
|
806
|
+
* layout in the same pass, the two interleave and the browser recalculates
|
|
807
|
+
* style between every injection. Batching collapses that into one invalidation
|
|
808
|
+
* per flush — but only if the flush happens before anything can measure.
|
|
809
|
+
*
|
|
810
|
+
* ```
|
|
811
|
+
* provider renders -> window OPEN
|
|
812
|
+
* children render -> injections queued
|
|
813
|
+
* provider insertionEffect -> FLUSH, window CLOSED
|
|
814
|
+
* layout effects run -> rules are in the sheet
|
|
815
|
+
* ```
|
|
816
|
+
*
|
|
817
|
+
* `useInsertionEffect` runs in React's mutation phase, after every render in
|
|
818
|
+
* the commit and before any `useLayoutEffect` — which is exactly why React
|
|
819
|
+
* added it for CSS-in-JS libraries. Effects fire child-first, so this
|
|
820
|
+
* provider's runs after every descendant's and still before all layout
|
|
821
|
+
* effects.
|
|
822
|
+
*
|
|
823
|
+
* A commit that does not re-render this provider gets no window, and those
|
|
824
|
+
* injections are written synchronously instead. That is the point: turning
|
|
825
|
+
* `batchInjection: true` on can only ever make injection cheaper, never make a
|
|
826
|
+
* measurement wrong. It also means batching applies to commits this provider
|
|
827
|
+
* takes part in, so mount it as high in the tree as you can.
|
|
828
|
+
*
|
|
829
|
+
* Requires `configure({ batchInjection: true })`; without it this component
|
|
830
|
+
* only renders its children. `batchInjection: 'always'` does not need the
|
|
831
|
+
* provider at all — see that option's docs for the trade-off it accepts.
|
|
832
|
+
*
|
|
833
|
+
* @example
|
|
834
|
+
* ```tsx
|
|
835
|
+
* configure({ batchInjection: true });
|
|
836
|
+
*
|
|
837
|
+
* createRoot(el).render(
|
|
838
|
+
* <TastyBatchProvider>
|
|
839
|
+
* <App />
|
|
840
|
+
* </TastyBatchProvider>,
|
|
841
|
+
* );
|
|
842
|
+
* ```
|
|
843
|
+
*/
|
|
844
|
+
declare function TastyBatchProvider({ children }: TastyBatchProviderProps): ReactNode;
|
|
845
|
+
//#endregion
|
|
747
846
|
//#region src/utils/get-display-name.d.ts
|
|
748
847
|
declare function getDisplayName<T>(Component: ElementType<T>, fallbackName?: string): string;
|
|
749
848
|
//#endregion
|
|
@@ -752,6 +851,210 @@ declare module './utils/css-types' {
|
|
|
752
851
|
interface CSSProperties extends CSSProperties {}
|
|
753
852
|
}
|
|
754
853
|
//#endregion
|
|
854
|
+
//#region src/plugins/okhsl-plugin.d.ts
|
|
855
|
+
/**
|
|
856
|
+
* The okhsl function handler for tasty parser.
|
|
857
|
+
* Receives parsed style groups and returns an RGB color string.
|
|
858
|
+
*/
|
|
859
|
+
declare const okhslFunction: (groups: StyleDetails[]) => string;
|
|
860
|
+
/**
|
|
861
|
+
* OKHSL Plugin for Tasty.
|
|
862
|
+
*
|
|
863
|
+
* Adds support for the `okhsl()` color function in tasty styles.
|
|
864
|
+
*
|
|
865
|
+
* @example
|
|
866
|
+
* ```ts
|
|
867
|
+
* import { configure } from '@tenphi/tasty';
|
|
868
|
+
* import { okhslPlugin } from '@tenphi/tasty';
|
|
869
|
+
*
|
|
870
|
+
* configure({
|
|
871
|
+
* plugins: [okhslPlugin()],
|
|
872
|
+
* });
|
|
873
|
+
*
|
|
874
|
+
* // Now you can use okhsl in styles:
|
|
875
|
+
* const Box = tasty({
|
|
876
|
+
* styles: {
|
|
877
|
+
* fill: 'okhsl(240 50% 50%)',
|
|
878
|
+
* },
|
|
879
|
+
* });
|
|
880
|
+
* ```
|
|
881
|
+
*/
|
|
882
|
+
declare const okhslPlugin: TastyPluginFactory;
|
|
883
|
+
//#endregion
|
|
884
|
+
//#region src/plugins/okhst-plugin.d.ts
|
|
885
|
+
/**
|
|
886
|
+
* The okhst function handler for tasty parser.
|
|
887
|
+
* Receives parsed style groups and returns an RGB color string.
|
|
888
|
+
*/
|
|
889
|
+
declare const okhstFunction: (groups: StyleDetails[]) => string;
|
|
890
|
+
/**
|
|
891
|
+
* OKHST Plugin for Tasty.
|
|
892
|
+
*
|
|
893
|
+
* Adds support for the `okhst()` color function in tasty styles.
|
|
894
|
+
*
|
|
895
|
+
* @example
|
|
896
|
+
* ```ts
|
|
897
|
+
* import { configure } from '@tenphi/tasty';
|
|
898
|
+
* import { okhstPlugin } from '@tenphi/tasty';
|
|
899
|
+
*
|
|
900
|
+
* configure({
|
|
901
|
+
* plugins: [okhstPlugin()],
|
|
902
|
+
* });
|
|
903
|
+
*
|
|
904
|
+
* // Now you can use okhst in styles:
|
|
905
|
+
* const Box = tasty({
|
|
906
|
+
* styles: {
|
|
907
|
+
* fill: 'okhst(240 50% 50%)',
|
|
908
|
+
* },
|
|
909
|
+
* });
|
|
910
|
+
* ```
|
|
911
|
+
*/
|
|
912
|
+
declare const okhstPlugin: TastyPluginFactory;
|
|
913
|
+
//#endregion
|
|
914
|
+
//#region src/plugins/color-func.d.ts
|
|
915
|
+
/**
|
|
916
|
+
* Creates a color function handler for the tasty parser.
|
|
917
|
+
*
|
|
918
|
+
* A color function is a custom `functions` entry that converts its arguments
|
|
919
|
+
* to an `rgb(...)` string (an already-supported color), so it needs no special
|
|
920
|
+
* core integration — registering it as a parse function is enough.
|
|
921
|
+
*
|
|
922
|
+
* @param name The name of the color function (e.g., 'okhsl', 'okhst')
|
|
923
|
+
* @param convert Converts the parsed first three channel values (after angle/
|
|
924
|
+
* percent normalization) to sRGB `[r, g, b]` in the 0-1 range
|
|
925
|
+
* @param label Optional diagnostic label shown in dev warnings when the wrong
|
|
926
|
+
* number of arguments is supplied (e.g., 'H S L'). Has no effect on parsing
|
|
927
|
+
* or output.
|
|
928
|
+
*/
|
|
929
|
+
declare function createColorFunc(name: string, convert: (h: number, c2: number, c3: number) => [number, number, number], label?: string): (groups: StyleDetails[]) => string;
|
|
930
|
+
//#endregion
|
|
931
|
+
//#region src/utils/function-color.d.ts
|
|
932
|
+
/**
|
|
933
|
+
* Resolve a `name(...)` value produced by a registered custom parse function
|
|
934
|
+
* into its concrete color output.
|
|
935
|
+
*
|
|
936
|
+
* A color function is just a `functions` entry whose output is an already
|
|
937
|
+
* supported color (`rgb`, `hsl`, `#…`, `oklch`, …). This helper delegates the
|
|
938
|
+
* value to the global parser (which already runs the registered parse function)
|
|
939
|
+
* and returns the result only when it looks like a color. Returns `null` when
|
|
940
|
+
* `str` is not a registered custom function or its output is not a color.
|
|
941
|
+
*
|
|
942
|
+
* This is the generic replacement for the previously hardcoded okhsl/okhst
|
|
943
|
+
* conversion branches scattered across `strToRgb`, `resolveToRgbaValues`, and
|
|
944
|
+
* the `#token.alpha` injection path.
|
|
945
|
+
*/
|
|
946
|
+
declare function resolveFunctionColor(str: string): string | null;
|
|
947
|
+
//#endregion
|
|
948
|
+
//#region src/chunks/style-chunk-map.d.ts
|
|
949
|
+
/**
|
|
950
|
+
* Chunk names, the built-in chunk style lists, and the style→chunk lookup.
|
|
951
|
+
*
|
|
952
|
+
* This module only imports data-only style-name lists. It exists separately
|
|
953
|
+
* from `definitions.ts` for two reasons:
|
|
954
|
+
*
|
|
955
|
+
* 1. The style handler registry (`styles/predefined.ts`) needs to assign chunk
|
|
956
|
+
* membership for custom handlers. Reaching for `definitions.ts` would create an
|
|
957
|
+
* import cycle (`definitions` -> `pipeline` -> `styles` -> `predefined`).
|
|
958
|
+
* 2. `STYLE_TO_CHUNK` is populated as a side effect of module load, so it must be
|
|
959
|
+
* populated by the module that *owns* it. Otherwise an importer that only pulls
|
|
960
|
+
* in this module would see an empty map and misclassify every style as `misc`.
|
|
961
|
+
*
|
|
962
|
+
* `definitions.ts` re-exports everything here, so existing import paths and the
|
|
963
|
+
* public API surface are unchanged.
|
|
964
|
+
*/
|
|
965
|
+
declare const CHUNK_NAMES: {
|
|
966
|
+
/** Special chunk for styles that cannot be split */
|
|
967
|
+
readonly COMBINED: "combined";
|
|
968
|
+
readonly SUBCOMPONENTS: "subcomponents";
|
|
969
|
+
readonly APPEARANCE: "appearance";
|
|
970
|
+
readonly FONT: "font";
|
|
971
|
+
readonly DIMENSION: "dimension";
|
|
972
|
+
readonly DISPLAY: "display";
|
|
973
|
+
readonly LAYOUT: "layout";
|
|
974
|
+
readonly POSITION: "position";
|
|
975
|
+
readonly MISC: "misc";
|
|
976
|
+
};
|
|
977
|
+
type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];
|
|
978
|
+
/**
|
|
979
|
+
* Appearance chunk - visual styling with independent handlers
|
|
980
|
+
*
|
|
981
|
+
* @public
|
|
982
|
+
*/
|
|
983
|
+
declare const APPEARANCE_CHUNK_STYLES: readonly ["fill", "color", "opacity", "border", "blockBorder", "inlineBorder", "radius", "outline", "outlineOffset", "shadow", "fade"];
|
|
984
|
+
/**
|
|
985
|
+
* Font chunk - typography styles
|
|
986
|
+
*
|
|
987
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
988
|
+
* ⚠️ presetStyle: preset, fontSize, lineHeight, letterSpacing, textTransform,
|
|
989
|
+
* fontWeight, fontStyle, font
|
|
990
|
+
*/
|
|
991
|
+
/** @public */
|
|
992
|
+
declare const FONT_CHUNK_STYLES: readonly ["preset", "font", "fontWeight", "fontStyle", "fontSize", "lineHeight", "letterSpacing", "textTransform", "fontFamily", "textAlign", "textDecoration", "wordBreak", "wordWrap", "boldFontWeight"];
|
|
993
|
+
/**
|
|
994
|
+
* Dimension chunk - sizing and spacing
|
|
995
|
+
*
|
|
996
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
997
|
+
* ⚠️ paddingStyle: padding, paddingTop/Right/Bottom/Left
|
|
998
|
+
* ⚠️ marginStyle: margin, marginTop/Right/Bottom/Left
|
|
999
|
+
* ⚠️ widthStyle: width, minWidth, maxWidth
|
|
1000
|
+
* ⚠️ heightStyle: height, minHeight, maxHeight
|
|
1001
|
+
* ⚠️ blockSizeStyle: blockSize, minBlockSize, maxBlockSize
|
|
1002
|
+
* ⚠️ inlineSizeStyle: inlineSize, minInlineSize, maxInlineSize
|
|
1003
|
+
*/
|
|
1004
|
+
/** @public */
|
|
1005
|
+
declare const DIMENSION_CHUNK_STYLES: readonly ["padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "blockPadding", "inlinePadding", "margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "blockMargin", "inlineMargin", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "blockSize", "minBlockSize", "maxBlockSize", "inlineSize", "minInlineSize", "maxInlineSize", "flexBasis", "flexGrow", "flexShrink", "flex"];
|
|
1006
|
+
/**
|
|
1007
|
+
* Display chunk - display mode, layout flow, text overflow, and scrollbar
|
|
1008
|
+
*
|
|
1009
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
1010
|
+
* ⚠️ displayStyle: display, hide, textOverflow, overflow, whiteSpace
|
|
1011
|
+
* ⚠️ flowStyle: display, flow
|
|
1012
|
+
* ⚠️ gapStyle: display, flow, gap
|
|
1013
|
+
* ⚠️ scrollbarStyle: scrollbar, overflow
|
|
1014
|
+
*/
|
|
1015
|
+
/** @public */
|
|
1016
|
+
declare const DISPLAY_CHUNK_STYLES: readonly ["display", "hide", "textOverflow", "overflow", "whiteSpace", "flow", "gap", "scrollbar"];
|
|
1017
|
+
/**
|
|
1018
|
+
* Layout chunk - flex/grid alignment and grid templates
|
|
1019
|
+
*
|
|
1020
|
+
* Note: flow and gap are in DISPLAY chunk due to handler dependencies
|
|
1021
|
+
* (flowStyle and gapStyle both require 'display' prop).
|
|
1022
|
+
*/
|
|
1023
|
+
/** @public */
|
|
1024
|
+
declare const LAYOUT_CHUNK_STYLES: readonly ["placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "place", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas", "gridAutoFlow", "gridAutoColumns", "gridAutoRows"];
|
|
1025
|
+
/**
|
|
1026
|
+
* Position chunk - element positioning
|
|
1027
|
+
*
|
|
1028
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
1029
|
+
* ⚠️ insetStyle: inset, top, right, bottom, left
|
|
1030
|
+
*/
|
|
1031
|
+
/** @public */
|
|
1032
|
+
declare const POSITION_CHUNK_STYLES: readonly ["position", "inset", "blockInset", "inlineInset", "top", "right", "bottom", "left", "blockScrollMargin", "inlineScrollMargin", "blockScrollPadding", "inlineScrollPadding", "zIndex", "gridArea", "gridColumn", "gridRow", "order", "placeSelf", "alignSelf", "justifySelf", "transform", "transition", "animation"];
|
|
1033
|
+
/**
|
|
1034
|
+
* Map for O(1) style-to-chunk lookup. Seeded with the built-in lists above and
|
|
1035
|
+
* extended by {@link assignStyleChunk} when a custom handler declares style names
|
|
1036
|
+
* the built-in lists don't know.
|
|
1037
|
+
*/
|
|
1038
|
+
declare const STYLE_TO_CHUNK: Map<string, ChunkName>;
|
|
1039
|
+
//#endregion
|
|
1040
|
+
//#region src/chunks/definitions.d.ts
|
|
1041
|
+
interface ChunkInfo {
|
|
1042
|
+
/** Name of the chunk */
|
|
1043
|
+
name: ChunkName | string;
|
|
1044
|
+
/** Style keys belonging to this chunk */
|
|
1045
|
+
styleKeys: string[];
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Categorize style keys into chunks.
|
|
1049
|
+
*
|
|
1050
|
+
* Returns chunks in a deterministic order (by CHUNK_ORDER) regardless
|
|
1051
|
+
* of the order of keys in the input styles object.
|
|
1052
|
+
*
|
|
1053
|
+
* @param styles - The styles object to categorize
|
|
1054
|
+
* @returns Map of chunk name to array of style keys in that chunk (in priority order)
|
|
1055
|
+
*/
|
|
1056
|
+
declare function categorizeStyleKeys(styles: Record<string, unknown>): Map<string, string[]>;
|
|
1057
|
+
//#endregion
|
|
755
1058
|
//#region src/styles/border.d.ts
|
|
756
1059
|
/**
|
|
757
1060
|
* Border style handler with multi-group support.
|
|
@@ -766,23 +1069,27 @@ declare module './utils/css-types' {
|
|
|
766
1069
|
*
|
|
767
1070
|
* Later groups override earlier groups for conflicting directions.
|
|
768
1071
|
*/
|
|
769
|
-
declare function borderStyle({
|
|
770
|
-
border
|
|
771
|
-
}: {
|
|
1072
|
+
declare function borderStyle({ border }: {
|
|
772
1073
|
border?: string | number | boolean;
|
|
773
1074
|
}): Record<string, string> | null;
|
|
774
1075
|
declare namespace borderStyle {
|
|
775
1076
|
var __lookupStyles: string[];
|
|
776
1077
|
}
|
|
777
1078
|
//#endregion
|
|
1079
|
+
//#region src/styles/blockSize.d.ts
|
|
1080
|
+
declare function blockSizeStyle({ blockSize, minBlockSize, maxBlockSize }: {
|
|
1081
|
+
blockSize?: string | number | boolean;
|
|
1082
|
+
minBlockSize?: string | number | boolean;
|
|
1083
|
+
maxBlockSize?: string | number | boolean;
|
|
1084
|
+
}): Record<string, string | string[]> | null;
|
|
1085
|
+
declare namespace blockSizeStyle {
|
|
1086
|
+
var __lookupStyles: ("blockSize" | "maxBlockSize" | "minBlockSize")[];
|
|
1087
|
+
}
|
|
1088
|
+
//#endregion
|
|
778
1089
|
//#region src/styles/color.d.ts
|
|
779
|
-
declare function colorStyle({
|
|
780
|
-
color
|
|
781
|
-
}: {
|
|
1090
|
+
declare function colorStyle({ color }: {
|
|
782
1091
|
color?: string | boolean;
|
|
783
|
-
}):
|
|
784
|
-
color: string;
|
|
785
|
-
} | null;
|
|
1092
|
+
}): Record<string, string> | null;
|
|
786
1093
|
declare namespace colorStyle {
|
|
787
1094
|
var __lookupStyles: string[];
|
|
788
1095
|
}
|
|
@@ -804,21 +1111,13 @@ interface DisplayStyleProps {
|
|
|
804
1111
|
* 3. Single-line `textOverflow` defaults white-space to nowrap
|
|
805
1112
|
* 4. Explicit `whiteSpace` overrides the default from `textOverflow`
|
|
806
1113
|
*/
|
|
807
|
-
declare function displayStyle({
|
|
808
|
-
display,
|
|
809
|
-
hide,
|
|
810
|
-
textOverflow,
|
|
811
|
-
overflow,
|
|
812
|
-
whiteSpace
|
|
813
|
-
}: DisplayStyleProps): Record<string, string | number> | null;
|
|
1114
|
+
declare function displayStyle({ display, hide, textOverflow, overflow, whiteSpace }: DisplayStyleProps): Record<string, string | number> | null;
|
|
814
1115
|
declare namespace displayStyle {
|
|
815
1116
|
var __lookupStyles: string[];
|
|
816
1117
|
}
|
|
817
1118
|
//#endregion
|
|
818
1119
|
//#region src/styles/fade.d.ts
|
|
819
|
-
declare function fadeStyle({
|
|
820
|
-
fade
|
|
821
|
-
}: {
|
|
1120
|
+
declare function fadeStyle({ fade }: {
|
|
822
1121
|
fade?: string;
|
|
823
1122
|
}): {
|
|
824
1123
|
mask: string;
|
|
@@ -829,19 +1128,7 @@ declare namespace fadeStyle {
|
|
|
829
1128
|
}
|
|
830
1129
|
//#endregion
|
|
831
1130
|
//#region src/styles/fill.d.ts
|
|
832
|
-
declare function fillStyle({
|
|
833
|
-
fill,
|
|
834
|
-
backgroundColor,
|
|
835
|
-
image,
|
|
836
|
-
backgroundImage,
|
|
837
|
-
backgroundPosition,
|
|
838
|
-
backgroundSize,
|
|
839
|
-
backgroundRepeat,
|
|
840
|
-
backgroundAttachment,
|
|
841
|
-
backgroundOrigin,
|
|
842
|
-
backgroundClip,
|
|
843
|
-
background
|
|
844
|
-
}: {
|
|
1131
|
+
declare function fillStyle({ fill, backgroundColor, image, backgroundImage, backgroundPosition, backgroundSize, backgroundRepeat, backgroundAttachment, backgroundOrigin, backgroundClip, background }: {
|
|
845
1132
|
fill?: string;
|
|
846
1133
|
backgroundColor?: string;
|
|
847
1134
|
image?: string;
|
|
@@ -857,9 +1144,7 @@ declare function fillStyle({
|
|
|
857
1144
|
declare namespace fillStyle {
|
|
858
1145
|
var __lookupStyles: string[];
|
|
859
1146
|
}
|
|
860
|
-
declare function svgFillStyle({
|
|
861
|
-
svgFill
|
|
862
|
-
}: {
|
|
1147
|
+
declare function svgFillStyle({ svgFill }: {
|
|
863
1148
|
svgFill?: string;
|
|
864
1149
|
}): {
|
|
865
1150
|
fill: string;
|
|
@@ -869,28 +1154,21 @@ declare namespace svgFillStyle {
|
|
|
869
1154
|
}
|
|
870
1155
|
//#endregion
|
|
871
1156
|
//#region src/styles/flow.d.ts
|
|
872
|
-
declare function flowStyle({
|
|
873
|
-
display
|
|
874
|
-
flow
|
|
875
|
-
}: {
|
|
876
|
-
display?: string;
|
|
877
|
-
flow?: string;
|
|
1157
|
+
declare function flowStyle({ display, flow }: {
|
|
1158
|
+
display?: string | NoType;
|
|
1159
|
+
flow?: string | NoType;
|
|
878
1160
|
}): {
|
|
879
|
-
[x: string]: string
|
|
1161
|
+
[x: string]: string;
|
|
880
1162
|
} | null;
|
|
881
1163
|
declare namespace flowStyle {
|
|
882
1164
|
var __lookupStyles: string[];
|
|
883
1165
|
}
|
|
884
1166
|
//#endregion
|
|
885
1167
|
//#region src/styles/gap.d.ts
|
|
886
|
-
declare function gapStyle({
|
|
887
|
-
display
|
|
888
|
-
flow
|
|
889
|
-
gap
|
|
890
|
-
}: {
|
|
891
|
-
display?: string;
|
|
892
|
-
flow?: string;
|
|
893
|
-
gap?: string | number | boolean;
|
|
1168
|
+
declare function gapStyle({ display, flow, gap }: {
|
|
1169
|
+
display?: string | NoType;
|
|
1170
|
+
flow?: string | NoType;
|
|
1171
|
+
gap?: string | number | boolean | NoType;
|
|
894
1172
|
}): {
|
|
895
1173
|
gap: string;
|
|
896
1174
|
$?: undefined;
|
|
@@ -917,28 +1195,14 @@ interface HeightStyleProps {
|
|
|
917
1195
|
minHeight?: string | number | boolean;
|
|
918
1196
|
maxHeight?: string | number | boolean;
|
|
919
1197
|
}
|
|
920
|
-
declare function heightStyle({
|
|
921
|
-
height,
|
|
922
|
-
minHeight,
|
|
923
|
-
maxHeight
|
|
924
|
-
}: HeightStyleProps): Record<string, string | string[]> | null;
|
|
1198
|
+
declare function heightStyle({ height, minHeight, maxHeight }: HeightStyleProps): Record<string, string | string[]> | null;
|
|
925
1199
|
declare namespace heightStyle {
|
|
926
1200
|
var __lookupStyles: string[];
|
|
927
1201
|
}
|
|
928
1202
|
//#endregion
|
|
929
1203
|
//#region src/styles/inset.d.ts
|
|
930
|
-
declare function insetStyle({
|
|
931
|
-
inset,
|
|
932
|
-
insetBlock,
|
|
933
|
-
insetInline,
|
|
934
|
-
top,
|
|
935
|
-
right,
|
|
936
|
-
bottom,
|
|
937
|
-
left
|
|
938
|
-
}: {
|
|
1204
|
+
declare function insetStyle({ inset, top, right, bottom, left }: {
|
|
939
1205
|
inset?: string | number | boolean;
|
|
940
|
-
insetBlock?: string | number | boolean;
|
|
941
|
-
insetInline?: string | number | boolean;
|
|
942
1206
|
top?: string | number | boolean;
|
|
943
1207
|
right?: string | number | boolean;
|
|
944
1208
|
bottom?: string | number | boolean;
|
|
@@ -948,19 +1212,19 @@ declare namespace insetStyle {
|
|
|
948
1212
|
var __lookupStyles: string[];
|
|
949
1213
|
}
|
|
950
1214
|
//#endregion
|
|
1215
|
+
//#region src/styles/inlineSize.d.ts
|
|
1216
|
+
declare function inlineSizeStyle({ inlineSize, minInlineSize, maxInlineSize }: {
|
|
1217
|
+
inlineSize?: string | number | boolean;
|
|
1218
|
+
minInlineSize?: string | number | boolean;
|
|
1219
|
+
maxInlineSize?: string | number | boolean;
|
|
1220
|
+
}): Record<string, string | string[]> | null;
|
|
1221
|
+
declare namespace inlineSizeStyle {
|
|
1222
|
+
var __lookupStyles: ("inlineSize" | "maxInlineSize" | "minInlineSize")[];
|
|
1223
|
+
}
|
|
1224
|
+
//#endregion
|
|
951
1225
|
//#region src/styles/margin.d.ts
|
|
952
|
-
declare function marginStyle({
|
|
953
|
-
margin,
|
|
954
|
-
marginBlock,
|
|
955
|
-
marginInline,
|
|
956
|
-
marginTop,
|
|
957
|
-
marginRight,
|
|
958
|
-
marginBottom,
|
|
959
|
-
marginLeft
|
|
960
|
-
}: {
|
|
1226
|
+
declare function marginStyle({ margin, marginTop, marginRight, marginBottom, marginLeft }: {
|
|
961
1227
|
margin?: string | number | boolean;
|
|
962
|
-
marginBlock?: string | number | boolean;
|
|
963
|
-
marginInline?: string | number | boolean;
|
|
964
1228
|
marginTop?: string | number | boolean;
|
|
965
1229
|
marginRight?: string | number | boolean;
|
|
966
1230
|
marginBottom?: string | number | boolean;
|
|
@@ -989,27 +1253,14 @@ interface OutlineStyleProps {
|
|
|
989
1253
|
*
|
|
990
1254
|
* @return CSS properties for outline and optionally outline-offset
|
|
991
1255
|
*/
|
|
992
|
-
declare function outlineStyle({
|
|
993
|
-
outline,
|
|
994
|
-
outlineOffset
|
|
995
|
-
}: OutlineStyleProps): Record<string, string> | null;
|
|
1256
|
+
declare function outlineStyle({ outline, outlineOffset }: OutlineStyleProps): Record<string, string> | null;
|
|
996
1257
|
declare namespace outlineStyle {
|
|
997
1258
|
var __lookupStyles: string[];
|
|
998
1259
|
}
|
|
999
1260
|
//#endregion
|
|
1000
1261
|
//#region src/styles/padding.d.ts
|
|
1001
|
-
declare function paddingStyle({
|
|
1002
|
-
padding,
|
|
1003
|
-
paddingBlock,
|
|
1004
|
-
paddingInline,
|
|
1005
|
-
paddingTop,
|
|
1006
|
-
paddingRight,
|
|
1007
|
-
paddingBottom,
|
|
1008
|
-
paddingLeft
|
|
1009
|
-
}: {
|
|
1262
|
+
declare function paddingStyle({ padding, paddingTop, paddingRight, paddingBottom, paddingLeft }: {
|
|
1010
1263
|
padding?: string | number | boolean;
|
|
1011
|
-
paddingBlock?: string | number | boolean;
|
|
1012
|
-
paddingInline?: string | number | boolean;
|
|
1013
1264
|
paddingTop?: string | number | boolean;
|
|
1014
1265
|
paddingRight?: string | number | boolean;
|
|
1015
1266
|
paddingBottom?: string | number | boolean;
|
|
@@ -1039,17 +1290,7 @@ interface PlacementStyleProps {
|
|
|
1039
1290
|
* 2. placeItems, placeContent, align, justify (medium) — each sets 2 longhands
|
|
1040
1291
|
* 3. alignItems, alignContent, justifyItems, justifyContent (highest) — each sets 1 longhand
|
|
1041
1292
|
*/
|
|
1042
|
-
declare function placementStyle({
|
|
1043
|
-
place,
|
|
1044
|
-
placeItems,
|
|
1045
|
-
placeContent,
|
|
1046
|
-
align,
|
|
1047
|
-
justify,
|
|
1048
|
-
alignItems,
|
|
1049
|
-
alignContent,
|
|
1050
|
-
justifyItems,
|
|
1051
|
-
justifyContent
|
|
1052
|
-
}: PlacementStyleProps): Record<string, string> | null;
|
|
1293
|
+
declare function placementStyle({ place, placeItems, placeContent, align, justify, alignItems, alignContent, justifyItems, justifyContent }: PlacementStyleProps): Record<string, string> | null;
|
|
1053
1294
|
declare namespace placementStyle {
|
|
1054
1295
|
var __lookupStyles: string[];
|
|
1055
1296
|
}
|
|
@@ -1090,25 +1331,13 @@ interface PresetStyleProps {
|
|
|
1090
1331
|
* - `font` is the recommended prop with special handling (monospace, boolean, fallback)
|
|
1091
1332
|
* - `fontFamily` is a direct value without special handling
|
|
1092
1333
|
*/
|
|
1093
|
-
declare function presetStyle({
|
|
1094
|
-
preset,
|
|
1095
|
-
fontSize,
|
|
1096
|
-
lineHeight,
|
|
1097
|
-
textTransform,
|
|
1098
|
-
letterSpacing,
|
|
1099
|
-
fontWeight,
|
|
1100
|
-
fontStyle,
|
|
1101
|
-
fontFamily,
|
|
1102
|
-
font
|
|
1103
|
-
}: PresetStyleProps): Styles | null;
|
|
1334
|
+
declare function presetStyle({ preset, fontSize, lineHeight, textTransform, letterSpacing, fontWeight, fontStyle, fontFamily, font }: PresetStyleProps): CSSMap | null;
|
|
1104
1335
|
declare namespace presetStyle {
|
|
1105
1336
|
var __lookupStyles: string[];
|
|
1106
1337
|
}
|
|
1107
1338
|
//#endregion
|
|
1108
1339
|
//#region src/styles/radius.d.ts
|
|
1109
|
-
declare function radiusStyle({
|
|
1110
|
-
radius
|
|
1111
|
-
}: {
|
|
1340
|
+
declare function radiusStyle({ radius }: {
|
|
1112
1341
|
radius?: string | number | boolean;
|
|
1113
1342
|
}): Record<string, string> | null;
|
|
1114
1343
|
declare namespace radiusStyle {
|
|
@@ -1116,18 +1345,8 @@ declare namespace radiusStyle {
|
|
|
1116
1345
|
}
|
|
1117
1346
|
//#endregion
|
|
1118
1347
|
//#region src/styles/scrollMargin.d.ts
|
|
1119
|
-
declare function scrollMarginStyle({
|
|
1120
|
-
scrollMargin,
|
|
1121
|
-
scrollMarginBlock,
|
|
1122
|
-
scrollMarginInline,
|
|
1123
|
-
scrollMarginTop,
|
|
1124
|
-
scrollMarginRight,
|
|
1125
|
-
scrollMarginBottom,
|
|
1126
|
-
scrollMarginLeft
|
|
1127
|
-
}: {
|
|
1348
|
+
declare function scrollMarginStyle({ scrollMargin, scrollMarginTop, scrollMarginRight, scrollMarginBottom, scrollMarginLeft }: {
|
|
1128
1349
|
scrollMargin?: string | number | boolean;
|
|
1129
|
-
scrollMarginBlock?: string | number | boolean;
|
|
1130
|
-
scrollMarginInline?: string | number | boolean;
|
|
1131
1350
|
scrollMarginTop?: string | number | boolean;
|
|
1132
1351
|
scrollMarginRight?: string | number | boolean;
|
|
1133
1352
|
scrollMarginBottom?: string | number | boolean;
|
|
@@ -1137,6 +1356,18 @@ declare namespace scrollMarginStyle {
|
|
|
1137
1356
|
var __lookupStyles: string[];
|
|
1138
1357
|
}
|
|
1139
1358
|
//#endregion
|
|
1359
|
+
//#region src/styles/scrollPadding.d.ts
|
|
1360
|
+
declare function scrollPaddingStyle({ scrollPadding, scrollPaddingTop, scrollPaddingRight, scrollPaddingBottom, scrollPaddingLeft }: {
|
|
1361
|
+
scrollPadding?: string | number | boolean;
|
|
1362
|
+
scrollPaddingTop?: string | number | boolean;
|
|
1363
|
+
scrollPaddingRight?: string | number | boolean;
|
|
1364
|
+
scrollPaddingBottom?: string | number | boolean;
|
|
1365
|
+
scrollPaddingLeft?: string | number | boolean;
|
|
1366
|
+
}): Record<string, string> | null;
|
|
1367
|
+
declare namespace scrollPaddingStyle {
|
|
1368
|
+
var __lookupStyles: string[];
|
|
1369
|
+
}
|
|
1370
|
+
//#endregion
|
|
1140
1371
|
//#region src/styles/scrollbar.d.ts
|
|
1141
1372
|
interface ScrollbarStyleProps {
|
|
1142
1373
|
scrollbar?: string | boolean;
|
|
@@ -1152,18 +1383,13 @@ interface ScrollbarStyleProps {
|
|
|
1152
1383
|
* Note: `auto` is classified as a VALUE_KEYWORD by the parser, so it lands
|
|
1153
1384
|
* in `values` rather than `mods`. Both locations are checked for robustness.
|
|
1154
1385
|
*/
|
|
1155
|
-
declare function scrollbarStyle({
|
|
1156
|
-
scrollbar,
|
|
1157
|
-
overflow
|
|
1158
|
-
}: ScrollbarStyleProps): Record<string, string> | null;
|
|
1386
|
+
declare function scrollbarStyle({ scrollbar, overflow }: ScrollbarStyleProps): Record<string, string> | null;
|
|
1159
1387
|
declare namespace scrollbarStyle {
|
|
1160
1388
|
var __lookupStyles: string[];
|
|
1161
1389
|
}
|
|
1162
1390
|
//#endregion
|
|
1163
1391
|
//#region src/styles/shadow.d.ts
|
|
1164
|
-
declare function shadowStyle({
|
|
1165
|
-
shadow
|
|
1166
|
-
}: {
|
|
1392
|
+
declare function shadowStyle({ shadow }: {
|
|
1167
1393
|
shadow?: string | boolean;
|
|
1168
1394
|
}): {
|
|
1169
1395
|
'box-shadow': string;
|
|
@@ -1173,9 +1399,7 @@ declare namespace shadowStyle {
|
|
|
1173
1399
|
}
|
|
1174
1400
|
//#endregion
|
|
1175
1401
|
//#region src/styles/transition.d.ts
|
|
1176
|
-
declare function transitionStyle({
|
|
1177
|
-
transition
|
|
1178
|
-
}: {
|
|
1402
|
+
declare function transitionStyle({ transition }: {
|
|
1179
1403
|
transition?: string;
|
|
1180
1404
|
}): {
|
|
1181
1405
|
transition: string;
|
|
@@ -1190,11 +1414,7 @@ interface WidthStyleProps {
|
|
|
1190
1414
|
minWidth?: string | number | boolean;
|
|
1191
1415
|
maxWidth?: string | number | boolean;
|
|
1192
1416
|
}
|
|
1193
|
-
declare function widthStyle({
|
|
1194
|
-
width,
|
|
1195
|
-
minWidth,
|
|
1196
|
-
maxWidth
|
|
1197
|
-
}: WidthStyleProps): Record<string, string | string[]> | null;
|
|
1417
|
+
declare function widthStyle({ width, minWidth, maxWidth }: WidthStyleProps): Record<string, string | string[]> | null;
|
|
1198
1418
|
declare namespace widthStyle {
|
|
1199
1419
|
var __lookupStyles: string[];
|
|
1200
1420
|
}
|
|
@@ -1224,16 +1444,6 @@ declare namespace widthStyle {
|
|
|
1224
1444
|
* ```
|
|
1225
1445
|
*/
|
|
1226
1446
|
declare const styleHandlers: {
|
|
1227
|
-
readonly border: typeof borderStyle;
|
|
1228
|
-
readonly color: typeof colorStyle;
|
|
1229
|
-
readonly display: typeof displayStyle;
|
|
1230
|
-
readonly fade: typeof fadeStyle;
|
|
1231
|
-
readonly fill: typeof fillStyle;
|
|
1232
|
-
readonly svgFill: typeof svgFillStyle;
|
|
1233
|
-
readonly flow: typeof flowStyle;
|
|
1234
|
-
readonly gap: typeof gapStyle;
|
|
1235
|
-
readonly height: typeof heightStyle;
|
|
1236
|
-
readonly inset: typeof insetStyle;
|
|
1237
1447
|
readonly margin: typeof marginStyle;
|
|
1238
1448
|
readonly outline: typeof outlineStyle;
|
|
1239
1449
|
readonly padding: typeof paddingStyle;
|
|
@@ -1241,12 +1451,67 @@ declare const styleHandlers: {
|
|
|
1241
1451
|
readonly preset: typeof presetStyle;
|
|
1242
1452
|
readonly radius: typeof radiusStyle;
|
|
1243
1453
|
readonly scrollMargin: typeof scrollMarginStyle;
|
|
1454
|
+
readonly scrollPadding: typeof scrollPaddingStyle;
|
|
1244
1455
|
readonly scrollbar: typeof scrollbarStyle;
|
|
1245
1456
|
readonly shadow: typeof shadowStyle;
|
|
1246
1457
|
readonly transition: typeof transitionStyle;
|
|
1247
1458
|
readonly width: typeof widthStyle;
|
|
1459
|
+
readonly blockBorder: StyleHandler<Partial<Record<"blockBorder", string | number | boolean | undefined>>>;
|
|
1460
|
+
readonly inlineBorder: StyleHandler<Partial<Record<"inlineBorder", string | number | boolean | undefined>>>;
|
|
1461
|
+
readonly blockScrollPadding: StyleHandler<Partial<Record<"blockScrollPadding", string | number | boolean | undefined>>>;
|
|
1462
|
+
readonly inlineScrollPadding: StyleHandler<Partial<Record<"inlineScrollPadding", string | number | boolean | undefined>>>;
|
|
1463
|
+
readonly blockScrollMargin: StyleHandler<Partial<Record<"blockScrollMargin", string | number | boolean | undefined>>>;
|
|
1464
|
+
readonly inlineScrollMargin: StyleHandler<Partial<Record<"inlineScrollMargin", string | number | boolean | undefined>>>;
|
|
1465
|
+
readonly blockInset: StyleHandler<Partial<Record<"blockInset", string | number | boolean | undefined>>>;
|
|
1466
|
+
readonly inlineInset: StyleHandler<Partial<Record<"inlineInset", string | number | boolean | undefined>>>;
|
|
1467
|
+
readonly blockMargin: StyleHandler<Partial<Record<"blockMargin", string | number | boolean | undefined>>>;
|
|
1468
|
+
readonly inlineMargin: StyleHandler<Partial<Record<"inlineMargin", string | number | boolean | undefined>>>;
|
|
1469
|
+
readonly blockPadding: StyleHandler<Partial<Record<"blockPadding", string | number | boolean | undefined>>>;
|
|
1470
|
+
readonly inlinePadding: StyleHandler<Partial<Record<"inlinePadding", string | number | boolean | undefined>>>;
|
|
1471
|
+
readonly blockSize: typeof blockSizeStyle;
|
|
1472
|
+
readonly border: typeof borderStyle;
|
|
1473
|
+
readonly color: typeof colorStyle;
|
|
1474
|
+
readonly display: typeof displayStyle;
|
|
1475
|
+
readonly fade: typeof fadeStyle;
|
|
1476
|
+
readonly fill: typeof fillStyle;
|
|
1477
|
+
readonly svgFill: typeof svgFillStyle;
|
|
1478
|
+
readonly flow: typeof flowStyle;
|
|
1479
|
+
readonly gap: typeof gapStyle;
|
|
1480
|
+
readonly height: typeof heightStyle;
|
|
1481
|
+
readonly inset: typeof insetStyle;
|
|
1482
|
+
readonly inlineSize: typeof inlineSizeStyle;
|
|
1248
1483
|
};
|
|
1249
1484
|
//#endregion
|
|
1485
|
+
//#region src/styles/define-handler.d.ts
|
|
1486
|
+
/**
|
|
1487
|
+
* Declare a multi-dependency style handler with its dependency names inferred
|
|
1488
|
+
* into the handler's parameter type.
|
|
1489
|
+
*
|
|
1490
|
+
* Without it, the multi-dependency tuple form needs a hand-written parameter
|
|
1491
|
+
* annotation that can silently drift from the dependency list:
|
|
1492
|
+
*
|
|
1493
|
+
* ```ts
|
|
1494
|
+
* // Annotation and dependency list are maintained separately.
|
|
1495
|
+
* handlers: {
|
|
1496
|
+
* spacing: [['gap', 'padding'], ({ gap, padding }: { gap?: string; padding?: string }) => …],
|
|
1497
|
+
* }
|
|
1498
|
+
*
|
|
1499
|
+
* // Both come from the same array; a typo in the destructure is a type error.
|
|
1500
|
+
* handlers: {
|
|
1501
|
+
* spacing: defineHandler(['gap', 'padding'], ({ gap, padding }) => …),
|
|
1502
|
+
* }
|
|
1503
|
+
* ```
|
|
1504
|
+
*
|
|
1505
|
+
* Values arrive **state-resolved but unparsed** — the raw authored DSL string
|
|
1506
|
+
* (`'2x'`, `'#purple.5'`), so call `parseStyle()` / `parseColor()` as needed. The
|
|
1507
|
+
* result is a kebab-case CSS declaration map (or an array of them); the reserved
|
|
1508
|
+
* `$` key applies the declarations to a nested selector.
|
|
1509
|
+
*
|
|
1510
|
+
* All names must belong to the same chunk. Names the built-in chunk lists don't
|
|
1511
|
+
* know are pulled into their handler's chunk automatically at registration.
|
|
1512
|
+
*/
|
|
1513
|
+
declare function defineHandler<const TDeps extends readonly string[]>(deps: TDeps, handler: (props: Partial<Record<TDeps[number], ResolvedStyleValue>>) => StyleHandlerResult): [readonly string[], RawStyleHandler];
|
|
1514
|
+
//#endregion
|
|
1250
1515
|
//#region src/compute-styles.d.ts
|
|
1251
1516
|
interface ComputeStylesResult {
|
|
1252
1517
|
className: string;
|
|
@@ -1257,6 +1522,13 @@ interface ComputeStylesOptions {
|
|
|
1257
1522
|
ssrCollector?: ServerStyleCollector | null;
|
|
1258
1523
|
/** Target root for style injection (client only). Defaults to `document`. */
|
|
1259
1524
|
root?: Document | ShadowRoot;
|
|
1525
|
+
/**
|
|
1526
|
+
* Set when `styles` outlives this call and will be passed in again — a
|
|
1527
|
+
* `tasty()` factory's own styles object rather than a per-render merge.
|
|
1528
|
+
* It lets chunk cache keys be memoized on the object, which is worth the
|
|
1529
|
+
* bookkeeping only when there is a next render to spend it on.
|
|
1530
|
+
*/
|
|
1531
|
+
stableStyles?: boolean;
|
|
1260
1532
|
}
|
|
1261
1533
|
/**
|
|
1262
1534
|
* Synchronous, hook-free style computation.
|
|
@@ -1314,10 +1586,7 @@ declare const chunkSheetRegistry: ChunkSheetRegistry;
|
|
|
1314
1586
|
/**
|
|
1315
1587
|
* Inject styles and return className with dispose function
|
|
1316
1588
|
*/
|
|
1317
|
-
declare function inject(rules: StyleResult[], options?:
|
|
1318
|
-
root?: Document | ShadowRoot;
|
|
1319
|
-
cacheKey?: string;
|
|
1320
|
-
}): InjectResult;
|
|
1589
|
+
declare function inject(rules: StyleResult[], options?: InjectOptions): InjectResult;
|
|
1321
1590
|
/**
|
|
1322
1591
|
* Inject global rules that should not reserve tasty class names
|
|
1323
1592
|
*/
|
|
@@ -1359,26 +1628,6 @@ declare function keyframes(steps: KeyframesSteps, nameOrOptions?: string | {
|
|
|
1359
1628
|
root?: Document | ShadowRoot;
|
|
1360
1629
|
name?: string;
|
|
1361
1630
|
}): KeyframesResult;
|
|
1362
|
-
interface PropertyOptions {
|
|
1363
|
-
/**
|
|
1364
|
-
* CSS syntax string for the property (e.g., '<color>', '<length>', '<angle>')
|
|
1365
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/@property/syntax
|
|
1366
|
-
*/
|
|
1367
|
-
syntax?: string;
|
|
1368
|
-
/**
|
|
1369
|
-
* Whether the property inherits from parent elements
|
|
1370
|
-
* @default true
|
|
1371
|
-
*/
|
|
1372
|
-
inherits?: boolean;
|
|
1373
|
-
/**
|
|
1374
|
-
* Initial value for the property
|
|
1375
|
-
*/
|
|
1376
|
-
initialValue?: string | number;
|
|
1377
|
-
/**
|
|
1378
|
-
* Shadow root or document to inject into
|
|
1379
|
-
*/
|
|
1380
|
-
root?: Document | ShadowRoot;
|
|
1381
|
-
}
|
|
1382
1631
|
/**
|
|
1383
1632
|
* Define a CSS @property custom property.
|
|
1384
1633
|
* This enables advanced features like animating custom properties.
|
|
@@ -1405,7 +1654,7 @@ interface PropertyOptions {
|
|
|
1405
1654
|
* });
|
|
1406
1655
|
* ```
|
|
1407
1656
|
*/
|
|
1408
|
-
declare function property
|
|
1657
|
+
declare function property(name: string, options?: PropertyOptions): void;
|
|
1409
1658
|
/**
|
|
1410
1659
|
* Check if a CSS @property has already been defined
|
|
1411
1660
|
*
|
|
@@ -1427,49 +1676,85 @@ declare function fontFace(family: string, descriptors: FontFaceDescriptors, opti
|
|
|
1427
1676
|
/**
|
|
1428
1677
|
* Inject a CSS @counter-style rule.
|
|
1429
1678
|
*
|
|
1430
|
-
* Permanent and global — no dispose or ref-counting.
|
|
1431
|
-
*
|
|
1679
|
+
* Permanent and global — no dispose or ref-counting. Deduplicates by name and
|
|
1680
|
+
* overrides an existing rule by default. Pass `weak: true` for global
|
|
1681
|
+
* `configure()` definitions, which never clobber an existing rule.
|
|
1432
1682
|
*/
|
|
1433
1683
|
declare function counterStyle(name: string, descriptors: CounterStyleDescriptors, options?: {
|
|
1434
1684
|
root?: Document | ShadowRoot;
|
|
1685
|
+
weak?: boolean;
|
|
1686
|
+
}): void;
|
|
1687
|
+
/**
|
|
1688
|
+
* Inject a CSS @function rule (custom function).
|
|
1689
|
+
*
|
|
1690
|
+
* Permanent and global — no dispose or ref-counting. Deduplicates by function
|
|
1691
|
+
* name and overrides an existing rule by default. Pass `weak: true` for global
|
|
1692
|
+
* `configure()` definitions, which never clobber an existing rule.
|
|
1693
|
+
*
|
|
1694
|
+
* @param name - The function name (`$$name`, `$name`, or `--name`)
|
|
1695
|
+
* @param definition - Function definition (args, returns, result, local vars)
|
|
1696
|
+
*
|
|
1697
|
+
* @example
|
|
1698
|
+
* ```ts
|
|
1699
|
+
* func('$$negative', { args: ['$value'], result: '(-1 * $value)' });
|
|
1700
|
+
* ```
|
|
1701
|
+
*/
|
|
1702
|
+
declare function func(name: string, definition: FunctionDefinition, options?: {
|
|
1703
|
+
root?: Document | ShadowRoot;
|
|
1704
|
+
weak?: boolean;
|
|
1435
1705
|
}): void;
|
|
1436
1706
|
/**
|
|
1437
1707
|
* Get CSS text from all sheets (for SSR)
|
|
1438
1708
|
*/
|
|
1439
|
-
declare function
|
|
1709
|
+
declare function getCSSText(options?: {
|
|
1440
1710
|
root?: Document | ShadowRoot;
|
|
1441
1711
|
}): string;
|
|
1442
1712
|
/**
|
|
1443
1713
|
* Collect only CSS used by a rendered subtree (like jest-styled-components).
|
|
1444
1714
|
* Pass the container returned by render(...).
|
|
1445
1715
|
*/
|
|
1446
|
-
declare function
|
|
1716
|
+
declare function getCSSTextForNode(node: ParentNode | Element | DocumentFragment, options?: {
|
|
1447
1717
|
root?: Document | ShadowRoot;
|
|
1448
1718
|
}): string;
|
|
1449
1719
|
/**
|
|
1450
|
-
*
|
|
1720
|
+
* Take a reference on local `@keyframes` under the deterministic names the
|
|
1721
|
+
* caller resolved, and report which entry holds each. Pair with
|
|
1722
|
+
* `ownKeyframes()` once the rules exist to inspect.
|
|
1723
|
+
*/
|
|
1724
|
+
declare function holdKeyframes(steps: Record<string, KeyframesSteps>, names: Map<string, string>, options?: {
|
|
1725
|
+
root?: Document | ShadowRoot;
|
|
1726
|
+
}): Map<string, string>;
|
|
1727
|
+
/**
|
|
1728
|
+
* Record that a class animates these keyframes, so the reference is released
|
|
1729
|
+
* when the last such class is collected.
|
|
1730
|
+
*/
|
|
1731
|
+
declare function ownKeyframes(key: string, className: string, options?: {
|
|
1732
|
+
root?: Document | ShadowRoot;
|
|
1733
|
+
}): void;
|
|
1734
|
+
/**
|
|
1735
|
+
* Remove every injected rule that is neither in the DOM nor held by an
|
|
1736
|
+
* outstanding `inject()` handle. Equivalent to `gc({ force: true })`.
|
|
1451
1737
|
*/
|
|
1452
1738
|
declare function cleanup(root?: Document | ShadowRoot): void;
|
|
1453
1739
|
/**
|
|
1454
|
-
*
|
|
1455
|
-
* Used internally by computeStyles and tasty()
|
|
1456
|
-
*
|
|
1740
|
+
* Count a render, so that a collection pass is scheduled every
|
|
1741
|
+
* `gc.touchInterval` of them. Used internally by computeStyles and tasty().
|
|
1742
|
+
*
|
|
1743
|
+
* @deprecated The class name is ignored — collection asks the DOM what is
|
|
1744
|
+
* rendered rather than recording usage per class. The argument is kept so
|
|
1745
|
+
* existing calls still compile.
|
|
1457
1746
|
*/
|
|
1458
1747
|
declare function touch(className: string, options?: {
|
|
1459
1748
|
root?: Document | ShadowRoot;
|
|
1460
1749
|
}): void;
|
|
1461
1750
|
/**
|
|
1462
|
-
* Synchronous garbage collection of unused styles
|
|
1463
|
-
* Evicts the oldest
|
|
1464
|
-
* With `{ force: true }`, removes
|
|
1751
|
+
* Synchronous garbage collection of unused styles — those no element carries
|
|
1752
|
+
* and no `inject()` handle references. Evicts the oldest ones once they exceed
|
|
1753
|
+
* capacity. With `{ force: true }`, removes all of them regardless of capacity.
|
|
1465
1754
|
*
|
|
1466
1755
|
* @returns Number of styles evicted.
|
|
1467
1756
|
*/
|
|
1468
1757
|
declare function gc(options?: GCOptions): number;
|
|
1469
|
-
/**
|
|
1470
|
-
* Check if we're currently running in a test environment
|
|
1471
|
-
*/
|
|
1472
|
-
declare function getIsTestEnvironment(): boolean;
|
|
1473
1758
|
/**
|
|
1474
1759
|
* Get the global injector instance for debugging
|
|
1475
1760
|
*/
|
|
@@ -1486,80 +1771,54 @@ declare function destroy(root?: Document | ShadowRoot): void;
|
|
|
1486
1771
|
declare function createInjector(config?: Partial<StyleInjectorConfig>): StyleInjector;
|
|
1487
1772
|
//#endregion
|
|
1488
1773
|
//#region src/utils/filter-base-props.d.ts
|
|
1774
|
+
declare const basePropNames: readonly ["role", "title", "inert", "as", "element", "css", "qa", "mods", "qaVal", "hidden", "isHidden", "disabled", "isDisabled", "children", "style", "className", "href", "target", "tabIndex"];
|
|
1775
|
+
declare const ignoredEventPropNames: readonly ["onPress", "onHoverStart", "onHoverEnd", "onPressStart", "onPressEnd"];
|
|
1489
1776
|
interface PropsFilterOptions {
|
|
1490
1777
|
labelable?: boolean;
|
|
1491
|
-
propNames?:
|
|
1778
|
+
propNames?: ReadonlySet<string>;
|
|
1492
1779
|
eventProps?: boolean;
|
|
1493
1780
|
}
|
|
1781
|
+
type ExplicitPropName<O> = O extends {
|
|
1782
|
+
propNames?: ReadonlySet<infer P>;
|
|
1783
|
+
} ? Extract<P, string> : never;
|
|
1784
|
+
type EventPropsEnabled<O> = O extends {
|
|
1785
|
+
eventProps?: infer E;
|
|
1786
|
+
} ? Extract<E, boolean> : never;
|
|
1787
|
+
type Characters<S extends string> = S extends `${infer First}${infer Rest}` ? First | Characters<Rest> : never;
|
|
1788
|
+
/** Models DOM-style event keys and the runtime's ignored event names. */
|
|
1789
|
+
type EventPropName<K extends string> = string extends K ? `on${Characters<'ABCDEFGHIJKLMNOPQRSTUVWXYZ'>}${string}` : K extends `on${infer Initial}${infer Rest}` ? 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' extends `${string}${Initial}${string}` ? Rest extends '' ? never : Exclude<K, (typeof ignoredEventPropNames)[number]> : never : never;
|
|
1790
|
+
type ExplicitNumericPropName<K, O> = K extends number ? `${K}` extends ExplicitPropName<O> ? K : never : never;
|
|
1791
|
+
type RetainedPropName<T, O> = 'id' | (typeof basePropNames)[number] | `aria-${string}` | `data-${string}` | ExplicitPropName<O> | (true extends EventPropsEnabled<O> ? EventPropName<Extract<keyof T, string>> : never);
|
|
1792
|
+
type FilteredProps<T extends object, O> = T extends unknown ? Partial<Pick<T, Extract<keyof T, RetainedPropName<T, O>> | Extract<RetainedPropName<T, O>, keyof T> | ExplicitNumericPropName<keyof T, O>>> : never;
|
|
1494
1793
|
/**
|
|
1495
|
-
*
|
|
1794
|
+
* Keeps the built-in base props, ARIA/data attributes, and explicitly allowed props.
|
|
1795
|
+
* DOM-style event names are kept only with `eventProps: true`, except the ignored
|
|
1796
|
+
* interaction events (which can still be allowed explicitly via `propNames`).
|
|
1797
|
+
* The return type preserves the input value types only for potentially retained
|
|
1798
|
+
* keys. Props remain optional because only own enumerable string keys are copied.
|
|
1799
|
+
* Use a literal union (e.g. `new Set(['name', 'type'] as const)`) for `propNames`
|
|
1800
|
+
* to keep precise types; a `Set<string>` can potentially retain any string key.
|
|
1496
1801
|
* @param props - The component props to be filtered.
|
|
1497
|
-
* @param opts -
|
|
1802
|
+
* @param opts - Additional prop names and event forwarding options.
|
|
1498
1803
|
*/
|
|
1499
|
-
declare function filterBaseProps<T extends object>(props: T, opts?:
|
|
1804
|
+
declare function filterBaseProps<T extends object>(props: T, opts?: undefined): FilteredProps<T, undefined>;
|
|
1805
|
+
declare function filterBaseProps<T extends object, O extends PropsFilterOptions | undefined = PropsFilterOptions>(props: T, opts: O): FilteredProps<T, O>;
|
|
1500
1806
|
//#endregion
|
|
1501
1807
|
//#region src/utils/colors.d.ts
|
|
1502
1808
|
declare function color$1(name: string, opacity?: number): string;
|
|
1503
1809
|
//#endregion
|
|
1504
1810
|
//#region src/utils/mod-attrs.d.ts
|
|
1505
|
-
declare
|
|
1506
|
-
//#endregion
|
|
1507
|
-
//#region src/utils/dotize.d.ts
|
|
1508
|
-
declare const dotize: {
|
|
1509
|
-
valTypes: {
|
|
1510
|
-
none: string;
|
|
1511
|
-
primitive: string;
|
|
1512
|
-
object: string;
|
|
1513
|
-
array: string;
|
|
1514
|
-
};
|
|
1515
|
-
getValType: (val: any) => string | undefined;
|
|
1516
|
-
getPathType: (arrPath: any) => string[];
|
|
1517
|
-
isUndefined: (obj: any) => obj is undefined;
|
|
1518
|
-
isNumber: (f: any) => boolean;
|
|
1519
|
-
isEmptyObj: (obj: any) => boolean;
|
|
1520
|
-
isPlainObject: (obj: any) => boolean;
|
|
1521
|
-
isNotObject: (obj: any) => boolean;
|
|
1522
|
-
isEmptyArray: (arr: any) => boolean;
|
|
1523
|
-
isNotArray: (arr: any) => boolean;
|
|
1524
|
-
removeEmptyArrayItem: (arr: any) => any;
|
|
1525
|
-
getFieldName: (field: any, prefix: any, isRoot: any, isArrayItem: any, isArray: any) => string;
|
|
1526
|
-
startsWith: (val: any, valToSearch: any) => boolean;
|
|
1527
|
-
convert: (obj: any, prefix?: string) => any;
|
|
1528
|
-
backward: (obj: any, prefix: any) => any;
|
|
1529
|
-
};
|
|
1811
|
+
declare function modAttrs(map: AllBaseProps['mods']): Record<string, string> | null;
|
|
1530
1812
|
//#endregion
|
|
1531
1813
|
//#region src/utils/resolve-recipes.d.ts
|
|
1532
|
-
/**
|
|
1533
|
-
* Resolve all `recipe` style properties in a styles object.
|
|
1534
|
-
*
|
|
1535
|
-
* Handles both top-level and sub-element recipe references.
|
|
1536
|
-
* Returns the same object reference if no recipes are present anywhere
|
|
1537
|
-
* (zero overhead for the common case).
|
|
1538
|
-
*
|
|
1539
|
-
* @param styles - The styles object potentially containing `recipe` keys
|
|
1540
|
-
* @returns Resolved styles with recipe values merged in, or the original object if unchanged
|
|
1541
|
-
*/
|
|
1814
|
+
/** Resolve recipe references against the globally configured recipe map. */
|
|
1542
1815
|
declare function resolveRecipes(styles: Styles): Styles;
|
|
1543
1816
|
//#endregion
|
|
1544
|
-
//#region src/utils/warnings.d.ts
|
|
1545
|
-
declare function warn(...args: unknown[]): void;
|
|
1546
|
-
declare function deprecationWarning(condition: unknown, {
|
|
1547
|
-
property,
|
|
1548
|
-
name,
|
|
1549
|
-
betterAlternative,
|
|
1550
|
-
reason
|
|
1551
|
-
}: {
|
|
1552
|
-
property: string;
|
|
1553
|
-
name: string;
|
|
1554
|
-
betterAlternative: (() => string) | string;
|
|
1555
|
-
reason?: (() => string) | string;
|
|
1556
|
-
}): void;
|
|
1557
|
-
//#endregion
|
|
1558
1817
|
//#region src/utils/process-tokens.d.ts
|
|
1559
1818
|
/**
|
|
1560
1819
|
* Process tokens object into inline style properties.
|
|
1561
|
-
* -
|
|
1562
|
-
* -
|
|
1820
|
+
* - `$name` -> `--name` with the parsed value
|
|
1821
|
+
* - `#name` -> `--name-color` with the parsed value
|
|
1563
1822
|
*
|
|
1564
1823
|
* @param tokens - The tokens object to process
|
|
1565
1824
|
* @returns CSSProperties object or undefined if no tokens to process
|
|
@@ -1578,19 +1837,19 @@ interface DebugOptions {
|
|
|
1578
1837
|
/** Suppress console logging and return data only (default: false) */
|
|
1579
1838
|
raw?: boolean;
|
|
1580
1839
|
}
|
|
1581
|
-
interface
|
|
1840
|
+
interface CSSOptions extends DebugOptions {
|
|
1582
1841
|
prettify?: boolean;
|
|
1583
1842
|
/** Read from stored source CSS (dev-mode only) instead of live CSSOM */
|
|
1584
1843
|
source?: boolean;
|
|
1585
1844
|
}
|
|
1586
|
-
interface
|
|
1845
|
+
interface DebugChunkInfo {
|
|
1587
1846
|
className: string;
|
|
1588
1847
|
chunkName: string | null;
|
|
1589
1848
|
}
|
|
1590
1849
|
interface InspectResult {
|
|
1591
1850
|
element?: Element | null;
|
|
1592
1851
|
classes: string[];
|
|
1593
|
-
chunks:
|
|
1852
|
+
chunks: DebugChunkInfo[];
|
|
1594
1853
|
css: string;
|
|
1595
1854
|
size: number;
|
|
1596
1855
|
rules: number;
|
|
@@ -1614,7 +1873,13 @@ interface ChunkBreakdown {
|
|
|
1614
1873
|
}
|
|
1615
1874
|
interface Summary {
|
|
1616
1875
|
activeClasses: string[];
|
|
1876
|
+
/** Classes `gc({ force: true })` would delete right now. */
|
|
1617
1877
|
unusedClasses: string[];
|
|
1878
|
+
/**
|
|
1879
|
+
* Held but in neither list: nothing renders them, yet collection will not
|
|
1880
|
+
* take them — inside the grace window, or pinned by an `inject()` handle.
|
|
1881
|
+
*/
|
|
1882
|
+
hotClasses: string[];
|
|
1618
1883
|
totalStyledClasses: string[];
|
|
1619
1884
|
activeCSSSize: number;
|
|
1620
1885
|
unusedCSSSize: number;
|
|
@@ -1639,7 +1904,7 @@ interface Summary {
|
|
|
1639
1904
|
chunkBreakdown: ChunkBreakdown;
|
|
1640
1905
|
}
|
|
1641
1906
|
declare const tastyDebug: {
|
|
1642
|
-
css(target: CSSTarget, opts?:
|
|
1907
|
+
css(target: CSSTarget, opts?: CSSOptions): string;
|
|
1643
1908
|
inspect(target: string | Element, opts?: DebugOptions): InspectResult;
|
|
1644
1909
|
summary(opts?: DebugOptions): Summary;
|
|
1645
1910
|
chunks(opts?: DebugOptions): ChunkBreakdown;
|
|
@@ -1651,5 +1916,5 @@ declare const tastyDebug: {
|
|
|
1651
1916
|
install(): void;
|
|
1652
1917
|
};
|
|
1653
1918
|
//#endregion
|
|
1654
|
-
export {
|
|
1655
|
-
//# sourceMappingURL=index-
|
|
1919
|
+
export { createColorFunc as $, OuterStyleProps as $t, keyframes as A, strToRgb as An, TastyElementOptions as At, styleHandlers as B, BasePropsWithoutChildren as Bt, getRawCSSText as C, DEFAULT_ZERO_NAME_PREFIX as Cn, ResolveAsProps as Ct, injectRawCSS as D, getRgbValuesFromRgbaString as Dn, SubElementDefinition as Dt, injectGlobal as E, getNamedColorHex as En, ResolveTokenProps as Et, chunkSheetRegistry as F, VariantMap as Ft, ChunkName as G, ColorStyleProps as Gt, categorizeStyleKeys as H, BlockInnerStyleProps as Ht, ComputeStylesOptions as I, WithVariant as It, FONT_CHUNK_STYLES as J, ExtraBaseStyleProps as Jt, DIMENSION_CHUNK_STYLES as K, ContainerStyleProps as Kt, ComputeStylesResult as L, tasty as Lt, property as M, TastyPolymorphicComponent as Mt, touch as N, TastyProps as Nt, injector as O, hexToRgb as On, SubElementProps as Ot, ChunkSheetRegistry as P, TokenPropsInput as Pt, resolveFunctionColor as Q, Mods as Qt, computeStyles as R, AllBaseProps as Rt, getCSSTextForNode as S, DEFAULT_NAME_PREFIX as Sn, ModPropsInput as St, inject as T, isSelector as Tn, ResolveModProps as Tt, APPEARANCE_CHUNK_STYLES as U, BlockOuterStyleProps as Ut, ChunkInfo as V, BaseStyleProps as Vt, CHUNK_NAMES as W, BlockStyleProps as Wt, POSITION_CHUNK_STYLES as X, InnerStyleProps as Xt, LAYOUT_CHUNK_STYLES as Y, FlowStyleProps as Yt, STYLE_TO_CHUNK as Z, ModValue as Zt, destroy as _, FLOW_STYLES as _n, useStyles as _t, DebugOptions as a, TastyExtensionConfig as an, TastyBatchProvider as at, gc as b, POSITION_STYLES as bn, ElementsDefinition as bt, tastyDebug as c, TokenValue as cn, useFunction as ct, modAttrs as d, BLOCK_INNER_STYLES as dn, UsePropertyOptions as dt, PositionStyleProps as en, okhstFunction as et, color$1 as f, BLOCK_OUTER_STYLES as fn, useProperty as ft, createInjector as g, DIMENSION_STYLES as gn, UseStylesResult as gt, counterStyle as h, CONTAINER_STYLES as hn, useGlobalStyles as ht, DebugChunkInfo as i, TastyCustomProps as in, getDisplayName as it, ownKeyframes as j, TastyElementProps as jt, isPropertyDefined as k, hslToRgbValues as kn, TastyComponentPropsWithDefaults as kt, processTokens as l, Tokens as ln, useCounterStyle as lt, cleanup as m, COLOR_STYLES as mn, useRawCSS as mt, CacheStatus as n, TagName as nn, okhslFunction as nt, InspectResult as o, TastyThemeNames as on, TastyBatchProviderProps as ot, filterBaseProps as p, BLOCK_STYLES as pn, useKeyframes as pt, DISPLAY_CHUNK_STYLES as q, DimensionStyleProps as qt, ChunkBreakdown as r, TastyBaseStylePropNames as rn, okhslPlugin as rt, Summary as s, TextStyleProps as sn, UseFunctionOptions as st, CSSOptions as t, ShortGridStyles as tn, okhstPlugin as tt, resolveRecipes as u, BASE_STYLES as un, useFontFace as ut, fontFace as v, INNER_STYLES as vn, AllBasePropsWithMods as vt, holdKeyframes as w, hasStylesGenerated as wn, ResolveModPropDef as wt, getCSSText as x, TEXT_STYLES as xn, ModPropDef as xt, func as y, OUTER_STYLES as yn, Element$1 as yt, defineHandler as z, BaseProps as zt };
|
|
1920
|
+
//# sourceMappingURL=index-CYJtAI9a.d.ts.map
|