@tenphi/tasty 3.2.0 → 3.3.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/dist/{babel-D8dm92E_.d.ts → babel-BUQGeOXA.d.ts} +2 -2
- package/dist/{collector-Di3C8btw.js → collector-BKqNBmzA.js} +3 -3
- package/dist/{collector-Di3C8btw.js.map → collector-BKqNBmzA.js.map} +1 -1
- package/dist/{collector-BFuqdF2F.d.ts → collector-DUaHCcTS.d.ts} +2 -2
- package/dist/{config-BrDt11hO.js → config-BCdCTIED.js} +263 -863
- package/dist/config-BCdCTIED.js.map +1 -0
- package/dist/{config-DH7I0Ggx.d.ts → config-YsxGv4tq.d.ts} +30 -10
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +5 -5
- package/dist/{core-YWn1zgh4.js → core-wxP3GHQu.js} +57 -41
- package/dist/core-wxP3GHQu.js.map +1 -0
- package/dist/{css-writer-CQYbT4g_.js → css-writer-D64NY9AX.js} +3 -3
- package/dist/{css-writer-CQYbT4g_.js.map → css-writer-D64NY9AX.js.map} +1 -1
- package/dist/{format-rules-DdmLdntR.js → format-rules-Bo_e2u7r.js} +5 -20
- package/dist/format-rules-Bo_e2u7r.js.map +1 -0
- package/dist/{hydrate-D2ivfS-B.js → hydrate-CMKOuKAx.js} +2 -2
- package/dist/{hydrate-D2ivfS-B.js.map → hydrate-CMKOuKAx.js.map} +1 -1
- package/dist/{index-LC3O3Jj4.d.ts → index-Cd45t5NM.d.ts} +7 -2
- package/dist/{index-DljBkZhV.d.ts → index-DhhUI0yi.d.ts} +8 -10
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/{keyframes-CoLLjBcd.js → keyframes-D737PShJ.js} +2 -2
- package/dist/{keyframes-CoLLjBcd.js.map → keyframes-D737PShJ.js.map} +1 -1
- package/dist/{merge-styles-Cx_6ySBv.d.ts → merge-styles-CU7JbEwg.d.ts} +2 -2
- package/dist/{merge-styles-bdh7-1uh.js → merge-styles-CUIQcs5v.js} +2 -2
- package/dist/{merge-styles-bdh7-1uh.js.map → merge-styles-CUIQcs5v.js.map} +1 -1
- package/dist/{resolve-recipes-9JYSgubn.js → resolve-recipes-Df1Ta-Q0.js} +3 -3
- package/dist/{resolve-recipes-9JYSgubn.js.map → resolve-recipes-Df1Ta-Q0.js.map} +1 -1
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro.js +3 -3
- package/dist/ssr/index.d.ts +1 -1
- package/dist/ssr/index.js +3 -3
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +4 -4
- package/dist/static/index.d.ts +2 -2
- package/dist/static/index.js +1 -1
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +4 -4
- package/dist/zero/index.d.ts +1 -1
- package/dist/zero/index.js +1 -1
- package/dist/zero/next.d.ts +1 -1
- package/docs/configuration.md +68 -15
- package/docs/dsl.md +40 -5
- package/docs/methodology.md +1 -1
- package/docs/pipeline.md +1 -4
- package/docs/react-api.md +1 -1
- package/docs/styles.md +8 -1
- package/package.json +7 -6
- package/dist/config-BrDt11hO.js.map +0 -1
- package/dist/core-YWn1zgh4.js.map +0 -1
- package/dist/format-rules-DdmLdntR.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-styles-bdh7-1uh.js","names":[],"sources":["../src/utils/merge-styles.ts"],"sourcesContent":["import { isSelector } from '../pipeline';\nimport type { Styles, StylesWithoutSelectors } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\n\nconst devMode = isDevEnv();\n\nconst INHERIT_VALUE = '@inherit';\n\n/**\n * Check if a value is a state map (object, not array).\n */\nfunction isStateMap(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Normalize a parent value to a state map.\n * - Already a state map → return as-is\n * - Non-null, non-false primitive → wrap as `{ '': value }`\n * - null / undefined / false → return null (no parent to merge with)\n */\nfunction normalizeToStateMap(value: unknown): Record<string, unknown> | null {\n if (isStateMap(value)) return value as Record<string, unknown>;\n if (value != null && value !== false) return { '': value };\n return null;\n}\n\n/**\n * Resolve a child state map against a parent value.\n *\n * Mode is determined by whether the child contains a `''` (default) key:\n * - No `''` → extend mode: parent entries preserved, child adds/overrides/repositions\n * - Has `''` → replace mode: child defines everything, `@inherit` cherry-picks from parent\n *\n * In both modes:\n * - `@inherit` value → resolve from parent state map\n * - `null` value → remove this state from the result\n * - `false` value → tombstone, persists through all layers, blocks recipe\n */\nfunction resolveStateMap(\n parentValue: unknown,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const isExtend = !('' in childMap);\n const parentMap = normalizeToStateMap(parentValue);\n\n if (!parentMap) {\n // No parent to merge with — strip nulls and @inherit, return child entries\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === null || val === INHERIT_VALUE) continue;\n result[key] = val;\n }\n return result;\n }\n\n if (isExtend) {\n return resolveExtendMode(parentMap, childMap);\n }\n\n return resolveReplaceMode(parentMap, childMap);\n}\n\n/**\n * Extend mode: parent entries are preserved, child entries add/override/reposition.\n */\nfunction resolveExtendMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const inheritKeys = new Set<string>();\n const removeKeys = new Set<string>();\n const overrideKeys = new Map<string, unknown>();\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n inheritKeys.add(key);\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val === null) {\n removeKeys.add(key);\n } else if (key in parentMap) {\n overrideKeys.set(key, val);\n }\n }\n\n // 1. Parent entries in order (skip removed, skip repositioned, apply overrides)\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(parentMap)) {\n if (removeKeys.has(key)) continue;\n if (inheritKeys.has(key)) continue;\n if (overrideKeys.has(key)) {\n result[key] = overrideKeys.get(key);\n } else {\n result[key] = parentMap[key];\n }\n }\n\n // 2. Append new + repositioned entries in child declaration order\n for (const key of Object.keys(childMap)) {\n if (inheritKeys.has(key)) {\n result[key] = parentMap[key];\n } else if (\n !removeKeys.has(key) &&\n !overrideKeys.has(key) &&\n // Skip @inherit for keys that weren't in the parent (already warned above)\n childMap[key] !== INHERIT_VALUE\n ) {\n result[key] = childMap[key];\n }\n }\n\n return result;\n}\n\n/**\n * Replace mode: child entries define the result, `@inherit` pulls from parent.\n */\nfunction resolveReplaceMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n result[key] = parentMap[key];\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val !== null) {\n result[key] = val;\n }\n }\n\n return result;\n}\n\n/**\n * Merge sub-element properties with state map / null / undefined support.\n */\nfunction mergeSubElementStyles(\n parentSub: StylesWithoutSelectors | undefined,\n childSub: StylesWithoutSelectors,\n): StylesWithoutSelectors {\n const parent = parentSub as Record<string, unknown> | undefined;\n const child = childSub as Record<string, unknown>;\n const merged: Record<string, unknown> = { ...parent, ...child };\n\n for (const key of Object.keys(child)) {\n const val = child[key];\n\n if (val === undefined) {\n if (parent && key in parent) {\n merged[key] = parent[key];\n }\n } else if (val === null) {\n delete merged[key];\n } else if (isStateMap(val)) {\n merged[key] = resolveStateMap(\n parent ? parent[key] : undefined,\n val as Record<string, unknown>,\n );\n }\n }\n\n return merged as StylesWithoutSelectors;\n}\n\nexport function mergeStyles(...objects: (Styles | undefined | null)[]): Styles {\n let styles: Styles = objects[0] ? { ...objects[0] } : {};\n let pos = 1;\n\n while (pos in objects) {\n const selectorKeys = Object.keys(styles).filter(\n (key) => isSelector(key) && styles[key],\n );\n const newStyles = objects[pos];\n\n if (newStyles) {\n const resultStyles = { ...styles, ...newStyles };\n\n // Collect all selector keys from both parent and child\n const newSelectorKeys = Object.keys(newStyles).filter(isSelector);\n const allSelectorKeys = new Set([...selectorKeys, ...newSelectorKeys]);\n\n for (const key of allSelectorKeys) {\n const newValue = newStyles?.[key];\n\n if (newValue === false || newValue === null) {\n delete resultStyles[key];\n } else if (newValue === undefined) {\n resultStyles[key] = styles[key];\n } else if (newValue) {\n resultStyles[key] = mergeSubElementStyles(\n styles[key] as StylesWithoutSelectors,\n newValue as StylesWithoutSelectors,\n );\n }\n }\n\n // Handle non-selector properties: state maps, null, undefined\n for (const key of Object.keys(newStyles)) {\n if (isSelector(key)) continue;\n\n const newValue = newStyles[key];\n\n if (newValue === undefined) {\n if (key in styles) {\n resultStyles[key] = styles[key];\n } else {\n delete resultStyles[key];\n }\n } else if (newValue === null) {\n delete resultStyles[key];\n } else if (isStateMap(newValue)) {\n (resultStyles as Record<string, unknown>)[key] = resolveStateMap(\n styles[key],\n newValue as Record<string, unknown>,\n );\n }\n }\n\n styles = resultStyles;\n }\n\n pos++;\n }\n\n return styles;\n}\n"],"mappings":";;AAKA,MAAM,UAAU,SAAS;AAEzB,MAAM,gBAAgB;;;;AAKtB,SAAS,WAAW,OAAkD;CACpE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;;;;;;;AAQA,SAAS,oBAAoB,OAAgD;CAC3E,IAAI,WAAW,KAAK,GAAG,OAAO;CAC9B,IAAI,SAAS,QAAQ,UAAU,OAAO,OAAO,EAAE,IAAI,MAAM;CACzD,OAAO;AACT;;;;;;;;;;;;;AAcA,SAAS,gBACP,aACA,UACyB;CACzB,MAAM,WAAW,EAAE,MAAM;CACzB,MAAM,YAAY,oBAAoB,WAAW;CAEjD,IAAI,CAAC,WAAW;EAEd,MAAM,SAAkC,CAAC;EACzC,KAAK,MAAM,OAAO,OAAO,KAAK,QA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GA,KAAK,MAAM,OAAO,OAAO,KAAK,SAAS,GAAG;IACxC,IAAI,WAAW,GAAG,GAAG;IAErB,MAAM,WAAW,UAAU;IAE3B,IAAI,aAAa,KAAA,GACf,IAAI,OAAO,QACT,aAAa,OAAO,OAAO;SAE3B,OAAO,aAAa;SAEjB,IAAI,aAAa,MACtB,OAAO,aAAa;SACf,IAAI,WAAW,QAAQ,GAC5B,aAA0C,OAAO,gBAC/C,OAAO,MACP,QACF;GAEJ;GAEA,SAAS;EACX;EAEA;CACF;CAEA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"merge-styles-CUIQcs5v.js","names":[],"sources":["../src/utils/merge-styles.ts"],"sourcesContent":["import { isSelector } from '../pipeline';\nimport type { Styles, StylesWithoutSelectors } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\n\nconst devMode = isDevEnv();\n\nconst INHERIT_VALUE = '@inherit';\n\n/**\n * Check if a value is a state map (object, not array).\n */\nfunction isStateMap(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Normalize a parent value to a state map.\n * - Already a state map → return as-is\n * - Non-null, non-false primitive → wrap as `{ '': value }`\n * - null / undefined / false → return null (no parent to merge with)\n */\nfunction normalizeToStateMap(value: unknown): Record<string, unknown> | null {\n if (isStateMap(value)) return value as Record<string, unknown>;\n if (value != null && value !== false) return { '': value };\n return null;\n}\n\n/**\n * Resolve a child state map against a parent value.\n *\n * Mode is determined by whether the child contains a `''` (default) key:\n * - No `''` → extend mode: parent entries preserved, child adds/overrides/repositions\n * - Has `''` → replace mode: child defines everything, `@inherit` cherry-picks from parent\n *\n * In both modes:\n * - `@inherit` value → resolve from parent state map\n * - `null` value → remove this state from the result\n * - `false` value → tombstone, persists through all layers, blocks recipe\n */\nfunction resolveStateMap(\n parentValue: unknown,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const isExtend = !('' in childMap);\n const parentMap = normalizeToStateMap(parentValue);\n\n if (!parentMap) {\n // No parent to merge with — strip nulls and @inherit, return child entries\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === null || val === INHERIT_VALUE) continue;\n result[key] = val;\n }\n return result;\n }\n\n if (isExtend) {\n return resolveExtendMode(parentMap, childMap);\n }\n\n return resolveReplaceMode(parentMap, childMap);\n}\n\n/**\n * Extend mode: parent entries are preserved, child entries add/override/reposition.\n */\nfunction resolveExtendMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const inheritKeys = new Set<string>();\n const removeKeys = new Set<string>();\n const overrideKeys = new Map<string, unknown>();\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n inheritKeys.add(key);\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val === null) {\n removeKeys.add(key);\n } else if (key in parentMap) {\n overrideKeys.set(key, val);\n }\n }\n\n // 1. Parent entries in order (skip removed, skip repositioned, apply overrides)\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(parentMap)) {\n if (removeKeys.has(key)) continue;\n if (inheritKeys.has(key)) continue;\n if (overrideKeys.has(key)) {\n result[key] = overrideKeys.get(key);\n } else {\n result[key] = parentMap[key];\n }\n }\n\n // 2. Append new + repositioned entries in child declaration order\n for (const key of Object.keys(childMap)) {\n if (inheritKeys.has(key)) {\n result[key] = parentMap[key];\n } else if (\n !removeKeys.has(key) &&\n !overrideKeys.has(key) &&\n // Skip @inherit for keys that weren't in the parent (already warned above)\n childMap[key] !== INHERIT_VALUE\n ) {\n result[key] = childMap[key];\n }\n }\n\n return result;\n}\n\n/**\n * Replace mode: child entries define the result, `@inherit` pulls from parent.\n */\nfunction resolveReplaceMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n result[key] = parentMap[key];\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val !== null) {\n result[key] = val;\n }\n }\n\n return result;\n}\n\n/**\n * Merge sub-element properties with state map / null / undefined support.\n */\nfunction mergeSubElementStyles(\n parentSub: StylesWithoutSelectors | undefined,\n childSub: StylesWithoutSelectors,\n): StylesWithoutSelectors {\n const parent = parentSub as Record<string, unknown> | undefined;\n const child = childSub as Record<string, unknown>;\n const merged: Record<string, unknown> = { ...parent, ...child };\n\n for (const key of Object.keys(child)) {\n const val = child[key];\n\n if (val === undefined) {\n if (parent && key in parent) {\n merged[key] = parent[key];\n }\n } else if (val === null) {\n delete merged[key];\n } else if (isStateMap(val)) {\n merged[key] = resolveStateMap(\n parent ? parent[key] : undefined,\n val as Record<string, unknown>,\n );\n }\n }\n\n return merged as StylesWithoutSelectors;\n}\n\nexport function mergeStyles(...objects: (Styles | undefined | null)[]): Styles {\n let styles: Styles = objects[0] ? { ...objects[0] } : {};\n let pos = 1;\n\n while (pos in objects) {\n const selectorKeys = Object.keys(styles).filter(\n (key) => isSelector(key) && styles[key],\n );\n const newStyles = objects[pos];\n\n if (newStyles) {\n const resultStyles = { ...styles, ...newStyles };\n\n // Collect all selector keys from both parent and child\n const newSelectorKeys = Object.keys(newStyles).filter(isSelector);\n const allSelectorKeys = new Set([...selectorKeys, ...newSelectorKeys]);\n\n for (const key of allSelectorKeys) {\n const newValue = newStyles?.[key];\n\n if (newValue === false || newValue === null) {\n delete resultStyles[key];\n } else if (newValue === undefined) {\n resultStyles[key] = styles[key];\n } else if (newValue) {\n resultStyles[key] = mergeSubElementStyles(\n styles[key] as StylesWithoutSelectors,\n newValue as StylesWithoutSelectors,\n );\n }\n }\n\n // Handle non-selector properties: state maps, null, undefined\n for (const key of Object.keys(newStyles)) {\n if (isSelector(key)) continue;\n\n const newValue = newStyles[key];\n\n if (newValue === undefined) {\n if (key in styles) {\n resultStyles[key] = styles[key];\n } else {\n delete resultStyles[key];\n }\n } else if (newValue === null) {\n delete resultStyles[key];\n } else if (isStateMap(newValue)) {\n (resultStyles as Record<string, unknown>)[key] = resolveStateMap(\n styles[key],\n newValue as Record<string, unknown>,\n );\n }\n }\n\n styles = resultStyles;\n }\n\n pos++;\n }\n\n return styles;\n}\n"],"mappings":";;AAKA,MAAM,UAAU,SAAS;AAEzB,MAAM,gBAAgB;;;;AAKtB,SAAS,WAAW,OAAkD;CACpE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;;;;;;;AAQA,SAAS,oBAAoB,OAAgD;CAC3E,IAAI,WAAW,KAAK,GAAG,OAAO;CAC9B,IAAI,SAAS,QAAQ,UAAU,OAAO,OAAO,EAAE,IAAI,MAAM;CACzD,OAAO;AACT;;;;;;;;;;;;;AAcA,SAAS,gBACP,aACA,UACyB;CACzB,MAAM,WAAW,EAAE,MAAM;CACzB,MAAM,YAAY,oBAAoB,WAAW;CAEjD,IAAI,CAAC,WAAW;EAEd,MAAM,SAAkC,CAAC;EACzC,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GAAG;GACvC,MAAM,MAAM,SAAS;GACrB,IAAI,QAAQ,QAAQ,QAAQ,eAAe;GAC3C,OAAO,OAAO;EAChB;EACA,OAAO;CACT;CAEA,IAAI,UACF,OAAO,kBAAkB,WAAW,QAAQ;CAG9C,OAAO,mBAAmB,WAAW,QAAQ;AAC/C;;;;AAKA,SAAS,kBACP,WACA,UACyB;CACzB,MAAM,8BAAc,IAAI,IAAY;CACpC,MAAM,6BAAa,IAAI,IAAY;CACnC,MAAM,+BAAe,IAAI,IAAqB;CAE9C,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GAAG;EACvC,MAAM,MAAM,SAAS;EACrB,IAAI,QAAQ;OACN,OAAO,WACT,YAAY,IAAI,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elector, Qt as isDevEnv, u as getGlobalRecipes } from "./config-BCdCTIED.js";
|
|
2
|
+
import { t as mergeStyles } from "./merge-styles-CUIQcs5v.js";
|
|
3
3
|
//#region src/utils/resolve-recipes.ts
|
|
4
4
|
/**
|
|
5
5
|
* Recipe resolution utility.
|
|
@@ -141,4 +141,4 @@ function resolveRecipes(styles) {
|
|
|
141
141
|
//#endregion
|
|
142
142
|
export { resolveRecipes as t };
|
|
143
143
|
|
|
144
|
-
//# sourceMappingURL=resolve-recipes-
|
|
144
|
+
//# sourceMappingURL=resolve-recipes-Df1Ta-Q0.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-recipes-
|
|
1
|
+
{"version":3,"file":"resolve-recipes-Df1Ta-Q0.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,MA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ANGED
package/dist/ssr/astro.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as getConfig } from "../config-
|
|
2
|
-
import { a as registerSSRCollectorGetterGlobal } from "../format-rules-
|
|
3
|
-
import { t as ServerStyleCollector } from "../collector-
|
|
1
|
+
import { n as getConfig } from "../config-BCdCTIED.js";
|
|
2
|
+
import { a as registerSSRCollectorGetterGlobal } from "../format-rules-Bo_e2u7r.js";
|
|
3
|
+
import { t as ServerStyleCollector } from "../collector-BKqNBmzA.js";
|
|
4
4
|
import { n as runWithCollector, t as getSSRCollector } from "../async-storage-DKK-wTD4.js";
|
|
5
5
|
//#region src/ssr/astro.ts
|
|
6
6
|
/**
|
package/dist/ssr/index.d.ts
CHANGED
package/dist/ssr/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as registerSSRCollectorGetterGlobal } from "../format-rules-
|
|
2
|
-
import { n as createServerStyleCollector, t as ServerStyleCollector } from "../collector-
|
|
1
|
+
import { a as registerSSRCollectorGetterGlobal } from "../format-rules-Bo_e2u7r.js";
|
|
2
|
+
import { n as createServerStyleCollector, t as ServerStyleCollector } from "../collector-BKqNBmzA.js";
|
|
3
3
|
import { n as runWithCollector, t as getSSRCollector } from "../async-storage-DKK-wTD4.js";
|
|
4
|
-
import { t as hydrateTastyClasses } from "../hydrate-
|
|
4
|
+
import { t as hydrateTastyClasses } from "../hydrate-CMKOuKAx.js";
|
|
5
5
|
//#region src/ssr/index.ts
|
|
6
6
|
registerSSRCollectorGetterGlobal(getSSRCollector);
|
|
7
7
|
//#endregion
|
package/dist/ssr/next.d.ts
CHANGED
package/dist/ssr/next.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { n as getConfig } from "../config-
|
|
3
|
-
import { i as registerSSRCollectorGetter } from "../format-rules-
|
|
2
|
+
import { n as getConfig } from "../config-BCdCTIED.js";
|
|
3
|
+
import { i as registerSSRCollectorGetter } from "../format-rules-Bo_e2u7r.js";
|
|
4
4
|
import { t as getTastySSRContext } from "../context-CA8YKeMn.js";
|
|
5
|
-
import { t as ServerStyleCollector } from "../collector-
|
|
6
|
-
import { t as hydrateTastyClasses } from "../hydrate-
|
|
5
|
+
import { t as ServerStyleCollector } from "../collector-BKqNBmzA.js";
|
|
6
|
+
import { t as hydrateTastyClasses } from "../hydrate-CMKOuKAx.js";
|
|
7
7
|
import { Fragment, createElement, useState } from "react";
|
|
8
8
|
import { useServerInsertedHTML } from "next/navigation";
|
|
9
9
|
//#region src/ssr/next.ts
|
package/dist/static/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as Styles } from "../index-
|
|
2
|
-
import { t as mergeStyles } from "../merge-styles-
|
|
1
|
+
import { b as Styles } from "../index-Cd45t5NM.js";
|
|
2
|
+
import { t as mergeStyles } from "../merge-styles-CU7JbEwg.js";
|
|
3
3
|
|
|
4
4
|
//#region src/static/types.d.ts
|
|
5
5
|
/**
|
package/dist/static/index.js
CHANGED
package/dist/zero/babel.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as _default, r as TastyZeroConfig, t as TastyZeroBabelOptions } from "../babel-
|
|
1
|
+
import { n as _default, r as TastyZeroConfig, t as TastyZeroBabelOptions } from "../babel-BUQGeOXA.js";
|
|
2
2
|
export { TastyZeroBabelOptions, type TastyZeroConfig, _default as default };
|
package/dist/zero/babel.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as resetConfig, d as getGlobalStyles, i as getGlobalConfigTokens, s as getGlobalFunctions, t as configure } from "../config-
|
|
2
|
-
import { t as mergeStyles } from "../merge-styles-
|
|
3
|
-
import { t as resolveRecipes } from "../resolve-recipes-
|
|
4
|
-
import { a as extractFunctionsFromStyles, c as extractStylesForSelector, i as extractFontFaceFromStyles, l as extractStylesWithChunks, o as extractKeyframesFromStyles, r as extractCounterStyleFromStyles, s as extractPropertiesFromStyles, t as CSSWriter, u as setExtractorNamePrefix } from "../css-writer-
|
|
1
|
+
import { b as resetConfig, d as getGlobalStyles, i as getGlobalConfigTokens, s as getGlobalFunctions, t as configure } from "../config-BCdCTIED.js";
|
|
2
|
+
import { t as mergeStyles } from "../merge-styles-CUIQcs5v.js";
|
|
3
|
+
import { t as resolveRecipes } from "../resolve-recipes-Df1Ta-Q0.js";
|
|
4
|
+
import { a as extractFunctionsFromStyles, c as extractStylesForSelector, i as extractFontFaceFromStyles, l as extractStylesWithChunks, o as extractKeyframesFromStyles, r as extractCounterStyleFromStyles, s as extractPropertiesFromStyles, t as CSSWriter, u as setExtractorNamePrefix } from "../css-writer-D64NY9AX.js";
|
|
5
5
|
import * as fs from "fs";
|
|
6
6
|
import * as path from "path";
|
|
7
7
|
import { declare } from "@babel/helper-plugin-utils";
|
package/dist/zero/index.d.ts
CHANGED
package/dist/zero/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as extractStylesForSelector, l as extractStylesWithChunks, n as createCSSWriter, t as CSSWriter } from "../css-writer-
|
|
1
|
+
import { c as extractStylesForSelector, l as extractStylesWithChunks, n as createCSSWriter, t as CSSWriter } from "../css-writer-D64NY9AX.js";
|
|
2
2
|
export { CSSWriter, createCSSWriter, extractStylesForSelector, extractStylesWithChunks };
|
package/dist/zero/next.d.ts
CHANGED
package/docs/configuration.md
CHANGED
|
@@ -72,7 +72,7 @@ These docs use `data-schema="dark"` in examples. If your app already standardize
|
|
|
72
72
|
| `plugins` | `TastyPlugin[]` | - | Plugins that bundle any of the above (processed in order; later override earlier, and direct config wins over all). See [Plugins](plugins.md) |
|
|
73
73
|
| `gc` | `GCConfig` | - | Garbage-collection tuning for unused styles (`{ touchInterval, capacity }`) |
|
|
74
74
|
| `batchInjection` | `boolean \| 'always'` | `false` | Defer stylesheet writes and apply them in one batch. See [Batched injection](#batched-injection) |
|
|
75
|
-
| `colorSpace` | `'rgb' \| 'hsl' \| 'oklch'` |
|
|
75
|
+
| `colorSpace` | `'rgb' \| 'hsl' \| 'oklch'` | - | **Deprecated** — no longer has any effect. See [Color space](#color-space) |
|
|
76
76
|
| `namePrefix` | `string` | `'t'` (runtime) / `'ts'` (zero-runtime) | Prefix prepended to every generated identifier (class, keyframe, counter-style names). Must match `^[a-zA-Z_][a-zA-Z0-9_-]{0,31}$`. See [Name prefix](#name-prefix). |
|
|
77
77
|
|
|
78
78
|
---
|
|
@@ -205,25 +205,78 @@ useLayoutEffect(() => {
|
|
|
205
205
|
|
|
206
206
|
## Color Space
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
> **Deprecated.** `configure({ colorSpace })` no longer has any effect and will
|
|
209
|
+
> be removed in the next major. Setting it warns in development.
|
|
210
|
+
|
|
211
|
+
A `#name` token's value used to be rewritten into a configured color space, so
|
|
212
|
+
`#brand: '#ff8800'` declared `--brand-color: oklch(0.75 0.16 55)`. That existed
|
|
213
|
+
to serve the opacity suffix, which needed numeric channels to write an alpha
|
|
214
|
+
into. Opacity now uses CSS relative color syntax —
|
|
215
|
+
`oklch(from var(--brand-color) l c h / .5)` — which has the browser read the
|
|
216
|
+
channels, so there is nothing left for the setting to decide.
|
|
217
|
+
|
|
218
|
+
A color is emitted exactly as authored:
|
|
209
219
|
|
|
210
220
|
```jsx
|
|
211
|
-
configure({
|
|
212
|
-
|
|
213
|
-
});
|
|
221
|
+
configure({ tokens: { '#brand': '#ff8800' } });
|
|
222
|
+
// → --brand-color: #ff8800
|
|
214
223
|
```
|
|
215
224
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
225
|
+
That holds for every form: a hex literal, a native color function, a bare CSS
|
|
226
|
+
color name, a `color-mix()`, a `light-dark()`, a fallback chain. A `#token`
|
|
227
|
+
reference still resolves to its `var()` chain, and a plugin color function such
|
|
228
|
+
as `okhsl()` is still resolved by the parser to the color it denotes.
|
|
229
|
+
|
|
230
|
+
To address a token's channels, use relative color syntax against the token:
|
|
231
|
+
|
|
232
|
+
```css
|
|
233
|
+
background: oklch(from var(--brand-color) calc(l * 1.2) c h);
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
This works on any `<color>`, including the ones no build-time conversion could
|
|
237
|
+
have evaluated — and it is what the [opacity suffix](dsl.md#color-tokens--opacity)
|
|
238
|
+
itself uses. Its space is always `oklch`, which is unbounded, so a wide-gamut
|
|
239
|
+
color survives a round trip a narrower space would clamp.
|
|
240
|
+
|
|
241
|
+
### Migrating off `colorSpace`
|
|
221
242
|
|
|
222
|
-
|
|
243
|
+
Drop the option. If you relied on the uniform output format, nothing in Tasty
|
|
244
|
+
needs it — author your tokens in the space you want them emitted in, since the
|
|
245
|
+
value now passes through untouched:
|
|
223
246
|
|
|
224
|
-
|
|
247
|
+
```jsx
|
|
248
|
+
// before: any input, normalized to the configured space on the way out
|
|
249
|
+
configure({ colorSpace: 'oklch', tokens: { '#brand': '#ff8800' } });
|
|
250
|
+
|
|
251
|
+
// after: author it in the space you want
|
|
252
|
+
configure({ tokens: { '#brand': 'oklch(0.75 0.16 55)' } });
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Migrating off the channel companions
|
|
256
|
+
|
|
257
|
+
A `#name` token used to declare a second variable beside `--name-color` holding
|
|
258
|
+
its channels decomposed, suffixed with the configured space —
|
|
259
|
+
`--brand-color-oklch: 0.75 0.16 55` — and a `color` style emitted
|
|
260
|
+
`--current-color-{space}` beside `--current-color`. Both are gone, for the same
|
|
261
|
+
reason: they existed so an opacity suffix had channels to write an alpha into.
|
|
262
|
+
|
|
263
|
+
These were never part of the public API, but they were visible in the emitted
|
|
264
|
+
CSS, so hand-authored CSS may reference one. Address the token itself instead:
|
|
265
|
+
|
|
266
|
+
```css
|
|
267
|
+
/* before */
|
|
268
|
+
color: oklch(var(--brand-color-oklch) / 0.5);
|
|
269
|
+
background: oklch(var(--brand-color-oklch));
|
|
270
|
+
|
|
271
|
+
/* after */
|
|
272
|
+
color: oklch(from var(--brand-color) l c h / 0.5);
|
|
273
|
+
background: var(--brand-color);
|
|
274
|
+
```
|
|
225
275
|
|
|
226
|
-
|
|
276
|
+
The replacement is strictly more capable — the companion could only be
|
|
277
|
+
decomposed for a color the engine could evaluate at build time, while relative
|
|
278
|
+
color syntax works on every `<color>`, including a `color-mix()`, a
|
|
279
|
+
`light-dark()`, and a variable Tasty never defined.
|
|
227
280
|
|
|
228
281
|
---
|
|
229
282
|
|
|
@@ -294,7 +347,7 @@ configure({
|
|
|
294
347
|
```
|
|
295
348
|
|
|
296
349
|
- `$name` keys become `--name` CSS custom properties
|
|
297
|
-
- `#name` keys become `--name-color`
|
|
350
|
+
- `#name` keys become `--name-color` custom properties
|
|
298
351
|
- Names keep their case, since CSS custom properties are case-sensitive: `$myVar` is `--myVar` and is referenced as `$myVar`. A leading capital is not supported and folds — `$Foo` and `#Purple` become `--foo` and `--purple-color` — so start names lowercase. Kebab-case (`$my-var`) remains the convention.
|
|
299
352
|
|
|
300
353
|
Tokens are automatically emitted in all rendering modes: runtime (client), SSR, and zero-runtime (Babel plugin).
|
|
@@ -416,7 +469,7 @@ See [Functions (`@function`)](dsl.md#functions-function) for inline usage inside
|
|
|
416
469
|
|
|
417
470
|
### Custom color functions
|
|
418
471
|
|
|
419
|
-
A parse function whose output is an already-supported color (`rgb`, `hsl`, `#…`, `oklch`, …) is treated as a **color function**: it works everywhere a color is accepted — style values, `#token.alpha` opacity injection,
|
|
472
|
+
A parse function whose output is an already-supported color (`rgb`, `hsl`, `#…`, `oklch`, …) is treated as a **color function**: it works everywhere a color is accepted — style values, `#token.alpha` opacity injection, and `parseColor` — with no extra registration. This is the same mechanism the built-in `okhsl`/`okhst` plugins use; they are ordinary plugins registered by default.
|
|
420
473
|
|
|
421
474
|
```ts
|
|
422
475
|
import { configure, createColorFunc } from '@tenphi/tasty';
|
package/docs/dsl.md
CHANGED
|
@@ -151,9 +151,9 @@ these:
|
|
|
151
151
|
|
|
152
152
|
- a token holding a `color-mix()`, a `light-dark()`, or a `color()` in a space
|
|
153
153
|
Tasty cannot convert — none of which have channels to decompose
|
|
154
|
-
- `#current`, which resolves to
|
|
154
|
+
- `#current`, which resolves to the color the element inherits
|
|
155
155
|
- a `--name-color` variable declared in your own CSS, with no Tasty token
|
|
156
|
-
definition
|
|
156
|
+
definition behind it
|
|
157
157
|
|
|
158
158
|
Two properties follow from writing the alpha slot rather than compositing:
|
|
159
159
|
|
|
@@ -163,6 +163,41 @@ Two properties follow from writing the alpha slot rather than compositing:
|
|
|
163
163
|
`/ var(--fade)` unchanged, so it works whether `$fade` holds `.5` or `50%` —
|
|
164
164
|
which is what `--*-opacity` properties are registered to accept.
|
|
165
165
|
|
|
166
|
+
### `#current` is the keyword
|
|
167
|
+
|
|
168
|
+
`#current` emits the `currentcolor` keyword, so it resolves against the element
|
|
169
|
+
that reads it. That is what lets it follow a color an ancestor faded — a ramp
|
|
170
|
+
that expresses its disabled state once, in `color`, fades everything painted from
|
|
171
|
+
`#current` below it with no further declarations.
|
|
172
|
+
|
|
173
|
+
The `color` style also publishes `--current-color` beside every color it sets,
|
|
174
|
+
for anything that needs the inherited color *as a color* rather than as the
|
|
175
|
+
keyword — hand-authored CSS, or a place the keyword will not do. Read it as
|
|
176
|
+
`$current-color`. It is registered with `initial-value: currentcolor`, so where
|
|
177
|
+
nothing published it, it still resolves against each element's own color:
|
|
178
|
+
|
|
179
|
+
```jsx
|
|
180
|
+
fill: '$current-color'; // → var(--current-color)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
A color that already reads the color it inherits — `#current`, a `#current` fade
|
|
184
|
+
— is not published into it: resolving such a value a second time at a descendant
|
|
185
|
+
would fade it twice.
|
|
186
|
+
|
|
187
|
+
One case needs the wider floor to be considered. A token *defined* as `#current`
|
|
188
|
+
and then faded gives relative color syntax a `currentcolor` origin, which Safari
|
|
189
|
+
supports only from 18:
|
|
190
|
+
|
|
191
|
+
```jsx
|
|
192
|
+
{ '#ink': '#current', fill: '#ink.5' }
|
|
193
|
+
// --ink-color: currentcolor
|
|
194
|
+
// fill: oklch(from currentcolor l c h / .5) → Chrome, Firefox, Safari 18+
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Put the fade in the token instead — `{ '#ink': '#current.5' }` — and it goes
|
|
198
|
+
through `color-mix()`, which works from Safari 16.2 and composes like every other
|
|
199
|
+
`#current` fade.
|
|
200
|
+
|
|
166
201
|
### `#current` composes instead
|
|
167
202
|
|
|
168
203
|
`#current` is the one exception, and the difference is deliberate. A token *names*
|
|
@@ -182,9 +217,9 @@ step. Because a `color-mix()` percentage cannot be a `<number>`, an opacity
|
|
|
182
217
|
custom property used as `#current.$fade` must hold a unitless number; a token
|
|
183
218
|
accepts either form.
|
|
184
219
|
|
|
185
|
-
The space is always `oklch
|
|
186
|
-
|
|
187
|
-
|
|
220
|
+
The space is always `oklch`: it is unbounded, so a wide-gamut color survives a
|
|
221
|
+
round trip that a gamut-limited space would clamp. Nothing configures this —
|
|
222
|
+
see [Color space](configuration.md#color-space).
|
|
188
223
|
|
|
189
224
|
---
|
|
190
225
|
|
package/docs/methodology.md
CHANGED
package/docs/pipeline.md
CHANGED
|
@@ -683,7 +683,7 @@ The default entry's exclusive is `!hovered & !@media(dark)` — no top-level OR,
|
|
|
683
683
|
|
|
684
684
|
### Stages 4–5: Compute combinations and call handler
|
|
685
685
|
|
|
686
|
-
Single style, three snapshots; the `color` handler emits `color` plus `--current-color
|
|
686
|
+
Single style, three snapshots; the `color` handler emits `color` plus a `--current-color` variable.
|
|
687
687
|
|
|
688
688
|
### Stage 6: Merge by value
|
|
689
689
|
|
|
@@ -697,20 +697,17 @@ Using `renderStyles(styles, '.t1')` (the class is doubled — `.t1.t1` — so Ta
|
|
|
697
697
|
.t1[data-hovered] {
|
|
698
698
|
color: var(--highlight-color);
|
|
699
699
|
--current-color: var(--highlight-color);
|
|
700
|
-
--current-color-oklch: var(--highlight-color-oklch);
|
|
701
700
|
}
|
|
702
701
|
@media (prefers-color-scheme: dark) {
|
|
703
702
|
.t1:not([data-hovered]) {
|
|
704
703
|
color: var(--dark-color);
|
|
705
704
|
--current-color: var(--dark-color);
|
|
706
|
-
--current-color-oklch: var(--dark-color-oklch);
|
|
707
705
|
}
|
|
708
706
|
}
|
|
709
707
|
@media (not (prefers-color-scheme: dark)) {
|
|
710
708
|
.t1:not([data-hovered]) {
|
|
711
709
|
color: var(--white-color);
|
|
712
710
|
--current-color: var(--white-color);
|
|
713
|
-
--current-color-oklch: var(--white-color-oklch);
|
|
714
711
|
}
|
|
715
712
|
}
|
|
716
713
|
```
|
package/docs/react-api.md
CHANGED
|
@@ -224,7 +224,7 @@ const ProgressBar = tasty({
|
|
|
224
224
|
|
|
225
225
|
<ProgressBar progress="75%" accentColor="#purple" />
|
|
226
226
|
// 'progress' → $progress → --progress
|
|
227
|
-
// 'accentColor' → #accent → --accent-color
|
|
227
|
+
// 'accentColor' → #accent → --accent-color
|
|
228
228
|
```
|
|
229
229
|
|
|
230
230
|
### Object form
|
package/docs/styles.md
CHANGED
|
@@ -290,7 +290,14 @@ Text color with design token support.
|
|
|
290
290
|
| `"light-dark(#dark, #light)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
|
|
291
291
|
| `true` | `currentColor` |
|
|
292
292
|
|
|
293
|
-
|
|
293
|
+
Also sets `$current-color` to the same color, for anything that needs the
|
|
294
|
+
inherited color as a color rather than as the `currentcolor` keyword. Every color
|
|
295
|
+
publishes it, not just a named token, so a reader below always takes the nearest
|
|
296
|
+
`color` rather than the nearest *token* color. A value that already reads the
|
|
297
|
+
inherited color — `#current` itself, a `#current` fade, a bare `currentColor` —
|
|
298
|
+
is not republished: resolving it a second time one level down would fade it
|
|
299
|
+
twice, and the variable into itself is a self-reference. `#current` does not go
|
|
300
|
+
through it; it is the keyword.
|
|
294
301
|
|
|
295
302
|
### `svgFill`
|
|
296
303
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenphi/tasty",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "A design-system-integrated styling system and DSL for concise, state-aware UI styling",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -178,19 +178,19 @@
|
|
|
178
178
|
"name": "main (import *)",
|
|
179
179
|
"path": "dist/index.js",
|
|
180
180
|
"import": "*",
|
|
181
|
-
"limit": "
|
|
181
|
+
"limit": "56.6 kB"
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
184
|
"name": "core (import *)",
|
|
185
185
|
"path": "dist/core/index.js",
|
|
186
186
|
"import": "*",
|
|
187
|
-
"limit": "
|
|
187
|
+
"limit": "53.65 kB"
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
"name": "static",
|
|
191
191
|
"path": "dist/static/index.js",
|
|
192
192
|
"import": "*",
|
|
193
|
-
"limit": "
|
|
193
|
+
"limit": "16.8 kB"
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
196
|
"name": "zero",
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
"path",
|
|
202
202
|
"crypto"
|
|
203
203
|
],
|
|
204
|
-
"limit": "
|
|
204
|
+
"limit": "31.25 kB"
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
207
|
"name": "babel-plugin",
|
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
"path",
|
|
213
213
|
"crypto"
|
|
214
214
|
],
|
|
215
|
-
"limit": "
|
|
215
|
+
"limit": "49.35 kB"
|
|
216
216
|
}
|
|
217
217
|
],
|
|
218
218
|
"scripts": {
|
|
@@ -235,6 +235,7 @@
|
|
|
235
235
|
"version": "changeset version",
|
|
236
236
|
"release": "changeset publish",
|
|
237
237
|
"knip": "knip",
|
|
238
|
+
"check:test-only": "node scripts/check-test-only-code.mjs",
|
|
238
239
|
"hygiene": "pnpm lint && pnpm format:check && pnpm typecheck",
|
|
239
240
|
"hygiene:fix": "pnpm lint:fix && pnpm format && pnpm typecheck"
|
|
240
241
|
}
|