@tenphi/tasty 0.0.0-snapshot.d656d18 → 0.0.0-snapshot.d7129ca

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 (92) hide show
  1. package/README.md +6 -6
  2. package/dist/{babel-_RVkw0iE.d.ts → babel-DD7kdEFT.d.ts} +2 -2
  3. package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
  4. package/dist/chunks/{async-storage-DKK-wTD4.js.map → async-storage-CG5HnUT5.js.map} +1 -1
  5. package/dist/chunks/build-config-CUQVwdWF.js +42 -0
  6. package/dist/chunks/build-config-CUQVwdWF.js.map +1 -0
  7. package/dist/chunks/{collector-DBGcmUEq.js → collector-B0LTHw6Z.js} +6 -124
  8. package/dist/chunks/collector-B0LTHw6Z.js.map +1 -0
  9. package/dist/chunks/config-engine-C3pF9EK9.js +267 -0
  10. package/dist/chunks/config-engine-C3pF9EK9.js.map +1 -0
  11. package/dist/chunks/css-definitions-D_it4XZH.js +875 -0
  12. package/dist/chunks/css-definitions-D_it4XZH.js.map +1 -0
  13. package/dist/chunks/{css-resources-Cyl_axbI.js → css-resources-BN8apgxt.js} +1 -8
  14. package/dist/chunks/{css-resources-Cyl_axbI.js.map → css-resources-BN8apgxt.js.map} +1 -1
  15. package/dist/chunks/{debug-BUwqo6vC.js → debug-CiiHDgmR.js} +69 -150
  16. package/dist/chunks/debug-CiiHDgmR.js.map +1 -0
  17. package/dist/chunks/{dsl-CXvoaLnj.js → dsl-C5yuAn41.js} +62 -786
  18. package/dist/chunks/dsl-C5yuAn41.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-sH6r6Ajr.js +557 -0
  22. package/dist/chunks/react-runtime-sH6r6Ajr.js.map +1 -0
  23. package/dist/chunks/runtime-engine-BrRcOZwD.js +2438 -0
  24. package/dist/chunks/runtime-engine-BrRcOZwD.js.map +1 -0
  25. package/dist/chunks/runtime-state-BTDqSYBk.js +127 -0
  26. package/dist/chunks/runtime-state-BTDqSYBk.js.map +1 -0
  27. package/dist/chunks/{shared-utils-OIg0N_dp.js → shared-utils-DWA4LjIa.js} +24 -62
  28. package/dist/chunks/shared-utils-DWA4LjIa.js.map +1 -0
  29. package/dist/chunks/{style-engine-CqSmIlud.js → style-engine-C1ECBZxR.js} +671 -2736
  30. package/dist/chunks/style-engine-C1ECBZxR.js.map +1 -0
  31. package/dist/chunks/{css-writer-PFzrSPeu.js → zero-engine-B6EnYcXY.js} +3 -120
  32. package/dist/chunks/zero-engine-B6EnYcXY.js.map +1 -0
  33. package/dist/{collector-CVdVIy7s.d.ts → collector-YpsMjV7T.d.ts} +6 -4
  34. package/dist/{config-BI0y21JV.d.ts → config-BnZqyYG4.d.ts} +16 -25
  35. package/dist/core/index.d.ts +5 -5
  36. package/dist/core/index.js +9 -7
  37. package/dist/{index-CrT0bsiI.d.ts → index-BLJLo9cl.d.ts} +17 -50
  38. package/dist/index.d.ts +5 -5
  39. package/dist/index.js +10 -7
  40. package/dist/{merge-styles-BFktNP8J.d.ts → merge-styles-CTDLIrO5.d.ts} +2 -2
  41. package/dist/ssr/astro-client.js +1 -14
  42. package/dist/ssr/astro-client.js.map +1 -1
  43. package/dist/ssr/astro-middleware-static.js +0 -11
  44. package/dist/ssr/astro-middleware-static.js.map +1 -1
  45. package/dist/ssr/astro-middleware.js +0 -12
  46. package/dist/ssr/astro-middleware.js.map +1 -1
  47. package/dist/ssr/astro.js +5 -85
  48. package/dist/ssr/astro.js.map +1 -1
  49. package/dist/ssr/index.d.ts +6 -6
  50. package/dist/ssr/index.js +4 -4
  51. package/dist/ssr/next-config.d.ts +1 -1
  52. package/dist/ssr/next-config.js +29 -20
  53. package/dist/ssr/next-config.js.map +1 -1
  54. package/dist/ssr/next.d.ts +1 -1
  55. package/dist/ssr/next.js +5 -36
  56. package/dist/ssr/next.js.map +1 -1
  57. package/dist/static/index.d.ts +2 -2
  58. package/dist/static/index.js +1 -19
  59. package/dist/static/index.js.map +1 -1
  60. package/dist/{index-BzAC3p06.d.ts → types-vfRQhzRd.d.ts} +811 -811
  61. package/dist/zero/babel.d.ts +1 -1
  62. package/dist/zero/babel.js +25 -95
  63. package/dist/zero/babel.js.map +1 -1
  64. package/dist/zero/index.d.ts +1 -1
  65. package/dist/zero/index.js +1 -1
  66. package/dist/zero/next.d.ts +1 -1
  67. package/dist/zero/next.js +0 -31
  68. package/dist/zero/next.js.map +1 -1
  69. package/docs/ai-agents.md +5 -1
  70. package/docs/dsl.md +2 -2
  71. package/docs/getting-started.md +12 -11
  72. package/docs/methodology.md +2 -2
  73. package/docs/pipeline.md +3 -0
  74. package/docs/plugins.md +1 -1
  75. package/docs/runtime-benchmarks.md +105 -68
  76. package/docs/ssr.md +1 -1
  77. package/docs/styles.md +5 -5
  78. package/docs/tasty-static.md +1 -1
  79. package/package.json +29 -10
  80. package/dist/chunks/async-storage-DKK-wTD4.js +0 -44
  81. package/dist/chunks/collector-DBGcmUEq.js.map +0 -1
  82. package/dist/chunks/css-writer-PFzrSPeu.js.map +0 -1
  83. package/dist/chunks/debug-BUwqo6vC.js.map +0 -1
  84. package/dist/chunks/dsl-CXvoaLnj.js.map +0 -1
  85. package/dist/chunks/hydrate-6YoHZP6A.js +0 -37
  86. package/dist/chunks/hydrate-6YoHZP6A.js.map +0 -1
  87. package/dist/chunks/react-runtime-B3CmvDEQ.js +0 -1525
  88. package/dist/chunks/react-runtime-B3CmvDEQ.js.map +0 -1
  89. package/dist/chunks/runtime-engine-Y00VWjrS.js +0 -4719
  90. package/dist/chunks/runtime-engine-Y00VWjrS.js.map +0 -1
  91. package/dist/chunks/shared-utils-OIg0N_dp.js.map +0 -1
  92. package/dist/chunks/style-engine-CqSmIlud.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { _ as TastyPluginFactory, w as StyleInjector } from "./config-BI0y21JV.js";
