@tenphi/tasty 0.0.0-snapshot.cca2ea6 → 0.0.0-snapshot.cd6580c
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/dist/astro-r3wQ-RQn.js +307 -0
- package/dist/astro-r3wQ-RQn.js.map +1 -0
- package/dist/{babel-CHy3n_M7.d.ts → babel-Bu_bhevw.d.ts} +2 -2
- package/dist/{collector-0YO-P1vW.d.ts → collector-BTVXj2hS.d.ts} +20 -2
- package/dist/{collector-Eve9-4dP.js → collector-CudWaexa.js} +36 -13
- package/dist/collector-CudWaexa.js.map +1 -0
- package/dist/{config-Bwerr9rW.js → config-CHz_SFr_.js} +32 -24
- package/dist/config-CHz_SFr_.js.map +1 -0
- package/dist/{config-DRp9aYRG.d.ts → config-ClpSyptP.d.ts} +29 -11
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +6 -6
- package/dist/{core-C9nPCkW6.js → core-COC2UQ48.js} +150 -67
- package/dist/core-COC2UQ48.js.map +1 -0
- package/dist/{css-writer-7SOcy4BM.js → css-writer-Dji9t0wk.js} +3 -3
- package/dist/{css-writer-7SOcy4BM.js.map → css-writer-Dji9t0wk.js.map} +1 -1
- package/dist/{format-rules-Cb8LAho6.js → format-rules-U9Od0aqv.js} +2 -2
- package/dist/{format-rules-Cb8LAho6.js.map → format-rules-U9Od0aqv.js.map} +1 -1
- package/dist/{hydrate-DfL38fk5.js → hydrate-DA-ttBga.js} +2 -2
- package/dist/{hydrate-DfL38fk5.js.map → hydrate-DA-ttBga.js.map} +1 -1
- package/dist/{index-B1A0pcCf.d.ts → index-CV_fhEm0.d.ts} +18 -11
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -7
- package/dist/{keyframes-CygCEfJG.js → keyframes-KkxDZ9xu.js} +45 -3
- package/dist/keyframes-KkxDZ9xu.js.map +1 -0
- package/dist/{merge-styles-Bh_wsNk_.js → merge-styles-BGM4RJWC.js} +2 -2
- package/dist/{merge-styles-Bh_wsNk_.js.map → merge-styles-BGM4RJWC.js.map} +1 -1
- package/dist/{resolve-recipes-Da6piP7f.js → resolve-recipes-DbeVYQFr.js} +3 -3
- package/dist/{resolve-recipes-Da6piP7f.js.map → resolve-recipes-DbeVYQFr.js.map} +1 -1
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
- package/dist/ssr/astro-middleware-extract-static.js +9 -0
- package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
- package/dist/ssr/astro-middleware-extract.d.ts +11 -0
- package/dist/ssr/astro-middleware-extract.js +9 -0
- package/dist/ssr/astro-middleware-extract.js.map +1 -0
- package/dist/ssr/astro-middleware-static.d.ts +3 -1
- package/dist/ssr/astro-middleware-static.js +1 -1
- package/dist/ssr/astro-middleware.d.ts +3 -1
- package/dist/ssr/astro-middleware.js +1 -1
- package/dist/ssr/astro.d.ts +37 -3
- package/dist/ssr/astro.js +1 -156
- package/dist/ssr/index.d.ts +2 -2
- package/dist/ssr/index.js +3 -3
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +4 -4
- 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.js +1 -1
- package/dist/zero/next.d.ts +1 -1
- package/docs/ssr.md +48 -9
- package/package.json +18 -4
- package/dist/collector-Eve9-4dP.js.map +0 -1
- package/dist/config-Bwerr9rW.js.map +0 -1
- package/dist/core-C9nPCkW6.js.map +0 -1
- package/dist/keyframes-CygCEfJG.js.map +0 -1
- package/dist/ssr/astro.js.map +0 -1
|
@@ -326,18 +326,27 @@ declare class StyleInjector {
|
|
|
326
326
|
root?: Document | ShadowRoot;
|
|
327
327
|
}): string;
|
|
328
328
|
/**
|
|
329
|
-
*
|
|
330
|
-
*
|
|
329
|
+
* Take a reference on local `@keyframes`, under the deterministic names the
|
|
330
|
+
* caller resolved.
|
|
331
331
|
*
|
|
332
|
-
* One reference per distinct set of steps,
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
* count climbing for the life of the page. The reference goes when the last
|
|
336
|
-
* of those classes is deleted.
|
|
332
|
+
* One reference per distinct set of steps, shared by every class that ends up
|
|
333
|
+
* animating it, so a repeat render takes nothing further. Ownership is
|
|
334
|
+
* assigned by `ownKeyframes()` once the rules exist to be inspected.
|
|
337
335
|
*/
|
|
338
|
-
holdKeyframes(
|
|
336
|
+
holdKeyframes(steps: Record<string, KeyframesSteps>, names: Map<string, string>, options?: {
|
|
339
337
|
root?: Document | ShadowRoot;
|
|
340
|
-
}): Map<string, string
|
|
338
|
+
}): Map<string, string>;
|
|
339
|
+
/**
|
|
340
|
+
* Record that `className` animates these keyframes, so the reference is
|
|
341
|
+
* released when the last such class is collected.
|
|
342
|
+
*
|
|
343
|
+
* Only classes whose rules actually reference the animation should be here:
|
|
344
|
+
* a class that merely rendered alongside one would otherwise keep the
|
|
345
|
+
* keyframes alive for as long as it lives.
|
|
346
|
+
*/
|
|
347
|
+
ownKeyframes(key: string, className: string, options?: {
|
|
348
|
+
root?: Document | ShadowRoot;
|
|
349
|
+
}): void;
|
|
341
350
|
/**
|
|
342
351
|
* Pin an already-injected cacheKey and return the handle that releases it.
|
|
343
352
|
* For callers that skipped the pipeline on a cache hit but still need the
|
|
@@ -462,6 +471,14 @@ declare class StyleInjector {
|
|
|
462
471
|
keyframes(steps: KeyframesSteps, nameOrOptions?: string | {
|
|
463
472
|
root?: Document | ShadowRoot;
|
|
464
473
|
name?: string;
|
|
474
|
+
/**
|
|
475
|
+
* Give this name its own rule even if another name already carries
|
|
476
|
+
* the same steps. Without it two names with identical steps share
|
|
477
|
+
* one rule under whichever name arrived first — fine when the caller
|
|
478
|
+
* only wants the animation, wrong when the name has to be the one it
|
|
479
|
+
* asked for.
|
|
480
|
+
*/
|
|
481
|
+
distinctByName?: boolean;
|
|
465
482
|
}): KeyframesResult;
|
|
466
483
|
/**
|
|
467
484
|
* Dispose keyframes
|
|
@@ -474,7 +491,8 @@ declare class StyleInjector {
|
|
|
474
491
|
*
|
|
475
492
|
* @deprecated The class name is ignored — pass anything, or stop calling it.
|
|
476
493
|
* Collection no longer records per-class usage, and scheduling does not need
|
|
477
|
-
* to know which class was rendered.
|
|
494
|
+
* to know which class was rendered. A class handed back by `inject()` is
|
|
495
|
+
* marked wanted there, which is what reuse actually goes through.
|
|
478
496
|
*/
|
|
479
497
|
touch(_className: string, options?: {
|
|
480
498
|
root?: Document | ShadowRoot;
|
|
@@ -1315,4 +1333,4 @@ declare function getNamePrefix(): string;
|
|
|
1315
1333
|
declare function resetConfig(): void;
|
|
1316
1334
|
//#endregion
|
|
1317
1335
|
export { ParseFunction as C, PropHandlerDefinition as D, PropHandler as E, PropHandlerProps as O, FunctionsConfig as S, SheetManager as T, TastyPluginFactory as _, getGlobalFontFaces as a, generateTypographyTokens as b, getGlobalRecipes as c, hasGlobalRecipes as d, hasStylesGenerated as f, TastyPlugin as g, resetConfig as h, getGlobalCounterStyles as i, getNamePrefix as l, isTestEnvironment as m, configure as n, getGlobalFunctions as o, isConfigLocked as p, getConfig as r, getGlobalKeyframes as s, TastyConfig as t, hasGlobalKeyframes as u, TypographyPreset as v, StyleInjector as w, ColorSpace as x, TypographyTokenValue as y };
|
|
1318
|
-
//# sourceMappingURL=config-
|
|
1336
|
+
//# sourceMappingURL=config-ClpSyptP.d.ts.map
|
package/dist/core/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 hasStylesGenerated, g as TastyPlugin, h as resetConfig, i as getGlobalCounterStyles, l as getNamePrefix, m as isTestEnvironment, n as configure, o as getGlobalFunctions, p as isConfigLocked, 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-
|
|
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 hasStylesGenerated, g as TastyPlugin, h as resetConfig, i as getGlobalCounterStyles, l as getNamePrefix, m as isTestEnvironment, n as configure, o as getGlobalFunctions, p as isConfigLocked, 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-ClpSyptP.js";
|
|
2
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 ParseStateKeyOptions, at as CSSProperties, b as Styles, bt as KeyframesInfo, c as ParsedAdvancedState, ct as DisposeFunction, d as getGlobalPredefinedStates, dt as FunctionDefinition, et as ParserOptions, f as setGlobalPredefinedStates, ft as FunctionParameter, g as NoType, gt as InjectOptions, h as ConfigTokens, i as renderStyles, it as UnitHandler, j as RawStyleHandler, jt as StyleUsage, k as DIRECTIONS, kt as StyleInjectorConfig, l as StateParserContext, lt as FontFaceDescriptors, m as ConfigTokenValue, mt as GCOptions, n as StyleResult, nt as StyleDetails, o as parseStateKey, ot as CacheMetrics, p as ConditionNode, pt as GCConfig, q as stringifyStyles, r as isSelector, rt as StyleDetailsPart, s as AtRuleContext, st as CounterStyleDescriptors, t as RenderResult, tt as ProcessedStyle, u as createStateParserContext, 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-BmogEzTo.js";
|
|
3
|
-
import { $ as
|
|
3
|
+
import { $ as resolveFunctionColor, $t as Mods, A as isPropertyDefined, B as defineHandler, C as getCSSTextForNode, Cn as DEFAULT_NAME_PREFIX, D as injectGlobal, E as inject, F as ChunkSheetRegistry, G as CHUNK_NAMES, Gt as BlockStyleProps, H as ChunkInfo, Ht as BaseStyleProps, I as chunkSheetRegistry, J as DISPLAY_CHUNK_STYLES, Jt as DimensionStyleProps, K as ChunkName, Kt as ColorStyleProps, L as ComputeStylesOptions, M as ownKeyframes, N as property, O as injectRawCSS, P as touch, Q as STYLE_TO_CHUNK, Qt as ModValue, R as ComputeStylesResult, S as getCSSText, Sn as TEXT_STYLES, T as holdKeyframes, U as categorizeStyleKeys, Ut as BlockInnerStyleProps, V as styleHandlers, 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, a as DebugOptions, an as TastyCustomProps, b as func, bn as OUTER_STYLES, c as tastyDebug, cn as TextStyleProps, d as dotize, dn as BASE_STYLES, en as OuterStyleProps, et as createColorFunc, f as _modAttrs, fn as BLOCK_INNER_STYLES, g as counterStyle, gn as CONTAINER_STYLES, h as cleanup, hn as COLOR_STYLES, i as DebugChunkInfo, in as TastyBaseStylePropNames, it as okhslPlugin, j as keyframes, k as injector, l as processTokens, ln as TokenValue, m as filterBaseProps, mn as BLOCK_STYLES, n as CacheStatus, nn as ShortGridStyles, nt as okhstPlugin, o as InspectResult, on as TastyExtensionConfig, p as color, pn as BLOCK_OUTER_STYLES, q as DIMENSION_CHUNK_STYLES, qt as ContainerStyleProps, r as ChunkBreakdown, rn as TagName, rt as okhslFunction, s as Summary, sn as TastyThemeNames, t as CSSOptions, tn as PositionStyleProps, tt as okhstFunction, u as resolveRecipes, un as Tokens, v as destroy, vn as FLOW_STYLES, w as getRawCSSText, wn as DEFAULT_ZERO_NAME_PREFIX, x as gc, xn as POSITION_STYLES, y as fontFace, yn as INNER_STYLES, z as computeStyles } from "../index-CV_fhEm0.js";
|
|
4
4
|
import { t as mergeStyles } from "../merge-styles-BcLl1u_d.js";
|
|
5
|
-
export { APPEARANCE_CHUNK_STYLES, type AnyStyleHandler, type AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, 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, 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 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 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 SuffixForSelector, Summary, TEXT_STYLES, type TagName, type TastyBaseStylePropNames, type TastyConfig, type TastyCustomProps, type TastyExtensionConfig, type TastyNamedColors, type TastyPlugin, type TastyPluginFactory, type TastyPresetNames, type TastyThemeNames, type TextStyleProps, type TokenValue, type Tokens, TypographyPreset, TypographyTokenValue, type UnitHandler, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, dotize, filterBaseProps, filterMods, flushStyles, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, 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, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetStyleBatch, resolveFunctionColor, resolveRecipes, setGlobalPredefinedStates, strToRgb, stringifyStyles, styleHandlers, tastyDebug, touch };
|
|
5
|
+
export { APPEARANCE_CHUNK_STYLES, type AnyStyleHandler, type AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, 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, 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 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 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 SuffixForSelector, Summary, TEXT_STYLES, type TagName, type TastyBaseStylePropNames, type TastyConfig, type TastyCustomProps, type TastyExtensionConfig, type TastyNamedColors, type TastyPlugin, type TastyPluginFactory, type TastyPresetNames, type TastyThemeNames, type TextStyleProps, type TokenValue, type Tokens, TypographyPreset, TypographyTokenValue, type UnitHandler, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, dotize, filterBaseProps, filterMods, flushStyles, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, 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, tastyDebug, touch };
|
package/dist/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as SheetManager, $t as StyleParser, A as FLOW_STYLES, At as STYLE_TO_CHUNK, B as createStateParserContext, C as BASE_STYLES, Ct as APPEARANCE_CHUNK_STYLES, D as COLOR_STYLES, Dt as FONT_CHUNK_STYLES, E as BLOCK_STYLES, Et as DISPLAY_CHUNK_STYLES, G as StyleInjector, Gt as parseStyle, Ht as getGlobalPredefinedTokens, I as isSelector, Jt as okhstPlugin, Kt as stringifyStyles, L as renderStyles, Lt as CUSTOM_UNITS, M as OUTER_STYLES, N as POSITION_STYLES, O as CONTAINER_STYLES, Ot as LAYOUT_CHUNK_STYLES, P as TEXT_STYLES, R as parseStateKey, Rt as DIRECTIONS, T as BLOCK_OUTER_STYLES, Tt as DIMENSION_CHUNK_STYLES, U as getGlobalPredefinedStates, Ut as normalizeColorTokenValue, Vt as getGlobalParser, W as setGlobalPredefinedStates, Wt as parseColor, Xt as okhslPlugin, Yt as okhslFunction, Zt as createColorFunc, a as getGlobalCounterStyles, an as hslToRgbValues, b as resetConfig, dt as DEFAULT_ZERO_NAME_PREFIX, f as getNamePrefix, g as isConfigLocked, h as hasStylesGenerated, in as hexToRgb, j as INNER_STYLES, k as DIMENSION_STYLES, kt as POSITION_CHUNK_STYLES, l as getGlobalKeyframes, lt as resetStyleBatch, m as hasGlobalRecipes, n as getConfig, nn as getNamedColorHex, nt as styleHandlers, o as getGlobalFontFaces, on as strToRgb, ot as flushStyles, p as hasGlobalKeyframes, qt as okhstFunction, rn as getRgbValuesFromRgbaString, s as getGlobalFunctions, st as hasPendingStyleWrites, t as configure, tt as defineHandler, u as getGlobalRecipes, ut as DEFAULT_NAME_PREFIX, v as isTestEnvironment, w as BLOCK_INNER_STYLES, wt as CHUNK_NAMES, x as generateTypographyTokens, zt as filterMods } from "../config-
|
|
2
|
-
import { A as keyframes, C as getRawCSSText, D as injectRawCSS, E as injectGlobal, F as resolveFunctionColor, M as
|
|
3
|
-
import {
|
|
4
|
-
import { t as mergeStyles } from "../merge-styles-
|
|
5
|
-
import { t as resolveRecipes } from "../resolve-recipes-
|
|
6
|
-
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, 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, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, dotize, filterBaseProps, filterMods, flushStyles, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, 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, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetStyleBatch, resolveFunctionColor, resolveRecipes, setGlobalPredefinedStates, strToRgb, stringifyStyles, styleHandlers, tastyDebug, touch };
|
|
1
|
+
import { $ as SheetManager, $t as StyleParser, A as FLOW_STYLES, At as STYLE_TO_CHUNK, B as createStateParserContext, C as BASE_STYLES, Ct as APPEARANCE_CHUNK_STYLES, D as COLOR_STYLES, Dt as FONT_CHUNK_STYLES, E as BLOCK_STYLES, Et as DISPLAY_CHUNK_STYLES, G as StyleInjector, Gt as parseStyle, Ht as getGlobalPredefinedTokens, I as isSelector, Jt as okhstPlugin, Kt as stringifyStyles, L as renderStyles, Lt as CUSTOM_UNITS, M as OUTER_STYLES, N as POSITION_STYLES, O as CONTAINER_STYLES, Ot as LAYOUT_CHUNK_STYLES, P as TEXT_STYLES, R as parseStateKey, Rt as DIRECTIONS, T as BLOCK_OUTER_STYLES, Tt as DIMENSION_CHUNK_STYLES, U as getGlobalPredefinedStates, Ut as normalizeColorTokenValue, Vt as getGlobalParser, W as setGlobalPredefinedStates, Wt as parseColor, Xt as okhslPlugin, Yt as okhslFunction, Zt as createColorFunc, a as getGlobalCounterStyles, an as hslToRgbValues, b as resetConfig, dt as DEFAULT_ZERO_NAME_PREFIX, f as getNamePrefix, g as isConfigLocked, h as hasStylesGenerated, in as hexToRgb, j as INNER_STYLES, k as DIMENSION_STYLES, kt as POSITION_CHUNK_STYLES, l as getGlobalKeyframes, lt as resetStyleBatch, m as hasGlobalRecipes, n as getConfig, nn as getNamedColorHex, nt as styleHandlers, o as getGlobalFontFaces, on as strToRgb, ot as flushStyles, p as hasGlobalKeyframes, qt as okhstFunction, rn as getRgbValuesFromRgbaString, s as getGlobalFunctions, st as hasPendingStyleWrites, t as configure, tt as defineHandler, u as getGlobalRecipes, ut as DEFAULT_NAME_PREFIX, v as isTestEnvironment, w as BLOCK_INNER_STYLES, wt as CHUNK_NAMES, x as generateTypographyTokens, zt as filterMods } from "../config-CHz_SFr_.js";
|
|
2
|
+
import { A as keyframes, C as getRawCSSText, D as injectRawCSS, E as injectGlobal, F as chunkSheetRegistry, I as resolveFunctionColor, M as property, N as touch, O as injector, P as ChunkSheetRegistry, S as getCSSTextForNode, T as inject, _ as destroy, a as color, b as gc, g as createInjector, h as counterStyle, i as _modAttrs, j as ownKeyframes, k as isPropertyDefined, m as cleanup, n as processTokens, o as filterBaseProps, r as dotize, s as computeStyles, t as tastyDebug, v as fontFace, w as holdKeyframes, x as getCSSText, y as func } from "../core-COC2UQ48.js";
|
|
3
|
+
import { d as categorizeStyleKeys } from "../keyframes-KkxDZ9xu.js";
|
|
4
|
+
import { t as mergeStyles } from "../merge-styles-BGM4RJWC.js";
|
|
5
|
+
import { t as resolveRecipes } from "../resolve-recipes-DbeVYQFr.js";
|
|
6
|
+
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, 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, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, dotize, filterBaseProps, filterMods, flushStyles, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, 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, tastyDebug, touch };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Bt as getGlobalParseFunctions, G as StyleInjector, Gt as parseStyle, It as registerLocalFunctionPolyfills, J as hasLocalCounterStyle, K as extractLocalCounterStyle, Mt as formatFunctionRule, Nt as hasLocalFunctions, Pt as parseFunctionName, Q as hasLocalFontFace, Qt as isDevEnv, Ut as normalizeColorTokenValue, Vt as getGlobalParser, X as fontFaceContentHash, Y as extractLocalFontFace, Z as formatFontFaceRule, _ as isFunctionsPolyfillEnabled, _t as hashString, bt as hasLocalProperties, c as getGlobalInjector, en as Lru, et as STYLE_HANDLER_MAP, f as getNamePrefix, ft as makeClassName, ht as tastyClassRegex, it as PropertyTypeResolver, jt as extractLocalFunctions, l as getGlobalKeyframes, n as getConfig, p as hasGlobalKeyframes, q as formatCounterStyleRule, rt as createStyle, sn as normalizeDslName, tn as overrideColorAlpha, v as isTestEnvironment, vt as extractLocalProperties, wt as CHUNK_NAMES, xt as parsePropertyToken, y as markStylesGenerated, z as camelToKebab } from "./config-
|
|
2
|
-
import { a as mergeKeyframes, c as
|
|
3
|
-
import { n as formatPropertyCSS, r as getRegisteredSSRCollector, t as formatRules } from "./format-rules-
|
|
4
|
-
import { t as resolveRecipes } from "./resolve-recipes-
|
|
1
|
+
import { Bt as getGlobalParseFunctions, G as StyleInjector, Gt as parseStyle, It as registerLocalFunctionPolyfills, J as hasLocalCounterStyle, K as extractLocalCounterStyle, Mt as formatFunctionRule, Nt as hasLocalFunctions, Pt as parseFunctionName, Q as hasLocalFontFace, Qt as isDevEnv, Ut as normalizeColorTokenValue, Vt as getGlobalParser, X as fontFaceContentHash, Y as extractLocalFontFace, Z as formatFontFaceRule, _ as isFunctionsPolyfillEnabled, _t as hashString, bt as hasLocalProperties, c as getGlobalInjector, en as Lru, et as STYLE_HANDLER_MAP, f as getNamePrefix, ft as makeClassName, ht as tastyClassRegex, it as PropertyTypeResolver, jt as extractLocalFunctions, l as getGlobalKeyframes, n as getConfig, p as hasGlobalKeyframes, q as formatCounterStyleRule, rt as createStyle, sn as normalizeDslName, tn as overrideColorAlpha, v as isTestEnvironment, vt as extractLocalProperties, wt as CHUNK_NAMES, xt as parsePropertyToken, y as markStylesGenerated, z as camelToKebab } from "./config-CHz_SFr_.js";
|
|
2
|
+
import { a as mergeKeyframes, c as resolveKeyframesNames, d as categorizeStyleKeys, i as hasLocalKeyframes, l as renderStylesForChunk, n as extractLocalKeyframes, o as referencesAnimation, r as filterUsedKeyframes, s as replaceAnimationNames, t as extractAnimationNamesFromStyles, u as generateChunkCacheKey } from "./keyframes-KkxDZ9xu.js";
|
|
3
|
+
import { n as formatPropertyCSS, r as getRegisteredSSRCollector, t as formatRules } from "./format-rules-U9Od0aqv.js";
|
|
4
|
+
import { t as resolveRecipes } from "./resolve-recipes-DbeVYQFr.js";
|
|
5
5
|
import { cache } from "react";
|
|
6
6
|
//#region src/utils/function-color.ts
|
|
7
7
|
const RE_FUNC_NAME = /^([a-z][a-z0-9-]*)\s*\(/i;
|
|
@@ -245,12 +245,19 @@ function getCSSTextForNode(node, options) {
|
|
|
245
245
|
return getGlobalInjector().getCSSTextForClasses(classSet, options);
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
248
|
+
* Take a reference on local `@keyframes` under the deterministic names the
|
|
249
|
+
* caller resolved, and report which entry holds each. Pair with
|
|
250
|
+
* `ownKeyframes()` once the rules exist to inspect.
|
|
251
251
|
*/
|
|
252
|
-
function holdKeyframes(
|
|
253
|
-
return getGlobalInjector().holdKeyframes(
|
|
252
|
+
function holdKeyframes(steps, names, options) {
|
|
253
|
+
return getGlobalInjector().holdKeyframes(steps, names, options);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Record that a class animates these keyframes, so the reference is released
|
|
257
|
+
* when the last such class is collected.
|
|
258
|
+
*/
|
|
259
|
+
function ownKeyframes(key, className, options) {
|
|
260
|
+
getGlobalInjector().ownKeyframes(key, className, options);
|
|
254
261
|
}
|
|
255
262
|
/**
|
|
256
263
|
* Remove every injected rule that is neither in the DOM nor held by an
|
|
@@ -264,8 +271,8 @@ function cleanup(root) {
|
|
|
264
271
|
* `gc.touchInterval` of them. Used internally by computeStyles and tasty().
|
|
265
272
|
*
|
|
266
273
|
* @deprecated The class name is ignored — collection asks the DOM what is
|
|
267
|
-
* rendered rather than recording usage per class
|
|
268
|
-
*
|
|
274
|
+
* rendered rather than recording usage per class. The argument is kept so
|
|
275
|
+
* existing calls still compile.
|
|
269
276
|
*/
|
|
270
277
|
function touch(className, options) {
|
|
271
278
|
if (!getConfig().gc) return;
|
|
@@ -555,8 +562,10 @@ function collectInternalsRSC(rscCache) {
|
|
|
555
562
|
function collectAncillaryRSC(rscCache, styles) {
|
|
556
563
|
const parts = [];
|
|
557
564
|
const usedKf = getUsedKeyframes(styles);
|
|
558
|
-
|
|
559
|
-
|
|
565
|
+
const rscKeyframeNames = usedKf ? resolveKeyframesNames(usedKf) : null;
|
|
566
|
+
if (usedKf && rscKeyframeNames) for (const [authored, steps] of Object.entries(usedKf)) {
|
|
567
|
+
const name = rscKeyframeNames.get(authored);
|
|
568
|
+
const key = `__kf:${name}`;
|
|
560
569
|
if (!rscCache.emittedKeys.has(key)) {
|
|
561
570
|
rscCache.emittedKeys.add(key);
|
|
562
571
|
parts.push(formatKeyframesCSS(name, steps));
|
|
@@ -616,20 +625,23 @@ function computeStylesRSC(styles, chunkMap, stableStyles) {
|
|
|
616
625
|
const rscCache = getRSCCache();
|
|
617
626
|
const cssParts = [];
|
|
618
627
|
const classNames = [];
|
|
628
|
+
const rscUsedKf = getUsedKeyframes(styles);
|
|
629
|
+
const rscKeyframeNames = rscUsedKf ? resolveKeyframesNames(rscUsedKf) : null;
|
|
619
630
|
const pendingCSS = flushPendingCSS(rscCache);
|
|
620
631
|
if (pendingCSS) cssParts.push(pendingCSS);
|
|
621
632
|
const internalsCSS = collectInternalsRSC(rscCache);
|
|
622
633
|
if (internalsCSS) cssParts.push(internalsCSS);
|
|
623
634
|
for (const [chunkName, chunkStyleKeys] of chunkMap) {
|
|
624
635
|
if (chunkStyleKeys.length === 0) continue;
|
|
625
|
-
const
|
|
636
|
+
const baseKey = generateChunkCacheKey(styles, chunkName, chunkStyleKeys, stableStyles);
|
|
637
|
+
const renderResult = renderStylesForChunk(styles, chunkName, chunkStyleKeys);
|
|
638
|
+
if (renderResult.rules.length === 0) continue;
|
|
639
|
+
const { rules, cacheKey } = applyKeyframeNames(renderResult.rules, baseKey, rscKeyframeNames);
|
|
640
|
+
const { className, isNew } = rscAllocateClassName(rscCache, cacheKey);
|
|
626
641
|
classNames.push(className);
|
|
627
642
|
if (isNew) {
|
|
628
|
-
const
|
|
629
|
-
if (
|
|
630
|
-
const css = formatRules(renderResult.rules, className);
|
|
631
|
-
if (css) cssParts.push(css);
|
|
632
|
-
}
|
|
643
|
+
const css = formatRules(rules, className);
|
|
644
|
+
if (css) cssParts.push(css);
|
|
633
645
|
}
|
|
634
646
|
}
|
|
635
647
|
const ancillaryCSS = collectAncillaryRSC(rscCache, styles);
|
|
@@ -656,23 +668,26 @@ function getUsedKeyframes(styles) {
|
|
|
656
668
|
/**
|
|
657
669
|
* Process a chunk on the SSR path: allocate via collector, render, collect CSS.
|
|
658
670
|
*/
|
|
659
|
-
function processChunkSSR(collector, styles, chunkName, styleKeys, stableStyles) {
|
|
671
|
+
function processChunkSSR(collector, styles, chunkName, styleKeys, stableStyles, keyframeNames) {
|
|
660
672
|
if (styleKeys.length === 0) return null;
|
|
661
|
-
const
|
|
673
|
+
const baseKey = generateChunkCacheKey(styles, chunkName, styleKeys, stableStyles);
|
|
674
|
+
const renderResult = renderStylesForChunk(styles, chunkName, styleKeys);
|
|
675
|
+
if (renderResult.rules.length === 0) return null;
|
|
676
|
+
const { animations, rules, cacheKey } = applyKeyframeNames(renderResult.rules, baseKey, keyframeNames);
|
|
662
677
|
const { className, isNewAllocation } = collector.allocateClassName(cacheKey);
|
|
663
678
|
if (isNewAllocation) {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
679
|
+
collector.collectChunk(cacheKey, className, rules);
|
|
680
|
+
return {
|
|
681
|
+
name: chunkName,
|
|
682
|
+
styleKeys,
|
|
683
|
+
cacheKey,
|
|
684
|
+
renderResult: {
|
|
685
|
+
...renderResult,
|
|
686
|
+
rules
|
|
687
|
+
},
|
|
688
|
+
className,
|
|
689
|
+
animations
|
|
690
|
+
};
|
|
676
691
|
}
|
|
677
692
|
return {
|
|
678
693
|
name: chunkName,
|
|
@@ -683,41 +698,64 @@ function processChunkSSR(collector, styles, chunkName, styleKeys, stableStyles)
|
|
|
683
698
|
};
|
|
684
699
|
}
|
|
685
700
|
/**
|
|
701
|
+
* Point a chunk's rules at the resolved keyframe names, and fold those names
|
|
702
|
+
* into its cache key.
|
|
703
|
+
*
|
|
704
|
+
* Both halves matter, and both have to happen before the rules are written
|
|
705
|
+
* anywhere: the declarations have to name the animation that will exist, and
|
|
706
|
+
* the key has to distinguish two components that authored the same shorthand
|
|
707
|
+
* over different definitions. Shared by the client and the server so they
|
|
708
|
+
* cannot disagree about either.
|
|
709
|
+
*/
|
|
710
|
+
function applyKeyframeNames(ruleset, baseKey, keyframeNames) {
|
|
711
|
+
if (!keyframeNames || keyframeNames.size === 0) return {
|
|
712
|
+
animations: [],
|
|
713
|
+
rules: ruleset,
|
|
714
|
+
cacheKey: baseKey
|
|
715
|
+
};
|
|
716
|
+
const animations = [...keyframeNames.keys()].filter((authored) => ruleset.some((rule) => referencesAnimation(rule.declarations, authored)));
|
|
717
|
+
if (animations.length === 0) return {
|
|
718
|
+
animations,
|
|
719
|
+
rules: ruleset,
|
|
720
|
+
cacheKey: baseKey
|
|
721
|
+
};
|
|
722
|
+
return {
|
|
723
|
+
animations,
|
|
724
|
+
rules: ruleset.map((rule) => ({
|
|
725
|
+
...rule,
|
|
726
|
+
declarations: replaceAnimationNames(rule.declarations, keyframeNames)
|
|
727
|
+
})),
|
|
728
|
+
cacheKey: `${baseKey}\u0000kf:${animations.map((authored) => `${authored}=${keyframeNames.get(authored)}`).sort().join(",")}`
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
686
732
|
* Process a chunk on the client: render, allocate className, and inject
|
|
687
733
|
* CSS synchronously. The injector's cache makes this idempotent.
|
|
688
734
|
*/
|
|
689
|
-
function processChunkSync(styles, chunkName, styleKeys, stableStyles, root) {
|
|
735
|
+
function processChunkSync(styles, chunkName, styleKeys, stableStyles, root, keyframeNames) {
|
|
690
736
|
if (styleKeys.length === 0) return null;
|
|
691
737
|
const cacheKey = generateChunkCacheKey(styles, chunkName, styleKeys, stableStyles);
|
|
692
738
|
const renderResult = renderStylesForChunk(styles, chunkName, styleKeys, cacheKey);
|
|
693
739
|
if (renderResult.rules.length === 0) return null;
|
|
694
|
-
const {
|
|
695
|
-
|
|
740
|
+
const { animations, rules, cacheKey: injectKey } = applyKeyframeNames(renderResult.rules, cacheKey, keyframeNames);
|
|
741
|
+
const { className } = inject(rules, {
|
|
742
|
+
cacheKey: injectKey,
|
|
696
743
|
root,
|
|
697
744
|
pin: false
|
|
698
745
|
});
|
|
699
746
|
return {
|
|
700
747
|
name: chunkName,
|
|
701
748
|
styleKeys,
|
|
702
|
-
cacheKey,
|
|
703
|
-
renderResult
|
|
704
|
-
|
|
749
|
+
cacheKey: injectKey,
|
|
750
|
+
renderResult: {
|
|
751
|
+
...renderResult,
|
|
752
|
+
rules
|
|
753
|
+
},
|
|
754
|
+
className,
|
|
755
|
+
animations
|
|
705
756
|
};
|
|
706
757
|
}
|
|
707
758
|
/**
|
|
708
|
-
* Inject chunk rules synchronously, replacing animation names if needed.
|
|
709
|
-
*/
|
|
710
|
-
function injectChunkRulesSync(chunks, nameMap, root) {
|
|
711
|
-
for (const chunk of chunks) if (chunk.renderResult.rules.length > 0) inject(nameMap ? chunk.renderResult.rules.map((rule) => ({
|
|
712
|
-
...rule,
|
|
713
|
-
declarations: replaceAnimationNames(rule.declarations, nameMap)
|
|
714
|
-
})) : chunk.renderResult.rules, {
|
|
715
|
-
cacheKey: chunk.cacheKey,
|
|
716
|
-
root,
|
|
717
|
-
pin: false
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
/**
|
|
721
759
|
* Inject all ancillary rules (properties, font-faces, counter-styles) synchronously.
|
|
722
760
|
*/
|
|
723
761
|
function injectAncillarySync(styles, root) {
|
|
@@ -749,9 +787,12 @@ function injectAncillarySync(styles, root) {
|
|
|
749
787
|
*/
|
|
750
788
|
function collectAncillarySSR(collector, styles, chunks) {
|
|
751
789
|
const usedKf = getUsedKeyframes(styles);
|
|
752
|
-
if (usedKf)
|
|
753
|
-
const
|
|
754
|
-
|
|
790
|
+
if (usedKf) {
|
|
791
|
+
const names = resolveKeyframesNames(usedKf);
|
|
792
|
+
for (const [authored, steps] of Object.entries(usedKf)) {
|
|
793
|
+
const name = names.get(authored);
|
|
794
|
+
collector.collectKeyframes(name, formatKeyframesCSS(name, steps));
|
|
795
|
+
}
|
|
755
796
|
}
|
|
756
797
|
if (hasLocalProperties(styles)) {
|
|
757
798
|
const localProperties = extractLocalProperties(styles);
|
|
@@ -815,8 +856,10 @@ function computeStyles(styles, options) {
|
|
|
815
856
|
const chunks = [];
|
|
816
857
|
if (collector) {
|
|
817
858
|
collector.collectInternals();
|
|
859
|
+
const ssrKf = getUsedKeyframes(resolved);
|
|
860
|
+
const ssrKeyframeNames = ssrKf ? resolveKeyframesNames(ssrKf) : null;
|
|
818
861
|
for (const [chunkName, chunkStyleKeys] of chunkMap) {
|
|
819
|
-
const chunk = processChunkSSR(collector, resolved, chunkName, chunkStyleKeys, stableStyles);
|
|
862
|
+
const chunk = processChunkSSR(collector, resolved, chunkName, chunkStyleKeys, stableStyles, ssrKeyframeNames);
|
|
820
863
|
if (chunk) chunks.push(chunk);
|
|
821
864
|
}
|
|
822
865
|
collectAncillarySSR(collector, resolved, chunks);
|
|
@@ -825,12 +868,16 @@ function computeStyles(styles, options) {
|
|
|
825
868
|
const root = options?.root;
|
|
826
869
|
injectAncillarySync(resolved, root);
|
|
827
870
|
const usedKf = getUsedKeyframes(resolved);
|
|
871
|
+
const keyframeNames = usedKf ? resolveKeyframesNames(usedKf) : null;
|
|
872
|
+
const keyframeKeys = usedKf && keyframeNames ? holdKeyframes(usedKf, keyframeNames, { root }) : null;
|
|
828
873
|
for (const [chunkName, chunkStyleKeys] of chunkMap) {
|
|
829
|
-
const chunk = processChunkSync(resolved, chunkName, chunkStyleKeys, stableStyles, root);
|
|
874
|
+
const chunk = processChunkSync(resolved, chunkName, chunkStyleKeys, stableStyles, root, keyframeNames);
|
|
830
875
|
if (chunk) chunks.push(chunk);
|
|
831
876
|
}
|
|
832
|
-
|
|
833
|
-
|
|
877
|
+
if (keyframeKeys) for (const chunk of chunks) for (const authored of chunk.animations ?? []) {
|
|
878
|
+
const key = keyframeKeys.get(authored);
|
|
879
|
+
if (key) ownKeyframes(key, chunk.className, { root });
|
|
880
|
+
}
|
|
834
881
|
for (const chunk of chunks) touch(chunk.className, { root });
|
|
835
882
|
}
|
|
836
883
|
if (chunks.length === 0) return EMPTY_RESULT;
|
|
@@ -1239,6 +1286,18 @@ function buildChunkBreakdown(root = document) {
|
|
|
1239
1286
|
totalClasses
|
|
1240
1287
|
};
|
|
1241
1288
|
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Every prefix `registry.globalRules` is keyed by. Anything missing here is a
|
|
1291
|
+
* rule the summary would hold but never count, which is how the totals stopped
|
|
1292
|
+
* adding up the first time.
|
|
1293
|
+
*/
|
|
1294
|
+
const GLOBAL_RULE_PREFIXES = {
|
|
1295
|
+
global: "global:",
|
|
1296
|
+
property: "property:",
|
|
1297
|
+
fontFace: "fontface:",
|
|
1298
|
+
counterStyle: "counterstyle:",
|
|
1299
|
+
function: "function:"
|
|
1300
|
+
};
|
|
1242
1301
|
function getGlobalTypeCSS(type, root = document) {
|
|
1243
1302
|
const registry = getRegistry(root);
|
|
1244
1303
|
if (!registry) return {
|
|
@@ -1248,6 +1307,14 @@ function getGlobalTypeCSS(type, root = document) {
|
|
|
1248
1307
|
};
|
|
1249
1308
|
const chunks = [];
|
|
1250
1309
|
let rc = 0;
|
|
1310
|
+
if (type === "raw") {
|
|
1311
|
+
const css = injector.instance.getRawCSSText({ root });
|
|
1312
|
+
return {
|
|
1313
|
+
css: prettifyCSS(css),
|
|
1314
|
+
ruleCount: countRules(css),
|
|
1315
|
+
size: css.length
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1251
1318
|
if (type === "keyframes") for (const [, entry] of registry.keyframesCache) {
|
|
1252
1319
|
const info = entry.info;
|
|
1253
1320
|
const sheetInfo = registry.sheets[info.sheetIndex];
|
|
@@ -1265,7 +1332,7 @@ function getGlobalTypeCSS(type, root = document) {
|
|
|
1265
1332
|
}
|
|
1266
1333
|
}
|
|
1267
1334
|
else {
|
|
1268
|
-
const prefix = type
|
|
1335
|
+
const prefix = GLOBAL_RULE_PREFIXES[type];
|
|
1269
1336
|
for (const [key, ri] of registry.globalRules) {
|
|
1270
1337
|
if (!key.startsWith(prefix)) continue;
|
|
1271
1338
|
const sheetInfo = registry.sheets[ri.sheetIndex];
|
|
@@ -1446,7 +1513,23 @@ const tastyDebug = {
|
|
|
1446
1513
|
const rawData = getGlobalTypeCSS("raw", root);
|
|
1447
1514
|
const kfData = getGlobalTypeCSS("keyframes", root);
|
|
1448
1515
|
const propData = getGlobalTypeCSS("property", root);
|
|
1449
|
-
const
|
|
1516
|
+
const atRuleData = [
|
|
1517
|
+
"fontFace",
|
|
1518
|
+
"counterStyle",
|
|
1519
|
+
"function"
|
|
1520
|
+
].reduce((all, type) => {
|
|
1521
|
+
const data = getGlobalTypeCSS(type, root);
|
|
1522
|
+
return {
|
|
1523
|
+
css: data.css ? `${all.css}\n${data.css}`.trim() : all.css,
|
|
1524
|
+
ruleCount: all.ruleCount + data.ruleCount,
|
|
1525
|
+
size: all.size + data.size
|
|
1526
|
+
};
|
|
1527
|
+
}, {
|
|
1528
|
+
css: "",
|
|
1529
|
+
ruleCount: 0,
|
|
1530
|
+
size: 0
|
|
1531
|
+
});
|
|
1532
|
+
const totalRuleCount = activeRuleCount + unusedRuleCount + countRules(hotCSS) + globalData.ruleCount + atRuleData.ruleCount + rawData.ruleCount + kfData.ruleCount + propData.ruleCount;
|
|
1450
1533
|
const metrics = injector.instance.getMetrics({ root });
|
|
1451
1534
|
const defs = getDefs(root);
|
|
1452
1535
|
const chunkBreakdown = buildChunkBreakdown(root);
|
|
@@ -1457,14 +1540,14 @@ const tastyDebug = {
|
|
|
1457
1540
|
totalStyledClasses,
|
|
1458
1541
|
activeCSSSize: activeCSS.length,
|
|
1459
1542
|
unusedCSSSize: unusedCSS.length,
|
|
1460
|
-
globalCSSSize: globalData.size,
|
|
1543
|
+
globalCSSSize: globalData.size + atRuleData.size,
|
|
1461
1544
|
rawCSSSize: rawData.size,
|
|
1462
1545
|
keyframesCSSSize: kfData.size,
|
|
1463
1546
|
propertyCSSSize: propData.size,
|
|
1464
1547
|
totalCSSSize: allCSS.length,
|
|
1465
1548
|
activeRuleCount,
|
|
1466
1549
|
unusedRuleCount,
|
|
1467
|
-
globalRuleCount: globalData.ruleCount,
|
|
1550
|
+
globalRuleCount: globalData.ruleCount + atRuleData.ruleCount,
|
|
1468
1551
|
rawRuleCount: rawData.ruleCount,
|
|
1469
1552
|
keyframesRuleCount: kfData.ruleCount,
|
|
1470
1553
|
propertyRuleCount: propData.ruleCount,
|
|
@@ -1479,7 +1562,7 @@ const tastyDebug = {
|
|
|
1479
1562
|
console.log(`Active: ${activeClasses.length} classes, ${activeRuleCount} rules, ${fmtSize(activeCSS.length)}`);
|
|
1480
1563
|
console.log(`Unused: ${unusedClasses.length} classes, ${unusedRuleCount} rules, ${fmtSize(unusedCSS.length)}`);
|
|
1481
1564
|
if (hotClasses.length) console.log(`Held: ${hotClasses.length} classes, ${countRules(hotCSS)} rules, ${fmtSize(hotCSS.length)} (not rendered, not yet collectable)`);
|
|
1482
|
-
console.log(`Global: ${globalData.ruleCount} rules, ${fmtSize(globalData.size)}`);
|
|
1565
|
+
console.log(`Global: ${globalData.ruleCount + atRuleData.ruleCount} rules, ${fmtSize(globalData.size + atRuleData.size)}`);
|
|
1483
1566
|
if (rawData.ruleCount) console.log(`Raw: ${rawData.ruleCount} rules, ${fmtSize(rawData.size)}`);
|
|
1484
1567
|
if (kfData.ruleCount) console.log(`Keyframes: ${kfData.ruleCount} rules, ${fmtSize(kfData.size)}`);
|
|
1485
1568
|
if (propData.ruleCount) console.log(`@property: ${propData.ruleCount} rules, ${fmtSize(propData.size)}`);
|
|
@@ -1526,7 +1609,7 @@ const tastyDebug = {
|
|
|
1526
1609
|
classes: {
|
|
1527
1610
|
active,
|
|
1528
1611
|
unused,
|
|
1529
|
-
all: [...active, ...
|
|
1612
|
+
all: sortTastyClasses(new Set([...active, ...getOwnedClasses(root)]))
|
|
1530
1613
|
},
|
|
1531
1614
|
metrics
|
|
1532
1615
|
};
|
|
@@ -1576,6 +1659,6 @@ function getPageCSS(root = document) {
|
|
|
1576
1659
|
}
|
|
1577
1660
|
if (typeof window !== "undefined" && isDevEnv()) tastyDebug.install();
|
|
1578
1661
|
//#endregion
|
|
1579
|
-
export { keyframes as A, getRawCSSText as C, injectRawCSS as D, injectGlobal as E,
|
|
1662
|
+
export { keyframes as A, getRawCSSText as C, injectRawCSS as D, injectGlobal as E, chunkSheetRegistry as F, resolveFunctionColor as I, property as M, touch as N, injector as O, ChunkSheetRegistry as P, getCSSTextForNode as S, inject as T, destroy as _, color as a, gc as b, hasKeys as c, collectAutoInferredPropertiesRSC as d, getStyleTarget as f, createInjector as g, counterStyle as h, _modAttrs as i, ownKeyframes as j, isPropertyDefined 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, holdKeyframes as w, getCSSText as x, func as y };
|
|
1580
1663
|
|
|
1581
|
-
//# sourceMappingURL=core-
|
|
1664
|
+
//# sourceMappingURL=core-COC2UQ48.js.map
|