@tenphi/tasty 0.0.0-snapshot.1d29633 → 0.0.0-snapshot.1f1c00a

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.
Files changed (122) hide show
  1. package/README.md +152 -134
  2. package/dist/{babel-Cg-mJV_t.d.ts → babel-rZcEwPLM.d.ts} +2 -3
  3. package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
  4. package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
  5. package/dist/chunks/build-config-CL4eRu2z.js +42 -0
  6. package/dist/chunks/build-config-CL4eRu2z.js.map +1 -0
  7. package/dist/{collector-BMT05AmU.js → chunks/collector-D2ARGT2L.js} +21 -117
  8. package/dist/chunks/collector-D2ARGT2L.js.map +1 -0
  9. package/dist/chunks/config-engine-DEmmPPdp.js +272 -0
  10. package/dist/chunks/config-engine-DEmmPPdp.js.map +1 -0
  11. package/dist/chunks/css-definitions-DotDkIXt.js +876 -0
  12. package/dist/chunks/css-definitions-DotDkIXt.js.map +1 -0
  13. package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
  14. package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
  15. package/dist/chunks/debug-D8pg9RGI.js +502 -0
  16. package/dist/chunks/debug-D8pg9RGI.js.map +1 -0
  17. package/dist/chunks/dsl-DRhFWQzo.js +1378 -0
  18. package/dist/chunks/dsl-DRhFWQzo.js.map +1 -0
  19. package/dist/chunks/hydration-TRcz5vnk.js +41 -0
  20. package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
  21. package/dist/chunks/react-runtime-BpxlOTbO.js +562 -0
  22. package/dist/chunks/react-runtime-BpxlOTbO.js.map +1 -0
  23. package/dist/chunks/runtime-engine-CKFXUH-A.js +2416 -0
  24. package/dist/chunks/runtime-engine-CKFXUH-A.js.map +1 -0
  25. package/dist/chunks/runtime-state-BxaLhVdP.js +127 -0
  26. package/dist/chunks/runtime-state-BxaLhVdP.js.map +1 -0
  27. package/dist/{merge-styles-CkAcnd0Z.js → chunks/shared-utils-y-HjvPN4.js} +60 -55
  28. package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
  29. package/dist/chunks/style-engine-BBbBuSkT.js +5260 -0
  30. package/dist/chunks/style-engine-BBbBuSkT.js.map +1 -0
  31. package/dist/{css-writer-b02uBqNF.js → chunks/zero-engine-gJrKBRiw.js} +6 -121
  32. package/dist/chunks/zero-engine-gJrKBRiw.js.map +1 -0
  33. package/dist/{collector-BFuqdF2F.d.ts → collector-w4mBj5gd.d.ts} +23 -4
  34. package/dist/{config-DmFxnBxg.d.ts → config-CZWCzBr6.d.ts} +171 -72
  35. package/dist/core/index.d.ts +5 -5
  36. package/dist/core/index.js +9 -6
  37. package/dist/{index-D1nMkpUe.d.ts → index-G9JuwM9p.d.ts} +263 -247
  38. package/dist/index.d.ts +5 -5
  39. package/dist/index.js +11 -921
  40. package/dist/{merge-styles-Cx_6ySBv.d.ts → merge-styles-VXwJ0Frr.d.ts} +2 -3
  41. package/dist/ssr/astro-client.d.ts +1 -1
  42. package/dist/ssr/astro-client.js +1 -14
  43. package/dist/ssr/astro-client.js.map +1 -1
  44. package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
  45. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  46. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract.d.ts +10 -0
  48. package/dist/ssr/astro-middleware-extract.js +9 -0
  49. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  50. package/dist/ssr/astro-middleware-static.d.ts +3 -2
  51. package/dist/ssr/astro-middleware-static.js +0 -11
  52. package/dist/ssr/astro-middleware-static.js.map +1 -1
  53. package/dist/ssr/astro-middleware.d.ts +3 -2
  54. package/dist/ssr/astro-middleware.js +0 -12
  55. package/dist/ssr/astro-middleware.js.map +1 -1
  56. package/dist/ssr/astro.d.ts +40 -6
  57. package/dist/ssr/astro.js +157 -93
  58. package/dist/ssr/astro.js.map +1 -1
  59. package/dist/ssr/index.d.ts +10 -11
  60. package/dist/ssr/index.js +4 -4
  61. package/dist/ssr/index.js.map +1 -1
  62. package/dist/ssr/next-config.d.ts +64 -0
  63. package/dist/ssr/next-config.js +128 -0
  64. package/dist/ssr/next-config.js.map +1 -0
  65. package/dist/ssr/next.d.ts +9 -8
  66. package/dist/ssr/next.js +29 -43
  67. package/dist/ssr/next.js.map +1 -1
  68. package/dist/static/index.d.ts +8 -9
  69. package/dist/static/index.js +4 -22
  70. package/dist/static/index.js.map +1 -1
  71. package/dist/static/inject.d.ts +1 -2
  72. package/dist/{index-LC3O3Jj4.d.ts → types-JEY8PVYP.d.ts} +862 -811
  73. package/dist/zero/babel.d.ts +1 -1
  74. package/dist/zero/babel.js +41 -107
  75. package/dist/zero/babel.js.map +1 -1
  76. package/dist/zero/index.d.ts +6 -7
  77. package/dist/zero/index.js +1 -1
  78. package/dist/zero/next.d.ts +3 -5
  79. package/dist/zero/next.js +0 -31
  80. package/dist/zero/next.js.map +1 -1
  81. package/docs/README.md +13 -8
  82. package/docs/adoption.md +56 -31
  83. package/docs/ai-agents.md +107 -80
  84. package/docs/comparison.md +69 -40
  85. package/docs/configuration.md +179 -114
  86. package/docs/debug.md +19 -7
  87. package/docs/design-system.md +41 -22
  88. package/docs/dsl.md +310 -201
  89. package/docs/getting-started.md +64 -41
  90. package/docs/injector.md +63 -26
  91. package/docs/methodology.md +44 -38
  92. package/docs/migration-v3.md +49 -49
  93. package/docs/pipeline.md +32 -8
  94. package/docs/plugins.md +38 -34
  95. package/docs/react-api.md +67 -44
  96. package/docs/runtime-benchmarks.md +388 -0
  97. package/docs/ssr.md +219 -61
  98. package/docs/styles.md +95 -18
  99. package/docs/tasty-static.md +138 -105
  100. package/package.json +104 -33
  101. package/dist/async-storage-DKK-wTD4.js +0 -44
  102. package/dist/async-storage-DKK-wTD4.js.map +0 -1
  103. package/dist/collector-BMT05AmU.js.map +0 -1
  104. package/dist/config-DF93rL3u.js +0 -12661
  105. package/dist/config-DF93rL3u.js.map +0 -1
  106. package/dist/context-CA8YKeMn.js +0 -24
  107. package/dist/context-CA8YKeMn.js.map +0 -1
  108. package/dist/core-B5ybnMP1.js +0 -1529
  109. package/dist/core-B5ybnMP1.js.map +0 -1
  110. package/dist/css-writer-b02uBqNF.js.map +0 -1
  111. package/dist/format-global-rules-DklyaXv-.js +0 -22
  112. package/dist/format-global-rules-DklyaXv-.js.map +0 -1
  113. package/dist/format-rules-Cs4e3M9m.js +0 -130
  114. package/dist/format-rules-Cs4e3M9m.js.map +0 -1
  115. package/dist/hydrate-aaUSNJZJ.js +0 -37
  116. package/dist/hydrate-aaUSNJZJ.js.map +0 -1
  117. package/dist/index.js.map +0 -1
  118. package/dist/keyframes-BedEzEXk.js +0 -424
  119. package/dist/keyframes-BedEzEXk.js.map +0 -1
  120. package/dist/merge-styles-CkAcnd0Z.js.map +0 -1
  121. package/dist/resolve-recipes-CiyLtJG9.js +0 -144
  122. package/dist/resolve-recipes-CiyLtJG9.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,921 +1,11 @@