2
- import { B as StyleValueStateMap, D as CSSMap, I as StyleHandlerResult, M as ResolvedStyleValue, N as StyleHandler, R as StylePropValue, St as KeyframesSteps, _t as InjectResult, at as CSSProperties$1, b as Styles, dt as FunctionDefinition, gt as InjectOptions, ht as GlobalInjectResult, j as RawStyleHandler, kt as StyleInjectorConfig, lt as FontFaceDescriptors, mt as GCOptions, n as StyleResult, nt as StyleDetails, ot as CacheMetrics, st as CounterStyleDescriptors, ut as FontFaceInput, wt as PropertyOptions, x as StylesInterface, xt as KeyframesResult, z as StyleValue } from "./index-BzAC3p06.js";
3
- import { r as ServerStyleCollector } from "./collector-CVdVIy7s.js";
1
+ import { Ft as CSSProperties$1, M as StyleResult, Mt as StyleDetails, X as Styles, Z as StylesInterface, _ as KeyframesSteps, a as FontFaceInput, ct as ResolvedStyleValue, d as InjectOptions, f as InjectResult, ft as StyleHandlerResult, g as KeyframesResult, gt as StyleValueStateMap, ht as StyleValue, i as FontFaceDescriptors, l as GCOptions, lt as StyleHandler, mt as StylePropValue, n as CounterStyleDescriptors, o as FunctionDefinition, rt as CSSMap, st as RawStyleHandler, t as CacheMetrics, u as GlobalInjectResult, w as StyleInjectorConfig, y as PropertyOptions } from "./types-vfRQhzRd.js";
2
+ import { m as TastyPluginFactory, x as StyleInjector } from "./config-BnZqyYG4.js";
3
+ import { t as ServerStyleCollector } from "./collector-YpsMjV7T.js";
4
4
  import { AllHTMLAttributes, CSSProperties, ComponentType, ElementType, ForwardRefExoticComponent, JSX, PropsWithoutRef, ReactNode, RefAttributes } from "react";
5
5
 
6
6
  //#region src/utils/name-prefix.d.ts
