@tenphi/tasty 0.0.0-snapshot.de81152 → 0.0.0-snapshot.dfef2a5
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 +60 -28
- package/dist/{async-storage-B7_o6FKt.js → async-storage-DKK-wTD4.js} +1 -1
- package/dist/{async-storage-B7_o6FKt.js.map → async-storage-DKK-wTD4.js.map} +1 -1
- package/dist/babel-BUQGeOXA.d.ts +83 -0
- package/dist/{collector-DrgDE7QB.js → collector-DTahQUiV.js} +97 -23
- package/dist/collector-DTahQUiV.js.map +1 -0
- package/dist/{collector-LuU1vZ68.d.ts → collector-DUaHCcTS.d.ts} +54 -7
- package/dist/{config-_aQ_PZ-P.js → config-B5kHzuNz.js} +5162 -3024
- package/dist/config-B5kHzuNz.js.map +1 -0
- package/dist/{config-vuCRkBWX.d.ts → config-YsxGv4tq.d.ts} +412 -33
- package/dist/{context-CkSg-kDT.js → context-CA8YKeMn.js} +1 -1
- package/dist/{context-CkSg-kDT.js.map → context-CA8YKeMn.js.map} +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +6 -6
- package/dist/{core-BqO8pplb.js → core-CTP5hhqP.js} +152 -179
- package/dist/core-CTP5hhqP.js.map +1 -0
- package/dist/{css-writer-D--REwtp.js → css-writer-BrQjOLNY.js} +78 -17
- package/dist/css-writer-BrQjOLNY.js.map +1 -0
- package/dist/{format-global-rules-Dbc_1tc3.js → format-global-rules-DklyaXv-.js} +1 -1
- package/dist/{format-global-rules-Dbc_1tc3.js.map → format-global-rules-DklyaXv-.js.map} +1 -1
- package/dist/{format-rules-xwteB7a1.js → format-rules-DKOA-6qu.js} +4 -17
- package/dist/format-rules-DKOA-6qu.js.map +1 -0
- package/dist/{hydrate-BvPT4ndL.js → hydrate-OeMX99We.js} +3 -11
- package/dist/{hydrate-BvPT4ndL.js.map → hydrate-OeMX99We.js.map} +1 -1
- package/dist/{index-dUtwpOux.d.ts → index-Cd45t5NM.d.ts} +319 -64
- package/dist/{index-D7qPUGRG.d.ts → index-DhhUI0yi.d.ts} +491 -189
- package/dist/index.d.ts +5 -5
- package/dist/index.js +251 -62
- package/dist/index.js.map +1 -1
- package/dist/{keyframes-ClPFWy33.js → keyframes-CoBy6OgI.js} +10 -173
- package/dist/keyframes-CoBy6OgI.js.map +1 -0
- package/dist/{merge-styles-CtDJMhpJ.d.ts → merge-styles-CU7JbEwg.d.ts} +2 -2
- package/dist/{merge-styles-BUQsEpbv.js → merge-styles-oklji0KB.js} +2 -2
- package/dist/{merge-styles-BUQsEpbv.js.map → merge-styles-oklji0KB.js.map} +1 -1
- package/dist/{resolve-recipes-C0-AMzCz.js → resolve-recipes-DTG81rzl.js} +3 -3
- package/dist/{resolve-recipes-C0-AMzCz.js.map → resolve-recipes-DTG81rzl.js.map} +1 -1
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro-client.js.map +1 -1
- package/dist/ssr/astro-middleware-static.d.ts +16 -0
- package/dist/ssr/astro-middleware-static.js +18 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +8 -6
- package/dist/ssr/astro-middleware.js +10 -10
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.d.ts +2 -17
- package/dist/ssr/astro.js +29 -21
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/index.d.ts +2 -9
- package/dist/ssr/index.js +5 -5
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next.d.ts +2 -3
- package/dist/ssr/next.js +6 -7
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +2 -2
- package/dist/static/index.js +4 -4
- package/dist/static/index.js.map +1 -1
- package/dist/static/inject.js.map +1 -1
- package/dist/zero/babel.d.ts +2 -81
- package/dist/zero/babel.js +39 -27
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +16 -2
- package/dist/zero/index.js +2 -2
- package/dist/zero/next.d.ts +1 -1
- package/dist/zero/next.js +1 -1
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +4 -1
- package/docs/ai-agents.md +223 -0
- package/docs/configuration.md +457 -38
- package/docs/debug.md +7 -7
- package/docs/design-system.md +2 -2
- package/docs/dsl.md +326 -23
- package/docs/injector.md +57 -4
- package/docs/methodology.md +28 -2
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +93 -25
- package/docs/plugins.md +349 -0
- package/docs/react-api.md +107 -4
- package/docs/ssr.md +45 -35
- package/docs/styles.md +64 -15
- package/docs/tasty-static.md +23 -6
- package/package.json +43 -21
- package/tasty.config.ts +6 -0
- package/dist/collector-DrgDE7QB.js.map +0 -1
- package/dist/config-_aQ_PZ-P.js.map +0 -1
- package/dist/core-BqO8pplb.js.map +0 -1
- package/dist/css-writer-D--REwtp.js.map +0 -1
- package/dist/format-rules-xwteB7a1.js.map +0 -1
- package/dist/keyframes-ClPFWy33.js.map +0 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as
|
|
3
|
-
import {
|
|
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,
|
|
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-YsxGv4tq.js";
|
|
2
|
+
import { $ as StyleParser, A as ParsedColor, At as StyleUsage, B as StyleValueStateMap, C as SuffixForSelector, Ct as PropertyOptions, D as CSSMap, Dt as SheetInfo, E as AnyStyleHandler, Et as RuleInfo, F as StyleHandlerProps, G as parseColor, H as getGlobalParser, I as StyleHandlerResult, J as getNamedColorHex, K as parseStyle, L as StyleMap, M as ResolvedStyleValue, Mt as flushStyles, N as StyleHandler, Nt as hasPendingStyleWrites, O as CUSTOM_UNITS, Ot as StyleInjectorConfig, P as StyleHandlerDefinition, Pt as resetStyleBatch, Q as strToRgb, R as StylePropValue, S as StylesWithoutSelectors, St as PropertyDefinition, T as TastyPresetNames, Tt as RootRegistry, U as getGlobalPredefinedTokens, V as filterMods, W as normalizeColorTokenValue, X as hexToRgb, Y as getRgbValuesFromRgbaString, Z as hslToRgbValues, _ as NotSelector, _t as InjectionMode, a as ParseStateKeyOptions, at as CSSProperties, b as Styles, bt as KeyframesResult, 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 InjectResult, h as ConfigTokens, i as renderStyles, it as UnitHandler, j as RawStyleHandler, jt as QueuedWrite, k as DIRECTIONS, kt as StyleRule, 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 KeyframesCacheEntry, w as TastyNamedColors, wt as RawCSSResult, x as StylesInterface, xt as KeyframesSteps, y as Selector, yt as KeyframesInfo, z as StyleValue } from "../index-Cd45t5NM.js";
|
|
3
|
+
import { $ as okhstFunction, $t as PositionStyleProps, A as keyframes, B as ChunkInfo, Bt as BaseStyleProps, C as getCSSTextForNode, D as injectRawCSS, E as injectGlobal, F as ComputeStylesOptions, G as DIMENSION_CHUNK_STYLES, Gt as ContainerStyleProps, H as APPEARANCE_CHUNK_STYLES, Ht as BlockOuterStyleProps, I as ComputeStylesResult, J as LAYOUT_CHUNK_STYLES, Jt as FlowStyleProps, K as DISPLAY_CHUNK_STYLES, Kt as DimensionStyleProps, L as computeStyles, M as touch, N as ChunkSheetRegistry, O as injector, P as chunkSheetRegistry, Q as createColorFunc, Qt as OuterStyleProps, R as defineHandler, S as getCSSText, Sn as DEFAULT_ZERO_NAME_PREFIX, T as inject, U as CHUNK_NAMES, Ut as BlockStyleProps, V as categorizeStyleKeys, Vt as BlockInnerStyleProps, W as ChunkName, Wt as ColorStyleProps, X as STYLE_TO_CHUNK, Xt as ModValue, Y as POSITION_CHUNK_STYLES, Yt as InnerStyleProps, Z as resolveFunctionColor, Zt as Mods, _ as createInjector, _n as INNER_STYLES, a as DebugOptions, an as TastyThemeNames, b as func, bn as TEXT_STYLES, c as tastyDebug, cn as Tokens, d as dotize, dn as BLOCK_OUTER_STYLES, en as ShortGridStyles, et as okhstPlugin, f as _modAttrs, fn as BLOCK_STYLES, g as counterStyle, gn as FLOW_STYLES, h as cleanup, hn as DIMENSION_STYLES, i as DebugChunkInfo, in as TastyExtensionConfig, j as property, k as isPropertyDefined, l as processTokens, ln as BASE_STYLES, m as filterBaseProps, mn as CONTAINER_STYLES, n as CacheStatus, nn as TastyBaseStylePropNames, nt as okhslPlugin, o as InspectResult, on as TextStyleProps, p as color, pn as COLOR_STYLES, q as FONT_CHUNK_STYLES, qt as ExtraBaseStyleProps, r as ChunkBreakdown, rn as TastyCustomProps, s as Summary, sn as TokenValue, t as CSSOptions, tn as TagName, tt as okhslFunction, u as resolveRecipes, un as BLOCK_INNER_STYLES, v as destroy, vn as OUTER_STYLES, w as getRawCSSText, x as gc, xn as DEFAULT_NAME_PREFIX, y as fontFace, yn as POSITION_STYLES, z as styleHandlers } from "../index-DhhUI0yi.js";
|
|
4
|
+
import { t as mergeStyles } from "../merge-styles-CU7JbEwg.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 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, 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 };
|
package/dist/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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,
|
|
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-B5kHzuNz.js";
|
|
2
|
+
import { A as property, C as getRawCSSText, D as injector, E as injectRawCSS, M as ChunkSheetRegistry, N as chunkSheetRegistry, O as isPropertyDefined, P as resolveFunctionColor, S as getCSSTextForNode, T as injectGlobal, _ as destroy, a as color, b as gc, 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 getCSSText, y as func } from "../core-CTP5hhqP.js";
|
|
3
|
+
import { l as categorizeStyleKeys } from "../keyframes-CoBy6OgI.js";
|
|
4
|
+
import { t as mergeStyles } from "../merge-styles-oklji0KB.js";
|
|
5
|
+
import { t as resolveRecipes } from "../resolve-recipes-DTG81rzl.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, 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,104 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as mergeKeyframes, c as generateChunkCacheKey,
|
|
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-B5kHzuNz.js";
|
|
2
|
+
import { a as mergeKeyframes, c as generateChunkCacheKey, i as hasLocalKeyframes, l as categorizeStyleKeys, n as extractLocalKeyframes, o as replaceAnimationNames, r as filterUsedKeyframes, s as renderStylesForChunk, t as extractAnimationNamesFromStyles } from "./keyframes-CoBy6OgI.js";
|
|
3
|
+
import { n as formatPropertyCSS, r as getRegisteredSSRCollector, t as formatRules } from "./format-rules-DKOA-6qu.js";
|
|
4
|
+
import { t as resolveRecipes } from "./resolve-recipes-DTG81rzl.js";
|
|
5
5
|
import { cache } from "react";
|
|
6
|
-
//#region src/
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"paddingBlock",
|
|
34
|
-
"overflow",
|
|
35
|
-
"scrollbar",
|
|
36
|
-
"textAlign"
|
|
37
|
-
];
|
|
38
|
-
const BLOCK_OUTER_STYLES = [
|
|
39
|
-
"border",
|
|
40
|
-
"radius",
|
|
41
|
-
"shadow",
|
|
42
|
-
"outline"
|
|
43
|
-
];
|
|
44
|
-
const BLOCK_STYLES = [...BLOCK_INNER_STYLES, ...BLOCK_OUTER_STYLES];
|
|
45
|
-
const COLOR_STYLES = [
|
|
46
|
-
"color",
|
|
47
|
-
"fill",
|
|
48
|
-
"fade",
|
|
49
|
-
"image"
|
|
50
|
-
];
|
|
51
|
-
const TEXT_STYLES = [
|
|
52
|
-
"textTransform",
|
|
53
|
-
"fontWeight",
|
|
54
|
-
"fontStyle"
|
|
55
|
-
];
|
|
56
|
-
const DIMENSION_STYLES = [
|
|
57
|
-
"width",
|
|
58
|
-
"height",
|
|
59
|
-
"flexBasis",
|
|
60
|
-
"flexGrow",
|
|
61
|
-
"flexShrink",
|
|
62
|
-
"flex"
|
|
63
|
-
];
|
|
64
|
-
const FLOW_STYLES = [
|
|
65
|
-
"flow",
|
|
66
|
-
"place",
|
|
67
|
-
"placeItems",
|
|
68
|
-
"placeContent",
|
|
69
|
-
"alignItems",
|
|
70
|
-
"alignContent",
|
|
71
|
-
"justifyItems",
|
|
72
|
-
"justifyContent",
|
|
73
|
-
"align",
|
|
74
|
-
"justify",
|
|
75
|
-
"gap",
|
|
76
|
-
"columnGap",
|
|
77
|
-
"rowGap",
|
|
78
|
-
"gridColumns",
|
|
79
|
-
"gridRows",
|
|
80
|
-
"gridTemplate",
|
|
81
|
-
"gridAreas"
|
|
82
|
-
];
|
|
83
|
-
const CONTAINER_STYLES = [
|
|
84
|
-
...BASE_STYLES,
|
|
85
|
-
...COLOR_STYLES,
|
|
86
|
-
...DIMENSION_STYLES,
|
|
87
|
-
...POSITION_STYLES,
|
|
88
|
-
...BLOCK_STYLES,
|
|
89
|
-
...FLOW_STYLES
|
|
90
|
-
];
|
|
91
|
-
const OUTER_STYLES = [
|
|
92
|
-
...POSITION_STYLES,
|
|
93
|
-
...DIMENSION_STYLES,
|
|
94
|
-
...BLOCK_OUTER_STYLES
|
|
95
|
-
];
|
|
96
|
-
const INNER_STYLES = [
|
|
97
|
-
...BASE_STYLES,
|
|
98
|
-
...COLOR_STYLES,
|
|
99
|
-
...BLOCK_INNER_STYLES,
|
|
100
|
-
...FLOW_STYLES
|
|
101
|
-
];
|
|
6
|
+
//#region src/utils/function-color.ts
|
|
7
|
+
const RE_FUNC_NAME = /^([a-z][a-z0-9-]*)\s*\(/i;
|
|
8
|
+
const RE_COLOR_OUT = /^(?:rgb|hsl|hwb|lab|lch|oklab|oklch|color)\(|^#|^var\(--/i;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve a `name(...)` value produced by a registered custom parse function
|
|
11
|
+
* into its concrete color output.
|
|
12
|
+
*
|
|
13
|
+
* A color function is just a `functions` entry whose output is an already
|
|
14
|
+
* supported color (`rgb`, `hsl`, `#…`, `oklch`, …). This helper delegates the
|
|
15
|
+
* value to the global parser (which already runs the registered parse function)
|
|
16
|
+
* and returns the result only when it looks like a color. Returns `null` when
|
|
17
|
+
* `str` is not a registered custom function or its output is not a color.
|
|
18
|
+
*
|
|
19
|
+
* This is the generic replacement for the previously hardcoded okhsl/okhst
|
|
20
|
+
* conversion branches scattered across `strToRgb`, `resolveToRgbaValues`, and
|
|
21
|
+
* the `#token.alpha` injection path.
|
|
22
|
+
*/
|
|
23
|
+
function resolveFunctionColor(str) {
|
|
24
|
+
const m = RE_FUNC_NAME.exec(str);
|
|
25
|
+
if (!m) return null;
|
|
26
|
+
const name = m[1].toLowerCase();
|
|
27
|
+
getGlobalParser();
|
|
28
|
+
if (!(name in getGlobalParseFunctions())) return null;
|
|
29
|
+
const out = getGlobalParser().process(str).output;
|
|
30
|
+
if (!out || !RE_COLOR_OUT.test(out)) return null;
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
102
33
|
//#endregion
|
|
103
34
|
//#region src/injector/chunk-sheet-registry.ts
|
|
104
35
|
/**
|
|
@@ -265,33 +196,53 @@ function fontFace(family, descriptors, options) {
|
|
|
265
196
|
/**
|
|
266
197
|
* Inject a CSS @counter-style rule.
|
|
267
198
|
*
|
|
268
|
-
* Permanent and global — no dispose or ref-counting.
|
|
269
|
-
*
|
|
199
|
+
* Permanent and global — no dispose or ref-counting. Deduplicates by name and
|
|
200
|
+
* overrides an existing rule by default. Pass `weak: true` for global
|
|
201
|
+
* `configure()` definitions, which never clobber an existing rule.
|
|
270
202
|
*/
|
|
271
203
|
function counterStyle(name, descriptors, options) {
|
|
272
204
|
return getGlobalInjector().counterStyle(name, descriptors, options);
|
|
273
205
|
}
|
|
274
206
|
/**
|
|
207
|
+
* Inject a CSS @function rule (custom function).
|
|
208
|
+
*
|
|
209
|
+
* Permanent and global — no dispose or ref-counting. Deduplicates by function
|
|
210
|
+
* name and overrides an existing rule by default. Pass `weak: true` for global
|
|
211
|
+
* `configure()` definitions, which never clobber an existing rule.
|
|
212
|
+
*
|
|
213
|
+
* @param name - The function name (`$$name`, `$name`, or `--name`)
|
|
214
|
+
* @param definition - Function definition (args, returns, result, local vars)
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```ts
|
|
218
|
+
* func('$$negative', { args: ['$value'], result: '(-1 * $value)' });
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
function func(name, definition, options) {
|
|
222
|
+
return getGlobalInjector().func(name, definition, options);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
275
225
|
* Get CSS text from all sheets (for SSR)
|
|
276
226
|
*/
|
|
277
|
-
function
|
|
278
|
-
return getGlobalInjector().
|
|
227
|
+
function getCSSText(options) {
|
|
228
|
+
return getGlobalInjector().getCSSText(options);
|
|
279
229
|
}
|
|
280
230
|
/**
|
|
281
231
|
* Collect only CSS used by a rendered subtree (like jest-styled-components).
|
|
282
232
|
* Pass the container returned by render(...).
|
|
283
233
|
*/
|
|
284
|
-
function
|
|
234
|
+
function getCSSTextForNode(node, options) {
|
|
235
|
+
const classRegex = tastyClassRegex(getNamePrefix());
|
|
285
236
|
const classSet = /* @__PURE__ */ new Set();
|
|
286
237
|
const readClasses = (el) => {
|
|
287
238
|
const cls = el.getAttribute("class");
|
|
288
239
|
if (!cls) return;
|
|
289
|
-
for (const token of cls.split(/\s+/)) if (
|
|
240
|
+
for (const token of cls.split(/\s+/)) if (classRegex.test(token)) classSet.add(token);
|
|
290
241
|
};
|
|
291
242
|
if (node.getAttribute) readClasses(node);
|
|
292
243
|
const elements = node.querySelectorAll ? node.querySelectorAll("[class]") : [];
|
|
293
244
|
if (elements) elements.forEach(readClasses);
|
|
294
|
-
return getGlobalInjector().
|
|
245
|
+
return getGlobalInjector().getCSSTextForClasses(classSet, options);
|
|
295
246
|
}
|
|
296
247
|
/**
|
|
297
248
|
* Force cleanup of unused rules
|
|
@@ -319,12 +270,6 @@ function gc(options) {
|
|
|
319
270
|
return getGlobalInjector().gc(options);
|
|
320
271
|
}
|
|
321
272
|
/**
|
|
322
|
-
* Check if we're currently running in a test environment
|
|
323
|
-
*/
|
|
324
|
-
function getIsTestEnvironment() {
|
|
325
|
-
return isTestEnvironment();
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
273
|
* Get the global injector instance for debugging
|
|
329
274
|
*/
|
|
330
275
|
const injector = { get instance() {
|
|
@@ -367,6 +312,7 @@ const getRSCCache = cache(() => ({
|
|
|
367
312
|
emittedKeys: /* @__PURE__ */ new Set(),
|
|
368
313
|
internalsEmitted: false,
|
|
369
314
|
pendingCSS: [],
|
|
315
|
+
keyToIndex: /* @__PURE__ */ new Map(),
|
|
370
316
|
generatedNames: /* @__PURE__ */ new Map()
|
|
371
317
|
}));
|
|
372
318
|
function rscAllocateClassName(rscCache, cacheKey) {
|
|
@@ -375,7 +321,7 @@ function rscAllocateClassName(rscCache, cacheKey) {
|
|
|
375
321
|
className: existing,
|
|
376
322
|
isNew: false
|
|
377
323
|
};
|
|
378
|
-
const className =
|
|
324
|
+
const className = makeClassName(getNamePrefix(), hashString(cacheKey));
|
|
379
325
|
rscCache.cacheKeyToClassName.set(cacheKey, className);
|
|
380
326
|
return {
|
|
381
327
|
className,
|
|
@@ -390,15 +336,28 @@ function flushPendingCSS(rscCache) {
|
|
|
390
336
|
if (rscCache.pendingCSS.length === 0) return "";
|
|
391
337
|
const css = rscCache.pendingCSS.join("\n");
|
|
392
338
|
rscCache.pendingCSS.length = 0;
|
|
339
|
+
rscCache.keyToIndex.clear();
|
|
393
340
|
return css;
|
|
394
341
|
}
|
|
395
342
|
/**
|
|
396
343
|
* Push CSS into the RSC pending buffer with dedup via emittedKeys.
|
|
397
344
|
* Returns true if the CSS was added, false if it was already emitted.
|
|
345
|
+
*
|
|
346
|
+
* Pass `replace` for slot-keyed entries (an explicit `id`), where the last write
|
|
347
|
+
* must win to match the client's update-tracking behavior. If the slot has
|
|
348
|
+
* already been flushed into a `<style>` tag the new CSS is appended instead,
|
|
349
|
+
* which still wins by cascade order.
|
|
398
350
|
*/
|
|
399
|
-
function pushRSCCSS(rscCache, key, css) {
|
|
400
|
-
if (
|
|
351
|
+
function pushRSCCSS(rscCache, key, css, replace) {
|
|
352
|
+
if (replace) {
|
|
353
|
+
const pendingIndex = rscCache.keyToIndex.get(key);
|
|
354
|
+
if (pendingIndex !== void 0) {
|
|
355
|
+
rscCache.pendingCSS[pendingIndex] = css;
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
} else if (rscCache.emittedKeys.has(key)) return false;
|
|
401
359
|
rscCache.emittedKeys.add(key);
|
|
360
|
+
rscCache.keyToIndex.set(key, rscCache.pendingCSS.length);
|
|
402
361
|
rscCache.pendingCSS.push(css);
|
|
403
362
|
return true;
|
|
404
363
|
}
|
|
@@ -428,7 +387,7 @@ function getStyleTarget() {
|
|
|
428
387
|
function scanAndEmitAutoProperties(rules, styles, emit) {
|
|
429
388
|
const registered = /* @__PURE__ */ new Set();
|
|
430
389
|
if (styles) {
|
|
431
|
-
const localProps = styles["@
|
|
390
|
+
const localProps = styles["@property"];
|
|
432
391
|
if (localProps && typeof localProps === "object") for (const token of Object.keys(localProps)) {
|
|
433
392
|
const parsed = parsePropertyToken(token);
|
|
434
393
|
if (parsed.isValid) registered.add(parsed.cssName);
|
|
@@ -454,7 +413,7 @@ function scanAndEmitAutoProperties(rules, styles, emit) {
|
|
|
454
413
|
*
|
|
455
414
|
* @param rules - Rendered style rules containing CSS declarations
|
|
456
415
|
* @param collector - SSR collector to emit @property CSS into
|
|
457
|
-
* @param styles - Original styles object (used to skip explicit @
|
|
416
|
+
* @param styles - Original styles object (used to skip explicit @property)
|
|
458
417
|
*/
|
|
459
418
|
function collectAutoInferredProperties(rules, collector, styles) {
|
|
460
419
|
scanAndEmitAutoProperties(rules, styles, (name, css) => {
|
|
@@ -625,6 +584,16 @@ function collectAncillaryRSC(rscCache, styles) {
|
|
|
625
584
|
}
|
|
626
585
|
}
|
|
627
586
|
}
|
|
587
|
+
if (!isFunctionsPolyfillEnabled() && hasLocalFunctions(styles)) {
|
|
588
|
+
const localFunctions = extractLocalFunctions(styles);
|
|
589
|
+
if (localFunctions) for (const [name, definition] of Object.entries(localFunctions)) {
|
|
590
|
+
const key = `__func:${parseFunctionName(name)}`;
|
|
591
|
+
if (!rscCache.emittedKeys.has(key)) {
|
|
592
|
+
rscCache.emittedKeys.add(key);
|
|
593
|
+
parts.push(formatFunctionRule(name, definition));
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
628
597
|
return parts.join("\n");
|
|
629
598
|
}
|
|
630
599
|
/**
|
|
@@ -774,6 +743,10 @@ function injectAncillarySync(styles, root) {
|
|
|
774
743
|
const localCounterStyle = extractLocalCounterStyle(styles);
|
|
775
744
|
if (localCounterStyle) for (const [name, descriptors] of Object.entries(localCounterStyle)) counterStyle(name, descriptors, { root });
|
|
776
745
|
}
|
|
746
|
+
if (!isFunctionsPolyfillEnabled() && hasLocalFunctions(styles)) {
|
|
747
|
+
const localFunctions = extractLocalFunctions(styles);
|
|
748
|
+
if (localFunctions) for (const [name, definition] of Object.entries(localFunctions)) func(name, definition, { root });
|
|
749
|
+
}
|
|
777
750
|
}
|
|
778
751
|
/**
|
|
779
752
|
* Collect all ancillary rules into the SSR collector.
|
|
@@ -809,6 +782,13 @@ function collectAncillarySSR(collector, styles, chunks) {
|
|
|
809
782
|
collector.collectCounterStyle(name, css);
|
|
810
783
|
}
|
|
811
784
|
}
|
|
785
|
+
if (!isFunctionsPolyfillEnabled() && hasLocalFunctions(styles)) {
|
|
786
|
+
const localFunctions = extractLocalFunctions(styles);
|
|
787
|
+
if (localFunctions) for (const [name, definition] of Object.entries(localFunctions)) {
|
|
788
|
+
const css = formatFunctionRule(name, definition);
|
|
789
|
+
collector.collectFunction(parseFunctionName(name), css);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
812
792
|
if (getConfig().autoPropertyTypes !== false) {
|
|
813
793
|
const allRules = chunks.flatMap((c) => c.renderResult.rules);
|
|
814
794
|
if (allRules.length > 0) collectAutoInferredProperties(allRules, collector, styles);
|
|
@@ -832,6 +812,7 @@ function collectAncillarySSR(collector, styles, chunks) {
|
|
|
832
812
|
function computeStyles(styles, options) {
|
|
833
813
|
if (!styles || !hasKeys(styles)) return EMPTY_RESULT;
|
|
834
814
|
const resolved = resolveRecipes(styles);
|
|
815
|
+
if (isFunctionsPolyfillEnabled() && hasLocalFunctions(resolved)) registerLocalFunctionPolyfills(resolved);
|
|
835
816
|
const chunkMap = categorizeStyleKeys(resolved);
|
|
836
817
|
const collector = options?.ssrCollector !== void 0 ? options.ssrCollector : getRegisteredSSRCollector();
|
|
837
818
|
const chunks = [];
|
|
@@ -904,7 +885,7 @@ function filterBaseProps(props, opts = {}) {
|
|
|
904
885
|
//#endregion
|
|
905
886
|
//#region src/utils/colors.ts
|
|
906
887
|
function color(name, opacity = 1) {
|
|
907
|
-
if (opacity !== 1) return
|
|
888
|
+
if (opacity !== 1) return overrideColorAlpha(`var(--${name}-color)`, String(opacity));
|
|
908
889
|
return `var(--${name}-color)`;
|
|
909
890
|
}
|
|
910
891
|
//#endregion
|
|
@@ -934,7 +915,7 @@ function modAttrs(map) {
|
|
|
934
915
|
if (value === true) attrs[attrName] = "";
|
|
935
916
|
else if (typeof value === "string") attrs[attrName] = value;
|
|
936
917
|
else if (typeof value === "number") attrs[attrName] = String(value);
|
|
937
|
-
else console.warn(`Tasty
|
|
918
|
+
else console.warn(`[Tasty] Invalid mod value for "${key}". Expected boolean, string, or number, got ${typeof value}`);
|
|
938
919
|
return attrs;
|
|
939
920
|
}, {}) : null;
|
|
940
921
|
}
|
|
@@ -1061,28 +1042,13 @@ const dotize = {
|
|
|
1061
1042
|
//#endregion
|
|
1062
1043
|
//#region src/utils/process-tokens.ts
|
|
1063
1044
|
/**
|
|
1064
|
-
* Extract color components in the configured color space.
|
|
1065
|
-
* Returns a CSS variable reference for token colors, or decomposed
|
|
1066
|
-
* components as a space-separated string.
|
|
1067
|
-
*/
|
|
1068
|
-
function extractColorSpaceValue(colorValue, parsedOutput) {
|
|
1069
|
-
const suffix = getColorSpaceSuffix();
|
|
1070
|
-
const varMatch = parsedOutput.match(/var\(--([a-z0-9-]+)-color\)/);
|
|
1071
|
-
if (varMatch) return `var(--${varMatch[1]}-color-${suffix})`;
|
|
1072
|
-
const components = getColorSpaceComponents(colorValue);
|
|
1073
|
-
if (components !== colorValue) return components;
|
|
1074
|
-
const componentsFromParsed = getColorSpaceComponents(parsedOutput);
|
|
1075
|
-
if (componentsFromParsed !== parsedOutput) return componentsFromParsed;
|
|
1076
|
-
return parsedOutput;
|
|
1077
|
-
}
|
|
1078
|
-
/**
|
|
1079
1045
|
* Check if a value is a valid token value (string, number, or boolean - not object).
|
|
1080
1046
|
* Returns false for `false` values (they mean "skip this token").
|
|
1081
1047
|
*/
|
|
1082
1048
|
function isValidTokenValue(value) {
|
|
1083
1049
|
if (value === void 0 || value === null || value === false) return false;
|
|
1084
1050
|
if (typeof value === "object") {
|
|
1085
|
-
console.warn("Tasty
|
|
1051
|
+
console.warn("[Tasty] Object values are not allowed in tokens prop. Tokens do not support state-based styling. Use a primitive value instead.");
|
|
1086
1052
|
return false;
|
|
1087
1053
|
}
|
|
1088
1054
|
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
@@ -1099,9 +1065,24 @@ function processTokenValue(value) {
|
|
|
1099
1065
|
return parseStyle(value).output;
|
|
1100
1066
|
}
|
|
1101
1067
|
/**
|
|
1068
|
+
* Resolve one `$name` / `#name` entry to the custom property it declares and
|
|
1069
|
+
* the value to declare, or `null` when the entry declares nothing.
|
|
1070
|
+
*
|
|
1071
|
+
* The two sigils differ only in the property name they build and in how `true`
|
|
1072
|
+
* is read: for a custom property it is the empty value, for a color it is
|
|
1073
|
+
* `transparent`.
|
|
1074
|
+
*/
|
|
1075
|
+
function resolveTokenEntry(key, value) {
|
|
1076
|
+
const name = `--${normalizeDslName(key.slice(1))}`;
|
|
1077
|
+
if (key[0] === "$") return [name, processTokenValue(value === true ? "" : value)];
|
|
1078
|
+
const colorValue = normalizeColorTokenValue(value);
|
|
1079
|
+
if (colorValue === null) return null;
|
|
1080
|
+
return [`${name}-color`, processTokenValue(colorValue)];
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1102
1083
|
* Process tokens object into inline style properties.
|
|
1103
|
-
* -
|
|
1104
|
-
* -
|
|
1084
|
+
* - `$name` -> `--name` with the parsed value
|
|
1085
|
+
* - `#name` -> `--name-color` with the parsed value
|
|
1105
1086
|
*
|
|
1106
1087
|
* @param tokens - The tokens object to process
|
|
1107
1088
|
* @returns CSSProperties object or undefined if no tokens to process
|
|
@@ -1114,24 +1095,11 @@ function processTokens(tokens) {
|
|
|
1114
1095
|
for (const key of keys) {
|
|
1115
1096
|
const value = tokens[key];
|
|
1116
1097
|
if (!isValidTokenValue(value)) continue;
|
|
1117
|
-
if (key
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
} else if (key.startsWith("#")) {
|
|
1123
|
-
const colorName = key.slice(1);
|
|
1124
|
-
const suffix = getColorSpaceSuffix();
|
|
1125
|
-
const effectiveValue = normalizeColorTokenValue(value);
|
|
1126
|
-
if (effectiveValue === null) continue;
|
|
1127
|
-
const originalValue = typeof effectiveValue === "number" ? String(effectiveValue) : effectiveValue;
|
|
1128
|
-
const lowerValue = originalValue.toLowerCase();
|
|
1129
|
-
const processedValue = processTokenValue(effectiveValue);
|
|
1130
|
-
if (!result) result = {};
|
|
1131
|
-
result[`--${colorName}-color`] = processedValue;
|
|
1132
|
-
if (/^#current(?:\.|$)/i.test(lowerValue)) continue;
|
|
1133
|
-
result[`--${colorName}-color-${suffix}`] = extractColorSpaceValue(originalValue, processedValue);
|
|
1134
|
-
}
|
|
1098
|
+
if (key[0] !== "$" && key[0] !== "#") continue;
|
|
1099
|
+
const entry = resolveTokenEntry(key, value);
|
|
1100
|
+
if (!entry) continue;
|
|
1101
|
+
if (!result) result = {};
|
|
1102
|
+
result[entry[0]] = entry[1];
|
|
1135
1103
|
}
|
|
1136
1104
|
return result;
|
|
1137
1105
|
}
|
|
@@ -1158,10 +1126,12 @@ function getUnusedClasses(root = document) {
|
|
|
1158
1126
|
}
|
|
1159
1127
|
function findDomTastyClasses(root = document) {
|
|
1160
1128
|
const classes = /* @__PURE__ */ new Set();
|
|
1161
|
-
|
|
1129
|
+
const elements = root.querySelectorAll?.("[class]") || [];
|
|
1130
|
+
const classRegex = tastyClassRegex(getNamePrefix());
|
|
1131
|
+
elements.forEach((el) => {
|
|
1162
1132
|
const attr = el.getAttribute("class");
|
|
1163
1133
|
if (attr) {
|
|
1164
|
-
for (const cls of attr.split(/\s+/)) if (
|
|
1134
|
+
for (const cls of attr.split(/\s+/)) if (classRegex.test(cls)) classes.add(cls);
|
|
1165
1135
|
}
|
|
1166
1136
|
});
|
|
1167
1137
|
return sortTastyClasses(classes);
|
|
@@ -1248,7 +1218,7 @@ function buildChunkBreakdown(root = document) {
|
|
|
1248
1218
|
ruleCount: 0
|
|
1249
1219
|
};
|
|
1250
1220
|
byChunk[chunk].classes.push(className);
|
|
1251
|
-
const css = injector.instance.
|
|
1221
|
+
const css = injector.instance.getCSSTextForClasses([className], { root });
|
|
1252
1222
|
byChunk[chunk].cssSize += css.length;
|
|
1253
1223
|
byChunk[chunk].ruleCount += countRules(css);
|
|
1254
1224
|
}
|
|
@@ -1361,38 +1331,39 @@ const tastyDebug = {
|
|
|
1361
1331
|
css(target, opts) {
|
|
1362
1332
|
const { root = document, prettify = true, raw = false, source = false } = opts || {};
|
|
1363
1333
|
let css = "";
|
|
1364
|
-
|
|
1334
|
+
const classRegex = tastyClassRegex(getNamePrefix());
|
|
1335
|
+
if (source && typeof target === "string" && classRegex.test(target)) {
|
|
1365
1336
|
const src = getSourceCssForClasses([target], root);
|
|
1366
1337
|
if (src) css = src;
|
|
1367
1338
|
else {
|
|
1368
|
-
if (!raw) console.warn("
|
|
1369
|
-
css = injector.instance.
|
|
1339
|
+
if (!raw) console.warn("[Tasty] source CSS not available (requires dev mode or TASTY_DEBUG=true). Falling back to live CSSOM.");
|
|
1340
|
+
css = injector.instance.getCSSTextForClasses([target], { root });
|
|
1370
1341
|
}
|
|
1371
1342
|
} else if (source && Array.isArray(target)) {
|
|
1372
1343
|
const src = getSourceCssForClasses(target, root);
|
|
1373
1344
|
if (src) css = src;
|
|
1374
1345
|
else {
|
|
1375
|
-
if (!raw) console.warn("
|
|
1376
|
-
css = injector.instance.
|
|
1346
|
+
if (!raw) console.warn("[Tasty] source CSS not available. Falling back to live CSSOM.");
|
|
1347
|
+
css = injector.instance.getCSSTextForClasses(target, { root });
|
|
1377
1348
|
}
|
|
1378
|
-
} else if (typeof target === "string") if (target === "all") css = injector.instance.
|
|
1349
|
+
} else if (typeof target === "string") if (target === "all") css = injector.instance.getCSSText({ root });
|
|
1379
1350
|
else if (target === "global") {
|
|
1380
1351
|
css = getGlobalTypeCSS("global", root).css;
|
|
1381
1352
|
return css;
|
|
1382
1353
|
} else if (target === "active") {
|
|
1383
1354
|
const active = findDomTastyClasses(root);
|
|
1384
|
-
css = injector.instance.
|
|
1355
|
+
css = injector.instance.getCSSTextForClasses(active, { root });
|
|
1385
1356
|
} else if (target === "unused") {
|
|
1386
1357
|
const unused = getUnusedClasses(root);
|
|
1387
|
-
css = injector.instance.
|
|
1358
|
+
css = injector.instance.getCSSTextForClasses(unused, { root });
|
|
1388
1359
|
} else if (target === "page") css = getPageCSS(root);
|
|
1389
|
-
else if (
|
|
1360
|
+
else if (classRegex.test(target)) css = injector.instance.getCSSTextForClasses([target], { root });
|
|
1390
1361
|
else {
|
|
1391
1362
|
const el = root.querySelector?.(target);
|
|
1392
|
-
if (el) css =
|
|
1363
|
+
if (el) css = getCSSTextForNode(el, { root });
|
|
1393
1364
|
}
|
|
1394
|
-
else if (Array.isArray(target)) css = injector.instance.
|
|
1395
|
-
else if (target instanceof Element) css =
|
|
1365
|
+
else if (Array.isArray(target)) css = injector.instance.getCSSTextForClasses(target, { root });
|
|
1366
|
+
else if (target instanceof Element) css = getCSSTextForNode(target, { root });
|
|
1396
1367
|
const result = prettify ? prettifyCSS(css) : css;
|
|
1397
1368
|
if (!raw) {
|
|
1398
1369
|
const label = Array.isArray(target) ? `[${target.join(", ")}]` : target;
|
|
@@ -1415,15 +1386,17 @@ const tastyDebug = {
|
|
|
1415
1386
|
size: 0,
|
|
1416
1387
|
rules: 0
|
|
1417
1388
|
};
|
|
1418
|
-
if (!raw) console.warn("
|
|
1389
|
+
if (!raw) console.warn("[Tasty] debug.inspect: element not found");
|
|
1419
1390
|
return empty;
|
|
1420
1391
|
}
|
|
1421
|
-
const
|
|
1392
|
+
const classList = element.getAttribute("class") || "";
|
|
1393
|
+
const classRegex = tastyClassRegex(getNamePrefix());
|
|
1394
|
+
const tastyClasses = classList.split(/\s+/).filter((cls) => classRegex.test(cls));
|
|
1422
1395
|
const chunks = tastyClasses.map((className) => ({
|
|
1423
1396
|
className,
|
|
1424
1397
|
chunkName: getChunkForClass(className, root)
|
|
1425
1398
|
}));
|
|
1426
|
-
const css =
|
|
1399
|
+
const css = getCSSTextForNode(element, { root });
|
|
1427
1400
|
const rules = countRules(css);
|
|
1428
1401
|
const result = {
|
|
1429
1402
|
element,
|
|
@@ -1450,9 +1423,9 @@ const tastyDebug = {
|
|
|
1450
1423
|
const activeClasses = findDomTastyClasses(root);
|
|
1451
1424
|
const unusedClasses = getUnusedClasses(root);
|
|
1452
1425
|
const totalStyledClasses = [...activeClasses, ...unusedClasses];
|
|
1453
|
-
const activeCSS = injector.instance.
|
|
1454
|
-
const unusedCSS = injector.instance.
|
|
1455
|
-
const allCSS = injector.instance.
|
|
1426
|
+
const activeCSS = injector.instance.getCSSTextForClasses(activeClasses, { root });
|
|
1427
|
+
const unusedCSS = injector.instance.getCSSTextForClasses(unusedClasses, { root });
|
|
1428
|
+
const allCSS = injector.instance.getCSSText({ root });
|
|
1456
1429
|
const activeRuleCount = countRules(activeCSS);
|
|
1457
1430
|
const unusedRuleCount = countRules(unusedCSS);
|
|
1458
1431
|
const globalData = getGlobalTypeCSS("global", root);
|
|
@@ -1587,6 +1560,6 @@ function getPageCSS(root = document) {
|
|
|
1587
1560
|
}
|
|
1588
1561
|
if (typeof window !== "undefined" && isDevEnv()) tastyDebug.install();
|
|
1589
1562
|
//#endregion
|
|
1590
|
-
export { property as A,
|
|
1563
|
+
export { property as A, getRawCSSText as C, injector as D, injectRawCSS as E, ChunkSheetRegistry as M, chunkSheetRegistry as N, isPropertyDefined as O, resolveFunctionColor as P, getCSSTextForNode as S, injectGlobal 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, 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, getCSSText as x, func as y };
|
|
1591
1564
|
|
|
1592
|
-
//# sourceMappingURL=core-
|
|
1565
|
+
//# sourceMappingURL=core-CTP5hhqP.js.map
|