@tenphi/tasty 0.0.0-snapshot.0003ae6

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 (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +685 -0
  3. package/dist/babel-rZcEwPLM.d.ts +82 -0
  4. package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
  5. package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
  6. package/dist/chunks/build-config-_cm7XDZ0.js +42 -0
  7. package/dist/chunks/build-config-_cm7XDZ0.js.map +1 -0
  8. package/dist/chunks/collector-DZh0frqA.js +208 -0
  9. package/dist/chunks/collector-DZh0frqA.js.map +1 -0
  10. package/dist/chunks/config-engine-B9arIU78.js +272 -0
  11. package/dist/chunks/config-engine-B9arIU78.js.map +1 -0
  12. package/dist/chunks/css-definitions-LxHlQWqa.js +876 -0
  13. package/dist/chunks/css-definitions-LxHlQWqa.js.map +1 -0
  14. package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
  15. package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
  16. package/dist/chunks/debug-Cp6kyH_o.js +502 -0
  17. package/dist/chunks/debug-Cp6kyH_o.js.map +1 -0
  18. package/dist/chunks/dsl-MW8TZusz.js +1377 -0
  19. package/dist/chunks/dsl-MW8TZusz.js.map +1 -0
  20. package/dist/chunks/hydration-TRcz5vnk.js +41 -0
  21. package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
  22. package/dist/chunks/react-runtime-DFK-u-KU.js +562 -0
  23. package/dist/chunks/react-runtime-DFK-u-KU.js.map +1 -0
  24. package/dist/chunks/runtime-engine-BNE2KUiS.js +2412 -0
  25. package/dist/chunks/runtime-engine-BNE2KUiS.js.map +1 -0
  26. package/dist/chunks/runtime-state-BsBWQeBn.js +127 -0
  27. package/dist/chunks/runtime-state-BsBWQeBn.js.map +1 -0
  28. package/dist/chunks/shared-utils-CGMsLq--.js +148 -0
  29. package/dist/chunks/shared-utils-CGMsLq--.js.map +1 -0
  30. package/dist/chunks/style-engine-BuW7q07d.js +5260 -0
  31. package/dist/chunks/style-engine-BuW7q07d.js.map +1 -0
  32. package/dist/chunks/zero-engine-DzsBXgfk.js +275 -0
  33. package/dist/chunks/zero-engine-DzsBXgfk.js.map +1 -0
  34. package/dist/collector-w4mBj5gd.d.ts +164 -0
  35. package/dist/config-CZWCzBr6.d.ts +1349 -0
  36. package/dist/core/index.d.ts +5 -0
  37. package/dist/core/index.js +9 -0
  38. package/dist/index-G9JuwM9p.d.ts +1920 -0
  39. package/dist/index.d.ts +5 -0
  40. package/dist/index.js +11 -0
  41. package/dist/merge-styles-VXwJ0Frr.d.ts +6 -0
  42. package/dist/ssr/astro-client.d.ts +1 -0
  43. package/dist/ssr/astro-client.js +6 -0
  44. package/dist/ssr/astro-client.js.map +1 -0
  45. package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
  46. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  47. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  48. package/dist/ssr/astro-middleware-extract.d.ts +10 -0
  49. package/dist/ssr/astro-middleware-extract.js +9 -0
  50. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  51. package/dist/ssr/astro-middleware-static.d.ts +17 -0
  52. package/dist/ssr/astro-middleware-static.js +7 -0
  53. package/dist/ssr/astro-middleware-static.js.map +1 -0
  54. package/dist/ssr/astro-middleware.d.ts +18 -0
  55. package/dist/ssr/astro-middleware.js +7 -0
  56. package/dist/ssr/astro-middleware.js.map +1 -0
  57. package/dist/ssr/astro.d.ts +127 -0
  58. package/dist/ssr/astro.js +221 -0
  59. package/dist/ssr/astro.js.map +1 -0
  60. package/dist/ssr/index.d.ts +36 -0
  61. package/dist/ssr/index.js +10 -0
  62. package/dist/ssr/index.js.map +1 -0
  63. package/dist/ssr/next-config.d.ts +64 -0
  64. package/dist/ssr/next-config.js +128 -0
  65. package/dist/ssr/next-config.js.map +1 -0
  66. package/dist/ssr/next.d.ts +46 -0
  67. package/dist/ssr/next.js +60 -0
  68. package/dist/ssr/next.js.map +1 -0
  69. package/dist/static/index.d.ts +90 -0
  70. package/dist/static/index.js +32 -0
  71. package/dist/static/index.js.map +1 -0
  72. package/dist/static/inject.d.ts +4 -0
  73. package/dist/static/inject.js +17 -0
  74. package/dist/static/inject.js.map +1 -0
  75. package/dist/types-JEY8PVYP.d.ts +1567 -0
  76. package/dist/zero/babel.d.ts +2 -0
  77. package/dist/zero/babel.js +412 -0
  78. package/dist/zero/babel.js.map +1 -0
  79. package/dist/zero/index.d.ts +80 -0
  80. package/dist/zero/index.js +2 -0
  81. package/dist/zero/next.d.ts +84 -0
  82. package/dist/zero/next.js +112 -0
  83. package/dist/zero/next.js.map +1 -0
  84. package/docs/README.md +39 -0
  85. package/docs/adoption.md +323 -0
  86. package/docs/ai-agents.md +250 -0
  87. package/docs/comparison.md +448 -0
  88. package/docs/configuration.md +839 -0
  89. package/docs/debug.md +332 -0
  90. package/docs/design-system.md +455 -0
  91. package/docs/dsl.md +1065 -0
  92. package/docs/getting-started.md +240 -0
  93. package/docs/injector.md +634 -0
  94. package/docs/methodology.md +648 -0
  95. package/docs/migration-v3.md +285 -0
  96. package/docs/pipeline.md +765 -0
  97. package/docs/plugins.md +353 -0
  98. package/docs/react-api.md +683 -0
  99. package/docs/runtime-benchmarks.md +388 -0
  100. package/docs/ssr.md +610 -0
  101. package/docs/styles.md +715 -0
  102. package/docs/tasty-static.md +582 -0
  103. package/package.json +314 -0
  104. package/tasty.config.ts +20 -0
@@ -0,0 +1,5 @@
1
+ import { $ as TastyNamedColors, A as resetStyleBatch, B as getGlobalPredefinedStates, C as SheetInfo, Ct as StyleParser, D as QueuedWrite, Dt as StyleDetailsPart, E as StyleUsage, Et as StyleDetails, F as parseStateKey, G as NoType, H as ConditionNode, I as AtRuleContext, J as Selector, K as NotSelector, L as ParsedAdvancedState, M as StyleResult, N as renderStyles, O as flushStyles, Ot as UnitHandler, P as ParseStateKeyOptions, Q as SuffixForSelector, R as StateParserContext, S as RuleInfo, St as stringifyStyles, T as StyleRule, Tt as ProcessedStyle, U as ConfigTokenValue, V as setGlobalPredefinedStates, W as ConfigTokens, X as StylesInterface, Y as Styles, Z as StylesWithoutSelectors, _ as KeyframesSteps, _t as getGlobalParser, a as FontFaceInput, at as ParsedColor, b as RawCSSResult, bt as parseColor, c as GCConfig, ct as StyleHandler, d as InjectOptions, dt as StyleHandlerResult, et as TastyPresetNames, f as InjectResult, ft as StyleMap, g as KeyframesResult, gt as filterMods, h as KeyframesInfo, ht as StyleValueStateMap, i as FontFaceDescriptors, it as DIRECTIONS, j as RenderResult, k as hasPendingStyleWrites, kt as CSSProperties, l as GCOptions, lt as StyleHandlerDefinition, m as KeyframesCacheEntry, mt as StyleValue, n as CounterStyleDescriptors, nt as CSSMap, o as FunctionDefinition, ot as RawStyleHandler, p as InjectionMode, pt as StylePropValue, q as RecipeStyles, r as DisposeFunction, rt as CUSTOM_UNITS, s as FunctionParameter, st as ResolvedStyleValue, t as CacheMetrics, tt as AnyStyleHandler, ut as StyleHandlerProps, v as PropertyDefinition, vt as getGlobalPredefinedTokens, w as StyleInjectorConfig, wt as ParserOptions, x as RootRegistry, xt as parseStyle, y as PropertyOptions, yt as normalizeColorTokenValue, z as createStateParserContext } from "./types-JEY8PVYP.js";
2
+ import { $ as createColorFunc, $t as OuterStyleProps, A as keyframes, An as strToRgb, At as TastyElementOptions, B as styleHandlers, Bt as BasePropsWithoutChildren, C as getRawCSSText, Cn as DEFAULT_ZERO_NAME_PREFIX, Ct as ResolveAsProps, D as injectRawCSS, Dn as getRgbValuesFromRgbaString, Dt as SubElementDefinition, E as injectGlobal, En as getNamedColorHex, Et as ResolveTokenProps, F as chunkSheetRegistry, Ft as VariantMap, G as ChunkName, Gt as ColorStyleProps, H as categorizeStyleKeys, Ht as BlockInnerStyleProps, I as ComputeStylesOptions, It as WithVariant, J as FONT_CHUNK_STYLES, Jt as ExtraBaseStyleProps, K as DIMENSION_CHUNK_STYLES, Kt as ContainerStyleProps, L as ComputeStylesResult, Lt as tasty, M as property, Mt as TastyPolymorphicComponent, N as touch, Nt as TastyProps, O as injector, On as hexToRgb, Ot as SubElementProps, P as ChunkSheetRegistry, Pt as TokenPropsInput, Q as resolveFunctionColor, Qt as Mods, R as computeStyles, Rt as AllBaseProps, S as getCSSTextForNode, Sn as DEFAULT_NAME_PREFIX, St as ModPropsInput, T as inject, Tn as isSelector, Tt as ResolveModProps, U as APPEARANCE_CHUNK_STYLES, Ut as BlockOuterStyleProps, V as ChunkInfo, Vt as BaseStyleProps, W as CHUNK_NAMES, Wt as BlockStyleProps, X as POSITION_CHUNK_STYLES, Xt as InnerStyleProps, Y as LAYOUT_CHUNK_STYLES, Yt as FlowStyleProps, Z as STYLE_TO_CHUNK, Zt as ModValue, _ as destroy, _n as FLOW_STYLES, _t as useStyles, a as DebugOptions, an as TastyExtensionConfig, at as TastyBatchProvider, b as gc, bn as POSITION_STYLES, bt as ElementsDefinition, c as tastyDebug, cn as TokenValue, ct as useFunction, d as modAttrs, dn as BLOCK_INNER_STYLES, dt as UsePropertyOptions, en as PositionStyleProps, et as okhstFunction, f as color, fn as BLOCK_OUTER_STYLES, ft as useProperty, g as createInjector, gn as DIMENSION_STYLES, gt as UseStylesResult, h as counterStyle, hn as CONTAINER_STYLES, ht as useGlobalStyles, i as DebugChunkInfo, in as TastyCustomProps, it as getDisplayName, j as ownKeyframes, jt as TastyElementProps, k as isPropertyDefined, kn as hslToRgbValues, kt as TastyComponentPropsWithDefaults, l as processTokens, ln as Tokens, lt as useCounterStyle, m as cleanup, mn as COLOR_STYLES, mt as useRawCSS, n as CacheStatus, nn as TagName, nt as okhslFunction, o as InspectResult, on as TastyThemeNames, ot as TastyBatchProviderProps, p as filterBaseProps, pn as BLOCK_STYLES, pt as useKeyframes, q as DISPLAY_CHUNK_STYLES, qt as DimensionStyleProps, r as ChunkBreakdown, rn as TastyBaseStylePropNames, rt as okhslPlugin, s as Summary, sn as TextStyleProps, st as UseFunctionOptions, t as CSSOptions, tn as ShortGridStyles, tt as okhstPlugin, u as resolveRecipes, un as BASE_STYLES, ut as useFontFace, v as fontFace, vn as INNER_STYLES, vt as AllBasePropsWithMods, w as holdKeyframes, wn as hasStylesGenerated, wt as ResolveModPropDef, x as getCSSText, xn as TEXT_STYLES, xt as ModPropDef, y as func, yn as OUTER_STYLES, yt as Element, z as defineHandler, zt as BaseProps } from "./index-G9JuwM9p.js";
3
+ import { C as PropHandlerDefinition, D as getGlobalFunctions, E as getGlobalFontFaces, S as PropHandler, T as getGlobalCounterStyles, _ as ColorSpace, a as getGlobalRecipes, b as StyleInjector, c as hasGlobalRecipes, d as resetConfig, f as TastyPlugin, g as generateTypographyTokens, h as TypographyTokenValue, i as getGlobalKeyframes, l as isConfigLocked, m as TypographyPreset, n as configure, o as getNamePrefix, p as TastyPluginFactory, r as getConfig, s as hasGlobalKeyframes, t as TastyConfig, u as isTestEnvironment, v as FunctionsConfig, w as PropHandlerProps, x as SheetManager, y as ParseFunction } from "./config-CZWCzBr6.js";
4
+ import { t as mergeStyles } from "./merge-styles-VXwJ0Frr.js";
5
+ export { APPEARANCE_CHUNK_STYLES, type AllBaseProps, type AllBasePropsWithMods, type AnyStyleHandler, type AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, type BaseProps, type BasePropsWithoutChildren, type BaseStyleProps, type BlockInnerStyleProps, type BlockOuterStyleProps, type BlockStyleProps, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, type CSSMap, CSSOptions, type CSSProperties, CUSTOM_UNITS, type CacheMetrics, CacheStatus, ChunkBreakdown, type ChunkInfo, type ChunkName, ChunkSheetRegistry, type ColorSpace, type ColorStyleProps, type ComputeStylesOptions, type ComputeStylesResult, type ConditionNode, type ConfigTokenValue, type ConfigTokens, type ContainerStyleProps, type CounterStyleDescriptors, DEFAULT_NAME_PREFIX, DEFAULT_ZERO_NAME_PREFIX, DIMENSION_CHUNK_STYLES, DIMENSION_STYLES, DIRECTIONS, DISPLAY_CHUNK_STYLES, DebugChunkInfo, DebugOptions, type DimensionStyleProps, type DisposeFunction, Element, type ElementsDefinition, type ExtraBaseStyleProps, FLOW_STYLES, FONT_CHUNK_STYLES, type FlowStyleProps, type FontFaceDescriptors, type FontFaceInput, type FunctionDefinition, type FunctionParameter, type FunctionsConfig, type GCConfig, type GCOptions, INNER_STYLES, type InjectOptions, type InjectResult, type InjectionMode, type InnerStyleProps, InspectResult, type KeyframesCacheEntry, type KeyframesInfo, type KeyframesResult, type KeyframesSteps, LAYOUT_CHUNK_STYLES, type ModPropDef, type ModPropsInput, type ModValue, type Mods, type NoType, type NotSelector, OUTER_STYLES, type OuterStyleProps, POSITION_CHUNK_STYLES, POSITION_STYLES, type ParseFunction, type ParseStateKeyOptions, type ParsedAdvancedState, type ParsedColor, type ParserOptions, type PositionStyleProps, type ProcessedStyle, type PropHandler, type PropHandlerDefinition, type PropHandlerProps, type PropertyDefinition, type PropertyOptions, type QueuedWrite, type RawCSSResult, type RawStyleHandler, type RecipeStyles, type RenderResult, type ResolveAsProps, type ResolveModPropDef, type ResolveModProps, type ResolveTokenProps, type ResolvedStyleValue, type RootRegistry, type RuleInfo, STYLE_TO_CHUNK, type Selector, type SheetInfo, SheetManager, type ShortGridStyles, type StateParserContext, type StyleDetails, type StyleDetailsPart, type StyleHandler, type StyleHandlerDefinition, type StyleHandlerProps, type StyleHandlerResult, StyleInjector, type StyleInjectorConfig, type StyleMap, StyleParser, type StylePropValue, type StyleResult, type StyleRule, type StyleUsage, type StyleValue, type StyleValueStateMap, type Styles, type StylesInterface, type StylesWithoutSelectors, type SubElementDefinition, type SubElementProps, type SuffixForSelector, Summary, TEXT_STYLES, type TagName, type TastyBaseStylePropNames, TastyBatchProvider, type TastyBatchProviderProps, type TastyComponentPropsWithDefaults, type TastyConfig, type TastyCustomProps, type TastyElementOptions, type TastyElementProps, type TastyExtensionConfig, type TastyNamedColors, type TastyPlugin, type TastyPluginFactory, type TastyPolymorphicComponent, type TastyPresetNames, type TastyProps, type TastyThemeNames, type TextStyleProps, type TokenPropsInput, type TokenValue, type Tokens, TypographyPreset, TypographyTokenValue, type UnitHandler, type UseFunctionOptions, type UsePropertyOptions, type UseStylesResult, type VariantMap, type WithVariant, 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 };
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
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-MW8TZusz.js";
2
+ import { n as isSelector, t as mergeStyles } from "./chunks/shared-utils-CGMsLq--.js";
3
+ import { C as DEFAULT_NAME_PREFIX, w as DEFAULT_ZERO_NAME_PREFIX } from "./chunks/css-definitions-LxHlQWqa.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-BuW7q07d.js";
5
+ import { i as generateTypographyTokens } from "./chunks/config-engine-B9arIU78.js";
6
+ import { c as getGlobalFunctions, o as getGlobalCounterStyles, s as getGlobalFontFaces } from "./chunks/runtime-state-BsBWQeBn.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-BNE2KUiS.js";
8
+ import { t as tastyDebug } from "./chunks/debug-Cp6kyH_o.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-DFK-u-KU.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 };
@@ -0,0 +1,6 @@
1
+ import { Y as Styles } from "./types-JEY8PVYP.js";
2
+ //#region src/utils/merge-styles.d.ts
3
+ declare function mergeStyles(...objects: (Styles | undefined | null)[]): Styles;
4
+ //#endregion
5
+ export { mergeStyles as t };
6
+ //# sourceMappingURL=merge-styles-VXwJ0Frr.d.ts.map
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,6 @@
1
+ import { t as hydrateTastyClasses } from "../chunks/hydration-TRcz5vnk.js";
2
+ //#region src/ssr/astro-client.ts
3
+ if (typeof window !== "undefined") hydrateTastyClasses();
4
+ //#endregion
5
+
6
+ //# sourceMappingURL=astro-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astro-client.js","names":[],"sources":["../../src/ssr/astro-client.ts"],"sourcesContent":["/**\n * Client-side cache hydration for Astro islands.\n *\n * Reads the class name list from `window.__TASTY__` (populated by\n * inline scripts emitted during SSR) and pre-populates the injector\n * so island hydration skips the style pipeline entirely.\n *\n * This module is browser-safe — it does NOT import node:async_hooks.\n *\n * Usage:\n * - Automatically injected by tastyIntegration() via injectScript('before-hydration')\n * - Can be imported manually: `import '@tenphi/tasty/ssr/astro-client'`\n */\n\nimport { hydrateTastyClasses } from './hydrate';\n\nif (typeof window !== 'undefined') {\n hydrateTastyClasses();\n}\n"],"mappings":";;AAgBA,IAAI,OAAO,WAAW,aACpB,oBAAoB"}
@@ -0,0 +1,10 @@
1
+ //#region src/ssr/astro-middleware-extract-static.d.ts
2
+ /**
3
+ * Prerender-extraction middleware entrypoint for sites without islands.
4
+ * Exported only so Astro can resolve it through the package exports map.
5
+ */
6
+ export declare const onRequest: (context: {
7
+ isPrerendered?: boolean;
8
+ }, next: () => Promise<Response>) => Promise<Response>;
9
+ //#endregion
10
+ //# sourceMappingURL=astro-middleware-extract-static.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { tastyMiddleware } from "./astro.js";
2
+ const onRequest = tastyMiddleware({
3
+ transferCache: false,
4
+ extractionMetadata: true
5
+ });
6
+ //#endregion
7
+ export { onRequest };
8
+
9
+ //# sourceMappingURL=astro-middleware-extract-static.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astro-middleware-extract-static.js","names":[],"sources":["../../src/ssr/astro-middleware-extract-static.ts"],"sourcesContent":["/**\n * Prerender-extraction middleware entrypoint for sites without islands.\n * Exported only so Astro can resolve it through the package exports map.\n */\n\nimport { tastyMiddleware } from './astro';\n\nconst options = {\n transferCache: false,\n extractionMetadata: true,\n};\n\nexport const onRequest = tastyMiddleware(options);\n"],"mappings":";AAYA,MAAa,YAAY,gBAAgB;CAJvC,eAAe;CACf,oBAAoB;AAGmB,CAAO"}
@@ -0,0 +1,10 @@
1
+ //#region src/ssr/astro-middleware-extract.d.ts
2
+ /**
3
+ * Prerender-extraction middleware entrypoint with island cache transfer.
4
+ * Exported only so Astro can resolve it through the package exports map.
5
+ */
6
+ export declare const onRequest: (context: {
7
+ isPrerendered?: boolean;
8
+ }, next: () => Promise<Response>) => Promise<Response>;
9
+ //#endregion
10
+ //# sourceMappingURL=astro-middleware-extract.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { tastyMiddleware } from "./astro.js";
2
+ const onRequest = tastyMiddleware({
3
+ transferCache: true,
4
+ extractionMetadata: true
5
+ });
6
+ //#endregion
7
+ export { onRequest };
8
+
9
+ //# sourceMappingURL=astro-middleware-extract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astro-middleware-extract.js","names":[],"sources":["../../src/ssr/astro-middleware-extract.ts"],"sourcesContent":["/**\n * Prerender-extraction middleware entrypoint with island cache transfer.\n * Exported only so Astro can resolve it through the package exports map.\n */\n\nimport { tastyMiddleware } from './astro';\n\nconst options = {\n transferCache: true,\n extractionMetadata: true,\n};\n\nexport const onRequest = tastyMiddleware(options);\n"],"mappings":";AAYA,MAAa,YAAY,gBAAgB;CAJvC,eAAe;CACf,oBAAoB;AAGmB,CAAO"}
@@ -0,0 +1,17 @@
1
+ //#region src/ssr/astro-middleware-static.d.ts
2
+ /**
3
+ * Astro middleware entrypoint for `tastyIntegration({ islands: false })`.
4
+ *
5
+ * Registered via `addMiddleware()` as
6
+ * `@tenphi/tasty/ssr/astro-middleware-static`. Exposed as a package subpath
7
+ * only so Astro can resolve it — use `tastyMiddleware({ transferCache: false })`
8
+ * directly if you need manual middleware composition.
9
+ *
10
+ * Identical to `./astro-middleware` except that no class-list `<script>` is
11
+ * emitted, so a site without `client:*` islands ships zero client JavaScript.
12
+ */
13
+ export declare const onRequest: (context: {
14
+ isPrerendered?: boolean;
15
+ }, next: () => Promise<Response>) => Promise<Response>;
16
+ //#endregion
17
+ //# sourceMappingURL=astro-middleware-static.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { tastyMiddleware } from "./astro.js";
2
+ //#region src/ssr/astro-middleware-static.ts
3
+ const onRequest = tastyMiddleware({ transferCache: false });
4
+ //#endregion
5
+ export { onRequest };
6
+
7
+ //# sourceMappingURL=astro-middleware-static.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astro-middleware-static.js","names":[],"sources":["../../src/ssr/astro-middleware-static.ts"],"sourcesContent":["/**\n * Astro middleware entrypoint for `tastyIntegration({ islands: false })`.\n *\n * Registered via `addMiddleware()` as\n * `@tenphi/tasty/ssr/astro-middleware-static`. Exposed as a package subpath\n * only so Astro can resolve it — use `tastyMiddleware({ transferCache: false })`\n * directly if you need manual middleware composition.\n *\n * Identical to `./astro-middleware` except that no class-list `<script>` is\n * emitted, so a site without `client:*` islands ships zero client JavaScript.\n */\n\nimport { tastyMiddleware } from './astro';\n\nexport const onRequest = tastyMiddleware({ transferCache: false });\n"],"mappings":";;AAcA,MAAa,YAAY,gBAAgB,EAAE,eAAe,MAAM,CAAC"}
@@ -0,0 +1,18 @@
1
+ //#region src/ssr/astro-middleware.d.ts
2
+ /**
3
+ * Astro middleware entrypoint for `tastyIntegration()`.
4
+ *
5
+ * Registered via `addMiddleware()` as `@tenphi/tasty/ssr/astro-middleware`.
6
+ * Exposed as a package subpath only so Astro can resolve it — use
7
+ * `tastyMiddleware()` directly if you need manual middleware composition.
8
+ *
9
+ * This is the islands variant: the rendered class list is transferred to the
10
+ * client so hydrating islands skip the style pipeline. See
11
+ * `./astro-middleware-static` for the variant used by
12
+ * `tastyIntegration({ islands: false })`.
13
+ */
14
+ export declare const onRequest: (context: {
15
+ isPrerendered?: boolean;
16
+ }, next: () => Promise<Response>) => Promise<Response>;
17
+ //#endregion
18
+ //# sourceMappingURL=astro-middleware.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { tastyMiddleware } from "./astro.js";
2
+ //#region src/ssr/astro-middleware.ts
3
+ const onRequest = tastyMiddleware({ transferCache: true });
4
+ //#endregion
5
+ export { onRequest };
6
+
7
+ //# sourceMappingURL=astro-middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astro-middleware.js","names":[],"sources":["../../src/ssr/astro-middleware.ts"],"sourcesContent":["/**\n * Astro middleware entrypoint for `tastyIntegration()`.\n *\n * Registered via `addMiddleware()` as `@tenphi/tasty/ssr/astro-middleware`.\n * Exposed as a package subpath only so Astro can resolve it — use\n * `tastyMiddleware()` directly if you need manual middleware composition.\n *\n * This is the islands variant: the rendered class list is transferred to the\n * client so hydrating islands skip the style pipeline. See\n * `./astro-middleware-static` for the variant used by\n * `tastyIntegration({ islands: false })`.\n */\n\nimport { tastyMiddleware } from './astro';\n\nexport const onRequest = tastyMiddleware({ transferCache: true });\n"],"mappings":";;AAeA,MAAa,YAAY,gBAAgB,EAAE,eAAe,KAAK,CAAC"}
@@ -0,0 +1,127 @@
1
+ //#region src/ssr/astro.d.ts
2
+ /**
3
+ * Astro integration for Tasty SSR.
4
+ *
5
+ * Provides:
6
+ * - tastyIntegration() — Astro Integration API (recommended)
7
+ * - tastyMiddleware() — manual middleware for advanced composition
8
+ *
9
+ * Import from '@tenphi/tasty/ssr/astro'.
10
+ */
11
+ export interface TastyMiddlewareOptions {
12
+ /**
13
+ * Whether to embed the class-list script for client hydration.
14
+ * Set to false to skip class transfer (e.g. for CSP restrictions).
15
+ * Without it, client components may re-inject CSS that already exists
16
+ * in server-rendered `<style>` tags. Default: true.
17
+ */
18
+ transferCache?: boolean;
19
+ }
20
+ /**
21
+ * Create an Astro middleware that collects Tasty styles during SSR.
22
+ *
23
+ * All React components rendered during the request will have their
24
+ * computeStyles() calls captured by the collector via AsyncLocalStorage.
25
+ * After rendering, the middleware injects the collected CSS into </head>.
26
+ *
27
+ * @example Manual middleware setup
28
+ * ```ts
29
+ * // src/middleware.ts
30
+ * import { tastyMiddleware } from '@tenphi/tasty/ssr/astro';
31
+ * export const onRequest = tastyMiddleware();
32
+ * ```
33
+ *
34
+ * @example Composing with other middleware
35
+ * ```ts
36
+ * // src/middleware.ts
37
+ * import { sequence } from 'astro:middleware';
38
+ * import { tastyMiddleware } from '@tenphi/tasty/ssr/astro';
39
+ *
40
+ * export const onRequest = sequence(
41
+ * tastyMiddleware(),
42
+ * myOtherMiddleware,
43
+ * );
44
+ * ```
45
+ */
46
+ export declare function tastyMiddleware(options?: TastyMiddlewareOptions): (context: {
47
+ isPrerendered?: boolean;
48
+ }, next: () => Promise<Response>) => Promise<Response>;
49
+ export interface TastyIntegrationCSSOptions {
50
+ /**
51
+ * CSS delivery mode. Extraction only applies to prerendered builds.
52
+ * Extracted CSS preserves resource URLs verbatim, so use absolute URLs or
53
+ * data URLs. Root-relative URLs are also supported unless `assetsPrefix`
54
+ * sends CSS to an external origin. The build rejects resource URLs whose
55
+ * targets would change after extraction.
56
+ */
57
+ mode?: 'inline' | 'extract';
58
+ }
59
+ export interface TastyIntegrationOptions {
60
+ /**
61
+ * Enable island hydration support.
62
+ *
63
+ * When `true` (default): injects a client hydration script via
64
+ * `injectScript('before-hydration')` and sets `transferCache: true`
65
+ * on the middleware. Islands skip the style pipeline during hydration.
66
+ *
67
+ * When `false`: no client JS is shipped and `transferCache` is set
68
+ * to `false`. Use this for fully static sites without `client:*`
69
+ * directives.
70
+ */
71
+ islands?: boolean;
72
+ /** Configure inline or build-wide extracted CSS delivery. */
73
+ css?: TastyIntegrationCSSOptions;
74
+ }
75
+ /**
76
+ * Astro integration that automatically sets up Tasty SSR.
77
+ *
78
+ * Registers middleware for cross-component CSS deduplication and
79
+ * optionally injects a client hydration script for island support.
80
+ *
81
+ * @example Basic setup (with islands)
82
+ * ```ts
83
+ * // astro.config.mjs
84
+ * import { tastyIntegration } from '@tenphi/tasty/ssr/astro';
85
+ *
86
+ * export default defineConfig({
87
+ * integrations: [tastyIntegration()],
88
+ * });
89
+ * ```
90
+ *
91
+ * @example Static-only (no client JS)
92
+ * ```ts
93
+ * // astro.config.mjs
94
+ * import { tastyIntegration } from '@tenphi/tasty/ssr/astro';
95
+ *
96
+ * export default defineConfig({
97
+ * integrations: [tastyIntegration({ islands: false })],
98
+ * });
99
+ * ```
100
+ */
101
+ export declare function tastyIntegration(options?: TastyIntegrationOptions): {
102
+ name: string;
103
+ hooks: {
104
+ 'astro:config:setup': ({ addMiddleware, injectScript }: {
105
+ addMiddleware: (middleware: {
106
+ entrypoint: string | URL;
107
+ order: "pre" | "post";
108
+ }) => void;
109
+ injectScript: (stage: "head-inline" | "before-hydration" | "page" | "page-ssr", content: string) => void;
110
+ }) => void;
111
+ 'astro:config:done': ({ config }: {
112
+ config: {
113
+ base?: string;
114
+ site?: URL;
115
+ build?: {
116
+ assets?: string;
117
+ assetsPrefix?: string | Record<string, string>;
118
+ };
119
+ };
120
+ }) => void;
121
+ 'astro:build:done': ({ dir }: {
122
+ dir: URL;
123
+ }) => Promise<void>;
124
+ };
125
+ };
126
+ //#endregion
127
+ //# sourceMappingURL=astro.d.ts.map
@@ -0,0 +1,221 @@
1
+ import { r as registerSSRCollectorGetterGlobal, u as getRuntimeConfigState } from "../chunks/runtime-state-BsBWQeBn.js";
2
+ import { t as ServerStyleCollector } from "../chunks/collector-DZh0frqA.js";
3
+ import { n as runWithCollector, t as getSSRCollector } from "../chunks/async-storage-CG5HnUT5.js";
4
+ import { t as findUnsafeCSSResource } from "../chunks/css-resources-P7IBUUZs.js";
5
+ import { createHash } from "node:crypto";
6
+ import { join } from "node:path";
7
+ import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
8
+ import { fileURLToPath } from "node:url";
9
+ //#region src/ssr/astro-extraction.ts
10
+ const METADATA_START = "<template data-tasty-extract>";
11
+ const METADATA_END = "</template>";
12
+ function createExtractionMetadata(artifacts) {
13
+ const encoded = Buffer.from(JSON.stringify(artifacts), "utf8").toString("base64");
14
+ return `${METADATA_START}${encoded}${METADATA_END}`;
15
+ }
16
+ function parseExtractablePage(path, html) {
17
+ const metadataStart = html.indexOf(METADATA_START);
18
+ if (metadataStart === -1) return null;
19
+ const metadataContentStart = metadataStart + 29;
20
+ const metadataEnd = html.indexOf(METADATA_END, metadataContentStart);
21
+ if (metadataEnd === -1) return null;
22
+ const encoded = html.slice(metadataContentStart, metadataEnd);
23
+ let artifacts;
24
+ try {
25
+ artifacts = JSON.parse(Buffer.from(encoded, "base64").toString("utf8"));
26
+ } catch {
27
+ return null;
28
+ }
29
+ const styleStart = html.lastIndexOf("<style data-tasty-ssr", metadataStart);
30
+ if (styleStart === -1) return null;
31
+ const styleOpenEnd = html.indexOf(">", styleStart);
32
+ const styleEnd = html.indexOf("</style>", styleOpenEnd + 1);
33
+ if (styleOpenEnd === -1 || styleEnd === -1 || styleEnd + 8 !== metadataStart) return null;
34
+ return {
35
+ path,
36
+ html,
37
+ artifacts,
38
+ styleStart,
39
+ replacementEnd: metadataEnd + 11,
40
+ styleOpen: html.slice(styleStart, styleOpenEnd + 1)
41
+ };
42
+ }
43
+ async function findHTMLFiles(dir) {
44
+ const paths = [];
45
+ const entries = await readdir(dir, { withFileTypes: true });
46
+ entries.sort((a, b) => a.name.localeCompare(b.name));
47
+ for (const entry of entries) {
48
+ const path = join(dir, entry.name);
49
+ if (entry.isDirectory()) paths.push(...await findHTMLFiles(path));
50
+ else if (entry.isFile() && entry.name.endsWith(".html")) paths.push(path);
51
+ }
52
+ return paths;
53
+ }
54
+ function crossOriginAssetsPrefix(assetsPrefix, site) {
55
+ if (!assetsPrefix) return null;
56
+ const prefix = typeof assetsPrefix === "string" ? assetsPrefix : assetsPrefix.css || assetsPrefix.fallback;
57
+ if (!/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(prefix)) return null;
58
+ if (!site) return prefix;
59
+ try {
60
+ return (prefix.startsWith("//") ? new URL(`${site.protocol}${prefix}`) : new URL(prefix)).origin === site.origin ? null : prefix;
61
+ } catch {
62
+ return prefix;
63
+ }
64
+ }
65
+ function validateExtractedURLs(pages, assetsPrefix, site) {
66
+ const externalPrefix = crossOriginAssetsPrefix(assetsPrefix, site);
67
+ for (const page of pages) for (const artifact of page.artifacts) {
68
+ const unsafe = findUnsafeCSSResource(artifact.css, externalPrefix !== null);
69
+ if (unsafe) {
70
+ const reason = unsafe.rootRelative ? `root-relative CSS URL "${unsafe.url}" would resolve against the external assetsPrefix "${externalPrefix}" instead of the page origin` : `page-relative CSS URL "${unsafe.url}" cannot preserve its target`;
71
+ throw new Error(`[Tasty] Astro CSS extraction cannot preserve ${reason} in ${page.path} (${artifact.kind} artifact ${artifact.id}). Use an absolute URL or a data URL${externalPrefix ? "" : ", or a root-relative URL such as url(/path/to/asset)"}.`);
72
+ }
73
+ }
74
+ }
75
+ function selectSharedArtifacts(pages) {
76
+ if (pages.length < 2) return [];
77
+ const source = pages[0].artifacts;
78
+ const otherIds = pages.slice(1).map((page) => new Set(page.artifacts.map(({ id }) => id)));
79
+ return source.filter(({ id }) => otherIds.every((ids) => ids.has(id)));
80
+ }
81
+ function stylesheetHref(base, assets, filename, assetsPrefix) {
82
+ const assetsPath = assets.replace(/^\/+|\/+$/g, "");
83
+ if (assetsPrefix) return `${(typeof assetsPrefix === "string" ? assetsPrefix : assetsPrefix.css || assetsPrefix.fallback).replace(/\/+$/g, "")}/${assetsPath}/${filename}`;
84
+ return `${base === "/" ? "" : `/${base.replace(/^\/+|\/+$/g, "")}`}/${assetsPath}/${filename}`;
85
+ }
86
+ function stylesheetLink(page, href) {
87
+ return `<link rel="stylesheet" href="${href}" data-tasty-ssr${page.styleOpen.match(/\snonce="[^"]*"/)?.[0] ?? ""}>`;
88
+ }
89
+ function transformPage(page, hrefs) {
90
+ const replacement = hrefs.map((href) => stylesheetLink(page, href)).join("");
91
+ return page.html.slice(0, page.styleStart) + replacement + page.html.slice(page.replacementEnd);
92
+ }
93
+ async function writeStylesheet(assetDir, scope, artifacts) {
94
+ if (artifacts.length === 0) return null;
95
+ const css = artifacts.map(({ css }) => css).join("\n");
96
+ const filename = `tasty.${scope}.${createHash("sha256").update(css).digest("hex").slice(0, 12)}.css`;
97
+ await writeFile(join(assetDir, filename), css);
98
+ return filename;
99
+ }
100
+ async function extractAstroCSS(options) {
101
+ const outputDir = fileURLToPath(options.dir);
102
+ const paths = await findHTMLFiles(outputDir);
103
+ const pages = (await Promise.all(paths.map(async (path) => parseExtractablePage(path, await readFile(path, "utf8"))))).filter((page) => page !== null);
104
+ if (pages.length === 0) return;
105
+ validateExtractedURLs(pages, options.assetsPrefix, options.site);
106
+ const shared = selectSharedArtifacts(pages);
107
+ const assetDir = join(outputDir, options.assets);
108
+ await mkdir(assetDir, { recursive: true });
109
+ const sharedFilename = await writeStylesheet(assetDir, "shared", shared);
110
+ const sharedHref = sharedFilename ? stylesheetHref(options.base, options.assets, sharedFilename, options.assetsPrefix) : null;
111
+ const sharedIds = new Set(shared.map(({ id }) => id));
112
+ for (const page of pages) {
113
+ const pageFilename = await writeStylesheet(assetDir, "page", page.artifacts.filter(({ id }) => !sharedIds.has(id)));
114
+ const hrefs = sharedHref ? [sharedHref] : [];
115
+ if (pageFilename) hrefs.push(stylesheetHref(options.base, options.assets, pageFilename, options.assetsPrefix));
116
+ await writeFile(page.path, transformPage(page, hrefs));
117
+ }
118
+ }
119
+ //#endregion
120
+ //#region src/ssr/astro.ts
121
+ registerSSRCollectorGetterGlobal(getSSRCollector);
122
+ function tastyMiddleware(options) {
123
+ const internalOptions = options;
124
+ return async (context, next) => {
125
+ const transferCache = options?.transferCache ?? true;
126
+ const extractionMetadata = internalOptions?.extractionMetadata === true && context.isPrerendered === true;
127
+ const collector = new ServerStyleCollector();
128
+ const rendered = await runWithCollector(collector, async () => {
129
+ const response = await next();
130
+ const body = response.body;
131
+ const contentType = response.headers.get("content-type") ?? "";
132
+ if (!body || !contentType.includes("text/html")) return { response };
133
+ const reader = body.pipeThrough(new TextDecoderStream()).getReader();
134
+ const parts = [];
135
+ for (;;) {
136
+ const { done, value } = await reader.read();
137
+ if (done) break;
138
+ parts.push(value);
139
+ }
140
+ return {
141
+ html: parts.join(""),
142
+ status: response.status,
143
+ headers: response.headers
144
+ };
145
+ });
146
+ if ("response" in rendered) return rendered.response;
147
+ if (!rendered.html) return new Response(null, {
148
+ status: rendered.status,
149
+ headers: rendered.headers
150
+ });
151
+ let { html } = rendered;
152
+ const css = collector.getCSS();
153
+ if (!css) return new Response(html, {
154
+ status: rendered.status,
155
+ headers: rendered.headers
156
+ });
157
+ const nonce = getRuntimeConfigState()?.nonce;
158
+ const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
159
+ const styleTag = `<style data-tasty-ssr${nonceAttr}>${css}</style>`;
160
+ const metadataTag = extractionMetadata ? createExtractionMetadata(collector.getArtifacts()) : "";
161
+ let cacheTag = "";
162
+ if (transferCache) {
163
+ const classNames = collector.getRenderedClassNames();
164
+ if (classNames.length > 0) cacheTag = `<script${nonceAttr}>(window.__TASTY__=window.__TASTY__||[]).push(${classNames.map((n) => `"${n}"`).join(",")})<\/script>`;
165
+ }
166
+ const injection = styleTag + metadataTag + cacheTag;
167
+ const idx = html.indexOf("</head>");
168
+ if (idx !== -1) html = html.slice(0, idx) + injection + html.slice(idx);
169
+ else html = injection + html;
170
+ const headers = new Headers(rendered.headers);
171
+ headers.delete("content-length");
172
+ return new Response(html, {
173
+ status: rendered.status,
174
+ headers
175
+ });
176
+ };
177
+ }
178
+ const MIDDLEWARE_ENTRYPOINT = "@tenphi/tasty/ssr/astro-middleware";
179
+ const MIDDLEWARE_ENTRYPOINT_STATIC = "@tenphi/tasty/ssr/astro-middleware-static";
180
+ const MIDDLEWARE_ENTRYPOINT_EXTRACT = "@tenphi/tasty/ssr/astro-middleware-extract";
181
+ const MIDDLEWARE_ENTRYPOINT_EXTRACT_STATIC = "@tenphi/tasty/ssr/astro-middleware-extract-static";
182
+ function tastyIntegration(options) {
183
+ const { islands = true } = options ?? {};
184
+ const cssMode = options?.css?.mode ?? "inline";
185
+ let base = "/";
186
+ let assets = "_astro";
187
+ let assetsPrefix;
188
+ let site;
189
+ return {
190
+ name: "@tenphi/tasty",
191
+ hooks: {
192
+ "astro:config:setup": ({ addMiddleware, injectScript }) => {
193
+ addMiddleware({
194
+ entrypoint: cssMode === "extract" ? islands ? MIDDLEWARE_ENTRYPOINT_EXTRACT : MIDDLEWARE_ENTRYPOINT_EXTRACT_STATIC : islands ? MIDDLEWARE_ENTRYPOINT : MIDDLEWARE_ENTRYPOINT_STATIC,
195
+ order: "pre"
196
+ });
197
+ if (islands) injectScript("before-hydration", `import "@tenphi/tasty/ssr/astro-client";`);
198
+ },
199
+ "astro:config:done": ({ config }) => {
200
+ base = config.base ?? "/";
201
+ assets = config.build?.assets ?? "_astro";
202
+ assetsPrefix = config.build?.assetsPrefix;
203
+ site = config.site;
204
+ },
205
+ "astro:build:done": async ({ dir }) => {
206
+ if (cssMode !== "extract") return;
207
+ await extractAstroCSS({
208
+ dir,
209
+ base,
210
+ assets,
211
+ assetsPrefix,
212
+ site
213
+ });
214
+ }
215
+ }
216
+ };
217
+ }
218
+ //#endregion
219
+ export { tastyIntegration, tastyMiddleware };
220
+
221
+ //# sourceMappingURL=astro.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astro.js","names":[],"sources":["../../src/ssr/astro-extraction.ts","../../src/ssr/astro.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { readdir, readFile, writeFile, mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { ServerStyleArtifact } from './collector';\nimport { findUnsafeCSSResource } from './css-resources';\n\nconst METADATA_START = '<template data-tasty-extract>';\nconst METADATA_END = '</template>';\n\ninterface ExtractablePage {\n path: string;\n html: string;\n artifacts: ServerStyleArtifact[];\n styleStart: number;\n replacementEnd: number;\n styleOpen: string;\n}\n\nexport function createExtractionMetadata(\n artifacts: ServerStyleArtifact[],\n): string {\n const encoded = Buffer.from(JSON.stringify(artifacts), 'utf8').toString(\n 'base64',\n );\n return `${METADATA_START}${encoded}${METADATA_END}`;\n}\n\nfunction parseExtractablePage(\n path: string,\n html: string,\n): ExtractablePage | null {\n const metadataStart = html.indexOf(METADATA_START);\n if (metadataStart === -1) return null;\n\n const metadataContentStart = metadataStart + METADATA_START.length;\n const metadataEnd = html.indexOf(METADATA_END, metadataContentStart);\n if (metadataEnd === -1) return null;\n\n const encoded = html.slice(metadataContentStart, metadataEnd);\n let artifacts: ServerStyleArtifact[];\n try {\n artifacts = JSON.parse(\n Buffer.from(encoded, 'base64').toString('utf8'),\n ) as ServerStyleArtifact[];\n } catch {\n return null;\n }\n\n const styleStart = html.lastIndexOf('<style data-tasty-ssr', metadataStart);\n if (styleStart === -1) return null;\n const styleOpenEnd = html.indexOf('>', styleStart);\n const styleEnd = html.indexOf('</style>', styleOpenEnd + 1);\n if (\n styleOpenEnd === -1 ||\n styleEnd === -1 ||\n styleEnd + '</style>'.length !== metadataStart\n ) {\n return null;\n }\n\n return {\n path,\n html,\n artifacts,\n styleStart,\n replacementEnd: metadataEnd + METADATA_END.length,\n styleOpen: html.slice(styleStart, styleOpenEnd + 1),\n };\n}\n\nasync function findHTMLFiles(dir: string): Promise<string[]> {\n const paths: string[] = [];\n const entries = await readdir(dir, { withFileTypes: true });\n entries.sort((a, b) => a.name.localeCompare(b.name));\n for (const entry of entries) {\n const path = join(dir, entry.name);\n if (entry.isDirectory()) {\n paths.push(...(await findHTMLFiles(path)));\n } else if (entry.isFile() && entry.name.endsWith('.html')) {\n paths.push(path);\n }\n }\n return paths;\n}\n\nfunction crossOriginAssetsPrefix(\n assetsPrefix?: string | Record<string, string>,\n site?: URL,\n): string | null {\n if (!assetsPrefix) return null;\n const prefix =\n typeof assetsPrefix === 'string'\n ? assetsPrefix\n : assetsPrefix.css || assetsPrefix.fallback;\n if (!/^(?:[a-z][a-z\\d+.-]*:|\\/\\/)/i.test(prefix)) return null;\n if (!site) return prefix;\n\n try {\n const prefixURL = prefix.startsWith('//')\n ? new URL(`${site.protocol}${prefix}`)\n : new URL(prefix);\n return prefixURL.origin === site.origin ? null : prefix;\n } catch {\n return prefix;\n }\n}\n\nfunction validateExtractedURLs(\n pages: ExtractablePage[],\n assetsPrefix?: string | Record<string, string>,\n site?: URL,\n): void {\n const externalPrefix = crossOriginAssetsPrefix(assetsPrefix, site);\n for (const page of pages) {\n for (const artifact of page.artifacts) {\n const unsafe = findUnsafeCSSResource(\n artifact.css,\n externalPrefix !== null,\n );\n if (unsafe) {\n const reason = unsafe.rootRelative\n ? `root-relative CSS URL \"${unsafe.url}\" would resolve against the external assetsPrefix \"${externalPrefix}\" instead of the page origin`\n : `page-relative CSS URL \"${unsafe.url}\" cannot preserve its target`;\n throw new Error(\n `[Tasty] Astro CSS extraction cannot preserve ${reason} in ${page.path} (${artifact.kind} artifact ${artifact.id}). Use an absolute URL or a data URL${externalPrefix ? '' : ', or a root-relative URL such as url(/path/to/asset)'}.`,\n );\n }\n }\n }\n}\n\n/** Find artifacts emitted by every styled page, in the first page's order. */\nfunction selectSharedArtifacts(\n pages: ExtractablePage[],\n): ServerStyleArtifact[] {\n if (pages.length < 2) return [];\n\n const source = pages[0].artifacts;\n const otherIds = pages\n .slice(1)\n .map((page) => new Set(page.artifacts.map(({ id }) => id)));\n\n return source.filter(({ id }) => otherIds.every((ids) => ids.has(id)));\n}\n\nfunction stylesheetHref(\n base: string,\n assets: string,\n filename: string,\n assetsPrefix?: string | Record<string, string>,\n): string {\n const assetsPath = assets.replace(/^\\/+|\\/+$/g, '');\n if (assetsPrefix) {\n const prefix =\n typeof assetsPrefix === 'string'\n ? assetsPrefix\n : assetsPrefix.css || assetsPrefix.fallback;\n return `${prefix.replace(/\\/+$/g, '')}/${assetsPath}/${filename}`;\n }\n\n const basePath = base === '/' ? '' : `/${base.replace(/^\\/+|\\/+$/g, '')}`;\n return `${basePath}/${assetsPath}/${filename}`;\n}\n\nfunction stylesheetLink(page: ExtractablePage, href: string): string {\n const nonceAttr = page.styleOpen.match(/\\snonce=\"[^\"]*\"/)?.[0] ?? '';\n return `<link rel=\"stylesheet\" href=\"${href}\" data-tasty-ssr${nonceAttr}>`;\n}\n\nfunction transformPage(page: ExtractablePage, hrefs: string[]): string {\n const replacement = hrefs.map((href) => stylesheetLink(page, href)).join('');\n\n return (\n page.html.slice(0, page.styleStart) +\n replacement +\n page.html.slice(page.replacementEnd)\n );\n}\n\nasync function writeStylesheet(\n assetDir: string,\n scope: 'shared' | 'page',\n artifacts: ServerStyleArtifact[],\n): Promise<string | null> {\n if (artifacts.length === 0) return null;\n\n const css = artifacts.map(({ css }) => css).join('\\n');\n const hash = createHash('sha256').update(css).digest('hex').slice(0, 12);\n const filename = `tasty.${scope}.${hash}.css`;\n await writeFile(join(assetDir, filename), css);\n return filename;\n}\n\nexport async function extractAstroCSS(options: {\n dir: URL;\n base: string;\n assets: string;\n assetsPrefix?: string | Record<string, string>;\n site?: URL;\n}): Promise<void> {\n const outputDir = fileURLToPath(options.dir);\n const paths = await findHTMLFiles(outputDir);\n const pages = (\n await Promise.all(\n paths.map(async (path) =>\n parseExtractablePage(path, await readFile(path, 'utf8')),\n ),\n )\n ).filter((page): page is ExtractablePage => page !== null);\n if (pages.length === 0) return;\n validateExtractedURLs(pages, options.assetsPrefix, options.site);\n\n const shared = selectSharedArtifacts(pages);\n const assetDir = join(outputDir, options.assets);\n await mkdir(assetDir, { recursive: true });\n const sharedFilename = await writeStylesheet(assetDir, 'shared', shared);\n const sharedHref = sharedFilename\n ? stylesheetHref(\n options.base,\n options.assets,\n sharedFilename,\n options.assetsPrefix,\n )\n : null;\n const sharedIds = new Set(shared.map(({ id }) => id));\n\n for (const page of pages) {\n const remainder = page.artifacts.filter(({ id }) => !sharedIds.has(id));\n const pageFilename = await writeStylesheet(assetDir, 'page', remainder);\n const hrefs = sharedHref ? [sharedHref] : [];\n if (pageFilename) {\n hrefs.push(\n stylesheetHref(\n options.base,\n options.assets,\n pageFilename,\n options.assetsPrefix,\n ),\n );\n }\n await writeFile(page.path, transformPage(page, hrefs));\n }\n}\n","/**\n * Astro integration for Tasty SSR.\n *\n * Provides:\n * - tastyIntegration() — Astro Integration API (recommended)\n * - tastyMiddleware() — manual middleware for advanced composition\n *\n * Import from '@tenphi/tasty/ssr/astro'.\n */\n\nimport { getRuntimeConfigState } from '../config-resources';\nimport { getSSRCollector, runWithCollector } from './async-storage';\nimport { createExtractionMetadata, extractAstroCSS } from './astro-extraction';\nimport { ServerStyleCollector } from './collector';\nimport { registerSSRCollectorGetterGlobal } from './ssr-collector-ref';\n\n// Wire up ALS-based collector discovery so computeStyles() can find\n// the collector set by tastyMiddleware's runWithCollector().\n// Uses globalThis so the getter is visible across Astro's separate\n// module graphs (middleware vs page components).\nregisterSSRCollectorGetterGlobal(getSSRCollector);\n\nexport interface TastyMiddlewareOptions {\n /**\n * Whether to embed the class-list script for client hydration.\n * Set to false to skip class transfer (e.g. for CSP restrictions).\n * Without it, client components may re-inject CSS that already exists\n * in server-rendered `<style>` tags. Default: true.\n */\n transferCache?: boolean;\n}\n\ninterface InternalTastyMiddlewareOptions extends TastyMiddlewareOptions {\n extractionMetadata?: boolean;\n}\n\n/**\n * Create an Astro middleware that collects Tasty styles during SSR.\n *\n * All React components rendered during the request will have their\n * computeStyles() calls captured by the collector via AsyncLocalStorage.\n * After rendering, the middleware injects the collected CSS into </head>.\n *\n * @example Manual middleware setup\n * ```ts\n * // src/middleware.ts\n * import { tastyMiddleware } from '@tenphi/tasty/ssr/astro';\n * export const onRequest = tastyMiddleware();\n * ```\n *\n * @example Composing with other middleware\n * ```ts\n * // src/middleware.ts\n * import { sequence } from 'astro:middleware';\n * import { tastyMiddleware } from '@tenphi/tasty/ssr/astro';\n *\n * export const onRequest = sequence(\n * tastyMiddleware(),\n * myOtherMiddleware,\n * );\n * ```\n */\nexport function tastyMiddleware(options?: TastyMiddlewareOptions) {\n const internalOptions = options as InternalTastyMiddlewareOptions | undefined;\n return async (\n context: { isPrerendered?: boolean },\n next: () => Promise<Response>,\n ): Promise<Response> => {\n const transferCache = options?.transferCache ?? true;\n const extractionMetadata =\n internalOptions?.extractionMetadata === true &&\n context.isPrerendered === true;\n const collector = new ServerStyleCollector();\n\n // Run the entire request — including body stream consumption — inside\n // the ALS context so that components rendering lazily during stream\n // reads can still find the collector via getSSRCollector().\n type Rendered =\n | { response: Response }\n | { html: string | null; status: number; headers: Headers };\n\n const rendered = await runWithCollector<Promise<Rendered>>(\n collector,\n async (): Promise<Rendered> => {\n const response = await next();\n const body = response.body;\n\n // Only process HTML responses. Reading a non-HTML body (e.g. an\n // image, font, or JSON endpoint) as UTF-8 text corrupts binary\n // payloads: every byte >= 0x80 is decoded to U+FFFD and re-encoded\n // as EF BF BD. Pass anything that isn't HTML straight through.\n const contentType = response.headers.get('content-type') ?? '';\n if (!body || !contentType.includes('text/html')) {\n return { response };\n }\n\n const reader = body.pipeThrough(new TextDecoderStream()).getReader();\n const parts: string[] = [];\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n parts.push(value);\n }\n return {\n html: parts.join(''),\n status: response.status,\n headers: response.headers,\n };\n },\n );\n\n // Non-HTML responses are returned untouched to avoid corrupting\n // binary payloads.\n if ('response' in rendered) {\n return rendered.response;\n }\n\n if (!rendered.html) {\n return new Response(null, {\n status: rendered.status,\n headers: rendered.headers,\n });\n }\n\n let { html } = rendered;\n\n const css = collector.getCSS();\n if (!css) {\n return new Response(html, {\n status: rendered.status,\n headers: rendered.headers,\n });\n }\n\n const nonce = getRuntimeConfigState()?.nonce;\n const nonceAttr = nonce ? ` nonce=\"${nonce}\"` : '';\n const styleTag = `<style data-tasty-ssr${nonceAttr}>${css}</style>`;\n const metadataTag = extractionMetadata\n ? createExtractionMetadata(collector.getArtifacts())\n : '';\n\n let cacheTag = '';\n if (transferCache) {\n const classNames = collector.getRenderedClassNames();\n if (classNames.length > 0) {\n const classListJSON = classNames.map((n) => `\"${n}\"`).join(',');\n cacheTag = `<script${nonceAttr}>(window.__TASTY__=window.__TASTY__||[]).push(${classListJSON})</script>`;\n }\n }\n\n const injection = styleTag + metadataTag + cacheTag;\n const idx = html.indexOf('</head>');\n if (idx !== -1) {\n html = html.slice(0, idx) + injection + html.slice(idx);\n } else {\n html = injection + html;\n }\n\n const headers = new Headers(rendered.headers);\n headers.delete('content-length');\n\n return new Response(html, {\n status: rendered.status,\n headers,\n });\n };\n}\n\n// ============================================================================\n// Astro Integration API\n// ============================================================================\n\n/**\n * Package subpaths of the middleware entrypoints registered by\n * `tastyIntegration()`.\n *\n * These must be bare specifiers rather than\n * `new URL('./astro-middleware.js', import.meta.url)`. The bundler is free to\n * hoist `tastyIntegration` into a shared chunk at a different directory depth\n * than `dist/ssr/`, which makes a relative URL resolve to a file that does not\n * exist and breaks the build for every consumer. A package subpath is resolved\n * by the consumer through our `exports` map, so it never depends on the\n * chunk layout.\n *\n * There are separate entrypoints instead of one parameterised entrypoint because\n * `addMiddleware()` cannot pass options: the integration runs when the Astro\n * config is loaded, while the middleware module is evaluated in the server\n * runtime — a different process for built output — so module-level state set\n * by the integration is not visible to the middleware.\n */\nconst MIDDLEWARE_ENTRYPOINT = '@tenphi/tasty/ssr/astro-middleware';\nconst MIDDLEWARE_ENTRYPOINT_STATIC =\n '@tenphi/tasty/ssr/astro-middleware-static';\nconst MIDDLEWARE_ENTRYPOINT_EXTRACT =\n '@tenphi/tasty/ssr/astro-middleware-extract';\nconst MIDDLEWARE_ENTRYPOINT_EXTRACT_STATIC =\n '@tenphi/tasty/ssr/astro-middleware-extract-static';\n\nexport interface TastyIntegrationCSSOptions {\n /**\n * CSS delivery mode. Extraction only applies to prerendered builds.\n * Extracted CSS preserves resource URLs verbatim, so use absolute URLs or\n * data URLs. Root-relative URLs are also supported unless `assetsPrefix`\n * sends CSS to an external origin. The build rejects resource URLs whose\n * targets would change after extraction.\n */\n mode?: 'inline' | 'extract';\n}\n\nexport interface TastyIntegrationOptions {\n /**\n * Enable island hydration support.\n *\n * When `true` (default): injects a client hydration script via\n * `injectScript('before-hydration')` and sets `transferCache: true`\n * on the middleware. Islands skip the style pipeline during hydration.\n *\n * When `false`: no client JS is shipped and `transferCache` is set\n * to `false`. Use this for fully static sites without `client:*`\n * directives.\n */\n islands?: boolean;\n /** Configure inline or build-wide extracted CSS delivery. */\n css?: TastyIntegrationCSSOptions;\n}\n\n/**\n * Astro integration that automatically sets up Tasty SSR.\n *\n * Registers middleware for cross-component CSS deduplication and\n * optionally injects a client hydration script for island support.\n *\n * @example Basic setup (with islands)\n * ```ts\n * // astro.config.mjs\n * import { tastyIntegration } from '@tenphi/tasty/ssr/astro';\n *\n * export default defineConfig({\n * integrations: [tastyIntegration()],\n * });\n * ```\n *\n * @example Static-only (no client JS)\n * ```ts\n * // astro.config.mjs\n * import { tastyIntegration } from '@tenphi/tasty/ssr/astro';\n *\n * export default defineConfig({\n * integrations: [tastyIntegration({ islands: false })],\n * });\n * ```\n */\nexport function tastyIntegration(options?: TastyIntegrationOptions) {\n const { islands = true } = options ?? {};\n const cssMode = options?.css?.mode ?? 'inline';\n let base = '/';\n let assets = '_astro';\n let assetsPrefix: string | Record<string, string> | undefined;\n let site: URL | undefined;\n\n return {\n name: '@tenphi/tasty',\n hooks: {\n 'astro:config:setup': ({\n addMiddleware,\n injectScript,\n }: {\n addMiddleware: (middleware: {\n entrypoint: string | URL;\n order: 'pre' | 'post';\n }) => void;\n injectScript: (\n stage: 'head-inline' | 'before-hydration' | 'page' | 'page-ssr',\n content: string,\n ) => void;\n }) => {\n addMiddleware({\n entrypoint:\n cssMode === 'extract'\n ? islands\n ? MIDDLEWARE_ENTRYPOINT_EXTRACT\n : MIDDLEWARE_ENTRYPOINT_EXTRACT_STATIC\n : islands\n ? MIDDLEWARE_ENTRYPOINT\n : MIDDLEWARE_ENTRYPOINT_STATIC,\n order: 'pre',\n });\n\n if (islands) {\n injectScript(\n 'before-hydration',\n `import \"@tenphi/tasty/ssr/astro-client\";`,\n );\n }\n },\n 'astro:config:done': ({\n config,\n }: {\n config: {\n base?: string;\n site?: URL;\n build?: {\n assets?: string;\n assetsPrefix?: string | Record<string, string>;\n };\n };\n }) => {\n base = config.base ?? '/';\n assets = config.build?.assets ?? '_astro';\n assetsPrefix = config.build?.assetsPrefix;\n site = config.site;\n },\n 'astro:build:done': async ({ dir }: { dir: URL }) => {\n if (cssMode !== 'extract') return;\n await extractAstroCSS({ dir, base, assets, assetsPrefix, site });\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;AAQA,MAAM,iBAAiB;AACvB,MAAM,eAAe;AAWrB,SAAgB,yBACd,WACQ;CACR,MAAM,UAAU,OAAO,KAAK,KAAK,UAAU,SAAS,GAAG,MAAM,CAAC,CAAC,SAC7D,QACF;CACA,OAAO,GAAG,iBAAiB,UAAU;AACvC;AAEA,SAAS,qBACP,MACA,MACwB;CACxB,MAAM,gBAAgB,KAAK,QAAQ,cAAc;CACjD,IAAI,kBAAkB,IAAI,OAAO;CAEjC,MAAM,uBAAuB,gBAAgB;CAC7C,MAAM,cAAc,KAAK,QAAQ,cAAc,oBAAoB;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AAc;KACZ,YACE,YAAY,YACR,UACE,gCACA,uCACF,UACE,wBACA;KACR,OAAO;IACT,CAAC;IAED,IAAI,SACF,aACE,oBACA,0CACF;GAEJ;GACA,sBAAsB,EACpB,aAUI;IACJ,OAAO,OAAO,QAAQ;IACtB,SAAS,OAAO,OAAO,UAAU;IACjC,eAAe,OAAO,OAAO;IAC7B,OAAO,OAAO;GAChB;GACA,oBAAoB,OAAO,EAAE,UAAwB;IACnD,IAAI,YAAY,WAAW;IAC3B,MAAM,gBAAgB;KAAE;KAAK;KAAM;KAAQ;KAAc;IAAK,CAAC;GACjE;EACF;CACF;AACF"}
@@ -0,0 +1,36 @@
1
+ import { i as ServerStyleArtifactKind, n as createServerStyleCollector, r as ServerStyleArtifact, t as ServerStyleCollector } from "../collector-w4mBj5gd.js";
2
+ //#region src/ssr/async-storage.d.ts
3
+ /**
4
+ * Run a function with a ServerStyleCollector bound to the current
5
+ * async context. All useStyles() calls within `fn` (and any async
6
+ * continuations) will find this collector via getSSRCollector().
7
+ */
8
+ export declare function runWithCollector<T>(collector: ServerStyleCollector, fn: () => T): T;
9
+ /**
10
+ * Retrieve the ServerStyleCollector bound to the current async context.
11
+ * Returns null when called outside of runWithCollector() or on the client.
12
+ */
13
+ export declare function getSSRCollector(): ServerStyleCollector | null;
14
+ //#endregion
15
+ //#region src/ssr/hydrate.d.ts
16
+ /**
17
+ * Client-side cache hydration for SSR/RSC.
18
+ *
19
+ * Registers class names rendered on the server with the client injector. If
20
+ * the runtime is not initialized yet, registration is deferred until its first
21
+ * use. With hash-based naming, only the class name list needs to cross the
22
+ * wire — no cache keys or counters.
23
+ */
24
+ /**
25
+ * Hydrate the client-side style registry from the server's class name list.
26
+ *
27
+ * Call this before ReactDOM.hydrateRoot() or ensure it runs before
28
+ * any tasty() component renders on the client.
29
+ *
30
+ * When called without arguments, reads the class list from `window.__TASTY__`
31
+ * (populated by inline scripts emitted during SSR/RSC streaming).
32
+ */
33
+ export declare function hydrateTastyClasses(classes?: string[]): void;
34
+ //#endregion
35
+ export { type ServerStyleArtifact, type ServerStyleArtifactKind, ServerStyleCollector, createServerStyleCollector };
36
+ //# sourceMappingURL=index.d.ts.map