@@ -1504,18 +1504,18 @@ declare const styleHandlers: {
1504
1504
  readonly shadow: typeof shadowStyle;
1505
1505
  readonly transition: typeof transitionStyle;
1506
1506
  readonly width: typeof widthStyle;
1507
- readonly blockPadding: StyleHandler<Partial<Record<"blockPadding", string | number | boolean | undefined>>>;
1508
- readonly inlinePadding: StyleHandler<Partial<Record<"inlinePadding", string | number | boolean | undefined>>>;
1509
- readonly blockMargin: StyleHandler<Partial<Record<"blockMargin", string | number | boolean | undefined>>>;
1510
- readonly inlineMargin: StyleHandler<Partial<Record<"inlineMargin", string | number | boolean | undefined>>>;
1511
- readonly blockInset: StyleHandler<Partial<Record<"blockInset", string | number | boolean | undefined>>>;
1512
- readonly inlineInset: StyleHandler<Partial<Record<"inlineInset", string | number | boolean | undefined>>>;
1513
- readonly blockScrollMargin: StyleHandler<Partial<Record<"blockScrollMargin", string | number | boolean | undefined>>>;
1514
- readonly inlineScrollMargin: StyleHandler<Partial<Record<"inlineScrollMargin", string | number | boolean | undefined>>>;
1515
- readonly blockScrollPadding: StyleHandler<Partial<Record<"blockScrollPadding", string | number | boolean | undefined>>>;
1516
- readonly inlineScrollPadding: StyleHandler<Partial<Record<"inlineScrollPadding", string | number | boolean | undefined>>>;
1517
1507
  readonly blockBorder: StyleHandler<Partial<Record<"blockBorder", string | number | boolean | undefined>>>;
1518
1508
  readonly inlineBorder: StyleHandler<Partial<Record<"inlineBorder", string | number | boolean | undefined>>>;
1509
+ readonly blockScrollPadding: StyleHandler<Partial<Record<"blockScrollPadding", string | number | boolean | undefined>>>;
1510
+ readonly inlineScrollPadding: StyleHandler<Partial<Record<"inlineScrollPadding", string | number | boolean | undefined>>>;
1511
+ readonly blockScrollMargin: StyleHandler<Partial<Record<"blockScrollMargin", string | number | boolean | undefined>>>;
1512
+ readonly inlineScrollMargin: StyleHandler<Partial<Record<"inlineScrollMargin", string | number | boolean | undefined>>>;
1513
+ readonly blockInset: StyleHandler<Partial<Record<"blockInset", string | number | boolean | undefined>>>;
1514
+ readonly inlineInset: StyleHandler<Partial<Record<"inlineInset", string | number | boolean | undefined>>>;
1515
+ readonly blockMargin: StyleHandler<Partial<Record<"blockMargin", string | number | boolean | undefined>>>;
1516
+ readonly inlineMargin: StyleHandler<Partial<Record<"inlineMargin", string | number | boolean | undefined>>>;
1517
+ readonly blockPadding: StyleHandler<Partial<Record<"blockPadding", string | number | boolean | undefined>>>;
1518
+ readonly inlinePadding: StyleHandler<Partial<Record<"inlinePadding", string | number | boolean | undefined>>>;
1519
1519
  readonly blockSize: typeof blockSizeStyle;
1520
1520
  readonly border: typeof borderStyle;
1521
1521
  readonly color: typeof colorStyle;
@@ -1835,43 +1835,10 @@ declare function filterBaseProps<T extends object>(props: T, opts?: PropsFilterO
1835
1835
  declare function color$1(name: string, opacity?: number): string;
1836
1836
  //#endregion
1837
1837
  //#region src/utils/mod-attrs.d.ts
1838
- declare const _modAttrs: (firstArg: Record<string, ModValue> | undefined, secondArg?: unknown) => Record<string, string> | null;
1839
- //#endregion
1840
- //#region src/utils/dotize.d.ts
1841
- declare const dotize: {
1842
- valTypes: {
1843
- none: string;
1844
- primitive: string;
1845
- object: string;
1846
- array: string;
1847
- };
1848
- getValType: (val: any) => string | undefined;
1849
- getPathType: (arrPath: any) => string[];
1850
- isUndefined: (obj: any) => obj is undefined;
1851
- isNumber: (f: any) => boolean;
1852
- isEmptyObj: (obj: any) => boolean;
1853
- isPlainObject: (obj: any) => boolean;
1854
- isNotObject: (obj: any) => boolean;
1855
- isEmptyArray: (arr: any) => boolean;
1856
- isNotArray: (arr: any) => boolean;
1857
- removeEmptyArrayItem: (arr: any) => any;
1858
- getFieldName: (field: any, prefix: any, isRoot: any, isArrayItem: any, isArray: any) => string;
1859
- startsWith: (val: any, valToSearch: any) => boolean;
1860
- convert: (obj: any, prefix?: string) => any;
1861
- backward: (obj: any, prefix: any) => any;
1862
- };
1838
+ declare function modAttrs(map: AllBaseProps['mods']): Record<string, string> | null;
1863
1839
  //#endregion
1864
1840
  //#region src/utils/resolve-recipes.d.ts
1865
- /**
1866
- * Resolve all `recipe` style properties in a styles object.
1867
- *
1868
- * Handles both top-level and sub-element recipe references.
1869
- * Returns the same object reference if no recipes are present anywhere
1870
- * (zero overhead for the common case).
1871
- *
1872
- * @param styles - The styles object potentially containing `recipe` keys
1873
- * @returns Resolved styles with recipe values merged in, or the original object if unchanged
1874
- */
1841
+ /** Resolve recipe references against the globally configured recipe map. */
1875
1842
  declare function resolveRecipes(styles: Styles): Styles;
1876
1843
  //#endregion
1877
1844
  //#region src/utils/process-tokens.d.ts
@@ -1976,5 +1943,5 @@ declare const tastyDebug: {
1976
1943
  install(): void;
1977
1944
  };
1978
1945
  //#endregion
1979
- export { resolveFunctionColor as $, Mods as $t, isPropertyDefined as A, TastyComponentPropsWithDefaults as At, defineHandler as B, BaseProps as Bt, getCSSTextForNode as C, DEFAULT_NAME_PREFIX as Cn, ModPropsInput as Ct, injectGlobal as D, ResolveTokenProps as Dt, inject as E, ResolveModProps as Et, ChunkSheetRegistry as F, TokenPropsInput as Ft, CHUNK_NAMES as G, BlockStyleProps as Gt, ChunkInfo as H, BaseStyleProps as Ht, chunkSheetRegistry as I, VariantMap as It, DISPLAY_CHUNK_STYLES as J, DimensionStyleProps as Jt, ChunkName as K, ColorStyleProps as Kt, ComputeStylesOptions as L, WithVariant as Lt, ownKeyframes as M, TastyElementProps as Mt, property as N, TastyPolymorphicComponent as Nt, injectRawCSS as O, SubElementDefinition as Ot, touch as P, TastyProps as Pt, STYLE_TO_CHUNK as Q, ModValue as Qt, ComputeStylesResult as R, tasty as Rt, getCSSText as S, TEXT_STYLES as Sn, ModPropDef as St, holdKeyframes as T, ResolveModPropDef as Tt, categorizeStyleKeys as U, BlockInnerStyleProps as Ut, styleHandlers as V, BasePropsWithoutChildren as Vt, APPEARANCE_CHUNK_STYLES as W, BlockOuterStyleProps as Wt, LAYOUT_CHUNK_STYLES as X, FlowStyleProps as Xt, FONT_CHUNK_STYLES as Y, ExtraBaseStyleProps as Yt, POSITION_CHUNK_STYLES as Z, InnerStyleProps as Zt, createInjector as _, DIMENSION_STYLES as _n, UseStylesResult as _t, DebugOptions as a, TastyCustomProps as an, getDisplayName as at, func as b, OUTER_STYLES as bn, Element$1 as bt, tastyDebug as c, TextStyleProps as cn, UseFunctionOptions as ct, dotize as d, BASE_STYLES as dn, useFontFace as dt, OuterStyleProps as en, createColorFunc as et, _modAttrs as f, BLOCK_INNER_STYLES as fn, UsePropertyOptions as ft, counterStyle as g, CONTAINER_STYLES as gn, useGlobalStyles as gt, cleanup as h, COLOR_STYLES as hn, useRawCSS as ht, DebugChunkInfo as i, TastyBaseStylePropNames as in, okhslPlugin as it, keyframes as j, TastyElementOptions as jt, injector as k, SubElementProps as kt, processTokens as l, TokenValue as ln, useFunction as lt, filterBaseProps as m, BLOCK_STYLES as mn, useKeyframes as mt, CacheStatus as n, ShortGridStyles as nn, okhstPlugin as nt, InspectResult as o, TastyExtensionConfig as on, TastyBatchProvider as ot, color$1 as p, BLOCK_OUTER_STYLES as pn, useProperty as pt, DIMENSION_CHUNK_STYLES as q, ContainerStyleProps as qt, ChunkBreakdown as r, TagName as rn, okhslFunction as rt, Summary as s, TastyThemeNames as sn, TastyBatchProviderProps as st, CSSOptions as t, PositionStyleProps as tn, okhstFunction as tt, resolveRecipes as u, Tokens as un, useCounterStyle as ut, destroy as v, FLOW_STYLES as vn, useStyles as vt, getRawCSSText as w, DEFAULT_ZERO_NAME_PREFIX as wn, ResolveAsProps as wt, gc as x, POSITION_STYLES as xn, ElementsDefinition as xt, fontFace as y, INNER_STYLES as yn, AllBasePropsWithMods as yt, computeStyles as z, AllBaseProps as zt };
1980
- //# sourceMappingURL=index-CrT0bsiI.d.ts.map
1946
+ export { createColorFunc as $, OuterStyleProps as $t, keyframes as A, TastyElementOptions as At, styleHandlers as B, BasePropsWithoutChildren as Bt, getRawCSSText as C, DEFAULT_ZERO_NAME_PREFIX as Cn, ResolveAsProps as Ct, injectRawCSS as D, SubElementDefinition as Dt, injectGlobal as E, ResolveTokenProps as Et, chunkSheetRegistry as F, VariantMap as Ft, ChunkName as G, ColorStyleProps as Gt, categorizeStyleKeys as H, BlockInnerStyleProps as Ht, ComputeStylesOptions as I, WithVariant as It, FONT_CHUNK_STYLES as J, ExtraBaseStyleProps as Jt, DIMENSION_CHUNK_STYLES as K, ContainerStyleProps as Kt, ComputeStylesResult as L, tasty as Lt, property as M, TastyPolymorphicComponent as Mt, touch as N, TastyProps as Nt, injector as O, SubElementProps as Ot, ChunkSheetRegistry as P, TokenPropsInput as Pt, resolveFunctionColor as Q, Mods as Qt, computeStyles as R, AllBaseProps as Rt, getCSSTextForNode as S, DEFAULT_NAME_PREFIX as Sn, ModPropsInput as St, inject as T, ResolveModProps as Tt, APPEARANCE_CHUNK_STYLES as U, BlockOuterStyleProps as Ut, ChunkInfo as V, BaseStyleProps as Vt, CHUNK_NAMES as W, BlockStyleProps as Wt, POSITION_CHUNK_STYLES as X, InnerStyleProps as Xt, LAYOUT_CHUNK_STYLES as Y, FlowStyleProps as Yt, STYLE_TO_CHUNK as Z, ModValue as Zt, destroy as _, FLOW_STYLES as _n, useStyles as _t, DebugOptions as a, TastyExtensionConfig as an, TastyBatchProvider as at, gc as b, POSITION_STYLES as bn, ElementsDefinition as bt, tastyDebug as c, TokenValue as cn, useFunction as ct, modAttrs as d, BLOCK_INNER_STYLES as dn, UsePropertyOptions as dt, PositionStyleProps as en, okhstFunction as et, color$1 as f, BLOCK_OUTER_STYLES as fn, useProperty as ft, createInjector as g, DIMENSION_STYLES as gn, UseStylesResult as gt, counterStyle as h, CONTAINER_STYLES as hn, useGlobalStyles as ht, DebugChunkInfo as i, TastyCustomProps as in, getDisplayName as it, ownKeyframes as j, TastyElementProps as jt, isPropertyDefined as k, TastyComponentPropsWithDefaults as kt, processTokens as l, Tokens as ln, useCounterStyle as lt, cleanup as m, COLOR_STYLES as mn, useRawCSS as mt, CacheStatus as n, TagName as nn, okhslFunction as nt, InspectResult as o, TastyThemeNames as on, TastyBatchProviderProps as ot, filterBaseProps as p, BLOCK_STYLES as pn, useKeyframes as pt, DISPLAY_CHUNK_STYLES as q, DimensionStyleProps as qt, ChunkBreakdown as r, TastyBaseStylePropNames as rn, okhslPlugin as rt, Summary as s, TextStyleProps as sn, UseFunctionOptions as st, CSSOptions as t, ShortGridStyles as tn, okhstPlugin as tt, resolveRecipes as u, BASE_STYLES as un, useFontFace as ut, fontFace as v, INNER_STYLES as vn, AllBasePropsWithMods as vt, holdKeyframes as w, ResolveModPropDef as wt, getCSSText as x, TEXT_STYLES as xn, ModPropDef as xt, func as y, OUTER_STYLES as yn, Element$1 as yt, defineHandler as z, BaseProps as zt };
1947
+ //# sourceMappingURL=index-BLJLo9cl.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ParseFunction, D as PropHandlerDefinition, E as PropHandler, O as PropHandlerProps, S as FunctionsConfig, T as SheetManager, _ as TastyPluginFactory, a as getGlobalFontFaces, b as generateTypographyTokens, c as getGlobalRecipes, d as hasGlobalRecipes, f as isConfigLocked, g as TastyPlugin, h as hasStylesGenerated, i as getGlobalCounterStyles, l as getNamePrefix, m as resetConfig, n as configure, o as getGlobalFunctions, p as isTestEnvironment, r as getConfig, s as getGlobalKeyframes, t as TastyConfig, u as hasGlobalKeyframes, v as TypographyPreset, w as StyleInjector, x as ColorSpace, y as TypographyTokenValue } from "./config-BI0y21JV.js";
2
- import { $ as StyleParser, A as ParsedColor, At as StyleRule, B as StyleValueStateMap, C as SuffixForSelector, Ct as PropertyDefinition, D as CSSMap, Dt as RuleInfo, E as AnyStyleHandler, Et as RootRegistry, F as StyleHandlerProps, Ft as resetStyleBatch, G as parseColor, H as getGlobalParser, I as StyleHandlerResult, J as getNamedColorHex, K as parseStyle, L as StyleMap, M as ResolvedStyleValue, Mt as QueuedWrite, N as StyleHandler, Nt as flushStyles, O as CUSTOM_UNITS, Ot as SheetInfo, P as StyleHandlerDefinition, Pt as hasPendingStyleWrites, Q as strToRgb, R as StylePropValue, S as StylesWithoutSelectors, St as KeyframesSteps, T as TastyPresetNames, Tt as RawCSSResult, U as getGlobalPredefinedTokens, V as filterMods, W as normalizeColorTokenValue, X as hexToRgb, Y as getRgbValuesFromRgbaString, Z as hslToRgbValues, _ as NotSelector, _t as InjectResult, a as parseStateKey, at as CSSProperties, b as Styles, bt as KeyframesInfo, c as StateParserContext, ct as DisposeFunction, d as setGlobalPredefinedStates, dt as FunctionDefinition, et as ParserOptions, f as ConditionNode, ft as FunctionParameter, g as NoType, gt as InjectOptions, h as ConfigTokens, i as ParseStateKeyOptions, it as UnitHandler, j as RawStyleHandler, jt as StyleUsage, k as DIRECTIONS, kt as StyleInjectorConfig, l as createStateParserContext, lt as FontFaceDescriptors, m as ConfigTokenValue, mt as GCOptions, n as StyleResult, nt as StyleDetails, o as AtRuleContext, ot as CacheMetrics, p as isSelector, pt as GCConfig, q as stringifyStyles, r as renderStyles, rt as StyleDetailsPart, s as ParsedAdvancedState, st as CounterStyleDescriptors, t as RenderResult, tt as ProcessedStyle, u as getGlobalPredefinedStates, ut as FontFaceInput, v as RecipeStyles, vt as InjectionMode, w as TastyNamedColors, wt as PropertyOptions, x as StylesInterface, xt as KeyframesResult, y as Selector, yt as KeyframesCacheEntry, z as StyleValue } from "./index-BzAC3p06.js";
3
- import { $ as resolveFunctionColor, $t as Mods, A as isPropertyDefined, At as TastyComponentPropsWithDefaults, B as defineHandler, Bt as BaseProps, C as getCSSTextForNode, Cn as DEFAULT_NAME_PREFIX, Ct as ModPropsInput, D as injectGlobal, Dt as ResolveTokenProps, E as inject, Et as ResolveModProps, F as ChunkSheetRegistry, Ft as TokenPropsInput, G as CHUNK_NAMES, Gt as BlockStyleProps, H as ChunkInfo, Ht as BaseStyleProps, I as chunkSheetRegistry, It as VariantMap, J as DISPLAY_CHUNK_STYLES, Jt as DimensionStyleProps, K as ChunkName, Kt as ColorStyleProps, L as ComputeStylesOptions, Lt as WithVariant, M as ownKeyframes, Mt as TastyElementProps, N as property, Nt as TastyPolymorphicComponent, O as injectRawCSS, Ot as SubElementDefinition, P as touch, Pt as TastyProps, Q as STYLE_TO_CHUNK, Qt as ModValue, R as ComputeStylesResult, Rt as tasty, S as getCSSText, Sn as TEXT_STYLES, St as ModPropDef, T as holdKeyframes, Tt as ResolveModPropDef, U as categorizeStyleKeys, Ut as BlockInnerStyleProps, V as styleHandlers, Vt as BasePropsWithoutChildren, W as APPEARANCE_CHUNK_STYLES, Wt as BlockOuterStyleProps, X as LAYOUT_CHUNK_STYLES, Xt as FlowStyleProps, Y as FONT_CHUNK_STYLES, Yt as ExtraBaseStyleProps, Z as POSITION_CHUNK_STYLES, Zt as InnerStyleProps, _ as createInjector, _n as DIMENSION_STYLES, _t as UseStylesResult, a as DebugOptions, an as TastyCustomProps, at as getDisplayName, b as func, bn as OUTER_STYLES, bt as Element, c as tastyDebug, cn as TextStyleProps, ct as UseFunctionOptions, d as dotize, dn as BASE_STYLES, dt as useFontFace, en as OuterStyleProps, et as createColorFunc, f as _modAttrs, fn as BLOCK_INNER_STYLES, ft as UsePropertyOptions, g as counterStyle, gn as CONTAINER_STYLES, gt as useGlobalStyles, h as cleanup, hn as COLOR_STYLES, ht as useRawCSS, i as DebugChunkInfo, in as TastyBaseStylePropNames, it as okhslPlugin, j as keyframes, jt as TastyElementOptions, k as injector, kt as SubElementProps, l as processTokens, ln as TokenValue, lt as useFunction, m as filterBaseProps, mn as BLOCK_STYLES, mt as useKeyframes, n as CacheStatus, nn as ShortGridStyles, nt as okhstPlugin, o as InspectResult, on as TastyExtensionConfig, ot as TastyBatchProvider, p as color, pn as BLOCK_OUTER_STYLES, pt as useProperty, q as DIMENSION_CHUNK_STYLES, qt as ContainerStyleProps, r as ChunkBreakdown, rn as TagName, rt as okhslFunction, s as Summary, sn as TastyThemeNames, st as TastyBatchProviderProps, t as CSSOptions, tn as PositionStyleProps, tt as okhstFunction, u as resolveRecipes, un as Tokens, ut as useCounterStyle, v as destroy, vn as FLOW_STYLES, vt as useStyles, w as getRawCSSText, wn as DEFAULT_ZERO_NAME_PREFIX, wt as ResolveAsProps, x as gc, xn as POSITION_STYLES, xt as ElementsDefinition, y as fontFace, yn as INNER_STYLES, yt as AllBasePropsWithMods, z as computeStyles, zt as AllBaseProps } from "./index-CrT0bsiI.js";
4
- import { t as mergeStyles } from "./merge-styles-BFktNP8J.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, 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, holdKeyframes, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as 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 };
1
+ import { $ as SuffixForSelector, A as resetStyleBatch, At as ParserOptions, B as getGlobalPredefinedStates, C as SheetInfo, Ct as stringifyStyles, D as QueuedWrite, Dt as hslToRgbValues, E as StyleUsage, Et as hexToRgb, F as parseStateKey, Ft as CSSProperties, G as ConfigTokens, H as ConditionNode, I as AtRuleContext, J as RecipeStyles, K as NoType, L as ParsedAdvancedState, M as StyleResult, Mt as StyleDetails, N as renderStyles, Nt as StyleDetailsPart, O as flushStyles, Ot as strToRgb, P as ParseStateKeyOptions, Pt as UnitHandler, Q as StylesWithoutSelectors, R as StateParserContext, S as RuleInfo, St as parseStyle, T as StyleRule, Tt as getRgbValuesFromRgbaString, U as isSelector, V as setGlobalPredefinedStates, W as ConfigTokenValue, X as Styles, Y as Selector, Z as StylesInterface, _ as KeyframesSteps, _t as filterMods, a as FontFaceInput, at as DIRECTIONS, b as RawCSSResult, bt as normalizeColorTokenValue, c as GCConfig, ct as ResolvedStyleValue, d as InjectOptions, dt as StyleHandlerProps, et as TastyNamedColors, f as InjectResult, ft as StyleHandlerResult, g as KeyframesResult, gt as StyleValueStateMap, h as KeyframesInfo, ht as StyleValue, i as FontFaceDescriptors, it as CUSTOM_UNITS, j as RenderResult, jt as ProcessedStyle, k as hasPendingStyleWrites, kt as StyleParser, l as GCOptions, lt as StyleHandler, m as KeyframesCacheEntry, mt as StylePropValue, n as CounterStyleDescriptors, nt as AnyStyleHandler, o as FunctionDefinition, ot as ParsedColor, p as InjectionMode, pt as StyleMap, q as NotSelector, r as DisposeFunction, rt as CSSMap, s as FunctionParameter, st as RawStyleHandler, t as CacheMetrics, tt as TastyPresetNames, ut as StyleHandlerDefinition, v as PropertyDefinition, vt as getGlobalParser, w as StyleInjectorConfig, wt as getNamedColorHex, x as RootRegistry, xt as parseColor, y as PropertyOptions, yt as getGlobalPredefinedTokens, z as createStateParserContext } from "./types-vfRQhzRd.js";
2
+ import { C as PropHandler, D as getGlobalFontFaces, E as getGlobalCounterStyles, O as getGlobalFunctions, S as SheetManager, T as PropHandlerProps, _ as generateTypographyTokens, a as getGlobalRecipes, b as ParseFunction, c as hasGlobalRecipes, d as resetConfig, f as hasStylesGenerated, g as TypographyTokenValue, h as TypographyPreset, i as getGlobalKeyframes, l as isConfigLocked, m as TastyPluginFactory, n as configure, o as getNamePrefix, p as TastyPlugin, r as getConfig, s as hasGlobalKeyframes, t as TastyConfig, u as isTestEnvironment, v as ColorSpace, w as PropHandlerDefinition, x as StyleInjector, y as FunctionsConfig } from "./config-BnZqyYG4.js";
3
+ import { $ as createColorFunc, $t as OuterStyleProps, A as keyframes, At as TastyElementOptions, B as styleHandlers, Bt as BasePropsWithoutChildren, C as getRawCSSText, Cn as DEFAULT_ZERO_NAME_PREFIX, Ct as ResolveAsProps, D as injectRawCSS, Dt as SubElementDefinition, E as injectGlobal, 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, 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, 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, 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, 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-BLJLo9cl.js";
4
+ import { t as mergeStyles } from "./merge-styles-CTDLIrO5.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 CHANGED
@@ -1,8 +1,11 @@
1
- import { A as hslToRgbValues, C as createColorFunc, D as getNamedColorHex, O as getRgbValuesFromRgbaString, S as okhslPlugin, a as DIRECTIONS, b as okhstPlugin, d as normalizeColorTokenValue, f as parseColor, i as CUSTOM_UNITS, j as strToRgb, k as hexToRgb, l as getGlobalParser, n as color, p as parseStyle, r as resolveFunctionColor, s as filterMods, t as dotize, u as getGlobalPredefinedTokens, v as stringifyStyles, w as StyleParser, x as okhslFunction, y as okhstFunction } from "./chunks/dsl-CXvoaLnj.js";
2
- import { n as isSelector, t as mergeStyles } from "./chunks/shared-utils-OIg0N_dp.js";
3
- import { $ as getNamePrefix, A as holdKeyframes, B as ChunkSheetRegistry, C as destroy, Ct as DEFAULT_ZERO_NAME_PREFIX, D as getCSSText, E as gc, F as isPropertyDefined, H as configure, I as keyframes, J as getGlobalFunctions, K as getGlobalCounterStyles, L as ownKeyframes, M as injectGlobal, N as injectRawCSS, O as getCSSTextForNode, P as injector, R as property, S as createInjector, St as DEFAULT_NAME_PREFIX, T as func, U as getConfig, V as chunkSheetRegistry, X as getGlobalKeyframes, Z as getGlobalRecipes, a as resolveRecipes, at as resetConfig, b as cleanup, et as hasGlobalKeyframes, ht as SheetManager, it as isTestEnvironment, j as inject, k as getRawCSSText, nt as isConfigLocked, ot as generateTypographyTokens, q as getGlobalFontFaces, st as StyleInjector, tt as hasGlobalRecipes, vt as flushStyles, w as fontFace, x as counterStyle, xt as resetStyleBatch, yt as hasPendingStyleWrites, z as touch } from "./chunks/runtime-engine-Y00VWjrS.js";
4
- import { B as STYLE_TO_CHUNK, C as createStateParserContext, D as defineHandler, F as DIMENSION_CHUNK_STYLES, H as hasStylesGenerated, I as DISPLAY_CHUNK_STYLES, L as FONT_CHUNK_STYLES, N as APPEARANCE_CHUNK_STYLES, P as CHUNK_NAMES, R as LAYOUT_CHUNK_STYLES, T as setGlobalPredefinedStates, _ 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 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, w as getGlobalPredefinedStates, x as parseStateKey, z as POSITION_CHUNK_STYLES } from "./chunks/style-engine-CqSmIlud.js";
5
- import { _ as computeStyles, a as useProperty, c as useGlobalStyles, d as Element, f as tasty, g as filterBaseProps, h as _modAttrs, i as useFontFace, l as useStyles, m as processTokens, n as useFunction, o as useKeyframes, p as getDisplayName, r as useCounterStyle, s as useRawCSS, t as TastyBatchProvider } from "./chunks/react-runtime-B3CmvDEQ.js";
6
- import { t as tastyDebug } from "./chunks/debug-BUwqo6vC.js";
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-C5yuAn41.js";
2
+ import { n as isSelector, t as mergeStyles } from "./chunks/shared-utils-DWA4LjIa.js";
3
+ import { C as DEFAULT_NAME_PREFIX, w as DEFAULT_ZERO_NAME_PREFIX } from "./chunks/css-definitions-D_it4XZH.js";
4
+ import { A as APPEARANCE_CHUNK_STYLES, B as getGlobalPredefinedStates, F as LAYOUT_CHUNK_STYLES, H as hasStylesGenerated, I as POSITION_CHUNK_STYLES, L as STYLE_TO_CHUNK, M as DIMENSION_CHUNK_STYLES, N as DISPLAY_CHUNK_STYLES, O as styleHandlers, P as FONT_CHUNK_STYLES, V as setGlobalPredefinedStates, _ 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 CHUNK_NAMES, 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, w as defineHandler, x as parseStateKey, z as createStateParserContext } from "./chunks/style-engine-C1ECBZxR.js";
5
+ import { i as generateTypographyTokens } from "./chunks/config-engine-C3pF9EK9.js";
6
+ import { c as getGlobalFunctions, o as getGlobalCounterStyles, s as getGlobalFontFaces } from "./chunks/runtime-state-BTDqSYBk.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-BrRcOZwD.js";
8
+ import { t as tastyDebug } from "./chunks/debug-CiiHDgmR.js";
7
9
  import "./core/index.js";
8
- 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, holdKeyframes, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as 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 };
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-sH6r6Ajr.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 };
@@ -1,7 +1,7 @@
1
- import { b as Styles } from "./index-BzAC3p06.js";
1
+ import { X as Styles } from "./types-vfRQhzRd.js";
2
2
 
3
3
  //#region src/utils/merge-styles.d.ts
4
4
  declare function mergeStyles(...objects: (Styles | undefined | null)[]): Styles;
5
5
  //#endregion
6
6
  export { mergeStyles as t };
7
- //# sourceMappingURL=merge-styles-BFktNP8J.d.ts.map
7
+ //# sourceMappingURL=merge-styles-CTDLIrO5.d.ts.map
@@ -1,18 +1,5 @@
1
- import { t as hydrateTastyClasses } from "../chunks/hydrate-6YoHZP6A.js";
1
+ import { t as hydrateTastyClasses } from "../chunks/hydration-TRcz5vnk.js";
2
2
  //#region src/ssr/astro-client.ts
3
- /**
4
- * Client-side cache hydration for Astro islands.
5
- *
6
- * Reads the class name list from `window.__TASTY__` (populated by
7
- * inline scripts emitted during SSR) and pre-populates the injector
8
- * so island hydration skips the style pipeline entirely.
9
- *
10
- * This module is browser-safe — it does NOT import node:async_hooks.
11
- *
12
- * Usage:
13
- * - Automatically injected by tastyIntegration() via injectScript('before-hydration')
14
- * - Can be imported manually: `import '@tenphi/tasty/ssr/astro-client'`
15
- */
16
3
  if (typeof window !== "undefined") hydrateTastyClasses();
17
4
  //#endregion
18
5
 
@@ -1 +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"}
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"}
@@ -1,16 +1,5 @@
1
1
  import { tastyMiddleware } from "./astro.js";
2
2
  //#region src/ssr/astro-middleware-static.ts
3
- /**
4
- * Astro middleware entrypoint for `tastyIntegration({ islands: false })`.
5
- *
6
- * Registered via `addMiddleware()` as
7
- * `@tenphi/tasty/ssr/astro-middleware-static`. Exposed as a package subpath
8
- * only so Astro can resolve it — use `tastyMiddleware({ transferCache: false })`
9
- * directly if you need manual middleware composition.
10
- *
11
- * Identical to `./astro-middleware` except that no class-list `<script>` is
12
- * emitted, so a site without `client:*` islands ships zero client JavaScript.
13
- */
14
3
  const onRequest = tastyMiddleware({ transferCache: false });
15
4
  //#endregion
16
5
  export { onRequest };
@@ -1 +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"}
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"}
@@ -1,17 +1,5 @@
1
1
  import { tastyMiddleware } from "./astro.js";
2
2
  //#region src/ssr/astro-middleware.ts
3
- /**
4
- * Astro middleware entrypoint for `tastyIntegration()`.
5
- *
6
- * Registered via `addMiddleware()` as `@tenphi/tasty/ssr/astro-middleware`.
7
- * Exposed as a package subpath only so Astro can resolve it — use
8
- * `tastyMiddleware()` directly if you need manual middleware composition.
9
- *
10
- * This is the islands variant: the rendered class list is transferred to the
11
- * client so hydrating islands skip the style pipeline. See
12
- * `./astro-middleware-static` for the variant used by
13
- * `tastyIntegration({ islands: false })`.
14
- */
15
3
  const onRequest = tastyMiddleware({ transferCache: true });
16
4
  //#endregion
17
5
  export { onRequest };
@@ -1 +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"}
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"}
package/dist/ssr/astro.js CHANGED
@@ -1,7 +1,7 @@
1
- import { U as getConfig, d as registerSSRCollectorGetterGlobal } from "../chunks/runtime-engine-Y00VWjrS.js";
2
- import { t as ServerStyleCollector } from "../chunks/collector-DBGcmUEq.js";
3
- import { n as runWithCollector, t as getSSRCollector } from "../chunks/async-storage-DKK-wTD4.js";
4
- import { t as findUnsafeCSSResource } from "../chunks/css-resources-Cyl_axbI.js";
1
+ import { r as registerSSRCollectorGetterGlobal, u as getRuntimeConfigState } from "../chunks/runtime-state-BTDqSYBk.js";
2
+ import { t as ServerStyleCollector } from "../chunks/collector-B0LTHw6Z.js";
3
+ import { n as runWithCollector, t as getSSRCollector } from "../chunks/async-storage-CG5HnUT5.js";
4
+ import { t as findUnsafeCSSResource } from "../chunks/css-resources-BN8apgxt.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { join } from "node:path";
7
7
  import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
@@ -71,7 +71,6 @@ function validateExtractedURLs(pages, assetsPrefix, site) {
71
71
  }
72
72
  }
