@tenphi/tasty 0.13.1 → 0.14.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.
Files changed (66) hide show
  1. package/README.md +117 -28
  2. package/dist/config.d.ts +13 -1
  3. package/dist/config.js +5 -1
  4. package/dist/config.js.map +1 -1
  5. package/dist/core/index.d.ts +5 -3
  6. package/dist/core/index.js +4 -3
  7. package/dist/debug.d.ts +26 -141
  8. package/dist/debug.js +356 -635
  9. package/dist/debug.js.map +1 -1
  10. package/dist/index.d.ts +5 -3
  11. package/dist/index.js +4 -3
  12. package/dist/parser/classify.js +2 -1
  13. package/dist/parser/classify.js.map +1 -1
  14. package/dist/parser/parser.js +1 -1
  15. package/dist/plugins/okhsl-plugin.js +2 -275
  16. package/dist/plugins/okhsl-plugin.js.map +1 -1
  17. package/dist/plugins/types.d.ts +1 -1
  18. package/dist/properties/index.js +2 -15
  19. package/dist/properties/index.js.map +1 -1
  20. package/dist/ssr/format-property.js +9 -7
  21. package/dist/ssr/format-property.js.map +1 -1
  22. package/dist/styles/color.js +9 -5
  23. package/dist/styles/color.js.map +1 -1
  24. package/dist/styles/createStyle.js +24 -21
  25. package/dist/styles/createStyle.js.map +1 -1
  26. package/dist/styles/index.js +1 -1
  27. package/dist/styles/predefined.js +1 -1
  28. package/dist/styles/predefined.js.map +1 -1
  29. package/dist/styles/types.d.ts +1 -1
  30. package/dist/tasty.d.ts +6 -6
  31. package/dist/tasty.js +1 -1
  32. package/dist/types.d.ts +1 -1
  33. package/dist/utils/color-math.d.ts +46 -0
  34. package/dist/utils/color-math.js +749 -0
  35. package/dist/utils/color-math.js.map +1 -0
  36. package/dist/utils/color-space.d.ts +5 -0
  37. package/dist/utils/color-space.js +229 -0
  38. package/dist/utils/color-space.js.map +1 -0
  39. package/dist/utils/colors.js +3 -1
  40. package/dist/utils/colors.js.map +1 -1
  41. package/dist/utils/mod-attrs.js +1 -1
  42. package/dist/utils/mod-attrs.js.map +1 -1
  43. package/dist/utils/process-tokens.d.ts +3 -13
  44. package/dist/utils/process-tokens.js +18 -98
  45. package/dist/utils/process-tokens.js.map +1 -1
  46. package/dist/utils/styles.d.ts +2 -15
  47. package/dist/utils/styles.js +22 -217
  48. package/dist/utils/styles.js.map +1 -1
  49. package/docs/PIPELINE.md +519 -0
  50. package/docs/README.md +30 -0
  51. package/docs/adoption.md +10 -2
  52. package/docs/comparison.md +11 -6
  53. package/docs/configuration.md +26 -3
  54. package/docs/debug.md +152 -339
  55. package/docs/dsl.md +3 -1
  56. package/docs/getting-started.md +21 -7
  57. package/docs/injector.md +2 -2
  58. package/docs/runtime.md +59 -9
  59. package/docs/ssr.md +2 -2
  60. package/docs/styles.md +1 -1
  61. package/docs/tasty-static.md +13 -2
  62. package/package.json +4 -3
  63. package/dist/utils/hsl-to-rgb.js +0 -38
  64. package/dist/utils/hsl-to-rgb.js.map +0 -1
  65. package/dist/utils/okhsl-to-rgb.js +0 -296
  66. package/dist/utils/okhsl-to-rgb.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  # Configuration
2
2
 
3
- Configure the Tasty style system before your app renders using the `configure()` function. Configuration must be done **before any styles are generated** (before first render).
3
+ Configure the Tasty style system before your app renders using the `configure()` function. Configuration must be done **before any styles are generated** (before first render). For a higher-level docs map, see the [Docs Hub](README.md).
4
4
 
5
5
  ```jsx
6
6
  import { configure } from '@tenphi/tasty';
@@ -13,7 +13,7 @@ configure({
13
13
  states: {
14
14
  '@mobile': '@media(w < 768px)',
15
15
  '@tablet': '@media(768px <= w < 1024px)',
16
- '@dark': '@root(theme=dark)',
16
+ '@dark': '@root(schema=dark)',
17
17
  },
18
18
 
19
19
  // Parser configuration
@@ -36,6 +36,8 @@ configure({
36
36
  });
37
37
  ```
38
38
 
39
+ These docs use `data-schema="dark"` in examples. If your app already standardizes on a different attribute such as `data-theme`, keep the same pattern and swap the attribute name consistently everywhere you define root-state aliases.
40
+
39
41
  ---
40
42
 
41
43
  ## Options
@@ -54,6 +56,27 @@ configure({
54
56
  | `properties` | `Record<string, PropertyDefinition>` | - | Global CSS @property definitions |
55
57
  | `autoPropertyTypes` | `boolean` | `true` | Auto-infer and register `@property` types from values |
56
58
  | `recipes` | `Record<string, RecipeStyles>` | - | Predefined style recipes (named style bundles) |
59
+ | `colorSpace` | `'rgb' \| 'hsl' \| 'oklch'` | `'oklch'` | Color space for decomposed color token companion variables |
60
+
61
+ ---
62
+
63
+ ## Color Space
64
+
65
+ Controls the CSS color space used for decomposed color token companion variables. When you define `#name` color tokens, tasty generates both `--name-color` (full color) and `--name-color-{suffix}` (decomposed components for alpha composition).
66
+
67
+ ```jsx
68
+ configure({
69
+ colorSpace: 'oklch', // default
70
+ });
71
+ ```
72
+
73
+ | Color Space | Suffix | Components Format | Alpha Syntax |
74
+ |---|---|---|---|
75
+ | `rgb` | `-rgb` | `255 128 0` | `rgb(var(--name-color-rgb) / .5)` |
76
+ | `hsl` | `-hsl` | `300 100% 25%` | `hsl(var(--name-color-hsl) / .5)` |
77
+ | `oklch` | `-oklch` | `0.42 0.16 328` | `oklch(var(--name-color-oklch) / .5)` |
78
+
79
+ The `oklch` color space is the default because it provides perceptually uniform color manipulation — alpha fading and color mixing produce more natural-looking results.
57
80
 
58
81
  ---
59
82
 
@@ -81,7 +104,7 @@ configure({
81
104
  ```
82
105
 
83
106
  - `$name` keys become `--name` CSS custom properties
84
- - `#name` keys become `--name-color` and `--name-color-rgb` properties
107
+ - `#name` keys become `--name-color` and `--name-color-{colorSpace}` properties (suffix depends on `colorSpace`, default `oklch`)
85
108
 
86
109
  Tokens are automatically emitted in all rendering modes: runtime (client), SSR, and zero-runtime (Babel plugin).
87
110