@tenphi/tasty 0.0.0-snapshot.2f41cf6 → 0.0.0-snapshot.2f4e31d
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 +440 -372
- package/dist/babel-types-Dc5zghyE.d.ts +18 -0
- package/dist/chunks/async-storage-f9j9JRtq.js +37 -0
- package/dist/chunks/async-storage-f9j9JRtq.js.map +1 -0
- package/dist/chunks/build-config-D9Iq8QQm.js +60 -0
- package/dist/chunks/build-config-D9Iq8QQm.js.map +1 -0
- package/dist/{collector-BMEQCkCn.js → chunks/collector-Cb8ah2JF.js} +68 -101
- package/dist/chunks/collector-Cb8ah2JF.js.map +1 -0
- package/dist/chunks/config-engine-CMYFZYQh.js +272 -0
- package/dist/chunks/config-engine-CMYFZYQh.js.map +1 -0
- package/dist/chunks/config-file-DlZXJMj8.js +25 -0
- package/dist/chunks/config-file-DlZXJMj8.js.map +1 -0
- package/dist/chunks/css-definitions-B4aWBkH3.js +910 -0
- package/dist/chunks/css-definitions-B4aWBkH3.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-D2Pu7Xhy.js +502 -0
- package/dist/chunks/debug-D2Pu7Xhy.js.map +1 -0
- package/dist/chunks/dsl-CsFl9LGn.js +1458 -0
- package/dist/chunks/dsl-CsFl9LGn.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-DHiopXCu.js +691 -0
- package/dist/chunks/react-runtime-DHiopXCu.js.map +1 -0
- package/dist/chunks/runtime-engine-NGCofNXy.js +2435 -0
- package/dist/chunks/runtime-engine-NGCofNXy.js.map +1 -0
- package/dist/chunks/runtime-state-lZjMbvwV.js +152 -0
- package/dist/chunks/runtime-state-lZjMbvwV.js.map +1 -0
- package/dist/{merge-styles-3il_ClCF.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-DnkV_4Jg.js +5602 -0
- package/dist/chunks/style-engine-DnkV_4Jg.js.map +1 -0
- package/dist/{css-writer-BSv8PrEX.js → chunks/zero-engine-DcwaCvFs.js} +95 -136
- package/dist/chunks/zero-engine-DcwaCvFs.js.map +1 -0
- package/dist/{collector-osfWTeRd.d.ts → collector-D2OT6I2G.d.ts} +64 -8
- package/dist/{config-BoZDUHW5.d.ts → config-C4ftFxgI.d.ts} +514 -92
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +9 -6
- package/dist/hydrate-CRyjjAyl.d.ts +22 -0
- package/dist/{index-D-OA_O6i.d.ts → index-DxQNRj50.d.ts} +718 -502
- package/dist/index.d.ts +5 -5
- package/dist/index.js +11 -732
- package/dist/{merge-styles-BMWcH6MF.d.ts → merge-styles-D39qBtox.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/client.d.ts +2 -0
- package/dist/ssr/client.js +2 -0
- package/dist/ssr/index.d.ts +5 -32
- package/dist/ssr/index.js +6 -6
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +64 -0
- package/dist/ssr/next-config.js +123 -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-CYQIhUg1.d.ts} +883 -600
- package/dist/zero/babel.d.ts +12 -20
- package/dist/zero/babel.js +97 -156
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +76 -7
- package/dist/zero/index.js +25 -2
- package/dist/zero/index.js.map +1 -0
- package/dist/zero/next.d.ts +4 -5
- package/dist/zero/next.js +3 -38
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +20 -9
- package/docs/adoption.md +69 -36
- package/docs/ai-agents.md +259 -0
- package/docs/comparison.md +77 -47
- package/docs/configuration.md +617 -98
- package/docs/debug.md +28 -15
- package/docs/design-system.md +154 -33
- package/docs/dsl.md +715 -194
- package/docs/getting-started.md +130 -50
- package/docs/injector.md +160 -69
- package/docs/methodology.md +82 -51
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +102 -33
- package/docs/plugins.md +333 -0
- package/docs/react-api.md +215 -50
- package/docs/runtime-benchmarks.md +388 -0
- package/docs/ssr.md +310 -118
- package/docs/styles.md +225 -42
- package/docs/tasty-static.md +289 -136
- package/package.json +141 -45
- package/tasty.config.ts +6 -0
- package/dist/async-storage-B7_o6FKt.js +0 -44
- package/dist/async-storage-B7_o6FKt.js.map +0 -1
- package/dist/collector-BMEQCkCn.js.map +0 -1
- package/dist/config-eiremPHv.js +0 -10559
- package/dist/config-eiremPHv.js.map +0 -1
- package/dist/context-CkSg-kDT.js +0 -24
- package/dist/context-CkSg-kDT.js.map +0 -1
- package/dist/core-Dm9EkOA_.js +0 -1598
- package/dist/core-Dm9EkOA_.js.map +0 -1
- package/dist/css-writer-BSv8PrEX.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-DcFFQceU.js +0 -143
- package/dist/format-rules-DcFFQceU.js.map +0 -1
- package/dist/hydrate-B6SjFHhj.js +0 -45
- package/dist/hydrate-B6SjFHhj.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/keyframes-DJ8Geo4L.js +0 -595
- package/dist/keyframes-DJ8Geo4L.js.map +0 -1
- package/dist/merge-styles-3il_ClCF.js.map +0 -1
- package/dist/resolve-recipes-B3MSkfFQ.js +0 -144
- package/dist/resolve-recipes-B3MSkfFQ.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-CYQIhUg1.js";
|
|
2
|
+
import { f as TastyPluginFactory, y as StyleInjector } from "./config-C4ftFxgI.js";
|
|
3
|
+
import { t as ServerStyleCollector } from "./collector-D2OT6I2G.js";
|
|
4
|
+
import "./merge-styles-D39qBtox.js";
|
|
5
|
+
import React, { 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,182 +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
|
-
/**
|
|
64
|
-
* Style chunk definitions for CSS chunking optimization.
|
|
65
|
-
*
|
|
66
|
-
* Styles are grouped into chunks based on:
|
|
67
|
-
* 1. Handler dependencies - styles that share a handler MUST be in the same chunk
|
|
68
|
-
* 2. Logical grouping - related styles grouped for better cache reuse
|
|
69
|
-
*
|
|
70
|
-
* See STYLE_CHUNKING_SPEC.md for detailed rationale.
|
|
71
|
-
*
|
|
72
|
-
* ============================================================================
|
|
73
|
-
* ⚠️ CRITICAL ARCHITECTURAL CONSTRAINT: NO CROSS-CHUNK HANDLER DEPENDENCIES
|
|
74
|
-
* ============================================================================
|
|
75
|
-
*
|
|
76
|
-
* Style handlers declare their dependencies via `__lookupStyles` array.
|
|
77
|
-
* This creates a dependency graph where handlers read multiple style props.
|
|
78
|
-
*
|
|
79
|
-
* **ALL styles in a handler's `__lookupStyles` MUST be in the SAME chunk.**
|
|
80
|
-
*
|
|
81
|
-
* Why this matters:
|
|
82
|
-
* 1. Each chunk computes a cache key from ONLY its own style values
|
|
83
|
-
* 2. If a handler reads a style from another chunk, that value isn't in the cache key
|
|
84
|
-
* 3. Changing the cross-chunk style won't invalidate this chunk's cache
|
|
85
|
-
* 4. Result: stale CSS output or incorrect cache hits
|
|
86
|
-
*
|
|
87
|
-
* Example of a violation:
|
|
88
|
-
* ```
|
|
89
|
-
* // flowStyle.__lookupStyles = ['display', 'flow']
|
|
90
|
-
* // If 'display' is in DISPLAY chunk and 'flow' is in LAYOUT chunk:
|
|
91
|
-
* // - User sets { display: 'grid', flow: 'column' }
|
|
92
|
-
* // - LAYOUT chunk caches CSS with flow=column, display=grid
|
|
93
|
-
* // - User changes to { display: 'flex', flow: 'column' }
|
|
94
|
-
* // - LAYOUT chunk cache key unchanged (only has 'flow')
|
|
95
|
-
* // - Returns stale CSS computed with display=grid!
|
|
96
|
-
* ```
|
|
97
|
-
*
|
|
98
|
-
* Before adding/moving styles, verify:
|
|
99
|
-
* 1. Find all handlers that use this style (grep for the style name in __lookupStyles)
|
|
100
|
-
* 2. Ensure ALL styles from each handler's __lookupStyles are in the same chunk
|
|
101
|
-
* ============================================================================
|
|
102
|
-
*/
|
|
103
|
-
/**
|
|
104
|
-
* Appearance chunk - visual styling with independent handlers
|
|
105
|
-
*
|
|
106
|
-
* @public
|
|
107
|
-
*/
|
|
108
|
-
declare const APPEARANCE_CHUNK_STYLES: readonly ["fill", "color", "opacity", "border", "radius", "outline", "outlineOffset", "shadow", "fade"];
|
|
109
|
-
/**
|
|
110
|
-
* Font chunk - typography styles
|
|
111
|
-
*
|
|
112
|
-
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
113
|
-
* ⚠️ presetStyle: preset, fontSize, lineHeight, letterSpacing, textTransform,
|
|
114
|
-
* fontWeight, fontStyle, font
|
|
115
|
-
*/
|
|
116
|
-
/** @public */
|
|
117
|
-
declare const FONT_CHUNK_STYLES: readonly ["preset", "font", "fontWeight", "fontStyle", "fontSize", "lineHeight", "letterSpacing", "textTransform", "fontFamily", "textAlign", "textDecoration", "wordBreak", "wordWrap", "boldFontWeight"];
|
|
118
|
-
/**
|
|
119
|
-
* Dimension chunk - sizing and spacing
|
|
120
|
-
*
|
|
121
|
-
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
122
|
-
* ⚠️ paddingStyle: padding, paddingTop/Right/Bottom/Left, paddingBlock/Inline
|
|
123
|
-
* ⚠️ marginStyle: margin, marginTop/Right/Bottom/Left, marginBlock/Inline
|
|
124
|
-
* ⚠️ widthStyle: width, minWidth, maxWidth
|
|
125
|
-
* ⚠️ heightStyle: height, minHeight, maxHeight
|
|
126
|
-
*/
|
|
127
|
-
/** @public */
|
|
128
|
-
declare const DIMENSION_CHUNK_STYLES: readonly ["padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "paddingBlock", "paddingInline", "margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "marginBlock", "marginInline", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "flexBasis", "flexGrow", "flexShrink", "flex"];
|
|
129
|
-
/**
|
|
130
|
-
* Display chunk - display mode, layout flow, text overflow, and scrollbar
|
|
131
|
-
*
|
|
132
|
-
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
133
|
-
* ⚠️ displayStyle: display, hide, textOverflow, overflow, whiteSpace
|
|
134
|
-
* ⚠️ flowStyle: display, flow
|
|
135
|
-
* ⚠️ gapStyle: display, flow, gap
|
|
136
|
-
* ⚠️ scrollbarStyle: scrollbar, overflow
|
|
137
|
-
*/
|
|
138
|
-
/** @public */
|
|
139
|
-
declare const DISPLAY_CHUNK_STYLES: readonly ["display", "hide", "textOverflow", "overflow", "whiteSpace", "flow", "gap", "scrollbar"];
|
|
140
|
-
/**
|
|
141
|
-
* Layout chunk - flex/grid alignment and grid templates
|
|
142
|
-
*
|
|
143
|
-
* Note: flow and gap are in DISPLAY chunk due to handler dependencies
|
|
144
|
-
* (flowStyle and gapStyle both require 'display' prop).
|
|
145
|
-
*/
|
|
146
|
-
/** @public */
|
|
147
|
-
declare const LAYOUT_CHUNK_STYLES: readonly ["placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "place", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas", "gridAutoFlow", "gridAutoColumns", "gridAutoRows"];
|
|
148
|
-
/**
|
|
149
|
-
* Position chunk - element positioning
|
|
150
|
-
*
|
|
151
|
-
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
152
|
-
* ⚠️ insetStyle: inset, insetBlock, insetInline, top, right, bottom, left
|
|
153
|
-
*/
|
|
154
|
-
/** @public */
|
|
155
|
-
declare const POSITION_CHUNK_STYLES: readonly ["position", "inset", "insetBlock", "insetInline", "top", "right", "bottom", "left", "zIndex", "gridArea", "gridColumn", "gridRow", "order", "placeSelf", "alignSelf", "justifySelf", "transform", "transition", "animation"];
|
|
156
|
-
declare const CHUNK_NAMES: {
|
|
157
|
-
/** Special chunk for styles that cannot be split */readonly COMBINED: "combined";
|
|
158
|
-
readonly SUBCOMPONENTS: "subcomponents";
|
|
159
|
-
readonly APPEARANCE: "appearance";
|
|
160
|
-
readonly FONT: "font";
|
|
161
|
-
readonly DIMENSION: "dimension";
|
|
162
|
-
readonly DISPLAY: "display";
|
|
163
|
-
readonly LAYOUT: "layout";
|
|
164
|
-
readonly POSITION: "position";
|
|
165
|
-
readonly MISC: "misc";
|
|
166
|
-
};
|
|
167
|
-
type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];
|
|
168
|
-
/**
|
|
169
|
-
* Pre-computed map for O(1) style-to-chunk lookup.
|
|
170
|
-
* Built once at module load time.
|
|
171
|
-
*/
|
|
172
|
-
declare const STYLE_TO_CHUNK: Map<string, ChunkName>;
|
|
173
|
-
interface ChunkInfo$1 {
|
|
174
|
-
/** Name of the chunk */
|
|
175
|
-
name: ChunkName | string;
|
|
176
|
-
/** Style keys belonging to this chunk */
|
|
177
|
-
styleKeys: string[];
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Categorize style keys into chunks.
|
|
181
|
-
*
|
|
182
|
-
* Returns chunks in a deterministic order (by CHUNK_ORDER) regardless
|
|
183
|
-
* of the order of keys in the input styles object.
|
|
184
|
-
*
|
|
185
|
-
* @param styles - The styles object to categorize
|
|
186
|
-
* @returns Map of chunk name to array of style keys in that chunk (in priority order)
|
|
187
|
-
*/
|
|
188
|
-
declare function categorizeStyleKeys(styles: Record<string, unknown>): Map<string, string[]>;
|
|
189
|
-
//#endregion
|
|
190
88
|
//#region src/styles/list.d.ts
|
|
191
89
|
declare const BASE_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition"];
|
|
192
|
-
declare const POSITION_STYLES: readonly ["gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "inset", "position", "scrollMargin"];
|
|
193
|
-
declare const BLOCK_INNER_STYLES: readonly ["padding", "
|
|
194
|
-
declare const BLOCK_OUTER_STYLES: readonly ["border", "radius", "shadow", "outline"];
|
|
195
|
-
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"];
|
|
196
94
|
declare const COLOR_STYLES: readonly ["color", "fill", "fade", "image"];
|
|
197
95
|
declare const TEXT_STYLES: readonly ["textTransform", "fontWeight", "fontStyle"];
|
|
198
|
-
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"];
|
|
199
97
|
declare const FLOW_STYLES: readonly ["flow", "place", "placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "gap", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas"];
|
|
200
|
-
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", "
|
|
201
|
-
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"];
|
|
202
|
-
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"];
|
|
203
101
|
//#endregion
|
|
204
102
|
//#region src/types.d.ts
|
|
205
|
-
interface GlobalStyledProps {
|
|
206
|
-
breakpoints?: number[];
|
|
207
|
-
}
|
|
208
103
|
/**
|
|
209
104
|
* Extensible interface for theme names.
|
|
210
105
|
* Augment this interface to register project-specific theme names for autocomplete.
|
|
@@ -222,6 +117,42 @@ interface GlobalStyledProps {
|
|
|
222
117
|
interface TastyThemeNames {}
|
|
223
118
|
type ThemeNameKey = Extract<keyof TastyThemeNames, string>;
|
|
224
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]>; };
|
|
225
156
|
/** Allowed mod value types */
|
|
226
157
|
type ModValue = boolean | string | number | undefined | null;
|
|
227
158
|
/**
|
|
@@ -244,7 +175,7 @@ type TokenValue = string | number | boolean | undefined | null;
|
|
|
244
175
|
/**
|
|
245
176
|
* Tokens definition for inline CSS custom properties.
|
|
246
177
|
* - `$name` keys become `--name` CSS properties
|
|
247
|
-
* - `#name` keys become `--name-color`
|
|
178
|
+
* - `#name` keys become `--name-color` CSS properties
|
|
248
179
|
*/
|
|
249
180
|
type Tokens = Record<`$${string}` | `#${string}`, TokenValue>;
|
|
250
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';
|
|
@@ -259,20 +190,14 @@ interface BasePropsWithoutChildren<K extends TagName = TagName> extends Pick<All
|
|
|
259
190
|
element?: `${Caps}${string}`;
|
|
260
191
|
/** The style map */
|
|
261
192
|
styles?: Styles;
|
|
262
|
-
/** The list of responsive points in pixels */
|
|
263
|
-
breakpoints?: number[];
|
|
264
|
-
/** Whether the element has the block layout outside */
|
|
265
|
-
block?: boolean;
|
|
266
|
-
/** Whether the element has the inline layout outside */
|
|
267
|
-
inline?: boolean;
|
|
268
193
|
/** The list of element modifiers **/
|
|
269
194
|
mods?: Mods;
|
|
270
195
|
/** Whether the element is hidden (`hidden` attribute is set) */
|
|
271
196
|
isHidden?: boolean;
|
|
272
197
|
/** Whether the element is disabled (`disabled` attribute is set) */
|
|
273
198
|
isDisabled?: boolean;
|
|
274
|
-
/**
|
|
275
|
-
|
|
199
|
+
/** Whether the element is checked (`checked` attribute is set) */
|
|
200
|
+
isChecked?: boolean;
|
|
276
201
|
/** The CSS style map */
|
|
277
202
|
style?: CSSProperties$1 | (CSSProperties$1 & Record<string, string | number | null | undefined>);
|
|
278
203
|
/** User-defined theme for the element. Mapped to `data-theme` attribute. Augment `TastyThemeNames` to register project-specific themes for autocomplete. */
|
|
@@ -300,7 +225,6 @@ interface ShortGridStyles {
|
|
|
300
225
|
rows?: Styles['gridRows'];
|
|
301
226
|
areas?: Styles['gridAreas'];
|
|
302
227
|
}
|
|
303
|
-
type Props = Record<string, any>;
|
|
304
228
|
type TagName = keyof HTMLElementTagNameMap;
|
|
305
229
|
/**
|
|
306
230
|
* Configuration type for tasty.config.ts files.
|
|
@@ -345,7 +269,7 @@ interface TastyExtensionConfig {
|
|
|
345
269
|
* Set to `false` to disable function validation (overrides parent).
|
|
346
270
|
* @example ['clamp', 'double']
|
|
347
271
|
*/
|
|
348
|
-
|
|
272
|
+
functions?: false | string[];
|
|
349
273
|
/**
|
|
350
274
|
* State alias names for autocomplete.
|
|
351
275
|
* Must start with @ prefix.
|
|
@@ -379,7 +303,7 @@ interface TastyExtensionConfig {
|
|
|
379
303
|
}
|
|
380
304
|
//#endregion
|
|
381
305
|
//#region src/tasty.d.ts
|
|
382
|
-
type StyleList = readonly (keyof { [key in keyof StylesInterface]: StylesInterface[key] })[];
|
|
306
|
+
type StyleList = readonly (keyof { [key in keyof StylesInterface]: StylesInterface[key]; })[];
|
|
383
307
|
/** Type descriptor for a single mod prop: a JS constructor or an enum array. */
|
|
384
308
|
type ModPropDef = BooleanConstructor | StringConstructor | NumberConstructor | readonly string[];
|
|
385
309
|
/** Array form: list of mod key names (types default to ModValue). */
|
|
@@ -391,7 +315,7 @@ type ModPropsInput = ModPropsList | ModPropsMap;
|
|
|
391
315
|
/** Resolve a single ModPropDef to its TypeScript type. */
|
|
392
316
|
type ResolveModPropDef<T> = T extends BooleanConstructor ? boolean : T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends readonly (infer U)[] ? U : ModValue;
|
|
393
317
|
/** Resolve an entire `modProps` definition to the component prop types it adds. */
|
|
394
|
-
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]>; } : {};
|
|
395
319
|
/** A token key with `$` or `#` prefix. */
|
|
396
320
|
type TokenPropKey = `$${string}` | `#${string}`;
|
|
397
321
|
/** Array form: list of prop names. Names ending in `Color` map to `#` color tokens. */
|
|
@@ -402,9 +326,10 @@ type TokenPropsMap = Readonly<Record<string, TokenPropKey>>;
|
|
|
402
326
|
type TokenPropsInput = TokenPropsList | TokenPropsMap;
|
|
403
327
|
/** Resolve a `tokenProps` definition to the component prop types it adds. */
|
|
404
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>;
|
|
405
330
|
type PropsWithStyles = {
|
|
406
331
|
styles?: Styles;
|
|
407
|
-
} & Omit<
|
|
332
|
+
} & Omit<Record<string, any>, 'styles'>;
|
|
408
333
|
type VariantMap = Record<string, Styles>;
|
|
409
334
|
interface WithVariant<V extends VariantMap> {
|
|
410
335
|
variant?: keyof V;
|
|
@@ -432,13 +357,15 @@ type ResolveElementTag<T extends SubElementDefinition<any>> = T extends string ?
|
|
|
432
357
|
} ? Tag extends keyof JSX.IntrinsicElements ? Tag : 'div' : 'div';
|
|
433
358
|
/**
|
|
434
359
|
* Props for sub-element components.
|
|
435
|
-
* Combines HTML attributes with tasty-specific props (qa, qaVal, mods, tokens, isDisabled, etc.)
|
|
360
|
+
* Combines HTML attributes with tasty-specific props (qa, qaVal, mods, tokens, theme, isDisabled, etc.)
|
|
436
361
|
*/
|
|
437
362
|
type SubElementProps<Tag extends keyof JSX.IntrinsicElements = 'div'> = Omit<JSX.IntrinsicElements[Tag], 'ref' | 'color' | 'content' | 'translate'> & {
|
|
438
363
|
qa?: string;
|
|
439
364
|
qaVal?: string | number;
|
|
440
365
|
mods?: Mods;
|
|
441
366
|
tokens?: Tokens;
|
|
367
|
+
/** User-defined theme for the element. Mapped to `data-theme` attribute. */
|
|
368
|
+
theme?: BaseProps['theme'];
|
|
442
369
|
isDisabled?: boolean;
|
|
443
370
|
isHidden?: boolean;
|
|
444
371
|
isChecked?: boolean;
|
|
@@ -446,24 +373,43 @@ type SubElementProps<Tag extends keyof JSX.IntrinsicElements = 'div'> = Omit<JSX
|
|
|
446
373
|
/**
|
|
447
374
|
* Generates the sub-element component types from an ElementsDefinition
|
|
448
375
|
*/
|
|
449
|
-
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
|
|
376
|
+
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>>; };
|
|
450
377
|
/**
|
|
451
378
|
* Base type containing common properties shared between TastyProps and TastyElementOptions.
|
|
452
379
|
* Separated to avoid code duplication while allowing different type constraints.
|
|
453
380
|
*/
|
|
454
381
|
type TastyBaseProps<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = {
|
|
455
|
-
/** Default styles of the element. */
|
|
456
|
-
|
|
457
|
-
|
|
382
|
+
/** Default styles of the element. */
|
|
383
|
+
styles?: Styles;
|
|
384
|
+
/** The list of styles that can be provided by props */
|
|
385
|
+
styleProps?: K;
|
|
386
|
+
/** Modifier keys exposed as top-level component props (array or typed object form). */
|
|
387
|
+
modProps?: M;
|
|
388
|
+
/** Token keys exposed as top-level component props (array or typed object form). */
|
|
458
389
|
tokenProps?: TP;
|
|
459
390
|
element?: BaseProps['element'];
|
|
460
|
-
variants?: V;
|
|
461
|
-
|
|
391
|
+
variants?: V;
|
|
392
|
+
/** Default tokens for inline CSS custom properties */
|
|
393
|
+
tokens?: Tokens;
|
|
394
|
+
/** Sub-element definitions for compound components */
|
|
462
395
|
elements?: E;
|
|
463
|
-
} & Pick<BaseProps, 'qa' | 'qaVal'
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
396
|
+
} & Pick<BaseProps, 'qa' | 'qaVal'>;
|
|
397
|
+
/**
|
|
398
|
+
* The names the `variant` option of `tasty(Base, options)` accepts: the
|
|
399
|
+
* extension's own variants and the base's, as its `variant` prop does. A
|
|
400
|
+
* union, not an intersection of the two, so an extension can default to a
|
|
401
|
+
* variant only one of them defines.
|
|
402
|
+
*/
|
|
403
|
+
type ExtensionVariantName<V extends VariantMap, Props> = string extends keyof V ? 'variant' extends keyof Props ? NonNullable<Props['variant' & keyof Props]> : keyof V : keyof V | ('variant' extends keyof Props ? NonNullable<Props['variant' & keyof Props]> : never);
|
|
404
|
+
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> & {
|
|
405
|
+
/** The tag name of the element or a React component. */
|
|
406
|
+
as?: string | ComponentType<any>;
|
|
407
|
+
/**
|
|
408
|
+
* The variant applied when the `variant` prop is omitted or names no
|
|
409
|
+
* variant: one of `variants`, or one of the base component's.
|
|
410
|
+
*/
|
|
411
|
+
variant?: ExtensionVariantName<V, DefaultProps>;
|
|
412
|
+
} & Partial<Omit<DefaultProps, 'as' | 'styles' | 'styleProps' | 'modProps' | 'tokenProps' | 'tokens' | 'variant'>>;
|
|
467
413
|
/**
|
|
468
414
|
* Resolves the props of a polymorphic `as` value (intrinsic tag or component).
|
|
469
415
|
* - For intrinsic tags (`'div'`, `'button'`, ...): returns `JSX.IntrinsicElements[Tag]`.
|
|
@@ -477,18 +423,19 @@ type ResolveAsProps<AsType extends ElementType> = AsType extends keyof JSX.Intri
|
|
|
477
423
|
* element type from the `as` prop — both for intrinsic tags and for React
|
|
478
424
|
* components (so the wrapped component's prop API is preserved).
|
|
479
425
|
*
|
|
480
|
-
* Note: Uses a separate index signature with `unknown` instead of
|
|
481
|
-
*
|
|
426
|
+
* Note: Uses a separate index signature with `unknown` instead of an `any`
|
|
427
|
+
* record to ensure strict type checking for styles.
|
|
482
428
|
*/
|
|
483
|
-
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> & {
|
|
484
|
-
/** The tag name of the element or a React component. */
|
|
429
|
+
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> & WithVariant<V> & {
|
|
430
|
+
/** The tag name of the element or a React component. */
|
|
431
|
+
as?: AsType;
|
|
485
432
|
} & Record<string, unknown>;
|
|
486
|
-
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]
|
|
433
|
+
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>;
|
|
487
434
|
/**
|
|
488
|
-
*
|
|
489
|
-
*
|
|
435
|
+
* Props consumed by Tasty rather than forwarded to the `as` component.
|
|
436
|
+
* Event handlers are resolved from JSX.IntrinsicElements or the component's own props.
|
|
490
437
|
*/
|
|
491
|
-
type TastySpecificKeys = 'as' | 'qa' | 'qaVal' | 'element' | 'styles' | '
|
|
438
|
+
type TastySpecificKeys = keyof BaseStyleProps | 'as' | 'qa' | 'qaVal' | 'element' | 'styles' | 'mods' | 'isHidden' | 'isDisabled' | 'isChecked' | 'style' | 'theme' | 'tokens' | 'ref';
|
|
492
439
|
/** Extract prop key names from a ModPropsInput (array elements or object keys). */
|
|
493
440
|
type ModPropsKeys<M extends ModPropsInput> = M extends readonly (infer K)[] ? K & string : keyof M & string;
|
|
494
441
|
/** Extract prop key names from a TokenPropsInput (array elements or object keys). */
|
|
@@ -509,8 +456,25 @@ type TokenPropsKeys<TP extends TokenPropsInput> = TP extends readonly (infer K)[
|
|
|
509
456
|
* baseline is preserved so generic HTML attributes still work even when `as`
|
|
510
457
|
* is a component type with a narrower prop API.
|
|
511
458
|
*/
|
|
512
|
-
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>>;
|
|
513
|
-
|
|
459
|
+
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>>;
|
|
460
|
+
/** Statics React itself reads, as a type (see `REACT_STATICS`). */
|
|
461
|
+
type ReactStaticKey = '$$typeof' | 'render' | 'type' | 'compare' | 'displayName' | 'defaultProps' | 'propTypes' | 'contextType' | 'contextTypes' | 'childContextTypes' | 'getDerivedStateFromProps' | 'getDerivedStateFromError';
|
|
462
|
+
/**
|
|
463
|
+
* The statics of a component that are components themselves — a `tasty()`
|
|
464
|
+
* base's sub-elements (`Card.Title`) — which its extension keeps.
|
|
465
|
+
*/
|
|
466
|
+
type ComponentStatics<C> = { [Key in keyof C as Key extends ReactStaticKey ? never : C[Key] extends string ? never : C[Key] extends ElementType ? Key : never]: C[Key]; };
|
|
467
|
+
/** Prop names the extension form's own options claim from the base's props. */
|
|
468
|
+
type ExtensionClaimedKeys<K extends StyleList, V extends VariantMap, M extends ModPropsInput, TP extends TokenPropsInput> = K[number] | ModPropsKeys<M> | TokenPropsKeys<TP> | (string extends keyof V ? never : 'variant');
|
|
469
|
+
/**
|
|
470
|
+
* Props of a `tasty(Component, options)` extension: the base's props, plus
|
|
471
|
+
* whatever its own `styleProps`, `modProps`, `tokenProps` and `variants` add.
|
|
472
|
+
* Its variants extend the base's: `variant` accepts either set.
|
|
473
|
+
*/
|
|
474
|
+
type TastyExtensionProps<Props extends PropsWithStyles, DefaultProps extends Partial<Props>, K extends StyleList = readonly never[], V extends VariantMap = VariantMap, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = [ExtensionClaimedKeys<K, V, M, TP>] extends [never] ? TastyComponentPropsWithDefaults<Props, DefaultProps> : Omit<TastyComponentPropsWithDefaults<Props, DefaultProps>, ExtensionClaimedKeys<K, V, M, TP>> & { [key in K[number]]?: StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]>; } & ResolveModProps<M> & ResolveTokenProps<TP> & (string extends keyof V ? unknown : {
|
|
475
|
+
variant?: keyof V | ('variant' extends keyof Props ? NonNullable<Props['variant']> : never);
|
|
476
|
+
});
|
|
477
|
+
type TastyComponentPropsWithDefaults<Props extends PropsWithStyles, DefaultProps extends Partial<Props>> = keyof DefaultProps extends never ? Props : keyof Props extends keyof DefaultProps ? Partial<Props> : { [key in Extract<keyof Props, keyof DefaultProps>]?: Props[key]; } & { [key in keyof Omit<Props, keyof DefaultProps>]: Props[key]; };
|
|
514
478
|
/**
|
|
515
479
|
* The component type returned by the `tasty(options)` element-factory overload.
|
|
516
480
|
*
|
|
@@ -525,16 +489,11 @@ type TastyComponentPropsWithDefaults<Props extends PropsWithStyles, DefaultProps
|
|
|
525
489
|
* `SomeComponent`; create another `tasty({ as: SomeComponent })` for that.
|
|
526
490
|
*/
|
|
527
491
|
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>>;
|
|
528
|
-
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>;
|
|
529
|
-
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<
|
|
530
|
-
declare const Element$1: TastyPolymorphicComponent<"div",
|
|
492
|
+
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>;
|
|
493
|
+
declare function tasty<Props extends PropsWithStyles, DefaultProps extends Partial<Props> = Partial<Props>, K extends StyleList = readonly never[], V extends VariantMap = VariantMap, const E extends ElementsDefinition = Record<string, never>, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[], C extends ComponentType<Props> = ComponentType<Props>>(Component: C & ComponentType<Props>, options?: TastyProps<K, V, E, Props, M, TP>): ComponentType<TastyExtensionProps<Props, DefaultProps, K, V, M, TP>> & ComponentStatics<C> & (string extends keyof E ? unknown : SubElementComponents<E>);
|
|
494
|
+
declare const Element$1: TastyPolymorphicComponent<"div", readonly never[], VariantMap, readonly never[], readonly never[]> & SubElementComponents<Record<string, never>>;
|
|
531
495
|
//#endregion
|
|
532
496
|
//#region src/hooks/useStyles.d.ts
|
|
533
|
-
/**
|
|
534
|
-
* Tasty styles object to generate CSS classes for.
|
|
535
|
-
* Can be undefined or empty object for no styles.
|
|
536
|
-
*/
|
|
537
|
-
type UseStylesOptions = Styles | undefined;
|
|
538
497
|
interface UseStylesResult {
|
|
539
498
|
/**
|
|
540
499
|
* Generated className(s) to apply to the element.
|
|
@@ -548,7 +507,9 @@ interface UseStylesResult {
|
|
|
548
507
|
* Thin wrapper around `computeStyles()` that adds React context-based
|
|
549
508
|
* SSR collector discovery for backward compatibility with TastyRegistry.
|
|
550
509
|
*
|
|
551
|
-
*
|
|
510
|
+
* Works in Server Components too. There, like the other style functions, it
|
|
511
|
+
* cannot emit CSS itself: the next `tasty()` element in the tree emits it, so
|
|
512
|
+
* render one after it.
|
|
552
513
|
*
|
|
553
514
|
* @example
|
|
554
515
|
* ```tsx
|
|
@@ -563,7 +524,7 @@ interface UseStylesResult {
|
|
|
563
524
|
* }
|
|
564
525
|
* ```
|
|
565
526
|
*/
|
|
566
|
-
declare function useStyles(styles:
|
|
527
|
+
declare function useStyles(styles: Styles | undefined, options?: {
|
|
567
528
|
root?: Document | ShadowRoot;
|
|
568
529
|
}): UseStylesResult;
|
|
569
530
|
//#endregion
|
|
@@ -592,6 +553,10 @@ interface UseGlobalStylesOptions {
|
|
|
592
553
|
* Use the `id` option for update tracking when styles change over the
|
|
593
554
|
* component lifecycle.
|
|
594
555
|
*
|
|
556
|
+
* Update tracking is per-slot and per-root: a slot (`id`, or the selector when
|
|
557
|
+
* no `id` is given) holds exactly one injection per `root`. Changing the styles
|
|
558
|
+
* replaces it; rendering styles that produce no CSS clears it.
|
|
559
|
+
*
|
|
595
560
|
* @param selector - CSS selector to apply styles to (e.g., '.my-class', ':root', 'body')
|
|
596
561
|
* @param styles - Tasty styles object
|
|
597
562
|
* @param options - Optional settings including `id` for update tracking
|
|
@@ -614,9 +579,8 @@ declare function useGlobalStyles(selector: string, styles?: Styles, options?: Us
|
|
|
614
579
|
//#region src/hooks/useRawCSS.d.ts
|
|
615
580
|
interface UseRawCSSOptions {
|
|
616
581
|
/**
|
|
617
|
-
* Shadow root or document to inject into.
|
|
618
|
-
*
|
|
619
|
-
* only the root for the same id/content will not re-inject.
|
|
582
|
+
* Shadow root or document to inject into. Update tracking is per-root: the
|
|
583
|
+
* same id in two roots holds a separate injection in each.
|
|
620
584
|
*/
|
|
621
585
|
root?: Document | ShadowRoot;
|
|
622
586
|
/**
|
|
@@ -642,6 +606,11 @@ interface UseKeyframesOptions {
|
|
|
642
606
|
*
|
|
643
607
|
* Works in all environments: client, SSR with collector, and React Server Components.
|
|
644
608
|
*
|
|
609
|
+
* Passing `name` claims a slot owned by that one call site (like `useRawCSS`'s
|
|
610
|
+
* `id`): when its steps change, the previous injection is disposed and the name
|
|
611
|
+
* is reused, so the rules don't accumulate. Anonymous keyframes are permanent
|
|
612
|
+
* and shared by content.
|
|
613
|
+
*
|
|
645
614
|
* @example Basic usage - steps object is the dependency
|
|
646
615
|
* ```tsx
|
|
647
616
|
* function MyComponent() {
|
|
@@ -686,28 +655,11 @@ declare function useKeyframes(steps: KeyframesSteps, options?: UseKeyframesOptio
|
|
|
686
655
|
declare function useKeyframes(factory: () => KeyframesSteps, deps: readonly unknown[], options?: UseKeyframesOptions): string;
|
|
687
656
|
//#endregion
|
|
688
657
|
//#region src/hooks/useProperty.d.ts
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
*/
|
|
695
|
-
syntax?: string;
|
|
696
|
-
/**
|
|
697
|
-
* Whether the property inherits from parent elements
|
|
698
|
-
* @default true
|
|
699
|
-
*/
|
|
700
|
-
inherits?: boolean;
|
|
701
|
-
/**
|
|
702
|
-
* Initial value for the property.
|
|
703
|
-
* For color tokens (#name), this defaults to 'transparent' if not specified.
|
|
704
|
-
*/
|
|
705
|
-
initialValue?: string | number;
|
|
706
|
-
/**
|
|
707
|
-
* Shadow root or document to inject into
|
|
708
|
-
*/
|
|
709
|
-
root?: Document | ShadowRoot;
|
|
710
|
-
}
|
|
658
|
+
/**
|
|
659
|
+
* Options for {@link useProperty}. Extends the shared {@link PropertyOptions}
|
|
660
|
+
* (which is `PropertyDefinition` plus an optional injection `root`).
|
|
661
|
+
*/
|
|
662
|
+
type UsePropertyOptions = PropertyOptions;
|
|
711
663
|
/**
|
|
712
664
|
* Register a CSS @property custom property.
|
|
713
665
|
* This enables advanced features like animating custom properties.
|
|
@@ -837,7 +789,99 @@ interface UseCounterStyleOptions {
|
|
|
837
789
|
*/
|
|
838
790
|
declare function useCounterStyle(descriptors: CounterStyleDescriptors, options?: UseCounterStyleOptions): string;
|
|
839
791
|
//#endregion
|
|
792
|
+
//#region src/hooks/useFunction.d.ts
|
|
793
|
+
interface UseFunctionOptions {
|
|
794
|
+
/** Shadow root or document to inject into. */
|
|
795
|
+
root?: Document | ShadowRoot;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Register a CSS @function (custom function).
|
|
799
|
+
*
|
|
800
|
+
* @function rules are global and persistent once defined. The hook ensures the
|
|
801
|
+
* function is only registered once per root (deduplicated by function name).
|
|
802
|
+
*
|
|
803
|
+
* Accepts tasty token syntax for the function name:
|
|
804
|
+
* - `$$name` → defines `--name` (matches the call site `$$name(...)`)
|
|
805
|
+
* - `$name` / `--name` → also accepted
|
|
806
|
+
*
|
|
807
|
+
* Works in all environments: client, SSR with collector, and React Server Components.
|
|
808
|
+
*
|
|
809
|
+
* @param name - The function name token (`$$name`, `$name`, or `--name`)
|
|
810
|
+
* @param definition - Function definition (args, returns, result, local vars)
|
|
811
|
+
*
|
|
812
|
+
* Call the function through the Tasty DSL, not a raw `style` prop: an inline
|
|
813
|
+
* `style` value reaches the browser unparsed, so the `$$name(...)` sugar is never
|
|
814
|
+
* expanded and `polyfills.functions` cannot rewrite it either.
|
|
815
|
+
*
|
|
816
|
+
* @example
|
|
817
|
+
* ```tsx
|
|
818
|
+
* const Box = tasty({ styles: { marginTop: '$$negative(10px)' } });
|
|
819
|
+
*
|
|
820
|
+
* function Layout() {
|
|
821
|
+
* useFunction('$$negative', { args: ['$value'], result: '(-1 * $value)' });
|
|
822
|
+
* return <Box />;
|
|
823
|
+
* }
|
|
824
|
+
* ```
|
|
825
|
+
*/
|
|
826
|
+
declare function useFunction(name: string, definition: FunctionDefinition, options?: UseFunctionOptions): void;
|
|
827
|
+
//#endregion
|
|
828
|
+
//#region src/batch-provider.d.ts
|
|
829
|
+
interface TastyBatchProviderProps {
|
|
830
|
+
children?: ReactNode;
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Opens a *batch window* for the commit it renders in, so `batchInjection`
|
|
834
|
+
* can defer stylesheet writes without ever letting a layout effect measure an
|
|
835
|
+
* unstyled element.
|
|
836
|
+
*
|
|
837
|
+
* Every `insertRule()` on a live sheet invalidates style for that sheet's
|
|
838
|
+
* scope. When components inject during React's render phase while others read
|
|
839
|
+
* layout in the same pass, the two interleave and the browser recalculates
|
|
840
|
+
* style between every injection. Batching collapses that into one invalidation
|
|
841
|
+
* per flush — but only if the flush happens before anything can measure.
|
|
842
|
+
*
|
|
843
|
+
* ```
|
|
844
|
+
* provider renders -> window OPEN
|
|
845
|
+
* children render -> injections queued
|
|
846
|
+
* provider insertionEffect -> FLUSH, window CLOSED
|
|
847
|
+
* layout effects run -> rules are in the sheet
|
|
848
|
+
* ```
|
|
849
|
+
*
|
|
850
|
+
* `useInsertionEffect` runs in React's mutation phase, after every render in
|
|
851
|
+
* the commit and before any `useLayoutEffect` — which is exactly why React
|
|
852
|
+
* added it for CSS-in-JS libraries. Effects fire child-first, so this
|
|
853
|
+
* provider's runs after every descendant's and still before all layout
|
|
854
|
+
* effects.
|
|
855
|
+
*
|
|
856
|
+
* A commit that does not re-render this provider gets no window, and those
|
|
857
|
+
* injections are written synchronously instead. That is the point: turning
|
|
858
|
+
* `batchInjection: true` on can only ever make injection cheaper, never make a
|
|
859
|
+
* measurement wrong. It also means batching applies to commits this provider
|
|
860
|
+
* takes part in, so mount it as high in the tree as you can.
|
|
861
|
+
*
|
|
862
|
+
* Requires `configure({ batchInjection: true })`; without it this component
|
|
863
|
+
* only renders its children. `batchInjection: 'always'` does not need the
|
|
864
|
+
* provider at all — see that option's docs for the trade-off it accepts.
|
|
865
|
+
*
|
|
866
|
+
* @example
|
|
867
|
+
* ```tsx
|
|
868
|
+
* configure({ batchInjection: true });
|
|
869
|
+
*
|
|
870
|
+
* createRoot(el).render(
|
|
871
|
+
* <TastyBatchProvider>
|
|
872
|
+
* <App />
|
|
873
|
+
* </TastyBatchProvider>,
|
|
874
|
+
* );
|
|
875
|
+
* ```
|
|
876
|
+
*/
|
|
877
|
+
declare function TastyBatchProvider({ children }: TastyBatchProviderProps): React.ReactNode;
|
|
878
|
+
//#endregion
|
|
840
879
|
//#region src/utils/get-display-name.d.ts
|
|
880
|
+
/**
|
|
881
|
+
* A readable name for a component: its `displayName`, else its function name,
|
|
882
|
+
* looking through `forwardRef()` and `memo()` to the component they wrap. A
|
|
883
|
+
* tag name names itself. Falls back to `fallbackName` when there is none.
|
|
884
|
+
*/
|
|
841
885
|
declare function getDisplayName<T>(Component: ElementType<T>, fallbackName?: string): string;
|
|
842
886
|
//#endregion
|
|
843
887
|
//#region src/index.d.ts
|
|
@@ -845,6 +889,214 @@ declare module './utils/css-types' {
|
|
|
845
889
|
interface CSSProperties extends CSSProperties {}
|
|
846
890
|
}
|
|
847
891
|
//#endregion
|
|
892
|
+
//#region src/plugins/okhsl-plugin.d.ts
|
|
893
|
+
/**
|
|
894
|
+
* The okhsl function handler for tasty parser.
|
|
895
|
+
* Receives parsed style groups and returns an RGB color string.
|
|
896
|
+
*/
|
|
897
|
+
declare const okhslFunction: (groups: StyleDetails[]) => string;
|
|
898
|
+
/**
|
|
899
|
+
* OKHSL Plugin for Tasty.
|
|
900
|
+
*
|
|
901
|
+
* Adds support for the `okhsl()` color function in tasty styles.
|
|
902
|
+
*
|
|
903
|
+
* @example
|
|
904
|
+
* ```ts
|
|
905
|
+
* import { configure } from '@tenphi/tasty';
|
|
906
|
+
* import { okhslPlugin } from '@tenphi/tasty';
|
|
907
|
+
*
|
|
908
|
+
* configure({
|
|
909
|
+
* plugins: [okhslPlugin()],
|
|
910
|
+
* });
|
|
911
|
+
*
|
|
912
|
+
* // Now you can use okhsl in styles:
|
|
913
|
+
* const Box = tasty({
|
|
914
|
+
* styles: {
|
|
915
|
+
* fill: 'okhsl(240 50% 50%)',
|
|
916
|
+
* },
|
|
917
|
+
* });
|
|
918
|
+
* ```
|
|
919
|
+
*/
|
|
920
|
+
declare const okhslPlugin: TastyPluginFactory;
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region src/plugins/okhst-plugin.d.ts
|
|
923
|
+
/**
|
|
924
|
+
* The okhst function handler for tasty parser.
|
|
925
|
+
* Receives parsed style groups and returns an RGB color string.
|
|
926
|
+
*/
|
|
927
|
+
declare const okhstFunction: (groups: StyleDetails[]) => string;
|
|
928
|
+
/**
|
|
929
|
+
* OKHST Plugin for Tasty.
|
|
930
|
+
*
|
|
931
|
+
* Adds support for the `okhst()` color function in tasty styles.
|
|
932
|
+
*
|
|
933
|
+
* @example
|
|
934
|
+
* ```ts
|
|
935
|
+
* import { configure } from '@tenphi/tasty';
|
|
936
|
+
* import { okhstPlugin } from '@tenphi/tasty';
|
|
937
|
+
*
|
|
938
|
+
* configure({
|
|
939
|
+
* plugins: [okhstPlugin()],
|
|
940
|
+
* });
|
|
941
|
+
*
|
|
942
|
+
* // Now you can use okhst in styles:
|
|
943
|
+
* const Box = tasty({
|
|
944
|
+
* styles: {
|
|
945
|
+
* fill: 'okhst(240 50% 50%)',
|
|
946
|
+
* },
|
|
947
|
+
* });
|
|
948
|
+
* ```
|
|
949
|
+
*/
|
|
950
|
+
declare const okhstPlugin: TastyPluginFactory;
|
|
951
|
+
//#endregion
|
|
952
|
+
//#region src/plugins/color-func.d.ts
|
|
953
|
+
/**
|
|
954
|
+
* Creates a color function handler for the tasty parser.
|
|
955
|
+
*
|
|
956
|
+
* A color function is a custom `functions` entry that converts its arguments
|
|
957
|
+
* to an `rgb(...)` string (an already-supported color), so it needs no special
|
|
958
|
+
* core integration — registering it as a parse function is enough.
|
|
959
|
+
*
|
|
960
|
+
* @param name The name of the color function (e.g., 'okhsl', 'okhst')
|
|
961
|
+
* @param convert Converts the parsed first three channel values (after angle/
|
|
962
|
+
* percent normalization) to sRGB `[r, g, b]` in the 0-1 range
|
|
963
|
+
* @param label Optional diagnostic label shown in dev warnings when the wrong
|
|
964
|
+
* number of arguments is supplied (e.g., 'H S L'). Has no effect on parsing
|
|
965
|
+
* or output.
|
|
966
|
+
*/
|
|
967
|
+
declare function createColorFunc(name: string, convert: (h: number, c2: number, c3: number) => [number, number, number], label?: string): (groups: StyleDetails[]) => string;
|
|
968
|
+
//#endregion
|
|
969
|
+
//#region src/utils/function-color.d.ts
|
|
970
|
+
/**
|
|
971
|
+
* Resolve a `name(...)` value produced by a registered custom parse function
|
|
972
|
+
* into its concrete color output.
|
|
973
|
+
*
|
|
974
|
+
* A color function is just a `functions` entry whose output is an already
|
|
975
|
+
* supported color (`rgb`, `hsl`, `#…`, `oklch`, …). This helper delegates the
|
|
976
|
+
* value to the global parser (which already runs the registered parse function)
|
|
977
|
+
* and returns the result only when it looks like a color. Returns `null` when
|
|
978
|
+
* `str` is not a registered custom function or its output is not a color.
|
|
979
|
+
*
|
|
980
|
+
* This is the generic replacement for the previously hardcoded okhsl/okhst
|
|
981
|
+
* conversion branches scattered across `strToRgb`, `resolveToRgbaValues`, and
|
|
982
|
+
* the `#token.alpha` injection path.
|
|
983
|
+
*/
|
|
984
|
+
declare function resolveFunctionColor(str: string): string | null;
|
|
985
|
+
//#endregion
|
|
986
|
+
//#region src/chunks/style-chunk-map.d.ts
|
|
987
|
+
/**
|
|
988
|
+
* Chunk names, the built-in chunk style lists, and the style→chunk lookup.
|
|
989
|
+
*
|
|
990
|
+
* This module only imports data-only style-name lists. It exists separately
|
|
991
|
+
* from `definitions.ts` for two reasons:
|
|
992
|
+
*
|
|
993
|
+
* 1. The style handler registry (`styles/predefined.ts`) needs to assign chunk
|
|
994
|
+
* membership for custom handlers. Reaching for `definitions.ts` would create an
|
|
995
|
+
* import cycle (`definitions` -> `pipeline` -> `styles` -> `predefined`).
|
|
996
|
+
* 2. `STYLE_TO_CHUNK` is populated as a side effect of module load, so it must be
|
|
997
|
+
* populated by the module that *owns* it. Otherwise an importer that only pulls
|
|
998
|
+
* in this module would see an empty map and misclassify every style as `misc`.
|
|
999
|
+
*
|
|
1000
|
+
* `definitions.ts` re-exports everything here, so existing import paths and the
|
|
1001
|
+
* public API surface are unchanged.
|
|
1002
|
+
*/
|
|
1003
|
+
declare const CHUNK_NAMES: {
|
|
1004
|
+
/** Special chunk for styles that cannot be split */
|
|
1005
|
+
readonly COMBINED: "combined";
|
|
1006
|
+
readonly SUBCOMPONENTS: "subcomponents";
|
|
1007
|
+
readonly APPEARANCE: "appearance";
|
|
1008
|
+
readonly FONT: "font";
|
|
1009
|
+
readonly DIMENSION: "dimension";
|
|
1010
|
+
readonly DISPLAY: "display";
|
|
1011
|
+
readonly LAYOUT: "layout";
|
|
1012
|
+
readonly POSITION: "position";
|
|
1013
|
+
readonly MISC: "misc";
|
|
1014
|
+
};
|
|
1015
|
+
type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];
|
|
1016
|
+
/**
|
|
1017
|
+
* Appearance chunk - visual styling
|
|
1018
|
+
*
|
|
1019
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
1020
|
+
* ⚠️ fillStyle: fill, backgroundColor, image, backgroundImage,
|
|
1021
|
+
* backgroundPosition/Size/Repeat/Attachment/Origin/Clip, background
|
|
1022
|
+
*
|
|
1023
|
+
* @public
|
|
1024
|
+
*/
|
|
1025
|
+
declare const APPEARANCE_CHUNK_STYLES: readonly ["fill", "backgroundColor", "image", "backgroundImage", "backgroundPosition", "backgroundSize", "backgroundRepeat", "backgroundAttachment", "backgroundOrigin", "backgroundClip", "background", "color", "opacity", "border", "blockBorder", "inlineBorder", "radius", "outline", "outlineOffset", "shadow", "fade"];
|
|
1026
|
+
/**
|
|
1027
|
+
* Font chunk - typography styles
|
|
1028
|
+
*
|
|
1029
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
1030
|
+
* ⚠️ presetStyle: preset, fontSize, lineHeight, letterSpacing, textTransform,
|
|
1031
|
+
* fontWeight, fontStyle, font
|
|
1032
|
+
*/
|
|
1033
|
+
/** @public */
|
|
1034
|
+
declare const FONT_CHUNK_STYLES: readonly ["preset", "font", "fontWeight", "fontStyle", "fontSize", "lineHeight", "letterSpacing", "textTransform", "fontFamily", "textAlign", "textDecoration", "wordBreak", "wordWrap", "boldFontWeight"];
|
|
1035
|
+
/**
|
|
1036
|
+
* Dimension chunk - sizing and spacing
|
|
1037
|
+
*
|
|
1038
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
1039
|
+
* ⚠️ paddingStyle: padding, paddingTop/Right/Bottom/Left
|
|
1040
|
+
* ⚠️ marginStyle: margin, marginTop/Right/Bottom/Left
|
|
1041
|
+
* ⚠️ widthStyle: width, minWidth, maxWidth
|
|
1042
|
+
* ⚠️ heightStyle: height, minHeight, maxHeight
|
|
1043
|
+
* ⚠️ blockSizeStyle: blockSize, minBlockSize, maxBlockSize
|
|
1044
|
+
* ⚠️ inlineSizeStyle: inlineSize, minInlineSize, maxInlineSize
|
|
1045
|
+
*/
|
|
1046
|
+
/** @public */
|
|
1047
|
+
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"];
|
|
1048
|
+
/**
|
|
1049
|
+
* Display chunk - display mode, layout flow, text overflow, and scrollbar
|
|
1050
|
+
*
|
|
1051
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
1052
|
+
* ⚠️ displayStyle: display, hide, textOverflow, overflow, whiteSpace
|
|
1053
|
+
* ⚠️ flowStyle: display, flow
|
|
1054
|
+
* ⚠️ gapStyle: display, flow, gap
|
|
1055
|
+
* ⚠️ scrollbarStyle: scrollbar, overflow
|
|
1056
|
+
*/
|
|
1057
|
+
/** @public */
|
|
1058
|
+
declare const DISPLAY_CHUNK_STYLES: readonly ["display", "hide", "textOverflow", "overflow", "whiteSpace", "flow", "gap", "scrollbar"];
|
|
1059
|
+
/**
|
|
1060
|
+
* Layout chunk - flex/grid alignment and grid templates
|
|
1061
|
+
*
|
|
1062
|
+
* Note: flow and gap are in DISPLAY chunk due to handler dependencies
|
|
1063
|
+
* (flowStyle and gapStyle both require 'display' prop).
|
|
1064
|
+
*/
|
|
1065
|
+
/** @public */
|
|
1066
|
+
declare const LAYOUT_CHUNK_STYLES: readonly ["placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "place", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas", "gridAutoFlow", "gridAutoColumns", "gridAutoRows"];
|
|
1067
|
+
/**
|
|
1068
|
+
* Position chunk - element positioning
|
|
1069
|
+
*
|
|
1070
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
1071
|
+
* ⚠️ insetStyle: inset, top, right, bottom, left
|
|
1072
|
+
*/
|
|
1073
|
+
/** @public */
|
|
1074
|
+
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"];
|
|
1075
|
+
/**
|
|
1076
|
+
* Map for O(1) style-to-chunk lookup. Seeded with the built-in lists above and
|
|
1077
|
+
* extended by {@link assignStyleChunk} when a custom handler declares style names
|
|
1078
|
+
* the built-in lists don't know.
|
|
1079
|
+
*/
|
|
1080
|
+
declare const STYLE_TO_CHUNK: Map<string, ChunkName>;
|
|
1081
|
+
//#endregion
|
|
1082
|
+
//#region src/chunks/definitions.d.ts
|
|
1083
|
+
interface ChunkInfo {
|
|
1084
|
+
/** Name of the chunk */
|
|
1085
|
+
name: ChunkName | string;
|
|
1086
|
+
/** Style keys belonging to this chunk */
|
|
1087
|
+
styleKeys: string[];
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Categorize style keys into chunks.
|
|
1091
|
+
*
|
|
1092
|
+
* Returns chunks in a deterministic order (by CHUNK_ORDER) regardless
|
|
1093
|
+
* of the order of keys in the input styles object.
|
|
1094
|
+
*
|
|
1095
|
+
* @param styles - The styles object to categorize
|
|
1096
|
+
* @returns Map of chunk name to array of style keys in that chunk (in priority order)
|
|
1097
|
+
*/
|
|
1098
|
+
declare function categorizeStyleKeys(styles: Record<string, unknown>): Map<string, string[]>;
|
|
1099
|
+
//#endregion
|
|
848
1100
|
//#region src/styles/border.d.ts
|
|
849
1101
|
/**
|
|
850
1102
|
* Border style handler with multi-group support.
|
|
@@ -859,23 +1111,27 @@ declare module './utils/css-types' {
|
|
|
859
1111
|
*
|
|
860
1112
|
* Later groups override earlier groups for conflicting directions.
|
|
861
1113
|
*/
|
|
862
|
-
declare function borderStyle({
|
|
863
|
-
border
|
|
864
|
-
}: {
|
|
1114
|
+
declare function borderStyle({ border }: {
|
|
865
1115
|
border?: string | number | boolean;
|
|
866
1116
|
}): Record<string, string> | null;
|
|
867
1117
|
declare namespace borderStyle {
|
|
868
1118
|
var __lookupStyles: string[];
|
|
869
1119
|
}
|
|
870
1120
|
//#endregion
|
|
1121
|
+
//#region src/styles/blockSize.d.ts
|
|
1122
|
+
declare function blockSizeStyle({ blockSize, minBlockSize, maxBlockSize }: {
|
|
1123
|
+
blockSize?: string | number | boolean;
|
|
1124
|
+
minBlockSize?: string | number | boolean;
|
|
1125
|
+
maxBlockSize?: string | number | boolean;
|
|
1126
|
+
}): Record<string, string | string[]> | null;
|
|
1127
|
+
declare namespace blockSizeStyle {
|
|
1128
|
+
var __lookupStyles: ("blockSize" | "maxBlockSize" | "minBlockSize")[];
|
|
1129
|
+
}
|
|
1130
|
+
//#endregion
|
|
871
1131
|
//#region src/styles/color.d.ts
|
|
872
|
-
declare function colorStyle({
|
|
873
|
-
color
|
|
874
|
-
}: {
|
|
1132
|
+
declare function colorStyle({ color }: {
|
|
875
1133
|
color?: string | boolean;
|
|
876
|
-
}):
|
|
877
|
-
color: string;
|
|
878
|
-
} | null;
|
|
1134
|
+
}): Record<string, string> | null;
|
|
879
1135
|
declare namespace colorStyle {
|
|
880
1136
|
var __lookupStyles: string[];
|
|
881
1137
|
}
|
|
@@ -897,21 +1153,13 @@ interface DisplayStyleProps {
|
|
|
897
1153
|
* 3. Single-line `textOverflow` defaults white-space to nowrap
|
|
898
1154
|
* 4. Explicit `whiteSpace` overrides the default from `textOverflow`
|
|
899
1155
|
*/
|
|
900
|
-
declare function displayStyle({
|
|
901
|
-
display,
|
|
902
|
-
hide,
|
|
903
|
-
textOverflow,
|
|
904
|
-
overflow,
|
|
905
|
-
whiteSpace
|
|
906
|
-
}: DisplayStyleProps): Record<string, string | number> | null;
|
|
1156
|
+
declare function displayStyle({ display, hide, textOverflow, overflow, whiteSpace }: DisplayStyleProps): Record<string, string | number> | null;
|
|
907
1157
|
declare namespace displayStyle {
|
|
908
1158
|
var __lookupStyles: string[];
|
|
909
1159
|
}
|
|
910
1160
|
//#endregion
|
|
911
1161
|
//#region src/styles/fade.d.ts
|
|
912
|
-
declare function fadeStyle({
|
|
913
|
-
fade
|
|
914
|
-
}: {
|
|
1162
|
+
declare function fadeStyle({ fade }: {
|
|
915
1163
|
fade?: string;
|
|
916
1164
|
}): {
|
|
917
1165
|
mask: string;
|
|
@@ -922,20 +1170,8 @@ declare namespace fadeStyle {
|
|
|
922
1170
|
}
|
|
923
1171
|
//#endregion
|
|
924
1172
|
//#region src/styles/fill.d.ts
|
|
925
|
-
declare function fillStyle({
|
|
926
|
-
fill
|
|
927
|
-
backgroundColor,
|
|
928
|
-
image,
|
|
929
|
-
backgroundImage,
|
|
930
|
-
backgroundPosition,
|
|
931
|
-
backgroundSize,
|
|
932
|
-
backgroundRepeat,
|
|
933
|
-
backgroundAttachment,
|
|
934
|
-
backgroundOrigin,
|
|
935
|
-
backgroundClip,
|
|
936
|
-
background
|
|
937
|
-
}: {
|
|
938
|
-
fill?: string;
|
|
1173
|
+
declare function fillStyle({ fill, backgroundColor, image, backgroundImage, backgroundPosition, backgroundSize, backgroundRepeat, backgroundAttachment, backgroundOrigin, backgroundClip, background }: {
|
|
1174
|
+
fill?: string | boolean;
|
|
939
1175
|
backgroundColor?: string;
|
|
940
1176
|
image?: string;
|
|
941
1177
|
backgroundImage?: string;
|
|
@@ -950,9 +1186,7 @@ declare function fillStyle({
|
|
|
950
1186
|
declare namespace fillStyle {
|
|
951
1187
|
var __lookupStyles: string[];
|
|
952
1188
|
}
|
|
953
|
-
declare function svgFillStyle({
|
|
954
|
-
svgFill
|
|
955
|
-
}: {
|
|
1189
|
+
declare function svgFillStyle({ svgFill }: {
|
|
956
1190
|
svgFill?: string;
|
|
957
1191
|
}): {
|
|
958
1192
|
fill: string;
|
|
@@ -962,28 +1196,21 @@ declare namespace svgFillStyle {
|
|
|
962
1196
|
}
|
|
963
1197
|
//#endregion
|
|
964
1198
|
//#region src/styles/flow.d.ts
|
|
965
|
-
declare function flowStyle({
|
|
966
|
-
display
|
|
967
|
-
flow
|
|
968
|
-
}: {
|
|
969
|
-
display?: string;
|
|
970
|
-
flow?: string;
|
|
1199
|
+
declare function flowStyle({ display, flow }: {
|
|
1200
|
+
display?: string | NoType;
|
|
1201
|
+
flow?: string | NoType;
|
|
971
1202
|
}): {
|
|
972
|
-
[x: string]: string
|
|
1203
|
+
[x: string]: string;
|
|
973
1204
|
} | null;
|
|
974
1205
|
declare namespace flowStyle {
|
|
975
1206
|
var __lookupStyles: string[];
|
|
976
1207
|
}
|
|
977
1208
|
//#endregion
|
|
978
1209
|
//#region src/styles/gap.d.ts
|
|
979
|
-
declare function gapStyle({
|
|
980
|
-
display
|
|
981
|
-
flow
|
|
982
|
-
gap
|
|
983
|
-
}: {
|
|
984
|
-
display?: string;
|
|
985
|
-
flow?: string;
|
|
986
|
-
gap?: string | number | boolean;
|
|
1210
|
+
declare function gapStyle({ display, flow, gap }: {
|
|
1211
|
+
display?: string | NoType;
|
|
1212
|
+
flow?: string | NoType;
|
|
1213
|
+
gap?: string | number | boolean | NoType;
|
|
987
1214
|
}): {
|
|
988
1215
|
gap: string;
|
|
989
1216
|
$?: undefined;
|
|
@@ -1010,28 +1237,14 @@ interface HeightStyleProps {
|
|
|
1010
1237
|
minHeight?: string | number | boolean;
|
|
1011
1238
|
maxHeight?: string | number | boolean;
|
|
1012
1239
|
}
|
|
1013
|
-
declare function heightStyle({
|
|
1014
|
-
height,
|
|
1015
|
-
minHeight,
|
|
1016
|
-
maxHeight
|
|
1017
|
-
}: HeightStyleProps): Record<string, string | string[]> | null;
|
|
1240
|
+
declare function heightStyle({ height, minHeight, maxHeight }: HeightStyleProps): Record<string, string | string[]> | null;
|
|
1018
1241
|
declare namespace heightStyle {
|
|
1019
1242
|
var __lookupStyles: string[];
|
|
1020
1243
|
}
|
|
1021
1244
|
//#endregion
|
|
1022
1245
|
//#region src/styles/inset.d.ts
|
|
1023
|
-
declare function insetStyle({
|
|
1024
|
-
inset,
|
|
1025
|
-
insetBlock,
|
|
1026
|
-
insetInline,
|
|
1027
|
-
top,
|
|
1028
|
-
right,
|
|
1029
|
-
bottom,
|
|
1030
|
-
left
|
|
1031
|
-
}: {
|
|
1246
|
+
declare function insetStyle({ inset, top, right, bottom, left }: {
|
|
1032
1247
|
inset?: string | number | boolean;
|
|
1033
|
-
insetBlock?: string | number | boolean;
|
|
1034
|
-
insetInline?: string | number | boolean;
|
|
1035
1248
|
top?: string | number | boolean;
|
|
1036
1249
|
right?: string | number | boolean;
|
|
1037
1250
|
bottom?: string | number | boolean;
|
|
@@ -1041,19 +1254,19 @@ declare namespace insetStyle {
|
|
|
1041
1254
|
var __lookupStyles: string[];
|
|
1042
1255
|
}
|
|
1043
1256
|
//#endregion
|
|
1257
|
+
//#region src/styles/inlineSize.d.ts
|
|
1258
|
+
declare function inlineSizeStyle({ inlineSize, minInlineSize, maxInlineSize }: {
|
|
1259
|
+
inlineSize?: string | number | boolean;
|
|
1260
|
+
minInlineSize?: string | number | boolean;
|
|
1261
|
+
maxInlineSize?: string | number | boolean;
|
|
1262
|
+
}): Record<string, string | string[]> | null;
|
|
1263
|
+
declare namespace inlineSizeStyle {
|
|
1264
|
+
var __lookupStyles: ("inlineSize" | "maxInlineSize" | "minInlineSize")[];
|
|
1265
|
+
}
|
|
1266
|
+
//#endregion
|
|
1044
1267
|
//#region src/styles/margin.d.ts
|
|
1045
|
-
declare function marginStyle({
|
|
1046
|
-
margin,
|
|
1047
|
-
marginBlock,
|
|
1048
|
-
marginInline,
|
|
1049
|
-
marginTop,
|
|
1050
|
-
marginRight,
|
|
1051
|
-
marginBottom,
|
|
1052
|
-
marginLeft
|
|
1053
|
-
}: {
|
|
1268
|
+
declare function marginStyle({ margin, marginTop, marginRight, marginBottom, marginLeft }: {
|
|
1054
1269
|
margin?: string | number | boolean;
|
|
1055
|
-
marginBlock?: string | number | boolean;
|
|
1056
|
-
marginInline?: string | number | boolean;
|
|
1057
1270
|
marginTop?: string | number | boolean;
|
|
1058
1271
|
marginRight?: string | number | boolean;
|
|
1059
1272
|
marginBottom?: string | number | boolean;
|
|
@@ -1066,7 +1279,7 @@ declare namespace marginStyle {
|
|
|
1066
1279
|
//#region src/styles/outline.d.ts
|
|
1067
1280
|
interface OutlineStyleProps {
|
|
1068
1281
|
outline?: string | boolean | number;
|
|
1069
|
-
outlineOffset?: string | number;
|
|
1282
|
+
outlineOffset?: string | number | boolean;
|
|
1070
1283
|
}
|
|
1071
1284
|
/**
|
|
1072
1285
|
* Generates CSS for outline property with optional offset.
|
|
@@ -1082,27 +1295,14 @@ interface OutlineStyleProps {
|
|
|
1082
1295
|
*
|
|
1083
1296
|
* @return CSS properties for outline and optionally outline-offset
|
|
1084
1297
|
*/
|
|
1085
|
-
declare function outlineStyle({
|
|
1086
|
-
outline,
|
|
1087
|
-
outlineOffset
|
|
1088
|
-
}: OutlineStyleProps): Record<string, string> | null;
|
|
1298
|
+
declare function outlineStyle({ outline, outlineOffset }: OutlineStyleProps): Record<string, string> | null;
|
|
1089
1299
|
declare namespace outlineStyle {
|
|
1090
1300
|
var __lookupStyles: string[];
|
|
1091
1301
|
}
|
|
1092
1302
|
//#endregion
|
|
1093
1303
|
//#region src/styles/padding.d.ts
|
|
1094
|
-
declare function paddingStyle({
|
|
1095
|
-
padding,
|
|
1096
|
-
paddingBlock,
|
|
1097
|
-
paddingInline,
|
|
1098
|
-
paddingTop,
|
|
1099
|
-
paddingRight,
|
|
1100
|
-
paddingBottom,
|
|
1101
|
-
paddingLeft
|
|
1102
|
-
}: {
|
|
1304
|
+
declare function paddingStyle({ padding, paddingTop, paddingRight, paddingBottom, paddingLeft }: {
|
|
1103
1305
|
padding?: string | number | boolean;
|
|
1104
|
-
paddingBlock?: string | number | boolean;
|
|
1105
|
-
paddingInline?: string | number | boolean;
|
|
1106
1306
|
paddingTop?: string | number | boolean;
|
|
1107
1307
|
paddingRight?: string | number | boolean;
|
|
1108
1308
|
paddingBottom?: string | number | boolean;
|
|
@@ -1132,17 +1332,7 @@ interface PlacementStyleProps {
|
|
|
1132
1332
|
* 2. placeItems, placeContent, align, justify (medium) — each sets 2 longhands
|
|
1133
1333
|
* 3. alignItems, alignContent, justifyItems, justifyContent (highest) — each sets 1 longhand
|
|
1134
1334
|
*/
|
|
1135
|
-
declare function placementStyle({
|
|
1136
|
-
place,
|
|
1137
|
-
placeItems,
|
|
1138
|
-
placeContent,
|
|
1139
|
-
align,
|
|
1140
|
-
justify,
|
|
1141
|
-
alignItems,
|
|
1142
|
-
alignContent,
|
|
1143
|
-
justifyItems,
|
|
1144
|
-
justifyContent
|
|
1145
|
-
}: PlacementStyleProps): Record<string, string> | null;
|
|
1335
|
+
declare function placementStyle({ place, placeItems, placeContent, align, justify, alignItems, alignContent, justifyItems, justifyContent }: PlacementStyleProps): Record<string, string> | null;
|
|
1146
1336
|
declare namespace placementStyle {
|
|
1147
1337
|
var __lookupStyles: string[];
|
|
1148
1338
|
}
|
|
@@ -1183,25 +1373,13 @@ interface PresetStyleProps {
|
|
|
1183
1373
|
* - `font` is the recommended prop with special handling (monospace, boolean, fallback)
|
|
1184
1374
|
* - `fontFamily` is a direct value without special handling
|
|
1185
1375
|
*/
|
|
1186
|
-
declare function presetStyle({
|
|
1187
|
-
preset,
|
|
1188
|
-
fontSize,
|
|
1189
|
-
lineHeight,
|
|
1190
|
-
textTransform,
|
|
1191
|
-
letterSpacing,
|
|
1192
|
-
fontWeight,
|
|
1193
|
-
fontStyle,
|
|
1194
|
-
fontFamily,
|
|
1195
|
-
font
|
|
1196
|
-
}: PresetStyleProps): Styles | null;
|
|
1376
|
+
declare function presetStyle({ preset, fontSize, lineHeight, textTransform, letterSpacing, fontWeight, fontStyle, fontFamily, font }: PresetStyleProps): CSSMap | null;
|
|
1197
1377
|
declare namespace presetStyle {
|
|
1198
1378
|
var __lookupStyles: string[];
|
|
1199
1379
|
}
|
|
1200
1380
|
//#endregion
|
|
1201
1381
|
//#region src/styles/radius.d.ts
|
|
1202
|
-
declare function radiusStyle({
|
|
1203
|
-
radius
|
|
1204
|
-
}: {
|
|
1382
|
+
declare function radiusStyle({ radius }: {
|
|
1205
1383
|
radius?: string | number | boolean;
|
|
1206
1384
|
}): Record<string, string> | null;
|
|
1207
1385
|
declare namespace radiusStyle {
|
|
@@ -1209,18 +1387,8 @@ declare namespace radiusStyle {
|
|
|
1209
1387
|
}
|
|
1210
1388
|
//#endregion
|
|
1211
1389
|
//#region src/styles/scrollMargin.d.ts
|
|
1212
|
-
declare function scrollMarginStyle({
|
|
1213
|
-
scrollMargin,
|
|
1214
|
-
scrollMarginBlock,
|
|
1215
|
-
scrollMarginInline,
|
|
1216
|
-
scrollMarginTop,
|
|
1217
|
-
scrollMarginRight,
|
|
1218
|
-
scrollMarginBottom,
|
|
1219
|
-
scrollMarginLeft
|
|
1220
|
-
}: {
|
|
1390
|
+
declare function scrollMarginStyle({ scrollMargin, scrollMarginTop, scrollMarginRight, scrollMarginBottom, scrollMarginLeft }: {
|
|
1221
1391
|
scrollMargin?: string | number | boolean;
|
|
1222
|
-
scrollMarginBlock?: string | number | boolean;
|
|
1223
|
-
scrollMarginInline?: string | number | boolean;
|
|
1224
1392
|
scrollMarginTop?: string | number | boolean;
|
|
1225
1393
|
scrollMarginRight?: string | number | boolean;
|
|
1226
1394
|
scrollMarginBottom?: string | number | boolean;
|
|
@@ -1230,6 +1398,18 @@ declare namespace scrollMarginStyle {
|
|
|
1230
1398
|
var __lookupStyles: string[];
|
|
1231
1399
|
}
|
|
1232
1400
|
//#endregion
|
|
1401
|
+
//#region src/styles/scrollPadding.d.ts
|
|
1402
|
+
declare function scrollPaddingStyle({ scrollPadding, scrollPaddingTop, scrollPaddingRight, scrollPaddingBottom, scrollPaddingLeft }: {
|
|
1403
|
+
scrollPadding?: string | number | boolean;
|
|
1404
|
+
scrollPaddingTop?: string | number | boolean;
|
|
1405
|
+
scrollPaddingRight?: string | number | boolean;
|
|
1406
|
+
scrollPaddingBottom?: string | number | boolean;
|
|
1407
|
+
scrollPaddingLeft?: string | number | boolean;
|
|
1408
|
+
}): Record<string, string> | null;
|
|
1409
|
+
declare namespace scrollPaddingStyle {
|
|
1410
|
+
var __lookupStyles: string[];
|
|
1411
|
+
}
|
|
1412
|
+
//#endregion
|
|
1233
1413
|
//#region src/styles/scrollbar.d.ts
|
|
1234
1414
|
interface ScrollbarStyleProps {
|
|
1235
1415
|
scrollbar?: string | boolean;
|
|
@@ -1245,18 +1425,13 @@ interface ScrollbarStyleProps {
|
|
|
1245
1425
|
* Note: `auto` is classified as a VALUE_KEYWORD by the parser, so it lands
|
|
1246
1426
|
* in `values` rather than `mods`. Both locations are checked for robustness.
|
|
1247
1427
|
*/
|
|
1248
|
-
declare function scrollbarStyle({
|
|
1249
|
-
scrollbar,
|
|
1250
|
-
overflow
|
|
1251
|
-
}: ScrollbarStyleProps): Record<string, string> | null;
|
|
1428
|
+
declare function scrollbarStyle({ scrollbar, overflow }: ScrollbarStyleProps): Record<string, string> | null;
|
|
1252
1429
|
declare namespace scrollbarStyle {
|
|
1253
1430
|
var __lookupStyles: string[];
|
|
1254
1431
|
}
|
|
1255
1432
|
//#endregion
|
|
1256
1433
|
//#region src/styles/shadow.d.ts
|
|
1257
|
-
declare function shadowStyle({
|
|
1258
|
-
shadow
|
|
1259
|
-
}: {
|
|
1434
|
+
declare function shadowStyle({ shadow }: {
|
|
1260
1435
|
shadow?: string | boolean;
|
|
1261
1436
|
}): {
|
|
1262
1437
|
'box-shadow': string;
|
|
@@ -1266,9 +1441,7 @@ declare namespace shadowStyle {
|
|
|
1266
1441
|
}
|
|
1267
1442
|
//#endregion
|
|
1268
1443
|
//#region src/styles/transition.d.ts
|
|
1269
|
-
declare function transitionStyle({
|
|
1270
|
-
transition
|
|
1271
|
-
}: {
|
|
1444
|
+
declare function transitionStyle({ transition }: {
|
|
1272
1445
|
transition?: string;
|
|
1273
1446
|
}): {
|
|
1274
1447
|
transition: string;
|
|
@@ -1283,11 +1456,7 @@ interface WidthStyleProps {
|
|
|
1283
1456
|
minWidth?: string | number | boolean;
|
|
1284
1457
|
maxWidth?: string | number | boolean;
|
|
1285
1458
|
}
|
|
1286
|
-
declare function widthStyle({
|
|
1287
|
-
width,
|
|
1288
|
-
minWidth,
|
|
1289
|
-
maxWidth
|
|
1290
|
-
}: WidthStyleProps): Record<string, string | string[]> | null;
|
|
1459
|
+
declare function widthStyle({ width, minWidth, maxWidth }: WidthStyleProps): Record<string, string | string[]> | null;
|
|
1291
1460
|
declare namespace widthStyle {
|
|
1292
1461
|
var __lookupStyles: string[];
|
|
1293
1462
|
}
|
|
@@ -1317,16 +1486,6 @@ declare namespace widthStyle {
|
|
|
1317
1486
|
* ```
|
|
1318
1487
|
*/
|
|
1319
1488
|
declare const styleHandlers: {
|
|
1320
|
-
readonly border: typeof borderStyle;
|
|
1321
|
-
readonly color: typeof colorStyle;
|
|
1322
|
-
readonly display: typeof displayStyle;
|
|
1323
|
-
readonly fade: typeof fadeStyle;
|
|
1324
|
-
readonly fill: typeof fillStyle;
|
|
1325
|
-
readonly svgFill: typeof svgFillStyle;
|
|
1326
|
-
readonly flow: typeof flowStyle;
|
|
1327
|
-
readonly gap: typeof gapStyle;
|
|
1328
|
-
readonly height: typeof heightStyle;
|
|
1329
|
-
readonly inset: typeof insetStyle;
|
|
1330
1489
|
readonly margin: typeof marginStyle;
|
|
1331
1490
|
readonly outline: typeof outlineStyle;
|
|
1332
1491
|
readonly padding: typeof paddingStyle;
|
|
@@ -1334,12 +1493,67 @@ declare const styleHandlers: {
|
|
|
1334
1493
|
readonly preset: typeof presetStyle;
|
|
1335
1494
|
readonly radius: typeof radiusStyle;
|
|
1336
1495
|
readonly scrollMargin: typeof scrollMarginStyle;
|
|
1496
|
+
readonly scrollPadding: typeof scrollPaddingStyle;
|
|
1337
1497
|
readonly scrollbar: typeof scrollbarStyle;
|
|
1338
1498
|
readonly shadow: typeof shadowStyle;
|
|
1339
1499
|
readonly transition: typeof transitionStyle;
|
|
1340
1500
|
readonly width: typeof widthStyle;
|
|
1501
|
+
readonly blockBorder: StyleHandler<Partial<Record<"blockBorder", string | number | boolean | undefined>>>;
|
|
1502
|
+
readonly inlineBorder: StyleHandler<Partial<Record<"inlineBorder", string | number | boolean | undefined>>>;
|
|
1503
|
+
readonly blockScrollPadding: StyleHandler<Partial<Record<"blockScrollPadding", string | number | boolean | undefined>>>;
|
|
1504
|
+
readonly inlineScrollPadding: StyleHandler<Partial<Record<"inlineScrollPadding", string | number | boolean | undefined>>>;
|
|
1505
|
+
readonly blockScrollMargin: StyleHandler<Partial<Record<"blockScrollMargin", string | number | boolean | undefined>>>;
|
|
1506
|
+
readonly inlineScrollMargin: StyleHandler<Partial<Record<"inlineScrollMargin", string | number | boolean | undefined>>>;
|
|
1507
|
+
readonly blockInset: StyleHandler<Partial<Record<"blockInset", string | number | boolean | undefined>>>;
|
|
1508
|
+
readonly inlineInset: StyleHandler<Partial<Record<"inlineInset", string | number | boolean | undefined>>>;
|
|
1509
|
+
readonly blockMargin: StyleHandler<Partial<Record<"blockMargin", string | number | boolean | undefined>>>;
|
|
1510
|
+
readonly inlineMargin: StyleHandler<Partial<Record<"inlineMargin", string | number | boolean | undefined>>>;
|
|
1511
|
+
readonly blockPadding: StyleHandler<Partial<Record<"blockPadding", string | number | boolean | undefined>>>;
|
|
1512
|
+
readonly inlinePadding: StyleHandler<Partial<Record<"inlinePadding", string | number | boolean | undefined>>>;
|
|
1513
|
+
readonly blockSize: typeof blockSizeStyle;
|
|
1514
|
+
readonly border: typeof borderStyle;
|
|
1515
|
+
readonly color: typeof colorStyle;
|
|
1516
|
+
readonly display: typeof displayStyle;
|
|
1517
|
+
readonly fade: typeof fadeStyle;
|
|
1518
|
+
readonly fill: typeof fillStyle;
|
|
1519
|
+
readonly svgFill: typeof svgFillStyle;
|
|
1520
|
+
readonly flow: typeof flowStyle;
|
|
1521
|
+
readonly gap: typeof gapStyle;
|
|
1522
|
+
readonly height: typeof heightStyle;
|
|
1523
|
+
readonly inset: typeof insetStyle;
|
|
1524
|
+
readonly inlineSize: typeof inlineSizeStyle;
|
|
1341
1525
|
};
|
|
1342
1526
|
//#endregion
|
|
1527
|
+
//#region src/styles/define-handler.d.ts
|
|
1528
|
+
/**
|
|
1529
|
+
* Declare a multi-dependency style handler with its dependency names inferred
|
|
1530
|
+
* into the handler's parameter type.
|
|
1531
|
+
*
|
|
1532
|
+
* Without it, the multi-dependency tuple form needs a hand-written parameter
|
|
1533
|
+
* annotation that can silently drift from the dependency list:
|
|
1534
|
+
*
|
|
1535
|
+
* ```ts
|
|
1536
|
+
* // Annotation and dependency list are maintained separately.
|
|
1537
|
+
* handlers: {
|
|
1538
|
+
* spacing: [['gap', 'padding'], ({ gap, padding }: { gap?: string; padding?: string }) => …],
|
|
1539
|
+
* }
|
|
1540
|
+
*
|
|
1541
|
+
* // Both come from the same array; a typo in the destructure is a type error.
|
|
1542
|
+
* handlers: {
|
|
1543
|
+
* spacing: defineHandler(['gap', 'padding'], ({ gap, padding }) => …),
|
|
1544
|
+
* }
|
|
1545
|
+
* ```
|
|
1546
|
+
*
|
|
1547
|
+
* Values arrive **state-resolved but unparsed** — the raw authored DSL string
|
|
1548
|
+
* (`'2x'`, `'#purple.5'`), so call `parseStyle()` / `parseColor()` as needed. The
|
|
1549
|
+
* result is a kebab-case CSS declaration map (or an array of them); the reserved
|
|
1550
|
+
* `$` key applies the declarations to a nested selector.
|
|
1551
|
+
*
|
|
1552
|
+
* All names must belong to the same chunk. Names the built-in chunk lists don't
|
|
1553
|
+
* know are pulled into their handler's chunk automatically at registration.
|
|
1554
|
+
*/
|
|
1555
|
+
declare function defineHandler<const TDeps extends readonly string[]>(deps: TDeps, handler: (props: Partial<Record<TDeps[number], ResolvedStyleValue>>) => StyleHandlerResult): [readonly string[], RawStyleHandler];
|
|
1556
|
+
//#endregion
|
|
1343
1557
|
//#region src/compute-styles.d.ts
|
|
1344
1558
|
interface ComputeStylesResult {
|
|
1345
1559
|
className: string;
|
|
@@ -1350,6 +1564,13 @@ interface ComputeStylesOptions {
|
|
|
1350
1564
|
ssrCollector?: ServerStyleCollector | null;
|
|
1351
1565
|
/** Target root for style injection (client only). Defaults to `document`. */
|
|
1352
1566
|
root?: Document | ShadowRoot;
|
|
1567
|
+
/**
|
|
1568
|
+
* Set when `styles` outlives this call and will be passed in again — a
|
|
1569
|
+
* `tasty()` factory's own styles object rather than a per-render merge.
|
|
1570
|
+
* It lets chunk cache keys be memoized on the object, which is worth the
|
|
1571
|
+
* bookkeeping only when there is a next render to spend it on.
|
|
1572
|
+
*/
|
|
1573
|
+
stableStyles?: boolean;
|
|
1353
1574
|
}
|
|
1354
1575
|
/**
|
|
1355
1576
|
* Synchronous, hook-free style computation.
|
|
@@ -1407,10 +1628,7 @@ declare const chunkSheetRegistry: ChunkSheetRegistry;
|
|
|
1407
1628
|
/**
|
|
1408
1629
|
* Inject styles and return className with dispose function
|
|
1409
1630
|
*/
|
|
1410
|
-
declare function inject(rules: StyleResult[], options?:
|
|
1411
|
-
root?: Document | ShadowRoot;
|
|
1412
|
-
cacheKey?: string;
|
|
1413
|
-
}): InjectResult;
|
|
1631
|
+
declare function inject(rules: StyleResult[], options?: InjectOptions): InjectResult;
|
|
1414
1632
|
/**
|
|
1415
1633
|
* Inject global rules that should not reserve tasty class names
|
|
1416
1634
|
*/
|
|
@@ -1452,26 +1670,6 @@ declare function keyframes(steps: KeyframesSteps, nameOrOptions?: string | {
|
|
|
1452
1670
|
root?: Document | ShadowRoot;
|
|
1453
1671
|
name?: string;
|
|
1454
1672
|
}): KeyframesResult;
|
|
1455
|
-
interface PropertyOptions {
|
|
1456
|
-
/**
|
|
1457
|
-
* CSS syntax string for the property (e.g., '<color>', '<length>', '<angle>')
|
|
1458
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/@property/syntax
|
|
1459
|
-
*/
|
|
1460
|
-
syntax?: string;
|
|
1461
|
-
/**
|
|
1462
|
-
* Whether the property inherits from parent elements
|
|
1463
|
-
* @default true
|
|
1464
|
-
*/
|
|
1465
|
-
inherits?: boolean;
|
|
1466
|
-
/**
|
|
1467
|
-
* Initial value for the property
|
|
1468
|
-
*/
|
|
1469
|
-
initialValue?: string | number;
|
|
1470
|
-
/**
|
|
1471
|
-
* Shadow root or document to inject into
|
|
1472
|
-
*/
|
|
1473
|
-
root?: Document | ShadowRoot;
|
|
1474
|
-
}
|
|
1475
1673
|
/**
|
|
1476
1674
|
* Define a CSS @property custom property.
|
|
1477
1675
|
* This enables advanced features like animating custom properties.
|
|
@@ -1498,7 +1696,7 @@ interface PropertyOptions {
|
|
|
1498
1696
|
* });
|
|
1499
1697
|
* ```
|
|
1500
1698
|
*/
|
|
1501
|
-
declare function property
|
|
1699
|
+
declare function property(name: string, options?: PropertyOptions): void;
|
|
1502
1700
|
/**
|
|
1503
1701
|
* Check if a CSS @property has already been defined
|
|
1504
1702
|
*
|
|
@@ -1520,49 +1718,87 @@ declare function fontFace(family: string, descriptors: FontFaceDescriptors, opti
|
|
|
1520
1718
|
/**
|
|
1521
1719
|
* Inject a CSS @counter-style rule.
|
|
1522
1720
|
*
|
|
1523
|
-
* Permanent and global — no dispose or ref-counting.
|
|
1524
|
-
*
|
|
1721
|
+
* Permanent and global — no dispose or ref-counting. Deduplicates by name and
|
|
1722
|
+
* overrides an existing rule by default. Pass `weak: true` for global
|
|
1723
|
+
* `configure()` definitions, which never clobber an existing rule.
|
|
1525
1724
|
*/
|
|
1526
1725
|
declare function counterStyle(name: string, descriptors: CounterStyleDescriptors, options?: {
|
|
1527
1726
|
root?: Document | ShadowRoot;
|
|
1727
|
+
weak?: boolean;
|
|
1528
1728
|
}): void;
|
|
1529
1729
|
/**
|
|
1530
|
-
*
|
|
1730
|
+
* Inject a CSS @function rule (custom function).
|
|
1731
|
+
*
|
|
1732
|
+
* Permanent and global — no dispose or ref-counting. Deduplicates by function
|
|
1733
|
+
* name and overrides an existing rule by default. Pass `weak: true` for global
|
|
1734
|
+
* `configure()` definitions, which never clobber an existing rule.
|
|
1735
|
+
*
|
|
1736
|
+
* @param name - The function name (`$$name`, `$name`, or `--name`)
|
|
1737
|
+
* @param definition - Function definition (args, returns, result, local vars)
|
|
1738
|
+
*
|
|
1739
|
+
* @example
|
|
1740
|
+
* ```ts
|
|
1741
|
+
* func('$$negative', { args: ['$value'], result: '(-1 * $value)' });
|
|
1742
|
+
* ```
|
|
1531
1743
|
*/
|
|
1532
|
-
declare function
|
|
1744
|
+
declare function func(name: string, definition: FunctionDefinition, options?: {
|
|
1745
|
+
root?: Document | ShadowRoot;
|
|
1746
|
+
weak?: boolean;
|
|
1747
|
+
}): void;
|
|
1748
|
+
/**
|
|
1749
|
+
* Get the CSS text of every sheet the injector holds. Reads the live
|
|
1750
|
+
* stylesheets, so it needs a DOM: on the server, collect CSS with
|
|
1751
|
+
* `ServerStyleCollector` from `@tenphi/tasty/ssr` instead.
|
|
1752
|
+
*/
|
|
1753
|
+
declare function getCSSText(options?: {
|
|
1533
1754
|
root?: Document | ShadowRoot;
|
|
1534
1755
|
}): string;
|
|
1535
1756
|
/**
|
|
1536
1757
|
* Collect only CSS used by a rendered subtree (like jest-styled-components).
|
|
1537
1758
|
* Pass the container returned by render(...).
|
|
1538
1759
|
*/
|
|
1539
|
-
declare function
|
|
1760
|
+
declare function getCSSTextForNode(node: ParentNode | Element | DocumentFragment, options?: {
|
|
1540
1761
|
root?: Document | ShadowRoot;
|
|
1541
1762
|
}): string;
|
|
1542
1763
|
/**
|
|
1543
|
-
*
|
|
1764
|
+
* Take a reference on local `@keyframes` under the deterministic names the
|
|
1765
|
+
* caller resolved, and report which entry holds each. Pair with
|
|
1766
|
+
* `ownKeyframes()` once the rules exist to inspect.
|
|
1767
|
+
*/
|
|
1768
|
+
declare function holdKeyframes(steps: Record<string, KeyframesSteps>, names: Map<string, string>, options?: {
|
|
1769
|
+
root?: Document | ShadowRoot;
|
|
1770
|
+
}): Map<string, string>;
|
|
1771
|
+
/**
|
|
1772
|
+
* Record that a class animates these keyframes, so the reference is released
|
|
1773
|
+
* when the last such class is collected.
|
|
1774
|
+
*/
|
|
1775
|
+
declare function ownKeyframes(key: string, className: string, options?: {
|
|
1776
|
+
root?: Document | ShadowRoot;
|
|
1777
|
+
}): void;
|
|
1778
|
+
/**
|
|
1779
|
+
* Remove every injected rule that is neither in the DOM nor held by an
|
|
1780
|
+
* outstanding `inject()` handle. Equivalent to `gc({ force: true })`.
|
|
1544
1781
|
*/
|
|
1545
1782
|
declare function cleanup(root?: Document | ShadowRoot): void;
|
|
1546
1783
|
/**
|
|
1547
|
-
*
|
|
1548
|
-
* Used internally by computeStyles and tasty()
|
|
1549
|
-
*
|
|
1784
|
+
* Count a render, so that a collection pass is scheduled every
|
|
1785
|
+
* `gc.touchInterval` of them. Used internally by computeStyles and tasty().
|
|
1786
|
+
*
|
|
1787
|
+
* @deprecated The class name is ignored — collection asks the DOM what is
|
|
1788
|
+
* rendered rather than recording usage per class. The argument is kept so
|
|
1789
|
+
* existing calls still compile.
|
|
1550
1790
|
*/
|
|
1551
1791
|
declare function touch(className: string, options?: {
|
|
1552
1792
|
root?: Document | ShadowRoot;
|
|
1553
1793
|
}): void;
|
|
1554
1794
|
/**
|
|
1555
|
-
* Synchronous garbage collection of unused styles
|
|
1556
|
-
* Evicts the oldest
|
|
1557
|
-
* With `{ force: true }`, removes
|
|
1795
|
+
* Synchronous garbage collection of unused styles — those no element carries
|
|
1796
|
+
* and no `inject()` handle references. Evicts the oldest ones once they exceed
|
|
1797
|
+
* capacity. With `{ force: true }`, removes all of them regardless of capacity.
|
|
1558
1798
|
*
|
|
1559
1799
|
* @returns Number of styles evicted.
|
|
1560
1800
|
*/
|
|
1561
1801
|
declare function gc(options?: GCOptions): number;
|
|
1562
|
-
/**
|
|
1563
|
-
* Check if we're currently running in a test environment
|
|
1564
|
-
*/
|
|
1565
|
-
declare function getIsTestEnvironment(): boolean;
|
|
1566
1802
|
/**
|
|
1567
1803
|
* Get the global injector instance for debugging
|
|
1568
1804
|
*/
|
|
@@ -1579,80 +1815,54 @@ declare function destroy(root?: Document | ShadowRoot): void;
|
|
|
1579
1815
|
declare function createInjector(config?: Partial<StyleInjectorConfig>): StyleInjector;
|
|
1580
1816
|
//#endregion
|
|
1581
1817
|
//#region src/utils/filter-base-props.d.ts
|
|
1818
|
+
declare const basePropNames: readonly ["role", "title", "inert", "as", "element", "css", "qa", "mods", "qaVal", "hidden", "isHidden", "disabled", "isDisabled", "isChecked", "children", "style", "tokens", "theme", "className", "href", "target", "tabIndex"];
|
|
1819
|
+
declare const ignoredEventPropNames: readonly ["onPress", "onHoverStart", "onHoverEnd", "onPressStart", "onPressEnd"];
|
|
1582
1820
|
interface PropsFilterOptions {
|
|
1583
1821
|
labelable?: boolean;
|
|
1584
|
-
propNames?:
|
|
1822
|
+
propNames?: ReadonlySet<string>;
|
|
1585
1823
|
eventProps?: boolean;
|
|
1586
1824
|
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1825
|
+
type ExplicitPropName<O> = O extends {
|
|
1826
|
+
propNames?: ReadonlySet<infer P>;
|
|
1827
|
+
} ? Extract<P, string> : never;
|
|
1828
|
+
type EventPropsEnabled<O> = O extends {
|
|
1829
|
+
eventProps?: infer E;
|
|
1830
|
+
} ? Extract<E, boolean> : never;
|
|
1831
|
+
type Characters<S extends string> = S extends `${infer First}${infer Rest}` ? First | Characters<Rest> : never;
|
|
1832
|
+
/** Models DOM-style event keys and the runtime's ignored event names. */
|
|
1833
|
+
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;
|
|
1834
|
+
type ExplicitNumericPropName<K, O> = K extends number ? `${K}` extends ExplicitPropName<O> ? K : never : never;
|
|
1835
|
+
type RetainedPropName<T, O> = 'id' | (typeof basePropNames)[number] | `aria-${string}` | `data-${string}` | ExplicitPropName<O> | (true extends EventPropsEnabled<O> ? EventPropName<Extract<keyof T, string>> : never);
|
|
1836
|
+
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;
|
|
1837
|
+
/**
|
|
1838
|
+
* Keeps the built-in base props, ARIA/data attributes, and explicitly allowed props.
|
|
1839
|
+
* DOM-style event names are kept only with `eventProps: true`, except the ignored
|
|
1840
|
+
* interaction events (which can still be allowed explicitly via `propNames`).
|
|
1841
|
+
* The return type preserves the input value types only for potentially retained
|
|
1842
|
+
* keys. Props remain optional because only own enumerable string keys are copied.
|
|
1843
|
+
* Use a literal union (e.g. `new Set(['name', 'type'] as const)`) for `propNames`
|
|
1844
|
+
* to keep precise types; a `Set<string>` can potentially retain any string key.
|
|
1589
1845
|
* @param props - The component props to be filtered.
|
|
1590
|
-
* @param opts -
|
|
1846
|
+
* @param opts - Additional prop names and event forwarding options.
|
|
1591
1847
|
*/
|
|
1592
|
-
declare function filterBaseProps<T extends object>(props: T, opts?:
|
|
1848
|
+
declare function filterBaseProps<T extends object>(props: T, opts?: undefined): FilteredProps<T, undefined>;
|
|
1849
|
+
declare function filterBaseProps<T extends object, O extends PropsFilterOptions | undefined = PropsFilterOptions>(props: T, opts: O): FilteredProps<T, O>;
|
|
1593
1850
|
//#endregion
|
|
1594
1851
|
//#region src/utils/colors.d.ts
|
|
1595
1852
|
declare function color$1(name: string, opacity?: number): string;
|
|
1596
1853
|
//#endregion
|
|
1597
1854
|
//#region src/utils/mod-attrs.d.ts
|
|
1598
|
-
declare
|
|
1599
|
-
//#endregion
|
|
1600
|
-
//#region src/utils/dotize.d.ts
|
|
1601
|
-
declare const dotize: {
|
|
1602
|
-
valTypes: {
|
|
1603
|
-
none: string;
|
|
1604
|
-
primitive: string;
|
|
1605
|
-
object: string;
|
|
1606
|
-
array: string;
|
|
1607
|
-
};
|
|
1608
|
-
getValType: (val: any) => string | undefined;
|
|
1609
|
-
getPathType: (arrPath: any) => string[];
|
|
1610
|
-
isUndefined: (obj: any) => obj is undefined;
|
|
1611
|
-
isNumber: (f: any) => boolean;
|
|
1612
|
-
isEmptyObj: (obj: any) => boolean;
|
|
1613
|
-
isPlainObject: (obj: any) => boolean;
|
|
1614
|
-
isNotObject: (obj: any) => boolean;
|
|
1615
|
-
isEmptyArray: (arr: any) => boolean;
|
|
1616
|
-
isNotArray: (arr: any) => boolean;
|
|
1617
|
-
removeEmptyArrayItem: (arr: any) => any;
|
|
1618
|
-
getFieldName: (field: any, prefix: any, isRoot: any, isArrayItem: any, isArray: any) => string;
|
|
1619
|
-
startsWith: (val: any, valToSearch: any) => boolean;
|
|
1620
|
-
convert: (obj: any, prefix?: string) => any;
|
|
1621
|
-
backward: (obj: any, prefix: any) => any;
|
|
1622
|
-
};
|
|
1855
|
+
declare function modAttrs(map: AllBaseProps['mods']): Record<string, string> | null;
|
|
1623
1856
|
//#endregion
|
|
1624
1857
|
//#region src/utils/resolve-recipes.d.ts
|
|
1625
|
-
/**
|
|
1626
|
-
* Resolve all `recipe` style properties in a styles object.
|
|
1627
|
-
*
|
|
1628
|
-
* Handles both top-level and sub-element recipe references.
|
|
1629
|
-
* Returns the same object reference if no recipes are present anywhere
|
|
1630
|
-
* (zero overhead for the common case).
|
|
1631
|
-
*
|
|
1632
|
-
* @param styles - The styles object potentially containing `recipe` keys
|
|
1633
|
-
* @returns Resolved styles with recipe values merged in, or the original object if unchanged
|
|
1634
|
-
*/
|
|
1858
|
+
/** Resolve recipe references against the globally configured recipe map. */
|
|
1635
1859
|
declare function resolveRecipes(styles: Styles): Styles;
|
|
1636
1860
|
//#endregion
|
|
1637
|
-
//#region src/utils/warnings.d.ts
|
|
1638
|
-
declare function warn(...args: unknown[]): void;
|
|
1639
|
-
declare function deprecationWarning(condition: unknown, {
|
|
1640
|
-
property,
|
|
1641
|
-
name,
|
|
1642
|
-
betterAlternative,
|
|
1643
|
-
reason
|
|
1644
|
-
}: {
|
|
1645
|
-
property: string;
|
|
1646
|
-
name: string;
|
|
1647
|
-
betterAlternative: (() => string) | string;
|
|
1648
|
-
reason?: (() => string) | string;
|
|
1649
|
-
}): void;
|
|
1650
|
-
//#endregion
|
|
1651
1861
|
//#region src/utils/process-tokens.d.ts
|
|
1652
1862
|
/**
|
|
1653
1863
|
* Process tokens object into inline style properties.
|
|
1654
|
-
* -
|
|
1655
|
-
* -
|
|
1864
|
+
* - `$name` -> `--name` with the parsed value
|
|
1865
|
+
* - `#name` -> `--name-color` with the parsed value
|
|
1656
1866
|
*
|
|
1657
1867
|
* @param tokens - The tokens object to process
|
|
1658
1868
|
* @returns CSSProperties object or undefined if no tokens to process
|
|
@@ -1671,19 +1881,19 @@ interface DebugOptions {
|
|
|
1671
1881
|
/** Suppress console logging and return data only (default: false) */
|
|
1672
1882
|
raw?: boolean;
|
|
1673
1883
|
}
|
|
1674
|
-
interface
|
|
1884
|
+
interface CSSOptions extends DebugOptions {
|
|
1675
1885
|
prettify?: boolean;
|
|
1676
1886
|
/** Read from stored source CSS (dev-mode only) instead of live CSSOM */
|
|
1677
1887
|
source?: boolean;
|
|
1678
1888
|
}
|
|
1679
|
-
interface
|
|
1889
|
+
interface DebugChunkInfo {
|
|
1680
1890
|
className: string;
|
|
1681
1891
|
chunkName: string | null;
|
|
1682
1892
|
}
|
|
1683
1893
|
interface InspectResult {
|
|
1684
1894
|
element?: Element | null;
|
|
1685
1895
|
classes: string[];
|
|
1686
|
-
chunks:
|
|
1896
|
+
chunks: DebugChunkInfo[];
|
|
1687
1897
|
css: string;
|
|
1688
1898
|
size: number;
|
|
1689
1899
|
rules: number;
|
|
@@ -1707,7 +1917,13 @@ interface ChunkBreakdown {
|
|
|
1707
1917
|
}
|
|
1708
1918
|
interface Summary {
|
|
1709
1919
|
activeClasses: string[];
|
|
1920
|
+
/** Classes `gc({ force: true })` would delete right now. */
|
|
1710
1921
|
unusedClasses: string[];
|
|
1922
|
+
/**
|
|
1923
|
+
* Held but in neither list: nothing renders them, yet collection will not
|
|
1924
|
+
* take them — inside the grace window, or pinned by an `inject()` handle.
|
|
1925
|
+
*/
|
|
1926
|
+
hotClasses: string[];
|
|
1711
1927
|
totalStyledClasses: string[];
|
|
1712
1928
|
activeCSSSize: number;
|
|
1713
1929
|
unusedCSSSize: number;
|
|
@@ -1732,7 +1948,7 @@ interface Summary {
|
|
|
1732
1948
|
chunkBreakdown: ChunkBreakdown;
|
|
1733
1949
|
}
|
|
1734
1950
|
declare const tastyDebug: {
|
|
1735
|
-
css(target: CSSTarget, opts?:
|
|
1951
|
+
css(target: CSSTarget, opts?: CSSOptions): string;
|
|
1736
1952
|
inspect(target: string | Element, opts?: DebugOptions): InspectResult;
|
|
1737
1953
|
summary(opts?: DebugOptions): Summary;
|
|
1738
1954
|
chunks(opts?: DebugOptions): ChunkBreakdown;
|
|
@@ -1744,5 +1960,5 @@ declare const tastyDebug: {
|
|
|
1744
1960
|
install(): void;
|
|
1745
1961
|
};
|
|
1746
1962
|
//#endregion
|
|
1747
|
-
export {
|
|
1748
|
-
//# sourceMappingURL=index-
|
|
1963
|
+
export { createColorFunc as $, ModValue as $t, keyframes as A, hexToRgb as An, TastyComponentPropsWithDefaults as At, styleHandlers as B, AllBaseProps as Bt, getRawCSSText as C, TEXT_STYLES as Cn, ModPropsInput as Ct, injectRawCSS as D, isSelector as Dn, ResolveTokenProps as Dt, injectGlobal as E, hasStylesGenerated as En, ResolveModProps as Et, chunkSheetRegistry as F, TastyProps as Ft, ChunkName as G, BlockOuterStyleProps as Gt, categorizeStyleKeys as H, BasePropsWithoutChildren as Ht, ComputeStylesOptions as I, TokenPropsInput as It, FONT_CHUNK_STYLES as J, ContainerStyleProps as Jt, DIMENSION_CHUNK_STYLES as K, BlockStyleProps as Kt, ComputeStylesResult as L, VariantMap as Lt, property as M, strToRgb as Mn, TastyElementProps as Mt, touch as N, TastyExtensionProps as Nt, injector as O, getNamedColorHex as On, SubElementDefinition as Ot, ChunkSheetRegistry as P, TastyPolymorphicComponent as Pt, resolveFunctionColor as Q, InnerStyleProps as Qt, computeStyles as R, WithVariant as Rt, getCSSTextForNode as S, POSITION_STYLES as Sn, ModPropDef as St, inject as T, DEFAULT_ZERO_NAME_PREFIX as Tn, ResolveModPropDef as Tt, APPEARANCE_CHUNK_STYLES as U, BaseStyleProps as Ut, ChunkInfo as V, BaseProps as Vt, CHUNK_NAMES as W, BlockInnerStyleProps as Wt, POSITION_CHUNK_STYLES as X, ExtraBaseStyleProps as Xt, LAYOUT_CHUNK_STYLES as Y, DimensionStyleProps as Yt, STYLE_TO_CHUNK as Z, FlowStyleProps as Zt, destroy as _, CONTAINER_STYLES as _n, useStyles as _t, DebugOptions as a, TastyBaseStylePropNames as an, TastyBatchProvider as at, gc as b, INNER_STYLES as bn, Element$1 as bt, tastyDebug as c, TastyThemeNames as cn, useFunction as ct, modAttrs as d, Tokens as dn, UsePropertyOptions as dt, Mods as en, okhstFunction as et, color$1 as f, BASE_STYLES as fn, useProperty as ft, createInjector as g, COLOR_STYLES as gn, UseStylesResult as gt, counterStyle as h, BLOCK_STYLES as hn, useGlobalStyles as ht, DebugChunkInfo as i, TagName as in, getDisplayName as it, ownKeyframes as j, hslToRgbValues as jn, TastyElementOptions as jt, isPropertyDefined as k, getRgbValuesFromRgbaString as kn, SubElementProps as kt, processTokens as l, TextStyleProps as ln, useCounterStyle as lt, cleanup as m, BLOCK_OUTER_STYLES as mn, useRawCSS as mt, CacheStatus as n, PositionStyleProps as nn, okhslFunction as nt, InspectResult as o, TastyCustomProps as on, TastyBatchProviderProps as ot, filterBaseProps as p, BLOCK_INNER_STYLES as pn, useKeyframes as pt, DISPLAY_CHUNK_STYLES as q, ColorStyleProps as qt, ChunkBreakdown as r, ShortGridStyles as rn, okhslPlugin as rt, Summary as s, TastyExtensionConfig as sn, UseFunctionOptions as st, CSSOptions as t, OuterStyleProps as tn, okhstPlugin as tt, resolveRecipes as u, TokenValue as un, useFontFace as ut, fontFace as v, DIMENSION_STYLES as vn, AllBasePropsWithMods as vt, holdKeyframes as w, DEFAULT_NAME_PREFIX as wn, ResolveAsProps as wt, getCSSText as x, OUTER_STYLES as xn, ElementsDefinition as xt, func as y, FLOW_STYLES as yn, ComponentStatics as yt, defineHandler as z, tasty as zt };
|
|
1964
|
+
//# sourceMappingURL=index-DxQNRj50.d.ts.map
|