73
73
  }
74
- /** Find artifacts emitted by every styled page, in the first page's order. */
75
74
  function selectSharedArtifacts(pages) {
76
75
  if (pages.length < 2) return [];
77
76
  const source = pages[0].artifacts;
@@ -118,42 +117,7 @@ async function extractAstroCSS(options) {
118
117
  }
119
118
  //#endregion
120
119
  //#region src/ssr/astro.ts
121
- /**
122
- * Astro integration for Tasty SSR.
123
- *
124
- * Provides:
125
- * - tastyIntegration() — Astro Integration API (recommended)
126
- * - tastyMiddleware() — manual middleware for advanced composition
127
- *
128
- * Import from '@tenphi/tasty/ssr/astro'.
129
- */
130
120
  registerSSRCollectorGetterGlobal(getSSRCollector);
131
- /**
132
- * Create an Astro middleware that collects Tasty styles during SSR.
133
- *
134
- * All React components rendered during the request will have their
135
- * computeStyles() calls captured by the collector via AsyncLocalStorage.
136
- * After rendering, the middleware injects the collected CSS into </head>.
137
- *
138
- * @example Manual middleware setup
139
- * ```ts
140
- * // src/middleware.ts
141
- * import { tastyMiddleware } from '@tenphi/tasty/ssr/astro';
142
- * export const onRequest = tastyMiddleware();
143
- * ```
144
- *
145
- * @example Composing with other middleware
146
- * ```ts
147
- * // src/middleware.ts
148
- * import { sequence } from 'astro:middleware';
149
- * import { tastyMiddleware } from '@tenphi/tasty/ssr/astro';
150
- *
151
- * export const onRequest = sequence(
152
- * tastyMiddleware(),
153
- * myOtherMiddleware,
154
- * );
155
- * ```
156
- */
157
121
  function tastyMiddleware(options) {
158
122
  const internalOptions = options;
159
123
  return async (context, next) => {
@@ -189,7 +153,7 @@ function tastyMiddleware(options) {
189
153
  status: rendered.status,
190
154
  headers: rendered.headers
191
155
  });
192
- const nonce = getConfig().nonce;
156
+ const nonce = getRuntimeConfigState()?.nonce;
193
157
  const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
194
158
  const styleTag = `<style data-tasty-ssr${nonceAttr}>${css}</style>`;
195
159
  const metadataTag = extractionMetadata ? createExtractionMetadata(collector.getArtifacts()) : "";
@@ -210,54 +174,10 @@ function tastyMiddleware(options) {
210
174
  });
211
175
  };
