@tenphi/tasty 2.0.4 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/{collector-CkZ517g4.d.ts → collector-LuU1vZ68.d.ts} +2 -2
- package/dist/{collector-DXqvGOb1.js → collector-QwpPODsy.js} +3 -3
- package/dist/{collector-DXqvGOb1.js.map → collector-QwpPODsy.js.map} +1 -1
- package/dist/{config-5jzS6k6B.js → config-rrijM-U2.js} +176 -44
- package/dist/{config-5jzS6k6B.js.map → config-rrijM-U2.js.map} +1 -1
- package/dist/{config-DknGsfMo.d.ts → config-vuCRkBWX.d.ts} +31 -4
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +6 -6
- package/dist/{core-CtU6-9OC.js → core-BvTG0J_M.js} +108 -23
- package/dist/core-BvTG0J_M.js.map +1 -0
- package/dist/{css-writer-DHkX0JuE.js → css-writer-C7HJGEmN.js} +3 -3
- package/dist/{css-writer-DHkX0JuE.js.map → css-writer-C7HJGEmN.js.map} +1 -1
- package/dist/{format-rules-DH13ewDu.js → format-rules-BvokPr1L.js} +2 -2
- package/dist/{format-rules-DH13ewDu.js.map → format-rules-BvokPr1L.js.map} +1 -1
- package/dist/{hydrate-C1Gv-DoS.js → hydrate-Dsv7Pwon.js} +2 -2
- package/dist/{hydrate-C1Gv-DoS.js.map → hydrate-Dsv7Pwon.js.map} +1 -1
- package/dist/{index-o7zV2yCr.d.ts → index-FuQphaEO.d.ts} +48 -7
- package/dist/{index-PzENbpAq.d.ts → index-dUtwpOux.d.ts} +9 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.js +13 -10
- package/dist/index.js.map +1 -1
- package/dist/{keyframes-b7X3UxDV.js → keyframes-DDqRjwa9.js} +2 -2
- package/dist/{keyframes-b7X3UxDV.js.map → keyframes-DDqRjwa9.js.map} +1 -1
- package/dist/{merge-styles-Tgo3BbL2.js → merge-styles-B8jV6zu3.js} +2 -2
- package/dist/{merge-styles-Tgo3BbL2.js.map → merge-styles-B8jV6zu3.js.map} +1 -1
- package/dist/{merge-styles-C7KTy7MY.d.ts → merge-styles-CtDJMhpJ.d.ts} +2 -2
- package/dist/{resolve-recipes-Ca2-5CxM.js → resolve-recipes-BnTZz2I_.js} +3 -3
- package/dist/{resolve-recipes-Ca2-5CxM.js.map → resolve-recipes-BnTZz2I_.js.map} +1 -1
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro.js +3 -3
- package/dist/ssr/index.d.ts +1 -1
- package/dist/ssr/index.js +3 -3
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +4 -4
- package/dist/static/index.d.ts +2 -2
- package/dist/static/index.js +1 -1
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +4 -4
- package/dist/zero/index.d.ts +1 -1
- package/dist/zero/index.js +1 -1
- package/docs/dsl.md +1 -0
- package/docs/injector.md +2 -2
- package/package.json +8 -7
- package/dist/core-CtU6-9OC.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as
|
|
1
|
+
import { Ct as RawCSSResult, Dt as StyleInjectorConfig, Et as SheetInfo, M as StyleHandlerDefinition, Ot as StyleRule, St as PropertyDefinition, Tt as RuleInfo, b as Styles, bt as KeyframesResult, ct as CacheMetrics, dt as FontFaceDescriptors, ft as FontFaceInput, gt as InjectResult, h as ConfigTokens, ht as GlobalInjectResult, it as StyleDetails, lt as CounterStyleDescriptors, mt as GCOptions, n as StyleResult, ot as UnitHandler, pt as GCConfig, v as RecipeStyles, wt as RootRegistry, xt as KeyframesSteps, yt as KeyframesInfo } from "./index-dUtwpOux.js";
|
|
2
2
|
|
|
3
3
|
//#region src/injector/sheet-manager.d.ts
|
|
4
4
|
declare class SheetManager {
|
|
@@ -8,11 +8,23 @@ declare class SheetManager {
|
|
|
8
8
|
private config;
|
|
9
9
|
/** Dedicated style elements for raw CSS per root */
|
|
10
10
|
private rawStyleElements;
|
|
11
|
+
/** Constructable sheets for raw CSS in adopted mode */
|
|
12
|
+
private rawConstructableSheets;
|
|
11
13
|
/** Tracking for raw CSS blocks per root */
|
|
12
14
|
private rawCSSBlocks;
|
|
13
15
|
/** Counter for generating unique raw CSS IDs */
|
|
14
16
|
private rawCSSCounter;
|
|
15
17
|
constructor(config: StyleInjectorConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the underlying CSSStyleSheet from a SheetInfo,
|
|
20
|
+
* abstracting away adopted vs style-element modes.
|
|
21
|
+
*/
|
|
22
|
+
getCSSSheet(sheetInfo: SheetInfo): CSSStyleSheet | null;
|
|
23
|
+
/**
|
|
24
|
+
* Determine the injection mode for a root.
|
|
25
|
+
* ShadowRoot uses adopted stylesheets when supported; Document uses <style> elements.
|
|
26
|
+
*/
|
|
27
|
+
private detectInjectionMode;
|
|
16
28
|
/**
|
|
17
29
|
* Get or create registry for a root (Document or ShadowRoot)
|
|
18
30
|
*/
|
|
@@ -24,7 +36,9 @@ declare class SheetManager {
|
|
|
24
36
|
/** Remove registries for ShadowRoots whose host has been detached from the DOM. */
|
|
25
37
|
pruneDisconnectedRoots(): void;
|
|
26
38
|
/**
|
|
27
|
-
* Create a new stylesheet for the registry
|
|
39
|
+
* Create a new stylesheet for the registry.
|
|
40
|
+
* In adopted mode (ShadowRoot), creates a constructable CSSStyleSheet and
|
|
41
|
+
* pushes it to adoptedStyleSheets. Otherwise creates a <style> element.
|
|
28
42
|
*/
|
|
29
43
|
createSheet(registry: RootRegistry, root: Document | ShadowRoot): SheetInfo;
|
|
30
44
|
/**
|
|
@@ -108,6 +122,15 @@ declare class SheetManager {
|
|
|
108
122
|
* Clean up resources for a root
|
|
109
123
|
*/
|
|
110
124
|
cleanup(root: Document | ShadowRoot): void;
|
|
125
|
+
/**
|
|
126
|
+
* Check if a root uses adopted injection mode.
|
|
127
|
+
*/
|
|
128
|
+
private isAdoptedMode;
|
|
129
|
+
/**
|
|
130
|
+
* Get or create a constructable CSSStyleSheet for raw CSS in adopted mode.
|
|
131
|
+
* The raw sheet is prepended to adoptedStyleSheets so it precedes tasty rules.
|
|
132
|
+
*/
|
|
133
|
+
private getOrCreateRawAdoptedSheet;
|
|
111
134
|
/**
|
|
112
135
|
* Get or create a dedicated style element for raw CSS
|
|
113
136
|
* Raw CSS is kept separate from tasty-managed sheets to avoid index conflicts
|
|
@@ -118,12 +141,16 @@ declare class SheetManager {
|
|
|
118
141
|
* Returns a dispose function to remove the injected CSS
|
|
119
142
|
*/
|
|
120
143
|
injectRawCSS(css: string, root: Document | ShadowRoot): RawCSSResult;
|
|
144
|
+
/**
|
|
145
|
+
* Rebuild the raw CSS constructable sheet from all tracked blocks.
|
|
146
|
+
*/
|
|
147
|
+
private rebuildRawAdoptedSheet;
|
|
121
148
|
/**
|
|
122
149
|
* Remove a raw CSS block by ID
|
|
123
150
|
*/
|
|
124
151
|
private disposeRawCSS;
|
|
125
152
|
/**
|
|
126
|
-
* Get the raw CSS content
|
|
153
|
+
* Get the raw CSS content
|
|
127
154
|
*/
|
|
128
155
|
getRawCSSText(root: Document | ShadowRoot): string;
|
|
129
156
|
}
|
|
@@ -854,4 +881,4 @@ declare function getConfig(): TastyConfig;
|
|
|
854
881
|
declare function resetConfig(): void;
|
|
855
882
|
//#endregion
|
|
856
883
|
export { TypographyTokenValue as _, getGlobalFontFace as a, StyleInjector as b, hasGlobalKeyframes as c, isConfigLocked as d, isTestEnvironment as f, TypographyPreset as g, TastyPluginFactory as h, getGlobalCounterStyle as i, hasGlobalRecipes as l, TastyPlugin as m, configure as n, getGlobalKeyframes as o, resetConfig as p, getConfig as r, getGlobalRecipes as s, TastyConfig as t, hasStylesGenerated as u, generateTypographyTokens as v, SheetManager as x, ColorSpace as y };
|
|
857
|
-
//# sourceMappingURL=config-
|
|
884
|
+
//# sourceMappingURL=config-vuCRkBWX.d.ts.map
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as strToRgb, A as RawStyleHandler, B as getGlobalFuncs, C as SuffixForSelector, Ct as
|
|
2
|
-
import { _ as TypographyTokenValue, a as getGlobalFontFace, b as StyleInjector, c as hasGlobalKeyframes, d as isConfigLocked, f as isTestEnvironment, g as TypographyPreset, h as TastyPluginFactory, i as getGlobalCounterStyle, l as hasGlobalRecipes, m as TastyPlugin, n as configure, o as getGlobalKeyframes, p as resetConfig, r as getConfig, s as getGlobalRecipes, t as TastyConfig, u as hasStylesGenerated, v as generateTypographyTokens, x as SheetManager, y as ColorSpace } from "../config-
|
|
3
|
-
import { A as
|
|
4
|
-
import { t as mergeStyles } from "../merge-styles-
|
|
5
|
-
export { AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, BaseStyleProps, BlockInnerStyleProps, BlockOuterStyleProps, BlockStyleProps, Bucket, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, CSSMap, CSSProperties, CUSTOM_UNITS, CacheMetrics, ChunkInfo, ChunkName, ColorSpace, ColorStyleProps, ComputeStylesOptions, ComputeStylesResult, ConditionNode, ConfigTokenValue, ConfigTokens, ContainerStyleProps, CounterStyleDescriptors, DIMENSION_STYLES, DIRECTIONS, DimensionStyleProps, DisposeFunction, FLOW_STYLES, FlowStyleProps, FontFaceDescriptors, FontFaceInput, GCConfig, GCOptions, GlobalStyledProps, INNER_STYLES, InjectResult, InnerStyleProps, KeyframesCacheEntry, KeyframesInfo, KeyframesResult, KeyframesSteps, ModValue, Mods, NoType, NotSelector, OUTER_STYLES, OuterStyleProps, POSITION_STYLES, ParseStateKeyOptions, ParsedAdvancedState, ParsedColor, ParserOptions, PositionStyleProps, ProcessedStyle, PropertyDefinition, PropertyOptions, Props, RawCSSResult, RawStyleHandler, RecipeStyles, RenderResult, RootRegistry, RuleInfo, STYLE_TO_CHUNK, Selector, SheetInfo, SheetManager, ShortGridStyles, StateParserContext, StyleDetails, StyleDetailsPart, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleInjector, StyleInjectorConfig, StyleMap, StyleParser, StylePropValue, StyleResult, StyleRule, StyleUsage, StyleValue, StyleValueStateMap, Styles, StylesInterface, StylesWithoutSelectors, SuffixForSelector, TEXT_STYLES, TagName, TastyConfig, TastyExtensionConfig, TastyNamedColors, TastyPlugin, TastyPluginFactory, TastyPresetNames, TastyThemeNames, TextStyleProps, TokenValue, Tokens, TypographyPreset, TypographyTokenValue, UnitHandler, categorizeStyleKeys, cleanup, color, computeStyles, configure, counterStyle, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, filterBaseProps, filterMods, fontFace, gc, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getGlobalCounterStyle, getGlobalFontFace, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunc, okhslPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleHandlers, tastyDebug, touch, warn };
|
|
1
|
+
import { $ as strToRgb, A as RawStyleHandler, B as getGlobalFuncs, C as SuffixForSelector, Ct as RawCSSResult, D as CUSTOM_UNITS, Dt as StyleInjectorConfig, E as CSSMap, Et as SheetInfo, F as StylePropValue, G as parseStyle, H as getGlobalPredefinedTokens, I as StyleValue, J as stringifyStyles, K as resetGlobalPredefinedTokens, L as StyleValueStateMap, M as StyleHandlerDefinition, N as StyleHandlerResult, O as DIRECTIONS, Ot as StyleRule, P as StyleMap, Q as hslToRgbValues, R as customFunc, S as StylesWithoutSelectors, St as PropertyDefinition, T as TastyPresetNames, Tt as RuleInfo, U as normalizeColorTokenValue, V as getGlobalParser, W as parseColor, X as getRgbValuesFromRgbaString, Y as getNamedColorHex, Z as hexToRgb, _ as NotSelector, _t as InjectionMode, a as ParseStateKeyOptions, at as StyleDetailsPart, b as Styles, bt as KeyframesResult, c as ParsedAdvancedState, ct as CacheMetrics, d as getGlobalPredefinedStates, dt as FontFaceDescriptors, et as StyleParser, f as setGlobalPredefinedStates, ft as FontFaceInput, g as NoType, gt as InjectResult, h as ConfigTokens, i as renderStyles, it as StyleDetails, j as StyleHandler, k as ParsedColor, kt as StyleUsage, l as StateParserContext, lt as CounterStyleDescriptors, m as ConfigTokenValue, mt as GCOptions, n as StyleResult, nt as ParserOptions, o as parseStateKey, ot as UnitHandler, p as ConditionNode, pt as GCConfig, q as setGlobalPredefinedTokens, r as isSelector, rt as ProcessedStyle, s as AtRuleContext, st as CSSProperties, t as RenderResult, tt as Bucket, u as createStateParserContext, ut as DisposeFunction, v as RecipeStyles, vt as KeyframesCacheEntry, w as TastyNamedColors, wt as RootRegistry, x as StylesInterface, xt as KeyframesSteps, y as Selector, yt as KeyframesInfo, z as filterMods } from "../index-dUtwpOux.js";
|
|
2
|
+
import { _ as TypographyTokenValue, a as getGlobalFontFace, b as StyleInjector, c as hasGlobalKeyframes, d as isConfigLocked, f as isTestEnvironment, g as TypographyPreset, h as TastyPluginFactory, i as getGlobalCounterStyle, l as hasGlobalRecipes, m as TastyPlugin, n as configure, o as getGlobalKeyframes, p as resetConfig, r as getConfig, s as getGlobalRecipes, t as TastyConfig, u as hasStylesGenerated, v as generateTypographyTokens, x as SheetManager, y as ColorSpace } from "../config-vuCRkBWX.js";
|
|
3
|
+
import { A as chunkSheetRegistry, At as TastyThemeNames, Bt as DIMENSION_STYLES, C as injectRawCSS, Ct as Mods, D as property, Dt as ShortGridStyles, E as keyframes, Et as Props, Ft as BLOCK_INNER_STYLES, Gt as TEXT_STYLES, Ht as INNER_STYLES, It as BLOCK_OUTER_STYLES, Jt as ChunkName, Kt as CHUNK_NAMES, Lt as BLOCK_STYLES, M as ComputeStylesResult, Mt as TokenValue, N as computeStyles, Nt as Tokens, O as touch, Ot as TagName, P as styleHandlers, Pt as BASE_STYLES, Qt as okhslPlugin, Rt as COLOR_STYLES, S as injectGlobal, St as ModValue, T as isPropertyDefined, Tt as PositionStyleProps, Ut as OUTER_STYLES, Vt as FLOW_STYLES, Wt as POSITION_STYLES, Xt as categorizeStyleKeys, Yt as STYLE_TO_CHUNK, Zt as okhslFunc, _ as getCssText, _t as ContainerStyleProps, a as resolveRecipes, b as getRawCSSText, bt as GlobalStyledProps, c as color, d as cleanup, f as counterStyle, ft as BaseStyleProps, g as gc, gt as ColorStyleProps, h as fontFace, ht as BlockStyleProps, i as warn, j as ComputeStylesOptions, jt as TextStyleProps, k as ChunkSheetRegistry, kt as TastyExtensionConfig, l as filterBaseProps, m as destroy, mt as BlockOuterStyleProps, n as processTokens, o as dotize, p as createInjector, pt as BlockInnerStyleProps, qt as ChunkInfo, r as deprecationWarning, s as _modAttrs, t as tastyDebug, u as PropertyOptions, v as getCssTextForNode, vt as DimensionStyleProps, w as injector, wt as OuterStyleProps, x as inject, xt as InnerStyleProps, y as getIsTestEnvironment, yt as FlowStyleProps, zt as CONTAINER_STYLES } from "../index-FuQphaEO.js";
|
|
4
|
+
import { t as mergeStyles } from "../merge-styles-CtDJMhpJ.js";
|
|
5
|
+
export { AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, BaseStyleProps, BlockInnerStyleProps, BlockOuterStyleProps, BlockStyleProps, Bucket, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, CSSMap, CSSProperties, CUSTOM_UNITS, CacheMetrics, ChunkInfo, ChunkName, ChunkSheetRegistry, ColorSpace, ColorStyleProps, ComputeStylesOptions, ComputeStylesResult, ConditionNode, ConfigTokenValue, ConfigTokens, ContainerStyleProps, CounterStyleDescriptors, DIMENSION_STYLES, DIRECTIONS, DimensionStyleProps, DisposeFunction, FLOW_STYLES, FlowStyleProps, FontFaceDescriptors, FontFaceInput, GCConfig, GCOptions, GlobalStyledProps, INNER_STYLES, InjectResult, InjectionMode, InnerStyleProps, KeyframesCacheEntry, KeyframesInfo, KeyframesResult, KeyframesSteps, ModValue, Mods, NoType, NotSelector, OUTER_STYLES, OuterStyleProps, POSITION_STYLES, ParseStateKeyOptions, ParsedAdvancedState, ParsedColor, ParserOptions, PositionStyleProps, ProcessedStyle, PropertyDefinition, PropertyOptions, Props, RawCSSResult, RawStyleHandler, RecipeStyles, RenderResult, RootRegistry, RuleInfo, STYLE_TO_CHUNK, Selector, SheetInfo, SheetManager, ShortGridStyles, StateParserContext, StyleDetails, StyleDetailsPart, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleInjector, StyleInjectorConfig, StyleMap, StyleParser, StylePropValue, StyleResult, StyleRule, StyleUsage, StyleValue, StyleValueStateMap, Styles, StylesInterface, StylesWithoutSelectors, SuffixForSelector, TEXT_STYLES, TagName, TastyConfig, TastyExtensionConfig, TastyNamedColors, TastyPlugin, TastyPluginFactory, TastyPresetNames, TastyThemeNames, TextStyleProps, TokenValue, Tokens, TypographyPreset, TypographyTokenValue, UnitHandler, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, filterBaseProps, filterMods, fontFace, gc, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getGlobalCounterStyle, getGlobalFontFace, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunc, okhslPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleHandlers, tastyDebug, touch, warn };
|
package/dist/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as parseStyle, B as deprecationWarning, D as getGlobalPredefinedStates, G as DIRECTIONS, J as getGlobalFuncs, K as customFunc, L as SheetManager, O as setGlobalPredefinedStates, Q as parseColor, S as parseStateKey, St as strToRgb, V as warn, W as CUSTOM_UNITS, X as getGlobalPredefinedTokens, Y as getGlobalParser, Z as normalizeColorTokenValue, _ as resetConfig, a as getGlobalCounterStyle, at as StyleParser, b as isSelector, bt as hexToRgb, c as getGlobalKeyframes, d as hasGlobalKeyframes, et as resetGlobalPredefinedTokens, f as hasGlobalRecipes, h as isTestEnvironment, it as okhslPlugin, k as StyleInjector, l as getGlobalRecipes, m as isConfigLocked, n as getConfig, nt as stringifyStyles, o as getGlobalFontFace, ot as Bucket, p as hasStylesGenerated, q as filterMods, rt as okhslFunc, t as configure, tt as setGlobalPredefinedTokens, v as generateTypographyTokens, vt as getNamedColorHex, w as createStateParserContext, x as renderStyles, xt as hslToRgbValues, yt as getRgbValuesFromRgbaString, z as styleHandlers } from "../config-
|
|
2
|
-
import { d as categorizeStyleKeys, l as CHUNK_NAMES, u as STYLE_TO_CHUNK } from "../keyframes-
|
|
3
|
-
import { A as property, B as
|
|
4
|
-
import { t as mergeStyles } from "../merge-styles-
|
|
5
|
-
import { t as resolveRecipes } from "../resolve-recipes-
|
|
6
|
-
export { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, Bucket, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, CUSTOM_UNITS, DIMENSION_STYLES, DIRECTIONS, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, categorizeStyleKeys, cleanup, color, computeStyles, configure, counterStyle, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, filterBaseProps, filterMods, fontFace, gc, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getGlobalCounterStyle, getGlobalFontFace, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunc, okhslPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleHandlers, tastyDebug, touch, warn };
|
|
1
|
+
import { $ as parseStyle, B as deprecationWarning, D as getGlobalPredefinedStates, G as DIRECTIONS, J as getGlobalFuncs, K as customFunc, L as SheetManager, O as setGlobalPredefinedStates, Q as parseColor, S as parseStateKey, St as strToRgb, V as warn, W as CUSTOM_UNITS, X as getGlobalPredefinedTokens, Y as getGlobalParser, Z as normalizeColorTokenValue, _ as resetConfig, a as getGlobalCounterStyle, at as StyleParser, b as isSelector, bt as hexToRgb, c as getGlobalKeyframes, d as hasGlobalKeyframes, et as resetGlobalPredefinedTokens, f as hasGlobalRecipes, h as isTestEnvironment, it as okhslPlugin, k as StyleInjector, l as getGlobalRecipes, m as isConfigLocked, n as getConfig, nt as stringifyStyles, o as getGlobalFontFace, ot as Bucket, p as hasStylesGenerated, q as filterMods, rt as okhslFunc, t as configure, tt as setGlobalPredefinedTokens, v as generateTypographyTokens, vt as getNamedColorHex, w as createStateParserContext, x as renderStyles, xt as hslToRgbValues, yt as getRgbValuesFromRgbaString, z as styleHandlers } from "../config-rrijM-U2.js";
|
|
2
|
+
import { d as categorizeStyleKeys, l as CHUNK_NAMES, u as STYLE_TO_CHUNK } from "../keyframes-DDqRjwa9.js";
|
|
3
|
+
import { A as property, B as DIMENSION_STYLES, C as getRawCSSText, D as injector, E as injectRawCSS, F as BLOCK_INNER_STYLES, G as TEXT_STYLES, H as INNER_STYLES, I as BLOCK_OUTER_STYLES, L as BLOCK_STYLES, M as ChunkSheetRegistry, N as chunkSheetRegistry, O as isPropertyDefined, P as BASE_STYLES, R as COLOR_STYLES, S as getIsTestEnvironment, T as injectGlobal, U as OUTER_STYLES, V as FLOW_STYLES, W as POSITION_STYLES, _ as destroy, a as color, b as getCssText, g as createInjector, h as counterStyle, i as _modAttrs, j as touch, k as keyframes, m as cleanup, n as processTokens, o as filterBaseProps, r as dotize, s as computeStyles, t as tastyDebug, v as fontFace, w as inject, x as getCssTextForNode, y as gc, z as CONTAINER_STYLES } from "../core-BvTG0J_M.js";
|
|
4
|
+
import { t as mergeStyles } from "../merge-styles-B8jV6zu3.js";
|
|
5
|
+
import { t as resolveRecipes } from "../resolve-recipes-BnTZz2I_.js";
|
|
6
|
+
export { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, Bucket, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, CUSTOM_UNITS, ChunkSheetRegistry, DIMENSION_STYLES, DIRECTIONS, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, filterBaseProps, filterMods, fontFace, gc, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getGlobalCounterStyle, getGlobalFontFace, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunc, okhslPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleHandlers, tastyDebug, touch, warn };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $ as parseStyle, A as extractLocalCounterStyle, C as camelToKebab, Ct as Lru, F as formatFontFaceRule, H as createStyle, I as hasLocalFontFace, M as hasLocalCounterStyle, N as extractLocalFontFace, P as fontFaceContentHash, R as STYLE_HANDLER_MAP, U as PropertyTypeResolver, Z as normalizeColorTokenValue, c as getGlobalKeyframes, ct as hashString, d as hasGlobalKeyframes, dt as hasLocalProperties, ft as parsePropertyToken, g as markStylesGenerated, gt as getColorSpaceSuffix, h as isTestEnvironment, ht as getColorSpaceFunc, j as formatCounterStyleRule, k as StyleInjector, lt as extractLocalProperties, mt as getColorSpaceComponents, n as getConfig, s as getGlobalInjector, st as isDevEnv } from "./config-
|
|
2
|
-
import { a as mergeKeyframes, c as generateChunkCacheKey, d as categorizeStyleKeys, i as hasLocalKeyframes, l as CHUNK_NAMES, n as extractLocalKeyframes, o as replaceAnimationNames, r as filterUsedKeyframes, s as renderStylesForChunk, t as extractAnimationNamesFromStyles } from "./keyframes-
|
|
3
|
-
import { n as formatPropertyCSS, r as getRegisteredSSRCollector, t as formatRules } from "./format-rules-
|
|
4
|
-
import { t as resolveRecipes } from "./resolve-recipes-
|
|
1
|
+
import { $ as parseStyle, A as extractLocalCounterStyle, C as camelToKebab, Ct as Lru, F as formatFontFaceRule, H as createStyle, I as hasLocalFontFace, M as hasLocalCounterStyle, N as extractLocalFontFace, P as fontFaceContentHash, R as STYLE_HANDLER_MAP, U as PropertyTypeResolver, Z as normalizeColorTokenValue, c as getGlobalKeyframes, ct as hashString, d as hasGlobalKeyframes, dt as hasLocalProperties, ft as parsePropertyToken, g as markStylesGenerated, gt as getColorSpaceSuffix, h as isTestEnvironment, ht as getColorSpaceFunc, j as formatCounterStyleRule, k as StyleInjector, lt as extractLocalProperties, mt as getColorSpaceComponents, n as getConfig, s as getGlobalInjector, st as isDevEnv } from "./config-rrijM-U2.js";
|
|
2
|
+
import { a as mergeKeyframes, c as generateChunkCacheKey, d as categorizeStyleKeys, i as hasLocalKeyframes, l as CHUNK_NAMES, n as extractLocalKeyframes, o as replaceAnimationNames, r as filterUsedKeyframes, s as renderStylesForChunk, t as extractAnimationNamesFromStyles } from "./keyframes-DDqRjwa9.js";
|
|
3
|
+
import { n as formatPropertyCSS, r as getRegisteredSSRCollector, t as formatRules } from "./format-rules-BvokPr1L.js";
|
|
4
|
+
import { t as resolveRecipes } from "./resolve-recipes-BnTZz2I_.js";
|
|
5
5
|
import { cache } from "react";
|
|
6
6
|
//#region src/styles/list.ts
|
|
7
7
|
const BASE_STYLES = [
|
|
@@ -100,6 +100,74 @@ const INNER_STYLES = [
|
|
|
100
100
|
...FLOW_STYLES
|
|
101
101
|
];
|
|
102
102
|
//#endregion
|
|
103
|
+
//#region src/injector/chunk-sheet-registry.ts
|
|
104
|
+
/**
|
|
105
|
+
* Global registry mapping CSS content hashes to shared constructable
|
|
106
|
+
* CSSStyleSheet objects with reference counting.
|
|
107
|
+
*
|
|
108
|
+
* Multiple shadow roots adopting the same chunk share a single underlying
|
|
109
|
+
* stylesheet object — parse once, adopt everywhere.
|
|
110
|
+
*/
|
|
111
|
+
var ChunkSheetRegistry = class {
|
|
112
|
+
sheets = /* @__PURE__ */ new Map();
|
|
113
|
+
sheetToHash = /* @__PURE__ */ new WeakMap();
|
|
114
|
+
/**
|
|
115
|
+
* Get or create a CSSStyleSheet for the given CSS text.
|
|
116
|
+
* Increments refCount. Uses content hash as the dedup key.
|
|
117
|
+
*/
|
|
118
|
+
acquire(cssText) {
|
|
119
|
+
const hash = hashString(cssText);
|
|
120
|
+
const existing = this.sheets.get(hash);
|
|
121
|
+
if (existing) {
|
|
122
|
+
existing.refCount++;
|
|
123
|
+
return existing.sheet;
|
|
124
|
+
}
|
|
125
|
+
const sheet = new CSSStyleSheet();
|
|
126
|
+
sheet.replaceSync(cssText);
|
|
127
|
+
const entry = {
|
|
128
|
+
sheet,
|
|
129
|
+
cssText,
|
|
130
|
+
refCount: 1
|
|
131
|
+
};
|
|
132
|
+
this.sheets.set(hash, entry);
|
|
133
|
+
this.sheetToHash.set(sheet, hash);
|
|
134
|
+
return sheet;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Decrement refCount for a sheet. When refCount reaches 0,
|
|
138
|
+
* the sheet is removed from the registry.
|
|
139
|
+
*/
|
|
140
|
+
release(sheet) {
|
|
141
|
+
const hash = this.sheetToHash.get(sheet);
|
|
142
|
+
if (!hash) return;
|
|
143
|
+
const entry = this.sheets.get(hash);
|
|
144
|
+
if (!entry) return;
|
|
145
|
+
entry.refCount--;
|
|
146
|
+
if (entry.refCount <= 0) {
|
|
147
|
+
this.sheets.delete(hash);
|
|
148
|
+
this.sheetToHash.delete(sheet);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Bulk acquire — returns an array of CSSStyleSheet in the same order.
|
|
153
|
+
*/
|
|
154
|
+
acquireAll(cssTexts) {
|
|
155
|
+
return cssTexts.map((text) => this.acquire(text));
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Bulk release — decrements refCount for each sheet.
|
|
159
|
+
*/
|
|
160
|
+
releaseAll(sheets) {
|
|
161
|
+
for (const sheet of sheets) this.release(sheet);
|
|
162
|
+
}
|
|
163
|
+
/** Number of unique sheets currently held. */
|
|
164
|
+
get size() {
|
|
165
|
+
return this.sheets.size;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
/** Module-level singleton shared across the entire application. */
|
|
169
|
+
const chunkSheetRegistry = new ChunkSheetRegistry();
|
|
170
|
+
//#endregion
|
|
103
171
|
//#region src/injector/index.ts
|
|
104
172
|
/**
|
|
105
173
|
* Inject styles and return className with dispose function
|
|
@@ -637,12 +705,15 @@ function processChunkSSR(collector, styles, chunkName, styleKeys) {
|
|
|
637
705
|
* Process a chunk on the client: render, allocate className, and inject
|
|
638
706
|
* CSS synchronously. The injector's cache makes this idempotent.
|
|
639
707
|
*/
|
|
640
|
-
function processChunkSync(styles, chunkName, styleKeys) {
|
|
708
|
+
function processChunkSync(styles, chunkName, styleKeys, root) {
|
|
641
709
|
if (styleKeys.length === 0) return null;
|
|
642
710
|
const cacheKey = generateChunkCacheKey(styles, chunkName, styleKeys);
|
|
643
711
|
const renderResult = renderStylesForChunk(styles, chunkName, styleKeys, cacheKey);
|
|
644
712
|
if (renderResult.rules.length === 0) return null;
|
|
645
|
-
const { className } = inject(renderResult.rules, {
|
|
713
|
+
const { className } = inject(renderResult.rules, {
|
|
714
|
+
cacheKey,
|
|
715
|
+
root
|
|
716
|
+
});
|
|
646
717
|
return {
|
|
647
718
|
name: chunkName,
|
|
648
719
|
styleKeys,
|
|
@@ -655,10 +726,13 @@ function processChunkSync(styles, chunkName, styleKeys) {
|
|
|
655
726
|
* Inject keyframes synchronously and return a name replacement map.
|
|
656
727
|
* On the client, keyframes are injected into the DOM.
|
|
657
728
|
*/
|
|
658
|
-
function injectKeyframesSync(usedKeyframes) {
|
|
729
|
+
function injectKeyframesSync(usedKeyframes, root) {
|
|
659
730
|
let nameMap = null;
|
|
660
731
|
for (const [name, steps] of Object.entries(usedKeyframes)) {
|
|
661
|
-
const injectedName = keyframes(steps, {
|
|
732
|
+
const injectedName = keyframes(steps, {
|
|
733
|
+
name,
|
|
734
|
+
root
|
|
735
|
+
}).toString();
|
|
662
736
|
if (injectedName !== name) {
|
|
663
737
|
if (!nameMap) nameMap = /* @__PURE__ */ new Map();
|
|
664
738
|
nameMap.set(name, injectedName);
|
|
@@ -669,30 +743,36 @@ function injectKeyframesSync(usedKeyframes) {
|
|
|
669
743
|
/**
|
|
670
744
|
* Inject chunk rules synchronously, replacing animation names if needed.
|
|
671
745
|
*/
|
|
672
|
-
function injectChunkRulesSync(chunks, nameMap) {
|
|
746
|
+
function injectChunkRulesSync(chunks, nameMap, root) {
|
|
673
747
|
for (const chunk of chunks) if (chunk.renderResult.rules.length > 0) inject(nameMap ? chunk.renderResult.rules.map((rule) => ({
|
|
674
748
|
...rule,
|
|
675
749
|
declarations: replaceAnimationNames(rule.declarations, nameMap)
|
|
676
|
-
})) : chunk.renderResult.rules, {
|
|
750
|
+
})) : chunk.renderResult.rules, {
|
|
751
|
+
cacheKey: chunk.cacheKey,
|
|
752
|
+
root
|
|
753
|
+
});
|
|
677
754
|
}
|
|
678
755
|
/**
|
|
679
756
|
* Inject all ancillary rules (properties, font-faces, counter-styles) synchronously.
|
|
680
757
|
*/
|
|
681
|
-
function injectAncillarySync(styles) {
|
|
758
|
+
function injectAncillarySync(styles, root) {
|
|
682
759
|
if (hasLocalProperties(styles)) {
|
|
683
760
|
const localProperties = extractLocalProperties(styles);
|
|
684
|
-
if (localProperties) for (const [token, definition] of Object.entries(localProperties)) property(token,
|
|
761
|
+
if (localProperties) for (const [token, definition] of Object.entries(localProperties)) property(token, {
|
|
762
|
+
...definition,
|
|
763
|
+
root
|
|
764
|
+
});
|
|
685
765
|
}
|
|
686
766
|
if (hasLocalFontFace(styles)) {
|
|
687
767
|
const localFontFace = extractLocalFontFace(styles);
|
|
688
768
|
if (localFontFace) for (const [family, input] of Object.entries(localFontFace)) {
|
|
689
769
|
const descriptors = Array.isArray(input) ? input : [input];
|
|
690
|
-
for (const desc of descriptors) fontFace(family, desc);
|
|
770
|
+
for (const desc of descriptors) fontFace(family, desc, { root });
|
|
691
771
|
}
|
|
692
772
|
}
|
|
693
773
|
if (hasLocalCounterStyle(styles)) {
|
|
694
774
|
const localCounterStyle = extractLocalCounterStyle(styles);
|
|
695
|
-
if (localCounterStyle) for (const [name, descriptors] of Object.entries(localCounterStyle)) counterStyle(name, descriptors);
|
|
775
|
+
if (localCounterStyle) for (const [name, descriptors] of Object.entries(localCounterStyle)) counterStyle(name, descriptors, { root });
|
|
696
776
|
}
|
|
697
777
|
}
|
|
698
778
|
/**
|
|
@@ -764,15 +844,16 @@ function computeStyles(styles, options) {
|
|
|
764
844
|
collectAncillarySSR(collector, resolved, chunks);
|
|
765
845
|
} else if (typeof document === "undefined") return computeStylesRSC(resolved, chunkMap);
|
|
766
846
|
else {
|
|
767
|
-
|
|
847
|
+
const root = options?.root;
|
|
848
|
+
injectAncillarySync(resolved, root);
|
|
768
849
|
const usedKf = getUsedKeyframes(resolved);
|
|
769
|
-
const nameMap = usedKf ? injectKeyframesSync(usedKf) : null;
|
|
850
|
+
const nameMap = usedKf ? injectKeyframesSync(usedKf, root) : null;
|
|
770
851
|
for (const [chunkName, chunkStyleKeys] of chunkMap) {
|
|
771
|
-
const chunk = processChunkSync(resolved, chunkName, chunkStyleKeys);
|
|
852
|
+
const chunk = processChunkSync(resolved, chunkName, chunkStyleKeys, root);
|
|
772
853
|
if (chunk) chunks.push(chunk);
|
|
773
854
|
}
|
|
774
|
-
if (nameMap) injectChunkRulesSync(chunks, nameMap);
|
|
775
|
-
for (const chunk of chunks) touch(chunk.className);
|
|
855
|
+
if (nameMap) injectChunkRulesSync(chunks, nameMap, root);
|
|
856
|
+
for (const chunk of chunks) touch(chunk.className, { root });
|
|
776
857
|
}
|
|
777
858
|
if (chunks.length === 0) return EMPTY_RESULT;
|
|
778
859
|
if (chunks.length === 1) return { className: chunks[0].className };
|
|
@@ -1190,7 +1271,9 @@ function getGlobalTypeCSS(type, root = document) {
|
|
|
1190
1271
|
let rc = 0;
|
|
1191
1272
|
if (type === "keyframes") for (const [, entry] of registry.keyframesCache) {
|
|
1192
1273
|
const info = entry.info;
|
|
1193
|
-
const
|
|
1274
|
+
const sheetInfo = registry.sheets[info.sheetIndex];
|
|
1275
|
+
const sm = injector.instance._sheetManager;
|
|
1276
|
+
const ss = sheetInfo && sm ? sm.getCSSSheet(sheetInfo) : null;
|
|
1194
1277
|
if (ss && info.ruleIndex < ss.cssRules.length) {
|
|
1195
1278
|
const rule = ss.cssRules[info.ruleIndex];
|
|
1196
1279
|
if (rule) {
|
|
@@ -1206,7 +1289,9 @@ function getGlobalTypeCSS(type, root = document) {
|
|
|
1206
1289
|
const prefix = type === "global" ? "global:" : type === "raw" ? "raw:" : "property:";
|
|
1207
1290
|
for (const [key, ri] of registry.globalRules) {
|
|
1208
1291
|
if (!key.startsWith(prefix)) continue;
|
|
1209
|
-
const
|
|
1292
|
+
const sheetInfo = registry.sheets[ri.sheetIndex];
|
|
1293
|
+
const sm = injector.instance._sheetManager;
|
|
1294
|
+
const ss = sheetInfo && sm ? sm.getCSSSheet(sheetInfo) : null;
|
|
1210
1295
|
if (ss) {
|
|
1211
1296
|
const start = Math.max(0, ri.ruleIndex);
|
|
1212
1297
|
const end = Math.min(ss.cssRules.length - 1, ri.endRuleIndex ?? ri.ruleIndex);
|
|
@@ -1502,6 +1587,6 @@ function getPageCSS(root = document) {
|
|
|
1502
1587
|
}
|
|
1503
1588
|
if (typeof window !== "undefined" && isDevEnv()) tastyDebug.install();
|
|
1504
1589
|
//#endregion
|
|
1505
|
-
export { property as A,
|
|
1590
|
+
export { property as A, DIMENSION_STYLES as B, getRawCSSText as C, injector as D, injectRawCSS as E, BLOCK_INNER_STYLES as F, TEXT_STYLES as G, INNER_STYLES as H, BLOCK_OUTER_STYLES as I, BLOCK_STYLES as L, ChunkSheetRegistry as M, chunkSheetRegistry as N, isPropertyDefined as O, BASE_STYLES as P, COLOR_STYLES as R, getIsTestEnvironment as S, injectGlobal as T, OUTER_STYLES as U, FLOW_STYLES as V, POSITION_STYLES as W, destroy as _, color as a, getCssText as b, hasKeys as c, collectAutoInferredPropertiesRSC as d, getStyleTarget as f, createInjector as g, counterStyle as h, _modAttrs as i, touch as j, keyframes as k, formatKeyframesCSS as l, cleanup as m, processTokens as n, filterBaseProps as o, pushRSCCSS as p, dotize as r, computeStyles as s, tastyDebug as t, collectAutoInferredProperties as u, fontFace as v, inject as w, getCssTextForNode as x, gc as y, CONTAINER_STYLES as z };
|
|
1506
1591
|
|
|
1507
|
-
//# sourceMappingURL=core-
|
|
1592
|
+
//# sourceMappingURL=core-BvTG0J_M.js.map
|