1
- import { $ as SheetManager, A as FLOW_STYLES, At as STYLE_TO_CHUNK, B as createStateParserContext, Bt as getGlobalParser, C as BASE_STYLES, Ct as APPEARANCE_CHUNK_STYLES, D as COLOR_STYLES, Dt as FONT_CHUNK_STYLES, E as BLOCK_STYLES, Et as DISPLAY_CHUNK_STYLES, Ft as registerFunctionPolyfill, G as StyleInjector, Gt as stringifyStyles, Ht as normalizeColorTokenValue, I as isSelector, Jt as okhslFunction, Kt as okhstFunction, L as renderStyles, Lt as CUSTOM_UNITS, M as OUTER_STYLES, Mt as formatFunctionRule, N as POSITION_STYLES, O as CONTAINER_STYLES, Ot as LAYOUT_CHUNK_STYLES, P as TEXT_STYLES, Pt as parseFunctionName, Qt as StyleParser, R as parseStateKey, Rt as DIRECTIONS, S as baseStylePropsRegistry, St as propHandlerRegistry, T as BLOCK_OUTER_STYLES, Tt as DIMENSION_CHUNK_STYLES, U as getGlobalPredefinedStates, Ut as parseColor, Vt as getGlobalPredefinedTokens, W as setGlobalPredefinedStates, Wt as parseStyle, X as fontFaceContentHash, Xt as createColorFunc, Yt as okhslPlugin, Z as formatFontFaceRule, _ as isFunctionsPolyfillEnabled, _t as hashString, a as getGlobalCounterStyles, an as hslToRgbValues, at as closeBatchWindow, b as resetConfig, c as getGlobalInjector, ct as openBatchWindow, dt as DEFAULT_ZERO_NAME_PREFIX, en as resolveFunctionColor, f as getNamePrefix, g as isConfigLocked, h as hasStylesGenerated, in as hexToRgb, j as INNER_STYLES, k as DIMENSION_STYLES, kt as POSITION_CHUNK_STYLES, l as getGlobalKeyframes, lt as resetStyleBatch, m as hasGlobalRecipes, mt as makeKeyframeName, n as getConfig, nn as getNamedColorHex, nt as styleHandlers, o as getGlobalFontFaces, on as strToRgb, ot as flushStyles, p as hasGlobalKeyframes, pt as makeCounterStyleName, q as formatCounterStyleRule, qt as okhstPlugin, rn as getRgbValuesFromRgbaString, s as getGlobalFunctions, st as hasPendingStyleWrites, t as configure, tt as defineHandler, u as getGlobalRecipes, ut as DEFAULT_NAME_PREFIX, v as isTestEnvironment, w as BLOCK_INNER_STYLES, wt as CHUNK_NAMES, x as generateTypographyTokens, zt as filterMods } from "./config-DF93rL3u.js";
2
- import { l as categorizeStyleKeys } from "./keyframes-BedEzEXk.js";
3
- import { A as property, C as getRawCSSText, D as injector, E as injectRawCSS, M as ChunkSheetRegistry, N as chunkSheetRegistry, O as isPropertyDefined, S as getCSSTextForNode, T as injectGlobal, _ as destroy, a as color, b as gc, c as hasKeys, d as collectAutoInferredPropertiesRSC, f as getStyleTarget, g as createInjector, h as counterStyle, i as _modAttrs, j as touch, k as keyframes, l as formatKeyframesCSS, m as cleanup, n as processTokens, o as filterBaseProps, p as pushRSCCSS, r as dotize, s as computeStyles, t as tastyDebug, u as collectAutoInferredProperties, v as fontFace, w as inject, x as getCSSText, y as func } from "./core-B5ybnMP1.js";
4
- import { n as formatPropertyCSS } from "./format-rules-Cs4e3M9m.js";
5
- import { t as mergeStyles } from "./merge-styles-CkAcnd0Z.js";
6
- import { t as resolveRecipes } from "./resolve-recipes-CiyLtJG9.js";
7
- import { t as getTastySSRContext } from "./context-CA8YKeMn.js";
8
- import { t as formatGlobalRules } from "./format-global-rules-DklyaXv-.js";
9
- import { Fragment, createElement, forwardRef, useContext, useInsertionEffect } from "react";
10
- //#region src/utils/get-display-name.ts
11
- const DEFAULT_NAME = "Anonymous";
12
- function getDisplayName(Component, fallbackName = DEFAULT_NAME) {
13
- if (typeof Component === "function") return Component.displayName ?? Component.name ?? fallbackName;
14
- return fallbackName;
15
- }
16
- //#endregion
17
- //#region src/utils/is-valid-element-type.ts
18
- /**
19
- * Lightweight replacement for `react-is`'s isValidElementType.
20
- * Detects string tags, function/class components, and React exotic types
21
- * (forwardRef, memo, lazy, etc.) via their internal $$typeof symbol.
22
- */
23
- function isValidElementType(value) {
24
- if (typeof value === "string" || typeof value === "function") return true;
25
- if (typeof value === "object" && value !== null) return typeof value.$$typeof === "symbol";
26
- return false;
27
- }
28
- //#endregion
29
- //#region src/tasty.tsx
30
- /**
31
- * Precalculated entries for performance optimization
32
- */
33
- const IS_PROPERTIES_ENTRIES = Object.entries({
34
- isDisabled: "disabled",
35
- isHidden: "hidden",
36
- isChecked: "checked"
37
- });
38
- /**
39
- * Helper function to handle is* properties consistently
40
- * Transforms is* props to HTML attributes and adds corresponding data-* attributes
41
- */
42
- function handleIsProperties(props) {
43
- for (const [isProperty, targetAttribute] of IS_PROPERTIES_ENTRIES) {
44
- if (isProperty in props) {
45
- props[targetAttribute] = props[isProperty];
46
- delete props[isProperty];
47
- }
48
- const dataAttribute = `data-${targetAttribute}`;
49
- if (!(dataAttribute in props) && props[targetAttribute]) props[dataAttribute] = "";
50
- }
51
- }
52
- /**
53
- * Creates a sub-element component for compound component patterns.
54
- * Sub-elements are lightweight components with data-element attribute for CSS targeting.
55
- */
56
- function createSubElement(elementName, definition) {
57
- const config = typeof definition === "string" ? { as: definition } : definition;
58
- const tag = config.as ?? "div";
59
- const defaultQa = config.qa;
60
- const defaultQaVal = config.qaVal;
61
- const SubElement = forwardRef((props, ref) => {
62
- const { qa, qaVal, mods, tokens, isDisabled, isHidden, isChecked, className, style, ...htmlProps } = props;
63
- let modDataAttrs;
64
- if (mods) modDataAttrs = _modAttrs(mods);
65
- const tokenStyle = tokens ? processTokens(tokens) : void 0;
66
- let mergedStyle;
67
- if (tokenStyle || style) mergedStyle = tokenStyle && style ? {
68
- ...tokenStyle,
69
- ...style
70
- } : tokenStyle ?? style;
71
- const elementProps = {
72
- "data-element": elementName,
73
- "data-qa": qa ?? defaultQa,
74
- "data-qaval": qaVal ?? defaultQaVal,
75
- ...modDataAttrs || {},
76
- ...htmlProps,
77
- className,
78
- style: mergedStyle,
79
- isDisabled,
80
- isHidden,
81
- isChecked,
82
- ref
83
- };
84
- handleIsProperties(elementProps);
85
- if (elementProps["data-qa"] === void 0) delete elementProps["data-qa"];
86
- if (elementProps["data-qaval"] === void 0) delete elementProps["data-qaval"];
87
- return createElement(tag, elementProps);
88
- });
89
- SubElement.displayName = `SubElement(${elementName})`;
90
- return SubElement;
91
- }
92
- /**
93
- * Pre-compute the mapping from prop name to token key at component-creation time.
94
- * Array form: `'progress'` -> `'$progress'`, `'accentColor'` -> `'#accent'`.
95
- * Object form: entries used as-is.
96
- */
97
- function buildTokenPropsMapping(def) {
98
- if (Array.isArray(def)) return def.map((propName) => {
99
- if (propName.endsWith("Color") && propName.length > 5) return [propName, `#${propName.slice(0, -5)}`];
100
- return [propName, `$${propName}`];
101
- });
102
- return Object.entries(def);
103
- }
104
- function tasty(Component, options) {
105
- if (isValidElementType(Component)) return tastyWrap(Component, options);
106
- return tastyElement(Component);
107
- }
108
- function tastyWrap(Component, options) {
109
- const { as: extendTag, element: extendElement, styleProps: _styleProps, modProps: _modProps, tokenProps: _tokenProps, variants: _variants, elements: _elements, ...defaultProps } = options ?? {};
110
- const propsWithStyles = ["styles"].concat(Object.keys(defaultProps).filter((prop) => prop.endsWith("Styles")));
111
- const _WrappedComponent = forwardRef((props, ref) => {
112
- const { as, element, ...restProps } = props;
113
- const mergedStylesMap = propsWithStyles.reduce((map, prop) => {
114
- const restValue = restProps[prop];
115
- const defaultValue = defaultProps[prop];
116
- if (restValue != null && defaultValue != null) map[prop] = mergeStyles(defaultValue, restValue);
117
- else map[prop] = restValue ?? defaultValue;
118
- return map;
119
- }, {});
120
- return createElement(Component, {
121
- ...defaultProps,
122
- ...restProps,
123
- ...mergedStylesMap,
124
- as: as ?? extendTag,
125
- element: element || extendElement,
126
- ref
127
- });
128
- });
129
- _WrappedComponent.displayName = `TastyWrappedComponent(${getDisplayName(Component, defaultProps.qa ?? extendTag ?? "Anonymous")})`;
130
- return _WrappedComponent;
131
- }
132
- function tastyElement(tastyOptions) {
133
- const { as: originalAs = "div", element: defaultElement, styles: defaultStyles, styleProps, modProps: modPropsDef, tokenProps: tokenPropsDef, variants, tokens: defaultTokens, elements, ...defaultProps } = tastyOptions;
134
- let variantStylesMap;
135
- if (variants) {
136
- let baseStyles = defaultStyles;
137
- let extensionStyles;
138
- if (defaultStyles) for (const key of Object.keys(defaultStyles)) {
139
- if (isSelector(key)) continue;
140
- const value = defaultStyles[key];
141
- if (typeof value === "object" && value !== null && !Array.isArray(value) && !("" in value)) {
142
- if (!extensionStyles) {
143
- baseStyles = { ...defaultStyles };
144
- extensionStyles = {};
145
- }
146
- extensionStyles[key] = value;
147
- delete baseStyles[key];
148
- }
149
- }
150
- variantStylesMap = Object.entries(variants).reduce((map, [variant, variantStyles]) => {
151
- map[variant] = extensionStyles ? mergeStyles(baseStyles, variantStyles, extensionStyles) : mergeStyles(baseStyles, variantStyles);
152
- return map;
153
- }, {});
154
- if (!variantStylesMap["default"]) variantStylesMap["default"] = defaultStyles;
155
- }
156
- const { qa: defaultQa, qaVal: defaultQaVal, ...otherDefaultProps } = defaultProps ?? {};
157
- const ownPropsToCheck = styleProps ? styleProps.concat(BASE_STYLES) : BASE_STYLES;
158
- let propsToCheck = ownPropsToCheck;
159
- let propsToCheckVersion = -1;
160
- const modPropsKeys = modPropsDef ? Array.isArray(modPropsDef) ? modPropsDef : Object.keys(modPropsDef) : void 0;
161
- const tokenPropsMapping = tokenPropsDef ? buildTokenPropsMapping(tokenPropsDef) : void 0;
162
- const classNameCache = /* @__PURE__ */ new Map();
163
- const _TastyComponent = forwardRef((incomingProps, ref) => {
164
- const applyPropHandlers = propHandlerRegistry.apply;
165
- const { as, styles: rawStyles, variant, mods, element, qa, qaVal, className: userClassName, tokens, style, theme, ...otherProps } = applyPropHandlers ? applyPropHandlers(incomingProps) : incomingProps;
166
- let styles = rawStyles;
167
- let propStyles = null;
168
- if (propsToCheckVersion !== baseStylePropsRegistry.version) {
169
- const promoted = baseStylePropsRegistry.list;
170
- propsToCheck = promoted.length === 0 ? ownPropsToCheck : ownPropsToCheck.concat(promoted);
171
- propsToCheckVersion = baseStylePropsRegistry.version;
172
- }
173
- for (const prop of propsToCheck) {
174
- const key = prop;
175
- if (key in otherProps) {
176
- if (!propStyles) propStyles = {};
177
- const value = otherProps[key];
178
- propStyles[key] = value;
179
- delete otherProps[key];
180
- }
181
- }
182
- if (!styles || styles && !hasKeys(styles)) styles = void 0;
183
- let propMods;
184
- if (modPropsKeys) {
185
- for (const key of modPropsKeys) if (key in otherProps) {
186
- if (!propMods) propMods = {};
187
- propMods[key] = otherProps[key];
188
- delete otherProps[key];
189
- }
190
- }
191
- let propTokens;
192
- if (tokenPropsMapping) {
193
- for (const [propName, tokenKey] of tokenPropsMapping) if (propName in otherProps) {
194
- if (!propTokens) propTokens = {};
195
- propTokens[tokenKey] = otherProps[propName];
196
- delete otherProps[propName];
197
- }
198
- }
199
- const baseStyles = variantStylesMap ? variantStylesMap[variant || "default"] ?? variantStylesMap["default"] : defaultStyles;
200
- const hasInstanceStyles = styles && hasKeys(styles);
201
- const hasPropStyles = propStyles && hasKeys(propStyles);
202
- const allStyles = hasInstanceStyles || hasPropStyles ? mergeStyles(baseStyles, styles, propStyles) : baseStyles;
203
- const useFactoryCache = typeof document !== "undefined";
204
- let stylesResult;
205
- if (useFactoryCache && allStyles === baseStyles && classNameCache.has(allStyles)) {
206
- stylesResult = { className: classNameCache.get(allStyles) };
207
- touch(stylesResult.className);
208
- } else {
209
- stylesResult = computeStyles(allStyles);
210
- if (useFactoryCache && allStyles === baseStyles) classNameCache.set(allStyles, stylesResult.className);
211
- }
212
- let mergedTokens;
213
- if (defaultTokens || tokens || propTokens) if (!defaultTokens && !propTokens) mergedTokens = tokens;
214
- else if (!tokens && !propTokens) mergedTokens = defaultTokens;
215
- else mergedTokens = {
216
- ...defaultTokens,
217
- ...tokens,
218
- ...propTokens
219
- };
220
- const processedTokenStyle = processTokens(mergedTokens);
221
- let mergedStyle;
222
- if (processedTokenStyle || style) if (!processedTokenStyle) mergedStyle = style;
223
- else if (!style) mergedStyle = processedTokenStyle;
224
- else mergedStyle = {
225
- ...processedTokenStyle,
226
- ...style
227
- };
228
- const mergedMods = propMods ? {
229
- ...mods,
230
- ...propMods
231
- } : mods;
232
- let modDataAttrs;
233
- if (mergedMods) modDataAttrs = _modAttrs(mergedMods);
234
- const finalClassName = [userClassName || "", stylesResult.className].filter(Boolean).join(" ");
235
- const elementProps = {
236
- "data-element": element || defaultElement,
237
- "data-qa": qa || defaultQa,
238
- "data-qaval": qaVal || defaultQaVal,
239
- "data-theme": theme,
240
- ...otherDefaultProps,
241
- ...modDataAttrs || {},
242
- ...otherProps,
243
- className: finalClassName,
244
- style: mergedStyle,
245
- ref
246
- };
247
- handleIsProperties(elementProps);
248
- if (elementProps["data-theme"] === void 0) delete elementProps["data-theme"];
249
- const el = createElement(as ?? originalAs, elementProps);
250
- if (stylesResult.css) {
251
- const nonce = getConfig().nonce;
252
- return createElement(Fragment, null, createElement("style", {
253
- "data-tasty-rsc": "",
254
- nonce,
255
- dangerouslySetInnerHTML: { __html: stylesResult.css }
256
- }), el);
257
- }
258
- return el;
259
- });
260
- _TastyComponent.displayName = `TastyComponent(${defaultProps.qa || originalAs})`;
261
- if (elements) {
262
- const subElements = Object.entries(elements).reduce((acc, [name, definition]) => {
263
- acc[name] = createSubElement(name, definition);
264
- return acc;
265
- }, {});
266
- return Object.assign(_TastyComponent, subElements);
267
- }
268
- return _TastyComponent;
269
- }
270
- const Element = tasty({});
271
- //#endregion
272
- //#region src/hooks/useStyles.ts
273
- /**
274
- * Hook to generate CSS classes from Tasty styles.
275
- * Thin wrapper around `computeStyles()` that adds React context-based
276
- * SSR collector discovery for backward compatibility with TastyRegistry.
277
- *
278
- * For hook-free usage (e.g. in server components), use `computeStyles()` directly.
279
- *
280
- * @example
281
- * ```tsx
282
- * function MyComponent() {
283
- * const { className } = useStyles({
284
- * padding: '2x',
285
- * fill: '#purple',
286
- * radius: '1r',
287
- * });
288
- *
289
- * return <div className={className}>Styled content</div>;
290
- * }
291
- * ```
292
- */
293
- function useStyles(styles, options) {
294
- return computeStyles(styles, {
295
- ssrCollector: useContext(getTastySSRContext()),
296
- root: options?.root
297
- });
298
- }
299
- //#endregion
300
- //#region src/utils/client-state.ts
301
- /**
302
- * Build a per-(injector, root) client state cache for the standalone style
303
- * functions (`useGlobalStyles`, `useRawCSS`, `useKeyframes`, `useCounterStyle`).
304
- *
305
- * Two levels, both weak:
306
- *
307
- * - **injector** — `configure()` replaces the global injector, and every dispose
308
- * handle and generated name we cache belongs to the one that produced it.
309
- * Keying by injector makes stale state fall away with it, instead of letting
310
- * change-detection keys suppress re-injection into the new sheets.
311
- * - **root** — the same selector or slot name can be used in several shadow
312
- * roots, and each holds its own injection.
313
- */
314
- function createClientState(create) {
315
- const byInjector = /* @__PURE__ */ new WeakMap();
316
- return (root) => {
317
- const injector = getGlobalInjector();
318
- let byRoot = byInjector.get(injector);
319
- if (!byRoot) {
320
- byRoot = /* @__PURE__ */ new WeakMap();
321
- byInjector.set(injector, byRoot);
322
- }
323
- let state = byRoot.get(root);
324
- if (!state) {
325
- state = create();
326
- byRoot.set(root, state);
327
- }
328
- return state;
329
- };
330
- }
331
- //#endregion
332
- //#region src/hooks/useGlobalStyles.ts
333
- const getClientGlobalSlots = createClientState(() => /* @__PURE__ */ new Map());
334
- const noop = () => {};
335
- /**
336
- * Inject global styles for a given selector.
337
- * Useful for styling elements by selector without generating classNames.
338
- *
339
- * SSR-aware: when a ServerStyleCollector is available, CSS is collected
340
- * during the render phase instead of being injected into the DOM.
341
- *
342
- * Works in all environments: client, SSR with collector, and React Server Components.
343
- *
344
- * Injected styles are permanent — they are not cleaned up on component unmount.
345
- * Use the `id` option for update tracking when styles change over the
346
- * component lifecycle.
347
- *
348
- * Update tracking is per-slot and per-root: a slot (`id`, or the selector when
349
- * no `id` is given) holds exactly one injection per `root`. Changing the styles
350
- * replaces it; rendering styles that produce no CSS clears it.
351
- *
352
- * @param selector - CSS selector to apply styles to (e.g., '.my-class', ':root', 'body')
353
- * @param styles - Tasty styles object
354
- * @param options - Optional settings including `id` for update tracking
355
- *
356
- * @example
357
- * ```tsx
358
- * function MyComponent() {
359
- * useGlobalStyles('.card', {
360
- * padding: '2x',
361
- * radius: '1r',
362
- * fill: '#white',
363
- * });
364
- *
365
- * return <div className="card">Content</div>;
366
- * }
367
- * ```
368
- */
369
- function useGlobalStyles(selector, styles, options) {
370
- if (!styles) return;
371
- if (!selector) {
372
- console.warn("[Tasty] useGlobalStyles: selector is required and cannot be empty. Styles will not be injected.");
373
- return;
374
- }
375
- const target = getStyleTarget();
376
- const slots = target.mode === "client" ? getClientGlobalSlots(options?.root ?? document) : null;
377
- const slotKey = options?.id ?? selector;
378
- const stylesKey = slots ? JSON.stringify(styles) : "";
379
- const existing = slots?.get(slotKey);
380
- if (existing && existing.stylesKey === stylesKey) return;
381
- const resolvedStyles = resolveRecipes(styles);
382
- const styleResults = renderStyles(resolvedStyles, selector);
383
- if (styleResults.length === 0) {
384
- if (slots) {
385
- existing?.dispose();
386
- slots.set(slotKey, {
387
- stylesKey,
388
- dispose: noop
389
- });
390
- }
391
- return;
392
- }
393
- if (target.mode === "ssr") {
394
- target.collector.collectInternals();
395
- const css = formatGlobalRules(styleResults);
396
- if (css) {
397
- const key = options?.id ? `global:${options.id}` : `global:${selector}:${hashString(css)}`;
398
- target.collector.collectGlobalStyles(key, css, options?.id != null);
399
- }
400
- if (getConfig().autoPropertyTypes !== false) collectAutoInferredProperties(styleResults, target.collector, resolvedStyles);
401
- return;
402
- }
403
- if (target.mode === "rsc") {
404
- const css = formatGlobalRules(styleResults);
405
- if (css) {
406
- const key = options?.id ? `__global:${options.id}` : `__global:${selector}:${hashString(css)}`;
407
- pushRSCCSS(target.cache, key, css, options?.id != null);
408
- }
409
- if (getConfig().autoPropertyTypes !== false) collectAutoInferredPropertiesRSC(styleResults, target.cache, resolvedStyles);
410
- return;
411
- }
412
- if (slots) {
413
- existing?.dispose();
414
- const { dispose } = injectGlobal(styleResults, { root: options?.root });
415
- slots.set(slotKey, {
416
- stylesKey,
417
- dispose
418
- });
419
- }
420
- }
421
- //#endregion
422
- //#region src/utils/deps-equal.ts
423
- /**
424
- * Shallow comparison of two dependency arrays using Object.is semantics.
425
- * Returns true when both arrays have the same length and every element
426
- * at the same index is identical.
427
- */
428
- function depsEqual(a, b) {
429
- if (a.length !== b.length) return false;
430
- for (let i = 0; i < a.length; i++) if (!Object.is(a[i], b[i])) return false;
431
- return true;
432
- }
433
- //#endregion
434
- //#region src/hooks/useRawCSS.ts
435
- const getClientState$1 = createClientState(() => ({
436
- entries: /* @__PURE__ */ new Map(),
437
- contentDedup: /* @__PURE__ */ new Set(),
438
- factoryDeps: /* @__PURE__ */ new Map()
439
- }));
440
- /**
441
- * Inject raw CSS text directly without parsing.
442
- * This is a low-overhead alternative for injecting global CSS that doesn't need tasty processing.
443
- *
444
- * The CSS is inserted into a separate style element (data-tasty-raw) to avoid conflicts
445
- * with tasty's chunked style sheets.
446
- *
447
- * Works in all environments: client, SSR with collector, and React Server Components.
448
- *
449
- * Injected styles are permanent — they are not cleaned up on component unmount.
450
- * Use the `id` option for update tracking when styles change over the
451
- * component lifecycle.
452
- *
453
- * @example Static CSS string
454
- * ```tsx
455
- * function GlobalStyles() {
456
- * useRawCSS(`
457
- * body {
458
- * margin: 0;
459
- * padding: 0;
460
- * font-family: sans-serif;
461
- * }
462
- * `);
463
- *
464
- * return null;
465
- * }
466
- * ```
467
- *
468
- * @example Factory function with dependencies
469
- * ```tsx
470
- * function ThemeStyles({ theme }: { theme: 'light' | 'dark' }) {
471
- * useRawCSS(() => `
472
- * :root {
473
- * --bg-color: ${theme === 'dark' ? '#1a1a1a' : '#ffffff'};
474
- * --text-color: ${theme === 'dark' ? '#ffffff' : '#1a1a1a'};
475
- * }
476
- * `, [theme], { id: 'theme-vars' });
477
- *
478
- * return null;
479
- * }
480
- * ```
481
- *
482
- * @example With options
483
- * ```tsx
484
- * function ShadowStyles({ shadowRoot }) {
485
- * useRawCSS(() => `.scoped { color: red; }`, [], { root: shadowRoot });
486
- * return null;
487
- * }
488
- * ```
489
- */
490
- function useRawCSS(cssOrFactory, depsOrOptions, options) {
491
- const isFactory = typeof cssOrFactory === "function";
492
- const deps = isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : void 0;
493
- const opts = isFactory ? options : depsOrOptions;
494
- const target = getStyleTarget();
495
- const state = target.mode === "client" ? getClientState$1(opts?.root ?? document) : null;
496
- if (isFactory && deps && opts?.id && state) {
497
- const cachedDeps = state.factoryDeps.get(opts.id);
498
- if (cachedDeps && depsEqual(cachedDeps, deps)) return;
499
- }
500
- const css = isFactory ? cssOrFactory() : cssOrFactory;
501
- if (!css.trim()) return;
502
- if (target.mode === "ssr") {
503
- const key = opts?.id ? `raw:${opts.id}` : `raw:${hashString(css)}`;
504
- target.collector.collectRawCSS(key, css, opts?.id != null);
505
- return;
506
- }
507
- if (target.mode === "rsc") {
508
- const key = opts?.id ? `__raw:${opts.id}` : `__raw:${hashString(css)}`;
509
- pushRSCCSS(target.cache, key, css, opts?.id != null);
510
- return;
511
- }
512
- if (!state) return;
513
- const id = opts?.id;
514
- if (id) {
515
- const existing = state.entries.get(id);
516
- if (existing) {
517
- if (existing.contentKey === css) return;
518
- existing.dispose();
519
- }
520
- const { dispose } = injectRawCSS(css, opts);
521
- state.entries.set(id, {
522
- contentKey: css,
523
- dispose
524
- });
525
- if (deps) state.factoryDeps.set(id, deps);
526
- } else {
527
- const contentKey = hashString(css);
528
- if (state.contentDedup.has(contentKey)) return;
529
- state.contentDedup.add(contentKey);
530
- injectRawCSS(css, opts);
531
- }
532
- }
533
- //#endregion
534
- //#region src/hooks/useKeyframes.ts
535
- const getClientState = createClientState(() => ({
536
- contentToName: /* @__PURE__ */ new Map(),
537
- namedSlots: /* @__PURE__ */ new Map(),
538
- factoryDeps: /* @__PURE__ */ new Map()
539
- }));
540
- function useKeyframes(stepsOrFactory, depsOrOptions, options) {
541
- const isFactory = typeof stepsOrFactory === "function";
542
- const deps = isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : void 0;
543
- const opts = isFactory ? options : depsOrOptions;
544
- const target = getStyleTarget();
545
- const clientState = target.mode === "client" ? getClientState(opts?.root ?? document) : null;
546
- if (isFactory && deps && opts?.name && clientState) {
547
- const cached = clientState.factoryDeps.get(opts.name);
548
- if (cached && depsEqual(cached.deps, deps)) return cached.name;
549
- }
550
- const steps = isFactory ? stepsOrFactory() : stepsOrFactory;
551
- if (!steps || Object.keys(steps).length === 0) return "";
552
- if (target.mode === "ssr") {
553
- const actualName = target.collector.allocateKeyframeName(opts?.name);
554
- const css = formatKeyframesCSS(actualName, steps);
555
- target.collector.collectKeyframes(actualName, css);
556
- return actualName;
557
- }
558
- if (target.mode === "rsc") {
559
- const serializedContent = JSON.stringify(steps);
560
- const key = `__kf:${opts?.name ?? ""}:${serializedContent}`;
561
- const existingName = target.cache.generatedNames.get(key);
562
- if (existingName) return existingName;
563
- const actualName = opts?.name ?? makeKeyframeName(getNamePrefix(), hashString(serializedContent));
564
- const css = formatKeyframesCSS(actualName, steps);
565
- pushRSCCSS(target.cache, key, css);
566
- target.cache.generatedNames.set(key, actualName);
567
- return actualName;
568
- }
569
- const state = clientState ?? getClientState(opts?.root ?? document);
570
- const serializedContent = JSON.stringify(steps);
571
- const cacheKey = `${opts?.name ?? ""}:${serializedContent}`;
572
- const cachedName = state.contentToName.get(cacheKey);
573
- if (cachedName) return cachedName;
574
- const providedName = opts?.name;
575
- if (providedName) {
576
- const slot = state.namedSlots.get(providedName);
577
- if (slot && slot.cacheKey !== cacheKey) {
578
- slot.dispose();
579
- state.contentToName.delete(slot.cacheKey);
580
- state.namedSlots.delete(providedName);
581
- }
582
- }
583
- const result = keyframes(steps, {
584
- name: providedName,
585
- root: opts?.root
586
- });
587
- const name = result.toString();
588
- state.contentToName.set(cacheKey, name);
589
- if (providedName) {
590
- state.namedSlots.set(providedName, {
591
- cacheKey,
592
- dispose: result.dispose
593
- });
594
- if (deps) state.factoryDeps.set(providedName, {
595
- deps,
596
- name
597
- });
598
- }
599
- return name;
600
- }
601
- //#endregion
602
- //#region src/hooks/useProperty.ts
603
- /**
604
- * Register a CSS @property custom property.
605
- * This enables advanced features like animating custom properties.
606
- *
607
- * Note: @property rules are global and persistent once defined.
608
- * The function ensures the property is only registered once per root.
609
- *
610
- * Accepts tasty token syntax for the property name:
611
- * - `$name` → defines `--name`
612
- * - `#name` → defines `--name-color` (auto-sets syntax: '<color>', defaults initialValue: 'transparent')
613
- * - `--name` → defines `--name` (legacy format)
614
- *
615
- * Works in all environments: client, SSR with collector, and React Server Components.
616
- *
617
- * @param name - The property token ($name, #name) or CSS property name (--name)
618
- * @param options - Property configuration
619
- *
620
- * @example Basic property with token syntax
621
- * ```tsx
622
- * function Spinner() {
623
- * useProperty('$rotation', {
624
- * syntax: '<angle>',
625
- * inherits: false,
626
- * initialValue: '0deg',
627
- * });
628
- *
629
- * return <div className="spinner" />;
630
- * }
631
- * ```
632
- *
633
- * @example Color property with token syntax (auto-sets syntax)
634
- * ```tsx
635
- * function MyComponent() {
636
- * useProperty('#theme', {
637
- * initialValue: 'red', // syntax: '<color>' is auto-set
638
- * });
639
- *
640
- * // Now --theme-color can be animated with CSS transitions
641
- * return <div style={{ '--theme-color': 'blue' } as React.CSSProperties}>Colored</div>;
642
- * }
643
- * ```
644
- *
645
- * @example Legacy format (still supported)
646
- * ```tsx
647
- * function ResizableBox() {
648
- * useProperty('--box-size', {
649
- * syntax: '<length>',
650
- * initialValue: '100px',
651
- * });
652
- *
653
- * return <div style={{ width: 'var(--box-size)' }} />;
654
- * }
655
- * ```
656
- */
657
- function useProperty(name, options) {
658
- if (!name) {
659
- console.warn(`[Tasty] useProperty: property name is required`);
660
- return;
661
- }
662
- const target = getStyleTarget();
663
- if (target.mode === "ssr") {
664
- target.collector.collectInternals();
665
- const css = formatPropertyCSS(name, {
666
- syntax: options?.syntax,
667
- inherits: options?.inherits,
668
- initialValue: options?.initialValue
669
- });
670
- if (css) target.collector.collectProperty(name, css);
671
- return;
672
- }
673
- if (target.mode === "rsc") {
674
- const css = formatPropertyCSS(name, {
675
- syntax: options?.syntax,
676
- inherits: options?.inherits,
677
- initialValue: options?.initialValue
678
- });
679
- if (css) pushRSCCSS(target.cache, `__prop:${name}`, css);
680
- return;
681
- }
682
- const injector = getGlobalInjector();
683
- if (injector.isPropertyDefined(name, { root: options?.root })) return;
684
- injector.property(name, {
685
- syntax: options?.syntax,
686
- inherits: options?.inherits,
687
- initialValue: options?.initialValue,
688
- root: options?.root
689
- });
690
- }
691
- //#endregion
692
- //#region src/hooks/useFontFace.ts
693
- /**
694
- * Inject CSS @font-face rules.
695
- * Permanent — no cleanup on unmount. Deduplicates by content hash.
696
- *
697
- * Works in all environments: client, SSR with collector, and React Server Components.
698
- *
699
- * @param family - The font-family name
700
- * @param input - Single descriptor object or array of descriptors (for multiple weights/styles)
701
- * @param options - Optional settings (e.g. Shadow DOM root)
702
- *
703
- * @example Single weight
704
- * ```tsx
705
- * function App() {
706
- * useFontFace('Brand Sans', {
707
- * src: 'url("/fonts/brand-sans.woff2") format("woff2")',
708
- * fontWeight: '400 700',
709
- * fontDisplay: 'swap',
710
- * });
711
- *
712
- * return <div style={{ fontFamily: '"Brand Sans", sans-serif' }}>Hello</div>;
713
- * }
714
- * ```
715
- *
716
- * @example Multiple weights
717
- * ```tsx
718
- * function App() {
719
- * useFontFace('Brand Sans', [
720
- * { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
721
- * { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
722
- * ]);
723
- *
724
- * return <div style={{ fontFamily: '"Brand Sans", sans-serif' }}>Hello</div>;
725
- * }
726
- * ```
727
- */
728
- function useFontFace(family, input, options) {
729
- if (!family) return;
730
- const descriptors = Array.isArray(input) ? input : [input];
731
- const target = getStyleTarget();
732
- if (target.mode === "ssr") {
733
- for (const desc of descriptors) {
734
- const hash = fontFaceContentHash(family, desc);
735
- const css = formatFontFaceRule(family, desc);
736
- target.collector.collectFontFace(hash, css);
737
- }
738
- return;
739
- }
740
- if (target.mode === "rsc") {
741
- for (const desc of descriptors) {
742
- const hash = fontFaceContentHash(family, desc);
743
- const css = formatFontFaceRule(family, desc);
744
- pushRSCCSS(target.cache, `__ff:${hash}`, css);
745
- }
746
- return;
747
- }
748
- const injector = getGlobalInjector();
749
- for (const desc of descriptors) injector.fontFace(family, desc, { root: options?.root });
750
- }
751
- //#endregion
752
- //#region src/hooks/useCounterStyle.ts
753
- let clientCounterStyleCounter = 0;
754
- const getClientContentToName = createClientState(() => /* @__PURE__ */ new Map());
755
- /**
756
- * Inject a CSS @counter-style rule and return the generated name.
757
- * Permanent — no cleanup on unmount. Deduplicates by name.
758
- *
759
- * Works in all environments: client, SSR with collector, and React Server Components.
760
- *
761
- * @example Basic usage
762
- * ```tsx
763
- * function EmojiList() {
764
- * const styleName = useCounterStyle({
765
- * system: 'cyclic',
766
- * symbols: '"👍"',
767
- * suffix: '" "',
768
- * }, { name: 'thumbs' });
769
- *
770
- * return (
771
- * <ol style={{ listStyleType: styleName }}>
772
- * <li>First</li>
773
- * <li>Second</li>
774
- * </ol>
775
- * );
776
- * }
777
- * ```
778
- *
779
- */
780
- function useCounterStyle(descriptors, options) {
781
- if (!descriptors || !descriptors.system) return "";
782
- const target = getStyleTarget();
783
- if (target.mode === "ssr") {
784
- const actualName = target.collector.allocateCounterStyleName(options?.name);
785
- const css = formatCounterStyleRule(actualName, descriptors);
786
- target.collector.collectCounterStyle(actualName, css);
787
- return actualName;
788
- }
789
- if (target.mode === "rsc") {
790
- const serializedContent = JSON.stringify(descriptors);
791
- const key = `__cs:${options?.name ?? ""}:${serializedContent}`;
792
- const existingName = target.cache.generatedNames.get(key);
793
- if (existingName) return existingName;
794
- const actualName = options?.name ?? makeCounterStyleName(getNamePrefix(), hashString(serializedContent));
795
- const css = formatCounterStyleRule(actualName, descriptors);
796
- pushRSCCSS(target.cache, key, css);
797
- target.cache.generatedNames.set(key, actualName);
798
- return actualName;
799
- }
800
- const contentToName = getClientContentToName(options?.root ?? document);
801
- const serializedContent = JSON.stringify(descriptors);
802
- const cacheKey = `${options?.name ?? ""}:${serializedContent}`;
803
- const existingName = contentToName.get(cacheKey);
804
- if (existingName) return existingName;
805
- const name = options?.name ?? makeCounterStyleName(getNamePrefix(), String(clientCounterStyleCounter++));
806
- contentToName.set(cacheKey, name);
807
- getGlobalInjector().counterStyle(name, descriptors, { root: options?.root });
808
- return name;
809
- }
810
- //#endregion
811
- //#region src/hooks/useFunction.ts
812
- /**
813
- * Register a CSS @function (custom function).
814
- *
815
- * @function rules are global and persistent once defined. The hook ensures the
816
- * function is only registered once per root (deduplicated by function name).
817
- *
818
- * Accepts tasty token syntax for the function name:
819
- * - `$$name` → defines `--name` (matches the call site `$$name(...)`)
820
- * - `$name` / `--name` → also accepted
821
- *
822
- * Works in all environments: client, SSR with collector, and React Server Components.
823
- *
824
- * @param name - The function name token (`$$name`, `$name`, or `--name`)
825
- * @param definition - Function definition (args, returns, result, local vars)
826
- *
827
- * Call the function through the Tasty DSL, not a raw `style` prop: an inline
828
- * `style` value reaches the browser unparsed, so the `$$name(...)` sugar is never
829
- * expanded and `polyfills.functions` cannot rewrite it either.
830
- *
831
- * @example
832
- * ```tsx
833
- * const Box = tasty({ styles: { marginTop: '$$negative(10px)' } });
834
- *
835
- * function Layout() {
836
- * useFunction('$$negative', { args: ['$value'], result: '(-1 * $value)' });
837
- * return <Box />;
838
- * }
839
- * ```
840
- */
841
- function useFunction(name, definition, options) {
842
- if (!name) {
843
- console.warn(`[Tasty] useFunction: function name is required`);
844
- return;
845
- }
846
- if (isFunctionsPolyfillEnabled()) {
847
- registerFunctionPolyfill(name, definition);
848
- return;
849
- }
850
- const target = getStyleTarget();
851
- if (target.mode === "ssr") {
852
- target.collector.collectInternals();
853
- const css = formatFunctionRule(name, definition);
854
- if (css) target.collector.collectFunction(parseFunctionName(name), css);
855
- return;
856
- }
857
- if (target.mode === "rsc") {
858
- const css = formatFunctionRule(name, definition);
859
- if (css) pushRSCCSS(target.cache, `__func:${parseFunctionName(name)}`, css);
860
- return;
861
- }
862
- getGlobalInjector().func(name, definition, { root: options?.root });
863
- }
864
- //#endregion
865
- //#region src/batch-provider.tsx
866
- /**
867
- * Opens a *batch window* for the commit it renders in, so `batchInjection`
868
- * can defer stylesheet writes without ever letting a layout effect measure an
869
- * unstyled element.
870
- *
871
- * Every `insertRule()` on a live sheet invalidates style for that sheet's
872
- * scope. When components inject during React's render phase while others read
873
- * layout in the same pass, the two interleave and the browser recalculates
874
- * style between every injection. Batching collapses that into one invalidation
875
- * per flush — but only if the flush happens before anything can measure.
876
- *
877
- * ```
878
- * provider renders -> window OPEN
879
- * children render -> injections queued
880
- * provider insertionEffect -> FLUSH, window CLOSED
881
- * layout effects run -> rules are in the sheet
882
- * ```
883
- *
884
- * `useInsertionEffect` runs in React's mutation phase, after every render in
885
- * the commit and before any `useLayoutEffect` — which is exactly why React
886
- * added it for CSS-in-JS libraries. Effects fire child-first, so this
887
- * provider's runs after every descendant's and still before all layout
888
- * effects.
889
- *
890
- * A commit that does not re-render this provider gets no window, and those
891
- * injections are written synchronously instead. That is the point: turning
892
- * `batchInjection: true` on can only ever make injection cheaper, never make a
893
- * measurement wrong. It also means batching applies to commits this provider
894
- * takes part in, so mount it as high in the tree as you can.
895
- *
896
- * Requires `configure({ batchInjection: true })`; without it this component
897
- * only renders its children. `batchInjection: 'always'` does not need the
898
- * provider at all — see that option's docs for the trade-off it accepts.
899
- *
900
- * @example
901
- * ```tsx
902
- * configure({ batchInjection: true });
903
- *
904
- * createRoot(el).render(
905
- * <TastyBatchProvider>
906
- * <App />
907
- * </TastyBatchProvider>,
908
- * );
909
- * ```
910
- */
911
- function TastyBatchProvider({ children }) {
912
- openBatchWindow();
913
- useInsertionEffect(() => {
914
- closeBatchWindow();
915
- });
916
- return children;
917
- }
918
- //#endregion
919
- export { APPEARANCE_CHUNK_STYLES, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, CUSTOM_UNITS, ChunkSheetRegistry, DEFAULT_NAME_PREFIX, DEFAULT_ZERO_NAME_PREFIX, DIMENSION_CHUNK_STYLES, DIMENSION_STYLES, DIRECTIONS, DISPLAY_CHUNK_STYLES, Element, FLOW_STYLES, FONT_CHUNK_STYLES, INNER_STYLES, LAYOUT_CHUNK_STYLES, OUTER_STYLES, POSITION_CHUNK_STYLES, POSITION_STYLES, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, TastyBatchProvider, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, dotize, filterBaseProps, filterMods, flushStyles, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, getDisplayName, getGlobalCounterStyles, getGlobalFontFaces, getGlobalFunctions, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getNamePrefix, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasPendingStyleWrites, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunction, okhslPlugin, okhstFunction, okhstPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetStyleBatch, resolveFunctionColor, resolveRecipes, setGlobalPredefinedStates, strToRgb, stringifyStyles, styleHandlers, tasty, tastyDebug, touch, useCounterStyle, useFontFace, useFunction, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles };
920
-
921
- //# sourceMappingURL=index.js.map
1
+ import { A as strToRgb, C as StyleParser, D as getRgbValuesFromRgbaString, E as getNamedColorHex, O as hexToRgb, S as createColorFunc, _ as stringifyStyles, b as okhslFunction, c as getGlobalParser, d as parseColor, f as parseStyle, i as DIRECTIONS, k as hslToRgbValues, l as getGlobalPredefinedTokens, n as resolveFunctionColor, o as filterMods, r as CUSTOM_UNITS, t as color, u as normalizeColorTokenValue, v as okhstFunction, x as okhslPlugin, y as okhstPlugin } from "./chunks/dsl-DRhFWQzo.js";
2
+ import { n as isSelector, t as mergeStyles } from "./chunks/shared-utils-y-HjvPN4.js";
3
+ import { C as DEFAULT_NAME_PREFIX, w as DEFAULT_ZERO_NAME_PREFIX } from "./chunks/css-definitions-DotDkIXt.js";
4
+ import { B as createStateParserContext, F as FONT_CHUNK_STYLES, H as setGlobalPredefinedStates, I as LAYOUT_CHUNK_STYLES, L as POSITION_CHUNK_STYLES, M as CHUNK_NAMES, N as DIMENSION_CHUNK_STYLES, P as DISPLAY_CHUNK_STYLES, R as STYLE_TO_CHUNK, T as defineHandler, U as hasStylesGenerated, V as getGlobalPredefinedStates, _ as POSITION_STYLES, b as renderStyles, c as BLOCK_INNER_STYLES, d as COLOR_STYLES, f as CONTAINER_STYLES, g as OUTER_STYLES, h as INNER_STYLES, j as APPEARANCE_CHUNK_STYLES, k as styleHandlers, l as BLOCK_OUTER_STYLES, m as FLOW_STYLES, p as DIMENSION_STYLES, r as categorizeStyleKeys, s as BASE_STYLES, u as BLOCK_STYLES, v as TEXT_STYLES, x as parseStateKey } from "./chunks/style-engine-BBbBuSkT.js";
5
+ import { i as generateTypographyTokens } from "./chunks/config-engine-DEmmPPdp.js";
6
+ import { c as getGlobalFunctions, o as getGlobalCounterStyles, s as getGlobalFontFaces } from "./chunks/runtime-state-BxaLhVdP.js";
7
+ import { A as ownKeyframes, B as getNamePrefix, C as holdKeyframes, D as injector, E as injectRawCSS, F as configure, G as resetConfig, H as hasGlobalRecipes, I as getConfig, K as StyleInjector, M as touch, N as ChunkSheetRegistry, O as isPropertyDefined, P as chunkSheetRegistry, Q as resetStyleBatch, R as getGlobalKeyframes, S as getRawCSSText, T as injectGlobal, U as isConfigLocked, V as hasGlobalKeyframes, W as isTestEnvironment, X as hasPendingStyleWrites, Y as flushStyles, _ as fontFace, a as filterBaseProps, b as getCSSText, g as destroy, h as createInjector, i as modAttrs, j as property, k as keyframes, m as counterStyle, o as computeStyles, p as cleanup, q as SheetManager, r as processTokens, s as resolveRecipes, v as func, w as inject, x as getCSSTextForNode, y as gc, z as getGlobalRecipes } from "./chunks/runtime-engine-CKFXUH-A.js";
8
+ import { t as tastyDebug } from "./chunks/debug-D8pg9RGI.js";
9
+ import "./core/index.js";
10
+ import { a as useProperty, c as useGlobalStyles, d as Element, f as tasty, i as useFontFace, l as useStyles, n as useFunction, o as useKeyframes, p as getDisplayName, r as useCounterStyle, s as useRawCSS, t as TastyBatchProvider } from "./chunks/react-runtime-BpxlOTbO.js";
11
+ export { APPEARANCE_CHUNK_STYLES, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, CUSTOM_UNITS, ChunkSheetRegistry, DEFAULT_NAME_PREFIX, DEFAULT_ZERO_NAME_PREFIX, DIMENSION_CHUNK_STYLES, DIMENSION_STYLES, DIRECTIONS, DISPLAY_CHUNK_STYLES, Element, FLOW_STYLES, FONT_CHUNK_STYLES, INNER_STYLES, LAYOUT_CHUNK_STYLES, OUTER_STYLES, POSITION_CHUNK_STYLES, POSITION_STYLES, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, TastyBatchProvider, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, filterBaseProps, filterMods, flushStyles, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, getDisplayName, getGlobalCounterStyles, getGlobalFontFaces, getGlobalFunctions, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getNamePrefix, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasPendingStyleWrites, hasStylesGenerated, hexToRgb, holdKeyframes, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, modAttrs, normalizeColorTokenValue, okhslFunction, okhslPlugin, okhstFunction, okhstPlugin, ownKeyframes, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetStyleBatch, resolveFunctionColor, resolveRecipes, setGlobalPredefinedStates, strToRgb, stringifyStyles, styleHandlers, tasty, tastyDebug, touch, useCounterStyle, useFontFace, useFunction, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles };