@tenphi/tasty 3.10.0 → 3.11.0
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 +399 -380
- package/dist/{babel-types-C_7kRP38.d.ts → babel-types-BKDTT4--.d.ts} +2 -2
- package/dist/chunks/async-storage-f9j9JRtq.js +37 -0
- package/dist/chunks/async-storage-f9j9JRtq.js.map +1 -0
- package/dist/chunks/{build-config-l2Ys-AJr.js → build-config-5d8WlQbq.js} +5 -5
- package/dist/chunks/{build-config-l2Ys-AJr.js.map → build-config-5d8WlQbq.js.map} +1 -1
- package/dist/chunks/{collector-CaNtsRtn.js → collector-CjCak4iE.js} +4 -4
- package/dist/chunks/{collector-CaNtsRtn.js.map → collector-CjCak4iE.js.map} +1 -1
- package/dist/chunks/{config-engine-CpExZO_T.js → config-engine-uOFYZidB.js} +4 -4
- package/dist/chunks/{config-engine-CpExZO_T.js.map → config-engine-uOFYZidB.js.map} +1 -1
- package/dist/chunks/config-file-DlZXJMj8.js +25 -0
- package/dist/chunks/config-file-DlZXJMj8.js.map +1 -0
- package/dist/chunks/{css-definitions-DAIJxzFY.js → css-definitions-ubrHP97m.js} +88 -77
- package/dist/chunks/css-definitions-ubrHP97m.js.map +1 -0
- package/dist/chunks/{debug-CKy49GEr.js → debug-CJ31U_WE.js} +6 -6
- package/dist/chunks/{debug-CKy49GEr.js.map → debug-CJ31U_WE.js.map} +1 -1
- package/dist/chunks/{dsl-DRhFWQzo.js → dsl-DYSJc1-T.js} +11 -6
- package/dist/chunks/dsl-DYSJc1-T.js.map +1 -0
- package/dist/chunks/{react-runtime-oi6i3ELR.js → react-runtime-CyyCI02N.js} +168 -61
- package/dist/chunks/react-runtime-CyyCI02N.js.map +1 -0
- package/dist/chunks/{runtime-engine-DoULyhPt.js → runtime-engine-BQmOu5-W.js} +53 -36
- package/dist/chunks/runtime-engine-BQmOu5-W.js.map +1 -0
- package/dist/chunks/{runtime-state-CZ2J5QiZ.js → runtime-state-DEsyUMU-.js} +14 -3
- package/dist/chunks/runtime-state-DEsyUMU-.js.map +1 -0
- package/dist/chunks/{style-engine-CeKsjtIr.js → style-engine-BX2LshDZ.js} +116 -56
- package/dist/chunks/style-engine-BX2LshDZ.js.map +1 -0
- package/dist/chunks/{zero-engine-fxKu8Jbn.js → zero-engine-Dw0P4yGM.js} +22 -7
- package/dist/chunks/zero-engine-Dw0P4yGM.js.map +1 -0
- package/dist/{collector-w4mBj5gd.d.ts → collector-CTU-nl0g.d.ts} +2 -2
- package/dist/{config-CrZOfNJ5.d.ts → config-CcxqSZI2.d.ts} +28 -9
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +7 -7
- package/dist/hydrate-CRyjjAyl.d.ts +22 -0
- package/dist/{index-CYJtAI9a.d.ts → index-xtey-KDu.d.ts} +43 -13
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8 -8
- package/dist/{merge-styles-VXwJ0Frr.d.ts → merge-styles-DSkVc6CD.d.ts} +2 -2
- package/dist/ssr/astro.js +4 -4
- package/dist/ssr/client.d.ts +2 -0
- package/dist/ssr/client.js +2 -0
- package/dist/ssr/index.d.ts +3 -22
- package/dist/ssr/index.js +4 -4
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +1 -1
- package/dist/ssr/next-config.js +6 -17
- package/dist/ssr/next-config.js.map +1 -1
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +3 -3
- package/dist/static/index.d.ts +2 -2
- package/dist/{types-JEY8PVYP.d.ts → types-DJEM_BOJ.d.ts} +6 -6
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +30 -19
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +24 -6
- package/dist/zero/index.js +4 -4
- package/dist/zero/index.js.map +1 -1
- package/dist/zero/next.d.ts +1 -1
- package/dist/zero/next.js +3 -7
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +4 -1
- package/docs/adoption.md +25 -17
- package/docs/ai-agents.md +37 -34
- package/docs/comparison.md +9 -8
- package/docs/configuration.md +173 -58
- package/docs/debug.md +3 -2
- package/docs/design-system.md +117 -15
- package/docs/dsl.md +120 -81
- package/docs/getting-started.md +81 -24
- package/docs/injector.md +39 -40
- package/docs/methodology.md +45 -20
- package/docs/migration-v3.md +2 -2
- package/docs/pipeline.md +19 -16
- package/docs/plugins.md +20 -40
- package/docs/react-api.md +21 -8
- package/docs/runtime-benchmarks.md +4 -4
- package/docs/ssr.md +83 -63
- package/docs/styles.md +27 -17
- package/docs/tasty-static.md +110 -56
- package/package.json +23 -9
- package/dist/chunks/async-storage-CG5HnUT5.js +0 -20
- package/dist/chunks/async-storage-CG5HnUT5.js.map +0 -1
- package/dist/chunks/css-definitions-DAIJxzFY.js.map +0 -1
- package/dist/chunks/dsl-DRhFWQzo.js.map +0 -1
- package/dist/chunks/react-runtime-oi6i3ELR.js.map +0 -1
- package/dist/chunks/runtime-engine-DoULyhPt.js.map +0 -1
- package/dist/chunks/runtime-state-CZ2J5QiZ.js.map +0 -1
- package/dist/chunks/style-engine-CeKsjtIr.js.map +0 -1
- package/dist/chunks/zero-engine-fxKu8Jbn.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { f as parseStyle, j as normalizeDslName, m as resetGlobalPredefinedTokens, p as resetGlobalParseFunctions, u as normalizeColorTokenValue, w as Lru } from "./dsl-
|
|
2
|
-
import { i as warn, n as isSelector, o as isDevEnv, r as resetStyleWarnings } from "./shared-utils-y-HjvPN4.js";
|
|
3
|
-
import { A as rscClassRegexGlobal, B as
|
|
4
|
-
import { C as camelToKebab, J as markStylesGeneratedState, K as hasStylesGenerated, M as createStyle, T as STYLE_HANDLER_MAP, V as resetStyleChunks, X as resetStylesGeneratedState, Y as resetGlobalPolyfillsState, a as registerBaseStyleProps, b as renderStyles, k as resetHandlers, n as generateChunkCacheKey, o as resetBaseStyleProps, q as isFunctionsPolyfillEnabled, r as categorizeStyleKeys, t as renderStylesForChunk, w as splitSelectorsSafely, y as clearPipelineCache } from "./style-engine-
|
|
5
|
-
import { n as applyStyleConfig, r as normalizeConfig, t as resolveRecipesWith } from "./config-engine-
|
|
6
|
-
import { _ as
|
|
1
|
+
import { f as parseStyle, j as normalizeDslName, m as resetGlobalPredefinedTokens, p as resetGlobalParseFunctions, u as normalizeColorTokenValue, w as Lru } from "./dsl-DYSJc1-T.js";
|
|
2
|
+
import { a as warnOnceDev, i as warn, n as isSelector, o as isDevEnv, r as resetStyleWarnings } from "./shared-utils-y-HjvPN4.js";
|
|
3
|
+
import { A as rscClassRegexGlobal, B as parsePropertyToken, D as makeClassName, F as extractLocalProperties, H as formatFunctionDeclarations, I as getEffectiveDefinition, J as registerLocalFunctionPolyfills, K as parseFunctionName, M as validateNamePrefix, N as hashString, S as formatFontFaceRule, U as formatFunctionPrelude, V as extractLocalFunctions, W as formatFunctionRule, Y as resetFunctionPolyfills, _ as formatCounterStyleRule, b as fontFaceContentHash, c as extractLocalKeyframes, d as mergeKeyframes, f as replaceAnimationNames, g as formatCounterStyleDeclarations, h as extractLocalCounterStyle, i as formatKeyframesCSS, j as tastyClassRegex, k as makeKeyframeName, l as filterUsedKeyframes, m as resolveSelectorKeyframes, o as formatPropertyCSS, p as resolveKeyframesNames, r as formatRules, s as extractAnimationNamesFromStyles, u as hasLocalKeyframes, w as PropertyTypeResolver, x as formatFontFaceDeclarations, y as extractLocalFontFace, z as normalizePropertyDefinition } from "./css-definitions-ubrHP97m.js";
|
|
4
|
+
import { C as camelToKebab, J as markStylesGeneratedState, K as hasStylesGenerated, M as createStyle, T as STYLE_HANDLER_MAP, V as resetStyleChunks, X as resetStylesGeneratedState, Y as resetGlobalPolyfillsState, a as registerBaseStyleProps, b as renderStyles, k as resetHandlers, n as generateChunkCacheKey, o as resetBaseStyleProps, q as isFunctionsPolyfillEnabled, r as categorizeStyleKeys, t as renderStylesForChunk, w as splitSelectorsSafely, y as clearPipelineCache } from "./style-engine-BX2LshDZ.js";
|
|
5
|
+
import { n as applyStyleConfig, r as normalizeConfig, t as resolveRecipesWith } from "./config-engine-uOFYZidB.js";
|
|
6
|
+
import { _ as mergeGlobalKeyframes, a as getEffectivePropertiesByName, b as resetConfigResources, c as getGlobalFontFaces, d as getGlobalStyles, g as mergeGlobalFunctions, h as mergeGlobalFontFaces, i as getEffectiveProperties, l as getGlobalFunctions, m as mergeGlobalCounterStyles, o as getGlobalConfigTokens, p as mergeGlobalConfigTokens, s as getGlobalCounterStyles, t as getRegisteredSSRCollector, u as getGlobalKeyframes, v as mergeGlobalProperties, x as setRuntimeConfigState, y as mergeGlobalStyles } from "./runtime-state-DEsyUMU-.js";
|
|
7
7
|
import React from "react";
|
|
8
8
|
//#region src/prop-handlers.ts
|
|
9
9
|
const GTKEY = "__tasty_prop_handlers__";
|
|
@@ -938,6 +938,9 @@ function registerHydratedClass(registry, className) {
|
|
|
938
938
|
});
|
|
939
939
|
registry.pinCounts.set(className, 0);
|
|
940
940
|
}
|
|
941
|
+
function isPreAllocated(ruleInfo) {
|
|
942
|
+
return ruleInfo.ruleIndex === -1 && ruleInfo.sheetIndex === -1;
|
|
943
|
+
}
|
|
941
944
|
var StyleInjector = class {
|
|
942
945
|
sheetManager;
|
|
943
946
|
config;
|
|
@@ -946,6 +949,7 @@ var StyleInjector = class {
|
|
|
946
949
|
namePrefix;
|
|
947
950
|
classRegex;
|
|
948
951
|
rscClassRegex;
|
|
952
|
+
evictions = 0;
|
|
949
953
|
get _sheetManager() {
|
|
950
954
|
return this.sheetManager;
|
|
951
955
|
}
|
|
@@ -1040,6 +1044,18 @@ var StyleInjector = class {
|
|
|
1040
1044
|
isNewAllocation: true
|
|
1041
1045
|
};
|
|
1042
1046
|
}
|
|
1047
|
+
reuseInjected(registry, className, pin) {
|
|
1048
|
+
registry.unusedSince.delete(className);
|
|
1049
|
+
if (pin) {
|
|
1050
|
+
const pins = registry.pinCounts.get(className) || 0;
|
|
1051
|
+
registry.pinCounts.set(className, pins + 1);
|
|
1052
|
+
}
|
|
1053
|
+
if (registry.metrics) registry.metrics.hits++;
|
|
1054
|
+
return {
|
|
1055
|
+
className,
|
|
1056
|
+
dispose: pin ? () => this.unpin(className, registry) : noop
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1043
1059
|
inject(rules, options) {
|
|
1044
1060
|
const root = options?.root || document;
|
|
1045
1061
|
const registry = this.sheetManager.getRegistry(root);
|
|
@@ -1052,28 +1068,7 @@ var StyleInjector = class {
|
|
|
1052
1068
|
let className;
|
|
1053
1069
|
if (cacheKey && registry.cacheKeyToClassName.has(cacheKey)) {
|
|
1054
1070
|
className = registry.cacheKeyToClassName.get(cacheKey);
|
|
1055
|
-
|
|
1056
|
-
if (existingRuleInfo.ruleIndex === -3) {
|
|
1057
|
-
registry.unusedSince.delete(className);
|
|
1058
|
-
if (pin) registry.pinCounts.set(className, (registry.pinCounts.get(className) || 0) + 1);
|
|
1059
|
-
if (registry.metrics) registry.metrics.hits++;
|
|
1060
|
-
return {
|
|
1061
|
-
className,
|
|
1062
|
-
dispose: pin ? () => this.unpin(className, registry) : noop
|
|
1063
|
-
};
|
|
1064
|
-
}
|
|
1065
|
-
if (!(existingRuleInfo.ruleIndex === -1 && existingRuleInfo.sheetIndex === -1)) {
|
|
1066
|
-
registry.unusedSince.delete(className);
|
|
1067
|
-
if (pin) {
|
|
1068
|
-
const pins = registry.pinCounts.get(className) || 0;
|
|
1069
|
-
registry.pinCounts.set(className, pins + 1);
|
|
1070
|
-
}
|
|
1071
|
-
if (registry.metrics) registry.metrics.hits++;
|
|
1072
|
-
return {
|
|
1073
|
-
className,
|
|
1074
|
-
dispose: pin ? () => this.unpin(className, registry) : noop
|
|
1075
|
-
};
|
|
1076
|
-
}
|
|
1071
|
+
if (!isPreAllocated(registry.rules.get(className))) return this.reuseInjected(registry, className, pin);
|
|
1077
1072
|
} else if (cacheKey) {
|
|
1078
1073
|
className = this.generateClassName(cacheKey);
|
|
1079
1074
|
if (this.tryHydratedHit(registry, cacheKey, className)) {
|
|
@@ -1087,6 +1082,8 @@ var StyleInjector = class {
|
|
|
1087
1082
|
} else {
|
|
1088
1083
|
const parts = rules.map((r) => `${r.selector}\0${r.declarations}`);
|
|
1089
1084
|
className = makeClassName(this.namePrefix, hashString(parts.join("\n")));
|
|
1085
|
+
const existing = registry.rules.get(className);
|
|
1086
|
+
if (existing && !isPreAllocated(existing)) return this.reuseInjected(registry, className, pin);
|
|
1090
1087
|
}
|
|
1091
1088
|
const rulesToInsert = rules.map((rule) => {
|
|
1092
1089
|
let newSelector = rule.selector;
|
|
@@ -1573,12 +1570,15 @@ var StyleInjector = class {
|
|
|
1573
1570
|
else if (unused.length > capacity) doomed = unused.slice(capacity);
|
|
1574
1571
|
else return 0;
|
|
1575
1572
|
if (doomed.length === 0) return 0;
|
|
1576
|
-
|
|
1573
|
+
const deleted = this.sheetManager.deleteClasses(registry, doomed);
|
|
1574
|
+
if (deleted > 0) this.evictions++;
|
|
1575
|
+
return deleted;
|
|
1577
1576
|
}
|
|
1578
1577
|
destroy(root) {
|
|
1579
1578
|
flushStyles();
|
|
1580
1579
|
const targetRoot = root || document;
|
|
1581
1580
|
this.sheetManager.cleanup(targetRoot);
|
|
1581
|
+
this.evictions++;
|
|
1582
1582
|
if (this.cancelPendingGC && !this.sheetManager.hasActiveRoots()) {
|
|
1583
1583
|
this.cancelPendingGC();
|
|
1584
1584
|
this.cancelPendingGC = null;
|
|
@@ -1936,6 +1936,16 @@ const createRSCCache = () => ({
|
|
|
1936
1936
|
generatedNames: /* @__PURE__ */ new Map()
|
|
1937
1937
|
});
|
|
1938
1938
|
const getRSCCache = typeof React.cache === "function" ? React.cache(createRSCCache) : createRSCCache;
|
|
1939
|
+
let requestScopeMissing = false;
|
|
1940
|
+
function checkRequestScope() {
|
|
1941
|
+
if (requestScopeMissing) return;
|
|
1942
|
+
const rscCache = getRSCCache();
|
|
1943
|
+
if (rscCache.scopeChecked) return;
|
|
1944
|
+
rscCache.scopeChecked = true;
|
|
1945
|
+
if (getRSCCache() === rscCache) return;
|
|
1946
|
+
requestScopeMissing = true;
|
|
1947
|
+
warnOnceDev("rsc-request-scope", "Server rendering without a style collector, outside React Server Components. Each tasty() element inlines all of its CSS, and configured globals (tokens, @property defaults such as --gap, globalStyles, @font-face) and the CSS of useGlobalStyles(), useRawCSS(), useKeyframes() and the other style functions are not emitted. Use tastyIntegration() in Astro, TastyRegistry in Next.js, or runWithCollector() from @tenphi/tasty/ssr elsewhere.");
|
|
1948
|
+
}
|
|
1939
1949
|
function rscAllocateClassName(rscCache, cacheKey) {
|
|
1940
1950
|
const existing = rscCache.cacheKeyToClassName.get(cacheKey);
|
|
1941
1951
|
if (existing) return {
|
|
@@ -1969,16 +1979,22 @@ function pushRSCCSS(rscCache, key, css, replace) {
|
|
|
1969
1979
|
rscCache.pendingCSS.push(css);
|
|
1970
1980
|
return true;
|
|
1971
1981
|
}
|
|
1982
|
+
function queueRSCCSS(rscCache, css) {
|
|
1983
|
+
rscCache.pendingCSS.push(css);
|
|
1984
|
+
}
|
|
1972
1985
|
function getStyleTarget() {
|
|
1973
1986
|
const collector = getRegisteredSSRCollector();
|
|
1974
1987
|
if (collector) return {
|
|
1975
1988
|
mode: "ssr",
|
|
1976
1989
|
collector
|
|
1977
1990
|
};
|
|
1978
|
-
if (typeof document === "undefined")
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1991
|
+
if (typeof document === "undefined") {
|
|
1992
|
+
checkRequestScope();
|
|
1993
|
+
return {
|
|
1994
|
+
mode: "rsc",
|
|
1995
|
+
cache: getRSCCache()
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1982
1998
|
return { mode: "client" };
|
|
1983
1999
|
}
|
|
1984
2000
|
//#endregion
|
|
@@ -1992,10 +2008,11 @@ function scanAndEmitAutoProperties(rules, styles, emit) {
|
|
|
1992
2008
|
if (parsed.isValid) registered.add(parsed.cssName);
|
|
1993
2009
|
}
|
|
1994
2010
|
}
|
|
2011
|
+
const declared = getEffectivePropertiesByName();
|
|
1995
2012
|
const resolver = new PropertyTypeResolver();
|
|
1996
2013
|
for (const rule of rules) {
|
|
1997
2014
|
if (!rule.declarations) continue;
|
|
1998
|
-
resolver.scanDeclarations(rule.declarations, (name) => registered.has(name), (name, syntax, initialValue) => {
|
|
2015
|
+
resolver.scanDeclarations(rule.declarations, (name) => registered.has(name) || declared.has(name), (name, syntax, initialValue) => {
|
|
1999
2016
|
registered.add(name);
|
|
2000
2017
|
const css = formatPropertyCSS(name, {
|
|
2001
2018
|
syntax,
|
|
@@ -2410,6 +2427,6 @@ function depsEqual(a, b) {
|
|
|
2410
2427
|
return true;
|
|
2411
2428
|
}
|
|
2412
2429
|
//#endregion
|
|
2413
|
-
export {
|
|
2430
|
+
export { openBatchWindow as $, injector as A, getGlobalInjector as B, getCSSText as C, inject as D, holdKeyframes as E, touch as F, isConfigLocked as G, getNamePrefix as H, ChunkSheetRegistry as I, StyleInjector as J, isTestEnvironment as K, chunkSheetRegistry as L, keyframes as M, ownKeyframes as N, injectGlobal as O, property as P, hasPendingStyleWrites as Q, configure as R, gc as S, getRawCSSText as T, hasGlobalKeyframes as U, getGlobalRecipes as V, hasGlobalRecipes as W, closeBatchWindow as X, SheetManager as Y, flushStyles as Z, counterStyle as _, filterBaseProps as a, fontFace as b, hasKeys as c, checkRequestScope as d, resetStyleBatch as et, getRSCCache as f, cleanup as g, queueRSCCSS as h, modAttrs as i, isPropertyDefined as j, injectRawCSS as k, collectAutoInferredProperties as l, pushRSCCSS as m, createClientState as n, computeStyles as o, getStyleTarget as p, resetConfig as q, processTokens as r, resolveRecipes as s, depsEqual as t, propHandlerRegistry as tt, collectAutoInferredPropertiesRSC as u, createInjector as v, getCSSTextForNode as w, func as x, destroy as y, getConfig as z };
|
|
2414
2431
|
|
|
2415
|
-
//# sourceMappingURL=runtime-engine-
|
|
2432
|
+
//# sourceMappingURL=runtime-engine-BQmOu5-W.js.map
|