@tenphi/tasty 0.0.0-snapshot.8a8eb7d → 0.0.0-snapshot.8be165d
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 +176 -131
- package/dist/astro-C_by9qPq.js +307 -0
- package/dist/astro-C_by9qPq.js.map +1 -0
- package/dist/{async-storage-B7_o6FKt.js → async-storage-DKK-wTD4.js} +1 -1
- package/dist/{async-storage-B7_o6FKt.js.map → async-storage-DKK-wTD4.js.map} +1 -1
- package/dist/babel-BUQGeOXA.d.ts +83 -0
- package/dist/{collector-o-UYCV-b.js → collector-BevHh16N.js} +108 -24
- package/dist/collector-BevHh16N.js.map +1 -0
- package/dist/{collector-CpU85p2G.d.ts → collector-CLVr5_p3.d.ts} +62 -7
- package/dist/{config-DOvjo65E.js → config-NcdqU9PC.js} +2812 -1496
- package/dist/config-NcdqU9PC.js.map +1 -0
- package/dist/{config-3h7BtX4l.d.ts → config-YsxGv4tq.d.ts} +351 -33
- package/dist/{context-CkSg-kDT.js → context-CA8YKeMn.js} +1 -1
- package/dist/{context-CkSg-kDT.js.map → context-CA8YKeMn.js.map} +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +6 -6
- package/dist/{core-CPx5Lqjr.js → core-D7s7u-k1.js} +150 -182
- package/dist/core-D7s7u-k1.js.map +1 -0
- package/dist/{css-writer-DJvsfR1w.js → css-writer-BDPmetHV.js} +54 -15
- package/dist/css-writer-BDPmetHV.js.map +1 -0
- package/dist/{format-global-rules-Dbc_1tc3.js → format-global-rules-DklyaXv-.js} +1 -1
- package/dist/{format-global-rules-Dbc_1tc3.js.map → format-global-rules-DklyaXv-.js.map} +1 -1
- package/dist/{format-rules-aRlqFAd1.js → format-rules-BQCn7JZH.js} +4 -17
- package/dist/format-rules-BQCn7JZH.js.map +1 -0
- package/dist/{hydrate-Ddw7yjyx.js → hydrate-C3cfqlaQ.js} +3 -11
- package/dist/{hydrate-Ddw7yjyx.js.map → hydrate-C3cfqlaQ.js.map} +1 -1
- package/dist/{index-C_SRmAWj.d.ts → index-CBK778ne.d.ts} +294 -161
- package/dist/{index-BsJz5xBF.d.ts → index-Cd45t5NM.d.ts} +297 -62
- package/dist/index.d.ts +5 -5
- package/dist/index.js +250 -60
- package/dist/index.js.map +1 -1
- package/dist/{keyframes-C4ObN2Vc.js → keyframes-ByhOtsXB.js} +97 -199
- package/dist/keyframes-ByhOtsXB.js.map +1 -0
- package/dist/{merge-styles-BbyWO2Gc.js → merge-styles-BKfagXfV.js} +2 -2
- package/dist/{merge-styles-BbyWO2Gc.js.map → merge-styles-BKfagXfV.js.map} +1 -1
- package/dist/{merge-styles-BzOwGOGC.d.ts → merge-styles-CU7JbEwg.d.ts} +2 -2
- package/dist/{resolve-recipes-CqTtBOKx.js → resolve-recipes-vvygrWLw.js} +3 -3
- package/dist/{resolve-recipes-CqTtBOKx.js.map → resolve-recipes-vvygrWLw.js.map} +1 -1
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro-client.js.map +1 -1
- package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
- package/dist/ssr/astro-middleware-extract-static.js +9 -0
- package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
- package/dist/ssr/astro-middleware-extract.d.ts +11 -0
- package/dist/ssr/astro-middleware-extract.js +9 -0
- package/dist/ssr/astro-middleware-extract.js.map +1 -0
- package/dist/ssr/astro-middleware-static.d.ts +18 -0
- package/dist/ssr/astro-middleware-static.js +18 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +11 -7
- package/dist/ssr/astro-middleware.js +10 -10
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.d.ts +37 -7
- package/dist/ssr/astro.js +2 -147
- package/dist/ssr/index.d.ts +2 -9
- package/dist/ssr/index.js +5 -5
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next.d.ts +2 -3
- package/dist/ssr/next.js +6 -7
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +2 -2
- package/dist/static/index.js +4 -4
- package/dist/static/index.js.map +1 -1
- package/dist/static/inject.js.map +1 -1
- package/dist/zero/babel.d.ts +2 -81
- package/dist/zero/babel.js +27 -23
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +16 -2
- package/dist/zero/index.js +2 -2
- package/dist/zero/next.d.ts +1 -1
- package/dist/zero/next.js +1 -1
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +17 -9
- package/docs/adoption.md +56 -31
- package/docs/ai-agents.md +224 -0
- package/docs/comparison.md +69 -40
- package/docs/configuration.md +470 -85
- package/docs/debug.md +7 -7
- package/docs/design-system.md +43 -24
- package/docs/dsl.md +407 -185
- package/docs/getting-started.md +60 -39
- package/docs/injector.md +58 -5
- package/docs/methodology.md +44 -38
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +4 -7
- package/docs/plugins.md +353 -0
- package/docs/react-api.md +142 -42
- package/docs/runtime-benchmarks.md +216 -0
- package/docs/ssr.md +132 -86
- package/docs/styles.md +56 -9
- package/docs/tasty-static.md +140 -105
- package/package.json +50 -18
- package/tasty.config.ts +4 -0
- package/dist/collector-o-UYCV-b.js.map +0 -1
- package/dist/config-DOvjo65E.js.map +0 -1
- package/dist/core-CPx5Lqjr.js.map +0 -1
- package/dist/css-writer-DJvsfR1w.js.map +0 -1
- package/dist/format-rules-aRlqFAd1.js.map +0 -1
- package/dist/keyframes-C4ObN2Vc.js.map +0 -1
- package/dist/ssr/astro.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { AllHTMLAttributes, CSSProperties, ComponentType, ElementType, ForwardRefExoticComponent, JSX, PropsWithoutRef, RefAttributes } from "react";
|
|
1
|
+
import { _ as TastyPluginFactory, w as StyleInjector } from "./config-YsxGv4tq.js";
|
|
2
|
+
import { B as StyleValueStateMap, Ct as PropertyOptions, D as CSSMap, I as StyleHandlerResult, M as ResolvedStyleValue, Ot as StyleInjectorConfig, R as StylePropValue, at as CSSProperties$1, b as Styles, bt as KeyframesResult, dt as FunctionDefinition, gt as InjectResult, ht as GlobalInjectResult, j as RawStyleHandler, lt as FontFaceDescriptors, mt as GCOptions, n as StyleResult, nt as StyleDetails, ot as CacheMetrics, st as CounterStyleDescriptors, ut as FontFaceInput, x as StylesInterface, xt as KeyframesSteps, z as StyleValue } from "./index-Cd45t5NM.js";
|
|
3
|
+
import { r as ServerStyleCollector } from "./collector-CLVr5_p3.js";
|
|
4
|
+
import { AllHTMLAttributes, CSSProperties, ComponentType, ElementType, ForwardRefExoticComponent, JSX, PropsWithoutRef, ReactNode, RefAttributes } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/name-prefix.d.ts
|
|
7
7
|
/**
|
|
@@ -44,9 +44,6 @@ declare const OUTER_STYLES: readonly ["gridArea", "order", "gridColumn", "gridRo
|
|
|
44
44
|
declare const INNER_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition", "color", "fill", "fade", "image", "padding", "paddingInline", "paddingBlock", "overflow", "scrollbar", "textAlign", "flow", "place", "placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "gap", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas"];
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/types.d.ts
|
|
47
|
-
interface GlobalStyledProps {
|
|
48
|
-
breakpoints?: number[];
|
|
49
|
-
}
|
|
50
47
|
/**
|
|
51
48
|
* Extensible interface for theme names.
|
|
52
49
|
* Augment this interface to register project-specific theme names for autocomplete.
|
|
@@ -64,6 +61,42 @@ interface GlobalStyledProps {
|
|
|
64
61
|
interface TastyThemeNames {}
|
|
65
62
|
type ThemeNameKey = Extract<keyof TastyThemeNames, string>;
|
|
66
63
|
type ThemeName = [ThemeNameKey] extends [never] ? string : ThemeNameKey;
|
|
64
|
+
/**
|
|
65
|
+
* Extensible interface for custom props added via `configure({ propHandlers })`.
|
|
66
|
+
* Augment it to type those props on every tasty component.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* declare module '@tenphi/tasty' {
|
|
71
|
+
* interface TastyCustomProps {
|
|
72
|
+
* glaze: 'soft' | 'strong' | { tone: string; intensity?: number };
|
|
73
|
+
* }
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
interface TastyCustomProps {}
|
|
78
|
+
/**
|
|
79
|
+
* Extensible interface for style names promoted via
|
|
80
|
+
* `configure({ baseStyleProps })`. Set each name to `true`; the prop is then typed
|
|
81
|
+
* exactly like the style it names.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* declare module '@tenphi/tasty' {
|
|
86
|
+
* interface TastyBaseStylePropNames {
|
|
87
|
+
* radius: true;
|
|
88
|
+
* shadow: true;
|
|
89
|
+
* }
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
interface TastyBaseStylePropNames {}
|
|
94
|
+
/**
|
|
95
|
+
* Props contributed by `configure({ baseStyleProps })`, each typed like the style
|
|
96
|
+
* it names. Intersecting with `keyof StylesInterface` makes a name that isn't a
|
|
97
|
+
* real style inert rather than `never`-typed.
|
|
98
|
+
*/
|
|
99
|
+
type ExtraBaseStyleProps = { [key in keyof TastyBaseStylePropNames & keyof StylesInterface]?: StylePropValue<StylesInterface[key]> };
|
|
67
100
|
/** Allowed mod value types */
|
|
68
101
|
type ModValue = boolean | string | number | undefined | null;
|
|
69
102
|
/**
|
|
@@ -86,7 +119,7 @@ type TokenValue = string | number | boolean | undefined | null;
|
|
|
86
119
|
/**
|
|
87
120
|
* Tokens definition for inline CSS custom properties.
|
|
88
121
|
* - `$name` keys become `--name` CSS properties
|
|
89
|
-
* - `#name` keys become `--name-color`
|
|
122
|
+
* - `#name` keys become `--name-color` CSS properties
|
|
90
123
|
*/
|
|
91
124
|
type Tokens = Record<`$${string}` | `#${string}`, TokenValue>;
|
|
92
125
|
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';
|
|
@@ -101,20 +134,14 @@ interface BasePropsWithoutChildren<K extends TagName = TagName> extends Pick<All
|
|
|
101
134
|
element?: `${Caps}${string}`;
|
|
102
135
|
/** The style map */
|
|
103
136
|
styles?: Styles;
|
|
104
|
-
/** The list of responsive points in pixels */
|
|
105
|
-
breakpoints?: number[];
|
|
106
|
-
/** Whether the element has the block layout outside */
|
|
107
|
-
block?: boolean;
|
|
108
|
-
/** Whether the element has the inline layout outside */
|
|
109
|
-
inline?: boolean;
|
|
110
137
|
/** The list of element modifiers **/
|
|
111
138
|
mods?: Mods;
|
|
112
139
|
/** Whether the element is hidden (`hidden` attribute is set) */
|
|
113
140
|
isHidden?: boolean;
|
|
114
141
|
/** Whether the element is disabled (`disabled` attribute is set) */
|
|
115
142
|
isDisabled?: boolean;
|
|
116
|
-
/**
|
|
117
|
-
|
|
143
|
+
/** Whether the element is checked (`checked` attribute is set) */
|
|
144
|
+
isChecked?: boolean;
|
|
118
145
|
/** The CSS style map */
|
|
119
146
|
style?: CSSProperties$1 | (CSSProperties$1 & Record<string, string | number | null | undefined>);
|
|
120
147
|
/** User-defined theme for the element. Mapped to `data-theme` attribute. Augment `TastyThemeNames` to register project-specific themes for autocomplete. */
|
|
@@ -142,7 +169,6 @@ interface ShortGridStyles {
|
|
|
142
169
|
rows?: Styles['gridRows'];
|
|
143
170
|
areas?: Styles['gridAreas'];
|
|
144
171
|
}
|
|
145
|
-
type Props = Record<string, any>;
|
|
146
172
|
type TagName = keyof HTMLElementTagNameMap;
|
|
147
173
|
/**
|
|
148
174
|
* Configuration type for tasty.config.ts files.
|
|
@@ -187,7 +213,7 @@ interface TastyExtensionConfig {
|
|
|
187
213
|
* Set to `false` to disable function validation (overrides parent).
|
|
188
214
|
* @example ['clamp', 'double']
|
|
189
215
|
*/
|
|
190
|
-
|
|
216
|
+
functions?: false | string[];
|
|
191
217
|
/**
|
|
192
218
|
* State alias names for autocomplete.
|
|
193
219
|
* Must start with @ prefix.
|
|
@@ -244,9 +270,10 @@ type TokenPropsMap = Readonly<Record<string, TokenPropKey>>;
|
|
|
244
270
|
type TokenPropsInput = TokenPropsList | TokenPropsMap;
|
|
245
271
|
/** Resolve a `tokenProps` definition to the component prop types it adds. */
|
|
246
272
|
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>> : {};
|
|
273
|
+
type AnyProps = Record<string, any>;
|
|
247
274
|
type PropsWithStyles = {
|
|
248
275
|
styles?: Styles;
|
|
249
|
-
} & Omit<
|
|
276
|
+
} & Omit<Record<string, any>, 'styles'>;
|
|
250
277
|
type VariantMap = Record<string, Styles>;
|
|
251
278
|
interface WithVariant<V extends VariantMap> {
|
|
252
279
|
variant?: keyof V;
|
|
@@ -303,7 +330,7 @@ type TastyBaseProps<K extends StyleList, V extends VariantMap, E extends Element
|
|
|
303
330
|
tokens?: Tokens; /** Sub-element definitions for compound components */
|
|
304
331
|
elements?: E;
|
|
305
332
|
} & Pick<BaseProps, 'qa' | 'qaVal'> & WithVariant<V>;
|
|
306
|
-
type TastyProps<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, DefaultProps =
|
|
333
|
+
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> & {
|
|
307
334
|
/** The tag name of the element or a React component. */as?: string | ComponentType<any>;
|
|
308
335
|
} & Partial<Omit<DefaultProps, 'as' | 'styles' | 'styleProps' | 'modProps' | 'tokenProps' | 'tokens'>>;
|
|
309
336
|
/**
|
|
@@ -319,18 +346,18 @@ type ResolveAsProps<AsType extends ElementType> = AsType extends keyof JSX.Intri
|
|
|
319
346
|
* element type from the `as` prop — both for intrinsic tags and for React
|
|
320
347
|
* components (so the wrapped component's prop API is preserved).
|
|
321
348
|
*
|
|
322
|
-
* Note: Uses a separate index signature with `unknown` instead of
|
|
323
|
-
*
|
|
349
|
+
* Note: Uses a separate index signature with `unknown` instead of an `any`
|
|
350
|
+
* record to ensure strict type checking for styles.
|
|
324
351
|
*/
|
|
325
352
|
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> & {
|
|
326
353
|
/** The tag name of the element or a React component. */as?: AsType;
|
|
327
354
|
} & Record<string, unknown>;
|
|
328
|
-
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 & ResolveModProps<M> & ResolveTokenProps<TP>;
|
|
355
|
+
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>;
|
|
329
356
|
/**
|
|
330
357
|
* Keys from BasePropsWithoutChildren that should be omitted from HTML attributes.
|
|
331
358
|
* This excludes event handlers so they can be properly typed from JSX.IntrinsicElements.
|
|
332
359
|
*/
|
|
333
|
-
type TastySpecificKeys = 'as' | 'qa' | 'qaVal' | 'element' | 'styles' | '
|
|
360
|
+
type TastySpecificKeys = 'as' | 'qa' | 'qaVal' | 'element' | 'styles' | 'mods' | 'isHidden' | 'isDisabled' | 'isChecked' | 'style' | 'theme' | 'tokens' | 'ref' | 'color';
|
|
334
361
|
/** Extract prop key names from a ModPropsInput (array elements or object keys). */
|
|
335
362
|
type ModPropsKeys<M extends ModPropsInput> = M extends readonly (infer K)[] ? K & string : keyof M & string;
|
|
336
363
|
/** Extract prop key names from a TokenPropsInput (array elements or object keys). */
|
|
@@ -351,7 +378,7 @@ type TokenPropsKeys<TP extends TokenPropsInput> = TP extends readonly (infer K)[
|
|
|
351
378
|
* baseline is preserved so generic HTML attributes still work even when `as`
|
|
352
379
|
* is a component type with a narrower prop API.
|
|
353
380
|
*/
|
|
354
|
-
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>>;
|
|
381
|
+
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>>;
|
|
355
382
|
type TastyComponentPropsWithDefaults<Props extends PropsWithStyles, DefaultProps extends Partial<Props>> = keyof DefaultProps extends never ? Props : { [key in Extract<keyof Props, keyof DefaultProps>]?: Props[key] } & { [key in keyof Omit<Props, keyof DefaultProps>]: Props[key] };
|
|
356
383
|
/**
|
|
357
384
|
* The component type returned by the `tasty(options)` element-factory overload.
|
|
@@ -372,11 +399,6 @@ declare function tasty<Props extends PropsWithStyles, DefaultProps extends Parti
|
|
|
372
399
|
declare const Element$1: TastyPolymorphicComponent<"div", StyleList, VariantMap, readonly never[], readonly never[]> & SubElementComponents<Record<string, never>>;
|
|
373
400
|
//#endregion
|
|
374
401
|
//#region src/hooks/useStyles.d.ts
|
|
375
|
-
/**
|
|
376
|
-
* Tasty styles object to generate CSS classes for.
|
|
377
|
-
* Can be undefined or empty object for no styles.
|
|
378
|
-
*/
|
|
379
|
-
type UseStylesOptions = Styles | undefined;
|
|
380
402
|
interface UseStylesResult {
|
|
381
403
|
/**
|
|
382
404
|
* Generated className(s) to apply to the element.
|
|
@@ -405,7 +427,7 @@ interface UseStylesResult {
|
|
|
405
427
|
* }
|
|
406
428
|
* ```
|
|
407
429
|
*/
|
|
408
|
-
declare function useStyles(styles:
|
|
430
|
+
declare function useStyles(styles: Styles | undefined, options?: {
|
|
409
431
|
root?: Document | ShadowRoot;
|
|
410
432
|
}): UseStylesResult;
|
|
411
433
|
//#endregion
|
|
@@ -434,6 +456,10 @@ interface UseGlobalStylesOptions {
|
|
|
434
456
|
* Use the `id` option for update tracking when styles change over the
|
|
435
457
|
* component lifecycle.
|
|
436
458
|
*
|
|
459
|
+
* Update tracking is per-slot and per-root: a slot (`id`, or the selector when
|
|
460
|
+
* no `id` is given) holds exactly one injection per `root`. Changing the styles
|
|
461
|
+
* replaces it; rendering styles that produce no CSS clears it.
|
|
462
|
+
*
|
|
437
463
|
* @param selector - CSS selector to apply styles to (e.g., '.my-class', ':root', 'body')
|
|
438
464
|
* @param styles - Tasty styles object
|
|
439
465
|
* @param options - Optional settings including `id` for update tracking
|
|
@@ -456,9 +482,8 @@ declare function useGlobalStyles(selector: string, styles?: Styles, options?: Us
|
|
|
456
482
|
//#region src/hooks/useRawCSS.d.ts
|
|
457
483
|
interface UseRawCSSOptions {
|
|
458
484
|
/**
|
|
459
|
-
* Shadow root or document to inject into.
|
|
460
|
-
*
|
|
461
|
-
* only the root for the same id/content will not re-inject.
|
|
485
|
+
* Shadow root or document to inject into. Update tracking is per-root: the
|
|
486
|
+
* same id in two roots holds a separate injection in each.
|
|
462
487
|
*/
|
|
463
488
|
root?: Document | ShadowRoot;
|
|
464
489
|
/**
|
|
@@ -484,6 +509,11 @@ interface UseKeyframesOptions {
|
|
|
484
509
|
*
|
|
485
510
|
* Works in all environments: client, SSR with collector, and React Server Components.
|
|
486
511
|
*
|
|
512
|
+
* Passing `name` claims a slot owned by that one call site (like `useRawCSS`'s
|
|
513
|
+
* `id`): when its steps change, the previous injection is disposed and the name
|
|
514
|
+
* is reused, so the rules don't accumulate. Anonymous keyframes are permanent
|
|
515
|
+
* and shared by content.
|
|
516
|
+
*
|
|
487
517
|
* @example Basic usage - steps object is the dependency
|
|
488
518
|
* ```tsx
|
|
489
519
|
* function MyComponent() {
|
|
@@ -528,28 +558,11 @@ declare function useKeyframes(steps: KeyframesSteps, options?: UseKeyframesOptio
|
|
|
528
558
|
declare function useKeyframes(factory: () => KeyframesSteps, deps: readonly unknown[], options?: UseKeyframesOptions): string;
|
|
529
559
|
//#endregion
|
|
530
560
|
//#region src/hooks/useProperty.d.ts
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
*/
|
|
537
|
-
syntax?: string;
|
|
538
|
-
/**
|
|
539
|
-
* Whether the property inherits from parent elements
|
|
540
|
-
* @default true
|
|
541
|
-
*/
|
|
542
|
-
inherits?: boolean;
|
|
543
|
-
/**
|
|
544
|
-
* Initial value for the property.
|
|
545
|
-
* For color tokens (#name), this defaults to 'transparent' if not specified.
|
|
546
|
-
*/
|
|
547
|
-
initialValue?: string | number;
|
|
548
|
-
/**
|
|
549
|
-
* Shadow root or document to inject into
|
|
550
|
-
*/
|
|
551
|
-
root?: Document | ShadowRoot;
|
|
552
|
-
}
|
|
561
|
+
/**
|
|
562
|
+
* Options for {@link useProperty}. Extends the shared {@link PropertyOptions}
|
|
563
|
+
* (which is `PropertyDefinition` plus an optional injection `root`).
|
|
564
|
+
*/
|
|
565
|
+
type UsePropertyOptions = PropertyOptions;
|
|
553
566
|
/**
|
|
554
567
|
* Register a CSS @property custom property.
|
|
555
568
|
* This enables advanced features like animating custom properties.
|
|
@@ -679,6 +692,95 @@ interface UseCounterStyleOptions {
|
|
|
679
692
|
*/
|
|
680
693
|
declare function useCounterStyle(descriptors: CounterStyleDescriptors, options?: UseCounterStyleOptions): string;
|
|
681
694
|
//#endregion
|
|
695
|
+
//#region src/hooks/useFunction.d.ts
|
|
696
|
+
interface UseFunctionOptions {
|
|
697
|
+
/** Shadow root or document to inject into. */
|
|
698
|
+
root?: Document | ShadowRoot;
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Register a CSS @function (custom function).
|
|
702
|
+
*
|
|
703
|
+
* @function rules are global and persistent once defined. The hook ensures the
|
|
704
|
+
* function is only registered once per root (deduplicated by function name).
|
|
705
|
+
*
|
|
706
|
+
* Accepts tasty token syntax for the function name:
|
|
707
|
+
* - `$$name` → defines `--name` (matches the call site `$$name(...)`)
|
|
708
|
+
* - `$name` / `--name` → also accepted
|
|
709
|
+
*
|
|
710
|
+
* Works in all environments: client, SSR with collector, and React Server Components.
|
|
711
|
+
*
|
|
712
|
+
* @param name - The function name token (`$$name`, `$name`, or `--name`)
|
|
713
|
+
* @param definition - Function definition (args, returns, result, local vars)
|
|
714
|
+
*
|
|
715
|
+
* Call the function through the Tasty DSL, not a raw `style` prop: an inline
|
|
716
|
+
* `style` value reaches the browser unparsed, so the `$$name(...)` sugar is never
|
|
717
|
+
* expanded and `polyfills.functions` cannot rewrite it either.
|
|
718
|
+
*
|
|
719
|
+
* @example
|
|
720
|
+
* ```tsx
|
|
721
|
+
* const Box = tasty({ styles: { marginTop: '$$negative(10px)' } });
|
|
722
|
+
*
|
|
723
|
+
* function Layout() {
|
|
724
|
+
* useFunction('$$negative', { args: ['$value'], result: '(-1 * $value)' });
|
|
725
|
+
* return <Box />;
|
|
726
|
+
* }
|
|
727
|
+
* ```
|
|
728
|
+
*/
|
|
729
|
+
declare function useFunction(name: string, definition: FunctionDefinition, options?: UseFunctionOptions): void;
|
|
730
|
+
//#endregion
|
|
731
|
+
//#region src/batch-provider.d.ts
|
|
732
|
+
interface TastyBatchProviderProps {
|
|
733
|
+
children?: ReactNode;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Opens a *batch window* for the commit it renders in, so `batchInjection`
|
|
737
|
+
* can defer stylesheet writes without ever letting a layout effect measure an
|
|
738
|
+
* unstyled element.
|
|
739
|
+
*
|
|
740
|
+
* Every `insertRule()` on a live sheet invalidates style for that sheet's
|
|
741
|
+
* scope. When components inject during React's render phase while others read
|
|
742
|
+
* layout in the same pass, the two interleave and the browser recalculates
|
|
743
|
+
* style between every injection. Batching collapses that into one invalidation
|
|
744
|
+
* per flush — but only if the flush happens before anything can measure.
|
|
745
|
+
*
|
|
746
|
+
* ```
|
|
747
|
+
* provider renders -> window OPEN
|
|
748
|
+
* children render -> injections queued
|
|
749
|
+
* provider insertionEffect -> FLUSH, window CLOSED
|
|
750
|
+
* layout effects run -> rules are in the sheet
|
|
751
|
+
* ```
|
|
752
|
+
*
|
|
753
|
+
* `useInsertionEffect` runs in React's mutation phase, after every render in
|
|
754
|
+
* the commit and before any `useLayoutEffect` — which is exactly why React
|
|
755
|
+
* added it for CSS-in-JS libraries. Effects fire child-first, so this
|
|
756
|
+
* provider's runs after every descendant's and still before all layout
|
|
757
|
+
* effects.
|
|
758
|
+
*
|
|
759
|
+
* A commit that does not re-render this provider gets no window, and those
|
|
760
|
+
* injections are written synchronously instead. That is the point: turning
|
|
761
|
+
* `batchInjection: true` on can only ever make injection cheaper, never make a
|
|
762
|
+
* measurement wrong. It also means batching applies to commits this provider
|
|
763
|
+
* takes part in, so mount it as high in the tree as you can.
|
|
764
|
+
*
|
|
765
|
+
* Requires `configure({ batchInjection: true })`; without it this component
|
|
766
|
+
* only renders its children. `batchInjection: 'always'` does not need the
|
|
767
|
+
* provider at all — see that option's docs for the trade-off it accepts.
|
|
768
|
+
*
|
|
769
|
+
* @example
|
|
770
|
+
* ```tsx
|
|
771
|
+
* configure({ batchInjection: true });
|
|
772
|
+
*
|
|
773
|
+
* createRoot(el).render(
|
|
774
|
+
* <TastyBatchProvider>
|
|
775
|
+
* <App />
|
|
776
|
+
* </TastyBatchProvider>,
|
|
777
|
+
* );
|
|
778
|
+
* ```
|
|
779
|
+
*/
|
|
780
|
+
declare function TastyBatchProvider({
|
|
781
|
+
children
|
|
782
|
+
}: TastyBatchProviderProps): ReactNode;
|
|
783
|
+
//#endregion
|
|
682
784
|
//#region src/utils/get-display-name.d.ts
|
|
683
785
|
declare function getDisplayName<T>(Component: ElementType<T>, fallbackName?: string): string;
|
|
684
786
|
//#endregion
|
|
@@ -692,7 +794,7 @@ declare module './utils/css-types' {
|
|
|
692
794
|
* The okhsl function handler for tasty parser.
|
|
693
795
|
* Receives parsed style groups and returns an RGB color string.
|
|
694
796
|
*/
|
|
695
|
-
declare const
|
|
797
|
+
declare const okhslFunction: (groups: StyleDetails[]) => string;
|
|
696
798
|
/**
|
|
697
799
|
* OKHSL Plugin for Tasty.
|
|
698
800
|
*
|
|
@@ -722,7 +824,7 @@ declare const okhslPlugin: TastyPluginFactory;
|
|
|
722
824
|
* The okhst function handler for tasty parser.
|
|
723
825
|
* Receives parsed style groups and returns an RGB color string.
|
|
724
826
|
*/
|
|
725
|
-
declare const
|
|
827
|
+
declare const okhstFunction: (groups: StyleDetails[]) => string;
|
|
726
828
|
/**
|
|
727
829
|
* OKHST Plugin for Tasty.
|
|
728
830
|
*
|
|
@@ -747,47 +849,69 @@ declare const okhstFunc: (groups: StyleDetails[]) => string;
|
|
|
747
849
|
*/
|
|
748
850
|
declare const okhstPlugin: TastyPluginFactory;
|
|
749
851
|
//#endregion
|
|
750
|
-
//#region src/
|
|
852
|
+
//#region src/plugins/color-func.d.ts
|
|
751
853
|
/**
|
|
752
|
-
*
|
|
854
|
+
* Creates a color function handler for the tasty parser.
|
|
753
855
|
*
|
|
754
|
-
*
|
|
755
|
-
*
|
|
756
|
-
*
|
|
856
|
+
* A color function is a custom `functions` entry that converts its arguments
|
|
857
|
+
* to an `rgb(...)` string (an already-supported color), so it needs no special
|
|
858
|
+
* core integration — registering it as a parse function is enough.
|
|
757
859
|
*
|
|
758
|
-
*
|
|
759
|
-
*
|
|
760
|
-
*
|
|
761
|
-
*
|
|
762
|
-
*
|
|
860
|
+
* @param name The name of the color function (e.g., 'okhsl', 'okhst')
|
|
861
|
+
* @param convert Converts the parsed first three channel values (after angle/
|
|
862
|
+
* percent normalization) to sRGB `[r, g, b]` in the 0-1 range
|
|
863
|
+
* @param label Optional diagnostic label shown in dev warnings when the wrong
|
|
864
|
+
* number of arguments is supplied (e.g., 'H S L'). Has no effect on parsing
|
|
865
|
+
* or output.
|
|
866
|
+
*/
|
|
867
|
+
declare function createColorFunc(name: string, convert: (h: number, c2: number, c3: number) => [number, number, number], label?: string): (groups: StyleDetails[]) => string;
|
|
868
|
+
//#endregion
|
|
869
|
+
//#region src/utils/function-color.d.ts
|
|
870
|
+
/**
|
|
871
|
+
* Resolve a `name(...)` value produced by a registered custom parse function
|
|
872
|
+
* into its concrete color output.
|
|
763
873
|
*
|
|
764
|
-
*
|
|
765
|
-
*
|
|
874
|
+
* A color function is just a `functions` entry whose output is an already
|
|
875
|
+
* supported color (`rgb`, `hsl`, `#…`, `oklch`, …). This helper delegates the
|
|
876
|
+
* value to the global parser (which already runs the registered parse function)
|
|
877
|
+
* and returns the result only when it looks like a color. Returns `null` when
|
|
878
|
+
* `str` is not a registered custom function or its output is not a color.
|
|
766
879
|
*
|
|
767
|
-
*
|
|
880
|
+
* This is the generic replacement for the previously hardcoded okhsl/okhst
|
|
881
|
+
* conversion branches scattered across `strToRgb`, `resolveToRgbaValues`, and
|
|
882
|
+
* the `#token.alpha` injection path.
|
|
883
|
+
*/
|
|
884
|
+
declare function resolveFunctionColor(str: string): string | null;
|
|
885
|
+
//#endregion
|
|
886
|
+
//#region src/chunks/style-chunk-map.d.ts
|
|
887
|
+
/**
|
|
888
|
+
* Chunk names, the built-in chunk style lists, and the style→chunk lookup.
|
|
768
889
|
*
|
|
769
|
-
*
|
|
770
|
-
*
|
|
771
|
-
* 2. If a handler reads a style from another chunk, that value isn't in the cache key
|
|
772
|
-
* 3. Changing the cross-chunk style won't invalidate this chunk's cache
|
|
773
|
-
* 4. Result: stale CSS output or incorrect cache hits
|
|
890
|
+
* This is a **leaf module with no imports**. It exists separately from
|
|
891
|
+
* `definitions.ts` for two reasons:
|
|
774
892
|
*
|
|
775
|
-
*
|
|
776
|
-
*
|
|
777
|
-
*
|
|
778
|
-
*
|
|
779
|
-
*
|
|
780
|
-
*
|
|
781
|
-
* // - User changes to { display: 'flex', flow: 'column' }
|
|
782
|
-
* // - LAYOUT chunk cache key unchanged (only has 'flow')
|
|
783
|
-
* // - Returns stale CSS computed with display=grid!
|
|
784
|
-
* ```
|
|
893
|
+
* 1. The style handler registry (`styles/predefined.ts`) needs to assign chunk
|
|
894
|
+
* membership for custom handlers. Reaching for `definitions.ts` would create an
|
|
895
|
+
* import cycle (`definitions` -> `pipeline` -> `styles` -> `predefined`).
|
|
896
|
+
* 2. `STYLE_TO_CHUNK` is populated as a side effect of module load, so it must be
|
|
897
|
+
* populated by the module that *owns* it. Otherwise an importer that only pulls
|
|
898
|
+
* in this module would see an empty map and misclassify every style as `misc`.
|
|
785
899
|
*
|
|
786
|
-
*
|
|
787
|
-
*
|
|
788
|
-
* 2. Ensure ALL styles from each handler's __lookupStyles are in the same chunk
|
|
789
|
-
* ============================================================================
|
|
900
|
+
* `definitions.ts` re-exports everything here, so existing import paths and the
|
|
901
|
+
* public API surface are unchanged.
|
|
790
902
|
*/
|
|
903
|
+
declare const CHUNK_NAMES: {
|
|
904
|
+
/** Special chunk for styles that cannot be split */readonly COMBINED: "combined";
|
|
905
|
+
readonly SUBCOMPONENTS: "subcomponents";
|
|
906
|
+
readonly APPEARANCE: "appearance";
|
|
907
|
+
readonly FONT: "font";
|
|
908
|
+
readonly DIMENSION: "dimension";
|
|
909
|
+
readonly DISPLAY: "display";
|
|
910
|
+
readonly LAYOUT: "layout";
|
|
911
|
+
readonly POSITION: "position";
|
|
912
|
+
readonly MISC: "misc";
|
|
913
|
+
};
|
|
914
|
+
type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];
|
|
791
915
|
/**
|
|
792
916
|
* Appearance chunk - visual styling with independent handlers
|
|
793
917
|
*
|
|
@@ -841,24 +965,15 @@ declare const LAYOUT_CHUNK_STYLES: readonly ["placeItems", "placeContent", "alig
|
|
|
841
965
|
*/
|
|
842
966
|
/** @public */
|
|
843
967
|
declare const POSITION_CHUNK_STYLES: readonly ["position", "inset", "insetBlock", "insetInline", "top", "right", "bottom", "left", "zIndex", "gridArea", "gridColumn", "gridRow", "order", "placeSelf", "alignSelf", "justifySelf", "transform", "transition", "animation"];
|
|
844
|
-
declare const CHUNK_NAMES: {
|
|
845
|
-
/** Special chunk for styles that cannot be split */readonly COMBINED: "combined";
|
|
846
|
-
readonly SUBCOMPONENTS: "subcomponents";
|
|
847
|
-
readonly APPEARANCE: "appearance";
|
|
848
|
-
readonly FONT: "font";
|
|
849
|
-
readonly DIMENSION: "dimension";
|
|
850
|
-
readonly DISPLAY: "display";
|
|
851
|
-
readonly LAYOUT: "layout";
|
|
852
|
-
readonly POSITION: "position";
|
|
853
|
-
readonly MISC: "misc";
|
|
854
|
-
};
|
|
855
|
-
type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];
|
|
856
968
|
/**
|
|
857
|
-
*
|
|
858
|
-
*
|
|
969
|
+
* Map for O(1) style-to-chunk lookup. Seeded with the built-in lists above and
|
|
970
|
+
* extended by {@link assignStyleChunk} when a custom handler declares style names
|
|
971
|
+
* the built-in lists don't know.
|
|
859
972
|
*/
|
|
860
973
|
declare const STYLE_TO_CHUNK: Map<string, ChunkName>;
|
|
861
|
-
|
|
974
|
+
//#endregion
|
|
975
|
+
//#region src/chunks/definitions.d.ts
|
|
976
|
+
interface ChunkInfo {
|
|
862
977
|
/** Name of the chunk */
|
|
863
978
|
name: ChunkName | string;
|
|
864
979
|
/** Style keys belonging to this chunk */
|
|
@@ -903,9 +1018,7 @@ declare function colorStyle({
|
|
|
903
1018
|
color
|
|
904
1019
|
}: {
|
|
905
1020
|
color?: string | boolean;
|
|
906
|
-
}):
|
|
907
|
-
color: string;
|
|
908
|
-
} | null;
|
|
1021
|
+
}): Record<string, string> | null;
|
|
909
1022
|
declare namespace colorStyle {
|
|
910
1023
|
var __lookupStyles: string[];
|
|
911
1024
|
}
|
|
@@ -999,7 +1112,7 @@ declare function flowStyle({
|
|
|
999
1112
|
display?: string;
|
|
1000
1113
|
flow?: string;
|
|
1001
1114
|
}): {
|
|
1002
|
-
[x: string]: string
|
|
1115
|
+
[x: string]: string;
|
|
1003
1116
|
} | null;
|
|
1004
1117
|
declare namespace flowStyle {
|
|
1005
1118
|
var __lookupStyles: string[];
|
|
@@ -1223,7 +1336,7 @@ declare function presetStyle({
|
|
|
1223
1336
|
fontStyle,
|
|
1224
1337
|
fontFamily,
|
|
1225
1338
|
font
|
|
1226
|
-
}: PresetStyleProps):
|
|
1339
|
+
}: PresetStyleProps): CSSMap | null;
|
|
1227
1340
|
declare namespace presetStyle {
|
|
1228
1341
|
var __lookupStyles: string[];
|
|
1229
1342
|
}
|
|
@@ -1370,6 +1483,36 @@ declare const styleHandlers: {
|
|
|
1370
1483
|
readonly width: typeof widthStyle;
|
|
1371
1484
|
};
|
|
1372
1485
|
//#endregion
|
|
1486
|
+
//#region src/styles/define-handler.d.ts
|
|
1487
|
+
/**
|
|
1488
|
+
* Declare a multi-dependency style handler with its dependency names inferred
|
|
1489
|
+
* into the handler's parameter type.
|
|
1490
|
+
*
|
|
1491
|
+
* Without it, the multi-dependency tuple form needs a hand-written parameter
|
|
1492
|
+
* annotation that can silently drift from the dependency list:
|
|
1493
|
+
*
|
|
1494
|
+
* ```ts
|
|
1495
|
+
* // Annotation and dependency list are maintained separately.
|
|
1496
|
+
* handlers: {
|
|
1497
|
+
* spacing: [['gap', 'padding'], ({ gap, padding }: { gap?: string; padding?: string }) => …],
|
|
1498
|
+
* }
|
|
1499
|
+
*
|
|
1500
|
+
* // Both come from the same array; a typo in the destructure is a type error.
|
|
1501
|
+
* handlers: {
|
|
1502
|
+
* spacing: defineHandler(['gap', 'padding'], ({ gap, padding }) => …),
|
|
1503
|
+
* }
|
|
1504
|
+
* ```
|
|
1505
|
+
*
|
|
1506
|
+
* Values arrive **state-resolved but unparsed** — the raw authored DSL string
|
|
1507
|
+
* (`'2x'`, `'#purple.5'`), so call `parseStyle()` / `parseColor()` as needed. The
|
|
1508
|
+
* result is a kebab-case CSS declaration map (or an array of them); the reserved
|
|
1509
|
+
* `$` key applies the declarations to a nested selector.
|
|
1510
|
+
*
|
|
1511
|
+
* All names must belong to the same chunk. Names the built-in chunk lists don't
|
|
1512
|
+
* know are pulled into their handler's chunk automatically at registration.
|
|
1513
|
+
*/
|
|
1514
|
+
declare function defineHandler<const TDeps extends readonly string[]>(deps: TDeps, handler: (props: Partial<Record<TDeps[number], ResolvedStyleValue>>) => StyleHandlerResult): [readonly string[], RawStyleHandler];
|
|
1515
|
+
//#endregion
|
|
1373
1516
|
//#region src/compute-styles.d.ts
|
|
1374
1517
|
interface ComputeStylesResult {
|
|
1375
1518
|
className: string;
|
|
@@ -1380,6 +1523,13 @@ interface ComputeStylesOptions {
|
|
|
1380
1523
|
ssrCollector?: ServerStyleCollector | null;
|
|
1381
1524
|
/** Target root for style injection (client only). Defaults to `document`. */
|
|
1382
1525
|
root?: Document | ShadowRoot;
|
|
1526
|
+
/**
|
|
1527
|
+
* Set when `styles` outlives this call and will be passed in again — a
|
|
1528
|
+
* `tasty()` factory's own styles object rather than a per-render merge.
|
|
1529
|
+
* It lets chunk cache keys be memoized on the object, which is worth the
|
|
1530
|
+
* bookkeeping only when there is a next render to spend it on.
|
|
1531
|
+
*/
|
|
1532
|
+
stableStyles?: boolean;
|
|
1383
1533
|
}
|
|
1384
1534
|
/**
|
|
1385
1535
|
* Synchronous, hook-free style computation.
|
|
@@ -1482,26 +1632,6 @@ declare function keyframes(steps: KeyframesSteps, nameOrOptions?: string | {
|
|
|
1482
1632
|
root?: Document | ShadowRoot;
|
|
1483
1633
|
name?: string;
|
|
1484
1634
|
}): KeyframesResult;
|
|
1485
|
-
interface PropertyOptions {
|
|
1486
|
-
/**
|
|
1487
|
-
* CSS syntax string for the property (e.g., '<color>', '<length>', '<angle>')
|
|
1488
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/@property/syntax
|
|
1489
|
-
*/
|
|
1490
|
-
syntax?: string;
|
|
1491
|
-
/**
|
|
1492
|
-
* Whether the property inherits from parent elements
|
|
1493
|
-
* @default true
|
|
1494
|
-
*/
|
|
1495
|
-
inherits?: boolean;
|
|
1496
|
-
/**
|
|
1497
|
-
* Initial value for the property
|
|
1498
|
-
*/
|
|
1499
|
-
initialValue?: string | number;
|
|
1500
|
-
/**
|
|
1501
|
-
* Shadow root or document to inject into
|
|
1502
|
-
*/
|
|
1503
|
-
root?: Document | ShadowRoot;
|
|
1504
|
-
}
|
|
1505
1635
|
/**
|
|
1506
1636
|
* Define a CSS @property custom property.
|
|
1507
1637
|
* This enables advanced features like animating custom properties.
|
|
@@ -1528,7 +1658,7 @@ interface PropertyOptions {
|
|
|
1528
1658
|
* });
|
|
1529
1659
|
* ```
|
|
1530
1660
|
*/
|
|
1531
|
-
declare function property
|
|
1661
|
+
declare function property(name: string, options?: PropertyOptions): void;
|
|
1532
1662
|
/**
|
|
1533
1663
|
* Check if a CSS @property has already been defined
|
|
1534
1664
|
*
|
|
@@ -1550,23 +1680,44 @@ declare function fontFace(family: string, descriptors: FontFaceDescriptors, opti
|
|
|
1550
1680
|
/**
|
|
1551
1681
|
* Inject a CSS @counter-style rule.
|
|
1552
1682
|
*
|
|
1553
|
-
* Permanent and global — no dispose or ref-counting.
|
|
1554
|
-
*
|
|
1683
|
+
* Permanent and global — no dispose or ref-counting. Deduplicates by name and
|
|
1684
|
+
* overrides an existing rule by default. Pass `weak: true` for global
|
|
1685
|
+
* `configure()` definitions, which never clobber an existing rule.
|
|
1555
1686
|
*/
|
|
1556
1687
|
declare function counterStyle(name: string, descriptors: CounterStyleDescriptors, options?: {
|
|
1557
1688
|
root?: Document | ShadowRoot;
|
|
1689
|
+
weak?: boolean;
|
|
1690
|
+
}): void;
|
|
1691
|
+
/**
|
|
1692
|
+
* Inject a CSS @function rule (custom function).
|
|
1693
|
+
*
|
|
1694
|
+
* Permanent and global — no dispose or ref-counting. Deduplicates by function
|
|
1695
|
+
* name and overrides an existing rule by default. Pass `weak: true` for global
|
|
1696
|
+
* `configure()` definitions, which never clobber an existing rule.
|
|
1697
|
+
*
|
|
1698
|
+
* @param name - The function name (`$$name`, `$name`, or `--name`)
|
|
1699
|
+
* @param definition - Function definition (args, returns, result, local vars)
|
|
1700
|
+
*
|
|
1701
|
+
* @example
|
|
1702
|
+
* ```ts
|
|
1703
|
+
* func('$$negative', { args: ['$value'], result: '(-1 * $value)' });
|
|
1704
|
+
* ```
|
|
1705
|
+
*/
|
|
1706
|
+
declare function func(name: string, definition: FunctionDefinition, options?: {
|
|
1707
|
+
root?: Document | ShadowRoot;
|
|
1708
|
+
weak?: boolean;
|
|
1558
1709
|
}): void;
|
|
1559
1710
|
/**
|
|
1560
1711
|
* Get CSS text from all sheets (for SSR)
|
|
1561
1712
|
*/
|
|
1562
|
-
declare function
|
|
1713
|
+
declare function getCSSText(options?: {
|
|
1563
1714
|
root?: Document | ShadowRoot;
|
|
1564
1715
|
}): string;
|
|
1565
1716
|
/**
|
|
1566
1717
|
* Collect only CSS used by a rendered subtree (like jest-styled-components).
|
|
1567
1718
|
* Pass the container returned by render(...).
|
|
1568
1719
|
*/
|
|
1569
|
-
declare function
|
|
1720
|
+
declare function getCSSTextForNode(node: ParentNode | Element | DocumentFragment, options?: {
|
|
1570
1721
|
root?: Document | ShadowRoot;
|
|
1571
1722
|
}): string;
|
|
1572
1723
|
/**
|
|
@@ -1589,10 +1740,6 @@ declare function touch(className: string, options?: {
|
|
|
1589
1740
|
* @returns Number of styles evicted.
|
|
1590
1741
|
*/
|
|
1591
1742
|
declare function gc(options?: GCOptions): number;
|
|
1592
|
-
/**
|
|
1593
|
-
* Check if we're currently running in a test environment
|
|
1594
|
-
*/
|
|
1595
|
-
declare function getIsTestEnvironment(): boolean;
|
|
1596
1743
|
/**
|
|
1597
1744
|
* Get the global injector instance for debugging
|
|
1598
1745
|
*/
|
|
@@ -1664,25 +1811,11 @@ declare const dotize: {
|
|
|
1664
1811
|
*/
|
|
1665
1812
|
declare function resolveRecipes(styles: Styles): Styles;
|
|
1666
1813
|
//#endregion
|
|
1667
|
-
//#region src/utils/warnings.d.ts
|
|
1668
|
-
declare function warn(...args: unknown[]): void;
|
|
1669
|
-
declare function deprecationWarning(condition: unknown, {
|
|
1670
|
-
property,
|
|
1671
|
-
name,
|
|
1672
|
-
betterAlternative,
|
|
1673
|
-
reason
|
|
1674
|
-
}: {
|
|
1675
|
-
property: string;
|
|
1676
|
-
name: string;
|
|
1677
|
-
betterAlternative: (() => string) | string;
|
|
1678
|
-
reason?: (() => string) | string;
|
|
1679
|
-
}): void;
|
|
1680
|
-
//#endregion
|
|
1681
1814
|
//#region src/utils/process-tokens.d.ts
|
|
1682
1815
|
/**
|
|
1683
1816
|
* Process tokens object into inline style properties.
|
|
1684
|
-
* -
|
|
1685
|
-
* -
|
|
1817
|
+
* - `$name` -> `--name` with the parsed value
|
|
1818
|
+
* - `#name` -> `--name-color` with the parsed value
|
|
1686
1819
|
*
|
|
1687
1820
|
* @param tokens - The tokens object to process
|
|
1688
1821
|
* @returns CSSProperties object or undefined if no tokens to process
|
|
@@ -1701,19 +1834,19 @@ interface DebugOptions {
|
|
|
1701
1834
|
/** Suppress console logging and return data only (default: false) */
|
|
1702
1835
|
raw?: boolean;
|
|
1703
1836
|
}
|
|
1704
|
-
interface
|
|
1837
|
+
interface CSSOptions extends DebugOptions {
|
|
1705
1838
|
prettify?: boolean;
|
|
1706
1839
|
/** Read from stored source CSS (dev-mode only) instead of live CSSOM */
|
|
1707
1840
|
source?: boolean;
|
|
1708
1841
|
}
|
|
1709
|
-
interface
|
|
1842
|
+
interface DebugChunkInfo {
|
|
1710
1843
|
className: string;
|
|
1711
1844
|
chunkName: string | null;
|
|
1712
1845
|
}
|
|
1713
1846
|
interface InspectResult {
|
|
1714
1847
|
element?: Element | null;
|
|
1715
1848
|
classes: string[];
|
|
1716
|
-
chunks:
|
|
1849
|
+
chunks: DebugChunkInfo[];
|
|
1717
1850
|
css: string;
|
|
1718
1851
|
size: number;
|
|
1719
1852
|
rules: number;
|
|
@@ -1762,7 +1895,7 @@ interface Summary {
|
|
|
1762
1895
|
chunkBreakdown: ChunkBreakdown;
|
|
1763
1896
|
}
|
|
1764
1897
|
declare const tastyDebug: {
|
|
1765
|
-
css(target: CSSTarget, opts?:
|
|
1898
|
+
css(target: CSSTarget, opts?: CSSOptions): string;
|
|
1766
1899
|
inspect(target: string | Element, opts?: DebugOptions): InspectResult;
|
|
1767
1900
|
summary(opts?: DebugOptions): Summary;
|
|
1768
1901
|
chunks(opts?: DebugOptions): ChunkBreakdown;
|
|
@@ -1774,5 +1907,5 @@ declare const tastyDebug: {
|
|
|
1774
1907
|
install(): void;
|
|
1775
1908
|
};
|
|
1776
1909
|
//#endregion
|
|
1777
|
-
export {
|
|
1778
|
-
//# sourceMappingURL=index-
|
|
1910
|
+
export { okhstFunction as $, PositionStyleProps as $t, keyframes as A, TastyElementProps as At, ChunkInfo as B, BaseStyleProps as Bt, getCSSTextForNode as C, ResolveModPropDef as Ct, injectRawCSS as D, SubElementProps as Dt, injectGlobal as E, SubElementDefinition as Et, ComputeStylesOptions as F, WithVariant as Ft, DIMENSION_CHUNK_STYLES as G, ContainerStyleProps as Gt, APPEARANCE_CHUNK_STYLES as H, BlockOuterStyleProps as Ht, ComputeStylesResult as I, tasty as It, LAYOUT_CHUNK_STYLES as J, FlowStyleProps as Jt, DISPLAY_CHUNK_STYLES as K, DimensionStyleProps as Kt, computeStyles as L, AllBaseProps as Lt, touch as M, TastyProps as Mt, ChunkSheetRegistry as N, TokenPropsInput as Nt, injector as O, TastyComponentPropsWithDefaults as Ot, chunkSheetRegistry as P, VariantMap as Pt, createColorFunc as Q, OuterStyleProps as Qt, defineHandler as R, BaseProps as Rt, getCSSText as S, DEFAULT_ZERO_NAME_PREFIX as Sn, ResolveAsProps as St, inject as T, ResolveTokenProps as Tt, CHUNK_NAMES as U, BlockStyleProps as Ut, categorizeStyleKeys as V, BlockInnerStyleProps as Vt, ChunkName as W, ColorStyleProps as Wt, STYLE_TO_CHUNK as X, ModValue as Xt, POSITION_CHUNK_STYLES as Y, InnerStyleProps as Yt, resolveFunctionColor as Z, Mods as Zt, createInjector as _, INNER_STYLES as _n, AllBasePropsWithMods as _t, DebugOptions as a, TastyThemeNames as an, TastyBatchProviderProps as at, func as b, TEXT_STYLES as bn, ModPropDef as bt, tastyDebug as c, Tokens as cn, useCounterStyle as ct, dotize as d, BLOCK_OUTER_STYLES as dn, useProperty as dt, ShortGridStyles as en, okhstPlugin as et, _modAttrs as f, BLOCK_STYLES as fn, useKeyframes as ft, counterStyle as g, FLOW_STYLES as gn, useStyles as gt, cleanup as h, DIMENSION_STYLES as hn, UseStylesResult as ht, DebugChunkInfo as i, TastyExtensionConfig as in, TastyBatchProvider as it, property as j, TastyPolymorphicComponent as jt, isPropertyDefined as k, TastyElementOptions as kt, processTokens as l, BASE_STYLES as ln, useFontFace as lt, filterBaseProps as m, CONTAINER_STYLES as mn, useGlobalStyles as mt, CacheStatus as n, TastyBaseStylePropNames as nn, okhslPlugin as nt, InspectResult as o, TextStyleProps as on, UseFunctionOptions as ot, color$1 as p, COLOR_STYLES as pn, useRawCSS as pt, FONT_CHUNK_STYLES as q, ExtraBaseStyleProps as qt, ChunkBreakdown as r, TastyCustomProps as rn, getDisplayName as rt, Summary as s, TokenValue as sn, useFunction as st, CSSOptions as t, TagName as tn, okhslFunction as tt, resolveRecipes as u, BLOCK_INNER_STYLES as un, UsePropertyOptions as ut, destroy as v, OUTER_STYLES as vn, Element$1 as vt, getRawCSSText as w, ResolveModProps as wt, gc as x, DEFAULT_NAME_PREFIX as xn, ModPropsInput as xt, fontFace as y, POSITION_STYLES as yn, ElementsDefinition as yt, styleHandlers as z, BasePropsWithoutChildren as zt };
|
|
1911
|
+
//# sourceMappingURL=index-CBK778ne.d.ts.map
|