@tenphi/tasty 3.8.0 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/{babel-Cp_dRhuS.d.ts → babel-Zs1Q03qt.d.ts} +2 -2
- package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
- package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
- package/dist/chunks/build-config-CUQVwdWF.js +42 -0
- package/dist/chunks/build-config-CUQVwdWF.js.map +1 -0
- package/dist/{collector-C7YBiY7D.js → chunks/collector-B0LTHw6Z.js} +6 -125
- package/dist/chunks/collector-B0LTHw6Z.js.map +1 -0
- package/dist/chunks/config-engine-C3pF9EK9.js +267 -0
- package/dist/chunks/config-engine-C3pF9EK9.js.map +1 -0
- package/dist/chunks/css-definitions-D_it4XZH.js +875 -0
- package/dist/chunks/css-definitions-D_it4XZH.js.map +1 -0
- package/dist/{css-resources-Cyl_axbI.js → chunks/css-resources-BN8apgxt.js} +1 -8
- package/dist/chunks/css-resources-BN8apgxt.js.map +1 -0
- package/dist/chunks/debug-C9LeNVoJ.js +501 -0
- package/dist/chunks/debug-C9LeNVoJ.js.map +1 -0
- package/dist/chunks/dsl-C5yuAn41.js +1373 -0
- package/dist/chunks/dsl-C5yuAn41.js.map +1 -0
- package/dist/chunks/hydration-TRcz5vnk.js +41 -0
- package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
- package/dist/chunks/react-runtime-O-OUrKLH.js +557 -0
- package/dist/chunks/react-runtime-O-OUrKLH.js.map +1 -0
- package/dist/chunks/runtime-engine-DvnE2g-E.js +2437 -0
- package/dist/chunks/runtime-engine-DvnE2g-E.js.map +1 -0
- package/dist/chunks/runtime-state-BTDqSYBk.js +127 -0
- package/dist/chunks/runtime-state-BTDqSYBk.js.map +1 -0
- package/dist/{merge-styles-ChW1k-ZM.js → chunks/shared-utils-DWA4LjIa.js} +55 -54
- package/dist/chunks/shared-utils-DWA4LjIa.js.map +1 -0
- package/dist/chunks/style-engine-C1ECBZxR.js +5131 -0
- package/dist/chunks/style-engine-C1ECBZxR.js.map +1 -0
- package/dist/{css-writer-BiumPvq-.js → chunks/zero-engine-B6EnYcXY.js} +3 -120
- package/dist/chunks/zero-engine-B6EnYcXY.js.map +1 -0
- package/dist/{collector-CUtAFyIb.d.ts → collector-hl5KNH7k.d.ts} +6 -4
- package/dist/{config-BY1e5y7V.d.ts → config-DWL1ZYue.d.ts} +20 -25
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +9 -6
- package/dist/{index-uX74k5jG.d.ts → index-D9N9GV24.d.ts} +17 -50
- package/dist/index.d.ts +5 -5
- package/dist/index.js +11 -922
- package/dist/{merge-styles-pf6iPs82.d.ts → merge-styles-C_oMoJVd.d.ts} +2 -2
- package/dist/ssr/astro-client.js +1 -14
- package/dist/ssr/astro-client.js.map +1 -1
- package/dist/ssr/astro-middleware-extract-static.js +1 -1
- package/dist/ssr/astro-middleware-extract.js +1 -1
- package/dist/ssr/astro-middleware-static.js +1 -12
- package/dist/ssr/astro-middleware-static.js.map +1 -1
- package/dist/ssr/astro-middleware.js +1 -13
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.js +219 -1
- package/dist/ssr/astro.js.map +1 -0
- package/dist/ssr/index.d.ts +6 -6
- package/dist/ssr/index.js +4 -4
- package/dist/ssr/next-config.d.ts +1 -1
- package/dist/ssr/next-config.js +29 -20
- package/dist/ssr/next-config.js.map +1 -1
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +5 -37
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +2 -2
- package/dist/static/index.js +1 -19
- package/dist/static/index.js.map +1 -1
- package/dist/{index-DBjd4MAb.d.ts → types-jKZNpias.d.ts} +800 -800
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +25 -96
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +1 -1
- package/dist/zero/index.js +1 -1
- package/dist/zero/next.d.ts +1 -1
- package/dist/zero/next.js +0 -31
- package/dist/zero/next.js.map +1 -1
- package/docs/debug.md +2 -5
- package/docs/pipeline.md +3 -0
- package/docs/runtime-benchmarks.md +105 -68
- package/docs/ssr.md +1 -1
- package/package.json +49 -6
- package/dist/astro-w8r-u4qo.js +0 -301
- package/dist/astro-w8r-u4qo.js.map +0 -1
- package/dist/async-storage-DKK-wTD4.js +0 -44
- package/dist/async-storage-DKK-wTD4.js.map +0 -1
- package/dist/collector-C7YBiY7D.js.map +0 -1
- package/dist/config-yXpe2jAV.js +0 -12668
- package/dist/config-yXpe2jAV.js.map +0 -1
- package/dist/context-CA8YKeMn.js +0 -24
- package/dist/context-CA8YKeMn.js.map +0 -1
- package/dist/core-DoEZAHJq.js +0 -1732
- package/dist/core-DoEZAHJq.js.map +0 -1
- package/dist/css-resources-Cyl_axbI.js.map +0 -1
- package/dist/css-writer-BiumPvq-.js.map +0 -1
- package/dist/format-global-rules-DklyaXv-.js +0 -22
- package/dist/format-global-rules-DklyaXv-.js.map +0 -1
- package/dist/format-rules-DHuG25KU.js +0 -104
- package/dist/format-rules-DHuG25KU.js.map +0 -1
- package/dist/hydrate-BvRP6QEC.js +0 -37
- package/dist/hydrate-BvRP6QEC.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/keyframes-B8uPLZwx.js +0 -535
- package/dist/keyframes-B8uPLZwx.js.map +0 -1
- package/dist/merge-styles-ChW1k-ZM.js.map +0 -1
- package/dist/resolve-recipes-BNmjANzT.js +0 -144
- package/dist/resolve-recipes-BNmjANzT.js.map +0 -1
- package/dist/ssr-collector-ref-COs_ioWl.js +0 -29
- package/dist/ssr-collector-ref-COs_ioWl.js.map +0 -1
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { I as isSelector, Qt as isDevEnv, u as getGlobalRecipes } from "./config-yXpe2jAV.js";
|
|
2
|
-
import { t as mergeStyles } from "./merge-styles-ChW1k-ZM.js";
|
|
3
|
-
//#region src/utils/resolve-recipes.ts
|
|
4
|
-
/**
|
|
5
|
-
* Recipe resolution utility.
|
|
6
|
-
*
|
|
7
|
-
* Resolves `recipe` style properties by looking up predefined recipe styles
|
|
8
|
-
* from global configuration and merging them with the component's own styles.
|
|
9
|
-
*
|
|
10
|
-
* Resolution order per level (top-level and each sub-element independently):
|
|
11
|
-
* base_recipe_1 base_recipe_2 → component styles → post_recipe_1 post_recipe_2
|
|
12
|
-
*
|
|
13
|
-
* The `/` separator splits base recipes (before component styles)
|
|
14
|
-
* from post recipes (after component styles). All merges use mergeStyles
|
|
15
|
-
* semantics: primitives and state maps with '' key fully replace;
|
|
16
|
-
* state maps without '' key extend the existing value.
|
|
17
|
-
*
|
|
18
|
-
* Returns the same object reference if no recipes are present (zero overhead).
|
|
19
|
-
*/
|
|
20
|
-
const devMode = isDevEnv();
|
|
21
|
-
/**
|
|
22
|
-
* Parse a recipe string into base and post recipe name groups.
|
|
23
|
-
*
|
|
24
|
-
* Syntax: `'base1 base2 / post1 post2'`
|
|
25
|
-
* - Names are space-separated within each group
|
|
26
|
-
* - `/` separates base (before component) from post (after component) groups
|
|
27
|
-
* - `/` is optional; if absent, all names are base
|
|
28
|
-
* - `none` as the sole base value means "no base recipes"
|
|
29
|
-
*
|
|
30
|
-
* Returns `{ base: null, post: null }` if the string is empty or invalid.
|
|
31
|
-
*/
|
|
32
|
-
function parseRecipeNames(value) {
|
|
33
|
-
const empty = {
|
|
34
|
-
base: null,
|
|
35
|
-
post: null
|
|
36
|
-
};
|
|
37
|
-
if (typeof value !== "string") return empty;
|
|
38
|
-
const trimmed = value.trim();
|
|
39
|
-
if (trimmed === "") return empty;
|
|
40
|
-
const slashIndex = trimmed.indexOf("/");
|
|
41
|
-
if (slashIndex === -1) {
|
|
42
|
-
if (trimmed === "none") return empty;
|
|
43
|
-
return {
|
|
44
|
-
base: splitNames(trimmed),
|
|
45
|
-
post: null
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
const basePart = trimmed.slice(0, slashIndex);
|
|
49
|
-
const postPart = trimmed.slice(slashIndex + 1);
|
|
50
|
-
return {
|
|
51
|
-
base: basePart.trim() === "none" ? null : splitNames(basePart),
|
|
52
|
-
post: splitNames(postPart)
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function splitNames(s) {
|
|
56
|
-
const names = s.split(/\s+/).filter(Boolean);
|
|
57
|
-
return names.length > 0 ? names : null;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Collect merged styles for a list of recipe names.
|
|
61
|
-
* Each recipe is flat-spread on top of the previous.
|
|
62
|
-
*/
|
|
63
|
-
function collectRecipeStyles(names, recipes) {
|
|
64
|
-
let merged = {};
|
|
65
|
-
for (const name of names) {
|
|
66
|
-
const recipeStyles = recipes[name];
|
|
67
|
-
if (!recipeStyles) {
|
|
68
|
-
if (devMode) console.warn(`[Tasty] Recipe "${name}" not found. Make sure it is defined in configure({ recipes: { ... } }).`);
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
merged = {
|
|
72
|
-
...merged,
|
|
73
|
-
...recipeStyles
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
return merged;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Resolve recipe references in a flat styles object (no sub-elements).
|
|
80
|
-
* Returns null if no `recipe` key is present.
|
|
81
|
-
*
|
|
82
|
-
* Resolution: base recipes → component styles → post recipes (all via mergeStyles)
|
|
83
|
-
*/
|
|
84
|
-
function resolveRecipesForLevel(styles, recipes) {
|
|
85
|
-
if (!("recipe" in styles)) return null;
|
|
86
|
-
const { base, post } = parseRecipeNames(styles.recipe);
|
|
87
|
-
const { recipe: _recipe, ...allRest } = styles;
|
|
88
|
-
const flatStyles = {};
|
|
89
|
-
const selectorStyles = {};
|
|
90
|
-
for (const key of Object.keys(allRest)) if (isSelector(key)) selectorStyles[key] = allRest[key];
|
|
91
|
-
else flatStyles[key] = allRest[key];
|
|
92
|
-
if (!base && !post) return allRest;
|
|
93
|
-
let result;
|
|
94
|
-
if (base) result = mergeStyles(collectRecipeStyles(base, recipes), flatStyles);
|
|
95
|
-
else result = { ...flatStyles };
|
|
96
|
-
if (post) {
|
|
97
|
-
const postStyles = collectRecipeStyles(post, recipes);
|
|
98
|
-
result = mergeStyles(result, postStyles);
|
|
99
|
-
}
|
|
100
|
-
for (const key of Object.keys(selectorStyles)) result[key] = selectorStyles[key];
|
|
101
|
-
return result;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Resolve all `recipe` style properties in a styles object.
|
|
105
|
-
*
|
|
106
|
-
* Handles both top-level and sub-element recipe references.
|
|
107
|
-
* Returns the same object reference if no recipes are present anywhere
|
|
108
|
-
* (zero overhead for the common case).
|
|
109
|
-
*
|
|
110
|
-
* @param styles - The styles object potentially containing `recipe` keys
|
|
111
|
-
* @returns Resolved styles with recipe values merged in, or the original object if unchanged
|
|
112
|
-
*/
|
|
113
|
-
function resolveRecipes(styles) {
|
|
114
|
-
const recipes = getGlobalRecipes();
|
|
115
|
-
if (!recipes) return styles;
|
|
116
|
-
let changed = false;
|
|
117
|
-
const topResolved = resolveRecipesForLevel(styles, recipes);
|
|
118
|
-
let result;
|
|
119
|
-
if (topResolved) {
|
|
120
|
-
changed = true;
|
|
121
|
-
result = topResolved;
|
|
122
|
-
} else result = styles;
|
|
123
|
-
const keys = Object.keys(result);
|
|
124
|
-
for (const key of keys) {
|
|
125
|
-
if (!isSelector(key)) continue;
|
|
126
|
-
const subStyles = result[key];
|
|
127
|
-
if (!subStyles || typeof subStyles !== "object" || Array.isArray(subStyles)) continue;
|
|
128
|
-
const subRecord = subStyles;
|
|
129
|
-
if (!("recipe" in subRecord)) continue;
|
|
130
|
-
const subResolved = resolveRecipesForLevel(subRecord, recipes);
|
|
131
|
-
if (subResolved) {
|
|
132
|
-
if (!changed) {
|
|
133
|
-
changed = true;
|
|
134
|
-
result = { ...styles };
|
|
135
|
-
}
|
|
136
|
-
result[key] = subResolved;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return changed ? result : styles;
|
|
140
|
-
}
|
|
141
|
-
//#endregion
|
|
142
|
-
export { resolveRecipes as t };
|
|
143
|
-
|
|
144
|
-
//# sourceMappingURL=resolve-recipes-BNmjANzT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-recipes-BNmjANzT.js","names":[],"sources":["../src/utils/resolve-recipes.ts"],"sourcesContent":["/**\n * Recipe resolution utility.\n *\n * Resolves `recipe` style properties by looking up predefined recipe styles\n * from global configuration and merging them with the component's own styles.\n *\n * Resolution order per level (top-level and each sub-element independently):\n * base_recipe_1 base_recipe_2 → component styles → post_recipe_1 post_recipe_2\n *\n * The `/` separator splits base recipes (before component styles)\n * from post recipes (after component styles). All merges use mergeStyles\n * semantics: primitives and state maps with '' key fully replace;\n * state maps without '' key extend the existing value.\n *\n * Returns the same object reference if no recipes are present (zero overhead).\n */\n\nimport { getGlobalRecipes } from '../config';\nimport { isSelector } from '../pipeline';\nimport type { RecipeStyles, Styles } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\nimport { mergeStyles } from './merge-styles';\n\nconst devMode = isDevEnv();\n\ninterface ParsedRecipeGroups {\n base: string[] | null;\n post: string[] | null;\n}\n\n/**\n * Parse a recipe string into base and post recipe name groups.\n *\n * Syntax: `'base1 base2 / post1 post2'`\n * - Names are space-separated within each group\n * - `/` separates base (before component) from post (after component) groups\n * - `/` is optional; if absent, all names are base\n * - `none` as the sole base value means \"no base recipes\"\n *\n * Returns `{ base: null, post: null }` if the string is empty or invalid.\n */\nfunction parseRecipeNames(value: unknown): ParsedRecipeGroups {\n const empty: ParsedRecipeGroups = { base: null, post: null };\n\n if (typeof value !== 'string') return empty;\n const trimmed = value.trim();\n if (trimmed === '') return empty;\n\n const slashIndex = trimmed.indexOf('/');\n\n if (slashIndex === -1) {\n if (trimmed === 'none') return empty;\n const names = splitNames(trimmed);\n return { base: names, post: null };\n }\n\n const basePart = trimmed.slice(0, slashIndex);\n const postPart = trimmed.slice(slashIndex + 1);\n\n return {\n base: basePart.trim() === 'none' ? null : splitNames(basePart),\n post: splitNames(postPart),\n };\n}\n\nfunction splitNames(s: string): string[] | null {\n const names = s.split(/\\s+/).filter(Boolean);\n return names.length > 0 ? names : null;\n}\n\n/**\n * Collect merged styles for a list of recipe names.\n * Each recipe is flat-spread on top of the previous.\n */\nfunction collectRecipeStyles(\n names: string[],\n recipes: Record<string, RecipeStyles>,\n): Record<string, unknown> {\n let merged: Record<string, unknown> = {};\n\n for (const name of names) {\n const recipeStyles = recipes[name];\n\n if (!recipeStyles) {\n if (devMode) {\n console.warn(\n `[Tasty] Recipe \"${name}\" not found. ` +\n `Make sure it is defined in configure({ recipes: { ... } }).`,\n );\n }\n continue;\n }\n\n merged = { ...merged, ...(recipeStyles as Record<string, unknown>) };\n }\n\n return merged;\n}\n\n/**\n * Resolve recipe references in a flat styles object (no sub-elements).\n * Returns null if no `recipe` key is present.\n *\n * Resolution: base recipes → component styles → post recipes (all via mergeStyles)\n */\nfunction resolveRecipesForLevel(\n styles: Record<string, unknown>,\n recipes: Record<string, RecipeStyles>,\n): Record<string, unknown> | null {\n if (!('recipe' in styles)) return null;\n\n const { base, post } = parseRecipeNames(styles.recipe);\n\n // Separate selector keys (sub-elements) from flat style properties.\n // mergeStyles handles selectors with its own semantics (e.g. false = delete),\n // but at this level we only want recipe merging on flat properties.\n\n const { recipe: _recipe, ...allRest } = styles;\n const flatStyles: Record<string, unknown> = {};\n const selectorStyles: Record<string, unknown> = {};\n\n for (const key of Object.keys(allRest)) {\n if (isSelector(key)) {\n selectorStyles[key] = allRest[key];\n } else {\n flatStyles[key] = allRest[key];\n }\n }\n\n if (!base && !post) {\n return allRest;\n }\n\n // 1. Merge base recipes, then component styles on top (via mergeStyles)\n let result: Record<string, unknown>;\n\n if (base) {\n const baseStyles = collectRecipeStyles(base, recipes);\n result = mergeStyles(baseStyles as Styles, flatStyles as Styles) as Record<\n string,\n unknown\n >;\n } else {\n result = { ...flatStyles };\n }\n\n // 2. Apply post recipes via mergeStyles (state map extend semantics)\n if (post) {\n const postStyles = collectRecipeStyles(post, recipes);\n result = mergeStyles(result as Styles, postStyles as Styles) as Record<\n string,\n unknown\n >;\n }\n\n // Re-attach selector keys unchanged\n for (const key of Object.keys(selectorStyles)) {\n result[key] = selectorStyles[key];\n }\n\n return result;\n}\n\n/**\n * Resolve all `recipe` style properties in a styles object.\n *\n * Handles both top-level and sub-element recipe references.\n * Returns the same object reference if no recipes are present anywhere\n * (zero overhead for the common case).\n *\n * @param styles - The styles object potentially containing `recipe` keys\n * @returns Resolved styles with recipe values merged in, or the original object if unchanged\n */\nexport function resolveRecipes(styles: Styles): Styles {\n const recipes = getGlobalRecipes();\n\n // Fast path: no recipes configured globally\n if (!recipes) return styles;\n\n let changed = false;\n\n // Resolve top-level recipe\n const topResolved = resolveRecipesForLevel(\n styles as Record<string, unknown>,\n recipes,\n );\n\n let result: Record<string, unknown>;\n\n if (topResolved) {\n changed = true;\n result = topResolved;\n } else {\n // Keep reference; a shallow copy is deferred until a sub-element actually changes\n result = styles as Record<string, unknown>;\n }\n\n // Resolve sub-element recipes\n const keys = Object.keys(result);\n\n for (const key of keys) {\n if (!isSelector(key)) continue;\n\n const subStyles = result[key];\n\n if (\n !subStyles ||\n typeof subStyles !== 'object' ||\n Array.isArray(subStyles)\n ) {\n continue;\n }\n\n const subRecord = subStyles as Record<string, unknown>;\n\n if (!('recipe' in subRecord)) continue;\n\n const subResolved = resolveRecipesForLevel(subRecord, recipes);\n\n if (subResolved) {\n if (!changed) {\n // First change in sub-elements -- need to shallow-copy the top level\n changed = true;\n result = { ...(styles as Record<string, unknown>) };\n }\n result[key] = subResolved;\n }\n }\n\n return changed ? (result as Styles) : styles;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBA,MAAM,UAAU,SAAS;;;;;;;;;;;;AAkBzB,SAAS,iBAAiB,OAAoC;CAC5D,MAAM,QAA4B;EAAE,MAAM;EAAM,MAAM;CAAK;CAE3D,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,MAAM,UAAU,MAAM,KAAK;CAC3B,IAAI,YAAY,IAAI,OAAO;CAE3B,MAAM,aAAa,QAAQ,QAAQ,GAAG;CAEtC,IAAI,eAAe,IAAI;EACrB,IAAI,YAAY,QAAQ,OAAO;EAE/B,OAAO;GAAE,MADK,WAAW,OACN;GAAG,MAAM;EAAK;CACnC;CAEA,MAAM,WAAW,QAAQ,MAAM,GAAG,UAAU;CAC5C,MAAM,WAAW,QAAQ,MAAM,aAAa,CAAC;CAE7C,OAAO;EACL,MAAM,SAAS,KAAK,MAAM,SAAS,OAAO,WAAW,QAAQ;EAC7D,MAAM,WAAW,QAAQ;CAC3B;AACF;AAEA,SAAS,WAAW,GAA4B;CAC9C,MAAM,QAAQ,EAAE,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO;CAC3C,OAAO,MAAM,SAAS,IAAI,QAAQ;AACpC;;;;;AAMA,SAAS,oBACP,OACA,SACyB;CACzB,IAAI,SAAkC,CAAC;CAEvC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,eAAe,QAAQ;EAE7B,IAAI,CAAC,cAAc;GACjB,IAAI,SACF,QAAQ,KACN,mBAAmB,KAAK,yEAE1B;GAEF;EACF;EAEA,SAAS;GAAE,GAAG;GAAQ,GAAI;EAAyC;CACrE;CAEA,OAAO;AACT;;;;;;;AAQA,SAAS,uBACP,QACA,SACgC;CAChC,IAAI,EAAE,YAAY,SAAS,OAAO;CAElC,MAAM,EAAE,MAAM,SAAS,iBAAiB,OAAO,MAAM;CAMrD,MAAM,EAAE,QAAQ,SAAS,GAAG,YAAY;CACxC,MAAM,aAAsC,CAAC;CAC7C,MAAM,iBAA0C,CAAC;CAEjD,KAAK,MAAM,OAAO,OAAO,KAAK,OAAO,GACnC,IAAI,WAAW,GAAG,GAChB,eAAe,OAAO,QAAQ;MAE9B,WAAW,OAAO,QAAQ;CAI9B,IAAI,CAAC,QAAQ,CAAC,MACZ,OAAO;CAIT,IAAI;CAEJ,IAAI,MAEF,SAAS,YADU,oBAAoB,MAAM,OACf,GAAa,UAAoB;MAK/D,SAAS,EAAE,GAAG,WAAW;CAI3B,IAAI,MAAM;EACR,MAAM,aAAa,oBAAoB,MAAM,OAAO;EACpD,SAAS,YAAY,QAAkB,UAAoB;CAI7D;CAGA,KAAK,MAAM,OAAO,OAAO,KAAK,cAAc,GAC1C,OAAO,OAAO,eAAe;CAG/B,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,eAAe,QAAwB;CACrD,MAAM,UAAU,iBAAiB;CAGjC,IAAI,CAAC,SAAS,OAAO;CAErB,IAAI,UAAU;CAGd,MAAM,cAAc,uBAClB,QACA,OACF;CAEA,IAAI;CAEJ,IAAI,aAAa;EACf,UAAU;EACV,SAAS;CACX,OAEE,SAAS;CAIX,MAAM,OAAO,OAAO,KAAK,MAAM;CAE/B,KAAK,MAAM,OAAO,MAAM;EACtB,IAAI,CAAC,WAAW,GAAG,GAAG;EAEtB,MAAM,YAAY,OAAO;EAEzB,IACE,CAAC,aACD,OAAO,cAAc,YACrB,MAAM,QAAQ,SAAS,GAEvB;EAGF,MAAM,YAAY;EAElB,IAAI,EAAE,YAAY,YAAY;EAE9B,MAAM,cAAc,uBAAuB,WAAW,OAAO;EAE7D,IAAI,aAAa;GACf,IAAI,CAAC,SAAS;IAEZ,UAAU;IACV,SAAS,EAAE,GAAI,OAAmC;GACpD;GACA,OAAO,OAAO;EAChB;CACF;CAEA,OAAO,UAAW,SAAoB;AACxC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region src/ssr/ssr-collector-ref.ts
|
|
2
|
-
const GETTER_KEY = "__tasty_ssr_collector_getter__";
|
|
3
|
-
let _getSSRCollector = null;
|
|
4
|
-
/**
|
|
5
|
-
* Register the collector getter in the current module graph only.
|
|
6
|
-
* Used by Next.js TastyRegistry.
|
|
7
|
-
*/
|
|
8
|
-
function registerSSRCollectorGetter(fn) {
|
|
9
|
-
_getSSRCollector = fn;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Register the collector getter on globalThis so it is visible across
|
|
13
|
-
* separate module graphs (e.g. Astro middleware ↔ page components).
|
|
14
|
-
*/
|
|
15
|
-
function registerSSRCollectorGetterGlobal(fn) {
|
|
16
|
-
globalThis[GETTER_KEY] = fn;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Retrieve the SSR collector: module-level first, globalThis fallback.
|
|
20
|
-
*/
|
|
21
|
-
function getRegisteredSSRCollector() {
|
|
22
|
-
if (_getSSRCollector) return _getSSRCollector();
|
|
23
|
-
const getter = globalThis[GETTER_KEY];
|
|
24
|
-
return getter ? getter() : null;
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { registerSSRCollectorGetter as n, registerSSRCollectorGetterGlobal as r, getRegisteredSSRCollector as t };
|
|
28
|
-
|
|
29
|
-
//# sourceMappingURL=ssr-collector-ref-COs_ioWl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-collector-ref-COs_ioWl.js","names":[],"sources":["../src/ssr/ssr-collector-ref.ts"],"sourcesContent":["/**\n * Global reference to the SSR collector getter function.\n *\n * This indirection avoids importing 'node:async_hooks' in the browser bundle.\n * The SSR entry point sets this ref when loaded on the server. The useStyles\n * hook calls it if set; on the client it stays null and is never called.\n *\n * Uses a module-level variable as the primary mechanism. In Next.js App\n * Router the RSC and SSR module graphs load separate copies of this module,\n * so the getter registered by TastyRegistry (SSR layer) is invisible to\n * server components (RSC layer) — which correctly fall through to inline\n * RSC styles.\n *\n * A globalThis fallback (`registerSSRCollectorGetterGlobal`) is provided\n * for frameworks like Astro where middleware and page components live in\n * different module graphs and must share the getter across them.\n */\n\nimport type { ServerStyleCollector } from './collector';\n\ntype SSRCollectorGetter = () => ServerStyleCollector | null;\n\nconst GETTER_KEY = '__tasty_ssr_collector_getter__';\n\nlet _getSSRCollector: SSRCollectorGetter | null = null;\n\n/**\n * Register the collector getter in the current module graph only.\n * Used by Next.js TastyRegistry.\n */\nexport function registerSSRCollectorGetter(fn: SSRCollectorGetter): void {\n _getSSRCollector = fn;\n}\n\n/**\n * Register the collector getter on globalThis so it is visible across\n * separate module graphs (e.g. Astro middleware ↔ page components).\n */\nexport function registerSSRCollectorGetterGlobal(fn: SSRCollectorGetter): void {\n (globalThis as Record<string, unknown>)[GETTER_KEY] = fn;\n}\n\n/**\n * Retrieve the SSR collector: module-level first, globalThis fallback.\n */\nexport function getRegisteredSSRCollector(): ServerStyleCollector | null {\n if (_getSSRCollector) return _getSSRCollector();\n const getter = (globalThis as Record<string, unknown>)[GETTER_KEY] as\n SSRCollectorGetter | undefined;\n return getter ? getter() : null;\n}\n"],"mappings":";AAsBA,MAAM,aAAa;AAEnB,IAAI,mBAA8C;;;;;AAMlD,SAAgB,2BAA2B,IAA8B;CACvE,mBAAmB;AACrB;;;;;AAMA,SAAgB,iCAAiC,IAA8B;CAC7E,WAAwC,cAAc;AACxD;;;;AAKA,SAAgB,4BAAyD;CACvE,IAAI,kBAAkB,OAAO,iBAAiB;CAC9C,MAAM,SAAU,WAAuC;CAEvD,OAAO,SAAS,OAAO,IAAI;AAC7B"}
|