@tenphi/tasty 0.0.0-snapshot.4edfcbd → 0.0.0-snapshot.4fb5b7d
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-BOABQvEI.d.ts +16 -0
- package/dist/chunks/async-storage-CzSKAyrI.js +36 -0
- package/dist/chunks/async-storage-CzSKAyrI.js.map +1 -0
- package/dist/chunks/build-config-CKiw8Irz.js +59 -0
- package/dist/chunks/build-config-CKiw8Irz.js.map +1 -0
- package/dist/{collector-C-keQH9m.js → chunks/collector-EKAsDdmQ.js} +69 -103
- package/dist/chunks/collector-EKAsDdmQ.js.map +1 -0
- package/dist/chunks/config-engine-Br1Z5kEh.js +269 -0
- package/dist/chunks/config-engine-Br1Z5kEh.js.map +1 -0
- package/dist/chunks/config-file-BX3F_61U.js +24 -0
- package/dist/chunks/config-file-BX3F_61U.js.map +1 -0
- package/dist/chunks/css-definitions-CuohiBRl.js +896 -0
- package/dist/chunks/css-definitions-CuohiBRl.js.map +1 -0
- package/dist/chunks/css-resources-C0zT36nQ.js +141 -0
- package/dist/chunks/css-resources-C0zT36nQ.js.map +1 -0
- package/dist/chunks/debug-I3LGrxPm.js +501 -0
- package/dist/chunks/debug-I3LGrxPm.js.map +1 -0
- package/dist/chunks/dsl-BAwiOznp.js +1442 -0
- package/dist/chunks/dsl-BAwiOznp.js.map +1 -0
- package/dist/chunks/hydration-DEmoq1sQ.js +39 -0
- package/dist/chunks/hydration-DEmoq1sQ.js.map +1 -0
- package/dist/chunks/react-runtime-CrZHuNgA.js +678 -0
- package/dist/chunks/react-runtime-CrZHuNgA.js.map +1 -0
- package/dist/chunks/runtime-engine-BUiX_aR8.js +2418 -0
- package/dist/chunks/runtime-engine-BUiX_aR8.js.map +1 -0
- package/dist/chunks/runtime-state-BqEnurQk.js +150 -0
- package/dist/chunks/runtime-state-BqEnurQk.js.map +1 -0
- package/dist/{merge-styles-Cd2vBl9b.js → chunks/shared-utils-CYgOs2mp.js} +58 -57
- package/dist/chunks/shared-utils-CYgOs2mp.js.map +1 -0
- package/dist/chunks/style-engine-D8FKtEaC.js +5549 -0
- package/dist/chunks/style-engine-D8FKtEaC.js.map +1 -0
- package/dist/{css-writer-BWvwQzz0.js → chunks/zero-engine-C17ezpgd.js} +97 -140
- package/dist/chunks/zero-engine-C17ezpgd.js.map +1 -0
- package/dist/{collector-osfWTeRd.d.ts → collector-BN6hCWIx.d.ts} +62 -10
- package/dist/{config-BoZDUHW5.d.ts → config-Chmu-PnP.d.ts} +508 -104
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +9 -6
- package/dist/hydrate-CTh8SGd9.d.ts +20 -0
- package/dist/{index-B_k47mc_.d.ts → index-szujmf6W.d.ts} +687 -494
- package/dist/index.d.ts +5 -5
- package/dist/index.js +11 -732
- package/dist/merge-styles-Cx25bpax.d.ts +4 -0
- package/dist/ssr/astro-client.d.ts +1 -1
- package/dist/ssr/astro-client.js +2 -16
- package/dist/ssr/astro-client.js.map +1 -1
- package/dist/ssr/astro-middleware-extract-static.d.ts +8 -0
- package/dist/ssr/astro-middleware-extract-static.js +8 -0
- package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
- package/dist/ssr/astro-middleware-extract.d.ts +8 -0
- package/dist/ssr/astro-middleware-extract.js +8 -0
- package/dist/ssr/astro-middleware-extract.js.map +1 -0
- package/dist/ssr/astro-middleware-static.d.ts +15 -0
- package/dist/ssr/astro-middleware-static.js +6 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +11 -10
- package/dist/ssr/astro-middleware.js +3 -16
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.d.ts +40 -12
- package/dist/ssr/astro.js +163 -93
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/client.d.ts +2 -0
- package/dist/ssr/client.js +1 -0
- package/dist/ssr/index.d.ts +5 -34
- package/dist/ssr/index.js +7 -8
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +63 -0
- package/dist/ssr/next-config.js +122 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +9 -11
- package/dist/ssr/next.js +30 -46
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +8 -13
- package/dist/static/index.js +6 -26
- package/dist/static/index.js.map +1 -1
- package/dist/static/inject.d.ts +1 -4
- package/dist/static/inject.js +1 -2
- package/dist/static/inject.js.map +1 -1
- package/dist/{index-tcHuMPFt.d.ts → types-DbMN-Yyn.d.ts} +851 -592
- package/dist/zero/babel.d.ts +12 -22
- package/dist/zero/babel.js +98 -160
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +74 -11
- package/dist/zero/index.js +24 -2
- package/dist/zero/index.js.map +1 -0
- package/dist/zero/next.d.ts +5 -7
- package/dist/zero/next.js +4 -40
- 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 +146 -41
- 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-C-keQH9m.js.map +0 -1
- package/dist/config-BBiyxMCe.js +0 -10559
- package/dist/config-BBiyxMCe.js.map +0 -1
- package/dist/context-CkSg-kDT.js +0 -24
- package/dist/context-CkSg-kDT.js.map +0 -1
- package/dist/core-BO4319td.js +0 -1598
- package/dist/core-BO4319td.js.map +0 -1
- package/dist/css-writer-BWvwQzz0.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-BSjeH4Z7.js +0 -143
- package/dist/format-rules-BSjeH4Z7.js.map +0 -1
- package/dist/hydrate-CcvrP4qJ.js +0 -45
- package/dist/hydrate-CcvrP4qJ.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/keyframes-BUQhdOSJ.js +0 -588
- package/dist/keyframes-BUQhdOSJ.js.map +0 -1
- package/dist/merge-styles-BMWcH6MF.d.ts +0 -7
- package/dist/merge-styles-Cd2vBl9b.js.map +0 -1
- package/dist/resolve-recipes-C1nrvnYh.js +0 -144
- package/dist/resolve-recipes-C1nrvnYh.js.map +0 -1
|
@@ -1,9 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as ServerStyleCollector } from "./collector-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
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-DbMN-Yyn.js";
|
|
2
|
+
import { f as TastyPluginFactory, y as StyleInjector } from "./config-Chmu-PnP.js";
|
|
3
|
+
import { t as ServerStyleCollector } from "./collector-BN6hCWIx.js";
|
|
4
|
+
import "./merge-styles-Cx25bpax.js";
|
|
5
|
+
import React, { AllHTMLAttributes, CSSProperties, ComponentType, ElementType, ForwardRefExoticComponent, JSX, PropsWithoutRef, ReactNode, RefAttributes } from "react";
|
|
6
|
+
/**
|
|
7
|
+
* Consolidated color conversion math.
|
|
8
|
+
*
|
|
9
|
+
* Single source of truth for all color space conversions used across the
|
|
10
|
+
* library: sRGB gamma, HSL, OKLab, OKLCH, OKHSL, hex parsing, named
|
|
11
|
+
* colors, and CSS string converters.
|
|
12
|
+
*
|
|
13
|
+
* This module has zero internal imports — it is a leaf dependency.
|
|
14
|
+
*
|
|
15
|
+
* Reference: https://bottosson.github.io/posts/oklab/
|
|
16
|
+
*/
|
|
17
|
+
type Vec3 = [number, number, number];
|
|
18
|
+
/**
|
|
19
|
+
* HSL to RGB.
|
|
20
|
+
* Algorithm from CSS Color 4 spec.
|
|
21
|
+
*
|
|
22
|
+
* @param h - Hue in degrees (0-360)
|
|
23
|
+
* @param s - Saturation (0-1)
|
|
24
|
+
* @param l - Lightness (0-1)
|
|
25
|
+
* @returns RGB values in 0-255 range (may have fractional values)
|
|
26
|
+
*/
|
|
27
|
+
declare function hslToRgbValues(h: number, s: number, l: number): Vec3;
|
|
28
|
+
declare function getNamedColorHex(): Map<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Convert hex color string to `rgb()` CSS string.
|
|
31
|
+
* Supports 3, 4, 6, and 8 character hex values (with or without `#`).
|
|
32
|
+
*/
|
|
33
|
+
declare function hexToRgb(hex: string): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Extract RGB values from an `rgb()`/`rgba()` string.
|
|
36
|
+
* Supports comma-separated, space-separated, fractional, percentage,
|
|
37
|
+
* and slash alpha notation.
|
|
38
|
+
*
|
|
39
|
+
* @returns Array of RGB values (0-255 range), converting percentages as needed.
|
|
40
|
+
*/
|
|
41
|
+
declare function getRgbValuesFromRgbaString(str: string): number[];
|
|
42
|
+
/**
|
|
43
|
+
* Convert any recognized color string to an `rgb()` CSS string.
|
|
44
|
+
* Handles hex, `okhsl()`, `okhst()`, `hsl()`/`hsla()`, named CSS colors,
|
|
45
|
+
* and `rgb()`/`rgba()` pass-through.
|
|
46
|
+
*/
|
|
47
|
+
declare function strToRgb(color: string, _ignoreAlpha?: boolean): string | null | undefined;
|
|
48
|
+
/** Check whether a style-object key identifies a nested CSS selector. */
|
|
49
|
+
declare function isSelector(key: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Minimal configuration state shared by the style engine, zero-runtime
|
|
52
|
+
* extractor, and runtime configuration module. Keeping it independent
|
|
53
|
+
* prevents pure rendering code from importing the full injector graph.
|
|
54
|
+
*/
|
|
55
|
+
declare function hasStylesGenerated(): boolean;
|
|
7
56
|
/**
|
|
8
57
|
* Name prefix utilities for generated identifiers.
|
|
9
58
|
*
|
|
@@ -28,90 +77,18 @@ import { AllHTMLAttributes, CSSProperties, ComponentType, ElementType, ForwardRe
|
|
|
28
77
|
declare const DEFAULT_NAME_PREFIX = "t";
|
|
29
78
|
/** Default prefix used by the zero-runtime (`tastyStatic`) build path. */
|
|
30
79
|
declare const DEFAULT_ZERO_NAME_PREFIX = "ts";
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/plugins/okhsl-plugin.d.ts
|
|
33
|
-
/**
|
|
34
|
-
* The okhsl function handler for tasty parser.
|
|
35
|
-
* Receives parsed style groups and returns an RGB color string.
|
|
36
|
-
*/
|
|
37
|
-
declare const okhslFunc: (groups: StyleDetails[]) => string;
|
|
38
|
-
/**
|
|
39
|
-
* OKHSL Plugin for Tasty.
|
|
40
|
-
*
|
|
41
|
-
* Adds support for the `okhsl()` color function in tasty styles.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```ts
|
|
45
|
-
* import { configure } from '@tenphi/tasty';
|
|
46
|
-
* import { okhslPlugin } from '@tenphi/tasty';
|
|
47
|
-
*
|
|
48
|
-
* configure({
|
|
49
|
-
* plugins: [okhslPlugin()],
|
|
50
|
-
* });
|
|
51
|
-
*
|
|
52
|
-
* // Now you can use okhsl in styles:
|
|
53
|
-
* const Box = tasty({
|
|
54
|
-
* styles: {
|
|
55
|
-
* fill: 'okhsl(240 50% 50%)',
|
|
56
|
-
* },
|
|
57
|
-
* });
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
declare const okhslPlugin: TastyPluginFactory;
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region src/chunks/definitions.d.ts
|
|
63
|
-
declare const CHUNK_NAMES: {
|
|
64
|
-
/** Special chunk for styles that cannot be split */readonly COMBINED: "combined";
|
|
65
|
-
readonly SUBCOMPONENTS: "subcomponents";
|
|
66
|
-
readonly APPEARANCE: "appearance";
|
|
67
|
-
readonly FONT: "font";
|
|
68
|
-
readonly DIMENSION: "dimension";
|
|
69
|
-
readonly DISPLAY: "display";
|
|
70
|
-
readonly LAYOUT: "layout";
|
|
71
|
-
readonly POSITION: "position";
|
|
72
|
-
readonly MISC: "misc";
|
|
73
|
-
};
|
|
74
|
-
type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];
|
|
75
|
-
/**
|
|
76
|
-
* Pre-computed map for O(1) style-to-chunk lookup.
|
|
77
|
-
* Built once at module load time.
|
|
78
|
-
*/
|
|
79
|
-
declare const STYLE_TO_CHUNK: Map<string, ChunkName>;
|
|
80
|
-
interface ChunkInfo$1 {
|
|
81
|
-
/** Name of the chunk */
|
|
82
|
-
name: ChunkName | string;
|
|
83
|
-
/** Style keys belonging to this chunk */
|
|
84
|
-
styleKeys: string[];
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Categorize style keys into chunks.
|
|
88
|
-
*
|
|
89
|
-
* Returns chunks in a deterministic order (by CHUNK_ORDER) regardless
|
|
90
|
-
* of the order of keys in the input styles object.
|
|
91
|
-
*
|
|
92
|
-
* @param styles - The styles object to categorize
|
|
93
|
-
* @returns Map of chunk name to array of style keys in that chunk (in priority order)
|
|
94
|
-
*/
|
|
95
|
-
declare function categorizeStyleKeys(styles: Record<string, unknown>): Map<string, string[]>;
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region src/styles/list.d.ts
|
|
98
80
|
declare const BASE_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition"];
|
|
99
|
-
declare const POSITION_STYLES: readonly ["gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "inset", "position", "scrollMargin"];
|
|
100
|
-
declare const BLOCK_INNER_STYLES: readonly ["padding", "
|
|
101
|
-
declare const BLOCK_OUTER_STYLES: readonly ["border", "radius", "shadow", "outline"];
|
|
102
|
-
declare const BLOCK_STYLES: readonly ["padding", "
|
|
81
|
+
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"];
|
|
82
|
+
declare const BLOCK_INNER_STYLES: readonly ["padding", "blockPadding", "inlinePadding", "overflow", "scrollbar", "textAlign"];
|
|
83
|
+
declare const BLOCK_OUTER_STYLES: readonly ["border", "blockBorder", "inlineBorder", "radius", "shadow", "outline"];
|
|
84
|
+
declare const BLOCK_STYLES: readonly ["padding", "blockPadding", "inlinePadding", "overflow", "scrollbar", "textAlign", "border", "blockBorder", "inlineBorder", "radius", "shadow", "outline"];
|
|
103
85
|
declare const COLOR_STYLES: readonly ["color", "fill", "fade", "image"];
|
|
104
86
|
declare const TEXT_STYLES: readonly ["textTransform", "fontWeight", "fontStyle"];
|
|
105
|
-
declare const DIMENSION_STYLES: readonly ["width", "height", "flexBasis", "flexGrow", "flexShrink", "flex"];
|
|
87
|
+
declare const DIMENSION_STYLES: readonly ["width", "height", "blockSize", "inlineSize", "flexBasis", "flexGrow", "flexShrink", "flex"];
|
|
106
88
|
declare const FLOW_STYLES: readonly ["flow", "place", "placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "gap", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas"];
|
|
107
|
-
declare const CONTAINER_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition", "color", "fill", "fade", "image", "width", "height", "flexBasis", "flexGrow", "flexShrink", "flex", "gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "inset", "position", "scrollMargin", "padding", "
|
|
108
|
-
declare const OUTER_STYLES: readonly ["gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "inset", "position", "scrollMargin", "width", "height", "flexBasis", "flexGrow", "flexShrink", "flex", "border", "radius", "shadow", "outline"];
|
|
109
|
-
declare const INNER_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition", "color", "fill", "fade", "image", "padding", "
|
|
110
|
-
//#endregion
|
|
111
|
-
//#region src/types.d.ts
|
|
112
|
-
interface GlobalStyledProps {
|
|
113
|
-
breakpoints?: number[];
|
|
114
|
-
}
|
|
89
|
+
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"];
|
|
90
|
+
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"];
|
|
91
|
+
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"];
|
|
115
92
|
/**
|
|
116
93
|
* Extensible interface for theme names.
|
|
117
94
|
* Augment this interface to register project-specific theme names for autocomplete.
|
|
@@ -129,6 +106,42 @@ interface GlobalStyledProps {
|
|
|
129
106
|
interface TastyThemeNames {}
|
|
130
107
|
type ThemeNameKey = Extract<keyof TastyThemeNames, string>;
|
|
131
108
|
type ThemeName = [ThemeNameKey] extends [never] ? string : ThemeNameKey;
|
|
109
|
+
/**
|
|
110
|
+
* Extensible interface for custom props added via `configure({ propHandlers })`.
|
|
111
|
+
* Augment it to type those props on every tasty component.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* declare module '@tenphi/tasty' {
|
|
116
|
+
* interface TastyCustomProps {
|
|
117
|
+
* glaze: 'soft' | 'strong' | { tone: string; intensity?: number };
|
|
118
|
+
* }
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
interface TastyCustomProps {}
|
|
123
|
+
/**
|
|
124
|
+
* Extensible interface for style names promoted via
|
|
125
|
+
* `configure({ baseStyleProps })`. Set each name to `true`; the prop is then typed
|
|
126
|
+
* exactly like the style it names.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* declare module '@tenphi/tasty' {
|
|
131
|
+
* interface TastyBaseStylePropNames {
|
|
132
|
+
* radius: true;
|
|
133
|
+
* shadow: true;
|
|
134
|
+
* }
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
interface TastyBaseStylePropNames {}
|
|
139
|
+
/**
|
|
140
|
+
* Props contributed by `configure({ baseStyleProps })`, each typed like the style
|
|
141
|
+
* it names. Intersecting with `keyof StylesInterface` makes a name that isn't a
|
|
142
|
+
* real style inert rather than `never`-typed.
|
|
143
|
+
*/
|
|
144
|
+
type ExtraBaseStyleProps = { [key in keyof TastyBaseStylePropNames & keyof StylesInterface]?: StylePropValue<StylesInterface[key]>; };
|
|
132
145
|
/** Allowed mod value types */
|
|
133
146
|
type ModValue = boolean | string | number | undefined | null;
|
|
134
147
|
/**
|
|
@@ -151,7 +164,7 @@ type TokenValue = string | number | boolean | undefined | null;
|
|
|
151
164
|
/**
|
|
152
165
|
* Tokens definition for inline CSS custom properties.
|
|
153
166
|
* - `$name` keys become `--name` CSS properties
|
|
154
|
-
* - `#name` keys become `--name-color`
|
|
167
|
+
* - `#name` keys become `--name-color` CSS properties
|
|
155
168
|
*/
|
|
156
169
|
type Tokens = Record<`$${string}` | `#${string}`, TokenValue>;
|
|
157
170
|
type Caps = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z';
|
|
@@ -166,20 +179,14 @@ interface BasePropsWithoutChildren<K extends TagName = TagName> extends Pick<All
|
|
|
166
179
|
element?: `${Caps}${string}`;
|
|
167
180
|
/** The style map */
|
|
168
181
|
styles?: Styles;
|
|
169
|
-
/** The list of responsive points in pixels */
|
|
170
|
-
breakpoints?: number[];
|
|
171
|
-
/** Whether the element has the block layout outside */
|
|
172
|
-
block?: boolean;
|
|
173
|
-
/** Whether the element has the inline layout outside */
|
|
174
|
-
inline?: boolean;
|
|
175
182
|
/** The list of element modifiers **/
|
|
176
183
|
mods?: Mods;
|
|
177
184
|
/** Whether the element is hidden (`hidden` attribute is set) */
|
|
178
185
|
isHidden?: boolean;
|
|
179
186
|
/** Whether the element is disabled (`disabled` attribute is set) */
|
|
180
187
|
isDisabled?: boolean;
|
|
181
|
-
/**
|
|
182
|
-
|
|
188
|
+
/** Whether the element is checked (`checked` attribute is set) */
|
|
189
|
+
isChecked?: boolean;
|
|
183
190
|
/** The CSS style map */
|
|
184
191
|
style?: CSSProperties$1 | (CSSProperties$1 & Record<string, string | number | null | undefined>);
|
|
185
192
|
/** User-defined theme for the element. Mapped to `data-theme` attribute. Augment `TastyThemeNames` to register project-specific themes for autocomplete. */
|
|
@@ -207,7 +214,6 @@ interface ShortGridStyles {
|
|
|
207
214
|
rows?: Styles['gridRows'];
|
|
208
215
|
areas?: Styles['gridAreas'];
|
|
209
216
|
}
|
|
210
|
-
type Props = Record<string, any>;
|
|
211
217
|
type TagName = keyof HTMLElementTagNameMap;
|
|
212
218
|
/**
|
|
213
219
|
* Configuration type for tasty.config.ts files.
|
|
@@ -252,7 +258,7 @@ interface TastyExtensionConfig {
|
|
|
252
258
|
* Set to `false` to disable function validation (overrides parent).
|
|
253
259
|
* @example ['clamp', 'double']
|
|
254
260
|
*/
|
|
255
|
-
|
|
261
|
+
functions?: false | string[];
|
|
256
262
|
/**
|
|
257
263
|
* State alias names for autocomplete.
|
|
258
264
|
* Must start with @ prefix.
|
|
@@ -284,9 +290,7 @@ interface TastyExtensionConfig {
|
|
|
284
290
|
*/
|
|
285
291
|
stateDescriptions?: Record<string, string>;
|
|
286
292
|
}
|
|
287
|
-
|
|
288
|
-
//#region src/tasty.d.ts
|
|
289
|
-
type StyleList = readonly (keyof { [key in keyof StylesInterface]: StylesInterface[key] })[];
|
|
293
|
+
type StyleList = readonly (keyof { [key in keyof StylesInterface]: StylesInterface[key]; })[];
|
|
290
294
|
/** Type descriptor for a single mod prop: a JS constructor or an enum array. */
|
|
291
295
|
type ModPropDef = BooleanConstructor | StringConstructor | NumberConstructor | readonly string[];
|
|
292
296
|
/** Array form: list of mod key names (types default to ModValue). */
|
|
@@ -298,7 +302,7 @@ type ModPropsInput = ModPropsList | ModPropsMap;
|
|
|
298
302
|
/** Resolve a single ModPropDef to its TypeScript type. */
|
|
299
303
|
type ResolveModPropDef<T> = T extends BooleanConstructor ? boolean : T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends readonly (infer U)[] ? U : ModValue;
|
|
300
304
|
/** Resolve an entire `modProps` definition to the component prop types it adds. */
|
|
301
|
-
type ResolveModProps<M extends ModPropsInput> = M extends readonly (infer K)[] ? Partial<Record<K & string, ModValue>> : M extends Record<string, ModPropDef> ? { [key in keyof M & string]?: ResolveModPropDef<M[key]
|
|
305
|
+
type ResolveModProps<M extends ModPropsInput> = M extends readonly (infer K)[] ? Partial<Record<K & string, ModValue>> : M extends Record<string, ModPropDef> ? { [key in keyof M & string]?: ResolveModPropDef<M[key]>; } : {};
|
|
302
306
|
/** A token key with `$` or `#` prefix. */
|
|
303
307
|
type TokenPropKey = `$${string}` | `#${string}`;
|
|
304
308
|
/** Array form: list of prop names. Names ending in `Color` map to `#` color tokens. */
|
|
@@ -309,9 +313,10 @@ type TokenPropsMap = Readonly<Record<string, TokenPropKey>>;
|
|
|
309
313
|
type TokenPropsInput = TokenPropsList | TokenPropsMap;
|
|
310
314
|
/** Resolve a `tokenProps` definition to the component prop types it adds. */
|
|
311
315
|
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>> : {};
|
|
316
|
+
type AnyProps = Record<string, any>;
|
|
312
317
|
type PropsWithStyles = {
|
|
313
318
|
styles?: Styles;
|
|
314
|
-
} & Omit<
|
|
319
|
+
} & Omit<Record<string, any>, 'styles'>;
|
|
315
320
|
type VariantMap = Record<string, Styles>;
|
|
316
321
|
interface WithVariant<V extends VariantMap> {
|
|
317
322
|
variant?: keyof V;
|
|
@@ -339,13 +344,15 @@ type ResolveElementTag<T extends SubElementDefinition<any>> = T extends string ?
|
|
|
339
344
|
} ? Tag extends keyof JSX.IntrinsicElements ? Tag : 'div' : 'div';
|
|
340
345
|
/**
|
|
341
346
|
* Props for sub-element components.
|
|
342
|
-
* Combines HTML attributes with tasty-specific props (qa, qaVal, mods, tokens, isDisabled, etc.)
|
|
347
|
+
* Combines HTML attributes with tasty-specific props (qa, qaVal, mods, tokens, theme, isDisabled, etc.)
|
|
343
348
|
*/
|
|
344
349
|
type SubElementProps<Tag extends keyof JSX.IntrinsicElements = 'div'> = Omit<JSX.IntrinsicElements[Tag], 'ref' | 'color' | 'content' | 'translate'> & {
|
|
345
350
|
qa?: string;
|
|
346
351
|
qaVal?: string | number;
|
|
347
352
|
mods?: Mods;
|
|
348
353
|
tokens?: Tokens;
|
|
354
|
+
/** User-defined theme for the element. Mapped to `data-theme` attribute. */
|
|
355
|
+
theme?: BaseProps['theme'];
|
|
349
356
|
isDisabled?: boolean;
|
|
350
357
|
isHidden?: boolean;
|
|
351
358
|
isChecked?: boolean;
|
|
@@ -353,24 +360,43 @@ type SubElementProps<Tag extends keyof JSX.IntrinsicElements = 'div'> = Omit<JSX
|
|
|
353
360
|
/**
|
|
354
361
|
* Generates the sub-element component types from an ElementsDefinition
|
|
355
362
|
*/
|
|
356
|
-
type SubElementComponents<E extends ElementsDefinition> = { [K in keyof E]: ForwardRefExoticComponent<PropsWithoutRef<SubElementProps<ResolveElementTag<E[K]>>> & RefAttributes<ResolveElementTag<E[K]> extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[ResolveElementTag<E[K]>] : Element$1
|
|
363
|
+
type SubElementComponents<E extends ElementsDefinition> = { [K in keyof E]: ForwardRefExoticComponent<PropsWithoutRef<SubElementProps<ResolveElementTag<E[K]>>> & RefAttributes<ResolveElementTag<E[K]> extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[ResolveElementTag<E[K]>] : Element$1>>; };
|
|
357
364
|
/**
|
|
358
365
|
* Base type containing common properties shared between TastyProps and TastyElementOptions.
|
|
359
366
|
* Separated to avoid code duplication while allowing different type constraints.
|
|
360
367
|
*/
|
|
361
368
|
type TastyBaseProps<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = {
|
|
362
|
-
/** Default styles of the element. */
|
|
363
|
-
|
|
364
|
-
|
|
369
|
+
/** Default styles of the element. */
|
|
370
|
+
styles?: Styles;
|
|
371
|
+
/** The list of styles that can be provided by props */
|
|
372
|
+
styleProps?: K;
|
|
373
|
+
/** Modifier keys exposed as top-level component props (array or typed object form). */
|
|
374
|
+
modProps?: M;
|
|
375
|
+
/** Token keys exposed as top-level component props (array or typed object form). */
|
|
365
376
|
tokenProps?: TP;
|
|
366
377
|
element?: BaseProps['element'];
|
|
367
|
-
variants?: V;
|
|
368
|
-
|
|
378
|
+
variants?: V;
|
|
379
|
+
/** Default tokens for inline CSS custom properties */
|
|
380
|
+
tokens?: Tokens;
|
|
381
|
+
/** Sub-element definitions for compound components */
|
|
369
382
|
elements?: E;
|
|
370
|
-
} & Pick<BaseProps, 'qa' | 'qaVal'
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
383
|
+
} & Pick<BaseProps, 'qa' | 'qaVal'>;
|
|
384
|
+
/**
|
|
385
|
+
* The names the `variant` option of `tasty(Base, options)` accepts: the
|
|
386
|
+
* extension's own variants and the base's, as its `variant` prop does. A
|
|
387
|
+
* union, not an intersection of the two, so an extension can default to a
|
|
388
|
+
* variant only one of them defines.
|
|
389
|
+
*/
|
|
390
|
+
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);
|
|
391
|
+
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> & {
|
|
392
|
+
/** The tag name of the element or a React component. */
|
|
393
|
+
as?: string | ComponentType<any>;
|
|
394
|
+
/**
|
|
395
|
+
* The variant applied when the `variant` prop is omitted or names no
|
|
396
|
+
* variant: one of `variants`, or one of the base component's.
|
|
397
|
+
*/
|
|
398
|
+
variant?: ExtensionVariantName<V, DefaultProps>;
|
|
399
|
+
} & Partial<Omit<DefaultProps, 'as' | 'styles' | 'styleProps' | 'modProps' | 'tokenProps' | 'tokens' | 'variant'>>;
|
|
374
400
|
/**
|
|
375
401
|
* Resolves the props of a polymorphic `as` value (intrinsic tag or component).
|
|
376
402
|
* - For intrinsic tags (`'div'`, `'button'`, ...): returns `JSX.IntrinsicElements[Tag]`.
|
|
@@ -384,18 +410,19 @@ type ResolveAsProps<AsType extends ElementType> = AsType extends keyof JSX.Intri
|
|
|
384
410
|
* element type from the `as` prop — both for intrinsic tags and for React
|
|
385
411
|
* components (so the wrapped component's prop API is preserved).
|
|
386
412
|
*
|
|
387
|
-
* Note: Uses a separate index signature with `unknown` instead of
|
|
388
|
-
*
|
|
413
|
+
* Note: Uses a separate index signature with `unknown` instead of an `any`
|
|
414
|
+
* record to ensure strict type checking for styles.
|
|
389
415
|
*/
|
|
390
|
-
type TastyElementOptions<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, AsType extends ElementType = 'div', M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = TastyBaseProps<K, V, E, M, TP> & {
|
|
391
|
-
/** The tag name of the element or a React component. */
|
|
416
|
+
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> & {
|
|
417
|
+
/** The tag name of the element or a React component. */
|
|
418
|
+
as?: AsType;
|
|
392
419
|
} & Record<string, unknown>;
|
|
393
|
-
type AllBasePropsWithMods<K extends StyleList, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = AllBaseProps & { [key in K[number]]?: StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]
|
|
420
|
+
type AllBasePropsWithMods<K extends StyleList, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = AllBaseProps & { [key in K[number]]?: StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]>; } & BaseStyleProps & ExtraBaseStyleProps & Partial<TastyCustomProps> & ResolveModProps<M> & ResolveTokenProps<TP>;
|
|
394
421
|
/**
|
|
395
|
-
*
|
|
396
|
-
*
|
|
422
|
+
* Props consumed by Tasty rather than forwarded to the `as` component.
|
|
423
|
+
* Event handlers are resolved from JSX.IntrinsicElements or the component's own props.
|
|
397
424
|
*/
|
|
398
|
-
type TastySpecificKeys = 'as' | 'qa' | 'qaVal' | 'element' | 'styles' | '
|
|
425
|
+
type TastySpecificKeys = keyof BaseStyleProps | 'as' | 'qa' | 'qaVal' | 'element' | 'styles' | 'mods' | 'isHidden' | 'isDisabled' | 'isChecked' | 'style' | 'theme' | 'tokens' | 'ref';
|
|
399
426
|
/** Extract prop key names from a ModPropsInput (array elements or object keys). */
|
|
400
427
|
type ModPropsKeys<M extends ModPropsInput> = M extends readonly (infer K)[] ? K & string : keyof M & string;
|
|
401
428
|
/** Extract prop key names from a TokenPropsInput (array elements or object keys). */
|
|
@@ -416,8 +443,25 @@ type TokenPropsKeys<TP extends TokenPropsInput> = TP extends readonly (infer K)[
|
|
|
416
443
|
* baseline is preserved so generic HTML attributes still work even when `as`
|
|
417
444
|
* is a component type with a narrower prop API.
|
|
418
445
|
*/
|
|
419
|
-
type TastyElementProps<K extends StyleList, V extends VariantMap, AsType extends ElementType = 'div', M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = Omit<AllBasePropsWithMods<K, M, TP>, Exclude<keyof ResolveAsProps<AsType>, TastySpecificKeys | K[number] | ModPropsKeys<M> | TokenPropsKeys<TP>>> & WithVariant<V> & Omit<Omit<AllHTMLAttributes<HTMLElement>, keyof ResolveAsProps<AsType>> & ResolveAsProps<AsType>, TastySpecificKeys | K[number] | ModPropsKeys<M> | TokenPropsKeys<TP>>;
|
|
420
|
-
|
|
446
|
+
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>>;
|
|
447
|
+
/** Statics React itself reads, as a type (see `REACT_STATICS`). */
|
|
448
|
+
type ReactStaticKey = '$$typeof' | 'render' | 'type' | 'compare' | 'displayName' | 'defaultProps' | 'propTypes' | 'contextType' | 'contextTypes' | 'childContextTypes' | 'getDerivedStateFromProps' | 'getDerivedStateFromError';
|
|
449
|
+
/**
|
|
450
|
+
* The statics of a component that are components themselves — a `tasty()`
|
|
451
|
+
* base's sub-elements (`Card.Title`) — which its extension keeps.
|
|
452
|
+
*/
|
|
453
|
+
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]; };
|
|
454
|
+
/** Prop names the extension form's own options claim from the base's props. */
|
|
455
|
+
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');
|
|
456
|
+
/**
|
|
457
|
+
* Props of a `tasty(Component, options)` extension: the base's props, plus
|
|
458
|
+
* whatever its own `styleProps`, `modProps`, `tokenProps` and `variants` add.
|
|
459
|
+
* Its variants extend the base's: `variant` accepts either set.
|
|
460
|
+
*/
|
|
461
|
+
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 : {
|
|
462
|
+
variant?: keyof V | ('variant' extends keyof Props ? NonNullable<Props['variant']> : never);
|
|
463
|
+
});
|
|
464
|
+
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]; };
|
|
421
465
|
/**
|
|
422
466
|
* The component type returned by the `tasty(options)` element-factory overload.
|
|
423
467
|
*
|
|
@@ -432,16 +476,9 @@ type TastyComponentPropsWithDefaults<Props extends PropsWithStyles, DefaultProps
|
|
|
432
476
|
* `SomeComponent`; create another `tasty({ as: SomeComponent })` for that.
|
|
433
477
|
*/
|
|
434
478
|
type TastyPolymorphicComponent<DefaultAs extends ElementType, K extends StyleList, V extends VariantMap, M extends ModPropsInput, TP extends TokenPropsInput> = ForwardRefExoticComponent<PropsWithoutRef<TastyElementProps<K, V, DefaultAs, M, TP>> & RefAttributes<unknown>>;
|
|
435
|
-
declare function tasty<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, AsType extends ElementType = 'div', M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]>(options: TastyElementOptions<K, V, E, AsType, M, TP>, secondArg?: never): TastyPolymorphicComponent<AsType, K, V, M, TP> & SubElementComponents<E>;
|
|
436
|
-
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<
|
|
437
|
-
declare const Element$1: TastyPolymorphicComponent<"div",
|
|
438
|
-
//#endregion
|
|
439
|
-
//#region src/hooks/useStyles.d.ts
|
|
440
|
-
/**
|
|
441
|
-
* Tasty styles object to generate CSS classes for.
|
|
442
|
-
* Can be undefined or empty object for no styles.
|
|
443
|
-
*/
|
|
444
|
-
type UseStylesOptions = Styles | undefined;
|
|
479
|
+
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>;
|
|
480
|
+
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>);
|
|
481
|
+
declare const Element$1: TastyPolymorphicComponent<"div", readonly never[], VariantMap, readonly never[], readonly never[]> & SubElementComponents<Record<string, never>>;
|
|
445
482
|
interface UseStylesResult {
|
|
446
483
|
/**
|
|
447
484
|
* Generated className(s) to apply to the element.
|
|
@@ -455,7 +492,9 @@ interface UseStylesResult {
|
|
|
455
492
|
* Thin wrapper around `computeStyles()` that adds React context-based
|
|
456
493
|
* SSR collector discovery for backward compatibility with TastyRegistry.
|
|
457
494
|
*
|
|
458
|
-
*
|
|
495
|
+
* Works in Server Components too. There, like the other style functions, it
|
|
496
|
+
* cannot emit CSS itself: the next `tasty()` element in the tree emits it, so
|
|
497
|
+
* render one after it.
|
|
459
498
|
*
|
|
460
499
|
* @example
|
|
461
500
|
* ```tsx
|
|
@@ -470,11 +509,9 @@ interface UseStylesResult {
|
|
|
470
509
|
* }
|
|
471
510
|
* ```
|
|
472
511
|
*/
|
|
473
|
-
declare function useStyles(styles:
|
|
512
|
+
declare function useStyles(styles: Styles | undefined, options?: {
|
|
474
513
|
root?: Document | ShadowRoot;
|
|
475
514
|
}): UseStylesResult;
|
|
476
|
-
//#endregion
|
|
477
|
-
//#region src/hooks/useGlobalStyles.d.ts
|
|
478
515
|
interface UseGlobalStylesOptions {
|
|
479
516
|
/**
|
|
480
517
|
* Stable identifier for update tracking (client-only). When provided,
|
|
@@ -499,6 +536,10 @@ interface UseGlobalStylesOptions {
|
|
|
499
536
|
* Use the `id` option for update tracking when styles change over the
|
|
500
537
|
* component lifecycle.
|
|
501
538
|
*
|
|
539
|
+
* Update tracking is per-slot and per-root: a slot (`id`, or the selector when
|
|
540
|
+
* no `id` is given) holds exactly one injection per `root`. Changing the styles
|
|
541
|
+
* replaces it; rendering styles that produce no CSS clears it.
|
|
542
|
+
*
|
|
502
543
|
* @param selector - CSS selector to apply styles to (e.g., '.my-class', ':root', 'body')
|
|
503
544
|
* @param styles - Tasty styles object
|
|
504
545
|
* @param options - Optional settings including `id` for update tracking
|
|
@@ -517,13 +558,10 @@ interface UseGlobalStylesOptions {
|
|
|
517
558
|
* ```
|
|
518
559
|
*/
|
|
519
560
|
declare function useGlobalStyles(selector: string, styles?: Styles, options?: UseGlobalStylesOptions): void;
|
|
520
|
-
//#endregion
|
|
521
|
-
//#region src/hooks/useRawCSS.d.ts
|
|
522
561
|
interface UseRawCSSOptions {
|
|
523
562
|
/**
|
|
524
|
-
* Shadow root or document to inject into.
|
|
525
|
-
*
|
|
526
|
-
* only the root for the same id/content will not re-inject.
|
|
563
|
+
* Shadow root or document to inject into. Update tracking is per-root: the
|
|
564
|
+
* same id in two roots holds a separate injection in each.
|
|
527
565
|
*/
|
|
528
566
|
root?: Document | ShadowRoot;
|
|
529
567
|
/**
|
|
@@ -537,8 +575,6 @@ interface UseRawCSSOptions {
|
|
|
537
575
|
}
|
|
538
576
|
declare function useRawCSS(css: string, options?: UseRawCSSOptions): void;
|
|
539
577
|
declare function useRawCSS(factory: () => string, deps: readonly unknown[], options?: UseRawCSSOptions): void;
|
|
540
|
-
//#endregion
|
|
541
|
-
//#region src/hooks/useKeyframes.d.ts
|
|
542
578
|
interface UseKeyframesOptions {
|
|
543
579
|
name?: string;
|
|
544
580
|
root?: Document | ShadowRoot;
|
|
@@ -549,6 +585,11 @@ interface UseKeyframesOptions {
|
|
|
549
585
|
*
|
|
550
586
|
* Works in all environments: client, SSR with collector, and React Server Components.
|
|
551
587
|
*
|
|
588
|
+
* Passing `name` claims a slot owned by that one call site (like `useRawCSS`'s
|
|
589
|
+
* `id`): when its steps change, the previous injection is disposed and the name
|
|
590
|
+
* is reused, so the rules don't accumulate. Anonymous keyframes are permanent
|
|
591
|
+
* and shared by content.
|
|
592
|
+
*
|
|
552
593
|
* @example Basic usage - steps object is the dependency
|
|
553
594
|
* ```tsx
|
|
554
595
|
* function MyComponent() {
|
|
@@ -591,30 +632,11 @@ interface UseKeyframesOptions {
|
|
|
591
632
|
*/
|
|
592
633
|
declare function useKeyframes(steps: KeyframesSteps, options?: UseKeyframesOptions): string;
|
|
593
634
|
declare function useKeyframes(factory: () => KeyframesSteps, deps: readonly unknown[], options?: UseKeyframesOptions): string;
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
* For color tokens (#name), this is auto-set to '<color>' and cannot be overridden.
|
|
600
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/@property/syntax
|
|
601
|
-
*/
|
|
602
|
-
syntax?: string;
|
|
603
|
-
/**
|
|
604
|
-
* Whether the property inherits from parent elements
|
|
605
|
-
* @default true
|
|
606
|
-
*/
|
|
607
|
-
inherits?: boolean;
|
|
608
|
-
/**
|
|
609
|
-
* Initial value for the property.
|
|
610
|
-
* For color tokens (#name), this defaults to 'transparent' if not specified.
|
|
611
|
-
*/
|
|
612
|
-
initialValue?: string | number;
|
|
613
|
-
/**
|
|
614
|
-
* Shadow root or document to inject into
|
|
615
|
-
*/
|
|
616
|
-
root?: Document | ShadowRoot;
|
|
617
|
-
}
|
|
635
|
+
/**
|
|
636
|
+
* Options for {@link useProperty}. Extends the shared {@link PropertyOptions}
|
|
637
|
+
* (which is `PropertyDefinition` plus an optional injection `root`).
|
|
638
|
+
*/
|
|
639
|
+
type UsePropertyOptions = PropertyOptions;
|
|
618
640
|
/**
|
|
619
641
|
* Register a CSS @property custom property.
|
|
620
642
|
* This enables advanced features like animating custom properties.
|
|
@@ -670,8 +692,6 @@ interface UsePropertyOptions {
|
|
|
670
692
|
* ```
|
|
671
693
|
*/
|
|
672
694
|
declare function useProperty(name: string, options?: UsePropertyOptions): void;
|
|
673
|
-
//#endregion
|
|
674
|
-
//#region src/hooks/useFontFace.d.ts
|
|
675
695
|
interface UseFontFaceOptions {
|
|
676
696
|
root?: Document | ShadowRoot;
|
|
677
697
|
}
|
|
@@ -711,8 +731,6 @@ interface UseFontFaceOptions {
|
|
|
711
731
|
* ```
|
|
712
732
|
*/
|
|
713
733
|
declare function useFontFace(family: string, input: FontFaceInput, options?: UseFontFaceOptions): void;
|
|
714
|
-
//#endregion
|
|
715
|
-
//#region src/hooks/useCounterStyle.d.ts
|
|
716
734
|
interface UseCounterStyleOptions {
|
|
717
735
|
name?: string;
|
|
718
736
|
root?: Document | ShadowRoot;
|
|
@@ -743,16 +761,294 @@ interface UseCounterStyleOptions {
|
|
|
743
761
|
*
|
|
744
762
|
*/
|
|
745
763
|
declare function useCounterStyle(descriptors: CounterStyleDescriptors, options?: UseCounterStyleOptions): string;
|
|
746
|
-
|
|
747
|
-
|
|
764
|
+
interface UseFunctionOptions {
|
|
765
|
+
/** Shadow root or document to inject into. */
|
|
766
|
+
root?: Document | ShadowRoot;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Register a CSS @function (custom function).
|
|
770
|
+
*
|
|
771
|
+
* @function rules are global and persistent once defined. The hook ensures the
|
|
772
|
+
* function is only registered once per root (deduplicated by function name).
|
|
773
|
+
*
|
|
774
|
+
* Accepts tasty token syntax for the function name:
|
|
775
|
+
* - `$$name` → defines `--name` (matches the call site `$$name(...)`)
|
|
776
|
+
* - `$name` / `--name` → also accepted
|
|
777
|
+
*
|
|
778
|
+
* Works in all environments: client, SSR with collector, and React Server Components.
|
|
779
|
+
*
|
|
780
|
+
* @param name - The function name token (`$$name`, `$name`, or `--name`)
|
|
781
|
+
* @param definition - Function definition (args, returns, result, local vars)
|
|
782
|
+
*
|
|
783
|
+
* Call the function through the Tasty DSL, not a raw `style` prop: an inline
|
|
784
|
+
* `style` value reaches the browser unparsed, so the `$$name(...)` sugar is never
|
|
785
|
+
* expanded and `polyfills.functions` cannot rewrite it either.
|
|
786
|
+
*
|
|
787
|
+
* @example
|
|
788
|
+
* ```tsx
|
|
789
|
+
* const Box = tasty({ styles: { marginTop: '$$negative(10px)' } });
|
|
790
|
+
*
|
|
791
|
+
* function Layout() {
|
|
792
|
+
* useFunction('$$negative', { args: ['$value'], result: '(-1 * $value)' });
|
|
793
|
+
* return <Box />;
|
|
794
|
+
* }
|
|
795
|
+
* ```
|
|
796
|
+
*/
|
|
797
|
+
declare function useFunction(name: string, definition: FunctionDefinition, options?: UseFunctionOptions): void;
|
|
798
|
+
interface TastyBatchProviderProps {
|
|
799
|
+
children?: ReactNode;
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Opens a *batch window* for the commit it renders in, so `batchInjection`
|
|
803
|
+
* can defer stylesheet writes without ever letting a layout effect measure an
|
|
804
|
+
* unstyled element.
|
|
805
|
+
*
|
|
806
|
+
* Every `insertRule()` on a live sheet invalidates style for that sheet's
|
|
807
|
+
* scope. When components inject during React's render phase while others read
|
|
808
|
+
* layout in the same pass, the two interleave and the browser recalculates
|
|
809
|
+
* style between every injection. Batching collapses that into one invalidation
|
|
810
|
+
* per flush — but only if the flush happens before anything can measure.
|
|
811
|
+
*
|
|
812
|
+
* ```
|
|
813
|
+
* provider renders -> window OPEN
|
|
814
|
+
* children render -> injections queued
|
|
815
|
+
* provider insertionEffect -> FLUSH, window CLOSED
|
|
816
|
+
* layout effects run -> rules are in the sheet
|
|
817
|
+
* ```
|
|
818
|
+
*
|
|
819
|
+
* `useInsertionEffect` runs in React's mutation phase, after every render in
|
|
820
|
+
* the commit and before any `useLayoutEffect` — which is exactly why React
|
|
821
|
+
* added it for CSS-in-JS libraries. Effects fire child-first, so this
|
|
822
|
+
* provider's runs after every descendant's and still before all layout
|
|
823
|
+
* effects.
|
|
824
|
+
*
|
|
825
|
+
* A commit that does not re-render this provider gets no window, and those
|
|
826
|
+
* injections are written synchronously instead. That is the point: turning
|
|
827
|
+
* `batchInjection: true` on can only ever make injection cheaper, never make a
|
|
828
|
+
* measurement wrong. It also means batching applies to commits this provider
|
|
829
|
+
* takes part in, so mount it as high in the tree as you can.
|
|
830
|
+
*
|
|
831
|
+
* Requires `configure({ batchInjection: true })`; without it this component
|
|
832
|
+
* only renders its children. `batchInjection: 'always'` does not need the
|
|
833
|
+
* provider at all — see that option's docs for the trade-off it accepts.
|
|
834
|
+
*
|
|
835
|
+
* @example
|
|
836
|
+
* ```tsx
|
|
837
|
+
* configure({ batchInjection: true });
|
|
838
|
+
*
|
|
839
|
+
* createRoot(el).render(
|
|
840
|
+
* <TastyBatchProvider>
|
|
841
|
+
* <App />
|
|
842
|
+
* </TastyBatchProvider>,
|
|
843
|
+
* );
|
|
844
|
+
* ```
|
|
845
|
+
*/
|
|
846
|
+
declare function TastyBatchProvider({ children }: TastyBatchProviderProps): React.ReactNode;
|
|
847
|
+
/**
|
|
848
|
+
* A readable name for a component: its `displayName`, else its function name,
|
|
849
|
+
* looking through `forwardRef()` and `memo()` to the component they wrap. A
|
|
850
|
+
* tag name names itself. Falls back to `fallbackName` when there is none.
|
|
851
|
+
*/
|
|
748
852
|
declare function getDisplayName<T>(Component: ElementType<T>, fallbackName?: string): string;
|
|
749
|
-
//#endregion
|
|
750
|
-
//#region src/index.d.ts
|
|
751
853
|
declare module './utils/css-types' {
|
|
752
854
|
interface CSSProperties extends CSSProperties {}
|
|
753
855
|
}
|
|
754
|
-
|
|
755
|
-
|
|
856
|
+
/**
|
|
857
|
+
* The okhsl function handler for tasty parser.
|
|
858
|
+
* Receives parsed style groups and returns an RGB color string.
|
|
859
|
+
*/
|
|
860
|
+
declare const okhslFunction: (groups: StyleDetails[]) => string;
|
|
861
|
+
/**
|
|
862
|
+
* OKHSL Plugin for Tasty.
|
|
863
|
+
*
|
|
864
|
+
* Adds support for the `okhsl()` color function in tasty styles.
|
|
865
|
+
*
|
|
866
|
+
* @example
|
|
867
|
+
* ```ts
|
|
868
|
+
* import { configure } from '@tenphi/tasty';
|
|
869
|
+
* import { okhslPlugin } from '@tenphi/tasty';
|
|
870
|
+
*
|
|
871
|
+
* configure({
|
|
872
|
+
* plugins: [okhslPlugin()],
|
|
873
|
+
* });
|
|
874
|
+
*
|
|
875
|
+
* // Now you can use okhsl in styles:
|
|
876
|
+
* const Box = tasty({
|
|
877
|
+
* styles: {
|
|
878
|
+
* fill: 'okhsl(240 50% 50%)',
|
|
879
|
+
* },
|
|
880
|
+
* });
|
|
881
|
+
* ```
|
|
882
|
+
*/
|
|
883
|
+
declare const okhslPlugin: TastyPluginFactory;
|
|
884
|
+
/**
|
|
885
|
+
* The okhst function handler for tasty parser.
|
|
886
|
+
* Receives parsed style groups and returns an RGB color string.
|
|
887
|
+
*/
|
|
888
|
+
declare const okhstFunction: (groups: StyleDetails[]) => string;
|
|
889
|
+
/**
|
|
890
|
+
* OKHST Plugin for Tasty.
|
|
891
|
+
*
|
|
892
|
+
* Adds support for the `okhst()` color function in tasty styles.
|
|
893
|
+
*
|
|
894
|
+
* @example
|
|
895
|
+
* ```ts
|
|
896
|
+
* import { configure } from '@tenphi/tasty';
|
|
897
|
+
* import { okhstPlugin } from '@tenphi/tasty';
|
|
898
|
+
*
|
|
899
|
+
* configure({
|
|
900
|
+
* plugins: [okhstPlugin()],
|
|
901
|
+
* });
|
|
902
|
+
*
|
|
903
|
+
* // Now you can use okhst in styles:
|
|
904
|
+
* const Box = tasty({
|
|
905
|
+
* styles: {
|
|
906
|
+
* fill: 'okhst(240 50% 50%)',
|
|
907
|
+
* },
|
|
908
|
+
* });
|
|
909
|
+
* ```
|
|
910
|
+
*/
|
|
911
|
+
declare const okhstPlugin: TastyPluginFactory;
|
|
912
|
+
/**
|
|
913
|
+
* Creates a color function handler for the tasty parser.
|
|
914
|
+
*
|
|
915
|
+
* A color function is a custom `functions` entry that converts its arguments
|
|
916
|
+
* to an `rgb(...)` string (an already-supported color), so it needs no special
|
|
917
|
+
* core integration — registering it as a parse function is enough.
|
|
918
|
+
*
|
|
919
|
+
* @param name The name of the color function (e.g., 'okhsl', 'okhst')
|
|
920
|
+
* @param convert Converts the parsed first three channel values (after angle/
|
|
921
|
+
* percent normalization) to sRGB `[r, g, b]` in the 0-1 range
|
|
922
|
+
* @param label Optional diagnostic label shown in dev warnings when the wrong
|
|
923
|
+
* number of arguments is supplied (e.g., 'H S L'). Has no effect on parsing
|
|
924
|
+
* or output.
|
|
925
|
+
*/
|
|
926
|
+
declare function createColorFunc(name: string, convert: (h: number, c2: number, c3: number) => [number, number, number], label?: string): (groups: StyleDetails[]) => string;
|
|
927
|
+
/**
|
|
928
|
+
* Resolve a `name(...)` value produced by a registered custom parse function
|
|
929
|
+
* into its concrete color output.
|
|
930
|
+
*
|
|
931
|
+
* A color function is just a `functions` entry whose output is an already
|
|
932
|
+
* supported color (`rgb`, `hsl`, `#…`, `oklch`, …). This helper delegates the
|
|
933
|
+
* value to the global parser (which already runs the registered parse function)
|
|
934
|
+
* and returns the result only when it looks like a color. Returns `null` when
|
|
935
|
+
* `str` is not a registered custom function or its output is not a color.
|
|
936
|
+
*
|
|
937
|
+
* This is the generic replacement for the previously hardcoded okhsl/okhst
|
|
938
|
+
* conversion branches scattered across `strToRgb`, `resolveToRgbaValues`, and
|
|
939
|
+
* the `#token.alpha` injection path.
|
|
940
|
+
*/
|
|
941
|
+
declare function resolveFunctionColor(str: string): string | null;
|
|
942
|
+
/**
|
|
943
|
+
* Chunk names, the built-in chunk style lists, and the style→chunk lookup.
|
|
944
|
+
*
|
|
945
|
+
* This module only imports data-only style-name lists. It exists separately
|
|
946
|
+
* from `definitions.ts` for two reasons:
|
|
947
|
+
*
|
|
948
|
+
* 1. The style handler registry (`styles/predefined.ts`) needs to assign chunk
|
|
949
|
+
* membership for custom handlers. Reaching for `definitions.ts` would create an
|
|
950
|
+
* import cycle (`definitions` -> `pipeline` -> `styles` -> `predefined`).
|
|
951
|
+
* 2. `STYLE_TO_CHUNK` is populated as a side effect of module load, so it must be
|
|
952
|
+
* populated by the module that *owns* it. Otherwise an importer that only pulls
|
|
953
|
+
* in this module would see an empty map and misclassify every style as `misc`.
|
|
954
|
+
*
|
|
955
|
+
* `definitions.ts` re-exports everything here, so existing import paths and the
|
|
956
|
+
* public API surface are unchanged.
|
|
957
|
+
*/
|
|
958
|
+
declare const CHUNK_NAMES: {
|
|
959
|
+
/** Special chunk for styles that cannot be split */
|
|
960
|
+
readonly COMBINED: "combined";
|
|
961
|
+
readonly SUBCOMPONENTS: "subcomponents";
|
|
962
|
+
readonly APPEARANCE: "appearance";
|
|
963
|
+
readonly FONT: "font";
|
|
964
|
+
readonly DIMENSION: "dimension";
|
|
965
|
+
readonly DISPLAY: "display";
|
|
966
|
+
readonly LAYOUT: "layout";
|
|
967
|
+
readonly POSITION: "position";
|
|
968
|
+
readonly MISC: "misc";
|
|
969
|
+
};
|
|
970
|
+
type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];
|
|
971
|
+
/**
|
|
972
|
+
* Appearance chunk - visual styling
|
|
973
|
+
*
|
|
974
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
975
|
+
* ⚠️ fillStyle: fill, backgroundColor, image, backgroundImage,
|
|
976
|
+
* backgroundPosition/Size/Repeat/Attachment/Origin/Clip, background
|
|
977
|
+
*
|
|
978
|
+
* @public
|
|
979
|
+
*/
|
|
980
|
+
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"];
|
|
981
|
+
/**
|
|
982
|
+
* Font chunk - typography styles
|
|
983
|
+
*
|
|
984
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
985
|
+
* ⚠️ presetStyle: preset, fontSize, lineHeight, letterSpacing, textTransform,
|
|
986
|
+
* fontWeight, fontStyle, font
|
|
987
|
+
*/
|
|
988
|
+
/** @public */
|
|
989
|
+
declare const FONT_CHUNK_STYLES: readonly ["preset", "font", "fontWeight", "fontStyle", "fontSize", "lineHeight", "letterSpacing", "textTransform", "fontFamily", "textAlign", "textDecoration", "wordBreak", "wordWrap", "boldFontWeight"];
|
|
990
|
+
/**
|
|
991
|
+
* Dimension chunk - sizing and spacing
|
|
992
|
+
*
|
|
993
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
994
|
+
* ⚠️ paddingStyle: padding, paddingTop/Right/Bottom/Left
|
|
995
|
+
* ⚠️ marginStyle: margin, marginTop/Right/Bottom/Left
|
|
996
|
+
* ⚠️ widthStyle: width, minWidth, maxWidth
|
|
997
|
+
* ⚠️ heightStyle: height, minHeight, maxHeight
|
|
998
|
+
* ⚠️ blockSizeStyle: blockSize, minBlockSize, maxBlockSize
|
|
999
|
+
* ⚠️ inlineSizeStyle: inlineSize, minInlineSize, maxInlineSize
|
|
1000
|
+
*/
|
|
1001
|
+
/** @public */
|
|
1002
|
+
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"];
|
|
1003
|
+
/**
|
|
1004
|
+
* Display chunk - display mode, layout flow, text overflow, and scrollbar
|
|
1005
|
+
*
|
|
1006
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
1007
|
+
* ⚠️ displayStyle: display, hide, textOverflow, overflow, whiteSpace
|
|
1008
|
+
* ⚠️ flowStyle: display, flow
|
|
1009
|
+
* ⚠️ gapStyle: display, flow, gap
|
|
1010
|
+
* ⚠️ scrollbarStyle: scrollbar, overflow
|
|
1011
|
+
*/
|
|
1012
|
+
/** @public */
|
|
1013
|
+
declare const DISPLAY_CHUNK_STYLES: readonly ["display", "hide", "textOverflow", "overflow", "whiteSpace", "flow", "gap", "scrollbar"];
|
|
1014
|
+
/**
|
|
1015
|
+
* Layout chunk - flex/grid alignment and grid templates
|
|
1016
|
+
*
|
|
1017
|
+
* Note: flow and gap are in DISPLAY chunk due to handler dependencies
|
|
1018
|
+
* (flowStyle and gapStyle both require 'display' prop).
|
|
1019
|
+
*/
|
|
1020
|
+
/** @public */
|
|
1021
|
+
declare const LAYOUT_CHUNK_STYLES: readonly ["placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "place", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas", "gridAutoFlow", "gridAutoColumns", "gridAutoRows"];
|
|
1022
|
+
/**
|
|
1023
|
+
* Position chunk - element positioning
|
|
1024
|
+
*
|
|
1025
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
1026
|
+
* ⚠️ insetStyle: inset, top, right, bottom, left
|
|
1027
|
+
*/
|
|
1028
|
+
/** @public */
|
|
1029
|
+
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"];
|
|
1030
|
+
/**
|
|
1031
|
+
* Map for O(1) style-to-chunk lookup. Seeded with the built-in lists above and
|
|
1032
|
+
* extended by {@link assignStyleChunk} when a custom handler declares style names
|
|
1033
|
+
* the built-in lists don't know.
|
|
1034
|
+
*/
|
|
1035
|
+
declare const STYLE_TO_CHUNK: Map<string, ChunkName>;
|
|
1036
|
+
interface ChunkInfo {
|
|
1037
|
+
/** Name of the chunk */
|
|
1038
|
+
name: ChunkName | string;
|
|
1039
|
+
/** Style keys belonging to this chunk */
|
|
1040
|
+
styleKeys: string[];
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Categorize style keys into chunks.
|
|
1044
|
+
*
|
|
1045
|
+
* Returns chunks in a deterministic order (by CHUNK_ORDER) regardless
|
|
1046
|
+
* of the order of keys in the input styles object.
|
|
1047
|
+
*
|
|
1048
|
+
* @param styles - The styles object to categorize
|
|
1049
|
+
* @returns Map of chunk name to array of style keys in that chunk (in priority order)
|
|
1050
|
+
*/
|
|
1051
|
+
declare function categorizeStyleKeys(styles: Record<string, unknown>): Map<string, string[]>;
|
|
756
1052
|
/**
|
|
757
1053
|
* Border style handler with multi-group support.
|
|
758
1054
|
*
|
|
@@ -766,28 +1062,26 @@ declare module './utils/css-types' {
|
|
|
766
1062
|
*
|
|
767
1063
|
* Later groups override earlier groups for conflicting directions.
|
|
768
1064
|
*/
|
|
769
|
-
declare function borderStyle({
|
|
770
|
-
border
|
|
771
|
-
}: {
|
|
1065
|
+
declare function borderStyle({ border }: {
|
|
772
1066
|
border?: string | number | boolean;
|
|
773
1067
|
}): Record<string, string> | null;
|
|
774
1068
|
declare namespace borderStyle {
|
|
775
1069
|
var __lookupStyles: string[];
|
|
776
1070
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
}:
|
|
1071
|
+
declare function blockSizeStyle({ blockSize, minBlockSize, maxBlockSize }: {
|
|
1072
|
+
blockSize?: string | number | boolean;
|
|
1073
|
+
minBlockSize?: string | number | boolean;
|
|
1074
|
+
maxBlockSize?: string | number | boolean;
|
|
1075
|
+
}): Record<string, string | string[]> | null;
|
|
1076
|
+
declare namespace blockSizeStyle {
|
|
1077
|
+
var __lookupStyles: ("blockSize" | "maxBlockSize" | "minBlockSize")[];
|
|
1078
|
+
}
|
|
1079
|
+
declare function colorStyle({ color }: {
|
|
782
1080
|
color?: string | boolean;
|
|
783
|
-
}):
|
|
784
|
-
color: string;
|
|
785
|
-
} | null;
|
|
1081
|
+
}): Record<string, string> | null;
|
|
786
1082
|
declare namespace colorStyle {
|
|
787
1083
|
var __lookupStyles: string[];
|
|
788
1084
|
}
|
|
789
|
-
//#endregion
|
|
790
|
-
//#region src/styles/display.d.ts
|
|
791
1085
|
interface DisplayStyleProps {
|
|
792
1086
|
display?: string;
|
|
793
1087
|
hide?: boolean;
|
|
@@ -804,21 +1098,11 @@ interface DisplayStyleProps {
|
|
|
804
1098
|
* 3. Single-line `textOverflow` defaults white-space to nowrap
|
|
805
1099
|
* 4. Explicit `whiteSpace` overrides the default from `textOverflow`
|
|
806
1100
|
*/
|
|
807
|
-
declare function displayStyle({
|
|
808
|
-
display,
|
|
809
|
-
hide,
|
|
810
|
-
textOverflow,
|
|
811
|
-
overflow,
|
|
812
|
-
whiteSpace
|
|
813
|
-
}: DisplayStyleProps): Record<string, string | number> | null;
|
|
1101
|
+
declare function displayStyle({ display, hide, textOverflow, overflow, whiteSpace }: DisplayStyleProps): Record<string, string | number> | null;
|
|
814
1102
|
declare namespace displayStyle {
|
|
815
1103
|
var __lookupStyles: string[];
|
|
816
1104
|
}
|
|
817
|
-
|
|
818
|
-
//#region src/styles/fade.d.ts
|
|
819
|
-
declare function fadeStyle({
|
|
820
|
-
fade
|
|
821
|
-
}: {
|
|
1105
|
+
declare function fadeStyle({ fade }: {
|
|
822
1106
|
fade?: string;
|
|
823
1107
|
}): {
|
|
824
1108
|
mask: string;
|
|
@@ -827,22 +1111,8 @@ declare function fadeStyle({
|
|
|
827
1111
|
declare namespace fadeStyle {
|
|
828
1112
|
var __lookupStyles: string[];
|
|
829
1113
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
declare function fillStyle({
|
|
833
|
-
fill,
|
|
834
|
-
backgroundColor,
|
|
835
|
-
image,
|
|
836
|
-
backgroundImage,
|
|
837
|
-
backgroundPosition,
|
|
838
|
-
backgroundSize,
|
|
839
|
-
backgroundRepeat,
|
|
840
|
-
backgroundAttachment,
|
|
841
|
-
backgroundOrigin,
|
|
842
|
-
backgroundClip,
|
|
843
|
-
background
|
|
844
|
-
}: {
|
|
845
|
-
fill?: string;
|
|
1114
|
+
declare function fillStyle({ fill, backgroundColor, image, backgroundImage, backgroundPosition, backgroundSize, backgroundRepeat, backgroundAttachment, backgroundOrigin, backgroundClip, background }: {
|
|
1115
|
+
fill?: string | boolean;
|
|
846
1116
|
backgroundColor?: string;
|
|
847
1117
|
image?: string;
|
|
848
1118
|
backgroundImage?: string;
|
|
@@ -857,9 +1127,7 @@ declare function fillStyle({
|
|
|
857
1127
|
declare namespace fillStyle {
|
|
858
1128
|
var __lookupStyles: string[];
|
|
859
1129
|
}
|
|
860
|
-
declare function svgFillStyle({
|
|
861
|
-
svgFill
|
|
862
|
-
}: {
|
|
1130
|
+
declare function svgFillStyle({ svgFill }: {
|
|
863
1131
|
svgFill?: string;
|
|
864
1132
|
}): {
|
|
865
1133
|
fill: string;
|
|
@@ -867,30 +1135,19 @@ declare function svgFillStyle({
|
|
|
867
1135
|
declare namespace svgFillStyle {
|
|
868
1136
|
var __lookupStyles: string[];
|
|
869
1137
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
display,
|
|
874
|
-
flow
|
|
875
|
-
}: {
|
|
876
|
-
display?: string;
|
|
877
|
-
flow?: string;
|
|
1138
|
+
declare function flowStyle({ display, flow }: {
|
|
1139
|
+
display?: string | NoType;
|
|
1140
|
+
flow?: string | NoType;
|
|
878
1141
|
}): {
|
|
879
|
-
[x: string]: string
|
|
1142
|
+
[x: string]: string;
|
|
880
1143
|
} | null;
|
|
881
1144
|
declare namespace flowStyle {
|
|
882
1145
|
var __lookupStyles: string[];
|
|
883
1146
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
flow,
|
|
889
|
-
gap
|
|
890
|
-
}: {
|
|
891
|
-
display?: string;
|
|
892
|
-
flow?: string;
|
|
893
|
-
gap?: string | number | boolean;
|
|
1147
|
+
declare function gapStyle({ display, flow, gap }: {
|
|
1148
|
+
display?: string | NoType;
|
|
1149
|
+
flow?: string | NoType;
|
|
1150
|
+
gap?: string | number | boolean | NoType;
|
|
894
1151
|
}): {
|
|
895
1152
|
gap: string;
|
|
896
1153
|
$?: undefined;
|
|
@@ -910,35 +1167,17 @@ declare function gapStyle({
|
|
|
910
1167
|
declare namespace gapStyle {
|
|
911
1168
|
var __lookupStyles: string[];
|
|
912
1169
|
}
|
|
913
|
-
//#endregion
|
|
914
|
-
//#region src/styles/height.d.ts
|
|
915
1170
|
interface HeightStyleProps {
|
|
916
1171
|
height?: string | number | boolean;
|
|
917
1172
|
minHeight?: string | number | boolean;
|
|
918
1173
|
maxHeight?: string | number | boolean;
|
|
919
1174
|
}
|
|
920
|
-
declare function heightStyle({
|
|
921
|
-
height,
|
|
922
|
-
minHeight,
|
|
923
|
-
maxHeight
|
|
924
|
-
}: HeightStyleProps): Record<string, string | string[]> | null;
|
|
1175
|
+
declare function heightStyle({ height, minHeight, maxHeight }: HeightStyleProps): Record<string, string | string[]> | null;
|
|
925
1176
|
declare namespace heightStyle {
|
|
926
1177
|
var __lookupStyles: string[];
|
|
927
1178
|
}
|
|
928
|
-
|
|
929
|
-
//#region src/styles/inset.d.ts
|
|
930
|
-
declare function insetStyle({
|
|
931
|
-
inset,
|
|
932
|
-
insetBlock,
|
|
933
|
-
insetInline,
|
|
934
|
-
top,
|
|
935
|
-
right,
|
|
936
|
-
bottom,
|
|
937
|
-
left
|
|
938
|
-
}: {
|
|
1179
|
+
declare function insetStyle({ inset, top, right, bottom, left }: {
|
|
939
1180
|
inset?: string | number | boolean;
|
|
940
|
-
insetBlock?: string | number | boolean;
|
|
941
|
-
insetInline?: string | number | boolean;
|
|
942
1181
|
top?: string | number | boolean;
|
|
943
1182
|
right?: string | number | boolean;
|
|
944
1183
|
bottom?: string | number | boolean;
|
|
@@ -947,20 +1186,16 @@ declare function insetStyle({
|
|
|
947
1186
|
declare namespace insetStyle {
|
|
948
1187
|
var __lookupStyles: string[];
|
|
949
1188
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
marginLeft
|
|
960
|
-
}: {
|
|
1189
|
+
declare function inlineSizeStyle({ inlineSize, minInlineSize, maxInlineSize }: {
|
|
1190
|
+
inlineSize?: string | number | boolean;
|
|
1191
|
+
minInlineSize?: string | number | boolean;
|
|
1192
|
+
maxInlineSize?: string | number | boolean;
|
|
1193
|
+
}): Record<string, string | string[]> | null;
|
|
1194
|
+
declare namespace inlineSizeStyle {
|
|
1195
|
+
var __lookupStyles: ("inlineSize" | "maxInlineSize" | "minInlineSize")[];
|
|
1196
|
+
}
|
|
1197
|
+
declare function marginStyle({ margin, marginTop, marginRight, marginBottom, marginLeft }: {
|
|
961
1198
|
margin?: string | number | boolean;
|
|
962
|
-
marginBlock?: string | number | boolean;
|
|
963
|
-
marginInline?: string | number | boolean;
|
|
964
1199
|
marginTop?: string | number | boolean;
|
|
965
1200
|
marginRight?: string | number | boolean;
|
|
966
1201
|
marginBottom?: string | number | boolean;
|
|
@@ -969,11 +1204,9 @@ declare function marginStyle({
|
|
|
969
1204
|
declare namespace marginStyle {
|
|
970
1205
|
var __lookupStyles: string[];
|
|
971
1206
|
}
|
|
972
|
-
//#endregion
|
|
973
|
-
//#region src/styles/outline.d.ts
|
|
974
1207
|
interface OutlineStyleProps {
|
|
975
1208
|
outline?: string | boolean | number;
|
|
976
|
-
outlineOffset?: string | number;
|
|
1209
|
+
outlineOffset?: string | number | boolean;
|
|
977
1210
|
}
|
|
978
1211
|
/**
|
|
979
1212
|
* Generates CSS for outline property with optional offset.
|
|
@@ -989,27 +1222,12 @@ interface OutlineStyleProps {
|
|
|
989
1222
|
*
|
|
990
1223
|
* @return CSS properties for outline and optionally outline-offset
|
|
991
1224
|
*/
|
|
992
|
-
declare function outlineStyle({
|
|
993
|
-
outline,
|
|
994
|
-
outlineOffset
|
|
995
|
-
}: OutlineStyleProps): Record<string, string> | null;
|
|
1225
|
+
declare function outlineStyle({ outline, outlineOffset }: OutlineStyleProps): Record<string, string> | null;
|
|
996
1226
|
declare namespace outlineStyle {
|
|
997
1227
|
var __lookupStyles: string[];
|
|
998
1228
|
}
|
|
999
|
-
|
|
1000
|
-
//#region src/styles/padding.d.ts
|
|
1001
|
-
declare function paddingStyle({
|
|
1002
|
-
padding,
|
|
1003
|
-
paddingBlock,
|
|
1004
|
-
paddingInline,
|
|
1005
|
-
paddingTop,
|
|
1006
|
-
paddingRight,
|
|
1007
|
-
paddingBottom,
|
|
1008
|
-
paddingLeft
|
|
1009
|
-
}: {
|
|
1229
|
+
declare function paddingStyle({ padding, paddingTop, paddingRight, paddingBottom, paddingLeft }: {
|
|
1010
1230
|
padding?: string | number | boolean;
|
|
1011
|
-
paddingBlock?: string | number | boolean;
|
|
1012
|
-
paddingInline?: string | number | boolean;
|
|
1013
1231
|
paddingTop?: string | number | boolean;
|
|
1014
1232
|
paddingRight?: string | number | boolean;
|
|
1015
1233
|
paddingBottom?: string | number | boolean;
|
|
@@ -1018,8 +1236,6 @@ declare function paddingStyle({
|
|
|
1018
1236
|
declare namespace paddingStyle {
|
|
1019
1237
|
var __lookupStyles: string[];
|
|
1020
1238
|
}
|
|
1021
|
-
//#endregion
|
|
1022
|
-
//#region src/styles/placement.d.ts
|
|
1023
1239
|
interface PlacementStyleProps {
|
|
1024
1240
|
place?: string | boolean;
|
|
1025
1241
|
placeItems?: string | boolean;
|
|
@@ -1039,22 +1255,10 @@ interface PlacementStyleProps {
|
|
|
1039
1255
|
* 2. placeItems, placeContent, align, justify (medium) — each sets 2 longhands
|
|
1040
1256
|
* 3. alignItems, alignContent, justifyItems, justifyContent (highest) — each sets 1 longhand
|
|
1041
1257
|
*/
|
|
1042
|
-
declare function placementStyle({
|
|
1043
|
-
place,
|
|
1044
|
-
placeItems,
|
|
1045
|
-
placeContent,
|
|
1046
|
-
align,
|
|
1047
|
-
justify,
|
|
1048
|
-
alignItems,
|
|
1049
|
-
alignContent,
|
|
1050
|
-
justifyItems,
|
|
1051
|
-
justifyContent
|
|
1052
|
-
}: PlacementStyleProps): Record<string, string> | null;
|
|
1258
|
+
declare function placementStyle({ place, placeItems, placeContent, align, justify, alignItems, alignContent, justifyItems, justifyContent }: PlacementStyleProps): Record<string, string> | null;
|
|
1053
1259
|
declare namespace placementStyle {
|
|
1054
1260
|
var __lookupStyles: string[];
|
|
1055
1261
|
}
|
|
1056
|
-
//#endregion
|
|
1057
|
-
//#region src/styles/preset.d.ts
|
|
1058
1262
|
interface PresetStyleProps {
|
|
1059
1263
|
preset?: string | boolean;
|
|
1060
1264
|
fontSize?: string | number;
|
|
@@ -1090,44 +1294,18 @@ interface PresetStyleProps {
|
|
|
1090
1294
|
* - `font` is the recommended prop with special handling (monospace, boolean, fallback)
|
|
1091
1295
|
* - `fontFamily` is a direct value without special handling
|
|
1092
1296
|
*/
|
|
1093
|
-
declare function presetStyle({
|
|
1094
|
-
preset,
|
|
1095
|
-
fontSize,
|
|
1096
|
-
lineHeight,
|
|
1097
|
-
textTransform,
|
|
1098
|
-
letterSpacing,
|
|
1099
|
-
fontWeight,
|
|
1100
|
-
fontStyle,
|
|
1101
|
-
fontFamily,
|
|
1102
|
-
font
|
|
1103
|
-
}: PresetStyleProps): Styles | null;
|
|
1297
|
+
declare function presetStyle({ preset, fontSize, lineHeight, textTransform, letterSpacing, fontWeight, fontStyle, fontFamily, font }: PresetStyleProps): CSSMap | null;
|
|
1104
1298
|
declare namespace presetStyle {
|
|
1105
1299
|
var __lookupStyles: string[];
|
|
1106
1300
|
}
|
|
1107
|
-
|
|
1108
|
-
//#region src/styles/radius.d.ts
|
|
1109
|
-
declare function radiusStyle({
|
|
1110
|
-
radius
|
|
1111
|
-
}: {
|
|
1301
|
+
declare function radiusStyle({ radius }: {
|
|
1112
1302
|
radius?: string | number | boolean;
|
|
1113
1303
|
}): Record<string, string> | null;
|
|
1114
1304
|
declare namespace radiusStyle {
|
|
1115
1305
|
var __lookupStyles: string[];
|
|
1116
1306
|
}
|
|
1117
|
-
|
|
1118
|
-
//#region src/styles/scrollMargin.d.ts
|
|
1119
|
-
declare function scrollMarginStyle({
|
|
1120
|
-
scrollMargin,
|
|
1121
|
-
scrollMarginBlock,
|
|
1122
|
-
scrollMarginInline,
|
|
1123
|
-
scrollMarginTop,
|
|
1124
|
-
scrollMarginRight,
|
|
1125
|
-
scrollMarginBottom,
|
|
1126
|
-
scrollMarginLeft
|
|
1127
|
-
}: {
|
|
1307
|
+
declare function scrollMarginStyle({ scrollMargin, scrollMarginTop, scrollMarginRight, scrollMarginBottom, scrollMarginLeft }: {
|
|
1128
1308
|
scrollMargin?: string | number | boolean;
|
|
1129
|
-
scrollMarginBlock?: string | number | boolean;
|
|
1130
|
-
scrollMarginInline?: string | number | boolean;
|
|
1131
1309
|
scrollMarginTop?: string | number | boolean;
|
|
1132
1310
|
scrollMarginRight?: string | number | boolean;
|
|
1133
1311
|
scrollMarginBottom?: string | number | boolean;
|
|
@@ -1136,8 +1314,16 @@ declare function scrollMarginStyle({
|
|
|
1136
1314
|
declare namespace scrollMarginStyle {
|
|
1137
1315
|
var __lookupStyles: string[];
|
|
1138
1316
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1317
|
+
declare function scrollPaddingStyle({ scrollPadding, scrollPaddingTop, scrollPaddingRight, scrollPaddingBottom, scrollPaddingLeft }: {
|
|
1318
|
+
scrollPadding?: string | number | boolean;
|
|
1319
|
+
scrollPaddingTop?: string | number | boolean;
|
|
1320
|
+
scrollPaddingRight?: string | number | boolean;
|
|
1321
|
+
scrollPaddingBottom?: string | number | boolean;
|
|
1322
|
+
scrollPaddingLeft?: string | number | boolean;
|
|
1323
|
+
}): Record<string, string> | null;
|
|
1324
|
+
declare namespace scrollPaddingStyle {
|
|
1325
|
+
var __lookupStyles: string[];
|
|
1326
|
+
}
|
|
1141
1327
|
interface ScrollbarStyleProps {
|
|
1142
1328
|
scrollbar?: string | boolean;
|
|
1143
1329
|
overflow?: string;
|
|
@@ -1152,18 +1338,11 @@ interface ScrollbarStyleProps {
|
|
|
1152
1338
|
* Note: `auto` is classified as a VALUE_KEYWORD by the parser, so it lands
|
|
1153
1339
|
* in `values` rather than `mods`. Both locations are checked for robustness.
|
|
1154
1340
|
*/
|
|
1155
|
-
declare function scrollbarStyle({
|
|
1156
|
-
scrollbar,
|
|
1157
|
-
overflow
|
|
1158
|
-
}: ScrollbarStyleProps): Record<string, string> | null;
|
|
1341
|
+
declare function scrollbarStyle({ scrollbar, overflow }: ScrollbarStyleProps): Record<string, string> | null;
|
|
1159
1342
|
declare namespace scrollbarStyle {
|
|
1160
1343
|
var __lookupStyles: string[];
|
|
1161
1344
|
}
|
|
1162
|
-
|
|
1163
|
-
//#region src/styles/shadow.d.ts
|
|
1164
|
-
declare function shadowStyle({
|
|
1165
|
-
shadow
|
|
1166
|
-
}: {
|
|
1345
|
+
declare function shadowStyle({ shadow }: {
|
|
1167
1346
|
shadow?: string | boolean;
|
|
1168
1347
|
}): {
|
|
1169
1348
|
'box-shadow': string;
|
|
@@ -1171,11 +1350,7 @@ declare function shadowStyle({
|
|
|
1171
1350
|
declare namespace shadowStyle {
|
|
1172
1351
|
var __lookupStyles: string[];
|
|
1173
1352
|
}
|
|
1174
|
-
|
|
1175
|
-
//#region src/styles/transition.d.ts
|
|
1176
|
-
declare function transitionStyle({
|
|
1177
|
-
transition
|
|
1178
|
-
}: {
|
|
1353
|
+
declare function transitionStyle({ transition }: {
|
|
1179
1354
|
transition?: string;
|
|
1180
1355
|
}): {
|
|
1181
1356
|
transition: string;
|
|
@@ -1183,23 +1358,15 @@ declare function transitionStyle({
|
|
|
1183
1358
|
declare namespace transitionStyle {
|
|
1184
1359
|
var __lookupStyles: string[];
|
|
1185
1360
|
}
|
|
1186
|
-
//#endregion
|
|
1187
|
-
//#region src/styles/width.d.ts
|
|
1188
1361
|
interface WidthStyleProps {
|
|
1189
1362
|
width?: string | number | boolean;
|
|
1190
1363
|
minWidth?: string | number | boolean;
|
|
1191
1364
|
maxWidth?: string | number | boolean;
|
|
1192
1365
|
}
|
|
1193
|
-
declare function widthStyle({
|
|
1194
|
-
width,
|
|
1195
|
-
minWidth,
|
|
1196
|
-
maxWidth
|
|
1197
|
-
}: WidthStyleProps): Record<string, string | string[]> | null;
|
|
1366
|
+
declare function widthStyle({ width, minWidth, maxWidth }: WidthStyleProps): Record<string, string | string[]> | null;
|
|
1198
1367
|
declare namespace widthStyle {
|
|
1199
1368
|
var __lookupStyles: string[];
|
|
1200
1369
|
}
|
|
1201
|
-
//#endregion
|
|
1202
|
-
//#region src/styles/predefined.d.ts
|
|
1203
1370
|
/**
|
|
1204
1371
|
* Exported object containing wrapped predefined style handlers.
|
|
1205
1372
|
* Users can import and call these to extend or delegate to built-in behavior.
|
|
@@ -1224,16 +1391,6 @@ declare namespace widthStyle {
|
|
|
1224
1391
|
* ```
|
|
1225
1392
|
*/
|
|
1226
1393
|
declare const styleHandlers: {
|
|
1227
|
-
readonly border: typeof borderStyle;
|
|
1228
|
-
readonly color: typeof colorStyle;
|
|
1229
|
-
readonly display: typeof displayStyle;
|
|
1230
|
-
readonly fade: typeof fadeStyle;
|
|
1231
|
-
readonly fill: typeof fillStyle;
|
|
1232
|
-
readonly svgFill: typeof svgFillStyle;
|
|
1233
|
-
readonly flow: typeof flowStyle;
|
|
1234
|
-
readonly gap: typeof gapStyle;
|
|
1235
|
-
readonly height: typeof heightStyle;
|
|
1236
|
-
readonly inset: typeof insetStyle;
|
|
1237
1394
|
readonly margin: typeof marginStyle;
|
|
1238
1395
|
readonly outline: typeof outlineStyle;
|
|
1239
1396
|
readonly padding: typeof paddingStyle;
|
|
@@ -1241,13 +1398,64 @@ declare const styleHandlers: {
|
|
|
1241
1398
|
readonly preset: typeof presetStyle;
|
|
1242
1399
|
readonly radius: typeof radiusStyle;
|
|
1243
1400
|
readonly scrollMargin: typeof scrollMarginStyle;
|
|
1401
|
+
readonly scrollPadding: typeof scrollPaddingStyle;
|
|
1244
1402
|
readonly scrollbar: typeof scrollbarStyle;
|
|
1245
1403
|
readonly shadow: typeof shadowStyle;
|
|
1246
1404
|
readonly transition: typeof transitionStyle;
|
|
1247
1405
|
readonly width: typeof widthStyle;
|
|
1406
|
+
readonly blockBorder: StyleHandler<Partial<Record<"blockBorder", string | number | boolean | undefined>>>;
|
|
1407
|
+
readonly inlineBorder: StyleHandler<Partial<Record<"inlineBorder", string | number | boolean | undefined>>>;
|
|
1408
|
+
readonly blockScrollPadding: StyleHandler<Partial<Record<"blockScrollPadding", string | number | boolean | undefined>>>;
|
|
1409
|
+
readonly inlineScrollPadding: StyleHandler<Partial<Record<"inlineScrollPadding", string | number | boolean | undefined>>>;
|
|
1410
|
+
readonly blockScrollMargin: StyleHandler<Partial<Record<"blockScrollMargin", string | number | boolean | undefined>>>;
|
|
1411
|
+
readonly inlineScrollMargin: StyleHandler<Partial<Record<"inlineScrollMargin", string | number | boolean | undefined>>>;
|
|
1412
|
+
readonly blockInset: StyleHandler<Partial<Record<"blockInset", string | number | boolean | undefined>>>;
|
|
1413
|
+
readonly inlineInset: StyleHandler<Partial<Record<"inlineInset", string | number | boolean | undefined>>>;
|
|
1414
|
+
readonly blockMargin: StyleHandler<Partial<Record<"blockMargin", string | number | boolean | undefined>>>;
|
|
1415
|
+
readonly inlineMargin: StyleHandler<Partial<Record<"inlineMargin", string | number | boolean | undefined>>>;
|
|
1416
|
+
readonly blockPadding: StyleHandler<Partial<Record<"blockPadding", string | number | boolean | undefined>>>;
|
|
1417
|
+
readonly inlinePadding: StyleHandler<Partial<Record<"inlinePadding", string | number | boolean | undefined>>>;
|
|
1418
|
+
readonly blockSize: typeof blockSizeStyle;
|
|
1419
|
+
readonly border: typeof borderStyle;
|
|
1420
|
+
readonly color: typeof colorStyle;
|
|
1421
|
+
readonly display: typeof displayStyle;
|
|
1422
|
+
readonly fade: typeof fadeStyle;
|
|
1423
|
+
readonly fill: typeof fillStyle;
|
|
1424
|
+
readonly svgFill: typeof svgFillStyle;
|
|
1425
|
+
readonly flow: typeof flowStyle;
|
|
1426
|
+
readonly gap: typeof gapStyle;
|
|
1427
|
+
readonly height: typeof heightStyle;
|
|
1428
|
+
readonly inset: typeof insetStyle;
|
|
1429
|
+
readonly inlineSize: typeof inlineSizeStyle;
|
|
1248
1430
|
};
|
|
1249
|
-
|
|
1250
|
-
|
|
1431
|
+
/**
|
|
1432
|
+
* Declare a multi-dependency style handler with its dependency names inferred
|
|
1433
|
+
* into the handler's parameter type.
|
|
1434
|
+
*
|
|
1435
|
+
* Without it, the multi-dependency tuple form needs a hand-written parameter
|
|
1436
|
+
* annotation that can silently drift from the dependency list:
|
|
1437
|
+
*
|
|
1438
|
+
* ```ts
|
|
1439
|
+
* // Annotation and dependency list are maintained separately.
|
|
1440
|
+
* handlers: {
|
|
1441
|
+
* spacing: [['gap', 'padding'], ({ gap, padding }: { gap?: string; padding?: string }) => …],
|
|
1442
|
+
* }
|
|
1443
|
+
*
|
|
1444
|
+
* // Both come from the same array; a typo in the destructure is a type error.
|
|
1445
|
+
* handlers: {
|
|
1446
|
+
* spacing: defineHandler(['gap', 'padding'], ({ gap, padding }) => …),
|
|
1447
|
+
* }
|
|
1448
|
+
* ```
|
|
1449
|
+
*
|
|
1450
|
+
* Values arrive **state-resolved but unparsed** — the raw authored DSL string
|
|
1451
|
+
* (`'2x'`, `'#purple.5'`), so call `parseStyle()` / `parseColor()` as needed. The
|
|
1452
|
+
* result is a kebab-case CSS declaration map (or an array of them); the reserved
|
|
1453
|
+
* `$` key applies the declarations to a nested selector.
|
|
1454
|
+
*
|
|
1455
|
+
* All names must belong to the same chunk. Names the built-in chunk lists don't
|
|
1456
|
+
* know are pulled into their handler's chunk automatically at registration.
|
|
1457
|
+
*/
|
|
1458
|
+
declare function defineHandler<const TDeps extends readonly string[]>(deps: TDeps, handler: (props: Partial<Record<TDeps[number], ResolvedStyleValue>>) => StyleHandlerResult): [readonly string[], RawStyleHandler];
|
|
1251
1459
|
interface ComputeStylesResult {
|
|
1252
1460
|
className: string;
|
|
1253
1461
|
/** CSS text to emit as an inline <style> tag (RSC mode only). */
|
|
@@ -1257,6 +1465,13 @@ interface ComputeStylesOptions {
|
|
|
1257
1465
|
ssrCollector?: ServerStyleCollector | null;
|
|
1258
1466
|
/** Target root for style injection (client only). Defaults to `document`. */
|
|
1259
1467
|
root?: Document | ShadowRoot;
|
|
1468
|
+
/**
|
|
1469
|
+
* Set when `styles` outlives this call and will be passed in again — a
|
|
1470
|
+
* `tasty()` factory's own styles object rather than a per-render merge.
|
|
1471
|
+
* It lets chunk cache keys be memoized on the object, which is worth the
|
|
1472
|
+
* bookkeeping only when there is a next render to spend it on.
|
|
1473
|
+
*/
|
|
1474
|
+
stableStyles?: boolean;
|
|
1260
1475
|
}
|
|
1261
1476
|
/**
|
|
1262
1477
|
* Synchronous, hook-free style computation.
|
|
@@ -1274,8 +1489,6 @@ interface ComputeStylesOptions {
|
|
|
1274
1489
|
* @param options - Optional SSR collector override
|
|
1275
1490
|
*/
|
|
1276
1491
|
declare function computeStyles(styles: Styles | undefined, options?: ComputeStylesOptions): ComputeStylesResult;
|
|
1277
|
-
//#endregion
|
|
1278
|
-
//#region src/injector/chunk-sheet-registry.d.ts
|
|
1279
1492
|
/**
|
|
1280
1493
|
* Global registry mapping CSS content hashes to shared constructable
|
|
1281
1494
|
* CSSStyleSheet objects with reference counting.
|
|
@@ -1309,15 +1522,10 @@ declare class ChunkSheetRegistry {
|
|
|
1309
1522
|
}
|
|
1310
1523
|
/** Module-level singleton shared across the entire application. */
|
|
1311
1524
|
declare const chunkSheetRegistry: ChunkSheetRegistry;
|
|
1312
|
-
//#endregion
|
|
1313
|
-
//#region src/injector/index.d.ts
|
|
1314
1525
|
/**
|
|
1315
1526
|
* Inject styles and return className with dispose function
|
|
1316
1527
|
*/
|
|
1317
|
-
declare function inject(rules: StyleResult[], options?:
|
|
1318
|
-
root?: Document | ShadowRoot;
|
|
1319
|
-
cacheKey?: string;
|
|
1320
|
-
}): InjectResult;
|
|
1528
|
+
declare function inject(rules: StyleResult[], options?: InjectOptions): InjectResult;
|
|
1321
1529
|
/**
|
|
1322
1530
|
* Inject global rules that should not reserve tasty class names
|
|
1323
1531
|
*/
|
|
@@ -1359,26 +1567,6 @@ declare function keyframes(steps: KeyframesSteps, nameOrOptions?: string | {
|
|
|
1359
1567
|
root?: Document | ShadowRoot;
|
|
1360
1568
|
name?: string;
|
|
1361
1569
|
}): KeyframesResult;
|
|
1362
|
-
interface PropertyOptions {
|
|
1363
|
-
/**
|
|
1364
|
-
* CSS syntax string for the property (e.g., '<color>', '<length>', '<angle>')
|
|
1365
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/@property/syntax
|
|
1366
|
-
*/
|
|
1367
|
-
syntax?: string;
|
|
1368
|
-
/**
|
|
1369
|
-
* Whether the property inherits from parent elements
|
|
1370
|
-
* @default true
|
|
1371
|
-
*/
|
|
1372
|
-
inherits?: boolean;
|
|
1373
|
-
/**
|
|
1374
|
-
* Initial value for the property
|
|
1375
|
-
*/
|
|
1376
|
-
initialValue?: string | number;
|
|
1377
|
-
/**
|
|
1378
|
-
* Shadow root or document to inject into
|
|
1379
|
-
*/
|
|
1380
|
-
root?: Document | ShadowRoot;
|
|
1381
|
-
}
|
|
1382
1570
|
/**
|
|
1383
1571
|
* Define a CSS @property custom property.
|
|
1384
1572
|
* This enables advanced features like animating custom properties.
|
|
@@ -1405,7 +1593,7 @@ interface PropertyOptions {
|
|
|
1405
1593
|
* });
|
|
1406
1594
|
* ```
|
|
1407
1595
|
*/
|
|
1408
|
-
declare function property
|
|
1596
|
+
declare function property(name: string, options?: PropertyOptions): void;
|
|
1409
1597
|
/**
|
|
1410
1598
|
* Check if a CSS @property has already been defined
|
|
1411
1599
|
*
|
|
@@ -1427,49 +1615,87 @@ declare function fontFace(family: string, descriptors: FontFaceDescriptors, opti
|
|
|
1427
1615
|
/**
|
|
1428
1616
|
* Inject a CSS @counter-style rule.
|
|
1429
1617
|
*
|
|
1430
|
-
* Permanent and global — no dispose or ref-counting.
|
|
1431
|
-
*
|
|
1618
|
+
* Permanent and global — no dispose or ref-counting. Deduplicates by name and
|
|
1619
|
+
* overrides an existing rule by default. Pass `weak: true` for global
|
|
1620
|
+
* `configure()` definitions, which never clobber an existing rule.
|
|
1432
1621
|
*/
|
|
1433
1622
|
declare function counterStyle(name: string, descriptors: CounterStyleDescriptors, options?: {
|
|
1434
1623
|
root?: Document | ShadowRoot;
|
|
1624
|
+
weak?: boolean;
|
|
1435
1625
|
}): void;
|
|
1436
1626
|
/**
|
|
1437
|
-
*
|
|
1627
|
+
* Inject a CSS @function rule (custom function).
|
|
1628
|
+
*
|
|
1629
|
+
* Permanent and global — no dispose or ref-counting. Deduplicates by function
|
|
1630
|
+
* name and overrides an existing rule by default. Pass `weak: true` for global
|
|
1631
|
+
* `configure()` definitions, which never clobber an existing rule.
|
|
1632
|
+
*
|
|
1633
|
+
* @param name - The function name (`$$name`, `$name`, or `--name`)
|
|
1634
|
+
* @param definition - Function definition (args, returns, result, local vars)
|
|
1635
|
+
*
|
|
1636
|
+
* @example
|
|
1637
|
+
* ```ts
|
|
1638
|
+
* func('$$negative', { args: ['$value'], result: '(-1 * $value)' });
|
|
1639
|
+
* ```
|
|
1438
1640
|
*/
|
|
1439
|
-
declare function
|
|
1641
|
+
declare function func(name: string, definition: FunctionDefinition, options?: {
|
|
1642
|
+
root?: Document | ShadowRoot;
|
|
1643
|
+
weak?: boolean;
|
|
1644
|
+
}): void;
|
|
1645
|
+
/**
|
|
1646
|
+
* Get the CSS text of every sheet the injector holds. Reads the live
|
|
1647
|
+
* stylesheets, so it needs a DOM: on the server, collect CSS with
|
|
1648
|
+
* `ServerStyleCollector` from `@tenphi/tasty/ssr` instead.
|
|
1649
|
+
*/
|
|
1650
|
+
declare function getCSSText(options?: {
|
|
1440
1651
|
root?: Document | ShadowRoot;
|
|
1441
1652
|
}): string;
|
|
1442
1653
|
/**
|
|
1443
1654
|
* Collect only CSS used by a rendered subtree (like jest-styled-components).
|
|
1444
1655
|
* Pass the container returned by render(...).
|
|
1445
1656
|
*/
|
|
1446
|
-
declare function
|
|
1657
|
+
declare function getCSSTextForNode(node: ParentNode | Element | DocumentFragment, options?: {
|
|
1447
1658
|
root?: Document | ShadowRoot;
|
|
1448
1659
|
}): string;
|
|
1449
1660
|
/**
|
|
1450
|
-
*
|
|
1661
|
+
* Take a reference on local `@keyframes` under the deterministic names the
|
|
1662
|
+
* caller resolved, and report which entry holds each. Pair with
|
|
1663
|
+
* `ownKeyframes()` once the rules exist to inspect.
|
|
1664
|
+
*/
|
|
1665
|
+
declare function holdKeyframes(steps: Record<string, KeyframesSteps>, names: Map<string, string>, options?: {
|
|
1666
|
+
root?: Document | ShadowRoot;
|
|
1667
|
+
}): Map<string, string>;
|
|
1668
|
+
/**
|
|
1669
|
+
* Record that a class animates these keyframes, so the reference is released
|
|
1670
|
+
* when the last such class is collected.
|
|
1671
|
+
*/
|
|
1672
|
+
declare function ownKeyframes(key: string, className: string, options?: {
|
|
1673
|
+
root?: Document | ShadowRoot;
|
|
1674
|
+
}): void;
|
|
1675
|
+
/**
|
|
1676
|
+
* Remove every injected rule that is neither in the DOM nor held by an
|
|
1677
|
+
* outstanding `inject()` handle. Equivalent to `gc({ force: true })`.
|
|
1451
1678
|
*/
|
|
1452
1679
|
declare function cleanup(root?: Document | ShadowRoot): void;
|
|
1453
1680
|
/**
|
|
1454
|
-
*
|
|
1455
|
-
* Used internally by computeStyles and tasty()
|
|
1456
|
-
*
|
|
1681
|
+
* Count a render, so that a collection pass is scheduled every
|
|
1682
|
+
* `gc.touchInterval` of them. Used internally by computeStyles and tasty().
|
|
1683
|
+
*
|
|
1684
|
+
* @deprecated The class name is ignored — collection asks the DOM what is
|
|
1685
|
+
* rendered rather than recording usage per class. The argument is kept so
|
|
1686
|
+
* existing calls still compile.
|
|
1457
1687
|
*/
|
|
1458
1688
|
declare function touch(className: string, options?: {
|
|
1459
1689
|
root?: Document | ShadowRoot;
|
|
1460
1690
|
}): void;
|
|
1461
1691
|
/**
|
|
1462
|
-
* Synchronous garbage collection of unused styles
|
|
1463
|
-
* Evicts the oldest
|
|
1464
|
-
* With `{ force: true }`, removes
|
|
1692
|
+
* Synchronous garbage collection of unused styles — those no element carries
|
|
1693
|
+
* and no `inject()` handle references. Evicts the oldest ones once they exceed
|
|
1694
|
+
* capacity. With `{ force: true }`, removes all of them regardless of capacity.
|
|
1465
1695
|
*
|
|
1466
1696
|
* @returns Number of styles evicted.
|
|
1467
1697
|
*/
|
|
1468
1698
|
declare function gc(options?: GCOptions): number;
|
|
1469
|
-
/**
|
|
1470
|
-
* Check if we're currently running in a test environment
|
|
1471
|
-
*/
|
|
1472
|
-
declare function getIsTestEnvironment(): boolean;
|
|
1473
1699
|
/**
|
|
1474
1700
|
* Get the global injector instance for debugging
|
|
1475
1701
|
*/
|
|
@@ -1484,89 +1710,51 @@ declare function destroy(root?: Document | ShadowRoot): void;
|
|
|
1484
1710
|
* Create a new isolated injector instance
|
|
1485
1711
|
*/
|
|
1486
1712
|
declare function createInjector(config?: Partial<StyleInjectorConfig>): StyleInjector;
|
|
1487
|
-
|
|
1488
|
-
|
|
1713
|
+
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"];
|
|
1714
|
+
declare const ignoredEventPropNames: readonly ["onPress", "onHoverStart", "onHoverEnd", "onPressStart", "onPressEnd"];
|
|
1489
1715
|
interface PropsFilterOptions {
|
|
1490
1716
|
labelable?: boolean;
|
|
1491
|
-
propNames?:
|
|
1717
|
+
propNames?: ReadonlySet<string>;
|
|
1492
1718
|
eventProps?: boolean;
|
|
1493
1719
|
}
|
|
1720
|
+
type ExplicitPropName<O> = O extends {
|
|
1721
|
+
propNames?: ReadonlySet<infer P>;
|
|
1722
|
+
} ? Extract<P, string> : never;
|
|
1723
|
+
type EventPropsEnabled<O> = O extends {
|
|
1724
|
+
eventProps?: infer E;
|
|
1725
|
+
} ? Extract<E, boolean> : never;
|
|
1726
|
+
type Characters<S extends string> = S extends `${infer First}${infer Rest}` ? First | Characters<Rest> : never;
|
|
1727
|
+
/** Models DOM-style event keys and the runtime's ignored event names. */
|
|
1728
|
+
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;
|
|
1729
|
+
type ExplicitNumericPropName<K, O> = K extends number ? `${K}` extends ExplicitPropName<O> ? K : never : never;
|
|
1730
|
+
type RetainedPropName<T, O> = 'id' | (typeof basePropNames)[number] | `aria-${string}` | `data-${string}` | ExplicitPropName<O> | (true extends EventPropsEnabled<O> ? EventPropName<Extract<keyof T, string>> : never);
|
|
1731
|
+
type FilteredProps<T extends object, O> = T extends unknown ? Partial<Pick<T, Extract<keyof T, RetainedPropName<T, O>> | Extract<RetainedPropName<T, O>, keyof T> | ExplicitNumericPropName<keyof T, O>>> : never;
|
|
1494
1732
|
/**
|
|
1495
|
-
*
|
|
1733
|
+
* Keeps the built-in base props, ARIA/data attributes, and explicitly allowed props.
|
|
1734
|
+
* DOM-style event names are kept only with `eventProps: true`, except the ignored
|
|
1735
|
+
* interaction events (which can still be allowed explicitly via `propNames`).
|
|
1736
|
+
* The return type preserves the input value types only for potentially retained
|
|
1737
|
+
* keys. Props remain optional because only own enumerable string keys are copied.
|
|
1738
|
+
* Use a literal union (e.g. `new Set(['name', 'type'] as const)`) for `propNames`
|
|
1739
|
+
* to keep precise types; a `Set<string>` can potentially retain any string key.
|
|
1496
1740
|
* @param props - The component props to be filtered.
|
|
1497
|
-
* @param opts -
|
|
1741
|
+
* @param opts - Additional prop names and event forwarding options.
|
|
1498
1742
|
*/
|
|
1499
|
-
declare function filterBaseProps<T extends object>(props: T, opts?:
|
|
1500
|
-
|
|
1501
|
-
//#region src/utils/colors.d.ts
|
|
1743
|
+
declare function filterBaseProps<T extends object>(props: T, opts?: undefined): FilteredProps<T, undefined>;
|
|
1744
|
+
declare function filterBaseProps<T extends object, O extends PropsFilterOptions | undefined = PropsFilterOptions>(props: T, opts: O): FilteredProps<T, O>;
|
|
1502
1745
|
declare function color$1(name: string, opacity?: number): string;
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
declare const _modAttrs: (firstArg: Record<string, ModValue> | undefined, secondArg?: unknown) => Record<string, string> | null;
|
|
1506
|
-
//#endregion
|
|
1507
|
-
//#region src/utils/dotize.d.ts
|
|
1508
|
-
declare const dotize: {
|
|
1509
|
-
valTypes: {
|
|
1510
|
-
none: string;
|
|
1511
|
-
primitive: string;
|
|
1512
|
-
object: string;
|
|
1513
|
-
array: string;
|
|
1514
|
-
};
|
|
1515
|
-
getValType: (val: any) => string | undefined;
|
|
1516
|
-
getPathType: (arrPath: any) => string[];
|
|
1517
|
-
isUndefined: (obj: any) => obj is undefined;
|
|
1518
|
-
isNumber: (f: any) => boolean;
|
|
1519
|
-
isEmptyObj: (obj: any) => boolean;
|
|
1520
|
-
isPlainObject: (obj: any) => boolean;
|
|
1521
|
-
isNotObject: (obj: any) => boolean;
|
|
1522
|
-
isEmptyArray: (arr: any) => boolean;
|
|
1523
|
-
isNotArray: (arr: any) => boolean;
|
|
1524
|
-
removeEmptyArrayItem: (arr: any) => any;
|
|
1525
|
-
getFieldName: (field: any, prefix: any, isRoot: any, isArrayItem: any, isArray: any) => string;
|
|
1526
|
-
startsWith: (val: any, valToSearch: any) => boolean;
|
|
1527
|
-
convert: (obj: any, prefix?: string) => any;
|
|
1528
|
-
backward: (obj: any, prefix: any) => any;
|
|
1529
|
-
};
|
|
1530
|
-
//#endregion
|
|
1531
|
-
//#region src/utils/resolve-recipes.d.ts
|
|
1532
|
-
/**
|
|
1533
|
-
* Resolve all `recipe` style properties in a styles object.
|
|
1534
|
-
*
|
|
1535
|
-
* Handles both top-level and sub-element recipe references.
|
|
1536
|
-
* Returns the same object reference if no recipes are present anywhere
|
|
1537
|
-
* (zero overhead for the common case).
|
|
1538
|
-
*
|
|
1539
|
-
* @param styles - The styles object potentially containing `recipe` keys
|
|
1540
|
-
* @returns Resolved styles with recipe values merged in, or the original object if unchanged
|
|
1541
|
-
*/
|
|
1746
|
+
declare function modAttrs(map: AllBaseProps['mods']): Record<string, string> | null;
|
|
1747
|
+
/** Resolve recipe references against the globally configured recipe map. */
|
|
1542
1748
|
declare function resolveRecipes(styles: Styles): Styles;
|
|
1543
|
-
//#endregion
|
|
1544
|
-
//#region src/utils/warnings.d.ts
|
|
1545
|
-
declare function warn(...args: unknown[]): void;
|
|
1546
|
-
declare function deprecationWarning(condition: unknown, {
|
|
1547
|
-
property,
|
|
1548
|
-
name,
|
|
1549
|
-
betterAlternative,
|
|
1550
|
-
reason
|
|
1551
|
-
}: {
|
|
1552
|
-
property: string;
|
|
1553
|
-
name: string;
|
|
1554
|
-
betterAlternative: (() => string) | string;
|
|
1555
|
-
reason?: (() => string) | string;
|
|
1556
|
-
}): void;
|
|
1557
|
-
//#endregion
|
|
1558
|
-
//#region src/utils/process-tokens.d.ts
|
|
1559
1749
|
/**
|
|
1560
1750
|
* Process tokens object into inline style properties.
|
|
1561
|
-
* -
|
|
1562
|
-
* -
|
|
1751
|
+
* - `$name` -> `--name` with the parsed value
|
|
1752
|
+
* - `#name` -> `--name-color` with the parsed value
|
|
1563
1753
|
*
|
|
1564
1754
|
* @param tokens - The tokens object to process
|
|
1565
1755
|
* @returns CSSProperties object or undefined if no tokens to process
|
|
1566
1756
|
*/
|
|
1567
1757
|
declare function processTokens(tokens: Tokens | undefined): CSSProperties$1 | undefined;
|
|
1568
|
-
//#endregion
|
|
1569
|
-
//#region src/debug.d.ts
|
|
1570
1758
|
declare global {
|
|
1571
1759
|
interface Window {
|
|
1572
1760
|
tastyDebug?: typeof tastyDebug;
|
|
@@ -1578,19 +1766,19 @@ interface DebugOptions {
|
|
|
1578
1766
|
/** Suppress console logging and return data only (default: false) */
|
|
1579
1767
|
raw?: boolean;
|
|
1580
1768
|
}
|
|
1581
|
-
interface
|
|
1769
|
+
interface CSSOptions extends DebugOptions {
|
|
1582
1770
|
prettify?: boolean;
|
|
1583
1771
|
/** Read from stored source CSS (dev-mode only) instead of live CSSOM */
|
|
1584
1772
|
source?: boolean;
|
|
1585
1773
|
}
|
|
1586
|
-
interface
|
|
1774
|
+
interface DebugChunkInfo {
|
|
1587
1775
|
className: string;
|
|
1588
1776
|
chunkName: string | null;
|
|
1589
1777
|
}
|
|
1590
1778
|
interface InspectResult {
|
|
1591
1779
|
element?: Element | null;
|
|
1592
1780
|
classes: string[];
|
|
1593
|
-
chunks:
|
|
1781
|
+
chunks: DebugChunkInfo[];
|
|
1594
1782
|
css: string;
|
|
1595
1783
|
size: number;
|
|
1596
1784
|
rules: number;
|
|
@@ -1614,7 +1802,13 @@ interface ChunkBreakdown {
|
|
|
1614
1802
|
}
|
|
1615
1803
|
interface Summary {
|
|
1616
1804
|
activeClasses: string[];
|
|
1805
|
+
/** Classes `gc({ force: true })` would delete right now. */
|
|
1617
1806
|
unusedClasses: string[];
|
|
1807
|
+
/**
|
|
1808
|
+
* Held but in neither list: nothing renders them, yet collection will not
|
|
1809
|
+
* take them — inside the grace window, or pinned by an `inject()` handle.
|
|
1810
|
+
*/
|
|
1811
|
+
hotClasses: string[];
|
|
1618
1812
|
totalStyledClasses: string[];
|
|
1619
1813
|
activeCSSSize: number;
|
|
1620
1814
|
unusedCSSSize: number;
|
|
@@ -1639,7 +1833,7 @@ interface Summary {
|
|
|
1639
1833
|
chunkBreakdown: ChunkBreakdown;
|
|
1640
1834
|
}
|
|
1641
1835
|
declare const tastyDebug: {
|
|
1642
|
-
css(target: CSSTarget, opts?:
|
|
1836
|
+
css(target: CSSTarget, opts?: CSSOptions): string;
|
|
1643
1837
|
inspect(target: string | Element, opts?: DebugOptions): InspectResult;
|
|
1644
1838
|
summary(opts?: DebugOptions): Summary;
|
|
1645
1839
|
chunks(opts?: DebugOptions): ChunkBreakdown;
|
|
@@ -1650,6 +1844,5 @@ declare const tastyDebug: {
|
|
|
1650
1844
|
help(): void;
|
|
1651
1845
|
install(): void;
|
|
1652
1846
|
};
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
//# sourceMappingURL=index-B_k47mc_.d.ts.map
|
|
1847
|
+
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 };
|
|
1848
|
+
//# sourceMappingURL=index-szujmf6W.d.ts.map
|