212
176
  }
213
- /**
214
- * Package subpaths of the middleware entrypoints registered by
215
- * `tastyIntegration()`.
216
- *
217
- * These must be bare specifiers rather than
218
- * `new URL('./astro-middleware.js', import.meta.url)`. The bundler is free to
219
- * hoist `tastyIntegration` into a shared chunk at a different directory depth
220
- * than `dist/ssr/`, which makes a relative URL resolve to a file that does not
221
- * exist and breaks the build for every consumer. A package subpath is resolved
222
- * by the consumer through our `exports` map, so it never depends on the
223
- * chunk layout.
224
- *
225
- * There are separate entrypoints instead of one parameterised entrypoint because
226
- * `addMiddleware()` cannot pass options: the integration runs when the Astro
227
- * config is loaded, while the middleware module is evaluated in the server
228
- * runtime — a different process for built output — so module-level state set
229
- * by the integration is not visible to the middleware.
230
- */
231
177
  const MIDDLEWARE_ENTRYPOINT = "@tenphi/tasty/ssr/astro-middleware";
232
178
  const MIDDLEWARE_ENTRYPOINT_STATIC = "@tenphi/tasty/ssr/astro-middleware-static";
233
179
  const MIDDLEWARE_ENTRYPOINT_EXTRACT = "@tenphi/tasty/ssr/astro-middleware-extract";
234
180
  const MIDDLEWARE_ENTRYPOINT_EXTRACT_STATIC = "@tenphi/tasty/ssr/astro-middleware-extract-static";
235
- /**
236
- * Astro integration that automatically sets up Tasty SSR.
237
- *
238
- * Registers middleware for cross-component CSS deduplication and
239
- * optionally injects a client hydration script for island support.
240
- *
241
- * @example Basic setup (with islands)
242
- * ```ts
243
- * // astro.config.mjs
244
- * import { tastyIntegration } from '@tenphi/tasty/ssr/astro';
245
- *
246
- * export default defineConfig({
247
- * integrations: [tastyIntegration()],
248
- * });
249
- * ```
250
- *
251
- * @example Static-only (no client JS)
252
- * ```ts
253
- * // astro.config.mjs
254
- * import { tastyIntegration } from '@tenphi/tasty/ssr/astro';
255
- *
256
- * export default defineConfig({
257
- * integrations: [tastyIntegration({ islands: false })],
258
- * });
259
- * ```
260
- */
261
181
  function tastyIntegration(options) {
262
182
  const { islands = true } = options ?? {};
263
183
  const cssMode = options?.css?.mode ?? "inline";
@@ -1 +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 { getConfig } from '../config';\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 = getConfig().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;CAIR,OAAO,GAAG,iBAHM,OAAO,KAAK,KAAK,UAAU,SAAS,GAAG,MAAM,CAAC,CAAC,SAC7D,QAE+B,IAAI;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;CACnE,IAAI,gBAAgB,IAAI,OAAO;CAE/B,MA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AM;EACN,OAAO;GACL,uBAAuB,EACrB,eACA,mBAUI;IACJ,cAAc;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"}
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,SAAg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;AAC9B,MAAM,+BACJ;AACF,MAAM,gCACJ;AACF,MAAM,uCACJ;AAwDF,SAAgB,iBAAiB,SAAmC;CAClE,MAAM,EAAE,UAAU,SAAS,WAAW,CAAC;CACvC,MAAM,UAAU,SAAS,KAAK,QAAQ;CACtC,IAAI,OAAO;CACX,IAAI,SAAS;CACb,IAAI;CACJ,IAAI;CAEJ,OAAO;EACL,MAAM;EACN,OAAO;GACL,uBAAuB,EACrB,eACA,mBAUI;IACJ,cAAc;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"}
@@ -1,4 +1,4 @@
1
- import { i as createServerStyleCollector, n as ServerStyleArtifactKind, r as ServerStyleCollector, t as ServerStyleArtifact } from "../collector-CVdVIy7s.js";
1
+ import { i as ServerStyleArtifactKind, n as createServerStyleCollector, r as ServerStyleArtifact, t as ServerStyleCollector } from "../collector-YpsMjV7T.js";
2
2
 
3
3
  //#region src/ssr/async-storage.d.ts
4
4
  /**
@@ -17,13 +17,13 @@ declare function getSSRCollector(): ServerStyleCollector | null;
17
17
  /**
18
18
  * Client-side cache hydration for SSR/RSC.
19
19
  *
20
- * Pre-populates the client injector's rules map with class names
21
- * rendered on the server. With hash-based naming, the client derives
22
- * the same class name from the same cache key, so only the class name
23
- * list needs to cross the wire — no cache keys or counters.
20
+ * Registers class names rendered on the server with the client injector. If
21
+ * the runtime is not initialized yet, registration is deferred until its first
22
+ * use. With hash-based naming, only the class name list needs to cross the
23
+ * wire — no cache keys or counters.
24
24
  */
25
25
  /**
26
- * Pre-populate the client-side style registry from the server's class name list.
26
+ * Hydrate the client-side style registry from the server's class name list.
27
27
  *
28
28
  * Call this before ReactDOM.hydrateRoot() or ensure it runs before
29
29
  * any tasty() component renders on the client.
package/dist/ssr/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { d as registerSSRCollectorGetterGlobal } from "../chunks/runtime-engine-Y00VWjrS.js";
2
- import { n as createServerStyleCollector, t as ServerStyleCollector } from "../chunks/collector-DBGcmUEq.js";
3
- import { n as runWithCollector, t as getSSRCollector } from "../chunks/async-storage-DKK-wTD4.js";
4
- import { t as hydrateTastyClasses } from "../chunks/hydrate-6YoHZP6A.js";
1
+ import { r as registerSSRCollectorGetterGlobal } from "../chunks/runtime-state-BTDqSYBk.js";
2
+ import { n as createServerStyleCollector, t as ServerStyleCollector } from "../chunks/collector-B0LTHw6Z.js";
3
+ import { n as runWithCollector, t as getSSRCollector } from "../chunks/async-storage-CG5HnUT5.js";
4
+ import { t as hydrateTastyClasses } from "../chunks/hydration-TRcz5vnk.js";
5
5
  //#region src/ssr/index.ts
6
6
  registerSSRCollectorGetterGlobal(getSSRCollector);
7
7
  //#endregion
@@ -1,4 +1,4 @@
1
- import { t as TastyConfig } from "../config-BI0y21JV.js";
1
+ import { t as TastyConfig } from "../config-BnZqyYG4.js";
2
2
 
3
3
  //#region src/ssr/next-config.d.ts
4
4
  interface NextConfig {